summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-09-26 19:01:49 +0000
committerpeter1138 <peter1138@openttd.org>2005-09-26 19:01:49 +0000
commitfbf06041ca6ae5a7429ba7342480fca25ab442ed (patch)
tree95e2e84c3e59ea54f0c38d658b37ca313bc134f9
parent2314431a596c25b7e48cfbc7dda452c66cd5ca32 (diff)
downloadopenttd-fbf06041ca6ae5a7429ba7342480fca25ab442ed.tar.xz
(svn r2990) Remove _engine_original_sprites and replace all uses with references to our (new) original engine/vehicle tables.
-rw-r--r--aircraft_cmd.c4
-rw-r--r--engine.h1
-rw-r--r--newgrf.c17
-rw-r--r--roadveh_cmd.c4
-rw-r--r--ship_cmd.c4
-rw-r--r--train_cmd.c6
6 files changed, 9 insertions, 27 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 14379d5b2..69b008be7 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -97,7 +97,7 @@ int GetAircraftImage(const Vehicle *v, byte direction)
int sprite = GetCustomVehicleSprite(v, direction);
if (sprite) return sprite;
- spritenum = _engine_original_sprites[v->engine_type];
+ spritenum = orig_aircraft_vehicle_info[v->engine_type - AIRCRAFT_ENGINES_INDEX].image_index;
}
return direction + _aircraft_sprite[spritenum];
}
@@ -110,7 +110,7 @@ void DrawAircraftEngine(int x, int y, int engine, uint32 image_ormod)
if (is_custom_sprite(spritenum)) {
sprite = GetCustomVehicleIcon(engine, 6);
if (!sprite)
- sprite = _engine_original_sprites[engine];
+ spritenum = orig_aircraft_vehicle_info[engine - AIRCRAFT_ENGINES_INDEX].image_index;
}
DrawSprite(sprite | image_ormod, x, y);
diff --git a/engine.h b/engine.h
index a851dda4c..d672d82d4 100644
--- a/engine.h
+++ b/engine.h
@@ -172,7 +172,6 @@ VARDEF const uint32 _landscape_global_cargo_mask[NUM_LANDSCAPE];
VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID];
VARDEF uint32 _engine_refit_masks[256];
-VARDEF byte _engine_original_sprites[256];
void SetWagonOverrideSprites(byte engine, struct SpriteGroup *group, byte *train_id, int trains);
void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteGroup *group);
// loaded is in percents, overriding_engine 0xffff is none
diff --git a/newgrf.c b/newgrf.c
index e204f30be..ef9d161e2 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -272,8 +272,6 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT {
uint8 spriteid = grf_load_byte(&buf);
- if (spriteid == 0xFD && rvi[i].image_index != 0xFD)
- _engine_original_sprites[engine + i] = rvi[i].image_index;
rvi[i].image_index = spriteid;
}
} break;
@@ -448,11 +446,6 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
if (spriteid == 0xFF)
spriteid = 0xFD; // cars have different custom id in the GRF file
- // This is currently not used but there's no reason
- // in not having it here for the future.
- if (spriteid == 0xFD && rvi[i].image_index != 0xFD)
- _engine_original_sprites[ROAD_ENGINES_INDEX + engine + i] = rvi[i].image_index;
-
rvi[i].image_index = spriteid;
}
} break;
@@ -539,11 +532,6 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
if (spriteid == 0xFF)
spriteid = 0xFD; // ships have different custom id in the GRF file
- // This is currently not used but there's no reason
- // in not having it here for the future.
- if (spriteid == 0xFD && svi[i].image_index != 0xFD)
- _engine_original_sprites[SHIP_ENGINES_INDEX + engine + i] = svi[i].image_index;
-
svi[i].image_index = spriteid;
}
} break;
@@ -646,11 +634,6 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte *
if (spriteid == 0xFF)
spriteid = 0xFD; // ships have different custom id in the GRF file
- // This is currently not used but there's no reason
- // in not having it here for the future.
- if (spriteid == 0xFD && avi[i].image_index != 0xFD)
- _engine_original_sprites[AIRCRAFT_ENGINES_INDEX + engine + i] = avi[i].image_index;
-
avi[i].image_index = spriteid;
}
} break;
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 0e544b1f5..db1a7778b 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -68,7 +68,7 @@ int GetRoadVehImage(const Vehicle *v, byte direction)
if (is_custom_sprite(img)) {
image = GetCustomVehicleSprite(v, direction);
if (image) return image;
- img = _engine_original_sprites[v->engine_type];
+ img = orig_road_vehicle_info[v->engine_type - ROAD_ENGINES_INDEX].image_index;
}
image = direction + _roadveh_images[img];
@@ -88,7 +88,7 @@ void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod)
DrawSprite(sprite | image_ormod, x, y);
return;
}
- spritenum = _engine_original_sprites[engine];
+ spritenum = orig_road_vehicle_info[engine - ROAD_ENGINES_INDEX].image_index;
}
DrawSprite((6 + _roadveh_images[spritenum]) | image_ormod, x, y);
}
diff --git a/ship_cmd.c b/ship_cmd.c
index cc14449c4..ac67056ca 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -39,7 +39,7 @@ void DrawShipEngine(int x, int y, int engine, uint32 image_ormod)
DrawSprite(sprite | image_ormod, x, y);
return;
}
- spritenum = _engine_original_sprites[engine];
+ spritenum = orig_ship_vehicle_info[engine - SHIP_ENGINES_INDEX].image_index;
}
DrawSprite((6 + _ship_sprites[spritenum]) | image_ormod, x, y);
}
@@ -52,7 +52,7 @@ int GetShipImage(const Vehicle *v, byte direction)
int sprite = GetCustomVehicleSprite(v, direction);
if (sprite) return sprite;
- spritenum = _engine_original_sprites[v->engine_type];
+ spritenum = orig_ship_vehicle_info[v->engine_type - SHIP_ENGINES_INDEX].image_index;
}
return _ship_sprites[spritenum] + direction;
}
diff --git a/train_cmd.c b/train_cmd.c
index c863115f6..b9687da4d 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -354,7 +354,7 @@ int GetTrainImage(const Vehicle *v, byte direction)
if (is_custom_sprite(img)) {
base = GetCustomVehicleSprite(v, direction + 4 * IS_CUSTOM_SECONDHEAD_SPRITE(img));
if (base != 0) return base;
- img = _engine_original_sprites[v->engine_type];
+ img = orig_rail_vehicle_info[v->engine_type].image_index;
}
base = _engine_sprite_base[img] + ((direction + _engine_sprite_add[img]) & _engine_sprite_and[img]);
@@ -373,7 +373,7 @@ void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod)
if (is_custom_sprite(img)) {
image = GetCustomVehicleIcon(engine, 6);
- if (image == 0) img = _engine_original_sprites[engine];
+ if (image == 0) img = orig_rail_vehicle_info[engine].image_index;
}
if (image == 0) {
image = (6 & _engine_sprite_and[img]) + _engine_sprite_base[img];
@@ -385,7 +385,7 @@ void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod)
image = 0;
if (is_custom_sprite(img)) {
image = GetCustomVehicleIcon(engine, 2);
- if (image == 0) img = _engine_original_sprites[engine];
+ if (image == 0) img = orig_rail_vehicle_info[engine].image_index;
}
if (image == 0) {
image =