--- deliantra/server/include/object.h 2007/05/14 19:08:26 1.121
+++ deliantra/server/include/object.h 2007/07/05 08:10:30 1.136
@@ -1,25 +1,24 @@
/*
- * CrossFire, A Multiplayer Online RPG
- *
- * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
- * Copyright (C) 2001 Mark Wedel & Crossfire Development Team
- * Copyright (C) 1992 Frank Tore Johansen
- *
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
+ *
+ * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
+ * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team
+ * Copyright (©) 1992,2007 Frank Tore Johansen
+ *
+ * Crossfire TRT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * The authors can be reached via e-mail at crossfire@schmorp.de
+ * along with this program. If not, see .
+ *
+ * The authors can be reached via e-mail to
*/
#ifndef OBJECT_H
@@ -33,14 +32,14 @@
typedef int tag_t;
enum {
+ body_skill,
+ body_combat,
body_range,
body_shield,
- body_combat,
body_arm,
body_torso,
body_head,
body_neck,
- body_skill,
body_finger,
body_shoulder,
body_foot,
@@ -61,7 +60,7 @@
typedef struct Body_Locations
{
- const char *save_name; /* Name used to load/save it to disk */
+ keyword save_name; /* Name used to load/save it to disk */
const char *use_name; /* Name used when describing an item we can use */
const char *nonuse_name; /* Name to describe objects we can't use */
} Body_Locations;
@@ -109,11 +108,6 @@
#define WILL_APPLY_DOOR 0x08
#define WILL_APPLY_FOOD 0x10
-/* However, if you're keeping a pointer of some sort, you probably
- * don't just want it copied, so you'll need to add to common/object.C,
- * e.g. ->copy_to ()
- */
-
struct body_slot
{
signed char info:4; /* body info as loaded from the file */
@@ -253,8 +247,8 @@
UUID ACC (RW, uuid); // Unique Identifier, survives saves etc.
int ACC (RO, count);
- int ACC (RO, index); // index into objects
- int ACC (RO, active); // index into actives
+ object_vector_index ACC (RO, index); // index into objects
+ object_vector_index ACC (RO, active); // index into actives
player_ptr ACC (RW, contr); /* Pointer to the player which control this object */
@@ -299,22 +293,6 @@
do_remove ();
}
- // move this object to the top of its env's inventory to speed up
- // searches for it.
- MTH void inv_splay ()
- {
- if (env && env->inv != this)
- {
- if (above) above->below = below;
- if (below) below->above = above;
-
- above = 0;
- below = env->inv;
- below->above = this;
- env->inv = this;
- }
- }
-
static bool can_merge_slow (object *op1, object *op2);
// this is often used in time-critical code, so optimise
@@ -328,6 +306,7 @@
MTH void set_owner (object *owner);
MTH void set_speed (float speed);
MTH bool change_weapon (object *ob);
+ MTH bool change_skill (object *ob);
MTH void open_container (object *new_container);
MTH void close_container ()
@@ -335,6 +314,15 @@
open_container (0);
}
+ MTH object *force_find (const shstr name);
+ MTH void force_add (const shstr name, int duration = 0);
+
+ // overwrite the attachable should_invoke function with a version that also checks ev_want_type
+ bool should_invoke (event_type event)
+ {
+ return ev_want_event [event] || ev_want_type [type] || cb;
+ }
+
MTH void instantiate ();
// recalculate all stats
@@ -416,6 +404,11 @@
return head ? head : this;
}
+ MTH bool is_head ()
+ {
+ return head_ () == this;
+ }
+
MTH std::string long_desc (object *who = 0);
MTH std::string describe_monster (object *who = 0);
MTH std::string describe_item (object *who = 0);
@@ -498,28 +491,31 @@
MTH struct region *region () const;
protected:
- friend struct archetype;
-
- void link ();
+ void link ();
void unlink ();
object ();
~object ();
};
-typedef object_vector