forked from github/server
moving spells into eressea-only location (should this be eressea/src instead of just eressea?)
This commit is contained in:
parent
715ae2b8d6
commit
52882bd632
|
@ -0,0 +1,54 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{228B8781-480F-4608-BA14-1EB82581EADE}") = "kernel", "common\kernel.vcproj", "{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}"
|
||||
EndProject
|
||||
Project("{228B8781-480F-4608-BA14-1EB82581EADE}") = "gamecode", "common\gamecode.vcproj", "{1E8BFF9E-3044-0742-992F-C5765B80FE65}"
|
||||
EndProject
|
||||
Project("{228B8781-480F-4608-BA14-1EB82581EADE}") = "util", "common\util.vcproj", "{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}"
|
||||
EndProject
|
||||
Project("{228B8781-480F-4608-BA14-1EB82581EADE}") = "lua-bindings", "common\lua-bindings.vcproj", "{75501170-51C2-E641-BA8B-EDC008184192}"
|
||||
EndProject
|
||||
Project("{228B8781-480F-4608-BA14-1EB82581EADE}") = "external", "external\external.vcproj", "{F9AE4586-8F65-486B-9666-744839E40A54}"
|
||||
EndProject
|
||||
Project("{228B8781-480F-4608-BA14-1EB82581EADE}") = "amalgamation-eressea", "eressea\eressea.vcproj", "{AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}"
|
||||
Project("{228B8781-480F-4608-BA14-1EB82581EADE}") = "amalgamation-basic", "basic\basic.vcproj", "{4A17DAEE-2261-4E2C-96F6-BA4132A09551}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SubversionScc) = preSolution
|
||||
Svn-Managed = True
|
||||
Manager = AnkhSVN - Subversion Support for Visual Studio
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Release|Win32.Build.0 = Release|Win32
|
||||
{1E8BFF9E-3044-0742-992F-C5765B80FE65}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1E8BFF9E-3044-0742-992F-C5765B80FE65}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1E8BFF9E-3044-0742-992F-C5765B80FE65}.Release|Win32.Build.0 = Release|Win32
|
||||
{D893D6B3-805D-9848-8EA4-CDA1B79151F6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D893D6B3-805D-9848-8EA4-CDA1B79151F6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D893D6B3-805D-9848-8EA4-CDA1B79151F6}.Release|Win32.Build.0 = Release|Win32
|
||||
{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Release|Win32.Build.0 = Release|Win32
|
||||
{75501170-51C2-E641-BA8B-EDC008184192}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{75501170-51C2-E641-BA8B-EDC008184192}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{75501170-51C2-E641-BA8B-EDC008184192}.Release|Win32.Build.0 = Release|Win32
|
||||
{F9AE4586-8F65-486B-9666-744839E40A54}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F9AE4586-8F65-486B-9666-744839E40A54}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F9AE4586-8F65-486B-9666-744839E40A54}.Release|Win32.Build.0 = Release|Win32
|
||||
{AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Release|Win32.ActiveCfg = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -10,7 +10,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-bindings", "..\common\l
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "external", "..\external\external.vcproj", "{F9AE4586-8F65-486B-9666-744839E40A54}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build", "build.vcproj", "{4A17DAEE-2261-4E2C-96F6-BA4132A09551}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build", "basic.vcproj", "{4A17DAEE-2261-4E2C-96F6-BA4132A09551}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SubversionScc) = preSolution
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
OutputDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
|
@ -101,8 +101,8 @@
|
|||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
OutputDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
|
@ -186,22 +186,6 @@
|
|||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\common\build\curses.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common\build\external.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common\build\gamecode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common\build\kernel.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\main.c"
|
||||
>
|
||||
|
@ -222,6 +206,36 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\common\build\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Unity Build"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\common\build\external.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common\build\gamecode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common\build\kernel.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common\build\lib.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\server.c"
|
||||
>
|
||||
|
@ -260,16 +274,6 @@
|
|||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\common\build\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
|
@ -23,7 +23,7 @@
|
|||
#include <util/variant.h>
|
||||
|
||||
static int
|
||||
read_follow(attrib * a, struct storage * store)
|
||||
read_follow(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
read_unit_reference(store); /* skip it */
|
||||
return AT_READ_FAIL;
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef struct give_data {
|
|||
} give_data;
|
||||
|
||||
static void
|
||||
a_writegive(const attrib * a, struct storage * store)
|
||||
a_writegive(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
give_data * gdata = (give_data*)a->data.v;
|
||||
item * itm;
|
||||
|
@ -52,7 +52,7 @@ a_writegive(const attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
static int
|
||||
a_readgive(attrib * a, struct storage * store)
|
||||
a_readgive(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
give_data * gdata = (give_data*)a->data.v;
|
||||
variant var;
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
#include <util/storage.h>
|
||||
|
||||
static void
|
||||
write_gm(const attrib * a, struct storage * store)
|
||||
write_gm(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
write_plane_reference((plane*)a->data.v, store);
|
||||
}
|
||||
|
||||
static int
|
||||
read_gm(attrib * a, struct storage * store)
|
||||
read_gm(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
plane * pl;
|
||||
int result = read_plane_reference(&pl, store);
|
||||
|
|
|
@ -33,13 +33,13 @@ verify_hate(attrib * a)
|
|||
}
|
||||
|
||||
static void
|
||||
write_hate(const attrib * a, struct storage * store)
|
||||
write_hate(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
write_unit_reference((unit*)a->data.v, store);
|
||||
}
|
||||
|
||||
static int
|
||||
read_hate(attrib * a, struct storage * store)
|
||||
read_hate(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
int result = read_reference(&a->data.v, store, read_unit_reference, resolve_unit);
|
||||
if (result==0 && !a->data.v) {
|
||||
|
|
|
@ -27,13 +27,13 @@ age_moved(attrib * a)
|
|||
}
|
||||
|
||||
static void
|
||||
write_moved(const attrib * a, struct storage * store)
|
||||
write_moved(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
store->w_int(store, a->data.i);
|
||||
}
|
||||
|
||||
static int
|
||||
read_moved(attrib * a, struct storage * store)
|
||||
read_moved(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
a->data.i = store->r_int(store);
|
||||
if (a->data.i !=0 ) return AT_READ_OK;
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
#include <util/storage.h>
|
||||
|
||||
static void
|
||||
write_movement(const attrib * a, struct storage * store)
|
||||
write_movement(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
store->w_int(store, a->data.i);
|
||||
}
|
||||
|
||||
static int
|
||||
read_movement(attrib * a, struct storage * store)
|
||||
read_movement(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
a->data.i = store->r_int(store);
|
||||
if (a->data.i !=0 ) return AT_READ_OK;
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef struct object_data {
|
|||
} object_data;
|
||||
|
||||
static void
|
||||
object_write(const attrib *a, struct storage * store)
|
||||
object_write(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
const object_data * data = (object_data *)a->data.v;
|
||||
int type = (int)data->type;
|
||||
|
@ -90,7 +90,7 @@ object_write(const attrib *a, struct storage * store)
|
|||
}
|
||||
|
||||
static int
|
||||
object_read(attrib *a, struct storage * store)
|
||||
object_read(attrib *a, void * owner, struct storage * store)
|
||||
{
|
||||
object_data * data = (object_data *)a->data.v;
|
||||
int result;
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
|
||||
|
||||
void
|
||||
write_of(const struct attrib * a, struct storage * store)
|
||||
write_of(const struct attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
const faction * f = (faction*)a->data.v;
|
||||
store->w_int(store, f->no);
|
||||
}
|
||||
|
||||
int
|
||||
read_of(struct attrib * a, struct storage * store) /* return 1 on success, 0 if attrib needs removal */
|
||||
read_of(struct attrib * a, void * owner, struct storage * store) /* return 1 on success, 0 if attrib needs removal */
|
||||
{
|
||||
int of = store->r_int(store);
|
||||
a->data.v = findfaction(of);
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
#include <util/storage.h>
|
||||
|
||||
static void
|
||||
write_targetregion(const attrib * a, struct storage * store)
|
||||
write_targetregion(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
write_region_reference((region*)a->data.v, store);
|
||||
}
|
||||
|
||||
static int
|
||||
read_targetregion(attrib * a, struct storage * store)
|
||||
read_targetregion(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
int result = read_reference(&a->data.v, store, read_region_reference, RESOLVE_REGION(store->version));
|
||||
if (result==0 && !a->data.v) return AT_READ_FAIL;
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
#include <assert.h>
|
||||
|
||||
static void
|
||||
a_writefunction(const struct attrib * a, storage * store)
|
||||
a_writefunction(const struct attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
const char * str = get_functionname((pf_generic)a->data.f);
|
||||
store->w_tok(store, str);
|
||||
}
|
||||
|
||||
static int
|
||||
a_readfunction(struct attrib *a, storage * store)
|
||||
a_readfunction(struct attrib *a, void * owner, struct storage * store)
|
||||
/* return 1 on success, 0 if attrib needs removal */
|
||||
{
|
||||
char buf[64];
|
||||
|
|
|
@ -152,7 +152,7 @@ write_ext_i(lua_State * L, const char * name, bson_buffer * bb)
|
|||
}
|
||||
|
||||
static void
|
||||
write_ext(const attrib * a, struct storage * store) {
|
||||
write_ext(const attrib * a, const void * owner, struct storage * store) {
|
||||
lua_State * L = (lua_State *)global.vm_state;
|
||||
if (a->data.i>0) {
|
||||
int handle = a->data.i;
|
||||
|
@ -279,7 +279,7 @@ resolve_bson(variant data, void * address)
|
|||
}
|
||||
|
||||
static int
|
||||
read_ext(attrib * a, struct storage * store) {
|
||||
read_ext(attrib * a, void * owner, struct storage * store) {
|
||||
variant data;
|
||||
int len = store->r_int(store);
|
||||
data.v = bson_malloc(len);
|
||||
|
|
|
@ -25,6 +25,7 @@ without prior permission by the authors of Eressea.
|
|||
#include <kernel/region.h>
|
||||
|
||||
#include <util/language.h>
|
||||
#include <util/log.h>
|
||||
|
||||
#include <lua.h>
|
||||
#include <tolua.h>
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include <lua.h>
|
||||
#include <tolua.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#define E_OK 0
|
||||
#define E_INVALID_MESSAGE 1
|
||||
#define E_INVALID_PARAMETER_NAME 2
|
||||
|
|
|
@ -130,6 +130,21 @@ tolua_ship_tostring(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_flags(lua_State* L)
|
||||
{
|
||||
ship* self = (ship*) tolua_tousertype(L, 1, 0);
|
||||
tolua_pushnumber(L, (lua_Number)self->flags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_set_flags(lua_State* L)
|
||||
{
|
||||
ship* self = (ship*)tolua_tousertype(L, 1, 0);
|
||||
self->flags = (int)tolua_tonumber(L, 2, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tolua_ship_open(lua_State* L)
|
||||
{
|
||||
|
@ -146,13 +161,13 @@ tolua_ship_open(lua_State* L)
|
|||
tolua_variable(L, TOLUA_CAST "id", tolua_ship_get_id, NULL);
|
||||
tolua_variable(L, TOLUA_CAST "name", tolua_ship_get_name, tolua_ship_set_name);
|
||||
tolua_variable(L, TOLUA_CAST "units", tolua_ship_get_units, NULL);
|
||||
tolua_variable(L, TOLUA_CAST "flags", &tolua_ship_get_flags, tolua_ship_set_flags);
|
||||
tolua_variable(L, TOLUA_CAST "region", tolua_ship_get_region, tolua_ship_set_region);
|
||||
#ifdef TODO
|
||||
.property("type", &ship_gettype)
|
||||
.property("weight", &ship_getweight)
|
||||
.property("capacity", &ship_getcapacity)
|
||||
.property("maxsize", &ship_maxsize)
|
||||
.property("region", &ship_getregion, &ship_setregion)
|
||||
.def_readwrite("damage", &ship::damage)
|
||||
.def_readwrite("size", &ship::size)
|
||||
.def_readwrite("coast", &ship::coast)
|
||||
|
|
|
@ -45,7 +45,6 @@ without prior permission by the authors of Eressea.
|
|||
#include <gamecode/monster.h>
|
||||
#include <gamecode/market.h>
|
||||
|
||||
#include <spells/spells.h>
|
||||
#include <modules/autoseed.h>
|
||||
#include <modules/score.h>
|
||||
#include <attributes/key.h>
|
||||
|
@ -467,6 +466,7 @@ tolua_equipment_setitem(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef TODO_FOSS
|
||||
static int
|
||||
tolua_levitate_ship(lua_State * L)
|
||||
{
|
||||
|
@ -478,6 +478,7 @@ tolua_levitate_ship(lua_State * L)
|
|||
tolua_pushnumber(L, (lua_Number)cno);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
tolua_set_unitscript(lua_State * L)
|
||||
|
@ -1056,7 +1057,8 @@ tolua_eventbus_fire(lua_State * L)
|
|||
{
|
||||
void * sender = tolua_tousertype(L, 1, 0);
|
||||
const char * event = tolua_tostring(L, 2, 0);
|
||||
/* eventbus_fire(sender, event, args); */
|
||||
void * args = NULL;
|
||||
eventbus_fire(sender, event, args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1187,8 +1189,10 @@ tolua_eressea_open(lua_State* L)
|
|||
tolua_function(L, TOLUA_CAST "set_race_brain", tolua_set_racescript);
|
||||
tolua_function(L, TOLUA_CAST "set_unit_brain", tolua_set_unitscript);
|
||||
|
||||
#ifdef TODO_FOSS
|
||||
/* spells and stuff */
|
||||
tolua_function(L, TOLUA_CAST "levitate_ship", tolua_levitate_ship);
|
||||
#endif
|
||||
|
||||
tolua_function(L, TOLUA_CAST "update_guards", tolua_update_guards);
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <gamecode/monster.c>
|
||||
#include <gamecode/randenc.c>
|
||||
#include <gamecode/report.c>
|
||||
// #include <gamecode/spells.c>
|
||||
#include <gamecode/spy.c>
|
||||
#include <gamecode/study.c>
|
||||
#include <gamecode/summary.c>
|
||||
|
@ -70,14 +69,6 @@
|
|||
#include <items/weapons.c>
|
||||
#include <items/xerewards.c>
|
||||
|
||||
#include <spells/alp.c>
|
||||
#include <spells/buildingcurse.c>
|
||||
// #include <spells/combatspells.c>
|
||||
#include <spells/regioncurse.c>
|
||||
#include <spells/shipcurse.c>
|
||||
// #include <spells/spells.c>
|
||||
#include <spells/unitcurse.c>
|
||||
|
||||
#include <triggers/changefaction.c>
|
||||
#include <triggers/changerace.c>
|
||||
#include <triggers/clonedied.c>
|
||||
|
|
|
@ -147,11 +147,6 @@ game_init(void)
|
|||
register_resources();
|
||||
register_buildings();
|
||||
register_itemfunctions();
|
||||
#ifdef TODO
|
||||
register_curses();
|
||||
register_spells();
|
||||
register_gcspells();
|
||||
#endif
|
||||
#if DUNGEON_MODULE
|
||||
register_dungeon();
|
||||
#endif
|
||||
|
|
|
@ -245,14 +245,6 @@
|
|||
RelativePath=".\gamecode\report.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gamecode\spells.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gamecode\spells.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gamecode\spy.c"
|
||||
>
|
||||
|
|
|
@ -1,332 +0,0 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/types.h>
|
||||
|
||||
#include "curses.h"
|
||||
|
||||
#include <kernel/connection.h>
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/eressea.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/save.h>
|
||||
#include <kernel/terrain.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/version.h>
|
||||
|
||||
#include <util/attrib.h>
|
||||
#include <util/language.h>
|
||||
#include <util/rand.h>
|
||||
#include <util/rng.h>
|
||||
#include <util/resolve.h>
|
||||
#include <util/storage.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
typedef struct wallcurse {
|
||||
curse * buddy;
|
||||
connection * wall;
|
||||
} wallcurse;
|
||||
|
||||
void
|
||||
cw_init(attrib * a) {
|
||||
curse * c;
|
||||
curse_init(a);
|
||||
c = (curse*)a->data.v;
|
||||
c->data.v = calloc(sizeof(wallcurse), 1);
|
||||
}
|
||||
|
||||
void
|
||||
cw_write(const attrib * a, storage * store) {
|
||||
connection * b = ((wallcurse*)((curse*)a->data.v)->data.v)->wall;
|
||||
curse_write(a, store);
|
||||
store->w_int(store, b->id);
|
||||
}
|
||||
|
||||
typedef struct bresvole {
|
||||
unsigned int id;
|
||||
curse * self;
|
||||
} bresolve;
|
||||
|
||||
static int resolve_buddy(variant data, void * addr);
|
||||
|
||||
static int
|
||||
cw_read(attrib * a, storage * store)
|
||||
{
|
||||
bresolve * br = calloc(sizeof(bresolve), 1);
|
||||
curse * c = (curse*)a->data.v;
|
||||
wallcurse * wc = (wallcurse*)c->data.v;
|
||||
variant var;
|
||||
|
||||
curse_read(a, store);
|
||||
br->self = c;
|
||||
br->id = store->r_int(store);
|
||||
|
||||
var.i = br->id;
|
||||
ur_add(var, &wc->wall, resolve_borderid);
|
||||
|
||||
var.v = br;
|
||||
ur_add(var, &wc->buddy, resolve_buddy);
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
||||
attrib_type at_cursewall =
|
||||
{
|
||||
"cursewall",
|
||||
cw_init,
|
||||
curse_done,
|
||||
curse_age,
|
||||
cw_write,
|
||||
cw_read,
|
||||
ATF_CURSE
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
resolve_buddy(variant data, void * addr)
|
||||
{
|
||||
curse * result = NULL;
|
||||
bresolve * br = (bresolve*)data.v;
|
||||
|
||||
if (br->id>=0) {
|
||||
connection * b = find_border(br->id);
|
||||
|
||||
if (b && b->from && b->to) {
|
||||
attrib * a = a_find(b->from->attribs, &at_cursewall);
|
||||
while (a && a->data.v!=br->self) {
|
||||
curse * c = (curse*)a->data.v;
|
||||
wallcurse * wc = (wallcurse*)c->data.v;
|
||||
if (wc->wall->id==br->id) break;
|
||||
a = a->next;
|
||||
}
|
||||
if (!a || a->type!=&at_cursewall) {
|
||||
a = a_find(b->to->attribs, &at_cursewall);
|
||||
while (a && a->type==&at_cursewall && a->data.v!=br->self) {
|
||||
curse * c = (curse*)a->data.v;
|
||||
wallcurse * wc = (wallcurse*)c->data.v;
|
||||
if (wc->wall->id==br->id) break;
|
||||
a = a->next;
|
||||
}
|
||||
}
|
||||
if (a && a->type==&at_cursewall) {
|
||||
curse * c = (curse*)a->data.v;
|
||||
free(br);
|
||||
result = c;
|
||||
}
|
||||
} else {
|
||||
/* fail, object does not exist (but if you're still loading then
|
||||
* you may want to try again later) */
|
||||
*(curse**)addr = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
*(curse**)addr = result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
attrib_type at_unitdissolve = {
|
||||
"unitdissolve", NULL, NULL, NULL, a_writechars, a_readchars
|
||||
};
|
||||
|
||||
static void
|
||||
wall_init(connection * b)
|
||||
{
|
||||
wall_data * fd = (wall_data*)calloc(sizeof(wall_data), 1);
|
||||
fd->countdown = -1; /* infinite */
|
||||
b->data.v = fd;
|
||||
}
|
||||
|
||||
static void
|
||||
wall_destroy(connection * b)
|
||||
{
|
||||
free(b->data.v);
|
||||
}
|
||||
|
||||
static void
|
||||
wall_read(connection * b, storage * store)
|
||||
{
|
||||
wall_data * fd = (wall_data*)b->data.v;
|
||||
variant mno;
|
||||
assert(fd);
|
||||
if (store->version<STORAGE_VERSION) {
|
||||
mno.i = store->r_int(store);
|
||||
fd->mage = findunit(mno.i);
|
||||
if (!fd->mage) {
|
||||
ur_add(mno, &fd->mage, resolve_unit);
|
||||
}
|
||||
} else {
|
||||
read_reference(&fd->mage, store, read_unit_reference, resolve_unit);
|
||||
}
|
||||
fd->force = store->r_int(store);
|
||||
if (store->version>=NOBORDERATTRIBS_VERSION) {
|
||||
fd->countdown = store->r_int(store);
|
||||
}
|
||||
fd->active = true;
|
||||
}
|
||||
|
||||
static void
|
||||
wall_write(const connection * b, storage * store)
|
||||
{
|
||||
wall_data * fd = (wall_data*)b->data.v;
|
||||
write_unit_reference(fd->mage, store);
|
||||
store->w_int(store, fd->force);
|
||||
store->w_int(store, fd->countdown);
|
||||
}
|
||||
|
||||
static int
|
||||
wall_age(connection * b)
|
||||
{
|
||||
wall_data * fd = (wall_data*)b->data.v;
|
||||
--fd->countdown;
|
||||
return (fd->countdown>0)?AT_AGE_KEEP:AT_AGE_REMOVE;
|
||||
}
|
||||
|
||||
static region *
|
||||
wall_move(const connection * b, struct unit * u, struct region * from, struct region * to, boolean routing)
|
||||
{
|
||||
wall_data * fd = (wall_data*)b->data.v;
|
||||
if (!routing && fd->active) {
|
||||
int hp = dice(3, fd->force) * u->number;
|
||||
hp = MIN(u->hp, hp);
|
||||
u->hp -= hp;
|
||||
if (u->hp) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("firewall_damage",
|
||||
"region unit", from, u));
|
||||
}
|
||||
else ADDMSG(&u->faction->msgs, msg_message("firewall_death", "region unit", from, u));
|
||||
if (u->number>u->hp) {
|
||||
scale_number(u, u->hp);
|
||||
u->hp = u->number;
|
||||
}
|
||||
}
|
||||
return to;
|
||||
}
|
||||
|
||||
static const char *
|
||||
b_namefirewall(const connection * b, const region * r, const faction * f, int gflags)
|
||||
{
|
||||
const char * bname;
|
||||
unused(f);
|
||||
unused(r);
|
||||
unused(b);
|
||||
if (gflags & GF_ARTICLE) bname = "a_firewall";
|
||||
else bname = "firewall";
|
||||
|
||||
if (gflags & GF_PURE) return bname;
|
||||
return LOC(f->locale, mkname("border", bname));
|
||||
}
|
||||
|
||||
border_type bt_firewall = {
|
||||
"firewall", VAR_VOIDPTR,
|
||||
b_transparent, /* transparent */
|
||||
wall_init, /* init */
|
||||
wall_destroy, /* destroy */
|
||||
wall_read, /* read */
|
||||
wall_write, /* write */
|
||||
b_blocknone, /* block */
|
||||
b_namefirewall, /* name */
|
||||
b_rvisible, /* rvisible */
|
||||
b_finvisible, /* fvisible */
|
||||
b_uinvisible, /* uvisible */
|
||||
NULL,
|
||||
wall_move,
|
||||
wall_age
|
||||
};
|
||||
|
||||
void convert_firewall_timeouts(connection * b, attrib * a)
|
||||
{
|
||||
while (a) {
|
||||
if (b->type==&bt_firewall && a->type==&at_countdown) {
|
||||
wall_data * fd = (wall_data *)b->data.v;
|
||||
fd->countdown = a->data.i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
wisps_name(const connection * b, const region * r, const faction * f, int gflags)
|
||||
{
|
||||
const char * bname;
|
||||
unused(f);
|
||||
unused(r);
|
||||
unused(b);
|
||||
if (gflags & GF_ARTICLE) {
|
||||
bname = "a_wisps";
|
||||
} else {
|
||||
bname = "wisps";
|
||||
}
|
||||
if (gflags & GF_PURE) return bname;
|
||||
return LOC(f->locale, mkname("border", bname));
|
||||
}
|
||||
|
||||
typedef struct wisps_data {
|
||||
wall_data wall;
|
||||
int rnd;
|
||||
} wisps_data;
|
||||
|
||||
static region *
|
||||
wisps_move(const connection * b, struct unit * u, struct region * from, struct region * next, boolean routing)
|
||||
{
|
||||
direction_t reldir = reldirection(from, next);
|
||||
wisps_data * wd = (wisps_data*)b->data.v;
|
||||
assert(reldir!=D_SPECIAL);
|
||||
|
||||
if (routing && wd->wall.active) {
|
||||
region * rl = rconnect(from, (direction_t)((reldir+MAXDIRECTIONS-1)%MAXDIRECTIONS));
|
||||
region * rr = rconnect(from, (direction_t)((reldir+1)%MAXDIRECTIONS));
|
||||
/* pick left and right region: */
|
||||
if (wd->rnd<0) {
|
||||
wd->rnd = rng_int() % 3;
|
||||
}
|
||||
|
||||
if (wd->rnd == 1 && rl && fval(rl->terrain, LAND_REGION)==fval(next, LAND_REGION)) return rl;
|
||||
if (wd->rnd == 2 && rr && fval(rr->terrain, LAND_REGION)==fval(next, LAND_REGION)) return rr;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
static void
|
||||
wisps_init(connection * b)
|
||||
{
|
||||
wisps_data * wd = (wisps_data*)calloc(sizeof(wisps_data), 1);
|
||||
|
||||
b->data.v = wd;
|
||||
wd->rnd = -1;
|
||||
}
|
||||
|
||||
border_type bt_wisps = {
|
||||
"wisps", VAR_VOIDPTR,
|
||||
b_transparent, /* transparent */
|
||||
wisps_init, /* init */
|
||||
wall_destroy, /* destroy */
|
||||
wall_read, /* read */
|
||||
wall_write, /* write */
|
||||
b_blocknone, /* block */
|
||||
wisps_name, /* name */
|
||||
b_rvisible, /* rvisible */
|
||||
b_fvisible, /* fvisible */
|
||||
b_uvisible, /* uvisible */
|
||||
NULL, /* visible */
|
||||
wisps_move
|
||||
};
|
||||
|
||||
void
|
||||
register_curses(void)
|
||||
{
|
||||
border_convert_cb = &convert_firewall_timeouts;
|
||||
at_register(&at_cursewall);
|
||||
|
||||
register_bordertype(&bt_firewall);
|
||||
register_bordertype(&bt_wisps);
|
||||
register_bordertype(&bt_chaosgate);
|
||||
|
||||
/* init_firewall(); */
|
||||
ct_register(&ct_firewall);
|
||||
ct_register(&ct_deathcloud);
|
||||
|
||||
at_register(&at_deathcloud_compat);
|
||||
register_unitcurse();
|
||||
register_regioncurse();
|
||||
register_shipcurse();
|
||||
register_buildingcurse();
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef H_KRNL_CURSES
|
||||
#define H_KRNL_CURSES
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void register_curses(void);
|
||||
|
||||
/* für Feuerwände: in movement muß das noch explizit getestet werden.
|
||||
** besser wäre eine blcok_type::move() routine, die den effekt
|
||||
** der Bewegung auf eine struct unit anwendet.
|
||||
**/
|
||||
extern struct border_type bt_chaosgate;
|
||||
extern struct border_type bt_firewall;
|
||||
|
||||
typedef struct wall_data {
|
||||
struct unit * mage;
|
||||
int force;
|
||||
boolean active;
|
||||
int countdown;
|
||||
} wall_data;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
/* gamecode includes */
|
||||
#include "economy.h"
|
||||
#include "archetype.h"
|
||||
#include "monster.h"
|
||||
#include "randenc.h"
|
||||
#include "spy.h"
|
||||
|
@ -85,6 +86,7 @@
|
|||
#include <util/umlaut.h>
|
||||
#include <util/message.h>
|
||||
#include <util/rng.h>
|
||||
#include <util/xml.h>
|
||||
|
||||
#include <modules/xecmd.h>
|
||||
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
#include <attributes/targetregion.h>
|
||||
#include <attributes/hate.h>
|
||||
|
||||
/* spezialmonster */
|
||||
#include <spells/alp.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/build.h>
|
||||
#include <kernel/equipment.h>
|
||||
|
|
|
@ -1,127 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
* | | Enno Rehling <enno@eressea.de>
|
||||
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
* | (c) 1998 - 2005 |
|
||||
* | | This program may not be used, modified or distributed
|
||||
* +-------------------+ without prior permission by the authors of Eressea.
|
||||
*
|
||||
* This file contains spells that aren't referenced by the kernel. That should
|
||||
* really be most if not all the spells, but they are in spells/spells.c
|
||||
* because it's so much work to get them out of the big array.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "spy.h"
|
||||
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/objtypes.h>
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
#include <util/functions.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Name: Plappermaul
|
||||
* Stufe: 4
|
||||
* Gebiet: Cerddor
|
||||
* Kategorie: Einheit
|
||||
*
|
||||
* Wirkung:
|
||||
* Einheit ausspionieren. Gibt auch Zauber und Kampfstatus aus. Wirkt
|
||||
* gegen Magieresistenz. Ist diese zu hoch, so wird der Zauber entdeckt
|
||||
* (Meldung) und der Zauberer erhält nur die Talente, nicht die Werte
|
||||
* der Einheit und auch keine Zauber.
|
||||
*
|
||||
* Flag:
|
||||
* (UNITSPELL | TESTCANSEE)
|
||||
*/
|
||||
static int
|
||||
sp_babbler(castorder *co)
|
||||
{
|
||||
unit *target;
|
||||
region *r = co->rt;
|
||||
unit *mage = co->magician.u;
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
message * msg;
|
||||
|
||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||
if (pa->param[0]->flag == TARGET_NOTFOUND) return 0;
|
||||
|
||||
target = pa->param[0]->data.u;
|
||||
|
||||
if (target->faction == mage->faction) {
|
||||
/* Die Einheit ist eine der unsrigen */
|
||||
cmistake(mage, co->order, 45, MSG_MAGIC);
|
||||
}
|
||||
|
||||
/* Magieresistenz Unit */
|
||||
if (target_resists_magic(mage, target, TYP_UNIT, 0)) {
|
||||
spy_message(5, mage, target);
|
||||
msg = msg_message("babbler_resist", "unit mage", target, mage);
|
||||
} else {
|
||||
spy_message(100, mage, target);
|
||||
msg = msg_message("babbler_effect", "unit", target);
|
||||
}
|
||||
r_addmessage(r, target->faction, msg);
|
||||
msg_release(msg);
|
||||
return cast_level;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Name: Traumdeuten
|
||||
* Stufe: 7
|
||||
* Kategorie: Einheit
|
||||
*
|
||||
* Wirkung:
|
||||
* Wirkt gegen Magieresistenz. Spioniert die Einheit aus. Gibt alle
|
||||
* Gegenstände, Talente mit Stufe, Zauber und Kampfstatus an.
|
||||
*
|
||||
* Magieresistenz hier prüfen, wegen Fehlermeldung
|
||||
*
|
||||
* Flag:
|
||||
* (UNITSPELL)
|
||||
*/
|
||||
static int
|
||||
sp_readmind(castorder *co)
|
||||
{
|
||||
unit *target;
|
||||
unit *mage = co->magician.u;
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
|
||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||
if (pa->param[0]->flag == TARGET_NOTFOUND) return 0;
|
||||
|
||||
target = pa->param[0]->data.u;
|
||||
|
||||
if (target->faction == mage->faction) {
|
||||
/* Die Einheit ist eine der unsrigen */
|
||||
cmistake(mage, co->order, 45, MSG_MAGIC);
|
||||
}
|
||||
|
||||
/* Magieresistenz Unit */
|
||||
if (target_resists_magic(mage, target, TYP_UNIT, 0)) {
|
||||
cmistake(mage, co->order, 180, MSG_MAGIC);
|
||||
/* "Fühlt sich beobachtet"*/
|
||||
ADDMSG(&target->faction->msgs, msg_message("stealdetect", "unit", target));
|
||||
return 0;
|
||||
}
|
||||
spy_message(2, mage, target);
|
||||
|
||||
return cast_level;
|
||||
}
|
||||
|
||||
void
|
||||
register_gcspells(void)
|
||||
{
|
||||
register_function((pf_generic)&sp_babbler, "cast_babbler");
|
||||
register_function((pf_generic)&sp_readmind, "cast_readmind");
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
* | | Enno Rehling <enno@eressea.de>
|
||||
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
* | (c) 1998 - 2007 |
|
||||
* | | This program may not be used, modified or distributed
|
||||
* +-------------------+ without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef GC_SPELLS_H
|
||||
#define GC_SPELLS_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void register_gcspells(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -602,66 +602,6 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="spells"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\spells\alp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\alp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\buildingcurse.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\buildingcurse.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\combatspells.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\combatspells.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\regioncurse.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\regioncurse.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\shipcurse.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\shipcurse.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\spells.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\spells.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\unitcurse.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\unitcurse.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="items"
|
||||
>
|
||||
|
|
|
@ -262,7 +262,7 @@ a_finalizeeffect(attrib * a)
|
|||
}
|
||||
|
||||
static void
|
||||
a_writeeffect(const attrib *a, storage * store)
|
||||
a_writeeffect(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
effect_data * edata = (effect_data*)a->data.v;
|
||||
store->w_tok(store, resourcename(edata->type->itype->rtype, 0));
|
||||
|
@ -270,7 +270,7 @@ a_writeeffect(const attrib *a, storage * store)
|
|||
}
|
||||
|
||||
static int
|
||||
a_readeffect(attrib *a, storage * store)
|
||||
a_readeffect(attrib *a, void * owner, struct storage * store)
|
||||
{
|
||||
int power;
|
||||
const item_type * itype;
|
||||
|
|
|
@ -66,7 +66,7 @@ lc_done(struct attrib *a)
|
|||
}
|
||||
|
||||
static void
|
||||
lc_write(const struct attrib * a, struct storage * store)
|
||||
lc_write(const struct attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
building_action * data = (building_action*)a->data.v;
|
||||
const char * fname = data->fname;
|
||||
|
@ -79,7 +79,7 @@ lc_write(const struct attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
static int
|
||||
lc_read(struct attrib * a, struct storage * store)
|
||||
lc_read(struct attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
building_action * data = (building_action*)a->data.v;
|
||||
int result = read_reference(&data->b, store, read_building_reference, resolve_building);
|
||||
|
|
|
@ -594,7 +594,7 @@ read_borders(struct storage * store)
|
|||
if (type->read) type->read(b, store);
|
||||
if (store->version<NOBORDERATTRIBS_VERSION) {
|
||||
attrib * a = NULL;
|
||||
int result = a_read(store, &a);
|
||||
int result = a_read(store, &a, b);
|
||||
if (border_convert_cb) border_convert_cb(b, a);
|
||||
while (a) {
|
||||
a_remove(&a, a);
|
||||
|
|
|
@ -127,13 +127,14 @@ curse_age(attrib * a)
|
|||
curse * c = (curse*)a->data.v;
|
||||
int result = 0;
|
||||
|
||||
if (c_flags(c) & CURSE_NOAGE) {
|
||||
c->duration = INT_MAX;
|
||||
}
|
||||
if (c->type->age) {
|
||||
result = c->type->age(c);
|
||||
}
|
||||
if (result!=0) {
|
||||
c->duration = 0;
|
||||
} else if (c_flags(c) & CURSE_NOAGE) {
|
||||
c->duration = 1;
|
||||
} else if (c->duration!=INT_MAX) {
|
||||
c->duration = MAX(0, c->duration-1);
|
||||
}
|
||||
|
@ -183,7 +184,7 @@ read_ccompat(const char * cursename, struct storage * store)
|
|||
}
|
||||
|
||||
int
|
||||
curse_read(attrib * a, struct storage * store)
|
||||
curse_read(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
curse * c = (curse*)a->data.v;
|
||||
int ur;
|
||||
|
@ -227,12 +228,9 @@ curse_read(attrib * a, struct storage * store)
|
|||
}
|
||||
c_clearflag(c, CURSE_ISNEW);
|
||||
|
||||
if (c->type->read) c->type->read(store, c);
|
||||
if (c->type->read) c->type->read(store, c, owner);
|
||||
else if (c->type->typ==CURSETYP_UNIT) {
|
||||
curse_unit * cc = calloc(1, sizeof(curse_unit));
|
||||
|
||||
c->data.v = cc;
|
||||
cc->cursedmen = store->r_int(store);
|
||||
c->data.i = store->r_int(store);
|
||||
}
|
||||
if (c->type->typ == CURSETYP_REGION) {
|
||||
int rr = read_reference(&c->data.v, store, read_region_reference, RESOLVE_REGION(store->version));
|
||||
|
@ -245,7 +243,7 @@ curse_read(attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
void
|
||||
curse_write(const attrib * a, struct storage * store)
|
||||
curse_write(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
unsigned int flags;
|
||||
curse * c = (curse*)a->data.v;
|
||||
|
@ -263,10 +261,9 @@ curse_write(const attrib * a, struct storage * store)
|
|||
write_unit_reference(mage, store);
|
||||
store->w_flt(store, (float)c->effect);
|
||||
|
||||
if (c->type->write) c->type->write(store, c);
|
||||
if (c->type->write) c->type->write(store, c, owner);
|
||||
else if (c->type->typ == CURSETYP_UNIT) {
|
||||
curse_unit * cc = (curse_unit*)c->data.v;
|
||||
store->w_int(store, cc->cursedmen);
|
||||
store->w_int(store, c->data.i);
|
||||
}
|
||||
if (c->type->typ == CURSETYP_REGION) {
|
||||
write_region_reference((region*)c->data.v, store);
|
||||
|
@ -469,7 +466,7 @@ set_curseingmagician(struct unit *magician, struct attrib *ap_target, const curs
|
|||
/* gibt bei Personenbeschränkten Verzauberungen die Anzahl der
|
||||
* betroffenen Personen zurück. Ansonsten wird 0 zurückgegeben. */
|
||||
int
|
||||
get_cursedmen(unit *u, curse *c)
|
||||
get_cursedmen(unit *u, const curse *c)
|
||||
{
|
||||
int cursedmen = u->number;
|
||||
|
||||
|
@ -477,8 +474,7 @@ get_cursedmen(unit *u, curse *c)
|
|||
|
||||
/* je nach curse_type andere data struct */
|
||||
if (c->type->typ == CURSETYP_UNIT) {
|
||||
curse_unit * cc = (curse_unit*)c->data.v;
|
||||
cursedmen = cc->cursedmen;
|
||||
cursedmen = c->data.i;
|
||||
}
|
||||
|
||||
return MIN(u->number, cursedmen);
|
||||
|
@ -492,8 +488,7 @@ set_cursedmen(curse *c, int cursedmen)
|
|||
|
||||
/* je nach curse_type andere data struct */
|
||||
if (c->type->typ == CURSETYP_UNIT) {
|
||||
curse_unit * cc = (curse_unit*)c->data.v;
|
||||
cc->cursedmen = cursedmen;
|
||||
c->data.i = cursedmen;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -528,9 +523,7 @@ make_curse(unit *mage, attrib **ap, const curse_type *ct, double vigour,
|
|||
|
||||
case CURSETYP_UNIT:
|
||||
{
|
||||
curse_unit *cc = calloc(1, sizeof(curse_unit));
|
||||
cc->cursedmen += men;
|
||||
c->data.v = cc;
|
||||
c->data.i = men;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -582,8 +575,7 @@ create_curse(unit *magician, attrib **ap, const curse_type *ct, double vigour,
|
|||
switch (ct->typ) {
|
||||
case CURSETYP_UNIT:
|
||||
{
|
||||
curse_unit * cc = (curse_unit*)c->data.v;
|
||||
cc->cursedmen += men;
|
||||
c->data.i += men;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -602,21 +594,10 @@ static void
|
|||
do_transfer_curse(curse *c, unit * u, unit * u2, int n)
|
||||
{
|
||||
int cursedmen = 0;
|
||||
int men = 0;
|
||||
int men = get_cursedmen(u, c);
|
||||
boolean dogive = false;
|
||||
const curse_type *ct = c->type;
|
||||
|
||||
switch (ct->typ) {
|
||||
case CURSETYP_UNIT:
|
||||
{
|
||||
curse_unit * cc = (curse_unit*)c->data.v;
|
||||
men = cc->cursedmen;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
cursedmen = u->number;
|
||||
}
|
||||
|
||||
switch ((ct->flags | c->flags) & CURSE_SPREADMASK) {
|
||||
case CURSE_SPREADALWAYS:
|
||||
dogive = true;
|
||||
|
|
|
@ -197,16 +197,6 @@ typedef struct curse {
|
|||
|
||||
#define c_flags(c) ((c)->type->flags ^ (c)->flags)
|
||||
|
||||
/* Die Unterattribute curse->data: */
|
||||
/* Einheitenzauber:
|
||||
* auf Einzelpersonen in einer Einheit bezogene Zauber. Für Zauber, die
|
||||
* nicht immer auf ganze Einheiten wirken brauchen
|
||||
*/
|
||||
typedef struct curse_unit {
|
||||
int cursedmen; /* verzauberte Personen in der Einheit */
|
||||
} curse_unit;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
typedef struct curse_type {
|
||||
|
@ -216,15 +206,15 @@ typedef struct curse_type {
|
|||
unsigned int mergeflags;
|
||||
struct message * (*curseinfo)(const void*, typ_t, const struct curse*, int);
|
||||
void (*change_vigour)(curse*, double);
|
||||
int (*read)(struct storage * store, curse * c);
|
||||
int (*write)(struct storage * store, const struct curse * c);
|
||||
int (*read)(struct storage * store, curse * c, void * target);
|
||||
int (*write)(struct storage * store, const struct curse * c, const void * target);
|
||||
int (*cansee)(const struct faction*, const void*, typ_t, const struct curse *, int);
|
||||
int (*age)(curse *);
|
||||
} curse_type;
|
||||
|
||||
extern struct attrib_type at_curse;
|
||||
extern void curse_write(const struct attrib * a, struct storage * store);
|
||||
extern int curse_read(struct attrib * a, struct storage * store);
|
||||
void curse_write(const struct attrib * a, const void * owner, struct storage * store);
|
||||
int curse_read(struct attrib * a, void * owner, struct storage * store);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
@ -269,7 +259,7 @@ extern double curse_geteffect(const struct curse * c);
|
|||
extern double curse_changevigour(struct attrib **ap, curse * c, double i);
|
||||
/* verändert die Stärke der Verzauberung um i */
|
||||
|
||||
extern int get_cursedmen(struct unit *u, struct curse *c);
|
||||
extern int get_cursedmen(struct unit *u, const struct curse *c);
|
||||
/* gibt bei Personenbeschränkten Verzauberungen die Anzahl der
|
||||
* betroffenen Personen zurück. Ansonsten wird 0 zurückgegeben. */
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ find_group(int gid)
|
|||
}
|
||||
|
||||
static int
|
||||
read_group(attrib * a, struct storage * store)
|
||||
read_group(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
group * g;
|
||||
int gid = store->r_int(store);
|
||||
|
@ -104,7 +104,7 @@ read_group(attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
static void
|
||||
write_group(const attrib * a, struct storage * store)
|
||||
write_group(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
group * g = (group*)a->data.v;
|
||||
store->w_int(store, g->gid);
|
||||
|
@ -198,7 +198,7 @@ write_groups(struct storage * store, group * g)
|
|||
}
|
||||
}
|
||||
store->w_id(store, 0);
|
||||
a_write(store, g->attribs);
|
||||
a_write(store, g->attribs, g);
|
||||
store->w_brk(store);
|
||||
g=g->next;
|
||||
}
|
||||
|
@ -234,6 +234,6 @@ read_groups(struct storage * store, faction * f)
|
|||
if (!a->faction) ur_add(fid, &a->faction, resolve_faction);
|
||||
}
|
||||
*pa = 0;
|
||||
a_read(store, &g->attribs);
|
||||
a_read(store, &g->attribs, g);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ MagicPower(void)
|
|||
}
|
||||
|
||||
static int
|
||||
a_readicastle(attrib * a, struct storage * store)
|
||||
a_readicastle(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
icastle_data * data = (icastle_data*)a->data.v;
|
||||
variant bno;
|
||||
|
@ -133,7 +133,7 @@ a_readicastle(attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
static void
|
||||
a_writeicastle(const attrib * a, struct storage * store)
|
||||
a_writeicastle(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
icastle_data * data = (icastle_data*)a->data.v;
|
||||
store->w_tok(store, data->type->_name);
|
||||
|
@ -231,7 +231,7 @@ void read_spellist(struct spell_list ** slistp, magic_t mtype, struct storage *
|
|||
}
|
||||
|
||||
static int
|
||||
read_mage(attrib * a, struct storage * store)
|
||||
read_mage(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
int i, mtype;
|
||||
sc_mage * mage = (sc_mage*)a->data.v;
|
||||
|
@ -285,7 +285,7 @@ void write_spelllist(const spell_list * slist, struct storage * store)
|
|||
}
|
||||
|
||||
static void
|
||||
write_mage(const attrib * a, struct storage * store)
|
||||
write_mage(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
int i;
|
||||
sc_mage *mage = (sc_mage*)a->data.v;
|
||||
|
@ -336,7 +336,7 @@ get_mage(const unit * u)
|
|||
|
||||
|
||||
static int
|
||||
read_seenspell(attrib * a, struct storage * store)
|
||||
read_seenspell(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
int i;
|
||||
spell * sp = NULL;
|
||||
|
@ -360,7 +360,7 @@ read_seenspell(attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
static void
|
||||
write_seenspell(const attrib * a, struct storage * store)
|
||||
write_seenspell(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
const spell * sp = (const spell*)a->data.v;
|
||||
store->w_tok(store, sp->sname);
|
||||
|
@ -2130,7 +2130,7 @@ is_familiar(const unit *u)
|
|||
}
|
||||
|
||||
static void
|
||||
a_write_unit(const attrib * a, struct storage * store)
|
||||
a_write_unit(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
unit * u = (unit*)a->data.v;
|
||||
write_unit_reference(u, store);
|
||||
|
@ -2260,7 +2260,7 @@ resolve_familiar(variant data, void * addr)
|
|||
}
|
||||
|
||||
static int
|
||||
read_familiar(attrib * a, struct storage * store)
|
||||
read_familiar(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
int result = read_reference(&a->data.v, store, read_unit_reference, resolve_familiar);
|
||||
if (result==0 && a->data.v==NULL) {
|
||||
|
@ -2339,7 +2339,7 @@ resolve_clone(variant data, void * addr)
|
|||
}
|
||||
|
||||
static int
|
||||
read_clone(attrib * a, struct storage * store)
|
||||
read_clone(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
int result = read_reference(&a->data.v, store, read_unit_reference, resolve_clone);
|
||||
if (result==0 && a->data.v==NULL) {
|
||||
|
@ -2367,7 +2367,7 @@ resolve_mage(variant data, void * addr)
|
|||
}
|
||||
|
||||
static int
|
||||
read_magician(attrib * a, struct storage * store)
|
||||
read_magician(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
int result = read_reference(&a->data.v, store, read_unit_reference, resolve_mage);
|
||||
if (result==0 && a->data.v==NULL) {
|
||||
|
|
|
@ -135,7 +135,7 @@ shiptrail_age(attrib *a)
|
|||
}
|
||||
|
||||
static int
|
||||
shiptrail_read(attrib *a, storage * store)
|
||||
shiptrail_read(attrib *a, void * owner, struct storage * store)
|
||||
{
|
||||
traveldir *t = (traveldir *)(a->data.v);
|
||||
|
||||
|
@ -146,7 +146,7 @@ shiptrail_read(attrib *a, storage * store)
|
|||
}
|
||||
|
||||
static void
|
||||
shiptrail_write(const attrib *a, storage * store)
|
||||
shiptrail_write(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
traveldir *t = (traveldir *)(a->data.v);
|
||||
store->w_int(store, t->no);
|
||||
|
@ -681,12 +681,7 @@ flying_ship(const ship * sh)
|
|||
static const curse_type * ct_flyingship;
|
||||
|
||||
if (sh->type->flags & SFL_FLY) return true;
|
||||
if (!init) {
|
||||
ct_flyingship = ct_find("flyingship");
|
||||
init = 1;
|
||||
}
|
||||
if (!ct_flyingship) return false;
|
||||
if (curse_active(get_curse(sh->attribs, ct_flyingship))) return true;
|
||||
if (sh->flags & SF_FLYING) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ register_special_direction(const char * name)
|
|||
}
|
||||
|
||||
static int
|
||||
a_readdirection(attrib *a, storage * store)
|
||||
a_readdirection(attrib *a, void * owner, struct storage * store)
|
||||
{
|
||||
spec_direction *d = (spec_direction *)(a->data.v);
|
||||
|
||||
|
@ -283,7 +283,7 @@ a_readdirection(attrib *a, storage * store)
|
|||
}
|
||||
|
||||
static void
|
||||
a_writedirection(const attrib *a, storage * store)
|
||||
a_writedirection(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
spec_direction *d = (spec_direction *)(a->data.v);
|
||||
|
||||
|
@ -359,7 +359,7 @@ a_initmoveblock(attrib *a)
|
|||
}
|
||||
|
||||
int
|
||||
a_readmoveblock(attrib *a, storage * store)
|
||||
a_readmoveblock(attrib *a, void * owner, struct storage * store)
|
||||
{
|
||||
moveblock *m = (moveblock *)(a->data.v);
|
||||
int i;
|
||||
|
@ -370,7 +370,7 @@ a_readmoveblock(attrib *a, storage * store)
|
|||
}
|
||||
|
||||
void
|
||||
a_writemoveblock(const attrib *a, storage * store)
|
||||
a_writemoveblock(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
moveblock *m = (moveblock *)(a->data.v);
|
||||
store->w_int(store, (int)m->dir);
|
||||
|
|
|
@ -840,7 +840,7 @@ read_unit(struct storage * store)
|
|||
u->hp=u->number;
|
||||
}
|
||||
|
||||
a_read(store, &u->attribs);
|
||||
a_read(store, &u->attribs, u);
|
||||
return u;
|
||||
}
|
||||
|
||||
|
@ -907,7 +907,7 @@ write_unit(struct storage * store, const unit * u)
|
|||
}
|
||||
store->w_int(store, u->hp);
|
||||
store->w_brk(store);
|
||||
a_write(store, u->attribs);
|
||||
a_write(store, u->attribs, u);
|
||||
store->w_brk(store);
|
||||
}
|
||||
|
||||
|
@ -1070,7 +1070,7 @@ readregion(struct storage * store, int x, int y)
|
|||
}
|
||||
}
|
||||
}
|
||||
a_read(store, &r->attribs);
|
||||
a_read(store, &r->attribs, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -1132,7 +1132,7 @@ writeregion(struct storage * store, const region * r)
|
|||
store->w_brk(store);
|
||||
#endif
|
||||
}
|
||||
a_write(store, r->attribs);
|
||||
a_write(store, r->attribs, r);
|
||||
store->w_brk(store);
|
||||
}
|
||||
|
||||
|
@ -1235,7 +1235,7 @@ readfaction(struct storage * store)
|
|||
f->flags |= FFL_NPC;
|
||||
}
|
||||
|
||||
a_read(store, &f->attribs);
|
||||
a_read(store, &f->attribs, f);
|
||||
if (store->version>=CLAIM_VERSION) {
|
||||
read_items(store, &f->items);
|
||||
}
|
||||
|
@ -1322,7 +1322,7 @@ writefaction(struct storage * store, const faction * f)
|
|||
store->w_int(store, f->magiegebiet);
|
||||
|
||||
store->w_int(store, f->flags&FFL_SAVEMASK);
|
||||
a_write(store, f->attribs);
|
||||
a_write(store, f->attribs, f);
|
||||
store->w_brk(store);
|
||||
#if RELEASE_VERSION>=CLAIM_VERSION
|
||||
write_items(store, f->items);
|
||||
|
@ -1397,7 +1397,7 @@ readgame(const char * filename, int mode, int backup)
|
|||
}
|
||||
}
|
||||
}
|
||||
a_read(store, &global.attribs);
|
||||
a_read(store, &global.attribs, NULL);
|
||||
global.data_turn = turn = store->r_int(store);
|
||||
log_info((1, " - reading turn %d\n", turn));
|
||||
rng_init(turn);
|
||||
|
@ -1437,7 +1437,7 @@ readgame(const char * filename, int mode, int backup)
|
|||
store->r_str_buf(store, token, sizeof(token));
|
||||
}
|
||||
|
||||
a_read(store, &pl->attribs);
|
||||
a_read(store, &pl->attribs, pl);
|
||||
addlist(&planes, pl);
|
||||
}
|
||||
|
||||
|
@ -1507,7 +1507,7 @@ readgame(const char * filename, int mode, int backup)
|
|||
store->r_str_buf(store, token, sizeof(token));
|
||||
b->type = bt_find(token);
|
||||
b->region = r;
|
||||
a_read(store, &b->attribs);
|
||||
a_read(store, &b->attribs, b);
|
||||
if (b->type==bt_lighthouse) {
|
||||
r->flags |= RF_LIGHTHOUSE;
|
||||
}
|
||||
|
@ -1540,6 +1540,9 @@ readgame(const char * filename, int mode, int backup)
|
|||
assert(sh->type || !"ship_type not registered!");
|
||||
sh->size = store->r_int(store);
|
||||
sh->damage = store->r_int(store);
|
||||
if (store->version>=FOSS_VERSION) {
|
||||
sh->flags = store->r_int(store);
|
||||
}
|
||||
|
||||
/* Attribute rekursiv einlesen */
|
||||
|
||||
|
@ -1547,7 +1550,7 @@ readgame(const char * filename, int mode, int backup)
|
|||
if (sh->type->flags & SFL_NOCOAST) {
|
||||
sh->coast = NODIRECTION;
|
||||
}
|
||||
a_read(store, &sh->attribs);
|
||||
a_read(store, &sh->attribs, sh);
|
||||
}
|
||||
|
||||
*shp = 0;
|
||||
|
@ -1681,7 +1684,7 @@ writegame(const char *filename, int mode)
|
|||
}
|
||||
store->w_brk(store);
|
||||
|
||||
a_write(store, global.attribs);
|
||||
a_write(store, global.attribs, NULL);
|
||||
store->w_brk(store);
|
||||
|
||||
store->w_int(store, turn);
|
||||
|
@ -1711,7 +1714,7 @@ writegame(const char *filename, int mode)
|
|||
w = w->next;
|
||||
}
|
||||
store->w_tok(store, "end");
|
||||
a_write(store, pl->attribs);
|
||||
a_write(store, pl->attribs, pl);
|
||||
store->w_brk(store);
|
||||
}
|
||||
|
||||
|
@ -1757,7 +1760,7 @@ writegame(const char *filename, int mode)
|
|||
store->w_int(store, b->size);
|
||||
store->w_tok(store, b->type->_name);
|
||||
store->w_brk(store);
|
||||
a_write(store, b->attribs);
|
||||
a_write(store, b->attribs, b);
|
||||
store->w_brk(store);
|
||||
}
|
||||
|
||||
|
@ -1771,10 +1774,11 @@ writegame(const char *filename, int mode)
|
|||
store->w_tok(store, sh->type->name[0]);
|
||||
store->w_int(store, sh->size);
|
||||
store->w_int(store, sh->damage);
|
||||
store->w_int(store, sh->flags & SFL_SAVEMASK);
|
||||
assert((sh->type->flags & SFL_NOCOAST)==0 || sh->coast == NODIRECTION);
|
||||
store->w_int(store, sh->coast);
|
||||
store->w_brk(store);
|
||||
a_write(store, sh->attribs);
|
||||
a_write(store, sh->attribs, sh);
|
||||
store->w_brk(store);
|
||||
}
|
||||
|
||||
|
@ -1795,7 +1799,7 @@ writegame(const char *filename, int mode)
|
|||
}
|
||||
|
||||
int
|
||||
a_readint(attrib * a, struct storage * store)
|
||||
a_readint(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
/* assert(sizeof(int)==sizeof(a->data)); */
|
||||
a->data.i = store->r_int(store);
|
||||
|
@ -1803,16 +1807,16 @@ a_readint(attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
void
|
||||
a_writeint(const attrib * a, struct storage * store)
|
||||
a_writeint(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
store->w_int(store, a->data.i);
|
||||
}
|
||||
|
||||
int
|
||||
a_readshorts(attrib * a, struct storage * store)
|
||||
a_readshorts(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
if (store->version<ATTRIBREAD_VERSION) {
|
||||
return a_readint(a, store);
|
||||
return a_readint(a, store, owner);
|
||||
}
|
||||
a->data.sa[0] = (short)store->r_int(store);
|
||||
a->data.sa[1] = (short)store->r_int(store);
|
||||
|
@ -1820,18 +1824,18 @@ a_readshorts(attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
void
|
||||
a_writeshorts(const attrib * a, struct storage * store)
|
||||
a_writeshorts(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
store->w_int(store, a->data.sa[0]);
|
||||
store->w_int(store, a->data.sa[1]);
|
||||
}
|
||||
|
||||
int
|
||||
a_readchars(attrib * a, struct storage * store)
|
||||
a_readchars(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
int i;
|
||||
if (store->version<ATTRIBREAD_VERSION) {
|
||||
return a_readint(a, store);
|
||||
return a_readint(a, store, owner);
|
||||
}
|
||||
for (i=0;i!=4;++i) {
|
||||
a->data.ca[i] = (char)store->r_int(store);
|
||||
|
@ -1840,7 +1844,7 @@ a_readchars(attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
void
|
||||
a_writechars(const attrib * a, struct storage * store)
|
||||
a_writechars(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1850,28 +1854,28 @@ a_writechars(const attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
int
|
||||
a_readvoid(attrib * a, struct storage * store)
|
||||
a_readvoid(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
if (store->version<ATTRIBREAD_VERSION) {
|
||||
return a_readint(a, store);
|
||||
return a_readint(a, store, owner);
|
||||
}
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
||||
void
|
||||
a_writevoid(const attrib * a, struct storage * store)
|
||||
a_writevoid(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
a_readstring(attrib * a, struct storage * store)
|
||||
a_readstring(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
a->data.v = store->r_str(store);
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
||||
void
|
||||
a_writestring(const attrib * a, struct storage * store)
|
||||
a_writestring(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
assert(a->data.v);
|
||||
store->w_str(store, (const char *)a->data.v);
|
||||
|
|
|
@ -55,16 +55,16 @@ extern void write_items(struct storage * store, struct item *it);
|
|||
extern void write_unit(struct storage * store, const struct unit * u);
|
||||
extern struct unit * read_unit(struct storage * store);
|
||||
|
||||
extern int a_readint(struct attrib * a, struct storage * store);
|
||||
extern void a_writeint(const struct attrib * a, struct storage * store);
|
||||
extern int a_readshorts(struct attrib * a, struct storage * store);
|
||||
extern void a_writeshorts(const struct attrib * a, struct storage * store);
|
||||
extern int a_readchars(struct attrib * a, struct storage * store);
|
||||
extern void a_writechars(const struct attrib * a, struct storage * store);
|
||||
extern int a_readvoid(struct attrib * a, struct storage * store);
|
||||
extern void a_writevoid(const struct attrib * a, struct storage * store);
|
||||
extern int a_readstring(struct attrib * a, struct storage * store);
|
||||
extern void a_writestring(const struct attrib * a, struct storage * store);
|
||||
extern int a_readint(struct attrib * a, void * owner, struct storage * store);
|
||||
extern void a_writeint(const struct attrib * a, const void * owner, struct storage * store);
|
||||
extern int a_readshorts(struct attrib * a, void * owner, struct storage * store);
|
||||
extern void a_writeshorts(const struct attrib * a, const void * owner, struct storage * store);
|
||||
extern int a_readchars(struct attrib * a, void * owner, struct storage * store);
|
||||
extern void a_writechars(const struct attrib * a, const void * owner, struct storage * store);
|
||||
extern int a_readvoid(struct attrib * a, void * owner, struct storage * store);
|
||||
extern void a_writevoid(const struct attrib * a, const void * owner, struct storage * store);
|
||||
extern int a_readstring(struct attrib * a, void * owner, struct storage * store);
|
||||
extern void a_writestring(const struct attrib * a, const void * owner, struct storage * store);
|
||||
extern void a_finalizestring(struct attrib * a);
|
||||
|
||||
extern int freadstr(FILE * F, int encoding, char * str, size_t size);
|
||||
|
|
|
@ -74,7 +74,9 @@ extern void st_register(const ship_type * type);
|
|||
#define SF_DAMAGED 1<<2 /* for use in combat */
|
||||
#define SF_SELECT 1<<3 /* previously FL_DH */
|
||||
#define SF_FISHING 1<<4 /* was on an ocean, can fish */
|
||||
#define SF_FLYING 1<<5 /* the ship can fly */
|
||||
|
||||
#define SFL_SAVEMASK (SF_FLYING)
|
||||
#define INCOME_FISHING 10
|
||||
|
||||
typedef struct ship {
|
||||
|
|
|
@ -408,7 +408,7 @@ ualias(const unit * u)
|
|||
}
|
||||
|
||||
int
|
||||
a_readprivate(attrib * a, struct storage * store)
|
||||
a_readprivate(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
a->data.v = store->r_str(store);
|
||||
if (a->data.v) return AT_READ_OK;
|
||||
|
@ -531,14 +531,14 @@ usettarget(unit * u, const unit * t)
|
|||
/*********************/
|
||||
|
||||
void
|
||||
a_writesiege(const attrib * a, struct storage * store)
|
||||
a_writesiege(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
struct building * b = (struct building*)a->data.v;
|
||||
write_building_reference(b, store);
|
||||
}
|
||||
|
||||
int
|
||||
a_readsiege(attrib * a, struct storage * store)
|
||||
a_readsiege(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
int result = read_reference(&a->data.v, store, read_building_reference, resolve_building);
|
||||
if (result==0 && !a->data.v) {
|
||||
|
|
|
@ -217,13 +217,13 @@ age_hurting(attrib * a) {
|
|||
}
|
||||
|
||||
static void
|
||||
write_hurting(const attrib * a, struct storage * store) {
|
||||
write_hurting(const attrib * a, const void * owner, struct storage * store) {
|
||||
building * b = a->data.v;
|
||||
store->w_int(store, b->no);
|
||||
}
|
||||
|
||||
static int
|
||||
read_hurting(attrib * a, struct storage * store) {
|
||||
read_hurting(attrib * a, void * owner, struct storage * store) {
|
||||
int i;
|
||||
i = store->r_int(store);
|
||||
a->data.v = (void*)findbuilding(i);
|
||||
|
|
|
@ -67,17 +67,17 @@ mistake(const unit * u, struct order * ord, const char *comment)
|
|||
}
|
||||
|
||||
static void
|
||||
write_permissions(const attrib * a, struct storage * store)
|
||||
write_permissions(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
a_write(store, (attrib*)a->data.v);
|
||||
a_write(store, (attrib*)a->data.v, owner);
|
||||
}
|
||||
|
||||
static int
|
||||
read_permissions(attrib * at, struct storage * store)
|
||||
read_permissions(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
attrib * attr = NULL;
|
||||
a_read(store, &attr);
|
||||
at->data.v = attr;
|
||||
a_read(store, &attr, NULL);
|
||||
a->data.v = attr;
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ make_atpermissions(void)
|
|||
**/
|
||||
|
||||
static void
|
||||
write_gmcreate(const attrib * a, struct storage * store)
|
||||
write_gmcreate(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
const item_type * itype = (const item_type *)a->data.v;
|
||||
assert(itype);
|
||||
|
@ -107,7 +107,7 @@ write_gmcreate(const attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
static int
|
||||
read_gmcreate(attrib * a, struct storage * store)
|
||||
read_gmcreate(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
char zText[32];
|
||||
store->r_tok_buf(store, zText, sizeof(zText));
|
||||
|
|
|
@ -69,7 +69,7 @@ a_finalizemuseumgivebackcookie(attrib *a)
|
|||
}
|
||||
|
||||
static void
|
||||
a_writemuseumgivebackcookie(const attrib *a, storage * store)
|
||||
a_writemuseumgivebackcookie(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
museumgivebackcookie *gbc = (museumgivebackcookie *)a->data.v;
|
||||
store->w_int(store, gbc->warden_no);
|
||||
|
@ -77,7 +77,7 @@ a_writemuseumgivebackcookie(const attrib *a, storage * store)
|
|||
}
|
||||
|
||||
static int
|
||||
a_readmuseumgivebackcookie(attrib *a, storage * store)
|
||||
a_readmuseumgivebackcookie(attrib *a, void * owner, struct storage * store)
|
||||
{
|
||||
museumgivebackcookie *gbc = (museumgivebackcookie *)a->data.v;
|
||||
gbc->warden_no = store->r_int(store);
|
||||
|
@ -113,7 +113,7 @@ a_finalizemuseumgiveback(attrib *a)
|
|||
}
|
||||
|
||||
static void
|
||||
a_writemuseumgiveback(const attrib *a, storage * store)
|
||||
a_writemuseumgiveback(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
museumgiveback *gb = (museumgiveback *)a->data.v;
|
||||
store->w_int(store, gb->cookie);
|
||||
|
@ -121,7 +121,7 @@ a_writemuseumgiveback(const attrib *a, storage * store)
|
|||
}
|
||||
|
||||
static int
|
||||
a_readmuseumgiveback(attrib *a, storage * store)
|
||||
a_readmuseumgiveback(attrib *a, void * owner, struct storage * store)
|
||||
{
|
||||
museumgiveback *gb = (museumgiveback *)a->data.v;
|
||||
gb->cookie = store->r_int(store);
|
||||
|
|
|
@ -102,7 +102,7 @@ wormhole_age(struct attrib * a)
|
|||
}
|
||||
|
||||
static void
|
||||
wormhole_write(const struct attrib * a, storage * store)
|
||||
wormhole_write(const struct attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
wormhole_data * data = (wormhole_data*)a->data.v;
|
||||
write_building_reference(data->entry, store);
|
||||
|
@ -124,7 +124,7 @@ resolve_exit(variant id, void * address)
|
|||
}
|
||||
|
||||
static int
|
||||
wormhole_read(struct attrib * a, storage * store)
|
||||
wormhole_read(struct attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
wormhole_data * data = (wormhole_data*)a->data.v;
|
||||
resolve_fun resolver = (store->version<UIDHASH_VERSION)?resolve_exit:resolve_region_id;
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
SubDir TOP common spells ;
|
||||
|
||||
TargetDirectory ;
|
||||
SubDirHdrs $(SUBDIR)/../gamecode ;
|
||||
SubDirHdrs $(SUBDIR)/../kernel ;
|
||||
SubDirHdrs $(SUBDIR)/../util ;
|
||||
SubDirHdrs $(SUBDIR)/.. ;
|
||||
SubDirHdrs $(SUBDIR)/../.. ;
|
||||
SubDirHdrs $(XMLHDRS) ;
|
||||
|
||||
SOURCES =
|
||||
alp.c
|
||||
buildingcurse.c
|
||||
combatspells.c
|
||||
regioncurse.c
|
||||
shipcurse.c
|
||||
spells.c
|
||||
unitcurse.c
|
||||
;
|
||||
|
||||
if $(BUILDTYPE) = REGULAR {
|
||||
Library spells : $(SOURCES) ;
|
||||
}
|
|
@ -1,205 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "alp.h"
|
||||
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/skill.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/event.h>
|
||||
#include <util/resolve.h>
|
||||
#include <util/umlaut.h>
|
||||
#include <util/storage.h>
|
||||
|
||||
#include <triggers/createcurse.h>
|
||||
#include <triggers/killunit.h>
|
||||
#include <triggers/removecurse.h>
|
||||
#include <triggers/unitmessage.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
extern const char *directions[];
|
||||
|
||||
typedef struct alp_data {
|
||||
unit * mage;
|
||||
unit * target;
|
||||
} alp_data;
|
||||
|
||||
static void
|
||||
alp_init(attrib * a)
|
||||
{
|
||||
a->data.v = calloc(sizeof(alp_data), 1);
|
||||
}
|
||||
|
||||
static void
|
||||
alp_done(attrib * a)
|
||||
{
|
||||
free(a->data.v);
|
||||
}
|
||||
|
||||
static int
|
||||
alp_verify(attrib * a)
|
||||
{
|
||||
alp_data * ad = (alp_data*)a->data.v;
|
||||
if (ad->mage && ad->target) return 1;
|
||||
return 0; /* remove the attribute */
|
||||
}
|
||||
|
||||
static void
|
||||
alp_write(const attrib * a, struct storage * store)
|
||||
{
|
||||
alp_data * ad = (alp_data*)a->data.v;
|
||||
write_unit_reference(ad->mage, store);
|
||||
write_unit_reference(ad->target, store);
|
||||
}
|
||||
|
||||
static int
|
||||
alp_read(attrib * a, struct storage * store)
|
||||
{
|
||||
alp_data * ad = (alp_data*)a->data.v;
|
||||
int rm = read_reference(&ad->mage, store, read_unit_reference, resolve_unit);
|
||||
int rt = read_reference(&ad->target, store, read_unit_reference, resolve_unit);
|
||||
if (rt==0 && rm==0 && (!ad->target || !ad->mage)) {
|
||||
/* the target or mage disappeared. */
|
||||
return AT_READ_FAIL;
|
||||
}
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
||||
static attrib_type at_alp = {
|
||||
"alp",
|
||||
alp_init,
|
||||
alp_done,
|
||||
alp_verify,
|
||||
alp_write,
|
||||
alp_read,
|
||||
ATF_UNIQUE
|
||||
};
|
||||
|
||||
int
|
||||
sp_summon_alp(struct castorder *co)
|
||||
{
|
||||
unit *alp, *opfer;
|
||||
region *r = co->rt;
|
||||
unit *mage = co->magician.u;
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
const struct race * rc = new_race[RC_ALP];
|
||||
struct faction * f = get_monsters();
|
||||
struct message * msg;
|
||||
|
||||
opfer = pa->param[0]->data.u;
|
||||
|
||||
/* Der Alp gehört den Monstern, darum erhält der Magier auch keine
|
||||
* Regionsberichte von ihm. Er erhält aber später eine Mitteilung,
|
||||
* sobald der Alp sein Opfer erreicht hat.
|
||||
*/
|
||||
alp = create_unit(r, f, 1, rc, 0, NULL, NULL);
|
||||
set_level(alp, SK_STEALTH, 7);
|
||||
setstatus(alp, ST_FLEE); /* flieht */
|
||||
|
||||
{
|
||||
attrib * a = a_add(&alp->attribs, a_new(&at_alp));
|
||||
alp_data * ad = (alp_data*) a->data.v;
|
||||
ad->mage = mage;
|
||||
ad->target = opfer;
|
||||
}
|
||||
|
||||
{
|
||||
/* Wenn der Alp stirbt, den Magier nachrichtigen */
|
||||
add_trigger(&alp->attribs, "destroy", trigger_unitmessage(mage,
|
||||
"trigger_alp_destroy", MSG_EVENT, ML_INFO));
|
||||
/* Wenn Opfer oder Magier nicht mehr existieren, dann stirbt der Alp */
|
||||
add_trigger(&mage->attribs, "destroy", trigger_killunit(alp));
|
||||
add_trigger(&opfer->attribs, "destroy", trigger_killunit(alp));
|
||||
}
|
||||
msg = msg_message("summon_alp_effect", "mage alp target", mage, alp, opfer);
|
||||
r_addmessage(r, mage->faction, msg);
|
||||
msg_release(msg);
|
||||
|
||||
return cast_level;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
alp_findet_opfer(unit *alp, region *r)
|
||||
{
|
||||
curse * c;
|
||||
attrib * a = a_find(alp->attribs, &at_alp);
|
||||
alp_data * ad = (alp_data*)a->data.v;
|
||||
unit *mage = ad->mage;
|
||||
unit *opfer = ad->target;
|
||||
double effect;
|
||||
message * msg;
|
||||
|
||||
assert(opfer);
|
||||
assert(mage);
|
||||
|
||||
/* Magier und Opfer Bescheid geben */
|
||||
msg = msg_message("alp_success", "target", opfer);
|
||||
add_message(&mage->faction->msgs, msg);
|
||||
r_addmessage(opfer->region, opfer->faction, msg);
|
||||
msg_release(msg);
|
||||
|
||||
/* Relations werden in destroy_unit(alp) automatisch gelöscht.
|
||||
* Die Aktionen, die beim Tod des Alps ausgelöst werden sollen,
|
||||
* müssen jetzt aber deaktiviert werden, sonst werden sie gleich
|
||||
* beim destroy_unit(alp) ausgelöst.
|
||||
*/
|
||||
a_removeall(&alp->attribs, &at_eventhandler);
|
||||
|
||||
/* Alp umwandeln in Curse */
|
||||
effect = -2;
|
||||
c = create_curse(mage, &opfer->attribs, ct_find("worse"), 2, 2, effect, opfer->number);
|
||||
/* solange es noch keine spezielle alp-Antimagie gibt, reagiert der
|
||||
* auch auf normale */
|
||||
set_number(alp, 0);
|
||||
|
||||
/* wenn der Magier stirbt, wird der Curse wieder vom Opfer genommen */
|
||||
add_trigger(&mage->attribs, "destroy", trigger_removecurse(c, opfer));
|
||||
}
|
||||
|
||||
void
|
||||
register_alp(void)
|
||||
{
|
||||
at_register(&at_alp);
|
||||
}
|
||||
|
||||
unit *
|
||||
alp_target(unit *alp)
|
||||
{
|
||||
alp_data* ad;
|
||||
unit * target = NULL;
|
||||
|
||||
attrib * a = a_find(alp->attribs, &at_alp);
|
||||
|
||||
if (a) {
|
||||
ad = (alp_data*) a->data.v;
|
||||
target = ad->target;
|
||||
}
|
||||
return target;
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef ALP_H
|
||||
#define ALP_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct castorder;
|
||||
struct region;
|
||||
struct unit;
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Name: Alp
|
||||
* Stufe: 15
|
||||
* Gebiet: Illaun
|
||||
* Wirkung:
|
||||
* Erschafft ein kleines Monster (den Alp). Dieser bewegt sich jede
|
||||
* zweite Runde auf eine Zieleinheit zu. Sobald das Ziel erreicht ist,
|
||||
* verwandelt es sich in einen Curse auf die Einheit, welches -2 auf
|
||||
* alle Talente bewirkt.
|
||||
*
|
||||
* Fähigkeiten (factypes.c):
|
||||
* Der Alp hat mittlere Tarnung (T7) und exzellente Verteidigung
|
||||
* (+20, 99% Magieresistenz, siehe factypes.c)
|
||||
*
|
||||
* TODO: Der Alp-Curse sollte sich durch besondere Antimagie (Tybied)
|
||||
* entfernen lassen.
|
||||
*
|
||||
* (UNITSPELL | SEARCHGLOBAL | TESTRESISTANCE)
|
||||
*/
|
||||
|
||||
extern int sp_summon_alp(struct castorder *co);
|
||||
extern void register_alp(void);
|
||||
|
||||
struct unit* alp_target(struct unit *alp);
|
||||
void alp_findet_opfer(struct unit *alp, struct region *r);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,99 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "buildingcurse.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/objtypes.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/ship.h>
|
||||
#include <kernel/curse.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/nrmessage.h>
|
||||
#include <util/base36.h>
|
||||
#include <util/functions.h>
|
||||
#include <util/language.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
static message *
|
||||
cinfo_building(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(typ);
|
||||
assert(typ == TYP_BUILDING);
|
||||
|
||||
if (self != 0){ /* owner or inside */
|
||||
return msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
|
||||
}
|
||||
return msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no);
|
||||
}
|
||||
|
||||
/* CurseInfo mit Spezialabfragen */
|
||||
|
||||
/* C_MAGICWALLS*/
|
||||
static message *
|
||||
cinfo_magicrunes(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
message * msg = NULL;
|
||||
if (typ == TYP_BUILDING){
|
||||
building * b;
|
||||
b = (building*)obj;
|
||||
if (self != 0) {
|
||||
msg = msg_message("curseinfo::magicrunes_building", "building id", b, c->no);
|
||||
}
|
||||
} else if (typ == TYP_SHIP) {
|
||||
ship *sh;
|
||||
sh = (ship*)obj;
|
||||
if (self != 0){
|
||||
msg = msg_message("curseinfo::magicrunes_ship", "ship id", sh, c->no);
|
||||
}
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
static struct curse_type ct_magicrunes = { "magicrunes",
|
||||
CURSETYP_NORM, 0, M_SUMEFFECT, cinfo_magicrunes
|
||||
};
|
||||
|
||||
/* Heimstein-Zauber */
|
||||
static struct curse_type ct_magicwalls = { "magicwalls",
|
||||
CURSETYP_NORM, 0, NO_MERGE, cinfo_building
|
||||
};
|
||||
|
||||
/* Feste Mauer - Präkampfzauber, wirkt nur 1 Runde */
|
||||
static struct curse_type ct_strongwall = { "strongwall",
|
||||
CURSETYP_NORM, 0, NO_MERGE, NULL
|
||||
};
|
||||
|
||||
/* Ewige Mauern-Zauber */
|
||||
static struct curse_type ct_nocostbuilding = { "nocostbuilding",
|
||||
CURSETYP_NORM, CURSE_NOAGE|CURSE_ONLYONE, NO_MERGE, cinfo_building
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
register_buildingcurse(void)
|
||||
{
|
||||
ct_register(&ct_magicwalls);
|
||||
ct_register(&ct_strongwall);
|
||||
ct_register(&ct_magicrunes);
|
||||
ct_register(&ct_nocostbuilding);
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef _BCURSE_H
|
||||
#define _BCURSE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct locale;
|
||||
struct curse;
|
||||
|
||||
extern void register_buildingcurse(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _BCURSE_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,57 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef H_GC_COMBATSPELLS
|
||||
#define H_GC_COMBATSPELLS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct fighter;
|
||||
|
||||
/* Kampfzauber */
|
||||
extern int sp_fumbleshield(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_shadowknights(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_combatrosthauch(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_kampfzauber(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_healing(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_keeploot(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_reanimate(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_chaosrow(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_flee(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_berserk(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_tiredsoldiers(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_reeling_arrows(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_denyattack(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_sleep(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_windshield(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_strong_wall(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_petrify(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_hero(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_frighten(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_mindblast(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_mindblast_temp(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_speed(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_wolfhowl(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_dragonodem(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_reduceshield(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_armorshield(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_stun(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_undeadhero(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_shadowcall(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
extern int sp_immolation(struct fighter * fi, int level, double power, struct spell * sp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,296 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "regioncurse.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/objtypes.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/terrain.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/nrmessage.h>
|
||||
#include <util/message.h>
|
||||
#include <util/functions.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* CurseInfo mit Spezialabfragen
|
||||
*/
|
||||
|
||||
/*
|
||||
* godcursezone
|
||||
*/
|
||||
static message *
|
||||
cinfo_cursed_by_the_gods(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
region *r = (region *)obj;
|
||||
|
||||
unused(typ);
|
||||
unused(self);
|
||||
assert(typ == TYP_REGION);
|
||||
|
||||
if (fval(r->terrain, SEA_REGION)) {
|
||||
return msg_message("curseinfo::godcurseocean", "id", c->no);
|
||||
}
|
||||
return msg_message("curseinfo::godcurse", "id", c->no);
|
||||
}
|
||||
|
||||
static struct curse_type ct_godcursezone = {
|
||||
"godcursezone",
|
||||
CURSETYP_NORM, CURSE_IMMUNE|CURSE_ISNEW, (NO_MERGE), cinfo_cursed_by_the_gods,
|
||||
};
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* C_GBDREAM
|
||||
*/
|
||||
static message *
|
||||
cinfo_dreamcurse(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(self);
|
||||
unused(typ);
|
||||
unused(obj);
|
||||
assert(typ == TYP_REGION);
|
||||
|
||||
if (curse_geteffect(c) > 0) {
|
||||
return msg_message("curseinfo::gooddream", "id", c->no);
|
||||
}
|
||||
return msg_message("curseinfo::baddream", "id", c->no);
|
||||
}
|
||||
|
||||
static struct curse_type ct_gbdream = {
|
||||
"gbdream",
|
||||
CURSETYP_NORM, CURSE_ISNEW, (NO_MERGE), cinfo_dreamcurse
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* C_MAGICSTREET
|
||||
* erzeugt Straßennetz
|
||||
*/
|
||||
static message *
|
||||
cinfo_magicstreet(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(typ);
|
||||
unused(self);
|
||||
unused(obj);
|
||||
assert(typ == TYP_REGION);
|
||||
|
||||
/* Warnung vor Auflösung */
|
||||
if (c->duration <= 2) {
|
||||
return msg_message("curseinfo::magicstreet", "id", c->no);
|
||||
}
|
||||
return msg_message("curseinfo::magicstreetwarn", "id", c->no);
|
||||
}
|
||||
|
||||
static struct curse_type ct_magicstreet = {
|
||||
"magicstreet",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
cinfo_magicstreet
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
static message *
|
||||
cinfo_antimagiczone(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(typ);
|
||||
unused(self);
|
||||
unused(obj);
|
||||
assert(typ == TYP_REGION);
|
||||
|
||||
/* Magier spüren eine Antimagiezone */
|
||||
if (self != 0) {
|
||||
return msg_message("curseinfo::antimagiczone", "id", c->no);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* alle Magier können eine Antimagiezone wahrnehmen */
|
||||
static int
|
||||
cansee_antimagiczone(const struct faction *viewer, const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
region *r;
|
||||
unit *u = NULL;
|
||||
unit *mage = c->magician;
|
||||
|
||||
unused(typ);
|
||||
|
||||
assert(typ == TYP_REGION);
|
||||
r = (region *)obj;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->faction==viewer) {
|
||||
if (u==mage) {
|
||||
self = 2;
|
||||
break;
|
||||
}
|
||||
if (is_mage(u)) {
|
||||
self = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
static struct curse_type ct_antimagiczone = {
|
||||
"antimagiczone",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
cinfo_antimagiczone, NULL, NULL, NULL, cansee_antimagiczone
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
static message *
|
||||
cinfo_farvision(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(typ);
|
||||
unused(obj);
|
||||
|
||||
assert(typ == TYP_REGION);
|
||||
|
||||
/* Magier spüren eine farvision */
|
||||
if (self != 0) {
|
||||
return msg_message("curseinfo::farvision", "id", c->no);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct curse_type ct_farvision = {
|
||||
"farvision",
|
||||
CURSETYP_NORM, 0, (NO_MERGE),
|
||||
cinfo_farvision
|
||||
};
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
static struct curse_type ct_fogtrap = {
|
||||
"fogtrap",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
cinfo_simple
|
||||
};
|
||||
static struct curse_type ct_maelstrom = {
|
||||
"maelstrom",
|
||||
CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
static struct curse_type ct_blessedharvest = {
|
||||
"blessedharvest",
|
||||
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
static struct curse_type ct_drought = {
|
||||
"drought",
|
||||
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),
|
||||
cinfo_simple
|
||||
};
|
||||
static struct curse_type ct_badlearn = {
|
||||
"badlearn",
|
||||
CURSETYP_NORM, CURSE_ISNEW, ( M_DURATION | M_VIGOUR ),
|
||||
cinfo_simple
|
||||
};
|
||||
/* Trübsal-Zauber */
|
||||
static struct curse_type ct_depression = {
|
||||
"depression",
|
||||
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
/* Astralblock, auf Astralregion */
|
||||
static struct curse_type ct_astralblock = {
|
||||
"astralblock",
|
||||
CURSETYP_NORM, 0, NO_MERGE,
|
||||
cinfo_simple
|
||||
};
|
||||
/* Unterhaltungsanteil vermehren */
|
||||
static struct curse_type ct_generous = {
|
||||
"generous",
|
||||
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR | M_MAXEFFECT ),
|
||||
cinfo_simple
|
||||
};
|
||||
/* verhindert Attackiere regional */
|
||||
static struct curse_type ct_peacezone = {
|
||||
"peacezone",
|
||||
CURSETYP_NORM, 0, NO_MERGE,
|
||||
cinfo_simple
|
||||
};
|
||||
/* erniedigt Magieresistenz von nicht-aliierten Einheiten, wirkt nur 1x
|
||||
* pro Einheit */
|
||||
static struct curse_type ct_badmagicresistancezone = {
|
||||
"badmagicresistancezone",
|
||||
CURSETYP_NORM, 0, NO_MERGE,
|
||||
cinfo_simple
|
||||
};
|
||||
/* erhöht Magieresistenz von aliierten Einheiten, wirkt nur 1x pro
|
||||
* Einheit */
|
||||
static struct curse_type ct_goodmagicresistancezone = {
|
||||
"goodmagicresistancezone",
|
||||
CURSETYP_NORM, 0, NO_MERGE,
|
||||
cinfo_simple
|
||||
};
|
||||
static struct curse_type ct_riotzone = {
|
||||
"riotzone",
|
||||
CURSETYP_NORM, 0, (M_DURATION),
|
||||
cinfo_simple
|
||||
};
|
||||
static struct curse_type ct_holyground = {
|
||||
"holyground",
|
||||
CURSETYP_NORM, CURSE_NOAGE, (M_VIGOUR_ADD),
|
||||
cinfo_simple
|
||||
};
|
||||
static struct curse_type ct_healing = {
|
||||
"healingzone",
|
||||
CURSETYP_NORM, 0, (M_VIGOUR | M_DURATION),
|
||||
cinfo_simple
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
register_regioncurse(void)
|
||||
{
|
||||
ct_register(&ct_fogtrap);
|
||||
ct_register(&ct_antimagiczone);
|
||||
ct_register(&ct_farvision);
|
||||
ct_register(&ct_gbdream);
|
||||
ct_register(&ct_maelstrom);
|
||||
ct_register(&ct_blessedharvest);
|
||||
ct_register(&ct_drought);
|
||||
ct_register(&ct_badlearn);
|
||||
ct_register(&ct_depression);
|
||||
ct_register(&ct_astralblock);
|
||||
ct_register(&ct_generous);
|
||||
ct_register(&ct_peacezone);
|
||||
ct_register(&ct_magicstreet);
|
||||
ct_register(&ct_badmagicresistancezone);
|
||||
ct_register(&ct_goodmagicresistancezone);
|
||||
ct_register(&ct_riotzone);
|
||||
ct_register(&ct_godcursezone);
|
||||
ct_register(&ct_holyground);
|
||||
ct_register(&ct_healing);
|
||||
}
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef _RCURSE_H
|
||||
#define _RCURSE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct curse;
|
||||
struct locale;
|
||||
|
||||
extern void register_regioncurse(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _RCURSE_H */
|
|
@ -1,123 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "shipcurse.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/objtypes.h>
|
||||
#include <kernel/ship.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/curse.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/base36.h>
|
||||
#include <util/functions.h>
|
||||
#include <util/language.h>
|
||||
#include <util/log.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
message *
|
||||
cinfo_ship(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
message * msg;
|
||||
|
||||
unused(typ);
|
||||
unused(obj);
|
||||
assert(typ == TYP_SHIP);
|
||||
|
||||
if (self != 0) { /* owner or inside */
|
||||
msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
|
||||
} else {
|
||||
msg = msg_message("curseinfo::ship_unknown", "id", c->no);
|
||||
}
|
||||
if (msg==NULL) {
|
||||
log_error(("There is no curseinfo for %s.\n", c->type->cname));
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
/* CurseInfo mit Spezialabfragen */
|
||||
|
||||
/* C_SHIP_NODRIFT */
|
||||
static message *
|
||||
cinfo_shipnodrift(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
ship * sh = (ship *)obj;
|
||||
|
||||
unused(typ);
|
||||
assert(typ == TYP_SHIP);
|
||||
|
||||
if (self != 0) {
|
||||
return msg_message("curseinfo::shipnodrift_1", "ship duration id", sh, c->duration, c->no);
|
||||
}
|
||||
return msg_message("curseinfo::shipnodrift_0", "ship id", sh, c->no);
|
||||
}
|
||||
|
||||
static struct curse_type ct_stormwind = { "stormwind",
|
||||
CURSETYP_NORM, 0, NO_MERGE, cinfo_ship
|
||||
};
|
||||
static struct curse_type ct_flyingship = { "flyingship",
|
||||
CURSETYP_NORM, 0, NO_MERGE, cinfo_ship
|
||||
};
|
||||
static struct curse_type ct_nodrift = { "nodrift",
|
||||
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ), cinfo_shipnodrift
|
||||
};
|
||||
static struct curse_type ct_shipspeedup = { "shipspeedup",
|
||||
CURSETYP_NORM, 0, 0, cinfo_ship
|
||||
};
|
||||
|
||||
curse *
|
||||
shipcurse_flyingship(ship* sh, unit * mage, double power, int duration)
|
||||
{
|
||||
static const curse_type * ct_flyingship = NULL;
|
||||
if (!ct_flyingship) {
|
||||
ct_flyingship = ct_find("flyingship");
|
||||
assert(ct_flyingship);
|
||||
}
|
||||
if (curse_active(get_curse(sh->attribs, ct_flyingship))) {
|
||||
return NULL;
|
||||
} else if (is_cursed(sh->attribs, C_SHIP_SPEEDUP, 0)) {
|
||||
return NULL;
|
||||
} else {
|
||||
/* mit C_SHIP_NODRIFT haben wir kein Problem */
|
||||
return create_curse(mage, &sh->attribs, ct_flyingship, power, duration, 0.0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
levitate_ship(ship * sh, unit * mage, double power, int duration)
|
||||
{
|
||||
curse * c = shipcurse_flyingship(sh, mage, power, duration);
|
||||
if (c) {
|
||||
return c->no;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
register_shipcurse(void)
|
||||
{
|
||||
ct_register(&ct_stormwind);
|
||||
ct_register(&ct_flyingship);
|
||||
ct_register(&ct_nodrift);
|
||||
ct_register(&ct_shipspeedup);
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef _SCURSE_H
|
||||
#define _SCURSE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct locale;
|
||||
struct message;
|
||||
extern struct message * cinfo_ship(const void * obj, typ_t typ, const struct curse *c, int self);
|
||||
extern void register_shipcurse(void);
|
||||
extern struct curse * shipcurse_flyingship(struct ship* sh, struct unit * mage, double power, int duration);
|
||||
int levitate_ship(struct ship * sh, struct unit * mage, double power, int duration);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _SCURSE_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,33 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef H_SPL_SPELLS
|
||||
#define H_SPL_SPELLS
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ship;
|
||||
struct curse;
|
||||
struct unit;
|
||||
|
||||
extern void register_spells(void);
|
||||
|
||||
int levitate_ship(struct ship * sh, struct unit * mage, double power, int duration);
|
||||
void set_spelldata(struct spell * sp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,364 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "unitcurse.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/skill.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/objtypes.h>
|
||||
#include <kernel/version.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/language.h>
|
||||
#include <util/nrmessage.h>
|
||||
#include <util/message.h>
|
||||
#include <util/base36.h>
|
||||
#include <util/functions.h>
|
||||
#include <util/storage.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_AURA
|
||||
*/
|
||||
/* erhöht/senkt regeneration und maxaura um effect% */
|
||||
static message *
|
||||
cinfo_auraboost(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
struct unit *u = (struct unit *)obj;
|
||||
unused(typ);
|
||||
assert(typ == TYP_UNIT);
|
||||
|
||||
if (self != 0){
|
||||
if (curse_geteffect(c) > 100){
|
||||
return msg_message("curseinfo::auraboost_0", "unit id", u, c->no);
|
||||
} else {
|
||||
return msg_message("curseinfo::auraboost_1", "unit id", u, c->no);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
static struct curse_type ct_auraboost = {
|
||||
"auraboost",
|
||||
CURSETYP_NORM, CURSE_SPREADMODULO, (NO_MERGE),
|
||||
cinfo_auraboost
|
||||
};
|
||||
|
||||
/* Magic Boost - Gabe des Chaos */
|
||||
static struct curse_type ct_magicboost = {
|
||||
"magicboost",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO|CURSE_IMMUNE, M_MEN, cinfo_simple
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_SLAVE
|
||||
*/
|
||||
static message *
|
||||
cinfo_slave(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unit *u;
|
||||
unused(typ);
|
||||
|
||||
assert(typ == TYP_UNIT);
|
||||
u = (unit *)obj;
|
||||
|
||||
if (self != 0){
|
||||
return msg_message("curseinfo::slave_1", "unit duration id", u, c->duration, c->no);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
static struct curse_type ct_slavery = { "slavery",
|
||||
CURSETYP_NORM, 0, NO_MERGE,
|
||||
cinfo_slave
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_CALM
|
||||
*/
|
||||
static message *
|
||||
cinfo_calm(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(typ);
|
||||
assert(typ == TYP_UNIT);
|
||||
|
||||
if (c->magician && c->magician->faction) {
|
||||
faction *f = c->magician->faction;
|
||||
unit *u = (unit *)obj;
|
||||
|
||||
if (f==NULL || self == 0) {
|
||||
const struct race * rc = u_irace(c->magician);
|
||||
return msg_message("curseinfo::calm_0", "unit race id", u, rc, c->no);
|
||||
}
|
||||
return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct curse_type ct_calmmonster = {
|
||||
"calmmonster",
|
||||
CURSETYP_NORM, CURSE_SPREADNEVER|CURSE_ONLYONE, NO_MERGE,
|
||||
cinfo_calm
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_SPEED
|
||||
*/
|
||||
static message *
|
||||
cinfo_speed(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(typ);
|
||||
assert(typ == TYP_UNIT);
|
||||
|
||||
if (self != 0){
|
||||
unit *u = (unit *)obj;
|
||||
curse_unit * cu = (curse_unit *)c->data.v;
|
||||
return msg_message("curseinfo::speed_1", "unit number duration id", u, cu->cursedmen, c->duration, c->no);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
static struct curse_type ct_speed = {
|
||||
"speed",
|
||||
CURSETYP_UNIT, CURSE_SPREADNEVER, M_MEN,
|
||||
cinfo_speed
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_ORC
|
||||
*/
|
||||
message *
|
||||
cinfo_unit(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(typ);
|
||||
assert(typ == TYP_UNIT);
|
||||
|
||||
if (self != 0){
|
||||
unit * u = (unit *)obj;
|
||||
return msg_message(mkname("curseinfo", c->type->cname), "unit id", u, c->no);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct curse_type ct_orcish = {
|
||||
"orcish",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO|CURSE_ISNEW, M_MEN,
|
||||
cinfo_unit
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_KAELTESCHUTZ
|
||||
*/
|
||||
static message *
|
||||
cinfo_kaelteschutz(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(typ);
|
||||
assert(typ == TYP_UNIT);
|
||||
|
||||
if (self != 0) {
|
||||
unit * u = (unit *)obj;
|
||||
curse_unit *cu = (curse_unit *)c->data.v;
|
||||
return msg_message("curseinfo::warmth_1", "unit number id", u, cu->cursedmen, c->no);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
static struct curse_type ct_insectfur = {
|
||||
"insectfur",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO, ( M_MEN | M_DURATION ),
|
||||
cinfo_kaelteschutz
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_SPARKLE
|
||||
*/
|
||||
static message *
|
||||
cinfo_sparkle(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
const char * effects[] = {
|
||||
NULL, /* end grau*/
|
||||
"sparkle_1",
|
||||
"sparkle_2",
|
||||
NULL, /* end traum */
|
||||
"sparkle_3",
|
||||
"sparkle_4",
|
||||
NULL, /* end tybied */
|
||||
"sparkle_5",
|
||||
"sparkle_6",
|
||||
"sparkle_7",
|
||||
"sparkle_8",
|
||||
NULL, /* end cerrdor */
|
||||
"sparkle_9",
|
||||
"sparkle_10",
|
||||
"sparkle_11",
|
||||
"sparkle_12",
|
||||
NULL, /* end gwyrrd */
|
||||
"sparkle_13",
|
||||
"sparkle_14",
|
||||
"sparkle_15",
|
||||
"sparkle_16",
|
||||
"sparkle_17",
|
||||
"sparkle_18",
|
||||
NULL, /* end draig */
|
||||
};
|
||||
int m, begin=0, end=0;
|
||||
unit *u;
|
||||
unused(typ);
|
||||
|
||||
assert(typ == TYP_UNIT);
|
||||
u = (unit *)obj;
|
||||
|
||||
if (!c->magician || !c->magician->faction) return NULL;
|
||||
|
||||
for (m=0;m!=c->magician->faction->magiegebiet;++m) {
|
||||
while (effects[end]!=NULL) ++end;
|
||||
begin = end+1;
|
||||
end = begin;
|
||||
}
|
||||
|
||||
while (effects[end]!=NULL) ++end;
|
||||
if (end==begin) return NULL;
|
||||
else {
|
||||
int index = begin + curse_geteffect_int(c) % (end-begin);
|
||||
return msg_message(mkname("curseinfo", effects[index]), "unit id", u, c->no);
|
||||
}
|
||||
}
|
||||
|
||||
static struct curse_type ct_sparkle = { "sparkle",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO, ( M_MEN | M_DURATION ), cinfo_sparkle
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_STRENGTH
|
||||
*/
|
||||
static struct curse_type ct_strength = { "strength",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_ALLSKILLS (Alp)
|
||||
*/
|
||||
static struct curse_type ct_worse = {
|
||||
"worse", CURSETYP_UNIT, CURSE_SPREADMODULO|CURSE_NOAGE, M_MEN, cinfo_unit
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* C_ITEMCLOAK
|
||||
*/
|
||||
static struct curse_type ct_itemcloak = {
|
||||
"itemcloak", CURSETYP_UNIT, CURSE_SPREADNEVER, M_DURATION, cinfo_unit
|
||||
};
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
static struct curse_type ct_fumble = {
|
||||
"fumble", CURSETYP_NORM, CURSE_SPREADNEVER|CURSE_ONLYONE, NO_MERGE, cinfo_unit
|
||||
};
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
|
||||
static struct curse_type ct_oldrace = {
|
||||
"oldrace", CURSETYP_NORM, CURSE_SPREADALWAYS, NO_MERGE, NULL
|
||||
};
|
||||
|
||||
static struct curse_type ct_magicresistance = {
|
||||
"magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple
|
||||
};
|
||||
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/*
|
||||
* C_SKILL
|
||||
*/
|
||||
|
||||
static int
|
||||
read_skill(struct storage * store, curse * c)
|
||||
{
|
||||
int skill;
|
||||
if (store->version<CURSETYPE_VERSION) {
|
||||
int men;
|
||||
skill = store->r_int(store);
|
||||
men = store->r_int(store);
|
||||
} else {
|
||||
skill = store->r_int(store);
|
||||
}
|
||||
c->data.i = skill;
|
||||
return 0;
|
||||
}
|
||||
static int
|
||||
write_skill(struct storage * store, const curse * c)
|
||||
{
|
||||
store->w_int(store, c->data.i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static message *
|
||||
cinfo_skillmod(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
unused(typ);
|
||||
|
||||
if (self != 0) {
|
||||
unit *u = (unit *)obj;
|
||||
int sk = c->data.i;
|
||||
if (c->effect>0) {
|
||||
return msg_message("curseinfo::skill_1", "unit skill id", u, sk, c->no);
|
||||
} else if (c->effect<0) {
|
||||
return msg_message("curseinfo::skill_2", "unit skill id", u, sk, c->no);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct curse_type ct_skillmod = {
|
||||
"skillmod", CURSETYP_NORM, CURSE_SPREADMODULO, M_MEN, cinfo_skillmod,
|
||||
NULL, read_skill, write_skill
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
void
|
||||
register_unitcurse(void)
|
||||
{
|
||||
ct_register(&ct_auraboost);
|
||||
ct_register(&ct_magicboost);
|
||||
ct_register(&ct_slavery);
|
||||
ct_register(&ct_calmmonster);
|
||||
ct_register(&ct_speed);
|
||||
ct_register(&ct_orcish);
|
||||
ct_register(&ct_insectfur);
|
||||
ct_register(&ct_sparkle);
|
||||
ct_register(&ct_strength);
|
||||
ct_register(&ct_worse);
|
||||
ct_register(&ct_skillmod);
|
||||
ct_register(&ct_itemcloak);
|
||||
ct_register(&ct_fumble);
|
||||
ct_register(&ct_oldrace);
|
||||
ct_register(&ct_magicresistance);
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef _UCURSE_H
|
||||
#define _UCURSE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct curse;
|
||||
struct message;
|
||||
extern struct message * cinfo_unit(const void * obj, typ_t typ, const struct curse *c, int self);
|
||||
|
||||
extern void register_unitcurse(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _UCURSE_H */
|
|
@ -256,7 +256,7 @@ a_age(attrib ** p)
|
|||
}
|
||||
|
||||
int
|
||||
a_read(struct storage * store, attrib ** attribs)
|
||||
a_read(struct storage * store, attrib ** attribs, void * owner)
|
||||
{
|
||||
int key, retval = AT_READ_OK;
|
||||
char zText[128];
|
||||
|
@ -275,7 +275,7 @@ a_read(struct storage * store, attrib ** attribs)
|
|||
}
|
||||
if (at->read) {
|
||||
attrib * na = a_new(at);
|
||||
int i = at->read(na, store);
|
||||
int i = at->read(na, owner, store);
|
||||
switch (i) {
|
||||
case AT_READ_OK:
|
||||
a_add(attribs, na);
|
||||
|
@ -300,7 +300,7 @@ a_read(struct storage * store, attrib ** attribs)
|
|||
}
|
||||
|
||||
void
|
||||
a_write(struct storage * store, const attrib * attribs)
|
||||
a_write(struct storage * store, const attrib * attribs, const void * owner)
|
||||
{
|
||||
const attrib * na = attribs;
|
||||
|
||||
|
@ -308,7 +308,7 @@ a_write(struct storage * store, const attrib * attribs)
|
|||
if (na->type->write) {
|
||||
assert(na->type->hashkey || !"attribute not registered");
|
||||
store->w_tok(store, na->type->name);
|
||||
na->type->write(na, store);
|
||||
na->type->write(na, owner, store);
|
||||
na = na->next;
|
||||
} else {
|
||||
na = na->nexttype;
|
||||
|
|
|
@ -48,8 +48,8 @@ typedef struct attrib_type {
|
|||
void (*finalize)(struct attrib *);
|
||||
int (*age)(struct attrib *);
|
||||
/* age returns 0 if the attribute needs to be removed, !=0 otherwise */
|
||||
void (*write)(const struct attrib *, struct storage *);
|
||||
int (*read)(struct attrib *, struct storage *); /* return AT_READ_OK on success, AT_READ_FAIL if attrib needs removal */
|
||||
void (*write)(const struct attrib *, const void * owner, struct storage *);
|
||||
int (*read)(struct attrib *, void * owner, struct storage *); /* return AT_READ_OK on success, AT_READ_FAIL if attrib needs removal */
|
||||
unsigned int flags;
|
||||
/* ---- internal data, do not modify: ---- */
|
||||
struct attrib_type * nexthash;
|
||||
|
@ -68,8 +68,8 @@ extern attrib * a_new(const attrib_type * at);
|
|||
extern void a_free(attrib * a);
|
||||
|
||||
extern int a_age(attrib ** attribs);
|
||||
extern int a_read(struct storage * store, attrib ** attribs);
|
||||
extern void a_write(struct storage * store, const attrib * attribs);
|
||||
extern int a_read(struct storage * store, attrib ** attribs, void * owner);
|
||||
extern void a_write(struct storage * store, const attrib * attribs, const void * owner);
|
||||
|
||||
#define DEFAULT_AGE NULL
|
||||
#define DEFAULT_INIT NULL
|
||||
|
|
|
@ -133,7 +133,7 @@ free_handler(attrib * a) {
|
|||
}
|
||||
|
||||
static void
|
||||
write_handler(const attrib * a, struct storage * store)
|
||||
write_handler(const attrib * a, const void * owner, struct storage * store)
|
||||
{
|
||||
handler_info *hi = (handler_info*)a->data.v;
|
||||
store->w_tok(store, hi->event);
|
||||
|
@ -141,7 +141,7 @@ write_handler(const attrib * a, struct storage * store)
|
|||
}
|
||||
|
||||
static int
|
||||
read_handler(attrib * a, struct storage * store)
|
||||
read_handler(attrib * a, void * owner, struct storage * store)
|
||||
{
|
||||
char zText[128];
|
||||
handler_info *hi = (handler_info*)a->data.v;
|
||||
|
|
|
@ -566,3 +566,4 @@ function test_building_other()
|
|||
process_orders()
|
||||
assert_not_equal(10, b.size)
|
||||
end
|
||||
|
||||
|
|
|
@ -85,3 +85,16 @@ function test_ship_capacity()
|
|||
assert_not_equal(r2.id, u4.region.id, "boat with too much cargo has moved")
|
||||
end
|
||||
|
||||
function test_levitate()
|
||||
local r = region.create(0,0, "plain")
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
local u = unit.create(f, r, 2)
|
||||
local s = ship.create(r, "boat")
|
||||
u.ship = s
|
||||
u:set_skill("sailing", 5)
|
||||
u:add_item("money", 100)
|
||||
levitate_ship(u.ship, u, 2, 1)
|
||||
assert_equal(32, u.ship.flags)
|
||||
process_orders()
|
||||
assert_equal(0, u.ship.flags)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue