- merge with revision 4032 of eressea-1.0

- begin to implement morale
This commit is contained in:
Enno Rehling 2009-02-14 09:53:20 +00:00
parent ef883c23e0
commit 0907203821
27 changed files with 241 additions and 163 deletions

View file

@ -31,7 +31,7 @@ SERVER_SOURCES =
kernel.c kernel.c
stdafx.c stdafx.c
util.c util.c
main.cpp main.c
; ;
if $(MSPACES) { if $(MSPACES) {

5
src/combined/main.c Normal file
View file

@ -0,0 +1,5 @@
#include "common/settings.h"
#include "common/config.h"
#include "stdafx.h"
#include <eressea/server.c>

View file

@ -1 +0,0 @@
#include <eressea/server.cpp>

View file

@ -39,6 +39,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..;." AdditionalIncludeDirectories="..;."
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"

View file

@ -1109,7 +1109,7 @@ cr_output_region(FILE * F, report_context * ctx, seen_region * sr)
if (sr->mode!=see_unit) fprintf(F, "\"%s\";visibility\n", visibility[sr->mode]); if (sr->mode!=see_unit) fprintf(F, "\"%s\";visibility\n", visibility[sr->mode]);
{ {
faction * owner = region_owner(r); faction * owner = get_region_owner(r);
if (owner) { if (owner) {
fprintf(F, "%d;owner\n", owner->no); fprintf(F, "%d;owner\n", owner->no);
} }

View file

@ -2958,18 +2958,17 @@ entertain_cmd(unit * u, struct order * ord)
entertaining += o->qty; entertaining += o->qty;
} }
/* ------------------------------------------------------------- */ /**
* \return number of working spaces taken by players
*/
static void static void
expandwork(region * r, request * work_begin, request * work_end) expandwork(region * r, request * work_begin, request * work_end, int maxwork)
{ {
int n, earnings; int earnings;
/* n: verbleibende Einnahmen */ /* n: verbleibende Einnahmen */
/* m: maximale Arbeiter */ /* m: maximale Arbeiter */
int m = maxworkingpeasants(r); int jobs = maxwork;
int p_wage = wage(r, NULL, NULL); int p_wage = wage(r, NULL, NULL);
int verdienst = 0;
request *o; request *o;
for (o = work_begin; o != work_end; ++o) { for (o = work_begin; o != work_end; ++o) {
@ -2978,18 +2977,18 @@ expandwork(region * r, request * work_begin, request * work_end)
if (u->number == 0) continue; if (u->number == 0) continue;
if (m>=working) workers = u->number; if (jobs>=working) workers = u->number;
else { else {
workers = u->number * m / working; workers = u->number * jobs / working;
if (rng_int() % working < (u->number * m) % working) workers++; if (rng_int() % working < (u->number * jobs) % working) workers++;
} }
assert(workers>=0); assert(workers>=0);
u->n = workers * wage(u->region, u->faction, u->race); u->n = workers * wage(u->region, u->faction, u->race);
m -= workers; jobs -= workers;
assert(m>=0); assert(jobs>=0);
change_money(u, u->n); change_money(u, u->n);
working -= o->unit->number; working -= o->unit->number;
@ -2997,14 +2996,10 @@ expandwork(region * r, request * work_begin, request * work_end)
fset(u, UFL_LONGACTION|UFL_NOTMOVING); fset(u, UFL_LONGACTION|UFL_NOTMOVING);
} }
n = m * p_wage; if (jobs>rpeasants(r)) {
jobs = rpeasants(r);
/* Der Rest wird von den Bauern verdient. n ist das uebriggebliebene }
* Geld. */ earnings = jobs * p_wage;
earnings = MIN(n, rpeasants(r) * p_wage) + verdienst;
/* Mehr oder weniger durch Trank "Riesengrass" oder "Faulobstschnaps" */
rsetmoney(r, rmoney(r) + earnings); rsetmoney(r, rmoney(r) + earnings);
} }
@ -3140,7 +3135,42 @@ auto_work(region * r)
} }
} }
if (nextworker!=workers) { if (nextworker!=workers) {
expandwork(r, workers, nextworker); expandwork(r, workers, nextworker, maxworkingpeasants(r));
}
}
static void
peasant_taxes(region * r)
{
faction * f;
unit * u;
building * b;
int money;
int maxsize;
f = get_region_owner(r);
if (f==NULL) return;
money = rmoney(r);
if (money<=0) return;
b = largestbuilding(r, false);
if (b==NULL) return;
u = buildingowner(r, b);
if (u==NULL || u->faction!=f) return;
maxsize = buildingeffsize(b, false);
if (maxsize > r->land->morale) {
maxsize = r->land->morale;
}
if (maxsize>0) {
int taxmoney = (money * maxsize) / 100;
change_money(u, taxmoney);
rsetmoney(r, money - taxmoney);
ADDMSG(&u->faction->msgs, msg_message("income_tax",
"unit region amount", u, r, taxmoney));
} }
} }
@ -3152,7 +3182,8 @@ produce(void)
request *taxorders, *sellorders, *stealorders, *buyorders; request *taxorders, *sellorders, *stealorders, *buyorders;
unit *u; unit *u;
int todo; int todo;
int autowork = get_param_int(global.parameters, "work.auto", 0); int rule_taxation = get_param_int(global.parameters, "rules.economy.taxation", 0);
int rule_autowork = get_param_int(global.parameters, "work.auto", 0);
/* das sind alles befehle, die 30 tage brauchen, und die in thisorder /* das sind alles befehle, die 30 tage brauchen, und die in thisorder
* stehen! von allen 30-tage befehlen wird einfach der letzte verwendet * stehen! von allen 30-tage befehlen wird einfach der letzte verwendet
@ -3233,7 +3264,7 @@ produce(void)
break; break;
case K_WORK: case K_WORK:
if (!autowork && do_work(u, u->thisorder, nextworker)==0) { if (!rule_autowork && do_work(u, u->thisorder, nextworker)==0) {
++nextworker; ++nextworker;
} }
break; break;
@ -3270,7 +3301,9 @@ produce(void)
* letzten Runde berechnen kann, wieviel die Bauern für Unterhaltung * letzten Runde berechnen kann, wieviel die Bauern für Unterhaltung
* auszugeben bereit sind. */ * auszugeben bereit sind. */
if (entertaining) expandentertainment(r); if (entertaining) expandentertainment(r);
if (!autowork) expandwork(r, workers, nextworker); if (!rule_autowork) {
expandwork(r, workers, nextworker, maxworkingpeasants(r));
}
if (taxorders) expandtax(r, taxorders); if (taxorders) expandtax(r, taxorders);
/* An erster Stelle Kaufen (expandbuying), die Bauern so Geld bekommen, um /* An erster Stelle Kaufen (expandbuying), die Bauern so Geld bekommen, um
@ -3294,5 +3327,9 @@ produce(void)
assert(rmoney(r) >= 0); assert(rmoney(r) >= 0);
assert(rpeasants(r) >= 0); assert(rpeasants(r) >= 0);
if (r->land && rule_taxation==1) {
/* new taxation rules, region owners make money based on morale and building */
peasant_taxes(r);
}
} }
} }

View file

@ -187,7 +187,7 @@ get_food(region *r)
{ {
unit *u; unit *u;
int peasantfood = rpeasants(r)*10; int peasantfood = rpeasants(r)*10;
faction * owner = region_owner(r); faction * owner = get_region_owner(r);
/* 1. Versorgung von eigenen Einheiten. Das vorhandene Silber /* 1. Versorgung von eigenen Einheiten. Das vorhandene Silber
* wird zunächst so auf die Einheiten aufgeteilt, dass idealerweise * wird zunächst so auf die Einheiten aufgeteilt, dass idealerweise

View file

@ -996,7 +996,7 @@ describe(FILE * F, const seen_region * sr, faction * f)
} }
{ {
const faction * owner = region_owner(r); const faction * owner = get_region_owner(r);
if (owner!=NULL) { if (owner!=NULL) {
bytes = snprintf(bufp, size, " Die Region ist im Besitz von %s.", bytes = snprintf(bufp, size, " Die Region ist im Besitz von %s.",
factionname(owner)); factionname(owner));

View file

@ -39,6 +39,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..;." AdditionalIncludeDirectories="..;."
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"

View file

@ -762,8 +762,7 @@ weapon_effskill(troop t, troop enemy, const weapon * w, boolean attacking, boole
static const armor_type * static const armor_type *
select_armor(troop t, boolean shield) select_armor(troop t, boolean shield)
{ {
unsigned int type = shield?ATF_SHIELD:0; unsigned int type = shield?ATF_SHIELD:0; unit * u = t.fighter->unit;
unit * u = t.fighter->unit;
const armor * a = t.fighter->armors; const armor * a = t.fighter->armors;
int geschuetzt = 0; int geschuetzt = 0;
@ -777,16 +776,13 @@ select_armor(troop t, boolean shield)
} }
for (;a;a=a->next) { for (;a;a=a->next) {
if ((a->atype->flags & ATF_SHIELD)==type) { if ((a->atype->flags & ATF_SHIELD)==type) { geschuetzt += a->count;
geschuetzt += a->count;
if (geschuetzt > t.index) { if (geschuetzt > t.index) {
/* unser Kandidat wird geschuetzt */ /* unser Kandidat wird geschuetzt */
return a->atype; return a->atype;
} }
} }
} } return NULL;
return NULL;
} }

View file

@ -1628,7 +1628,7 @@ cstring(const char *s)
} }
building * building *
largestbuilding (const region * r, boolean img) largestbuilding (const region * r, boolean imaginary)
{ {
static const building_type * btype = NULL; static const building_type * btype = NULL;
building *b, *best = NULL; building *b, *best = NULL;
@ -1638,7 +1638,7 @@ largestbuilding (const region * r, boolean img)
for (b = rbuildings(r); b; b = b->next) { for (b = rbuildings(r); b; b = b->next) {
if (b->type!=btype) { if (b->type!=btype) {
if (img) { if (imaginary) {
const attrib * a = a_find(b->attribs, &at_icastle); const attrib * a = a_find(b->attribs, &at_icastle);
if (!a) continue; if (!a) continue;
if (a->data.v != btype) continue; if (a->data.v != btype) continue;

View file

@ -247,7 +247,7 @@ extern char *cstring_i(char *s);
extern const char *unitname(const struct unit * u); extern const char *unitname(const struct unit * u);
extern char * write_unitname(const struct unit * u, char * buffer, size_t size); extern char * write_unitname(const struct unit * u, char * buffer, size_t size);
struct building *largestbuilding(const struct region * r, boolean img); struct building *largestbuilding(const struct region * r, boolean imaginary);
extern int count_all(const struct faction * f); extern int count_all(const struct faction * f);
extern int count_migrants (const struct faction * f); extern int count_migrants (const struct faction * f);

View file

@ -198,7 +198,7 @@ static boolean
entrance_allowed(const struct unit * u, const struct region * r) entrance_allowed(const struct unit * u, const struct region * r)
{ {
#ifdef REGIONOWNERS #ifdef REGIONOWNERS
faction * owner = region_owner(r); faction * owner = get_region_owner(r);
if (owner == NULL || u->faction == owner) return true; if (owner == NULL || u->faction == owner) return true;
if (alliedfaction(r->planep, owner, u->faction, HELP_TRAVEL)) return true; if (alliedfaction(r->planep, owner, u->faction, HELP_TRAVEL)) return true;
return false; return false;

View file

@ -1132,6 +1132,8 @@ terraform_region(region * r, const terrain_type * terrain)
int mnr = 0; int mnr = 0;
r->land = calloc(1, sizeof(land_region)); r->land = calloc(1, sizeof(land_region));
r->land->morale = MORALE_DEFAULT;
r->land->ownership = NULL;
region_setname(r, makename()); region_setname(r, makename());
for (d=0;d!=MAXDIRECTIONS;++d) { for (d=0;d!=MAXDIRECTIONS;++d) {
region * nr = rconnect(r, d); region * nr = rconnect(r, d);
@ -1324,24 +1326,21 @@ r_addmessage(struct region * r, const struct faction * viewer, struct message *
} }
struct faction * struct faction *
region_owner(const struct region * r) get_region_owner(const struct region * r)
{ {
#ifdef REGIONOWNERS if (r->land && r->land->ownership) {
return r->owner; return r->land->ownership->owner;
#else }
return NULL; return NULL;
#endif
} }
void void
region_setowner(struct region * r, struct faction * owner) set_region_owner(struct region * r, struct faction * owner, int turn)
{ {
#ifdef REGIONOWNERS if (r->land && r->land->ownership) {
r->owner = owner; r->land->ownership->owner = owner;
#else r->land->ownership->since_turn = turn;
unused(r); }
unused(owner);
#endif
} }
void void

View file

@ -62,6 +62,13 @@ struct rawmaterial;
struct donation; struct donation;
struct item; struct item;
#define MORALE_DEFAULT 2 /* Morale of peasants that have no lord */
typedef struct region_owner {
struct faction * owner;
int since_turn;
} region_owner;
typedef struct land_region { typedef struct land_region {
char *name; char *name;
/* TODO: demand kann nach Konvertierung entfernt werden. */ /* TODO: demand kann nach Konvertierung entfernt werden. */
@ -72,12 +79,14 @@ typedef struct land_region {
} * demands; } * demands;
const struct item_type * herbtype; const struct item_type * herbtype;
short herbs; short herbs;
unsigned short morale;
int trees[3]; /* 0 -> seeds, 1 -> shoots, 2 -> trees */ int trees[3]; /* 0 -> seeds, 1 -> shoots, 2 -> trees */
int horses; int horses;
int peasants; int peasants;
int newpeasants; int newpeasants;
int money; int money;
struct item * items; /* items that can be claimed */ struct item * items; /* items that can be claimed */
struct region_owner * ownership;
} land_region; } land_region;
typedef struct donation { typedef struct donation {
@ -112,9 +121,6 @@ typedef struct region {
struct donation * donations; struct donation * donations;
const struct terrain_type * terrain; const struct terrain_type * terrain;
struct rawmaterial * resources; struct rawmaterial * resources;
#ifdef REGIONOWNERS
struct faction * owner;
#endif
#ifdef FAST_CONNECT #ifdef FAST_CONNECT
struct region * connect[MAXDIRECTIONS]; /* use rconnect(r, dir) to access */ struct region * connect[MAXDIRECTIONS]; /* use rconnect(r, dir) to access */
#endif #endif
@ -226,8 +232,8 @@ extern const short delta_y[MAXDIRECTIONS];
direction_t dir_invert(direction_t dir); direction_t dir_invert(direction_t dir);
int production(const struct region *r); int production(const struct region *r);
void region_setowner(struct region * r, struct faction * owner); void set_region_owner(struct region * r, struct faction * owner, int turn);
struct faction * region_owner(const struct region * r); struct faction * get_region_owner(const struct region * r);
struct region * r_connect(const struct region *, direction_t dir); struct region * r_connect(const struct region *, direction_t dir);
#ifdef FAST_CONNECT #ifdef FAST_CONNECT

View file

@ -3739,6 +3739,35 @@ sp_analysesong_unit(castorder *co)
return cast_level; return cast_level;
} }
static boolean
can_charm(const unit * u, int maxlevel)
{
const skill_t expskills[] = { SK_ALCHEMY, SK_HERBALISM, SK_MAGIC, SK_SPY, SK_TACTICS, NOSKILL };
skill * sv = u->skills;
if (fval(u, UFL_HERO)) return false;
for (;sv!=u->skills+u->skill_size;++sv) {
int l = 0, h = 5;
skill_t sk = sv->id;
assert(expskills[h]==NOSKILL);
while (l<h) {
int m = (l+h)/2;
if (sk==expskills[m]) {
if (skill_limit(u->faction, sk)!=INT_MAX) {
return false;
} else if ((int)sv->level>maxlevel) {
return false;
}
break;
}
else if (sk>expskills[m]) l=m+1;
else h=m;
}
}
return true;
}
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Name: Charming /* Name: Charming
* Stufe: 13 * Stufe: 13
@ -3789,7 +3818,7 @@ sp_charmingsong(castorder *co)
cmistake(mage, co->order, 45, MSG_MAGIC); cmistake(mage, co->order, 45, MSG_MAGIC);
} }
/* niemand mit teurem Talent */ /* niemand mit teurem Talent */
if (has_limited_skills(target)) { if (!can_charm(target, cast_level/2)) {
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order,
"spellfail_noexpensives", "target", target)); "spellfail_noexpensives", "target", target));
return 0; return 0;

View file

@ -39,6 +39,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..;." AdditionalIncludeDirectories="..;."
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"

View file

@ -380,9 +380,9 @@ size_t dlmalloc_usable_size(void*);
*/ */
#ifndef USE_DL_PREFIX #ifndef USE_DL_PREFIX
void malloc_stats(); void malloc_stats(void);
#else #else
void dlmalloc_stats(); void dlmalloc_stats(void);
#endif #endif
/* /*

View file

@ -43,6 +43,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories=".;common" AdditionalIncludeDirectories=".;common"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
@ -183,19 +184,6 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath=".\combined\bindings.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PrecompiledHeaderThrough="stdafx.hpp"
PrecompiledHeaderFile="$(IntDir)\$(TargetName)_cpp.pch"
/>
</FileConfiguration>
</File>
<File <File
RelativePath=".\combined\curses.c" RelativePath=".\combined\curses.c"
> >
@ -208,6 +196,10 @@
RelativePath=".\combined\kernel.c" RelativePath=".\combined\kernel.c"
> >
</File> </File>
<File
RelativePath=".\combined\main.c"
>
</File>
<File <File
RelativePath=".\combined\stdafx.c" RelativePath=".\combined\stdafx.c"
> >
@ -221,31 +213,6 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath=".\combined\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
PrecompiledHeaderThrough="stdafx.hpp"
PrecompiledHeaderFile="$(IntDir)\$(TargetName)_cpp.pch"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File <File
RelativePath=".\combined\util.c" RelativePath=".\combined\util.c"
> >
@ -268,10 +235,6 @@
RelativePath=".\combined\stdafx.h" RelativePath=".\combined\stdafx.h"
> >
</File> </File>
<File
RelativePath=".\combined\stdafx.hpp"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Resource Files" Name="Resource Files"

View file

@ -39,6 +39,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..;../common" AdditionalIncludeDirectories="..;../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"

View file

@ -39,6 +39,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..;../common" AdditionalIncludeDirectories="..;../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
@ -385,7 +386,7 @@
> >
</File> </File>
<File <File
RelativePath=".\server.cpp" RelativePath=".\server.c"
> >
</File> </File>
</Files> </Files>

View file

@ -39,6 +39,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../..;../../common" AdditionalIncludeDirectories="../..;../../common"
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"

View file

@ -63,12 +63,12 @@ region_getterrain(const region * r) {
static void static void
lua_region_setowner(region * r, faction * f) { lua_region_setowner(region * r, faction * f) {
region_setowner(r, f); set_region_owner(r, f, turn);
} }
static faction * static faction *
lua_region_getowner(const region * r) { lua_region_getowner(const region * r) {
return region_owner(r); return get_region_owner(r);
} }
static void static void

View file

@ -98,7 +98,9 @@
/* lua includes */ /* lua includes */
#ifdef BINDINGS_TOLUA #ifdef BINDINGS_TOLUA
#include <lua.hpp> #include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include "tolua/bindings.h" #include "tolua/bindings.h"
#include "tolua/helpers.h" #include "tolua/helpers.h"
#include "tolua/bind_unit.h" #include "tolua/bind_unit.h"
@ -129,19 +131,15 @@
#include <libxml/encoding.h> #include <libxml/encoding.h>
/* stdc++ includes */
#include <stdexcept>
#include <string>
#include <sstream>
/* libc includes */ /* libc includes */
#include <cstdio> #include <stdio.h>
#include <cassert> #include <assert.h>
#include <cctype> #include <ctype.h>
#include <climits> #include <wctype.h>
#include <clocale> #include <limits.h>
#include <cstring> #include <locale.h>
#include <ctime> #include <string.h>
#include <time.h>
#if defined(_MSC_VER) #if defined(_MSC_VER)
# include <crtdbg.h> # include <crtdbg.h>
@ -150,7 +148,6 @@
/** /**
** global variables we are importing from other modules ** global variables we are importing from other modules
**/ **/
extern "C" {
extern const char * g_reportdir; extern const char * g_reportdir;
extern const char * g_datadir; extern const char * g_datadir;
extern const char * g_basedir; extern const char * g_basedir;
@ -163,7 +160,6 @@ extern "C" {
extern int loadplane; extern int loadplane;
extern boolean opt_cr_absolute_coords; extern boolean opt_cr_absolute_coords;
}
/** /**
** global variables that we are exporting ** global variables that we are exporting
@ -561,7 +557,7 @@ my_lua_error(lua_State * L)
log_error(("A LUA error occured: %s\n", error)); log_error(("A LUA error occured: %s\n", error));
lua_pop(L, 1); lua_pop(L, 1);
if (!g_ignore_errors) std::terminate(); if (!g_ignore_errors) abort();
return 1; return 1;
} }
@ -603,8 +599,8 @@ main(int argc, char *argv[])
int i; int i;
char * lc_ctype; char * lc_ctype;
char * lc_numeric; char * lc_numeric;
lua_State * luaState = lua_init();
rng_init((unsigned long)time(0));
setup_signal_handler(); setup_signal_handler();
sqlpatch = true; sqlpatch = true;
@ -616,7 +612,6 @@ main(int argc, char *argv[])
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();
global.vm_state = luaState; global.vm_state = luaState;
load_inifile("eressea.ini"); load_inifile("eressea.ini");
if (verbosity>=4) { if (verbosity>=4) {

View file

@ -104,6 +104,9 @@
<param name="rules.combat.turns" value="1"/> <param name="rules.combat.turns" value="1"/>
<param name="rules.combat.unarmed_bonus" value="0"/> <param name="rules.combat.unarmed_bonus" value="0"/>
<param name="rules.combat.populationdamage" value="0"/> <param name="rules.combat.populationdamage" value="0"/>
<param name="rules.economy.taxation" value="1"/>
<param name="rules.give" value="3"/> <!-- only self + peasants --> <param name="rules.give" value="3"/> <!-- only self + peasants -->
<param name="rules.stamina" value="0"/> <!-- does not affect hp --> <param name="rules.stamina" value="0"/> <!-- does not affect hp -->
<param name="skill.maxlevel" value="10"/> <param name="skill.maxlevel" value="10"/>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<terrains> <terrains>
<!-- defaults: walk="yes" sail="yes" fly="yes" shallow="yes" swim="no" forest="no" sea="no" land="yes" forbidden="no" arctic="no" cavalry="no" --> <!-- defaults: walk="yes" sail="yes" fly="yes" shallow="yes" swim="no" forest="no" sea="no" land="yes" forbidden="no" arctic="no" cavalry="no" -->
<terrain name="ocean" size="100" shallow="no" walk="no" swim="yes" land="no" sea="yes" /> <terrain name="ocean" size="0" shallow="no" walk="no" swim="yes" land="no" sea="yes" />
<terrain name="plain" size="2400" road="50" shallow="no" forest="yes" cavalry="yes" seed="3"> <terrain name="plain" size="200" road="50" shallow="no" forest="yes" cavalry="yes" seed="3">
<herb name="h0" /> <herb name="h0" />
<herb name="h1" /> <herb name="h1" />
<herb name="h2" /> <herb name="h2" />
@ -13,7 +13,7 @@
<resource name="stone" chance="0.15" level="1d4" base="5d8" div="2d30+20" /> <resource name="stone" chance="0.15" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.01" level="1d4" base="1d4" div="2d20+50" /> <resource name="laen" chance="0.01" level="1d4" base="1d4" div="2d20+50" />
</terrain> </terrain>
<terrain name="swamp" size="800" road="75" seed="2"> <terrain name="swamp" size="80" road="75" seed="2">
<herb name="h6" /> <herb name="h6" />
<herb name="h7" /> <herb name="h7" />
<herb name="h8" /> <herb name="h8" />
@ -21,7 +21,7 @@
<resource name="stone" chance="0.02" level="1d4" base="5d8" div="2d30+20" /> <resource name="stone" chance="0.02" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.02" level="1d4" base="1d4" div="2d20+50" /> <resource name="laen" chance="0.02" level="1d4" base="1d4" div="2d20+50" />
</terrain> </terrain>
<terrain name="desert" size="800" road="100" cavalry="yes" seed="2"> <terrain name="desert" size="80" road="100" cavalry="yes" seed="2">
<herb name="h9" /> <herb name="h9" />
<herb name="h10" /> <herb name="h10" />
<herb name="h11" /> <herb name="h11" />
@ -29,7 +29,7 @@
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" /> <resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" /> <resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain> </terrain>
<terrain name="highland" size="1600" road="100" cavalry="yes" seed="2"> <terrain name="highland" size="150" road="100" cavalry="yes" seed="2">
<herb name="h12" /> <herb name="h12" />
<herb name="h13" /> <herb name="h13" />
<herb name="h14" /> <herb name="h14" />
@ -37,7 +37,7 @@
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" /> <resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" /> <resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain> </terrain>
<terrain name="mountain" size="800" road="250" seed="2"> <terrain name="mountain" size="80" road="250" seed="2">
<herb name="h15" /> <herb name="h15" />
<herb name="h16" /> <herb name="h16" />
<herb name="h17" /> <herb name="h17" />
@ -45,7 +45,7 @@
<resource name="stone" chance="1.0" level="1" base="100" div="100" /> <resource name="stone" chance="1.0" level="1" base="100" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" /> <resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain> </terrain>
<terrain name="glacier" size="400" road="250" arctic="yes" seed="2"> <terrain name="glacier" size="10" road="250" arctic="yes" seed="2">
<herb name="h18" /> <herb name="h18" />
<herb name="h19" /> <herb name="h19" />
<herb name="h20" /> <herb name="h20" />
@ -53,7 +53,7 @@
<resource name="stone" chance="1.0" level="1" base="2" div="100" /> <resource name="stone" chance="1.0" level="1" base="2" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" /> <resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain> </terrain>
<terrain name="iceberg_sleep" size="100" road="250" arctic="yes"> <terrain name="iceberg_sleep" size="10" road="250" arctic="yes">
<herb name="h18" /> <herb name="h18" />
<herb name="h19" /> <herb name="h19" />
<herb name="h20" /> <herb name="h20" />
@ -61,22 +61,22 @@
<resource name="stone" chance="0.9" level="1" base="2" div="100" /> <resource name="stone" chance="0.9" level="1" base="2" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" /> <resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain> </terrain>
<terrain name="iceberg" size="100" arctic="yes"> <terrain name="iceberg" size="10" arctic="yes">
<herb name="h18" /> <herb name="h18" />
<herb name="h19" /> <herb name="h19" />
<herb name="h20" /> <herb name="h20" />
<resource name="iron" chance="0.9" level="1" base="3" div="50" /> <resource name="iron" chance="0.9" level="1" base="3" div="50" />
<resource name="stone" chance="0.9" level="1" base="2" div="100" /> <resource name="stone" chance="0.9" level="1" base="2" div="100" />
</terrain> </terrain>
<terrain name="firewall" size="100" road="250" land="no" walk="no" sail="no" fly="no" forbidden="yes" /> <terrain name="firewall" size="0" land="no" walk="no" sail="no" fly="no" forbidden="yes" />
<terrain name="fog" sail="no" land="no" size="0" /> <terrain name="fog" sail="no" land="no" size="0" />
<terrain name="thickfog" forbidden="yes" sail="no" walk="no" fly="no" land="no" size="0" /> <terrain name="thickfog" forbidden="yes" sail="no" walk="no" fly="no" land="no" size="0" />
<terrain name="volcano" size="500" road="250" seed="1"> <terrain name="volcano" size="30" road="250" seed="1">
<resource name="iron" chance="0.5" level="1" base="50" div="50" /> <resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" /> <resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" /> <resource name="laen" chance="0.075" level="1" base="4" div="100" />
</terrain> </terrain>
<terrain name="activevolcano" size="500" road="250"> <terrain name="activevolcano" size="30" road="250">
<resource name="iron" chance="0.5" level="1" base="50" div="50" /> <resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" /> <resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" /> <resource name="laen" chance="0.075" level="1" base="4" div="100" />

View file

@ -1,3 +1,43 @@
local function email_multis()
local multis = {
["u9bx"]="Tachlaar@web.de",
["7Lwz"]="Tachlaar@web.de",
["ddr"]="Tachlaar@web.de",
["myrd"]="Tachlaar@web.de",
["2a4v"]="Samurai_krieger@web.de",
["7oiw"]="Samurai_krieger@web.de",
["brud"]="Samurai_krieger@web.de",
["bzcm"]="Samurai_krieger@web.de",
["crow"]="Samurai_krieger@web.de",
["dino"]="Samurai_krieger@web.de",
["fynd"]="Samurai_krieger@web.de",
["Leer"]="Samurai_krieger@web.de",
["moos"]="Samurai_krieger@web.de",
["ogcL"]="Samurai_krieger@web.de",
["paty"]="Samurai_krieger@web.de",
["rd"]="Samurai_krieger@web.de",
["seee"]="Samurai_krieger@web.de",
["szem"]="Samurai_krieger@web.de",
["uebL"]="Samurai_krieger@web.de",
["uvzp"]="Samurai_krieger@web.de",
["wzLp"]="Samurai_krieger@web.de",
["ziwe"]="Samurai_krieger@web.de"
}
local k
local v
for k, info in pairs(multis) do
local f = get_faction(atoi36(k))
if f~=nil then
print("- marking " .. tostring(f) .. " as a multi-player.")
f.email = v
f.password = ""
f.info = info
else
print("- could not find faction " .. k)
end
end
end
local function kill_multis() local function kill_multis()
local multis = { local multis = {
["u9bx"]="Doppelspiel-Partei von Tachlaar@web.de", ["u9bx"]="Doppelspiel-Partei von Tachlaar@web.de",
@ -39,4 +79,4 @@ local function kill_multis()
end end
print("killing multi-players") print("killing multi-players")
kill_multis() email_multis()