From 83a880c882992efb1b949b26ac881abc3825964f Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 1 Jul 2007 19:11:47 +0000 Subject: (svn r10408) -Codechange: make GetImage a class method of Vehicle instead of Get(Aircraft|RoadVeh|Ship|Train)Image. --- src/ship_cmd.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/ship_cmd.cpp') diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index f98fde144..555af11b5 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -90,15 +90,15 @@ void GetShipSpriteSize(EngineID engine, uint &width, uint &height) height = spr->height; } -int GetShipImage(const Vehicle* v, Direction direction) +int Ship::GetImage(Direction direction) const { - int spritenum = v->spritenum; + int spritenum = this->spritenum; if (is_custom_sprite(spritenum)) { - int sprite = GetCustomVehicleSprite(v, direction); + int sprite = GetCustomVehicleSprite(this, direction); if (sprite != 0) return sprite; - spritenum = orig_ship_vehicle_info[v->engine_type - SHIP_ENGINES_INDEX].image_index; + spritenum = orig_ship_vehicle_info[this->engine_type - SHIP_ENGINES_INDEX].image_index; } return _ship_sprites[spritenum] + direction; } @@ -233,7 +233,7 @@ static void HandleBrokenShip(Vehicle *v) void Ship::MarkDirty() { - this->cur_image = GetShipImage(this, this->direction); + this->cur_image = this->GetImage(this->direction); MarkAllViewportsDirty(this->left_coord, this->top_coord, this->right_coord + 1, this->bottom_coord + 1); } @@ -337,7 +337,7 @@ void Ship::UpdateDeltaXY(Direction direction) void RecalcShipStuff(Vehicle *v) { v->UpdateDeltaXY(v->direction); - v->cur_image = GetShipImage(v, v->direction); + v->cur_image = v->GetImage(v->direction); v->MarkDirty(); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); } @@ -770,7 +770,7 @@ static void ShipController(Vehicle *v) getout: v->UpdateDeltaXY(dir); - v->cur_image = GetShipImage(v, dir); + v->cur_image = v->GetImage(dir); VehiclePositionChanged(v); EndVehicleMove(v); return; -- cgit v1.2.3-54-g00ecf