… | |
… | |
136 | { |
136 | { |
137 | signed char info:4; /* body info as loaded from the file */ |
137 | signed char info:4; /* body info as loaded from the file */ |
138 | signed char used:4; /* Calculated value based on items equipped */ |
138 | signed char used:4; /* Calculated value based on items equipped */ |
139 | }; |
139 | }; |
140 | |
140 | |
|
|
141 | typedef struct oblnk |
|
|
142 | { /* Used to link together several objects */ |
|
|
143 | object_ptr ob; |
|
|
144 | struct oblnk *next; |
|
|
145 | } objectlink; |
|
|
146 | |
|
|
147 | typedef struct oblinkpt |
|
|
148 | { /* Used to link together several object links */ |
|
|
149 | struct oblnk *link; |
|
|
150 | struct oblinkpt *next; |
|
|
151 | shstr id; /* Used as connected value in buttons/gates */ |
|
|
152 | } oblinkpt; |
|
|
153 | |
141 | INTERFACE_CLASS (object) |
154 | INTERFACE_CLASS (object) |
142 | // these are being copied |
155 | // these are being copied |
143 | struct object_copy : attachable |
156 | struct object_copy : attachable |
144 | { |
157 | { |
145 | sint16 ACC (RW, x), ACC (RW, y); /* Position in the map for this object */ |
158 | sint16 ACC (RW, x), ACC (RW, y); /* Position in the map for this object */ |
… | |
… | |
308 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
321 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
309 | client_container *seen_by; // seen by which player/container currently? |
322 | client_container *seen_by; // seen by which player/container currently? |
310 | key_value *key_values; /* Fields not explictly known by the loader. */ |
323 | key_value *key_values; /* Fields not explictly known by the loader. */ |
311 | |
324 | |
312 | // privates / perl |
325 | // privates / perl |
313 | const shstr &kv_get (const shstr &key) const; |
326 | shstr_tmp kv_get (shstr_tmp key) const; |
314 | void kv_del (const shstr &key); |
327 | void kv_del (shstr_tmp key); |
315 | void kv_set (const shstr &key, const shstr &value); |
328 | void kv_set (shstr_tmp key, shstr_tmp value); |
316 | |
329 | |
317 | // custom extra fields management |
330 | // custom extra fields management |
318 | struct key_value_access_proxy |
331 | struct key_value_access_proxy |
319 | { |
332 | { |
320 | object &ob; |
333 | object &ob; |
321 | shstr key; |
334 | shstr_tmp key; |
322 | |
335 | |
323 | key_value_access_proxy (object &ob, const shstr &key) |
336 | key_value_access_proxy (object &ob, shstr_tmp key) |
324 | : ob (ob), key (key) |
337 | : ob (ob), key (key) |
325 | { |
338 | { |
326 | } |
339 | } |
327 | |
340 | |
328 | const key_value_access_proxy &operator =(const shstr &value) const |
341 | const key_value_access_proxy &operator =(shstr_tmp value) const |
329 | { |
342 | { |
330 | ob.kv_set (key, value); |
343 | ob.kv_set (key, value); |
331 | return *this; |
344 | return *this; |
332 | } |
345 | } |
333 | |
346 | |
334 | operator const shstr &() const { return ob.kv_get (key); } |
347 | operator const shstr_tmp () const { return ob.kv_get (key); } |
335 | operator const char *() const { return ob.kv_get (key); } |
348 | operator const char *() const { return ob.kv_get (key); } |
336 | |
349 | |
337 | private: |
350 | private: |
338 | void operator =(int); |
351 | void operator =(int); |
339 | }; |
352 | }; |
340 | |
353 | |
341 | // operator [] is too annoying to use |
354 | // operator [] is too annoying to use |
342 | const key_value_access_proxy kv (const shstr &key) |
355 | const key_value_access_proxy kv (shstr_tmp key) |
343 | { |
356 | { |
344 | return key_value_access_proxy (*this, key); |
357 | return key_value_access_proxy (*this, key); |
345 | } |
358 | } |
346 | |
359 | |
347 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
360 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
… | |
… | |
412 | MTH void close_container () |
425 | MTH void close_container () |
413 | { |
426 | { |
414 | open_container (0); |
427 | open_container (0); |
415 | } |
428 | } |
416 | |
429 | |
417 | MTH object *force_find (const shstr name); |
430 | MTH object *force_find (shstr_tmp name); |
418 | MTH object *force_add (const shstr name, int duration = 0); |
431 | MTH object *force_add (shstr_tmp name, int duration = 0); |
|
|
432 | |
|
|
433 | oblinkpt *find_link () const; |
|
|
434 | MTH void add_link (maptile *map, shstr_tmp id); |
|
|
435 | MTH void remove_link (); |
419 | |
436 | |
420 | // overwrite the attachable should_invoke function with a version that also checks ev_want_type |
437 | // overwrite the attachable should_invoke function with a version that also checks ev_want_type |
421 | bool should_invoke (event_type event) |
438 | bool should_invoke (event_type event) |
422 | { |
439 | { |
423 | return ev_want_event [event] || ev_want_type [type] || cb; |
440 | return ev_want_event [event] || ev_want_type [type] || cb; |
… | |
… | |
556 | MTH bool affects_los () const |
573 | MTH bool affects_los () const |
557 | { |
574 | { |
558 | return glow_radius || flag [FLAG_BLOCKSVIEW]; |
575 | return glow_radius || flag [FLAG_BLOCKSVIEW]; |
559 | } |
576 | } |
560 | |
577 | |
|
|
578 | MTH bool has_carried_lights () const |
|
|
579 | { |
|
|
580 | return glow_radius; |
|
|
581 | } |
|
|
582 | |
561 | // returns the player that cna see this object, if any |
583 | // returns the player that cna see this object, if any |
562 | MTH object *visible_to () const; |
584 | MTH object *visible_to () const; |
563 | |
585 | |
564 | MTH std::string long_desc (object *who = 0); |
586 | MTH std::string long_desc (object *who = 0); |
565 | MTH std::string describe_monster (object *who = 0); |
587 | MTH std::string describe_monster (object *who = 0); |
… | |
… | |
692 | } |
714 | } |
693 | |
715 | |
694 | return ob; |
716 | return ob; |
695 | } |
717 | } |
696 | |
718 | |
697 | typedef struct oblnk |
|
|
698 | { /* Used to link together several objects */ |
|
|
699 | object_ptr ob; |
|
|
700 | struct oblnk *next; |
|
|
701 | } objectlink; |
|
|
702 | |
|
|
703 | typedef struct oblinkpt |
|
|
704 | { /* Used to link together several object links */ |
|
|
705 | struct oblnk *link; |
|
|
706 | sint32 value; /* Used as connected value in buttons/gates */ |
|
|
707 | struct oblinkpt *next; |
|
|
708 | } oblinkpt; |
|
|
709 | |
|
|
710 | object *find_skill_by_name (object *who, const char *name); |
719 | object *find_skill_by_name_fuzzy (object *who, const char *name); |
711 | object *find_skill_by_name (object *who, const shstr &sh); |
720 | object *find_skill_by_name (object *who, shstr_cmp sh); |
712 | object *find_skill_by_number (object *who, int skillno); |
721 | object *find_skill_by_number (object *who, int skillno); |
713 | |
722 | |
714 | /* |
723 | /* |
715 | * The archetype structure is a set of rules on how to generate and manipulate |
724 | * The archetype structure is a set of rules on how to generate and manipulate |
716 | * objects which point to archetypes. |
725 | * objects which point to archetypes. |