Merge pull request #121 from badgerman/version-3-4

Version 3.4 final preparations before launch
This commit is contained in:
Enno Rehling 2015-01-29 18:08:58 +01:00
commit 87735c6c8e
24 changed files with 179 additions and 423 deletions

View File

@ -58,6 +58,7 @@
<order name="tax" disable="yes"/>
<order name="entertain" disable="yes"/>
<order name="sell" disable="yes"/>
<order name="origin" disable="yes"/>
<skill name="armorer" enable="true"/>
<skill name="bow" enable="true"/>

View File

@ -1,16 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///game/"
rewritePrefix="../res/eressea/" />
<rewriteURI
uriStartString="config:///default/"
rewritePrefix="../res/" />
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../core/res/" />
</catalog>

View File

@ -1,114 +0,0 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config:///core/messages.xml"/>
<!-- Localization -->
<xi:include href="config:///core/de/strings.xml"/>
<xi:include href="config:///core/en/strings.xml"/>
<xi:include href="config:///game/spellinfo.xml" />
<xi:include href="config:///core/common/items.xml" />
<xi:include href="config:///core/common/armor.xml" />
<xi:include href="config:///core/common/weapons.xml" />
<xi:include href="config:///core/common/resources.xml" />
<xi:include href="config:///core/common/luxuries.xml" />
<xi:include href="config:///core/common/herbs.xml" />
<xi:include href="config:///core/common/potions.xml" />
<xi:include href="config:///core/spoils.xml"/>
<xi:include href="config:///game/races.xml"/>
<xi:include href="config:///core/prefixes.xml"/>
<xi:include href="config:///core/ships.xml"/>
<xi:include href="config:///core/common/buildings.xml"/>
<xi:include href="config:///game/familiars.xml"/>
<xi:include href="config:///core/terrains.xml"/>
<xi:include href="config:///game/terrains.xml"/>
<xi:include href="config:///game/artrewards.xml"/>
<xi:include href="config:///game/buildings.xml"/>
<xi:include href="config:///core/calendar.xml"/>
<calendar name="secondage" newyear="month_1" start="184"/>
<xi:include href="config:///game/equipment.xml"/>
<xi:include href="config:///game/items.xml"/>
<xi:include href="config:///game/spells.xml"/>
<xi:include href="config:///game/strings.xml"/>
<xi:include href="config:///default/adamantium.xml"/>
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="30"/>
<item name="stone" amount="30"/>
<item name="money" amount="4200"/>
</set>
<set name="new_faction">
<item name="adamantium" amount="1"/>
</set>
</equipment>
<xi:include href="config:///default/names-undead.xml"/>
<xi:include href="config:///default/names-skeletons.xml"/>
<xi:include href="config:///default/names-zombies.xml"/>
<xi:include href="config:///default/names-ghouls.xml"/>
<xi:include href="config:///default/names-dragons.xml"/>
<game name="Eressea">
<!-- Game specific settings -->
<skill name="alchemy" enable="true"/>
<skill name="crossbow" enable="true"/>
<skill name="mining" enable="true"/>
<skill name="bow" enable="true"/>
<skill name="building" enable="true"/>
<skill name="trade" enable="true"/>
<skill name="forestry" enable="true"/>
<skill name="catapult" enable="true"/>
<skill name="herbalism" enable="true"/>
<skill name="magic" enable="true"/>
<skill name="training" enable="true"/>
<skill name="riding" enable="true"/>
<skill name="armorer" enable="true"/>
<skill name="shipcraft" enable="true"/>
<skill name="melee" enable="true"/>
<skill name="sailing" enable="true"/>
<skill name="polearm" enable="true"/>
<skill name="espionage" enable="true"/>
<skill name="quarrying" enable="true"/>
<skill name="roadwork" enable="true"/>
<skill name="tactics" enable="true"/>
<skill name="stealth" enable="true"/>
<skill name="entertainment" enable="true"/>
<skill name="weaponsmithing" enable="true"/>
<skill name="cartmaking" enable="true"/>
<skill name="perception" enable="true"/>
<skill name="taxation" enable="true"/>
<skill name="stamina" enable="true"/>
<skill name="unarmed" enable="true"/>
<param name="NewbieImmunity" value="8"/>
<param name="modules.wormholes" value="1"/>
<param name="entertain.base" value="0"/>
<param name="entertain.perlevel" value="20"/>
<param name="nmr.timeout" value="5"/>
<param name="nmr.removenewbie" value="10"/>
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="1"/>
<param name="init_spells" value="0"/>
<param name="rules.check_overload" value="0"/>
<param name="rules.limit.faction" value="2500"/>
<param name="rules.maxskills.magic" value="5"/>
</game>
<strings>
<string name="mailto">
<text locale="de">eressea-server@eressea.de</text>
<text locale="en">eressea-server@eressea.de</text>
</string>
<string name="newbie_info_1">
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff
ERESSEA BEFEHLE an eressea-server@eressea.de zu senden.</text>
<text locale="en">Remember to send your orders to
eressea-server@eressea.de with the subject ERESSEA ORDERS.</text>
</string>
<string name="mailcmd">
<text locale="de">ERESSEA BEFEHLE</text>
<text locale="en">ERESSEA ORDERS</text>
</string>
</strings>
</eressea>

