summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/console_gui.cpp5
-rw-r--r--src/fios_gui.cpp3
-rw-r--r--src/genworld_gui.cpp3
-rw-r--r--src/network/network_chat_gui.cpp12
-rw-r--r--src/osk_gui.cpp3
-rw-r--r--src/signs_gui.cpp3
-rw-r--r--src/town_gui.cpp4
7 files changed, 11 insertions, 22 deletions
diff --git a/src/console_gui.cpp b/src/console_gui.cpp
index 2cbb5f3df..e97e458ff 100644
--- a/src/console_gui.cpp
+++ b/src/console_gui.cpp
@@ -451,11 +451,10 @@ static void IConsoleHistoryNavigate(int direction)
if (direction > 0 && _iconsole_history[_iconsole_historypos] == NULL) _iconsole_historypos--;
if (_iconsole_historypos == -1) {
- *_iconsole_cmdline.buf = '\0';
+ _iconsole_cmdline.DeleteAll();
} else {
- ttd_strlcpy(_iconsole_cmdline.buf, _iconsole_history[_iconsole_historypos], _iconsole_cmdline.max_bytes);
+ _iconsole_cmdline.Assign(_iconsole_history[_iconsole_historypos]);
}
- _iconsole_cmdline.UpdateSize();
}
/**
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index 6eac9315e..1a8b49935 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -567,8 +567,7 @@ public:
}
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) {
/* Copy clicked name to editbox */
- ttd_strlcpy(this->text.buf, file->title, this->text.max_bytes);
- this->text.UpdateSize();
+ this->text.Assign(file->title);
this->SetWidgetDirty(WID_SL_SAVE_OSK_TITLE);
}
} else if (!_load_check_data.HasErrors()) {
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 1e6914696..a9fb68a05 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -547,8 +547,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
case WID_GL_RANDOM_BUTTON: // Random seed
_settings_newgame.game_creation.generation_seed = InteractiveRandom();
- snprintf(this->edit_str_buf, this->edit_str_size, "%u", _settings_newgame.game_creation.generation_seed);
- this->text.UpdateSize();
+ this->text.Print("%u", _settings_newgame.game_creation.generation_seed);
this->SetDirty();
break;
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index af5782037..d3caed015 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -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);
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index 800b5ef54..2200db05d 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -188,8 +188,7 @@ struct OskWindow : public Window {
/* Window gets deleted when the parent window removes itself. */
return;
} else { // or reset to original string
- strcpy(qs->text.buf, this->orig_str_buf);
- qs->text.UpdateSize();
+ qs->text.Assign(this->orig_str_buf);
qs->text.MovePos(WKC_END);
this->InvalidateParent();
delete this;
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 09739e6f5..0e2567dcb 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -175,8 +175,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
*/
void ClearFilterTextWidget()
{
- this->edit_str_buf[0] = '\0';
- this->text.UpdateSize();
+ this->text.DeleteAll();
this->SetWidgetDirty(WID_SIL_FILTER_TEXT);
}
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 9634383f9..d34013eca 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -1004,11 +1004,11 @@ public:
this->townnamevalid = GenerateTownName(&this->townnameparts);
if (!this->townnamevalid) {
- this->edit_str_buf[0] = '\0';
+ this->text.DeleteAll();
} else {
GetTownName(this->edit_str_buf, &this->params, this->townnameparts, &this->edit_str_buf[this->edit_str_size - 1]);
+ this->text.UpdateSize();
}
- this->text.UpdateSize();
UpdateOSKOriginalText(this, WID_TF_TOWN_NAME_EDITBOX);
this->SetWidgetDirty(WID_TF_TOWN_NAME_EDITBOX);