forked from github/server
bugfix monsterfaction
This commit is contained in:
parent
dcf3292467
commit
76497abc92
3 changed files with 25 additions and 11 deletions
|
@ -341,7 +341,8 @@ set_alliance(faction * a, faction * b, int status)
|
||||||
(*sfp)->status |= status;
|
(*sfp)->status |= status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void renumber_faction(faction * f, int no)
|
void
|
||||||
|
renumber_faction(faction * f, int no)
|
||||||
{
|
{
|
||||||
if (f->subscription) {
|
if (f->subscription) {
|
||||||
sql_print(("UPDATE subscriptions set faction='%s' where id=%u;\n",
|
sql_print(("UPDATE subscriptions set faction='%s' where id=%u;\n",
|
||||||
|
|
|
@ -145,7 +145,7 @@ extern void remove_enemy(struct faction * f, struct faction * enemy);
|
||||||
extern void write_faction_reference(const struct faction * f, struct storage * store);
|
extern void write_faction_reference(const struct faction * f, struct storage * store);
|
||||||
extern int read_faction_reference(struct faction ** f, struct storage * store);
|
extern int read_faction_reference(struct faction ** f, struct storage * store);
|
||||||
|
|
||||||
void renumber_faction(faction * f, int no);
|
extern void renumber_faction(faction * f, int no);
|
||||||
|
|
||||||
#ifdef SMART_INTERVALS
|
#ifdef SMART_INTERVALS
|
||||||
extern void update_interval(struct faction * f, struct region * r);
|
extern void update_interval(struct faction * f, struct region * r);
|
||||||
|
|
|
@ -1419,6 +1419,9 @@ readfaction(struct storage * store)
|
||||||
#endif /* KARMA_MODULE */
|
#endif /* KARMA_MODULE */
|
||||||
|
|
||||||
f->flags = store->r_int(store);
|
f->flags = store->r_int(store);
|
||||||
|
if (f->no==0) {
|
||||||
|
f->flags |= FFL_NPC;
|
||||||
|
}
|
||||||
|
|
||||||
a_read(store, &f->attribs);
|
a_read(store, &f->attribs);
|
||||||
if (store->version>=CLAIM_VERSION) {
|
if (store->version>=CLAIM_VERSION) {
|
||||||
|
@ -1769,32 +1772,42 @@ readgame(const char * filename, int mode, int backup)
|
||||||
store->close(store);
|
store->close(store);
|
||||||
|
|
||||||
/* Unaufgeloeste Zeiger initialisieren */
|
/* Unaufgeloeste Zeiger initialisieren */
|
||||||
log_info((1, "\n - Referenzen initialisieren...\n"));
|
log_info((1, "fixing unresolved references.\n"));
|
||||||
resolve();
|
resolve();
|
||||||
|
|
||||||
|
log_info((1, "updating area information for lighthouses.\n"));
|
||||||
for (r=regions;r;r=r->next) {
|
for (r=regions;r;r=r->next) {
|
||||||
if (r->flags & RF_LIGHTHOUSE) {
|
if (r->flags & RF_LIGHTHOUSE) {
|
||||||
building * b;
|
building * b;
|
||||||
for (b=r->buildings;b;b=b->next) update_lighthouse(b);
|
for (b=r->buildings;b;b=b->next) update_lighthouse(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log_info((1, " - Regionen initialisieren & verbinden...\n"));
|
log_info((1, "marking factions as alive.\n"));
|
||||||
for (f = factions; f; f = f->next) {
|
for (f = factions; f; f = f->next) {
|
||||||
for (u = f->units; u; u = u->nextF) {
|
if (f->flags & FFL_NPC) {
|
||||||
if (u->number>0) {
|
f->alive = 1;
|
||||||
f->alive = 1;
|
if (f->no==0) {
|
||||||
break;
|
int no=666;
|
||||||
|
while (findfaction(no)) ++no;
|
||||||
|
log_warning(("renum(monsters, %d)\n", no));
|
||||||
|
renumber_faction(f, no);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (u = f->units; u; u = u->nextF) {
|
||||||
|
if (u->number>0) {
|
||||||
|
f->alive = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (findfaction(0)) {
|
|
||||||
findfaction(0)->alive = 1;
|
|
||||||
}
|
|
||||||
if (loadplane || maxregions>=0) {
|
if (loadplane || maxregions>=0) {
|
||||||
remove_empty_factions(false);
|
remove_empty_factions(false);
|
||||||
}
|
}
|
||||||
|
log_info((1, "Done loading turn %d.\n", turn));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
writegame(const char *filename, int mode)
|
writegame(const char *filename, int mode)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue