projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
16baed0
)
NodeResolver: Fix cancelNode and cancelNodeList
author
kwolekr
<kwolekr@minetest.net>
Thu, 11 Dec 2014 05:41:54 +0000
(
00:41
-0500)
committer
kwolekr
<kwolekr@minetest.net>
Thu, 11 Dec 2014 05:41:54 +0000
(
00:41
-0500)
src/nodedef.cpp
patch
|
blob
|
history
src/nodedef.h
patch
|
blob
|
history
diff --git
a/src/nodedef.cpp
b/src/nodedef.cpp
index 99557472e22234c44c81e7a93f7e37867b6777c4..112373b1eb8686bad506dfe09ccfad15d6b39e33 100644
(file)
--- a/
src/nodedef.cpp
+++ b/
src/nodedef.cpp
@@
-699,7
+699,7
@@
void CNodeDefManager::updateTextures(IGameDef *gamedef)
#ifndef SERVER
infostream << "CNodeDefManager::updateTextures(): Updating "
"textures in node definitions" << std::endl;
#ifndef SERVER
infostream << "CNodeDefManager::updateTextures(): Updating "
"textures in node definitions" << std::endl;
-
+
ITextureSource *tsrc = gamedef->tsrc();
IShaderSource *shdsrc = gamedef->getShaderSource();
scene::ISceneManager* smgr = gamedef->getSceneManager();
ITextureSource *tsrc = gamedef->tsrc();
IShaderSource *shdsrc = gamedef->getShaderSource();
scene::ISceneManager* smgr = gamedef->getSceneManager();
@@
-856,7
+856,7
@@
void CNodeDefManager::updateTextures(IGameDef *gamedef)
recalculateBoundingBox(f->mesh_ptr[0]);
meshmanip->recalculateNormals(f->mesh_ptr[0], true, false);
}
recalculateBoundingBox(f->mesh_ptr[0]);
meshmanip->recalculateNormals(f->mesh_ptr[0], true, false);
}
- } else if ((f->drawtype == NDT_NODEBOX) &&
+ } else if ((f->drawtype == NDT_NODEBOX) &&
((f->node_box.type == NODEBOX_REGULAR) ||
(f->node_box.type == NODEBOX_FIXED)) &&
(!f->node_box.fixed.empty())) {
((f->node_box.type == NODEBOX_REGULAR) ||
(f->node_box.type == NODEBOX_FIXED)) &&
(!f->node_box.fixed.empty())) {
@@
-888,7
+888,7
@@
void CNodeDefManager::updateTextures(IGameDef *gamedef)
}
rotateMeshBy6dFacedir(f->mesh_ptr[0], wm_to_6d[0]);
recalculateBoundingBox(f->mesh_ptr[0]);
}
rotateMeshBy6dFacedir(f->mesh_ptr[0], wm_to_6d[0]);
recalculateBoundingBox(f->mesh_ptr[0]);
- meshmanip->recalculateNormals(f->mesh_ptr[0], true, false);
+ meshmanip->recalculateNormals(f->mesh_ptr[0], true, false);
}
}
#endif
}
}
#endif
@@
-1148,7
+1148,7
@@
void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version)
writeU8(os, drowning);
writeU8(os, leveled);
writeU8(os, liquid_range);
writeU8(os, drowning);
writeU8(os, leveled);
writeU8(os, liquid_range);
- } else
+ } else
throw SerializationError("ContentFeatures::serialize(): "
"Unsupported version requested");
}
throw SerializationError("ContentFeatures::serialize(): "
"Unsupported version requested");
}
@@
-1336,8
+1336,10
@@
bool NodeResolver::cancelNode(content_t *content)
{
bool found = false;
{
bool found = false;
- std::list<NodeResolveInfo *>::iterator it = m_pending_contents.begin();
- while (it != m_pending_contents.end()) {
+ for (std::list<NodeResolveInfo *>::iterator
+ it = m_pending_contents.begin();
+ it != m_pending_contents.end();
+ ++it) {
NodeResolveInfo *nfi = *it;
if (nfi->output == content) {
it = m_pending_contents.erase(it);
NodeResolveInfo *nfi = *it;
if (nfi->output == content) {
it = m_pending_contents.erase(it);
@@
-1354,9
+1356,10
@@
int NodeResolver::cancelNodeList(std::vector<content_t> *content_vec)
{
int num_canceled = 0;
{
int num_canceled = 0;
- std::list<std::pair<std::string, std::vector<content_t> *> >::iterator it;
- it = m_pending_content_vecs.begin();
- while (it != m_pending_content_vecs.end()) {
+ for (ContentVectorResolveList::iterator
+ it = m_pending_content_vecs.begin();
+ it != m_pending_content_vecs.end();
+ ++it) {
if (it->second == content_vec) {
it = m_pending_content_vecs.erase(it);
num_canceled++;
if (it->second == content_vec) {
it = m_pending_content_vecs.erase(it);
num_canceled++;
@@
-1373,7
+1376,7
@@
int NodeResolver::resolveNodes()
//// Resolve pending single node name -> content ID mappings
while (!m_pending_contents.empty()) {
//// Resolve pending single node name -> content ID mappings
while (!m_pending_contents.empty()) {
- NodeResolveInfo *nri = m_pending_contents.front();
+ NodeResolveInfo *nri = m_pending_contents.front();
m_pending_contents.pop_front();
bool success = true;
m_pending_contents.pop_front();
bool success = true;
@@
-1403,7
+1406,7
@@
int NodeResolver::resolveNodes()
std::string &name = item.first;
std::vector<content_t> *output = item.second;
std::string &name = item.first;
std::vector<content_t> *output = item.second;
-
+
std::set<content_t> idset;
std::set<content_t>::iterator it;
std::set<content_t> idset;
std::set<content_t>::iterator it;
diff --git
a/src/nodedef.h
b/src/nodedef.h
index f41017f63ec22f054aae382eb8bef69219be588a..978b9b7cd406d48ae8596cff3b4b879bb9c2bc35 100644
(file)
--- a/
src/nodedef.h
+++ b/
src/nodedef.h
@@
-40,6
+40,8
@@
class IShaderSource;
class IGameDef;
typedef std::list<std::pair<content_t, int> > GroupItems;
class IGameDef;
typedef std::list<std::pair<content_t, int> > GroupItems;
+typedef std::list<std::pair<std::string, std::vector<content_t> *> >
+ ContentVectorResolveList;
enum ContentParamType
{
enum ContentParamType
{
@@
-164,7
+166,7
@@
struct ContentFeatures
*/
#ifndef SERVER
// 0 1 2 3 4 5
*/
#ifndef SERVER
// 0 1 2 3 4 5
- // up down right left back front
+ // up down right left back front
TileSpec tiles[6];
// Special tiles
// - Currently used for flowing liquids
TileSpec tiles[6];
// Special tiles
// - Currently used for flowing liquids
@@
-191,7
+193,7
@@
struct ContentFeatures
std::string mesh;
#ifndef SERVER
scene::IMesh *mesh_ptr[24];
std::string mesh;
#ifndef SERVER
scene::IMesh *mesh_ptr[24];
-#endif
+#endif
float visual_scale; // Misc. scale parameter
TileDef tiledef[6];
TileDef tiledef_special[CF_SPECIAL_COUNT]; // eg. flowing liquid
float visual_scale; // Misc. scale parameter
TileDef tiledef[6];
TileDef tiledef_special[CF_SPECIAL_COUNT]; // eg. flowing liquid
@@
-261,7
+263,7
@@
struct ContentFeatures
/*
Methods
*/
/*
Methods
*/
-
+
ContentFeatures();
~ContentFeatures();
void reset();
ContentFeatures();
~ContentFeatures();
void reset();
@@
-399,7
+401,7
@@
private:
INodeDefManager *m_ndef;
bool m_is_node_registration_complete;
std::list<NodeResolveInfo *> m_pending_contents;
INodeDefManager *m_ndef;
bool m_is_node_registration_complete;
std::list<NodeResolveInfo *> m_pending_contents;
-
std::list<std::pair<std::string, std::vector<content_t> *> >
m_pending_content_vecs;
+
ContentVectorResolveList
m_pending_content_vecs;
};
class INodeDefManager
};
class INodeDefManager
@@
-416,7
+418,7
@@
public:
virtual void getIds(const std::string &name, std::set<content_t> &result)
const=0;
virtual const ContentFeatures& get(const std::string &name) const=0;
virtual void getIds(const std::string &name, std::set<content_t> &result)
const=0;
virtual const ContentFeatures& get(const std::string &name) const=0;
-
+
virtual void serialize(std::ostream &os, u16 protocol_version)=0;
virtual NodeResolver *getResolver()=0;
virtual void serialize(std::ostream &os, u16 protocol_version)=0;
virtual NodeResolver *getResolver()=0;