forked from github/server
changing unsigned flags to regular ints
the storage library does not understand unsigned at the moment, and using the highest order bit causes trouble new version of datafile
This commit is contained in:
parent
1e7e5877a1
commit
c2329f7f2b
2
cutest
2
cutest
|
@ -1 +1 @@
|
|||
Subproject commit d83cec09a52835274ab8ed4849de16fb8658982a
|
||||
Subproject commit 788659594ef87e9f497b8039da764182adfd2943
|
|
@ -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
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -41,7 +41,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
unsigned int nextborder = 0;
|
||||
int nextborder = 0;
|
||||
|
||||
#define BORDER_MAXHASH 8191
|
||||
connection *borders[BORDER_MAXHASH];
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -51,7 +51,7 @@ extern "C" {
|
|||
int id;
|
||||
char *name;
|
||||
int minx, maxx, miny, maxy;
|
||||
unsigned int flags;
|
||||
int flags;
|
||||
struct attrib *attribs;
|
||||
} plane;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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? */
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue