(svn r26083) -Codechange: pass the CommandContainer for the station joiner around using a reference instead of by-value

This commit is contained in:
rubidium 2013-11-24 14:29:32 +00:00
parent b75e60124d
commit 58c356e935
2 changed files with 7 additions and 7 deletions

View File

@ -2234,7 +2234,7 @@ struct SelectStationWindow : Window {
TileArea area; ///< Location of new station TileArea area; ///< Location of new station
Scrollbar *vscroll; Scrollbar *vscroll;
SelectStationWindow(WindowDesc *desc, CommandContainer cmd, TileArea ta) : SelectStationWindow(WindowDesc *desc, const CommandContainer &cmd, TileArea ta) :
Window(desc), Window(desc),
select_station_cmd(cmd), select_station_cmd(cmd),
area(ta) area(ta)
@ -2351,7 +2351,7 @@ static WindowDesc _select_station_desc(
* @return whether we need to show the station selection window. * @return whether we need to show the station selection window.
*/ */
template <class T> template <class T>
static bool StationJoinerNeeded(CommandContainer cmd, TileArea ta) static bool StationJoinerNeeded(const CommandContainer &cmd, TileArea ta)
{ {
/* Only show selection if distant join is enabled in the settings */ /* Only show selection if distant join is enabled in the settings */
if (!_settings_game.station.distant_join_stations) return false; if (!_settings_game.station.distant_join_stations) return false;
@ -2385,7 +2385,7 @@ static bool StationJoinerNeeded(CommandContainer cmd, TileArea ta)
* @tparam the class to find stations for * @tparam the class to find stations for
*/ */
template <class T> template <class T>
void ShowSelectBaseStationIfNeeded(CommandContainer cmd, TileArea ta) void ShowSelectBaseStationIfNeeded(const CommandContainer &cmd, TileArea ta)
{ {
if (StationJoinerNeeded<T>(cmd, ta)) { if (StationJoinerNeeded<T>(cmd, ta)) {
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
@ -2400,7 +2400,7 @@ void ShowSelectBaseStationIfNeeded(CommandContainer cmd, TileArea ta)
* @param cmd Command to build the station. * @param cmd Command to build the station.
* @param ta Area to build the station in * @param ta Area to build the station in
*/ */
void ShowSelectStationIfNeeded(CommandContainer cmd, TileArea ta) void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta)
{ {
ShowSelectBaseStationIfNeeded<Station>(cmd, ta); ShowSelectBaseStationIfNeeded<Station>(cmd, ta);
} }
@ -2410,7 +2410,7 @@ void ShowSelectStationIfNeeded(CommandContainer cmd, TileArea ta)
* @param cmd Command to build the waypoint. * @param cmd Command to build the waypoint.
* @param ta Area to build the waypoint in * @param ta Area to build the waypoint in
*/ */
void ShowSelectWaypointIfNeeded(CommandContainer cmd, TileArea ta) void ShowSelectWaypointIfNeeded(const CommandContainer &cmd, TileArea ta)
{ {
ShowSelectBaseStationIfNeeded<Waypoint>(cmd, ta); ShowSelectBaseStationIfNeeded<Waypoint>(cmd, ta);
} }

View File

@ -27,7 +27,7 @@ enum StationCoverageType {
int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies); int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies);
void CheckRedrawStationCoverage(const Window *w); void CheckRedrawStationCoverage(const Window *w);
void ShowSelectStationIfNeeded(CommandContainer cmd, TileArea ta); void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta);
void ShowSelectWaypointIfNeeded(CommandContainer cmd, TileArea ta); void ShowSelectWaypointIfNeeded(const CommandContainer &cmd, TileArea ta);
#endif /* STATION_GUI_H */ #endif /* STATION_GUI_H */