Changeset - r9510:6d2f1c62ff65
[Not reviewed]
master
0 3 0
smatz - 16 years ago 2008-06-12 22:29:42
smatz@openttd.org
(svn r13501) -Feature(tte): ctrl+click on sign you own to remove it (Osai, planetmaker)
3 files changed with 14 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/signs_func.h
Show inline comments
 
@@ -12,10 +12,11 @@ extern bool _sign_sort_dirty;
 

	
 
void UpdateAllSignVirtCoords();
 
void PlaceProc_Sign(TileIndex tile);
 

	
 
/* signs_gui.cpp */
 
void ShowRenameSignWindow(const Sign *si);
 
void HandleClickOnSign(const Sign *si);
 

	
 
void ShowSignList();
 

	
 
#endif /* SIGNS_FUNC_H */
src/signs_gui.cpp
Show inline comments
 
@@ -5,12 +5,13 @@
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "gui.h"
 
#include "textbuf_gui.h"
 
#include "window_gui.h"
 
#include "player_gui.h"
 
#include "player_func.h"
 
#include "signs_base.h"
 
#include "signs_func.h"
 
#include "debug.h"
 
#include "variables.h"
 
#include "command_func.h"
 
#include "strings_func.h"
 
@@ -298,12 +299,21 @@ static const WindowDesc _query_sign_edit
 
	190, 170, 260, 42, 260, 42,
 
	WC_QUERY_STRING, WC_NONE,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
 
	_query_sign_edit_widgets,
 
};
 

	
 
void HandleClickOnSign(const Sign *si)
 
{
 
	if (_ctrl_pressed && si->owner == _local_player) {
 
		RenameSign(si->index, "");
 
		return;
 
	}
 
	ShowRenameSignWindow(si);
 
}
 

	
 
void ShowRenameSignWindow(const Sign *si)
 
{
 
	/* Delete all other edit windows and the save window */
 
	DeleteWindowById(WC_QUERY_STRING, 0);
 
	DeleteWindowById(WC_SAVELOAD, 0);
 

	
src/viewport.cpp
Show inline comments
 
@@ -1867,13 +1867,13 @@ static bool CheckClickOnSign(const ViewP
 
			y = y - vp->top  + vp->virtual_top;
 
			FOR_ALL_SIGNS(si) {
 
				if (y >= si->sign.top &&
 
						y <  si->sign.top + 12 &&
 
						x >= si->sign.left &&
 
						x <  si->sign.left + si->sign.width_1) {
 
					ShowRenameSignWindow(si);
 
					HandleClickOnSign(si);
 
					return true;
 
				}
 
			}
 
			break;
 

	
 
		case ZOOM_LVL_OUT_2X:
 
@@ -1881,13 +1881,13 @@ static bool CheckClickOnSign(const ViewP
 
			y = (y - vp->top  + 1) * 2 + vp->virtual_top;
 
			FOR_ALL_SIGNS(si) {
 
				if (y >= si->sign.top &&
 
						y <  si->sign.top + 24 &&
 
						x >= si->sign.left &&
 
						x <  si->sign.left + si->sign.width_1 * 2) {
 
					ShowRenameSignWindow(si);
 
					HandleClickOnSign(si);
 
					return true;
 
				}
 
			}
 
			break;
 

	
 
		case ZOOM_LVL_OUT_4X:
 
@@ -1897,13 +1897,13 @@ static bool CheckClickOnSign(const ViewP
 

	
 
			FOR_ALL_SIGNS(si) {
 
				if (y >= si->sign.top &&
 
						y <  si->sign.top + ScaleByZoom(12, vp->zoom) &&
 
						x >= si->sign.left &&
 
						x <  si->sign.left + ScaleByZoom(si->sign.width_2, vp->zoom)) {
 
					ShowRenameSignWindow(si);
 
					HandleClickOnSign(si);
 
					return true;
 
				}
 
			}
 
			break;
 

	
 
		default: NOT_REACHED();
0 comments (0 inline, 0 general)