From fa0114b64c83a02cac4c3b63448c419628f462c8 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 5 Sep 2004 09:51:57 +0000 Subject: [PATCH] http://eressea.upb.de/mantis/bug_view_page.php?bug_id=0000246 - Logging an error when a ship is moved to an illegal coast. - Removing a const-cast warning from call to translate() --- src/common/kernel/movement.c | 12 ++++++++++++ src/common/util/translation.c | 2 +- src/common/util/translation.h | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index e56e5bfe4..c8b59800b 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -45,6 +45,7 @@ /* util includes */ #include +#include #include #include @@ -550,6 +551,17 @@ move_ship(ship * sh, region * from, region * to, region_list * route) } if (*iunit==u) iunit=&u->next; } + +#ifndef NDEBUG + if (rterrain(sh->region)!=T_OCEAN) { + region * rcoast = rconnect(sh->region, sh->coast); + if (rterrain(rcoast)!=T_OCEAN) { + log_error(("ship %s sailed into a coast with no ocean neighbours.\n", + shipid(sh))); + } + } +#endif + return sh; } diff --git a/src/common/util/translation.c b/src/common/util/translation.c index fbaa61512..5539b5c0d 100644 --- a/src/common/util/translation.c +++ b/src/common/util/translation.c @@ -335,7 +335,7 @@ parse(opstack ** stack, const char* inn, const void * userdata) } const char * -translate(const char* format, const void * userdata, const char* vars, const void* args[]) +translate(const char* format, const void * userdata, const char* vars, void* args[]) { int i = 0; const char *ic = vars; diff --git a/src/common/util/translation.h b/src/common/util/translation.h index 18cca01b5..916df2944 100644 --- a/src/common/util/translation.h +++ b/src/common/util/translation.h @@ -25,7 +25,7 @@ extern void opstack_push(struct opstack ** stack, void * data); extern void translation_init(void); extern void translation_done(void); extern const char * translate_va(const char* format, const void * userdata, const char* vars, ...); -extern const char * translate(const char* format, const void * userdata, const char* vars, const void* args[]); +extern const char * translate(const char* format, const void * userdata, const char* vars, void* args[]); /* eval_x functions */ typedef void (*evalfun)(struct opstack ** stack, const void *);