Mercurial > hg > openttd
changeset 6175:d8e9bbb53e7d draft
(svn r8945) -Codechange: Rename v->load_status to v->vehicle_flags so it can be used for more than just the gradual loading status.
author | maedhros <maedhros@openttd.org> |
---|---|
date | Wed, 28 Feb 2007 17:18:36 +0000 |
parents | c9f5e97572a4 |
children | 863c86137fc1 |
files | src/aircraft_cmd.cpp src/economy.cpp src/openttd.cpp src/roadveh_cmd.cpp src/ship_cmd.cpp src/train_cmd.cpp src/vehicle.cpp src/vehicle.h |
diffstat | 8 files changed, 20 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1284,7 +1284,7 @@ if (CanFillVehicle(v) && ( v->current_order.flags & OF_FULL_LOAD || - (_patches.gradual_loading && !HASBIT(v->load_status, LS_LOADING_FINISHED)) + (_patches.gradual_loading && !HASBIT(v->vehicle_flags, VF_LOADING_FINISHED)) )) { SET_EXPENSES_TYPE(EXPENSES_AIRCRAFT_INC); if (LoadUnloadVehicle(v, false)) {
--- a/src/economy.cpp +++ b/src/economy.cpp @@ -1352,7 +1352,7 @@ * there is nothing left to load. It's easier to clear this if the * conditions haven't been met than attempting to check them all before * enabling though. */ - SETBIT(v->load_status, LS_LOADING_FINISHED); + SETBIT(v->vehicle_flags, VF_LOADING_FINISHED); old_player = _current_player; _current_player = v->owner; @@ -1371,16 +1371,16 @@ if (v->cargo_cap == 0) continue; /* If the vehicle has just arrived, set it to unload. */ - if (just_arrived) SETBIT(v->load_status, LS_CARGO_UNLOADING); + if (just_arrived) SETBIT(v->vehicle_flags, VF_CARGO_UNLOADING); ge = &st->goods[v->cargo_type]; count = GB(ge->waiting_acceptance, 0, 12); /* unload? */ - if (v->cargo_count != 0 && HASBIT(v->load_status, LS_CARGO_UNLOADING)) { + if (v->cargo_count != 0 && HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING)) { uint16 amount_unloaded = _patches.gradual_loading ? min(v->cargo_count, load_amount) : v->cargo_count; - CLRBIT(u->load_status, LS_LOADING_FINISHED); + CLRBIT(u->vehicle_flags, VF_LOADING_FINISHED); if (v->cargo_source != last_visited && ge->waiting_acceptance & 0x8000 && !(u->current_order.flags & OF_TRANSFER)) { /* deliver goods to the station */ @@ -1442,8 +1442,8 @@ } /* The vehicle must have been unloaded because it is either empty, or - * the UNLOADING bit is already clear in v->load_status. */ - CLRBIT(v->load_status, LS_CARGO_UNLOADING); + * the UNLOADING bit is already clear in v->vehicle_flags. */ + CLRBIT(v->vehicle_flags, VF_CARGO_UNLOADING); /* We cannot have paid for more cargo than there is on board. */ assert(v->cargo_paid_for <= v->cargo_count); @@ -1488,7 +1488,7 @@ if (cap > count) cap = count; if (_patches.gradual_loading) cap = min(cap, load_amount); - if (cap < count) CLRBIT(u->load_status, LS_LOADING_FINISHED); + if (cap < count) CLRBIT(u->vehicle_flags, VF_LOADING_FINISHED); cargoshare = cap * 10000 / ge->waiting_acceptance; feeder_profit_share = ge->feeder_profit * cargoshare / 10000; v->cargo_count += cap; @@ -1515,7 +1515,7 @@ uint gradual_loading_wait_time[] = { 40, 20, 10, 20 }; unloading_time = gradual_loading_wait_time[v->type]; - if (HASBIT(v->load_status, LS_LOADING_FINISHED)) { + if (HASBIT(v->vehicle_flags, VF_LOADING_FINISHED)) { if (anything_loaded) { unloading_time += 20; } else {
--- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1799,9 +1799,9 @@ * loading again, even if it didn't actually load anything, so now the * amount of cargo that has been paid for is stored. */ FOR_ALL_VEHICLES(v) { - if (HASBIT(v->load_status, 2)) { + if (HASBIT(v->vehicle_flags, 2)) { v->cargo_paid_for = v->cargo_count; - CLRBIT(v->load_status, 2); + CLRBIT(v->vehicle_flags, 2); } else { v->cargo_paid_for = 0; }
--- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -748,7 +748,7 @@ if (--v->load_unload_time_rem != 0) return; if (CanFillVehicle(v) && (v->current_order.flags & OF_FULL_LOAD || - (_patches.gradual_loading && !HASBIT(v->load_status, LS_LOADING_FINISHED)))) { + (_patches.gradual_loading && !HASBIT(v->vehicle_flags, VF_LOADING_FINISHED)))) { SET_EXPENSES_TYPE(EXPENSES_ROADVEH_INC); if (LoadUnloadVehicle(v, false)) { InvalidateWindow(WC_ROADVEH_LIST, v->owner);
--- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -306,7 +306,7 @@ if (CanFillVehicle(v) && ( v->current_order.flags & OF_FULL_LOAD || - (_patches.gradual_loading && !HASBIT(v->load_status, LS_LOADING_FINISHED)) + (_patches.gradual_loading && !HASBIT(v->vehicle_flags, VF_LOADING_FINISHED)) )) { SET_EXPENSES_TYPE(EXPENSES_SHIP_INC); if (LoadUnloadVehicle(v, false)) {
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2515,7 +2515,7 @@ if (CanFillVehicle(v) && ( v->current_order.flags & OF_FULL_LOAD || - (_patches.gradual_loading && !HASBIT(v->load_status, LS_LOADING_FINISHED)) + (_patches.gradual_loading && !HASBIT(v->vehicle_flags, VF_LOADING_FINISHED)) )) { v->u.rail.days_since_order_progr = 0; /* Prevent a train lost message for full loading trains */ SET_EXPENSES_TYPE(EXPENSES_TRAIN_INC);
--- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -718,7 +718,7 @@ if (v->cargo_cap == v->cargo_count) { full |= mask; } else if (GB(ge[v->cargo_type].waiting_acceptance, 0, 12) > 0 || - (HASBIT(v->load_status, LS_CARGO_UNLOADING) && (ge[v->cargo_type].waiting_acceptance & 0x8000))) { + (HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING) && (ge[v->cargo_type].waiting_acceptance & 0x8000))) { /* If there is any cargo waiting, or this vehicle is still unloading * and the station accepts the cargo, don't leave the station. */ keep_loading = true; @@ -3049,7 +3049,7 @@ SLE_VAR(Vehicle, load_unload_time_rem, SLE_UINT16), SLE_CONDVAR(Vehicle, cargo_paid_for, SLE_UINT16, 45, SL_MAX_VERSION), - SLE_CONDVAR(Vehicle, load_status, SLE_UINT8, 40, SL_MAX_VERSION), + SLE_CONDVAR(Vehicle, vehicle_flags, SLE_UINT8, 40, SL_MAX_VERSION), SLE_VAR(Vehicle, profit_this_year, SLE_INT32), SLE_VAR(Vehicle, profit_last_year, SLE_INT32),
--- a/src/vehicle.h +++ b/src/vehicle.h @@ -83,10 +83,9 @@ VS_CRASHED = 0x80, }; -enum LoadStatus { - LS_LOADING_FINISHED, - LS_CARGO_UNLOADING, - /* LS_CARGO_PAID_FOR was here until savegame version 45. */ +enum VehicleFlags { + VF_LOADING_FINISHED, + VF_CARGO_UNLOADING, }; /* Effect vehicle types */ @@ -294,7 +293,7 @@ uint16 load_unload_time_rem; uint16 cargo_paid_for; // How much of the cargo currently on board has been paid for. - byte load_status; + byte vehicle_flags; // Used for gradual loading and other miscellaneous things (@see VehicleFlags enum) int32 profit_this_year; int32 profit_last_year;