summaryrefslogtreecommitdiff
path: root/src/misc_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc_cmd.cpp')
-rw-r--r--src/misc_cmd.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp
index 0d6ebf143..dadc73a6d 100644
--- a/src/misc_cmd.cpp
+++ b/src/misc_cmd.cpp
@@ -205,12 +205,9 @@ CommandCost CmdDecreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
static bool IsUniqueCompanyName(const char *name)
{
const Company *c;
- char buf[512];
FOR_ALL_COMPANIES(c) {
- SetDParam(0, c->index);
- GetString(buf, STR_COMPANY_NAME, lastof(buf));
- if (strcmp(buf, name) == 0) return false;
+ if (c->name != NULL && strcmp(c->name, name) == 0) return false;
}
return true;
@@ -244,12 +241,9 @@ CommandCost CmdRenameCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
static bool IsUniquePresidentName(const char *name)
{
const Company *c;
- char buf[512];
FOR_ALL_COMPANIES(c) {
- SetDParam(0, c->index);
- GetString(buf, STR_PRESIDENT_NAME, lastof(buf));
- if (strcmp(buf, name) == 0) return false;
+ if (c->president_name != NULL && strcmp(c->president_name, name) == 0) return false;
}
return true;