15 #include "../clib/esignal.h" 16 #include "../clib/logfacility.h" 17 #include "../plib/systemstate.h" 61 for ( ZoneItems::size_type idx = 0; idx < zone.
items.size(); ++idx )
72 if ( multi ==
nullptr )
116 static unsigned wx = ~0u;
117 static unsigned wy = 0;
130 if ( ++wx >= gridwidth )
133 if ( ++wy >= gridheight )
172 unsigned sleeptime = ( 60 * 10L * 1000 ) / ( gridwidth * gridheight );
199 unsigned sleeptime = ( 60 * 10L * 1000 ) / ( gridwidth * gridheight );
223 if ( realm ==
nullptr )
230 if ( y + 1 >= ( *gridy ) )
239 unsigned total_grid_count = 0;
242 total_grid_count += ( realm->grid_width() * realm->grid_height() );
244 if ( !total_grid_count )
250 unsigned sleeptime = ( 60 * 10L * 1000 ) / total_grid_count;
251 sleeptime = std::max( sleeptime, 30u );
253 size_t realm_index = ~0u;
279 "DECAY STATISTICS: decayed: max {} mean {} variance {} runs {} active max {} mean " 280 "{} variance {} runs {}\n" )
void decay_thread_shadow(void *arg)
void pol_sleep_ms(unsigned int millis)
void update(double value)
bool should_decay(unsigned int gameclock) const
virtual Bscript::BObjectImp * make_ref() POL_OVERRIDE
bool should_switch_realm(size_t index, unsigned x, unsigned y, unsigned *gridx, unsigned *gridy)
bool call(Bscript::BObjectImp *p0)
void decay_single_zone(Realms::Realm *realm, unsigned gridx, unsigned gridy, unsigned &wx, unsigned &wy)
[3] Decay Sweep Each 64x64 tile World Zone is checked for decay approximately once every 10 minutes ...
size_t cycles_per_decay_worldzone
Core::ScriptDef destroy_script
bool call_script(const ScriptDef &script, Bscript::BObjectImp *param0)
void destroy_item(Item *item)
ExportedFunction * can_decay
std::vector< Realms::Realm * > Realms
unsigned short grid_width() const
virtual void spill_contents(Multi::UMulti *supporting_multi)
void decay_single_thread(void *arg)
unsigned short grid_height() const
size_t cycles_until_decay_worldzone
struct Pol::Core::StateManager::@8 decay_statistics
Clib::OnlineStatistics active_decay
void decay_worldzone(unsigned wx, unsigned wy, Realms::Realm *realm)
[1] Item Decay Criteria An Item is allowed to decay if ALL of the following are true: ...
gameclock_t read_gameclock()
Reads the current value of the game clock.
StateManager stateManager
void restart_all_clients()
Clib::OnlineStatistics decayed
const ItemDesc & itemdesc() const
Multi::UMulti * find_supporting_multi(unsigned short x, unsigned short y, short z) const
std::map< int, Realms::Realm * > shadowrealms_by_id
std::atomic< bool > exit_signalled
bool thread_decay_statistics
void decay_thread(void *arg)