Merge remote-tracking branch 'eressea/server'

This commit is contained in:
TomBraun 2014-06-27 07:35:21 +02:00
commit b346788e43
10 changed files with 69 additions and 17 deletions

View File

@ -3,7 +3,7 @@
Version="10.0" Version="10.0"
VendorName="SlickEdit" VendorName="SlickEdit"
TemplateName="GNU C/C++" TemplateName="GNU C/C++"
WorkingDir="." WorkingDir="../"
BuildSystem="vsbuild"> BuildSystem="vsbuild">
<Config <Config
Name="Debug" Name="Debug"
@ -69,7 +69,9 @@
Deletable="0" Deletable="0"
SaveOption="SaveNone" SaveOption="SaveNone"
RunFromDir="%rw"> RunFromDir="%rw">
<Exec CmdLine='vsdebugio -prog "%o"'/> <Exec
CmdLine='vsdebugio -prog "%o" %~other'
OtherOptions="scripts/runtests.lua"/>
</Target> </Target>
<Target <Target
Name="Execute" Name="Execute"
@ -79,9 +81,10 @@
CaptureOutputWith="ProcessBuffer" CaptureOutputWith="ProcessBuffer"
Deletable="0" Deletable="0"
SaveOption="SaveWorkspaceFiles" SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw" RunFromDir="%rw">
RunInXterm="1"> <Exec
<Exec CmdLine='"%o"'/> CmdLine='"%o" %~other'
OtherOptions="scripts/runtests.lua"/>
</Target> </Target>
<Target <Target
Name="dash" Name="dash"
@ -194,7 +197,9 @@
Deletable="0" Deletable="0"
SaveOption="SaveNone" SaveOption="SaveNone"
RunFromDir="%rw"> RunFromDir="%rw">
<Exec CmdLine='vsdebugio -prog "%o"'/> <Exec
CmdLine='vsdebugio -prog "%o" %~other'
OtherOptions="scripts/runtests.lua"/>
</Target> </Target>
<Target <Target
Name="Execute" Name="Execute"
@ -204,9 +209,10 @@
CaptureOutputWith="ProcessBuffer" CaptureOutputWith="ProcessBuffer"
Deletable="0" Deletable="0"
SaveOption="SaveWorkspaceFiles" SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw" RunFromDir="%rw">
RunInXterm="1"> <Exec
<Exec CmdLine='"%o"'/> CmdLine='"%o" %~other'
OtherOptions="scripts/runtests.lua"/>
</Target> </Target>
<Target <Target
Name="dash" Name="dash"
@ -282,6 +288,7 @@
<F N="../src/config.pkg.c"/> <F N="../src/config.pkg.c"/>
<F N="../src/console.c"/> <F N="../src/console.c"/>
<F N="../src/eressea.pkg.c"/> <F N="../src/eressea.pkg.c"/>
<F N="../src/game.pkg.c"/>
<F N="../src/gmtool.c"/> <F N="../src/gmtool.c"/>
<F N="../src/helpers.c"/> <F N="../src/helpers.c"/>
<F N="../src/listbox.c"/> <F N="../src/listbox.c"/>

View File

@ -21,7 +21,9 @@ static char *strip(char *str) {
for (; *b && isspace(*b); ++b) {}; for (; *b && isspace(*b); ++b) {};
for (e = b; *e && !isspace(*e); ++e) {}; for (e = b; *e && !isspace(*e); ++e) {};
while (*b) { while (*b) {
if (s!=b) {
memcpy(s, b, e - b); memcpy(s, b, e - b);
}
s += e - b; s += e - b;
for (b = e; *b && isspace(*b); ++b) {}; for (b = e; *b && isspace(*b); ++b) {};
for (e = b; *e && !isspace(*e); ++e) {}; for (e = b; *e && !isspace(*e); ++e) {};

View File

@ -117,8 +117,13 @@ extern "C" {
typedef struct weapon { typedef struct weapon {
int count, used; int count, used;
const struct weapon_type *type; const struct weapon_type *type;
# ifdef LOMEM
int attackskill:8; int attackskill:8;
int defenseskill:8; int defenseskill:8;
# else
int attackskill;
int defenseskill;
# endif
} weapon; } weapon;
/*** fighter::person::flags ***/ /*** fighter::person::flags ***/
@ -165,6 +170,7 @@ extern "C" {
int catmsg; /* Merkt sich, ob Katapultmessage schon generiert. */ int catmsg; /* Merkt sich, ob Katapultmessage schon generiert. */
struct person { struct person {
int hp; /* Trefferpunkte der Personen */ int hp; /* Trefferpunkte der Personen */
#ifdef LOMEM
int attack:8; /* (Magie) Attackenbonus der Personen */ int attack:8; /* (Magie) Attackenbonus der Personen */
int defence:8; /* (Magie) Paradenbonus der Personen */ int defence:8; /* (Magie) Paradenbonus der Personen */
int damage:8; /* (Magie) Schadensbonus der Personen im Nahkampf */ int damage:8; /* (Magie) Schadensbonus der Personen im Nahkampf */
@ -174,6 +180,16 @@ extern "C" {
int reload:4; /* Anzahl Runden, die die Waffe x noch laden muss. int reload:4; /* Anzahl Runden, die die Waffe x noch laden muss.
* dahinter steckt ein array[RL_MAX] wenn er min. eine hat. */ * dahinter steckt ein array[RL_MAX] wenn er min. eine hat. */
int last_action:4; /* In welcher Runde haben wir zuletzt etwas getan */ int last_action:4; /* In welcher Runde haben wir zuletzt etwas getan */
#else
int attack;
int defence;
int damage;
int damage_rear;
int flags;
int speed;
int reload;
int last_action;
#endif
struct weapon *missile; /* missile weapon */ struct weapon *missile; /* missile weapon */
struct weapon *melee; /* melee weapon */ struct weapon *melee; /* melee weapon */
} *person; } *person;

View File

@ -2103,7 +2103,7 @@ bool faction_id_is_unused(int id)
int weight(const unit * u) int weight(const unit * u)
{ {
int w, n = 0, in_bag = 0; int w = 0, n = 0, in_bag = 0;
const resource_type *rtype = get_resourcetype(R_SACK_OF_CONSERVATION); const resource_type *rtype = get_resourcetype(R_SACK_OF_CONSERVATION);
item *itm; item *itm;
@ -2120,8 +2120,8 @@ int weight(const unit * u)
if (rtype) { if (rtype) {
w = i_get(u->items, rtype->itype) * BAGCAPACITY; w = i_get(u->items, rtype->itype) * BAGCAPACITY;
if (w > in_bag) w = in_bag; if (w > in_bag) w = in_bag;
}
n -= w; n -= w;
}
return n; return n;
} }

View File

@ -260,9 +260,6 @@ void json_race(cJSON *json, race *rc) {
else if (strcmp(child->string, "weight")==0) { else if (strcmp(child->string, "weight")==0) {
rc->weight = child->valueint; rc->weight = child->valueint;
} }
else if (strcmp(child->string, "speed")==0) {
rc->speed = child->valueint;
}
else if (strcmp(child->string, "capacity")==0) { else if (strcmp(child->string, "capacity")==0) {
rc->capacity = child->valueint; rc->capacity = child->valueint;
} }

View File

@ -45,8 +45,13 @@ static int nlocales = 0;
typedef struct order_data { typedef struct order_data {
char *_str; char *_str;
# ifdef LOMEM
int _refcount:20; int _refcount:20;
int _lindex:4; int _lindex:4;
# else
int _refcount;
int _lindex;
# endif
keyword_t _keyword; keyword_t _keyword;
} order_data; } order_data;

View File

@ -22,12 +22,21 @@ extern "C" {
typedef struct rawmaterial { typedef struct rawmaterial {
const struct rawmaterial_type *type; const struct rawmaterial_type *type;
#ifdef LOMEM
int amount:16; int amount:16;
int level:8; int level:8;
int flags:8; int flags:8;
int base:8; int base:8;
int divisor:8; int divisor:8;
int startlevel:8; int startlevel:8;
#else
int amount;
int level;
int flags;
int base;
int divisor;
int startlevel;
#endif
struct rawmaterial *next; struct rawmaterial *next;
} rawmaterial; } rawmaterial;

View File

@ -25,10 +25,17 @@ extern "C" {
#define SMF_RIDING (1<<2) /* Bonus für berittene - an der rasse */ #define SMF_RIDING (1<<2) /* Bonus für berittene - an der rasse */
typedef struct skill { typedef struct skill {
#ifdef LOMEM
int id:8; int id:8;
unsigned int level:8; unsigned int level:8;
unsigned int weeks:8; unsigned int weeks:8;
unsigned int old:8; unsigned int old:8;
#else
int id;
unsigned int level;
unsigned int weeks;
unsigned int old;
#endif
} skill; } skill;
typedef int (*skillmod_fun) (const struct unit *, const struct region *, typedef int (*skillmod_fun) (const struct unit *, const struct region *,

View File

@ -19,6 +19,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CONFIG_H #ifndef CONFIG_H
#define CONFIG_H #define CONFIG_H
#ifdef NDEBUG
#define LOMEM
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
# define VC_EXTRALEAN # define VC_EXTRALEAN
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN

View File

@ -9,7 +9,12 @@ function setup()
eressea.settings.set("rules.ships.storms", "0") eressea.settings.set("rules.ships.storms", "0")
conf = [[{ conf = [[{
"races": { "races": {
"human" : { "speed" : 1, "flags" : [ "walk" ] }, "human" : {
"speed" : 1,
"weight" : 1000,
"capacity" : 1500,
"flags" : [ "walk" ]
},
"troll" : {} "troll" : {}
}, },
"items" : { "items" : {
@ -44,7 +49,7 @@ end
function test_walk_to_land() function test_walk_to_land()
local r1 = region.create(0, 0, "plain") local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain") local r2 = region.create(1, 0, "plain")
local f = faction.create("test@example.com", "human", "de") local f = faction.create("walk@example.com", "human", "de")
local u = unit.create(f, r1, 1) local u = unit.create(f, r1, 1)
u:add_order("NACH O") u:add_order("NACH O")
process_orders() process_orders()