(svn r9941) -Fix: trams could be cloned to appear in normal road depots and vice versa (spotted by Desolator)
authorbjarni
Sat, 26 May 2007 20:30:55 +0000
changeset 6709 2de208267583
parent 6708 257de56ddd2f
child 6710 fd3ade8bf17a
(svn r9941) -Fix: trams could be cloned to appear in normal road depots and vice versa (spotted by Desolator)
src/lang/english.txt
src/roadveh_cmd.cpp
--- a/src/lang/english.txt	Sat May 26 20:30:40 2007 +0000
+++ b/src/lang/english.txt	Sat May 26 20:30:55 2007 +0000
@@ -3030,6 +3030,7 @@
 
 ### depot strings
 STR_DEPOT_SELL_CONFIRMATION_TEXT                                :{YELLOW}You are about to sell all the vehicles in the depot. Are you sure?
+STR_DEPOT_WRONG_DEPOT_TYPE                                      :Wrong depot type
 
 STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TIP                             :{BLACK}Sell all trains in the depot
 STR_DEPOT_SELL_ALL_BUTTON_ROADVEH_TIP                           :{BLACK}Sell all road vehicles in the depot
--- a/src/roadveh_cmd.cpp	Sat May 26 20:30:40 2007 +0000
+++ b/src/roadveh_cmd.cpp	Sat May 26 20:30:55 2007 +0000
@@ -145,6 +145,8 @@
 	if (!IsTileDepotType(tile, TRANSPORT_ROAD)) return CMD_ERROR;
 	if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
 
+	if (HASBIT(GetRoadTypes(tile), ROADTYPE_TRAM) != HASBIT(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE);
+
 	v = AllocateVehicle();
 	if (v == NULL) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);