Changeset - r1078:053c0b0439f2
[Not reviewed]
master
0 2 0
dominik - 20 years ago 2005-01-20 22:19:34
dominik@openttd.org
(svn r1579) Fix: [ 1105963 ] Buoys can now only be removed if no ship has it in their schedule.
This makes buoys more useable in multiplayer games again, as buoys can't be deleted by other players if they are used.
2 files changed with 22 insertions and 0 deletions:
0 comments (0 inline, 0 general)
lang/english.txt
Show inline comments
 
@@ -1140,6 +1140,8 @@ STR_CANT_BUILD_LOCKS						:{WHITE}Can't 
 
STR_BUILD_LOCKS_TIP						:{BLACK}Build locks
 
STR_LANDINFO_LOCK						:Lock
 

	
 
STR_BUOY_IS_IN_USE					:{WHITE}... buoy is in use!
 

	
 
STR_LANDINFO_COORDS						:{BLACK}Coordinates: {LTBLUE}{NUMU16}x{NUMU16} ({STRING})
 

	
 
STR_CANT_REMOVE_PART_OF_STATION					:{WHITE}Can't remove part of station...
station_cmd.c
Show inline comments
 
@@ -1751,6 +1751,23 @@ int32 CmdBuildBuoy(int x, int y, uint32 
 
	return _price.build_dock;
 
}
 

	
 
/* Checks if any ship is servicing the buoy specified. Returns yes or no */
 
static bool CheckShipsOnBuoy(Station *st)
 
{
 
	const Vehicle *v;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_Ship) {
 
			const Order *order;
 
			FOR_VEHICLE_ORDERS(v, order) {
 
				if (order->type == OT_GOTO_STATION && order->station == st->index) {
 
					return true;
 
				}
 
			}
 
		}
 
	}
 
	return false;
 
}
 

	
 
static int32 RemoveBuoy(Station *st, uint32 flags)
 
{
 
	uint tile;
 
@@ -1762,6 +1779,9 @@ static int32 RemoveBuoy(Station *st, uin
 

	
 
	tile = st->dock_tile;
 

	
 
	if (CheckShipsOnBuoy(st))
 
		return_cmd_error(STR_BUOY_IS_IN_USE);
 

	
 
	if (!EnsureNoVehicle(tile))
 
		return CMD_ERROR;
 

	
0 comments (0 inline, 0 general)