From 532cbd0a3632030cf4b6a9c3b19407f7c0297371 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 14 Dec 2003 10:10:30 +0000 Subject: [PATCH] lua bindings addplayer gesplittet --- src/common/kernel/message.c | 12 -- src/common/kernel/save.c | 4 +- src/common/modules/gmcmd.c | 1 + src/common/modules/modules.vcproj | 22 +-- src/common/modules/museum.h | 2 +- src/common/modules/xecmd.c | 3 +- src/common/races/races.vcproj | 4 +- src/common/spells/spells.vcproj | 4 +- src/common/triggers/triggers.vcproj | 4 +- src/common/triggers/unitmessage.c | 1 + src/common/util/util.vcproj | 4 +- src/eressea/Jamfile | 30 +++- src/eressea/eressea.vcproj | 155 ++++++++++++++++++- src/eressea/korrektur.h | 14 +- src/eressea/main.cpp | 232 +++++++++++++++++++++------- src/mapper/autoseed.c | 8 +- src/mapper/map_partei.c | 6 +- src/mapper/mapper.vcproj | 4 +- 18 files changed, 394 insertions(+), 116 deletions(-) diff --git a/src/common/kernel/message.c b/src/common/kernel/message.c index 3a7cf7c00..1d69473b7 100644 --- a/src/common/kernel/message.c +++ b/src/common/kernel/message.c @@ -596,18 +596,6 @@ mistake(const unit * u, const char *command, const char *comment, int mtype) extern unsigned int new_hashstring(const char* s); -static int -old_hashstring(const char* s) -{ - int key = 0; - int i = strlen(s); - while (i) { - --i; - key = ((key >> 31) & 1) ^ (key << 1) ^ s[i]; - } - return key & 0x7fff; -} - void set_msglevel(struct warning ** warnings, const char * type, int level) { diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 0a83bc507..52672d2fd 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -760,9 +760,11 @@ void read_items(FILE *F, item **ilist) { for (;;) { + const item_type * itype; rs(F, buf); if (!strcmp("end", buf)) break; - i_change(ilist, it_find(buf), ri(F)); + itype = it_find(buf); + if (itype!=NULL) i_change(ilist, itype, ri(F)); } } diff --git a/src/common/modules/gmcmd.c b/src/common/modules/gmcmd.c index 917f2a628..0956aa4eb 100644 --- a/src/common/modules/gmcmd.c +++ b/src/common/modules/gmcmd.c @@ -111,6 +111,7 @@ read_gmcreate(attrib * a, FILE * F) *p_itype = it_find(zText); if (a->data.v==NULL) { log_error(("unknown itemtype %s in gmcreate attribute\n", zText)); + return AT_READ_FAIL; } return AT_READ_OK; } diff --git a/src/common/modules/modules.vcproj b/src/common/modules/modules.vcproj index c4ecb67bf..70eb79716 100644 --- a/src/common/modules/modules.vcproj +++ b/src/common/modules/modules.vcproj @@ -24,7 +24,7 @@ AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" BasicRuntimeChecks="0" - RuntimeLibrary="5" + RuntimeLibrary="3" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" @@ -76,7 +76,7 @@ AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" StringPooling="TRUE" - RuntimeLibrary="4" + RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="2" @@ -123,21 +123,12 @@ - - - - - - @@ -154,21 +145,12 @@ - - - - - - diff --git a/src/common/modules/museum.h b/src/common/modules/museum.h index d04afbb54..ddb751632 100644 --- a/src/common/modules/museum.h +++ b/src/common/modules/museum.h @@ -19,7 +19,7 @@ extern "C" { #endif #ifndef MUSEUM_MODULE -#warning "must define MUSEUM_MODULE to use this module" +#error "must define MUSEUM_MODULE to use this module" #endif extern attrib_type at_warden; diff --git a/src/common/modules/xecmd.c b/src/common/modules/xecmd.c index 234aaeb53..3de90d13d 100644 --- a/src/common/modules/xecmd.c +++ b/src/common/modules/xecmd.c @@ -25,9 +25,10 @@ #include #include +/* libc includes */ #include - #include +#include attrib_type at_xontormiaexpress = { "xontormiaexpress", diff --git a/src/common/races/races.vcproj b/src/common/races/races.vcproj index d7fc9a0a9..e71ee63e4 100644 --- a/src/common/races/races.vcproj +++ b/src/common/races/races.vcproj @@ -24,7 +24,7 @@ AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" BasicRuntimeChecks="0" - RuntimeLibrary="5" + RuntimeLibrary="3" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" @@ -76,7 +76,7 @@ AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" StringPooling="TRUE" - RuntimeLibrary="4" + RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="2" diff --git a/src/common/spells/spells.vcproj b/src/common/spells/spells.vcproj index 425c180cb..0515a7e71 100644 --- a/src/common/spells/spells.vcproj +++ b/src/common/spells/spells.vcproj @@ -24,7 +24,7 @@ AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" StringPooling="TRUE" - RuntimeLibrary="4" + RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="2" @@ -75,7 +75,7 @@ AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" BasicRuntimeChecks="0" - RuntimeLibrary="5" + RuntimeLibrary="3" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/common/triggers/triggers.vcproj b/src/common/triggers/triggers.vcproj index 333b4e3e8..8e6000f1d 100644 --- a/src/common/triggers/triggers.vcproj +++ b/src/common/triggers/triggers.vcproj @@ -24,7 +24,7 @@ AdditionalIncludeDirectories="../util,../kernel,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" BasicRuntimeChecks="0" - RuntimeLibrary="5" + RuntimeLibrary="3" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" @@ -76,7 +76,7 @@ AdditionalIncludeDirectories="../util,../kernel,../..,.." PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" StringPooling="TRUE" - RuntimeLibrary="4" + RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="2" diff --git a/src/common/triggers/unitmessage.c b/src/common/triggers/unitmessage.c index 24865cdc6..b75181fe7 100644 --- a/src/common/triggers/unitmessage.c +++ b/src/common/triggers/unitmessage.c @@ -27,6 +27,7 @@ /* ansi includes */ #include +#include #include #include diff --git a/src/common/util/util.vcproj b/src/common/util/util.vcproj index 02e1efc34..624fd4bc2 100644 --- a/src/common/util/util.vcproj +++ b/src/common/util/util.vcproj @@ -24,7 +24,7 @@ AdditionalIncludeDirectories="../.." PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" StringPooling="TRUE" - RuntimeLibrary="4" + RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="2" @@ -128,7 +128,7 @@ AdditionalIncludeDirectories="../..,.." PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" BasicRuntimeChecks="0" - RuntimeLibrary="5" + RuntimeLibrary="3" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/eressea/Jamfile b/src/eressea/Jamfile index d3e72293f..8789c95f1 100644 --- a/src/eressea/Jamfile +++ b/src/eressea/Jamfile @@ -7,10 +7,32 @@ SubDirHdrs $(SUBDIR)/../common/util ; SubDirHdrs $(SUBDIR)/../common ; SubDirHdrs $(SUBDIR)/.. ; -SOURCES = - korrektur.c - main.c - ; +if $(HAVE_LUA) { + SubDirC++Flags -DHAVE_LUA ; + UsingLua ; + UsingLuabind ; + SEARCH_SOURCE += [ FDirName $(SUBDIR) lua ] ; +} + +if $(HAVE_LUA) { + SOURCES = + alliance.cpp + building.cpp + eressea.cpp + faction.cpp + region.cpp + ship.cpp + unit.cpp + main.cpp + ; + + LINKLIBS on eressea += -llua50 -llualib50 ; + LINKLIBS on eressea += -lluabind ; +} else { + SOURCES = main.c ; +} + +SOURCES += korrektur.c ; Main eressea : $(SOURCES) ; LinkLibraries eressea : diff --git a/src/eressea/eressea.vcproj b/src/eressea/eressea.vcproj index 9a32160f9..a01be5eab 100644 --- a/src/eressea/eressea.vcproj +++ b/src/eressea/eressea.vcproj @@ -25,7 +25,7 @@ AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE" StringPooling="TRUE" - RuntimeLibrary="4" + RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="2" @@ -42,6 +42,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RelativePath=".\main.cpp"> + + + diff --git a/src/eressea/korrektur.h b/src/eressea/korrektur.h index 8ec9eb230..7107f1b42 100644 --- a/src/eressea/korrektur.h +++ b/src/eressea/korrektur.h @@ -9,6 +9,14 @@ * prior permission by the authors of Eressea. **/ -extern void korrektur(void); -extern void korrektur_end(void); -extern void init_conversion(void); +#ifdef __cplusplus +extern "C" { +#endif + + extern void korrektur(void); + extern void korrektur_end(void); + extern void init_conversion(void); +#ifdef __cplusplus +} +#endif + diff --git a/src/eressea/main.cpp b/src/eressea/main.cpp index fbe10edb7..5860e5b3d 100644 --- a/src/eressea/main.cpp +++ b/src/eressea/main.cpp @@ -1,7 +1,7 @@ /* vi: set ts=2: * * - * Eressea PB(E)M host Copyright (C) 1998-2000 + * 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) @@ -24,23 +24,31 @@ #undef LOCALE_CHECK #endif +/* config includes */ #include #include #include "korrektur.h" /* initialization - TODO: init in separate module */ -#include #include +#include #include #include /* modules includes */ +#ifdef DUNGEON_MODULE #include +#endif #include +#include #include -#ifdef INFOCMD_MODULE -# include +#include +#ifdef MUSEUM_MODULE +#include +#endif +#ifdef ARENA_MODULE +#include #endif /* gamecode includes */ @@ -49,14 +57,13 @@ #include /* kernel includes */ -#include #include +#include #include #include #include #include #include -#include #include #include #include @@ -70,11 +77,12 @@ /* util includes */ #include +#include #include #include -#ifdef HAVE_LUA /* lua includes */ +#ifdef HAVE_LUA #include "lua/bindings.h" #include #include @@ -88,18 +96,14 @@ #include #include - /** ** global variables we are importing from other modules **/ - extern "C" { -#ifdef BETA_CODE -extern int xml_writeitems(const char * filename); -extern int xml_writeships(void); -extern int xml_writebuildings(void); -#endif - +extern char * g_reportdir; +extern char * g_datadir; +extern char * g_basedir; +extern char * g_resourcedir; extern item_type * i_silver; extern boolean nonr; @@ -108,26 +112,33 @@ extern boolean noreports; extern boolean nomer; extern boolean nomsg; extern boolean nobattle; +extern boolean nomonsters; extern boolean nobattledebug; extern boolean dirtyload; +extern int demonfix; 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); +extern boolean opt_cr_absolute_coords; + +#ifdef FUZZY_BASE36 +extern int fuzzy_hits; +#endif /* FUZZY_BASE36 */ } - /** - ** global variables wthat we are exporting + ** global variables that we are exporting **/ static char * orders = NULL; static char * xmlfile = NULL; static int nowrite = 0; static boolean g_writemap = false; static boolean g_killeiswald = false; +static boolean opt_reportonly = false; struct settings global = { "Eressea", /* gamename */ @@ -143,7 +154,7 @@ crwritemap(void) for (r=regions;r;r=r->next) { plane * p = rplane(r); fprintf(F, "REGION %d %d %d\n", r->x, r->y, p?p->id:0); - fprintf(F, "\"%s\";Name\n\"%s\";Terrain\n", rname(r, default_locale), LOC(default_locale, rterrain(r)->name)); + fprintf(F, "\"%s\";Name\n\"%s\";Terrain\n", rname(r, default_locale), LOC(default_locale, terrain[rterrain(r)].name)); } fclose(F); return 0; @@ -153,31 +164,19 @@ static void game_init(void) { init_triggers(); - + init_xmas(); report_init(); creport_init(); debug_language("locales.log"); - register_skills(); - - register_raceclass(); register_races(); register_resources(); - register_terrains(); register_buildings(); register_ships(); register_items(); -#ifdef MAGIC register_spells(); -#endif - register_dungeon(); - register_technology(); - register_alchemy(); -#ifdef MUSEUM_MODULE - register_museum(); -#endif -#ifdef ARENA_MODULE - register_arena(); +#ifdef DUNGEON_MODULE + register_dungeon(); #endif init_data(xmlfile?xmlfile:"eressea.xml"); @@ -187,14 +186,20 @@ game_init(void) init_resources(); init_items(); init_economy(); +#if NEW_RESOURCEGROWTH init_rawmaterials(); +#endif init_gmcmd(); -#ifdef INFOCMD_MODULE init_info(); -#endif init_conversion(); +#ifdef MUSEUM_MODULE + register_museum(); +#endif +#ifdef ARENA_MODULE + register_arena(); +#endif #ifdef REMOVE_THIS render_init(); { @@ -236,7 +241,7 @@ writefactiondata(void) { FILE *F; char zText[128]; - + sprintf(zText, "%s/faction-data.xml", basepath()); F = cfopen(zText, "w"); if(F) { @@ -271,13 +276,44 @@ writepasswd(void) puts("Schreibe Passwörter..."); for (f = factions; f; f = f->next) { - fprintf(F, "%s:%s:%s:%s\n", + fprintf(F, "%s:%s:%s:%s\n", factionid(f), f->email, f->passw, f->override); } fclose(F); } } +#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)); + pwd->email = strdup(email); + pwd->pwd = strdup(passwd); + pwd->used = false; + pwd->next = f->shortpwds; + f->shortpwds = pwd; + } + } + fclose(F); + } +} +#endif + #ifdef HAVE_LUA lua_State * luaState; @@ -287,7 +323,10 @@ lua_init(void) luaState = lua_open(); luaopen_base(luaState); luabind::open(luaState); + bind_eressea(luaState); + bind_alliance(luaState); bind_region(luaState); + bind_faction(luaState); bind_unit(luaState); bind_ship(luaState); bind_building(luaState); @@ -303,9 +342,12 @@ lua_done(void) static int processturn(char *filename) { - struct summary * begin, * end; + struct summary * begin, * end; int i; +#ifdef SHORTPWDS + readshortpwds("passwords"); +#endif begin = make_summary(false); printf(" - Korrekturen Runde %d\n", turn); korrektur(); @@ -336,6 +378,11 @@ processturn(char *filename) free(end); free(begin); writepasswd(); +#ifdef FUZZY_BASE36 + fputs("==--------------------------==\n", stdout); + fprintf(stdout, "## fuzzy base10 hits: %5d ##\n", fuzzy_hits); + fputs("==--------------------------==\n", stdout); +#endif /* FUZZY_BASE36 */ if (!nowrite) { char ztext[64]; sprintf(ztext, "%s/%d", datapath(), turn); @@ -410,13 +457,17 @@ game_done(void) } #endif -#if MALLOCDBG -static void +#include "magic.h" + +#ifdef MALLOCDBG +void init_malloc_debug(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 @@ -437,7 +488,7 @@ write_stats(void) for (i=0;spelldaten[i].id;++i) { if (spelldaten[i].magietyp!=m) { m=spelldaten[i].magietyp; - fprintf(F, "\n%s\n", magic_schools[m]); + fprintf(F, "\n%s\n", magietypen[m]); } fprintf(F, "%d\t%s\n", spelldaten[i].level, spelldaten[i].name); } @@ -490,13 +541,16 @@ usage(const char * prog, const char * arg) "-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" "--noeiswald : beruhigt ungemein\n" "--nomsg : keine Messages (RAM sparen)\n" "--nobattle : keine Kämpfe\n" + "--nomonsters : keine monster KI\n" "--nodebug : keine Logfiles für Kämpfe\n" "--debug : schreibt Debug-Ausgaben in die Datei debug\n" "--nocr : keine CRs\n" "--nonr : keine Reports\n" + "--crabsolute : absolute Koordinaten im CR\n" #ifdef USE_MERIAN "--nomer : keine Meriankarten\n" #endif @@ -525,7 +579,9 @@ read_args(int argc, char **argv) else if (strcmp(argv[i]+2, "nomsg")==0) nomsg = true; else if (strcmp(argv[i]+2, "noeiswald")==0) g_killeiswald = 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) nobattledebug = true; + else if (strcmp(argv[i]+2, "crabsolute")==0) opt_cr_absolute_coords = true; #ifdef USE_MERIAN else if (strcmp(argv[i]+2, "nomer")==0) nomer = true; #endif @@ -537,6 +593,9 @@ read_args(int argc, char **argv) case 'o': g_reportdir = argv[++i]; break; + case 'D': /* DEBUG */ + demonfix = atoi(argv[++i]); + break; case 'd': g_datadir = argv[++i]; break; @@ -546,6 +605,9 @@ read_args(int argc, char **argv) case 'b': g_basedir = argv[++i]; break; + case 'i': + xmlfile = argv[++i]; + break; case 't': turn = atoi(argv[++i]); break; @@ -576,6 +638,9 @@ read_args(int argc, char **argv) case 'w': g_writemap = true; break; + case 'R': + opt_reportonly = true; + break; default: usage(argv[0], argv[i]); } @@ -583,6 +648,12 @@ read_args(int argc, char **argv) return 0; } +#ifdef BETA_CODE +extern int xml_writeitems(const char * filename); +extern int xml_writeships(void); +extern int xml_writebuildings(void); +#endif + typedef struct lostdata { int x, y; int prevunit; @@ -590,24 +661,53 @@ typedef struct lostdata { int ship; } lostdata; -static void +void confirm_newbies(void) { - const faction * f = factions; - if (sqlstream) while (f) { - if (f->age==0) { - fprintf(sqlstream, "UPDATE subscriptions SET status='ACTIVE', faction='%s' WHERE game=%d AND password='%s';\n", itoa36(f->no), GAME_ID, f->passw); + faction * f = factions; + if (sqlstream==NULL) return; + while (f) { + if (!fval(f, FFL_DBENTRY)) { + if (f->subscription) { + fprintf(sqlstream, "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; + int i; char zText[MAX_PATH]; + sqlpatch = true; updatelog = fopen("update.log", "w"); log_open("eressea.log"); printf("\n%s PBEM host\n" @@ -622,7 +722,7 @@ main(int argc, char *argv[]) return -1; } #endif -#if MALLOCDBG +#ifdef MALLOCDBG init_malloc_debug(); #endif @@ -642,16 +742,32 @@ main(int argc, char *argv[]) lua_init(); #endif game_init(); -#ifdef BETA_CODE +#if defined(BETA_CODE) /* xml_writeships(); */ /* xml_writebuildings(); */ - /* xml_writeitems("items.xml"); */ + xml_writeitems("items.xml"); return 0; #endif if ((i=readgame(false))!=0) return i; confirm_newbies(); -#ifdef BETA_CODE + 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 DUNGEON_MODULE if (dungeonstyles) { struct dungeon * d = dungeonstyles; struct region * r = make_dungeon(d); @@ -668,9 +784,19 @@ main(int argc, char *argv[]) for (u=r->units;u;u=u->next) scale_number(u, 1); } } - if (g_writemap) return crwritemap(); - if ((i=processturn(orders))!=0) return i; + if (opt_reportonly) { + reports(); + return 0; + } + + if (g_writemap) { + return crwritemap(); + } + + if ((i=processturn(orders))!=0) { + return i; + } #ifdef CLEANUP_CODE game_done(); diff --git a/src/mapper/autoseed.c b/src/mapper/autoseed.c index 754d2fb3e..75762a0e2 100644 --- a/src/mapper/autoseed.c +++ b/src/mapper/autoseed.c @@ -257,8 +257,8 @@ autoseed(struct regionlist * rlist) newfaction ** nfp = &newfactions; unit * u; while (*nfp!=nf) nfp=&(*nfp)->next; - u = addplayer(seeds[i].region, nf->email, nf->password, nf->race, - nf->lang, nf->subscription); + u = addplayer(seeds[i].region, addfaction(nf->email, nf->password, nf->race, + nf->lang, nf->subscription)); #ifdef ALLIANCES u->faction->alliance = nf->allies; #endif @@ -358,8 +358,8 @@ mkisland(int nsize) unit * u; terraform(r, preferred_terrain(nextf->race)); ++isize; - u = addplayer(r, nextf->email, nextf->password, nextf->race, nextf->lang, - nextf->subscription); + u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race, nextf->lang, + nextf->subscription)); #ifdef ALLIANCES u->faction->alliance = nextf->allies; #endif diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index c2b54d5ee..343ed8c71 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -289,8 +289,8 @@ seed_dropouts(void) if (u==NULL) while (*nfp) { newfaction * nf = *nfp; if (nf->race==drop->race && !nf->bonus) { - unit * u = addplayer(r, nf->email, nf->password, nf->race, nf->lang, - nf->subscription); + unit * u = addplayer(r, addfaction(nf->email, nf->password, nf->race, nf->lang, + nf->subscription)); #ifdef ALLIANCES u->faction->alliance = nf->allies; #endif @@ -519,7 +519,7 @@ NeuePartei(region * r) else nfp = &nf->next; } modified = 1; - u = addplayer(r, email, passwd, frace, lang, subscription); + u = addplayer(r, addfaction(email, passwd, frace, lang, subscription)); ++numnewbies; if(late) give_latestart_bonus(r, u, late); diff --git a/src/mapper/mapper.vcproj b/src/mapper/mapper.vcproj index d8d28ab44..e98231a59 100644 --- a/src/mapper/mapper.vcproj +++ b/src/mapper/mapper.vcproj @@ -25,7 +25,7 @@ AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE" StringPooling="TRUE" - RuntimeLibrary="4" + RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="2" @@ -86,7 +86,7 @@ AdditionalIncludeDirectories="$(CURSES_ROOT)/include;../common/kernel,../common/gamecode,../common/util,../common,.." PreprocessorDefinitions="_CONSOLE,WIN32" BasicRuntimeChecks="0" - RuntimeLibrary="5" + RuntimeLibrary="3" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h"