Crossfire Server, Trunk  R20608
Movement types and related macros.

Macros

#define MOVE_ALL   0x1f
 
#define MOVE_BLOCK_DEFAULT   MOVE_SWIM
 
#define MOVE_BOAT   0x10
 
#define MOVE_FLY_HIGH   0x4
 
#define MOVE_FLY_LOW   0x2
 
#define MOVE_FLYING   0x6
 
#define MOVE_SWIM   0x8
 
#define MOVE_WALK   0x1
 
#define OB_MOVE_BLOCK(ob1, ob2)   ((ob1->move_type&ob2->move_block) == ob1->move_type)
 
#define OB_TYPE_MOVE_BLOCK(ob1, type)   ((type != 0) && (ob1->move_type&type) == ob1->move_type)
 

Typedefs

typedef unsigned char MoveType
 

Detailed Description

Those flags are all possible movement types.

If you add new movement types, you may need to update describe_item() so properly describe those types. change_abil() probably should be updated also.

Macro Definition Documentation

#define MOVE_BLOCK_DEFAULT   MOVE_SWIM

The normal assumption is that objects are walking/flying. So often we don't want to block movement, but still don't want to allow all types (swimming is rather specialized) - I also expect as more movement types show up, this is likely to get updated. Basically, this is the default for spaces that allow movement - anything but swimming right now. If you really want nothing at all, then can always set move_block to 0

Definition at line 424 of file define.h.

Referenced by surround_flag3(), unblock_exits(), and wall_blocked().

#define MOVE_BOAT   0x10

Boats/sailing.

Definition at line 412 of file define.h.

Referenced by initConstants().

#define MOVE_FLY_HIGH   0x4

High flying object.

Definition at line 409 of file define.h.

Referenced by change_abil(), describe_item(), fix_object(), initConstants(), and object_insert_in_map().

#define MOVE_FLYING   0x6
#define MOVE_SWIM   0x8

Swimming object.

Definition at line 411 of file define.h.

Referenced by change_abil(), describe_item(), and initConstants().

#define MOVE_WALK   0x1
#define OB_MOVE_BLOCK (   ob1,
  ob2 
)    ((ob1->move_type&ob2->move_block) == ob1->move_type)

Basic macro to see if ob2 blocks ob1 from moving onto this space. Basically, ob2 has to block all of ob1 movement types.

Definition at line 438 of file define.h.

Referenced by blocked_link(), roll_ob(), and try_fit().

#define OB_TYPE_MOVE_BLOCK (   ob1,
  type 
)    ((type != 0) && (ob1->move_type&type) == ob1->move_type)

Basic macro to see if if ob1 can not move onto a space based on the 'type' move_block parameter Add check - if type is 0, don't stop anything from moving onto it.

Definition at line 447 of file define.h.

Referenced by attempt_jump(), blocked_link(), cast_create_obj(), cast_light(), check_bullet(), common_process_projectile(), dimension_door(), fire_arch_from_position(), fire_bolt(), forklightning(), move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_missile(), ob_blocked(), ok_to_put_more(), path_to_player(), pets_move(), skill_attack(), stand_near_hostile(), steal(), and teleport().

Typedef Documentation

typedef unsigned char MoveType

Typdef here to define type large enough to hold bitmask of all movement types. Make one declaration so easy to update. uint8_t is defined yet, so just use what that would define it at anyways.

Definition at line 432 of file define.h.