polserver/pol-core/pol/startloc.cpp

32 lines
738 B
C++
Raw Permalink Normal View History

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