From f18edc36516ec0a37baa5e6c0229198ad88a6df4 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 12 Nov 2008 22:07:23 +0000 Subject: [PATCH] combining files to improve compilation speed --- src/combined/bindings.cpp | 21 +++ src/combined/curses.c | 6 + src/combined/gamecode.c | 84 +++++++++ src/combined/kernel.c | 54 ++++++ src/combined/stdafx.c | 1 + src/combined/stdafx.cpp | 1 + src/combined/stdafx.h | 2 + src/combined/stdafx.hpp | 2 + src/combined/util.c | 36 ++++ src/common/attributes/giveitem.c | 4 +- src/common/gamecode/creport.c | 8 +- src/common/spells/spells.c | 10 +- src/common/triggers/gate.c | 4 +- src/common/util/crmessage.c | 10 +- src/common/util/functions.c | 12 +- src/common/util/nrmessage.c | 10 +- src/common/util/translation.c | 6 +- src/eressea.sln | 34 ++-- src/eressea.vcproj | 285 +++++++++++++++++++++++++++++++ src/eressea/eressea-lua.vcproj | 2 +- src/eressea/korrektur.c | 14 +- src/eressea/lua/event.h | 3 + src/eressea/lua/item.cpp | 29 +--- src/eressea/lua/script.cpp | 50 +++--- src/eressea/lua/script.h | 1 + 25 files changed, 575 insertions(+), 114 deletions(-) create mode 100644 src/combined/bindings.cpp create mode 100644 src/combined/curses.c create mode 100644 src/combined/gamecode.c create mode 100644 src/combined/kernel.c create mode 100644 src/combined/stdafx.c create mode 100644 src/combined/stdafx.cpp create mode 100644 src/combined/stdafx.h create mode 100644 src/combined/stdafx.hpp create mode 100644 src/combined/util.c create mode 100644 src/eressea.vcproj diff --git a/src/combined/bindings.cpp b/src/combined/bindings.cpp new file mode 100644 index 000000000..17ece108f --- /dev/null +++ b/src/combined/bindings.cpp @@ -0,0 +1,21 @@ +#include "common/settings.h" +#include "common/config.h" +#include "stdafx.hpp" + +#include "eressea/server.cpp" +#include "eressea/lua/alliance.cpp" +#include "eressea/lua/building.cpp" +#include "eressea/lua/eressea.cpp" +#include "eressea/lua/event.cpp" +#include "eressea/lua/faction.cpp" +#include "eressea/lua/gamecode.cpp" +#include "eressea/lua/gm.cpp" +#include "eressea/lua/item.cpp" +#include "eressea/lua/message.cpp" +#include "eressea/lua/objects.cpp" +#include "eressea/lua/region.cpp" +#include "eressea/lua/script.cpp" +#include "eressea/lua/ship.cpp" +#include "eressea/lua/spell.cpp" +#include "eressea/lua/test.cpp" +#include "eressea/lua/unit.cpp" diff --git a/src/combined/curses.c b/src/combined/curses.c new file mode 100644 index 000000000..e9c8622f4 --- /dev/null +++ b/src/combined/curses.c @@ -0,0 +1,6 @@ +#include "common/settings.h" +#include "common/config.h" +#include "stdafx.h" + +#include "eressea/curses/listbox.c" +#include "eressea/gmtool.c" diff --git a/src/combined/gamecode.c b/src/combined/gamecode.c new file mode 100644 index 000000000..1d863872b --- /dev/null +++ b/src/combined/gamecode.c @@ -0,0 +1,84 @@ +#include "common/settings.h" +#include "common/config.h" +#include "stdafx.h" + +#include "eressea/console.c" +#include "eressea/editing.c" +#include "eressea/korrektur.c" + +#include "common/gamecode/archetype.c" +#include "common/gamecode/creation.c" +#include "common/gamecode/creport.c" +#include "common/gamecode/economy.c" +#include "common/gamecode/give.c" +#include "common/gamecode/items.c" +#include "common/gamecode/laws.c" +#include "common/gamecode/luck.c" +#include "common/gamecode/monster.c" +#include "common/gamecode/randenc.c" +#include "common/gamecode/report.c" +#include "common/gamecode/spells.c" +#include "common/gamecode/spy.c" +#include "common/gamecode/study.c" +#include "common/gamecode/summary.c" +#include "common/gamecode/xmlreport.c" + +#include "common/races/dragons.c" +#include "common/races/illusion.c" +#include "common/races/races.c" +#include "common/races/zombies.c" + +#include "common/attributes/alliance.c" +#include "common/attributes/attributes.c" +#include "common/attributes/fleechance.c" +#include "common/attributes/follow.c" +#include "common/attributes/giveitem.c" +#include "common/attributes/gm.c" +#include "common/attributes/hate.c" +#include "common/attributes/iceberg.c" +#include "common/attributes/key.c" +#include "common/attributes/matmod.c" +#include "common/attributes/movement.c" +#include "common/attributes/moved.c" +#include "common/attributes/object.c" +#include "common/attributes/option.c" +#include "common/attributes/orcification.c" +#include "common/attributes/otherfaction.c" +#include "common/attributes/overrideroads.c" +#include "common/attributes/racename.c" +#include "common/attributes/raceprefix.c" +#include "common/attributes/reduceproduction.c" +#include "common/attributes/targetregion.c" +#include "common/attributes/viewrange.c" +#include "common/attributes/variable.c" + +#include "common/items/artrewards.c" +#include "common/items/demonseye.c" +#include "common/items/itemtypes.c" +#include "common/items/phoenixcompass.c" +#include "common/items/seed.c" +#include "common/items/weapons.c" +#include "common/items/xerewards.c" + +#include "common/spells/alp.c" +#include "common/spells/buildingcurse.c" +#include "common/spells/combatspells.c" +#include "common/spells/regioncurse.c" +#include "common/spells/shipcurse.c" +#include "common/spells/spells.c" +#include "common/spells/unitcurse.c" + +#include "common/triggers/changefaction.c" +#include "common/triggers/changerace.c" +#include "common/triggers/clonedied.c" +#include "common/triggers/createcurse.c" +#include "common/triggers/createunit.c" +#include "common/triggers/gate.c" +#include "common/triggers/giveitem.c" +#include "common/triggers/killunit.c" +#include "common/triggers/removecurse.c" +#include "common/triggers/shock.c" +#include "common/triggers/timeout.c" +#include "common/triggers/triggers.c" +#include "common/triggers/unguard.c" +#include "common/triggers/unitmessage.c" diff --git a/src/combined/kernel.c b/src/combined/kernel.c new file mode 100644 index 000000000..71153cba5 --- /dev/null +++ b/src/combined/kernel.c @@ -0,0 +1,54 @@ +#include "common/settings.h" +#include "common/config.h" +#include "stdafx.h" + +#include "common/kernel/alchemy.c" +#include "common/kernel/alliance.c" +#include "common/kernel/battle.c" +#include "common/kernel/binarystore.c" +#include "common/kernel/border.c" +#include "common/kernel/build.c" +#include "common/kernel/building.c" +#include "common/kernel/calendar.c" +#include "common/kernel/command.c" +#include "common/kernel/curse.c" +#include "common/kernel/equipment.c" +#include "common/kernel/eressea.c" +#include "common/kernel/faction.c" +#include "common/kernel/group.c" +#include "common/kernel/item.c" +#include "common/kernel/karma.c" +#include "common/kernel/magic.c" +#include "common/kernel/message.c" +#include "common/kernel/move.c" +#include "common/kernel/names.c" +#include "common/kernel/order.c" +#include "common/kernel/pathfinder.c" +#include "common/kernel/plane.c" +#include "common/kernel/player.c" +#include "common/kernel/pool.c" +#include "common/kernel/race.c" +#include "common/kernel/region.c" +#include "common/kernel/reports.c" +#include "common/kernel/resources.c" +#include "common/kernel/save.c" +#include "common/kernel/ship.c" +#include "common/kernel/skill.c" +#include "common/kernel/spell.c" +#include "common/kernel/teleport.c" +#include "common/kernel/terrain.c" +#include "common/kernel/textstore.c" +#include "common/kernel/unit.c" +#include "common/kernel/xmlreader.c" + +#include "common/modules/arena.c" +#include "common/modules/autoseed.c" +#include "common/modules/dungeon.c" +#include "common/modules/gmcmd.c" +#include "common/modules/infocmd.c" +#include "common/modules/museum.c" +#include "common/modules/score.c" +#include "common/modules/weather.c" +#include "common/modules/wormhole.c" +#include "common/modules/xecmd.c" +#include "common/modules/xmas.c" diff --git a/src/combined/stdafx.c b/src/combined/stdafx.c new file mode 100644 index 000000000..fd4f341c7 --- /dev/null +++ b/src/combined/stdafx.c @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/src/combined/stdafx.cpp b/src/combined/stdafx.cpp new file mode 100644 index 000000000..7845e6a58 --- /dev/null +++ b/src/combined/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.hpp" diff --git a/src/combined/stdafx.h b/src/combined/stdafx.h new file mode 100644 index 000000000..360bf55a4 --- /dev/null +++ b/src/combined/stdafx.h @@ -0,0 +1,2 @@ +#include "common/settings.h" +#include "common/config.h" diff --git a/src/combined/stdafx.hpp b/src/combined/stdafx.hpp new file mode 100644 index 000000000..360bf55a4 --- /dev/null +++ b/src/combined/stdafx.hpp @@ -0,0 +1,2 @@ +#include "common/settings.h" +#include "common/config.h" diff --git a/src/combined/util.c b/src/combined/util.c new file mode 100644 index 000000000..0ec07a9de --- /dev/null +++ b/src/combined/util.c @@ -0,0 +1,36 @@ +#include "common/settings.h" +#include "common/config.h" +#include "stdafx.h" + +#include "common/iniparser/iniparser.c" +#include "common/util/attrib.c" +#include "common/util/base36.c" +#include "common/util/crmessage.c" +#include "common/util/cvector.c" +#include "common/util/dice.c" +#include "common/util/event.c" +#include "common/util/filereader.c" +#include "common/util/functions.c" +#include "common/util/goodies.c" +#include "common/util/language.c" +#include "common/util/lists.c" +#include "common/util/log.c" +#include "common/util/message.c" +#include "common/util/mt19937ar.c" +#include "common/util/nrmessage.c" +#include "common/util/parser.c" +#include "common/util/rand.c" +#include "common/util/resolve.c" +#include "common/util/sql.c" +#include "common/util/translation.c" +#include "common/util/umlaut.c" +#include "common/util/unicode.c" +#include "common/util/xml.c" + +#ifndef HAVE_INLINE +#include "common/util/bsdstring.c" +#endif + +#ifdef __GNUC__ +#include "common/util/strncpy.c" +#endif diff --git a/src/common/attributes/giveitem.c b/src/common/attributes/giveitem.c index bff90ebdc..b960e91da 100644 --- a/src/common/attributes/giveitem.c +++ b/src/common/attributes/giveitem.c @@ -90,7 +90,7 @@ a_finalizegive(struct attrib * a) } static int -give_item(attrib * a) +a_giveitem(attrib * a) { give_data * gdata = (give_data*)a->data.v; region * r; @@ -110,7 +110,7 @@ give_item(attrib * a) attrib_type at_giveitem = { "giveitem", a_initgive, a_finalizegive, - give_item, + a_giveitem, a_writegive, a_readgive }; diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 272c0b0bf..92e0f2cf1 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -77,8 +77,6 @@ without prior permission by the authors of Eressea. #include /* imports */ -extern const char *directions[]; -extern const char *spelldata[]; extern int quiet; boolean opt_cr_absolute_coords = false; @@ -905,7 +903,7 @@ cr_output_unit(FILE * F, const region * r, /* prints allies */ static void -show_allies(FILE * F, const faction * f, const ally * sf) +show_allies_cr(FILE * F, const faction * f, const ally * sf) { for (; sf; sf = sf->next) if (sf->faction) { int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL); @@ -1365,7 +1363,7 @@ report_computer(const char * filename, report_context * ctx, const char * charse #ifdef ENEMIES show_enemies(F, f->enemies); #endif - show_allies(F, f, f->allies); + show_allies_cr(F, f, f->allies); { group * g; for (g=f->groups;g;g=g->next) { @@ -1378,7 +1376,7 @@ report_computer(const char * filename, report_context * ctx, const char * charse fprintf(F, "\"%s\";typprefix\n", add_translation(prefix, LOC(f->locale, prefix))); } - show_allies(F, f, g->allies); + show_allies_cr(F, f, g->allies); } } diff --git a/src/common/spells/spells.c b/src/common/spells/spells.c index b2c8b8cef..45d7706aa 100644 --- a/src/common/spells/spells.c +++ b/src/common/spells/spells.c @@ -108,7 +108,7 @@ attrib_type at_wdwpyramid = { /* ----------------------------------------------------------------------- */ static void -nr_spell(unit * mage, region * r, message * msg) +report_spell(unit * mage, region * r, message * msg) { r_addmessage(r, NULL, msg); if (mage && mage->region!=r) { @@ -1977,7 +1977,7 @@ sp_holyground(castorder *co) double power = co->force; curse * c; message * msg = msg_message("sp_holyground_effect", "mage region", mage, r); - nr_spell(mage, r, msg); + report_spell(mage, r, msg); msg_release(msg); if (!ctype) ctype = ct_find("holyground"); @@ -2082,7 +2082,7 @@ sp_drought(castorder *co) /* melden, 1x pro Partei */ msg = msg_message("sp_drought_effect", "mage region", mage, r); - nr_spell(mage, r, msg); + report_spell(mage, r, msg); msg_release(msg); /* Wenn schon Duerre herrscht, dann setzen wir nur den Power-Level @@ -4011,7 +4011,7 @@ sp_raisepeasantmob(castorder *co) create_curse(mage, &r->attribs, ct_find("riotzone"), cast_level, duration, anteil, 0); msg = msg_message("sp_raisepeasantmob_effect", "mage region", mage, r); - nr_spell(mage, r, msg); + report_spell(mage, r, msg); msg_release(msg); return cast_level; @@ -4796,7 +4796,7 @@ sp_icastle(castorder *co) co->order)); msg = msg_message("sp_icastle_effect", "region", r); - nr_spell(mage, r, msg); + report_spell(mage, r, msg); msg_release(msg); return cast_level; diff --git a/src/common/triggers/gate.c b/src/common/triggers/gate.c index 35c705511..a84d91450 100644 --- a/src/common/triggers/gate.c +++ b/src/common/triggers/gate.c @@ -30,8 +30,8 @@ #include typedef struct gate_data { - struct building * gate; - struct region * target; + struct building * gate; + struct region * target; } gate_data; static int diff --git a/src/common/util/crmessage.c b/src/common/util/crmessage.c index 051bc3cec..20ffe3a63 100644 --- a/src/common/util/crmessage.c +++ b/src/common/util/crmessage.c @@ -68,14 +68,14 @@ typedef struct crmessage_type { } crmessage_type; #define CRMAXHASH 63 -static crmessage_type * messagetypes[CRMAXHASH]; +static crmessage_type * crtypes[CRMAXHASH]; static crmessage_type * crt_find(const struct message_type * mtype) { unsigned int hash = hashstring(mtype->name) % CRMAXHASH; crmessage_type * found = NULL; - crmessage_type * type = messagetypes[hash]; + crmessage_type * type = crtypes[hash]; while (type) { if (type->mtype==mtype) found = type; type = type->next; @@ -87,7 +87,7 @@ void crt_register(const struct message_type * mtype) { unsigned int hash = hashstring(mtype->name) % CRMAXHASH; - crmessage_type * crt = messagetypes[hash]; + crmessage_type * crt = crtypes[hash]; while (crt && crt->mtype!=mtype) { crt = crt->next; } @@ -95,8 +95,8 @@ crt_register(const struct message_type * mtype) int i; crt = malloc(sizeof(crmessage_type)); crt->mtype = mtype; - crt->next = messagetypes[hash]; - messagetypes[hash] = crt; + crt->next = crtypes[hash]; + crtypes[hash] = crt; if(mtype->nparameters > 0) { crt->renderers = malloc(sizeof(tostring_f)*mtype->nparameters); } else { diff --git a/src/common/util/functions.c b/src/common/util/functions.c index a414c4e07..b68e2c28a 100644 --- a/src/common/util/functions.c +++ b/src/common/util/functions.c @@ -27,12 +27,12 @@ typedef struct function_list { const char * name; } function_list; -static function_list * functions; +static function_list * functionlist; pf_generic get_function(const char * name) { - function_list * fl = functions; + function_list * fl = functionlist; if (name==NULL) return NULL; while (fl && strcmp(fl->name, name)!=0) fl=fl->next; if (fl) return fl->fun; @@ -42,7 +42,7 @@ get_function(const char * name) const char * get_functionname(pf_generic fun) { - function_list * fl = functions; + function_list * fl = functionlist; while (fl && fl->fun!=fun) fl=fl->next; if (fl) return fl->name; return NULL; @@ -52,16 +52,16 @@ void register_function(pf_generic fun, const char * name) { function_list * fl = calloc(sizeof(function_list), 1); - fl->next = functions; + fl->next = functionlist; fl->fun = fun; fl->name = strdup(name); - functions = fl; + functionlist = fl; } void list_registered_functions(void) { - function_list * fl = functions; + function_list * fl = functionlist; while(fl) { printf("%s\n", fl->name); diff --git a/src/common/util/nrmessage.c b/src/common/util/nrmessage.c index c5e13cfe0..ee7056145 100644 --- a/src/common/util/nrmessage.c +++ b/src/common/util/nrmessage.c @@ -29,7 +29,7 @@ #include #define NRT_MAXHASH 1021 -static nrmessage_type * messagetypes[NRT_MAXHASH]; +static nrmessage_type * nrtypes[NRT_MAXHASH]; const char * nrt_string(const struct nrmessage_type *type) @@ -42,7 +42,7 @@ nrt_find(const struct locale * lang, const struct message_type * mtype) { nrmessage_type * found = NULL; unsigned int hash = hashstring(mtype->name) % NRT_MAXHASH; - nrmessage_type * type = messagetypes[hash]; + nrmessage_type * type = nrtypes[hash]; while (type) { if (type->mtype==mtype) { if (found==NULL) found = type; @@ -100,7 +100,7 @@ void nrt_register(const struct message_type * mtype, const struct locale * lang, const char * string, int level, const char * section) { unsigned int hash = hashstring(mtype->name) % NRT_MAXHASH; - nrmessage_type * nrt = messagetypes[hash]; + nrmessage_type * nrt = nrtypes[hash]; while (nrt && (nrt->lang!=lang || nrt->mtype!=mtype)) { nrt = nrt->next; } @@ -112,7 +112,7 @@ nrt_register(const struct message_type * mtype, const struct locale * lang, cons nrt = malloc(sizeof(nrmessage_type)); nrt->lang = lang; nrt->mtype = mtype; - nrt->next = messagetypes[hash]; + nrt->next = nrtypes[hash]; nrt->level=level; if (section) { const nrsection * s = section_find(section); @@ -122,7 +122,7 @@ nrt_register(const struct message_type * mtype, const struct locale * lang, cons nrt->section = s->name; } else nrt->section = NULL; - messagetypes[hash] = nrt; + nrtypes[hash] = nrt; assert(string && *string); nrt->string = strdup(string); *c = '\0'; diff --git a/src/common/util/translation.c b/src/common/util/translation.c index caef94c73..e14d3e51b 100644 --- a/src/common/util/translation.c +++ b/src/common/util/translation.c @@ -66,7 +66,7 @@ opstack_push(opstack ** stackp, variant data) ** static buffer malloc **/ -#define BUFSIZE 128*1024 +#define BBUFSIZE 128*1024 static struct { char * begin; char * end; @@ -80,8 +80,8 @@ balloc(size_t size) static int init = 0; /* STATIC_XCALL: used across calls */ if (!init) { init = 1; - buffer.current = buffer.begin = malloc(BUFSIZE); - buffer.end = buffer.begin + BUFSIZE; + buffer.current = buffer.begin = malloc(BBUFSIZE); + buffer.end = buffer.begin + BBUFSIZE; } if (buffer.current + size > buffer.end) { /* out of memory! */ diff --git a/src/eressea.sln b/src/eressea.sln index 389c29e6c..8ed9679cc 100644 --- a/src/eressea.sln +++ b/src/eressea.sln @@ -1,26 +1,16 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "util", "common/util.vcproj", "{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "util", "common\util.vcproj", "{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kernel", "common/kernel.vcproj", "{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kernel", "common\kernel.vcproj", "{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gamecode", "common/gamecode.vcproj", "{1E8BFF9E-3044-0742-992F-C5765B80FE65}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gamecode", "common\gamecode.vcproj", "{1E8BFF9E-3044-0742-992F-C5765B80FE65}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bindings", "eressea/lua/bindings.vcproj", "{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bindings", "eressea\lua\bindings.vcproj", "{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "editor", "eressea/editor.vcproj", "{D893D6B3-805D-9848-8EA4-CDA1B79151F6}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "editor", "eressea\editor.vcproj", "{D893D6B3-805D-9848-8EA4-CDA1B79151F6}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eressea-lua", "eressea/eressea-lua.vcproj", "{75501170-51C2-E641-BA8B-EDC008184192}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eressea-lua", "eressea\eressea-lua.vcproj", "{75501170-51C2-E641-BA8B-EDC008184192}" ProjectSection(ProjectDependencies) = postProject {F70CFB27-8A2F-E447-B452-4E1C590EDA6D} = {F70CFB27-8A2F-E447-B452-4E1C590EDA6D} {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D} = {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D} @@ -29,7 +19,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eressea-lua", "eressea/eres {D893D6B3-805D-9848-8EA4-CDA1B79151F6} = {D893D6B3-805D-9848-8EA4-CDA1B79151F6} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eressea", "eressea.vcproj", "{AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}" +EndProject Global + GlobalSection(SubversionScc) = preSolution + Svn-Managed = True + Manager = AnkhSVN - Subversion Support for Visual Studio + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Profile|Win32 = Profile|Win32 @@ -72,6 +68,12 @@ Global {75501170-51C2-E641-BA8B-EDC008184192}.Profile|Win32.Build.0 = Profile|Win32 {75501170-51C2-E641-BA8B-EDC008184192}.Release|Win32.ActiveCfg = Release|Win32 {75501170-51C2-E641-BA8B-EDC008184192}.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}.Profile|Win32.ActiveCfg = Release|Win32 + {AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}.Profile|Win32.Build.0 = Release|Win32 + {AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}.Release|Win32.ActiveCfg = Release|Win32 + {AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/eressea.vcproj b/src/eressea.vcproj new file mode 100644 index 000000000..c8cdb8ed9 --- /dev/null +++ b/src/eressea.vcproj @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/eressea/eressea-lua.vcproj b/src/eressea/eressea-lua.vcproj index 2990f6c92..76483220d 100644 --- a/src/eressea/eressea-lua.vcproj +++ b/src/eressea/eressea-lua.vcproj @@ -65,7 +65,7 @@ /> type==&tt_timeout) { - timeout_data * tdata = (timeout_data *)t->data.v; + timeout_data_fix * tdata = (timeout_data_fix *)t->data.v; trigger * tr = tdata->triggers; while (tr) { if (tr==tfind) break; @@ -376,13 +375,6 @@ growing_trees(void) return 0; } -#include -#include -typedef struct gate_data { - struct building * gate; - struct region * target; -} gate_data; - static int fix_undead(void) { diff --git a/src/eressea/lua/event.h b/src/eressea/lua/event.h index 929fd296e..f7361a0d2 100644 --- a/src/eressea/lua/event.h +++ b/src/eressea/lua/event.h @@ -1,3 +1,5 @@ +#ifndef LUA_EVENT_H +#define LUA_EVENT_H class event { public: event(char * m, struct event_arg * a) : args(a), msg(m) {} @@ -13,3 +15,4 @@ private: char * msg; }; +#endif diff --git a/src/eressea/lua/item.cpp b/src/eressea/lua/item.cpp index 3eb76d25f..f12a60932 100644 --- a/src/eressea/lua/item.cpp +++ b/src/eressea/lua/item.cpp @@ -2,6 +2,7 @@ #include #include "bindings.h" +#include "script.h" // kernel includes #include @@ -54,34 +55,6 @@ lua_giveitem(unit * s, unit * d, const item_type * itype, int n, struct order * return retval; } -static int -lua_useitem(struct unit * u, const struct item_type * itype, - int amount, struct order *ord) -{ - char fname[64]; - int retval = -1; - const char * iname = itype->rtype->_name[0]; - - assert(u!=NULL); - strcat(strcpy(fname, iname), "_use"); - - lua_State * L = (lua_State *)global.vm_state; - if (is_function(L, fname)) { - try { - retval = luabind::call_function(L, fname, u, amount); - } - catch (luabind::error& e) { - lua_State* L = e.state(); - const char* error = lua_tostring(L, -1); - log_error(("An exception occured while %s tried to call '%s': %s.\n", - unitname(u), fname, error)); - lua_pop(L, 1); - std::terminate(); - } - } - return retval; -} - static void item_register(const char * name, const char * appearance) { diff --git a/src/eressea/lua/script.cpp b/src/eressea/lua/script.cpp index 9ca29d948..3d99a8e47 100644 --- a/src/eressea/lua/script.cpp +++ b/src/eressea/lua/script.cpp @@ -129,31 +129,6 @@ lua_callspell(castorder *co) return retval; } -/** callback for an item-use function written in lua. */ -static int -lua_useitem(struct unit * u, const struct item_type * itype, int amount, struct order * ord) -{ - int retval = 0; - char fname[64]; - snprintf(fname, sizeof(fname), "use_%s", itype->rtype->_name[0]); - - lua_State * L = (lua_State *)global.vm_state; - if (is_function(L, fname)) { - try { - retval = call_function(L, fname, u, amount); - } - catch (error& e) { - lua_State* L = e.state(); - const char* error = lua_tostring(L, -1); - log_error(("An exception occured while %s tried to call '%s': %s.\n", - unitname(u), fname, error)); - lua_pop(L, 1); - std::terminate(); - } - } - return retval; -} - /** callback to initialize a familiar from lua. */ static void lua_initfamiliar(unit * u) @@ -310,6 +285,31 @@ lua_equipmentcallback(const struct equipment * eq, unit * u) } } +/** callback for an item-use function written in lua. */ +int +lua_useitem(struct unit * u, const struct item_type * itype, int amount, struct order * ord) +{ + int retval = 0; + char fname[64]; + snprintf(fname, sizeof(fname), "use_%s", itype->rtype->_name[0]); + + lua_State * L = (lua_State *)global.vm_state; + if (is_function(L, fname)) { + try { + retval = luabind::call_function(L, fname, u, amount); + } + catch (error& e) { + lua_State* L = e.state(); + const char* error = lua_tostring(L, -1); + log_error(("An exception occured while %s tried to call '%s': %s.\n", + unitname(u), fname, error)); + lua_pop(L, 1); + std::terminate(); + } + } + return retval; +} + void bind_script(lua_State * L) { diff --git a/src/eressea/lua/script.h b/src/eressea/lua/script.h index d5344fe43..fbdf68741 100644 --- a/src/eressea/lua/script.h +++ b/src/eressea/lua/script.h @@ -16,5 +16,6 @@ extern int call_script(struct unit * u); extern void setscript(struct attrib ** ap, void * fptr); extern void reset_scripts(); +extern int lua_useitem(struct unit * u, const struct item_type * itype, int amount, struct order * ord); #endif