--- deliantra/server/include/object.h 2016/11/16 23:42:00 1.270 +++ deliantra/server/include/object.h 2018/11/18 15:19:48 1.274 @@ -1,6 +1,7 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * + * Copyright (©) 2018 Marc Alexander Lehmann / the Deliantra team * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2001 Mark Wedel & Crossfire Development Team * Copyright (©) 1992 Frank Tore Johansen @@ -182,6 +183,32 @@ shstr id; /* Used as connected value in buttons/gates */ } oblinkpt; +// temporary hack to find the culprit who corrupts face numbers. maybe. hopefully. +struct faceidx_debug +{ + faceidx x; + + operator faceidx () const + { + return x; + } + + faceidx operator =(faceidx i) + { + if (ecb_expect_false (i >= faces.size ())) + { + fork_abort ("illegal faceidx assignment"); + i = blank_face; + } + + return x = i; + } +}; + +#if CFPERL +static inline void sv_to (SV *sv, faceidx_debug &v) { v = SvIV (sv); } +#endif + INTERFACE_CLASS (object) // these are being copied struct object_copy : attachable @@ -254,7 +281,7 @@ body_slot slot [NUM_BODY_LOCATIONS]; - faceidx ACC (RW, face); /* the graphical face */ + faceidx_debug ACC (RW, face); /* the graphical face */ faceidx ACC (RW, sound); /* the sound face */ faceidx ACC (RW, sound_destroy); /* played on destroy */ @@ -437,7 +464,7 @@ // can be different if originator is causing op to // move (originator is pushing op) // returns 0 if the object is not able to move to the - // desired space, 1 otherwise (in which case we also + // desired space, 1 otherwise (in which case we also // move the object accordingly. This function is // very similiar to move_object. int move (int dir, object *originator); @@ -584,7 +611,7 @@ MTH bool has_dialogue () const { return msg_has_dialogue (&msg); } - /* need_identify returns true if the item should be identified. This + /* need_identify returns true if the item should be identified. This * function really should not exist - by default, any item not identified * should need it. */ @@ -805,6 +832,10 @@ MTH int anim_frames () const { return anim ().num_animations; } MTH int anim_facings () const { return anim ().facings; } + // sets a new animation frame, if the object has animation frames, + // and updates the face + MTH void update_anim_frame (int frame); + MTH utf8_string as_string (); // low-level management, statistics, ... @@ -945,10 +976,10 @@ /* Used by update_object to know if the object being passed is * being added or removed. */ -#define UP_OBJ_INSERT 1 -#define UP_OBJ_REMOVE 2 -#define UP_OBJ_CHANGE 3 -#define UP_OBJ_FACE 4 /* Only thing that changed was the face */ +#define UP_OBJ_INSERT 1 // object was inserted +#define UP_OBJ_REMOVE 2 // object was removed +#define UP_OBJ_CHANGE 3 // object has changed in some unspecified way +#define UP_OBJ_FACE 4 // only thing that changed was the face /* These are flags passed to insert_ob_in_map and * insert_ob_in_ob. Note that all flags may not be meaningful @@ -961,7 +992,7 @@ * originator - saves cpu time if you know the inserted object * is not meaningful in terms of having an effect. * INS_ON_TOP: Always put object on top. Generally only needed when loading - * files from disk and ordering needs to be preserved. + * files from disk and ordering needs to be preserved. * INS_BELOW_ORIGINATOR: Insert new object immediately below originator - * Use for treasure chests so the new object is the highest thing * beneath the player, but not actually above it. Note - the