• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

polserver / polserver / 13067161185

31 Jan 2025 05:44AM UTC coverage: 57.998% (-0.01%) from 58.01%
13067161185

push

github

web-flow
Add missing attack range properties to itemdesc (#754)

* Add missing attack range properties to itemdesc.

* Add comments.

* Update core changes.

4 of 4 new or added lines in 1 file covered. (100.0%)

11 existing lines in 3 files now uncovered.

41359 of 71311 relevant lines covered (58.0%)

367083.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.39
/pol-core/pol/uobject.cpp
1
/** @file
2
 *
3
 * @par History
4
 * - 2009/08/25 Shinigami: STLport-5.2.1 fix: init order changed of realm and saveonexit_
5
 * - 2009/09/14 MuadDib:   UObject::setgraphic added error printing.
6
 * - 2009/12/02 Turley:    added config.max_tile_id - Tomi
7
 */
8

9

10
#include "uobject.h"
11

12
#include <atomic>
13
#include <iosfwd>
14
#include <stddef.h>
15
#include <string>
16
#include <utility>
17

18
#include "../clib/cfgelem.h"
19
#include "../clib/logfacility.h"
20
#include "../clib/passert.h"
21
#include "../clib/rawtypes.h"
22
#include "../clib/refptr.h"
23
#include "../clib/streamsaver.h"
24
#include "../plib/clidata.h"
25
#include "../plib/objtype.h"
26
#include "../plib/systemstate.h"
27
#include "../plib/uconst.h"
28
#include "baseobject.h"
29
#include "dynproperties.h"
30
#include "globals/state.h"
31
#include "globals/uvars.h"
32
#include "item/itemdesc.h"
33
#include "proplist.h"
34
#include "realms/realm.h"
35
#include "realms/realms.h"
36
#include "syshookscript.h"
37
#include "tooltips.h"
38
#include "uobjcnt.h"
39

40
namespace Pol
41
{
42
namespace Core
43
{
44
std::set<UObject*> unreaped_orphan_instances;
45
std::ofstream orphans_txt( "orphans.txt", std::ios::out | std::ios::trunc );
46

47
int display_orphan( UObject* o )
×
48
{
49
  std::ostringstream stream;
×
50
  {
51
    Clib::StreamWriter sw( stream );
×
52
    Clib::StreamWriter sw_orphan( orphans_txt );
×
53
    sw.comment( "{}, {}", o->name(), o->ref_counted_count() );
×
54
    o->printOn( sw );
×
55
    o->printOnDebug( sw_orphan );
×
56
  }
×
57
  INFO_PRINT( stream.str() );
×
58
  return 0;
×
59
}
×
60
void display_unreaped_orphan_instances()
3✔
61
{
62
  //    orphans_txt.open( "orphans.txt", ios::out|ios::trunc );
63

64
  for ( auto& obj : unreaped_orphan_instances )
3✔
65
  {
66
    display_orphan( obj );
×
67
  }
68
  // for( std::set<UObject*>::iterator itr = unreaped_orphan_instances.begin();
69
}
3✔
70

71

72
std::atomic<unsigned int> UObject::dirty_writes;
73
std::atomic<unsigned int> UObject::clean_writes;
74

75
UObject::UObject( u32 objtype, UOBJ_CLASS i_uobj_class )
6,511✔
76
    : ref_counted(),
77
      ULWObject( i_uobj_class ),
78
      DynamicPropsHolder(),
79
      serial_ext( 0 ),
6,511✔
80
      objtype_( objtype ),
6,511✔
81
      color( 0 ),
6,511✔
82
      facing( Core::FACING_N ),
6,511✔
83
      _rev( 0 ),
6,511✔
84
      name_( "" ),
6,511✔
85
      flags_(),
6,511✔
86
      proplist_( CPropProfiler::class_to_type( i_uobj_class ) )
13,022✔
87
{
88
  graphic = Items::getgraphic( objtype );
6,511✔
89
  flags_.set( OBJ_FLAGS::DIRTY );
6,511✔
90
  flags_.set( OBJ_FLAGS::SAVE_ON_EXIT );
6,511✔
91
  height = Plib::tileheight( graphic );
6,511✔
92
  ++stateManager.uobjcount.uobject_count;
6,511✔
93
}
6,511✔
94

95
UObject::~UObject()
6,511✔
96
{
97
  if ( ref_counted::count() != 0 )
6,511✔
98
  {
99
    POLLOG_INFOLN( "Ouch! UObject::~UObject() with count()=={}", ref_counted::count() );
×
100
  }
101
  passert( ref_counted::count() == 0 );
6,511✔
102
  if ( serial == 0 )
6,511✔
103
  {
104
    --stateManager.uobjcount.unreaped_orphans;
6,511✔
105
  }
106
  --stateManager.uobjcount.uobject_count;
6,511✔
107
}
6,511✔
108

109
size_t UObject::estimatedSize() const
39✔
110
{
111
  size_t size = sizeof( UObject ) + proplist_.estimatedSize();
39✔
112
  size += estimateSizeDynProps();
39✔
113
  return size;
39✔
114
}
115

116
//
117
//    Every UObject is registered with the objecthash after creation.
118
//    (This can't happen in the ctor since the object isn't fully created yet)
119
//
120
//    Scripts may still reference any object, so rather than outright delete,
121
//    we set its serial to 0 (marking it "orphan", though "zombie" would probably be a better term).
122
//    Later, when all _other_ references to the object have been deleted,
123
//    objecthash.Reap() will remove its reference to this object, deleting it.
124
//
125
void UObject::destroy()
6,514✔
126
{
127
  if ( serial != 0 )
6,514✔
128
  {
129
    if ( ref_counted::count() < 1 )
6,511✔
130
    {
131
      POLLOG_INFOLN( "Ouch! UObject::destroy() with count()=={}", ref_counted::count() );
×
132
    }
133

134
    set_dirty();  // we will have to write a 'object deleted' directive once
6,511✔
135

136
    serial =
6,511✔
137
        0;  // used to set serial_ext to 0.  This way, if debugging, one can find out the old serial
138
    passert( ref_counted::count() >= 1 );
6,511✔
139

140
    ++stateManager.uobjcount.unreaped_orphans;
6,511✔
141
  }
142
}
6,514✔
143

144
bool UObject::dirty() const
164✔
145
{
146
  return flags_.get( OBJ_FLAGS::DIRTY );
164✔
147
}
148

149
void UObject::clear_dirty() const
164✔
150
{
151
  if ( dirty() )
164✔
152
    ++dirty_writes;
122✔
153
  else
154
    ++clean_writes;
42✔
155
  flags_.remove( OBJ_FLAGS::DIRTY );
164✔
156
}
164✔
157

158
bool UObject::getprop( const std::string& propname, std::string& propval ) const
27✔
159
{
160
  return proplist_.getprop( propname, propval );
27✔
161
}
162

163
void UObject::setprop( const std::string& propname, const std::string& propvalue )
56✔
164
{
165
  if ( propname[0] != '#' )
56✔
166
    set_dirty();
51✔
167
  proplist_.setprop( propname, propvalue );  // VOID_RETURN
56✔
168
}
56✔
169

170
void UObject::eraseprop( const std::string& propname )
×
171
{
172
  if ( propname[0] != '#' )
×
173
    set_dirty();
×
174
  proplist_.eraseprop( propname );  // VOID_RETURN
×
175
}
×
176

177
void UObject::copyprops( const UObject& from )
56✔
178
{
179
  set_dirty();
56✔
180
  proplist_.copyprops( from.proplist_ );
56✔
181
}
56✔
182

183
void UObject::copyprops( const PropertyList& proplist )
6,288✔
184
{
185
  set_dirty();
6,288✔
186
  proplist_.copyprops( proplist );
6,288✔
187
}
6,288✔
188

189
void UObject::getpropnames( std::vector<std::string>& propnames ) const
×
190
{
191
  proplist_.getpropnames( propnames );
×
192
}
×
193

194
const PropertyList& UObject::getprops() const
9✔
195
{
196
  return proplist_;
9✔
197
}
198

199
std::string UObject::name() const
103✔
200
{
201
  return name_;
103✔
202
}
203

204
std::string UObject::description() const
×
205
{
206
  return name_;
×
207
}
208

209
void UObject::setname( const std::string& newname )
87✔
210
{
211
  set_dirty();
87✔
212
  increv();
87✔
213
  send_object_cache_to_inrange( this );
87✔
214
  name_ = newname;
87✔
215
}
87✔
216

217
UObject* UObject::owner()
×
218
{
219
  return nullptr;
×
220
}
221

222
const UObject* UObject::owner() const
×
223
{
224
  return nullptr;
×
225
}
226

227
UObject* UObject::self_as_owner()
1✔
228
{
229
  return this;
1✔
230
}
231

232
const UObject* UObject::self_as_owner() const
×
233
{
234
  return this;
×
235
}
236

237
UObject* UObject::toplevel_owner()
×
238
{
239
  return this;
×
240
}
241

242
const UObject* UObject::toplevel_owner() const
56,791✔
243
{
244
  return this;
56,791✔
245
}
246

247
void UObject::setposition( Pos4d newpos )
13,132✔
248
{
249
  set_dirty();
13,132✔
250
  pos( std::move( newpos ) );
13,132✔
251
}
13,132✔
252

253
UFACING UObject::direction_toward( UObject* other ) const
×
254
{
255
  return pos2d().direction_toward( other->toplevel_owner()->pos2d() );
×
256
}
257
UFACING UObject::direction_toward( const Pos2d& other ) const
×
258
{
259
  return pos2d().direction_toward( other );
×
260
}
261
UFACING UObject::direction_away( UObject* other ) const
×
262
{
263
  return pos2d().direction_away( other->toplevel_owner()->pos2d() );
×
264
}
265
UFACING UObject::direction_away( const Pos2d& other ) const
×
266
{
267
  return pos2d().direction_away( other );
×
268
}
269

270
void UObject::printProperties( Clib::StreamWriter& sw ) const
94✔
271
{
272
  using namespace fmt;
273

274
  if ( !name_.get().empty() )
94✔
275
    sw.add( "Name", name_.get() );
64✔
276

277
  sw.add( "Serial", Clib::hexintv( serial ) );
94✔
278
  sw.add( "ObjType", Clib::hexintv( objtype_ ) );
93✔
279
  sw.add( "Graphic", Clib::hexintv( graphic ) );
92✔
280

281
  if ( color != 0 )
92✔
282
    sw.add( "Color", Clib::hexintv( color ) );
14✔
283

284
  sw.add( "X", x() );
92✔
285
  sw.add( "Y", y() );
92✔
286
  sw.add( "Z", (int)z() );
94✔
287

288
  if ( facing )
94✔
289
    sw.add( "Facing", static_cast<int>( facing ) );
32✔
290

291
  sw.add( "Revision", rev() );
94✔
292
  if ( realm() == nullptr )
93✔
293
    sw.add( "Realm", "britannia" );
×
294
  else
295
    sw.add( "Realm", realm()->name() );
93✔
296

297
  s16 value = fire_resist().mod;
94✔
298
  if ( value != 0 )
93✔
299
    sw.add( "FireResistMod", static_cast<int>( value ) );
2✔
300
  value = cold_resist().mod;
93✔
301
  if ( value != 0 )
92✔
302
    sw.add( "ColdResistMod", static_cast<int>( value ) );
2✔
303
  value = energy_resist().mod;
92✔
304
  if ( value != 0 )
93✔
305
    sw.add( "EnergyResistMod", static_cast<int>( value ) );
2✔
306
  value = poison_resist().mod;
93✔
307
  if ( value != 0 )
93✔
308
    sw.add( "PoisonResistMod", static_cast<int>( value ) );
2✔
309
  value = physical_resist().mod;
93✔
310
  if ( value != 0 )
93✔
311
    sw.add( "PhysicalResistMod", static_cast<int>( value ) );
2✔
312

313
  value = fire_damage().mod;
93✔
314
  if ( value != 0 )
94✔
315
    sw.add( "FireDamageMod", static_cast<int>( value ) );
2✔
316
  value = cold_damage().mod;
94✔
317
  if ( value != 0 )
94✔
318
    sw.add( "ColdDamageMod", static_cast<int>( value ) );
2✔
319
  value = energy_damage().mod;
94✔
320
  if ( value != 0 )
92✔
321
    sw.add( "EnergyDamageMod", static_cast<int>( value ) );
2✔
322
  value = poison_damage().mod;
92✔
323
  if ( value != 0 )
93✔
324
    sw.add( "PoisonDamageMod", static_cast<int>( value ) );
2✔
325
  value = physical_damage().mod;
93✔
326
  if ( value != 0 )
92✔
327
    sw.add( "PhysicalDamageMod", static_cast<int>( value ) );
2✔
328
  // new mod stuff
329
  value = lower_reagent_cost().mod;
92✔
330
  if ( value )
93✔
331
    sw.add( "LowerReagentCostMod", static_cast<int>( value ) );
2✔
332
  value = defence_increase().mod;
93✔
333
  if ( value )
92✔
334
    sw.add( "DefenceIncreaseMod", static_cast<int>( value ) );
2✔
335
  value = defence_increase_cap().mod;
92✔
336
  if ( value )
93✔
337
    sw.add( "DefenceIncreaseCapMod", static_cast<int>( value ) );
2✔
338
  value = lower_mana_cost().mod;
93✔
339
  if ( value )
93✔
340
    sw.add( "LowerManaCostMod", static_cast<int>( value ) );
2✔
341
  value = hit_chance().mod;
93✔
342
  if ( value )
92✔
343
    sw.add( "HitChanceMod", static_cast<int>( value ) );
2✔
344
  value = fire_resist_cap().mod;
92✔
345
  if ( value )
93✔
346
    sw.add( "FireResistCapMod", static_cast<int>( value ) );
2✔
347
  value = cold_resist_cap().mod;
93✔
348
  if ( value )
94✔
349
    sw.add( "ColdResistCapMod", static_cast<int>( value ) );
2✔
350
  value = energy_resist_cap().mod;
94✔
351
  if ( value )
93✔
352
    sw.add( "EnergyResistCapMod", static_cast<int>( value ) );
2✔
353
  value = physical_resist_cap().mod;
93✔
354
  if ( value )
94✔
355
    sw.add( "PhysicalResistCapMod", static_cast<int>( value ) );
2✔
356
  value = poison_resist_cap().mod;
94✔
357
  if ( value )
93✔
358
    sw.add( "PoisonResistCapMod", static_cast<int>( value ) );
2✔
359
  value = spell_damage_increase().mod;
93✔
360
  if ( value )
93✔
361
    sw.add( "SpellDamageIncreaseMod", static_cast<int>( value ) );
2✔
362
  value = faster_casting().mod;
93✔
363
  if ( value )
93✔
364
    sw.add( "FasterCastingMod", static_cast<int>( value ) );
2✔
365
  value = faster_cast_recovery().mod;
93✔
366
  if ( value )
94✔
367
    sw.add( "FasterCastRecoveryMod", static_cast<int>( value ) );
2✔
368
  value = luck().mod;
94✔
369
  if ( value )
93✔
370
    sw.add( "LuckMod", static_cast<int>( value ) );
2✔
371
  value = swing_speed_increase().mod;
93✔
372
  if ( value )
94✔
373
    sw.add( "SwingSpeedIncreaseMod", static_cast<int>( value ) );
2✔
374
  value = min_attack_range_increase().mod;
94✔
375
  if ( value )
94✔
UNCOV
376
    sw.add( "MinAttackRangeIncreaseMod", static_cast<int>( value ) );
×
377
  value = max_attack_range_increase().mod;
94✔
378
  if ( value )
94✔
379
    sw.add( "MaxAttackRangeIncreaseMod", static_cast<int>( value ) );
×
380
  // end new mod stuff
381

382

383
  proplist_.printProperties( sw );
94✔
384
}
92✔
385

386
void UObject::printDebugProperties( Clib::StreamWriter& sw ) const
×
387
{
388
  sw.comment( "uobj_class: {}", (int)uobj_class() );
×
389
}
×
390

391
/// Fixes invalid graphic, moving here to allow it to be overridden in subclass (see Multi)
392
void UObject::fixInvalidGraphic()
97✔
393
{
394
  if ( graphic > ( Plib::systemstate.config.max_tile_id ) )
97✔
395
    graphic = GRAPHIC_NODRAW;
×
396
}
97✔
397

398
void UObject::readProperties( Clib::ConfigElem& elem )
97✔
399
{
400
  name_ = elem.remove_string( "NAME", "" );
97✔
401

402
  // serial, objtype extracted by caller
403
  graphic = elem.remove_ushort( "GRAPHIC", static_cast<u16>( objtype_ ) );
97✔
404
  fixInvalidGraphic();
97✔
405

406
  height = Plib::tileheight( graphic );
97✔
407

408
  color = elem.remove_ushort( "COLOR", 0 );
97✔
409

410

411
  std::string realmstr = elem.remove_string( "Realm", "britannia" );
97✔
412
  auto* realm_tmp = find_realm( realmstr );
97✔
413
  if ( !realm_tmp )
97✔
414
  {
415
    ERROR_PRINTLN( "{} '{}' ({:#x}): has an invalid realm property '{}'.", classname(), name(),
×
416
                   serial, realmstr );
×
417
    throw std::runtime_error( "Data integrity error" );
×
418
  }
419
  setposition( Pos4d( elem.remove_ushort( "X" ), elem.remove_ushort( "Y" ),
97✔
420
                      static_cast<s8>( elem.remove_int( "Z" ) ), realm_tmp ) );
97✔
421

422
  unsigned short tmp = elem.remove_ushort( "FACING", 0 );
97✔
423
  setfacing( static_cast<unsigned char>( tmp ) );
97✔
424

425
  _rev = elem.remove_ulong( "Revision", 0 );
97✔
426

427
  s16 mod_value = static_cast<s16>( elem.remove_int( "FIRERESISTMOD", 0 ) );
97✔
428
  if ( mod_value != 0 )
97✔
429
    fire_resist( fire_resist().setAsMod( mod_value ) );
1✔
430
  mod_value = static_cast<s16>( elem.remove_int( "COLDRESISTMOD", 0 ) );
97✔
431
  if ( mod_value != 0 )
97✔
432
    cold_resist( cold_resist().setAsMod( mod_value ) );
1✔
433
  mod_value = static_cast<s16>( elem.remove_int( "ENERGYRESISTMOD", 0 ) );
97✔
434
  if ( mod_value != 0 )
97✔
435
    energy_resist( energy_resist().setAsMod( mod_value ) );
1✔
436
  mod_value = static_cast<s16>( elem.remove_int( "POISONRESISTMOD", 0 ) );
97✔
437
  if ( mod_value != 0 )
97✔
438
    poison_resist( poison_resist().setAsMod( mod_value ) );
1✔
439
  mod_value = static_cast<s16>( elem.remove_int( "PHYSICALRESISTMOD", 0 ) );
97✔
440
  if ( mod_value != 0 )
97✔
441
    physical_resist( physical_resist().setAsMod( mod_value ) );
1✔
442

443
  mod_value = static_cast<s16>( elem.remove_int( "FIREDAMAGEMOD", 0 ) );
97✔
444
  if ( mod_value != 0 )
97✔
445
    fire_damage( fire_damage().setAsMod( mod_value ) );
1✔
446
  mod_value = static_cast<s16>( elem.remove_int( "COLDDAMAGEMOD", 0 ) );
97✔
447
  if ( mod_value != 0 )
97✔
448
    cold_damage( cold_damage().setAsMod( mod_value ) );
1✔
449
  mod_value = static_cast<s16>( elem.remove_int( "ENERGYDAMAGEMOD", 0 ) );
97✔
450
  if ( mod_value != 0 )
97✔
451
    energy_damage( energy_damage().setAsMod( mod_value ) );
1✔
452
  mod_value = static_cast<s16>( elem.remove_int( "POISONDAMAGEMOD", 0 ) );
97✔
453
  if ( mod_value != 0 )
97✔
454
    poison_damage( poison_damage().setAsMod( mod_value ) );
1✔
455
  mod_value = static_cast<s16>( elem.remove_int( "PHYSICALDAMAGEMOD", 0 ) );
97✔
456
  if ( mod_value != 0 )
97✔
457
    physical_damage( physical_damage().setAsMod( mod_value ) );
1✔
458
  mod_value = static_cast<s16>( elem.remove_int( "DEFENCEINCREASEMOD", 0 ) );
97✔
459
  if ( mod_value != 0 )
97✔
460
    defence_increase( defence_increase().setAsMod( mod_value ) );
1✔
461
  mod_value = static_cast<s16>( elem.remove_int( "DEFENCEINCREASECAPMOD", 0 ) );
97✔
462
  if ( mod_value != 0 )
97✔
463
    defence_increase_cap( defence_increase_cap().setAsMod( mod_value ) );
1✔
464
  mod_value = static_cast<s16>( elem.remove_int( "LOWERMANACOSTMOD", 0 ) );
97✔
465
  if ( mod_value != 0 )
97✔
466
    lower_mana_cost( lower_mana_cost().setAsMod( mod_value ) );
1✔
467
  mod_value = static_cast<s16>( elem.remove_int( "HITCHANCEMOD", 0 ) );
97✔
468
  if ( mod_value != 0 )
97✔
469
    hit_chance( hit_chance().setAsMod( mod_value ) );
1✔
470
  mod_value = static_cast<s16>( elem.remove_int( "FIRERESISTCAPMOD", 0 ) );
97✔
471
  if ( mod_value != 0 )
97✔
472
    fire_resist_cap( fire_resist_cap().setAsMod( mod_value ) );
1✔
473
  mod_value = static_cast<s16>( elem.remove_int( "COLDRESISTCAPMOD", 0 ) );
97✔
474
  if ( mod_value != 0 )
97✔
475
    cold_resist_cap( cold_resist_cap().setAsMod( mod_value ) );
1✔
476
  mod_value = static_cast<s16>( elem.remove_int( "ENERGYRESISTCAPMOD", 0 ) );
97✔
477
  if ( mod_value != 0 )
97✔
478
    energy_resist_cap( energy_resist_cap().setAsMod( mod_value ) );
1✔
479
  mod_value = static_cast<s16>( elem.remove_int( "POISONRESISTCAPMOD", 0 ) );
97✔
480
  if ( mod_value != 0 )
97✔
481
    poison_resist_cap( poison_resist_cap().setAsMod( mod_value ) );
1✔
482
  mod_value = static_cast<s16>( elem.remove_int( "PHYSICALRESISTCAPMOD", 0 ) );
97✔
483
  if ( mod_value != 0 )
97✔
484
    physical_resist_cap( physical_resist_cap().setAsMod( mod_value ) );
1✔
485
  mod_value = static_cast<s16>( elem.remove_int( "LOWERREAGENTCOSTMOD", 0 ) );
97✔
486
  if ( mod_value != 0 )
97✔
487
    lower_reagent_cost( lower_reagent_cost().setAsMod( mod_value ) );
1✔
488
  mod_value = static_cast<s16>( elem.remove_int( "SPELLDAMAGEINCREASEMOD", 0 ) );
97✔
489
  if ( mod_value != 0 )
97✔
490
    spell_damage_increase( spell_damage_increase().setAsMod( mod_value ) );
1✔
491
  mod_value = static_cast<s16>( elem.remove_int( "FASTERCASTINGMOD", 0 ) );
97✔
492
  if ( mod_value != 0 )
97✔
493
    faster_casting( faster_casting().setAsMod( mod_value ) );
1✔
494
  mod_value = static_cast<s16>( elem.remove_int( "FASTERCASTRECOVERYMOD", 0 ) );
97✔
495
  if ( mod_value != 0 )
97✔
496
    faster_cast_recovery( faster_cast_recovery().setAsMod( mod_value ) );
1✔
497
  mod_value = static_cast<s16>( elem.remove_int( "LUCKMOD", 0 ) );
97✔
498
  if ( mod_value != 0 )
97✔
499
    luck( luck().setAsMod( mod_value ) );
1✔
500
  mod_value = static_cast<s16>( elem.remove_int( "SWINGSPEEDINCREASEMOD", 0 ) );
97✔
501
  if ( mod_value != 0 )
97✔
502
    swing_speed_increase( swing_speed_increase().setAsMod( mod_value ) );
1✔
503
  mod_value = static_cast<s16>( elem.remove_int( "MINATTACKRANGEINCREASEMOD", 0 ) );
97✔
504
  if ( mod_value != 0 )
97✔
UNCOV
505
    min_attack_range_increase( min_attack_range_increase().setAsMod( mod_value ) );
×
506
  mod_value = static_cast<s16>( elem.remove_int( "MAXATTACKRANGEINCREASEMOD", 0 ) );
97✔
507
  if ( mod_value != 0 )
97✔
508
    max_attack_range_increase( max_attack_range_increase().setAsMod( mod_value ) );
×
509

510

511
  proplist_.readProperties( elem );
97✔
512
}
97✔
513

514
void UObject::printSelfOn( Clib::StreamWriter& sw ) const
×
515
{
516
  printOn( sw );
×
517
}
×
518

519
void UObject::printOn( Clib::StreamWriter& sw ) const
90✔
520
{
521
  sw.begin( classname() );
90✔
522
  printProperties( sw );
90✔
523
  sw.end();
90✔
524
}
90✔
525

526
void UObject::printOnDebug( Clib::StreamWriter& sw ) const
×
527
{
528
  sw.begin( classname() );
×
529
  printProperties( sw );
×
530
  printDebugProperties( sw );
×
531
  sw.end();
×
532
}
×
533

534
bool UObject::setgraphic( u16 /*newgraphic*/ )
×
535
{
536
  ERROR_PRINTLN(
×
537
      "UOBject::SetGraphic used, object class does not have a graphic member! Object Serial: {:#x}",
538
      serial );
×
539
  return false;
×
540
}
541

542
bool UObject::setcolor( u16 newcolor )
×
543
{
544
  set_dirty();
×
545

546
  if ( color != newcolor )
×
547
  {
548
    color = newcolor;
×
549
    on_color_changed();
×
550
  }
551

552
  return true;
×
553
}
554

555
void UObject::on_color_changed() {}
×
556

557
void UObject::on_facing_changed() {}
×
558

559
bool UObject::saveonexit() const
99✔
560
{
561
  return flags_.get( OBJ_FLAGS::SAVE_ON_EXIT );
99✔
562
}
563

564
void UObject::saveonexit( bool newvalue )
6,495✔
565
{
566
  flags_.change( OBJ_FLAGS::SAVE_ON_EXIT, newvalue );
6,495✔
567
}
6,495✔
568

569
const char* UObject::target_tag() const
×
570
{
571
  return "object";
×
572
}
573

574
bool UObject::get_method_hook( const char* methodname, Bscript::Executor* ex, ExportScript** hook,
×
575
                               unsigned int* PC ) const
576
{
577
  return gamestate.system_hooks.get_method_hook( gamestate.system_hooks.uobject_method_script.get(),
×
578
                                                 methodname, ex, hook, PC );
×
579
}
580
}  // namespace Core
581
}  // namespace Pol
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc