(svn r4940) Remove the dubious feature of remembering the last built depot. It serves no real purpose except causing confusion

This commit is contained in:
tron 2006-05-21 13:51:36 +00:00
parent c0021cf937
commit e774caca2a
11 changed files with 13 additions and 102 deletions

View File

@ -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))

View File

@ -249,5 +249,4 @@ static void ShowBuildAirportPicker(void)
void InitializeAirportGui(void)
{
_selected_airport_type = AT_SMALL;
_last_built_aircraft_depot_tile = 0;
}

View File

@ -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.

6
misc.c
View File

@ -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();

View File

@ -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 */

View File

@ -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 */

View File

@ -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))
case 9: /* Build new Vehicle */
if (!IsWindowOfPrototype(w, _player_roadveh_widgets)) break;
ShowBuildRoadVehWindow(0);
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);
ShowBuildRoadVehWindow(0);
} break;
case 10: {
if (!IsWindowOfPrototype(w, _player_roadveh_widgets))
break;

View File

@ -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;

View File

@ -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;

View File

@ -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))
case 9: /* Build new Vehicle */
if (!IsWindowOfPrototype(w, _player_trains_widgets)) break;
ShowBuildTrainWindow(0);
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);
ShowBuildTrainWindow(0);
} break;
case 10: {
if (!IsWindowOfPrototype(w, _player_trains_widgets))
break;

View File

@ -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 */