Changeset - r2427:ab70d019f40e
[Not reviewed]
master
0 1 0
Darkvater - 19 years ago 2005-09-14 22:03:27
darkvater@openttd.org
(svn r2953) - Fix: [ 1257766 ] Cannot make ships go to an oil platform (oilrig has no station). While it is still possible that oilrigs end up without a station, it is only the case where no more stations can be built at all
1 file changed with 12 insertions and 9 deletions:
0 comments (0 inline, 0 general)
station_cmd.c
Show inline comments
 
@@ -2883,21 +2883,26 @@ uint MoveGoodsToStation(TileIndex tile, 
 

	
 
	return moved;
 
}
 

	
 
void BuildOilRig(TileIndex tile)
 
{
 
	Station *st;
 
	int j;
 

	
 
	FOR_ALL_STATIONS(st) {
 
		if (st->xy == 0) {
 
	Station *st = AllocateStation();
 

	
 
	if (st == NULL) {
 
		DEBUG(misc, 0) ("Couldn't allocate station for oilrig at %#X, reverting to oilrig only...", tile);
 
		return;
 
	}
 
	if (!GenerateStationName(st, tile, 2)) {
 
		DEBUG(misc, 0) ("Couldn't allocate station-name for oilrig at %#X, reverting to oilrig only...", tile);
 
		return;
 
	}
 

	
 
			st->town = ClosestTownFromTile(tile, (uint)-1);
 
			st->sign.width_1 = 0;
 
			if (!GenerateStationName(st, tile, 2))
 
				return;
 

	
 
			SetTileType(tile, MP_STATION);
 
			_m[tile].m5 = 0x4B;
 
			SetTileOwner(tile, OWNER_NONE);
 
			_m[tile].m3 = 0;
 
			_m[tile].m4 = 0;
 
@@ -2916,26 +2921,24 @@ void BuildOilRig(TileIndex tile)
 
			st->time_since_load = 255;
 
			st->time_since_unload = 255;
 
			st->delete_ctr = 0;
 
			st->last_vehicle = INVALID_VEHICLE;
 
			st->facilities = FACIL_AIRPORT | FACIL_DOCK;
 
			st->build_date = _date;
 

	
 
			for(j=0; j!=NUM_CARGO; j++) {
 
				st->goods[j].waiting_acceptance = 0;
 
				st->goods[j].days_since_pickup = 0;
 
				st->goods[j].enroute_from = INVALID_STATION;
 
				st->goods[j].rating = 175;
 
				st->goods[j].last_speed = 0;
 
				st->goods[j].last_age = 255;
 
			}
 

	
 
			UpdateStationVirtCoordDirty(st);
 
			UpdateStationAcceptance(st, false);
 
			return;
 
		}
 
	}
 
}
 

	
 
void DeleteOilRig(TileIndex tile)
 
{
 
	Station *st = GetStation(_m[tile].m2);
 

	
0 comments (0 inline, 0 general)