diff options
author | kwolekr <mirrorisim@gmail.com> | 2013-02-17 01:47:49 -0500 |
---|---|---|
committer | kwolekr <mirrorisim@gmail.com> | 2013-02-25 23:08:26 -0500 |
commit | 5ec5b1cbd64a22e628be2cf03391883c44074811 (patch) | |
tree | 776d209306ce96d543e1b69a9726293e5f5f0fa5 /src/emerge.h | |
parent | 76217939e05bdd8d06fa7113902a74b02deeb915 (diff) | |
download | minetest-5ec5b1cbd64a22e628be2cf03391883c44074811.tar.gz minetest-5ec5b1cbd64a22e628be2cf03391883c44074811.tar.bz2 minetest-5ec5b1cbd64a22e628be2cf03391883c44074811.zip |
Add multi-Emerge thread support
Diffstat (limited to 'src/emerge.h')
-rw-r--r-- | src/emerge.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/emerge.h b/src/emerge.h index b4461ae61..7e0cc4850 100644 --- a/src/emerge.h +++ b/src/emerge.h @@ -46,8 +46,8 @@ class EmergeManager { public: std::map<std::string, MapgenFactory *> mglist; - Mapgen *mapgen; - EmergeThread *emergethread; + std::vector<Mapgen *> mapgen; + std::vector<EmergeThread *> emergethread; //settings MapgenParams *params; @@ -68,11 +68,9 @@ public: void initMapgens(MapgenParams *mgparams); Mapgen *createMapgen(std::string mgname, int mgid, - MapgenParams *mgparams, EmergeManager *emerge); + MapgenParams *mgparams); MapgenParams *createMapgenParams(std::string mgname); - Mapgen *getMapgen(); bool enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate); - bool popBlockEmerge(v3s16 *pos, u8 *flags); bool registerMapgen(std::string name, MapgenFactory *mgfactory); MapgenParams *getParamsFromSettings(Settings *settings); @@ -92,17 +90,19 @@ class EmergeThread : public SimpleThread EmergeManager *emerge; Mapgen *mapgen; bool enable_mapgen_debug_info; + int id; public: Event qevent; std::queue<v3s16> blockqueue; - EmergeThread(Server *server): + EmergeThread(Server *server, int ethreadid): SimpleThread(), m_server(server), map(NULL), emerge(NULL), - mapgen(NULL) + mapgen(NULL), + id(ethreadid) { enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info"); } @@ -118,6 +118,7 @@ public: } } + bool popBlockEmerge(v3s16 *pos, u8 *flags); bool getBlockOrStartGen(v3s16 p, MapBlock **b, BlockMakeData *data, bool allow_generate); }; |