forked from github/server
Datenbanklink
This commit is contained in:
parent
5aa7d8f5d1
commit
533fdf4143
|
@ -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
|
||||||
|
|
|
@ -586,15 +586,39 @@ confirm_newbies(void)
|
||||||
if (sqlstream==NULL) return;
|
if (sqlstream==NULL) return;
|
||||||
while (f) {
|
while (f) {
|
||||||
if (!fval(f, FFL_DBENTRY)) {
|
if (!fval(f, FFL_DBENTRY)) {
|
||||||
if (f->subscription) {
|
if (f->subscription) {
|
||||||
fprintf(sqlstream, "UPDATE subscriptions SET status='ACTIVE', faction='%s', race='%s' WHERE id=%u;\n", itoa36(f->no), dbrace(f->race), f->subscription);
|
fprintf(sqlstream, "UPDATE subscriptions SET status='ACTIVE', faction='%s', race='%s' WHERE id=%u;\n", itoa36(f->no), dbrace(f->race), f->subscription);
|
||||||
fset(f, FFL_DBENTRY);
|
fset(f, FFL_DBENTRY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f = f->next;
|
f = f->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
Loading…
Reference in New Issue