Changeset - r12330:7a2432bd694b
[Not reviewed]
master
0 2 0
rubidium - 15 years ago 2009-07-07 16:43:58
rubidium@openttd.org
(svn r16760) -Codechange: make UpdateStationVirtCoord a function of Station
2 files changed with 16 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/station_base.h
Show inline comments
 
@@ -161,6 +161,8 @@ public:
 
	 */
 
	void MarkTilesDirty(bool cargo_change) const;
 

	
 
	void UpdateVirtCoord();
 

	
 
	uint GetPlatformLength(TileIndex tile, DiagDirection dir) const;
 
	uint GetPlatformLength(TileIndex tile) const;
 
	void RecomputeIndustriesNear();
src/station_cmd.cpp
Show inline comments
 
@@ -366,19 +366,21 @@ static Station *GetClosestDeletedStation
 
	return best_station;
 
}
 

	
 
/** Update the virtual coords needed to draw the station sign.
 
 * @param st Station to update for.
 
/**
 
 * Update the virtual coords needed to draw the station sign and
 
 * mark the station sign dirty.
 
 * @ingroup dirty
 
 */
 
static void UpdateStationVirtCoord(Station *st)
 
void Station::UpdateVirtCoord()
 
{
 
	Point pt = RemapCoords2(TileX(st->xy) * TILE_SIZE, TileY(st->xy) * TILE_SIZE);
 
	Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
 

	
 
	pt.y -= 32;
 
	if ((st->facilities & FACIL_AIRPORT) && st->airport_type == AT_OILRIG) pt.y -= 16;
 

	
 
	SetDParam(0, st->index);
 
	SetDParam(1, st->facilities);
 
	UpdateViewportSignPos(&st->sign, pt.x, pt.y, STR_STATION_SIGN);
 
	if ((this->facilities & FACIL_AIRPORT) && this->airport_type == AT_OILRIG) pt.y -= 16;
 

	
 
	SetDParam(0, this->index);
 
	SetDParam(1, this->facilities);
 
	UpdateViewportSignPos(&this->sign, pt.x, pt.y, STR_STATION_SIGN);
 
}
 

	
 
/** Update the virtual coords needed to draw the station sign for all stations. */
 
@@ -387,7 +389,7 @@ void UpdateAllStationVirtCoord()
 
	Station *st;
 

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

	
 
@@ -402,7 +404,7 @@ void UpdateAllStationVirtCoord()
 
static void UpdateStationVirtCoordDirty(Station *st)
 
{
 
	st->MarkDirty();
 
	UpdateStationVirtCoord(st);
 
	st->UpdateVirtCoord();
 
	st->MarkDirty();
 
}
 

	
 
@@ -2819,7 +2821,7 @@ CommandCost CmdRenameStation(TileIndex t
 
		free(st->name);
 
		st->name = reset ? NULL : strdup(text);
 

	
 
		UpdateStationVirtCoord(st);
 
		st->UpdateVirtCoord();
 
		InvalidateWindowData(WC_STATION_LIST, st->owner, 1);
 
		MarkWholeScreenDirty();
 
	}
0 comments (0 inline, 0 general)