Bugfix crashbug bei Astraler Wirbel

This commit is contained in:
Enno Rehling 2004-01-18 23:52:57 +00:00
parent 53d6b4c2b8
commit 7d927094dd
3 changed files with 28 additions and 23 deletions

View File

@ -3849,8 +3849,12 @@ eval_direction(struct opstack ** stack, const void * userdata)
{
const faction * report = (const faction*)userdata;
int i = opop(stack, int);
const char * c = LOC(report->locale, directions[i]);
const char * c;
if (i>=0) {
c = LOC(report->locale, directions[i]);
} else {
c = LOC(report->locale, "unknown_direction");
}
opush(stack, strcpy(balloc(strlen(c)+1), c));
}

View File

@ -37,20 +37,20 @@ extern "C" {
/* #define MSG_LEVELS -- msg-levels active */
/* basic types used in the eressea "kernel" */
typedef unsigned char order_t;
typedef char terrain_t;
typedef char direction_t;
typedef int race_t;
typedef int magic_t;
typedef short order_t;
typedef short terrain_t;
typedef short direction_t;
typedef short race_t;
typedef short magic_t;
typedef short skill_t;
typedef short typ_t;
typedef int herb_t;
typedef int potion_t;
typedef int luxury_t;
typedef int weapon_t;
typedef int item_t;
typedef int resource_t;
typedef int spellid_t;
typedef short herb_t;
typedef short potion_t;
typedef short luxury_t;
typedef short weapon_t;
typedef short item_t;
typedef short resource_t;
typedef short spellid_t;
struct plane;
struct spell;

View File

@ -1058,7 +1058,7 @@ travel(region * first, unit * u, region * next, int flucht)
direction_t dir = reldirection(current, next);
border * b = get_borders(current, next);
while (b) {
while (b!=NULL) {
if (b->type==&bt_wisps) {
wall_data * wd = (wall_data*)b->data;
if (wd->active) {
@ -1081,15 +1081,17 @@ travel(region * first, unit * u, region * next, int flucht)
k -= BP_NORMAL;
if (k<0) break;
/* r2 -> Zielregion, r3 -> Momentane Region */
if (move_blocked(u, current, reldirection(current, next))
if (dir>=0 && move_blocked(u, current, dir)
|| curse_active(get_curse(current->attribs, fogtrap_ct)))
{
ADDMSG(&u->faction->msgs, msg_message("leavefail",
"unit region", u, next));
"unit region",
u, next));
}
if (!entrance_allowed(u, next)) {
if (!entrance_allowed(u, next)) {
ADDMSG(&u->faction->msgs, msg_message("regionowned",
"unit region target", u, current, next));
"unit region target",
u, current, next));
break;
}
if ((wache = bewegung_blockiert_von(u, current)) != (unit *) NULL
@ -1116,10 +1118,9 @@ travel(region * first, unit * u, region * next, int flucht)
if (rterrain(next) == T_OCEAN && !canswim(u)) {
plane *pl = getplane(next);
if(pl && fval(pl, PFL_NOCOORDS)) {
if (pl!=NULL && fval(pl, PFL_NOCOORDS)) {
add_message(&u->faction->msgs, new_message(u->faction,
"detectoceandir%u:unit%i:direction", u,
reldirection(current, next)));
"detectoceandir%u:unit%i:direction", u, dir));
} else {
add_message(&u->faction->msgs, new_message(u->faction,
"detectocean%u:unit%r:region", u, next));
@ -1131,7 +1132,7 @@ travel(region * first, unit * u, region * next, int flucht)
plane *pl = getplane(next);
if(pl && fval(pl, PFL_NOCOORDS)) {
add_message(&u->faction->msgs, new_message(u->faction,
"detectforbiddendir%u:unit%i:direction", u, reldirection(current, next)));
"detectforbiddendir%u:unit%i:direction", u, dir));
} else {
add_message(&u->faction->msgs, new_message(u->faction,
"detectforbidden%u:unit%r:region", u, next));