diff --git a/res/core/messages.xml b/res/core/messages.xml
index dfbeecd07..e65d89d1e 100644
--- a/res/core/messages.xml
+++ b/res/core/messages.xml
@@ -7112,6 +7112,15 @@
"$unit($target) receives $int($amount) $resource($resource,$amount) from $unit($unit)."
+
+
+
+
+
+ "$unit($unit) ertränkt $int($amount) Person$if($eq($amount,1),"","en")."
+ "$unit($unit) drowns $int($amount)."
+
+
diff --git a/scripts/eressea/eternath.lua b/scripts/eressea/eternath.lua
index 1a93ad352..4c230e733 100644
--- a/scripts/eressea/eternath.lua
+++ b/scripts/eressea/eternath.lua
@@ -23,6 +23,7 @@ local eternath = {}
function eternath.update()
if b1 and b2 then
+ local size = 5
local units1 = gates.units(b1, size)
local units2 = gates.units(b2, size)
diff --git a/scripts/eressea/gates.lua b/scripts/eressea/gates.lua
index 2fb6736ba..c6ce0d7bc 100644
--- a/scripts/eressea/gates.lua
+++ b/scripts/eressea/gates.lua
@@ -13,7 +13,7 @@ function gates.travel(b, units)
end
function gates.units(b, maxsize)
- local size = maxsize
+ local size = maxsize or 1
local units = {}
local u
diff --git a/src/creport.c b/src/creport.c
index 5f9700533..9829f7e7c 100644
--- a/src/creport.c
+++ b/src/creport.c
@@ -1523,7 +1523,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset)
fprintf(F, "%d;Basis\n", 36);
fprintf(F, "%d;Runde\n", turn);
fprintf(F, "%d;Zeitalter\n", era);
- fprintf(F, "%d;Build\n", VERSION_BUILD);
+ fprintf(F, "%d.%d.%d;Build\n", VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
if (mailto != NULL) {
fprintf(F, "\"%s\";mailto\n", mailto);
fprintf(F, "\"%s\";mailcmd\n", locale_string(f->locale, "mailcmd"));
diff --git a/src/give.c b/src/give.c
index ecbbe949c..8887018ba 100644
--- a/src/give.c
+++ b/src/give.c
@@ -393,6 +393,9 @@ message * disband_men(int n, unit * u, struct order *ord) {
a->data.i += n;
}
#endif
+ if (fval(u->region->terrain, SEA_REGION)) {
+ return msg_message("give_person_ocean", "unit amount", u, n);
+ }
return msg_message("give_person_peasants", "unit amount", u, n);
}
@@ -421,12 +424,19 @@ void give_unit(unit * u, unit * u2, order * ord)
}
if (u2 == NULL) {
+ message *msg;
if (fval(r->terrain, SEA_REGION)) {
- cmistake(u, ord, 152, MSG_COMMERCE);
+ /* TODO: why is this here, but the unit does not actually seem to lose any men? */
+ msg = disband_men(u->number, u, ord);
+ if (msg) {
+ ADDMSG(&u->faction->msgs, msg);
+ }
+ else {
+ cmistake(u, ord, 152, MSG_COMMERCE);
+ }
}
else if (getunitpeasants) {
unit *u3;
- message *msg;
for (u3 = r->units; u3; u3 = u3->next)
if (u3->faction == u->faction && u != u3)
@@ -596,12 +606,10 @@ void give_cmd(unit * u, order * ord)
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
return;
}
- if (!u2) {
- if (!getunitpeasants) {
- ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
- "feedback_unit_not_found", ""));
- return;
- }
+ if (!u2 && !getunitpeasants) {
+ ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
+ "feedback_unit_not_found", ""));
+ return;
}
if (u->items) {
item **itmp = &u->items;
@@ -691,7 +699,7 @@ void give_cmd(unit * u, order * ord)
}
else {
message * msg;
- msg = getunitpeasants ? disband_men(u->number, u, ord) : give_men(u->number, u, u2, ord);
+ msg = u2 ? give_men(u->number, u, u2, ord) : disband_men(u->number, u, ord);
if (msg) {
ADDMSG(&u->faction->msgs, msg);
}
@@ -747,7 +755,7 @@ void give_cmd(unit * u, order * ord)
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
return;
}
- msg = getunitpeasants ? disband_men(u->number, u, ord) : give_men(u->number, u, u2, ord);
+ msg = u2 ? give_men(u->number, u, u2, ord) : disband_men(u->number, u, ord);
if (msg) {
ADDMSG(&u->faction->msgs, msg);
}
diff --git a/src/give.test.c b/src/give.test.c
index f376c4577..517675e4a 100644
--- a/src/give.test.c
+++ b/src/give.test.c
@@ -36,6 +36,33 @@ static void setup_give(struct give *env) {
env->itype->flags |= ITF_HERB;
}
+static void test_give_unit_to_peasants(CuTest * tc) {
+ struct give env;
+ test_cleanup();
+ env.f1 = test_create_faction(0);
+ env.f2 = 0;
+ setup_give(&env);
+ rsetpeasants(env.r, 0);
+ getunitpeasants = true;
+ give_unit(env.src, NULL, NULL);
+ CuAssertIntEquals(tc, 0, env.src->number);
+ CuAssertIntEquals(tc, 1, env.r->land->peasants);
+ test_cleanup();
+}
+
+static void test_give_unit_in_ocean(CuTest * tc) {
+ struct give env;
+ test_cleanup();
+ env.f1 = test_create_faction(0);
+ env.f2 = 0;
+ setup_give(&env);
+ env.r->terrain = test_create_terrain("ocean", SEA_REGION);
+ getunitpeasants = true;
+ give_unit(env.src, NULL, NULL);
+ CuAssertIntEquals(tc, 0, env.src->number);
+ test_cleanup();
+}
+
static void test_give_men(CuTest * tc) {
struct give env;
test_cleanup();
@@ -47,6 +74,21 @@ static void test_give_men(CuTest * tc) {
test_cleanup();
}
+static void test_give_men_in_ocean(CuTest * tc) {
+ struct give env;
+ message * msg;
+
+ test_cleanup();
+ env.f1 = test_create_faction(0);
+ env.f2 = 0;
+ setup_give(&env);
+ env.r->terrain = test_create_terrain("ocean", SEA_REGION);
+ msg = disband_men(1, env.src, NULL);
+ CuAssertStrEquals(tc, "give_person_ocean", (const char *)msg->parameters[0].v);
+ CuAssertIntEquals(tc, 0, env.src->number);
+ test_cleanup();
+}
+
static void test_give_men_too_many(CuTest * tc) {
struct give env;
test_cleanup();
@@ -118,16 +160,16 @@ static void test_give_men_not_to_self(CuTest * tc) {
static void test_give_peasants(CuTest * tc) {
struct give env;
message * msg;
- int peasants;
+
test_cleanup();
env.f1 = test_create_faction(0);
env.f2 = 0;
setup_give(&env);
- peasants = env.r->land->peasants;
+ rsetpeasants(env.r, 0);
msg = disband_men(1, env.src, NULL);
CuAssertStrEquals(tc, "give_person_peasants", (const char*)msg->parameters[0].v);
CuAssertIntEquals(tc, 0, env.src->number);
- CuAssertIntEquals(tc, peasants+1, env.r->land->peasants);
+ CuAssertIntEquals(tc, 1, env.r->land->peasants);
test_cleanup();
}
@@ -207,11 +249,14 @@ CuSuite *get_give_suite(void)
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_give);
SUITE_ADD_TEST(suite, test_give_men);
+ SUITE_ADD_TEST(suite, test_give_men_in_ocean);
SUITE_ADD_TEST(suite, test_give_men_none);
SUITE_ADD_TEST(suite, test_give_men_too_many);
SUITE_ADD_TEST(suite, test_give_men_other_faction);
SUITE_ADD_TEST(suite, test_give_men_requires_contact);
SUITE_ADD_TEST(suite, test_give_men_not_to_self);
+ SUITE_ADD_TEST(suite, test_give_unit_in_ocean);
+ SUITE_ADD_TEST(suite, test_give_unit_to_peasants);
SUITE_ADD_TEST(suite, test_give_peasants);
SUITE_ADD_TEST(suite, test_give_herbs);
SUITE_ADD_TEST(suite, test_give_okay);
diff --git a/src/laws.c b/src/laws.c
index b4f00f91f..6420ab366 100755
--- a/src/laws.c
+++ b/src/laws.c
@@ -4385,6 +4385,7 @@ void init_processor(void)
p += 10; /* rest rng again before economics */
add_proc_region(p, &economics, "Zerstoeren, Geben, Rekrutieren, Vergessen");
+ add_proc_order(p, K_PROMOTION, &promotion_cmd, 0, "Heldenbefoerderung");
p += 10;
if (!keyword_disabled(K_PAY)) {
@@ -4456,7 +4457,6 @@ void init_processor(void)
p += 10;
add_proc_global(p, restack_units, "Einheiten sortieren");
}
- add_proc_order(p, K_PROMOTION, &promotion_cmd, 0, "Heldenbefoerderung");
if (!keyword_disabled(K_NUMBER)) {
add_proc_order(p, K_NUMBER, &renumber_cmd, 0, "Neue Nummern (Einheiten)");
p += 10;
diff --git a/storage b/storage
index 6acf2b4fe..bcc2874cf 160000
--- a/storage
+++ b/storage
@@ -1 +1 @@
-Subproject commit 6acf2b4fec360d7f681275ea3be77002fd2573c7
+Subproject commit bcc2874cf289a1d0fc9cc79ff3ed271403b2e24c