Datenbanklink

This commit is contained in:
Enno Rehling 2002-12-01 11:23:17 +00:00
parent 5aa7d8f5d1
commit 533fdf4143
2 changed files with 48 additions and 6 deletions

View File

@ -149,7 +149,7 @@ rc(FILE * F)
#define rc(F) (nextc = getc(F)) #define rc(F) (nextc = getc(F))
#endif #endif
#define CONVERT_DBLINK #undef CONVERT_DBLINK
#ifdef CONVERT_DBLINK #ifdef CONVERT_DBLINK
typedef struct uniquenode { typedef struct uniquenode {
@ -1483,6 +1483,7 @@ curse_read(attrib * a, FILE * f) {
} }
assert(ct!=NULL); assert(ct!=NULL);
#ifdef CONVERT_DBLINK
if (global.data_version<DBLINK_VERSION) { if (global.data_version<DBLINK_VERSION) {
static const curse_type * cmonster = NULL; static const curse_type * cmonster = NULL;
if (!cmonster) cmonster=ct_find("calmmonster"); if (!cmonster) cmonster=ct_find("calmmonster");
@ -1490,6 +1491,7 @@ curse_read(attrib * a, FILE * f) {
c->effect.v = uniquefaction(c->effect.i); c->effect.v = uniquefaction(c->effect.i);
} }
} }
#endif
c->type = ct; c->type = ct;
/* beim Einlesen sind noch nicht alle units da, muss also /* beim Einlesen sind noch nicht alle units da, muss also

View File

@ -595,6 +595,30 @@ confirm_newbies(void)
} }
} }
void
update_subscriptions(void)
{
FILE * F;
char zText[MAX_PATH];
faction * f;
strcat(strcpy(zText, basepath()), "/subscriptions");
F = fopen(zText, "r");
if (F==NULL) {
log_error(("could not open %s.\n", zText));
return;
}
for (;;) {
char zFaction[5];
int subscription, fno;
if (fscanf(F, "%d %s", &subscription, zFaction)<=0) break;
fno = atoi36(zFaction);
f = findfaction(fno);
if (f!=NULL) {
f->subscription=subscription;
}
}
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -642,6 +666,22 @@ main(int argc, char *argv[])
if ((i=readgame(false))!=0) return i; if ((i=readgame(false))!=0) return i;
confirm_newbies(); confirm_newbies();
update_subscriptions();
{
char zText[128];
FILE * F;
faction * f = factions;
sprintf(zText, "subscriptions.%u", turn);
F = fopen(zText, "w");
while (f!=NULL) {
fprintf(F, "%s:%u:%s:%s:%s:%u:\n",
itoa36(f->no), f->subscription, f->email, f->override,
dbrace(f->race), f->lastorders);
f = f->next;
}
fclose(F);
}
#ifdef BETA_CODE #ifdef BETA_CODE
if (dungeonstyles) { if (dungeonstyles) {
struct dungeon * d = dungeonstyles; struct dungeon * d = dungeonstyles;