13 #include "../../plib/mapserver.h" 14 #include "../../plib/maptileserver.h" 15 #include "../../plib/realmdescriptor.h" 16 #include "../../plib/staticserver.h" 17 #include "../mobile/charactr.h" 18 #include "../poltype.h" 20 #include "../uworld.h" 27 Realm::Realm(
const std::string& realm_name,
const std::string& realm_path )
28 : is_shadowrealm( false ),
31 _descriptor( Plib::RealmDescriptor::Load( realm_name, realm_path ) ),
34 _toplevel_item_count( 0 ),
36 _mapserver( Plib::MapServer::Create( _descriptor ) ),
37 _staticserver( new Plib::StaticServer( _descriptor ) ),
38 _maptileserver( new Plib::MapTileServer( _descriptor ) )
45 for (
size_t i = 0; i < gridwidth; i++ )
65 for (
size_t i = 0; i < gridwidth; i++ )
72 for (
size_t i = 0; i < gridwidth; i++ )
79 size_t size =
sizeof( *this );
85 for (
unsigned x = 0; x < gridwidth; ++x )
87 for (
unsigned y = 0; y < gridheight; ++y )
89 size += 3 *
sizeof(
void** ) +
zone[x][y].characters.capacity() *
sizeof(
void* );
90 size += 3 *
sizeof(
void** ) +
zone[x][y].npcs.capacity() *
sizeof(
void* );
91 size += 3 *
sizeof(
void** ) +
zone[x][y].items.capacity() *
sizeof(
void* );
92 size += 3 *
sizeof(
void** ) +
zone[x][y].multis.capacity() *
sizeof(
void* );
98 3 *
sizeof(
void* ) +
global_hulls.size() * (
sizeof(
unsigned int ) + 3 *
sizeof(
void* ) );
143 whomoved.
x, whomoved.
y,
this, 33,
152 whounhid.
x, whounhid.
y,
this, 32,
153 [&](
Mobile::Character* chr ) { Mobile::NpcPropagateEnteredArea( chr, &whounhid ); } );
166 Mobile::NpcPropagateEnteredArea( chr, &whoentered );
167 Mobile::NpcPropagateEnteredArea( &whoentered,
177 wholeft.
x, wholeft.
y,
this, 32,
178 [&](
Mobile::Character* chr ) { Mobile::NpcPropagateLeftArea( chr, &wholeft ); } );
Realm(const std::string &realm_name, const std::string &realm_path="")
void notify_resurrected(Mobile::Character &whoressed)
static void InRange(u16 x, u16 y, const Realms::Realm *realm, unsigned range, F &&f)
unsigned int _toplevel_item_count
size_t sizeEstimate() const
const std::string name() const
unsigned int _multi_count
std::unique_ptr< Plib::MapServer > _mapserver
const std::string shadowname
unsigned short height() const
unsigned short grid_width() const
void notify_entered(Mobile::Character &whoentered)
std::unique_ptr< Plib::StaticServer > _staticserver
unsigned short grid_height() const
void notify_left(Mobile::Character &wholeft)
void remove_mobile(const Mobile::Character &chr, WorldChangeReason reason)
void add_mobile(const Mobile::Character &chr, WorldChangeReason reason)
unsigned int _mobile_count
unsigned short grid_height
size_t sizeEstimate() const
unsigned short pol_distance(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2)
void notify_unhid(Mobile::Character &whounhid)
std::set< unsigned int > global_hulls
unsigned short width() const
std::unique_ptr< Plib::MapTileServer > _maptileserver
bool valid(unsigned short x, unsigned short y, short z) const
unsigned int _offline_count
void notify_moved(Mobile::Character &whomoved)
unsigned short grid_width
const Plib::RealmDescriptor _descriptor