mirror of
https://github.com/OpenTTD/OpenTTD
synced 2025-12-23 21:22:46 +01:00
(svn r9849) [0.5] -Backport from trunk (r9693, r9694, r9697, r9718, r9719, r9725 and 9726):
- Fix: Crash when destroying bridge with train partially on it [FS#738] (r9726) - Fix: Planes made a 270 degree turn instead of a 90 degree turn on the southern runway of the intercontinental airport [FS#743] (r9725) - Fix: In-game private messages did not work for clients with high ClientIDs (r9719) - Fix: Do not allow building of rail vehicles whose railtype is not available (r9718) - Fix: [YAPF] The guessed path was ignored for ships [FS#736] (r9694)
This commit is contained in:
@@ -1479,7 +1479,7 @@ void ShowJoinStatusWindowAfterJoin(void)
|
||||
AllocateWindowDesc(&_network_join_status_window_desc);
|
||||
}
|
||||
|
||||
static void SendChat(const char *buf, DestType type, byte dest)
|
||||
static void SendChat(const char *buf, DestType type, int dest)
|
||||
{
|
||||
if (buf[0] == '\0') return;
|
||||
if (!_network_server) {
|
||||
@@ -1543,7 +1543,7 @@ static char *ChatTabCompletionFindText(char *buf)
|
||||
static void ChatTabCompletion(Window *w)
|
||||
{
|
||||
static char _chat_tab_completion_buf[lengthof(_edit_str_buf)];
|
||||
Textbuf *tb = &WP(w, querystr_d).text;
|
||||
Textbuf *tb = &WP(w, chatquerystr_d).text;
|
||||
uint len, tb_len;
|
||||
uint item;
|
||||
char *tb_buf, *pre_buf;
|
||||
@@ -1601,7 +1601,7 @@ static void ChatTabCompletion(Window *w)
|
||||
}
|
||||
|
||||
/* Update the textbuffer */
|
||||
UpdateTextBufferSize(&WP(w, querystr_d).text);
|
||||
UpdateTextBufferSize(&WP(w, chatquerystr_d).text);
|
||||
|
||||
SetWindowDirty(w);
|
||||
free(pre_buf);
|
||||
@@ -1615,17 +1615,17 @@ static void ChatTabCompletion(Window *w)
|
||||
_chat_tab_completion_active = false;
|
||||
|
||||
/* Update the textbuffer */
|
||||
UpdateTextBufferSize(&WP(w, querystr_d).text);
|
||||
UpdateTextBufferSize(&WP(w, chatquerystr_d).text);
|
||||
|
||||
SetWindowDirty(w);
|
||||
}
|
||||
free(pre_buf);
|
||||
}
|
||||
|
||||
/* uses querystr_d WP macro
|
||||
* uses querystr_d->caption to store
|
||||
* - type of chat message (Private/Team/All) in bytes 0-7
|
||||
* - destination of chat message in the case of Team/Private in bytes 8-15 */
|
||||
/*
|
||||
* uses chatquerystr_d WP macro
|
||||
* uses chatquerystr_d->caption to store type of chat message (Private/Team/All)
|
||||
*/
|
||||
static void ChatWindowWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
switch (e->event) {
|
||||
@@ -1644,25 +1644,25 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
assert(GB(WP(w, querystr_d).caption, 0, 8) < lengthof(chat_captions));
|
||||
msg = chat_captions[GB(WP(w, querystr_d).caption, 0, 8)];
|
||||
assert(WP(w, chatquerystr_d).caption < lengthof(chat_captions));
|
||||
msg = chat_captions[WP(w, chatquerystr_d).caption];
|
||||
DrawStringRightAligned(w->widget[2].left - 2, w->widget[2].top + 1, msg, 16);
|
||||
DrawEditBox(w, &WP(w, querystr_d), 2);
|
||||
DrawEditBox(w, &WP(w, chatquerystr_d), 2);
|
||||
} break;
|
||||
|
||||
case WE_CLICK:
|
||||
switch (e->we.click.widget) {
|
||||
case 3: { /* Send */
|
||||
DestType type = GB(WP(w, querystr_d).caption, 0, 8);
|
||||
byte dest = GB(WP(w, querystr_d).caption, 8, 8);
|
||||
SendChat(WP(w, querystr_d).text.buf, type, dest);
|
||||
DestType type = (DestType)WP(w, chatquerystr_d).caption;
|
||||
int dest = WP(w, chatquerystr_d).dest;
|
||||
SendChat(WP(w, chatquerystr_d).text.buf, type, dest);
|
||||
} /* FALLTHROUGH */
|
||||
case 0: /* Cancel */ DeleteWindow(w); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WE_MOUSELOOP:
|
||||
HandleEditBox(w, &WP(w, querystr_d), 2);
|
||||
HandleEditBox(w, &WP(w, chatquerystr_d), 2);
|
||||
break;
|
||||
|
||||
case WE_KEYPRESS:
|
||||
@@ -1670,11 +1670,11 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
|
||||
ChatTabCompletion(w);
|
||||
} else {
|
||||
_chat_tab_completion_active = false;
|
||||
switch (HandleEditBoxKey(w, &WP(w, querystr_d), 2, e)) {
|
||||
switch (HandleEditBoxKey(w, &WP(w, chatquerystr_d), 2, e)) {
|
||||
case 1: { /* Return */
|
||||
DestType type = GB(WP(w, querystr_d).caption, 0, 8);
|
||||
byte dest = GB(WP(w, querystr_d).caption, 8, 8);
|
||||
SendChat(WP(w, querystr_d).text.buf, type, dest);
|
||||
DestType type = (DestType)WP(w, chatquerystr_d).caption;
|
||||
int dest = WP(w, chatquerystr_d).dest;
|
||||
SendChat(WP(w, chatquerystr_d).text.buf, type, dest);
|
||||
} /* FALLTHROUGH */
|
||||
case 2: /* Escape */ DeleteWindow(w); break;
|
||||
}
|
||||
@@ -1704,7 +1704,7 @@ static const WindowDesc _chat_window_desc = {
|
||||
ChatWindowWndProc
|
||||
};
|
||||
|
||||
void ShowNetworkChatQueryWindow(DestType type, byte dest)
|
||||
void ShowNetworkChatQueryWindow(DestType type, int dest)
|
||||
{
|
||||
Window *w;
|
||||
|
||||
@@ -1716,11 +1716,12 @@ void ShowNetworkChatQueryWindow(DestType type, byte dest)
|
||||
w = AllocateWindowDesc(&_chat_window_desc);
|
||||
|
||||
LowerWindowWidget(w, 2);
|
||||
WP(w,querystr_d).caption = GB(type, 0, 8) | (dest << 8); // Misuse of caption
|
||||
WP(w,querystr_d).wnd_class = WC_MAIN_TOOLBAR;
|
||||
WP(w,querystr_d).wnd_num = 0;
|
||||
WP(w,querystr_d).afilter = CS_ALPHANUMERAL;
|
||||
InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 0);
|
||||
WP(w, chatquerystr_d).caption = type; // Misuse of caption
|
||||
WP(w, chatquerystr_d).dest = dest;
|
||||
WP(w, chatquerystr_d).afilter = CS_ALPHANUMERAL;
|
||||
WP(w, chatquerystr_d).wnd_class = WC_MAIN_TOOLBAR;
|
||||
WP(w, chatquerystr_d).wnd_num = 0;
|
||||
InitializeTextBuffer(&WP(w, chatquerystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 0);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
Reference in New Issue
Block a user