View File

@ -1,16 +0,0 @@
[eressea]
base = .
report = reports
verbose = 0
lomem = 0
debug = 0
memcheck = 0
locales = de,en
[config]
rules = eressea
source_dir = ..
maxnmrs = 10
[editor]
color = 1

View File

@ -1,2 +0,0 @@
require "setup"
run_tests()

View File

@ -1,14 +0,0 @@
local srcpath = config.source_dir
local respath = srcpath .. '/res'
local paths = {
'scripts/?.lua',
'core/scripts/?.lua',
'lunit/?.lua'
}
for idx, path in pairs(paths) do
package.path = srcpath .. '/' .. path .. ';' .. package.path
end
assert(read_xml())
require "init"

View File

@ -1,16 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///game/"
rewritePrefix="../res/e3a/" />
<rewriteURI
uriStartString="config:///default/"
rewritePrefix="../res/" />
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../core/res/" />
</catalog>

View File

@ -1,182 +0,0 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config:///core/messages.xml"/>
<xi:include href="config:///core/de/strings.xml"/>
<xi:include href="config:///core/en/strings.xml"/>
<xi:include href="config:///core/common/items.xml"/>
<xi:include href="config:///core/common/herbs.xml" />
<xi:include href="config:///core/spoils.xml"/>
<xi:include href="config:///core/prefixes.xml"/>
<xi:include href="config:///core/common/buildings.xml"/>
<xi:include href="config:///game/familiars.xml"/>
<xi:include href="config:///game/ships.xml"/>
<xi:include href="config:///game/shipnames.xml"/>
<xi:include href="config:///game/terrains.xml"/>
<xi:include href="config:///core/calendar.xml"/>
<xi:include href="config:///game/items.xml" />
<xi:include href="config:///game/strings.xml"/>
<xi:include href="config:///game/messages.xml"/>
<xi:include href="config:///game/races.xml"/>
<xi:include href="config:///game/buildings.xml"/>
<xi:include href="config:///game/equipment.xml"/>
<xi:include href="config:///game/spells.xml"/>
<xi:include href="config:///game/luxuries.xml" />
<xi:include href="config:///game/weapons.xml" />
<xi:include href="config:///game/armor.xml" />
<xi:include href="config:///game/resources.xml" />
<calendar name="thirdage" newyear="month_1" start="1"/>
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="10"/>
<item name="stone" amount="10"/>
<item name="money" amount="5000"/>
</set>
</equipment>
<xi:include href="config:///default/names-undead.xml"/>
<xi:include href="config:///default/names-skeletons.xml"/>
<xi:include href="config:///default/names-zombies.xml"/>
<xi:include href="config:///default/names-ghouls.xml"/>
<xi:include href="config:///default/names-dragons.xml"/>
<game name="E4">
<!-- Game specific settings -->
<param name="database.gameid" value="7"></param>
<order name="BELAGERE" disable="yes"/>
<order name="BEKLAUEN" disable="yes"/>
<order name="GM" disable="yes"/>
<order name="KAUFEN" disable="yes"/>
<order name="LEHREN" disable="yes"/>
<order name="SABOTIEREN" disable="yes"/>
<order name="SPIONIEREN" disable="yes"/>
<order name="TREIBEN" disable="yes"/>
<order name="UNTERHALTEN" disable="yes"/>
<order name="VERKAUFEN" disable="yes"/>
<skill name="armorer" enable="true"/>
<skill name="bow" enable="true"/>
<skill name="building" enable="true"/>
<skill name="cartmaking" enable="true"/>
<skill name="catapult" enable="true"/>
<skill name="crossbow" enable="true"/>
<skill name="forestry" enable="true"/>
<skill name="magic" enable="true"/>
<skill name="melee" enable="true"/>
<skill name="mining" enable="true"/>
<skill name="polearm" enable="true"/>
<skill name="quarrying" enable="true"/>
<skill name="riding" enable="true"/>
<skill name="roadwork" enable="true"/>
<skill name="sailing" enable="true"/>
<skill name="shipcraft" enable="true"/>
<skill name="stamina" enable="true"/>
<skill name="tactics" enable="true"/>
<skill name="training" enable="true"/>
<skill name="unarmed" enable="true"/>
<skill name="weaponsmithing" enable="true"/>
<skill name="herbalism" enable="false"/>
<skill name="alchemy" enable="false"/>
<skill name="entertainment" enable="false"/>
<skill name="espionage" enable="false"/>
<skill name="perception" enable="false"/>
<skill name="stealth" enable="false"/>
<skill name="taxation" enable="false"/>
<skill name="trade" enable="false"/>
<param name="NewbieImmunity" value="9"/> <!-- ends after turn 9 -->
<param name="modules.astralspace" value="0"/>
<param name="modules.wormholes" value="0"/>
<param name="modules.markets" value="1"/>
<!-- resource limitations -->
<param name="magic.regeneration" value="0.75"/>
<param name="magic.power" value="0.5"/>
<param name="resource.factor" value="0.25"/>
<param name="skills.cost.tactics" value="500"/>
<param name="entertain.base" value="0"/>
<param name="entertain.perlevel" value="20"/>
<param name="nmr.timeout" value="5"/>
<param name="nmr.removenewbie" value="0"/>
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="0"/>
<param name="hunger.demon.skill" value="1"/>
<param name="hunger.damage" value="1d9+9"/>
<param name="hunger.demons" value="1"/>
<param name="init_spells" value="0"/>
<param name="recruit.allow_merge" value="1"/>
<param name="study.expensivemigrants" value="1"/>
<param name="study.speedup" value="0"/>
<param name="world.era" value="3"/>
<param name="rules.migrants" value="0"/>
<param name="rules.transfermen" value="0"/>
<param name="rules.stealth.faction" value="1"/>
<param name="rules.stealth.anon_battle" value="0"/>
<param name="rules.check_overload" value="0"/>
<param name="rules.combat.goblinbonus" value="3"/>
<param name="rules.ship.damage_drift" value="0.00"/> <!-- percent damage from drifting-->
<param name="rules.alliances" value="1"/>
<param name="rules.combat.herospeed" value="3"/>
<param name="rules.combat.demon_vampire" value="5"/> <!-- regen 1 hp per X points of damage done -->
<param name="rules.combat.nat_armor" value="1"/>
<param name="rules.combat.skill_bonus" value="0"/>
<!--param name="rules.combat.loot" value="5"/--> <!-- only self + others - keeploot -->
<param name="rules.items.loot_divisor" value="2"/> <!-- damage skims off 1/2 of goods transfers -->
<param name="rules.items.give_divisor" value="2"/> <!-- corruption skims off 1/2 of goods transfers -->
<param name="rules.move.owner_leave" value="1"/> <!-- owner must leave before moving -->
<param name="rules.region_owners" value="1"/>
<param name="rules.cavalry.skill" value="2"/>
<param name="rules.cavalry.mode" value="1"/>
<param name="rules.magic.multipotion" value="1"/>
<param name="rules.magic.wol_effect" value="5"/>
<param name="rules.magic.factionlist" value="1"/>
<param name="rules.magic.wol_type" value="2"/>
<param name="rules.magic.blessed_harvest" value="1"/>
<param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>
<param name="rules.build.other_buildings" value="1"/>
<param name="rules.economy.taxation" value="1"/>
<param name="rules.economy.food" value="2"/>
<param name="rules.economy.wages" value="1"/>
<param name="rules.economy.roqf" value="5"/>
<param name="rules.economy.herbrot" value="0"/>
<param name="rules.dwarf_castles" value="1"/>
<!-- param name="rules.nmr.destroy" value="1"/ -->
<param name="rules.limit.faction" value="250"/>
<!--param name="rules.give" value="15"/ --> <!-- self + peasants + herbs + lux - goods -->
<param name="rules.economy.grow" value="1"/>
<param name="rules.tactics.formula" value="1"/> <!-- 10% per skilldiff -->
<param name="rules.help.mask" value="fight guard money give"/>
<param name="movement.shipspeed.skillbonus" value="6"/>
<param name="alliance.auto" value="fight"/>
<param name="alliance.restricted" value="fight"/>
</game>
<rules>
<function name="wage" value="minimum_wage"/>
</rules>
<strings>
<string name="mailto">
<text locale="de">eressea-server@eressea.de</text>
<text locale="en">eressea-server@eressea.de</text>
</string>
<string name="newbie_info_1">
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff
ERESSEA 4 BEFEHLE an eressea-server@eressea.de zu senden.</text>
<text locale="en">Remember to send your orders to
eressea-server@eressea.de with the subject ERESSEA 4 ORDERS.</text>
</string>
<string name="mailcmd">
<text locale="de">ERESSEA 4 BEFEHLE</text>
<text locale="en">ERESSEA 4 ORDERS</text>
</string>
</strings>
</eressea>

