summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/economy.cpp16
-rw-r--r--src/openttd.cpp4
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/vehicle.cpp4
-rw-r--r--src/vehicle.h9
8 files changed, 20 insertions, 21 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index c088bb388..fe5d371be 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1284,7 +1284,7 @@ static void HandleAircraftLoading(Vehicle *v, int mode)
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)) {
diff --git a/src/economy.cpp b/src/economy.cpp
index 41bcc4237..24e4c9515 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1352,7 +1352,7 @@ int LoadUnloadVehicle(Vehicle *v, bool just_arrived)
* 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 @@ int LoadUnloadVehicle(Vehicle *v, bool just_arrived)
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 @@ int LoadUnloadVehicle(Vehicle *v, bool just_arrived)
}
/* 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 @@ int LoadUnloadVehicle(Vehicle *v, bool just_arrived)
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 @@ int LoadUnloadVehicle(Vehicle *v, bool just_arrived)
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 {
diff --git a/src/openttd.cpp b/src/openttd.cpp
index e34c30825..a80ac44b3 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1799,9 +1799,9 @@ bool AfterLoadGame(void)
* 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;
}
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 5caaaf8a1..9fc8204cf 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -748,7 +748,7 @@ static void HandleRoadVehLoading(Vehicle *v)
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);
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index d1af28144..618fcdbb6 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -306,7 +306,7 @@ static void HandleShipLoading(Vehicle *v)
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)) {
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 31f7b1700..56d09cbda 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2515,7 +2515,7 @@ static void HandleTrainLoading(Vehicle *v, bool mode)
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);
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 09e889dac..bcca91fe3 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -718,7 +718,7 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v)
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 @@ extern const SaveLoad _common_veh_desc[] = {
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),
diff --git a/src/vehicle.h b/src/vehicle.h
index a0b7fb875..d14da3a7f 100644
--- a/src/vehicle.h
+++ b/src/vehicle.h
@@ -83,10 +83,9 @@ enum VehStatus {
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 @@ struct Vehicle {
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;