Changeset - r9232:bfa5965b4b61
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2008-05-15 08:01:46
rubidium@openttd.org
(svn r13098) -Fix [FS#2016]: segmentation fault on opening an already opened depot.
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/depot_gui.cpp
Show inline comments
 
@@ -980,46 +980,48 @@ static void DepotSellAllConfirmationCall
 
		DoCommandP(tile, vehtype, 0, NULL, CMD_DEPOT_SELL_ALL_VEHICLES);
 
	}
 
}
 

	
 
/** Opens a depot window
 
 * @param tile The tile where the depot/hangar is located
 
 * @param type The type of vehicles in the depot
 
 */
 
void ShowDepotWindow(TileIndex tile, VehicleType type)
 
{
 
	DepotWindow *w;
 

	
 
	switch (type) {
 
		default: NOT_REACHED();
 
		case VEH_TRAIN:
 
			w = AllocateWindowDescFront<DepotWindow>(&_train_depot_desc, tile); break;
 
		case VEH_ROAD:
 
			w = AllocateWindowDescFront<DepotWindow>(&_road_depot_desc, tile); break;
 
		case VEH_SHIP:
 
			w = AllocateWindowDescFront<DepotWindow>(&_ship_depot_desc, tile); break;
 
		case VEH_AIRCRAFT:
 
			w = AllocateWindowDescFront<DepotWindow>(&_aircraft_depot_desc, tile); break;
 
	}
 

	
 
	if (w == NULL) return;
 

	
 
	w->caption_color = GetTileOwner(tile);
 
	w->CreateDepotListWindow(type);
 
}
 

	
 
/** Removes the highlight of a vehicle in a depot window
 
 * @param *v Vehicle to remove all highlights from
 
 */
 
void DeleteDepotHighlightOfVehicle(const Vehicle *v)
 
{
 
	DepotWindow *w;
 

	
 
	/* If we haven't got any vehicles on the mouse pointer, we haven't got any highlighted in any depots either
 
	 * If that is the case, we can skip looping though the windows and save time
 
	 */
 
	if (_special_mouse_mode != WSM_DRAGDROP) return;
 

	
 
	w = dynamic_cast<DepotWindow*>(FindWindowById(WC_VEHICLE_DEPOT, v->tile));
 
	if (w != NULL) {
 
		w->sel = INVALID_VEHICLE;
 
		ResetObjectToPlace();
 
	}
 
}
0 comments (0 inline, 0 general)