mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r7009) - Fix (r1323, r1326): In the replace vehicle window, the left vehicle list was not drawn when an engine was not selected.
This commit is contained in:
parent
8b12e25468
commit
2d8708bde1
@ -939,10 +939,6 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
|||||||
int num = NUM_ROAD_ENGINES;
|
int num = NUM_ROAD_ENGINES;
|
||||||
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
|
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
|
||||||
EngineID engine_id = ROAD_ENGINES_INDEX;
|
EngineID engine_id = ROAD_ENGINES_INDEX;
|
||||||
byte cargo;
|
|
||||||
|
|
||||||
if (selected_id[0] >= ROAD_ENGINES_INDEX && selected_id[0] < SHIP_ENGINES_INDEX) {
|
|
||||||
cargo = RoadVehInfo(selected_id[0])->cargo_type;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (p->num_engines[engine_id] > 0 || EngineHasReplacementForPlayer(p, engine_id)) {
|
if (p->num_engines[engine_id] > 0 || EngineHasReplacementForPlayer(p, engine_id)) {
|
||||||
@ -956,6 +952,9 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
|||||||
sel[0]--;
|
sel[0]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selected_id[0] != INVALID_ENGINE) {
|
||||||
|
byte cargo = RoadVehInfo(selected_id[0])->cargo_type;
|
||||||
|
|
||||||
if (RoadVehInfo(engine_id)->cargo_type == cargo && HASBIT(e->player_avail, _local_player)) {
|
if (RoadVehInfo(engine_id)->cargo_type == cargo && HASBIT(e->player_avail, _local_player)) {
|
||||||
if (IS_INT_INSIDE(--pos2, -w->vscroll.cap, 0) && RoadVehInfo(engine_id)->cargo_type == cargo) {
|
if (IS_INT_INSIDE(--pos2, -w->vscroll.cap, 0) && RoadVehInfo(engine_id)->cargo_type == cargo) {
|
||||||
DrawString(x2+59, y2+2, GetCustomEngineName(engine_id), sel[1]==0 ? 0xC : 0x10);
|
DrawString(x2+59, y2+2, GetCustomEngineName(engine_id), sel[1]==0 ? 0xC : 0x10);
|
||||||
@ -964,8 +963,8 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
|||||||
}
|
}
|
||||||
sel[1]--;
|
sel[1]--;
|
||||||
}
|
}
|
||||||
} while (++engine_id, ++e,--num);
|
|
||||||
}
|
}
|
||||||
|
} while (++engine_id, ++e,--num);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -973,11 +972,6 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
|||||||
int num = NUM_SHIP_ENGINES;
|
int num = NUM_SHIP_ENGINES;
|
||||||
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
|
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
|
||||||
EngineID engine_id = SHIP_ENGINES_INDEX;
|
EngineID engine_id = SHIP_ENGINES_INDEX;
|
||||||
byte cargo, refittable;
|
|
||||||
|
|
||||||
if (selected_id[0] != INVALID_ENGINE) {
|
|
||||||
cargo = ShipVehInfo(selected_id[0])->cargo_type;
|
|
||||||
refittable = ShipVehInfo(selected_id[0])->refittable;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (p->num_engines[engine_id] > 0 || EngineHasReplacementForPlayer(p, engine_id)) {
|
if (p->num_engines[engine_id] > 0 || EngineHasReplacementForPlayer(p, engine_id)) {
|
||||||
@ -990,7 +984,11 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
|||||||
}
|
}
|
||||||
sel[0]--;
|
sel[0]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected_id[0] != INVALID_ENGINE) {
|
if (selected_id[0] != INVALID_ENGINE) {
|
||||||
|
CargoID cargo = ShipVehInfo(selected_id[0])->cargo_type;
|
||||||
|
bool refittable = ShipVehInfo(selected_id[0])->refittable;
|
||||||
|
|
||||||
if (HASBIT(e->player_avail, _local_player) && ( cargo == ShipVehInfo(engine_id)->cargo_type || refittable & ShipVehInfo(engine_id)->refittable)) {
|
if (HASBIT(e->player_avail, _local_player) && ( cargo == ShipVehInfo(engine_id)->cargo_type || refittable & ShipVehInfo(engine_id)->refittable)) {
|
||||||
if (IS_INT_INSIDE(--pos2, -w->vscroll.cap, 0)) {
|
if (IS_INT_INSIDE(--pos2, -w->vscroll.cap, 0)) {
|
||||||
DrawString(x2+75, y2+7, GetCustomEngineName(engine_id), sel[1]==0 ? 0xC : 0x10);
|
DrawString(x2+75, y2+7, GetCustomEngineName(engine_id), sel[1]==0 ? 0xC : 0x10);
|
||||||
@ -1000,17 +998,14 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
|||||||
sel[1]--;
|
sel[1]--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (++engine_id, ++e,--num);
|
} while (++engine_id, ++e, --num);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
} //end of ship
|
} //end of ship
|
||||||
|
|
||||||
case VEH_Aircraft: {
|
case VEH_Aircraft: {
|
||||||
if (selected_id[0] != INVALID_ENGINE) {
|
|
||||||
int num = NUM_AIRCRAFT_ENGINES;
|
int num = NUM_AIRCRAFT_ENGINES;
|
||||||
const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
||||||
EngineID engine_id = AIRCRAFT_ENGINES_INDEX;
|
EngineID engine_id = AIRCRAFT_ENGINES_INDEX;
|
||||||
byte subtype = AircraftVehInfo(selected_id[0])->subtype;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (p->num_engines[engine_id] > 0 || EngineHasReplacementForPlayer(p, engine_id)) {
|
if (p->num_engines[engine_id] > 0 || EngineHasReplacementForPlayer(p, engine_id)) {
|
||||||
@ -1024,6 +1019,10 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
|||||||
}
|
}
|
||||||
sel[0]--;
|
sel[0]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selected_id[0] != INVALID_ENGINE) {
|
||||||
|
byte subtype = AircraftVehInfo(selected_id[0])->subtype;
|
||||||
|
|
||||||
if ((subtype & AIR_CTOL) == (AircraftVehInfo(engine_id)->subtype & AIR_CTOL) &&
|
if ((subtype & AIR_CTOL) == (AircraftVehInfo(engine_id)->subtype & AIR_CTOL) &&
|
||||||
HASBIT(e->player_avail, _local_player)) {
|
HASBIT(e->player_avail, _local_player)) {
|
||||||
if (sel[1] == 0) selected_id[1] = engine_id;
|
if (sel[1] == 0) selected_id[1] = engine_id;
|
||||||
@ -1034,8 +1033,8 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
|||||||
}
|
}
|
||||||
sel[1]--;
|
sel[1]--;
|
||||||
}
|
}
|
||||||
} while (++engine_id, ++e,--num);
|
|
||||||
}
|
}
|
||||||
|
} while (++engine_id, ++e,--num);
|
||||||
break;
|
break;
|
||||||
} // end of aircraft
|
} // end of aircraft
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user