summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-05-21 13:51:36 +0000
committertron <tron@openttd.org>2006-05-21 13:51:36 +0000
commite774caca2af3bed3c9643da9a4e2faee2d1a7a27 (patch)
treea0f8f35f08e024362e9469a68b9d671758791404
parentc0021cf9372c3ee54766fd3ff04d0c8bd90ccb31 (diff)
downloadopenttd-e774caca2af3bed3c9643da9a4e2faee2d1a7a27.tar.xz
(svn r4940) Remove the dubious feature of remembering the last built depot. It serves no real purpose except causing confusion
-rw-r--r--aircraft_gui.c21
-rw-r--r--airport_gui.c1
-rw-r--r--depot.h4
-rw-r--r--misc.c6
-rw-r--r--rail_cmd.c6
-rw-r--r--road_cmd.c6
-rw-r--r--roadveh_gui.c22
-rw-r--r--ship_gui.c18
-rw-r--r--station_cmd.c3
-rw-r--r--train_gui.c23
-rw-r--r--water_cmd.c5
11 files changed, 13 insertions, 102 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 68f5142b8..fe3441b04 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -1082,25 +1082,10 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
}
} break;
- case 9: { /* Build new Vehicle */
- TileIndex tile;
-
- if (!IsWindowOfPrototype(w, _player_aircraft_widgets))
- break;
-
- tile = _last_built_aircraft_depot_tile;
- do {
- if (IsHangarTile(tile) && IsTileOwner(tile, _local_player)) {
- ShowAircraftDepotWindow(tile);
- ShowBuildAircraftWindow(tile);
- return;
- }
-
- tile = TILE_MASK(tile + 1);
- } while (tile != _last_built_aircraft_depot_tile);
-
+ case 9: /* Build new Vehicle */
+ if (!IsWindowOfPrototype(w, _player_aircraft_widgets)) break;
ShowBuildAircraftWindow(0);
- } break;
+ break;
case 10:
if (!IsWindowOfPrototype(w, _player_aircraft_widgets))
diff --git a/airport_gui.c b/airport_gui.c
index 0bf290716..bad915960 100644
--- a/airport_gui.c
+++ b/airport_gui.c
@@ -249,5 +249,4 @@ static void ShowBuildAirportPicker(void)
void InitializeAirportGui(void)
{
_selected_airport_type = AT_SMALL;
- _last_built_aircraft_depot_tile = 0;
}
diff --git a/depot.h b/depot.h
index 136a180af..19d21ebbf 100644
--- a/depot.h
+++ b/depot.h
@@ -60,10 +60,6 @@ static inline uint16 GetServiceIntervalClamped(uint index)
return (_patches.servint_ispercent) ? clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
}
-VARDEF TileIndex _last_built_train_depot_tile;
-VARDEF TileIndex _last_built_road_depot_tile;
-VARDEF TileIndex _last_built_aircraft_depot_tile;
-VARDEF TileIndex _last_built_ship_depot_tile;
/**
* Check if a depot really exists.
diff --git a/misc.c b/misc.c
index f8b2e0e90..71e9e25fa 100644
--- a/misc.c
+++ b/misc.c
@@ -96,12 +96,9 @@ void InitializeDepot(void);
void InitializeEngines(void);
void InitializeOrders(void);
void InitializeClearLand(void);
-void InitializeRail(void);
void InitializeRailGui(void);
-void InitializeRoad(void);
void InitializeRoadGui(void);
void InitializeAirportGui(void);
-void InitializeDock(void);
void InitializeDockGui(void);
void InitializeIndustries(void);
void InitializeMainGui(void);
@@ -157,12 +154,9 @@ void InitializeGame(int mode, uint size_x, uint size_y)
InitNewsItemStructs();
InitializeLandscape();
InitializeClearLand();
- InitializeRail();
InitializeRailGui();
- InitializeRoad();
InitializeRoadGui();
InitializeAirportGui();
- InitializeDock();
InitializeDockGui();
InitializeTowns();
InitializeTrees();
diff --git a/rail_cmd.c b/rail_cmd.c
index ec819ab36..c26fa7d4c 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -590,8 +590,6 @@ int32 CmdBuildTrainDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (d == NULL) return CMD_ERROR;
if (flags & DC_EXEC) {
- if (IsLocalPlayer()) _last_built_train_depot_tile = tile;
-
MakeRailDepot(tile, _current_player, p2, p1);
MarkTileDirtyByTile(tile);
@@ -2032,10 +2030,6 @@ static uint32 VehicleEnter_Track(Vehicle *v, TileIndex tile, int x, int y)
return 0;
}
-void InitializeRail(void)
-{
- _last_built_train_depot_tile = 0;
-}
const TileTypeProcs _tile_type_rail_procs = {
DrawTile_Track, /* draw_tile_proc */
diff --git a/road_cmd.c b/road_cmd.c
index 7bb7bebd2..35fa8c06a 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -577,8 +577,6 @@ int32 CmdBuildRoadDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (dep == NULL) return CMD_ERROR;
if (flags & DC_EXEC) {
- if (IsLocalPlayer()) _last_built_road_depot_tile = tile;
-
dep->xy = tile;
dep->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
@@ -1081,10 +1079,6 @@ static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID n
}
}
-void InitializeRoad(void)
-{
- _last_built_road_depot_tile = 0;
-}
const TileTypeProcs _tile_type_road_procs = {
DrawTile_Road, /* draw_tile_proc */
diff --git a/roadveh_gui.c b/roadveh_gui.c
index a5c4876c2..035333c7b 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -968,25 +968,11 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
}
} break;
- case 9: { /* Build new Vehicle */
- TileIndex tile;
-
- if (!IsWindowOfPrototype(w, _player_roadveh_widgets))
- break;
-
- tile = _last_built_road_depot_tile;
- do {
- if (IsTileDepotType(tile, TRANSPORT_ROAD) && IsTileOwner(tile, _local_player)) {
- ShowRoadDepotWindow(tile);
- ShowBuildRoadVehWindow(tile);
- return;
- }
-
- tile = TILE_MASK(tile + 1);
- } while (tile != _last_built_road_depot_tile);
-
+ case 9: /* Build new Vehicle */
+ if (!IsWindowOfPrototype(w, _player_roadveh_widgets)) break;
ShowBuildRoadVehWindow(0);
- } break;
+ break;
+
case 10: {
if (!IsWindowOfPrototype(w, _player_roadveh_widgets))
break;
diff --git a/ship_gui.c b/ship_gui.c
index ee02af483..1f9feb9c1 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -1065,24 +1065,10 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
}
} break;
- case 9: { /* Build new Vehicle */
- TileIndex tile;
-
+ case 9: /* Build new Vehicle */
if (!IsWindowOfPrototype(w, _player_ships_widgets)) break;
-
- tile = _last_built_ship_depot_tile;
- do {
- if (IsTileDepotType(tile, TRANSPORT_WATER) && IsTileOwner(tile, _local_player)) {
- ShowShipDepotWindow(tile);
- ShowBuildShipWindow(tile);
- return;
- }
-
- tile = TILE_MASK(tile + 1);
- } while (tile != _last_built_ship_depot_tile);
-
ShowBuildShipWindow(0);
- } break;
+ break;
case 10: {
if (!IsWindowOfPrototype(w, _player_ships_widgets)) break;
diff --git a/station_cmd.c b/station_cmd.c
index efce4ac88..9b58edcff 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1669,9 +1669,6 @@ int32 CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
st->owner = _current_player;
- if (IsLocalPlayer() && afc->nof_depots != 0)
- _last_built_aircraft_depot_tile = tile + ToTileIndexDiff(afc->airport_depots[0]);
-
st->airport_tile = tile;
if (!st->facilities) st->xy = tile;
st->facilities |= FACIL_AIRPORT;
diff --git a/train_gui.c b/train_gui.c
index bed0b9cd6..e9635ef0e 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -1494,26 +1494,11 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
}
} break;
- case 9: { /* Build new Vehicle */
- TileIndex tile;
-
- if (!IsWindowOfPrototype(w, _player_trains_widgets))
- break;
-
- tile = _last_built_train_depot_tile;
- do {
- if (IsTileDepotType(tile, TRANSPORT_RAIL) &&
- IsTileOwner(tile, _local_player)) {
- ShowTrainDepotWindow(tile);
- ShowBuildTrainWindow(tile);
- return;
- }
-
- tile = TILE_MASK(tile + 1);
- } while (tile != _last_built_train_depot_tile);
-
+ case 9: /* Build new Vehicle */
+ if (!IsWindowOfPrototype(w, _player_trains_widgets)) break;
ShowBuildTrainWindow(0);
- } break;
+ break;
+
case 10: {
if (!IsWindowOfPrototype(w, _player_trains_widgets))
break;
diff --git a/water_cmd.c b/water_cmd.c
index b66558a8d..a841efeed 100644
--- a/water_cmd.c
+++ b/water_cmd.c
@@ -78,7 +78,6 @@ int32 CmdBuildShipDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
depot->xy = tile;
- _last_built_ship_depot_tile = tile;
depot->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
MakeShipDepot(tile,_current_player, DEPOT_NORTH, p1);
@@ -698,10 +697,6 @@ static uint32 VehicleEnter_Water(Vehicle *v, TileIndex tile, int x, int y)
return 0;
}
-void InitializeDock(void)
-{
- _last_built_ship_depot_tile = 0;
-}
const TileTypeProcs _tile_type_water_procs = {
DrawTile_Water, /* draw_tile_proc */