blob: be477b70f5eacaca89358ed97718afa6d02c95d3 (
plain)
ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 01 00 00 00 01 00 08 06 00 00 00 5c 72 a8 | .PNG........IHDR.............\r. |
0020 | 66 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0e c3 00 | f....bKGD..............pHYs..... |
0040 | 00 0e c3 01 c7 6f a8 64 00 00 00 07 74 49 4d 45 07 e0 06 09 13 12 3b ff 47 8f d6 00 00 20 00 49 | .....o.d....tIME......;.G......I |
0060 | 44 41 54 78 da ec bd 69 94 5c e7 79 26 f6 bc df 76 97 5a bb 7a 01 08 80 04 01 90 20 09 90 04 49 | DATx...i.\.y&...v.Z.z..........I |
0080 | 49 36 23 8b 92 45 5b d6 78 91 c6 b6 24 db e2 78 32 56 62 47 92 ed d8 71 e2 93 39 3e 67 92 4c e6 | I6#..E[.x...$..x2VbG...q..9>g.L. |
00a0 | 24 3f e6 4f e6 78 1b 25 71 a2 73 46 33 b1 ac 91 9d c9 62 5b 1e 79 ec b1 c7 76 bc 90 12 45 d1 04 | $?.O.x.%q.sF3.....b[.y...v...E.. |
00c0 | 29 52 04 40 12 22 01 f4 56 5d cb 5d bf 25 3f be 7b 2f aa 5b 4d 52 94 2d 12 a4 ee cb 53 04 d0 5d | )R.@."..V].].%?.{/.[MR.-....S..] |
00e0 | d5 d5 75 ab 9e e7 7b 97 e7 7d 5f a0 b5 d6 5a 6b ad /*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include "irrlichttypes.h"
#include "irr_v2d.h"
#include "mapblock.h"
#include <ostream>
#include <map>
#include <vector>
class Map;
class IGameDef;
/*
This is an Y-wise stack of MapBlocks.
*/
#define MAPSECTOR_SERVER 0
#define MAPSECTOR_CLIENT 1
class MapSector
{
public:
MapSector(Map *parent, v2s16 pos, IGameDef *gamedef);
virtual ~MapSector();
void deleteBlocks();
v2s16 getPos()
{
return m_pos;
}
MapBlock * getBlockNoCreateNoEx(s16 y);
MapBlock * createBlankBlockNoInsert(s16 y);
MapBlock * createBlankBlock(s16 y);
void insertBlock(MapBlock *block);
void deleteBlock(MapBlock *block);
void getBlocks(MapBlockVect &dest);
bool empty() const { return m_blocks.empty(); }
protected:
// The pile of MapBlocks
std::unordered_map<s16, MapBlock*> m_blocks;
Map *m_parent;
// Position on parent (in MapBlock widths)
v2s16 m_pos;
IGameDef *m_gamedef;
// Last-used block is cached here for quicker access.
// Be sure to set this to nullptr when the cached block is deleted
MapBlock *m_block_cache = nullptr;
s16 m_block_cache_y;
/*
Private methods
*/
MapBlock *getBlockBuffered(s16 y);
};
|