(svn r5146) - NewGRF: Support selection of aircraft default cargo type by checking its refit mask. If aircraft can be refitted to passengers, no change happens, else the first refittable type is chosen. Also use refit capacity to determine the default capacity.

This commit is contained in:
peter1138
2006-06-07 07:20:28 +00:00
parent 4a26eb083b
commit d286235a6a
3 changed files with 76 additions and 0 deletions

View File

@@ -692,6 +692,25 @@ bool CanRefitTo(EngineID engine_type, CargoID cid_to)
return HASBIT(EngInfo(engine_type)->refit_mask, cid);
}
/** Find the first cargo type that an engine can be refitted to.
* @param engine Which engine to find cargo for.
* @return A climate dependent cargo type. CT_INVALID is returned if not refittable.
*/
CargoID FindFirstRefittableCargo(EngineID engine_type)
{
CargoID cid;
uint32 refit_mask = EngInfo(engine_type)->refit_mask;
if (refit_mask != 0) {
for (cid = CT_PASSENGERS; cid < NUM_CARGO; cid++) {
if (HASBIT(refit_mask, _global_cargo_id[_opt_ptr->landscape][cid])) return cid;
}
}
return CT_INVALID;
}
static void DoDrawVehicle(const Vehicle *v)
{
uint32 image = v->cur_image;