View File

@ -1,16 +0,0 @@
[eressea]
base = .
report = reports
verbose = 0
lomem = 0
debug = 0
memcheck = 0
locales = de,en
[config]
rules = e3a
source_dir = ..
maxnmrs = 20
[editor]
color = 1

View File

@ -1,2 +0,0 @@
require "setup"
run_tests()

View File

@ -1,14 +0,0 @@
local srcpath = config.source_dir
local respath = srcpath .. '/res'
local paths = {
'scripts/?.lua',
'core/scripts/?.lua',
'lunit/?.lua'
}
for idx, path in pairs(paths) do
package.path = srcpath .. '/' .. path .. ';' .. package.path
end
assert(read_xml())
require "init"

View File

@ -1,6 +1,10 @@
<?xml version="1.0"?>
<resources>
<resource name="money">
<item weight="0"/>
</resource>
<resource name="ao_healing" appearance="amulet">
<item weight="0" score="6000"/>
</resource>

View File

@ -712,6 +712,42 @@ function test_golem_use_four_iron()
assert_equal(4, u1:get_item("towershield"))
end
function skip_test_silver_weight_stops_movement()
local r1 = region.create(1, 1, "plain")
local r2 = region.create(2, 1, "plain")
region.create(3, 1, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r1, 1)
u1:clear_orders()
u1:add_order("NACH OST")
u1:add_item("money", 540)
assert_equal(1540, u1.weight)
process_orders()
assert_equal(r2, u1.region)
u1:add_item("money", 1)
process_orders()
assert_equal(r2, u1.region)
end
function skip_test_silver_weight_stops_ship()
local r1 = region.create(1, 1, "ocean")
local r2 = region.create(2, 1, "ocean")
region.create(3, 1, "ocean")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r1, 1)
u1:set_skill("sailing", 3)
local s1 = ship.create(r1, "canoe")
u1.ship = s1
u1:clear_orders()
u1:add_order("NACH OST")
u1:add_item("money", 2000)
process_orders()
assert_equal(r2, u1.region)
u1:add_item("money", 1)
process_orders()
assert_equal(r2, u1.region)
end
function test_building_owner_can_enter_ship()
local r1 = region.create(1, 2, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
@ -734,3 +770,12 @@ function test_building_owner_can_enter_ship()
assert_equal(s1, u1.ship)
assert_equal(null, u1.building, "owner of the building can not go into a ship")
end
function test_weightless_silver()
local r1 = region.create(1, 2, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r1, 1)
assert_equal(1000, u1.weight)
u1:add_item("money", 540)
assert_equal(1000, u1.weight)
end

View File

@ -21,6 +21,7 @@ race.test.c
spellbook.test.c
curse.test.c
jsonconf.test.c
messages.test.c
)
SET(_FILES

View File

@ -143,6 +143,27 @@ static void test_fix_demand(CuTest *tc) {
test_cleanup();
}
static void test_core_resources(CuTest *tc) {
resource_type * rtype;
test_cleanup();
init_resources();
CuAssertPtrNotNull(tc, rtype = rt_find("money"));
CuAssertPtrNotNull(tc, rtype->itype);
CuAssertPtrNotNull(tc, rtype->uchange);
CuAssertPtrNotNull(tc, rtype->itype->give);
CuAssertPtrNotNull(tc, rtype = rt_find("peasant"));
CuAssertPtrEquals(tc, 0, rtype->itype);
CuAssertPtrNotNull(tc, rtype = rt_find("person"));
CuAssertPtrEquals(tc, 0, rtype->itype);
CuAssertPtrNotNull(tc, rtype = rt_find("permaura"));
CuAssertPtrEquals(tc, 0, rtype->itype);
CuAssertPtrNotNull(tc, rtype = rt_find("hp"));
CuAssertPtrEquals(tc, 0, rtype->itype);
CuAssertPtrNotNull(tc, rtype = rt_find("aura"));
CuAssertPtrEquals(tc, 0, rtype->itype);
test_cleanup();
}
CuSuite *get_item_suite(void)
{
CuSuite *suite = CuSuiteNew();
@ -153,5 +174,6 @@ CuSuite *get_item_suite(void)
SUITE_ADD_TEST(suite, test_finditemtype);
SUITE_ADD_TEST(suite, test_findresourcetype);
SUITE_ADD_TEST(suite, test_fix_demand);
SUITE_ADD_TEST(suite, test_core_resources);
return suite;
}

View File

@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include <kernel/config.h>
#include "messages.h"
/* kernel includes */
@ -140,7 +139,7 @@ struct message *msg_feedback(const struct unit *u, struct order *ord,
message *msg_message(const char *name, const char *sig, ...)
/* msg_message("oops_error", "unit region command", u, r, cmd) */
{
va_list marker;
va_list vargs;
const message_type *mtype = mt_find(name);
char paramname[64];
const char *ic = sig;
@ -155,7 +154,7 @@ message *msg_message(const char *name, const char *sig, ...)
return NULL;
}
va_start(marker, sig);
va_start(vargs, sig);
while (*ic && !isalnum(*ic))
ic++;
while (*ic) {
@ -172,9 +171,9 @@ message *msg_message(const char *name, const char *sig, ...)
}
if (i != mtype->nparameters) {
if (mtype->types[i]->vtype == VAR_VOIDPTR) {
args[i].v = va_arg(marker, void *);
args[i].v = va_arg(vargs, void *);
} else if (mtype->types[i]->vtype == VAR_INT) {
args[i].i = va_arg(marker, int);
args[i].i = va_arg(vargs, int);
} else {
assert(!"unknown variant type");
}
@ -185,7 +184,7 @@ message *msg_message(const char *name, const char *sig, ...)
while (*ic && !isalnum(*ic))
ic++;
}
va_end(marker);
va_end(vargs);
return msg_create(mtype, args);
}

View File

@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" {
#endif
#include <kernel/types.h>
#include <util/message.h>
struct faction;

View File

@ -0,0 +1,44 @@
#include <platform.h>
#include "messages.h"
#include <CuTest.h>
#include <tests.h>
void test_missing_message(CuTest *tc) {
message *msg;
msg = msg_message("unknown", "unit", NULL);
CuAssertPtrNotNull(tc, msg);
CuAssertPtrNotNull(tc, msg->type);
CuAssertStrEquals(tc, msg->type->name, "missing_message");
msg_release(msg);
}
void test_message(CuTest *tc) {
message *msg;
// const char * args[] = { }
message_type *mtype = mt_new("custom", NULL);
mt_register(mtype);
CuAssertPtrEquals(tc, mtype, (void *)mt_find("custom"));
CuAssertIntEquals(tc, 0, mtype->nparameters);
CuAssertPtrEquals(tc, NULL, (void *)mtype->pnames);
CuAssertPtrEquals(tc, NULL, (void *)mtype->types);
msg = msg_message("custom", "");
CuAssertPtrNotNull(tc, msg);
CuAssertIntEquals(tc, 1, msg->refcount);
CuAssertPtrEquals(tc, NULL, msg->parameters);
CuAssertPtrEquals(tc, mtype, (void *)msg->type);
CuAssertPtrEquals(tc, msg, msg_addref(msg));
CuAssertIntEquals(tc, 2, msg->refcount);
msg_release(msg);
CuAssertIntEquals(tc, 1, msg->refcount);
msg_release(msg);
test_cleanup();
}
CuSuite *get_messages_suite(void) {
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_missing_message);
SUITE_ADD_TEST(suite, test_message);
return suite;
}

View File

@ -177,7 +177,11 @@ race *rc_get_or_create(const char *zName)
rc = (race *)calloc(sizeof(race), 1);
rc->hitpoints = 1;
rc->weight = PERSON_WEIGHT;
rc->capacity = 540;
rc->recruit_multi = 1.0F;
rc->regaura = 1.0F;
rc->speed = 1.0F;
if (strchr(zName, ' ') != NULL) {
log_error("race '%s' has an invalid name. remove spaces\n", zName);
assert(strchr(zName, ' ') == NULL);

View File

@ -8,17 +8,43 @@
#include <assert.h>
static void test_rc_name(CuTest *tc) {
struct race *rc = test_create_race("human");
struct race *rc;
test_cleanup();
rc = test_create_race("human");
CuAssertStrEquals(tc, "race::human", rc_name_s(rc, NAME_SINGULAR));
CuAssertStrEquals(tc, "race::human_p", rc_name_s(rc, NAME_PLURAL));
CuAssertStrEquals(tc, "race::human_d", rc_name_s(rc, NAME_DEFINITIVE));
CuAssertStrEquals(tc, "race::human_x", rc_name_s(rc, NAME_CATEGORY));
test_cleanup();
}
static void test_rc_defaults(CuTest *tc) {
struct race *rc;
test_cleanup();
rc = rc_get_or_create("human");
CuAssertStrEquals(tc, "human", rc->_name);
CuAssertDblEquals(tc, 0.0, rc->magres, 0.0);
CuAssertDblEquals(tc, 0.0, rc->maxaura, 0.0);
CuAssertDblEquals(tc, 1.0, rc->recruit_multi, 0.0);
CuAssertDblEquals(tc, 1.0, rc->regaura, 0.0);
CuAssertDblEquals(tc, 1.0, rc->speed, 0.0);
CuAssertIntEquals(tc, 0, rc->flags);
CuAssertIntEquals(tc, 0, rc->recruitcost);
CuAssertIntEquals(tc, 0, rc->maintenance);
CuAssertIntEquals(tc, 540, rc->capacity);
CuAssertIntEquals(tc, 1, rc->hitpoints);
CuAssertIntEquals(tc, 0, rc->armor);
CuAssertIntEquals(tc, 0, rc->at_bonus);
CuAssertIntEquals(tc, 0, rc->df_bonus);
CuAssertIntEquals(tc, PERSON_WEIGHT, rc->weight);
test_cleanup();
}
CuSuite *get_race_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_rc_name);
SUITE_ADD_TEST(suite, test_rc_defaults);
return suite;
}

View File

@ -1626,22 +1626,22 @@ static int parse_races(xmlDocPtr doc)
rc->def_damage = _strdup((const char *)propValue);
xmlFree(propValue);
rc->magres = (float)xml_fvalue(node, "magres", 0.0);
rc->maxaura = (float)xml_fvalue(node, "maxaura", 0.0);
rc->regaura = (float)xml_fvalue(node, "regaura", 1.0);
rc->recruitcost = xml_ivalue(node, "recruitcost", 0);
rc->maintenance = xml_ivalue(node, "maintenance", 0);
rc->weight = xml_ivalue(node, "weight", PERSON_WEIGHT);
rc->capacity = xml_ivalue(node, "capacity", 540);
rc->speed = (float)xml_fvalue(node, "speed", 1.0F);
rc->hitpoints = xml_ivalue(node, "hp", 0);
rc->armor = (char)xml_ivalue(node, "ac", 0);
rc->magres = (float)xml_fvalue(node, "magres", rc->magres);
rc->maxaura = (float)xml_fvalue(node, "maxaura", rc->maxaura);
rc->regaura = (float)xml_fvalue(node, "regaura", rc->regaura);
rc->recruitcost = xml_ivalue(node, "recruitcost", rc->recruitcost);
rc->maintenance = xml_ivalue(node, "maintenance", rc->maintenance);
rc->weight = xml_ivalue(node, "weight", rc->weight);
rc->capacity = xml_ivalue(node, "capacity", rc->capacity);
rc->speed = (float)xml_fvalue(node, "speed", rc->speed);
rc->hitpoints = xml_ivalue(node, "hp", rc->hitpoints);
rc->armor = (char)xml_ivalue(node, "ac", rc->armor);
study_speed_base = xml_ivalue(node, "studyspeed", 0);
rc->at_default = (char)xml_ivalue(node, "unarmedattack", -2);
rc->df_default = (char)xml_ivalue(node, "unarmeddefense", -2);
rc->at_bonus = (char)xml_ivalue(node, "attackmodifier", 0);
rc->df_bonus = (char)xml_ivalue(node, "defensemodifier", 0);
rc->at_bonus = (char)xml_ivalue(node, "attackmodifier", rc->at_bonus);
rc->df_bonus = (char)xml_ivalue(node, "defensemodifier", rc->df_bonus);
if (!xml_bvalue(node, "playerrace", false))
rc->flags |= RCF_NPC;

View File

@ -4347,17 +4347,17 @@ void init_processor(void)
add_proc_order(p, K_GROUP, group_cmd, 0, NULL);
p += 10;
add_proc_order(p, K_QUIT, quit_cmd, 0, NULL);
add_proc_order(p, K_URSPRUNG, origin_cmd, 0, NULL);
add_proc_order(p, K_ALLY, ally_cmd, 0, NULL);
add_proc_order(p, K_PREFIX, prefix_cmd, 0, NULL);
add_proc_order(p, K_SETSTEALTH, setstealth_cmd, 0, NULL);
add_proc_order(p, K_STATUS, status_cmd, 0, NULL);
add_proc_order(p, K_COMBATSPELL, combatspell_cmd, 0, NULL);
add_proc_order(p, K_DISPLAY, display_cmd, 0, NULL);
add_proc_order(p, K_NAME, name_cmd, 0, NULL);
add_proc_order(p, K_GUARD, guard_off_cmd, 0, NULL);
add_proc_order(p, K_RESHOW, reshow_cmd, 0, NULL);
add_proc_order(p, K_QUIT, &quit_cmd, 0, NULL);
add_proc_order(p, K_URSPRUNG, &origin_cmd, 0, NULL);
add_proc_order(p, K_ALLY, &ally_cmd, 0, NULL);
add_proc_order(p, K_PREFIX, &prefix_cmd, 0, NULL);
add_proc_order(p, K_SETSTEALTH, &setstealth_cmd, 0, NULL);
add_proc_order(p, K_STATUS, &status_cmd, 0, NULL);
add_proc_order(p, K_COMBATSPELL, &combatspell_cmd, 0, NULL);
add_proc_order(p, K_DISPLAY, &display_cmd, 0, NULL);
add_proc_order(p, K_NAME, &name_cmd, 0, NULL);
add_proc_order(p, K_GUARD, &guard_off_cmd, 0, NULL);
add_proc_order(p, K_RESHOW, &reshow_cmd, 0, NULL);
if (get_param_int(global.parameters, "rules.alliances", 0) == 1) {
p += 10;

View File

@ -71,6 +71,7 @@ int RunAllTests(void)
RUN_TESTS(suite, building);
RUN_TESTS(suite, spell);
RUN_TESTS(suite, ally);
RUN_TESTS(suite, messages);
/* gamecode */
RUN_TESTS(suite, battle);
RUN_TESTS(suite, economy);

View File

@ -146,7 +146,7 @@ message *msg_create(const struct message_type *mtype, variant args[])
return NULL;
}
msg->type = mtype;
msg->parameters = (variant *) calloc(mtype->nparameters, sizeof(variant));
msg->parameters = (variant *)(mtype->nparameters ? calloc(mtype->nparameters, sizeof(variant)) : NULL);
msg->refcount = 1;
for (i = 0; i != mtype->nparameters; ++i) {
msg->parameters[i] = copy_arg(mtype->types[i], args[i]);