--- deliantra/server/include/object.h 2011/05/03 11:23:48 1.260 +++ deliantra/server/include/object.h 2016/11/16 22:14:05 1.269 @@ -1,24 +1,24 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. - * - * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * + * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2001 Mark Wedel & Crossfire Development Team * Copyright (©) 1992 Frank Tore Johansen - * + * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the Affero GNU General Public License * and the GNU General Public License along with this program. If not, see * . - * + * * The authors can be reached via e-mail to */ @@ -296,7 +296,7 @@ //float ACC (RW, expmul) = 1.0; /* needed experience = (calc_exp*expmul) - means some */ // /* races/classes can need less/more exp to gain levels */ - static const float expmul = 1.0;//D + constexpr static const float expmul = 1.0;//D float ACC (RW, move_slow_penalty); /* How much this slows down the object */ /* Following are values used by any object */ @@ -460,7 +460,7 @@ && can_merge_slow (op1, op2); } - MTH void set_owner (object *owner); + MTH void set_owner (object_ornull *owner); MTH void set_speed (float speed); MTH void set_glow_radius (sint8 rad); @@ -484,6 +484,8 @@ || (!env && flag [FLAG_APPLIED])); } + MTH object *find_spell (const_utf8_string prefix) const; + MTH object *force_find (shstr_tmp name); MTH void force_set_timer (int duration); MTH object *force_add (shstr_tmp name, int duration = 0); @@ -523,9 +525,9 @@ return nrof ? nrof : 1; } - MTH sint32 total_weight () const + MTH weight_t total_weight () const { - return (weight + carrying) * number_of (); + return sint64 (weight + carrying) * number_of (); } MTH void update_weight (); @@ -537,9 +539,9 @@ } // return the volume of this object in cm³ - MTH uint64 volume () const + MTH volume_t volume () const { - return (uint64)total_weight () + return (volume_t)total_weight () * 1024 // 1000 actually * (type == CONTAINER ? 128 : 1) / dominant_material ()->density; // ugh, division @@ -884,7 +886,7 @@ MTH void post_load_check (); // do some adjustments after parsing object_vector_index ACC (RW, archid); // index in archvector - shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ + shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ sint8 ACC (RW, max_x); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ @@ -926,16 +928,16 @@ #define for_inv_removable(op,var) \ for (object *var, *next_ = (op)->inv; (var = next_), var && (next_ = var->below), var; ) -#define for_all_objects(var) \ - for (unsigned _i = 0; _i < objects.size (); ++_i) \ +#define for_all_objects(var) \ + for (unsigned _i = 0; _i < objects.size (); ++_i) \ statementvar (object *, var, objects [_i]) -#define for_all_actives(var) \ - for (unsigned _i = 0; _i < actives.size (); ++_i) \ +#define for_all_actives(var) \ + for (unsigned _i = 0; _i < actives.size (); ++_i) \ statementvar (object *, var, actives [_i]) -#define for_all_archetypes(var) \ - for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ +#define for_all_archetypes(var) \ + for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ statementvar (archetype *, var, archetypes [_i]) //+GPL @@ -948,7 +950,7 @@ #define UP_OBJ_CHANGE 3 #define UP_OBJ_FACE 4 /* Only thing that changed was the face */ -/* These are flags passed to insert_ob_in_map and +/* These are flags passed to insert_ob_in_map and * insert_ob_in_ob. Note that all flags may not be meaningful * for both functions. * Most are fairly explanatory: