forked from mirror/OpenTTD
(svn r2432) Use GetEngine() instead of DEREF_ENGINE() or even _engines[]
This commit is contained in:
@@ -391,7 +391,7 @@ static void train_engine_drawing_loop(int *x, int *y, int *pos, int *sel, int *s
|
||||
byte colour;
|
||||
|
||||
for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
|
||||
const Engine *e = DEREF_ENGINE(i);
|
||||
const Engine *e = GetEngine(i);
|
||||
const RailVehicleInfo *rvi = RailVehInfo(i);
|
||||
const EngineInfo *info = &_engine_info[i];
|
||||
|
||||
@@ -448,7 +448,7 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
w->widget[13].color = _player_colors[_local_player]; // sets the colour of that art thing
|
||||
w->widget[16].color = _player_colors[_local_player]; // sets the colour of that art thing
|
||||
for (engine_id = 0; engine_id < NUM_TRAIN_ENGINES; engine_id++) {
|
||||
const Engine *e = DEREF_ENGINE(engine_id);
|
||||
const Engine *e = GetEngine(engine_id);
|
||||
const EngineInfo *info = &_engine_info[engine_id];
|
||||
|
||||
if (ENGINE_AVAILABLE && RailVehInfo(engine_id)->power && e->railtype == railtype ) {
|
||||
@@ -468,7 +468,7 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
}
|
||||
case VEH_Road: {
|
||||
int num = NUM_ROAD_ENGINES;
|
||||
Engine *e = DEREF_ENGINE(ROAD_ENGINES_INDEX);
|
||||
Engine *e = GetEngine(ROAD_ENGINES_INDEX);
|
||||
byte cargo;
|
||||
EngineInfo *info;
|
||||
engine_id = ROAD_ENGINES_INDEX;
|
||||
@@ -485,7 +485,7 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
if ( selected_id[0] != -1 ) { // only draw right array if we have anything in the left one
|
||||
num = NUM_ROAD_ENGINES;
|
||||
engine_id = ROAD_ENGINES_INDEX;
|
||||
e = DEREF_ENGINE(ROAD_ENGINES_INDEX);
|
||||
e = GetEngine(ROAD_ENGINES_INDEX);
|
||||
cargo = RoadVehInfo(selected_id[0])->cargo_type;
|
||||
|
||||
do {
|
||||
@@ -501,7 +501,7 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
|
||||
case VEH_Ship: {
|
||||
int num = NUM_SHIP_ENGINES;
|
||||
Engine *e = DEREF_ENGINE(SHIP_ENGINES_INDEX);
|
||||
Engine *e = GetEngine(SHIP_ENGINES_INDEX);
|
||||
byte cargo, refittable;
|
||||
EngineInfo *info;
|
||||
engine_id = SHIP_ENGINES_INDEX;
|
||||
@@ -517,7 +517,7 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
|
||||
if ( selected_id[0] != -1 ) {
|
||||
num = NUM_SHIP_ENGINES;
|
||||
e = DEREF_ENGINE(SHIP_ENGINES_INDEX);
|
||||
e = GetEngine(SHIP_ENGINES_INDEX);
|
||||
engine_id = SHIP_ENGINES_INDEX;
|
||||
cargo = ShipVehInfo(selected_id[0])->cargo_type;
|
||||
refittable = ShipVehInfo(selected_id[0])->refittable;
|
||||
@@ -538,7 +538,7 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
case VEH_Aircraft:{
|
||||
int num = NUM_AIRCRAFT_ENGINES;
|
||||
byte subtype;
|
||||
Engine *e = DEREF_ENGINE(AIRCRAFT_ENGINES_INDEX);
|
||||
Engine *e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
||||
EngineInfo *info;
|
||||
engine_id = AIRCRAFT_ENGINES_INDEX;
|
||||
|
||||
@@ -553,7 +553,7 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
|
||||
if ( selected_id[0] != -1 ) {
|
||||
num = NUM_AIRCRAFT_ENGINES;
|
||||
e = DEREF_ENGINE(AIRCRAFT_ENGINES_INDEX);
|
||||
e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
||||
subtype = AircraftVehInfo(selected_id[0])->subtype;
|
||||
engine_id = AIRCRAFT_ENGINES_INDEX;
|
||||
do {
|
||||
@@ -612,7 +612,7 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
||||
|
||||
case VEH_Road: {
|
||||
int num = NUM_ROAD_ENGINES;
|
||||
Engine *e = DEREF_ENGINE(ROAD_ENGINES_INDEX);
|
||||
Engine *e = GetEngine(ROAD_ENGINES_INDEX);
|
||||
int engine_id = ROAD_ENGINES_INDEX;
|
||||
byte cargo;
|
||||
EngineInfo *info;
|
||||
@@ -648,7 +648,7 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
||||
|
||||
case VEH_Ship: {
|
||||
int num = NUM_SHIP_ENGINES;
|
||||
Engine *e = DEREF_ENGINE(SHIP_ENGINES_INDEX);
|
||||
Engine *e = GetEngine(SHIP_ENGINES_INDEX);
|
||||
int engine_id = SHIP_ENGINES_INDEX;
|
||||
byte cargo, refittable;
|
||||
EngineInfo *info;
|
||||
@@ -687,7 +687,7 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
||||
case VEH_Aircraft: {
|
||||
if ( selected_id[0] != -1 ) {
|
||||
int num = NUM_AIRCRAFT_ENGINES;
|
||||
Engine *e = DEREF_ENGINE(AIRCRAFT_ENGINES_INDEX);
|
||||
Engine *e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
||||
int engine_id = AIRCRAFT_ENGINES_INDEX;
|
||||
byte subtype = AircraftVehInfo(selected_id[0])->subtype;
|
||||
EngineInfo *info;
|
||||
@@ -757,7 +757,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
|
||||
// do not count the vehicles, that contains only 0 in all var
|
||||
if (vehicle->engine_type == 0 && vehicle->spritenum == 0 ) continue;
|
||||
|
||||
if (vehicle->type != DEREF_ENGINE(vehicle->engine_type)->type) continue;
|
||||
if (vehicle->type != GetEngine(vehicle->engine_type)->type) continue;
|
||||
|
||||
_player_num_engines[vehicle->engine_type]++;
|
||||
}
|
||||
@@ -892,9 +892,9 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
|
||||
// finds mask for available engines
|
||||
{
|
||||
int engine_avail = 0;
|
||||
if ( !(HASBIT(DEREF_ENGINE(NUM_NORMAL_RAIL_ENGINES + NUM_MONORAIL_ENGINES)->player_avail, _local_player))) {
|
||||
if (!HASBIT(GetEngine(NUM_NORMAL_RAIL_ENGINES + NUM_MONORAIL_ENGINES)->player_avail, _local_player)) {
|
||||
engine_avail = 4;
|
||||
if ( !(HASBIT(DEREF_ENGINE(NUM_NORMAL_RAIL_ENGINES)->player_avail, _local_player)))
|
||||
if (!HASBIT(GetEngine(NUM_NORMAL_RAIL_ENGINES)->player_avail, _local_player))
|
||||
engine_avail = 6;
|
||||
}
|
||||
ShowDropDownMenu(w, _rail_types_list, _railtype_selected_in_replace_gui, 15, engine_avail, 1);
|
||||
|
Reference in New Issue
Block a user