Some changes made here

This commit is contained in:
Enno Rehling 2002-11-02 15:50:51 +00:00
parent 043380ae84
commit 8656f65fa0
2 changed files with 26 additions and 9 deletions

View File

@ -2620,14 +2620,15 @@ renumber_factions(void)
} }
} }
for (rp=renum;rp;rp=rp->next) { for (rp=renum;rp;rp=rp->next) {
a_remove(&rp->faction->attribs, rp->attrib); f = rp->faction;
if (updatelog) fprintf(updatelog, "renum %s %s\n", itoa36(rp->faction->no), itoa36(rp->want)); a_remove(&f->attribs, rp->attrib);
if (updatelog) fprintf(updatelog, "renum %s %s\n", itoa36(f->no), itoa36(rp->want));
if (f->subscription) fprintf(sqlstream, "UPDATE subscriptions set faction='%s' where " if (f->subscription) fprintf(sqlstream, "UPDATE subscriptions set faction='%s' where "
"subscription=%u;\n", itoa36(rp->want), "subscription=%u;\n", itoa36(rp->want),
f->subscription); f->subscription);
rp->faction->no = rp->want; f->no = rp->want;
register_faction_id(rp->want); register_faction_id(rp->want);
fset(rp->faction, FF_NEWID); fset(f, FF_NEWID);
} }
while (renum) { while (renum) {
rp = renum->next; rp = renum->next;

View File

@ -187,6 +187,18 @@ typedef struct mapnode {
static mapnode * subscriptions[HASHSIZE]; static mapnode * subscriptions[HASHSIZE];
static const char *
dbrace(const struct race * rc)
{
static char zText[32];
unsigned char * zPtr = (unsigned char*)zText;
strcpy(zText, LOC(find_locale("en"), rc_name(rc, 0)));
while (*zPtr) {
*zPtr = (unsigned char)toupper(*(int*)zPtr);
++zPtr;
}
return zText;
}
void void
convertunique(faction * f) convertunique(faction * f)
{ {
@ -216,7 +228,11 @@ convertunique(faction * f)
} }
mnode = subscriptions[f->no%HASHSIZE]; mnode = subscriptions[f->no%HASHSIZE];
while (mnode!=NULL && mnode->fno!=f->no) mnode = mnode->next; while (mnode!=NULL && mnode->fno!=f->no) mnode = mnode->next;
f->subscription = mnode->subscription; if (mnode) f->subscription = mnode->subscription;
else {
log_printf("No subscription: faction %s email %s pass %s race %s\n",
itoa36(f->no), f->email, f->override, dbrace(f->race));
}
} }
#endif #endif
@ -1459,7 +1475,7 @@ curse_read(attrib * a, FILE * f) {
int cspellid; int cspellid;
if (global.data_version < CURSE_NO_VERSION) { if (global.data_version < CURSE_NO_VERSION) {
fscanf(f, "%d %d %d %d %d %d ",&cspellid, &c->flag, &c->duration, fscanf(f, "%d %d %d %d %d %d ",&cspellid, &c->flag, &c->duration,
&c->vigour, &mageid, &c->effect); &c->vigour, &mageid, &c->effect.i);
c->no = newunitid(); c->no = newunitid();
} else { } else {
fscanf(f, "%d %d %d %d %d %d %d ", &c->no, &cspellid, &c->flag, fscanf(f, "%d %d %d %d %d %d %d ", &c->no, &cspellid, &c->flag,
@ -2048,9 +2064,6 @@ readfaction(FILE * F)
while (f->attribs) a_remove(&f->attribs, f->attribs); while (f->attribs) a_remove(&f->attribs, f->attribs);
} }
f->subscription = ri(F); f->subscription = ri(F);
#ifdef CONVERT_DBLINK
convertunique(f);
#endif
#ifdef ALLIANCES #ifdef ALLIANCES
if (global.data_version>=ALLIANCES_VERSION) { if (global.data_version>=ALLIANCES_VERSION) {
int allianceid = rid(F); int allianceid = rid(F);
@ -2095,6 +2108,9 @@ readfaction(FILE * F)
f->race = rc_find(buf); f->race = rc_find(buf);
assert(f->race); assert(f->race);
} }
#ifdef CONVERT_DBLINK
convertunique(f);
#endif
f->magiegebiet = (magic_t)ri(F); f->magiegebiet = (magic_t)ri(F);
if (!playerrace(f->race)) { if (!playerrace(f->race)) {
f->lastorders = turn+1; f->lastorders = turn+1;