Changeset - r12424:d9959af3645c
[Not reviewed]
master
0 7 0
rubidium - 15 years ago 2009-07-18 08:41:58
rubidium@openttd.org
(svn r16868) -Codechange: unify UpdateAll[Station|Waypoint]VirtCoords
7 files changed with 11 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/saveload/afterload.cpp
Show inline comments
 
@@ -213,13 +213,12 @@ static bool InitializeWindowsAndCaches()
 
	ResetViewportAfterLoadGame();
 

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

	
 
	Company *c;
 
	FOR_ALL_COMPANIES(c) {
 
		/* For each company, verify (while loading a scenario) that the inauguration date is the current year and set it
 
		 * accordingly if it is not the case.  No need to set it on companies that are not been used already,
 
		 * thus the MIN_YEAR (which is really nothing more than Zero, initialized value) test */
src/settings_gui.cpp
Show inline comments
 
@@ -319,13 +319,12 @@ struct GameOptionsWindow : Window {
 
				break;
 

	
 
			case GOW_LANG_DROPDOWN: // Change interface language
 
				ReadLanguagePack(index);
 
				CheckForMissingGlyphsInLoadedLanguagePack();
 
				UpdateAllStationVirtCoords();
 
				UpdateAllWaypointVirtCoords();
 
				ReInitAllWindows();
 
				MarkWholeScreenDirty();
 
				break;
 

	
 
			case GOW_RESOLUTION_DROPDOWN: // Change resolution
 
				if (index < _num_resolutions && ChangeResInGame(_resolutions[index].width, _resolutions[index].height)) {
src/station_base.h
Show inline comments
 
@@ -117,12 +117,17 @@ struct BaseStation {
 
	 * @param available will return false if ever the variable asked for does not exist
 
	 * @return the value stored in the corresponding variable
 
	 */
 
	virtual uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const = 0;
 

	
 
	/**
 
	 * Update the coordinated of the sign (as shown in the viewport).
 
	 */
 
	virtual void UpdateVirtCoord() = 0;
 

	
 
	/**
 
	 * Get the base station belonging to a specific tile.
 
	 * @param tile The tile to get the base station from.
 
	 * @return the station associated with that tile.
 
	 */
 
	static BaseStation *GetByTile(TileIndex tile);
 
};
src/station_cmd.cpp
Show inline comments
 
@@ -30,12 +30,13 @@
 
#include "vehicle_func.h"
 
#include "string_func.h"
 
#include "animated_tile_func.h"
 
#include "elrail_func.h"
 
#include "station_base.h"
 
#include "roadstop_base.h"
 
#include "waypoint.h"
 

	
 
#include "table/strings.h"
 

	
 
/**
 
 * Check whether the given tile is a hangar.
 
 * @param t the tile to of whether it is a hangar.
 
@@ -381,17 +382,21 @@ void Station::UpdateVirtCoord()
 
	this->sign.UpdatePosition(pt.x, pt.y, STR_STATION_SIGN);
 
}
 

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

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

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

	
 
/** Get a mask of the cargo types that the station accepts.
 
 * @param st Station to query
 
 * @return the expected mask
 
 */
src/town_cmd.cpp
Show inline comments
 
@@ -2283,13 +2283,12 @@ CommandCost CmdRenameTown(TileIndex tile
 
		free(t->name);
 
		t->name = reset ? NULL : strdup(text);
 

	
 
		t->UpdateVirtCoord();
 
		InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
 
		UpdateAllStationVirtCoords();
 
		UpdateAllWaypointVirtCoords();
 
	}
 
	return CommandCost();
 
}
 

	
 
/** Called from GUI */
 
void ExpandTown(Town *t)
src/waypoint.cpp
Show inline comments
 
@@ -15,24 +15,12 @@
 
#include "core/pool_func.hpp"
 

	
 
WaypointPool _waypoint_pool("Waypoint");
 
INSTANTIATE_POOL_METHODS(Waypoint)
 

	
 
/**
 
 * Update all signs
 
 */
 
void UpdateAllWaypointVirtCoords()
 
{
 
	Waypoint *wp;
 

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

	
 
/**
 
 * Daily loop for waypoints
 
 */
 
void WaypointsDailyLoop()
 
{
 
	Waypoint *wp;
 

	
src/waypoint.h
Show inline comments
 
@@ -48,9 +48,8 @@ struct Waypoint : WaypointPool::PoolItem
 
#define FOR_ALL_WAYPOINTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Waypoint, waypoint_index, var, start)
 
#define FOR_ALL_WAYPOINTS(var) FOR_ALL_WAYPOINTS_FROM(var, 0)
 

	
 
CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
 
void ShowWaypointWindow(const Waypoint *wp);
 
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
 
void UpdateAllWaypointVirtCoords();
 

	
 
#endif /* WAYPOINT_H */
0 comments (0 inline, 0 general)