polserver/pol-core/pol/startloc.cpp
turleypol dbb25bdb62
Include and buildsystem cleanup (#45)
Include cleanup
Reworked buildsystem (Linux only)
Removed dynamic libs, Linux now again uses static linking (like windows)
2018-01-29 21:55:48 +01:00

31 lines
700 B
C++

/** @file
*
* @par History
*/
#include "startloc.h"
#include "../clib/random.h"
namespace Pol
{
namespace Core
{
Coordinate StartingLocation::select_coordinate() const
{
int sidx = Clib::random_int( static_cast<int>( coords.size() - 1 ) );
return coords[sidx];
}
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*/
+ 3 * sizeof( Coordinate* ) + coords.capacity() * sizeof( Coordinate );
return size;
}
}
}