Changeset - r28:b3c40e796df9
[Not reviewed]
master
0 1 0
darkvater - 20 years ago 2004-08-12 21:11:23
darkvater@openttd.org
(svn r29) -Fix You cannot take ownership of an oilrig by building right next to it
-Fix when adding parts to a statin max size is not 15x15 anymore, but _patches.station_spread
1 file changed with 9 insertions and 10 deletions:
0 comments (0 inline, 0 general)
station_cmd.c
Show inline comments
 
@@ -40,12 +40,19 @@ static Station *GetStationAround(uint ti
 
{
 
	// check around to see if there's any stations there
 
	BEGIN_TILE_LOOP(tile_cur, w + 2, h + 2, tile - TILE_XY(1,1))
 
		if (IS_TILETYPE(tile_cur, MP_STATION)) {
 
			int t;
 
			t = _map2[tile_cur];
 
			{
 
				Station *st = DEREF_STATION(t);
 
				// you cannot take control of an oilrig!!
 
				if (st->airport_type == AT_OILRIG && st->facilities == (FACIL_AIRPORT|FACIL_DOCK))
 
					continue;
 
			}
 

	
 
			if (closest_station == -1) {
 
				closest_station = t;
 
			} else if (closest_station != t) {
 
				_error_message = STR_3006_ADJOINS_MORE_THAN_ONE_EXISTING;
 
				return CHECK_STATIONS_ERR;
 
			}
 
@@ -535,22 +542,14 @@ static void UpdateStationAcceptance(Stat
 
// This is called right after a station was deleted.
 
// It checks if the whole station is free of substations, and if so, the station will be
 
// deleted after a little while.
 
static void DeleteStationIfEmpty(Station *st) {
 
	if (st->facilities == 0) {
 
		st->delete_ctr = 0;
 
		InvalidateWindow(WC_STATION_LIST, st->owner);
 
	}
 

	
 
	// if a station next to an oilrig is removed, fix ownership
 
	if (st->airport_type == AT_OILRIG && st->facilities == (FACIL_AIRPORT|FACIL_DOCK) ) {
 
		_station_sort_dirty = true;
 
		InvalidateWindow(WC_STATION_LIST, st->owner);
 
		st->owner = 0x10;
 
	}
 

	
 
	InvalidateWindow(WC_STATION_LIST, st->owner);
 
}
 

	
 
// Tries to clear the given area. Returns the cost in case of success.
 
// Or an error code if it failed.
 
int32 CheckFlatLandBelow(uint tile, uint w, uint h, uint flags, uint invalid_dirs, int *station)
 
{
 
@@ -654,13 +653,13 @@ static bool CanExpandRailroadStation(Sta
 
			tile -= TILE_XY(curw, 0);
 
			curw += w;
 
		} else
 
			return false;
 
	}
 
	// make sure the final size is not too big.
 
	if (curw > 15 || curh > 15) return false;
 
	if (curw > _patches.station_spread || curh > _patches.station_spread) return false;
 

	
 
	// now tile contains the new value for st->train_tile
 
	// curw, curh contain the new value for width and height
 
	fin[0] = tile;
 
	fin[1] = curw;
 
	fin[2] = curh;
0 comments (0 inline, 0 general)