Implemented loot_apply_load_order.

Also improved constness of parameters.