Changeset - r10156:5d97c842d2d7
[Not reviewed]
master
0 3 0
smatz - 16 years ago 2008-09-16 19:05:38
smatz@openttd.org
(svn r14345) -Fix: delete the RenameSignWindow when 'its' sign is deleted
Also, it makes sure the RenameSignWindow isn't open when there are no signs (and crashes associted with that)
3 files changed with 15 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/signs.cpp
Show inline comments
 
@@ -36,6 +36,10 @@ Sign::Sign(PlayerID owner)
 
Sign::~Sign()
 
{
 
	free(this->name);
 

	
 
	if (CleaningPool()) return;
 

	
 
	DeleteRenameSignWindow(this->index);
 
	this->owner = INVALID_PLAYER;
 
}
 

	
src/signs_func.h
Show inline comments
 
@@ -15,6 +15,7 @@ void PlaceProc_Sign(TileIndex tile);
 
/* signs_gui.cpp */
 
void ShowRenameSignWindow(const Sign *si);
 
void HandleClickOnSign(const Sign *si);
 
void DeleteRenameSignWindow(SignID sign);
 

	
 
void ShowSignList();
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -286,8 +286,9 @@ struct SignWindow : QueryStringBaseWindo
 

	
 
			case QUERY_EDIT_SIGN_WIDGET_DELETE:
 
				/* Only need to set the buffer to null, the rest is handled as the OK button */
 
				DeleteTextBufferAll(&this->text);
 
				/* FALL THROUGH */
 
				RenameSign(this->cur_sign, "");
 
				/* don't delete this, we are deleted in Sign::~Sign() -> DeleteRenameSignWindow() */
 
				break;
 

	
 
			case QUERY_EDIT_SIGN_WIDGET_OK:
 
				RenameSign(this->cur_sign, this->text.buf);
 
@@ -358,3 +359,10 @@ void ShowRenameSignWindow(const Sign *si
 

	
 
	new SignWindow(&_query_sign_edit_desc, si);
 
}
 

	
 
void DeleteRenameSignWindow(SignID sign)
 
{
 
	SignWindow *w = dynamic_cast<SignWindow *>(FindWindowById(WC_QUERY_STRING, 0));
 

	
 
	if (w != NULL && w->cur_sign == sign) delete w;
 
}
0 comments (0 inline, 0 general)