aboutsummaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r--src/nodedef.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 48207da1f..2442799c7 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -241,7 +241,7 @@ void ContentFeatures::reset()
sound_dug = SimpleSoundSpec();
}
-void ContentFeatures::serialize(std::ostream &os, u16 protocol_version)
+void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) const
{
if(protocol_version < 24){
serializeOld(os, protocol_version);
@@ -398,9 +398,9 @@ public:
virtual content_t allocateDummy(const std::string &name);
virtual void updateAliases(IItemDefManager *idef);
virtual void updateTextures(IGameDef *gamedef,
- /*argument: */void (*progress_callback)(void *progress_args, u32 progress, u32 max_progress),
- /*argument: */void *progress_callback_args);
- void serialize(std::ostream &os, u16 protocol_version);
+ void (*progress_cbk)(void *progress_args, u32 progress, u32 max_progress),
+ void *progress_cbk_args);
+ void serialize(std::ostream &os, u16 protocol_version) const;
void deSerialize(std::istream &is);
inline virtual bool getNodeRegistrationStatus() const;
@@ -409,6 +409,7 @@ public:
virtual void pendNodeResolve(NodeResolver *nr, NodeResolveMethod how);
virtual bool cancelNodeResolveCallback(NodeResolver *nr);
virtual void runNodeResolveCallbacks();
+ virtual void resetNodeResolveState();
private:
void addNameIdMapping(content_t i, std::string name);
@@ -474,8 +475,7 @@ void CNodeDefManager::clear()
m_group_to_items.clear();
m_next_id = 0;
- m_node_registration_complete = false;
- m_pending_resolve_callbacks.clear();
+ resetNodeResolveState();
u32 initial_length = 0;
initial_length = MYMAX(initial_length, CONTENT_UNKNOWN + 1);
@@ -972,7 +972,7 @@ void CNodeDefManager::fillTileAttribs(ITextureSource *tsrc, TileSpec *tile,
#endif
-void CNodeDefManager::serialize(std::ostream &os, u16 protocol_version)
+void CNodeDefManager::serialize(std::ostream &os, u16 protocol_version) const
{
writeU8(os, 1); // version
u16 count = 0;
@@ -981,7 +981,7 @@ void CNodeDefManager::serialize(std::ostream &os, u16 protocol_version)
if (i == CONTENT_IGNORE || i == CONTENT_AIR
|| i == CONTENT_UNKNOWN)
continue;
- ContentFeatures *f = &m_content_features[i];
+ const ContentFeatures *f = &m_content_features[i];
if (f->name == "")
continue;
writeU16(os2, i);
@@ -1062,7 +1062,7 @@ IWritableNodeDefManager *createNodeDefManager()
//// Serialization of old ContentFeatures formats
-void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version)
+void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const
{
if (protocol_version == 13)
{
@@ -1342,6 +1342,13 @@ void CNodeDefManager::runNodeResolveCallbacks()
}
+void CNodeDefManager::resetNodeResolveState()
+{
+ m_node_registration_complete = false;
+ m_pending_resolve_callbacks.clear();
+}
+
+
////
//// NodeResolver
////