started limiting the maximum number of orders for a unit.

removed num_migrants as it was not updated properly.
This commit is contained in:
Enno Rehling 2005-07-27 11:48:16 +00:00
parent 8e260ce6be
commit 200201b384
9 changed files with 35 additions and 32 deletions

View File

@ -1209,7 +1209,7 @@ count_all(const faction * f)
}
if (f->num_people != n) {
log_error(("Anzahl Personen für (%s) ist != num_people: %d statt %d.\n",
factionid(f), f->num_migrants, n));
factionid(f), f->num_people, n));
return n;
}
#endif
@ -1231,13 +1231,8 @@ count_migrants (const faction * f)
}
u = u->nextF;
}
if (f->num_migrants != n) {
log_error(("Anzahl Migranten für (%s) ist != num_migrants: %d statt %d.\n",
factionid(f), f->num_migrants, n));
return n;
}
#endif
return f->num_migrants;
return n;
}
int

View File

@ -68,7 +68,6 @@ typedef struct faction {
const struct race * race;
magic_t magiegebiet;
int newbies;
int num_migrants; /* Anzahl Migranten */
int num_people; /* Anzahl Personen ohne Monster */
int num_total; /* Anzahl Personen mit Monstern */
int options;

View File

@ -75,6 +75,8 @@
#define COMMENT_CHAR ';'
#define ESCAPE_FIX
#define MAXORDERS 256
#define MAXPERSISTENT 16
/* exported symbols symbols */
const char * xmlfile = "eressea.xml";
@ -1024,7 +1026,7 @@ readunit(FILE * F)
herb_t herb;
potion_t potion;
unit * u;
int number, n;
int number, n, p;
n = rid(F);
u = findunit(n);
@ -1114,9 +1116,20 @@ readunit(FILE * F)
/* Persistente Befehle einlesen */
free_orders(&u->orders);
freadstr(F, buf, sizeof(buf));
p = n = 0;
while (*buf != 0) {
order * ord = parse_order(buf, u->faction->locale);
if (ord!=NULL) addlist(&u->orders, ord);
if (ord!=NULL) {
if (++n<MAXORDERS) {
if (!is_persistent(ord) || ++p<MAXPERSISTENT) {
addlist(&u->orders, ord);
} else if (p==MAXPERSISTENT) {
log_error(("%s had %d or more persistent orders\n", unitname(u), MAXPERSISTENT));
}
} else if (n==MAXORDERS) {
log_error(("%s had %d or more orders\n", unitname(u), MAXPERSISTENT));
}
}
freadstr(F, buf, sizeof(buf));
}
if (global.data_version<NOLASTORDER_VERSION) {

View File

@ -879,12 +879,6 @@ set_number(unit * u, int count)
#ifndef NDEBUG
assert (u->faction != 0 || u->number > 0);
#endif
if (u->faction && u->race != u->faction->race && playerrace(u->race)
&& u->race != new_race[RC_SPELL] && u->race != new_race[RC_SPECIAL]
&& !(is_cursed(u->attribs, C_SLAVE, 0)))
{
u->faction->num_migrants += count - u->number;
}
if (playerrace(u->race)) {
u->faction->num_people += count - u->number;

View File

@ -242,7 +242,6 @@ no_teurefremde(boolean convert)
if (convert) {
u->race = u->faction->race;
u->irace = u->faction->race;
u->faction->num_migrants -= u->number;
sprintf(buf, "Die Götter segnen %s mit der richtigen Rasse",
unitname(u));
addmessage(0, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);

View File

@ -40,10 +40,10 @@ log_read(const char * filename)
while (!feof(log)) {
if(fscanf(log, "%s", buf) == EOF) break;
if (strcmp(buf, "UNIT")==0) {
int x, y;
short x, y;
unit * u;
region * r;
fscanf(log, "%s %d %d", buf, &x, &y);
fscanf(log, "%s %hd %hd", buf, &x, &y);
u = readunit(log);
r = findregion(x, y);
if (r==NULL) {
@ -52,8 +52,8 @@ log_read(const char * filename)
}
if (u->region!=r) move_unit(u, r, NULL);
} else if (strcmp(buf, "REGION")==0) {
int x, y;
fscanf(log, "%d %d", &x, &y);
short x, y;
fscanf(log, "%hd %hd", &x, &y);
readregion(log, x, y);
} else if (strcmp(buf, "FACTION")==0) {
faction * f;

View File

@ -88,7 +88,7 @@ static terrain_t newblock[BLOCKSIZE][BLOCKSIZE];
static int g_maxluxuries;
void
block_create(int x1, int y1, int size, char chaotisch, int special, char terrain)
block_create(short x1, short y1, int size, char chaotisch, int special, char terrain)
{
int local_climate, k;
short x, y;

View File

@ -128,7 +128,8 @@ signal_init(void)
}
#endif /* ndef Win32 */
int left = 0, top = 0, breit, hoch, tx=-999, ty=-999;
short left = 0, top = 0, tx=-999, ty=-999;
int breit, hoch;
int MINX=0, MINY=0, MAXX=0, MAXY=0;
boolean minimapx=false,minimapy=false; /* Karte nicht vert./hor. scrollen */
@ -165,21 +166,23 @@ init_win(int x, int y) {
clear();
refresh();
breit=(SX-45)/2; hoch=SY-6;
breit = (short)(SX-45)/2; hoch = (short)SY-6;
if (breit > MAXX-MINX+(MAXY-MINY)/2) {
left=MINX-(breit-MAXX-MINX)/2+y/2;
left = (short)(MINX-(breit-MAXX-MINX)/2+y/2);
breit = MAXX-MINX+(MAXY-MINY)/2;
minimapx=true;
} else {
left=x-breit/2+y/2;
left = (short)(x-breit/2+y/2);
}
if (hoch > MAXY-MINY) {
minimapy=true;
top=MAXY+(hoch-MAXY-MINY)/2;
top = (short)(MAXY+(hoch-MAXY-MINY)/2);
hoch = MAXY-MINY;
} else top=y+hoch/2;
} else {
top = (short)(y+hoch/2);
}
/* breit=(SX-45)/2; hoch=SY-6; */ /* zum Darstellen schon alles nehmen */
}

View File

@ -115,7 +115,7 @@ typedef struct selection {
struct selection * do_selection(struct selection * sel, const char * title, void (*perform)(struct selection *, void *), void * data);
struct selection ** push_selection(struct selection ** p_sel, char * str, void * payload);
void insert_selection(struct selection ** p_sel, struct selection * prev, char * str, void * payload);
void block_create(int x1, int y1, int size, char chaotisch, int special, char terrain);
void block_create(short x1, short y1, int size, char chaotisch, int special, char terrain);
extern void read_orders(const char * filename);
extern void read_dropouts(const char *filename);