Merge pull request #422 from ennorehling/feature/issue-418-seaserpent-piracy-crash

issue #419, eliminate language_struct.h, make the struct module-private
This commit is contained in:
Enno Rehling 2015-12-02 11:52:16 +01:00
commit e91310f576
3 changed files with 20 additions and 31 deletions

View File

@ -2,7 +2,7 @@
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/race.h> #include <kernel/race.h>
#include <util/language_struct.h> #include <util/language.h>
#include <util/unicode.h> #include <util/unicode.h>
#include <util/log.h> #include <util/log.h>
#include <util/base36.h> #include <util/base36.h>
@ -129,7 +129,7 @@ static void update_faction(sqlite3 *db, const faction *f) {
sqlite3_bind_text(stmt, 2, code, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, 2, code, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 3, f->name, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, 3, f->name, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 4, f->email, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, 4, f->email, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 5, f->locale->name, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, 5, locale_name(f->locale), -1, SQLITE_STATIC);
sqlite3_bind_int(stmt, 6, turn); sqlite3_bind_int(stmt, 6, turn);
sqlite3_step(stmt); sqlite3_step(stmt);
sqlite3_finalize(stmt); sqlite3_finalize(stmt);

View File

@ -18,7 +18,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <platform.h> #include <platform.h>
#include "language.h" #include "language.h"
#include "language_struct.h"
#include "log.h" #include "log.h"
#include "strings.h" #include "strings.h"
@ -30,7 +29,24 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <assert.h> #include <assert.h>
#include <critbit.h> #include <critbit.h>
/** importing **/ #define SMAXHASH 2048
typedef struct locale_str {
unsigned int hashkey;
struct locale_str *nexthash;
char *str;
char *key;
} locale_str;
typedef struct locale {
char *name;
unsigned int index;
struct locale *next;
unsigned int hashkey;
struct locale_str *strings[SMAXHASH];
} locale;
extern locale *default_locale;
extern locale *locales;
locale *default_locale; locale *default_locale;
locale *locales; locale *locales;

View File

@ -1,27 +0,0 @@
#ifndef CLASS_LANGUAGE_STRUCT
#define CLASS_LANGUAGE_STRUCT
/* This file should not be included by anything in the server. If you
* feel that you need to include it, it's a sure sign that you're trying to
* do something BAD. */
#define SMAXHASH 2048
typedef struct locale_str {
unsigned int hashkey;
struct locale_str *nexthash;
char *str;
char *key;
} locale_str;
typedef struct locale {
char *name;
unsigned int index;
struct locale *next;
unsigned int hashkey;
struct locale_str *strings[SMAXHASH];
} locale;
extern locale *default_locale;
extern locale *locales;
#endif