Switched the hack for the bitset

I've also added acessors and mutators to the Region and RegionPagerBase
classes.
This commit is contained in:
Kayne Ruse
2014-07-01 22:55:43 +10:00
parent 8df1ecd804
commit 8ed308e89a
6 changed files with 59 additions and 29 deletions
+8 -17
View File
@@ -27,8 +27,6 @@
#include "region.hpp"
#include "statistics.hpp"
#include <cmath>
//Primary interface functions
void serializePacket(SerialPacketBase*, void* dest);
void deserializePacket(SerialPacketBase*, void* src);
@@ -55,22 +53,15 @@ void deserializeRegionContent(RegionPacket*, void*);
void deserializeServer(ServerPacket*, void*);
void deserializeStatistics(Statistics*, void*);
/* DOCS: Keep these macros, including PACKET_BUFFER_SIZE up to date
* DOCS: REGION_CONTENT is currently the largest type of packet, read more
* REGION_FORMAT
* This is the space for the region's metadata; the X and Y position, the map index and the SerialPacketType
* REGION_FOOTPRINT
* This is the theoretical size of the map's tile data in memory, but it doesn't take the collision map into account
* COLLISION_FOOTPRINT
* This is the space in the packet for the collision map, stored as a bit array
* PACKET_BUFFER_SIZE
* This is the tital size of the packet being sent between the server and the clients
/* DOCS: Keep PACKET_BUFFER_SIZE up to date
* DOCS: SerialPacketType::REGION_CONTENT is currently the largest type of packet, read more
* The metadata used are:
* SerialPacketType
* room index
* X & Y positon
* The rest is taken up by the Regions's content.
*/
constexpr int REGION_FORMAT = sizeof(int) * 3 + sizeof(SerialPacketType);
constexpr int REGION_FOOTPRINT = REGION_WIDTH * REGION_HEIGHT * REGION_DEPTH * sizeof(Region::type_t);
constexpr int COLLISION_FOOTPRINT = ceil(REGION_WIDTH * REGION_HEIGHT / 8.0);
constexpr int PACKET_BUFFER_SIZE = REGION_FORMAT + REGION_FOOTPRINT + COLLISION_FOOTPRINT;
constexpr int PACKET_BUFFER_SIZE = sizeof(SerialPacketType) + sizeof(int) * 3 + REGION_FOOTPRINT;
#endif