TrinityCore
Loading...
Searching...
No Matches
DynamicMMapTileBuilder.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_DYNAMIC_MMAP_TILE_BUILDER_H
19#define TRINITYCORE_DYNAMIC_MMAP_TILE_BUILDER_H
20
22#include "TileBuilder.h"
23#include "Timer.h"
24#include <atomic>
25
26class Map;
27
28namespace MMAP
29{
30struct TileBuildRequest;
31bool InvokeAsyncCallbackIfReady(TileBuildRequest& request);
32
33class DynamicTileBuilder : public TileBuilder, public std::enable_shared_from_this<DynamicTileBuilder>
34{
35public:
36 explicit DynamicTileBuilder(Map* map, dtNavMesh* navMesh);
37 DynamicTileBuilder(DynamicTileBuilder const& other) = delete;
42
43 void AddTile(uint32 terrainMapId, uint32 tileX, uint32 tileY);
44
45 void Update(Milliseconds diff);
46
48 {
50 std::atomic<bool> IsReady;
51 };
52
53private:
54 std::weak_ptr<AsyncTileResult> BuildTile(uint32 terrainMapId, uint32 tileX, uint32 tileY);
55
57 dtNavMesh* m_navMesh;
58
59 struct TileId;
60 std::vector<TileId> m_tilesToRebuild;
61
63
66};
67}
68
69#endif // TRINITYCORE_DYNAMIC_MMAP_TILE_BUILDER_H
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
void AddTile(uint32 terrainMapId, uint32 tileX, uint32 tileY)
std::vector< TileId > m_tilesToRebuild
DynamicTileBuilder(DynamicTileBuilder &&other)=delete
DynamicTileBuilder & operator=(DynamicTileBuilder const &other)=delete
DynamicTileBuilder & operator=(DynamicTileBuilder &&other)=delete
AsyncCallbackProcessor< TileBuildRequest > m_tiles
DynamicTileBuilder(DynamicTileBuilder const &other)=delete
std::weak_ptr< AsyncTileResult > BuildTile(uint32 terrainMapId, uint32 tileX, uint32 tileY)
Definition Map.h:225
bool InvokeAsyncCallbackIfReady(TileBuildRequest &request)