summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-01-30 11:53:35 +0000
committerbelugas <belugas@openttd.org>2007-01-30 11:53:35 +0000
commit0c45071bb018aab652f81b594cffa5b2c4ded0d4 (patch)
treed001f734f6111d6fe12abd4a122d09903325335c /src/newgrf.cpp
parente3b63e6d8327b800a2d318d8f30ef72f3b39f33e (diff)
downloadopenttd-0c45071bb018aab652f81b594cffa5b2c4ded0d4.tar.xz
(svn r8455) -Codechange: Give a more meaningful name (railveh_type)to member flags of RailVehInfo, as well as changing the code to reflect the fact that it was not a flag but rather a one value only variable. Doing so, some evaluations have been simplified.
-Codechange: Add and use RAILVEH_SINGLEHEAD when railveh_type is set to 0, which was implicit before. -Cleanup: Remove some extraneous parenthesis.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index b8fda928d..b8a5b8073 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -215,10 +215,10 @@ static void dewagonize(int condition, int engine)
if (condition != 0) {
ei->unk2 &= ~0x80;
- rvi->flags &= ~2;
+ rvi->railveh_type = RAILVEH_SINGLEHEAD;
} else {
ei->unk2 |= 0x80;
- rvi->flags |= 2;
+ rvi->railveh_type = RAILVEH_WAGON;
}
}
@@ -265,7 +265,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT {
uint16 power = grf_load_word(&buf);
- if (rvi[i].flags & RVI_MULTIHEAD) power /= 2;
+ if (rvi[i].railveh_type == RAILVEH_MULTIHEAD) power /= 2;
rvi[i].power = power;
dewagonize(power, engine + i);
@@ -276,7 +276,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT {
uint8 runcostfact = grf_load_byte(&buf);
- if (rvi[i].flags & RVI_MULTIHEAD) runcostfact /= 2;
+ if (rvi[i].railveh_type == RAILVEH_MULTIHEAD) runcostfact /= 2;
rvi[i].running_cost_base = runcostfact;
}
@@ -315,19 +315,19 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
uint8 dual = grf_load_byte(&buf);
if (dual != 0) {
- if (!(rvi[i].flags & RVI_MULTIHEAD)) {
+ if (rvi[i].railveh_type != RAILVEH_MULTIHEAD) {
// adjust power and running cost if needed
rvi[i].power /= 2;
rvi[i].running_cost_base /= 2;
}
- rvi[i].flags |= RVI_MULTIHEAD;
+ rvi[i].railveh_type = RAILVEH_MULTIHEAD;
} else {
- if (rvi[i].flags & RVI_MULTIHEAD) {
+ if (rvi[i].railveh_type == RAILVEH_MULTIHEAD) {
// adjust power and running cost if needed
rvi[i].power *= 2;
rvi[i].running_cost_base *= 2;
}
- rvi[i].flags &= ~RVI_MULTIHEAD;
+ rvi[i].railveh_type = RAILVEH_SINGLEHEAD;
}
}
break;
@@ -3588,7 +3588,7 @@ static void CalculateRefitMasks(void)
if (xor_mask == 0 && (
GetEngine(engine)->type != VEH_Train || (
RailVehInfo(engine)->capacity != 0 &&
- !(RailVehInfo(engine)->flags & RVI_WAGON)
+ RailVehInfo(engine)->railveh_type != RAILVEH_WAGON
)
)) {
xor_mask = _default_refitmasks[GetEngine(engine)->type - VEH_Train];
@@ -3801,3 +3801,4 @@ void LoadNewGRF(uint load_index, uint file_index)
+