Changeset - r12501:e56066b7af18
[Not reviewed]
master
0 3 0
rubidium - 15 years ago 2009-07-25 10:39:58
rubidium@openttd.org
(svn r16948) -Codechange: some code reductions and usage of wrapper functions
3 files changed with 6 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_order.cpp
Show inline comments
 
@@ -195,13 +195,13 @@ static const Order *ResolveOrder(Vehicle
 
				BEGIN_TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile) {
 
					if (!::IsHangar(tile)) return tile;
 
				} END_TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile)
 
			}
 
			return INVALID_TILE;
 
		}
 
		case OT_GOTO_WAYPOINT: return v->type == VEH_TRAIN ? ::Waypoint::Get(order->GetDestination())->xy : ::Station::Get(order->GetDestination())->xy;
 
		case OT_GOTO_WAYPOINT: return ::Waypoint::Get(order->GetDestination())->xy;
 
		default:               return INVALID_TILE;
 
	}
 
}
 

	
 
/* static */ AIOrder::AIOrderFlags AIOrder::GetOrderFlags(VehicleID vehicle_id, OrderPosition order_position)
 
{
src/station_cmd.cpp
Show inline comments
 
@@ -349,13 +349,13 @@ static Station *GetClosestDeletedStation
 
{
 
	uint threshold = 8;
 
	Station *best_station = NULL;
 
	Station *st;
 

	
 
	FOR_ALL_STATIONS(st) {
 
		if (st->facilities == 0 && st->owner == _current_company) {
 
		if (!st->IsInUse() && st->owner == _current_company) {
 
			uint cur_dist = DistanceManhattan(tile, st->xy);
 

	
 
			if (cur_dist < threshold) {
 
				threshold = cur_dist;
 
				best_station = st;
 
			}
 
@@ -417,17 +417,13 @@ void Station::UpdateVirtCoord()
 

	
 
/** Update the virtual coords needed to draw the station sign for all stations. */
 
void UpdateAllStationVirtCoords()
 
{
 
	BaseStation *st;
 

	
 
	FOR_ALL_STATIONS(st) {
 
		st->UpdateVirtCoord();
 
	}
 

	
 
	FOR_ALL_WAYPOINTS(st) {
 
	FOR_ALL_BASE_STATIONS(st) {
 
		st->UpdateVirtCoord();
 
	}
 
}
 

	
 
/** Get a mask of the cargo types that the station accepts.
 
 * @param st Station to query
 
@@ -625,13 +621,13 @@ static void UpdateStationSignCoord(Stati
 
 * It checks if the whole station is free of substations, and if so, the station will be
 
 * deleted after a little while.
 
 * @param st Station
 
 */
 
static void DeleteStationIfEmpty(Station *st)
 
{
 
	if (st->facilities == 0) {
 
	if (!st->IsInUse()) {
 
		st->delete_ctr = 0;
 
		InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
 
	}
 
	/* station remains but it probably lost some parts - station sign should stay in the station boundaries */
 
	UpdateStationSignCoord(st);
 
}
 
@@ -2948,13 +2944,13 @@ void DeleteOilRig(TileIndex tile)
 
	st->airport_flags = 0;
 

	
 
	st->rect.AfterRemoveTile(st, tile);
 

	
 
	st->UpdateVirtCoord();
 
	st->RecomputeIndustriesNear();
 
	if (st->facilities == 0) delete st;
 
	if (!st->IsInUse()) delete st;
 
}
 

	
 
static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_owner)
 
{
 
	if (IsDriveThroughStopTile(tile)) {
 
		for (RoadType rt = ROADTYPE_ROAD; rt < ROADTYPE_END; rt++) {
src/viewport.cpp
Show inline comments
 
@@ -1089,13 +1089,13 @@ static void ViewportAddTownNames(DrawPix
 
	}
 
}
 

	
 

	
 
static void AddStation(const Station *st, StringID str, uint16 width)
 
{
 
	AddStringToDraw(st->sign.left + 1, st->sign.top + 1, str, st->index, st->facilities, (st->owner == OWNER_NONE || st->facilities == 0) ? 0xE : _company_colours[st->owner], width);
 
	AddStringToDraw(st->sign.left + 1, st->sign.top + 1, str, st->index, st->facilities, (st->owner == OWNER_NONE || !st->IsInUse()) ? 0xE : _company_colours[st->owner], width);
 
}
 

	
 

	
 
static void ViewportAddStationNames(DrawPixelInfo *dpi)
 
{
 
	int left, top, right, bottom;
0 comments (0 inline, 0 general)