summaryrefslogtreecommitdiff
path: root/src/aircraft_cmd.cpp
diff options
context:
space:
mode:
authorMatt Kimber <github@mattkimber.org.uk>2021-01-03 13:32:58 +0000
committerPatric Stout <github@truebrain.nl>2021-01-05 11:42:25 +0100
commit9b28b15e677e0de64fde270f4223daeb401cfcac (patch)
tree879ebd9b98d9ce4e8a45dd38b9033f3da9349080 /src/aircraft_cmd.cpp
parenteeb88e87d8c7b62e0bac94ede44cceee987b8d09 (diff)
downloadopenttd-9b28b15e677e0de64fde270f4223daeb401cfcac.tar.xz
Codechange: create MutableSpriteCache to remove the need to cast Vehicle to a mutable type in render methods
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r--src/aircraft_cmd.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 447615e3b..c381fae97 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -341,8 +341,8 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
v->date_of_last_service = _date;
v->build_year = u->build_year = _cur_year;
- v->sprite_seq.Set(SPR_IMG_QUERY);
- u->sprite_seq.Set(SPR_IMG_QUERY);
+ v->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY);
+ u->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY);
v->random_bits = VehicleRandomBits();
u->random_bits = VehicleRandomBits();
@@ -374,7 +374,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
w->vehstatus = VS_HIDDEN | VS_UNCLICKABLE;
w->spritenum = 0xFF;
w->subtype = AIR_ROTOR;
- w->sprite_seq.Set(SPR_ROTOR_STOPPED);
+ w->sprite_cache.sprite_seq.Set(SPR_ROTOR_STOPPED);
w->random_bits = VehicleRandomBits();
/* Use rotor's air.state to store the rotor animation frame */
w->state = HRS_ROTOR_STOPPED;
@@ -497,7 +497,7 @@ static void HelicopterTickHandler(Aircraft *v)
if (spd == 0) {
u->state = HRS_ROTOR_STOPPED;
GetRotorImage(v, EIT_ON_MAP, &seq);
- if (u->sprite_seq == seq) return;
+ if (u->sprite_cache.sprite_seq == seq) return;
} else if (tick >= spd) {
u->tick_counter = 0;
u->state++;
@@ -507,7 +507,7 @@ static void HelicopterTickHandler(Aircraft *v)
return;
}
- u->sprite_seq = seq;
+ u->sprite_cache.sprite_seq = seq;
u->UpdatePositionAndViewport();
}
@@ -528,7 +528,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
v->UpdatePosition();
v->UpdateViewport(true, false);
if (v->subtype == AIR_HELICOPTER) {
- GetRotorImage(v, EIT_ON_MAP, &v->Next()->Next()->sprite_seq);
+ GetRotorImage(v, EIT_ON_MAP, &v->Next()->Next()->sprite_cache.sprite_seq);
}
Aircraft *u = v->Next();
@@ -540,7 +540,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
safe_y = Clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE);
u->z_pos = GetSlopePixelZ(safe_x, safe_y);
- u->sprite_seq.CopyWithoutPalette(v->sprite_seq); // the shadow is never coloured
+ u->sprite_cache.sprite_seq.CopyWithoutPalette(v->sprite_cache.sprite_seq); // the shadow is never coloured
u->UpdatePositionAndViewport();
@@ -1278,7 +1278,7 @@ void Aircraft::MarkDirty()
this->colourmap = PAL_NONE;
this->UpdateViewport(true, false);
if (this->subtype == AIR_HELICOPTER) {
- GetRotorImage(this, EIT_ON_MAP, &this->Next()->Next()->sprite_seq);
+ GetRotorImage(this, EIT_ON_MAP, &this->Next()->Next()->sprite_cache.sprite_seq);
}
}