From 4bb865cbbadac6146cf6eaf868b881edbb6a1912 Mon Sep 17 00:00:00 2001 From: MarcEricMartel <74071476+MarcEricMartel@users.noreply.github.com> Date: Wed, 1 Dec 2021 22:06:47 -0500 Subject: [PATCH] Ajout de RetrieveChunk --- SQCSim2021/define.h | 1 + SQCSim2021/media/chunks/26_85.chunk | Bin 0 -> 32768 bytes SQCSim2021/world.cpp | 18 ++++++++++++++++++ SQCSim2021/world.h | 5 ++++- 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 SQCSim2021/media/chunks/26_85.chunk diff --git a/SQCSim2021/define.h b/SQCSim2021/define.h index d12d984..1bd66b8 100644 --- a/SQCSim2021/define.h +++ b/SQCSim2021/define.h @@ -21,6 +21,7 @@ #define FRAMES_RENDER_CHUNKS 2 #define FRAMES_UPDATE_CHUNKS 2 +#define FRAMES_DELETE_CHUNKS 2 #define VIEW_DISTANCE 512 #define MAX_SELECTION_DISTANCE 5 diff --git a/SQCSim2021/media/chunks/26_85.chunk b/SQCSim2021/media/chunks/26_85.chunk new file mode 100644 index 0000000000000000000000000000000000000000..280bcc05bbaa8ab0deb22c34e4fc1b98f5caffcc GIT binary patch literal 32768 zcmeIy(Ne=O3`Eg(^8f#gEl2iRO;J3w9RimZ*m#v#=YehG2LS{SKmY**5I_I{1pcSM zeO~*1e|Rt#ws4;2Fiu1OfnOwW3wMb*9RIa=3;V{rh4VCD3+NX1jd=^_%Q^Lmz901~ z>rUU#a#?@sr}_O}^L^Iz>bg3=n(O*HpXSsnyl;D_pKYu6Zx04xmTg_#-v-9~!?`_> z^EB6j_S0MnQ~#UXwv+z;pwDNyUZ(u?{&H>uV?NDRkbatLLHm;J?s|WJ;QiHXmnlO& zpXR;L`)O{4(ND7#q%YaG^ZUl!-d&&W^S$sS_W}Q&4?N30;OA-H3%$Rb+knmc<$S-G z{W5-@=26)1*WdUg_W|F>2hL`Hf%ntA7i!TI&cuhB`_tyt!vJTk(@`9M<=+vM3?mDoX!@#`Vk>@-RIO_ka>E3le zeUN4Ce&X-xa^-_*4uyHUpL=~`=U09saQxWsm3OGetPosition(cx, cy); + + if (cx == x && cy == y) + return std::move(m_tbDeleted.at(index)); + } + + return nullptr; +} diff --git a/SQCSim2021/world.h b/SQCSim2021/world.h index 6d9c3c5..a90e08c 100644 --- a/SQCSim2021/world.h +++ b/SQCSim2021/world.h @@ -27,11 +27,14 @@ class World { BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const; void TransposeWorld(Player& player); + void CleanUpWorld(int& frames); + Chunk* RetrieveChunk(int x, int y); + private: Array2d m_chunks = Array2d(WORLD_SIZE_X, WORLD_SIZE_Y); std::vector m_tbDeleted; - int m_center[2] = {INT16_MAX / 2, INT16_MAX / 2}; + int m_center[2] = {INT16_MAX / 2 - WORLD_SIZE_X / 2, INT16_MAX / 2 - WORLD_SIZE_Y / 2}; }; #endif // WORLD_H__