2016-01-28 14:52:40 +01:00
|
|
|
/** @file
|
|
|
|
|
*
|
|
|
|
|
* @par History
|
|
|
|
|
*/
|
2015-01-19 18:18:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "startloc.h"
|
|
|
|
|
|
|
|
|
|
#include "../clib/random.h"
|
|
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
namespace Pol
|
|
|
|
|
{
|
|
|
|
|
namespace Core
|
|
|
|
|
{
|
2024-03-03 11:51:37 +01:00
|
|
|
Pos4d StartingLocation::select_coordinate() const
|
2016-02-19 19:26:35 +01:00
|
|
|
{
|
|
|
|
|
int sidx = Clib::random_int( static_cast<int>( coords.size() - 1 ) );
|
2015-01-19 18:18:21 +01:00
|
|
|
|
2024-03-03 11:51:37 +01:00
|
|
|
return Pos4d( coords[sidx], realm );
|
2016-02-19 19:26:35 +01:00
|
|
|
}
|
2015-01-19 18:18:21 +01:00
|
|
|
|
2016-02-19 19:26:35 +01:00
|
|
|
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*/
|
2021-10-26 10:52:13 +02:00
|
|
|
+ 3 * sizeof( Pos3d* ) + coords.capacity() * sizeof( Pos3d );
|
2016-02-19 19:26:35 +01:00
|
|
|
return size;
|
|
|
|
|
}
|
2021-10-26 10:52:13 +02:00
|
|
|
} // namespace Core
|
|
|
|
|
} // namespace Pol
|