From 5c7b93d0ce62ad9db757cc47e6f062b1ddf1f690 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 19 Aug 2014 15:31:16 +0200 Subject: [PATCH 01/11] =?UTF-8?q?Monster=20attackieren=20keine=20Einheiten?= =?UTF-8?q?=20in=20Geb=C3=A4uden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/monsters.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/monsters.c b/src/monsters.c index a882a941c..af35dc54f 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -171,7 +171,7 @@ static order *get_money_for_dragon(region * r, unit * u, int wanted) /* falls der drache launisch ist, oder das regionssilber knapp, greift er alle an */ n = 0; for (u2 = r->units; u2; u2 = u2->next) { - if (u2->faction != u->faction && cansee(u->faction, r, u2, 0)) { + if (inside_building(u2)!=u->building && u2->faction != u->faction && cansee(u->faction, r, u2, 0)) { int m = get_money(u2); if (m == 0 || is_guard(u2, GUARD_TAX)) continue; @@ -533,7 +533,7 @@ static void monster_attacks(unit * u) unit *u2; for (u2 = r->units; u2; u2 = u2->next) { - if (cansee(u->faction, r, u2, 0) && u2->faction != u->faction + if (cansee(u->faction, r, u2, 0) && u2->faction != u->faction && inside_building(u2)!=u->building && chance(0.75)) { order *ord = monster_attack(u, u2); if (ord) From fb7c8a898feb9f820d552ad9541502b37af81055 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 20 Aug 2014 07:00:58 +0200 Subject: [PATCH 02/11] add a test for get_monsters(). I want to make sure I don't break this in the future. --- res/eressea/strings.xml | 2 +- src/kernel/CMakeLists.txt | 1 + src/kernel/faction.test.c | 27 +++++++++++++++++++++++++++ src/test_eressea.c | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/kernel/faction.test.c diff --git a/res/eressea/strings.xml b/res/eressea/strings.xml index e235c4338..387ca981e 100644 --- a/res/eressea/strings.xml +++ b/res/eressea/strings.xml @@ -223,7 +223,7 @@ This badge pronounces its wearer an official visitor to the - region of Muschelplateau. + embassies of Muschelplateau. Dieses Abzeichen identifiziert die Partei seines Trägers offiziell als einen Besucher der Botschafterregion 'Muschelplateau'. diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index 8b97848bf..244407371 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -3,6 +3,7 @@ project(kernel C) SET(_TEST_FILES build.test.c config.test.c +faction.test.c save.test.c ship.test.c spell.test.c diff --git a/src/kernel/faction.test.c b/src/kernel/faction.test.c new file mode 100644 index 000000000..9ac975789 --- /dev/null +++ b/src/kernel/faction.test.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include "faction.h" +#include +#include + +void test_get_monsters(CuTest *tc) { + faction *f; + CuAssertPtrEquals(tc, NULL, get_monsters()); + f = get_or_create_monsters(); + CuAssertPtrEquals(tc, f, get_monsters()); + CuAssertIntEquals(tc, 666, f->no); + CuAssertStrEquals(tc, "Monster", f->name); + free_gamedata(); + CuAssertPtrEquals(tc, NULL, get_monsters()); + f = get_or_create_monsters(); + CuAssertPtrEquals(tc, f, get_monsters()); + CuAssertIntEquals(tc, 666, f->no); +} + +CuSuite *get_faction_suite(void) +{ + CuSuite *suite = CuSuiteNew(); + SUITE_ADD_TEST(suite, test_get_monsters); + return suite; +} diff --git a/src/test_eressea.c b/src/test_eressea.c index 0cc26348c..0836ab5ad 100644 --- a/src/test_eressea.c +++ b/src/test_eressea.c @@ -63,6 +63,7 @@ int RunAllTests(void) ADD_TESTS(suite, functions); ADD_TESTS(suite, umlaut); /* kernel */ + ADD_TESTS(suite, faction); ADD_TESTS(suite, build); ADD_TESTS(suite, pool); ADD_TESTS(suite, curse); From 68fc4df74de50aa6221d0d74e01786f97ece33dd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 19 Aug 2014 15:24:30 +0200 Subject: [PATCH 03/11] Configurable monster attack chance, default to 40%. E3 chance to attack is only 10%. --- conf/e3/config.xml | 1 + critbit | 2 +- src/kernel/config.h | 3 --- src/monsters.c | 6 +++++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/conf/e3/config.xml b/conf/e3/config.xml index 55d020ae6..36b5a692c 100644 --- a/conf/e3/config.xml +++ b/conf/e3/config.xml @@ -118,6 +118,7 @@ + diff --git a/critbit b/critbit index 2a7af5e23..2d901a238 160000 --- a/critbit +++ b/critbit @@ -1 +1 @@ -Subproject commit 2a7af5e2347217ea4efcf7fb3f0bc9c2681d1a17 +Subproject commit 2d901a238b98b14204f9118abc5040ff4904052c diff --git a/src/kernel/config.h b/src/kernel/config.h index 4a2870f81..1305bd473 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -65,9 +65,6 @@ extern "C" { #define PLAGUE_HEALCHANCE 0.25F /* Wahrscheinlichkeit Heilung */ #define PLAGUE_HEALCOST 30 /* Heilkosten */ - /* Chance of a monster attack */ -#define MONSTERATTACK 0.4F - /* Bewegungsweiten: */ #define BP_WALKING 4 #define BP_RIDING 6 diff --git a/src/monsters.c b/src/monsters.c index af35dc54f..0edc5cda2 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -132,6 +132,10 @@ static void reduce_weight(unit * u) } } +static float monster_attack_chance(void) { + return get_param_flt(global.parameters, "rules.monsters.attack_chance", 0.4f); +} + static order *monster_attack(unit * u, const unit * target) { if (u->region != target->region) @@ -747,7 +751,7 @@ void plan_monsters(faction * f) for (r = regions; r; r = r->next) { unit *u; - double attack_chance = MONSTERATTACK; + double attack_chance = monster_attack_chance(); bool attacking = false; for (u = r->units; u; u = u->next) { From bd8d28cfb7145302dea69b5c49c861512a031f0a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 20 Aug 2014 11:55:17 +0200 Subject: [PATCH 04/11] reduce E3 chance to attack to zero for turn re-run --- conf/e3/config.xml | 2 +- critbit | 2 +- iniparser | 2 +- storage | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/e3/config.xml b/conf/e3/config.xml index 36b5a692c..b30ad8bfc 100644 --- a/conf/e3/config.xml +++ b/conf/e3/config.xml @@ -118,7 +118,7 @@ - + diff --git a/critbit b/critbit index 2d901a238..2a7af5e23 160000 --- a/critbit +++ b/critbit @@ -1 +1 @@ -Subproject commit 2d901a238b98b14204f9118abc5040ff4904052c +Subproject commit 2a7af5e2347217ea4efcf7fb3f0bc9c2681d1a17 diff --git a/iniparser b/iniparser index a636c47eb..f84066fb7 160000 --- a/iniparser +++ b/iniparser @@ -1 +1 @@ -Subproject commit a636c47ebdaf602de6a5db81b5cb1b0309dfdae0 +Subproject commit f84066fb7d3254bdd9e89694acc4c1c20d001eed diff --git a/storage b/storage index eabc730c2..c6103e59c 160000 --- a/storage +++ b/storage @@ -1 +1 @@ -Subproject commit eabc730c24e67a9f21ea7c32c558075582275d61 +Subproject commit c6103e59c0938b173c0e08a852ff1cbbc4e284e3 From 7b3a3815008e9c7aaa01dcac7ef59a04ff05384a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 20 Aug 2014 19:26:37 +0200 Subject: [PATCH 05/11] increase version number to 3.1 log an error when trying to create an order for a disabled keyword monsters might be trying to TAX in E3? --- src/build.h | 4 ++-- src/kernel/order.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/build.h b/src/build.h index d908582e5..bfc11ffe7 100644 --- a/src/build.h +++ b/src/build.h @@ -1,3 +1,3 @@ #define VERSION_MAJOR 3 -#define VERSION_MINOR 0 -#define VERSION_BUILD 682 +#define VERSION_MINOR 1 +#define VERSION_BUILD 683 diff --git a/src/kernel/order.c b/src/kernel/order.c index c10a256fd..954429936 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -257,6 +257,11 @@ static order *create_order_i(keyword_t kwd, const char *sptr, int persistent, order *ord = NULL; int lindex; + if (keyword_disabled(kwd)) { + log_error("trying to create an order for disabled keyword %s.", keyword(kwd)); + return NULL; + } + /* if this is just nonsense, then we skip it. */ if (lomem) { switch (kwd) { From aed64a70fb3f67c803030d947bff050c2933f888 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 16 Aug 2014 23:23:37 +0200 Subject: [PATCH 06/11] cut the number of allocations for order-data in half. started writing a test file for orders. --- src/kernel/CMakeLists.txt | 1 + src/kernel/order.c | 57 +++++++++++++++++++-------------------- src/kernel/order.test.c | 48 +++++++++++++++++++++++++++++++++ src/test_eressea.c | 31 +-------------------- 4 files changed, 78 insertions(+), 59 deletions(-) create mode 100644 src/kernel/order.test.c diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index 244407371..898048c0c 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -15,6 +15,7 @@ equipment.test.c curse.test.c item.test.c move.test.c +order.test.c pool.test.c reports.test.c spellbook.test.c diff --git a/src/kernel/order.c b/src/kernel/order.c index 954429936..d01c233b7 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -2,7 +2,7 @@ +-------------------+ | | Christian Schlittchen | Eressea PBEM host | Enno Rehling - | (c) 1998 - 2004 | Katja Zedel + | (c) 1998 - 2014 | Katja Zedel | | +-------------------+ @@ -44,7 +44,7 @@ static struct locale_data *locale_array[16]; static int nlocales = 0; typedef struct order_data { - char *_str; + const char *_str; # ifdef LOMEM int _refcount:20; int _lindex:4; @@ -59,8 +59,6 @@ static void release_data(order_data * data) { if (data) { if (--data->_refcount == 0) { - if (data->_str) - free(data->_str); free(data); } } @@ -182,6 +180,22 @@ void free_orders(order ** olist) } } +static char *mkdata(order_data **pdata, size_t len, keyword_t kwd, int lindex, const char *str) +{ + order_data *data; + char *result; + data = malloc(sizeof(order_data) + len +1); + result = (char *)(data + 1); + data->_keyword = kwd; + data->_lindex = lindex; + data->_refcount = 0; + data->_str = 0; + data->_str = (len > 0) ? result : 0; + if (str) strcpy(result, str); + if (pdata) *pdata = data; + return result; +} + static order_data *create_data(keyword_t kwd, const char *sptr, int lindex) { const char *s = sptr; @@ -204,21 +218,15 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex) data = locale_array[lindex]->study_orders[sk]; if (data == NULL) { const char *skname = skillname(sk, lang); - data = (order_data *)malloc(sizeof(order_data)); + const char *spc = strchr(skname, ' '); + size_t len = strlen(skname); + char *dst = mkdata(&data, len + (spc ? 3 : 0), kwd, lindex, spc ? 0 : skname); locale_array[lindex]->study_orders[sk] = data; - data->_keyword = kwd; - data->_lindex = lindex; - assert(data->_lindex >= 0); - if (strchr(skname, ' ') != NULL) { - size_t len = strlen(skname); - data->_str = malloc(len + 3); - data->_str[0] = '\"'; - memcpy(data->_str + 1, skname, len); - data->_str[len + 1] = '\"'; - data->_str[len + 2] = '\0'; - } - else { - data->_str = _strdup(skname); + if (spc) { + dst[0] = '\"'; + memcpy(dst + 1, skname, len); + dst[len + 1] = '\"'; + dst[len + 2] = '\0'; } data->_refcount = 1; } @@ -231,22 +239,13 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex) else if (kwd != NOKEYWORD && *sptr == 0) { data = locale_array[lindex]->short_orders[kwd]; if (data == NULL) { - data = (order_data *)malloc(sizeof(order_data)); - locale_array[lindex]->short_orders[kwd] = data; - data->_keyword = kwd; - data->_lindex = lindex; - assert(data->_lindex >= 0); - data->_str = NULL; + mkdata(&data, 0, kwd, lindex, 0); data->_refcount = 1; } ++data->_refcount; return data; } - data = (order_data *)malloc(sizeof(order_data)); - data->_keyword = kwd; - data->_lindex = lindex; - assert(data->_lindex >= 0); - data->_str = s ? _strdup(s) : NULL; + mkdata(&data, s ? strlen(s) : 0, kwd, lindex, s); data->_refcount = 1; return data; } diff --git a/src/kernel/order.test.c b/src/kernel/order.test.c new file mode 100644 index 000000000..0d769825c --- /dev/null +++ b/src/kernel/order.test.c @@ -0,0 +1,48 @@ +#include +#include "order.h" + +#include +#include + +#include +#include + +static void test_create_order(CuTest *tc) { + char cmd[32]; + order *ord; + struct locale * lang = get_or_create_locale("en"); + + locale_setstring(lang, "keyword::move", "MOVE"); + ord = create_order(K_MOVE, lang, "NORTH"); + CuAssertPtrNotNull(tc, ord); + CuAssertIntEquals(tc, K_MOVE, getkeyword(ord)); + init_tokens(ord); + CuAssertStrEquals(tc, "MOVE NORTH", get_command(ord, cmd, sizeof(cmd))); + CuAssertStrEquals(tc, "MOVE", getstrtoken()); + CuAssertStrEquals(tc, "NORTH", getstrtoken()); + free_order(ord); +} + +static void test_parse_order(CuTest *tc) { + char cmd[32]; + order *ord; + struct locale * lang = get_or_create_locale("en"); + + locale_setstring(lang, "keyword::move", "MOVE"); + ord = parse_order("MOVE NORTH", lang); + CuAssertPtrNotNull(tc, ord); + CuAssertIntEquals(tc, K_MOVE, getkeyword(ord)); + init_tokens(ord); + CuAssertStrEquals(tc, "MOVE NORTH", get_command(ord, cmd, sizeof(cmd))); + CuAssertStrEquals(tc, "MOVE", getstrtoken()); + CuAssertStrEquals(tc, "NORTH", 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); + return suite; +} diff --git a/src/test_eressea.c b/src/test_eressea.c index 0836ab5ad..576be8b60 100644 --- a/src/test_eressea.c +++ b/src/test_eressea.c @@ -9,36 +9,6 @@ CuSuite *get_##name##_suite(void); \ CuSuiteAddSuite(suite, get_##name##_suite()) -CuSuite *get_tests_suite(void); -CuSuite *get_callback_suite(void); -CuSuite *get_jsonconf_suite(void); -CuSuite *get_json_suite(void); -CuSuite *get_economy_suite(void); -CuSuite *get_laws_suite(void); -CuSuite *get_market_suite(void); -CuSuite *get_battle_suite(void); -CuSuite *get_building_suite(void); -CuSuite *get_curse_suite(void); -CuSuite *get_equipment_suite(void); -CuSuite *get_item_suite(void); -CuSuite *get_magic_suite(void); -CuSuite *get_move_suite(void); -CuSuite *get_pool_suite(void); -CuSuite *get_build_suite(void); -CuSuite *get_reports_suite(void); -CuSuite *get_ship_suite(void); -CuSuite *get_spellbook_suite(void); -CuSuite *get_spell_suite(void); -CuSuite *get_base36_suite(void); -CuSuite *get_config_suite(void); -CuSuite *get_bsdstring_suite(void); -CuSuite *get_functions_suite(void); -CuSuite *get_umlaut_suite(void); -CuSuite *get_ally_suite(void); -CuSuite *get_direction_suite(void); -CuSuite *get_skill_suite(void); -CuSuite *get_keyword_suite(void); - int RunAllTests(void) { CuString *output = CuStringNew(); @@ -56,6 +26,7 @@ int RunAllTests(void) ADD_TESTS(suite, direction); ADD_TESTS(suite, skill); ADD_TESTS(suite, keyword); + ADD_TESTS(suite, order); /* util */ ADD_TESTS(suite, config); ADD_TESTS(suite, base36); From a84e628522f022745f7bae0181bf14ca69fb8071 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 17 Aug 2014 14:24:19 +0200 Subject: [PATCH 07/11] Repair MAKE, which broke when I changed MAKE TEMP. You can now also write MAKETEMP as one word, and we treat it that way. Added unit test coverage for MAKE order parsing. --- res/core/de/strings.xml | 6 ++-- res/core/en/strings.xml | 4 +-- src/kernel/config.c | 4 +-- src/kernel/config.h | 1 + src/kernel/order.c | 4 ++- src/kernel/order.test.c | 62 ++++++++++++++++++++++++++++++++++++++ src/util/language_struct.h | 22 +++++++------- 7 files changed, 84 insertions(+), 19 deletions(-) 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; From 8d30d73bb4924bc2774336fcf17b0c1e3c0d40c4 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 21 Aug 2014 19:50:03 +0200 Subject: [PATCH 08/11] fix preview script sending to testers.txt --- s/preview | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/s/preview b/s/preview index a3935aeb9..9db46f7cb 100755 --- a/s/preview +++ b/s/preview @@ -83,10 +83,10 @@ let turn=$turn+1 } function send() { -echo "sending reports to $1" zip="$turn-$1.zip" zip -q -u $zip $turn-$1.?r email=$(grep "faction=$1:" reports.txt | cut -d: -f2 | sed 's/email=//') +echo "sending reports to $1 / $email" cat /dev/null | mutt -F $ERESSEA/etc/muttrc -s "Testauswertung Spiel $GAME Partei $1" -a $zip -- $email } @@ -153,8 +153,8 @@ case "$1" in sent=1 done if [ $sent -eq 0 ]; then - if [ -e $factions ]; then - for faction in $(cat $factions) ; do + if [ -e ../$factions ]; then + for faction in $(cat ../$factions) ; do send $faction done fi From dea20e94bdf151bb317483c8c2b7ba8e58c6aec3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 22 Aug 2014 07:41:28 +0200 Subject: [PATCH 09/11] New pre-release. --- src/build.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build.h b/src/build.h index bfc11ffe7..8be9fc2e8 100644 --- a/src/build.h +++ b/src/build.h @@ -1,3 +1,3 @@ #define VERSION_MAJOR 3 -#define VERSION_MINOR 1 -#define VERSION_BUILD 683 +#define VERSION_MINOR 2 +#define VERSION_BUILD 684 From e9ccc248951d527c4a1e934896dcbd97f593b248 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 22 Aug 2014 07:44:52 +0200 Subject: [PATCH 10/11] make previews always build from master --- s/cron/previews.sh | 2 +- s/preview | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/s/cron/previews.sh b/s/cron/previews.sh index 91f0444fd..fc9f5f70b 100755 --- a/s/cron/previews.sh +++ b/s/cron/previews.sh @@ -1,6 +1,6 @@ #!/bin/bash -s/preview build +s/preview build master s/preview version for game in 2 3 4 ; do s/preview -g $game run && \ diff --git a/s/preview b/s/preview index 9db46f7cb..f5aebd818 100755 --- a/s/preview +++ b/s/preview @@ -23,6 +23,7 @@ function build() { assert_dir $SOURCE cd $SOURCE git pull || abort "failed to update source. do you have local changes?" +[ -z $1 ] || git checkout $1 s/build || abort "build failed." } @@ -128,7 +129,8 @@ case "$1" in version ;; "build") - build + shift + build $* ;; "setup") setup From beacb850c6b670bbbf6799698164fe6e6302ec2b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 23 Aug 2014 00:35:06 +0200 Subject: [PATCH 11/11] fix MAKE TEMP, for real this time. I hate skip_token and all that stuff. --- res/core/en/strings.xml | 2 +- s/preview | 2 +- src/laws.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/res/core/en/strings.xml b/res/core/en/strings.xml index c58d11918..f91b1d9a7 100644 --- a/res/core/en/strings.xml +++ b/res/core/en/strings.xml @@ -1476,7 +1476,7 @@ MAKE - MAKETEMP + MAKETEMP MOVE diff --git a/s/preview b/s/preview index f5aebd818..c25987ced 100755 --- a/s/preview +++ b/s/preview @@ -88,7 +88,7 @@ zip="$turn-$1.zip" zip -q -u $zip $turn-$1.?r email=$(grep "faction=$1:" reports.txt | cut -d: -f2 | sed 's/email=//') echo "sending reports to $1 / $email" -cat /dev/null | mutt -F $ERESSEA/etc/muttrc -s "Testauswertung Spiel $GAME Partei $1" -a $zip -- $email +cat /dev/null | mutt -F $ERESSEA/etc/muttrc -s "Testauswertung Spiel $game Partei $1" -a $zip -- $email } game=0 diff --git a/src/laws.c b/src/laws.c index d24ae795a..fe2ec329b 100755 --- a/src/laws.c +++ b/src/laws.c @@ -3627,6 +3627,8 @@ void new_units(void) } continue; } + init_tokens(makeord); + skip_token(); alias = getid(); token = getstrtoken();