the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 41 lines 1.0 kB view raw
1#pragma once 2 3class Entity; 4class TilePos; 5 6class ChunkPos 7{ 8public: 9 int x, z; // 4J - these were const but needed to make an assignment operator so we could make a vector of ChunkPos 10 11 ChunkPos(int x, int z); 12 13 static __int64 hashCode(int x, int z); 14 int hashCode(); 15 16 double distanceToSqr(shared_ptr<Entity> e); 17 double distanceToSqr(double px, double pz); // 4J added 18 19 int getMiddleBlockX(); 20 int getMiddleBlockZ(); 21 22 TilePos getMiddleBlockPosition(int y); 23 wstring toString(); 24 25 static __int64 hash_fnct(const ChunkPos &k); 26 static bool eq_test(const ChunkPos &x, const ChunkPos &y); 27 bool operator == (const ChunkPos &k) const { return (this->x == k.x) && ( this->z == k.z); } 28 ChunkPos & operator= (const ChunkPos & other) { x = other.x; z = other.z; return *this; } 29}; 30 31struct ChunkPosKeyHash 32{ 33 inline __int64 operator()(const ChunkPos &k) const 34 { return ChunkPos::hash_fnct(k); } 35}; 36 37struct ChunkPosKeyEq 38{ 39 inline bool operator()(const ChunkPos &x, const ChunkPos &y) const 40 { return ChunkPos::eq_test(x, y); } 41};