polserver/pol-core/pol/startloc.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

30 lines
707 B
C++

/** @file
*
* @par History
*/
#include "startloc.h"
#include "../clib/random.h"
#include "../clib/stlutil.h"
namespace Pol::Core
{
Pos4d StartingLocation::select_coordinate() const
{
int sidx = Clib::random_int( static_cast<int>( coords.size() - 1 ) );
return Pos4d( coords[sidx], realm );
}
size_t StartingLocation::estimateSize() const
{
size_t size = city.capacity() + desc.capacity() + sizeof( Realms::Realm* ) /*realm*/
+ sizeof( unsigned short ) /*mapid*/
+ sizeof( unsigned long ) /*cliloc_desc*/
+ Clib::memsize( coords );
return size;
}
} // namespace Pol::Core