diff options
author | smatz <smatz@openttd.org> | 2009-09-22 13:54:54 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-09-22 13:54:54 +0000 |
commit | 1da745c9ad04aba82c91a6bf69a8ea5ae57ccba7 (patch) | |
tree | 31138e76073053de9304e8b7c53910fc9c4f25ce /src/strings.cpp | |
parent | 665864e5b035189c10de1d545650662f5797f5d5 (diff) | |
download | openttd-1da745c9ad04aba82c91a6bf69a8ea5ae57ccba7.tar.xz |
(svn r17612) -Feature: possibility to choose (randomise or enter custom) town name before its creation (original patch by Terkhen)
Diffstat (limited to 'src/strings.cpp')
-rw-r--r-- | src/strings.cpp | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index 437619480..ecf3b6294 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -38,6 +38,7 @@ #include "engine_base.h" #include "strgen/strgen.h" #include "gfx_func.h" +#include "townname_func.h" #include "table/strings.h" #include "table/control_codes.h" @@ -105,7 +106,7 @@ const char *GetStringPtr(StringID string) * @param last * @return a formatted string of char */ -static char *GetStringWithArgs(char *buffr, uint string, int64 *argv, const char *last) +char *GetStringWithArgs(char *buffr, uint string, int64 *argv, const char *last) { if (GB(string, 0, 16) == 0) return GetStringWithArgs(buffr, STR_UNDEFINED, argv, last); @@ -913,27 +914,13 @@ static char *FormatString(char *buff, const char *str, int64 *argv, uint casei, case SCC_TOWN_NAME: { // {TOWN} const Town *t = Town::Get(GetInt32(&argv)); - int64 temp[1]; assert(t != NULL); - temp[0] = t->townnameparts; - uint32 grfid = t->townnamegrfid; - if (t->name != NULL) { buff = strecpy(buff, t->name, last); - } else if (grfid == 0) { - /* Original town name */ - buff = GetStringWithArgs(buff, t->townnametype, temp, last); } else { - /* Newgrf town name */ - if (GetGRFTownName(grfid) != NULL) { - /* The grf is loaded */ - buff = GRFTownNameGenerate(buff, t->townnamegrfid, t->townnametype, t->townnameparts, last); - } else { - /* Fallback to english original */ - buff = GetStringWithArgs(buff, SPECSTR_TOWNNAME_ENGLISH, temp, last); - } + buff = GetTownName(buff, t, last); } break; } |