combining files to improve compilation speed

This commit is contained in:
Enno Rehling 2008-11-12 22:07:23 +00:00
parent d305e983b2
commit f18edc3651
25 changed files with 575 additions and 114 deletions

21
src/combined/bindings.cpp Normal file
View File

@ -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"

6
src/combined/curses.c Normal file
View File

@ -0,0 +1,6 @@
#include "common/settings.h"
#include "common/config.h"
#include "stdafx.h"
#include "eressea/curses/listbox.c"
#include "eressea/gmtool.c"

84
src/combined/gamecode.c Normal file
View File

@ -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"

54
src/combined/kernel.c Normal file
View File

@ -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"

1
src/combined/stdafx.c Normal file
View File

@ -0,0 +1 @@
#include "stdafx.h"

1
src/combined/stdafx.cpp Normal file
View File

@ -0,0 +1 @@
#include "stdafx.hpp"

2
src/combined/stdafx.h Normal file
View File

@ -0,0 +1,2 @@
#include "common/settings.h"
#include "common/config.h"

2
src/combined/stdafx.hpp Normal file
View File

@ -0,0 +1,2 @@
#include "common/settings.h"
#include "common/config.h"

36
src/combined/util.c Normal file
View File

@ -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

View File

@ -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
};

View File

@ -77,8 +77,6 @@ without prior permission by the authors of Eressea.
#include <string.h>
/* 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);
}
}

View File

@ -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;

View File

@ -30,8 +30,8 @@
#include <stdlib.h>
typedef struct gate_data {
struct building * gate;
struct region * target;
struct building * gate;
struct region * target;
} gate_data;
static int

View File

@ -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 {

View File

@ -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);

View File

@ -29,7 +29,7 @@
#include <stdlib.h>
#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';

View File

@ -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! */

View File

@ -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

285
src/eressea.vcproj Normal file
View File

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="eressea"
ProjectGUID="{AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}"
RootNamespace="eressealump"
SccProjectName="Svn"
SccAuxPath="Svn"
SccLocalPath="Svn"
SccProvider="SubversionScc"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;common"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libxml2.lib pdcurses.lib lua5.1_d.lib luabind_d.lib"
OutputFile="$(OutDir)\eressea.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\eressea.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\combined\bindings.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="stdafx.hpp"
PrecompiledHeaderFile="$(IntDir)\$(TargetName)_cpp.pch"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\combined\curses.c"
>
</File>
<File
RelativePath=".\combined\gamecode.c"
>
</File>
<File
RelativePath=".\combined\kernel.c"
>
</File>
<File
RelativePath=".\combined\stdafx.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
PrecompiledHeaderThrough="stdafx.h"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\combined\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
PrecompiledHeaderThrough="stdafx.hpp"
PrecompiledHeaderFile="$(IntDir)\$(TargetName)_cpp.pch"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\combined\util.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="common/util"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\combined\stdafx.h"
>
</File>
<File
RelativePath=".\combined\stdafx.hpp"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -65,7 +65,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libxml2.lib pdcurses.lib lua5.1.lib luabind_d.lib"
AdditionalDependencies="libxml2.lib pdcurses.lib lua5.1_d.lib luabind_d.lib"
OutputFile="$(OutDir)/eressea-lua.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=".."

View File

@ -333,12 +333,11 @@ typedef struct handler_info {
trigger * triggers;
} handler_info;
typedef struct timeout_data {
typedef struct timeout_data_fix {
trigger * triggers;
int timer;
variant trigger_data;
} timeout_data;
} timeout_data_fix;
trigger *
get_timeout(trigger * td, trigger * tfind)
@ -346,7 +345,7 @@ get_timeout(trigger * td, trigger * tfind)
trigger * t = td;
while (t) {
if (t->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 <triggers/gate.h>
#include <triggers/unguard.h>
typedef struct gate_data {
struct building * gate;
struct region * target;
} gate_data;
static int
fix_undead(void)
{

View File

@ -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

View File

@ -2,6 +2,7 @@
#include <kernel/eressea.h>
#include "bindings.h"
#include "script.h"
// kernel includes
#include <kernel/item.h>
@ -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<int>(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)
{

View File

@ -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<int>(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<int>(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)
{

View File

@ -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