Changeset - r12381:5e06b887e97b
[Not reviewed]
master
0 15 0
rubidium - 15 years ago 2009-07-13 22:33:25
rubidium@openttd.org
(svn r16821) -Codechange: unify the naming of type::UpdateVirtCoord and UpdateAll[Type]VirtCoords.
15 files changed with 51 insertions and 53 deletions:
0 comments (0 inline, 0 general)
src/main_gui.cpp
Show inline comments
 
@@ -183,7 +183,7 @@ void ZoomInOrOutToCursorWindow(bool in, 
 
	}
 
}
 

	
 
extern void UpdateAllStationVirtCoord();
 
extern void UpdateAllStationVirtCoords();
 

	
 
struct MainWindow : Window
 
{
 
@@ -268,7 +268,7 @@ struct MainWindow : Window
 
				break;
 

	
 
			case '2' | WKC_ALT: // Update the coordinates of all station signs
 
				UpdateAllStationVirtCoord();
 
				UpdateAllStationVirtCoords();
 
				break;
 
#endif
 

	
src/saveload/afterload.cpp
Show inline comments
 
@@ -213,10 +213,10 @@ static bool InitializeWindowsAndCaches()
 
	ResetViewportAfterLoadGame();
 

	
 
	/* Update coordinates of the signs. */
 
	UpdateAllStationVirtCoord();
 
	UpdateAllStationVirtCoords();
 
	UpdateAllSignVirtCoords();
 
	UpdateAllTownVirtCoords();
 
	UpdateAllWaypointSigns();
 
	UpdateAllWaypointVirtCoords();
 

	
 
	Company *c;
 
	FOR_ALL_COMPANIES(c) {
src/settings.cpp
Show inline comments
 
@@ -645,9 +645,7 @@ static bool v_PositionMainToolbar(int32 
 

	
 
static bool PopulationInLabelActive(int32 p1)
 
{
 
	Town *t;
 
	FOR_ALL_TOWNS(t) UpdateTownVirtCoord(t);
 

	
 
	UpdateAllTownVirtCoords();
 
	return true;
 
}
 

	
src/settings_gui.cpp
Show inline comments
 
@@ -321,8 +321,8 @@ struct GameOptionsWindow : Window {
 
			case GOW_LANG_DROPDOWN: // Change interface language
 
				ReadLanguagePack(index);
 
				CheckForMissingGlyphsInLoadedLanguagePack();
 
				UpdateAllStationVirtCoord();
 
				UpdateAllWaypointSigns();
 
				UpdateAllStationVirtCoords();
 
				UpdateAllWaypointVirtCoords();
 
				ReInitAllWindows();
 
				MarkWholeScreenDirty();
 
				break;
src/signs.cpp
Show inline comments
 
@@ -33,16 +33,13 @@ Sign::~Sign()
 
}
 

	
 
/**
 
 *
 
 * Update the coordinate of one sign
 
 * @param si Pointer to the Sign
 
 *
 
 */
 
void UpdateSignVirtCoords(Sign *si)
 
void Sign::UpdateVirtCoord()
 
{
 
	Point pt = RemapCoords(si->x, si->y, si->z);
 
	SetDParam(0, si->index);
 
	si->sign.UpdatePosition(pt.x, pt.y - 6, STR_SIGN_WHITE);
 
	Point pt = RemapCoords(this->x, this->y, this->z);
 
	SetDParam(0, this->index);
 
	this->sign.UpdatePosition(pt.x, pt.y - 6, STR_SIGN_WHITE);
 
}
 

	
 
/** Update the coordinates of all signs */
 
@@ -50,7 +47,9 @@ void UpdateAllSignVirtCoords()
 
{
 
	Sign *si;
 

	
 
	FOR_ALL_SIGNS(si) UpdateSignVirtCoords(si);
 
	FOR_ALL_SIGNS(si) {
 
		si->UpdateVirtCoord();
 
	}
 
}
 

	
 
/**
src/signs_base.h
Show inline comments
 
@@ -28,6 +28,8 @@ struct Sign : SignPool::PoolItem<&_sign_
 

	
 
	/** Destroy the sign */
 
	~Sign();
 

	
 
	void UpdateVirtCoord();
 
};
 

	
 
#define FOR_ALL_SIGNS_FROM(var, start) FOR_ALL_ITEMS_FROM(Sign, sign_index, var, start)
src/signs_cmd.cpp
Show inline comments
 
@@ -46,7 +46,7 @@ CommandCost CmdPlaceSign(TileIndex tile,
 
		if (!StrEmpty(text)) {
 
			si->name = strdup(text);
 
		}
 
		UpdateSignVirtCoords(si);
 
		si->UpdateVirtCoord();
 
		si->sign.MarkDirty();
 
		InvalidateWindowData(WC_SIGN_LIST, 0, 0);
 
		_new_sign_id = si->index;
 
@@ -82,7 +82,7 @@ CommandCost CmdRenameSign(TileIndex tile
 

	
 
			/* Update; mark sign dirty twice, because it can either become longer, or shorter */
 
			si->sign.MarkDirty();
 
			UpdateSignVirtCoords(si);
 
			si->UpdateVirtCoord();
 
			si->sign.MarkDirty();
 
			InvalidateWindowData(WC_SIGN_LIST, 0, 1);
 
		}
src/signs_func.h
Show inline comments
 
@@ -11,7 +11,6 @@ extern SignID _new_sign_id;
 

	
 
void UpdateAllSignVirtCoords();
 
void PlaceProc_Sign(TileIndex tile);
 
void UpdateSignVirtCoords(Sign *si);
 

	
 
/* signs_gui.cpp */
 
void ShowRenameSignWindow(const Sign *si);
src/station_cmd.cpp
Show inline comments
 
@@ -367,9 +367,7 @@ static Station *GetClosestDeletedStation
 
}
 

	
 
/**
 
 * Update the virtual coords needed to draw the station sign and
 
 * mark the station sign dirty.
 
 * @ingroup dirty
 
 * Update the virtual coords needed to draw the station sign.
 
 */
 
void Station::UpdateVirtCoord()
 
{
 
@@ -384,7 +382,7 @@ void Station::UpdateVirtCoord()
 
}
 

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

	
src/station_func.h
Show inline comments
 
@@ -20,7 +20,7 @@ typedef SmallVector<Station*, 1> Station
 
void FindStationsAroundTiles(TileIndex tile, int w_prod, int h_prod, StationList *stations);
 

	
 
void ShowStationViewWindow(StationID station);
 
void UpdateAllStationVirtCoord();
 
void UpdateAllStationVirtCoords();
 

	
 
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad);
 
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad);
src/town.h
Show inline comments
 
