else if (creature_ptr->change_floor_mode & CFM_UP)
move_num = -1;
- if (creature_ptr->change_floor_mode & CFM_SHAFT)
- move_num += SGN(move_num);
+ if (creature_ptr->change_floor_mode & CFM_SHAFT) {
+ auto direction = 0;
+ if (move_num > 0) {
+ direction = 1;
+ } else if (move_num < 0) {
+ direction = -1;
+ }
+
+ move_num += direction;
+ }
if (creature_ptr->change_floor_mode & CFM_DOWN) {
if (!is_in_dungeon(creature_ptr))
#define ABS(a) (((a) < 0) ? (-(a)) : (a))
/*
- * Non-typed sign extractor macro
- */
-#undef SGN
-#define SGN(a) (((a) < 0) ? (-1) : ((a) != 0))
-
-/*
* Refer to the member at offset of structure
*/
#define atoffset(TYPE, STRUCT_PTR, OFFSET) (*(TYPE*)(((char*)STRUCT_PTR) + (OFFSET)))