some cleaning up with regard to luabind/boost

solution files for vc 2008
This commit is contained in:
Enno Rehling 2008-10-28 10:51:36 +00:00
parent 3ea0d50caf
commit 12574ac5b5
39 changed files with 3425 additions and 1274 deletions

394
src/common/gamecode.vcproj Normal file
View File

@ -0,0 +1,394 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="gamecode"
ProjectGUID="{1E8BFF9E-3044-0742-992F-C5765B80FE65}"
RootNamespace="gamecode"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug/gamecode"
IntermediateDirectory="Debug/gamecode"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;."
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
AdditionalIncludeDirectories="..;."
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/gamecode.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Profile|Win32"
OutputDirectory="Profile/gamecode"
IntermediateDirectory="Profile/gamecode"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;."
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;."
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/gamecode.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release/gamecode"
IntermediateDirectory="Release/gamecode"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories="..;."
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;."
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/gamecode.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="gamecode"
>
<File
RelativePath=".\gamecode\archetype.c"
>
</File>
<File
RelativePath=".\gamecode\archetype.h"
>
</File>
<File
RelativePath=".\gamecode\creation.c"
>
</File>
<File
RelativePath=".\gamecode\creation.h"
>
</File>
<File
RelativePath=".\gamecode\creport.c"
>
</File>
<File
RelativePath=".\gamecode\creport.h"
>
</File>
<File
RelativePath=".\gamecode\economy.c"
>
</File>
<File
RelativePath=".\gamecode\economy.h"
>
</File>
<File
RelativePath=".\gamecode\give.c"
>
</File>
<File
RelativePath=".\gamecode\give.h"
>
</File>
<File
RelativePath=".\gamecode\items.c"
>
</File>
<File
RelativePath=".\gamecode\items.h"
>
</File>
<File
RelativePath=".\gamecode\laws.c"
>
</File>
<File
RelativePath=".\gamecode\laws.h"
>
</File>
<File
RelativePath=".\gamecode\luck.c"
>
</File>
<File
RelativePath=".\gamecode\luck.h"
>
</File>
<File
RelativePath=".\gamecode\monster.c"
>
</File>
<File
RelativePath=".\gamecode\monster.h"
>
</File>
<File
RelativePath=".\gamecode\randenc.c"
>
</File>
<File
RelativePath=".\gamecode\randenc.h"
>
</File>
<File
RelativePath=".\gamecode\report.c"
>
</File>
<File
RelativePath=".\gamecode\report.h"
>
</File>
<File
RelativePath=".\gamecode\spells.c"
>
</File>
<File
RelativePath=".\gamecode\spells.h"
>
</File>
<File
RelativePath=".\gamecode\spy.c"
>
</File>
<File
RelativePath=".\gamecode\spy.h"
>
</File>
<File
RelativePath=".\gamecode\study.c"
>
</File>
<File
RelativePath=".\gamecode\study.h"
>
</File>
<File
RelativePath=".\gamecode\summary.c"
>
</File>
<File
RelativePath=".\gamecode\summary.h"
>
</File>
<File
RelativePath=".\gamecode\xmlreport.c"
>
</File>
<File
RelativePath=".\gamecode\xmlreport.h"
>
</File>
</Filter>
<Filter
Name="races"
>
<File
RelativePath=".\races\dragons.c"
>
</File>
<File
RelativePath=".\races\dragons.h"
>
</File>
<File
RelativePath=".\races\illusion.c"
>
</File>
<File
RelativePath=".\races\illusion.h"
>
</File>
<File
RelativePath=".\races\races.c"
>
</File>
<File
RelativePath=".\races\races.h"
>
</File>
<File
RelativePath=".\races\zombies.c"
>
</File>
<File
RelativePath=".\races\zombies.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

1098
src/common/kernel.vcproj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,115 +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-pbem.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 <config.h>
#include <eressea.h>
#include "victoryconditions.h"
/* kernel includes */
#include <region.h>
#include <faction.h>
/* util includes */
#include <attrib.h>
/* libc includes */
#include <stdlib.h>
#include <string.h>
#if VICTORY_CONDITION == VICTORY_MURDER
static void
print_winners_murder(const int winners)
{
faction *f;
char winner_buf[DISPLAYSIZE+1];
message *msg;
boolean first;
winner_buf[0] = 0;
first = true;
for(f=factions; f; f=f->next) {
if(f->no != 0 && f->victory_delay == VICTORY_DELAY) {
if(first == true) {
/* potential buffer overflow here */
strcat(winner_buf, factionid(f));
first = false;
} else {
/* potential buffer overflow here */
strcat(winner_buf, ", ");
strcat(winner_buf, factionid(f));
}
}
}
msg = msg_message("victory_murder_complete",
"winners n", strdup(winner_buf), winners);
for(f=factions; f; f=f->next) {
add_message(&f->messages, msg);
}
msg_release(msg);
}
static boolean
is_winner_murder(const faction *f)
{
}
static void
check_victory_murder(void)
{
faction *f;
int condfulfilled = 0;
int winners = 0;
for(f=factions; f; f=f->next) {
if(f->no != 0 && is_winner_murder(f)) {
f->victory_delay++;
condfulfilled++;
if(f->victory_delay == VICTORY_DELAY)
winners++;
} else {
f->victory_delay = 0;
}
}
if(winners > 0) {
print_winners_murder();
return true;
} else if(condfulfilled > 0) {
for(f=factions; f; f=f->next) {
if(f->victory_delay > 0) {
faction *f2;
message *msg = msg_message("victory_murder_cfulfilled",
"faction remain", f, VICTORY_DELAY - f->victory_delay);
for(f2=factions; f2; f2=f2->next) {
add_message(&f2->messages, msg);
}
msg_release(msg);
}
}
}
return false;
}
#endif
void
check_victory(void)
{
#if VICTORY_CONDITION == VICTORY_MURDER
check_victory_murder();
#endif
}

View File