@@ -48,7 +48,7 @@ struct Town : TownPool::PoolItem<&_town_
 
	uint32 townnameparts;
 
	char *name;
 

	
 
	/* NOSAVE: Location of name sign, UpdateTownVirtCoord updates this. */
 
	/* NOSAVE: Location of name sign, UpdateVirtCoord updates this. */
 
	ViewportSign sign;
 

	
 
	/* Makes sure we don't build certain house types twice.
 
@@ -136,6 +136,8 @@ struct Town : TownPool::PoolItem<&_town_
 
		return ((this->population / _settings_game.economy.town_noise_population[_settings_game.difficulty.town_council_tolerance]) + 3);
 
	}
 

	
 
	void UpdateVirtCoord();
 

	
 
	static FORCEINLINE Town *GetByTile(TileIndex tile)
 
	{
 
		return Town::Get(GetTownIndex(tile));
 
@@ -147,7 +149,6 @@ struct Town : TownPool::PoolItem<&_town_
 

	
 
uint32 GetWorldPopulation();
 

	
 
void UpdateTownVirtCoord(Town *t);
 
void UpdateAllTownVirtCoords();
 
void InitializeTown();
 
void ShowTownViewWindow(TownID town);
src/town_cmd.cpp
Show inline comments
 
@@ -324,25 +324,25 @@ static bool IsCloseToTown(TileIndex tile
 
/**
 
 * Resize the sign(label) of the town after changes in
 
 * population (creation or growth or else)
 
 * @param t Town to update
 
 */
 
void UpdateTownVirtCoord(Town *t)
 
void Town::UpdateVirtCoord()
 
