Bugfix englische Schiffsnamen

Bugfix uninitialisierte Variable
This commit is contained in:
Enno Rehling 2002-01-20 09:31:15 +00:00
parent 59e1c30357
commit 81dfda6805
7 changed files with 46 additions and 14 deletions

View File

@ -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 {

View File

@ -52,8 +52,6 @@ extern int income(const struct unit * u);
/* Wieviel Fremde eine Partei pro Woche aufnehmen kann */
#define MAXNEWBIES 5
const struct ship_type * findshiptype(char *s, const struct locale * lang);
void scramble(void *v1, int n, size_t width);
void economics(void);
void produce(void);

View File

@ -224,6 +224,7 @@ restart(unit *u, const race * rc)
strlist ** o=&u->orders;
f->magiegebiet = u->faction->magiegebiet;
fset(f, FL_RESTARTED);
f->options = u->faction->options;
freestrlist(nu->orders);
nu->orders = u->orders;
@ -1072,10 +1073,16 @@ quit(void)
cmistake(u, S->s, 242, MSG_EVENT);
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;
} else {
frace = findrace(getstrtoken(), u->faction->locale);
} else if (frace == NULL || !playerrace(frace)) {
cmistake(u, S->s, 243, MSG_EVENT);
continue;
}
if (frace == NULL || !playerrace(frace)) {

View File

@ -21,7 +21,6 @@
#include "curse.h" /* für C_NOCOST */
#include "unit.h"
#include "region.h"
#include "language.h"
#include "skill.h"
#include "save.h"
@ -29,6 +28,7 @@
#include <base36.h>
#include <resolve.h>
#include <event.h>
#include <language.h>
/* libc includes */
#include <assert.h>

View File

@ -881,12 +881,13 @@ typedef struct skillvalue {
#define FL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
#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_RESTARTED (1<<27) /* Partei hat schon einen Neustart gemacht */
/* Flags, die gespeichert werden sollen: */
#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
#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
#define fval(u, i) ((u)->flags & (i))

View File

@ -24,6 +24,7 @@
/* util includes */
#include <base36.h>
#include <event.h>
#include <language.h>
/* libc includes */
#include <stdlib.h>
@ -32,6 +33,34 @@
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 *
st_find(const char* name)
{

View File

@ -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 const char *shipname(const struct ship * sh);
extern ship *findship(int n);
extern const struct ship_type * findshiptype(const char *s, const struct locale * lang);
#endif