diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 70a3b7556..4f3ca8cf4 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -2629,9 +2629,6 @@ reports(void) #endif makedir(reportpath(), 0700); - if (global.data_version 0 && lbuf[i - 1] == ESCAPE_CHAR) - lbuf[--i] = SPACE_REPLACEMENT; - else - lbuf[i] = ' '; - } - i++; - s++; - } - - lbuf[i] = 0; - return lbuf; + *cursor = '\0'; + return lbuf; } const char * -getstrtoken (void) +getstrtoken(void) { - return igetstrtoken (0); + return igetstrtoken (0); } int diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 06238f3cb..a6d809de5 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -951,9 +951,8 @@ extern param_t findparam(const char *s, const struct locale * lang); extern param_t igetparam(const char *s, const struct locale * lang); extern param_t getparam(const struct locale * lang); -#define BASE36_VERSION 93 extern int atoi36(const char * s); -#define getid() ((global.data_versionno) diff --git a/src/common/kernel/objtypes.c b/src/common/kernel/objtypes.c index 5b88824b8..72687c30b 100644 --- a/src/common/kernel/objtypes.c +++ b/src/common/kernel/objtypes.c @@ -61,10 +61,6 @@ obj_ID default_ID; /* die müssen schon ein value zurückliefern... */ static char * notimplemented_desc(void *p) { unused(p); assert(0); return 0; } -static void cannot_destroy(void *p) { - fprintf(stderr, "** destroy-method unzerstörbares Objekt <%p> aufgerufen! **\n", p); -} - /****** Unit ******/ static obj_ID unit_ID(void *p) { obj_ID id; id.a = p ? ((unit *)p)->no : 0; id.b = 0; return id; @@ -75,9 +71,6 @@ static void * unit_find(obj_ID id) { static attrib ** unit_attribs( void *p ) { return &((unit *)p)->attribs; } -static void * unit_deref( void *pp ) { - return (void *) (*((unit **)pp)); -} static void unit_set( void *pp, void *p ) { *(unit **)pp = (unit *)p; } @@ -93,9 +86,6 @@ static void * region_find(obj_ID id) { static attrib ** region_attribs( void *p ) { return &((region *)p)->attribs; } -static void * region_deref( void *pp ) { - return (void *) (*((region **)pp)); -} static void region_set( void *pp, void *p ) { *(region **)pp = (region *)p; } @@ -110,9 +100,6 @@ static void * building_find(obj_ID id) { static attrib ** building_attribs( void *p ) { return &((building *)p)->attribs; } -static void * building_deref( void *pp ) { - return (void *) (*((building **)pp)); -} static void building_set( void *pp, void *p ) { *(building **)pp = (building *)p; } @@ -127,9 +114,6 @@ static obj_ID ship_ID(void *p) { static attrib ** ship_attribs( void *p ) { return &((ship *)p)->attribs; } -static void * ship_deref( void *pp ) { - return (void *) (*((ship **)pp)); -} static void ship_set( void *pp, void *p ) { *(ship **)pp = (ship *)p; } @@ -144,9 +128,6 @@ static obj_ID faction_ID(void *p) { static attrib ** faction_attribs( void *p ) { return &((faction *)p)->attribs; } -static void * faction_deref( void *pp ) { - return (void *) (*((faction **)pp)); -} static void faction_set( void *pp, void *p ) { *(faction **)pp = (faction *)p; } diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 582c0b4a8..5a501117a 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -134,20 +134,10 @@ cfopen(const char *filename, const char *mode) /* Dummy-Funktion für die Kompatibilität */ -#define rid(F) ((global.data_versionnext) if (itm->number) { - whs(F, resourcename(itm->type->rtype, 0)); - wi(F, itm->number); + fprintf(F, "%s %i ", resourcename(itm->type->rtype, 0), itm->number); } fputs("end ", F); } diff --git a/src/common/util/log.c b/src/common/util/log.c index e7f705fae..dcef41cf0 100644 --- a/src/common/util/log.c +++ b/src/common/util/log.c @@ -113,11 +113,9 @@ _log_error(const char * format, ...) vfprintf(stderr, format, marker); va_end(marker); } - if (flags & LOG_FLUSH) { - log_flush(); + log_flush(); } } -} void _log_info(unsigned int flag, const char * format, ...) diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index 5a57da864..5e8b4d756 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -1101,9 +1101,12 @@ check_phoenix(void) } } + f = findfaction(MONSTER_FACTION); + if (f==NULL) return; + /* it is not, so we create it */ r = random_land_region(); - phoenix = createunit(r, findfaction(MONSTER_FACTION), 1, phoenix_race); + phoenix = createunit(r, f, 1, phoenix_race); phoenix->name = strdup("Der Phönix"); /* TODO: generate an appropriate region message */ diff --git a/src/eressea/lua/eressea.cpp b/src/eressea/lua/eressea.cpp index 8c096f03e..87d2557ac 100644 --- a/src/eressea/lua/eressea.cpp +++ b/src/eressea/lua/eressea.cpp @@ -105,6 +105,13 @@ lua_setstring(const char * lname, const char * key, const char * str) locale_setstring(lang, key, str); } +static const char * +lua_getstring(const char * lname, const char * key) +{ + struct locale * lang = find_locale(lname); + return locale_getstring(lang, key); +} + void bind_eressea(lua_State * L) { @@ -120,7 +127,10 @@ bind_eressea(lua_State * L) def("add_equipment", &lua_addequipment), def("get_turn", &get_turn), def("remove_empty_units", &remove_empty_units), + + /* localization: */ def("set_string", &lua_setstring), + def("get_string", &lua_getstring), def("set_flag", &set_flag), def("get_flag", &get_flag), diff --git a/src/eressea/lua/unit.cpp b/src/eressea/lua/unit.cpp index 93a37a97d..74beab6ef 100644 --- a/src/eressea/lua/unit.cpp +++ b/src/eressea/lua/unit.cpp @@ -270,7 +270,25 @@ unit_setmagic(unit& u, const char * type) static void unit_addorder(unit& u, const char * str) { - addstrlist(&u.orders, str); + char buf[1024]; + char * s = buf; + boolean quote = false; + while (*str) { + switch (*str) { + case '"': + quote=!quote; + break; + case ' ': + if (quote) *s++ = SPACE_REPLACEMENT; + else *s++ = ' '; + break; + default: + *s++ = *str; + } + ++str; + } + *s=0; + addstrlist(&u.orders, buf); u.faction->lastorders = turn; } diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp index f2bb2d953..2353c2ef0 100644 --- a/src/eressea/server.cpp +++ b/src/eressea/server.cpp @@ -627,6 +627,7 @@ main(int argc, char *argv[]) int i; char zText[MAX_PATH]; + global.data_version = RELEASE_VERSION; sqlpatch = true; log_open("eressea.log"); printf("\n%s PBEM host\n"