… | |
… | |
308 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
308 | 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? |
309 | client_container *seen_by; // seen by which player/container currently? |
310 | key_value *key_values; /* Fields not explictly known by the loader. */ |
310 | key_value *key_values; /* Fields not explictly known by the loader. */ |
311 | |
311 | |
312 | // privates / perl |
312 | // privates / perl |
313 | const shstr &kv_get (const shstr &key) const; |
313 | shstr_tmp kv_get (shstr_tmp key) const; |
314 | void kv_del (const shstr &key); |
314 | void kv_del (shstr_tmp key); |
315 | void kv_set (const shstr &key, const shstr &value); |
315 | void kv_set (shstr_tmp key, shstr_tmp value); |
316 | |
316 | |
317 | // custom extra fields management |
317 | // custom extra fields management |
318 | struct key_value_access_proxy |
318 | struct key_value_access_proxy |
319 | { |
319 | { |
320 | object &ob; |
320 | object &ob; |
321 | shstr key; |
321 | shstr_tmp key; |
322 | |
322 | |
323 | key_value_access_proxy (object &ob, const shstr &key) |
323 | key_value_access_proxy (object &ob, shstr_tmp key) |
324 | : ob (ob), key (key) |
324 | : ob (ob), key (key) |
325 | { |
325 | { |
326 | } |
326 | } |
327 | |
327 | |
328 | const key_value_access_proxy &operator =(const shstr &value) const |
328 | const key_value_access_proxy &operator =(const shstr_tmp &value) const |
329 | { |
329 | { |
330 | ob.kv_set (key, value); |
330 | ob.kv_set (key, value); |
331 | return *this; |
331 | return *this; |
332 | } |
332 | } |
333 | |
333 | |
334 | operator const shstr &() const { return ob.kv_get (key); } |
334 | operator const shstr_tmp () const { return ob.kv_get (key); } |
335 | operator const char *() const { return ob.kv_get (key); } |
335 | operator const char *() const { return ob.kv_get (key); } |
336 | |
336 | |
337 | private: |
337 | private: |
338 | void operator =(int); |
338 | void operator =(int); |
339 | }; |
339 | }; |
340 | |
340 | |
341 | // operator [] is too annoying to use |
341 | // operator [] is too annoying to use |
342 | const key_value_access_proxy kv (const shstr &key) |
342 | const key_value_access_proxy kv (shstr_tmp key) |
343 | { |
343 | { |
344 | return key_value_access_proxy (*this, key); |
344 | return key_value_access_proxy (*this, key); |
345 | } |
345 | } |
346 | |
346 | |
347 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
347 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
… | |
… | |
412 | MTH void close_container () |
412 | MTH void close_container () |
413 | { |
413 | { |
414 | open_container (0); |
414 | open_container (0); |
415 | } |
415 | } |
416 | |
416 | |
417 | MTH object *force_find (const shstr name); |
417 | MTH object *force_find (shstr_tmp name); |
418 | MTH object *force_add (const shstr name, int duration = 0); |
418 | MTH object *force_add (shstr_tmp name, int duration = 0); |
419 | |
419 | |
420 | // overwrite the attachable should_invoke function with a version that also checks ev_want_type |
420 | // overwrite the attachable should_invoke function with a version that also checks ev_want_type |
421 | bool should_invoke (event_type event) |
421 | bool should_invoke (event_type event) |
422 | { |
422 | { |
423 | return ev_want_event [event] || ev_want_type [type] || cb; |
423 | return ev_want_event [event] || ev_want_type [type] || cb; |
… | |
… | |
706 | sint32 value; /* Used as connected value in buttons/gates */ |
706 | sint32 value; /* Used as connected value in buttons/gates */ |
707 | struct oblinkpt *next; |
707 | struct oblinkpt *next; |
708 | } oblinkpt; |
708 | } oblinkpt; |
709 | |
709 | |
710 | object *find_skill_by_name (object *who, const char *name); |
710 | object *find_skill_by_name (object *who, const char *name); |
711 | object *find_skill_by_name (object *who, const shstr &sh); |
711 | object *find_skill_by_name (object *who, shstr_tmp sh); |
712 | object *find_skill_by_number (object *who, int skillno); |
712 | object *find_skill_by_number (object *who, int skillno); |
713 | |
713 | |
714 | /* |
714 | /* |
715 | * The archetype structure is a set of rules on how to generate and manipulate |
715 | * The archetype structure is a set of rules on how to generate and manipulate |
716 | * objects which point to archetypes. |
716 | * objects which point to archetypes. |