equal
deleted
inserted
replaced
687 * @return true if it is possible, false otherwise |
687 * @return true if it is possible, false otherwise |
688 */ |
688 */ |
689 bool CanRefitTo(const Vehicle *v, CargoID cid_to) |
689 bool CanRefitTo(const Vehicle *v, CargoID cid_to) |
690 { |
690 { |
691 CargoID cid = _global_cargo_id[_opt_ptr->landscape][cid_to]; |
691 CargoID cid = _global_cargo_id[_opt_ptr->landscape][cid_to]; |
692 |
692 return HASBIT(_engine_info[v->engine_type].refit_mask, cid) != 0; |
693 if (cid == GC_INVALID) return false; |
|
694 |
|
695 if (_engine_refit_masks[v->engine_type]) { |
|
696 if (!HASBIT(_engine_refit_masks[v->engine_type], cid)) return false; |
|
697 } else { |
|
698 /* If we are talking about normal vehicles (no newgrf), you can only refit engines */ |
|
699 if (v->type == VEH_Train && (RailVehInfo(v->engine_type)->flags & RVI_WAGON)) return false; |
|
700 if (!HASBIT(_default_refitmasks[v->type - VEH_Train], cid)) return false; |
|
701 } |
|
702 |
|
703 return true; |
|
704 } |
693 } |
705 |
694 |
706 static void DoDrawVehicle(const Vehicle *v) |
695 static void DoDrawVehicle(const Vehicle *v) |
707 { |
696 { |
708 uint32 image = v->cur_image; |
697 uint32 image = v->cur_image; |