Change: move "give money" from client-list to company window
This is a much better location for this button, as you send money from one company to another company, not from player to player. This is based on work done by JGRPP in: https://github.com/JGRennison/OpenTTD-patches/commit/f82054339124cc6b89c5f4f9dac2d9da62f0108b and surrounding commits, which took the work from estys: https://www.tt-forums.net/viewtopic.php?p=1183311#p1183311 We did modify it to fix several bugs and clean up the code while here anyway. The callback was removed, as it meant a modified client could prevent anyone from seeing money was transfered. The message is now generated in the command itself, making that impossible.
This commit is contained in:
committed by
Patric Stout
parent
d6e15d4943
commit
62cdadb582
+6
-9
@@ -1047,13 +1047,9 @@ struct QueryStringWindow : public Window
|
||||
void OnOk()
|
||||
{
|
||||
if (this->editbox.orig == nullptr || strcmp(this->editbox.text.buf, this->editbox.orig) != 0) {
|
||||
/* If the parent is nullptr, the editbox is handled by general function
|
||||
* HandleOnEditText */
|
||||
if (this->parent != nullptr) {
|
||||
this->parent->OnQueryTextFinished(this->editbox.text.buf);
|
||||
} else {
|
||||
HandleOnEditText(this->editbox.text.buf);
|
||||
}
|
||||
assert(this->parent != nullptr);
|
||||
|
||||
this->parent->OnQueryTextFinished(this->editbox.text.buf);
|
||||
this->editbox.handled = true;
|
||||
}
|
||||
}
|
||||
@@ -1113,13 +1109,14 @@ static WindowDesc _query_string_desc(
|
||||
* @param str StringID for the text shown in the textbox
|
||||
* @param caption StringID of text shown in caption of querywindow
|
||||
* @param maxsize maximum size in bytes or characters (including terminating '\0') depending on flags
|
||||
* @param parent pointer to a Window that will handle the events (ok/cancel) of this
|
||||
* window. If nullptr, results are handled by global function HandleOnEditText
|
||||
* @param parent pointer to a Window that will handle the events (ok/cancel) of this window.
|
||||
* @param afilter filters out unwanted character input
|
||||
* @param flags various flags, @see QueryStringFlags
|
||||
*/
|
||||
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
|
||||
{
|
||||
assert(parent != nullptr);
|
||||
|
||||
DeleteWindowByClass(WC_QUERY_STRING);
|
||||
new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, &_query_string_desc, parent, afilter, flags);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user