summaryrefslogtreecommitdiff
path: root/src/aircraft_cmd.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-08-17 11:59:52 +0000
committeryexo <yexo@openttd.org>2010-08-17 11:59:52 +0000
commitc263f2530939572ef3d480f6c92057bcdf2fe97a (patch)
treed6184c2eeb41fbb59ba82e2a1af73bc8b4af5bef /src/aircraft_cmd.cpp
parentcf1f337e4d39adc7d02acf15648ef6372ebe4451 (diff)
downloadopenttd-c263f2530939572ef3d480f6c92057bcdf2fe97a.tar.xz
(svn r20525) -Codechange: make Aircraft::UpdateDeltaXY more readable by removing the MKIT macro
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r--src/aircraft_cmd.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index c3ea73416..b403e137e 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -45,30 +45,39 @@
void Aircraft::UpdateDeltaXY(Direction direction)
{
- uint32 x;
-#define MKIT(a, b, c, d) ((a & 0xFF) << 24) | ((b & 0xFF) << 16) | ((c & 0xFF) << 8) | ((d & 0xFF) << 0)
+ this->x_offs = -1;
+ this->y_offs = -1;
+ this->x_extent = 2;
+ this->y_extent = 2;
+
switch (this->subtype) {
default: NOT_REACHED();
+
case AIR_AIRCRAFT:
case AIR_HELICOPTER:
switch (this->state) {
+ default: break;
case ENDTAKEOFF:
case LANDING:
case HELILANDING:
- case FLYING: x = MKIT(24, 24, -1, -1); break;
- default: x = MKIT( 2, 2, -1, -1); break;
+ case FLYING:
+ this->x_extent = 24;
+ this->y_extent = 24;
+ break;
}
this->z_extent = 5;
break;
- case AIR_SHADOW: this->z_extent = 1; x = MKIT(2, 2, 0, 0); break;
- case AIR_ROTOR: this->z_extent = 1; x = MKIT(2, 2, -1, -1); break;
- }
-#undef MKIT
- this->x_offs = GB(x, 0, 8);
- this->y_offs = GB(x, 8, 8);
- this->x_extent = GB(x, 16, 8);
- this->y_extent = GB(x, 24, 8);
+ case AIR_SHADOW:
+ this->z_extent = 1;
+ this->x_offs = 0;
+ this->y_offs = 0;
+ break;
+
+ case AIR_ROTOR:
+ this->z_extent = 1;
+ break;
+ }
}
static bool AirportMove(Aircraft *v, const AirportFTAClass *apc);