diff --git a/conf/keywords.json b/conf/keywords.json index 3080a03c4..88ee6c2bd 100644 --- a/conf/keywords.json +++ b/conf/keywords.json @@ -1,6 +1,7 @@ { "keywords": { "en" : { + "grow": [ "GROW", "BREED", "PLANT" ], "combat": [ "COMBAT", "FIGHT" ] }, "de": { @@ -51,7 +52,7 @@ "cast": ["ZAUBERE", "ZAUBERN"], "show": ["ZEIGE", "ZEIGEN"], "destroy": ["ZERSTÖRE", "ZERSTÖREN"], - "grow": ["ZÜCHTE", "ZÜCHTEN"], + "grow": ["ZÜCHTE", "PFLANZE", "ZÜCHTEN", "PFLANZEN"], "default": "DEFAULT", "origin": "URSPRUNG", "email": "EMAIL", @@ -59,7 +60,6 @@ "group": "GRUPPE", "sort": ["SORTIERE", "SORTIEREN"], "prefix": "PRÄFIX", - "plant": ["PFLANZE", "PFLANZEN"], "alliance": "ALLIANZ", "claim": ["BEANSPRUCHE", "BEANSPRUCHEN"], "promote": ["BEFÖRDERE", "BEFÖRDERUNG"], diff --git a/res/core/en/strings.xml b/res/core/en/strings.xml index 71681ec44..e68915f06 100644 --- a/res/core/en/strings.xml +++ b/res/core/en/strings.xml @@ -1496,9 +1496,6 @@ PAY - - PLANT - PIRACY @@ -1568,9 +1565,6 @@ DESTROY - - GROW - loot diff --git a/scripts/tests/e3/init.lua b/scripts/tests/e3/init.lua index e0bce3a41..fe7d0c223 100644 --- a/scripts/tests/e3/init.lua +++ b/scripts/tests/e3/init.lua @@ -2,3 +2,4 @@ require 'tests.e3.castles' require 'tests.e3.stealth' require 'tests.e3.spells' require 'tests.e3.rules' +require 'tests.e3.parser' diff --git a/scripts/tests/e3/parser.lua b/scripts/tests/e3/parser.lua new file mode 100644 index 000000000..9d957464d --- /dev/null +++ b/scripts/tests/e3/parser.lua @@ -0,0 +1,57 @@ +require 'lunit' + +module('tests.e3.parser', package.seeall, lunit.testcase) + +function setup() + eressea.game.reset() +end + +function test_set_status_en() + local r = region.create(0, 0, "plain") + local f = faction.create("bug_1882@eressea.de", "human", "en") + local u = unit.create(f, r, 1) + u.status = 1 + u:clear_orders() + u:add_order("COMBAT AGGRESSIVE") + process_orders() + assert_equal(u.status, 0) + u.status = 1 + u:add_order("FIGHT AGGRESSIVE") + process_orders() + assert_equal(u.status, 0) +end + +function test_set_status_de() + local r = region.create(0, 0, "plain") + local f = faction.create("bug_1882@eressea.de", "human", "de") + local u = unit.create(f, r, 1) + u.status = 1 + u:clear_orders() + u:add_order("KAEMPFE AGGRESSIV") + process_orders() + assert_equal(u.status, 0) +end + +function test_breed_horses() + local r = region.create(0, 0, "plain") + local f = faction.create("bug_1886@eressea.de", "human", "en") + local u = unit.create(f, r, 1) + local b = building.create(r, "stables") + b.size = 10 + u.building = b + u:add_item("horse", 2) + u:add_item("money", 2000) + u:set_skill("training", 100) -- 100% chance to duplicate each horse + u:clear_orders() + u:add_order("GROW horses") + process_orders() + assert_equal(4, u:get_item("horse")) + u:clear_orders() + u:add_order("BREED horses") + process_orders() + assert_equal(8, u:get_item("horse")) + u:clear_orders() + u:add_order("PLANT horses") + process_orders() + assert_equal(16, u:get_item("horse")) +end diff --git a/src/economy.c b/src/economy.c index 4ac4210fe..886f2a210 100644 --- a/src/economy.c +++ b/src/economy.c @@ -3270,7 +3270,6 @@ void produce(struct region *r) sabotage_cmd(u, u->thisorder); break; - case K_PLANT: case K_BREED: breed_cmd(u, u->thisorder); break; diff --git a/src/kernel/order.c b/src/kernel/order.c index 4126c4a03..165769807 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -408,7 +408,6 @@ bool is_repeated(const order * ord) case K_TEACH: case K_BREED: case K_PIRACY: - case K_PLANT: case K_MAKE: case K_LOOT: case K_DESTROY: @@ -450,7 +449,6 @@ bool is_exclusive(const order * ord) case K_TEACH: case K_BREED: case K_PIRACY: - case K_PLANT: case K_MAKE: case K_LOOT: case K_DESTROY: @@ -495,7 +493,6 @@ bool is_long(const order * ord) case K_TEACH: case K_BREED: case K_PIRACY: - case K_PLANT: case K_MAKE: case K_LOOT: case K_DESTROY: diff --git a/src/kernel/save.c b/src/kernel/save.c index ca776aff9..95a85cf3b 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -168,8 +168,9 @@ static unit *unitorders(FILE * F, int enc, struct faction *f) if (s[0]) { if (s[0] != '@') { + char token[128]; const char *stok = s; - stok = parse_token_depr(&stok); + stok = parse_token(&stok, token, sizeof(token)); if (stok) { bool quit = false; @@ -192,7 +193,6 @@ static unit *unitorders(FILE * F, int enc, struct faction *f) } break; default: - /* TODO: syntax error message */ break; } if (quit) { diff --git a/src/keyword.c b/src/keyword.c index b4b181797..fde981bb9 100644 --- a/src/keyword.c +++ b/src/keyword.c @@ -138,7 +138,6 @@ const char *keywords[MAXKEYWORDS] = { "group", "sort", "prefix", - "plant", "alliance", "claim", "promote", diff --git a/src/keyword.h b/src/keyword.h index 24e47da51..b8094e74d 100644 --- a/src/keyword.h +++ b/src/keyword.h @@ -64,7 +64,6 @@ typedef enum { K_GROUP, K_SORT, K_PREFIX, - K_PLANT, K_ALLIANCE, K_CLAIM, K_PROMOTION,