5#include <unordered_map>
6#include <unordered_set>
22 static std::pair<float, float>
slotOffset(
int slotIndex);
35 void syncEggs(
const std::unordered_map<int, Egg>& eggs);
48 static constexpr float CORNER = 0.35f;
65 std::unordered_map<int, std::pair<int, int>>
_eggTile;
68 static uint64_t
tileKey(
int x,
int y);
69 static uint64_t
resourceKey(
int x,
int y,
int resourceType);
Manages 8-slot spatial assignment per tile for resources and eggs.
std::unordered_set< int > _knownEggs
static std::pair< float, float > slotOffset(int slotIndex)
Returns the XZ offset pair {dx, dz} for a slot index (0-7).
std::unordered_map< uint64_t, int > _resourceSlots
float resourceRotation(int tileX, int tileY, int resourceType) const
Returns the stable random Y rotation for a resource slot, or 0 if absent.
static uint64_t tileKey(int x, int y)
void syncEggs(const std::unordered_map< int, Egg > &eggs)
Syncs egg slot assignments against the current egg map. Assigns slots to new eggs,...
std::unordered_map< int, std::pair< int, int > > _eggTile
std::array< int, 7 > updateResourceSlots(int tileX, int tileY, const Resources &resources)
Updates slot assignments for all resource types on a tile. Assigns a slot when count goes 0→nonzero,...
void clear()
Resets all state. Call on reconnect.
static constexpr int SLOT_COUNT
std::unordered_map< int, int > _eggSlots
static uint64_t resourceKey(int x, int y, int resourceType)
std::unordered_map< uint64_t, float > _resourceRotations
int eggSlot(int eggId) const
Returns the slot index for an egg id, or -1 if unknown.
static constexpr float CORNER
std::unordered_map< uint64_t, TileOccupancy > _tileOccupancy
void release(int slotIndex)
std::array< bool, 8 > occupied