diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml
index 0d0f40c0b..07b06ba16 100644
--- a/res/core/de/strings.xml
+++ b/res/core/de/strings.xml
@@ -1989,8 +1989,8 @@
STUFE
-
- TEMPORÄRE
+
+ TEMP
TRÄNKE
@@ -2198,7 +2198,7 @@
MACHEN
- MACHE TEMP
+ MACHETEMP
NACH
diff --git a/res/core/en/strings.xml b/res/core/en/strings.xml
index e7115b2f3..c58d11918 100644
--- a/res/core/en/strings.xml
+++ b/res/core/en/strings.xml
@@ -1274,7 +1274,7 @@
LEVEL
-
+
TEMPORARY
@@ -1476,7 +1476,7 @@
MAKE
- MAKE TEMP
+ MAKETEMP
MOVE
diff --git a/src/kernel/config.c b/src/kernel/config.c
index c542bfa59..5fe492633 100644
--- a/src/kernel/config.c
+++ b/src/kernel/config.c
@@ -346,7 +346,7 @@ const char *parameters[MAXPARAMS] = {
"SCHIFF",
"SILBER",
"STRASSEN",
- "TEMPORAERE",
+ "TEMP",
"FLIEHE",
"GEBAEUDE",
"GIB", /* Für HELFE */
@@ -1791,7 +1791,7 @@ void init_options_translation(const struct locale * lang) {
}
}
-static void init_locale(const struct locale *lang)
+void init_locale(const struct locale *lang)
{
variant var;
int i;
diff --git a/src/kernel/config.h b/src/kernel/config.h
index 1305bd473..bca500ab9 100644
--- a/src/kernel/config.h
+++ b/src/kernel/config.h
@@ -177,6 +177,7 @@ extern "C" {
int distribute(int old, int new_value, int n);
void init_locales(void);
+ void init_locale(const struct locale *lang);
int newunitid(void);
int forbiddenid(int id);
diff --git a/src/kernel/order.c b/src/kernel/order.c
index d01c233b7..2c1e7ee89 100644
--- a/src/kernel/order.c
+++ b/src/kernel/order.c
@@ -364,9 +364,11 @@ order *parse_order(const char *s, const struct locale * lang)
sptr = s;
kwd = get_keyword(parse_token(&sptr), lang);
if (kwd == K_MAKE) {
- const char *s = parse_token(&sptr);
+ const char *s, *sp = sptr;
+ s = parse_token(&sp);
if (isparam(s, lang, P_TEMP)) {
kwd = K_MAKETEMP;
+ sptr = sp;
}
}
if (kwd != NOKEYWORD) {
diff --git a/src/kernel/order.test.c b/src/kernel/order.test.c
index 0d769825c..a3b47b472 100644
--- a/src/kernel/order.test.c
+++ b/src/kernel/order.test.c
@@ -1,4 +1,5 @@
#include
+#include
#include "order.h"
#include
@@ -39,10 +40,71 @@ static void test_parse_order(CuTest *tc) {
free_order(ord);
}
+static void test_parse_make(CuTest *tc) {
+ char cmd[32];
+ order *ord;
+ struct locale * lang = get_or_create_locale("en");
+
+ locale_setstring(lang, keyword(K_MAKE), "MAKE");
+ locale_setstring(lang, keyword(K_MAKETEMP), "MAKETEMP");
+ init_locale(lang);
+ ord = parse_order("M hurrdurr", lang);
+ CuAssertPtrNotNull(tc, ord);
+ CuAssertIntEquals(tc, K_MAKE, getkeyword(ord));
+ init_tokens(ord);
+ CuAssertStrEquals(tc, "MAKE hurrdurr", get_command(ord, cmd, sizeof(cmd)));
+ CuAssertStrEquals(tc, "MAKE", getstrtoken());
+ CuAssertStrEquals(tc, "hurrdurr", getstrtoken());
+ free_order(ord);
+}
+
+static void test_parse_make_temp(CuTest *tc) {
+ char cmd[32];
+ order *ord;
+ struct locale * lang = get_or_create_locale("en");
+
+ locale_setstring(lang, keyword(K_MAKE), "MAKE");
+ locale_setstring(lang, keyword(K_MAKETEMP), "MAKETEMP");
+ locale_setstring(lang, "TEMP", "TEMP");
+ init_locale(lang);
+
+ ord = parse_order("M T herp", lang);
+ CuAssertPtrNotNull(tc, ord);
+ CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord));
+ init_tokens(ord);
+ CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, cmd, sizeof(cmd)));
+ CuAssertStrEquals(tc, "MAKETEMP", getstrtoken());
+ CuAssertStrEquals(tc, "herp", getstrtoken());
+ free_order(ord);
+}
+
+static void test_parse_maketemp(CuTest *tc) {
+ char cmd[32];
+ order *ord;
+ struct locale * lang = get_or_create_locale("en");
+
+ locale_setstring(lang, keyword(K_MAKE), "MAKE");
+ locale_setstring(lang, keyword(K_MAKETEMP), "MAKETEMP");
+ locale_setstring(lang, "TEMP", "TEMP");
+ init_locale(lang);
+
+ ord = parse_order("MAKET herp", lang);
+ CuAssertPtrNotNull(tc, ord);
+ CuAssertIntEquals(tc, K_MAKETEMP, getkeyword(ord));
+ init_tokens(ord);
+ CuAssertStrEquals(tc, "MAKETEMP herp", get_command(ord, cmd, sizeof(cmd)));
+ CuAssertStrEquals(tc, "MAKETEMP", getstrtoken());
+ CuAssertStrEquals(tc, "herp", getstrtoken());
+ free_order(ord);
+}
+
CuSuite *get_order_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_create_order);
SUITE_ADD_TEST(suite, test_parse_order);
+ SUITE_ADD_TEST(suite, test_parse_make);
+ SUITE_ADD_TEST(suite, test_parse_make_temp);
+ SUITE_ADD_TEST(suite, test_parse_maketemp);
return suite;
}
diff --git a/src/util/language_struct.h b/src/util/language_struct.h
index fa79fdb57..14f331710 100644
--- a/src/util/language_struct.h
+++ b/src/util/language_struct.h
@@ -1,25 +1,25 @@
#ifndef CLASS_LANGUAGE_STRUCT
#define CLASS_LANGUAGE_STRUCT
-/* This file should not be included by anything in the server. If you
+/* This file should not be included by anything in the server. If you
* feel that you need to include it, it's a sure sign that you're trying to
* do something BAD. */
#define SMAXHASH 2048
typedef struct locale_str {
- unsigned int hashkey;
- struct locale_str *nexthash;
- char *str;
- char *key;
+ unsigned int hashkey;
+ struct locale_str *nexthash;
+ char *str;
+ char *key;
} locale_str;
typedef struct locale {
- unsigned int index;
- struct locale *next;
- unsigned int hashkey;
- const char *name;
- struct locale_str *strings[SMAXHASH];
- struct locale *fallback;
+ const char *name;
+ unsigned int index;
+ struct locale *next;
+ unsigned int hashkey;
+ struct locale_str *strings[SMAXHASH];
+ struct locale *fallback;
} locale;
extern locale *default_locale;