summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 0e30708d9..28d06a8f1 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -19727,7 +19727,7 @@ static BUILDIN(setunitdata)
clif->changelook(bl, LOOK_WEAPON, val);
break;
case UDT_LOOKDIR:
- unit->setdir(bl, (uint8) val);
+ unit->setdir(bl, (enum unit_dir) val);
break;
case UDT_CANMOVETICK:
md->ud.canmove_tick = val;
@@ -19859,7 +19859,7 @@ static BUILDIN(setunitdata)
status->calc_misc(bl, &hd->base_status, hd->homunculus.level);
break;
case UDT_LOOKDIR:
- unit->setdir(bl, (unsigned char) val);
+ unit->setdir(bl, (enum unit_dir) val);
break;
case UDT_CANMOVETICK:
hd->ud.canmove_tick = val;
@@ -19998,7 +19998,7 @@ static BUILDIN(setunitdata)
status->calc_misc(bl, &pd->status, pd->pet.level);
break;
case UDT_LOOKDIR:
- unit->setdir(bl, (unsigned char) val);
+ unit->setdir(bl, (enum unit_dir) val);
break;
case UDT_CANMOVETICK:
pd->ud.canmove_tick = val;
@@ -20131,7 +20131,7 @@ static BUILDIN(setunitdata)
status->calc_misc(bl, &mc->base_status, mc->db->lv);
break;
case UDT_LOOKDIR:
- unit->setdir(bl, (unsigned char) val);
+ unit->setdir(bl, (enum unit_dir) val);
break;
case UDT_CANMOVETICK:
mc->ud.canmove_tick = val;
@@ -20265,7 +20265,7 @@ static BUILDIN(setunitdata)
status->calc_misc(bl, &ed->base_status, ed->db->lv);
break;
case UDT_LOOKDIR:
- unit->setdir(bl, (unsigned char) val);
+ unit->setdir(bl, (enum unit_dir) val);
break;
case UDT_CANMOVETICK:
ed->ud.canmove_tick = val;
@@ -20397,7 +20397,7 @@ static BUILDIN(setunitdata)
status->calc_misc(bl, &nd->status, nd->level);
break;
case UDT_LOOKDIR:
- unit->setdir(bl, (unsigned char) val);
+ unit->setdir(bl, (enum unit_dir) val);
break;
case UDT_STR:
nd->status.str = (unsigned short) val;
@@ -23250,7 +23250,6 @@ static BUILDIN(progressbar_unit)
}
static BUILDIN(pushpc)
{
- uint8 dir;
int cells, dx, dy;
struct map_session_data* sd;
@@ -23259,14 +23258,14 @@ static BUILDIN(pushpc)
return true;
}
- dir = script_getnum(st,2);
- cells = script_getnum(st,3);
+ enum unit_dir dir = script_getnum(st, 2);
+ cells = script_getnum(st,3);
- if (dir > 7) {
+ if (dir >= UNIT_DIR_MAX) {
ShowWarning("buildin_pushpc: Invalid direction %d specified.\n", dir);
script->reportsrc(st);
- dir%= 8; // trim spin-over
+ dir %= UNIT_DIR_MAX; // trim spin-over
}
if(!cells)
@@ -23275,10 +23274,11 @@ static BUILDIN(pushpc)
}
else if(cells<0)
{// pushing backwards
- dir = (dir+4)%8; // turn around
- cells = -cells;
+ dir = unit_get_opposite_dir(dir);
+ cells = -cells;
}
+ Assert_retr(false, dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX);
dx = dirx[dir];
dy = diry[dir];