1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 21:49:10 +00:00

(svn r24739) -Codechange: Simplify some code by using Textbuf::Assign.

This commit is contained in:
frosch
2012-11-14 22:50:21 +00:00
parent f6d4200f86
commit 6653ac6b36
7 changed files with 11 additions and 22 deletions

View File

@@ -437,14 +437,11 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
/* Change to the found name. Add ': ' if we are at the start of the line (pretty) */
if (pre_buf == tb_buf) {
snprintf(tb->buf, this->edit_str_size, "%s: ", cur_name);
this->text.Print("%s: ", cur_name);
} else {
snprintf(tb->buf, this->edit_str_size, "%s %s", pre_buf, cur_name);
this->text.Print("%s %s", pre_buf, cur_name);
}
/* Update the textbuffer */
this->text.UpdateSize();
this->SetDirty();
free(pre_buf);
return;
@@ -453,12 +450,9 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
if (second_scan) {
/* We walked all posibilities, and the user presses tab again.. revert to original text */
strcpy(tb->buf, _chat_tab_completion_buf);
this->text.Assign(_chat_tab_completion_buf);
_chat_tab_completion_active = false;
/* Update the textbuffer */
this->text.UpdateSize();
this->SetDirty();
}
free(pre_buf);