Merge branch 'master' of github.com:eressea/server

This commit is contained in:
Enno Rehling 2014-01-02 22:08:15 -08:00
commit b214fc10cc
15 changed files with 17 additions and 88 deletions

2
cmake

@ -1 +1 @@
Subproject commit 51114339b929a662fb85d45ab6310b0423ac4cef
Subproject commit ddd0136d4e99b0daab16361aad5338ad3ca4b808

View File

@ -169,7 +169,6 @@ set (LIB_SRC
util/log.c
util/message.c
util/nrmessage.c
util/os.c
util/parser.c
util/rand.c
util/resolve.c

View File

@ -1446,26 +1446,20 @@ static void remove_idle_players(void)
destroyfaction(f);
continue;
}
if (fval(f, FFL_OVERRIDE)) {
free(f->override);
f->override = _strdup(itoa36(rng_int()));
freset(f, FFL_OVERRIDE);
}
if (turn != f->lastorders) {
char info[256];
sprintf(info, "%d Einheiten, %d Personen, %d Silber",
f->no_units, f->num_total, f->money);
if (f->subscription) {
sql_print(
("UPDATE subscriptions SET lastturn=%d, password='%s', info='%s' WHERE id=%u;\n",
f->lastorders, f->override, info, f->subscription));
("UPDATE subscriptions SET lastturn=%d, info='%s' WHERE id=%u;\n",
f->lastorders, info, f->subscription));
}
} else {
if (f->subscription) {
sql_print(
("UPDATE subscriptions SET status='ACTIVE', lastturn=%d, firstturn=greatest(firstturn,%d), password='%s' WHERE id=%u;\n",
f->lastorders, f->lastorders - f->age, f->override,
f->subscription));
("UPDATE subscriptions SET status='ACTIVE', lastturn=%d, firstturn=greatest(firstturn,%d) WHERE id=%u;\n",
f->lastorders, f->lastorders - f->age, f->subscription));
}
}
@ -2408,7 +2402,6 @@ int password_cmd(unit * u, struct order *ord)
} else {
u->faction->passw = _strdup(pwbuf);
}
fset(u->faction, FFL_OVERRIDE);
ADDMSG(&u->faction->msgs, msg_message("changepasswd",
"value", u->faction->passw));
return 0;
@ -4675,8 +4668,8 @@ int writepasswd(void)
log_info("writing passwords...");
for (f = factions; f; f = f->next) {
fprintf(F, "%s:%s:%s:%s:%u\n",
factionid(f), f->email, f->passw, f->override, f->subscription);
fprintf(F, "%s:%s:%s:%u\n",
factionid(f), f->email, f->passw, f->subscription);
}
fclose(F);
return 0;
@ -4711,9 +4704,8 @@ void update_subscriptions(void)
sprintf(zText, "subscriptions.%u", turn);
F = fopen(zText, "w");
for (f = factions; f != NULL; f = f->next) {
fprintf(F, "%s:%u:%s:%s:%s:%u:\n",
itoa36(f->no), f->subscription, f->email, f->override,
dbrace(f->race), f->lastorders);
fprintf(F, "%s:%u:%s:%s:%u:\n",
itoa36(f->no), f->subscription, f->email, dbrace(f->race), f->lastorders);
}
fclose(F);
}

View File

@ -59,7 +59,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/bsdstring.h>
#include <util/language.h>
#include <util/log.h>
#include <util/os.h>
#include <util/parser.h>
#include <quicklist.h>
#include <util/rand.h>

View File

@ -88,7 +88,6 @@ void free_faction(faction * f)
free(f->email);
free(f->banner);
free(f->passw);
free(f->override);
free(f->name);
while (f->attribs) {
@ -204,7 +203,6 @@ faction *addfaction(const char *email, const char *password,
log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email);
}
f->override = _strdup(itoa36(rng_int()));
faction_setpassword(f, password);
f->alliance_joindate = turn;
@ -264,8 +262,6 @@ bool checkpasswd(const faction * f, const char *passwd, bool shortp)
{
if (unicode_utf8_strcasecmp(f->passw, passwd) == 0)
return true;
if (unicode_utf8_strcasecmp(f->override, passwd) == 0)
return true;
return false;
}

View File

@ -44,7 +44,6 @@ extern "C" {
* (FFL_SELECT muss man vorher initialisieren,
* FL_MARK hinterher löschen) */
#define FFL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
#define FFL_OVERRIDE (1<<27) /* Override-Passwort wurde benutzt */
#define FFL_DBENTRY (1<<28) /* Partei ist in Datenbank eingetragen */
#define FFL_NOTIMEOUT (1<<29) /* ignore MaxAge() */
#define FFL_GM (1<<30) /* eine Partei mit Sonderrechten */
@ -71,7 +70,6 @@ extern "C" {
char *banner;
char *email;
char *passw;
char *override;
int max_spelllevel;
struct spellbook *spellbook;
const struct locale *locale;

View File

@ -52,7 +52,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/os.h>
#include <quicklist.h>
/* libc includes */

View File

@ -61,7 +61,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/os.h>
#include <util/parser.h>
#include <quicklist.h>
#include <util/rand.h>
@ -1248,11 +1247,8 @@ faction *readfaction(struct gamedata * data)
READ_STR(data->store, name, sizeof(name));
f->passw = _strdup(name);
if (data->version >= OVERRIDE_VERSION) {
READ_STR(data->store, name, sizeof(name));
f->override = _strdup(name);
} else {
f->override = _strdup(itoa36(rng_int()));
if (data->version < NOOVERRIDE_VERSION && data->version >= OVERRIDE_VERSION) {
READ_STR(data->store, 0, 0);
}
READ_STR(data->store, name, sizeof(name));
@ -1363,7 +1359,6 @@ void writefaction(struct gamedata *data, const faction * f)
WRITE_STR(data->store, (const char *)f->banner);
WRITE_STR(data->store, f->email);
WRITE_TOK(data->store, (const char *)f->passw);
WRITE_TOK(data->store, (const char *)f->override);
WRITE_TOK(data->store, locale_name(f->locale));
WRITE_INT(data->store, f->lastorders);
WRITE_INT(data->store, f->age);

View File

@ -69,8 +69,9 @@
#define FIX_WATCHERS_VERSION 338 /* fixed storage of watchers */
#define UNIQUE_SPELLS_VERSION 339 /* turn 775, spell names are now unique globally, not just per school */
#define SPELLBOOK_VERSION 340 /* turn 775, full spellbooks are stored for factions */
#define NOOVERRIDE_VERSION 341 /* turn 775, full spellbooks are stored for factions */
#define MIN_VERSION CURSETYPE_VERSION /* minimal datafile we support */
#define RELEASE_VERSION SPELLBOOK_VERSION /* current datafile */
#define RELEASE_VERSION NOOVERRIDE_VERSION /* current datafile */
#define STREAM_VERSION 2 /* internal encoding of binary files */

View File

@ -341,7 +341,6 @@ static void guardian_faction(plane * pl, int id)
f = calloc(1, sizeof(faction));
f->banner = _strdup("Sie dienen dem großen Wyrm");
f->passw = _strdup(itoa36(rng_int()));
f->override = _strdup(itoa36(rng_int()));
set_email(&f->email, "igjarjuk@eressea.de");
f->name = _strdup("Igjarjuks Kundschafter");
f->race = new_race[RC_ILLUSION];

View File

@ -689,9 +689,8 @@ int autoseed(newfaction ** players, int nsize, int max_agediff)
f->email, regionname(r, NULL));
if (f->subscription) {
sql_print(
("UPDATE subscriptions SET status='ACTIVE', faction='%s', firstturn=%d, lastturn=%d, password='%s' WHERE id=%u;\n",
factionid(f), f->lastorders, f->lastorders, f->override,
f->subscription));
("UPDATE subscriptions SET status='ACTIVE', faction='%s', firstturn=%d, lastturn=%d WHERE id=%u;\n",
factionid(f), f->lastorders, f->lastorders, f->subscription));
}
/* remove duplicate email addresses */

View File

@ -666,7 +666,6 @@ faction *gm_addfaction(const char *email, plane * p, region * r)
f->banner = _strdup("quest faction");
f->name = _strdup("quest faction");
f->passw = _strdup(itoa36(rng_int()));
f->override = _strdup(itoa36(rng_int()));
if (set_email(&f->email, email) != 0) {
log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email);
}

View File

@ -1,18 +0,0 @@
#include "os.h"
#if defined(WIN32)
#include <direct.h>
#else /* WIN32 */
#include <sys/types.h>
#include <sys/stat.h>
#endif /* WIN32 */
int os_mkdir(const char *path, int mode)
{
#ifdef WIN32
mode = mode;
return _mkdir(path);
#else /* POSIX is our last hope */
return mkdir(path, (mode_t) mode);
#endif /* WIN32 */
}

View File

@ -1,29 +0,0 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef _OS_H
#define _OS_H
#ifdef __cplusplus
extern "C" {
#endif
extern int os_mkdir(const char *path, int mode);
#ifdef __cplusplus
}
#endif
#endif

@ -1 +1 @@
Subproject commit af834a24aa87cdd51b1a68381a5a55140e1b1281
Subproject commit ce14333daa6f53d11b725dc347d734e3d513f793