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

View File

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

View File

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

View File

@ -879,12 +879,6 @@ set_number(unit * u, int count)
#ifndef NDEBUG #ifndef NDEBUG
assert (u->faction != 0 || u->number > 0); assert (u->faction != 0 || u->number > 0);
#endif #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)) { if (playerrace(u->race)) {
u->faction->num_people += count - u->number; u->faction->num_people += count - u->number;

View File

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

View File

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

View File

@ -88,7 +88,7 @@ static terrain_t newblock[BLOCKSIZE][BLOCKSIZE];
static int g_maxluxuries; static int g_maxluxuries;
void 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; int local_climate, k;
short x, y; short x, y;

View File

@ -128,7 +128,8 @@ signal_init(void)
} }
#endif /* ndef Win32 */ #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; int MINX=0, MINY=0, MAXX=0, MAXY=0;
boolean minimapx=false,minimapy=false; /* Karte nicht vert./hor. scrollen */ boolean minimapx=false,minimapy=false; /* Karte nicht vert./hor. scrollen */
@ -165,21 +166,23 @@ init_win(int x, int y) {
clear(); clear();
refresh(); refresh();
breit=(SX-45)/2; hoch=SY-6; breit = (short)(SX-45)/2; hoch = (short)SY-6;
if (breit > MAXX-MINX+(MAXY-MINY)/2) { 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; breit = MAXX-MINX+(MAXY-MINY)/2;
minimapx=true; minimapx=true;
} else { } else {
left=x-breit/2+y/2; left = (short)(x-breit/2+y/2);
} }
if (hoch > MAXY-MINY) { if (hoch > MAXY-MINY) {
minimapy=true; minimapy=true;
top=MAXY+(hoch-MAXY-MINY)/2; top = (short)(MAXY+(hoch-MAXY-MINY)/2);
hoch=MAXY-MINY; 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 */ /* breit=(SX-45)/2; hoch=SY-6; */ /* zum Darstellen schon alles nehmen */
} }
@ -406,7 +409,7 @@ drawmap(boolean maponly) {
chtype rs; chtype rs;
region *r; region *r;
x1=left; y1=top; x1 = left; y1=top;
if(maponly == false) { if(maponly == false) {
movexy(SX-36,SY-2); movexy(SX-36,SY-2);
sprintf(buf, "%d gesetzt, %d Rest, %d Dropouts", numnewbies, listlen(newfactions), listlen(dropouts)); sprintf(buf, "%d gesetzt, %d Rest, %d Dropouts", numnewbies, listlen(newfactions), listlen(dropouts));

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 * 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); 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 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_orders(const char * filename);
extern void read_dropouts(const char *filename); extern void read_dropouts(const char *filename);