src/station.cpp
branchgamebalance
changeset 9895 7bd07f43b0e3
parent 6447 3b71e57fd22b
child 9908 0fa543611bbe
equal deleted inserted replaced
9894:70d78ac95d6c 9895:7bd07f43b0e3
    46 	time_since_load = 255;
    46 	time_since_load = 255;
    47 	time_since_unload = 255;
    47 	time_since_unload = 255;
    48 	delete_ctr = 0;
    48 	delete_ctr = 0;
    49 	facilities = 0;
    49 	facilities = 0;
    50 
    50 
    51 	last_vehicle_type = VEH_Invalid;
    51 	last_vehicle_type = VEH_INVALID;
    52 
    52 
    53 	random_bits = 0; // Random() must be called when station is really built (DC_EXEC)
    53 	random_bits = 0; // Random() must be called when station is really built (DC_EXEC)
    54 	waiting_triggers = 0;
    54 	waiting_triggers = 0;
    55 }
    55 }
    56 
    56 
   153 bool Station::TileBelongsToRailStation(TileIndex tile) const
   153 bool Station::TileBelongsToRailStation(TileIndex tile) const
   154 {
   154 {
   155 	return IsTileType(tile, MP_STATION) && GetStationIndex(tile) == index && IsRailwayStation(tile);
   155 	return IsTileType(tile, MP_STATION) && GetStationIndex(tile) == index && IsRailwayStation(tile);
   156 }
   156 }
   157 
   157 
   158 /*static*/ Station *Station::AllocateRaw(void)
   158 /*static*/ Station *Station::AllocateRaw()
   159 {
   159 {
   160 	Station *st = NULL;
   160 	Station *st = NULL;
   161 
   161 
   162 	/* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
   162 	/* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
   163 	 * TODO - This is just a temporary stage, this will be removed. */
   163 	 * TODO - This is just a temporary stage, this will be removed. */
   453 	/* Clear the slot assignment of all vehicles heading for this road stop */
   453 	/* Clear the slot assignment of all vehicles heading for this road stop */
   454 	if (num_vehicles != 0) {
   454 	if (num_vehicles != 0) {
   455 		Vehicle *v;
   455 		Vehicle *v;
   456 
   456 
   457 		FOR_ALL_VEHICLES(v) {
   457 		FOR_ALL_VEHICLES(v) {
   458 			if (v->type == VEH_Road && v->u.road.slot == this) ClearSlot(v);
   458 			if (v->type == VEH_ROAD && v->u.road.slot == this) ClearSlot(v);
   459 		}
   459 		}
   460 	}
   460 	}
   461 	assert(num_vehicles == 0);
   461 	assert(num_vehicles == 0);
   462 
   462 
   463 	DEBUG(ms, cDebugCtorLevel , "I- at %d[0x%x]", xy, xy);
   463 	DEBUG(ms, cDebugCtorLevel , "I- at %d[0x%x]", xy, xy);
   465 	xy = INVALID_TILE;
   465 	xy = INVALID_TILE;
   466 }
   466 }
   467 
   467 
   468 
   468 
   469 /** Low-level function for allocating a RoadStop on the pool */
   469 /** Low-level function for allocating a RoadStop on the pool */
   470 RoadStop *RoadStop::AllocateRaw( void )
   470 RoadStop *RoadStop::AllocateRaw()
   471 {
   471 {
   472 	RoadStop *rs;
   472 	RoadStop *rs;
   473 
   473 
   474 	/* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
   474 	/* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
   475 	 * TODO - This is just a temporary stage, this will be removed. */
   475 	 * TODO - This is just a temporary stage, this will be removed. */