Advertisement
Guest User

Untitled

a guest
Jan 15th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. --- git/minetest/src/serverobject.cpp 2012-01-09 20:35:52.000000000 +0100
  2. +++ minetest/src/serverobject.cpp 2012-01-15 13:25:24.000000000 +0100
  3. @@ -43,8 +43,8 @@
  4. const std::string &data)
  5. {
  6. // Find factory function
  7. - core::map<u16, Factory>::Node *n;
  8. - n = m_types.find(type);
  9. + core::map<u8, Factory>::Node *n;
  10. + n = ServerActiveObject::getTypes().find(type);
  11. if(n == NULL)
  12. {
  13. // If factory is not found, just return.
  14. @@ -58,13 +58,13 @@
  15. return object;
  16. }
  17.  
  18. -void ServerActiveObject::registerType(u16 type, Factory f)
  19. +void ServerActiveObject::registerType(u8 type, Factory f)
  20. {
  21. - core::map<u16, Factory>::Node *n;
  22. - n = m_types.find(type);
  23. + core::map<u8, Factory>::Node *n;
  24. + n = ServerActiveObject::getTypes().find(type);
  25. if(n)
  26. return;
  27. - m_types.insert(type, f);
  28. + ServerActiveObject::getTypes().insert(type, f);
  29. }
  30.  
  31. void ServerActiveObject::getWieldDiggingProperties(ToolDiggingProperties *dst)
  32. --- git/minetest/src/serverobject.h 2012-01-09 20:35:52.000000000 +0100
  33. +++ minetest/src/serverobject.h 2012-01-15 13:20:52.000000000 +0100
  34. @@ -200,14 +200,17 @@
  35. typedef ServerActiveObject* (*Factory)
  36. (ServerEnvironment *env, v3f pos,
  37. const std::string &data);
  38. - static void registerType(u16 type, Factory f);
  39. + static void registerType(u8 type, Factory f);
  40.  
  41. ServerEnvironment *m_env;
  42. v3f m_base_position;
  43.  
  44. private:
  45. - // Used for creating objects based on type
  46. - static core::map<u16, Factory> m_types;
  47. + static core::map<u8, Factory>& getTypes()
  48. + {
  49. + static core::map<u8, Factory> types;
  50. + return types;
  51. + }
  52. };
  53.  
  54. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement