forked from github/server
disable QUIT FACTION with ifdef QUIT_WITH_TRANSFER
This commit is contained in:
parent
05b8477b8a
commit
f677a21541
|
@ -5196,6 +5196,12 @@
|
||||||
</type>
|
</type>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
|
<message name="transfer_unit" section="economy">
|
||||||
|
<type>
|
||||||
|
<arg name="unit" type="unit"/>
|
||||||
|
</type>
|
||||||
|
</message>
|
||||||
|
|
||||||
<message name="receive_person" section="economy">
|
<message name="receive_person" section="economy">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
|
|
|
@ -38,6 +38,9 @@ msgstr "\"$unit($mage) verwandelt $unit($target) in $race($race,0).\""
|
||||||
msgid "give_person"
|
msgid "give_person"
|
||||||
msgstr "\"$unit($unit) übergibt $int($amount) Person$if($eq($amount,1),\"\",\"en\") an $unit($target).\""
|
msgstr "\"$unit($unit) übergibt $int($amount) Person$if($eq($amount,1),\"\",\"en\") an $unit($target).\""
|
||||||
|
|
||||||
|
msgid "transfer_unit"
|
||||||
|
msgstr "\"$unit($unit) schließt sich unserer Partei an.\""
|
||||||
|
|
||||||
msgid "rust_effect_2"
|
msgid "rust_effect_2"
|
||||||
msgstr "\"$unit($mage) ruft ein fürchterliches Unwetter über seine Feinde. Der magischen Regen lässt alles Eisen rosten.\""
|
msgstr "\"$unit($mage) ruft ein fürchterliches Unwetter über seine Feinde. Der magischen Regen lässt alles Eisen rosten.\""
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ msgstr "\"$unit($mage) tranforms $unit($target) to $race($race,0).\""
|
||||||
msgid "give_person"
|
msgid "give_person"
|
||||||
msgstr "\"$unit($unit) transfers $int($amount) person$if($eq($amount,1),\"\",\"s\") to $unit($target).\""
|
msgstr "\"$unit($unit) transfers $int($amount) person$if($eq($amount,1),\"\",\"s\") to $unit($target).\""
|
||||||
|
|
||||||
|
msgid "transfer_unit"
|
||||||
|
msgstr "\"$unit($unit) joins our faction.\""
|
||||||
|
|
||||||
msgid "rust_effect_2"
|
msgid "rust_effect_2"
|
||||||
msgstr "\"$unit($mage) calls forth a terrible torment over the enemy. The magical rain makes all iron rusty.\""
|
msgstr "\"$unit($mage) calls forth a terrible torment over the enemy. The magical rain makes all iron rusty.\""
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
-- require 'tests.e2.quit'
|
||||||
require 'tests.e2.movement'
|
require 'tests.e2.movement'
|
||||||
require 'tests.e2.astral'
|
require 'tests.e2.astral'
|
||||||
require 'tests.e2.spells'
|
require 'tests.e2.spells'
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
require "lunit"
|
||||||
|
|
||||||
|
module("tests.e2.quit", package.seeall, lunit.testcase)
|
||||||
|
|
||||||
|
function test_quit_faction()
|
||||||
|
local r = region.create(0, 0, "plain")
|
||||||
|
local f1 = faction.create("human")
|
||||||
|
f1.password = "steamedhams"
|
||||||
|
local f2 = faction.create("human")
|
||||||
|
local u1 = unit.create(f1, r, 10)
|
||||||
|
local u2 = unit.create(f2, r, 10)
|
||||||
|
local u3 = unit.create(f1, r, 10)
|
||||||
|
u1:clear_orders()
|
||||||
|
u2:clear_orders()
|
||||||
|
u1:add_order("STIRB steamedhams PARTEI " .. itoa36(f2.id))
|
||||||
|
u2:add_order("KONTAKTIERE " .. itoa36(u1.id))
|
||||||
|
process_orders()
|
||||||
|
assert_equal(f2, u1.faction)
|
||||||
|
assert_equal(f2, u2.faction)
|
||||||
|
assert_equal(f2, u3.faction)
|
||||||
|
end
|
|
@ -1,4 +1,5 @@
|
||||||
-- new tests 2014-06-11
|
-- new tests 2014-06-11
|
||||||
|
require 'tests.laws'
|
||||||
require 'tests.faction'
|
require 'tests.faction'
|
||||||
require 'tests.locale'
|
require 'tests.locale'
|
||||||
require 'tests.movement'
|
require 'tests.movement'
|
||||||
|
@ -6,6 +7,5 @@ require 'tests.pool'
|
||||||
require 'tests.regions'
|
require 'tests.regions'
|
||||||
require 'tests.settings'
|
require 'tests.settings'
|
||||||
require 'tests.study'
|
require 'tests.study'
|
||||||
require 'tests.laws'
|
|
||||||
require 'tests.bindings'
|
require 'tests.bindings'
|
||||||
require 'tests.hunger'
|
require 'tests.hunger'
|
||||||
|
|
|
@ -216,6 +216,7 @@ faction *addfaction(const char *email, const char *password,
|
||||||
const struct race * frace, const struct locale * loc)
|
const struct race * frace, const struct locale * loc)
|
||||||
{
|
{
|
||||||
faction *f = calloc(1, sizeof(faction));
|
faction *f = calloc(1, sizeof(faction));
|
||||||
|
const char *fname;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
||||||
if (!f) abort();
|
if (!f) abort();
|
||||||
|
@ -255,7 +256,8 @@ faction *addfaction(const char *email, const char *password,
|
||||||
addlist(&factions, f);
|
addlist(&factions, f);
|
||||||
fhash(f);
|
fhash(f);
|
||||||
|
|
||||||
slprintf(buf, sizeof(buf), "%s %s", LOC(loc, "factiondefault"), itoa36(f->no));
|
fname = LOC(loc, "factiondefault");
|
||||||
|
slprintf(buf, sizeof(buf), "%s %s", fname ? fname : "faction", itoa36(f->no));
|
||||||
f->name = str_strdup(buf);
|
f->name = str_strdup(buf);
|
||||||
|
|
||||||
if (!f->race) {
|
if (!f->race) {
|
||||||
|
|
|
@ -947,6 +947,8 @@ void transfer_faction(faction *fsrc, faction *fdst) {
|
||||||
int skill_count[MAXSKILLS];
|
int skill_count[MAXSKILLS];
|
||||||
int skill_limit[MAXSKILLS];
|
int skill_limit[MAXSKILLS];
|
||||||
|
|
||||||
|
assert(fsrc != fdst);
|
||||||
|
|
||||||
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
||||||
skill_limit[sk] = faction_skill_limit(fdst, sk);
|
skill_limit[sk] = faction_skill_limit(fdst, sk);
|
||||||
}
|
}
|
||||||
|
@ -985,6 +987,7 @@ void transfer_faction(faction *fsrc, faction *fdst) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ADDMSG(&fdst->msgs, msg_message("transfer_unit", "unit", u));
|
||||||
u_setfaction(u, fdst);
|
u_setfaction(u, fdst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1008,6 +1011,7 @@ int quit_cmd(unit * u, struct order *ord)
|
||||||
param_t p;
|
param_t p;
|
||||||
p = getparam(f->locale);
|
p = getparam(f->locale);
|
||||||
if (p == P_FACTION) {
|
if (p == P_FACTION) {
|
||||||
|
#ifdef QUIT_WITH_TRANSFER
|
||||||
faction *f2 = getfaction();
|
faction *f2 = getfaction();
|
||||||
if (f2 == NULL) {
|
if (f2 == NULL) {
|
||||||
cmistake(u, ord, 66, MSG_EVENT);
|
cmistake(u, ord, 66, MSG_EVENT);
|
||||||
|
@ -1033,6 +1037,10 @@ int quit_cmd(unit * u, struct order *ord)
|
||||||
flags = 0;
|
flags = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
log_error("faction %s: QUIT FACTION is disabled.", factionname(f));
|
||||||
|
flags = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f->flags |= flags;
|
f->flags |= flags;
|
||||||
|
|
|
@ -1915,6 +1915,7 @@ static void test_quit_transfer(CuTest *tc) {
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef QUIT_WITH_TRANSFER
|
||||||
/**
|
/**
|
||||||
* Gifting units with limited skills to another faction.
|
* Gifting units with limited skills to another faction.
|
||||||
*
|
*
|
||||||
|
@ -2034,6 +2035,7 @@ static void test_transfer_faction(CuTest *tc) {
|
||||||
|
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CuSuite *get_laws_suite(void)
|
CuSuite *get_laws_suite(void)
|
||||||
{
|
{
|
||||||
|
@ -2111,11 +2113,13 @@ CuSuite *get_laws_suite(void)
|
||||||
SUITE_ADD_TEST(suite, test_long_orders);
|
SUITE_ADD_TEST(suite, test_long_orders);
|
||||||
SUITE_ADD_TEST(suite, test_long_order_on_ocean);
|
SUITE_ADD_TEST(suite, test_long_order_on_ocean);
|
||||||
SUITE_ADD_TEST(suite, test_quit);
|
SUITE_ADD_TEST(suite, test_quit);
|
||||||
|
#ifdef QUIT_WITH_TRANSFER
|
||||||
SUITE_ADD_TEST(suite, test_quit_transfer);
|
SUITE_ADD_TEST(suite, test_quit_transfer);
|
||||||
SUITE_ADD_TEST(suite, test_quit_transfer_limited);
|
SUITE_ADD_TEST(suite, test_quit_transfer_limited);
|
||||||
SUITE_ADD_TEST(suite, test_quit_transfer_migrants);
|
SUITE_ADD_TEST(suite, test_quit_transfer_migrants);
|
||||||
SUITE_ADD_TEST(suite, test_quit_transfer_hero);
|
SUITE_ADD_TEST(suite, test_quit_transfer_hero);
|
||||||
SUITE_ADD_TEST(suite, test_transfer_faction);
|
SUITE_ADD_TEST(suite, test_transfer_faction);
|
||||||
|
#endif
|
||||||
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue