Changeset - r10732:aa461adb8898
[Not reviewed]
master
0 4 0
frosch - 15 years ago 2009-01-13 17:28:11
frosch@openttd.org
(svn r15065) -Change (r14919): Allow to select a new station location by ctrl-clicking while distant-join window is open. (PhilSophus)
4 files changed with 15 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/station_gui.cpp
Show inline comments
 
@@ -1203,23 +1203,32 @@ static const WindowDesc _select_station_
 
 * @param w Width of the to-be-built station
 
 * @param h Height of the to-be-built station
 
 * @return whether we need to show the station selection window.
 
 */
 
static bool StationJoinerNeeded(CommandContainer cmd, int w, int h)
 
{
 
	if (CmdFailed(DoCommand(&cmd, CommandFlagsToDCFlags(GetCommandFlags(cmd.cmd))))) return false;
 

	
 
	/* Only show selection if distant join is enabled in the settings */
 
	if (!_settings_game.station.distant_join_stations) return false;
 

	
 
	/* If a window is already opened, we always return true */
 
	if (FindWindowById(WC_SELECT_STATION, 0) != NULL) return true;
 
	/* If a window is already opened and we didn't ctrl-click,
 
	 * return true (i.e. just flash the old window) */
 
	Window *selection_window = FindWindowById(WC_SELECT_STATION, 0);
 
	if (selection_window != NULL) {
 
		if (!_ctrl_pressed) return true;
 

	
 
		/* Abort current distant-join and start new one */
 
		delete selection_window;
 
		UpdateTileSelection();
 
	}
 

	
 
	/* only show the popup, if we press ctrl */
 
	if (!_ctrl_pressed) return false;
 

	
 
	/* Now check if we could build there */
 
	if (CmdFailed(DoCommand(&cmd, CommandFlagsToDCFlags(GetCommandFlags(cmd.cmd))))) return false;
 

	
 
	/* First test for adjacent station */
 
	FindStationsNearby(cmd.tile, w, h, false);
 
	int neighbour_station_count = _stations_nearby_list.Length();
 
	/* Now test for stations fully within station spread */
 
	const Station *st = FindStationsNearby(cmd.tile, w, h, true);
 
	if (_settings_game.station.adjacent_stations) {
src/tilehighlight_func.h
Show inline comments
 
@@ -21,10 +21,12 @@ void ResetObjectToPlace();
 

	
 
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
 
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process);
 
void VpSetPresizeRange(TileIndex from, TileIndex to);
 
void VpSetPlaceSizingLimit(int limit);
 

	
 
void UpdateTileSelection();
 

	
 
extern PlaceProc *_place_proc;
 
extern TileHighlightData _thd;
 

	
 
#endif /* TILEHIGHLIGHT_FUNC_H */
src/viewport.cpp
Show inline comments
 
@@ -2113,13 +2113,12 @@ static HighLightStyle GetAutorailHT(int 
 
/**
 
 * Updates tile highlighting for all cases.
 
 * Uses _thd.selstart and _thd.selend and _thd.place_mode (set elsewhere) to determine _thd.pos and _thd.size
 
 * Also drawstyle is determined. Uses _thd.new.* as a buffer and calls SetSelectionTilesDirty() twice,
 
 * Once for the old and once for the new selection.
 
 * _thd is TileHighlightData, found in viewport.h
 
 * Called by MouseLoop() in windows.cpp
 
 */
 
void UpdateTileSelection()
 
{
 
	int x1;
 
	int y1;
 

	
src/window.cpp
Show inline comments
 
@@ -1742,13 +1742,12 @@ enum MouseClick {
 
	MC_DOUBLE_LEFT,
 

	
 
	MAX_OFFSET_DOUBLE_CLICK = 5,     ///< How much the mouse is allowed to move to call it a double click
 
	TIME_BETWEEN_DOUBLE_CLICK = 500, ///< Time between 2 left clicks before it becoming a double click, in ms
 
};
 

	
 
extern void UpdateTileSelection();
 
extern bool VpHandlePlaceSizingDrag();
 

	
 
static void ScrollMainViewport(int x, int y)
 
{
 
	if (_game_mode != GM_MENU) {
 
		Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
0 comments (0 inline, 0 general)