polserver/pol-core/plib/systemstate.cpp
turleypol 21577d8e5b
Clang Tidy concat namespaces (#855)
* tidy

* Automated clang-tidy change: modernize-concat-nested-namespaces

* compile test

* fix namespace

---------

Co-authored-by: Clang Tidy <clang-tidy@users.noreply.github.com>
2026-01-17 10:30:21 +01:00

47 lines
878 B
C++

#include "systemstate.h"
#include "../clib/stlutil.h"
#include "objtype.h"
#include "pkg.h"
#include "tiles.h"
namespace Pol::Plib
{
SystemState systemstate;
SystemState::SystemState()
: packages(),
packages_byname(),
accounts_txt_dirty( false ),
accounts_txt_stat(),
config(),
tile(),
max_graphic( 0 )
{
}
void SystemState::deinitialize()
{
Clib::delete_all( packages );
packages_byname.clear();
tile.clear();
}
size_t SystemState::estimatedSize() const
{
size_t size = sizeof( SystemState );
size += Clib::memsize( tile ) + Clib::memsize( packages ) + Clib::memsize( packages_byname );
for ( const auto& pkg : packages )
if ( pkg != nullptr )
size += pkg->estimateSize();
for ( const auto& pkg_pair : packages_byname )
size += pkg_pair.first.capacity();
return size;
}
} // namespace Pol::Plib