forked from github/server
Merge pull request #48 from badgerman/master
more refactoring, no new features.
This commit is contained in:
commit
00ba5538f5
|
@ -1,3 +1,4 @@
|
|||
|
||||
[eressea]
|
||||
base = .
|
||||
report = reports
|
||||
|
@ -6,13 +7,13 @@ lomem = 0
|
|||
debug = 0
|
||||
memcheck = 0
|
||||
locales = de,en
|
||||
;game_id = 0
|
||||
|
||||
[lua]
|
||||
install = ../git
|
||||
paths = ../git/lunit:../git/scripts
|
||||
paths = lunit:scripts
|
||||
maxnmrs = 20
|
||||
rules = e2 ; can use -r to override
|
||||
rules = e2
|
||||
|
||||
[editor]
|
||||
color = 1
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ set (ERESSEA_SRC
|
|||
spells.c
|
||||
battle.c
|
||||
alchemy.c
|
||||
stealth.c
|
||||
upkeep.c
|
||||
vortex.c
|
||||
names.c
|
||||
|
@ -84,6 +83,7 @@ set (ERESSEA_SRC
|
|||
give.c
|
||||
items.c
|
||||
laws.c
|
||||
magic.c
|
||||
market.c
|
||||
monster.c
|
||||
randenc.c
|
||||
|
@ -161,17 +161,18 @@ set(TESTS_SRC
|
|||
vortex.test.c
|
||||
tests.test.c
|
||||
reports.test.c
|
||||
stealth.test.c
|
||||
callback.test.c
|
||||
direction.test.c
|
||||
economy.test.c
|
||||
json.test.c
|
||||
keyword.test.c
|
||||
laws.test.c
|
||||
magic.test.c
|
||||
market.test.c
|
||||
move.test.c
|
||||
skill.test.c
|
||||
upkeep.test.c
|
||||
${ATTRIBUTES_TESTS}
|
||||
${UTIL_TESTS}
|
||||
${KERNEL_TESTS}
|
||||
${ERESSEA_SRC}
|
||||
|
|
|
@ -26,7 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/faction.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/build.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/pool.h>
|
||||
#include <kernel/race.h>
|
||||
|
|
|
@ -23,6 +23,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct potion_type;
|
||||
struct unit;
|
||||
struct region;
|
||||
struct item_type;
|
||||
struct order;
|
||||
|
||||
enum {
|
||||
/* Stufe 1 */
|
||||
P_FAST,
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
PROJECT(attributes C)
|
||||
SET(_TEST_FILES
|
||||
stealth.test.c
|
||||
)
|
||||
|
||||
SET(_FILES
|
||||
alliance.c
|
||||
attributes.c
|
||||
|
@ -18,10 +22,14 @@ overrideroads.c
|
|||
racename.c
|
||||
raceprefix.c
|
||||
reduceproduction.c
|
||||
stealth.c
|
||||
targetregion.c
|
||||
)
|
||||
FOREACH(_FILE ${_FILES})
|
||||
LIST(APPEND _SOURCES ${PROJECT_NAME}/${_FILE})
|
||||
ENDFOREACH(_FILE)
|
||||
SET(ATTRIBUTES_SRC ${_SOURCES} PARENT_SCOPE)
|
||||
|
||||
FOREACH(_FILE ${_TEST_FILES})
|
||||
LIST(APPEND _TESTS ${PROJECT_NAME}/${_FILE})
|
||||
ENDFOREACH(_FILE)
|
||||
SET(ATTRIBUTES_TESTS ${_TESTS} PARENT_SCOPE)
|
||||
|
|
|
@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include "alliance.h"
|
||||
|
||||
#include <kernel/save.h>
|
||||
|
|
|
@ -26,6 +26,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "hate.h"
|
||||
#include "iceberg.h"
|
||||
#include "key.h"
|
||||
#include "stealth.h"
|
||||
#include "moved.h"
|
||||
#include "movement.h"
|
||||
#include "object.h"
|
||||
|
@ -57,6 +58,7 @@ attrib_type at_unitdissolve = {
|
|||
|
||||
void register_attributes(void)
|
||||
{
|
||||
at_register(&at_stealth);
|
||||
at_register(&at_object);
|
||||
at_register(&at_unitdissolve);
|
||||
at_register(&at_overrideroads);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <config.h>
|
||||
#include <platform.h>
|
||||
#include "stealth.h"
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/save.h>
|
||||
#include <util/attrib.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
30
src/battle.c
30
src/battle.c
|
@ -21,6 +21,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "battle.h"
|
||||
#include "alchemy.h"
|
||||
#include "move.h"
|
||||
#include "laws.h"
|
||||
#include "skill.h"
|
||||
|
||||
#include <kernel/alliance.h>
|
||||
|
@ -31,7 +32,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/faction.h>
|
||||
#include <kernel/group.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
|
@ -210,34 +210,6 @@ static void message_faction(battle * b, faction * f, struct message *m)
|
|||
add_message(&f->battles->msgs, m);
|
||||
}
|
||||
|
||||
int armedmen(const unit * u, bool siege_weapons)
|
||||
{
|
||||
item *itm;
|
||||
int n = 0;
|
||||
if (!(urace(u)->flags & RCF_NOWEAPONS)) {
|
||||
if (effskill(u, SK_WEAPONLESS) >= 1) {
|
||||
/* kann ohne waffen bewachen: fuer drachen */
|
||||
n = u->number;
|
||||
}
|
||||
else {
|
||||
/* alle Waffen werden gezaehlt, und dann wird auf die Anzahl
|
||||
* Personen minimiert */
|
||||
for (itm = u->items; itm; itm = itm->next) {
|
||||
const weapon_type *wtype = resource2weapon(itm->type->rtype);
|
||||
if (wtype == NULL || (!siege_weapons && (wtype->flags & WTF_SIEGE)))
|
||||
continue;
|
||||
if (effskill(u, wtype->skill) >= wtype->minskill)
|
||||
n += itm->number;
|
||||
/* if (effskill(u, wtype->skill) >= wtype->minskill) n += itm->number; */
|
||||
if (n > u->number)
|
||||
break;
|
||||
}
|
||||
n = _min(n, u->number);
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
void message_all(battle * b, message * m)
|
||||
{
|
||||
bfaction *bf;
|
||||
|
|
|
@ -18,6 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#ifndef H_KRNL_BATTLE
|
||||
#define H_KRNL_BATTLE
|
||||
|
||||
#include <kernel/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include <kernel/types.h>
|
||||
#include <platform.h>
|
||||
|
||||
#include "battle.h"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "bind_config.h"
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/jsonconf.h>
|
||||
#include <util/log.h>
|
||||
#include <util/language.h>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "json.h"
|
||||
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/save.h>
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ without prior permission by the authors of Eressea.
|
|||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include "bind_faction.h"
|
||||
#include "bind_unit.h"
|
||||
#include "bindings.h"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <platform.h>
|
||||
#include <curses.h>
|
||||
#include <kernel/types.h>
|
||||
|
||||
#include "bind_gmtool.h"
|
||||
#include "gmtool.h"
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include "spells/shipcurse.h"
|
||||
|
||||
#include <kernel/equipment.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/ship.h>
|
||||
#include <kernel/spellbook.h>
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
#include "bind_process.h"
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/terrain.h>
|
||||
#include <kernel/unit.h>
|
||||
#include "battle.h"
|
||||
#include "move.h"
|
||||
#include "economy.h"
|
||||
#include "laws.h"
|
||||
#include "market.h"
|
||||
#include "study.h"
|
||||
#include "keyword.h"
|
||||
#include "laws.h"
|
||||
#include "magic.h"
|
||||
#include "market.h"
|
||||
#include "move.h"
|
||||
#include "study.h"
|
||||
|
||||
#define PROC_LAND_REGION 0x0001
|
||||
#define PROC_LONG_ORDER 0x0002
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "bind_settings.h"
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/config.h>
|
||||
|
||||
const char * settings_get(const char *key)
|
||||
|
|
|
@ -11,7 +11,6 @@ without prior permission by the authors of Eressea.
|
|||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include "bind_ship.h"
|
||||
#include "bind_unit.h"
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ without prior permission by the authors of Eressea.
|
|||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/types.h>
|
||||
#include "bind_storage.h"
|
||||
|
||||
#include <kernel/save.h>
|
||||
|
|
|
@ -11,7 +11,6 @@ without prior permission by the authors of Eressea.
|
|||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
|
||||
#include "bind_unit.h"
|
||||
#ifdef BSON_ATTRIB
|
||||
|
@ -31,7 +30,6 @@ without prior permission by the authors of Eressea.
|
|||
#include <kernel/faction.h>
|
||||
#include <kernel/group.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/pool.h>
|
||||
|
|
|
@ -11,7 +11,6 @@ without prior permission by the authors of Eressea.
|
|||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include "bindings.h"
|
||||
#include "bind_unit.h"
|
||||
#include "bind_storage.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
||||
Copyright (c) 1998-2014, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
|
@ -26,7 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/build.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
|
|
|
@ -9,7 +9,7 @@ without prior permission by the authors of Eressea.
|
|||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "build.h"
|
||||
#include "buildno.h"
|
||||
#include "creport.h"
|
||||
|
||||
/* tweakable features */
|
||||
|
@ -22,15 +22,15 @@ without prior permission by the authors of Eressea.
|
|||
|
||||
/* attributes include */
|
||||
#include <attributes/follow.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/orcification.h>
|
||||
#include <attributes/otherfaction.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/raceprefix.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
/* gamecode includes */
|
||||
#include "laws.h"
|
||||
#include "economy.h"
|
||||
#include "stealth.h"
|
||||
#include "move.h"
|
||||
#include "reports.h"
|
||||
#include "alchemy.h"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
|
||||
#include "direction.h"
|
||||
#include "tests.h"
|
||||
|
|
|
@ -19,7 +19,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/types.h>
|
||||
#include "economy.h"
|
||||
|
||||
#include "alchemy.h"
|
||||
|
@ -38,7 +37,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/equipment.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/types.h>
|
||||
#include "economy.h"
|
||||
|
||||
#include <util/message.h>
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/pool.h>
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct lua_State;
|
||||
struct selection;
|
||||
struct state;
|
||||
struct region;
|
||||
struct terrain_type;
|
||||
|
||||
int gmmain(int argc, char *argv[]);
|
||||
int curses_readline(struct lua_State *L, char *buffer, size_t size,
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
#include "study.h"
|
||||
#include "move.h"
|
||||
#include "magic.h"
|
||||
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
|
|
|
@ -29,7 +29,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/save.h>
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/ship.h>
|
||||
|
||||
/* util includes */
|
||||
|
|
|
@ -20,6 +20,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/config.h>
|
||||
#include "xerewards.h"
|
||||
|
||||
#include "magic.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/region.h>
|
||||
|
@ -27,7 +29,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/unit.h>
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/pool.h>
|
||||
|
||||
/* util includes */
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "json.h"
|
||||
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/faction.h>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <stream.h>
|
||||
#include <memstream.h>
|
||||
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/terrain.h>
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ project(kernel C)
|
|||
SET(_TEST_FILES
|
||||
build.test.c
|
||||
config.test.c
|
||||
group.test.c
|
||||
faction.test.c
|
||||
unit.test.c
|
||||
save.test.c
|
||||
|
@ -10,7 +11,6 @@ ship.test.c
|
|||
spell.test.c
|
||||
ally.test.c
|
||||
building.test.c
|
||||
magic.test.c
|
||||
equipment.test.c
|
||||
curse.test.c
|
||||
item.test.c
|
||||
|
@ -36,7 +36,6 @@ equipment.c
|
|||
faction.c
|
||||
group.c
|
||||
item.c
|
||||
magic.c
|
||||
messages.c
|
||||
order.c
|
||||
pathfinder.c
|
||||
|
|
|
@ -20,28 +20,29 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/config.h>
|
||||
#include "build.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include "alchemy.h"
|
||||
#include "alliance.h"
|
||||
#include "connection.h"
|
||||
#include "direction.h"
|
||||
#include "building.h"
|
||||
#include "curse.h"
|
||||
#include "faction.h"
|
||||
#include "group.h"
|
||||
#include "item.h"
|
||||
#include "magic.h"
|
||||
#include "messages.h"
|
||||
#include "move.h"
|
||||
#include "order.h"
|
||||
#include "pool.h"
|
||||
#include "race.h"
|
||||
#include "region.h"
|
||||
#include "ship.h"
|
||||
#include "laws.h"
|
||||
#include "skill.h"
|
||||
#include "terrain.h"
|
||||
#include "terrainid.h"
|
||||
#include "unit.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/connection.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/group.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/pool.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/ship.h>
|
||||
#include <kernel/terrain.h>
|
||||
#include <kernel/terrainid.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* from libutil */
|
||||
#include <util/attrib.h>
|
||||
|
|
|
@ -29,7 +29,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "race.h"
|
||||
#include "region.h"
|
||||
#include "skill.h"
|
||||
#include "magic.h"
|
||||
#include "save.h"
|
||||
#include "version.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <platform.h>
|
||||
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/building.h>
|
||||
|
|
|
@ -36,7 +36,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "group.h"
|
||||
#include "item.h"
|
||||
#include "keyword.h"
|
||||
#include "magic.h"
|
||||
#include "messages.h"
|
||||
#include "move.h"
|
||||
#include "objtypes.h"
|
||||
|
@ -50,10 +49,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "ship.h"
|
||||
#include "skill.h"
|
||||
#include "terrain.h"
|
||||
#include "types.h"
|
||||
#include "unit.h"
|
||||
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/spellbook.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/base36.h>
|
||||
|
@ -74,8 +75,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/umlaut.h>
|
||||
#include <util/xml.h>
|
||||
|
||||
#include <stealth.h>
|
||||
|
||||
#ifdef USE_LIBXML2
|
||||
/* libxml includes */
|
||||
#include <libxml/tree.h>
|
||||
|
@ -521,34 +520,6 @@ int shipspeed(const ship * sh, const unit * u)
|
|||
return (int)k;
|
||||
}
|
||||
|
||||
#define FMAXHASH 2039
|
||||
faction *factionhash[FMAXHASH];
|
||||
|
||||
void fhash(faction * f)
|
||||
{
|
||||
int index = f->no % FMAXHASH;
|
||||
f->nexthash = factionhash[index];
|
||||
factionhash[index] = f;
|
||||
}
|
||||
|
||||
void funhash(faction * f)
|
||||
{
|
||||
int index = f->no % FMAXHASH;
|
||||
faction **fp = factionhash + index;
|
||||
while (*fp && (*fp) != f)
|
||||
fp = &(*fp)->nexthash;
|
||||
*fp = f->nexthash;
|
||||
}
|
||||
|
||||
static faction *ffindhash(int no)
|
||||
{
|
||||
int index = no % FMAXHASH;
|
||||
faction *f = factionhash[index];
|
||||
while (f && f->no != no)
|
||||
f = f->nexthash;
|
||||
return f;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
void verify_data(void)
|
||||
|
@ -634,29 +605,6 @@ unsigned int atoip(const char *s)
|
|||
return n;
|
||||
}
|
||||
|
||||
region *findunitregion(const unit * su)
|
||||
{
|
||||
#ifndef SLOW_REGION
|
||||
return su->region;
|
||||
#else
|
||||
region *r;
|
||||
const unit *u;
|
||||
|
||||
for (r = regions; r; r = r->next) {
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (su == u) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This should never happen */
|
||||
assert(!"Die unit wurde nicht gefunden");
|
||||
|
||||
return (region *) NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool unit_has_cursed_item(unit * u)
|
||||
{
|
||||
item *itm = u->items;
|
||||
|
@ -787,161 +735,6 @@ int alliedunit(const unit * u, const faction * f2, int mode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
seefaction(const faction * f, const region * r, const unit * u, int modifier)
|
||||
{
|
||||
if (((f == u->faction) || !fval(u, UFL_ANON_FACTION))
|
||||
&& cansee(f, r, u, modifier))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
cansee(const faction * f, const region * r, const unit * u, int modifier)
|
||||
/* r kann != u->region sein, wenn es um durchreisen geht */
|
||||
/* und es muss niemand aus f in der region sein, wenn sie vom Turm
|
||||
* erblickt wird */
|
||||
{
|
||||
int stealth, rings;
|
||||
unit *u2 = r->units;
|
||||
|
||||
if (u->faction == f || omniscient(f)) {
|
||||
return true;
|
||||
}
|
||||
else if (fval(u_race(u), RCF_INVISIBLE)) {
|
||||
return false;
|
||||
}
|
||||
else if (u->number == 0) {
|
||||
attrib *a = a_find(u->attribs, &at_creator);
|
||||
if (a) { /* u is an empty temporary unit. In this special case
|
||||
we look at the creating unit. */
|
||||
u = (unit *)a->data.v;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (leftship(u))
|
||||
return true;
|
||||
|
||||
while (u2 && u2->faction != f)
|
||||
u2 = u2->next;
|
||||
if (u2 == NULL)
|
||||
return false;
|
||||
|
||||
/* simple visibility, just gotta have a unit in the region to see 'em */
|
||||
if (is_guard(u, GUARD_ALL) != 0 || usiege(u) || u->building || u->ship) {
|
||||
return true;
|
||||
}
|
||||
|
||||
rings = invisible(u, NULL);
|
||||
stealth = eff_stealth(u, r) - modifier;
|
||||
|
||||
while (u2) {
|
||||
if (rings < u->number || invisible(u, u2) < u->number) {
|
||||
if (skill_enabled(SK_PERCEPTION)) {
|
||||
int observation = eff_skill(u2, SK_PERCEPTION, r);
|
||||
|
||||
if (observation >= stealth) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* find next unit in our faction */
|
||||
do {
|
||||
u2 = u2->next;
|
||||
} while (u2 && u2->faction != f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cansee_unit(const unit * u, const unit * target, int modifier)
|
||||
/* target->region kann != u->region sein, wenn es um durchreisen geht */
|
||||
{
|
||||
if (fval(u_race(target), RCF_INVISIBLE) || target->number == 0)
|
||||
return false;
|
||||
else if (target->faction == u->faction)
|
||||
return true;
|
||||
else {
|
||||
int n, rings, o;
|
||||
|
||||
if (is_guard(target, GUARD_ALL) != 0 || usiege(target) || target->building
|
||||
|| target->ship) {
|
||||
return true;
|
||||
}
|
||||
|
||||
n = eff_stealth(target, target->region) - modifier;
|
||||
rings = invisible(target, NULL);
|
||||
if (rings == 0 && n <= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rings && invisible(target, u) >= target->number) {
|
||||
return false;
|
||||
}
|
||||
if (skill_enabled(SK_PERCEPTION)) {
|
||||
o = eff_skill(u, SK_PERCEPTION, target->region);
|
||||
if (o >= n) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
cansee_durchgezogen(const faction * f, const region * r, const unit * u,
|
||||
int modifier)
|
||||
/* r kann != u->region sein, wenn es um durchreisen geht */
|
||||
/* und es muss niemand aus f in der region sein, wenn sie vom Turm
|
||||
* erblickt wird */
|
||||
{
|
||||
int n;
|
||||
unit *u2;
|
||||
|
||||
if (fval(u_race(u), RCF_INVISIBLE) || u->number == 0)
|
||||
return false;
|
||||
else if (u->faction == f)
|
||||
return true;
|
||||
else {
|
||||
int rings;
|
||||
|
||||
if (is_guard(u, GUARD_ALL) != 0 || usiege(u) || u->building || u->ship) {
|
||||
return true;
|
||||
}
|
||||
|
||||
n = eff_stealth(u, r) - modifier;
|
||||
rings = invisible(u, NULL);
|
||||
if (rings == 0 && n <= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (u2 = r->units; u2; u2 = u2->next) {
|
||||
if (u2->faction == f) {
|
||||
int o;
|
||||
|
||||
if (rings && invisible(u, u2) >= u->number)
|
||||
continue;
|
||||
|
||||
o = eff_skill(u2, SK_PERCEPTION, r);
|
||||
|
||||
if (o >= n) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
const char *strcheck(const char *s, size_t maxlen)
|
||||
{
|
||||
|
@ -1192,50 +985,11 @@ param_t getparam(const struct locale * lang)
|
|||
return s ? findparam(s, lang) : NOPARAM;
|
||||
}
|
||||
|
||||
faction *findfaction(int n)
|
||||
{
|
||||
faction *f = ffindhash(n);
|
||||
return f;
|
||||
}
|
||||
|
||||
faction *getfaction(void)
|
||||
{
|
||||
return findfaction(getid());
|
||||
}
|
||||
|
||||
unit *findunitr(const region * r, int n)
|
||||
{
|
||||
unit *u;
|
||||
|
||||
/* findunit regional! */
|
||||
|
||||
for (u = r->units; u; u = u->next)
|
||||
if (u->no == n)
|
||||
return u;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unit *findunit(int n)
|
||||
{
|
||||
if (n <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
return ufindhash(n);
|
||||
}
|
||||
|
||||
unit *findunitg(int n, const region * hint)
|
||||
{
|
||||
|
||||
/* Abfangen von Syntaxfehlern. */
|
||||
if (n <= 0)
|
||||
return NULL;
|
||||
|
||||
/* findunit global! */
|
||||
hint = 0;
|
||||
return ufindhash(n);
|
||||
}
|
||||
|
||||
unit *getnewunit(const region * r, const faction * f)
|
||||
{
|
||||
int n;
|
||||
|
@ -1685,42 +1439,6 @@ void *gc_add(void *p)
|
|||
return p;
|
||||
}
|
||||
|
||||
void add_translation(critbit_tree **cbp, const char *key, int i) {
|
||||
char buffer[256];
|
||||
char * str = transliterate(buffer, sizeof(buffer) - sizeof(int), key);
|
||||
critbit_tree * cb = *cbp;
|
||||
if (str) {
|
||||
size_t len = strlen(str);
|
||||
if (!cb) {
|
||||
*cbp = cb = (critbit_tree *)calloc(1, sizeof(critbit_tree *));
|
||||
}
|
||||
len = cb_new_kv(str, len, &i, sizeof(int), buffer);
|
||||
cb_insert(cb, buffer, len);
|
||||
}
|
||||
else {
|
||||
log_error("could not transliterate '%s'\n", key);
|
||||
}
|
||||
}
|
||||
|
||||
void init_translations(const struct locale *lang, int ut, const char * (*string_cb)(int i), int maxstrings)
|
||||
{
|
||||
void **tokens;
|
||||
int i;
|
||||
|
||||
assert(string_cb);
|
||||
assert(maxstrings > 0);
|
||||
tokens = get_translations(lang, ut);
|
||||
for (i = 0; i != maxstrings; ++i) {
|
||||
const char * s = string_cb(i);
|
||||
const char * key = s ? locale_string(lang, s) : 0;
|
||||
key = key ? key : s;
|
||||
if (key) {
|
||||
critbit_tree ** cb = (critbit_tree **)tokens;
|
||||
add_translation(cb, key, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char * parameter_key(int i)
|
||||
{
|
||||
assert(i < MAXPARAMS && i >= 0);
|
||||
|
@ -2503,7 +2221,6 @@ void attrib_init(void)
|
|||
at_register(&at_clone);
|
||||
at_register(&at_clonemage);
|
||||
at_register(&at_eventhandler);
|
||||
at_register(&at_stealth);
|
||||
at_register(&at_mage);
|
||||
at_register(&at_countdown);
|
||||
at_register(&at_curse);
|
||||
|
|
|
@ -27,7 +27,6 @@ extern "C" {
|
|||
#include "types.h"
|
||||
|
||||
struct _dictionary_;
|
||||
struct critbit_tree;
|
||||
/* experimental gameplay features (that don't affect the savefile) */
|
||||
/* TODO: move these settings to settings.h or into configuration files */
|
||||
#define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */
|
||||
|
@ -99,17 +98,10 @@ extern "C" {
|
|||
|
||||
#define want(option) (1<<option)
|
||||
/* ------------------------------------------------------------- */
|
||||
void add_translation(struct critbit_tree **cb, const char *str, int i);
|
||||
void init_translations(const struct locale *lang, int ut, const char * (*string_cb)(int i), int maxstrings);
|
||||
int shipspeed(const struct ship *sh, const struct unit *u);
|
||||
|
||||
#define i2b(i) ((bool)((i)?(true):(false)))
|
||||
|
||||
typedef struct strlist {
|
||||
struct strlist *next;
|
||||
char *s;
|
||||
} strlist;
|
||||
|
||||
#define fval(u, i) ((u)->flags & (i))
|
||||
#define fset(u, i) ((u)->flags |= (i))
|
||||
#define freset(u, i) ((u)->flags &= ~(i))
|
||||
|
@ -129,9 +121,13 @@ extern "C" {
|
|||
/* special units */
|
||||
void make_undead_unit(struct unit *);
|
||||
|
||||
void addstrlist(strlist ** SP, const char *s);
|
||||
typedef struct strlist {
|
||||
struct strlist *next;
|
||||
char *s;
|
||||
} strlist;
|
||||
|
||||
int armedmen(const struct unit *u, bool siege_weapons);
|
||||
void addstrlist(strlist ** SP, const char *s);
|
||||
void freestrlist(strlist * s);
|
||||
|
||||
unsigned int atoip(const char *s);
|
||||
unsigned int getuint(void);
|
||||
|
@ -155,15 +151,6 @@ extern "C" {
|
|||
#define factionid(x) itoa36((x)->no)
|
||||
#define curseid(x) itoa36((x)->no)
|
||||
|
||||
bool cansee(const struct faction *f, const struct region *r,
|
||||
const struct unit *u, int modifier);
|
||||
bool cansee_durchgezogen(const struct faction *f, const struct region *r,
|
||||
const struct unit *u, int modifier);
|
||||
bool cansee_unit(const struct unit *u, const struct unit *target,
|
||||
int modifier);
|
||||
bool seefaction(const struct faction *f, const struct region *r,
|
||||
const struct unit *u, int modifier);
|
||||
|
||||
const char * game_name(void);
|
||||
int game_id(void);
|
||||
int lovar(double xpct_x2);
|
||||
|
@ -191,15 +178,8 @@ extern "C" {
|
|||
int alliedgroup(const struct plane *pl, const struct faction *f,
|
||||
const struct faction *f2, const struct ally *sf, int mode);
|
||||
|
||||
struct faction *findfaction(int n);
|
||||
struct faction *getfaction(void);
|
||||
|
||||
struct unit *findunitg(int n, const struct region *hint);
|
||||
struct unit *findunit(int n);
|
||||
|
||||
struct unit *findunitr(const struct region *r, int n);
|
||||
struct region *findunitregion(const struct unit *su);
|
||||
|
||||
char *estring(const char *s);
|
||||
char *estring_i(char *s);
|
||||
char *cstring(const char *s);
|
||||
|
@ -252,7 +232,6 @@ extern "C" {
|
|||
* sonst großes Unglück. Durch asserts an ein paar Stellen abgesichert. */
|
||||
void verify_data(void);
|
||||
|
||||
void freestrlist(strlist * s);
|
||||
|
||||
int change_hitpoints(struct unit *u, int value);
|
||||
|
||||
|
@ -263,9 +242,6 @@ extern "C" {
|
|||
struct region *firstregion(struct faction *f);
|
||||
struct region *lastregion(struct faction *f);
|
||||
|
||||
void fhash(struct faction *f);
|
||||
void funhash(struct faction *f);
|
||||
|
||||
bool idle(struct faction *f);
|
||||
bool unit_has_cursed_item(struct unit *u);
|
||||
|
||||
|
|
|
@ -25,6 +25,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct attrib;
|
||||
struct attrib_type;
|
||||
struct faction;
|
||||
struct region;
|
||||
struct storage;
|
||||
struct unit;
|
||||
|
||||
extern int nextborder;
|
||||
|
||||
typedef struct connection {
|
||||
|
|
|
@ -23,7 +23,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
/* kernel includes */
|
||||
#include "building.h"
|
||||
#include "faction.h"
|
||||
#include "magic.h"
|
||||
#include "messages.h"
|
||||
#include "objtypes.h"
|
||||
#include "race.h"
|
||||
|
|
|
@ -25,6 +25,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
extern "C" {
|
||||
#endif
|
||||
struct spell;
|
||||
struct item;
|
||||
struct unit;
|
||||
|
||||
typedef struct itemdata {
|
||||
const struct item_type *itype;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <platform.h>
|
||||
|
||||
#include <kernel/types.h>
|
||||
#include "magic.h"
|
||||
|
||||
#include <kernel/equipment.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/spell.h>
|
||||
|
||||
#include <quicklist.h>
|
||||
|
|
|
@ -99,6 +99,40 @@ void free_faction(faction * f)
|
|||
freelist(f->ursprung);
|
||||
}
|
||||
|
||||
#define FMAXHASH 2039
|
||||
faction *factionhash[FMAXHASH];
|
||||
|
||||
void fhash(faction * f)
|
||||
{
|
||||
int index = f->no % FMAXHASH;
|
||||
f->nexthash = factionhash[index];
|
||||
factionhash[index] = f;
|
||||
}
|
||||
|
||||
void funhash(faction * f)
|
||||
{
|
||||
int index = f->no % FMAXHASH;
|
||||
faction **fp = factionhash + index;
|
||||
while (*fp && (*fp) != f)
|
||||
fp = &(*fp)->nexthash;
|
||||
*fp = f->nexthash;
|
||||
}
|
||||
|
||||
static faction *ffindhash(int no)
|
||||
{
|
||||
int index = no % FMAXHASH;
|
||||
faction *f = factionhash[index];
|
||||
while (f && f->no != no)
|
||||
f = f->nexthash;
|
||||
return f;
|
||||
}
|
||||
|
||||
faction *findfaction(int n)
|
||||
{
|
||||
faction *f = ffindhash(n);
|
||||
return f;
|
||||
}
|
||||
|
||||
void set_show_item(faction * f, const struct item_type *itype)
|
||||
{
|
||||
attrib *a = a_add(&f->attribs, a_new(&at_showitem));
|
||||
|
@ -215,7 +249,7 @@ faction *addfaction(const char *email, const char *password,
|
|||
char buf[128];
|
||||
|
||||
if (set_email(&f->email, email) != 0) {
|
||||
log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email);
|
||||
log_warning("Invalid email address for faction %s: %s\n", itoa36(f->no), email);
|
||||
}
|
||||
|
||||
faction_setpassword(f, password);
|
||||
|
|
|
@ -112,6 +112,10 @@ typedef struct faction {
|
|||
|
||||
extern struct faction *factions;
|
||||
|
||||
void fhash(struct faction *f);
|
||||
void funhash(struct faction *f);
|
||||
|
||||
struct faction *findfaction(int n);
|
||||
struct faction *get_monsters(void);
|
||||
struct faction *get_or_create_monsters(void);
|
||||
int max_magicians(const faction * f);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/config.h>
|
||||
|
@ -47,6 +46,7 @@ static void test_remove_empty_factions(CuTest *tc) {
|
|||
static void test_remove_dead_factions(CuTest *tc) {
|
||||
faction *f, *fm;
|
||||
region *r;
|
||||
int fno;
|
||||
|
||||
test_cleanup();
|
||||
r = test_create_region(0, 0, 0);
|
||||
|
@ -60,8 +60,9 @@ static void test_remove_dead_factions(CuTest *tc) {
|
|||
CuAssertPtrNotNull(tc, get_monsters());
|
||||
fm->alive = 0;
|
||||
f->alive = 0;
|
||||
fno = f->no;
|
||||
remove_empty_factions();
|
||||
CuAssertPtrEquals(tc, 0, findfaction(f->no));
|
||||
CuAssertPtrEquals(tc, 0, findfaction(fno));
|
||||
CuAssertPtrEquals(tc, fm, get_monsters());
|
||||
test_cleanup();
|
||||
}
|
||||
|
|
|
@ -22,9 +22,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* bitfield value for group::flags */
|
||||
#define GFL_ALIVE 0x01 /* There is at least one struct unit in the group */
|
||||
|
||||
struct gamedata;
|
||||
|
||||
typedef struct group {
|
||||
|
@ -34,7 +31,6 @@ extern "C" {
|
|||
struct attrib *attribs;
|
||||
char *name;
|
||||
struct ally *allies;
|
||||
int flags;
|
||||
int gid;
|
||||
int members;
|
||||
} group;
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
#include <platform.h>
|
||||
#include "types.h"
|
||||
#include "group.h"
|
||||
#include "faction.h"
|
||||
#include "unit.h"
|
||||
#include "region.h"
|
||||
|
||||
#include <CuTest.h>
|
||||
#include <tests.h>
|
||||
#include <assert.h>
|
||||
|
||||
static void test_group(CuTest * tc)
|
||||
{
|
||||
unit *u;
|
||||
region *r;
|
||||
faction *f;
|
||||
group *g;
|
||||
|
||||
test_cleanup();
|
||||
test_create_world();
|
||||
r = findregion(0, 0);
|
||||
f = test_create_faction(0);
|
||||
assert(r && f);
|
||||
u = test_create_unit(f, r);
|
||||
assert(u);
|
||||
CuAssertTrue(tc, join_group(u, "hodor"));
|
||||
CuAssertPtrNotNull(tc, (g = get_group(u)));
|
||||
CuAssertStrEquals(tc, "hodor", g->name);
|
||||
CuAssertIntEquals(tc, 1, g->members);
|
||||
set_group(u, 0);
|
||||
CuAssertIntEquals(tc, 0, g->members);
|
||||
CuAssertPtrEquals(tc, 0, get_group(u));
|
||||
set_group(u, g);
|
||||
CuAssertIntEquals(tc, 1, g->members);
|
||||
CuAssertPtrEquals(tc, g, get_group(u));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
CuSuite *get_group_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
SUITE_ADD_TEST(suite, test_group);
|
||||
return suite;
|
||||
}
|
||||
|
|
@ -33,6 +33,8 @@ extern "C" {
|
|||
struct resource_type;
|
||||
struct locale;
|
||||
struct troop;
|
||||
struct item;
|
||||
struct order;
|
||||
|
||||
typedef struct item {
|
||||
struct item *next;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <platform.h>
|
||||
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/pool.h>
|
||||
#include <kernel/unit.h>
|
||||
|
|
|
@ -22,6 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct region;
|
||||
struct plane;
|
||||
struct storage;
|
||||
|
||||
#define PFL_NOCOORDS 1 /* not in use */
|
||||
#define PFL_NORECRUITS 2
|
||||
#define PFL_NOALLIANCES 4
|
||||
|
|
|
@ -22,7 +22,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include "faction.h"
|
||||
#include "item.h"
|
||||
#include "magic.h"
|
||||
#include "order.h"
|
||||
#include "region.h"
|
||||
#include "race.h"
|
||||
|
|
|
@ -22,6 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct unit;
|
||||
struct resource_type;
|
||||
struct region;
|
||||
|
||||
/* bitfield values for get/use/change operations */
|
||||
#define GET_SLACK 0x01
|
||||
#define GET_RESERVE 0x02
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
|
||||
#include "ally.h"
|
||||
#include "pool.h"
|
||||
|
@ -15,6 +14,34 @@
|
|||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
void test_reservation(CuTest *tc) {
|
||||
unit *u;
|
||||
faction *f;
|
||||
region *r;
|
||||
struct resource_type *rtype;
|
||||
test_cleanup();
|
||||
test_create_world();
|
||||
rtype = rt_get_or_create("money");
|
||||
it_get_or_create(rtype);
|
||||
f = test_create_faction(0);
|
||||
r = findregion(0, 0);
|
||||
assert(r && f && rtype && rtype->itype);
|
||||
u = test_create_unit(f, r);
|
||||
assert(u);
|
||||
i_change(&u->items, rtype->itype, 100);
|
||||
CuAssertIntEquals(tc, 100, get_resource(u, rtype));
|
||||
CuAssertIntEquals(tc, 0, get_reservation(u, rtype));
|
||||
CuAssertIntEquals(tc, 50, change_reservation(u, rtype, 50));
|
||||
CuAssertIntEquals(tc, 100, change_reservation(u, rtype, 50));
|
||||
CuAssertIntEquals(tc, 50, set_resvalue(u, rtype, 50));
|
||||
CuAssertIntEquals(tc, 100, get_resource(u, rtype));
|
||||
CuAssertIntEquals(tc, 200, change_resource(u, rtype, 100));
|
||||
CuAssertIntEquals(tc, 200, get_resource(u, rtype));
|
||||
CuAssertIntEquals(tc, 200, i_get(u->items, rtype->itype));
|
||||
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
void test_pool(CuTest *tc) {
|
||||
unit *u1, *u2, *u3;
|
||||
faction *f;
|
||||
|
@ -60,6 +87,52 @@ void test_pool(CuTest *tc) {
|
|||
CuAssertIntEquals(tc, 300, get_pooled(u1, rtype, GET_ALL, INT_MAX));
|
||||
}
|
||||
|
||||
void test_pool_use(CuTest *tc) {
|
||||
unit *u1, *u2, *u3;
|
||||
faction *f;
|
||||
region *r;
|
||||
struct resource_type *rtype;
|
||||
ally *al;
|
||||
|
||||
test_cleanup();
|
||||
test_create_world();
|
||||
rtype = rt_get_or_create("money");
|
||||
it_get_or_create(rtype);
|
||||
f = test_create_faction(0);
|
||||
r = findregion(0, 0);
|
||||
assert(r && f && rtype && rtype->itype);
|
||||
u1 = test_create_unit(f, r);
|
||||
u2 = test_create_unit(f, r);
|
||||
u3 = test_create_unit(test_create_faction(0), r);
|
||||
assert(u1 && u2);
|
||||
i_change(&u1->items, rtype->itype, 100);
|
||||
set_resvalue(u1, rtype, 50);
|
||||
i_change(&u2->items, rtype->itype, 200);
|
||||
set_resvalue(u2, rtype, 100);
|
||||
i_change(&u3->items, rtype->itype, 400);
|
||||
set_resvalue(u3, rtype, 200);
|
||||
al = ally_add(&u3->faction->allies, f);
|
||||
al->status = HELP_MONEY;
|
||||
|
||||
CuAssertIntEquals(tc, 10, use_pooled(u1, rtype, GET_SLACK, 10));
|
||||
CuAssertIntEquals(tc, 40, use_pooled(u1, rtype, GET_SLACK, 50));
|
||||
CuAssertIntEquals(tc, 50, i_get(u1->items, rtype->itype));
|
||||
|
||||
CuAssertIntEquals(tc, 50, get_reservation(u1, rtype));
|
||||
CuAssertIntEquals(tc, 10, use_pooled(u1, rtype, GET_RESERVE, 10));
|
||||
CuAssertIntEquals(tc, 40, i_get(u1->items, rtype->itype));
|
||||
CuAssertIntEquals(tc, 40, get_reservation(u1, rtype));
|
||||
CuAssertIntEquals(tc, 40, use_pooled(u1, rtype, GET_RESERVE, 50));
|
||||
|
||||
CuAssertIntEquals(tc, 10, use_pooled(u1, rtype, GET_POOLED_SLACK, 10));
|
||||
CuAssertIntEquals(tc, 90, use_pooled(u1, rtype, GET_POOLED_SLACK, 100));
|
||||
CuAssertIntEquals(tc, 100, i_get(u2->items, rtype->itype));
|
||||
CuAssertIntEquals(tc, 10, use_pooled(u1, rtype, GET_POOLED_RESERVE, 10));
|
||||
CuAssertIntEquals(tc, 90, get_reservation(u2, rtype));
|
||||
CuAssertIntEquals(tc, 90, use_pooled(u1, rtype, GET_POOLED_RESERVE, 100));
|
||||
CuAssertIntEquals(tc, 0, i_get(u2->items, rtype->itype));
|
||||
}
|
||||
|
||||
void test_change_resource(CuTest * tc)
|
||||
{
|
||||
struct unit * u;
|
||||
|
@ -90,7 +163,9 @@ void test_change_resource(CuTest * tc)
|
|||
CuSuite *get_pool_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
SUITE_ADD_TEST(suite, test_reservation);
|
||||
SUITE_ADD_TEST(suite, test_pool);
|
||||
SUITE_ADD_TEST(suite, test_pool_use);
|
||||
SUITE_ADD_TEST(suite, test_change_resource);
|
||||
return suite;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "faction.h"
|
||||
#include "group.h"
|
||||
#include "item.h"
|
||||
#include "magic.h"
|
||||
#include "names.h"
|
||||
#include "pathfinder.h"
|
||||
#include "region.h"
|
||||
|
|
|
@ -20,7 +20,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/config.h>
|
||||
#include "save.h"
|
||||
|
||||
#include "../build.h"
|
||||
#include "../buildno.h"
|
||||
|
||||
#include "alchemy.h"
|
||||
#include "alliance.h"
|
||||
|
@ -30,7 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "faction.h"
|
||||
#include "group.h"
|
||||
#include "item.h"
|
||||
#include "magic.h"
|
||||
#include "messages.h"
|
||||
#include "move.h"
|
||||
#include "objtypes.h"
|
||||
|
|
|
@ -22,6 +22,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct attrib;
|
||||
struct item;
|
||||
struct storage;
|
||||
struct spell;
|
||||
struct spellbook;
|
||||
struct unit;
|
||||
|
||||
typedef struct gamedata {
|
||||
struct storage *store;
|
||||
int version;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <platform.h>
|
||||
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/ship.h>
|
||||
|
|
|
@ -22,7 +22,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include "curse.h"
|
||||
#include "item.h"
|
||||
#include "magic.h"
|
||||
#include "race.h"
|
||||
#include "region.h"
|
||||
#include "terrain.h"
|
||||
|
|
|
@ -23,6 +23,13 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
struct castorder;
|
||||
struct unit;
|
||||
struct region;
|
||||
struct spell;
|
||||
struct spell_component;
|
||||
struct quicklist;
|
||||
struct attrib_type;
|
||||
|
||||
typedef int (*spell_f)(struct castorder * co);
|
||||
typedef void(*fumble_f)(const struct castorder * co);
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#include <platform.h>
|
||||
|
||||
#include <quicklist.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/magic.h>
|
||||
|
||||
#include <CuTest.h>
|
||||
#include <tests.h>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <quicklist.h>
|
||||
#include <util/log.h>
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include <platform.h>
|
||||
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/spellbook.h>
|
||||
#include <quicklist.h>
|
||||
|
|
|
@ -18,7 +18,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/types.h>
|
||||
#include "unit.h"
|
||||
|
||||
#include "building.h"
|
||||
|
@ -42,6 +41,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <attributes/moved.h>
|
||||
#include <attributes/otherfaction.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
|
@ -56,8 +56,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/rng.h>
|
||||
#include <util/variant.h>
|
||||
|
||||
#include <stealth.h>
|
||||
|
||||
#include <storage.h>
|
||||
|
||||
/* libc includes */
|
||||
|
@ -74,6 +72,39 @@ attrib_type at_creator = {
|
|||
/* Rest ist NULL; temporaeres, nicht alterndes Attribut */
|
||||
};
|
||||
|
||||
unit *findunitr(const region * r, int n)
|
||||
{
|
||||
unit *u;
|
||||
|
||||
/* findunit regional! */
|
||||
|
||||
for (u = r->units; u; u = u->next)
|
||||
if (u->no == n)
|
||||
return u;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unit *findunit(int n)
|
||||
{
|
||||
if (n <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
return ufindhash(n);
|
||||
}
|
||||
|
||||
unit *findunitg(int n, const region * hint)
|
||||
{
|
||||
|
||||
/* Abfangen von Syntaxfehlern. */
|
||||
if (n <= 0)
|
||||
return NULL;
|
||||
|
||||
/* findunit global! */
|
||||
hint = 0;
|
||||
return ufindhash(n);
|
||||
}
|
||||
|
||||
#define UMAXHASH MAXUNITS
|
||||
static unit *unithash[UMAXHASH];
|
||||
static unit *delmarker = (unit *)unithash; /* a funny hack */
|
||||
|
@ -702,6 +733,7 @@ void set_level(unit * u, skill_t sk, int value)
|
|||
{
|
||||
skill *sv = u->skills;
|
||||
|
||||
assert(sk != SK_MAGIC || !u->faction || is_monsters(u->faction) || u->number == 1);
|
||||
if (!skill_enabled(sk))
|
||||
return;
|
||||
|
||||
|
@ -1165,8 +1197,8 @@ skill *add_skill(unit * u, skill_t id)
|
|||
sv->weeks = 1;
|
||||
sv->old = 0;
|
||||
sv->id = id;
|
||||
if (id == SK_MAGIC && u->faction) {
|
||||
assert(max_magicians(u->faction) >= u->number);
|
||||
if (id == SK_MAGIC && u->faction && !is_monsters(u->faction)) {
|
||||
assert(u->number==1 && max_magicians(u->faction) >= u->number);
|
||||
}
|
||||
return sv;
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ extern "C" {
|
|||
int wants; /* enno: attribut? */
|
||||
} unit;
|
||||
|
||||
extern struct attrib_type at_creator;
|
||||
extern struct attrib_type at_alias;
|
||||
extern struct attrib_type at_siege;
|
||||
extern struct attrib_type at_target;
|
||||
|
@ -216,9 +217,9 @@ extern "C" {
|
|||
int number, const struct race *rc, int id, const char *dname,
|
||||
struct unit *creator);
|
||||
|
||||
extern void uhash(struct unit *u);
|
||||
extern void uunhash(struct unit *u);
|
||||
extern struct unit *ufindhash(int i);
|
||||
void uhash(struct unit *u);
|
||||
void uunhash(struct unit *u);
|
||||
struct unit *ufindhash(int i);
|
||||
|
||||
const char *unit_getname(const struct unit *u);
|
||||
void unit_setname(struct unit *u, const char *name);
|
||||
|
@ -241,7 +242,11 @@ extern "C" {
|
|||
void remove_empty_units_in_region(struct region * r);
|
||||
void remove_empty_units(void);
|
||||
|
||||
extern struct attrib_type at_creator;
|
||||
struct unit *findunitg(int n, const struct region *hint);
|
||||
struct unit *findunit(int n);
|
||||
|
||||
struct unit *findunitr(const struct region *r, int n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <platform.h>
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/config.h"
|
||||
#include "kernel/order.h"
|
||||
#include "keyword.h"
|
||||
|
|
187
src/laws.c
187
src/laws.c
|
@ -45,7 +45,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/faction.h>
|
||||
#include <kernel/group.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
|
@ -63,9 +62,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/unit.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/object.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/raceprefix.h>
|
||||
#include <attributes/object.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
|
@ -4182,6 +4182,34 @@ void process(void)
|
|||
|
||||
}
|
||||
|
||||
int armedmen(const unit * u, bool siege_weapons)
|
||||
{
|
||||
item *itm;
|
||||
int n = 0;
|
||||
if (!(urace(u)->flags & RCF_NOWEAPONS)) {
|
||||
if (effskill(u, SK_WEAPONLESS) >= 1) {
|
||||
/* kann ohne waffen bewachen: fuer drachen */
|
||||
n = u->number;
|
||||
}
|
||||
else {
|
||||
/* alle Waffen werden gezaehlt, und dann wird auf die Anzahl
|
||||
* Personen minimiert */
|
||||
for (itm = u->items; itm; itm = itm->next) {
|
||||
const weapon_type *wtype = resource2weapon(itm->type->rtype);
|
||||
if (wtype == NULL || (!siege_weapons && (wtype->flags & WTF_SIEGE)))
|
||||
continue;
|
||||
if (effskill(u, wtype->skill) >= wtype->minskill)
|
||||
n += itm->number;
|
||||
/* if (effskill(u, wtype->skill) >= wtype->minskill) n += itm->number; */
|
||||
if (n > u->number)
|
||||
break;
|
||||
}
|
||||
n = _min(n, u->number);
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
int siege_cmd(unit * u, order * ord)
|
||||
{
|
||||
region *r = u->region;
|
||||
|
@ -4554,3 +4582,158 @@ void update_subscriptions(void)
|
|||
}
|
||||
fclose(F);
|
||||
}
|
||||
|
||||
bool
|
||||
cansee(const faction * f, const region * r, const unit * u, int modifier)
|
||||
/* r kann != u->region sein, wenn es um durchreisen geht */
|
||||
/* und es muss niemand aus f in der region sein, wenn sie vom Turm
|
||||
* erblickt wird */
|
||||
{
|
||||
int stealth, rings;
|
||||
unit *u2 = r->units;
|
||||
|
||||
if (u->faction == f || omniscient(f)) {
|
||||
return true;
|
||||
}
|
||||
else if (fval(u_race(u), RCF_INVISIBLE)) {
|
||||
return false;
|
||||
}
|
||||
else if (u->number == 0) {
|
||||
attrib *a = a_find(u->attribs, &at_creator);
|
||||
if (a) { /* u is an empty temporary unit. In this special case
|
||||
we look at the creating unit. */
|
||||
u = (unit *)a->data.v;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (leftship(u))
|
||||
return true;
|
||||
|
||||
while (u2 && u2->faction != f)
|
||||
u2 = u2->next;
|
||||
if (u2 == NULL)
|
||||
return false;
|
||||
|
||||
/* simple visibility, just gotta have a unit in the region to see 'em */
|
||||
if (is_guard(u, GUARD_ALL) != 0 || usiege(u) || u->building || u->ship) {
|
||||
return true;
|
||||
}
|
||||
|
||||
rings = invisible(u, NULL);
|
||||
stealth = eff_stealth(u, r) - modifier;
|
||||
|
||||
while (u2) {
|
||||
if (rings < u->number || invisible(u, u2) < u->number) {
|
||||
if (skill_enabled(SK_PERCEPTION)) {
|
||||
int observation = eff_skill(u2, SK_PERCEPTION, r);
|
||||
|
||||
if (observation >= stealth) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* find next unit in our faction */
|
||||
do {
|
||||
u2 = u2->next;
|
||||
} while (u2 && u2->faction != f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cansee_unit(const unit * u, const unit * target, int modifier)
|
||||
/* target->region kann != u->region sein, wenn es um durchreisen geht */
|
||||
{
|
||||
if (fval(u_race(target), RCF_INVISIBLE) || target->number == 0)
|
||||
return false;
|
||||
else if (target->faction == u->faction)
|
||||
return true;
|
||||
else {
|
||||
int n, rings, o;
|
||||
|
||||
if (is_guard(target, GUARD_ALL) != 0 || usiege(target) || target->building
|
||||
|| target->ship) {
|
||||
return true;
|
||||
}
|
||||
|
||||
n = eff_stealth(target, target->region) - modifier;
|
||||
rings = invisible(target, NULL);
|
||||
if (rings == 0 && n <= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rings && invisible(target, u) >= target->number) {
|
||||
return false;
|
||||
}
|
||||
if (skill_enabled(SK_PERCEPTION)) {
|
||||
o = eff_skill(u, SK_PERCEPTION, target->region);
|
||||
if (o >= n) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
cansee_durchgezogen(const faction * f, const region * r, const unit * u,
|
||||
int modifier)
|
||||
/* r kann != u->region sein, wenn es um durchreisen geht */
|
||||
/* und es muss niemand aus f in der region sein, wenn sie vom Turm
|
||||
* erblickt wird */
|
||||
{
|
||||
int n;
|
||||
unit *u2;
|
||||
|
||||
if (fval(u_race(u), RCF_INVISIBLE) || u->number == 0)
|
||||
return false;
|
||||
else if (u->faction == f)
|
||||
return true;
|
||||
else {
|
||||
int rings;
|
||||
|
||||
if (is_guard(u, GUARD_ALL) != 0 || usiege(u) || u->building || u->ship) {
|
||||
return true;
|
||||
}
|
||||
|
||||
n = eff_stealth(u, r) - modifier;
|
||||
rings = invisible(u, NULL);
|
||||
if (rings == 0 && n <= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (u2 = r->units; u2; u2 = u2->next) {
|
||||
if (u2->faction == f) {
|
||||
int o;
|
||||
|
||||
if (rings && invisible(u, u2) >= u->number)
|
||||
continue;
|
||||
|
||||
o = eff_skill(u2, SK_PERCEPTION, r);
|
||||
|
||||
if (o >= n) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
seefaction(const faction * f, const region * r, const unit * u, int modifier)
|
||||
{
|
||||
if (((f == u->faction) || !fval(u, UFL_ANON_FACTION))
|
||||
&& cansee(f, r, u, modifier))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
22
src/laws.h
22
src/laws.h
|
@ -22,7 +22,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int writepasswd(void);
|
||||
struct unit;
|
||||
struct region;
|
||||
struct building;
|
||||
struct faction;
|
||||
struct order;
|
||||
struct attrib_type;
|
||||
|
||||
int writepasswd(void);
|
||||
void demographics(void);
|
||||
void update_guards(void);
|
||||
void update_subscriptions(void);
|
||||
|
@ -32,7 +39,7 @@ extern "C" {
|
|||
bool renamed_building(const struct building * b);
|
||||
int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name);
|
||||
void get_food(struct region * r);
|
||||
extern int can_contact(const struct region *r, const struct unit *u, const struct unit *u2);
|
||||
int can_contact(const struct region *r, const struct unit *u, const struct unit *u2);
|
||||
|
||||
/* eressea-specific. put somewhere else, please. */
|
||||
void processorders(void);
|
||||
|
@ -84,6 +91,17 @@ extern "C" {
|
|||
extern int claim_cmd(struct unit *u, struct order *ord);
|
||||
extern int follow_cmd(struct unit *u, struct order *ord);
|
||||
|
||||
bool cansee(const struct faction *f, const struct region *r,
|
||||
const struct unit *u, int modifier);
|
||||
bool cansee_durchgezogen(const struct faction *f, const struct region *r,
|
||||
const struct unit *u, int modifier);
|
||||
bool cansee_unit(const struct unit *u, const struct unit *target,
|
||||
int modifier);
|
||||
bool seefaction(const struct faction *f, const struct region *r,
|
||||
const struct unit *u, int modifier);
|
||||
int armedmen(const struct unit *u, bool siege_weapons);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include "laws.h"
|
||||
|
||||
#include <kernel/ally.h>
|
||||
|
|
|
@ -19,30 +19,31 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/types.h>
|
||||
#include "magic.h"
|
||||
|
||||
#include "building.h"
|
||||
#include "curse.h"
|
||||
#include "faction.h"
|
||||
#include "item.h"
|
||||
#include "messages.h"
|
||||
#include "objtypes.h"
|
||||
#include "order.h"
|
||||
#include "pathfinder.h"
|
||||
#include "plane.h"
|
||||
#include "pool.h"
|
||||
#include "race.h"
|
||||
#include "region.h"
|
||||
#include "save.h"
|
||||
#include "ship.h"
|
||||
#include "skill.h"
|
||||
#include "spell.h"
|
||||
#include "spellbook.h"
|
||||
#include "teleport.h"
|
||||
#include "terrain.h"
|
||||
#include "unit.h"
|
||||
#include "version.h"
|
||||
#include "laws.h"
|
||||
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/objtypes.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/pathfinder.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/pool.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/save.h>
|
||||
#include <kernel/ship.h>
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/spellbook.h>
|
||||
#include <kernel/teleport.h>
|
||||
#include <kernel/terrain.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/version.h>
|
||||
|
||||
#include <triggers/timeout.h>
|
||||
#include <triggers/shock.h>
|
|
@ -18,6 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#ifndef H_KRNL_MAGIC
|
||||
#define H_KRNL_MAGIC
|
||||
|
||||
#include <kernel/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
|
@ -1,9 +1,9 @@
|
|||
#include <platform.h>
|
||||
|
||||
#include <kernel/types.h>
|
||||
#include "magic.h"
|
||||
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/spellbook.h>
|
|
@ -20,7 +20,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/log.h>
|
||||
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/save.h>
|
||||
#include <kernel/version.h>
|
||||
#include "eressea.h"
|
||||
|
@ -28,7 +27,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "gmtool.h"
|
||||
#endif
|
||||
|
||||
#include "build.h"
|
||||
#include "buildno.h"
|
||||
#include "bindings.h"
|
||||
#include "races/races.h"
|
||||
#include "spells.h"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include "market.h"
|
||||
#include "tests.h"
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/building.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
|
|
|
@ -26,7 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/building.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/ship.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "economy.h"
|
||||
#include "give.h"
|
||||
#include "monster.h"
|
||||
#include "laws.h"
|
||||
|
||||
/* triggers includes */
|
||||
#include <triggers/removecurse.h>
|
||||
|
|
|
@ -20,6 +20,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "move.h"
|
||||
#include "laws.h"
|
||||
#include "reports.h"
|
||||
#include "alchemy.h"
|
||||
#include "vortex.h"
|
||||
|
@ -31,7 +32,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
|
@ -60,15 +60,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/rand.h>
|
||||
#include <util/rng.h>
|
||||
|
||||
#include <stealth.h>
|
||||
|
||||
#include <storage.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/follow.h>
|
||||
#include <attributes/targetregion.h>
|
||||
#include <attributes/movement.h>
|
||||
#include <attributes/otherfaction.h>
|
||||
#include <attributes/stealth.h>
|
||||
#include <attributes/targetregion.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <assert.h>
|
||||
|
|
|
@ -26,6 +26,8 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
struct unit;
|
||||
struct region;
|
||||
struct region_list;
|
||||
struct ship;
|
||||
struct building_type;
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include <kernel/types.h>
|
||||
#include <platform.h>
|
||||
#include <stdlib.h>
|
||||
#include "move.h"
|
||||
|
|
|
@ -24,7 +24,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/unit.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/terrain.h>
|
||||
#include <kernel/terrainid.h>
|
||||
|
|
|
@ -31,7 +31,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/equipment.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
|
|
|
@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/config.h>
|
||||
|
||||
#include "reports.h"
|
||||
#include "laws.h"
|
||||
/* modules includes */
|
||||
#include <modules/score.h>
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "reports.h"
|
||||
#include "laws.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/alliance.h>
|
||||
|
@ -64,9 +65,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <attributes/follow.h>
|
||||
#include <attributes/otherfaction.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
#include "move.h"
|
||||
#include "stealth.h"
|
||||
|
||||
bool nocr = false;
|
||||
bool nonr = false;
|
||||
|
|
|
@ -21,6 +21,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include <time.h>
|
||||
#include <kernel/objtypes.h>
|
||||
#include <kernel/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <config.h>
|
||||
#include <kernel/types.h>
|
||||
#include "reports.h"
|
||||
|
||||
#include <kernel/building.h>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <platform.h>
|
||||
#include "kernel/types.h"
|
||||
#include "skill.h"
|
||||
#include "util/language.h"
|
||||
#include "tests.h"
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
#include <kernel/config.h>
|
||||
|
||||
#include "spy.h"
|
||||
#include "vortex.h"
|
||||
#include "laws.h"
|
||||
#include "spells.h"
|
||||
#include "direction.h"
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
|||
#include <kernel/spellid.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/objtypes.h>
|
||||
#include <kernel/order.h>
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
|
||||
#include "borders.h"
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*/
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/types.h>
|
||||
#include "combatspells.h"
|
||||
|
||||
/* kernel includes */
|
||||
|
@ -20,7 +19,6 @@
|
|||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/race.h>
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "regioncurse.h"
|
||||
#include "magic.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/objtypes.h>
|
||||
#include <kernel/region.h>
|
||||
|
|
|
@ -22,10 +22,14 @@ extern "C" {
|
|||
|
||||
struct locale;
|
||||
struct message;
|
||||
extern struct message *cinfo_ship(const void *obj, objtype_t typ,
|
||||
struct ship;
|
||||
struct unit;
|
||||
struct curse;
|
||||
|
||||
struct message *cinfo_ship(const void *obj, objtype_t typ,
|
||||
const struct curse *c, int self);
|
||||
extern void register_shipcurse(void);
|
||||
extern struct curse *shipcurse_flyingship(struct ship *sh, struct unit *mage,
|
||||
void register_shipcurse(void);
|
||||
struct curse *shipcurse_flyingship(struct ship *sh, struct unit *mage,
|
||||
float power, int duration);
|
||||
int levitate_ship(struct ship *sh, struct unit *mage, float power,
|
||||
int duration);
|
||||
|
|
|
@ -20,14 +20,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/config.h>
|
||||
#include "spy.h"
|
||||
#include "laws.h"
|
||||
#include "stealth.h"
|
||||
#include "move.h"
|
||||
#include "reports.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/race.h>
|
||||
|
@ -37,8 +35,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/unit.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/otherfaction.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <attributes/stealth.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
|
|
|
@ -29,7 +29,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
|
|
|
@ -40,6 +40,7 @@ int RunAllTests(void)
|
|||
/* kernel */
|
||||
ADD_TESTS(suite, unit);
|
||||
ADD_TESTS(suite, faction);
|
||||
ADD_TESTS(suite, group);
|
||||
ADD_TESTS(suite, build);
|
||||
ADD_TESTS(suite, pool);
|
||||
ADD_TESTS(suite, curse);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue