* Letzte Zugabgabe wird gepatched

* Header include Reihenfolge sollte immer egal sein.
This commit is contained in:
Enno Rehling 2002-03-03 10:51:24 +00:00
parent 86bb30e253
commit 46db739776
11 changed files with 60 additions and 35 deletions

View File

@ -70,6 +70,7 @@
#include <base36.h> #include <base36.h>
#include <goodies.h> #include <goodies.h>
#include <rand.h> #include <rand.h>
#include <sql.h>
#include <util/message.h> #include <util/message.h>
#ifdef AT_OPTION #ifdef AT_OPTION
@ -239,6 +240,8 @@ restart(unit *u, const race * rc)
unit * nu = f->units; unit * nu = f->units;
strlist ** o=&u->orders; strlist ** o=&u->orders;
fprintf(sqlstream, "UPDATE subscriptions set faction='%s' where faction"
"='%s' and game=%d;", itoa36(u->faction->no), itoa36(f->no), GAME_ID);
f->magiegebiet = u->faction->magiegebiet; f->magiegebiet = u->faction->magiegebiet;
f->options = u->faction->options; f->options = u->faction->options;
freestrlist(nu->orders); freestrlist(nu->orders);
@ -266,7 +269,7 @@ checkorders(void)
puts(" - Warne späte Spieler..."); puts(" - Warne späte Spieler...");
for (f = factions; f; f = f->next) for (f = factions; f; f = f->next)
if (f->no!=MONSTER_FACTION && turn - f->lastorders == ORDERGAP - 1) if (f->no!=MONSTER_FACTION && turn - f->lastorders == NMRTIMEOUT - 1)
addstrlist(&f->mistakes, addstrlist(&f->mistakes,
"Bitte sende die Befehle nächste Runde ein, " "Bitte sende die Befehle nächste Runde ein, "
"wenn du weiterspielen möchtest."); "wenn du weiterspielen möchtest.");
@ -1194,19 +1197,24 @@ quit(void)
remove("inactive"); remove("inactive");
for (f = factions; f; f = f->next) if(!fval(f, FL_NOIDLEOUT)) { for (f = factions; f; f = f->next) {
#if REMOVENMRTIMEOUT == 1 if(fval(f, FL_NOIDLEOUT)) f->lastorders = turn;
if (turn - f->lastorders >= ORDERGAP) { #if NMRTIMEOUT
if (turn - f->lastorders >= NMRTIMEOUT) {
destroyfaction(f); destroyfaction(f);
continue; continue;
} }
#endif #endif
if (turn - f->lastorders >= (ORDERGAP - 1)) { fprintf(sqlstream,
"UPDATE subscriptions SET lastturn=%d WHERE game=%d AND faction='%s';",
f->lastorders, GAME_ID, itoa36(f->no));
if (turn - f->lastorders >= (NMRTIMEOUT - 1)) {
inactivefaction(f); inactivefaction(f);
continue; continue;
} }
} }
#if REMOVENMRNEWBIE == 1 #if NMRTIMEOUT
puts(" - beseitige Spieler, die sich nach der Anmeldung nicht " puts(" - beseitige Spieler, die sich nach der Anmeldung nicht "
"gemeldet haben..."); "gemeldet haben...");
@ -2722,6 +2730,9 @@ renumber_factions(void)
} }
} }
if (updatelog) fprintf(updatelog, "renum %s %s\n", itoa36(rp->faction->no), itoa36(rp->want)); if (updatelog) fprintf(updatelog, "renum %s %s\n", itoa36(rp->faction->no), itoa36(rp->want));
fprintf(sqlstream, "UPDATE subscriptions set faction='%s' where "
"faction='%s' and game=%d;", itoa36(rp->want),
itoa36(rp->faction->no), GAME_ID);
rp->faction->no = rp->want; rp->faction->no = rp->want;
register_faction_id(rp->want); register_faction_id(rp->want);
fset(rp->faction, FF_NEWID); fset(rp->faction, FF_NEWID);

View File

@ -3338,7 +3338,7 @@ report_summary(summary * s, summary * o, boolean full)
FILE * F = NULL; FILE * F = NULL;
int i, newplayers = 0; int i, newplayers = 0;
faction * f; faction * f;
int nmrs[ORDERGAP+1]; int nmrs[NMRTIMEOUT+1];
{ {
char zText[MAX_PATH]; char zText[MAX_PATH];
@ -3430,7 +3430,7 @@ report_summary(summary * s, summary * o, boolean full)
fprintf(F, "\n\n"); fprintf(F, "\n\n");
for (i = 0; i != ORDERGAP+1; ++i) { for (i = 0; i != NMRTIMEOUT+1; ++i) {
nmrs[i] = 0; nmrs[i] = 0;
} }
@ -3438,12 +3438,12 @@ report_summary(summary * s, summary * o, boolean full)
if (f->age <= 1 && turn - f->lastorders == 1) { if (f->age <= 1 && turn - f->lastorders == 1) {
newplayers++; newplayers++;
} else if (f->no != MONSTER_FACTION) { } else if (f->no != MONSTER_FACTION) {
nmrs[min(ORDERGAP,turn-f->lastorders)]++; nmrs[min(NMRTIMEOUT,turn-f->lastorders)]++;
} }
} }
for (i = 0; i != ORDERGAP+1; ++i) { for (i = 0; i != NMRTIMEOUT+1; ++i) {
if(i == ORDERGAP) { if(i == NMRTIMEOUT) {
fprintf(F, "+ NMRs:\t\t %d\n", nmrs[i]); fprintf(F, "+ NMRs:\t\t %d\n", nmrs[i]);
} else { } else {
fprintf(F, "%d %s:\t\t %d\n", i, fprintf(F, "%d %s:\t\t %d\n", i,
@ -3467,11 +3467,11 @@ report_summary(summary * s, summary * o, boolean full)
out_faction(F, f); out_faction(F, f);
} }
if(full) { if (full && NMRTIMEOUT) {
fprintf(F, "\n\nFactions with NMRs:\n"); fprintf(F, "\n\nFactions with NMRs:\n");
for (i = ORDERGAP; i > 0; --i) { for (i = NMRTIMEOUT; i > 0; --i) {
for(f=factions; f; f=f->next) { for(f=factions; f; f=f->next) {
if(i == ORDERGAP) { if(i == NMRTIMEOUT) {
if(turn - f->lastorders >= i) { if(turn - f->lastorders >= i) {
out_faction(F, f); out_faction(F, f);
} }

View File

@ -2407,6 +2407,8 @@ remove_empty_factions(void)
} }
} }
} }
fprintf(sqlstream, "UPDATE subscriptions set status='DEAD' where "
"faction='%s' and game=%d;", itoa36(f->no), GAME_ID);
stripfaction(f); stripfaction(f);
*fp = f->next; *fp = f->next;
free(f); free(f);

View File

@ -353,7 +353,6 @@ extern void plagues(struct region * r, boolean ismagic);
* von struct unitname, regionid, etc. zurückgegeben werden. ohne die 0 */ * von struct unitname, regionid, etc. zurückgegeben werden. ohne die 0 */
#define CMDSIZE (DISPLAYSIZE*2+1) #define CMDSIZE (DISPLAYSIZE*2+1)
#define STARTMONEY 5000 #define STARTMONEY 5000
#define ORDERGAP 4
#define PRODUCEEXP 10 #define PRODUCEEXP 10
#define MAINTENANCE 10 #define MAINTENANCE 10

View File

@ -8,12 +8,12 @@ CFG=kernel - Win32 Profile
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "kernel-6.mak". !MESSAGE NMAKE /f "kernel.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "kernel-6.mak" CFG="kernel - Win32 Profile" !MESSAGE NMAKE /f "kernel.mak" CFG="kernel - Win32 Profile"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
@ -73,7 +73,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LIB32=link.exe -lib LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"Debug\kernel.lib" # ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "kernel - Win32 Profile" !ELSEIF "$(CFG)" == "kernel - Win32 Profile"
@ -162,10 +162,6 @@ SOURCE=.\karma.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\laws.h
# End Source File
# Begin Source File
SOURCE=.\magic.h SOURCE=.\magic.h
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -1044,13 +1044,15 @@ travel(region * first, unit * u, region * next, int flucht)
/* r2 -> Zielregion, r3 -> Momentane Region */ /* r2 -> Zielregion, r3 -> Momentane Region */
if (move_blocked(u, current, reldirection(current, next)) if (move_blocked(u, current, reldirection(current, next))
|| is_spell_active(current, C_FOGTRAP)) || is_spell_active(current, C_FOGTRAP))
add_message(&u->faction->msgs, new_message(u->faction, {
"leavefail%u:unit%r:region", u, next)); ADDMSG(&u->faction->msgs, msg_message("leavefail",
"unit region", u, next));
}
if ((wache = bewegung_blockiert_von(u, current)) != (unit *) NULL if ((wache = bewegung_blockiert_von(u, current)) != (unit *) NULL
&& gereist != 0) && gereist != 0)
{ {
add_message(&u->faction->msgs, new_message(u->faction, ADDMSG(&u->faction->msgs, msg_message("moveblockedbyguard",
"moveblockedbyguard%u:unit%r:region%u:guard", u, current, "unit region guard", u, current,
wache)); wache));
break; break;
} }

View File

@ -1023,12 +1023,14 @@ readgame(boolean backup)
addlist2(fp, f); addlist2(fp, f);
if (f->age==1) { if (f->age==1) {
fprintf(sqlstream, "INSERT INTO users (id, email) VALUES (%d, '%s');\n", /*
f->unique_id, f->email); * fprintf(sqlstream, "INSERT INTO users (id, email) VALUES (%d, '%s');\n",
fprintf(sqlstream, "INSERT INTO factions (id, user, name, password, race, locale, lastorders, banner, email) " * f->unique_id, f->email);
"VALUES ('%s', %d, '%s', '%s', '%s', '%s', %u, '%s', '%s');\n", * fprintf(sqlstream, "INSERT INTO subscriptions (id, user, name, race) "
itoa36(f->no), f->unique_id, sqlquote(f->name), sqlquote(f->passw), f->race->_name[0], * "VALUES ('%s', %d, '%s', '%s', '%s', '%s', %u, '%s', '%s');\n",
locale_name(f->locale), f->lastorders, sqlquote(f->banner), f->email); * itoa36(f->no), f->unique_id, sqlquote(f->name), sqlquote(f->passw), f->race->_name[0],
* locale_name(f->locale), f->lastorders, sqlquote(f->banner), f->email);
*/
} }
} }
*fp = 0; *fp = 0;

View File

@ -19,6 +19,7 @@ struct fighter;
struct spell; struct spell;
struct border_type; struct border_type;
struct attrib_type; struct attrib_type;
struct curse_type;
struct castorder; struct castorder;
/* Sprüche. Neue NUR hinten anfügen, oder das Datenfile geht kaputt */ /* Sprüche. Neue NUR hinten anfügen, oder das Datenfile geht kaputt */

View File

@ -14,12 +14,13 @@
* Contains defines for the "free" game (Eressea) . * Contains defines for the "free" game (Eressea) .
* Include this file from settings.h to make eressea work. * Include this file from settings.h to make eressea work.
*/ */
#define GAME_ID 0
#define RESOURCE_CONVERSION 1 #define RESOURCE_CONVERSION 1
#define NEW_RESOURCEGROWTH 1 #define NEW_RESOURCEGROWTH 1
#define LARGE_CASTLES 1 #define LARGE_CASTLES 1
#define GROWING_TREES 1 #define GROWING_TREES 1
#define REMOVENMRNEWBIE 1 #define REMOVENMRNEWBIE 1
#define REMOVENMRTIMEOUT 1 #define NMRTIMEOUT 4
#define HUNGER_DISABLES_LONGORDERS 1 #define HUNGER_DISABLES_LONGORDERS 1
#define REDUCED_PEASANTGROWTH 1 #define REDUCED_PEASANTGROWTH 1
#define RACE_ADJUSTMENTS 1 #define RACE_ADJUSTMENTS 1

View File

@ -14,13 +14,18 @@
* Contains defines for the "classic" game (Vinyambar I) . * Contains defines for the "classic" game (Vinyambar I) .
* Include this file from settings.h to make eressea work. * Include this file from settings.h to make eressea work.
*/ */
#define GAME_ID 1
#define RESOURCE_CONVERSION 0 #define RESOURCE_CONVERSION 0
#define NEW_RESOURCEGROWTH 0 #define NEW_RESOURCEGROWTH 0
#define LARGE_CASTLES 0 #define LARGE_CASTLES 0
#define GROWING_TREES 0 #define GROWING_TREES 0
#define REMOVENMRNEWBIE 0 #define REMOVENMRNEWBIE 0
#define REMOVENMRTIMEOUT 0 #define NMRTIMEOUT 5
#define HUNGER_DISABLES_LONGORDERS 1 #define HUNGER_DISABLES_LONGORDERS 1
#define REDUCED_PEASANTGROWTH 0 #define REDUCED_PEASANTGROWTH 0
#define RACE_ADJUSTMENTS 0 #define RACE_ADJUSTMENTS 0
#define SKILLPOINTS 1
#define TEACHDIFFERENCE 1
#define PEASANT_ADJUSTMENT 0

View File

@ -14,13 +14,19 @@
* Contains defines for the "modern" vinyambar game. * Contains defines for the "modern" vinyambar game.
* Include this file from settings.h to make eressea work. * Include this file from settings.h to make eressea work.
*/ */
#define GAME_ID 2
#define RESOURCE_CONVERSION 1 #define RESOURCE_CONVERSION 1
#define NEW_RESOURCEGROWTH 1 #define NEW_RESOURCEGROWTH 1
#define LARGE_CASTLES 1 #define LARGE_CASTLES 1
#define GROWING_TREES 1 #define GROWING_TREES 1
#define REMOVENMRNEWBIE 0 #define REMOVENMRNEWBIE 0
#define REMOVENMRTIMEOUT 0 #define NMRTIMEOUT 5
#define HUNGER_DISABLES_LONGORDERS 0 #define HUNGER_DISABLES_LONGORDERS 0
#define REDUCED_PEASANTGROWTH 0 #define REDUCED_PEASANTGROWTH 0
#define RACE_ADJUSTMENTS 0 #define RACE_ADJUSTMENTS 0
#define SKILLPOINTS 1
#define TEACHDIFFERENCE 1
#define PEASANT_ADJUSTMENT 0