ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/object.h
(Generate patch)

Comparing deliantra/server/include/object.h (file contents):
Revision 1.226 by root, Sun Mar 21 23:47:16 2010 UTC vs.
Revision 1.233 by root, Sun Apr 4 02:51:56 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
32 32
33//+GPL 33//+GPL
34 34
35typedef int tag_t; 35typedef int tag_t;
36 36
37// also see common/item.C
37enum { 38enum {
38 body_skill, 39 body_skill,
39 body_combat, 40 body_combat,
40 body_range, 41 body_range,
41 body_shield, 42 body_shield,
50 body_wrist, 51 body_wrist,
51 body_waist, 52 body_waist,
52 NUM_BODY_LOCATIONS 53 NUM_BODY_LOCATIONS
53}; 54};
54 55
55enum slottype_t
56{
57 slot_none,
58 slot_combat,
59 slot_ranged,
60};
61
62/* See common/item.c */ 56/* See common/item.c */
63 57
64typedef struct Body_Locations 58typedef struct Body_Locations
65{ 59{
66 keyword save_name; /* Name used to load/save it to disk */ 60 keyword save_name; /* Name used to load/save it to disk */
289 283
290const_utf8_string query_weight (const object *op); 284const_utf8_string query_weight (const object *op);
291const_utf8_string query_short_name (const object *op); 285const_utf8_string query_short_name (const object *op);
292const_utf8_string query_name (const object *op); 286const_utf8_string query_name (const object *op);
293const_utf8_string query_base_name (const object *op, int plural); 287const_utf8_string query_base_name (const object *op, int plural);
288sint64 query_cost (const object *tmp, object *who, int flag);
289const char *query_cost_string (const object *tmp, object *who, int flag);
290
291int change_ability_duration (object *spell, object *caster);
292int min_casting_level (object *caster, object *spell);
293int casting_level (object *caster, object *spell);
294sint16 SP_level_spellpoint_cost (object *caster, object *spell, int flags);
295int SP_level_dam_adjust (object *caster, object *spob);
296int SP_level_duration_adjust (object *caster, object *spob);
297int SP_level_range_adjust (object *caster, object *spob);
294 298
295struct object : zero_initialised, object_copy 299struct object : zero_initialised, object_copy
296{ 300{
297 // These variables are not changed by ->copy_to 301 // These variables are not changed by ->copy_to
298 maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ 302 maptile *ACC (RW, map); /* Pointer to the map in which this object is present */
360 bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all 364 bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all
361 MTH void post_load_check (); // do some adjustments after parsing 365 MTH void post_load_check (); // do some adjustments after parsing
362 static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. 366 static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go.
363 bool write (object_freezer &f); 367 bool write (object_freezer &f);
364 368
365 MTH int slottype () const;
366 MTH static object *create (); 369 MTH static object *create ();
367 const mapxy &operator =(const mapxy &pos); 370 const mapxy &operator =(const mapxy &pos);
368 MTH void copy_to (object *dst); 371 MTH void copy_to (object *dst);
369 MTH object *clone (); // create + copy_to a single object 372 MTH object *clone (); // create + copy_to a single object
370 MTH object *deep_clone (); // copy whole more chain and inventory 373 MTH object *deep_clone (); // copy whole more chain and inventory
397 remove (); 400 remove ();
398 *this = pos; 401 *this = pos;
399 insert_at (this, this); 402 insert_at (this, this);
400 } 403 }
401 404
402 // high-level move functions, return true if successful 405 // high-level move method.
406 // object op is trying to move in direction dir.
407 // originator is typically the same as op, but
408 // can be different if originator is causing op to
409 // move (originator is pushing op)
410 // returns 0 if the object is not able to move to the
411 // desired space, 1 otherwise (in which case we also
412 // move the object accordingly. This function is
413 // very similiar to move_object.
403 int move (int dir, object *originator); 414 int move (int dir, object *originator);
404 415
405 int move (int dir) 416 int move (int dir)
406 { 417 {
407 return move (dir, this); 418 return move (dir, this);
408 } 419 }
420
421 // changes move_type to a new value - handles move_on/move_off effects
422 MTH void change_move_type (MoveType mt);
409 423
410 static bool can_merge_slow (object *op1, object *op2); 424 static bool can_merge_slow (object *op1, object *op2);
411 425
412 // this is often used in time-critical code, so optimise 426 // this is often used in time-critical code, so optimise
413 MTH static bool can_merge (object *op1, object *op2) 427 MTH static bool can_merge (object *op1, object *op2)
418 } 432 }
419 433
420 MTH void set_owner (object *owner); 434 MTH void set_owner (object *owner);
421 MTH void set_speed (float speed); 435 MTH void set_speed (float speed);
422 MTH void set_glow_radius (sint8 rad); 436 MTH void set_glow_radius (sint8 rad);
423 MTH bool change_weapon (object *ob);
424 MTH bool change_skill (object *ob); 437 MTH bool change_skill (object *ob); // deprecated?
425 438
426 MTH void open_container (object *new_container); 439 MTH void open_container (object *new_container);
427 MTH void close_container () 440 MTH void close_container ()
428 { 441 {
429 open_container (0); 442 open_container (0);
600 MTH bool is_player () const 613 MTH bool is_player () const
601 { 614 {
602 return !!contr; 615 return !!contr;
603 } 616 }
604 617
618 /* elmex: this method checks whether the object is in a shop */
619 MTH bool is_in_shop () const;
620
605 MTH bool affects_los () const 621 MTH bool affects_los () const
606 { 622 {
607 return glow_radius || flag [FLAG_BLOCKSVIEW]; 623 return glow_radius || flag [FLAG_BLOCKSVIEW];
608 } 624 }
609 625
649 MTH void set_flag_inv (int flag, int value = 1); 665 MTH void set_flag_inv (int flag, int value = 1);
650 666
651 void enter_exit (object *exit);//Perl 667 void enter_exit (object *exit);//Perl
652 MTH void enter_map (maptile *newmap, int x, int y); 668 MTH void enter_map (maptile *newmap, int x, int y);
653 void player_goto (const_utf8_string path, int x, int y); // only for players 669 void player_goto (const_utf8_string path, int x, int y); // only for players
670 MTH bool apply (object *ob, int aflags = AP_APPLY); // ob may be 0
654 671
655 // returns the mapspace this object is in 672 // returns the mapspace this object is in
656 mapspace &ms () const; 673 mapspace &ms () const;
657 674
658 // fully recursive iterator 675 // fully recursive iterator

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines