Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- git/minetest/src/serverobject.cpp 2012-01-09 20:35:52.000000000 +0100
- +++ minetest/src/serverobject.cpp 2012-01-15 13:25:24.000000000 +0100
- @@ -43,8 +43,8 @@
- const std::string &data)
- {
- // Find factory function
- - core::map<u16, Factory>::Node *n;
- - n = m_types.find(type);
- + core::map<u8, Factory>::Node *n;
- + n = ServerActiveObject::getTypes().find(type);
- if(n == NULL)
- {
- // If factory is not found, just return.
- @@ -58,13 +58,13 @@
- return object;
- }
- -void ServerActiveObject::registerType(u16 type, Factory f)
- +void ServerActiveObject::registerType(u8 type, Factory f)
- {
- - core::map<u16, Factory>::Node *n;
- - n = m_types.find(type);
- + core::map<u8, Factory>::Node *n;
- + n = ServerActiveObject::getTypes().find(type);
- if(n)
- return;
- - m_types.insert(type, f);
- + ServerActiveObject::getTypes().insert(type, f);
- }
- void ServerActiveObject::getWieldDiggingProperties(ToolDiggingProperties *dst)
- --- git/minetest/src/serverobject.h 2012-01-09 20:35:52.000000000 +0100
- +++ minetest/src/serverobject.h 2012-01-15 13:20:52.000000000 +0100
- @@ -200,14 +200,17 @@
- typedef ServerActiveObject* (*Factory)
- (ServerEnvironment *env, v3f pos,
- const std::string &data);
- - static void registerType(u16 type, Factory f);
- + static void registerType(u8 type, Factory f);
- ServerEnvironment *m_env;
- v3f m_base_position;
- private:
- - // Used for creating objects based on type
- - static core::map<u16, Factory> m_types;
- + static core::map<u8, Factory>& getTypes()
- + {
- + static core::map<u8, Factory> types;
- + return types;
- + }
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement