summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-01-15 15:49:01 +0000
committerfrosch <frosch@openttd.org>2012-01-15 15:49:01 +0000
commit0011f9ce45438075bdc4101054fec9b107cb37be (patch)
tree04588b7d38f76a5ce372e13e93246e9bd62f34ef /src
parent15292fa08091e138d9a325ca75a2209225b699b1 (diff)
downloadopenttd-0011f9ce45438075bdc4101054fec9b107cb37be.tar.xz
(svn r23805) -Add: {STRING6} and {STRING7}.
Diffstat (limited to 'src')
-rw-r--r--src/strgen/strgen_base.cpp2
-rw-r--r--src/strings.cpp54
-rw-r--r--src/table/control_codes.h3
-rw-r--r--src/table/strgen_tables.h2
4 files changed, 17 insertions, 44 deletions
diff --git a/src/strgen/strgen_base.cpp b/src/strgen/strgen_base.cpp
index a71724bb3..c87c1a06f 100644
--- a/src/strgen/strgen_base.cpp
+++ b/src/strgen/strgen_base.cpp
@@ -627,6 +627,8 @@ static const CmdStruct *TranslateCmdForCompare(const CmdStruct *a)
strcmp(a->cmd, "STRING3") == 0 ||
strcmp(a->cmd, "STRING4") == 0 ||
strcmp(a->cmd, "STRING5") == 0 ||
+ strcmp(a->cmd, "STRING6") == 0 ||
+ strcmp(a->cmd, "STRING7") == 0 ||
strcmp(a->cmd, "RAW_STRING") == 0) {
return FindCmd("STRING", 6);
}
diff --git a/src/strings.cpp b/src/strings.cpp
index 15d478944..539ffcdbf 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -968,51 +968,17 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
break;
}
- case SCC_STRING1: { // {STRING1}
- /* String that consumes ONE argument */
- StringID str = args->GetInt32(SCC_STRING1);
+ case SCC_STRING1:
+ case SCC_STRING2:
+ case SCC_STRING3:
+ case SCC_STRING4:
+ case SCC_STRING5:
+ case SCC_STRING6:
+ case SCC_STRING7: { // {STRING1..7}
+ /* Strings that consume arguments */
+ StringID str = args->GetInt32(b);
if (game_script && GB(str, TAB_COUNT_OFFSET, TAB_COUNT_BITS) != GAME_TEXT_TAB) break;
- StringParameters sub_args(*args, 1);
- buff = GetStringWithArgs(buff, str, &sub_args, last, next_substr_case_index, game_script);
- next_substr_case_index = 0;
- break;
- }
-
- case SCC_STRING2: { // {STRING2}
- /* String that consumes TWO arguments */
- StringID str = args->GetInt32(SCC_STRING2);
- if (game_script && GB(str, TAB_COUNT_OFFSET, TAB_COUNT_BITS) != GAME_TEXT_TAB) break;
- StringParameters sub_args(*args, 2);
- buff = GetStringWithArgs(buff, str, &sub_args, last, next_substr_case_index, game_script);
- next_substr_case_index = 0;
- break;
- }
-
- case SCC_STRING3: { // {STRING3}
- /* String that consumes THREE arguments */
- StringID str = args->GetInt32(SCC_STRING3);
- if (game_script && GB(str, TAB_COUNT_OFFSET, TAB_COUNT_BITS) != GAME_TEXT_TAB) break;
- StringParameters sub_args(*args, 3);
- buff = GetStringWithArgs(buff, str, &sub_args, last, next_substr_case_index, game_script);
- next_substr_case_index = 0;
- break;
- }
-
- case SCC_STRING4: { // {STRING4}
- /* String that consumes FOUR arguments */
- StringID str = args->GetInt32(SCC_STRING4);
- if (game_script && GB(str, TAB_COUNT_OFFSET, TAB_COUNT_BITS) != GAME_TEXT_TAB) break;
- StringParameters sub_args(*args, 4);
- buff = GetStringWithArgs(buff, str, &sub_args, last, next_substr_case_index, game_script);
- next_substr_case_index = 0;
- break;
- }
-
- case SCC_STRING5: { // {STRING5}
- /* String that consumes FIVE arguments */
- StringID str = args->GetInt32(SCC_STRING5);
- if (game_script && GB(str, TAB_COUNT_OFFSET, TAB_COUNT_BITS) != GAME_TEXT_TAB) break;
- StringParameters sub_args(*args, 5);
+ StringParameters sub_args(*args, b - SCC_STRING1 + 1);
buff = GetStringWithArgs(buff, str, &sub_args, last, next_substr_case_index, game_script);
next_substr_case_index = 0;
break;
diff --git a/src/table/control_codes.h b/src/table/control_codes.h
index 2237a51d4..28266c155 100644
--- a/src/table/control_codes.h
+++ b/src/table/control_codes.h
@@ -65,11 +65,14 @@ enum StringControlCode {
SCC_DATE_LONG,
SCC_DATE_ISO,
+ /* Must be consecutive */
SCC_STRING1,
SCC_STRING2,
SCC_STRING3,
SCC_STRING4,
SCC_STRING5,
+ SCC_STRING6,
+ SCC_STRING7,
SCC_ENCODED,
diff --git a/src/table/strgen_tables.h b/src/table/strgen_tables.h
index 64a6da87e..276a94cce 100644
--- a/src/table/strgen_tables.h
+++ b/src/table/strgen_tables.h
@@ -65,6 +65,8 @@ static const CmdStruct _cmd_structs[] = {
{"STRING3", EmitSingleChar, SCC_STRING3, 4, C_CASE | C_GENDER}, // included string that consumes the string id and THREE arguments
{"STRING4", EmitSingleChar, SCC_STRING4, 5, C_CASE | C_GENDER}, // included string that consumes the string id and FOUR arguments
{"STRING5", EmitSingleChar, SCC_STRING5, 6, C_CASE | C_GENDER}, // included string that consumes the string id and FIVE arguments
+ {"STRING6", EmitSingleChar, SCC_STRING6, 7, C_CASE | C_GENDER}, // included string that consumes the string id and SIX arguments
+ {"STRING7", EmitSingleChar, SCC_STRING7, 8, C_CASE | C_GENDER}, // included string that consumes the string id and SEVEN arguments
{"STATION_FEATURES", EmitSingleChar, SCC_STATION_FEATURES, 1, C_NONE}, // station features string, icons of the features
{"INDUSTRY", EmitSingleChar, SCC_INDUSTRY_NAME, 1, C_CASE | C_GENDER}, // industry, takes an industry #, can have cases