{
 
	t->sign.MarkDirty();
 
	Point pt = RemapCoords2(TileX(t->xy) * TILE_SIZE, TileY(t->xy) * TILE_SIZE);
 
	SetDParam(0, t->index);
 
	SetDParam(1, t->population);
 
	t->sign.UpdatePosition(pt.x, pt.y - 24,
 
	this->sign.MarkDirty();
 
	Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
 
	SetDParam(0, this->index);
 
	SetDParam(1, this->population);
 
	this->sign.UpdatePosition(pt.x, pt.y - 24,
 
		_settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL);
 
	t->sign.MarkDirty();
 
	this->sign.MarkDirty();
 
}
 

	
 
/** Update the virtual coords needed to draw the town sign for all towns. */
 
void UpdateAllTownVirtCoords()
 
{
 
	Town *t;
 

	
 
	FOR_ALL_TOWNS(t) {
 
		UpdateTownVirtCoord(t);
 
		t->UpdateVirtCoord();
 
	}
 
}
 

	
 
@@ -355,7 +355,7 @@ static void ChangePopulation(Town *t, in
 
{
 
	t->population += mod;
 
	InvalidateWindow(WC_TOWN_VIEW, t->index);
 
	UpdateTownVirtCoord(t);
 
	t->UpdateVirtCoord();
 

	
 
	InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
 
}
 
@@ -1505,7 +1505,7 @@ static void DoCreateTown(Town *t, TileIn
 
	}
 
	t->townnameparts = townnameparts;
 

	
 
	UpdateTownVirtCoord(t);
 
	t->UpdateVirtCoord();
 
	InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 0);
 

	
 
	t->InitializeLayout(layout);
 
@@ -2285,10 +2285,10 @@ CommandCost CmdRenameTown(TileIndex tile
 
		free(t->name);
 
		t->name = reset ? NULL : strdup(text);
 

	
 
		UpdateTownVirtCoord(t);
 
		t->UpdateVirtCoord();
 
		InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
 
		UpdateAllStationVirtCoord();
 
		UpdateAllWaypointSigns();
 
		UpdateAllStationVirtCoords();
 
		UpdateAllWaypointVirtCoords();
 
		MarkWholeScreenDirty();
 
	}
 
	return CommandCost();
src/waypoint.cpp
Show inline comments
 
@@ -20,12 +20,12 @@ INSTANTIATE_POOL_METHODS(Waypoint)
 
/**
 
 * Update all signs
 
 */
 
void UpdateAllWaypointSigns()
 
void UpdateAllWaypointVirtCoords()
 
{
 
	Waypoint *wp;
 

	
 
	FOR_ALL_WAYPOINTS(wp) {
 
		UpdateWaypointSign(wp);
 
		wp->UpdateVirtCoord();
 
	}
 
}
 

	
src/waypoint.h
Show inline comments
 
@@ -37,6 +37,8 @@ struct Waypoint : WaypointPool::PoolItem
 

	
 
	Waypoint(TileIndex tile = INVALID_TILE) : xy(tile) { }
 
	~Waypoint();
 

	
 
	void UpdateVirtCoord();
 
};
 

	
 
#define FOR_ALL_WAYPOINTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Waypoint, waypoint_index, var, start)
 
@@ -58,7 +60,6 @@ CommandCost RemoveTrainWaypoint(TileInde
 
Station *ComposeWaypointStation(TileIndex tile);
 
void ShowWaypointWindow(const Waypoint *wp);
 
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
 
void UpdateAllWaypointSigns();
 
void UpdateWaypointSign(Waypoint *wp);
 
void UpdateAllWaypointVirtCoords();
 

	
 
#endif /* WAYPOINT_H */
src/waypoint_cmd.cpp
Show inline comments
 
@@ -26,13 +26,13 @@
 
#include "table/strings.h"
 

	
 
/**
 
 * Update the sign for the waypoint
 
 * @param wp Waypoint to update sign */
 
void UpdateWaypointSign(Waypoint *wp)
 
 * Update the virtual coords needed to draw the waypoint sign.
 
 */
 
void Waypoint::UpdateVirtCoord()
 
{
 
	Point pt = RemapCoords2(TileX(wp->xy) * TILE_SIZE, TileY(wp->xy) * TILE_SIZE);
 
	SetDParam(0, wp->index);
 
	wp->sign.UpdatePosition(pt.x, pt.y - 0x20, STR_WAYPOINT_VIEWPORT);
 
	Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
 
	SetDParam(0, this->index);
 
	this->sign.UpdatePosition(pt.x, pt.y - 0x20, STR_WAYPOINT_VIEWPORT);
 
}
 

	
 
/**
 
@@ -211,7 +211,7 @@ CommandCost CmdBuildTrainWaypoint(TileIn
 

	
 
		if (wp->town_index == INVALID_TOWN) MakeDefaultWaypointName(wp);
 

	
 
		UpdateWaypointSign(wp);
 
		wp->UpdateVirtCoord();
 
		wp->sign.MarkDirty();
 
		YapfNotifyTrackLayoutChange(tile, AxisToTrack(axis));
 
	}
 
@@ -319,7 +319,7 @@ CommandCost CmdRenameWaypoint(TileIndex 
 
			wp->name = strdup(text);
 
		}
 

	
 
		UpdateWaypointSign(wp);
 
		wp->UpdateVirtCoord();
 
		MarkWholeScreenDirty();
 
	}
 
	return CommandCost();
0 comments (0 inline, 0 general)