diff --git a/cutest b/cutest index d83cec09a..788659594 160000 --- a/cutest +++ b/cutest @@ -1 +1 @@ -Subproject commit d83cec09a52835274ab8ed4849de16fb8658982a +Subproject commit 788659594ef87e9f497b8039da764182adfd2943 diff --git a/process/cron/run-eressea b/process/cron/run-eressea new file mode 100755 index 000000000..afd019018 --- /dev/null +++ b/process/cron/run-eressea @@ -0,0 +1,31 @@ +#!/bin/sh +GAME=$1 +BIN=$HOME/bin +export ERESSEA=$HOME/eressea +export PATH +TURN=$(cat $ERESSEA/game-$GAME) +if [ ! -e $ERESSEA/game-$GAME/data/$TURN.dat ]; then + echo "data file $TURN is missing, cannot run turn for game $GAME" + exit 1 +fi +$REPORTS=$ERESSEA/game-$GAME/reports +if [ -d $REPORTS ]; then + rm -rf $REPORTS +fi +mkdir $REPORTS +$BIN/run-turn.sh $GAME +if [ ! -s $ERESSEA/game-$GAME/orders.$TURN ]; then + echo "server did not create orders for turn $TURN in game $GAME" + exit 2 +fi +LET TURN=$TURN+1 +if [ ! -s $ERESSEA/game-$GAME/data/$TURN.dat ]; then + echo "server did not create data for turn $TURN in game $GAME" + exit 3 +fi +if [ ! -s $REPORTS/reports.txt ]; then + echo "server did not create reports.txt for turn $TURN in game $GAME" + exit 4 +fi +$BIN/compress.sh $GAME $TURN +$BIN/sendreports.sh $GAME diff --git a/src/kernel/alliance.h b/src/kernel/alliance.h index 04871c50a..e2562c1f3 100644 --- a/src/kernel/alliance.h +++ b/src/kernel/alliance.h @@ -46,7 +46,7 @@ extern "C" { struct alliance *next; struct faction *_leader; struct quicklist *members; - unsigned int flags; + int flags; int id; char *name; struct ally *allies; diff --git a/src/kernel/building.h b/src/kernel/building.h index f78ba1db8..c91fa01df 100644 --- a/src/kernel/building.h +++ b/src/kernel/building.h @@ -34,7 +34,7 @@ extern "C" { typedef struct maintenance { const struct resource_type *rtype; /* type of resource required */ int number; /* amount of resources */ - unsigned int flags; /* misc. flags */ + int flags; /* misc. flags */ } maintenance; /* building_type::flags */ @@ -112,7 +112,7 @@ extern "C" { int size; int sizeleft; /* is only used during battle. should be a temporary attribute */ int besieged; /* should be an attribute */ - unsigned int flags; + int flags; } building; extern struct attrib_type at_building_generic_type; diff --git a/src/kernel/connection.c b/src/kernel/connection.c index 39bbdbbd2..bd3565ea5 100644 --- a/src/kernel/connection.c +++ b/src/kernel/connection.c @@ -41,7 +41,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -unsigned int nextborder = 0; +int nextborder = 0; #define BORDER_MAXHASH 8191 connection *borders[BORDER_MAXHASH]; diff --git a/src/kernel/connection.h b/src/kernel/connection.h index b582377c5..a30ebc19e 100644 --- a/src/kernel/connection.h +++ b/src/kernel/connection.h @@ -25,7 +25,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. extern "C" { #endif - extern unsigned int nextborder; + extern int nextborder; typedef struct connection { struct border_type *type; /* the type of this connection */ @@ -33,7 +33,7 @@ extern "C" { struct connection *nexthash; /* next connection between these regions */ struct region *from, *to; /* borders can be directed edges */ variant data; - unsigned int id; /* unique id */ + int id; /* unique id */ } connection; typedef struct border_type { diff --git a/src/kernel/curse.h b/src/kernel/curse.h index 078e9855e..4ad472a96 100644 --- a/src/kernel/curse.h +++ b/src/kernel/curse.h @@ -192,7 +192,7 @@ extern "C" { struct curse *nexthash; int no; /* 'Einheitennummer' dieses Curse */ const struct curse_type *type; /* Zeiger auf ein curse_type-struct */ - unsigned int flags; /* WARNING: these are XORed with type->flags! */ + int flags; /* WARNING: these are XORed with type->flags! */ int duration; /* Dauer der Verzauberung. Wird jede Runde vermindert */ float vigour; /* Stärke der Verzauberung, Widerstand gegen Antimagie */ struct unit *magician; /* Pointer auf den Magier, der den Spruch gewirkt hat */ @@ -207,8 +207,8 @@ extern "C" { typedef struct curse_type { const char *cname; /* Name der Zauberwirkung, Identifizierung des curse */ int typ; - unsigned int flags; - unsigned int mergeflags; + int flags; + int mergeflags; struct message *(*curseinfo) (const void *, objtype_t, const struct curse *, int); void(*change_vigour) (curse *, float); diff --git a/src/kernel/plane.h b/src/kernel/plane.h index c573c096b..98b897f52 100644 --- a/src/kernel/plane.h +++ b/src/kernel/plane.h @@ -51,7 +51,7 @@ extern "C" { int id; char *name; int minx, maxx, miny, maxy; - unsigned int flags; + int flags; struct attrib *attribs; } plane; diff --git a/src/kernel/region.h b/src/kernel/region.h index 02a653982..593d1e3f9 100644 --- a/src/kernel/region.h +++ b/src/kernel/region.h @@ -81,7 +81,7 @@ extern "C" { struct alliance *alliance; int since_turn; /* turn the region changed owners */ int morale_turn; /* turn when morale has changed most recently */ - unsigned int flags; + int flags; } region_owner; typedef struct demand { @@ -126,7 +126,7 @@ extern "C" { int x, y; struct plane *_plane; /* to access, use rplane(r) */ char *display; - unsigned int flags; + int flags; unsigned short age; struct message_list *msgs; struct individual_message { diff --git a/src/kernel/save.c b/src/kernel/save.c index 40d13a6b3..aa15dbc24 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -441,7 +441,7 @@ static void read_alliances(struct storage *store) READ_STR(store, aname, sizeof(aname)); al = makealliance(id, aname); if (global.data_version >= OWNER_2_VERSION) { - READ_UINT(store, &al->flags); + READ_INT(store, &al->flags); } if (global.data_version >= ALLIANCELEADER_VERSION) { read_reference(&al->_leader, store, read_faction_reference, @@ -513,7 +513,7 @@ static void read_owner(struct gamedata *data, region_owner ** powner) owner->since_turn = since_turn; READ_INT(data->store, &owner->morale_turn); if (data->version >= MOURNING_VERSION) { - READ_UINT(data->store, &owner->flags); + READ_INT(data->store, &owner->flags); } else { owner->flags = 0; } @@ -699,7 +699,7 @@ unit *read_unit(struct gamedata *data) READ_INT(data->store, &n); setstatus(u, n); - READ_UINT(data->store, &u->flags); + READ_INT(data->store, &u->flags); u->flags &= UFL_SAVEMASK; if ((u->flags & UFL_ANON_FACTION) && !rule_stealth_faction()) { /* if this rule is broken, then fix broken units */ @@ -844,11 +844,11 @@ static region *readregion(struct gamedata *data, int x, int y) region *r = findregion(x, y); const terrain_type *terrain; char token[32]; - unsigned int uid = 0; + int uid = 0; int n; if (data->version >= UID_VERSION) { - READ_UINT(data->store, &uid); + READ_INT(data->store, &uid); } if (r == NULL) { @@ -896,7 +896,7 @@ static region *readregion(struct gamedata *data, int x, int y) } } r->terrain = terrain; - READ_UINT(data->store, &r->flags); + READ_INT(data->store, &r->flags); READ_INT(data->store, &n); r->age = (unsigned short)n; @@ -1266,11 +1266,13 @@ faction *readfaction(struct gamedata * data) READ_INT(data->store, &n); } - READ_INT(data->store, &f->flags); - assert((f->flags&FFL_SAVEMASK) == f->flags); - if (f->no==0 || f->no==666) { - f->flags |= FFL_NPC; - } + READ_INT(data->store, &f->flags); + if (data->version < INTFLAGS_VERSION) { + if (f->no==0 || f->no==666) { + f->flags = FFL_NPC|FFL_NOTIMEOUT|FFL_NOIDLEOUT; + } + } + assert((f->flags&FFL_SAVEMASK) == f->flags); a_read(data->store, &f->attribs, f); if (data->version >= CLAIM_VERSION) { @@ -1462,7 +1464,7 @@ int readgame(const char *filename, int backup) rng_init(turn); ++global.cookie; READ_INT(&store, &nread); /* max_unique_id = ignore */ - READ_UINT(&store, &nextborder); + READ_INT(&store, &nextborder); /* Planes */ planes = NULL; @@ -1487,7 +1489,7 @@ int readgame(const char *filename, int backup) READ_INT(&store, &pl->maxx); READ_INT(&store, &pl->miny); READ_INT(&store, &pl->maxy); - READ_UINT(&store, &pl->flags); + READ_INT(&store, &pl->flags); /* read watchers */ if (gdata.version < FIX_WATCHERS_VERSION) { @@ -1625,7 +1627,7 @@ int readgame(const char *filename, int backup) READ_INT(&store, &sh->size); READ_INT(&store, &sh->damage); if (gdata.version >= FOSS_VERSION) { - READ_UINT(&store, &sh->flags); + READ_INT(&store, &sh->flags); } /* Attribute rekursiv einlesen */ diff --git a/src/kernel/ship.h b/src/kernel/ship.h index 8249a1beb..3f758c1bd 100644 --- a/src/kernel/ship.h +++ b/src/kernel/ship.h @@ -89,7 +89,7 @@ extern "C" { struct attrib *attribs; int size; int damage; /* damage in 100th of a point of size */ - unsigned int flags; + int flags; const struct ship_type *type; direction_t coast; } ship; diff --git a/src/kernel/terrain.h b/src/kernel/terrain.h index 355c66fd2..d4c0cb55b 100644 --- a/src/kernel/terrain.h +++ b/src/kernel/terrain.h @@ -61,7 +61,7 @@ extern "C" { typedef struct terrain_type { char *_name; int size; /* how many peasants can work? */ - unsigned int flags; + int flags; short max_road; /* this many stones make a full road */ short distribution; /* multiplier used for seeding */ struct terrain_production *production; diff --git a/src/kernel/unit.h b/src/kernel/unit.h index 8e09d40f8..145e7ef5d 100644 --- a/src/kernel/unit.h +++ b/src/kernel/unit.h @@ -107,7 +107,7 @@ extern "C" { const struct race *race_; const struct race *irace; - unsigned int flags; + int flags; struct attrib *attribs; status_t status; int n; /* enno: attribut? */ diff --git a/src/kernel/version.h b/src/kernel/version.h index c591834df..fb835e138 100644 --- a/src/kernel/version.h +++ b/src/kernel/version.h @@ -70,8 +70,9 @@ #define UNIQUE_SPELLS_VERSION 339 /* turn 775, spell names are now unique globally, not just per school */ #define SPELLBOOK_VERSION 340 /* turn 775, full spellbooks are stored for factions */ #define NOOVERRIDE_VERSION 341 /* turn 775, full spellbooks are stored for factions */ +#define INTFLAGS_VERSION 342 /* turn 876, FFL_NPC is now bit 25, flags is an int */ #define MIN_VERSION CURSETYPE_VERSION /* minimal datafile we support */ -#define RELEASE_VERSION NOOVERRIDE_VERSION /* current datafile */ +#define RELEASE_VERSION INTFLAGS_VERSION /* current datafile */ #define STREAM_VERSION 2 /* internal encoding of binary files */