@ -1,25 +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-pbem.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_MOD_VICTORY
#define H_MOD_VICTORY
#ifdef __cplusplus
extern "C" {
#endif
extern void check_victory(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -2,13 +2,13 @@
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de> * +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
* | | Enno Rehling <enno@eressea.de> * | | Enno Rehling <enno@eressea.de>
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de> * | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
* | (c) 1998 - 2007 | * | (c) 1998 - 2007 |
* | | This program may not be used, modified or distributed * | | This program may not be used, modified or distributed
* +-------------------+ without prior permission by the authors of Eressea. * +-------------------+ without prior permission by the authors of Eressea.
* *
*/ */
#include "../../config.h" #include <config.h>
#include <kernel/eressea.h> #include <kernel/eressea.h>
#include "races.h" #include "races.h"

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* *
* Eressea PB(E)M host Copyright (C) 1998-2003 * Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -19,6 +19,8 @@ extern "C" {
#endif #endif
struct castorder; struct castorder;
struct region;
struct unit;
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Name: Alp /* Name: Alp
* Stufe: 15 * Stufe: 15
@ -44,8 +46,8 @@ extern void register_alp(void);
struct unit* alp_target(struct unit *alp); struct unit* alp_target(struct unit *alp);
void alp_findet_opfer(struct unit *alp, struct region *r); void alp_findet_opfer(struct unit *alp, struct region *r);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* *
* Eressea PB(E)M host Copyright (C) 1998-2003 * Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -18,6 +18,10 @@
extern "C" { extern "C" {
#endif #endif
struct ship;
struct curse;
struct unit;
extern void register_spells(void); extern void register_spells(void);
extern struct curse * shipcurse_flyingship(struct ship* sh, struct unit * mage, double power, int duration); extern struct curse * shipcurse_flyingship(struct ship* sh, struct unit * mage, double power, int duration);

470
src/common/util.vcproj Normal file
View File

@ -0,0 +1,470 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="util"
ProjectGUID="{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}"
RootNamespace="util"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug/util"
IntermediateDirectory="Debug/util"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;."
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
AdditionalIncludeDirectories="..;."
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/util.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Profile|Win32"
OutputDirectory="Profile/util"
IntermediateDirectory="Profile/util"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;."
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;."
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/util.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release/util"
IntermediateDirectory="Release/util"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories="..;."
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;."
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/util.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="util"
>
<File
RelativePath=".\util\attrib.c"
>
</File>
<File
RelativePath=".\util\attrib.h"
>
</File>
<File
RelativePath=".\util\base36.c"
>
</File>
<File
RelativePath=".\util\base36.h"
>
</File>
<File
RelativePath=".\util\bsdstring.c"
>
</File>
<File
RelativePath=".\util\bsdstring.h"
>
</File>
<File
RelativePath=".\util\crmessage.c"
>
</File>
<File
RelativePath=".\util\crmessage.h"
>
</File>
<File
RelativePath=".\util\cvector.c"
>
</File>
<File
RelativePath=".\util\cvector.h"
>
</File>
<File
RelativePath=".\util\dice.c"
>
</File>
<File
RelativePath=".\util\event.c"
>
</File>
<File
RelativePath=".\util\event.h"
>
</File>
<File
RelativePath=".\util\filereader.c"
>
</File>
<File
RelativePath=".\util\filereader.h"
>
</File>
<File
RelativePath=".\util\functions.c"
>
</File>
<File
RelativePath=".\util\functions.h"
>
</File>
<File
RelativePath=".\util\goodies.c"
>
</File>
<File
RelativePath=".\util\goodies.h"
>
</File>
<File
RelativePath=".\util\language.c"
>
</File>
<File
RelativePath=".\util\language.h"
>
</File>
<File
RelativePath=".\util\language_struct.h"
>
</File>
<File
RelativePath=".\util\lists.c"
>
</File>
<File
RelativePath=".\util\lists.h"
>
</File>
<File
RelativePath=".\util\log.c"
>
</File>
<File
RelativePath=".\util\log.h"
>
</File>
<File
RelativePath=".\util\message.c"
>
</File>
<File
RelativePath=".\util\message.h"
>
</File>
<File
RelativePath=".\util\mt19937ar.c"
>
</File>
<File
RelativePath=".\util\nrmessage.c"
>
</File>
<File
RelativePath=".\util\nrmessage.h"
>
</File>
<File
RelativePath=".\util\nrmessage_struct.h"
>
</File>
<File
RelativePath=".\util\parser.c"
>
</File>
<File
RelativePath=".\util\parser.h"
>
</File>
<File
RelativePath=".\util\patricia.c"
>
</File>
<File
RelativePath=".\util\patricia.h"
>
</File>
<File
RelativePath=".\util\rand.c"
>
</File>
<File
RelativePath=".\util\rand.h"
>
</File>
<File
RelativePath=".\util\resolve.c"
>
</File>
<File
RelativePath=".\util\resolve.h"
>
</File>
<File
RelativePath=".\util\rng.h"
>
</File>
<File
RelativePath=".\util\sql.c"
>
</File>
<File
RelativePath=".\util\sql.h"
>
</File>
<File
RelativePath=".\util\storage.h"
>
</File>
<File
RelativePath=".\util\strings.c"
>
</File>
<File
RelativePath=".\util\translation.c"
>
</File>
<File
RelativePath=".\util\translation.h"
>
</File>
<File
RelativePath=".\util\umlaut.c"
>
</File>
<File
RelativePath=".\util\umlaut.h"
>
</File>
<File
RelativePath=".\util\unicode.c"
>
</File>
<File
RelativePath=".\util\unicode.h"
>
</File>
<File
RelativePath=".\util\variant.h"
>
</File>
<File
RelativePath=".\util\xml.c"
>
</File>
<File
RelativePath=".\util\xml.h"
>
</File>
</Filter>
<Filter
Name="iniparser"
>
<File
RelativePath=".\iniparser\iniparser.c"
>
</File>
<File
RelativePath=".\iniparser\iniparser.h"
>
</File>
</Filter>
<File
RelativePath=".\config.h"
>
</File>
<File
RelativePath=".\util\dl\malloc.h"
>
</File>
<File
RelativePath=".\settings.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -6,7 +6,7 @@
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de> | | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de> +-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed This program may not be used, modified or distributed
without prior permission by the authors of Eressea. without prior permission by the authors of Eressea.
*/ */
#include <config.h> #include <config.h>
@ -15,6 +15,8 @@
/* util includes */ /* util includes */
#include "log.h" #include "log.h"
#include <libxml/xmlstring.h>
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>

79
src/eressea.sln Normal file
View File

@ -0,0 +1,79 @@
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
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kernel", "common/kernel.vcproj", "{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gamecode", "common/gamecode.vcproj", "{1E8BFF9E-3044-0742-992F-C5765B80FE65}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bindings", "eressea/lua/bindings.vcproj", "{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "editor", "eressea/editor.vcproj", "{D893D6B3-805D-9848-8EA4-CDA1B79151F6}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
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}
{1E8BFF9E-3044-0742-992F-C5765B80FE65} = {1E8BFF9E-3044-0742-992F-C5765B80FE65}
{74B1CBD4-3B6E-E544-9475-33FBB0BCE165} = {74B1CBD4-3B6E-E544-9475-33FBB0BCE165}
{D893D6B3-805D-9848-8EA4-CDA1B79151F6} = {D893D6B3-805D-9848-8EA4-CDA1B79151F6}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Profile|Win32 = Profile|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Debug|Win32.ActiveCfg = Debug|Win32
{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Debug|Win32.Build.0 = Debug|Win32
{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Profile|Win32.ActiveCfg = Profile|Win32
{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Profile|Win32.Build.0 = Profile|Win32
{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Release|Win32.ActiveCfg = Release|Win32
{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Release|Win32.Build.0 = Release|Win32
{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Debug|Win32.ActiveCfg = Debug|Win32
{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Debug|Win32.Build.0 = Debug|Win32
{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Profile|Win32.ActiveCfg = Profile|Win32
{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Profile|Win32.Build.0 = Profile|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}.Debug|Win32.Build.0 = Debug|Win32
{1E8BFF9E-3044-0742-992F-C5765B80FE65}.Profile|Win32.ActiveCfg = Profile|Win32
{1E8BFF9E-3044-0742-992F-C5765B80FE65}.Profile|Win32.Build.0 = Profile|Win32
{1E8BFF9E-3044-0742-992F-C5765B80FE65}.Release|Win32.ActiveCfg = Release|Win32
{1E8BFF9E-3044-0742-992F-C5765B80FE65}.Release|Win32.Build.0 = Release|Win32
{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}.Debug|Win32.ActiveCfg = Debug|Win32
{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}.Debug|Win32.Build.0 = Debug|Win32
{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}.Profile|Win32.ActiveCfg = Profile|Win32
{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}.Profile|Win32.Build.0 = Profile|Win32
{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}.Release|Win32.ActiveCfg = Release|Win32
{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}.Release|Win32.Build.0 = Release|Win32
{D893D6B3-805D-9848-8EA4-CDA1B79151F6}.Debug|Win32.ActiveCfg = Debug|Win32
{D893D6B3-805D-9848-8EA4-CDA1B79151F6}.Debug|Win32.Build.0 = Debug|Win32
{D893D6B3-805D-9848-8EA4-CDA1B79151F6}.Profile|Win32.ActiveCfg = Profile|Win32
{D893D6B3-805D-9848-8EA4-CDA1B79151F6}.Profile|Win32.Build.0 = Profile|Win32
{D893D6B3-805D-9848-8EA4-CDA1B79151F6}.Release|Win32.ActiveCfg = Release|Win32
{D893D6B3-805D-9848-8EA4-CDA1B79151F6}.Release|Win32.Build.0 = Release|Win32
{75501170-51C2-E641-BA8B-EDC008184192}.Debug|Win32.ActiveCfg = Debug|Win32
{75501170-51C2-E641-BA8B-EDC008184192}.Debug|Win32.Build.0 = Debug|Win32
{75501170-51C2-E641-BA8B-EDC008184192}.Profile|Win32.ActiveCfg = Profile|Win32
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,56 +0,0 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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-pbem.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 <config.h>
#include <eressea.h>
#include <attributes/attributes.h>
/* attributes includes */
#include <attributes/key.h>
#include <attributes/gm.h>
#include <attributes/orcification.h>
#include <attributes/targetregion.h>
#include <attributes/reduceproduction.h>
#include <attributes/follow.h>
#include <attributes/iceberg.h>
#include <attributes/hate.h>
#include <attributes/overrideroads.h>
#include <attributes/racename.h>
#include <attributes/otherfaction.h>
#include <attributes/moved.h>
#ifdef AT_OPTION
# include <attributes/option.h>
#endif
/* util includes */
#include <attrib.h>
void
init_attributes(void)
{
at_register(&at_overrideroads);
init_iceberg();
init_key();
init_gm();
init_follow();
init_targetregion();
init_orcification();
init_hate();
init_reduceproduction();
init_racename();
init_otherfaction();
init_moved();
#ifdef AT_OPTION
init_option();
#endif
}

View File

@ -1,15 +0,0 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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-pbem.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.
*/
extern void init_attributes(void);

View File

@ -1,7 +1,9 @@
#include "console.h" #include "console.h"
/* lua includes */ /* lua includes */
#include <lua.hpp> #include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
@ -20,8 +22,8 @@
#define MAXINPUT 512 #define MAXINPUT 512
#endif #endif
static int static int
stdin_readline(lua_State *l, const char *prompt) stdin_readline(lua_State *l, const char *prompt)
{ {
static char buffer[MAXINPUT]; static char buffer[MAXINPUT];
if (prompt) { if (prompt) {
@ -57,7 +59,7 @@ set_readline(readline foo)
#endif #endif
static const char * static const char *
get_prompt(lua_State * L, int firstline) get_prompt(lua_State * L, int firstline)
{ {
const char *p = NULL; const char *p = NULL;
lua_pushstring(L, firstline ? "_PROMPT" : "_PROMPT2"); lua_pushstring(L, firstline ? "_PROMPT" : "_PROMPT2");
@ -68,8 +70,8 @@ get_prompt(lua_State * L, int firstline)
return p; return p;
} }
static int static int
incomplete(lua_State * L, int status) incomplete(lua_State * L, int status)
{ {
if (status!=LUA_ERRSYNTAX) return 0; if (status!=LUA_ERRSYNTAX) return 0;
if (strstr(lua_tostring(L, -1), "near `<eof>'") == NULL) return 0; if (strstr(lua_tostring(L, -1), "near `<eof>'") == NULL) return 0;
@ -78,15 +80,15 @@ incomplete(lua_State * L, int status)
return 1; return 1;
} }
static void static void
l_message(const char *pname, const char *msg) l_message(const char *pname, const char *msg)
{ {
if (pname) fprintf(stderr, "%s: ", pname); if (pname) fprintf(stderr, "%s: ", pname);
fprintf(stderr, "%s\n", msg); fprintf(stderr, "%s\n", msg);
} }
static int static int
l_report(lua_State * L, int status) l_report(lua_State * L, int status)
{ {
const char *msg; const char *msg;
if (status) { if (status) {
@ -106,8 +108,8 @@ l_report(lua_State * L, int status)
#define lua_saveline(L,line) /* empty */ #define lua_saveline(L,line) /* empty */
#endif #endif
static int static int
load_string(lua_State * L) load_string(lua_State * L)
{ {
int status; int status;
lua_settop(L, 0); lua_settop(L, 0);
@ -129,8 +131,8 @@ load_string(lua_State * L)
return status; return status;
} }
static void static void
lstop(lua_State *l, lua_Debug *ar) lstop(lua_State *l, lua_Debug *ar)
{ {
(void)ar; /* unused arg. */ (void)ar; /* unused arg. */
lua_sethook(l, NULL, 0, 0); lua_sethook(l, NULL, 0, 0);
@ -143,8 +145,8 @@ static lua_State * state_stack[STATESTACK_MAX];
int state_stack_top = -1; int state_stack_top = -1;
static void static void
laction(int i) laction(int i)
{ {
signal(i, SIG_DFL); /* if another SIGINT happens before lstop, signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
terminate process (default action) */ terminate process (default action) */
@ -152,8 +154,8 @@ laction(int i)
lua_sethook(state_stack[state_stack_top], lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); lua_sethook(state_stack[state_stack_top], lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
} }
static int static int
lcall(lua_State * L, int narg, int clear) lcall(lua_State * L, int narg, int clear)
{ {
int status, pop_state = state_stack_top; int status, pop_state = state_stack_top;
int base = lua_gettop(L) - narg; /* function index */ int base = lua_gettop(L) - narg; /* function index */
@ -162,7 +164,7 @@ lcall(lua_State * L, int narg, int clear)
lua_insert(L, base); /* put it under chunk and args */ lua_insert(L, base); /* put it under chunk and args */
if (state_stack_top<0 || L != state_stack[state_stack_top]) { if (state_stack_top<0 || L != state_stack[state_stack_top]) {
assert(state_stack_top+1<STATESTACK_MAX); assert(state_stack_top+1<STATESTACK_MAX);
state_stack[++state_stack_top] = L; state_stack[++state_stack_top] = L;
} }
signal(SIGINT, laction); signal(SIGINT, laction);
status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);

View File

@ -10,11 +10,12 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <lua.hpp>
extern int lua_console(lua_State * L); struct lua_State;
extern int lua_do(lua_State * L);
extern int lua_console(struct lua_State * L);
extern int lua_do(struct lua_State * L);
typedef int (*readline)(struct lua_State *, const char *); typedef int (*readline)(struct lua_State *, const char *);
extern void set_readline(readline foo); extern void set_readline(readline foo);

262
src/eressea/editor.vcproj Normal file
View File

@ -0,0 +1,262 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="editor"
ProjectGUID="{D893D6B3-805D-9848-8EA4-CDA1B79151F6}"
RootNamespace="editor"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug/editor"
IntermediateDirectory="Debug/editor"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
AdditionalIncludeDirectories="..;../common"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/editor.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Profile|Win32"
OutputDirectory="Profile/editor"
IntermediateDirectory="Profile/editor"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;../common"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/editor.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release/editor"
IntermediateDirectory="Release/editor"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories="..;../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;../common"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/editor.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="curses"
>
<File
RelativePath=".\curses\listbox.c"
>
</File>
<File
RelativePath=".\curses\listbox.h"
>
</File>
</Filter>
<Filter
Name="lua"
>
<File
RelativePath=".\lua\gm.cpp"
>
</File>
</Filter>
<File
RelativePath=".\editing.c"
>
</File>
<File
RelativePath=".\editing.h"
>
</File>
<File
RelativePath=".\gmtool.c"
>
</File>
<File
RelativePath=".\gmtool.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,306 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="eressea-lua"
ProjectGUID="{75501170-51C2-E641-BA8B-EDC008184192}"
RootNamespace="eressea-lua"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
AdditionalIncludeDirectories="..;../common"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libxml2.lib pdcurses.lib lua5.1.lib luabind_d.lib"
OutputFile="$(OutDir)/eressea-lua.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=".."
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/eressea-lua.pdb"
SubSystem="1"
EntryPointSymbol="mainCRTStartup"
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="Profile|Win32"
OutputDirectory="Profile"
IntermediateDirectory="Profile"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;../common"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../common/Profile/util/util.lib ../common/Profile/kernel/kernel.lib ../common/Profile/gamecode/gamecode.lib lua/Profile/bindings/bindings.lib Profile/editor/editor.lib libxml2.lib pdcurses.lib lua5.1.lib luabind.lib"
OutputFile="$(OutDir)/eressea-lua.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=".."
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/eressea-lua.pdb"
SubSystem="1"
EntryPointSymbol="mainCRTStartup"
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="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories="..;../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;../common"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../common/Release/util/util.lib ../common/Release/kernel/kernel.lib ../common/Release/gamecode/gamecode.lib lua/Release/bindings/bindings.lib Release/editor/editor.lib libxml2.lib pdcurses.lib lua5.1.lib luabind.lib"
OutputFile="$(OutDir)/eressea-lua.exe"
LinkIncremental="1"
AdditionalLibraryDirectories=".."
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
EntryPointSymbol="mainCRTStartup"
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>
<File
RelativePath=".\console.c"
>
</File>
<File
RelativePath=".\console.h"
>
</File>
<File
RelativePath="..\scripts\default.lua"
>
</File>
<File
RelativePath="..\scripts\eressea.lua"
>
</File>
<File
RelativePath=".\korrektur.c"
>
</File>
<File
RelativePath="..\scripts\run-tests.lua"
>
</File>
<File
RelativePath=".\server.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,89 +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 - 2006 |
* | | This program may not be used, modified or distributed
* +-------------------+ without prior permission by the authors of Eressea.
*
*/
/* wenn config.h nicht vor curses included wird, kompiliert es unter windows nicht */
#include <config.h>
#include <eressea.h>
#include "console.h"
#include "gmtool.h"
/* lua includes */
#include "lua/bindings.h"
#include <boost/version.hpp>
#pragma warning (push)
#pragma warning (disable: 4127)
#include <lua.hpp>
#include <luabind/luabind.hpp>
#pragma warning (pop)
static const struct {
const char * name;
int (*func)(lua_State *);
} lualibs[] = {
{"", luaopen_base},
{LUA_TABLIBNAME, luaopen_table},
{LUA_IOLIBNAME, luaopen_io},
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
{ NULL, NULL }
};
static void
openlibs(lua_State * L)
{
int i;
for (i=0;lualibs[i].func;++i) {
lua_pushcfunction(L, lualibs[i].func);
lua_pushstring(L, lualibs[i].name);
lua_call(L, 1, 0);
}
}
static lua_State *
lua_init(void)
{
lua_State * L = lua_open();
openlibs(L);
luabind::open(L);
bind_objects(L);
bind_eressea(L);
bind_spell(L);
bind_alliance(L);
bind_region(L);
bind_item(L);
bind_faction(L);
bind_unit(L);
bind_ship(L);
bind_building(L);
bind_gmtool(L);
lua_readline = curses_readline;
return L;
}
static void
lua_done(lua_State * L)
{
lua_close(L);
}
int
main(int argc, char *argv[])
{
lua_State* luaState = lua_init();
global.vm_state = luaState;
int result = gmmain(argc, argv);
lua_done(luaState);
return result;
}

View File

@ -2,10 +2,10 @@
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de> * +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
* | | Enno Rehling <enno@eressea.de> * | | Enno Rehling <enno@eressea.de>
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de> * | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
* | (c) 1998 - 2006 | * | (c) 1998 - 2006 |
* | | This program may not be used, modified or distributed * | | This program may not be used, modified or distributed
* +-------------------+ without prior permission by the authors of Eressea. * +-------------------+ without prior permission by the authors of Eressea.
* *
*/ */
/* wenn config.h nicht vor curses included wird, kompiliert es unter windows nicht */ /* wenn config.h nicht vor curses included wird, kompiliert es unter windows nicht */
@ -60,6 +60,8 @@
#include <libxml/encoding.h> #include <libxml/encoding.h>
#include <lua.h>
#include <string.h> #include <string.h>
#include <locale.h> #include <locale.h>
@ -101,12 +103,12 @@ init_curses(void)
short bcol = COLOR_BLACK; short bcol = COLOR_BLACK;
short hcol = COLOR_MAGENTA; short hcol = COLOR_MAGENTA;
start_color(); start_color();
#ifdef WIN32 #ifdef WIN32
/* looks crap on putty with TERM=linux */ /* looks crap on putty with TERM=linux */
if (can_change_color()) { if (can_change_color()) {
init_color(COLOR_YELLOW, 1000, 1000, 0); init_color(COLOR_YELLOW, 1000, 1000, 0);
} }
#endif #endif
for (fg=0;fg!=8;++fg) { for (fg=0;fg!=8;++fg) {
for (bg=0;bg!=2;++bg) { for (bg=0;bg!=2;++bg) {
@ -213,13 +215,13 @@ mr_tile(const map_region * mr, int highlight)
if (mr!=NULL && mr->r!=NULL) { if (mr!=NULL && mr->r!=NULL) {
const region * r = mr->r; const region * r = mr->r;
switch (r->terrain->_name[0]) { switch (r->terrain->_name[0]) {
case 'o' : case 'o' :
return '.' | COLOR_PAIR(hl + COLOR_CYAN); return '.' | COLOR_PAIR(hl + COLOR_CYAN);
case 'd' : case 'd' :
return 'D' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD; return 'D' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD;
case 't' : case 't' :
return '%' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD; return '%' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD;
case 'f' : case 'f' :
if (r->terrain->_name[1]=='o') { /* fog */ if (r->terrain->_name[1]=='o') { /* fog */
return '.' | COLOR_PAIR(hl + COLOR_YELLOW) | A_NORMAL; return '.' | COLOR_PAIR(hl + COLOR_YELLOW) | A_NORMAL;
} else if (r->terrain->_name[1]=='i') { /* firewall */ } else if (r->terrain->_name[1]=='i') { /* firewall */
@ -229,7 +231,7 @@ mr_tile(const map_region * mr, int highlight)
return 'H' | COLOR_PAIR(hl + COLOR_YELLOW) | A_NORMAL; return 'H' | COLOR_PAIR(hl + COLOR_YELLOW) | A_NORMAL;
case 'm' : case 'm' :
return '^' | COLOR_PAIR(hl + COLOR_WHITE) | A_NORMAL; return '^' | COLOR_PAIR(hl + COLOR_WHITE) | A_NORMAL;
case 'p' : case 'p' :
if (r_isforest(r)) return '#' | COLOR_PAIR(hl + COLOR_GREEN) | A_NORMAL; if (r_isforest(r)) return '#' | COLOR_PAIR(hl + COLOR_GREEN) | A_NORMAL;
return '+' | COLOR_PAIR(hl + COLOR_GREEN) | A_BOLD; return '+' | COLOR_PAIR(hl + COLOR_GREEN) | A_BOLD;
case 'g' : case 'g' :
@ -514,7 +516,7 @@ select_terrain(state * st, const terrain_type * default_terrain)
st->wnd_info->update |= 1; st->wnd_info->update |= 1;
st->wnd_map->update |= 1; st->wnd_map->update |= 1;
st->wnd_status->update |= 1; st->wnd_status->update |= 1;
if (selected==NULL) return NULL; if (selected==NULL) return NULL;
return (const terrain_type*)selected->data; return (const terrain_type*)selected->data;
} }
@ -610,7 +612,7 @@ select_regions(state * st, int selectmode)
} }
} }
} }
} }
else if (findmode=='p') { else if (findmode=='p') {
region * r; region * r;
sprintf(sbuffer, "%splayers", status); sprintf(sbuffer, "%splayers", status);
@ -628,7 +630,7 @@ select_regions(state * st, int selectmode)
} }
} }
} }
} }
else if (findmode=='u') { else if (findmode=='u') {
region * r; region * r;
sprintf(sbuffer, "%sunits", status); sprintf(sbuffer, "%sunits", status);
@ -642,7 +644,7 @@ select_regions(state * st, int selectmode)
} }
} }
} }
} }
else if (findmode=='s') { else if (findmode=='s') {
region * r; region * r;
sprintf(sbuffer, "%sships", status); sprintf(sbuffer, "%sships", status);
@ -656,17 +658,17 @@ select_regions(state * st, int selectmode)
} }
} }
} }
} }
else if (findmode=='f') { else if (findmode=='f') {
char fbuffer[12]; char fbuffer[12];
sprintf(sbuffer, "%sfaction:", status); sprintf(sbuffer, "%sfaction:", status);
askstring(st->wnd_status->handle, sbuffer, fbuffer, 12); askstring(st->wnd_status->handle, sbuffer, fbuffer, 12);
if (fbuffer[0]) { if (fbuffer[0]) {
faction * f = findfaction(atoi36(fbuffer)); faction * f = findfaction(atoi36(fbuffer));
if (f!=NULL) { if (f!=NULL) {
unit * u; unit * u;
sprintf(sbuffer, "%sfaction: %s", status, itoa36(f->no)); sprintf(sbuffer, "%sfaction: %s", status, itoa36(f->no));
statusline(st->wnd_status->handle, sbuffer); statusline(st->wnd_status->handle, sbuffer);
for (u=f->units;u;u=u->nextF) { for (u=f->units;u;u=u->nextF) {
@ -892,7 +894,7 @@ handlekey(state * st, int c)
if (global.vm_state) { if (global.vm_state) {
move(0, 0); move(0, 0);
refresh(); refresh();
lua_do((lua_State*)global.vm_state); lua_do((struct lua_State*)global.vm_state);
/* todo: do this from inside the script */ /* todo: do this from inside the script */
clear(); clear();
st->wnd_info->update |= 1; st->wnd_info->update |= 1;
@ -1066,7 +1068,7 @@ update_view(view * vi)
} }
} }
void void
run_mapper(void) run_mapper(void)
{ {
WINDOW * hwinstatus; WINDOW * hwinstatus;
@ -1179,7 +1181,7 @@ run_mapper(void)
#define MAXINPUT 512 #define MAXINPUT 512
int int
curses_readline(lua_State * L, const char * prompt) curses_readline(struct lua_State * L, const char * prompt)
{ {
static char buffer[MAXINPUT]; static char buffer[MAXINPUT];
askstring(hstatus, prompt, buffer, MAXINPUT); askstring(hstatus, prompt, buffer, MAXINPUT);

314
src/eressea/gmtool.vcproj Normal file
View File

@ -0,0 +1,314 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="gmtool"
ProjectGUID="{995E25C1-21EE-9348-934A-E74F55C72325}"
RootNamespace="gmtool"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;../common;../common/kernel"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
AdditionalIncludeDirectories="..;../common;../common/kernel"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../common/Debug/util/util.lib ../common/Debug/kernel/kernel.lib lua/Debug/bindings/bindings.lib libxml2.lib curses.lib lua5.1_d.lib luabind_d.lib"
OutputFile="$(OutDir)/gmtool.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=".."
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/gmtool.pdb"
SubSystem="1"
EntryPointSymbol="mainCRTStartup"
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="Profile|Win32"
OutputDirectory="Profile"
IntermediateDirectory="Profile"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;../common;../common/kernel"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;../common;../common/kernel"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../common/Profile/util/util.lib ../common/Profile/kernel/kernel.lib lua/Profile/bindings/bindings.lib libxml2.lib curses.lib lua5.1.lib luabind.lib"
OutputFile="$(OutDir)/gmtool.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=".."
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/gmtool.pdb"
SubSystem="1"
EntryPointSymbol="mainCRTStartup"
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="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories="..;../common;../common/kernel"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="..;../common;../common/kernel"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="../common/Release/util/util.lib ../common/Release/kernel/kernel.lib lua/Release/bindings/bindings.lib libxml2.lib curses.lib lua5.1.lib luabind.lib"
OutputFile="$(OutDir)/gmtool.exe"
LinkIncremental="1"
AdditionalLibraryDirectories=".."
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
EntryPointSymbol="mainCRTStartup"
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="curses"
Filter=""
>
<File
RelativePath=".\curses\listbox.h">
</File>
<File
RelativePath=".\curses\listbox.c">
</File>
</Filter>
<Filter
Name="lua"
Filter=""
>
<File
RelativePath=".\lua\gm.cpp">
</File>
</Filter>
<File
RelativePath=".\gmtool.h">
</File>
<File
RelativePath=".\gmtool.c">
</File>
<File
RelativePath=".\editing.c">
</File>
<File
RelativePath=".\editing.h">
</File>
<File
RelativePath=".\gmmain.cpp">
</File>
<File
RelativePath=".\console.c">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,28 +0,0 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | 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.
*/
#include <config.h>
#include <eressea.h>
#include <items/lmsreward.h>
#include <items/demonseye.h>
#include <items/weapons.h>
#include <items/xerewards.h>
void
register_items(void)
{
register_weapons();
register_demonseye();
init_lmsreward();
register_xerewards();
}

11
src/eressea/lua.hpp Normal file
View File

@ -0,0 +1,11 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,310 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="bindings"
ProjectGUID="{74B1CBD4-3B6E-E544-9475-33FBB0BCE165}"
RootNamespace="bindings"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug/bindings"
IntermediateDirectory="Debug/bindings"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../..;../../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
AdditionalIncludeDirectories="../..;../../common"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/bindings.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Profile|Win32"
OutputDirectory="Profile/bindings"
IntermediateDirectory="Profile/bindings"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../..;../../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="../..;../../common"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/bindings.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release/bindings"
IntermediateDirectory="Release/bindings"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories="../..;../../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
AdditionalIncludeDirectories="../..;../../common"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/bindings.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\alliance.cpp"
>
</File>
<File
RelativePath=".\bindings.h"
>
</File>
<File
RelativePath=".\building.cpp"
>
</File>
<File
RelativePath=".\eressea.cpp"
>
</File>
<File
RelativePath=".\event.cpp"
>
</File>
<File
RelativePath=".\event.h"
>
</File>
<File
RelativePath=".\export.h"
>
</File>
<File
RelativePath=".\faction.cpp"
>
</File>
<File
RelativePath=".\gamecode.cpp"
>
</File>
<File
RelativePath=".\item.cpp"
>
</File>
<File
RelativePath=".\list.h"
>
</File>
<File
RelativePath=".\message.cpp"
>
</File>
<File
RelativePath=".\objects.cpp"
>
</File>
<File
RelativePath=".\objects.h"
>
</File>
<File
RelativePath=".\region.cpp"
>
</File>
<File
RelativePath=".\script.cpp"
>
</File>
<File
RelativePath=".\script.h"
>
</File>
<File
RelativePath=".\ship.cpp"
>
</File>
<File
RelativePath=".\spell.cpp"
>
</File>
<File
RelativePath=".\test.cpp"
>
</File>
<File
RelativePath=".\unit.cpp"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -17,9 +17,7 @@
#include <lua.hpp> #include <lua.hpp>
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#include <luabind/iterator_policy.hpp> #include <luabind/iterator_policy.hpp>
#if LUABIND_BETA >= 7 #include <luabind/operator.hpp>
# include <luabind/operator.hpp>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (pop) #pragma warning (pop)
#endif #endif
@ -136,7 +134,7 @@ building_setregion(building * bld, region * r)
b->region = r; b->region = r;
} }
static std::ostream& static std::ostream&
operator<<(std::ostream& stream, const building& b) operator<<(std::ostream& stream, const building& b)
{ {
stream << b.name; stream << b.name;
@ -146,7 +144,7 @@ operator<<(std::ostream& stream, const building& b)
return stream; return stream;
} }
static bool static bool
operator==(const building& a, const building&b) operator==(const building& a, const building&b)
{ {
return a.no==b.no; return a.no==b.no;
@ -154,7 +152,7 @@ operator==(const building& a, const building&b)
class buildingunit { class buildingunit {
public: public:
static unit * next(unit * node) { static unit * next(unit * node) {
building * b = node->building; building * b = node->building;
do { do {
node = node->next; node = node->next;
@ -179,7 +177,7 @@ building_gettype(const building& b) {
} }
void void
bind_building(lua_State * L) bind_building(lua_State * L)
{ {
at_building_action.age = lc_age; at_building_action.age = lc_age;
module(L)[ module(L)[

View File

@ -210,7 +210,6 @@ lua_learnskill(unit * u, const char * skname, float chances)
bool bool
is_function(struct lua_State * luaState, const char * fname) is_function(struct lua_State * luaState, const char * fname)
{ {
#if LUABIND_BETA>7 || (LUABIND_BETA==7 && LUABIND_DEVEL>=2)
object g = globals(luaState); object g = globals(luaState);
object fun = g[fname]; object fun = g[fname];
if (fun.is_valid()) { if (fun.is_valid()) {
@ -221,18 +220,6 @@ is_function(struct lua_State * luaState, const char * fname)
log_warning(("Lua global object %s is not a function, type is %u\n", fname, type(fun))); log_warning(("Lua global object %s is not a function, type is %u\n", fname, type(fun)));
} }
} }
#else
object g = get_globals(luaState);
object fun = g[fname];
if (fun.is_valid()) {
if (fun.type()==LUA_TFUNCTION) {
return true;
}
if (fun.type()!=LUA_TNIL) {
log_warning(("Lua global object %s is not a function, type is %u\n", fname, fun.type()));
}
}
#endif
return false; return false;
} }

View File

@ -30,9 +30,7 @@
#include <luabind/iterator_policy.hpp> #include <luabind/iterator_policy.hpp>
#include <luabind/out_value_policy.hpp> #include <luabind/out_value_policy.hpp>
#include <luabind/copy_policy.hpp> #include <luabind/copy_policy.hpp>
#if LUABIND_BETA >= 7 #include <luabind/operator.hpp>
# include <luabind/operator.hpp>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (pop) #pragma warning (pop)
#endif #endif
@ -94,14 +92,14 @@ faction_setlocale(faction * f, const char * name)
f->locale = find_locale(name); f->locale = find_locale(name);
} }
static std::ostream& static std::ostream&
operator<<(std::ostream& stream, const faction& f) operator<<(std::ostream& stream, const faction& f)
{ {
stream << factionname(&f); stream << factionname(&f);
return stream; return stream;
} }
static bool static bool
operator==(const faction& a, const faction&b) operator==(const faction& a, const faction&b)
{ {
return a.no==b.no; return a.no==b.no;
@ -287,7 +285,7 @@ faction_maxheroes(const faction * f)
} }
void void
bind_faction(lua_State * L) bind_faction(lua_State * L)
{ {
module(L)[ module(L)[
def("factions", &get_factions, return_stl_iterator), def("factions", &get_factions, return_stl_iterator),

View File

@ -19,9 +19,7 @@
#include <lua.hpp> #include <lua.hpp>
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#include <luabind/iterator_policy.hpp> #include <luabind/iterator_policy.hpp>
#if LUABIND_BETA >= 7 #include <luabind/operator.hpp>
# include <luabind/operator.hpp>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (pop) #pragma warning (pop)
#endif #endif
@ -171,7 +169,7 @@ protected:
variant * args; variant * args;
}; };
static std::ostream& static std::ostream&
operator<<(std::ostream& stream, const lua_message& msg) operator<<(std::ostream& stream, const lua_message& msg)
{ {
stream << "(message object)"; stream << "(message object)";
@ -180,12 +178,12 @@ operator<<(std::ostream& stream, const lua_message& msg)
void void
bind_message(lua_State * L) bind_message(lua_State * L)
{ {
module(L)[ module(L)[
class_<lua_message>("message") class_<lua_message>("message")
.def(constructor<const char *>()) .def(constructor<const char *>())
.def(tostring(self)) .def(tostring(const_self))
.def("set_unit", &lua_message::set_unit) .def("set_unit", &lua_message::set_unit)
.def("set_region", &lua_message::set_region) .def("set_region", &lua_message::set_region)

View File

@ -27,101 +27,91 @@ using namespace luabind;
namespace eressea { namespace eressea {
object object objects::get(const char * name) {
objects::get(const char * name) { lua_State * L = (lua_State *) global.vm_state;
lua_State * L = (lua_State *)global.vm_state; attrib * a = a_find(*mAttribPtr, &at_object);
attrib * a = a_find(*mAttribPtr, &at_object); for (; a && a->type == &at_object; a = a->next) {
for (;a && a->type==&at_object;a=a->next) { if (strcmp(object_name(a), name) == 0) {
if (strcmp(object_name(a), name)==0) { variant val;
variant val; object_type type;
object_type type;
object_get(a, &type, &val); object_get(a, &type, &val);
switch (type) { switch (type) {
case TNONE: case TNONE:
break; break;
case TINTEGER: case TINTEGER:
return object(L, val.i); return object(L, val.i);
case TREAL: case TREAL:
return object(L, val.f); return object(L, val.f);
case TREGION: case TREGION:
return object(L, (region*)val.v); return object(L, (region*) val.v);
case TBUILDING: case TBUILDING:
return object(L, (building*)val.v); return object(L, (building*) val.v);
case TUNIT: case TUNIT:
return object(L, (unit*)val.v); return object(L, (unit*) val.v);
case TSHIP: case TSHIP:
return object(L, (ship*)val.v); return object(L, (ship*) val.v);
case TSTRING: case TSTRING:
return object(L, std::string((const char*)val.v)); return object(L, std::string((const char*) val.v));
default: default:
assert(!"not implemented"); assert(!"not implemented");
} }
} }
} }
#if LUABIND_BETA<7 || (LUABIND_BETA==7 && LUABIND_DEVEL<2) return object(); // nil
return object(L); // nil
#else
return object(); // nil
#endif
}
static void set_object(attrib **attribs, const char * name, object_type type, variant val) {
attrib * a = a_find(*attribs, &at_object);
for (;a && a->type==&at_object;a=a->next) {
if (strcmp(object_name(a), name)==0) {
object_set(a, type, val);
return;
}
}
a = a_add(attribs, object_create(name, type, val));
}
template<> void
objects::set<int, TINTEGER>(const char * name, int value) {
variant val = { 0 };
val.i = value;
set_object(mAttribPtr, name, TINTEGER, val);
}
template<> void
objects::set<double, TREAL>(const char * name, double value) {
variant val = { 0 };
val.f = (float)value;
set_object(mAttribPtr, name, TREAL, val);
}
template<> void
objects::set<const char *, TSTRING>(const char * name, const char * value) {
variant val = { 0 };
val.v = strdup(value);
set_object(mAttribPtr, name, TSTRING, val);
}
template <class V, object_type T> void
objects::set(const char * name, V value) {
variant val = { 0 };
val.v = &value;
set_object(mAttribPtr, name, T, val);
}
} }
void static void set_object(attrib **attribs, const char * name, object_type type,
bind_objects(struct lua_State * L) variant val) {
{ attrib * a = a_find(*attribs, &at_object);
using namespace eressea; for (; a && a->type == &at_object; a = a->next) {
if (strcmp(object_name(a), name) == 0) {
module(L)[ object_set(a, type, val);
class_<objects>("objects") return;
.def("get", &objects::get) }
.def("set", (void(objects::*)(const char*, region&))&objects::set<region&, TREGION>) }
.def("set", (void(objects::*)(const char*, unit&))&objects::set<unit&, TUNIT>) a = a_add(attribs, object_create(name, type, val));
.def("set", (void(objects::*)(const char*, faction&))&objects::set<faction&, TFACTION>)
.def("set", (void(objects::*)(const char*, building&))&objects::set<building&, TBUILDING>)
.def("set", (void(objects::*)(const char*, ship&))&objects::set<ship&, TSHIP>)
// POD:
// .def("set", (void(objects::*)(const char*, int))&objects::set<int, TINTEGER>)
.def("set", (void(objects::*)(const char*, double))&objects::set<lua_Number, TREAL>)
.def("set", (void(objects::*)(const char*, const char *))&objects::set<const char *, TSTRING>)
];
} }
template<> void objects::set<int, TINTEGER>(const char * name, int value) {
variant val = { 0 };
val.i = value;
set_object(mAttribPtr, name, TINTEGER, val);
}
template<> void objects::set<double, TREAL>(const char * name, double value) {
variant val = { 0 };
val.f = (float) value;
set_object(mAttribPtr, name, TREAL, val);
}
template<> void objects::set<const char *, TSTRING>(const char * name,
const char * value) {
variant val = { 0 };
val.v = strdup(value);
set_object(mAttribPtr, name, TSTRING, val);
}
template<class V, object_type T> void objects::set(const char * name, V value) {
variant val = { 0 };
val.v = &value;
set_object(mAttribPtr, name, T, val);
}
}
void bind_objects(struct lua_State * L) {
using namespace eressea;
module(L)[class_<objects> ("objects") .def("get", &objects::get) .def(
"set",
(void(objects::*)(const char*, region&))&objects::set<region&, TREGION>)
.def("set", (void(objects::*)(const char*, unit&))&objects::set<unit&, TUNIT>)
.def("set", (void(objects::*)(const char*, faction&))&objects::set<faction&, TFACTION>)
.def("set", (void(objects::*)(const char*, building&))&objects::set<building&, TBUILDING>)
.def("set", (void(objects::*)(const char*, ship&))&objects::set<ship&, TSHIP>)
// POD:
// .def("set", (void(objects::*)(const char*, int))&objects::set<int, TINTEGER>)
.def("set", (void(objects::*)(const char*, double))&objects::set<lua_Number, TREAL>)
.def("set", (void(objects::*)(const char*, const char *))&objects::set<const char *, TSTRING>)
];
}

View File

@ -27,9 +27,7 @@
#include <lua.hpp> #include <lua.hpp>
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#include <luabind/iterator_policy.hpp> #include <luabind/iterator_policy.hpp>
#if LUABIND_BETA >= 7 #include <luabind/operator.hpp>
# include <luabind/operator.hpp>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (pop) #pragma warning (pop)
#endif #endif
@ -374,7 +372,7 @@ bind_region(lua_State * L)
def("getplanebyname", &plane_getbyname), def("getplanebyname", &plane_getbyname),
class_<struct region>("region") class_<struct region>("region")
.def(tostring(self)) .def(tostring(const_self))
.def(self == region()) .def(self == region())
.property("name", &region_getname, &region_setname) .property("name", &region_getname, &region_setname)
.property("info", &region_getinfo, &region_setinfo) .property("info", &region_getinfo, &region_setinfo)

View File

@ -36,9 +36,7 @@
#pragma warning (disable: 4127) #pragma warning (disable: 4127)
#endif #endif
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#if LUABIND_BETA >= 7 #include <luabind/operator.hpp>
# include <luabind/operator.hpp>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (pop) #pragma warning (pop)
#endif #endif

View File

@ -16,9 +16,7 @@
#include <lua.hpp> #include <lua.hpp>
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#include <luabind/iterator_policy.hpp> #include <luabind/iterator_policy.hpp>
#if LUABIND_BETA >= 7 #include <luabind/operator.hpp>
# include <luabind/operator.hpp>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (pop) #pragma warning (pop)
#endif #endif
@ -28,7 +26,7 @@
#include <ostream> #include <ostream>
using namespace luabind; using namespace luabind;
static std::ostream& static std::ostream&
operator<<(std::ostream& stream, const ship& sh) operator<<(std::ostream& stream, const ship& sh)
{ {
stream << sh.name; stream << sh.name;
@ -38,7 +36,7 @@ operator<<(std::ostream& stream, const ship& sh)
return stream; return stream;
} }
static bool static bool
operator==(const ship& a, const ship& sh) operator==(const ship& a, const ship& sh)
{ {
return a.no==sh.no; return a.no==sh.no;
@ -88,7 +86,7 @@ ship_getregion(const ship * sh)
} }
void void
bind_ship(lua_State * L) bind_ship(lua_State * L)
{ {
module(L)[ module(L)[
def("get_ship", &findship), def("get_ship", &findship),

View File

@ -24,7 +24,7 @@ spell_getschool(const spell& sp)
} }
void void
bind_spell(lua_State * L) bind_spell(lua_State * L)
{ {
module(L)[ module(L)[
class_<struct spell>("spell") class_<struct spell>("spell")

View File

@ -39,9 +39,7 @@
#include <lua.hpp> #include <lua.hpp>
#include <luabind/luabind.hpp> #include <luabind/luabind.hpp>
#include <luabind/iterator_policy.hpp> #include <luabind/iterator_policy.hpp>
#if LUABIND_BETA>=7 #include <luabind/operator.hpp>
# include <luabind/operator.hpp>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (pop) #pragma warning (pop)
#endif #endif
@ -73,8 +71,8 @@ public:
class bind_orders { class bind_orders {
public: public:
static order * next(order * node) { return node->next; } static order * next(order * node) { return node->next; }
static std::string value(order * node) { static std::string value(order * node) {
char * cmd = (char*)getcommand(node); char * cmd = (char*)getcommand(node);
std::string s(cmd); std::string s(cmd);
free(cmd); free(cmd);
return s; return s;
@ -423,7 +421,7 @@ set_flag(unit * u, const char * name, bool value)
} }
} }
static std::ostream& static std::ostream&
operator<<(std::ostream& stream, const unit& u) operator<<(std::ostream& stream, const unit& u)
{ {
const char * rcname = get_racename(u.attribs); const char * rcname = get_racename(u.attribs);
@ -432,7 +430,7 @@ operator<<(std::ostream& stream, const unit& u)
return stream; return stream;
} }
static bool static bool
operator==(const unit& a, const unit &b) operator==(const unit& a, const unit &b)
{ {
return a.no==b.no; return a.no==b.no;
@ -462,7 +460,7 @@ unit_setfaction(unit * u, faction * f)
u_setfaction(u, f); u_setfaction(u, f);
} }
static const char * static const char *
unit_getmagic(const unit * u) unit_getmagic(const unit * u)
{ {
sc_mage * mage = get_mage(u); sc_mage * mage = get_mage(u);
@ -516,7 +514,7 @@ fctr_handle(struct trigger * tp, void * data)
trigger * t = tp; trigger * t = tp;
event * evt = new event(NULL, (event_arg*)data); event * evt = new event(NULL, (event_arg*)data);
fctr_data * fd = (fctr_data*)t->data.v; fctr_data * fd = (fctr_data*)t->data.v;
try { try {
fd->fptr->operator()(fd->target, evt); fd->fptr->operator()(fd->target, evt);
} }
catch (luabind::error& e) { catch (luabind::error& e) {
@ -580,14 +578,14 @@ unit_addnotice(unit * u, const char * str)
} }
void void
bind_unit(lua_State * L) bind_unit(lua_State * L)
{ {
module(L)[ module(L)[
def("get_unit", &findunit), def("get_unit", &findunit),
def("add_unit", &add_unit), def("add_unit", &add_unit),
class_<struct unit>("unit") class_<struct unit>("unit")
.def(tostring(self)) .def(tostring(const_self))
.def(self == unit()) .def(self == unit())
.property("name", &unit_getname, &unit_setname) .property("name", &unit_getname, &unit_setname)
.property("info", &unit_getinfo, &unit_setinfo) .property("info", &unit_getinfo, &unit_setinfo)

View File

@ -1,612 +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-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* based on:
*
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
* Atlantis v1.7 Copyright 1996 by Alex Schröder
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
* This program may not be sold or used commercially without prior written
* permission from the authors.
*/
#define LOCALE_CHECK
#ifdef __LCC__
#undef LOCALE_CHECK
#endif
#include <config.h>
#include "eressea.h"
/* initialization - TODO: init in separate module */
#include <attributes/attributes.h>
#include <spells/spells.h>
#include <gamecode/spells.h>
#include <triggers/triggers.h>
#include <items/itemtypes.h>
/* modules includes */
#include <modules/score.h>
#include <modules/xmas.h>
#include <modules/gmcmd.h>
#include <modules/infocmd.h>
#include <modules/autoseed.h>
#ifdef MUSEUM_MODULE
#include <modules/museum.h>
#endif
#ifdef WORMHOLE_MODULE
#include <modules/wormhole.h>
#endif
#ifdef ARENA_MODULE
#include <modules/arena.h>
#endif
#ifdef DUNGEON_MODULE
#include <modules/dungeon.h>
#endif
/* gamecode includes */
#include <gamecode/economy.h>
#include <gamecode/items.h>
#include <gamecode/laws.h>
#include <gamecode/monster.h>
#include <gamecode/creport.h>
#include <gamecode/report.h>
#include <gamecode/xmlreport.h>
/* kernel includes */
#include <kernel/xmlreader.h>
#include <kernel/spell.h>
#include <kernel/building.h>
#include <kernel/faction.h>
#include <kernel/message.h>
#include <kernel/names.h>
#include <kernel/plane.h>
#include <kernel/race.h>
#include <kernel/skill.h>
#include <kernel/teleport.h>
#include <kernel/unit.h>
#include <kernel/region.h>
#include <kernel/reports.h>
#include <kernel/resources.h>
#include <kernel/save.h>
#include <kernel/ship.h>
#include <kernel/border.h>
#include <kernel/region.h>
#include <kernel/terrain.h>
#include <kernel/item.h>
/* util includes */
#include <util/rand.h>
#include <util/rng.h>
#include <util/xml.h>
#include <util/goodies.h>
#include <util/log.h>
#include <util/lists.h>
#include <util/sql.h>
#include <util/base36.h>
/* libc includes */
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include <locale.h>
#define ISLANDSIZE 20
/**
** global variables we are importing from other modules
**/
extern char * g_reportdir;
extern char * g_datadir;
extern char * g_basedir;
extern char * g_resourcedir;
extern boolean nonr;
extern boolean nosh;
extern boolean nocr;
extern boolean noreports;
extern boolean nomer;
extern boolean nobattle;
extern boolean nomonsters;
extern boolean battledebug;
extern boolean dirtyload;
extern int loadplane;
extern void debug_messagetypes(FILE * out);
extern void free_region(region * r);
extern void render_init(void);
extern void free_borders(void);
/**
** global variables that we are exporting
**/
static char * orders = NULL;
static int nowrite = 0;
static boolean g_writemap = false;
static boolean opt_reportonly = false;
extern boolean opt_cr_absolute_coords;
struct settings global = {
"Eressea", /* gamename */
1000, /* maxunits */
};
static void
game_init(void)
{
init_triggers();
init_xmas();
reports_init();
report_init();
creport_init();
xmlreport_init();
debug_language("locales.log");
register_races();
register_names();
register_resources();
register_buildings();
register_ships();
register_itemfunctions();
register_spells();
register_gcspells();
#ifdef DUNGEON_MODULE
register_dungeon();
#endif
register_itemtypes();
register_xmlreader();
enable_xml_gamecode();
init_data(xmlfile);
init_locales();
init_attributes();
init_races();
init_itemtypes();
init_races();
init_rawmaterials();
init_gmcmd();
#ifdef INFOCMD_MODULE
init_info();
#endif
#ifdef MUSEUM_MODULE
register_museum();
#endif
#ifdef ARENA_MODULE
register_arena();
#endif
#ifdef WORMHOLE_MODULE
register_wormholes();
#endif
#ifdef REMOVE_THIS
render_init();
{
FILE * F = fopen("messagetypes.txt", "w");
debug_messagetypes(F);
fclose(F);
abort();
}
#endif
}
#ifdef SHORTPWDS
static void
readshortpwds()
{
FILE * F;
char zText[MAX_PATH];
sprintf(zText, "%s/%s.%u", basepath(), "shortpwds", turn);
F = fopen(zText, "r");
if (F==NULL) {
log_error(("could not open password file %s", zText));
} else {
while (!feof(F)) {
faction * f;
char passwd[16], faction[5], email[64];
fscanf(F, "%s %s %s\n", faction, passwd, email);
f = findfaction(atoi36(faction));
if (f!=NULL) {
shortpwd * pwd = (shortpwd*)malloc(sizeof(shortpwd));
if (set_email(&pwd->email, email)!=0) {
log_error(("Invalid email address faction %s: %s\n", faction, email));
}
pwd->pwd = strdup(passwd);
pwd->used = false;
pwd->next = f->shortpwds;
f->shortpwds = pwd;
}
}
fclose(F);
}
}
#endif
static int
processturn(char *filename)
{
struct summary * begin, * end;
newfaction * players;
int i;
char path[MAX_PATH];
if (turn == 0) rng_init((int)time(0));
else rng_init(turn);
#ifdef SHORTPWDS
readshortpwds("passwords");
#endif
begin = make_summary();
turn++;
if ((i=readorders(filename, "ISO-8859-1"))!=0) return i;
if (!nomonsters) {
if (turn == 0) rng_init((int)time(0));
else rng_init(turn);
puts(" - Monster KI...");
plan_monsters();
}
processorders();
sprintf(path, "%s/newfactions", basepath());
players = read_newfactions(filename);
while (players) {
int n = listlen(players);
int k = (n+ISLANDSIZE-1)/ISLANDSIZE;
k = n / k;
autoseed(&players, k, true);
}
score();
update_guards();
if (!noreports) {
init_reports();
reports();
}
free_units();
puts(" - Beseitige leere Parteien");
remove_empty_factions(true);
end = make_summary();
report_summary(end, begin, false);
report_summary(end, begin, true);
free(end);
free(begin);
writepasswd();
if (!nowrite) {
char ztext[64];
sprintf(ztext, "%d", turn);
return writegame(ztext, 0);
}
return 0;
}
#ifdef CLEANUP_CODE
static void
game_done(void)
{
/* Diese Routine enfernt allen allokierten Speicher wieder. Das ist nur
* zum Debugging interessant, wenn man Leak Detection hat, und nach
* nicht freigegebenem Speicher sucht, der nicht bis zum Ende benötigt
* wird (temporäre Hilsstrukturen) */
unit *u, *u2;
region *r, *r2;
building *b, *b2;
faction *f, *f2;
ship *s, *s2;
for (r = regions; r; r = r2) {
for (u = r->units; u; u = u2) {
u2 = u->next;
stripunit(u);
uunhash(u);
free(u);
}
for (b = r->buildings; b; b = b2) {
free(b->name);
free(b->display);
b2 = b->next;
free(b);
}
for (s = r->ships; s; s = s2) {
free(s->name);
free(s->display);
s2 = s->next;
free(s);
}
r2 = r->next;
free_region(r);
}
for (f = factions; f; f = f2) {
stripfaction(f);
f2 = f->next;
free(f);
}
while (planes) {
plane * pl = planes;
planes = planes->next;
free(pl->name);
free(pl);
}
creport_cleanup();
report_cleanup();
}
#endif
#include "magic.h"
#ifdef CRTDBG
void
init_crtdbg(void)
{
#if (defined(_MSC_VER))
# if MALLOCDBG == 2
# define CHECKON() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF)
# elif MALLOCDBG == 3
# define CHECKON() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) & 0)
# elif MALLOCDBG == 1
# define CHECKON() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_CRT_DF | _CRTDBG_DELAY_FREE_MEM_DF)
# endif
#endif
}
#endif
static int
usage(const char * prog, const char * arg)
{
if (arg) {
fprintf(stderr, "unknown argument: %s\n\n", arg);
}
fprintf(stderr, "Usage: %s [options]\n"
"-x n : Lädt nur die ersten n regionen\n"
"-f x y : Lädt nur die regionen ab (x,y)\n"
"-v befehlsdatei : verarbeitet automatisch die angegebene Befehlsdatei\n"
"-d datadir : gibt das datenverzeichnis an\n"
"-b basedir : gibt das basisverzeichnis an\n"
"-r resdir : gibt das resourceverzeichnis an\n"
"-t turn : read this datafile, not the most current one\n"
"-o reportdir : gibt das reportverzeichnis an\n"
"-l logfile : specify an alternative logfile\n"
"-R : erstellt nur die Reports neu\n"
"--lomem : keine Messages (RAM sparen)\n"
"--nobattle : keine Kämpfe\n"
"--nomonsters : keine monster KI\n"
"--nodebug : keine Logfiles für Kämpfe\n"
"--noreports : absolut keine Reporte schreiben\n"
"--debug : schreibt Debug-Ausgaben in die Datei debug\n"
"--nocr : keine CRs\n"
"--nonr : keine Reports\n"
"--nosh : keine Mail-skripte\n"
"--crabsolute : absolute Koordinaten im CR\n"
"--help : help\n", prog);
return -1;
}
static int
read_args(int argc, char **argv)
{
int i;
for (i=1;i!=argc;++i) {
if (argv[i][0]!='-') {
return usage(argv[0], argv[i]);
} else if (argv[i][1]=='-') { /* long format */
if (strcmp(argv[i]+2, "nocr")==0) nocr = true;
else if (strcmp(argv[i]+2, "nosave")==0) nowrite = true;
else if (strcmp(argv[i]+2, "noreports")==0) {
noreports = true;
nocr = true;
nocr = true;
}
else if (strcmp(argv[i]+2, "xml")==0) xmlfile = argv[++i];
else if (strcmp(argv[i]+2, "dirtyload")==0) dirtyload = true;
else if (strcmp(argv[i]+2, "nonr")==0) nonr = true;
else if (strcmp(argv[i]+2, "nosh")==0) nosh = true;
else if (strcmp(argv[i]+2, "lomem")==0) lomem = true;
else if (strcmp(argv[i]+2, "nobattle")==0) nobattle = true;
else if (strcmp(argv[i]+2, "nomonsters")==0) nomonsters = true;
else if (strcmp(argv[i]+2, "nodebug")==0) battledebug = false;
else if (strcmp(argv[i]+2, "crabsolute")==0) opt_cr_absolute_coords = true;
else if (strcmp(argv[i]+2, "help")==0)
return usage(argv[0], NULL);
else
return usage(argv[0], argv[i]);
} else switch(argv[i][1]) {
case 'o':
g_reportdir = argv[++i];
break;
case 'd':
g_datadir = argv[++i];
break;
case 'r':
g_resourcedir = argv[++i];
break;
case 'b':
g_basedir = argv[++i];
break;
case 'i':
xmlfile = argv[++i];
break;
case 't':
turn = atoi(argv[++i]);
break;
case 'f':
firstx = atoi(argv[++i]);
firsty = atoi(argv[++i]);
break;
case 'q':
quiet = 1;
break;
case 'v':
if (i<argc) orders = argv[++i];
else return usage(argv[0], argv[i]);
break;
case 'p':
loadplane = atoi(argv[++i]);
break;
case 'x':
maxregions = atoi(argv[++i]);
maxregions = (maxregions*81+80) / 81;
break;
case 'X':
dirtyload = true;
break;
case 'l':
log_open(argv[++i]);
break;
case 'w':
g_writemap = true;
break;
case 'R':
opt_reportonly = true;
break;
default:
usage(argv[0], argv[i]);
}
}
return 0;
}
void
confirm_newbies(void)
{
faction * f = factions;
while (f) {
if (!fval(f, FFL_DBENTRY)) {
if (f->subscription) {
sql_print(("UPDATE subscriptions SET status='ACTIVE', faction='%s', race='%s' WHERE id=%u;\n",
itoa36(f->no), dbrace(f->race), f->subscription));
fset(f, FFL_DBENTRY);
}
}
f = f->next;
}
}
void
update_subscriptions(void)
{
FILE * F;
char zText[MAX_PATH];
faction * f;
strcat(strcpy(zText, basepath()), "/subscriptions");
F = fopen(zText, "r");
if (F==NULL) {
log_error(("could not open %s.\n", zText));
return;
}
for (;;) {
char zFaction[5];
int subscription, fno;
if (fscanf(F, "%d %s", &subscription, zFaction)<=0) break;
fno = atoi36(zFaction);
f = findfaction(fno);
if (f!=NULL) {
f->subscription=subscription;
}
}
}
int
main(int argc, char *argv[])
{
int i;
char zText[MAX_PATH];
sqlpatch = true;
log_open("eressea.log");
printf("\n%s PBEM host\n"
"Copyright (C) 1996-2001 C.Schlittchen, K.Zedel, E.Rehling, H.Peters.\n\n"
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %f\n\n", global.gamename, version());
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C");
#ifdef LOCALE_CHECK
if (!locale_check()) {
log_error(("The current locale is not suitable for international Eressea.\n"));
return -1;
}
#endif
#ifdef CRTDBG
init_crtdbg();
#endif
#ifdef DMALLOC
init_dmalloc();
#endif
if ((i=read_args(argc, argv))!=0) return i;
printf(
"version %d.%d\n"
"turn %d.\n"
"orders %s.\n",
global.data_version / 10, global.data_version % 10, turn, orders);
kernel_init();
game_init();
sprintf(zText, "%d", turn);
i = readgame(zText, false);
if (i!=0) return i;
confirm_newbies();
update_subscriptions();
{
char zText[128];
FILE * F;
faction * f = factions;
sprintf(zText, "subscriptions.%u", turn);
F = fopen(zText, "w");
while (f!=NULL) {
fprintf(F, "%s:%u:%s:%s:%s:%u:\n",
itoa36(f->no), f->subscription, f->email, f->override,
dbrace(f->race), f->lastorders);
f = f->next;
}
fclose(F);
}
#ifdef BETA_CODE
if (dungeonstyles) {
struct dungeon * d = dungeonstyles;
struct region * r = make_dungeon(d);
make_dungeongate(findregion(0, 0), r, d);
}
#endif
writepasswd();
if (opt_reportonly) {
reports();
return 0;
}
if (g_writemap) {
return crwritemap("world.cr");
}
if (turn == 0) rng_init((int)time(0));
else rng_init(turn);
if ((i = processturn(orders))!=0) {
return i;
}
#ifdef CLEANUP_CODE
game_done();
#endif
kernel_done();
log_close();
return 0;
}

View File

@ -180,7 +180,7 @@ static int
setup_signal_handler(void) setup_signal_handler(void)
{ {
struct sigaction act; struct sigaction act;
act.sa_flags = SA_ONESHOT | SA_SIGINFO; act.sa_flags = SA_ONESHOT | SA_SIGINFO;
act.sa_sigaction = report_segfault; act.sa_sigaction = report_segfault;
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
@ -243,7 +243,7 @@ game_init(void)
#endif #endif
} }
static const struct { static const struct {
const char * name; const char * name;
int (*func)(lua_State *); int (*func)(lua_State *);
} lualibs[] = { } lualibs[] = {
@ -380,22 +380,14 @@ usage(const char * prog, const char * arg)
static void static void
setLuaString(lua_State * luaState, const char * name, const char * value) setLuaString(lua_State * luaState, const char * name, const char * value)
{ {
#if LUABIND_BETA<7 || (LUABIND_BETA==7 && LUABIND_DEVEL<2)
luabind::object g = luabind::get_globals(luaState);
#else
luabind::object g = luabind::globals(luaState); luabind::object g = luabind::globals(luaState);
#endif
g[name] = value; g[name] = value;
} }
static void static void
setLuaNumber(lua_State * luaState, const char * name, double value) setLuaNumber(lua_State * luaState, const char * name, double value)
{ {
#if LUABIND_BETA<7 || (LUABIND_BETA==7 && LUABIND_DEVEL<2)
luabind::object g = luabind::get_globals(luaState);
#else
luabind::object g = luabind::globals(luaState); luabind::object g = luabind::globals(luaState);
#endif
g[name] = value; g[name] = value;
} }
@ -582,7 +574,7 @@ main(int argc, char *argv[])
assert(towlower(0xC4)==0xE4); assert(towlower(0xC4)==0xE4);
if (lc_ctype) lc_ctype = strdup(lc_ctype); if (lc_ctype) lc_ctype = strdup(lc_ctype);
if (lc_numeric) lc_numeric = strdup(lc_numeric); if (lc_numeric) lc_numeric = strdup(lc_numeric);
lua_State * luaState = lua_init(); lua_State * luaState = lua_init();
global.vm_state = luaState; global.vm_state = luaState;
load_inifile("eressea.ini"); load_inifile("eressea.ini");
@ -609,7 +601,7 @@ main(int argc, char *argv[])
#endif #endif
luabind::call_function<int>(luaState, "dofile", buf); luabind::call_function<int>(luaState, "dofile", buf);
#ifndef LUABIND_NO_EXCEPTIONS #ifndef LUABIND_NO_EXCEPTIONS
} }
catch (std::runtime_error& rte) { catch (std::runtime_error& rte) {
log_error(("%s.\n", rte.what())); log_error(("%s.\n", rte.what()));
} }

View File

@ -1,25 +0,0 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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-pbem.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 <config.h>
#include <spells/spells.h>
#include <spells/alp.h>
void
register_spells(void)
{
/* sp_summon_alp */
init_alp();
}

View File

@ -1,59 +0,0 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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-pbem.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.
*/
/** module: eressea/triggers
* Registration and setup of all the triggers that are used in an Eressea
* world.
*/
#include <config.h>
#include <eressea.h>
/* triggers includes */
#include <triggers/changefaction.h>
#include <triggers/changerace.h>
#include <triggers/createcurse.h>
#include <triggers/createunit.h>
#include <triggers/gate.h>
#include <triggers/unguard.h>
#include <triggers/giveitem.h>
#include <triggers/killunit.h>
#include <triggers/removecurse.h>
#include <triggers/shock.h>
#include <triggers/timeout.h>
#include <triggers/unitmessage.h>
/* util includes */
#include <event.h>
/* libc includes */
#include <stdio.h>
void
init_triggers(void)
{
fprintf(stdout, "- registering triggers\n");
tt_register(&tt_changefaction);
tt_register(&tt_changerace);
tt_register(&tt_createcurse);
tt_register(&tt_createunit);
tt_register(&tt_gate);
tt_register(&tt_unguard);
tt_register(&tt_giveitem);
tt_register(&tt_killunit);
tt_register(&tt_removecurse);
tt_register(&tt_shock);
tt_register(&tt_unitmessage);
tt_register(&tt_timeout);
}

View File

@ -1,15 +0,0 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* 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-pbem.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.
*/
void register_triggers(void);

View File

@ -1,22 +0,0 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#ifdef __cplusplus
}
#ifndef LUABIND_BETA
# include <boost/version.hpp>
# if BOOST_VERSION < 103300
# define LUABIND_BETA 7
# define LUABIND_DEVEL 1
# else
# define LUABIND_BETA 7
# define LUABIND_DEVEL 2
# endif
#endif
#endif