summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/api/ai_basestation.cpp2
-rw-r--r--src/station_cmd.cpp2
-rw-r--r--src/station_gui.cpp4
-rw-r--r--src/station_type.h2
-rw-r--r--src/waypoint_cmd.cpp2
-rw-r--r--src/waypoint_gui.cpp2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/ai/api/ai_basestation.cpp b/src/ai/api/ai_basestation.cpp
index 30089609c..aea5d52cc 100644
--- a/src/ai/api/ai_basestation.cpp
+++ b/src/ai/api/ai_basestation.cpp
@@ -38,7 +38,7 @@
{
EnforcePrecondition(false, IsValidBaseStation(station_id));
EnforcePrecondition(false, !::StrEmpty(name));
- EnforcePreconditionCustomError(false, ::strlen(name) < MAX_LENGTH_STATION_NAME_BYTES, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
+ EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_STATION_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
return AIObject::DoCommand(0, station_id, 0, ::Station::IsValidID(station_id) ? CMD_RENAME_STATION : CMD_RENAME_WAYPOINT, name);
}
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 9936c6a8c..bea52f977 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3256,7 +3256,7 @@ CommandCost CmdRenameStation(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
bool reset = StrEmpty(text);
if (!reset) {
- if (strlen(text) >= MAX_LENGTH_STATION_NAME_BYTES) return CMD_ERROR;
+ if (Utf8StringLength(text) >= MAX_LENGTH_STATION_NAME_CHARS) return CMD_ERROR;
if (!IsUniqueStationName(text)) return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
}
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 12a103ee3..b3ac5e310 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -1185,8 +1185,8 @@ struct StationViewWindow : public Window {
case SVW_RENAME:
SetDParam(0, this->window_number);
- ShowQueryString(STR_STATION_NAME, STR_STATION_VIEW_RENAME_STATION_CAPTION, MAX_LENGTH_STATION_NAME_BYTES, MAX_LENGTH_STATION_NAME_PIXELS,
- this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
+ ShowQueryString(STR_STATION_NAME, STR_STATION_VIEW_RENAME_STATION_CAPTION, MAX_LENGTH_STATION_NAME_CHARS, MAX_LENGTH_STATION_NAME_PIXELS,
+ this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
break;
case SVW_TRAINS: // Show list of scheduled trains to this station
diff --git a/src/station_type.h b/src/station_type.h
index 3ba1a478e..9b1bfc27a 100644
--- a/src/station_type.h
+++ b/src/station_type.h
@@ -86,7 +86,7 @@ enum CatchmentArea {
MAX_CATCHMENT = 10, ///< Maximum catchment for airports with "modified catchment" enabled
};
-static const uint MAX_LENGTH_STATION_NAME_BYTES = 31; ///< The maximum length of a station name in bytes including '\0'
+static const uint MAX_LENGTH_STATION_NAME_CHARS = 31; ///< The maximum length of a station name in characters including '\0'
static const uint MAX_LENGTH_STATION_NAME_PIXELS = 180; ///< The maximum length of a station name in pixels
/** List of stations */
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index 510119c7e..c91334051 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -400,7 +400,7 @@ CommandCost CmdRenameWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
bool reset = StrEmpty(text);
if (!reset) {
- if (strlen(text) >= MAX_LENGTH_STATION_NAME_BYTES) return CMD_ERROR;
+ if (Utf8StringLength(text) >= MAX_LENGTH_STATION_NAME_CHARS) return CMD_ERROR;
if (!IsUniqueWaypointName(text)) return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
}
diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp
index b766a81f2..f050b3c26 100644
--- a/src/waypoint_gui.cpp
+++ b/src/waypoint_gui.cpp
@@ -101,7 +101,7 @@ public:
case WAYPVW_RENAME: // rename
SetDParam(0, this->wp->index);
- ShowQueryString(STR_WAYPOINT_NAME, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_STATION_NAME_BYTES, MAX_LENGTH_STATION_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
+ ShowQueryString(STR_WAYPOINT_NAME, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_STATION_NAME_CHARS, MAX_LENGTH_STATION_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
break;
case WAYPVW_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders