forked from github/server
Bugfix englische Schiffsnamen
Bugfix uninitialisierte Variable
This commit is contained in:
parent
59e1c30357
commit
81dfda6805
|
@ -114,12 +114,6 @@ income(const unit * u)
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
const struct ship_type *
|
|
||||||
findshiptype(char *s, const locale * lang)
|
|
||||||
{
|
|
||||||
const struct ship_type * i = st_find(s);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct scramble {
|
static struct scramble {
|
||||||
|
|
|
@ -52,8 +52,6 @@ extern int income(const struct unit * u);
|
||||||
/* Wieviel Fremde eine Partei pro Woche aufnehmen kann */
|
/* Wieviel Fremde eine Partei pro Woche aufnehmen kann */
|
||||||
#define MAXNEWBIES 5
|
#define MAXNEWBIES 5
|
||||||
|
|
||||||
const struct ship_type * findshiptype(char *s, const struct locale * lang);
|
|
||||||
|
|
||||||
void scramble(void *v1, int n, size_t width);
|
void scramble(void *v1, int n, size_t width);
|
||||||
void economics(void);
|
void economics(void);
|
||||||
void produce(void);
|
void produce(void);
|
||||||
|
|
|
@ -224,6 +224,7 @@ restart(unit *u, const race * rc)
|
||||||
strlist ** o=&u->orders;
|
strlist ** o=&u->orders;
|
||||||
|
|
||||||
f->magiegebiet = u->faction->magiegebiet;
|
f->magiegebiet = u->faction->magiegebiet;
|
||||||
|
fset(f, FL_RESTARTED);
|
||||||
f->options = u->faction->options;
|
f->options = u->faction->options;
|
||||||
freestrlist(nu->orders);
|
freestrlist(nu->orders);
|
||||||
nu->orders = u->orders;
|
nu->orders = u->orders;
|
||||||
|
@ -1072,10 +1073,16 @@ quit(void)
|
||||||
cmistake(u, S->s, 242, MSG_EVENT);
|
cmistake(u, S->s, 242, MSG_EVENT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (u->faction->age < 100) {
|
if (fval(u->faction, FL_RESTARTED)) {
|
||||||
|
/* schon einmal neustart gemacht */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
frace = findrace(getstrtoken(), u->faction->locale);
|
||||||
|
if (!frace && u->faction->age < 100) {
|
||||||
frace = u->faction->race;
|
frace = u->faction->race;
|
||||||
} else {
|
} else if (frace == NULL || !playerrace(frace)) {
|
||||||
frace = findrace(getstrtoken(), u->faction->locale);
|
cmistake(u, S->s, 243, MSG_EVENT);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frace == NULL || !playerrace(frace)) {
|
if (frace == NULL || !playerrace(frace)) {
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "curse.h" /* für C_NOCOST */
|
#include "curse.h" /* für C_NOCOST */
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "language.h"
|
|
||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
#include "save.h"
|
#include "save.h"
|
||||||
|
|
||||||
|
@ -29,6 +28,7 @@
|
||||||
#include <base36.h>
|
#include <base36.h>
|
||||||
#include <resolve.h>
|
#include <resolve.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
|
#include <language.h>
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -881,12 +881,13 @@ typedef struct skillvalue {
|
||||||
#define FL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
|
#define FL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
|
||||||
#define FL_TAKEALL (1<<25) /* Einheit nimmt alle Gegenstände an */
|
#define FL_TAKEALL (1<<25) /* Einheit nimmt alle Gegenstände an */
|
||||||
#define FL_UNNAMED (1<<26) /* Partei/Einheit/Gebäude/Schiff ist unbenannt */
|
#define FL_UNNAMED (1<<26) /* Partei/Einheit/Gebäude/Schiff ist unbenannt */
|
||||||
|
#define FL_RESTARTED (1<<27) /* Partei hat schon einen Neustart gemacht */
|
||||||
|
|
||||||
/* Flags, die gespeichert werden sollen: */
|
/* Flags, die gespeichert werden sollen: */
|
||||||
#ifdef NOAID
|
#ifdef NOAID
|
||||||
#define FL_SAVEMASK (FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOAID | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
|
#define FL_SAVEMASK (FL_NOAID | FL_RESTARTED | FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
|
||||||
#else
|
#else
|
||||||
#define FL_SAVEMASK (FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
|
#define FL_SAVEMASK (FL_RESTARTED | FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define fval(u, i) ((u)->flags & (i))
|
#define fval(u, i) ((u)->flags & (i))
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <base36.h>
|
#include <base36.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
|
#include <language.h>
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -32,6 +33,34 @@
|
||||||
|
|
||||||
ship_typelist *shiptypes = NULL;
|
ship_typelist *shiptypes = NULL;
|
||||||
|
|
||||||
|
static local_names * snames;
|
||||||
|
|
||||||
|
const ship_type *
|
||||||
|
findshiptype(const char * name, const locale * lang)
|
||||||
|
{
|
||||||
|
local_names * sn = snames;
|
||||||
|
void * i;
|
||||||
|
|
||||||
|
while (sn) {
|
||||||
|
if (sn->lang==lang) break;
|
||||||
|
sn=sn->next;
|
||||||
|
}
|
||||||
|
if (!sn) {
|
||||||
|
struct ship_typelist * stl = shiptypes;
|
||||||
|
sn = calloc(sizeof(local_names), 1);
|
||||||
|
sn->next = snames;
|
||||||
|
sn->lang = lang;
|
||||||
|
while (stl) {
|
||||||
|
const char * n = locale_string(lang, stl->type->name[0]);
|
||||||
|
addtoken(&sn->names, n, (void*)stl->type);
|
||||||
|
stl=stl->next;
|
||||||
|
}
|
||||||
|
snames = sn;
|
||||||
|
}
|
||||||
|
if (findtoken(&sn->names, name, &i)==E_TOK_NOMATCH) return NULL;
|
||||||
|
return (const ship_type*)i;
|
||||||
|
}
|
||||||
|
|
||||||
const ship_type *
|
const ship_type *
|
||||||
st_find(const char* name)
|
st_find(const char* name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,4 +92,7 @@ extern struct unit *shipowner(const struct region * r, const struct ship * sh);
|
||||||
extern ship *new_ship(const struct ship_type * stype, struct region * r);
|
extern ship *new_ship(const struct ship_type * stype, struct region * r);
|
||||||
extern const char *shipname(const struct ship * sh);
|
extern const char *shipname(const struct ship * sh);
|
||||||
extern ship *findship(int n);
|
extern ship *findship(int n);
|
||||||
|
|
||||||
|
extern const struct ship_type * findshiptype(const char *s, const struct locale * lang);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue