Ver Fonte

Merge branch 'master' into input-overhaul

rdb há 7 anos atrás
pai
commit
ba2de46beb
100 ficheiros alterados com 883 adições e 1008 exclusões
  1. 12 10
      README.md
  2. 47 47
      contrib/src/ai/aiBehaviors.cxx
  3. 15 15
      contrib/src/ai/aiBehaviors.h
  4. 3 0
      contrib/src/ai/aiCharacter.cxx
  5. 4 3
      contrib/src/ai/aiCharacter.h
  6. 3 3
      contrib/src/ai/aiNode.cxx
  7. 3 3
      contrib/src/ai/aiPathFinder.cxx
  8. 4 4
      contrib/src/ai/aiPathFinder.h
  9. 31 103
      contrib/src/ai/aiWorld.cxx
  10. 5 25
      contrib/src/ai/aiWorld.h
  11. 3 3
      contrib/src/ai/arrival.cxx
  12. 1 1
      contrib/src/ai/flock.h
  13. 3 3
      contrib/src/ai/meshNode.cxx
  14. 0 1
      contrib/src/ai/obstacleAvoidance.cxx
  15. 18 18
      contrib/src/ai/pathFind.cxx
  16. 4 4
      contrib/src/ai/pathFind.h
  17. 3 3
      contrib/src/ai/pathFollow.h
  18. 1 1
      contrib/src/panda3dtoolsgui/build_exe.bat
  19. 1 1
      contrib/src/rplight/gpuCommand.h
  20. 1 1
      contrib/src/rplight/gpuCommandList.h
  21. 2 1
      contrib/src/rplight/pointerSlotStorage.h
  22. 3 3
      contrib/src/rplight/pssmCameraRig.h
  23. 1 1
      contrib/src/rplight/rpLight.I
  24. 1 1
      contrib/src/rplight/rpLight.h
  25. 1 1
      contrib/src/rplight/shadowAtlas.I
  26. 2 2
      contrib/src/rplight/shadowManager.I
  27. 5 5
      contrib/src/rplight/tagStateManager.I
  28. 10 10
      contrib/src/rplight/tagStateManager.h
  29. 4 4
      contrib/src/sceneeditor/seFileSaver.py
  30. 1 8
      contrib/src/sceneeditor/seLights.py
  31. 2 2
      direct/src/dcparse/dcparse.cxx
  32. 5 5
      direct/src/dcparser/dcArrayParameter.cxx
  33. 4 4
      direct/src/dcparser/dcArrayParameter.h
  34. 4 4
      direct/src/dcparser/dcAtomicField.cxx
  35. 6 6
      direct/src/dcparser/dcAtomicField.h
  36. 1 1
      direct/src/dcparser/dcClass.I
  37. 50 129
      direct/src/dcparser/dcClass.cxx
  38. 17 22
      direct/src/dcparser/dcClass.h
  39. 2 2
      direct/src/dcparser/dcClassParameter.cxx
  40. 2 2
      direct/src/dcparser/dcClassParameter.h
  41. 4 4
      direct/src/dcparser/dcDeclaration.cxx
  42. 5 5
      direct/src/dcparser/dcDeclaration.h
  43. 4 4
      direct/src/dcparser/dcField.I
  44. 24 24
      direct/src/dcparser/dcField.cxx
  45. 14 14
      direct/src/dcparser/dcField.h
  46. 12 12
      direct/src/dcparser/dcFile.cxx
  47. 15 15
      direct/src/dcparser/dcFile.h
  48. 5 5
      direct/src/dcparser/dcKeyword.h
  49. 2 2
      direct/src/dcparser/dcKeywordList.cxx
  50. 4 4
      direct/src/dcparser/dcKeywordList.h
  51. 5 5
      direct/src/dcparser/dcLexer.lxx
  52. 3 3
      direct/src/dcparser/dcLexerDefs.h
  53. 2 2
      direct/src/dcparser/dcMolecularField.cxx
  54. 3 3
      direct/src/dcparser/dcMolecularField.h
  55. 15 15
      direct/src/dcparser/dcNumericRange.I
  56. 4 4
      direct/src/dcparser/dcNumericRange.h
  57. 6 6
      direct/src/dcparser/dcPackData.I
  58. 1 1
      direct/src/dcparser/dcPackData.cxx
  59. 1 1
      direct/src/dcparser/dcPackData.h
  60. 59 59
      direct/src/dcparser/dcPacker.I
  61. 74 74
      direct/src/dcparser/dcPacker.cxx
  62. 21 21
      direct/src/dcparser/dcPacker.h
  63. 1 1
      direct/src/dcparser/dcPackerCatalog.I
  64. 12 12
      direct/src/dcparser/dcPackerCatalog.cxx
  65. 7 7
      direct/src/dcparser/dcPackerCatalog.h
  66. 1 1
      direct/src/dcparser/dcPackerInterface.I
  67. 14 14
      direct/src/dcparser/dcPackerInterface.cxx
  68. 8 8
      direct/src/dcparser/dcPackerInterface.h
  69. 9 9
      direct/src/dcparser/dcParameter.cxx
  70. 12 12
      direct/src/dcparser/dcParameter.h
  71. 57 57
      direct/src/dcparser/dcParser.yxx
  72. 4 4
      direct/src/dcparser/dcParserDefs.h
  73. 8 6
      direct/src/dcparser/dcSimpleParameter.cxx
  74. 4 4
      direct/src/dcparser/dcSimpleParameter.h
  75. 1 1
      direct/src/dcparser/dcSubatomicType.h
  76. 25 25
      direct/src/dcparser/dcSwitch.cxx
  77. 21 21
      direct/src/dcparser/dcSwitch.h
  78. 3 3
      direct/src/dcparser/dcSwitchParameter.cxx
  79. 5 5
      direct/src/dcparser/dcSwitchParameter.h
  80. 5 5
      direct/src/dcparser/dcTypedef.h
  81. 7 16
      direct/src/dcparser/dcbase.h
  82. 2 2
      direct/src/dcparser/dcindent.h
  83. 6 9
      direct/src/dcparser/dcmsgtypes.h
  84. 1 1
      direct/src/dcparser/hashGenerator.h
  85. 1 1
      direct/src/dcparser/primeNumberGenerator.h
  86. 4 0
      direct/src/deadrec/config_deadrec.cxx
  87. 2 2
      direct/src/deadrec/config_deadrec.h
  88. 3 3
      direct/src/deadrec/smoothMover.h
  89. 54 4
      direct/src/directbase/directsymbols.h
  90. 7 3
      direct/src/directd/directd.cxx
  91. 11 11
      direct/src/directd/directd.h
  92. 2 2
      direct/src/directdServer/directdClient.cxx
  93. 2 2
      direct/src/directdServer/directdClient.h
  94. 2 2
      direct/src/directdServer/directdServer.h
  95. 2 2
      direct/src/directtools/DirectSelection.py
  96. 2 0
      direct/src/distributed/CRDataCache.py
  97. 3 3
      direct/src/distributed/ClientRepositoryBase.py
  98. 5 4
      direct/src/distributed/ConnectionRepository.py
  99. 2 0
      direct/src/distributed/DistributedNode.py
  100. 0 1
      direct/src/distributed/DistributedNodeUD.py

+ 12 - 10
README.md

@@ -43,24 +43,26 @@ Building Panda3D
 Windows
 Windows
 -------
 -------
 
 
-We currently build using the Microsoft Visual C++ 2010 compiler.  You do not
-need Microsoft Visual Studio to build Panda3D, though - the relevant compilers
-are included as part of the Windows 7.1 SDK.
+We currently build using the Microsoft Visual C++ 2015 compiler.  You will
+also need to install the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk),
+and if you intend to target Windows XP, you will also need the
+[Windows 7.1 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=8279).
 
 
 You will also need to have the third-party dependency libraries available for
 You will also need to have the third-party dependency libraries available for
 the build scripts to use.  These are available from one of these two URLs,
 the build scripts to use.  These are available from one of these two URLs,
-depending on whether you are on a 32-bit or 64-bit system:
-https://www.panda3d.org/download/panda3d-1.9.4/panda3d-1.9.4-tools-win32.zip
-https://www.panda3d.org/download/panda3d-1.9.4/panda3d-1.9.4-tools-win64.zip
+depending on whether you are on a 32-bit or 64-bit system, or you can
+[click here](https://github.com/rdb/panda3d-thirdparty) for instructions on
+building them from source.
 
 
-(It is also possible to build using MSVC 2015 and 2017, which requires a
-different set of thirdparty libraries, but that is not described here.)
+http://rdb.name/thirdparty-vc14-x64.7z
+http://rdb.name/thirdparty-vc14.7z
 
 
 After acquiring these dependencies, you may simply build Panda3D from the
 After acquiring these dependencies, you may simply build Panda3D from the
-command prompt using the following command:
+command prompt using the following command.  (Add the `--windows-sdk=10`
+option if you don't need to support Windows XP.)
 
 
 ```bash
 ```bash
-makepanda\makepanda.bat --everything --installer --no-eigen
+makepanda\makepanda.bat --everything --installer --no-eigen --threads=2
 ```
 ```
 
 
 When the build succeeds, it will produce an .exe file that you can use to
 When the build succeeds, it will produce an .exe file that you can use to

+ 47 - 47
contrib/src/ai/aiBehaviors.cxx

@@ -21,16 +21,16 @@ AIBehaviors::AIBehaviors() {
   _previous_conflict = false;
   _previous_conflict = false;
   _conflict = false;
   _conflict = false;
 
 
-  _seek_obj = NULL;
-  _flee_obj = NULL;
-  _pursue_obj = NULL;
-  _evade_obj = NULL;
-  _arrival_obj = NULL;
-  _wander_obj = NULL;
-  _flock_group = NULL;
-  _path_follow_obj = NULL;
-  _path_find_obj = NULL;
-  _obstacle_avoidance_obj = NULL;
+  _seek_obj = nullptr;
+  _flee_obj = nullptr;
+  _pursue_obj = nullptr;
+  _evade_obj = nullptr;
+  _arrival_obj = nullptr;
+  _wander_obj = nullptr;
+  _flock_group = nullptr;
+  _path_follow_obj = nullptr;
+  _path_find_obj = nullptr;
+  _obstacle_avoidance_obj = nullptr;
 
 
   turn_off("seek");
   turn_off("seek");
   turn_off("flee");
   turn_off("flee");
@@ -267,7 +267,7 @@ LVecBase3 AIBehaviors::calculate_prioritized() {
     accumulate_force("obstacle_avoidance", force);
     accumulate_force("obstacle_avoidance", force);
   }
   }
 
 
-  if(_path_follow_obj!=NULL) {
+  if(_path_follow_obj!=nullptr) {
     if(_path_follow_obj->_start) {
     if(_path_follow_obj->_start) {
       _path_follow_obj->do_follow();
       _path_follow_obj->do_follow();
     }
     }
@@ -286,13 +286,13 @@ LVecBase3 AIBehaviors::calculate_prioritized() {
   }
   }
 
 
   if(is_on(_arrival)) {
   if(is_on(_arrival)) {
-    if(_seek_obj != NULL) {
+    if(_seek_obj != nullptr) {
       LVecBase3 dirn = _steering_force;
       LVecBase3 dirn = _steering_force;
       dirn.normalize();
       dirn.normalize();
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * dirn);
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * dirn);
     }
     }
 
 
-    if(_pursue_obj != NULL) {
+    if(_pursue_obj != nullptr) {
       LVecBase3 dirn = _steering_force;
       LVecBase3 dirn = _steering_force;
       dirn.normalize();
       dirn.normalize();
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * _arrival_obj->_arrival_direction);
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * _arrival_obj->_arrival_direction);
@@ -320,10 +320,10 @@ void AIBehaviors::remove_ai(string ai_type) {
             }
             }
 
 
     case 1:  {
     case 1:  {
-              if(_seek_obj != NULL) {
+              if(_seek_obj != nullptr) {
                 turn_off("seek");
                 turn_off("seek");
                 delete _seek_obj;
                 delete _seek_obj;
-                _seek_obj = NULL;
+                _seek_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
@@ -338,10 +338,10 @@ void AIBehaviors::remove_ai(string ai_type) {
             }
             }
 
 
     case 3: {
     case 3: {
-              if(_pursue_obj != NULL) {
+              if(_pursue_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 delete _pursue_obj;
                 delete _pursue_obj;
-                _pursue_obj = NULL;
+                _pursue_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
@@ -356,59 +356,59 @@ void AIBehaviors::remove_ai(string ai_type) {
             }
             }
 
 
     case 5: {
     case 5: {
-              if(_arrival_obj != NULL) {
+              if(_arrival_obj != nullptr) {
                 turn_off("arrival");
                 turn_off("arrival");
                 turn_off("arrival_activate");
                 turn_off("arrival_activate");
                 delete _arrival_obj;
                 delete _arrival_obj;
-                _arrival_obj = NULL;
+                _arrival_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 6: {
     case 6: {
-              if(_flock_group != NULL) {
+              if(_flock_group != nullptr) {
                 turn_off("flock");
                 turn_off("flock");
                 turn_off("flock_activate");
                 turn_off("flock_activate");
-                _flock_group = NULL;
+                _flock_group = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 7: {
     case 7: {
-              if(_wander_obj != NULL) {
+              if(_wander_obj != nullptr) {
                 turn_off("wander");
                 turn_off("wander");
                 delete _wander_obj;
                 delete _wander_obj;
-                _wander_obj = NULL;
+                _wander_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 8: {
     case 8: {
-              if(_obstacle_avoidance_obj !=NULL) {
+              if(_obstacle_avoidance_obj !=nullptr) {
                 turn_off("obstacle_avoidance");
                 turn_off("obstacle_avoidance");
                 delete _obstacle_avoidance_obj;
                 delete _obstacle_avoidance_obj;
-                _obstacle_avoidance_obj = NULL;
+                _obstacle_avoidance_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 9: {
     case 9: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 delete _pursue_obj;
                 delete _pursue_obj;
-                _pursue_obj = NULL;
+                _pursue_obj = nullptr;
                 delete _path_follow_obj;
                 delete _path_follow_obj;
-                _path_follow_obj = NULL;
+                _path_follow_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
     case 16: {
     case 16: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 delete _pursue_obj;
                 delete _pursue_obj;
-                _pursue_obj = NULL;
+                _pursue_obj = nullptr;
                 delete _path_follow_obj;
                 delete _path_follow_obj;
-                _path_follow_obj = NULL;
+                _path_follow_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
@@ -436,7 +436,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 1:  {
     case 1:  {
-              if(_seek_obj != NULL) {
+              if(_seek_obj != nullptr) {
                 turn_off("seek");
                 turn_off("seek");
               }
               }
               break;
               break;
@@ -451,7 +451,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 3: {
     case 3: {
-              if(_pursue_obj != NULL) {
+              if(_pursue_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
               }
               }
               break;
               break;
@@ -466,7 +466,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 5: {
     case 5: {
-              if(_arrival_obj != NULL) {
+              if(_arrival_obj != nullptr) {
                 turn_off("arrival");
                 turn_off("arrival");
                 turn_off("arrival_activate");
                 turn_off("arrival_activate");
               }
               }
@@ -474,7 +474,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 6: {
     case 6: {
-              if(_flock_group != NULL) {
+              if(_flock_group != nullptr) {
                 turn_off("flock");
                 turn_off("flock");
                 turn_off("flock_activate");
                 turn_off("flock_activate");
               }
               }
@@ -482,14 +482,14 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 7: {
     case 7: {
-              if(_wander_obj != NULL) {
+              if(_wander_obj != nullptr) {
                 turn_off("wander");
                 turn_off("wander");
               }
               }
               break;
               break;
             }
             }
 
 
     case 8: {
     case 8: {
-              if(_obstacle_avoidance_obj != NULL) {
+              if(_obstacle_avoidance_obj != nullptr) {
                 turn_off("obstacle_avoidance");
                 turn_off("obstacle_avoidance");
                 turn_off("obstacle_avoidance_activate");
                 turn_off("obstacle_avoidance_activate");
               }
               }
@@ -497,14 +497,14 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 9: {
     case 9: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 _path_follow_obj->_start = false;
                 _path_follow_obj->_start = false;
               }
               }
               break;
               break;
             }
             }
     case 16: {
     case 16: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 _path_follow_obj->_start = false;
                 _path_follow_obj->_start = false;
               }
               }
@@ -534,7 +534,7 @@ void AIBehaviors::resume_ai(string ai_type) {
             }
             }
 
 
     case 1:  {
     case 1:  {
-              if(_seek_obj != NULL) {
+              if(_seek_obj != nullptr) {
                 turn_on("seek");
                 turn_on("seek");
               }
               }
               break;
               break;
@@ -548,7 +548,7 @@ void AIBehaviors::resume_ai(string ai_type) {
             }
             }
 
 
     case 3: {
     case 3: {
-              if(_pursue_obj != NULL) {
+              if(_pursue_obj != nullptr) {
                 turn_on("pursue");
                 turn_on("pursue");
               }
               }
               break;
               break;
@@ -562,42 +562,42 @@ void AIBehaviors::resume_ai(string ai_type) {
             }
             }
 
 
     case 5: {
     case 5: {
-              if(_arrival_obj != NULL) {
+              if(_arrival_obj != nullptr) {
                 turn_on("arrival");
                 turn_on("arrival");
               }
               }
               break;
               break;
             }
             }
 
 
     case 6: {
     case 6: {
-              if(_flock_group != NULL) {
+              if(_flock_group != nullptr) {
                 turn_on("flock");
                 turn_on("flock");
               }
               }
               break;
               break;
             }
             }
 
 
     case 7: {
     case 7: {
-              if(_wander_obj != NULL) {
+              if(_wander_obj != nullptr) {
                 turn_on("wander");
                 turn_on("wander");
               }
               }
               break;
               break;
             }
             }
 
 
     case 8: {
     case 8: {
-              if(_obstacle_avoidance_obj != NULL) {
+              if(_obstacle_avoidance_obj != nullptr) {
                 turn_on("obstacle_avoidance");
                 turn_on("obstacle_avoidance");
               }
               }
               break;
               break;
             }
             }
 
 
     case 9: {
     case 9: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_on("pursue");
                 turn_on("pursue");
                 _path_follow_obj->_start = true;
                 _path_follow_obj->_start = true;
               }
               }
               break;
               break;
             }
             }
     case 16: {
     case 16: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 _path_follow_obj->_start = false;
                 _path_follow_obj->_start = false;
               }
               }

+ 15 - 15
contrib/src/ai/aiBehaviors.h

@@ -28,8 +28,8 @@ class PathFollow;
 class PathFind;
 class PathFind;
 class ObstacleAvoidance;
 class ObstacleAvoidance;
 
 
-typedef list<Flee, allocator<Flee> > ListFlee;
-typedef list<Evade, allocator<Evade> > ListEvade;
+typedef std::list<Flee, std::allocator<Flee> > ListFlee;
+typedef std::list<Evade, std::allocator<Evade> > ListEvade;
 
 
 /**
 /**
  * This class implements all the steering behaviors of the AI framework, such
  * This class implements all the steering behaviors of the AI framework, such
@@ -113,21 +113,21 @@ public:
   ~AIBehaviors();
   ~AIBehaviors();
 
 
   bool is_on(_behavior_type bt);
   bool is_on(_behavior_type bt);
-  bool is_on(string ai_type); // special cases for pathfollow and pathfinding
+  bool is_on(std::string ai_type); // special cases for pathfollow and pathfinding
   bool is_off(_behavior_type bt);
   bool is_off(_behavior_type bt);
-  bool is_off(string ai_type); // special cases for pathfollow and pathfinding
-  void turn_on(string ai_type);
-  void turn_off(string ai_type);
+  bool is_off(std::string ai_type); // special cases for pathfollow and pathfinding
+  void turn_on(std::string ai_type);
+  void turn_off(std::string ai_type);
 
 
   bool is_conflict();
   bool is_conflict();
 
 
-  void accumulate_force(string force_type, LVecBase3 force);
+  void accumulate_force(std::string force_type, LVecBase3 force);
   LVecBase3 calculate_prioritized();
   LVecBase3 calculate_prioritized();
 
 
   void flock_activate();
   void flock_activate();
   LVecBase3 do_flock();
   LVecBase3 do_flock();
 
 
-  int char_to_int(string ai_type);
+  int char_to_int(std::string ai_type);
 
 
 PUBLISHED:
 PUBLISHED:
   void seek(NodePath target_object, float seek_wt = 1.0);
   void seek(NodePath target_object, float seek_wt = 1.0);
@@ -150,21 +150,21 @@ PUBLISHED:
 
 
   void path_follow(float follow_wt);
   void path_follow(float follow_wt);
   void add_to_path(LVecBase3 pos);
   void add_to_path(LVecBase3 pos);
-  void start_follow(string type = "normal");
+  void start_follow(std::string type = "normal");
 
 
   // should have different function names.
   // should have different function names.
   void init_path_find(const char* navmesh_filename);
   void init_path_find(const char* navmesh_filename);
-  void path_find_to(LVecBase3 pos, string type = "normal");
-  void path_find_to(NodePath target, string type = "normal");
+  void path_find_to(LVecBase3 pos, std::string type = "normal");
+  void path_find_to(NodePath target, std::string type = "normal");
   void add_static_obstacle(NodePath obstacle);
   void add_static_obstacle(NodePath obstacle);
   void add_dynamic_obstacle(NodePath obstacle);
   void add_dynamic_obstacle(NodePath obstacle);
 
 
 
 
-  void remove_ai(string ai_type);
-  void pause_ai(string ai_type);
-  void resume_ai(string ai_type);
+  void remove_ai(std::string ai_type);
+  void pause_ai(std::string ai_type);
+  void resume_ai(std::string ai_type);
 
 
-  string behavior_status(string ai_type);
+  std::string behavior_status(std::string ai_type);
 };
 };
 
 
 #endif
 #endif

+ 3 - 0
contrib/src/ai/aiCharacter.cxx

@@ -24,6 +24,8 @@ AICharacter::AICharacter(string model_name, NodePath model_np, double mass, doub
   _velocity = LVecBase3(0.0, 0.0, 0.0);
   _velocity = LVecBase3(0.0, 0.0, 0.0);
   _steering_force = LVecBase3(0.0, 0.0, 0.0);
   _steering_force = LVecBase3(0.0, 0.0, 0.0);
 
 
+  _world = nullptr;
+
   _steering = new AIBehaviors();
   _steering = new AIBehaviors();
   _steering->_ai_char = this;
   _steering->_ai_char = this;
 
 
@@ -31,6 +33,7 @@ AICharacter::AICharacter(string model_name, NodePath model_np, double mass, doub
 }
 }
 
 
 AICharacter::~AICharacter() {
 AICharacter::~AICharacter() {
+  nassertv(_world == nullptr);
 }
 }
 
 
 /**
 /**

+ 4 - 3
contrib/src/ai/aiCharacter.h

@@ -15,6 +15,7 @@
 #define _AICHARACTER_H
 #define _AICHARACTER_H
 
 
 #include "aiBehaviors.h"
 #include "aiBehaviors.h"
+#include "referenceCount.h"
 
 
 /**
 /**
  * This class is used for creating the AI characters.  It assigns both physics
  * This class is used for creating the AI characters.  It assigns both physics
@@ -25,13 +26,13 @@
 class AIBehaviors;
 class AIBehaviors;
 class AIWorld;
 class AIWorld;
 
 
-class EXPCL_PANDAAI AICharacter {
+class EXPCL_PANDAAI AICharacter : public ReferenceCount {
  public:
  public:
   double _mass;
   double _mass;
   double _max_force;
   double _max_force;
   LVecBase3 _velocity;
   LVecBase3 _velocity;
   LVecBase3 _steering_force;
   LVecBase3 _steering_force;
-  string _name;
+  std::string _name;
   double _movt_force;
   double _movt_force;
   unsigned int _ai_char_flock_id;
   unsigned int _ai_char_flock_id;
   AIWorld *_world;
   AIWorld *_world;
@@ -62,7 +63,7 @@ PUBLISHED:
     // This function is used to enable or disable the guides for path finding.
     // This function is used to enable or disable the guides for path finding.
     void set_pf_guide(bool pf_guide);
     void set_pf_guide(bool pf_guide);
 
 
-    explicit AICharacter(string model_name, NodePath model_np, double mass, double movt_force, double max_force);
+    explicit AICharacter(std::string model_name, NodePath model_np, double mass, double movt_force, double max_force);
     ~AICharacter();
     ~AICharacter();
 };
 };
 
 

+ 3 - 3
contrib/src/ai/aiNode.cxx

@@ -15,7 +15,7 @@
 
 
 AINode::AINode(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
 AINode::AINode(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
   for (int i = 0; i < 8; ++i) {
   for (int i = 0; i < 8; ++i) {
-    _neighbours[i] = NULL;
+    _neighbours[i] = nullptr;
   }
   }
 
 
   _position = pos;
   _position = pos;
@@ -29,8 +29,8 @@ AINode::AINode(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h)
   _score = 0;
   _score = 0;
   _cost = 0;
   _cost = 0;
   _heuristic = 0;
   _heuristic = 0;
-  _next = NULL;
-  _prv_node =  NULL;
+  _next = nullptr;
+  _prv_node =  nullptr;
 }
 }
 
 
 AINode::~AINode() {
 AINode::~AINode() {

+ 3 - 3
contrib/src/ai/aiPathFinder.cxx

@@ -87,7 +87,7 @@ void PathFinder::identify_neighbors(Node *parent_node) {
   // while adding new nodes to the open list heap.
   // while adding new nodes to the open list heap.
   remove_from_olist();
   remove_from_olist();
   for(int i = 0; i < 8; ++i) {
   for(int i = 0; i < 8; ++i) {
-    if(parent_node->_neighbours[i] != NULL) {
+    if(parent_node->_neighbours[i] != nullptr) {
       if(parent_node->_neighbours[i]->_status == parent_node->_neighbours[i]->neutral
       if(parent_node->_neighbours[i]->_status == parent_node->_neighbours[i]->neutral
         && parent_node->_neighbours[i]->_type == true) {
         && parent_node->_neighbours[i]->_type == true) {
         // Link the neighbor to the parent node.
         // Link the neighbor to the parent node.
@@ -340,10 +340,10 @@ Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size) {
 
 
   for(int i = 0; i < size; ++i) {
   for(int i = 0; i < size; ++i) {
     for(int j = 0; j < size; ++j) {
     for(int j = 0; j < size; ++j) {
-      if(nav_mesh[i][j] != NULL && nav_mesh[i][j]->contains(x, y)) {
+      if(nav_mesh[i][j] != nullptr && nav_mesh[i][j]->contains(x, y)) {
         return(nav_mesh[i][j]);
         return(nav_mesh[i][j]);
       }
       }
     }
     }
   }
   }
-  return NULL;
+  return nullptr;
 }
 }

+ 4 - 4
contrib/src/ai/aiPathFinder.h

@@ -18,8 +18,8 @@
 #include "cmath.h"
 #include "cmath.h"
 #include "lineSegs.h"
 #include "lineSegs.h"
 
 
-typedef vector<Node *> NodeArray;
-typedef vector<NodeArray> NavMesh;
+typedef std::vector<Node *> NodeArray;
+typedef std::vector<NodeArray> NavMesh;
 
 
 Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size);
 Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size);
 
 
@@ -32,8 +32,8 @@ class EXPCL_PANDAAI PathFinder {
 public:
 public:
   Node *_src_node;
   Node *_src_node;
   Node *_dest_node;
   Node *_dest_node;
-  vector<Node*> _open_list;
-  vector<Node*> _closed_list;
+  std::vector<Node*> _open_list;
+  std::vector<Node*> _closed_list;
 
 
   NavMesh _grid;
   NavMesh _grid;
 
 

+ 31 - 103
contrib/src/ai/aiWorld.cxx

@@ -14,44 +14,56 @@
 #include "aiWorld.h"
 #include "aiWorld.h"
 
 
 AIWorld::AIWorld(NodePath render) {
 AIWorld::AIWorld(NodePath render) {
-  _ai_char_pool = new AICharPool();
-  _render = render;
+  _render = move(render);
 }
 }
 
 
 AIWorld::~AIWorld() {
 AIWorld::~AIWorld() {
 }
 }
 
 
 void AIWorld::add_ai_char(AICharacter *ai_char) {
 void AIWorld::add_ai_char(AICharacter *ai_char) {
-  _ai_char_pool->append(ai_char);
+  _ai_char_pool.push_back(ai_char);
   ai_char->_window_render = _render;
   ai_char->_window_render = _render;
   ai_char->_world = this;
   ai_char->_world = this;
 }
 }
 
 
 void AIWorld::remove_ai_char(string name) {
 void AIWorld::remove_ai_char(string name) {
-  _ai_char_pool->del(name);
-  remove_ai_char_from_flock(name);
+  AICharPool::iterator it;
+  for (it = _ai_char_pool.begin(); it != _ai_char_pool.end(); ++it) {
+    AICharacter *ai_char = *it;
+    if (ai_char->_name == name) {
+      nassertv(ai_char->_world == this);
+      ai_char->_world = nullptr;
+      _ai_char_pool.erase(it);
+      break;
+    }
+  }
+
+  remove_ai_char_from_flock(move(name));
 }
 }
 
 
 void AIWorld::remove_ai_char_from_flock(string name) {
 void AIWorld::remove_ai_char_from_flock(string name) {
-  AICharPool::node *ai_pool;
-  ai_pool = _ai_char_pool->_head;
-  while((ai_pool) != NULL) {
-    for(unsigned int i = 0; i < _flock_pool.size(); ++i) {
-      if(ai_pool->_ai_char->_ai_char_flock_id == _flock_pool[i]->get_id()) {
-        for(unsigned int j = 0; j<_flock_pool[i]->_ai_char_list.size(); ++j) {
-          if(_flock_pool[i]->_ai_char_list[j]->_name == name) {
-            _flock_pool[i]->_ai_char_list.erase(_flock_pool[i]->_ai_char_list.begin() + j);
+  for (AICharacter *ai_char : _ai_char_pool) {
+    for (Flock *flock : _flock_pool) {
+      if (ai_char->_ai_char_flock_id == flock->get_id()) {
+        for (size_t j = 0; j < flock->_ai_char_list.size(); ++j) {
+          if (flock->_ai_char_list[j]->_name == name) {
+            flock->_ai_char_list.erase(flock->_ai_char_list.begin() + j);
             return;
             return;
           }
           }
         }
         }
       }
       }
     }
     }
-    ai_pool = ai_pool->_next;
   }
   }
 }
 }
 
 
+/**
+ * This function prints the names of the AI characters that have been added to
+ * the AIWorld.  Useful for debugging purposes.
+ */
 void AIWorld::print_list() {
 void AIWorld::print_list() {
-  _ai_char_pool->print_list();
+  for (AICharacter *ai_char : _ai_char_pool) {
+    cout << ai_char->_name << endl;
+  }
 }
 }
 
 
 /**
 /**
@@ -59,12 +71,8 @@ void AIWorld::print_list() {
  * characters which have been added to the AIWorld.
  * characters which have been added to the AIWorld.
  */
  */
 void AIWorld::update() {
 void AIWorld::update() {
-  AICharPool::node *ai_pool;
-  ai_pool = _ai_char_pool->_head;
-
-  while((ai_pool)!=NULL) {
-    ai_pool->_ai_char->update();
-    ai_pool = ai_pool->_next;
+  for (AICharacter *ai_char : _ai_char_pool) {
+    ai_char->update();
   }
   }
 }
 }
 
 
@@ -91,7 +99,7 @@ Flock AIWorld::get_flock(unsigned int flock_id) {
       return *_flock_pool[i];
       return *_flock_pool[i];
     }
     }
   }
   }
-  Flock *null_flock = NULL;
+  Flock *null_flock = nullptr;
   return *null_flock;
   return *null_flock;
 }
 }
 
 
@@ -104,7 +112,7 @@ void AIWorld::remove_flock(unsigned int flock_id) {
        for(unsigned int j = 0; j < _flock_pool[i]->_ai_char_list.size(); ++j) {
        for(unsigned int j = 0; j < _flock_pool[i]->_ai_char_list.size(); ++j) {
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock_activate");
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock_activate");
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock");
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock");
-         _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->_flock_group = NULL;
+         _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->_flock_group = nullptr;
        }
        }
        _flock_pool.erase(_flock_pool.begin() + i);
        _flock_pool.erase(_flock_pool.begin() + i);
        break;
        break;
@@ -142,86 +150,6 @@ void AIWorld::flock_on(unsigned int flock_id) {
   }
   }
 }
 }
 
 
-AICharPool::AICharPool() {
-  _head = NULL;
-}
-
-AICharPool::~AICharPool() {
-}
-
-void AICharPool::append(AICharacter *ai_ch) {
-  node *q;
-  node *t;
-
-  if(_head == NULL) {
-    q = new node();
-    q->_ai_char = ai_ch;
-    q->_next = NULL;
-    _head = q;
-  }
-  else {
-    q = _head;
-    while( q->_next != NULL) {
-      q = q->_next;
-    }
-
-    t = new node();
-    t->_ai_char = ai_ch;
-    t->_next = NULL;
-    q->_next = t;
-  }
-}
-
-void AICharPool::del(string name) {
-  node *q;
-  node *r;
-  q = _head;
-
-  if(_head==NULL) {
-    return;
-  }
-
-  // Only one node in the linked list
-  if(q->_next == NULL) {
-    if(q->_ai_char->_name == name) {
-      _head = NULL;
-      delete q;
-    }
-    return;
-  }
-
-  r = q;
-  while( q != NULL) {
-    if( q->_ai_char->_name == name) {
-      // Special case
-      if(q == _head) {
-        _head = q->_next;
-        delete q;
-        return;
-      }
-
-      r->_next = q->_next;
-      delete q;
-      return;
-    }
-    r = q;
-    q = q->_next;
-  }
-}
-
-/**
- * This function prints the ai characters in the AICharPool.  Used for
- * debugging purposes.
- */
-void AICharPool::print_list() {
-  node* q;
-  q = _head;
-  while(q != NULL) {
-    cout<<q->_ai_char->_name<<endl;
-    q = q->_next;
-  }
-}
-
 /**
 /**
  * This function adds the nodepath as an obstacle that is needed by the
  * This function adds the nodepath as an obstacle that is needed by the
  * obstacle avoidance behavior.
  * obstacle avoidance behavior.

+ 5 - 25
contrib/src/ai/aiWorld.h

@@ -21,27 +21,6 @@
 class AICharacter;
 class AICharacter;
 class Flock;
 class Flock;
 
 
-/**
- * This class implements a linked list of AI Characters allowing the user to
- * add and delete characters from the linked list.  This will be used in the
- * AIWorld class.
- */
-class EXPCL_PANDAAI AICharPool {
-    public:
-    struct node {
-      AICharacter * _ai_char;
-      node * _next;
-    } ;
-
-    node* _head;
-    AICharPool();
-    ~AICharPool();
-    void append(AICharacter *ai_ch);
-    void del(string name);
-        void print_list();
-};
-
-
 /**
 /**
  * A class that implements the virtual AI world which keeps track of the AI
  * A class that implements the virtual AI world which keeps track of the AI
  * characters active at any given time.  It contains a linked list of AI
  * characters active at any given time.  It contains a linked list of AI
@@ -51,20 +30,21 @@ class EXPCL_PANDAAI AICharPool {
  */
  */
 class EXPCL_PANDAAI AIWorld {
 class EXPCL_PANDAAI AIWorld {
   private:
   private:
-    AICharPool * _ai_char_pool;
+    typedef std::vector<PT(AICharacter)> AICharPool;
+    AICharPool _ai_char_pool;
     NodePath _render;
     NodePath _render;
   public:
   public:
-    vector<NodePath> _obstacles;
+    std::vector<NodePath> _obstacles;
     typedef std::vector<Flock*> FlockPool;
     typedef std::vector<Flock*> FlockPool;
     FlockPool _flock_pool;
     FlockPool _flock_pool;
-    void remove_ai_char_from_flock(string name);
+    void remove_ai_char_from_flock(std::string name);
 
 
 PUBLISHED:
 PUBLISHED:
     AIWorld(NodePath render);
     AIWorld(NodePath render);
     ~AIWorld();
     ~AIWorld();
 
 
     void add_ai_char(AICharacter *ai_ch);
     void add_ai_char(AICharacter *ai_ch);
-    void remove_ai_char(string name);
+    void remove_ai_char(std::string name);
 
 
     void add_flock(Flock *flock);
     void add_flock(Flock *flock);
     void flock_off(unsigned int flock_id);
     void flock_off(unsigned int flock_id);

+ 3 - 3
contrib/src/ai/arrival.cxx

@@ -48,7 +48,7 @@ LVecBase3 Arrival::do_arrival() {
     _ai_char->_steering->_steering_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_steering_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_arrival_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_arrival_force = LVecBase3(0.0, 0.0, 0.0);
 
 
-    if(_ai_char->_steering->_seek_obj != NULL) {
+    if(_ai_char->_steering->_seek_obj != nullptr) {
       _ai_char->_steering->turn_off("arrival");
       _ai_char->_steering->turn_off("arrival");
       _ai_char->_steering->turn_on("arrival_activate");
       _ai_char->_steering->turn_on("arrival_activate");
     }
     }
@@ -62,11 +62,11 @@ LVecBase3 Arrival::do_arrival() {
   double u = _ai_char->get_velocity().length();
   double u = _ai_char->get_velocity().length();
   LVecBase3 desired_force = ((u * u) / (2 * distance)) * _ai_char->get_mass();
   LVecBase3 desired_force = ((u * u) / (2 * distance)) * _ai_char->get_mass();
 
 
-  if(_ai_char->_steering->_seek_obj != NULL) {
+  if(_ai_char->_steering->_seek_obj != nullptr) {
     return(desired_force);
     return(desired_force);
   }
   }
 
 
-  if(_ai_char->_steering->_pursue_obj != NULL) {
+  if(_ai_char->_steering->_pursue_obj != nullptr) {
 
 
     if(distance > _arrival_distance) {
     if(distance > _arrival_distance) {
       _ai_char->_steering->turn_off("arrival");
       _ai_char->_steering->turn_off("arrival");

+ 1 - 1
contrib/src/ai/flock.h

@@ -40,7 +40,7 @@ public:
   unsigned int _alignment_wt;
   unsigned int _alignment_wt;
 
 
   // This vector will hold all the ai characters which belong to this flock.
   // This vector will hold all the ai characters which belong to this flock.
-  typedef std::vector<AICharacter*> AICharList;
+  typedef std::vector<PT(AICharacter)> AICharList;
   AICharList _ai_char_list;
   AICharList _ai_char_list;
 
 
 PUBLISHED:
 PUBLISHED:

+ 3 - 3
contrib/src/ai/meshNode.cxx

@@ -3,7 +3,7 @@
 
 
 Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
 Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
   for(int i = 0; i < 8; ++i) {
   for(int i = 0; i < 8; ++i) {
-    _neighbours[i] = NULL;
+    _neighbours[i] = nullptr;
   }
   }
 
 
   _position = pos;
   _position = pos;
@@ -17,8 +17,8 @@ Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
   _score = 0;
   _score = 0;
   _cost = 0;
   _cost = 0;
   _heuristic = 0;
   _heuristic = 0;
-  _next = NULL;
-  _prv_node =  NULL;
+  _next = nullptr;
+  _prv_node =  nullptr;
 }
 }
 
 
 Node::~Node() {
 Node::~Node() {

+ 0 - 1
contrib/src/ai/obstacleAvoidance.cxx

@@ -36,7 +36,6 @@ obstacle_detection() {
   double distance = 0x7fff ;
   double distance = 0x7fff ;
   double expanded_radius = 0;
   double expanded_radius = 0;
   LVecBase3 to_obstacle;
   LVecBase3 to_obstacle;
-  LVecBase3 prev_avoidance;
   for(unsigned int i = 0; i < _ai_char->_world->_obstacles.size(); ++i) {
   for(unsigned int i = 0; i < _ai_char->_world->_obstacles.size(); ++i) {
     PT(BoundingVolume) bounds = _ai_char->_world->_obstacles[i].get_bounds();
     PT(BoundingVolume) bounds = _ai_char->_world->_obstacles[i].get_bounds();
     CPT(BoundingSphere) bsphere = bounds->as_bounding_sphere();
     CPT(BoundingSphere) bsphere = bounds->as_bounding_sphere();

+ 18 - 18
contrib/src/ai/pathFind.cxx

@@ -23,7 +23,7 @@ PathFind::PathFind(AICharacter *ai_ch) {
   _pen->set_color(1.0, 0.0, 0.0);
   _pen->set_color(1.0, 0.0, 0.0);
   _pen->set_thickness(2.0);
   _pen->set_thickness(2.0);
 
 
-  _path_finder_obj = NULL;
+  _path_finder_obj = nullptr;
   _dynamic_avoid = false;
   _dynamic_avoid = false;
 }
 }
 
 
@@ -46,7 +46,7 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
   string fields[10];
   string fields[10];
 
 
   // Open data file for reading.
   // Open data file for reading.
-  ifstream nav_mesh_file (navmesh_filename);
+  std::ifstream nav_mesh_file (navmesh_filename);
 
 
   if(nav_mesh_file.is_open()) {
   if(nav_mesh_file.is_open()) {
     // Capture the grid size from the file.
     // Capture the grid size from the file.
@@ -56,9 +56,9 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
 
 
     // Initialize the stage mesh with NULL nodes.
     // Initialize the stage mesh with NULL nodes.
     for(int r = 0; r < _grid_size; ++r) {
     for(int r = 0; r < _grid_size; ++r) {
-      _nav_mesh.push_back(vector<Node*>());
+      _nav_mesh.push_back(std::vector<Node*>());
       for(int c = 0; c < _grid_size; ++c) {
       for(int c = 0; c < _grid_size; ++c) {
-        _nav_mesh[r].push_back(NULL);
+        _nav_mesh[r].push_back(nullptr);
       }
       }
     }
     }
 
 
@@ -111,7 +111,7 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
  * _nav_mesh.
  * _nav_mesh.
  */
  */
 void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
 void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
-  ifstream nav_mesh_file (navmesh_filename);
+  std::ifstream nav_mesh_file (navmesh_filename);
 
 
   // Stage variables.
   // Stage variables.
   int gd_x, gd_y, gd_xn, gd_yn;
   int gd_x, gd_y, gd_xn, gd_yn;
@@ -150,7 +150,7 @@ void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
           }
           }
           else if(fields_n[0] == "1" && fields_n[1] == "1") {
           else if(fields_n[0] == "1" && fields_n[1] == "1") {
             // NULL neighbor.
             // NULL neighbor.
-            _nav_mesh[gd_y][gd_x]->_neighbours[i] = NULL;
+            _nav_mesh[gd_y][gd_x]->_neighbours[i] = nullptr;
           }
           }
           else {
           else {
             cout<<"Warning: Corrupt data!"<<endl;
             cout<<"Warning: Corrupt data!"<<endl;
@@ -183,7 +183,7 @@ void PathFind::set_path_find(const char* navmesh_filename) {
 
 
   if(_path_finder_obj) {
   if(_path_finder_obj) {
     delete _path_finder_obj;
     delete _path_finder_obj;
-    _path_finder_obj = NULL;
+    _path_finder_obj = nullptr;
   }
   }
 
 
   _path_finder_obj = new PathFinder(_nav_mesh);
   _path_finder_obj = new PathFinder(_nav_mesh);
@@ -207,17 +207,17 @@ void PathFind::path_find(LVecBase3 pos, string type) {
 
 
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
 
 
-  if(src == NULL) {
+  if(src == nullptr) {
     cout<<"couldnt find source"<<endl;
     cout<<"couldnt find source"<<endl;
   }
   }
 
 
   Node* dst = find_in_mesh(_nav_mesh, pos, _grid_size);
   Node* dst = find_in_mesh(_nav_mesh, pos, _grid_size);
 
 
-  if(dst == NULL) {
+  if(dst == nullptr) {
     cout<<"couldnt find destination"<<endl;
     cout<<"couldnt find destination"<<endl;
   }
   }
 
 
-  if(src != NULL && dst != NULL) {
+  if(src != nullptr && dst != nullptr) {
     _path_finder_obj->find_path(src, dst);
     _path_finder_obj->find_path(src, dst);
     trace_path(src);
     trace_path(src);
   }
   }
@@ -248,22 +248,22 @@ void PathFind::path_find(NodePath target, string type) {
 
 
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
 
 
-  if(src == NULL) {
+  if(src == nullptr) {
     cout<<"couldnt find source"<<endl;
     cout<<"couldnt find source"<<endl;
   }
   }
 
 
   Node* dst = find_in_mesh(_nav_mesh, _prev_position, _grid_size);
   Node* dst = find_in_mesh(_nav_mesh, _prev_position, _grid_size);
 
 
-  if(dst == NULL) {
+  if(dst == nullptr) {
     cout<<"couldnt find destination"<<endl;
     cout<<"couldnt find destination"<<endl;
   }
   }
 
 
-  if(src != NULL && dst != NULL) {
+  if(src != nullptr && dst != nullptr) {
     _path_finder_obj->find_path(src, dst);
     _path_finder_obj->find_path(src, dst);
     trace_path(src);
     trace_path(src);
   }
   }
 
 
-  if(_ai_char->_steering->_path_follow_obj!=NULL) {
+  if(_ai_char->_steering->_path_follow_obj!=nullptr) {
     if(!_ai_char->_steering->_path_follow_obj->_start) {
     if(!_ai_char->_steering->_path_follow_obj->_start) {
       _ai_char->_steering->start_follow("pathfind");
       _ai_char->_steering->start_follow("pathfind");
     }
     }
@@ -277,12 +277,12 @@ void PathFind::clear_path() {
   // Initialize to zero
   // Initialize to zero
   for(int i = 0; i < _grid_size; ++i) {
   for(int i = 0; i < _grid_size; ++i) {
     for(int j = 0; j < _grid_size; ++j) {
     for(int j = 0; j < _grid_size; ++j) {
-      if(_nav_mesh[i][j] != NULL) {
+      if(_nav_mesh[i][j] != nullptr) {
         _nav_mesh[i][j]->_status = _nav_mesh[i][j]->neutral;
         _nav_mesh[i][j]->_status = _nav_mesh[i][j]->neutral;
         _nav_mesh[i][j]->_cost = 0;
         _nav_mesh[i][j]->_cost = 0;
         _nav_mesh[i][j]->_heuristic = 0;
         _nav_mesh[i][j]->_heuristic = 0;
         _nav_mesh[i][j]->_score = 0;
         _nav_mesh[i][j]->_score = 0;
-        _nav_mesh[i][j]->_prv_node = NULL;
+        _nav_mesh[i][j]->_prv_node = nullptr;
       }
       }
     }
     }
   }
   }
@@ -333,7 +333,7 @@ void PathFind::add_obstacle_to_mesh(NodePath obstacle) {
 
 
   Node* temp = find_in_mesh(_nav_mesh, obstacle.get_pos(), _grid_size);
   Node* temp = find_in_mesh(_nav_mesh, obstacle.get_pos(), _grid_size);
 
 
-  if(temp != NULL) {
+  if(temp != nullptr) {
     float left = temp->_position.get_x() - np_sphere->get_radius();
     float left = temp->_position.get_x() - np_sphere->get_radius();
     float right = temp->_position.get_x() + np_sphere->get_radius();
     float right = temp->_position.get_x() + np_sphere->get_radius();
     float top = temp->_position.get_y() + np_sphere->get_radius();
     float top = temp->_position.get_y() + np_sphere->get_radius();
@@ -341,7 +341,7 @@ void PathFind::add_obstacle_to_mesh(NodePath obstacle) {
 
 
     for(int i = 0; i < _grid_size; ++i) {
     for(int i = 0; i < _grid_size; ++i) {
         for(int j = 0; j < _grid_size; ++j) {
         for(int j = 0; j < _grid_size; ++j) {
-          if(_nav_mesh[i][j] != NULL && _nav_mesh[i][j]->_type == true) {
+          if(_nav_mesh[i][j] != nullptr && _nav_mesh[i][j]->_type == true) {
             if(_nav_mesh[i][j]->_position.get_x() >= left && _nav_mesh[i][j]->_position.get_x() <= right &&
             if(_nav_mesh[i][j]->_position.get_x() >= left && _nav_mesh[i][j]->_position.get_x() <= right &&
                _nav_mesh[i][j]->_position.get_y() >= down && _nav_mesh[i][j]->_position.get_y() <= top) {
                _nav_mesh[i][j]->_position.get_y() >= down && _nav_mesh[i][j]->_position.get_y() <= top) {
               _nav_mesh[i][j]->_type = false;
               _nav_mesh[i][j]->_type = false;

+ 4 - 4
contrib/src/ai/pathFind.h

@@ -40,9 +40,9 @@ public:
   LVecBase3 _prev_position;
   LVecBase3 _prev_position;
   PT(GeomNode) _parent;
   PT(GeomNode) _parent;
   LineSegs *_pen;
   LineSegs *_pen;
-  vector<int> _previous_obstacles;
+  std::vector<int> _previous_obstacles;
   bool _dynamic_avoid;
   bool _dynamic_avoid;
-  vector<NodePath> _dynamic_obstacle;
+  std::vector<NodePath> _dynamic_obstacle;
 
 
   PathFind(AICharacter *ai_ch);
   PathFind(AICharacter *ai_ch);
   ~PathFind();
   ~PathFind();
@@ -56,8 +56,8 @@ public:
   void clear_previous_obstacles();
   void clear_previous_obstacles();
 
 
   void set_path_find(const char* navmesh_filename);
   void set_path_find(const char* navmesh_filename);
-  void path_find(LVecBase3 pos, string type = "normal");
-  void path_find(NodePath target, string type = "normal");
+  void path_find(LVecBase3 pos, std::string type = "normal");
+  void path_find(NodePath target, std::string type = "normal");
   void add_obstacle_to_mesh(NodePath obstacle);
   void add_obstacle_to_mesh(NodePath obstacle);
   void dynamic_avoid(NodePath obstacle);
   void dynamic_avoid(NodePath obstacle);
 };
 };

+ 3 - 3
contrib/src/ai/pathFollow.h

@@ -13,18 +13,18 @@ class EXPCL_PANDAAI PathFollow {
 public:
 public:
   AICharacter *_ai_char;
   AICharacter *_ai_char;
   float _follow_weight;
   float _follow_weight;
-  vector<LVecBase3> _path;
+  std::vector<LVecBase3> _path;
   int _curr_path_waypoint;
   int _curr_path_waypoint;
   bool _start;
   bool _start;
   NodePath _dummy;
   NodePath _dummy;
-  string _type;
+  std::string _type;
   ClockObject *_myClock;
   ClockObject *_myClock;
   float _time;
   float _time;
 
 
   PathFollow(AICharacter *ai_ch, float follow_wt);
   PathFollow(AICharacter *ai_ch, float follow_wt);
   ~PathFollow();
   ~PathFollow();
   void add_to_path(LVecBase3 pos);
   void add_to_path(LVecBase3 pos);
-  void start(string type);
+  void start(std::string type);
   void do_follow();
   void do_follow();
   bool check_if_possible();
   bool check_if_possible();
 };
 };

+ 1 - 1
contrib/src/panda3dtoolsgui/build_exe.bat

@@ -74,7 +74,7 @@ inline float GPUCommand::convert_int_to_float(int v) const {
  */
  */
 inline void GPUCommand::push_float(float v) {
 inline void GPUCommand::push_float(float v) {
   if (_current_index >= GPU_COMMAND_ENTRIES) {
   if (_current_index >= GPU_COMMAND_ENTRIES) {
-    gpucommand_cat.error() << "Out of bounds! Exceeded command size of " << GPU_COMMAND_ENTRIES << endl;
+    gpucommand_cat.error() << "Out of bounds! Exceeded command size of " << GPU_COMMAND_ENTRIES << std::endl;
     return;
     return;
   }
   }
   _data[_current_index++] = v;
   _data[_current_index++] = v;

+ 1 - 1
contrib/src/rplight/gpuCommand.h

@@ -73,7 +73,7 @@ PUBLISHED:
   inline static bool get_uses_integer_packing();
   inline static bool get_uses_integer_packing();
 
 
   void write_to(const PTA_uchar &dest, size_t command_index);
   void write_to(const PTA_uchar &dest, size_t command_index);
-  void write(ostream &out) const;
+  void write(std::ostream &out) const;
 
 
 private:
 private:
 
 

+ 1 - 1
contrib/src/rplight/gpuCommandList.h

@@ -48,7 +48,7 @@ PUBLISHED:
   MAKE_PROPERTY(num_commands, get_num_commands);
   MAKE_PROPERTY(num_commands, get_num_commands);
 
 
 protected:
 protected:
-  queue<GPUCommand> _commands;
+  std::queue<GPUCommand> _commands;
 };
 };
 
 
 #endif // GPUCOMMANDLIST_H
 #endif // GPUCOMMANDLIST_H

+ 2 - 1
contrib/src/rplight/pointerSlotStorage.h

@@ -45,6 +45,7 @@ class PointerSlotStorage {};
 using std::tr1::array;
 using std::tr1::array;
 #else
 #else
 #include <array>
 #include <array>
+using std::array;
 #endif
 #endif
 
 
 /**
 /**
@@ -202,7 +203,7 @@ public:
     nassertv(slot >= 0 && slot < SIZE);
     nassertv(slot >= 0 && slot < SIZE);
     nassertv(_data[slot] == nullptr); // Slot already taken!
     nassertv(_data[slot] == nullptr); // Slot already taken!
     nassertv(ptr != nullptr); // nullptr passed as argument!
     nassertv(ptr != nullptr); // nullptr passed as argument!
-    _max_index = max(_max_index, (int)slot);
+    _max_index = std::max(_max_index, (int)slot);
     _data[slot] = ptr;
     _data[slot] = ptr;
     _num_entries++;
     _num_entries++;
   }
   }

+ 3 - 3
contrib/src/rplight/pssmCameraRig.h

@@ -96,9 +96,9 @@ protected:
   inline LPoint3 get_interpolated_point(CoordinateOrigin origin, float depth);
   inline LPoint3 get_interpolated_point(CoordinateOrigin origin, float depth);
   LVecBase3 get_snap_offset(const LMatrix4& mat, size_t resolution);
   LVecBase3 get_snap_offset(const LMatrix4& mat, size_t resolution);
 
 
-  vector<NodePath> _cam_nodes;
-  vector<Camera*> _cameras;
-  vector<LVecBase2> _max_film_sizes;
+  std::vector<NodePath> _cam_nodes;
+  std::vector<Camera*> _cameras;
+  std::vector<LVecBase2> _max_film_sizes;
 
 
   // Current near and far points
   // Current near and far points
   // Order: UL, UR, LL, LR (See CoordinateOrigin)
   // Order: UL, UR, LL, LR (See CoordinateOrigin)

+ 1 - 1
contrib/src/rplight/rpLight.I

@@ -278,7 +278,7 @@ inline RPLight::LightType RPLight::get_light_type() const {
  */
  */
 inline void RPLight::set_casts_shadows(bool flag) {
 inline void RPLight::set_casts_shadows(bool flag) {
   if (has_slot()) {
   if (has_slot()) {
-    cerr << "Light is already attached, can not call set_casts_shadows!" << endl;
+    std::cerr << "Light is already attached, can not call set_casts_shadows!" << std::endl;
     return;
     return;
   }
   }
   _casts_shadows = flag;
   _casts_shadows = flag;

+ 1 - 1
contrib/src/rplight/rpLight.h

@@ -122,7 +122,7 @@ protected:
   LightType _light_type;
   LightType _light_type;
   float _near_plane;
   float _near_plane;
 
 
-  vector<ShadowSource*> _shadow_sources;
+  std::vector<ShadowSource*> _shadow_sources;
 };
 };
 
 
 #include "rpLight.I"
 #include "rpLight.I"

+ 1 - 1
contrib/src/rplight/shadowAtlas.I

@@ -118,7 +118,7 @@ inline int ShadowAtlas::get_required_tiles(size_t resolution) const {
 
 
   if (resolution % _tile_size != 0) {
   if (resolution % _tile_size != 0) {
     shadowatlas_cat.error() << "Resolution " << resolution << " is not a multiple "
     shadowatlas_cat.error() << "Resolution " << resolution << " is not a multiple "
-                << "of the shadow atlas tile size (" << _tile_size << ")!" << endl;
+                << "of the shadow atlas tile size (" << _tile_size << ")!" << std::endl;
     return 1;
     return 1;
   }
   }
   return resolution / _tile_size;
   return resolution / _tile_size;

+ 2 - 2
contrib/src/rplight/shadowManager.I

@@ -52,7 +52,7 @@ inline void ShadowManager::set_max_updates(size_t max_updates) {
   nassertv(max_updates >= 0);
   nassertv(max_updates >= 0);
   nassertv(_atlas == nullptr);  // ShadowManager was already initialized
   nassertv(_atlas == nullptr);  // ShadowManager was already initialized
   if (max_updates == 0) {
   if (max_updates == 0) {
-    shadowmanager_cat.warning() << "max_updates set to 0, no shadows will be updated." << endl;
+    shadowmanager_cat.warning() << "max_updates set to 0, no shadows will be updated." << std::endl;
   }
   }
   _max_updates = max_updates;
   _max_updates = max_updates;
 }
 }
@@ -170,7 +170,7 @@ inline bool ShadowManager::add_update(const ShadowSource* source) {
 
 
   if (_queued_updates.size() >= _max_updates) {
   if (_queued_updates.size() >= _max_updates) {
     if (shadowmanager_cat.is_debug()) {
     if (shadowmanager_cat.is_debug()) {
-      shadowmanager_cat.debug() << "cannot update source, out of update slots" << endl;
+      shadowmanager_cat.debug() << "cannot update source, out of update slots" << std::endl;
     }
     }
     return false;
     return false;
   }
   }

+ 5 - 5
contrib/src/rplight/tagStateManager.I

@@ -35,7 +35,7 @@
  * @param source Camera which will be used to render shadows
  * @param source Camera which will be used to render shadows
  */
  */
 inline void TagStateManager::
 inline void TagStateManager::
-register_camera(const string& name, Camera* source) {
+register_camera(const std::string& name, Camera* source) {
   ContainerList::iterator entry = _containers.find(name);
   ContainerList::iterator entry = _containers.find(name);
   nassertv(entry != _containers.end());
   nassertv(entry != _containers.end());
   register_camera(entry->second, source);
   register_camera(entry->second, source);
@@ -49,7 +49,7 @@ register_camera(const string& name, Camera* source) {
  * @param source Camera to unregister
  * @param source Camera to unregister
  */
  */
 inline void TagStateManager::
 inline void TagStateManager::
-unregister_camera(const string& name, Camera* source) {
+unregister_camera(const std::string& name, Camera* source) {
   ContainerList::iterator entry = _containers.find(name);
   ContainerList::iterator entry = _containers.find(name);
   nassertv(entry != _containers.end());
   nassertv(entry != _containers.end());
   unregister_camera(entry->second, source);
   unregister_camera(entry->second, source);
@@ -67,8 +67,8 @@ unregister_camera(const string& name, Camera* source) {
  * @param sort Determines the sort with which the shader will be applied.
  * @param sort Determines the sort with which the shader will be applied.
  */
  */
 inline void TagStateManager::
 inline void TagStateManager::
-apply_state(const string& state, NodePath np, Shader* shader,
-            const string &name, int sort) {
+apply_state(const std::string& state, NodePath np, Shader* shader,
+            const std::string &name, int sort) {
   ContainerList::iterator entry = _containers.find(state);
   ContainerList::iterator entry = _containers.find(state);
   nassertv(entry != _containers.end());
   nassertv(entry != _containers.end());
   apply_state(entry->second, np, shader, name, sort);
   apply_state(entry->second, np, shader, name, sort);
@@ -83,7 +83,7 @@ apply_state(const string& state, NodePath np, Shader* shader,
  * @return Bit mask of the render pass
  * @return Bit mask of the render pass
  */
  */
 inline BitMask32 TagStateManager::
 inline BitMask32 TagStateManager::
-get_mask(const string &container_name) {
+get_mask(const std::string &container_name) {
   if (container_name == "gbuffer") {
   if (container_name == "gbuffer") {
     return BitMask32::bit(1);
     return BitMask32::bit(1);
   }
   }

+ 10 - 10
contrib/src/rplight/tagStateManager.h

@@ -52,36 +52,36 @@ PUBLISHED:
   TagStateManager(NodePath main_cam_node);
   TagStateManager(NodePath main_cam_node);
   ~TagStateManager();
   ~TagStateManager();
 
 
-  inline void apply_state(const string& state, NodePath np, Shader* shader, const string &name, int sort);
+  inline void apply_state(const std::string& state, NodePath np, Shader* shader, const std::string &name, int sort);
   void cleanup_states();
   void cleanup_states();
 
 
-  inline void register_camera(const string& state, Camera* source);
-  inline void unregister_camera(const string& state, Camera* source);
-  inline BitMask32 get_mask(const string &container_name);
+  inline void register_camera(const std::string& state, Camera* source);
+  inline void unregister_camera(const std::string& state, Camera* source);
+  inline BitMask32 get_mask(const std::string &container_name);
 
 
 private:
 private:
-  typedef vector<Camera*> CameraList;
-  typedef pmap<string, CPT(RenderState)> TagStateList;
+  typedef std::vector<Camera*> CameraList;
+  typedef pmap<std::string, CPT(RenderState)> TagStateList;
 
 
   struct StateContainer {
   struct StateContainer {
     CameraList cameras;
     CameraList cameras;
     TagStateList tag_states;
     TagStateList tag_states;
-    string tag_name;
+    std::string tag_name;
     BitMask32 mask;
     BitMask32 mask;
     bool write_color;
     bool write_color;
 
 
     StateContainer() {};
     StateContainer() {};
-    StateContainer(const string &tag_name, size_t mask, bool write_color)
+    StateContainer(const std::string &tag_name, size_t mask, bool write_color)
       : tag_name(tag_name), mask(BitMask32::bit(mask)), write_color(write_color) {};
       : tag_name(tag_name), mask(BitMask32::bit(mask)), write_color(write_color) {};
   };
   };
 
 
   void apply_state(StateContainer& container, NodePath np, Shader* shader,
   void apply_state(StateContainer& container, NodePath np, Shader* shader,
-                   const string& name, int sort);
+                   const std::string& name, int sort);
   void cleanup_container_states(StateContainer& container);
   void cleanup_container_states(StateContainer& container);
   void register_camera(StateContainer &container, Camera* source);
   void register_camera(StateContainer &container, Camera* source);
   void unregister_camera(StateContainer &container, Camera* source);
   void unregister_camera(StateContainer &container, Camera* source);
 
 
-  typedef pmap<string, StateContainer> ContainerList;
+  typedef pmap<std::string, StateContainer> ContainerList;
   ContainerList _containers;
   ContainerList _containers;
 
 
   NodePath _main_cam_node;
   NodePath _main_cam_node;

+ 4 - 4
contrib/src/sceneeditor/seFileSaver.py

@@ -488,7 +488,7 @@ class FileSaver:
                      out_file.write (i2+ "alight = AmbientLight(\'"+ light.getName() +"\')\n")
                      out_file.write (i2+ "alight = AmbientLight(\'"+ light.getName() +"\')\n")
                      out_file.write (i2+ "alight.setColor(VBase4("+ str(light.getLightColor().getX())+ "," + str(light.getLightColor().getY())+ "," + str(light.getLightColor().getZ()) + "," + str(light.getLightColor().getW()) + "))\n")
                      out_file.write (i2+ "alight.setColor(VBase4("+ str(light.getLightColor().getX())+ "," + str(light.getLightColor().getY())+ "," + str(light.getLightColor().getZ()) + "," + str(light.getLightColor().getW()) + "))\n")
                      out_file.write (i2+ "self.lightAttrib=self.lightAttrib.addLight(alight)\n")
                      out_file.write (i2+ "self.lightAttrib=self.lightAttrib.addLight(alight)\n")
-                     out_file.write (i2+ "self."+light.getName()+"= render.attachNewNode(alight.upcastToPandaNode())\n")
+                     out_file.write (i2+ "self."+light.getName()+"= render.attachNewNode(alight)\n")
                      out_file.write (i2+ "self."+light.getName()+".setTag(\"Metadata\",\"" + light.getTag("Metadata") + "\")\n")
                      out_file.write (i2+ "self."+light.getName()+".setTag(\"Metadata\",\"" + light.getTag("Metadata") + "\")\n")
                      out_file.write (i2+ "self.LightDict[\'" + light.getName() + "\']=alight\n")
                      out_file.write (i2+ "self.LightDict[\'" + light.getName() + "\']=alight\n")
                      out_file.write (i2+ "self.LightTypes[\'" + light.getName() + "\']=\'" + type + "\'\n")
                      out_file.write (i2+ "self.LightTypes[\'" + light.getName() + "\']=\'" + type + "\'\n")
@@ -503,7 +503,7 @@ class FileSaver:
                      #out_file.write (i2+ "alight.setPoint(Point3(" + str(light.getX()) + "," + str(light.getY()) + "," + str(light.getZ()) + "))\n")
                      #out_file.write (i2+ "alight.setPoint(Point3(" + str(light.getX()) + "," + str(light.getY()) + "," + str(light.getZ()) + "))\n")
                      out_file.write (i2+ "alight.setSpecularColor(Vec4(" + str(light.getSpecColor().getX()) + "," + str(light.getSpecColor().getY()) + "," + str(light.getSpecColor().getZ()) + "," + str(light.getSpecColor().getW()) + "))\n")
                      out_file.write (i2+ "alight.setSpecularColor(Vec4(" + str(light.getSpecColor().getX()) + "," + str(light.getSpecColor().getY()) + "," + str(light.getSpecColor().getZ()) + "," + str(light.getSpecColor().getW()) + "))\n")
                      out_file.write (i2+ "self.lightAttrib=self.lightAttrib.addLight(alight)\n")
                      out_file.write (i2+ "self.lightAttrib=self.lightAttrib.addLight(alight)\n")
-                     out_file.write (i2+ "self."+light.getName()+ "= render.attachNewNode(alight.upcastToPandaNode())\n")
+                     out_file.write (i2+ "self."+light.getName()+ "= render.attachNewNode(alight)\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setPos(Point3(" + str(light.getX()) + "," + str(light.getY()) + "," + str(light.getZ()) + "))\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setPos(Point3(" + str(light.getX()) + "," + str(light.getY()) + "," + str(light.getZ()) + "))\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setHpr(Vec3("+ str(light.getH())+ "," + str(light.getP())+ "," + str(light.getR()) + "))\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setHpr(Vec3("+ str(light.getH())+ "," + str(light.getP())+ "," + str(light.getR()) + "))\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setTag(\"Metadata\",\"" + light.getTag("Metadata") + "\")\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setTag(\"Metadata\",\"" + light.getTag("Metadata") + "\")\n")
@@ -521,7 +521,7 @@ class FileSaver:
                      out_file.write (i2+ "alight.setSpecularColor(Vec4(" + str(light.getSpecColor().getX()) + "," + str(light.getSpecColor().getY()) + "," + str(light.getSpecColor().getZ()) + "," + str(light.getSpecColor().getW()) + "))\n")
                      out_file.write (i2+ "alight.setSpecularColor(Vec4(" + str(light.getSpecColor().getX()) + "," + str(light.getSpecColor().getY()) + "," + str(light.getSpecColor().getZ()) + "," + str(light.getSpecColor().getW()) + "))\n")
                      out_file.write (i2+ "alight.setAttenuation(Vec3("+ str(light.getAttenuation().getX()) + "," + str(light.getAttenuation().getY()) + "," + str(light.getAttenuation().getZ()) + "))\n")
                      out_file.write (i2+ "alight.setAttenuation(Vec3("+ str(light.getAttenuation().getX()) + "," + str(light.getAttenuation().getY()) + "," + str(light.getAttenuation().getZ()) + "))\n")
                      out_file.write (i2+ "self.lightAttrib=self.lightAttrib.addLight(alight)\n")
                      out_file.write (i2+ "self.lightAttrib=self.lightAttrib.addLight(alight)\n")
-                     out_file.write (i2+ "self."+light.getName()+ "= render.attachNewNode(alight.upcastToPandaNode())\n")
+                     out_file.write (i2+ "self."+light.getName()+ "= render.attachNewNode(alight)\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setTag(\"Metadata\",\"" + light.getTag("Metadata") + "\")\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setTag(\"Metadata\",\"" + light.getTag("Metadata") + "\")\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setPos(Point3(" + str(light.getX()) + "," + str(light.getY()) + "," + str(light.getZ()) + "))\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setPos(Point3(" + str(light.getX()) + "," + str(light.getY()) + "," + str(light.getZ()) + "))\n")
                      out_file.write (i2+ "self.LightDict[\'" + light.getName() + "\']=alight\n")
                      out_file.write (i2+ "self.LightDict[\'" + light.getName() + "\']=alight\n")
@@ -539,7 +539,7 @@ class FileSaver:
                      out_file.write (i2+ "alight.setAttenuation(Vec3("+ str(light.getAttenuation().getX()) + "," + str(light.getAttenuation().getY()) + "," + str(light.getAttenuation().getZ()) + "))\n")
                      out_file.write (i2+ "alight.setAttenuation(Vec3("+ str(light.getAttenuation().getX()) + "," + str(light.getAttenuation().getY()) + "," + str(light.getAttenuation().getZ()) + "))\n")
                      out_file.write (i2+ "alight.setExponent(" +str(light.getExponent()) +")\n")
                      out_file.write (i2+ "alight.setExponent(" +str(light.getExponent()) +")\n")
                      out_file.write (i2+ "self.lightAttrib=self.lightAttrib.addLight(alight)\n")
                      out_file.write (i2+ "self.lightAttrib=self.lightAttrib.addLight(alight)\n")
-                     out_file.write (i2+ "self."+light.getName()+ "= render.attachNewNode(alight.upcastToLensNode())\n")
+                     out_file.write (i2+ "self."+light.getName()+ "= render.attachNewNode(alight)\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setTag(\"Metadata\",\"" + light.getTag("Metadata") + "\")\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setTag(\"Metadata\",\"" + light.getTag("Metadata") + "\")\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setPos(Point3(" + str(light.getX()) + "," + str(light.getY()) + "," + str(light.getZ()) + "))\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setPos(Point3(" + str(light.getX()) + "," + str(light.getY()) + "," + str(light.getZ()) + "))\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setHpr(Vec3("+ str(light.getH())+ "," + str(light.getP())+ "," + str(light.getR()) + "))\n")
                      out_file.write (i2+ "self."+light.getName()+ ".setHpr(Vec3("+ str(light.getH())+ "," + str(light.getP())+ "," + str(light.getR()) + "))\n")

+ 1 - 8
contrib/src/sceneeditor/seLights.py

@@ -63,13 +63,8 @@ class seLight(NodePath):
         self.lence = lence
         self.lence = lence
         self.active = True
         self.active = True
 
 
-        if isinstance(light, Spotlight):
-            node = light.upcastToLensNode()
-        else:
-            node = light.upcastToPandaNode()
-
         # Attach node to self
         # Attach node to self
-        self.LightNode=parent.attachNewNode(node)
+        self.LightNode=parent.attachNewNode(light)
         self.LightNode.setTag("Metadata",tag)
         self.LightNode.setTag("Metadata",tag)
         if(self.type=='spot'):
         if(self.type=='spot'):
             self.LightNode.setHpr(self.orientation)
             self.LightNode.setHpr(self.orientation)
@@ -418,8 +413,6 @@ class seLightManager(NodePath):
         #################################################################
         #################################################################
         type = lower(light.getType().getName())
         type = lower(light.getType().getName())
 
 
-        light.upcastToNamable()
-
         specularColor = VBase4(1)
         specularColor = VBase4(1)
         position = Point3(0,0,0)
         position = Point3(0,0,0)
         orientation = Vec3(1,0,0)
         orientation = Vec3(1,0,0)

+ 2 - 2
direct/src/dcparse/dcparse.cxx

@@ -103,8 +103,8 @@ write_complete_field_list(const DCFile &file) {
         cout << field->get_class()->get_name() << "::";
         cout << field->get_class()->get_name() << "::";
       }
       }
       cout << field->get_name();
       cout << field->get_name();
-      if (field->as_atomic_field() != (DCAtomicField *)NULL ||
-          field->as_molecular_field() != (DCMolecularField *)NULL) {
+      if (field->as_atomic_field() != nullptr ||
+          field->as_molecular_field() != nullptr) {
         // It's a "method".
         // It's a "method".
         cout << "()";
         cout << "()";
       }
       }

+ 5 - 5
direct/src/dcparser/dcArrayParameter.cxx

@@ -58,7 +58,7 @@ DCArrayParameter(DCParameter *element_type, const DCUnsignedIntRange &size) :
   _pack_type = PT_array;
   _pack_type = PT_array;
 
 
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
-  if (simple_type != (DCSimpleParameter *)NULL) {
+  if (simple_type != nullptr) {
     if (simple_type->get_type() == ST_char) {
     if (simple_type->get_type() == ST_char) {
       // We make a special case for char[] arrays: these we format as a
       // We make a special case for char[] arrays: these we format as a
       // string.  (It will still accept an array of ints packed into it.)  We
       // string.  (It will still accept an array of ints packed into it.)  We
@@ -148,7 +148,7 @@ get_array_size() const {
  */
  */
 DCParameter *DCArrayParameter::
 DCParameter *DCArrayParameter::
 append_array_specification(const DCUnsignedIntRange &size) {
 append_array_specification(const DCUnsignedIntRange &size) {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     // If this was a typedef, wrap it directly.
     // If this was a typedef, wrap it directly.
     return new DCArrayParameter(this, size);
     return new DCArrayParameter(this, size);
   }
   }
@@ -203,7 +203,7 @@ validate_num_nested_fields(int num_nested_fields) const {
 void DCArrayParameter::
 void DCArrayParameter::
 output_instance(ostream &out, bool brief, const string &prename,
 output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
                 const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {
@@ -236,7 +236,7 @@ pack_string(DCPackData &pack_data, const string &value,
             bool &pack_error, bool &range_error) const {
             bool &pack_error, bool &range_error) const {
   // We can only pack a string if the array element type is char or int8.
   // We can only pack a string if the array element type is char or int8.
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
-  if (simple_type == (DCSimpleParameter *)NULL) {
+  if (simple_type == nullptr) {
     pack_error = true;
     pack_error = true;
     return;
     return;
   }
   }
@@ -306,7 +306,7 @@ unpack_string(const char *data, size_t length, size_t &p, string &value,
               bool &pack_error, bool &range_error) const {
               bool &pack_error, bool &range_error) const {
   // We can only unpack a string if the array element type is char or int8.
   // We can only unpack a string if the array element type is char or int8.
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
-  if (simple_type == (DCSimpleParameter *)NULL) {
+  if (simple_type == nullptr) {
     pack_error = true;
     pack_error = true;
     return;
     return;
   }
   }

+ 4 - 4
direct/src/dcparser/dcArrayParameter.h

@@ -46,14 +46,14 @@ public:
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual bool validate_num_nested_fields(int num_nested_fields) const;
   virtual bool validate_num_nested_fields(int num_nested_fields) const;
 
 
-  virtual void output_instance(ostream &out, bool brief, const string &prename,
-                               const string &name, const string &postname) const;
+  virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                               const std::string &name, const std::string &postname) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
-  virtual void pack_string(DCPackData &pack_data, const string &value,
+  virtual void pack_string(DCPackData &pack_data, const std::string &value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual void unpack_string(const char *data, size_t length, size_t &p,
   virtual void unpack_string(const char *data, size_t length, size_t &p,
-                             string &value, bool &pack_error, bool &range_error) const;
+                             std::string &value, bool &pack_error, bool &range_error) const;
 
 
 protected:
 protected:
   virtual bool do_check_match(const DCPackerInterface *other) const;
   virtual bool do_check_match(const DCPackerInterface *other) const;

+ 4 - 4
direct/src/dcparser/dcAtomicField.cxx

@@ -73,7 +73,7 @@ get_num_elements() const {
  */
  */
 DCParameter *DCAtomicField::
 DCParameter *DCAtomicField::
 get_element(int n) const {
 get_element(int n) const {
-  nassertr(n >= 0 && n < (int)_elements.size(), NULL);
+  nassertr(n >= 0 && n < (int)_elements.size(), nullptr);
   return _elements[n];
   return _elements[n];
 }
 }
 
 
@@ -127,7 +127,7 @@ DCSubatomicType DCAtomicField::
 get_element_type(int n) const {
 get_element_type(int n) const {
   nassertr(n >= 0 && n < (int)_elements.size(), ST_invalid);
   nassertr(n >= 0 && n < (int)_elements.size(), ST_invalid);
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
-  nassertr(simple_parameter != (DCSimpleParameter *)NULL, ST_invalid);
+  nassertr(simple_parameter != nullptr, ST_invalid);
   return simple_parameter->get_type();
   return simple_parameter->get_type();
 }
 }
 
 
@@ -143,7 +143,7 @@ int DCAtomicField::
 get_element_divisor(int n) const {
 get_element_divisor(int n) const {
   nassertr(n >= 0 && n < (int)_elements.size(), 1);
   nassertr(n >= 0 && n < (int)_elements.size(), 1);
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
-  nassertr(simple_parameter != (DCSimpleParameter *)NULL, 1);
+  nassertr(simple_parameter != nullptr, 1);
   return simple_parameter->get_divisor();
   return simple_parameter->get_divisor();
 }
 }
 
 
@@ -207,7 +207,7 @@ generate_hash(HashGenerator &hashgen) const {
  */
  */
 DCPackerInterface *DCAtomicField::
 DCPackerInterface *DCAtomicField::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_elements.size(), NULL);
+  nassertr(n >= 0 && n < (int)_elements.size(), nullptr);
   return _elements[n];
   return _elements[n];
 }
 }
 
 

+ 6 - 6
direct/src/dcparser/dcAtomicField.h

@@ -29,7 +29,7 @@
  */
  */
 class DCAtomicField : public DCField {
 class DCAtomicField : public DCField {
 public:
 public:
-  DCAtomicField(const string &name, DCClass *dclass, bool bogus_field);
+  DCAtomicField(const std::string &name, DCClass *dclass, bool bogus_field);
   virtual ~DCAtomicField();
   virtual ~DCAtomicField();
 
 
 PUBLISHED:
 PUBLISHED:
@@ -40,17 +40,17 @@ PUBLISHED:
   DCParameter *get_element(int n) const;
   DCParameter *get_element(int n) const;
 
 
   // These five methods are deprecated and will be removed soon.
   // These five methods are deprecated and will be removed soon.
-  string get_element_default(int n) const;
+  std::string get_element_default(int n) const;
   bool has_element_default(int n) const;
   bool has_element_default(int n) const;
-  string get_element_name(int n) const;
+  std::string get_element_name(int n) const;
   DCSubatomicType get_element_type(int n) const;
   DCSubatomicType get_element_type(int n) const;
   int get_element_divisor(int n) const;
   int get_element_divisor(int n) const;
 
 
 public:
 public:
   void add_element(DCParameter *element);
   void add_element(DCParameter *element);
 
 
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
 
 
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual DCPackerInterface *get_nested_field(int n) const;
@@ -60,7 +60,7 @@ protected:
   virtual bool do_check_match_atomic_field(const DCAtomicField *other) const;
   virtual bool do_check_match_atomic_field(const DCAtomicField *other) const;
 
 
 private:
 private:
-  void output_element(ostream &out, bool brief, DCParameter *element) const;
+  void output_element(std::ostream &out, bool brief, DCParameter *element) const;
 
 
   typedef pvector<DCParameter *> Elements;
   typedef pvector<DCParameter *> Elements;
   Elements _elements;
   Elements _elements;

+ 1 - 1
direct/src/dcparser/dcClass.I

@@ -22,7 +22,7 @@ get_dc_file() const {
 /**
 /**
  * Returns the name of this class.
  * Returns the name of this class.
  */
  */
-INLINE const string &DCClass::
+INLINE const std::string &DCClass::
 get_name() const {
 get_name() const {
   return _name;
   return _name;
 }
 }

+ 50 - 129
direct/src/dcparser/dcClass.cxx

@@ -80,11 +80,11 @@ DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) :
   _bogus_class(bogus_class)
   _bogus_class(bogus_class)
 {
 {
   _number = -1;
   _number = -1;
-  _constructor = NULL;
+  _constructor = nullptr;
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
-  _class_def = NULL;
-  _owner_class_def = NULL;
+  _class_def = nullptr;
+  _owner_class_def = nullptr;
 #endif
 #endif
 }
 }
 
 
@@ -93,7 +93,7 @@ DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) :
  */
  */
 DCClass::
 DCClass::
 ~DCClass() {
 ~DCClass() {
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     delete _constructor;
     delete _constructor;
   }
   }
 
 
@@ -137,7 +137,7 @@ get_num_parents() const {
  */
  */
 DCClass *DCClass::
 DCClass *DCClass::
 get_parent(int n) const {
 get_parent(int n) const {
-  nassertr(n >= 0 && n < (int)_parents.size(), NULL);
+  nassertr(n >= 0 && n < (int)_parents.size(), nullptr);
   return _parents[n];
   return _parents[n];
 }
 }
 
 
@@ -147,7 +147,7 @@ get_parent(int n) const {
  */
  */
 bool DCClass::
 bool DCClass::
 has_constructor() const {
 has_constructor() const {
-  return (_constructor != (DCField *)NULL);
+  return (_constructor != nullptr);
 }
 }
 
 
 /**
 /**
@@ -183,7 +183,7 @@ get_field(int n) const {
     // __asm { int 3 }
     // __asm { int 3 }
   }
   }
   #endif //]
   #endif //]
-  nassertr_always(n >= 0 && n < (int)_fields.size(), NULL);
+  nassertr_always(n >= 0 && n < (int)_fields.size(), nullptr);
   return _fields[n];
   return _fields[n];
 }
 }
 
 
@@ -205,13 +205,13 @@ get_field_by_name(const string &name) const {
   Parents::const_iterator pi;
   Parents::const_iterator pi;
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
     DCField *result = (*pi)->get_field_by_name(name);
     DCField *result = (*pi)->get_field_by_name(name);
-    if (result != (DCField *)NULL) {
+    if (result != nullptr) {
       return result;
       return result;
     }
     }
   }
   }
 
 
   // Nobody knew what this field is.
   // Nobody knew what this field is.
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -232,7 +232,7 @@ get_field_by_index(int index_number) const {
   Parents::const_iterator pi;
   Parents::const_iterator pi;
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
     DCField *result = (*pi)->get_field_by_index(index_number);
     DCField *result = (*pi)->get_field_by_index(index_number);
-    if (result != (DCField *)NULL) {
+    if (result != nullptr) {
       // Cache this result for future lookups.
       // Cache this result for future lookups.
       ((DCClass *)this)->_fields_by_index[index_number] = result;
       ((DCClass *)this)->_fields_by_index[index_number] = result;
       return result;
       return result;
@@ -240,7 +240,7 @@ get_field_by_index(int index_number) const {
   }
   }
 
 
   // Nobody knew what this field is.
   // Nobody knew what this field is.
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -250,7 +250,7 @@ get_field_by_index(int index_number) const {
 int DCClass::
 int DCClass::
 get_num_inherited_fields() const {
 get_num_inherited_fields() const {
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
-      _dc_file != (DCFile *)NULL) {
+      _dc_file != nullptr) {
     _dc_file->check_inherited_fields();
     _dc_file->check_inherited_fields();
     if (_inherited_fields.empty()) {
     if (_inherited_fields.empty()) {
       ((DCClass *)this)->rebuild_inherited_fields();
       ((DCClass *)this)->rebuild_inherited_fields();
@@ -283,12 +283,12 @@ get_num_inherited_fields() const {
 DCField *DCClass::
 DCField *DCClass::
 get_inherited_field(int n) const {
 get_inherited_field(int n) const {
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
-      _dc_file != (DCFile *)NULL) {
+      _dc_file != nullptr) {
     _dc_file->check_inherited_fields();
     _dc_file->check_inherited_fields();
     if (_inherited_fields.empty()) {
     if (_inherited_fields.empty()) {
       ((DCClass *)this)->rebuild_inherited_fields();
       ((DCClass *)this)->rebuild_inherited_fields();
     }
     }
-    nassertr(n >= 0 && n < (int)_inherited_fields.size(), NULL);
+    nassertr(n >= 0 && n < (int)_inherited_fields.size(), nullptr);
     return _inherited_fields[n];
     return _inherited_fields[n];
 
 
   } else {
   } else {
@@ -349,7 +349,7 @@ output(ostream &out) const {
  */
  */
 bool DCClass::
 bool DCClass::
 has_class_def() const {
 has_class_def() const {
-  return (_class_def != NULL);
+  return (_class_def != nullptr);
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -373,7 +373,7 @@ set_class_def(PyObject *class_def) {
  */
  */
 PyObject *DCClass::
 PyObject *DCClass::
 get_class_def() const {
 get_class_def() const {
-  if (_class_def == NULL) {
+  if (_class_def == nullptr) {
     Py_INCREF(Py_None);
     Py_INCREF(Py_None);
     return Py_None;
     return Py_None;
   }
   }
@@ -390,7 +390,7 @@ get_class_def() const {
  */
  */
 bool DCClass::
 bool DCClass::
 has_owner_class_def() const {
 has_owner_class_def() const {
-  return (_owner_class_def != NULL);
+  return (_owner_class_def != nullptr);
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -414,7 +414,7 @@ set_owner_class_def(PyObject *owner_class_def) {
  */
  */
 PyObject *DCClass::
 PyObject *DCClass::
 get_owner_class_def() const {
 get_owner_class_def() const {
-  if (_owner_class_def == NULL) {
+  if (_owner_class_def == nullptr) {
     Py_INCREF(Py_None);
     Py_INCREF(Py_None);
     return Py_None;
     return Py_None;
   }
   }
@@ -441,7 +441,7 @@ receive_update(PyObject *distobj, DatagramIterator &di) const {
 
 
     int field_id = packer.raw_unpack_uint16();
     int field_id = packer.raw_unpack_uint16();
     DCField *field = get_field_by_index(field_id);
     DCField *field = get_field_by_index(field_id);
-    if (field == (DCField *)NULL) {
+    if (field == nullptr) {
             ostringstream strm;
             ostringstream strm;
             strm
             strm
                 << "Received update for field " << field_id << ", not in class "
                 << "Received update for field " << field_id << ", not in class "
@@ -478,7 +478,7 @@ receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->as_molecular_field() == (DCMolecularField *)NULL &&
+    if (field->as_molecular_field() == nullptr &&
         field->is_required() && field->is_broadcast()) {
         field->is_required() && field->is_broadcast()) {
       packer.begin_unpack(field);
       packer.begin_unpack(field);
       field->receive_update(packer, distobj);
       field->receive_update(packer, distobj);
@@ -513,16 +513,10 @@ receive_update_broadcast_required_owner(PyObject *distobj,
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->as_molecular_field() == (DCMolecularField *)NULL &&
-        field->is_required()) {
+    if (field->as_molecular_field() == nullptr &&
+        field->is_required() && (field->is_ownrecv() || field->is_broadcast())) {
       packer.begin_unpack(field);
       packer.begin_unpack(field);
-      if (field->is_ownrecv()) {
-        field->receive_update(packer, distobj);
-      } else {
-        // It's not an ownrecv field; skip over it.  It's difficult to filter
-        // this on the server, ask Roger for the reason.
-        packer.unpack_skip();
-      }
+      field->receive_update(packer, distobj);
       if (!packer.end_unpack()) {
       if (!packer.end_unpack()) {
         break;
         break;
       }
       }
@@ -552,7 +546,7 @@ receive_update_all_required(PyObject *distobj, DatagramIterator &di) const {
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->as_molecular_field() == (DCMolecularField *)NULL &&
+    if (field->as_molecular_field() == nullptr &&
         field->is_required()) {
         field->is_required()) {
       packer.begin_unpack(field);
       packer.begin_unpack(field);
       field->receive_update(packer, distobj);
       field->receive_update(packer, distobj);
@@ -591,7 +585,7 @@ void DCClass::
 direct_update(PyObject *distobj, const string &field_name,
 direct_update(PyObject *distobj, const string &field_name,
               const string &value_blob) {
               const string &value_blob) {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  nassertv_always(field != NULL);
+  nassertv_always(field != nullptr);
 
 
   DCPacker packer;
   DCPacker packer;
   packer.set_unpack_data(value_blob);
   packer.set_unpack_data(value_blob);
@@ -651,7 +645,7 @@ bool DCClass::
 pack_required_field(DCPacker &packer, PyObject *distobj,
 pack_required_field(DCPacker &packer, PyObject *distobj,
                     const DCField *field) const {
                     const DCField *field) const {
   const DCParameter *parameter = field->as_parameter();
   const DCParameter *parameter = field->as_parameter();
-  if (parameter != (DCParameter *)NULL) {
+  if (parameter != nullptr) {
     // This is the easy case: to pack a parameter, we just look on the class
     // This is the easy case: to pack a parameter, we just look on the class
     // object for the data element.
     // object for the data element.
     string field_name = field->get_name();
     string field_name = field->get_name();
@@ -674,7 +668,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     }
     }
     PyObject *result =
     PyObject *result =
       PyObject_GetAttrString(distobj, (char *)field_name.c_str());
       PyObject_GetAttrString(distobj, (char *)field_name.c_str());
-    nassertr(result != (PyObject *)NULL, false);
+    nassertr(result != nullptr, false);
 
 
     // Now pack the value into the datagram.
     // Now pack the value into the datagram.
     bool pack_ok = parameter->pack_args(packer, result);
     bool pack_ok = parameter->pack_args(packer, result);
@@ -683,7 +677,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     return pack_ok;
     return pack_ok;
   }
   }
 
 
-  if (field->as_molecular_field() != (DCMolecularField *)NULL) {
+  if (field->as_molecular_field() != nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "Cannot pack molecular field " << field->get_name()
     strm << "Cannot pack molecular field " << field->get_name()
          << " for generate";
          << " for generate";
@@ -692,7 +686,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
   }
   }
 
 
   const DCAtomicField *atom = field->as_atomic_field();
   const DCAtomicField *atom = field->as_atomic_field();
-  nassertr(atom != (DCAtomicField *)NULL, false);
+  nassertr(atom != nullptr, false);
 
 
   // We need to get the initial value of this field.  There isn't a good,
   // We need to get the initial value of this field.  There isn't a good,
   // robust way to get this; presently, we just mangle the "setFoo()" name of
   // robust way to get this; presently, we just mangle the "setFoo()" name of
@@ -746,13 +740,13 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
   }
   }
   PyObject *func =
   PyObject *func =
     PyObject_GetAttrString(distobj, (char *)getter_name.c_str());
     PyObject_GetAttrString(distobj, (char *)getter_name.c_str());
-  nassertr(func != (PyObject *)NULL, false);
+  nassertr(func != nullptr, false);
 
 
   PyObject *empty_args = PyTuple_New(0);
   PyObject *empty_args = PyTuple_New(0);
   PyObject *result = PyObject_CallObject(func, empty_args);
   PyObject *result = PyObject_CallObject(func, empty_args);
   Py_DECREF(empty_args);
   Py_DECREF(empty_args);
   Py_DECREF(func);
   Py_DECREF(func);
-  if (result == (PyObject *)NULL) {
+  if (result == nullptr) {
     // We don't set this as an exception, since presumably the Python method
     // We don't set this as an exception, since presumably the Python method
     // itself has already triggered a Python exception.
     // itself has already triggered a Python exception.
     cerr << "Error when calling " << getter_name << "\n";
     cerr << "Error when calling " << getter_name << "\n";
@@ -795,7 +789,7 @@ Datagram DCClass::
 client_format_update(const string &field_name, DOID_TYPE do_id,
 client_format_update(const string &field_name, DOID_TYPE do_id,
                      PyObject *args) const {
                      PyObject *args) const {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  if (field == (DCField *)NULL) {
+  if (field == nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "No field named " << field_name << " in class " << get_name()
     strm << "No field named " << field_name << " in class " << get_name()
          << "\n";
          << "\n";
@@ -816,7 +810,7 @@ Datagram DCClass::
 ai_format_update(const string &field_name, DOID_TYPE do_id,
 ai_format_update(const string &field_name, DOID_TYPE do_id,
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  if (field == (DCField *)NULL) {
+  if (field == nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "No field named " << field_name << " in class " << get_name()
     strm << "No field named " << field_name << " in class " << get_name()
          << "\n";
          << "\n";
@@ -838,7 +832,7 @@ Datagram DCClass::
 ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id,
 ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id,
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const {
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  if (field == (DCField *)NULL) {
+  if (field == nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "No field named " << field_name << " in class " << get_name()
     strm << "No field named " << field_name << " in class " << get_name()
          << "\n";
          << "\n";
@@ -877,7 +871,7 @@ client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields; ++i) {
   for (int i = 0; i < num_fields; ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->is_required() && field->as_molecular_field() == NULL) {
+    if (field->is_required() && field->as_molecular_field() == nullptr) {
       packer.begin_pack(field);
       packer.begin_pack(field);
       if (!pack_required_field(packer, distobj, field)) {
       if (!pack_required_field(packer, distobj, field)) {
         return Datagram();
         return Datagram();
@@ -903,7 +897,7 @@ client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
     Py_XDECREF(py_field_name);
     Py_XDECREF(py_field_name);
 
 
     DCField *field = get_field_by_name(field_name);
     DCField *field = get_field_by_name(field_name);
-    if (field == (DCField *)NULL) {
+    if (field == nullptr) {
       ostringstream strm;
       ostringstream strm;
       strm << "No field named " << field_name << " in class " << get_name()
       strm << "No field named " << field_name << " in class " << get_name()
            << "\n";
            << "\n";
@@ -946,25 +940,23 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
   bool has_optional_fields = (PyObject_IsTrue(optional_fields) != 0);
   bool has_optional_fields = (PyObject_IsTrue(optional_fields) != 0);
 
 
   if (has_optional_fields) {
   if (has_optional_fields) {
-    packer.raw_pack_uint16(STATESERVER_OBJECT_GENERATE_WITH_REQUIRED_OTHER);
+    packer.raw_pack_uint16(STATESERVER_CREATE_OBJECT_WITH_REQUIRED_OTHER);
   } else {
   } else {
-    packer.raw_pack_uint16(STATESERVER_OBJECT_GENERATE_WITH_REQUIRED);
+    packer.raw_pack_uint16(STATESERVER_CREATE_OBJECT_WITH_REQUIRED);
   }
   }
 
 
+  packer.raw_pack_uint32(do_id);
   // Parent is a bit overloaded; this parent is not about inheritance, this
   // Parent is a bit overloaded; this parent is not about inheritance, this
   // one is about the visibility container parent, i.e.  the zone parent:
   // one is about the visibility container parent, i.e.  the zone parent:
-  if (parent_id) {
-    packer.raw_pack_uint32(parent_id);
-  }
+  packer.raw_pack_uint32(parent_id);
   packer.raw_pack_uint32(zone_id);
   packer.raw_pack_uint32(zone_id);
   packer.raw_pack_uint16(_number);
   packer.raw_pack_uint16(_number);
-  packer.raw_pack_uint32(do_id);
 
 
   // Specify all of the required fields.
   // Specify all of the required fields.
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields; ++i) {
   for (int i = 0; i < num_fields; ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->is_required() && field->as_molecular_field() == NULL) {
+    if (field->is_required() && field->as_molecular_field() == nullptr) {
       packer.begin_pack(field);
       packer.begin_pack(field);
       if (!pack_required_field(packer, distobj, field)) {
       if (!pack_required_field(packer, distobj, field)) {
         return Datagram();
         return Datagram();
@@ -988,7 +980,7 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
       Py_XDECREF(py_field_name);
       Py_XDECREF(py_field_name);
 
 
       DCField *field = get_field_by_name(field_name);
       DCField *field = get_field_by_name(field_name);
-      if (field == (DCField *)NULL) {
+      if (field == nullptr) {
         ostringstream strm;
         ostringstream strm;
         strm << "No field named " << field_name << " in class " << get_name()
         strm << "No field named " << field_name << " in class " << get_name()
              << "\n";
              << "\n";
@@ -1009,77 +1001,6 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
   return Datagram(packer.get_data(), packer.get_length());
   return Datagram(packer.get_data(), packer.get_length());
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
-#ifdef HAVE_PYTHON
-/**
- * Generates a datagram containing the message necessary to create a new
- * database distributed object from the AI.
- *
- * First Pass is to only include required values (with Defaults).
- */
-Datagram DCClass::
-ai_database_generate_context(
-    unsigned int context_id, DOID_TYPE parent_id, ZONEID_TYPE zone_id,
-    CHANNEL_TYPE owner_channel,
-    CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const
-{
-  DCPacker packer;
-  packer.raw_pack_uint8(1);
-  packer.RAW_PACK_CHANNEL(database_server_id);
-  packer.RAW_PACK_CHANNEL(from_channel_id);
-  // packer.raw_pack_uint8('A');
-  packer.raw_pack_uint16(STATESERVER_OBJECT_CREATE_WITH_REQUIRED_CONTEXT);
-  packer.raw_pack_uint32(parent_id);
-  packer.raw_pack_uint32(zone_id);
-  packer.RAW_PACK_CHANNEL(owner_channel);
-  packer.raw_pack_uint16(_number); // DCD class ID
-  packer.raw_pack_uint32(context_id);
-
-  // Specify all of the required fields.
-  int num_fields = get_num_inherited_fields();
-  for (int i = 0; i < num_fields; ++i) {
-    DCField *field = get_inherited_field(i);
-    if (field->is_required() && field->as_molecular_field() == NULL) {
-      packer.begin_pack(field);
-      packer.pack_default_value();
-      packer.end_pack();
-    }
-  }
-
-  return Datagram(packer.get_data(), packer.get_length());
-}
-#endif  // HAVE_PYTHON
-
-#ifdef HAVE_PYTHON
-Datagram DCClass::
-ai_database_generate_context_old(
-    unsigned int context_id, DOID_TYPE parent_id, ZONEID_TYPE zone_id,
-    CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const
-{
-  DCPacker packer;
-  packer.raw_pack_uint8(1);
-  packer.RAW_PACK_CHANNEL(database_server_id);
-  packer.RAW_PACK_CHANNEL(from_channel_id);
-  // packer.raw_pack_uint8('A');
-  packer.raw_pack_uint16(STATESERVER_OBJECT_CREATE_WITH_REQUIRED_CONTEXT);
-  packer.raw_pack_uint32(parent_id);
-  packer.raw_pack_uint32(zone_id);
-  packer.raw_pack_uint16(_number); // DCD class ID
-  packer.raw_pack_uint32(context_id);
-
-  // Specify all of the required fields.
-  int num_fields = get_num_inherited_fields();
-  for (int i = 0; i < num_fields; ++i) {
-    DCField *field = get_inherited_field(i);
-    if (field->is_required() && field->as_molecular_field() == NULL) {
-      packer.begin_pack(field);
-      packer.pack_default_value();
-      packer.end_pack();
-    }
-  }
-
-  return Datagram(packer.get_data(), packer.get_length());
-}
-#endif  // HAVE_PYTHON
 
 
 /**
 /**
  * Write a string representation of this instance to <out>.
  * Write a string representation of this instance to <out>.
@@ -1121,7 +1042,7 @@ write(ostream &out, bool brief, int indent_level) const {
   }
   }
   out << "\n";
   out << "\n";
 
 
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     _constructor->write(out, brief, indent_level + 2);
     _constructor->write(out, brief, indent_level + 2);
   }
   }
 
 
@@ -1177,7 +1098,7 @@ output_instance(ostream &out, bool brief, const string &prename,
 
 
   out << " {";
   out << " {";
 
 
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     _constructor->output(out, brief);
     _constructor->output(out, brief);
     out << "; ";
     out << "; ";
   }
   }
@@ -1213,7 +1134,7 @@ generate_hash(HashGenerator &hashgen) const {
     hashgen.add_int((*pi)->get_number());
     hashgen.add_int((*pi)->get_number());
   }
   }
 
 
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     _constructor->generate_hash(hashgen);
     _constructor->generate_hash(hashgen);
   }
   }
 
 
@@ -1326,20 +1247,20 @@ shadow_inherited_field(const string &name) {
  */
  */
 bool DCClass::
 bool DCClass::
 add_field(DCField *field) {
 add_field(DCField *field) {
-  nassertr(field->get_class() == this || field->get_class() == NULL, false);
+  nassertr(field->get_class() == this || field->get_class() == nullptr, false);
   field->set_class(this);
   field->set_class(this);
-  if (_dc_file != (DCFile *)NULL) {
+  if (_dc_file != nullptr) {
     _dc_file->mark_inherited_fields_stale();
     _dc_file->mark_inherited_fields_stale();
   }
   }
 
 
   if (!field->get_name().empty()) {
   if (!field->get_name().empty()) {
     if (field->get_name() == _name) {
     if (field->get_name() == _name) {
       // This field is a constructor.
       // This field is a constructor.
-      if (_constructor != (DCField *)NULL) {
+      if (_constructor != nullptr) {
         // We already have a constructor.
         // We already have a constructor.
         return false;
         return false;
       }
       }
-      if (field->as_atomic_field() == (DCAtomicField *)NULL) {
+      if (field->as_atomic_field() == nullptr) {
         // The constructor must be an atomic field.
         // The constructor must be an atomic field.
         return false;
         return false;
       }
       }
@@ -1357,7 +1278,7 @@ add_field(DCField *field) {
     }
     }
   }
   }
 
 
-  if (_dc_file != (DCFile *)NULL &&
+  if (_dc_file != nullptr &&
       ((dc_virtual_inheritance && dc_sort_inheritance_by_file) || !is_struct())) {
       ((dc_virtual_inheritance && dc_sort_inheritance_by_file) || !is_struct())) {
     if (dc_multiple_inheritance) {
     if (dc_multiple_inheritance) {
       _dc_file->set_new_index_number(field);
       _dc_file->set_new_index_number(field);

+ 17 - 22
direct/src/dcparser/dcClass.h

@@ -43,7 +43,7 @@ class DCParameter;
  */
  */
 class DCClass : public DCDeclaration {
 class DCClass : public DCDeclaration {
 public:
 public:
-  DCClass(DCFile *dc_file, const string &name,
+  DCClass(DCFile *dc_file, const std::string &name,
           bool is_struct, bool bogus_class);
           bool is_struct, bool bogus_class);
   ~DCClass();
   ~DCClass();
 
 
@@ -53,7 +53,7 @@ PUBLISHED:
 
 
   INLINE DCFile *get_dc_file() const;
   INLINE DCFile *get_dc_file() const;
 
 
-  INLINE const string &get_name() const;
+  INLINE const std::string &get_name() const;
   INLINE int get_number() const;
   INLINE int get_number() const;
 
 
   int get_num_parents() const;
   int get_num_parents() const;
@@ -65,7 +65,7 @@ PUBLISHED:
   int get_num_fields() const;
   int get_num_fields() const;
   DCField *get_field(int n) const;
   DCField *get_field(int n) const;
 
 
-  DCField *get_field_by_name(const string &name) const;
+  DCField *get_field_by_name(const std::string &name) const;
   DCField *get_field_by_index(int index_number) const;
   DCField *get_field_by_index(int index_number) const;
 
 
   int get_num_inherited_fields() const;
   int get_num_inherited_fields() const;
@@ -78,7 +78,7 @@ PUBLISHED:
   INLINE void start_generate();
   INLINE void start_generate();
   INLINE void stop_generate();
   INLINE void stop_generate();
 
 
-  virtual void output(ostream &out) const;
+  virtual void output(std::ostream &out) const;
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
   bool has_class_def() const;
   bool has_class_def() const;
@@ -94,9 +94,9 @@ PUBLISHED:
   void receive_update_all_required(PyObject *distobj, DatagramIterator &di) const;
   void receive_update_all_required(PyObject *distobj, DatagramIterator &di) const;
   void receive_update_other(PyObject *distobj, DatagramIterator &di) const;
   void receive_update_other(PyObject *distobj, DatagramIterator &di) const;
 
 
-  void direct_update(PyObject *distobj, const string &field_name,
-                     const string &value_blob);
-  void direct_update(PyObject *distobj, const string &field_name,
+  void direct_update(PyObject *distobj, const std::string &field_name,
+                     const std::string &value_blob);
+  void direct_update(PyObject *distobj, const std::string &field_name,
                      const Datagram &datagram);
                      const Datagram &datagram);
   bool pack_required_field(Datagram &datagram, PyObject *distobj,
   bool pack_required_field(Datagram &datagram, PyObject *distobj,
                            const DCField *field) const;
                            const DCField *field) const;
@@ -105,11 +105,11 @@ PUBLISHED:
 
 
 
 
 
 
-  Datagram client_format_update(const string &field_name,
+  Datagram client_format_update(const std::string &field_name,
                                 DOID_TYPE do_id, PyObject *args) const;
                                 DOID_TYPE do_id, PyObject *args) const;
-  Datagram ai_format_update(const string &field_name, DOID_TYPE do_id,
+  Datagram ai_format_update(const std::string &field_name, DOID_TYPE do_id,
                             CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const;
                             CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const;
-  Datagram ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id,
+  Datagram ai_format_update_msg_type(const std::string &field_name, DOID_TYPE do_id,
                             CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const;
                             CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const;
   Datagram ai_format_generate(PyObject *distobj, DOID_TYPE do_id, ZONEID_TYPE parent_id, ZONEID_TYPE zone_id,
   Datagram ai_format_generate(PyObject *distobj, DOID_TYPE do_id, ZONEID_TYPE parent_id, ZONEID_TYPE zone_id,
                               CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id,
                               CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id,
@@ -117,18 +117,13 @@ PUBLISHED:
   Datagram client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
   Datagram client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
                                       ZONEID_TYPE zone_id,                                                           PyObject *optional_fields) const;
                                       ZONEID_TYPE zone_id,                                                           PyObject *optional_fields) const;
 
 
-  Datagram ai_database_generate_context(unsigned int context_id, DOID_TYPE parent_id, ZONEID_TYPE zone_id, CHANNEL_TYPE owner_channel,
-                                CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const;
-  Datagram ai_database_generate_context_old(unsigned int context_id, DOID_TYPE parent_id, ZONEID_TYPE zone_id,
-                                CHANNEL_TYPE database_server_id, CHANNEL_TYPE from_channel_id) const;
-
 #endif
 #endif
 
 
 public:
 public:
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
-  void output_instance(ostream &out, bool brief, const string &prename,
-                       const string &name, const string &postname) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
+  void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                       const std::string &name, const std::string &postname) const;
   void generate_hash(HashGenerator &hashgen) const;
   void generate_hash(HashGenerator &hashgen) const;
   void clear_inherited_fields();
   void clear_inherited_fields();
   void rebuild_inherited_fields();
   void rebuild_inherited_fields();
@@ -138,7 +133,7 @@ public:
   void set_number(int number);
   void set_number(int number);
 
 
 private:
 private:
-  void shadow_inherited_field(const string &name);
+  void shadow_inherited_field(const std::string &name);
 
 
 #ifdef WITHIN_PANDA
 #ifdef WITHIN_PANDA
   PStatCollector _class_update_pcollector;
   PStatCollector _class_update_pcollector;
@@ -149,7 +144,7 @@ private:
 
 
   DCFile *_dc_file;
   DCFile *_dc_file;
 
 
-  string _name;
+  std::string _name;
   bool _is_struct;
   bool _is_struct;
   bool _bogus_class;
   bool _bogus_class;
   int _number;
   int _number;
@@ -162,7 +157,7 @@ private:
   typedef pvector<DCField *> Fields;
   typedef pvector<DCField *> Fields;
   Fields _fields, _inherited_fields;
   Fields _fields, _inherited_fields;
 
 
-  typedef pmap<string, DCField *> FieldsByName;
+  typedef pmap<std::string, DCField *> FieldsByName;
   FieldsByName _fields_by_name;
   FieldsByName _fields_by_name;
 
 
   typedef pmap<int, DCField *> FieldsByIndex;
   typedef pmap<int, DCField *> FieldsByIndex;

+ 2 - 2
direct/src/dcparser/dcClassParameter.cxx

@@ -119,7 +119,7 @@ get_class() const {
  */
  */
 DCPackerInterface *DCClassParameter::
 DCPackerInterface *DCClassParameter::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_nested_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_nested_fields.size(), nullptr);
   return _nested_fields[n];
   return _nested_fields[n];
 }
 }
 
 
@@ -130,7 +130,7 @@ get_nested_field(int n) const {
 void DCClassParameter::
 void DCClassParameter::
 output_instance(ostream &out, bool brief, const string &prename,
 output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
                 const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {

+ 2 - 2
direct/src/dcparser/dcClassParameter.h

@@ -39,8 +39,8 @@ PUBLISHED:
 public:
 public:
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual DCPackerInterface *get_nested_field(int n) const;
 
 
-  virtual void output_instance(ostream &out, bool brief, const string &prename,
-                               const string &name, const string &postname) const;
+  virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                               const std::string &name, const std::string &postname) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
 
 
 protected:
 protected:

+ 4 - 4
direct/src/dcparser/dcDeclaration.cxx

@@ -26,7 +26,7 @@ DCDeclaration::
  */
  */
 DCClass *DCDeclaration::
 DCClass *DCDeclaration::
 as_class() {
 as_class() {
-  return (DCClass *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -34,7 +34,7 @@ as_class() {
  */
  */
 const DCClass *DCDeclaration::
 const DCClass *DCDeclaration::
 as_class() const {
 as_class() const {
-  return (DCClass *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -42,7 +42,7 @@ as_class() const {
  */
  */
 DCSwitch *DCDeclaration::
 DCSwitch *DCDeclaration::
 as_switch() {
 as_switch() {
-  return (DCSwitch *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -50,7 +50,7 @@ as_switch() {
  */
  */
 const DCSwitch *DCDeclaration::
 const DCSwitch *DCDeclaration::
 as_switch() const {
 as_switch() const {
-  return (DCSwitch *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**

+ 5 - 5
direct/src/dcparser/dcDeclaration.h

@@ -36,15 +36,15 @@ PUBLISHED:
   virtual DCSwitch *as_switch();
   virtual DCSwitch *as_switch();
   virtual const DCSwitch *as_switch() const;
   virtual const DCSwitch *as_switch() const;
 
 
-  virtual void output(ostream &out) const;
-  void write(ostream &out, int indent_level) const;
+  virtual void output(std::ostream &out) const;
+  void write(std::ostream &out, int indent_level) const;
 
 
 public:
 public:
-  virtual void output(ostream &out, bool brief) const=0;
-  virtual void write(ostream &out, bool brief, int indent_level) const=0;
+  virtual void output(std::ostream &out, bool brief) const=0;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const=0;
 };
 };
 
 
-INLINE ostream &operator << (ostream &out, const DCDeclaration &decl) {
+INLINE std::ostream &operator << (std::ostream &out, const DCDeclaration &decl) {
   decl.output(out);
   decl.output(out);
   return out;
   return out;
 }
 }

+ 4 - 4
direct/src/dcparser/dcField.I

@@ -42,7 +42,7 @@ has_default_value() const {
  * explicitly set (e.g.  has_default_value() returns true), returns that
  * explicitly set (e.g.  has_default_value() returns true), returns that
  * value; otherwise, returns an implicit default for the field.
  * value; otherwise, returns an implicit default for the field.
  */
  */
-INLINE const string &DCField::
+INLINE const std::string &DCField::
 get_default_value() const {
 get_default_value() const {
   if (_default_value_stale) {
   if (_default_value_stale) {
     ((DCField *)this)->refresh_default_value();
     ((DCField *)this)->refresh_default_value();
@@ -138,7 +138,7 @@ is_airecv() const {
  * Write a string representation of this instance to <out>.
  * Write a string representation of this instance to <out>.
  */
  */
 INLINE void DCField::
 INLINE void DCField::
-output(ostream &out) const {
+output(std::ostream &out) const {
   output(out, true);
   output(out, true);
 }
 }
 
 
@@ -146,7 +146,7 @@ output(ostream &out) const {
  * Write a string representation of this instance to <out>.
  * Write a string representation of this instance to <out>.
  */
  */
 INLINE void DCField::
 INLINE void DCField::
-write(ostream &out, int indent_level) const {
+write(std::ostream &out, int indent_level) const {
   write(out, false, indent_level);
   write(out, false, indent_level);
 }
 }
 
 
@@ -172,7 +172,7 @@ set_class(DCClass *dclass) {
  * Establishes a default value for this field.
  * Establishes a default value for this field.
  */
  */
 INLINE void DCField::
 INLINE void DCField::
-set_default_value(const string &default_value) {
+set_default_value(const std::string &default_value) {
   _default_value = default_value;
   _default_value = default_value;
   _has_default_value = true;
   _has_default_value = true;
   _default_value_stale = false;
   _default_value_stale = false;

+ 24 - 24
direct/src/dcparser/dcField.cxx

@@ -31,7 +31,7 @@
  */
  */
 DCField::
 DCField::
 DCField() :
 DCField() :
-  _dclass(NULL)
+  _dclass(nullptr)
 #ifdef WITHIN_PANDA
 #ifdef WITHIN_PANDA
   ,
   ,
   _field_update_pcollector("DCField")
   _field_update_pcollector("DCField")
@@ -108,7 +108,7 @@ as_field() const {
  */
  */
 DCAtomicField *DCField::
 DCAtomicField *DCField::
 as_atomic_field() {
 as_atomic_field() {
-  return (DCAtomicField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -117,7 +117,7 @@ as_atomic_field() {
  */
  */
 const DCAtomicField *DCField::
 const DCAtomicField *DCField::
 as_atomic_field() const {
 as_atomic_field() const {
-  return (DCAtomicField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -126,7 +126,7 @@ as_atomic_field() const {
  */
  */
 DCMolecularField *DCField::
 DCMolecularField *DCField::
 as_molecular_field() {
 as_molecular_field() {
-  return (DCMolecularField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -135,7 +135,7 @@ as_molecular_field() {
  */
  */
 const DCMolecularField *DCField::
 const DCMolecularField *DCField::
 as_molecular_field() const {
 as_molecular_field() const {
-  return (DCMolecularField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -143,7 +143,7 @@ as_molecular_field() const {
  */
  */
 DCParameter *DCField::
 DCParameter *DCField::
 as_parameter() {
 as_parameter() {
-  return (DCParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -151,7 +151,7 @@ as_parameter() {
  */
  */
 const DCParameter *DCField::
 const DCParameter *DCField::
 as_parameter() const {
 as_parameter() const {
-  return (DCParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -235,7 +235,7 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
     ostringstream strm;
     ostringstream strm;
     PyObject *exc_type = PyExc_Exception;
     PyObject *exc_type = PyExc_Exception;
 
 
-    if (as_parameter() != (DCParameter *)NULL) {
+    if (as_parameter() != nullptr) {
       // If it's a parameter-type field, the value may or may not be a
       // If it's a parameter-type field, the value may or may not be a
       // sequence.
       // sequence.
       if (packer.had_pack_error()) {
       if (packer.had_pack_error()) {
@@ -251,7 +251,7 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
     } else {
     } else {
       // If it's a molecular or atomic field, the value should be a sequence.
       // If it's a molecular or atomic field, the value should be a sequence.
       PyObject *tuple = PySequence_Tuple(sequence);
       PyObject *tuple = PySequence_Tuple(sequence);
-      if (tuple == (PyObject *)NULL) {
+      if (tuple == nullptr) {
         strm << "Value for " << get_name() << " not a sequence: " \
         strm << "Value for " << get_name() << " not a sequence: " \
              << get_pystr(sequence);
              << get_pystr(sequence);
         exc_type = PyExc_TypeError;
         exc_type = PyExc_TypeError;
@@ -287,8 +287,8 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
  */
  */
 PyObject *DCField::
 PyObject *DCField::
 unpack_args(DCPacker &packer) const {
 unpack_args(DCPacker &packer) const {
-  nassertr(!packer.had_error(), NULL);
-  nassertr(packer.get_current_field() == this, NULL);
+  nassertr(!packer.had_error(), nullptr);
+  nassertr(packer.get_current_field() == this, nullptr);
 
 
   size_t start_byte = packer.get_num_unpacked_bytes();
   size_t start_byte = packer.get_num_unpacked_bytes();
   PyObject *object = packer.unpack_object();
   PyObject *object = packer.unpack_object();
@@ -329,7 +329,7 @@ unpack_args(DCPacker &packer) const {
   }
   }
 
 
   Py_XDECREF(object);
   Py_XDECREF(object);
-  return NULL;
+  return nullptr;
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -340,10 +340,10 @@ unpack_args(DCPacker &packer) const {
  */
  */
 void DCField::
 void DCField::
 receive_update(DCPacker &packer, PyObject *distobj) const {
 receive_update(DCPacker &packer, PyObject *distobj) const {
-  if (as_parameter() != (DCParameter *)NULL) {
+  if (as_parameter() != nullptr) {
     // If it's a parameter-type field, just store a new value on the object.
     // If it's a parameter-type field, just store a new value on the object.
     PyObject *value = unpack_args(packer);
     PyObject *value = unpack_args(packer);
-    if (value != (PyObject *)NULL) {
+    if (value != nullptr) {
       PyObject_SetAttrString(distobj, (char *)_name.c_str(), value);
       PyObject_SetAttrString(distobj, (char *)_name.c_str(), value);
     }
     }
     Py_DECREF(value);
     Py_DECREF(value);
@@ -362,9 +362,9 @@ receive_update(DCPacker &packer, PyObject *distobj) const {
       // method.
       // method.
       PyObject *args = unpack_args(packer);
       PyObject *args = unpack_args(packer);
 
 
-      if (args != (PyObject *)NULL) {
+      if (args != nullptr) {
         PyObject *func = PyObject_GetAttrString(distobj, (char *)_name.c_str());
         PyObject *func = PyObject_GetAttrString(distobj, (char *)_name.c_str());
-        nassertv(func != (PyObject *)NULL);
+        nassertv(func != nullptr);
 
 
         PyObject *result;
         PyObject *result;
         {
         {
@@ -391,7 +391,7 @@ Datagram DCField::
 client_format_update(DOID_TYPE do_id, PyObject *args) const {
 client_format_update(DOID_TYPE do_id, PyObject *args) const {
   DCPacker packer;
   DCPacker packer;
 
 
-  packer.raw_pack_uint16(CLIENT_OBJECT_UPDATE_FIELD);
+  packer.raw_pack_uint16(CLIENT_OBJECT_SET_FIELD);
   packer.raw_pack_uint32(do_id);
   packer.raw_pack_uint32(do_id);
   packer.raw_pack_uint16(_number);
   packer.raw_pack_uint16(_number);
 
 
@@ -417,7 +417,7 @@ ai_format_update(DOID_TYPE do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyOb
   packer.raw_pack_uint8(1);
   packer.raw_pack_uint8(1);
   packer.RAW_PACK_CHANNEL(to_id);
   packer.RAW_PACK_CHANNEL(to_id);
   packer.RAW_PACK_CHANNEL(from_id);
   packer.RAW_PACK_CHANNEL(from_id);
-  packer.raw_pack_uint16(STATESERVER_OBJECT_UPDATE_FIELD);
+  packer.raw_pack_uint16(STATESERVER_OBJECT_SET_FIELD);
   packer.raw_pack_uint32(do_id);
   packer.raw_pack_uint32(do_id);
   packer.raw_pack_uint16(_number);
   packer.raw_pack_uint16(_number);
 
 
@@ -499,7 +499,7 @@ pack_default_value(DCPackData &pack_data, bool &) const {
 void DCField::
 void DCField::
 set_name(const string &name) {
 set_name(const string &name) {
   DCPackerInterface::set_name(name);
   DCPackerInterface::set_name(name);
-  if (_dclass != (DCClass *)NULL) {
+  if (_dclass != nullptr) {
     _dclass->_dc_file->mark_inherited_fields_stale();
     _dclass->_dc_file->mark_inherited_fields_stale();
   }
   }
 }
 }
@@ -510,12 +510,12 @@ set_name(const string &name) {
  */
  */
 string DCField::
 string DCField::
 get_pystr(PyObject *value) {
 get_pystr(PyObject *value) {
-  if (value == NULL) {
+  if (value == nullptr) {
     return "(null)";
     return "(null)";
   }
   }
 
 
   PyObject *str = PyObject_Str(value);
   PyObject *str = PyObject_Str(value);
-  if (str != NULL) {
+  if (str != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     string result = PyUnicode_AsUTF8(str);
     string result = PyUnicode_AsUTF8(str);
 #else
 #else
@@ -526,7 +526,7 @@ get_pystr(PyObject *value) {
   }
   }
 
 
   PyObject *repr = PyObject_Repr(value);
   PyObject *repr = PyObject_Repr(value);
-  if (repr != NULL) {
+  if (repr != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     string result = PyUnicode_AsUTF8(repr);
     string result = PyUnicode_AsUTF8(repr);
 #else
 #else
@@ -536,9 +536,9 @@ get_pystr(PyObject *value) {
     return result;
     return result;
   }
   }
 
 
-  if (value->ob_type != NULL) {
+  if (value->ob_type != nullptr) {
     PyObject *typestr = PyObject_Str((PyObject *)(value->ob_type));
     PyObject *typestr = PyObject_Str((PyObject *)(value->ob_type));
-    if (typestr != NULL) {
+    if (typestr != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
       string result = PyUnicode_AsUTF8(typestr);
       string result = PyUnicode_AsUTF8(typestr);
 #else
 #else

+ 14 - 14
direct/src/dcparser/dcField.h

@@ -37,7 +37,7 @@ class HashGenerator;
 class DCField : public DCPackerInterface, public DCKeywordList {
 class DCField : public DCPackerInterface, public DCKeywordList {
 public:
 public:
   DCField();
   DCField();
-  DCField(const string &name, DCClass *dclass);
+  DCField(const std::string &name, DCClass *dclass);
   virtual ~DCField();
   virtual ~DCField();
 
 
 PUBLISHED:
 PUBLISHED:
@@ -53,13 +53,13 @@ PUBLISHED:
   virtual DCParameter *as_parameter();
   virtual DCParameter *as_parameter();
   virtual const DCParameter *as_parameter() const;
   virtual const DCParameter *as_parameter() const;
 
 
-  string format_data(const string &packed_data, bool show_field_names = true);
-  string parse_string(const string &formatted_string);
+  std::string format_data(const std::string &packed_data, bool show_field_names = true);
+  std::string parse_string(const std::string &formatted_string);
 
 
-  bool validate_ranges(const string &packed_data) const;
+  bool validate_ranges(const std::string &packed_data) const;
 
 
   INLINE bool has_default_value() const;
   INLINE bool has_default_value() const;
-  INLINE const string &get_default_value() const;
+  INLINE const std::string &get_default_value() const;
 
 
   INLINE bool is_bogus_field() const;
   INLINE bool is_bogus_field() const;
 
 
@@ -73,8 +73,8 @@ PUBLISHED:
   INLINE bool is_ownrecv() const;
   INLINE bool is_ownrecv() const;
   INLINE bool is_airecv() const;
   INLINE bool is_airecv() const;
 
 
-  INLINE void output(ostream &out) const;
-  INLINE void write(ostream &out, int indent_level) const;
+  INLINE void output(std::ostream &out) const;
+  INLINE void write(std::ostream &out, int indent_level) const;
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
   bool pack_args(DCPacker &packer, PyObject *sequence) const;
   bool pack_args(DCPacker &packer, PyObject *sequence) const;
@@ -90,18 +90,18 @@ PUBLISHED:
 #endif
 #endif
 
 
 public:
 public:
-  virtual void output(ostream &out, bool brief) const=0;
-  virtual void write(ostream &out, bool brief, int indent_level) const=0;
+  virtual void output(std::ostream &out, bool brief) const=0;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const=0;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
-  virtual void set_name(const string &name);
+  virtual void set_name(const std::string &name);
 
 
   INLINE void set_number(int number);
   INLINE void set_number(int number);
   INLINE void set_class(DCClass *dclass);
   INLINE void set_class(DCClass *dclass);
-  INLINE void set_default_value(const string &default_value);
+  INLINE void set_default_value(const std::string &default_value);
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
-  static string get_pystr(PyObject *value);
+  static std::string get_pystr(PyObject *value);
 #endif
 #endif
 
 
 protected:
 protected:
@@ -115,14 +115,14 @@ protected:
   bool _bogus_field;
   bool _bogus_field;
 
 
 private:
 private:
-  string _default_value;
+  std::string _default_value;
 
 
 #ifdef WITHIN_PANDA
 #ifdef WITHIN_PANDA
   PStatCollector _field_update_pcollector;
   PStatCollector _field_update_pcollector;
 #endif
 #endif
 };
 };
 
 
-INLINE ostream &operator << (ostream &out, const DCField &field) {
+INLINE std::ostream &operator << (std::ostream &out, const DCField &field) {
   field.output(out);
   field.output(out);
   return out;
   return out;
 }
 }

+ 12 - 12
direct/src/dcparser/dcFile.cxx

@@ -123,7 +123,7 @@ read(Filename filename) {
   filename.set_text();
   filename.set_text();
   VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
   VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
   istream *in = vfs->open_read_file(filename, true);
   istream *in = vfs->open_read_file(filename, true);
-  if (in == (istream *)NULL) {
+  if (in == nullptr) {
     cerr << "Cannot open " << filename << " for reading.\n";
     cerr << "Cannot open " << filename << " for reading.\n";
     return false;
     return false;
   }
   }
@@ -247,7 +247,7 @@ get_num_classes() const {
  */
  */
 DCClass *DCFile::
 DCClass *DCFile::
 get_class(int n) const {
 get_class(int n) const {
-  nassertr(n >= 0 && n < (int)_classes.size(), NULL);
+  nassertr(n >= 0 && n < (int)_classes.size(), nullptr);
   return _classes[n];
   return _classes[n];
 }
 }
 
 
@@ -263,7 +263,7 @@ get_class_by_name(const string &name) const {
     return (*ni).second->as_class();
     return (*ni).second->as_class();
   }
   }
 
 
-  return (DCClass *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -278,7 +278,7 @@ get_switch_by_name(const string &name) const {
     return (*ni).second->as_switch();
     return (*ni).second->as_switch();
   }
   }
 
 
-  return (DCSwitch *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -291,13 +291,13 @@ get_switch_by_name(const string &name) const {
  */
  */
 DCField *DCFile::
 DCField *DCFile::
 get_field_by_index(int index_number) const {
 get_field_by_index(int index_number) const {
-  nassertr(dc_multiple_inheritance, NULL);
+  nassertr(dc_multiple_inheritance, nullptr);
 
 
   if (index_number >= 0 && index_number < (int)_fields_by_index.size()) {
   if (index_number >= 0 && index_number < (int)_fields_by_index.size()) {
     return _fields_by_index[index_number];
     return _fields_by_index[index_number];
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -352,7 +352,7 @@ get_num_typedefs() const {
  */
  */
 DCTypedef *DCFile::
 DCTypedef *DCFile::
 get_typedef(int n) const {
 get_typedef(int n) const {
-  nassertr(n >= 0 && n < (int)_typedefs.size(), NULL);
+  nassertr(n >= 0 && n < (int)_typedefs.size(), nullptr);
   return _typedefs[n];
   return _typedefs[n];
 }
 }
 
 
@@ -368,7 +368,7 @@ get_typedef_by_name(const string &name) const {
     return (*ni).second;
     return (*ni).second;
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -394,9 +394,9 @@ get_keyword(int n) const {
 const DCKeyword *DCFile::
 const DCKeyword *DCFile::
 get_keyword_by_name(const string &name) const {
 get_keyword_by_name(const string &name) const {
   const DCKeyword *keyword = _keywords.get_keyword_by_name(name);
   const DCKeyword *keyword = _keywords.get_keyword_by_name(name);
-  if (keyword == (const DCKeyword *)NULL) {
+  if (keyword == nullptr) {
     keyword = _default_keywords.get_keyword_by_name(name);
     keyword = _default_keywords.get_keyword_by_name(name);
-    if (keyword != (const DCKeyword *)NULL) {
+    if (keyword != nullptr) {
       // One of the historical default keywords was used, but wasn't defined.
       // One of the historical default keywords was used, but wasn't defined.
       // Define it implicitly right now.
       // Define it implicitly right now.
       ((DCFile *)this)->_keywords.add_keyword(keyword);
       ((DCFile *)this)->_keywords.add_keyword(keyword);
@@ -612,11 +612,11 @@ setup_default_keywords() {
     { "clrecv", 0x0040 },
     { "clrecv", 0x0040 },
     { "ownsend", 0x0080 },
     { "ownsend", 0x0080 },
     { "airecv", 0x0100 },
     { "airecv", 0x0100 },
-    { NULL, 0 }
+    { nullptr, 0 }
   };
   };
 
 
   _default_keywords.clear_keywords();
   _default_keywords.clear_keywords();
-  for (int i = 0; default_keywords[i].name != NULL; ++i) {
+  for (int i = 0; default_keywords[i].name != nullptr; ++i) {
     DCKeyword *keyword =
     DCKeyword *keyword =
       new DCKeyword(default_keywords[i].name,
       new DCKeyword(default_keywords[i].name,
                     default_keywords[i].flag);
                     default_keywords[i].flag);

+ 15 - 15
direct/src/dcparser/dcFile.h

@@ -41,32 +41,32 @@ PUBLISHED:
 #endif
 #endif
 
 
   bool read(Filename filename);
   bool read(Filename filename);
-  bool read(istream &in, const string &filename = string());
+  bool read(std::istream &in, const std::string &filename = std::string());
 
 
   bool write(Filename filename, bool brief) const;
   bool write(Filename filename, bool brief) const;
-  bool write(ostream &out, bool brief) const;
+  bool write(std::ostream &out, bool brief) const;
 
 
   int get_num_classes() const;
   int get_num_classes() const;
   DCClass *get_class(int n) const;
   DCClass *get_class(int n) const;
-  DCClass *get_class_by_name(const string &name) const;
-  DCSwitch *get_switch_by_name(const string &name) const;
+  DCClass *get_class_by_name(const std::string &name) const;
+  DCSwitch *get_switch_by_name(const std::string &name) const;
 
 
   DCField *get_field_by_index(int index_number) const;
   DCField *get_field_by_index(int index_number) const;
 
 
   INLINE bool all_objects_valid() const;
   INLINE bool all_objects_valid() const;
 
 
   int get_num_import_modules() const;
   int get_num_import_modules() const;
-  string get_import_module(int n) const;
+  std::string get_import_module(int n) const;
   int get_num_import_symbols(int n) const;
   int get_num_import_symbols(int n) const;
-  string get_import_symbol(int n, int i) const;
+  std::string get_import_symbol(int n, int i) const;
 
 
   int get_num_typedefs() const;
   int get_num_typedefs() const;
   DCTypedef *get_typedef(int n) const;
   DCTypedef *get_typedef(int n) const;
-  DCTypedef *get_typedef_by_name(const string &name) const;
+  DCTypedef *get_typedef_by_name(const std::string &name) const;
 
 
   int get_num_keywords() const;
   int get_num_keywords() const;
   const DCKeyword *get_keyword(int n) const;
   const DCKeyword *get_keyword(int n) const;
-  const DCKeyword *get_keyword_by_name(const string &name) const;
+  const DCKeyword *get_keyword_by_name(const std::string &name) const;
 
 
   unsigned long get_hash() const;
   unsigned long get_hash() const;
 
 
@@ -74,10 +74,10 @@ public:
   void generate_hash(HashGenerator &hashgen) const;
   void generate_hash(HashGenerator &hashgen) const;
   bool add_class(DCClass *dclass);
   bool add_class(DCClass *dclass);
   bool add_switch(DCSwitch *dswitch);
   bool add_switch(DCSwitch *dswitch);
-  void add_import_module(const string &import_module);
-  void add_import_symbol(const string &import_symbol);
+  void add_import_module(const std::string &import_module);
+  void add_import_symbol(const std::string &import_symbol);
   bool add_typedef(DCTypedef *dtypedef);
   bool add_typedef(DCTypedef *dtypedef);
-  bool add_keyword(const string &name);
+  bool add_keyword(const std::string &name);
   void add_thing_to_delete(DCDeclaration *decl);
   void add_thing_to_delete(DCDeclaration *decl);
 
 
   void set_new_index_number(DCField *field);
   void set_new_index_number(DCField *field);
@@ -91,13 +91,13 @@ private:
   typedef pvector<DCClass *> Classes;
   typedef pvector<DCClass *> Classes;
   Classes _classes;
   Classes _classes;
 
 
-  typedef pmap<string, DCDeclaration *> ThingsByName;
+  typedef pmap<std::string, DCDeclaration *> ThingsByName;
   ThingsByName _things_by_name;
   ThingsByName _things_by_name;
 
 
-  typedef pvector<string> ImportSymbols;
+  typedef pvector<std::string> ImportSymbols;
   class Import {
   class Import {
   public:
   public:
-    string _module;
+    std::string _module;
     ImportSymbols _symbols;
     ImportSymbols _symbols;
   };
   };
 
 
@@ -107,7 +107,7 @@ private:
   typedef pvector<DCTypedef *> Typedefs;
   typedef pvector<DCTypedef *> Typedefs;
   Typedefs _typedefs;
   Typedefs _typedefs;
 
 
-  typedef pmap<string, DCTypedef *> TypedefsByName;
+  typedef pmap<std::string, DCTypedef *> TypedefsByName;
   TypedefsByName _typedefs_by_name;
   TypedefsByName _typedefs_by_name;
 
 
   DCKeywordList _keywords;
   DCKeywordList _keywords;

+ 5 - 5
direct/src/dcparser/dcKeyword.h

@@ -27,22 +27,22 @@ class HashGenerator;
  */
  */
 class DCKeyword : public DCDeclaration {
 class DCKeyword : public DCDeclaration {
 public:
 public:
-  DCKeyword(const string &name, int historical_flag = ~0);
+  DCKeyword(const std::string &name, int historical_flag = ~0);
   virtual ~DCKeyword();
   virtual ~DCKeyword();
 
 
 PUBLISHED:
 PUBLISHED:
-  const string &get_name() const;
+  const std::string &get_name() const;
 
 
 public:
 public:
   int get_historical_flag() const;
   int get_historical_flag() const;
   void clear_historical_flag();
   void clear_historical_flag();
 
 
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
   void generate_hash(HashGenerator &hashgen) const;
   void generate_hash(HashGenerator &hashgen) const;
 
 
 private:
 private:
-  const string _name;
+  const std::string _name;
 
 
   // This flag is only kept for historical reasons, so we can preserve the
   // This flag is only kept for historical reasons, so we can preserve the
   // file's hash code if no new flags are in use.
   // file's hash code if no new flags are in use.

+ 2 - 2
direct/src/dcparser/dcKeywordList.cxx

@@ -83,7 +83,7 @@ get_num_keywords() const {
  */
  */
 const DCKeyword *DCKeywordList::
 const DCKeyword *DCKeywordList::
 get_keyword(int n) const {
 get_keyword(int n) const {
-  nassertr(n >= 0 && n < (int)_keywords.size(), NULL);
+  nassertr(n >= 0 && n < (int)_keywords.size(), nullptr);
   return _keywords[n];
   return _keywords[n];
 }
 }
 
 
@@ -99,7 +99,7 @@ get_keyword_by_name(const string &name) const {
     return (*ni).second;
     return (*ni).second;
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**

+ 4 - 4
direct/src/dcparser/dcKeywordList.h

@@ -31,11 +31,11 @@ public:
   ~DCKeywordList();
   ~DCKeywordList();
 
 
 PUBLISHED:
 PUBLISHED:
-  bool has_keyword(const string &name) const;
+  bool has_keyword(const std::string &name) const;
   bool has_keyword(const DCKeyword *keyword) const;
   bool has_keyword(const DCKeyword *keyword) const;
   int get_num_keywords() const;
   int get_num_keywords() const;
   const DCKeyword *get_keyword(int n) const;
   const DCKeyword *get_keyword(int n) const;
-  const DCKeyword *get_keyword_by_name(const string &name) const;
+  const DCKeyword *get_keyword_by_name(const std::string &name) const;
 
 
   bool compare_keywords(const DCKeywordList &other) const;
   bool compare_keywords(const DCKeywordList &other) const;
 
 
@@ -45,14 +45,14 @@ public:
   bool add_keyword(const DCKeyword *keyword);
   bool add_keyword(const DCKeyword *keyword);
   void clear_keywords();
   void clear_keywords();
 
 
-  void output_keywords(ostream &out) const;
+  void output_keywords(std::ostream &out) const;
   void generate_hash(HashGenerator &hashgen) const;
   void generate_hash(HashGenerator &hashgen) const;
 
 
 private:
 private:
   typedef pvector<const DCKeyword *> Keywords;
   typedef pvector<const DCKeyword *> Keywords;
   Keywords _keywords;
   Keywords _keywords;
 
 
-  typedef pmap<string, const DCKeyword *> KeywordsByName;
+  typedef pmap<std::string, const DCKeyword *> KeywordsByName;
   KeywordsByName _keywords_by_name;
   KeywordsByName _keywords_by_name;
 
 
   int _flags;
   int _flags;

+ 5 - 5
direct/src/dcparser/dcLexer.lxx

@@ -35,7 +35,7 @@ static int error_count = 0;
 static int warning_count = 0;
 static int warning_count = 0;
 
 
 // This is the pointer to the current input stream.
 // This is the pointer to the current input stream.
-static istream *input_p = NULL;
+static istream *input_p = nullptr;
 
 
 // This is the name of the dc file we're parsing.  We keep it so we
 // This is the name of the dc file we're parsing.  We keep it so we
 // can print it out for error messages.
 // can print it out for error messages.
@@ -129,7 +129,7 @@ dcyywarning(const string &msg) {
 // stdio FILE pointer.  This is flex-specific.
 // stdio FILE pointer.  This is flex-specific.
 static void
 static void
 input_chars(char *buffer, int &result, int max_size) {
 input_chars(char *buffer, int &result, int max_size) {
-  nassertv(input_p != NULL);
+  nassertv(input_p != nullptr);
   if (*input_p) {
   if (*input_p) {
     input_p->read(buffer, max_size);
     input_p->read(buffer, max_size);
     result = input_p->gcount();
     result = input_p->gcount();
@@ -150,7 +150,7 @@ input_chars(char *buffer, int &result, int max_size) {
 
 
       // Truncate it at the newline.
       // Truncate it at the newline.
       char *end = strchr(current_line, '\n');
       char *end = strchr(current_line, '\n');
-      if (end != NULL) {
+      if (end != nullptr) {
         *end = '\0';
         *end = '\0';
       }
       }
     }
     }
@@ -733,9 +733,9 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
   accept();
   accept();
   dcyylval.str = dcyytext;
   dcyylval.str = dcyytext;
 
 
-  if (dc_file != (DCFile *)NULL) {
+  if (dc_file != nullptr) {
     const DCKeyword *keyword = dc_file->get_keyword_by_name(dcyylval.str);
     const DCKeyword *keyword = dc_file->get_keyword_by_name(dcyylval.str);
-    if (keyword != (DCKeyword *)NULL) {
+    if (keyword != nullptr) {
       dcyylval.u.keyword = keyword;
       dcyylval.u.keyword = keyword;
       return KEYWORD;
       return KEYWORD;
     }
     }

+ 3 - 3
direct/src/dcparser/dcLexerDefs.h

@@ -16,14 +16,14 @@
 
 
 #include "dcbase.h"
 #include "dcbase.h"
 
 
-void dc_init_lexer(istream &in, const string &filename);
+void dc_init_lexer(std::istream &in, const std::string &filename);
 void dc_start_parameter_value();
 void dc_start_parameter_value();
 void dc_start_parameter_description();
 void dc_start_parameter_description();
 int dc_error_count();
 int dc_error_count();
 int dc_warning_count();
 int dc_warning_count();
 
 
-void dcyyerror(const string &msg);
-void dcyywarning(const string &msg);
+void dcyyerror(const std::string &msg);
+void dcyywarning(const std::string &msg);
 
 
 int dcyylex();
 int dcyylex();
 
 

+ 2 - 2
direct/src/dcparser/dcMolecularField.cxx

@@ -59,7 +59,7 @@ get_num_atomics() const {
  */
  */
 DCAtomicField *DCMolecularField::
 DCAtomicField *DCMolecularField::
 get_atomic(int n) const {
 get_atomic(int n) const {
-  nassertr(n >= 0 && n < (int)_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_fields.size(), nullptr);
   return _fields[n];
   return _fields[n];
 }
 }
 
 
@@ -161,7 +161,7 @@ generate_hash(HashGenerator &hashgen) const {
  */
  */
 DCPackerInterface *DCMolecularField::
 DCPackerInterface *DCMolecularField::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_nested_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_nested_fields.size(), nullptr);
   return _nested_fields[n];
   return _nested_fields[n];
 }
 }
 
 

+ 3 - 3
direct/src/dcparser/dcMolecularField.h

@@ -27,7 +27,7 @@ class DCParameter;
  */
  */
 class DCMolecularField : public DCField {
 class DCMolecularField : public DCField {
 public:
 public:
-  DCMolecularField(const string &name, DCClass *dclass);
+  DCMolecularField(const std::string &name, DCClass *dclass);
 
 
 PUBLISHED:
 PUBLISHED:
   virtual DCMolecularField *as_molecular_field();
   virtual DCMolecularField *as_molecular_field();
@@ -39,8 +39,8 @@ PUBLISHED:
 public:
 public:
   void add_atomic(DCAtomicField *atomic);
   void add_atomic(DCAtomicField *atomic);
 
 
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
 
 
   virtual DCPackerInterface *get_nested_field(int n) const;
   virtual DCPackerInterface *get_nested_field(int n) const;

+ 15 - 15
direct/src/dcparser/dcNumericRange.I

@@ -58,7 +58,7 @@ is_in_range(Number num) const {
     return true;
     return true;
   }
   }
 
 
-  TYPENAME Ranges::const_iterator ri;
+  typename Ranges::const_iterator ri;
   for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
   for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
     if (num >= (*ri)._min && num <= (*ri)._max) {
     if (num >= (*ri)._min && num <= (*ri)._max) {
       return true;
       return true;
@@ -96,7 +96,7 @@ has_one_value() const {
  * by the numeric range.
  * by the numeric range.
  */
  */
 template <class NUM>
 template <class NUM>
-INLINE TYPENAME DCNumericRange<NUM>::Number DCNumericRange<NUM>::
+INLINE typename DCNumericRange<NUM>::Number DCNumericRange<NUM>::
 get_one_value() const {
 get_one_value() const {
   nassertr(has_one_value(), 0);
   nassertr(has_one_value(), 0);
   return _ranges[0]._min;
   return _ranges[0]._min;
@@ -110,7 +110,7 @@ void DCNumericRange<NUM>::
 generate_hash(HashGenerator &hashgen) const {
 generate_hash(HashGenerator &hashgen) const {
   if (!_ranges.empty()) {
   if (!_ranges.empty()) {
     hashgen.add_int(_ranges.size());
     hashgen.add_int(_ranges.size());
-    TYPENAME Ranges::const_iterator ri;
+    typename Ranges::const_iterator ri;
     for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
     for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
       // We don't account for the fractional part of floating-point ranges
       // We don't account for the fractional part of floating-point ranges
       // here.  Shouldn't be a real issue.
       // here.  Shouldn't be a real issue.
@@ -125,9 +125,9 @@ generate_hash(HashGenerator &hashgen) const {
  */
  */
 template <class NUM>
 template <class NUM>
 void DCNumericRange<NUM>::
 void DCNumericRange<NUM>::
-output(ostream &out, Number divisor) const {
+output(std::ostream &out, Number divisor) const {
   if (!_ranges.empty()) {
   if (!_ranges.empty()) {
-    TYPENAME Ranges::const_iterator ri;
+    typename Ranges::const_iterator ri;
     ri = _ranges.begin();
     ri = _ranges.begin();
     output_minmax(out, divisor, *ri);
     output_minmax(out, divisor, *ri);
     ++ri;
     ++ri;
@@ -145,13 +145,13 @@ output(ostream &out, Number divisor) const {
  */
  */
 template <class NUM>
 template <class NUM>
 void DCNumericRange<NUM>::
 void DCNumericRange<NUM>::
-output_char(ostream &out, Number divisor) const {
+output_char(std::ostream &out, Number divisor) const {
   if (divisor != 1) {
   if (divisor != 1) {
     output(out, divisor);
     output(out, divisor);
 
 
   } else {
   } else {
     if (!_ranges.empty()) {
     if (!_ranges.empty()) {
-      TYPENAME Ranges::const_iterator ri;
+      typename Ranges::const_iterator ri;
       ri = _ranges.begin();
       ri = _ranges.begin();
       output_minmax_char(out, *ri);
       output_minmax_char(out, *ri);
       ++ri;
       ++ri;
@@ -187,7 +187,7 @@ add_range(Number min, Number max) {
     return false;
     return false;
   }
   }
 
 
-  TYPENAME Ranges::const_iterator ri;
+  typename Ranges::const_iterator ri;
   for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
   for (ri = _ranges.begin(); ri != _ranges.end(); ++ri) {
     if ((min >= (*ri)._min && min <= (*ri)._max) ||
     if ((min >= (*ri)._min && min <= (*ri)._max) ||
         (max >= (*ri)._min && max <= (*ri)._max) ||
         (max >= (*ri)._min && max <= (*ri)._max) ||
@@ -227,7 +227,7 @@ get_num_ranges() const {
  * Returns the minimum value defined by the nth component.
  * Returns the minimum value defined by the nth component.
  */
  */
 template <class NUM>
 template <class NUM>
-INLINE TYPENAME DCNumericRange<NUM>::Number DCNumericRange<NUM>::
+INLINE typename DCNumericRange<NUM>::Number DCNumericRange<NUM>::
 get_min(int n) const {
 get_min(int n) const {
   nassertr(n >= 0 && n < (int)_ranges.size(), 0);
   nassertr(n >= 0 && n < (int)_ranges.size(), 0);
   return _ranges[n]._min;
   return _ranges[n]._min;
@@ -237,7 +237,7 @@ get_min(int n) const {
  * Returns the maximum value defined by the nth component.
  * Returns the maximum value defined by the nth component.
  */
  */
 template <class NUM>
 template <class NUM>
-INLINE TYPENAME DCNumericRange<NUM>::Number DCNumericRange<NUM>::
+INLINE typename DCNumericRange<NUM>::Number DCNumericRange<NUM>::
 get_max(int n) const {
 get_max(int n) const {
   nassertr(n >= 0 && n < (int)_ranges.size(), 0);
   nassertr(n >= 0 && n < (int)_ranges.size(), 0);
   return _ranges[n]._max;
   return _ranges[n]._max;
@@ -248,7 +248,7 @@ get_max(int n) const {
  */
  */
 template <class NUM>
 template <class NUM>
 INLINE void DCNumericRange<NUM>::
 INLINE void DCNumericRange<NUM>::
-output_minmax(ostream &out, Number divisor, const MinMax &range) const {
+output_minmax(std::ostream &out, Number divisor, const MinMax &range) const {
   if (divisor == 1) {
   if (divisor == 1) {
     if (range._min == range._max) {
     if (range._min == range._max) {
       out << range._min;
       out << range._min;
@@ -271,12 +271,12 @@ output_minmax(ostream &out, Number divisor, const MinMax &range) const {
  */
  */
 template <class NUM>
 template <class NUM>
 INLINE void DCNumericRange<NUM>::
 INLINE void DCNumericRange<NUM>::
-output_minmax_char(ostream &out, const MinMax &range) const {
+output_minmax_char(std::ostream &out, const MinMax &range) const {
   if (range._min == range._max) {
   if (range._min == range._max) {
-    DCPacker::enquote_string(out, '\'', string(1, range._min));
+    DCPacker::enquote_string(out, '\'', std::string(1, range._min));
   } else {
   } else {
-    DCPacker::enquote_string(out, '\'', string(1, range._min));
+    DCPacker::enquote_string(out, '\'', std::string(1, range._min));
     out << "-";
     out << "-";
-    DCPacker::enquote_string(out, '\'', string(1, range._max));
+    DCPacker::enquote_string(out, '\'', std::string(1, range._max));
   }
   }
 }
 }

+ 4 - 4
direct/src/dcparser/dcNumericRange.h

@@ -40,8 +40,8 @@ public:
 
 
   void generate_hash(HashGenerator &hashgen) const;
   void generate_hash(HashGenerator &hashgen) const;
 
 
-  void output(ostream &out, Number divisor = 1) const;
-  void output_char(ostream &out, Number divisor = 1) const;
+  void output(std::ostream &out, Number divisor = 1) const;
+  void output_char(std::ostream &out, Number divisor = 1) const;
 
 
 public:
 public:
   INLINE void clear();
   INLINE void clear();
@@ -60,8 +60,8 @@ private:
     Number _min;
     Number _min;
     Number _max;
     Number _max;
   };
   };
-  INLINE void output_minmax(ostream &out, Number divisor, const MinMax &range) const;
-  INLINE void output_minmax_char(ostream &out, const MinMax &range) const;
+  INLINE void output_minmax(std::ostream &out, Number divisor, const MinMax &range) const;
+  INLINE void output_minmax_char(std::ostream &out, const MinMax &range) const;
 
 
   typedef pvector<MinMax> Ranges;
   typedef pvector<MinMax> Ranges;
   Ranges _ranges;
   Ranges _ranges;

+ 6 - 6
direct/src/dcparser/dcPackData.I

@@ -16,7 +16,7 @@
  */
  */
 INLINE DCPackData::
 INLINE DCPackData::
 DCPackData() {
 DCPackData() {
-  _buffer = NULL;
+  _buffer = nullptr;
   _allocated_size = 0;
   _allocated_size = 0;
   _used_length = 0;
   _used_length = 0;
 }
 }
@@ -26,7 +26,7 @@ DCPackData() {
  */
  */
 INLINE DCPackData::
 INLINE DCPackData::
 ~DCPackData() {
 ~DCPackData() {
-  if (_buffer != (const char *)NULL) {
+  if (_buffer != nullptr) {
     delete[] _buffer;
     delete[] _buffer;
   }
   }
 }
 }
@@ -82,16 +82,16 @@ rewrite_data(size_t position, const char *buffer, size_t size) {
  */
  */
 INLINE char *DCPackData::
 INLINE char *DCPackData::
 get_rewrite_pointer(size_t position, size_t size) {
 get_rewrite_pointer(size_t position, size_t size) {
-  nassertr(position + size <= _used_length, NULL);
+  nassertr(position + size <= _used_length, nullptr);
   return _buffer + position;
   return _buffer + position;
 }
 }
 
 
 /**
 /**
  * Returns the data buffer as a string.  Also see get_data().
  * Returns the data buffer as a string.  Also see get_data().
  */
  */
-INLINE string DCPackData::
+INLINE std::string DCPackData::
 get_string() const {
 get_string() const {
-  return string(_buffer, _used_length);
+  return std::string(_buffer, _used_length);
 }
 }
 
 
 /**
 /**
@@ -129,7 +129,7 @@ INLINE char *DCPackData::
 take_data() {
 take_data() {
   char *data = _buffer;
   char *data = _buffer;
 
 
-  _buffer = NULL;
+  _buffer = nullptr;
   _allocated_size = 0;
   _allocated_size = 0;
   _used_length = 0;
   _used_length = 0;
 
 

+ 1 - 1
direct/src/dcparser/dcPackData.cxx

@@ -27,7 +27,7 @@ set_used_length(size_t size) {
     if (_used_length > 0) {
     if (_used_length > 0) {
       memcpy(new_buf, _buffer, _used_length);
       memcpy(new_buf, _buffer, _used_length);
     }
     }
-    if (_buffer != NULL) {
+    if (_buffer != nullptr) {
       delete[] _buffer;
       delete[] _buffer;
     }
     }
     _buffer = new_buf;
     _buffer = new_buf;

+ 1 - 1
direct/src/dcparser/dcPackData.h

@@ -34,7 +34,7 @@ public:
   INLINE char *get_rewrite_pointer(size_t position, size_t size);
   INLINE char *get_rewrite_pointer(size_t position, size_t size);
 
 
 PUBLISHED:
 PUBLISHED:
-  INLINE string get_string() const;
+  INLINE std::string get_string() const;
   INLINE size_t get_length() const;
   INLINE size_t get_length() const;
 public:
 public:
   INLINE const char *get_data() const;
   INLINE const char *get_data() const;

+ 59 - 59
direct/src/dcparser/dcPacker.I

@@ -24,7 +24,7 @@ clear_data() {
     delete[] _unpack_data;
     delete[] _unpack_data;
     _owns_unpack_data = false;
     _owns_unpack_data = false;
   }
   }
-  _unpack_data = NULL;
+  _unpack_data = nullptr;
 }
 }
 
 
 /**
 /**
@@ -35,7 +35,7 @@ clear_data() {
  */
  */
 INLINE bool DCPacker::
 INLINE bool DCPacker::
 has_nested_fields() const {
 has_nested_fields() const {
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     return false;
     return false;
   } else {
   } else {
     return _current_field->has_nested_fields();
     return _current_field->has_nested_fields();
@@ -65,7 +65,7 @@ get_num_nested_fields() const {
  */
  */
 INLINE bool DCPacker::
 INLINE bool DCPacker::
 more_nested_fields() const {
 more_nested_fields() const {
-  return (_current_field != (DCPackerInterface *)NULL && !_pack_error);
+  return (_current_field != nullptr && !_pack_error);
 }
 }
 
 
 /**
 /**
@@ -112,7 +112,7 @@ get_last_switch() const {
  */
  */
 INLINE DCPackType DCPacker::
 INLINE DCPackType DCPacker::
 get_pack_type() const {
 get_pack_type() const {
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     return PT_invalid;
     return PT_invalid;
   } else {
   } else {
     return _current_field->get_pack_type();
     return _current_field->get_pack_type();
@@ -123,10 +123,10 @@ get_pack_type() const {
  * Returns the name of the current field, if it has a name, or the empty
  * Returns the name of the current field, if it has a name, or the empty
  * string if the field does not have a name or there is no current field.
  * string if the field does not have a name or there is no current field.
  */
  */
-INLINE string DCPacker::
+INLINE std::string DCPacker::
 get_current_field_name() const {
 get_current_field_name() const {
-  if (_current_field == NULL) {
-    return string();
+  if (_current_field == nullptr) {
+    return std::string();
   } else {
   } else {
     return _current_field->get_name();
     return _current_field->get_name();
   }
   }
@@ -138,7 +138,7 @@ get_current_field_name() const {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_double(double value) {
 pack_double(double value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_double(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_double(_pack_data, value, _pack_error, _range_error);
@@ -152,7 +152,7 @@ pack_double(double value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_int(int value) {
 pack_int(int value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_int(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_int(_pack_data, value, _pack_error, _range_error);
@@ -166,7 +166,7 @@ pack_int(int value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_uint(unsigned int value) {
 pack_uint(unsigned int value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_uint(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_uint(_pack_data, value, _pack_error, _range_error);
@@ -180,7 +180,7 @@ pack_uint(unsigned int value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_int64(int64_t value) {
 pack_int64(int64_t value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_int64(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_int64(_pack_data, value, _pack_error, _range_error);
@@ -194,7 +194,7 @@ pack_int64(int64_t value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_uint64(uint64_t value) {
 pack_uint64(uint64_t value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_uint64(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_uint64(_pack_data, value, _pack_error, _range_error);
@@ -206,9 +206,9 @@ pack_uint64(uint64_t value) {
  * Packs the indicated numeric or string value into the stream.
  * Packs the indicated numeric or string value into the stream.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-pack_string(const string &value) {
+pack_string(const std::string &value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_string(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_string(_pack_data, value, _pack_error, _range_error);
@@ -221,9 +221,9 @@ pack_string(const string &value) {
  * packed field element, or a whole group of field elements at once.
  * packed field element, or a whole group of field elements at once.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-pack_literal_value(const string &value) {
+pack_literal_value(const std::string &value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _pack_data.append_data(value.data(), value.length());
     _pack_data.append_data(value.data(), value.length());
@@ -238,7 +238,7 @@ INLINE double DCPacker::
 unpack_double() {
 unpack_double() {
   double value = 0.0;
   double value = 0.0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -257,7 +257,7 @@ INLINE int DCPacker::
 unpack_int() {
 unpack_int() {
   int value = 0;
   int value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -276,7 +276,7 @@ INLINE unsigned int DCPacker::
 unpack_uint() {
 unpack_uint() {
   unsigned int value = 0;
   unsigned int value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -295,7 +295,7 @@ INLINE int64_t DCPacker::
 unpack_int64() {
 unpack_int64() {
   int64_t value = 0;
   int64_t value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -314,7 +314,7 @@ INLINE uint64_t DCPacker::
 unpack_uint64() {
 unpack_uint64() {
   uint64_t value = 0;
   uint64_t value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -329,11 +329,11 @@ unpack_uint64() {
 /**
 /**
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
-INLINE string DCPacker::
+INLINE std::string DCPacker::
 unpack_string() {
 unpack_string() {
-  string value;
+  std::string value;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -349,12 +349,12 @@ unpack_string() {
  * Returns the literal string that represents the packed value of the current
  * Returns the literal string that represents the packed value of the current
  * field, and advances the field pointer.
  * field, and advances the field pointer.
  */
  */
-INLINE string DCPacker::
+INLINE std::string DCPacker::
 unpack_literal_value() {
 unpack_literal_value() {
   size_t start = _unpack_p;
   size_t start = _unpack_p;
   unpack_skip();
   unpack_skip();
-  nassertr(_unpack_p >= start, string());
-  return string(_unpack_data + start, _unpack_p - start);
+  nassertr(_unpack_p >= start, std::string());
+  return std::string(_unpack_data + start, _unpack_p - start);
 }
 }
 
 
 /**
 /**
@@ -363,7 +363,7 @@ unpack_literal_value() {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_double(double &value) {
 unpack_double(double &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -379,7 +379,7 @@ unpack_double(double &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_int(int &value) {
 unpack_int(int &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -395,7 +395,7 @@ unpack_int(int &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_uint(unsigned int &value) {
 unpack_uint(unsigned int &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -411,7 +411,7 @@ unpack_uint(unsigned int &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_int64(int64_t &value) {
 unpack_int64(int64_t &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -427,7 +427,7 @@ unpack_int64(int64_t &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_uint64(uint64_t &value) {
 unpack_uint64(uint64_t &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -441,9 +441,9 @@ unpack_uint64(uint64_t &value) {
  * Unpacks the current numeric or string value from the stream.
  * Unpacks the current numeric or string value from the stream.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-unpack_string(string &value) {
+unpack_string(std::string &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -458,7 +458,7 @@ unpack_string(string &value) {
  * field, and advances the field pointer.
  * field, and advances the field pointer.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-unpack_literal_value(string &value) {
+unpack_literal_value(std::string &value) {
   size_t start = _unpack_p;
   size_t start = _unpack_p;
   unpack_skip();
   unpack_skip();
   nassertv(_unpack_p >= start);
   nassertv(_unpack_p >= start);
@@ -536,7 +536,7 @@ get_length() const {
 /**
 /**
  * Returns the packed data buffer as a string.  Also see get_data().
  * Returns the packed data buffer as a string.  Also see get_data().
  */
  */
-INLINE string DCPacker::
+INLINE std::string DCPacker::
 get_string() const {
 get_string() const {
   return _pack_data.get_string();
   return _pack_data.get_string();
 }
 }
@@ -556,16 +556,16 @@ get_unpack_length() const {
  * unpacking; it is separate from the pack data returned by get_string(),
  * unpacking; it is separate from the pack data returned by get_string(),
  * which is filled during packing.  Also see get_unpack_data().
  * which is filled during packing.  Also see get_unpack_data().
  */
  */
-INLINE string DCPacker::
+INLINE std::string DCPacker::
 get_unpack_string() const {
 get_unpack_string() const {
-  return string(_unpack_data, _unpack_length);
+  return std::string(_unpack_data, _unpack_length);
 }
 }
 
 
 /**
 /**
  * Copies the packed data into the indicated string.  Also see get_data().
  * Copies the packed data into the indicated string.  Also see get_data().
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-get_string(string &data) const {
+get_string(std::string &data) const {
   data.assign(_pack_data.get_data(), _pack_data.get_length());
   data.assign(_pack_data.get_data(), _pack_data.get_length());
 }
 }
 
 
@@ -613,7 +613,7 @@ append_data(const char *buffer, size_t size) {
  */
  */
 INLINE char *DCPacker::
 INLINE char *DCPacker::
 get_write_pointer(size_t size) {
 get_write_pointer(size_t size) {
-  nassertr(_mode == M_idle, NULL);
+  nassertr(_mode == M_idle, nullptr);
   return _pack_data.get_write_pointer(size);
   return _pack_data.get_write_pointer(size);
 }
 }
 
 
@@ -722,7 +722,7 @@ raw_pack_float64(double value) {
  * Packs the data into the buffer between packing sessions.
  * Packs the data into the buffer between packing sessions.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-raw_pack_string(const string &value) {
+raw_pack_string(const std::string &value) {
   nassertv(_mode == M_idle);
   nassertv(_mode == M_idle);
   DCPackerInterface::do_pack_uint16(_pack_data.get_write_pointer(2), value.length());
   DCPackerInterface::do_pack_uint16(_pack_data.get_write_pointer(2), value.length());
   _pack_data.append_data(value.data(), value.length());
   _pack_data.append_data(value.data(), value.length());
@@ -773,7 +773,7 @@ raw_unpack_int64() {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_int8(int &value) {
 raw_unpack_int8(int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 1 > _unpack_length) {
   if (_unpack_p + 1 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -787,7 +787,7 @@ raw_unpack_int8(int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_int16(int &value) {
 raw_unpack_int16(int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 2 > _unpack_length) {
   if (_unpack_p + 2 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -801,7 +801,7 @@ raw_unpack_int16(int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_int32(int &value) {
 raw_unpack_int32(int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 4 > _unpack_length) {
   if (_unpack_p + 4 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -863,9 +863,9 @@ raw_unpack_float64() {
 /**
 /**
  * Unpacks the data from the buffer between unpacking sessions.
  * Unpacks the data from the buffer between unpacking sessions.
  */
  */
-INLINE string DCPacker::
+INLINE std::string DCPacker::
 raw_unpack_string() {
 raw_unpack_string() {
-  string value;
+  std::string value;
   raw_unpack_string(value);
   raw_unpack_string(value);
   return value;
   return value;
 }
 }
@@ -875,7 +875,7 @@ raw_unpack_string() {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_int64(int64_t &value) {
 raw_unpack_int64(int64_t &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 8 > _unpack_length) {
   if (_unpack_p + 8 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -889,7 +889,7 @@ raw_unpack_int64(int64_t &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_uint8(unsigned int &value) {
 raw_unpack_uint8(unsigned int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 1 > _unpack_length) {
   if (_unpack_p + 1 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -903,7 +903,7 @@ raw_unpack_uint8(unsigned int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_uint16(unsigned int &value) {
 raw_unpack_uint16(unsigned int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 2 > _unpack_length) {
   if (_unpack_p + 2 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -917,7 +917,7 @@ raw_unpack_uint16(unsigned int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_uint32(unsigned int &value) {
 raw_unpack_uint32(unsigned int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 4 > _unpack_length) {
   if (_unpack_p + 4 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -931,7 +931,7 @@ raw_unpack_uint32(unsigned int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_uint64(uint64_t &value) {
 raw_unpack_uint64(uint64_t &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 8 > _unpack_length) {
   if (_unpack_p + 8 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -945,7 +945,7 @@ raw_unpack_uint64(uint64_t &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_float64(double &value) {
 raw_unpack_float64(double &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 8 > _unpack_length) {
   if (_unpack_p + 8 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -958,8 +958,8 @@ raw_unpack_float64(double &value) {
  * Unpacks the data from the buffer between unpacking sessions.
  * Unpacks the data from the buffer between unpacking sessions.
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
-raw_unpack_string(string &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+raw_unpack_string(std::string &value) {
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   unsigned int string_length = raw_unpack_uint16();
   unsigned int string_length = raw_unpack_uint16();
 
 
   if (_unpack_p + string_length > _unpack_length) {
   if (_unpack_p + string_length > _unpack_length) {
@@ -981,13 +981,13 @@ advance() {
       _current_field_index >= _num_nested_fields) {
       _current_field_index >= _num_nested_fields) {
     // Done with all the fields on this parent.  The caller must now call
     // Done with all the fields on this parent.  The caller must now call
     // pop().
     // pop().
-    _current_field = NULL;
+    _current_field = nullptr;
 
 
     // But if the parent is a switch record, we make a special case so we can
     // But if the parent is a switch record, we make a special case so we can
     // get the alternate fields.
     // get the alternate fields.
-    if (_current_parent != (DCPackerInterface *)NULL) {
+    if (_current_parent != nullptr) {
       const DCSwitchParameter *switch_parameter = ((DCPackerInterface *)_current_parent)->as_switch_parameter();
       const DCSwitchParameter *switch_parameter = ((DCPackerInterface *)_current_parent)->as_switch_parameter();
-      if (switch_parameter != (DCSwitchParameter *)NULL) {
+      if (switch_parameter != nullptr) {
         handle_switch(switch_parameter);
         handle_switch(switch_parameter);
       }
       }
     }
     }
@@ -995,7 +995,7 @@ advance() {
   } else if (_pop_marker != 0 && _unpack_p >= _pop_marker) {
   } else if (_pop_marker != 0 && _unpack_p >= _pop_marker) {
     // Done with all the fields on this parent.  The caller must now call
     // Done with all the fields on this parent.  The caller must now call
     // pop().
     // pop().
-    _current_field = NULL;
+    _current_field = nullptr;
 
 
   } else {
   } else {
     // We have another field to advance to.
     // We have another field to advance to.
@@ -1009,7 +1009,7 @@ advance() {
  */
  */
 INLINE void *DCPacker::StackElement::
 INLINE void *DCPacker::StackElement::
 operator new(size_t size) {
 operator new(size_t size) {
-  if (_deleted_chain != (DCPacker::StackElement *)NULL) {
+  if (_deleted_chain != nullptr) {
     StackElement *obj = _deleted_chain;
     StackElement *obj = _deleted_chain;
     _deleted_chain = _deleted_chain->_next;
     _deleted_chain = _deleted_chain->_next;
     return obj;
     return obj;

+ 74 - 74
direct/src/dcparser/dcPacker.cxx

@@ -23,7 +23,7 @@
 #include "py_panda.h"
 #include "py_panda.h"
 #endif
 #endif
 
 
-DCPacker::StackElement *DCPacker::StackElement::_deleted_chain = NULL;
+DCPacker::StackElement *DCPacker::StackElement::_deleted_chain = nullptr;
 int DCPacker::StackElement::_num_ever_allocated = 0;
 int DCPacker::StackElement::_num_ever_allocated = 0;
 
 
 /**
 /**
@@ -32,15 +32,15 @@ int DCPacker::StackElement::_num_ever_allocated = 0;
 DCPacker::
 DCPacker::
 DCPacker() {
 DCPacker() {
   _mode = M_idle;
   _mode = M_idle;
-  _unpack_data = NULL;
+  _unpack_data = nullptr;
   _unpack_length = 0;
   _unpack_length = 0;
   _owns_unpack_data = false;
   _owns_unpack_data = false;
   _unpack_p = 0;
   _unpack_p = 0;
-  _live_catalog = NULL;
+  _live_catalog = nullptr;
   _parse_error = false;
   _parse_error = false;
   _pack_error = false;
   _pack_error = false;
   _range_error = false;
   _range_error = false;
-  _stack = NULL;
+  _stack = nullptr;
 
 
   clear();
   clear();
 }
 }
@@ -73,11 +73,11 @@ begin_pack(const DCPackerInterface *root) {
   _range_error = false;
   _range_error = false;
 
 
   _root = root;
   _root = root;
-  _catalog = NULL;
-  _live_catalog = NULL;
+  _catalog = nullptr;
+  _live_catalog = nullptr;
 
 
   _current_field = root;
   _current_field = root;
-  _current_parent = NULL;
+  _current_parent = nullptr;
   _current_field_index = 0;
   _current_field_index = 0;
   _num_nested_fields = 0;
   _num_nested_fields = 0;
 }
 }
@@ -94,7 +94,7 @@ end_pack() {
 
 
   _mode = M_idle;
   _mode = M_idle;
 
 
-  if (_stack != NULL || _current_field != NULL || _current_parent != NULL) {
+  if (_stack != nullptr || _current_field != nullptr || _current_parent != nullptr) {
     _pack_error = true;
     _pack_error = true;
   }
   }
 
 
@@ -146,7 +146,7 @@ set_unpack_data(const char *unpack_data, size_t unpack_length,
 void DCPacker::
 void DCPacker::
 begin_unpack(const DCPackerInterface *root) {
 begin_unpack(const DCPackerInterface *root) {
   nassertv(_mode == M_idle);
   nassertv(_mode == M_idle);
-  nassertv(_unpack_data != NULL);
+  nassertv(_unpack_data != nullptr);
 
 
   _mode = M_unpack;
   _mode = M_unpack;
   _parse_error = false;
   _parse_error = false;
@@ -154,11 +154,11 @@ begin_unpack(const DCPackerInterface *root) {
   _range_error = false;
   _range_error = false;
 
 
   _root = root;
   _root = root;
-  _catalog = NULL;
-  _live_catalog = NULL;
+  _catalog = nullptr;
+  _live_catalog = nullptr;
 
 
   _current_field = root;
   _current_field = root;
-  _current_parent = NULL;
+  _current_parent = nullptr;
   _current_field_index = 0;
   _current_field_index = 0;
   _num_nested_fields = 0;
   _num_nested_fields = 0;
 }
 }
@@ -175,13 +175,13 @@ end_unpack() {
 
 
   _mode = M_idle;
   _mode = M_idle;
 
 
-  if (_stack != NULL || _current_field != NULL || _current_parent != NULL) {
+  if (_stack != nullptr || _current_field != nullptr || _current_parent != nullptr) {
     // This happens if we have not unpacked all of the fields.  However, this
     // This happens if we have not unpacked all of the fields.  However, this
     // is not an error if we have called seek() during the unpack session (in
     // is not an error if we have called seek() during the unpack session (in
     // which case the _catalog will be non-NULL).  On the other hand, if the
     // which case the _catalog will be non-NULL).  On the other hand, if the
     // catalog is still NULL, then we have never called seek() and it is an
     // catalog is still NULL, then we have never called seek() and it is an
     // error not to unpack all values.
     // error not to unpack all values.
-    if (_catalog == (DCPackerCatalog *)NULL) {
+    if (_catalog == nullptr) {
       _pack_error = true;
       _pack_error = true;
     }
     }
   }
   }
@@ -206,7 +206,7 @@ end_unpack() {
 void DCPacker::
 void DCPacker::
 begin_repack(const DCPackerInterface *root) {
 begin_repack(const DCPackerInterface *root) {
   nassertv(_mode == M_idle);
   nassertv(_mode == M_idle);
-  nassertv(_unpack_data != NULL);
+  nassertv(_unpack_data != nullptr);
   nassertv(_unpack_p == 0);
   nassertv(_unpack_p == 0);
 
 
   _mode = M_repack;
   _mode = M_repack;
@@ -220,14 +220,14 @@ begin_repack(const DCPackerInterface *root) {
   _root = root;
   _root = root;
   _catalog = _root->get_catalog();
   _catalog = _root->get_catalog();
   _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
   _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
-  if (_live_catalog == NULL) {
+  if (_live_catalog == nullptr) {
     _pack_error = true;
     _pack_error = true;
   }
   }
 
 
   // We don't begin at the first field in repack mode.  Instead, you must
   // We don't begin at the first field in repack mode.  Instead, you must
   // explicitly call seek().
   // explicitly call seek().
-  _current_field = NULL;
-  _current_parent = NULL;
+  _current_field = nullptr;
+  _current_parent = nullptr;
   _current_field_index = 0;
   _current_field_index = 0;
   _num_nested_fields = 0;
   _num_nested_fields = 0;
 }
 }
@@ -262,12 +262,12 @@ end_repack() {
  */
  */
 bool DCPacker::
 bool DCPacker::
 seek(const string &field_name) {
 seek(const string &field_name) {
-  if (_catalog == (DCPackerCatalog *)NULL) {
+  if (_catalog == nullptr) {
     _catalog = _root->get_catalog();
     _catalog = _root->get_catalog();
     _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
     _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
   }
   }
-  nassertr(_catalog != (DCPackerCatalog *)NULL, false);
-  if (_live_catalog == NULL) {
+  nassertr(_catalog != nullptr, false);
+  if (_live_catalog == nullptr) {
     _pack_error = true;
     _pack_error = true;
     return false;
     return false;
   }
   }
@@ -292,12 +292,12 @@ seek(const string &field_name) {
  */
  */
 bool DCPacker::
 bool DCPacker::
 seek(int seek_index) {
 seek(int seek_index) {
-  if (_catalog == (DCPackerCatalog *)NULL) {
+  if (_catalog == nullptr) {
     _catalog = _root->get_catalog();
     _catalog = _root->get_catalog();
     _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
     _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
   }
   }
-  nassertr(_catalog != (DCPackerCatalog *)NULL, false);
-  if (_live_catalog == NULL) {
+  nassertr(_catalog != nullptr, false);
+  if (_live_catalog == nullptr) {
     _pack_error = true;
     _pack_error = true;
     return false;
     return false;
   }
   }
@@ -324,9 +324,9 @@ seek(int seek_index) {
     return true;
     return true;
 
 
   } else if (_mode == M_repack) {
   } else if (_mode == M_repack) {
-    nassertr(_catalog != (DCPackerCatalog *)NULL, false);
+    nassertr(_catalog != nullptr, false);
 
 
-    if (_stack != NULL || _current_field != NULL) {
+    if (_stack != nullptr || _current_field != nullptr) {
       // It is an error to reseek while the stack is nonempty--that means we
       // It is an error to reseek while the stack is nonempty--that means we
       // haven't finished packing the current field.
       // haven't finished packing the current field.
       _pack_error = true;
       _pack_error = true;
@@ -334,7 +334,7 @@ seek(int seek_index) {
     }
     }
     const DCPackerCatalog::Entry &entry = _live_catalog->get_entry(seek_index);
     const DCPackerCatalog::Entry &entry = _live_catalog->get_entry(seek_index);
 
 
-    if (entry._parent->as_switch_parameter() != (DCSwitchParameter *)NULL) {
+    if (entry._parent->as_switch_parameter() != nullptr) {
       // If the parent is a DCSwitch, that can only mean that the seeked field
       // If the parent is a DCSwitch, that can only mean that the seeked field
       // is a switch parameter.  We can't support seeking to a switch
       // is a switch parameter.  We can't support seeking to a switch
       // parameter and modifying it directly--what would happen to all of the
       // parameter and modifying it directly--what would happen to all of the
@@ -357,7 +357,7 @@ seek(int seek_index) {
       _catalog->release_live_catalog(_live_catalog);
       _catalog->release_live_catalog(_live_catalog);
       _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
       _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
 
 
-      if (_live_catalog == NULL) {
+      if (_live_catalog == nullptr) {
         _pack_error = true;
         _pack_error = true;
         return false;
         return false;
       }
       }
@@ -470,7 +470,7 @@ push() {
 
 
     if (_num_nested_fields >= 0 &&
     if (_num_nested_fields >= 0 &&
         _current_field_index >= _num_nested_fields) {
         _current_field_index >= _num_nested_fields) {
-      _current_field = NULL;
+      _current_field = nullptr;
 
 
     } else {
     } else {
       _current_field = _current_parent->get_nested_field(_current_field_index);
       _current_field = _current_parent->get_nested_field(_current_field_index);
@@ -487,7 +487,7 @@ push() {
  */
  */
 void DCPacker::
 void DCPacker::
 pop() {
 pop() {
-  if (_current_field != NULL && _num_nested_fields >= 0) {
+  if (_current_field != nullptr && _num_nested_fields >= 0) {
     // Oops, didn't pack or unpack enough values.
     // Oops, didn't pack or unpack enough values.
     _pack_error = true;
     _pack_error = true;
 
 
@@ -497,7 +497,7 @@ pop() {
     _pack_error = true;
     _pack_error = true;
   }
   }
 
 
-  if (_stack == NULL) {
+  if (_stack == nullptr) {
     // Unbalanced pop().
     // Unbalanced pop().
     _pack_error = true;
     _pack_error = true;
 
 
@@ -528,7 +528,7 @@ pop() {
     _current_field_index = _stack->_current_field_index;
     _current_field_index = _stack->_current_field_index;
     _push_marker = _stack->_push_marker;
     _push_marker = _stack->_push_marker;
     _pop_marker = _stack->_pop_marker;
     _pop_marker = _stack->_pop_marker;
-    _num_nested_fields = (_current_parent == NULL) ? 0 : _current_parent->get_num_nested_fields();
+    _num_nested_fields = (_current_parent == nullptr) ? 0 : _current_parent->get_num_nested_fields();
 
 
     StackElement *next = _stack->_next;
     StackElement *next = _stack->_next;
     delete _stack;
     delete _stack;
@@ -545,7 +545,7 @@ pop() {
 void DCPacker::
 void DCPacker::
 pack_default_value() {
 pack_default_value() {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     if (_current_field->pack_default_value(_pack_data, _pack_error)) {
     if (_current_field->pack_default_value(_pack_data, _pack_error)) {
@@ -571,7 +571,7 @@ pack_default_value() {
 void DCPacker::
 void DCPacker::
 unpack_validate() {
 unpack_validate() {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -597,7 +597,7 @@ unpack_validate() {
 void DCPacker::
 void DCPacker::
 unpack_skip() {
 unpack_skip() {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -739,11 +739,11 @@ pack_object(PyObject *object) {
       (PyObject_HasAttrString(object, "__len__") != 0);
       (PyObject_HasAttrString(object, "__len__") != 0);
     bool is_instance = false;
     bool is_instance = false;
 
 
-    const DCClass *dclass = NULL;
+    const DCClass *dclass = nullptr;
     const DCPackerInterface *current_field = get_current_field();
     const DCPackerInterface *current_field = get_current_field();
-    if (current_field != (DCPackerInterface *)NULL) {
+    if (current_field != nullptr) {
       const DCClassParameter *class_param = get_current_field()->as_class_parameter();
       const DCClassParameter *class_param = get_current_field()->as_class_parameter();
-      if (class_param != (DCClassParameter *)NULL) {
+      if (class_param != nullptr) {
         dclass = class_param->get_class();
         dclass = class_param->get_class();
 
 
         if (dclass->has_class_def()) {
         if (dclass->has_class_def()) {
@@ -771,7 +771,7 @@ pack_object(PyObject *object) {
 
 
     // (3) Otherwise, it is considered to be a class object.
     // (3) Otherwise, it is considered to be a class object.
 
 
-    if (dclass != (DCClass *)NULL && (is_instance || !is_sequence)) {
+    if (dclass != nullptr && (is_instance || !is_sequence)) {
       // The supplied object is either an instance of the expected class
       // The supplied object is either an instance of the expected class
       // object, or it is not a sequence--this is case (1) or (3).
       // object, or it is not a sequence--this is case (1) or (3).
       pack_class_object(dclass, object);
       pack_class_object(dclass, object);
@@ -782,7 +782,7 @@ pack_object(PyObject *object) {
       int size = PySequence_Size(object);
       int size = PySequence_Size(object);
       for (int i = 0; i < size; ++i) {
       for (int i = 0; i < size; ++i) {
         PyObject *element = PySequence_GetItem(object, i);
         PyObject *element = PySequence_GetItem(object, i);
-        if (element != (PyObject *)NULL) {
+        if (element != nullptr) {
           pack_object(element);
           pack_object(element);
           Py_DECREF(element);
           Py_DECREF(element);
         } else {
         } else {
@@ -812,7 +812,7 @@ pack_object(PyObject *object) {
  */
  */
 PyObject *DCPacker::
 PyObject *DCPacker::
 unpack_object() {
 unpack_object() {
-  PyObject *object = NULL;
+  PyObject *object = nullptr;
 
 
   DCPackType pack_type = get_pack_type();
   DCPackType pack_type = get_pack_type();
 
 
@@ -896,13 +896,13 @@ unpack_object() {
   case PT_class:
   case PT_class:
     {
     {
       const DCClassParameter *class_param = get_current_field()->as_class_parameter();
       const DCClassParameter *class_param = get_current_field()->as_class_parameter();
-      if (class_param != (DCClassParameter *)NULL) {
+      if (class_param != nullptr) {
         const DCClass *dclass = class_param->get_class();
         const DCClass *dclass = class_param->get_class();
         if (dclass->has_class_def()) {
         if (dclass->has_class_def()) {
           // If we know what kind of class object this is and it has a valid
           // If we know what kind of class object this is and it has a valid
           // constructor, create the class object instead of just a tuple.
           // constructor, create the class object instead of just a tuple.
           object = unpack_class_object(dclass);
           object = unpack_class_object(dclass);
-          if (object == (PyObject *)NULL) {
+          if (object == nullptr) {
             cerr << "Unable to construct object of class "
             cerr << "Unable to construct object of class "
                  << dclass->get_name() << "\n";
                  << dclass->get_name() << "\n";
           } else {
           } else {
@@ -939,7 +939,7 @@ unpack_object() {
     break;
     break;
   }
   }
 
 
-  nassertr(object != (PyObject *)NULL, NULL);
+  nassertr(object != nullptr, nullptr);
   return object;
   return object;
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
@@ -995,10 +995,10 @@ unpack_and_format(ostream &out, bool show_field_names) {
   DCPackType pack_type = get_pack_type();
   DCPackType pack_type = get_pack_type();
 
 
   if (show_field_names && !get_current_field_name().empty()) {
   if (show_field_names && !get_current_field_name().empty()) {
-    nassertv(_current_field != (DCPackerInterface *)NULL);
+    nassertv(_current_field != nullptr);
     const DCField *field = _current_field->as_field();
     const DCField *field = _current_field->as_field();
-    if (field != (DCField *)NULL &&
-        field->as_parameter() != (DCParameter *)NULL) {
+    if (field != nullptr &&
+        field->as_parameter() != nullptr) {
       out << field->get_name() << " = ";
       out << field->get_name() << " = ";
     }
     }
   }
   }
@@ -1135,7 +1135,7 @@ void DCPacker::
 handle_switch(const DCSwitchParameter *switch_parameter) {
 handle_switch(const DCSwitchParameter *switch_parameter) {
   // First, get the value from the key.  This is either found in the unpack or
   // First, get the value from the key.  This is either found in the unpack or
   // the pack data, depending on what mode we're in.
   // the pack data, depending on what mode we're in.
-  const DCPackerInterface *new_parent = NULL;
+  const DCPackerInterface *new_parent = nullptr;
 
 
   if (_mode == M_pack || _mode == M_repack) {
   if (_mode == M_pack || _mode == M_repack) {
     const char *data = _pack_data.get_data();
     const char *data = _pack_data.get_data();
@@ -1147,7 +1147,7 @@ handle_switch(const DCSwitchParameter *switch_parameter) {
       (_unpack_data + _push_marker, _unpack_p - _push_marker);
       (_unpack_data + _push_marker, _unpack_p - _push_marker);
   }
   }
 
 
-  if (new_parent == (DCPackerInterface *)NULL) {
+  if (new_parent == nullptr) {
     // This means an invalid value was packed for the key.
     // This means an invalid value was packed for the key.
     _range_error = true;
     _range_error = true;
     return;
     return;
@@ -1173,20 +1173,20 @@ handle_switch(const DCSwitchParameter *switch_parameter) {
 void DCPacker::
 void DCPacker::
 clear() {
 clear() {
   clear_stack();
   clear_stack();
-  _current_field = NULL;
-  _current_parent = NULL;
+  _current_field = nullptr;
+  _current_parent = nullptr;
   _current_field_index = 0;
   _current_field_index = 0;
   _num_nested_fields = 0;
   _num_nested_fields = 0;
   _push_marker = 0;
   _push_marker = 0;
   _pop_marker = 0;
   _pop_marker = 0;
-  _last_switch = NULL;
+  _last_switch = nullptr;
 
 
-  if (_live_catalog != (DCPackerCatalog::LiveCatalog *)NULL) {
+  if (_live_catalog != nullptr) {
     _catalog->release_live_catalog(_live_catalog);
     _catalog->release_live_catalog(_live_catalog);
-    _live_catalog = NULL;
+    _live_catalog = nullptr;
   }
   }
-  _catalog = NULL;
-  _root = NULL;
+  _catalog = nullptr;
+  _root = nullptr;
 }
 }
 
 
 /**
 /**
@@ -1194,7 +1194,7 @@ clear() {
  */
  */
 void DCPacker::
 void DCPacker::
 clear_stack() {
 clear_stack() {
-  while (_stack != (StackElement *)NULL) {
+  while (_stack != nullptr) {
     StackElement *next = _stack->_next;
     StackElement *next = _stack->_next;
     delete _stack;
     delete _stack;
     _stack = next;
     _stack = next;
@@ -1212,7 +1212,7 @@ pack_class_object(const DCClass *dclass, PyObject *object) {
   push();
   push();
   while (more_nested_fields() && !_pack_error) {
   while (more_nested_fields() && !_pack_error) {
     const DCField *field = get_current_field()->as_field();
     const DCField *field = get_current_field()->as_field();
-    nassertv(field != (DCField *)NULL);
+    nassertv(field != nullptr);
     get_class_element(dclass, object, field);
     get_class_element(dclass, object, field);
   }
   }
   pop();
   pop();
@@ -1227,36 +1227,36 @@ pack_class_object(const DCClass *dclass, PyObject *object) {
 PyObject *DCPacker::
 PyObject *DCPacker::
 unpack_class_object(const DCClass *dclass) {
 unpack_class_object(const DCClass *dclass) {
   PyObject *class_def = dclass->get_class_def();
   PyObject *class_def = dclass->get_class_def();
-  nassertr(class_def != (PyObject *)NULL, NULL);
+  nassertr(class_def != nullptr, nullptr);
 
 
-  PyObject *object = NULL;
+  PyObject *object = nullptr;
 
 
   if (!dclass->has_constructor()) {
   if (!dclass->has_constructor()) {
     // If the class uses a default constructor, go ahead and create the Python
     // If the class uses a default constructor, go ahead and create the Python
     // object for it now.
     // object for it now.
-    object = PyObject_CallObject(class_def, NULL);
-    if (object == (PyObject *)NULL) {
-      return NULL;
+    object = PyObject_CallObject(class_def, nullptr);
+    if (object == nullptr) {
+      return nullptr;
     }
     }
   }
   }
 
 
   push();
   push();
-  if (object == (PyObject *)NULL && more_nested_fields()) {
+  if (object == nullptr && more_nested_fields()) {
     // The first nested field will be the constructor.
     // The first nested field will be the constructor.
     const DCField *field = get_current_field()->as_field();
     const DCField *field = get_current_field()->as_field();
-    nassertr(field != (DCField *)NULL, object);
+    nassertr(field != nullptr, object);
     nassertr(field == dclass->get_constructor(), object);
     nassertr(field == dclass->get_constructor(), object);
 
 
     set_class_element(class_def, object, field);
     set_class_element(class_def, object, field);
 
 
     // By now, the object should have been constructed.
     // By now, the object should have been constructed.
-    if (object == (PyObject *)NULL) {
-      return NULL;
+    if (object == nullptr) {
+      return nullptr;
     }
     }
   }
   }
   while (more_nested_fields()) {
   while (more_nested_fields()) {
     const DCField *field = get_current_field()->as_field();
     const DCField *field = get_current_field()->as_field();
-    nassertr(field != (DCField *)NULL, object);
+    nassertr(field != nullptr, object);
 
 
     set_class_element(class_def, object, field);
     set_class_element(class_def, object, field);
   }
   }
@@ -1287,8 +1287,8 @@ set_class_element(PyObject *class_def, PyObject *&object,
       push();
       push();
       while (more_nested_fields()) {
       while (more_nested_fields()) {
         const DCField *field = get_current_field()->as_field();
         const DCField *field = get_current_field()->as_field();
-        nassertv(field != (DCField *)NULL);
-        nassertv(object != (PyObject *)NULL);
+        nassertv(field != nullptr);
+        nassertv(object != nullptr);
         set_class_element(class_def, object, field);
         set_class_element(class_def, object, field);
       }
       }
       pop();
       pop();
@@ -1307,7 +1307,7 @@ set_class_element(PyObject *class_def, PyObject *&object,
     PyObject *element = unpack_object();
     PyObject *element = unpack_object();
 
 
     if (pack_type == PT_field) {
     if (pack_type == PT_field) {
-      if (object == (PyObject *)NULL) {
+      if (object == nullptr) {
         // If the object hasn't been constructed yet, assume this is the
         // If the object hasn't been constructed yet, assume this is the
         // constructor.
         // constructor.
         object = PyObject_CallObject(class_def, element);
         object = PyObject_CallObject(class_def, element);
@@ -1315,7 +1315,7 @@ set_class_element(PyObject *class_def, PyObject *&object,
       } else {
       } else {
         if (PyObject_HasAttrString(object, (char *)field_name.c_str())) {
         if (PyObject_HasAttrString(object, (char *)field_name.c_str())) {
           PyObject *func = PyObject_GetAttrString(object, (char *)field_name.c_str());
           PyObject *func = PyObject_GetAttrString(object, (char *)field_name.c_str());
-          if (func != (PyObject *)NULL) {
+          if (func != nullptr) {
             PyObject *result = PyObject_CallObject(func, element);
             PyObject *result = PyObject_CallObject(func, element);
             Py_XDECREF(result);
             Py_XDECREF(result);
             Py_DECREF(func);
             Py_DECREF(func);
@@ -1324,7 +1324,7 @@ set_class_element(PyObject *class_def, PyObject *&object,
       }
       }
 
 
     } else {
     } else {
-      nassertv(object != (PyObject *)NULL);
+      nassertv(object != nullptr);
       PyObject_SetAttrString(object, (char *)field_name.c_str(), element);
       PyObject_SetAttrString(object, (char *)field_name.c_str(), element);
     }
     }
 
 
@@ -1353,7 +1353,7 @@ get_class_element(const DCClass *dclass, PyObject *object,
       push();
       push();
       while (more_nested_fields() && !_pack_error) {
       while (more_nested_fields() && !_pack_error) {
         const DCField *field = get_current_field()->as_field();
         const DCField *field = get_current_field()->as_field();
-        nassertv(field != (DCField *)NULL);
+        nassertv(field != nullptr);
         get_class_element(dclass, object, field);
         get_class_element(dclass, object, field);
       }
       }
       pop();
       pop();

+ 21 - 21
direct/src/dcparser/dcPacker.h

@@ -41,7 +41,7 @@ PUBLISHED:
   void begin_pack(const DCPackerInterface *root);
   void begin_pack(const DCPackerInterface *root);
   bool end_pack();
   bool end_pack();
 
 
-  void set_unpack_data(const string &data);
+  void set_unpack_data(const std::string &data);
 public:
 public:
   void set_unpack_data(const char *unpack_data, size_t unpack_length,
   void set_unpack_data(const char *unpack_data, size_t unpack_length,
                        bool owns_unpack_data);
                        bool owns_unpack_data);
@@ -53,7 +53,7 @@ PUBLISHED:
   void begin_repack(const DCPackerInterface *root);
   void begin_repack(const DCPackerInterface *root);
   bool end_repack();
   bool end_repack();
 
 
-  bool seek(const string &field_name);
+  bool seek(const std::string &field_name);
   bool seek(int seek_index);
   bool seek(int seek_index);
 
 
   INLINE bool has_nested_fields() const;
   INLINE bool has_nested_fields() const;
@@ -64,7 +64,7 @@ PUBLISHED:
   INLINE const DCPackerInterface *get_current_field() const;
   INLINE const DCPackerInterface *get_current_field() const;
   INLINE const DCSwitchParameter *get_last_switch() const;
   INLINE const DCSwitchParameter *get_last_switch() const;
   INLINE DCPackType get_pack_type() const;
   INLINE DCPackType get_pack_type() const;
-  INLINE string get_current_field_name() const;
+  INLINE std::string get_current_field_name() const;
 
 
   void push();
   void push();
   void pop();
   void pop();
@@ -74,8 +74,8 @@ PUBLISHED:
   INLINE void pack_uint(unsigned int value);
   INLINE void pack_uint(unsigned int value);
   INLINE void pack_int64(int64_t value);
   INLINE void pack_int64(int64_t value);
   INLINE void pack_uint64(uint64_t value);
   INLINE void pack_uint64(uint64_t value);
-  INLINE void pack_string(const string &value);
-  INLINE void pack_literal_value(const string &value);
+  INLINE void pack_string(const std::string &value);
+  INLINE void pack_literal_value(const std::string &value);
   void pack_default_value();
   void pack_default_value();
 
 
   INLINE double unpack_double();
   INLINE double unpack_double();
@@ -83,8 +83,8 @@ PUBLISHED:
   INLINE unsigned int unpack_uint();
   INLINE unsigned int unpack_uint();
   INLINE int64_t unpack_int64();
   INLINE int64_t unpack_int64();
   INLINE uint64_t unpack_uint64();
   INLINE uint64_t unpack_uint64();
-  INLINE string unpack_string();
-  INLINE string unpack_literal_value();
+  INLINE std::string unpack_string();
+  INLINE std::string unpack_literal_value();
   void unpack_validate();
   void unpack_validate();
   void unpack_skip();
   void unpack_skip();
 
 
@@ -96,8 +96,8 @@ public:
   INLINE void unpack_uint(unsigned int &value);
   INLINE void unpack_uint(unsigned int &value);
   INLINE void unpack_int64(int64_t &value);
   INLINE void unpack_int64(int64_t &value);
   INLINE void unpack_uint64(uint64_t &value);
   INLINE void unpack_uint64(uint64_t &value);
-  INLINE void unpack_string(string &value);
-  INLINE void unpack_literal_value(string &value);
+  INLINE void unpack_string(std::string &value);
+  INLINE void unpack_literal_value(std::string &value);
 
 
 PUBLISHED:
 PUBLISHED:
 
 
@@ -106,10 +106,10 @@ PUBLISHED:
   PyObject *unpack_object();
   PyObject *unpack_object();
 #endif
 #endif
 
 
-  bool parse_and_pack(const string &formatted_object);
-  bool parse_and_pack(istream &in);
-  string unpack_and_format(bool show_field_names = true);
-  void unpack_and_format(ostream &out, bool show_field_names = true);
+  bool parse_and_pack(const std::string &formatted_object);
+  bool parse_and_pack(std::istream &in);
+  std::string unpack_and_format(bool show_field_names = true);
+  void unpack_and_format(std::ostream &out, bool show_field_names = true);
 
 
   INLINE bool had_parse_error() const;
   INLINE bool had_parse_error() const;
   INLINE bool had_pack_error() const;
   INLINE bool had_pack_error() const;
@@ -118,11 +118,11 @@ PUBLISHED:
   INLINE size_t get_num_unpacked_bytes() const;
   INLINE size_t get_num_unpacked_bytes() const;
 
 
   INLINE size_t get_length() const;
   INLINE size_t get_length() const;
-  INLINE string get_string() const;
+  INLINE std::string get_string() const;
   INLINE size_t get_unpack_length() const;
   INLINE size_t get_unpack_length() const;
-  INLINE string get_unpack_string() const;
+  INLINE std::string get_unpack_string() const;
 public:
 public:
-  INLINE void get_string(string &data) const;
+  INLINE void get_string(std::string &data) const;
   INLINE const char *get_data() const;
   INLINE const char *get_data() const;
   INLINE char *take_data();
   INLINE char *take_data();
 
 
@@ -147,7 +147,7 @@ PUBLISHED:
   INLINE void raw_pack_uint32(unsigned int value);
   INLINE void raw_pack_uint32(unsigned int value);
   INLINE void raw_pack_uint64(uint64_t value);
   INLINE void raw_pack_uint64(uint64_t value);
   INLINE void raw_pack_float64(double value);
   INLINE void raw_pack_float64(double value);
-  INLINE void raw_pack_string(const string &value);
+  INLINE void raw_pack_string(const std::string &value);
 
 
 // this is a hack to allw me to get in and out of 32bit Mode Faster need to
 // this is a hack to allw me to get in and out of 32bit Mode Faster need to
 // agree with channel_type in dcbase.h
 // agree with channel_type in dcbase.h
@@ -164,7 +164,7 @@ PUBLISHED:
   INLINE unsigned int raw_unpack_uint32();
   INLINE unsigned int raw_unpack_uint32();
   INLINE uint64_t raw_unpack_uint64();
   INLINE uint64_t raw_unpack_uint64();
   INLINE double raw_unpack_float64();
   INLINE double raw_unpack_float64();
-  INLINE string raw_unpack_string();
+  INLINE std::string raw_unpack_string();
 
 
 public:
 public:
   INLINE void raw_unpack_int8(int &value);
   INLINE void raw_unpack_int8(int &value);
@@ -176,11 +176,11 @@ public:
   INLINE void raw_unpack_uint32(unsigned int &value);
   INLINE void raw_unpack_uint32(unsigned int &value);
   INLINE void raw_unpack_uint64(uint64_t &value);
   INLINE void raw_unpack_uint64(uint64_t &value);
   INLINE void raw_unpack_float64(double &value);
   INLINE void raw_unpack_float64(double &value);
-  INLINE void raw_unpack_string(string &value);
+  INLINE void raw_unpack_string(std::string &value);
 
 
 public:
 public:
-  static void enquote_string(ostream &out, char quote_mark, const string &str);
-  static void output_hex_string(ostream &out, const string &str);
+  static void enquote_string(std::ostream &out, char quote_mark, const std::string &str);
+  static void output_hex_string(std::ostream &out, const std::string &str);
 
 
 private:
 private:
   INLINE void advance();
   INLINE void advance();

+ 1 - 1
direct/src/dcparser/dcPackerCatalog.I

@@ -52,7 +52,7 @@ get_entry(int n) const {
  * get_entry().
  * get_entry().
  */
  */
 int DCPackerCatalog::LiveCatalog::
 int DCPackerCatalog::LiveCatalog::
-find_entry_by_name(const string &name) const {
+find_entry_by_name(const std::string &name) const {
   return _catalog->find_entry_by_name(name);
   return _catalog->find_entry_by_name(name);
 }
 }
 
 

+ 12 - 12
direct/src/dcparser/dcPackerCatalog.cxx

@@ -21,7 +21,7 @@
  */
  */
 DCPackerCatalog::
 DCPackerCatalog::
 DCPackerCatalog(const DCPackerInterface *root) : _root(root) {
 DCPackerCatalog(const DCPackerInterface *root) : _root(root) {
-  _live_catalog = NULL;
+  _live_catalog = nullptr;
 }
 }
 
 
 /**
 /**
@@ -34,7 +34,7 @@ DCPackerCatalog(const DCPackerCatalog &copy) :
   _entries_by_name(copy._entries_by_name),
   _entries_by_name(copy._entries_by_name),
   _entries_by_field(copy._entries_by_field)
   _entries_by_field(copy._entries_by_field)
 {
 {
-  _live_catalog = NULL;
+  _live_catalog = nullptr;
 }
 }
 
 
 /**
 /**
@@ -42,7 +42,7 @@ DCPackerCatalog(const DCPackerCatalog &copy) :
  */
  */
 DCPackerCatalog::
 DCPackerCatalog::
 ~DCPackerCatalog() {
 ~DCPackerCatalog() {
-  if (_live_catalog != (LiveCatalog *)NULL) {
+  if (_live_catalog != nullptr) {
     delete _live_catalog;
     delete _live_catalog;
   }
   }
 
 
@@ -92,7 +92,7 @@ find_entry_by_field(const DCPackerInterface *field) const {
  */
  */
 const DCPackerCatalog::LiveCatalog *DCPackerCatalog::
 const DCPackerCatalog::LiveCatalog *DCPackerCatalog::
 get_live_catalog(const char *data, size_t length) const {
 get_live_catalog(const char *data, size_t length) const {
-  if (_live_catalog != (LiveCatalog *)NULL) {
+  if (_live_catalog != nullptr) {
     // Return the previously-allocated live catalog; it will be the same as
     // Return the previously-allocated live catalog; it will be the same as
     // this one since it's based on a fixed-length field.
     // this one since it's based on a fixed-length field.
     return _live_catalog;
     return _live_catalog;
@@ -111,13 +111,13 @@ get_live_catalog(const char *data, size_t length) const {
   DCPacker packer;
   DCPacker packer;
   packer.set_unpack_data(data, length, false);
   packer.set_unpack_data(data, length, false);
   packer.begin_unpack(_root);
   packer.begin_unpack(_root);
-  const DCSwitchParameter *last_switch = NULL;
+  const DCSwitchParameter *last_switch = nullptr;
   r_fill_live_catalog(live_catalog, packer, last_switch);
   r_fill_live_catalog(live_catalog, packer, last_switch);
   bool okflag = packer.end_unpack();
   bool okflag = packer.end_unpack();
 
 
   if (!okflag) {
   if (!okflag) {
     delete live_catalog;
     delete live_catalog;
-    return NULL;
+    return nullptr;
   }
   }
 
 
   if (_root->has_fixed_structure()) {
   if (_root->has_fixed_structure()) {
@@ -188,7 +188,7 @@ r_fill_catalog(const string &name_prefix, const DCPackerInterface *field,
                const DCPackerInterface *parent, int field_index) {
                const DCPackerInterface *parent, int field_index) {
   string next_name_prefix = name_prefix;
   string next_name_prefix = name_prefix;
 
 
-  if (parent != (const DCPackerInterface *)NULL && !field->get_name().empty()) {
+  if (parent != nullptr && !field->get_name().empty()) {
     // Record this entry in the catalog.
     // Record this entry in the catalog.
     next_name_prefix += field->get_name();
     next_name_prefix += field->get_name();
     add_entry(next_name_prefix, field, parent, field_index);
     add_entry(next_name_prefix, field, parent, field_index);
@@ -197,7 +197,7 @@ r_fill_catalog(const string &name_prefix, const DCPackerInterface *field,
   }
   }
 
 
   const DCSwitchParameter *switch_parameter = field->as_switch_parameter();
   const DCSwitchParameter *switch_parameter = field->as_switch_parameter();
-  if (switch_parameter != (DCSwitchParameter *)NULL) {
+  if (switch_parameter != nullptr) {
     // If we come upon a DCSwitch while building the catalog, save the
     // If we come upon a DCSwitch while building the catalog, save the
     // name_prefix at this point so we'll have it again when we later
     // name_prefix at this point so we'll have it again when we later
     // encounter the switch while unpacking a live record (and so we can
     // encounter the switch while unpacking a live record (and so we can
@@ -211,7 +211,7 @@ r_fill_catalog(const string &name_prefix, const DCPackerInterface *field,
     // It's ok if num_nested is -1.
     // It's ok if num_nested is -1.
     for (int i = 0; i < num_nested; i++) {
     for (int i = 0; i < num_nested; i++) {
       DCPackerInterface *nested = field->get_nested_field(i);
       DCPackerInterface *nested = field->get_nested_field(i);
-      if (nested != (DCPackerInterface *)NULL) {
+      if (nested != nullptr) {
         r_fill_catalog(next_name_prefix, nested, field, i);
         r_fill_catalog(next_name_prefix, nested, field, i);
       }
       }
     }
     }
@@ -255,10 +255,10 @@ r_fill_live_catalog(LiveCatalog *live_catalog, DCPacker &packer,
     last_switch = packer.get_last_switch();
     last_switch = packer.get_last_switch();
 
 
     const DCPackerInterface *switch_case = packer.get_current_parent();
     const DCPackerInterface *switch_case = packer.get_current_parent();
-    nassertv(switch_case != (DCPackerInterface *)NULL);
+    nassertv(switch_case != nullptr);
     const DCPackerCatalog *switch_catalog =
     const DCPackerCatalog *switch_catalog =
       live_catalog->_catalog->update_switch_fields(last_switch, switch_case);
       live_catalog->_catalog->update_switch_fields(last_switch, switch_case);
-    nassertv(switch_catalog != (DCPackerCatalog *)NULL);
+    nassertv(switch_catalog != nullptr);
     live_catalog->_catalog = switch_catalog;
     live_catalog->_catalog = switch_catalog;
 
 
     // And we also have to expand the live catalog to hold the new entries.
     // And we also have to expand the live catalog to hold the new entries.
@@ -317,7 +317,7 @@ update_switch_fields(const DCSwitchParameter *switch_parameter,
   int num_nested = switch_case->get_num_nested_fields();
   int num_nested = switch_case->get_num_nested_fields();
   for (int i = 1; i < num_nested; i++) {
   for (int i = 1; i < num_nested; i++) {
     DCPackerInterface *nested = switch_case->get_nested_field(i);
     DCPackerInterface *nested = switch_case->get_nested_field(i);
-    if (nested != (DCPackerInterface *)NULL) {
+    if (nested != nullptr) {
       switch_catalog->r_fill_catalog(name_prefix, nested, switch_case, i);
       switch_catalog->r_fill_catalog(name_prefix, nested, switch_case, i);
     }
     }
   }
   }

+ 7 - 7
direct/src/dcparser/dcPackerCatalog.h

@@ -37,7 +37,7 @@ public:
   // and its relationship to its parent.
   // and its relationship to its parent.
   class Entry {
   class Entry {
   public:
   public:
-    string _name;
+    std::string _name;
     const DCPackerInterface *_field;
     const DCPackerInterface *_field;
     const DCPackerInterface *_parent;
     const DCPackerInterface *_parent;
     int _field_index;
     int _field_index;
@@ -58,7 +58,7 @@ public:
 
 
     INLINE int get_num_entries() const;
     INLINE int get_num_entries() const;
     INLINE const Entry &get_entry(int n) const;
     INLINE const Entry &get_entry(int n) const;
-    INLINE int find_entry_by_name(const string &name) const;
+    INLINE int find_entry_by_name(const std::string &name) const;
     INLINE int find_entry_by_field(const DCPackerInterface *field) const;
     INLINE int find_entry_by_field(const DCPackerInterface *field) const;
 
 
   private:
   private:
@@ -71,17 +71,17 @@ public:
 
 
   INLINE int get_num_entries() const;
   INLINE int get_num_entries() const;
   INLINE const Entry &get_entry(int n) const;
   INLINE const Entry &get_entry(int n) const;
-  int find_entry_by_name(const string &name) const;
+  int find_entry_by_name(const std::string &name) const;
   int find_entry_by_field(const DCPackerInterface *field) const;
   int find_entry_by_field(const DCPackerInterface *field) const;
 
 
   const LiveCatalog *get_live_catalog(const char *data, size_t length) const;
   const LiveCatalog *get_live_catalog(const char *data, size_t length) const;
   void release_live_catalog(const LiveCatalog *live_catalog) const;
   void release_live_catalog(const LiveCatalog *live_catalog) const;
 
 
 private:
 private:
-  void add_entry(const string &name, const DCPackerInterface *field,
+  void add_entry(const std::string &name, const DCPackerInterface *field,
                  const DCPackerInterface *parent, int field_index);
                  const DCPackerInterface *parent, int field_index);
 
 
-  void r_fill_catalog(const string &name_prefix, const DCPackerInterface *field,
+  void r_fill_catalog(const std::string &name_prefix, const DCPackerInterface *field,
                       const DCPackerInterface *parent, int field_index);
                       const DCPackerInterface *parent, int field_index);
   void r_fill_live_catalog(LiveCatalog *live_catalog, DCPacker &packer,
   void r_fill_live_catalog(LiveCatalog *live_catalog, DCPacker &packer,
                            const DCSwitchParameter *&last_switch) const;
                            const DCSwitchParameter *&last_switch) const;
@@ -96,7 +96,7 @@ private:
   typedef pvector<Entry> Entries;
   typedef pvector<Entry> Entries;
   Entries _entries;
   Entries _entries;
 
 
-  typedef pmap<string, int> EntriesByName;
+  typedef pmap<std::string, int> EntriesByName;
   EntriesByName _entries_by_name;
   EntriesByName _entries_by_name;
 
 
   typedef pmap<const DCPackerInterface *, int> EntriesByField;
   typedef pmap<const DCPackerInterface *, int> EntriesByField;
@@ -105,7 +105,7 @@ private:
   typedef pmap<const DCPackerInterface *, DCPackerCatalog *> SwitchCatalogs;
   typedef pmap<const DCPackerInterface *, DCPackerCatalog *> SwitchCatalogs;
   SwitchCatalogs _switch_catalogs;
   SwitchCatalogs _switch_catalogs;
 
 
-  typedef pmap<const DCSwitchParameter *, string> SwitchPrefixes;
+  typedef pmap<const DCSwitchParameter *, std::string> SwitchPrefixes;
   SwitchPrefixes _switch_prefixes;
   SwitchPrefixes _switch_prefixes;
 
 
   friend class DCPackerInterface;
   friend class DCPackerInterface;

+ 1 - 1
direct/src/dcparser/dcPackerInterface.I

@@ -14,7 +14,7 @@
 /**
 /**
  * Returns the name of this field, or empty string if the field is unnamed.
  * Returns the name of this field, or empty string if the field is unnamed.
  */
  */
-INLINE const string &DCPackerInterface::
+INLINE const std::string &DCPackerInterface::
 get_name() const {
 get_name() const {
   return _name;
   return _name;
 }
 }

+ 14 - 14
direct/src/dcparser/dcPackerInterface.cxx

@@ -32,7 +32,7 @@ DCPackerInterface(const string &name) :
   _has_nested_fields = false;
   _has_nested_fields = false;
   _num_nested_fields = -1;
   _num_nested_fields = -1;
   _pack_type = PT_invalid;
   _pack_type = PT_invalid;
-  _catalog = NULL;
+  _catalog = nullptr;
 }
 }
 
 
 /**
 /**
@@ -50,7 +50,7 @@ DCPackerInterface(const DCPackerInterface &copy) :
   _num_nested_fields(copy._num_nested_fields),
   _num_nested_fields(copy._num_nested_fields),
   _pack_type(copy._pack_type)
   _pack_type(copy._pack_type)
 {
 {
-  _catalog = NULL;
+  _catalog = nullptr;
 }
 }
 
 
 /**
 /**
@@ -58,7 +58,7 @@ DCPackerInterface(const DCPackerInterface &copy) :
  */
  */
 DCPackerInterface::
 DCPackerInterface::
 ~DCPackerInterface() {
 ~DCPackerInterface() {
-  if (_catalog != (DCPackerCatalog *)NULL) {
+  if (_catalog != nullptr) {
     delete _catalog;
     delete _catalog;
   }
   }
 }
 }
@@ -83,7 +83,7 @@ find_seek_index(const string &name) const {
  */
  */
 DCField *DCPackerInterface::
 DCField *DCPackerInterface::
 as_field() {
 as_field() {
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -91,7 +91,7 @@ as_field() {
  */
  */
 const DCField *DCPackerInterface::
 const DCField *DCPackerInterface::
 as_field() const {
 as_field() const {
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -99,7 +99,7 @@ as_field() const {
  */
  */
 DCSwitchParameter *DCPackerInterface::
 DCSwitchParameter *DCPackerInterface::
 as_switch_parameter() {
 as_switch_parameter() {
-  return (DCSwitchParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -107,7 +107,7 @@ as_switch_parameter() {
  */
  */
 const DCSwitchParameter *DCPackerInterface::
 const DCSwitchParameter *DCPackerInterface::
 as_switch_parameter() const {
 as_switch_parameter() const {
-  return (DCSwitchParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -115,7 +115,7 @@ as_switch_parameter() const {
  */
  */
 DCClassParameter *DCPackerInterface::
 DCClassParameter *DCPackerInterface::
 as_class_parameter() {
 as_class_parameter() {
-  return (DCClassParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -123,7 +123,7 @@ as_class_parameter() {
  */
  */
 const DCClassParameter *DCPackerInterface::
 const DCClassParameter *DCPackerInterface::
 as_class_parameter() const {
 as_class_parameter() const {
-  return (DCClassParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -145,7 +145,7 @@ check_match(const string &description, DCFile *dcfile) const {
   dc_cleanup_parser();
   dc_cleanup_parser();
 
 
   DCField *field = dc_get_parameter_description();
   DCField *field = dc_get_parameter_description();
-  if (field != NULL) {
+  if (field != nullptr) {
     match = check_match(field);
     match = check_match(field);
     delete field;
     delete field;
   }
   }
@@ -184,7 +184,7 @@ calc_num_nested_fields(size_t) const {
  */
  */
 DCPackerInterface *DCPackerInterface::
 DCPackerInterface *DCPackerInterface::
 get_nested_field(int) const {
 get_nested_field(int) const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -367,7 +367,7 @@ unpack_skip(const char *data, size_t length, size_t &p,
  */
  */
 const DCPackerCatalog *DCPackerInterface::
 const DCPackerCatalog *DCPackerInterface::
 get_catalog() const {
 get_catalog() const {
-  if (_catalog == (DCPackerCatalog *)NULL) {
+  if (_catalog == nullptr) {
     ((DCPackerInterface *)this)->make_catalog();
     ((DCPackerInterface *)this)->make_catalog();
   }
   }
   return _catalog;
   return _catalog;
@@ -432,8 +432,8 @@ do_check_match_molecular_field(const DCMolecularField *) const {
  */
  */
 void DCPackerInterface::
 void DCPackerInterface::
 make_catalog() {
 make_catalog() {
-  nassertv(_catalog == (DCPackerCatalog *)NULL);
+  nassertv(_catalog == nullptr);
   _catalog = new DCPackerCatalog(this);
   _catalog = new DCPackerCatalog(this);
 
 
-  _catalog->r_fill_catalog("", this, NULL, 0);
+  _catalog->r_fill_catalog("", this, nullptr, 0);
 }
 }

+ 8 - 8
direct/src/dcparser/dcPackerInterface.h

@@ -66,13 +66,13 @@ END_PUBLISH
  */
  */
 class DCPackerInterface {
 class DCPackerInterface {
 public:
 public:
-  DCPackerInterface(const string &name = string());
+  DCPackerInterface(const std::string &name = std::string());
   DCPackerInterface(const DCPackerInterface &copy);
   DCPackerInterface(const DCPackerInterface &copy);
   virtual ~DCPackerInterface();
   virtual ~DCPackerInterface();
 
 
 PUBLISHED:
 PUBLISHED:
-  INLINE const string &get_name() const;
-  int find_seek_index(const string &name) const;
+  INLINE const std::string &get_name() const;
+  int find_seek_index(const std::string &name) const;
 
 
   virtual DCField *as_field();
   virtual DCField *as_field();
   virtual const DCField *as_field() const;
   virtual const DCField *as_field() const;
@@ -82,10 +82,10 @@ PUBLISHED:
   virtual const DCClassParameter *as_class_parameter() const;
   virtual const DCClassParameter *as_class_parameter() const;
 
 
   INLINE bool check_match(const DCPackerInterface *other) const;
   INLINE bool check_match(const DCPackerInterface *other) const;
-  bool check_match(const string &description, DCFile *dcfile = NULL) const;
+  bool check_match(const std::string &description, DCFile *dcfile = nullptr) const;
 
 
 public:
 public:
-  virtual void set_name(const string &name);
+  virtual void set_name(const std::string &name);
   INLINE bool has_fixed_byte_size() const;
   INLINE bool has_fixed_byte_size() const;
   INLINE size_t get_fixed_byte_size() const;
   INLINE size_t get_fixed_byte_size() const;
   INLINE bool has_fixed_structure() const;
   INLINE bool has_fixed_structure() const;
@@ -111,7 +111,7 @@ public:
                           bool &pack_error, bool &range_error) const;
                           bool &pack_error, bool &range_error) const;
   virtual void pack_uint64(DCPackData &pack_data, uint64_t value,
   virtual void pack_uint64(DCPackData &pack_data, uint64_t value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
-  virtual void pack_string(DCPackData &pack_data, const string &value,
+  virtual void pack_string(DCPackData &pack_data, const std::string &value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
 
 
@@ -126,7 +126,7 @@ public:
   virtual void unpack_uint64(const char *data, size_t length, size_t &p,
   virtual void unpack_uint64(const char *data, size_t length, size_t &p,
                              uint64_t &value, bool &pack_error, bool &range_error) const;
                              uint64_t &value, bool &pack_error, bool &range_error) const;
   virtual void unpack_string(const char *data, size_t length, size_t &p,
   virtual void unpack_string(const char *data, size_t length, size_t &p,
-                             string &value, bool &pack_error, bool &range_error) const;
+                             std::string &value, bool &pack_error, bool &range_error) const;
   virtual bool unpack_validate(const char *data, size_t length, size_t &p,
   virtual bool unpack_validate(const char *data, size_t length, size_t &p,
                                bool &pack_error, bool &range_error) const;
                                bool &pack_error, bool &range_error) const;
   virtual bool unpack_skip(const char *data, size_t length, size_t &p,
   virtual bool unpack_skip(const char *data, size_t length, size_t &p,
@@ -184,7 +184,7 @@ private:
   void make_catalog();
   void make_catalog();
 
 
 protected:
 protected:
-  string _name;
+  std::string _name;
   bool _has_fixed_byte_size;
   bool _has_fixed_byte_size;
   size_t _fixed_byte_size;
   size_t _fixed_byte_size;
   bool _has_fixed_structure;
   bool _has_fixed_structure;

+ 9 - 9
direct/src/dcparser/dcParameter.cxx

@@ -22,7 +22,7 @@
  */
  */
 DCParameter::
 DCParameter::
 DCParameter() {
 DCParameter() {
-  _typedef = NULL;
+  _typedef = nullptr;
   _has_fixed_byte_size = false;
   _has_fixed_byte_size = false;
   _has_fixed_structure = false;
   _has_fixed_structure = false;
   _num_nested_fields = -1;
   _num_nested_fields = -1;
@@ -66,7 +66,7 @@ as_parameter() const {
  */
  */
 DCSimpleParameter *DCParameter::
 DCSimpleParameter *DCParameter::
 as_simple_parameter() {
 as_simple_parameter() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -74,7 +74,7 @@ as_simple_parameter() {
  */
  */
 const DCSimpleParameter *DCParameter::
 const DCSimpleParameter *DCParameter::
 as_simple_parameter() const {
 as_simple_parameter() const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -82,7 +82,7 @@ as_simple_parameter() const {
  */
  */
 DCClassParameter *DCParameter::
 DCClassParameter *DCParameter::
 as_class_parameter() {
 as_class_parameter() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -90,7 +90,7 @@ as_class_parameter() {
  */
  */
 const DCClassParameter *DCParameter::
 const DCClassParameter *DCParameter::
 as_class_parameter() const {
 as_class_parameter() const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -98,7 +98,7 @@ as_class_parameter() const {
  */
  */
 DCSwitchParameter *DCParameter::
 DCSwitchParameter *DCParameter::
 as_switch_parameter() {
 as_switch_parameter() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -106,7 +106,7 @@ as_switch_parameter() {
  */
  */
 const DCSwitchParameter *DCParameter::
 const DCSwitchParameter *DCParameter::
 as_switch_parameter() const {
 as_switch_parameter() const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -114,7 +114,7 @@ as_switch_parameter() const {
  */
  */
 DCArrayParameter *DCParameter::
 DCArrayParameter *DCParameter::
 as_array_parameter() {
 as_array_parameter() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -122,7 +122,7 @@ as_array_parameter() {
  */
  */
 const DCArrayParameter *DCParameter::
 const DCArrayParameter *DCParameter::
 as_array_parameter() const {
 as_array_parameter() const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**

+ 12 - 12
direct/src/dcparser/dcParameter.h

@@ -60,18 +60,18 @@ public:
   void set_typedef(const DCTypedef *dtypedef);
   void set_typedef(const DCTypedef *dtypedef);
   virtual DCParameter *append_array_specification(const DCUnsignedIntRange &size);
   virtual DCParameter *append_array_specification(const DCUnsignedIntRange &size);
 
 
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
-  virtual void output_instance(ostream &out, bool brief, const string &prename,
-                               const string &name, const string &postname) const=0;
-  virtual void write_instance(ostream &out, bool brief, int indent_level,
-                              const string &prename, const string &name,
-                              const string &postname) const;
-  void output_typedef_name(ostream &out, bool brief, const string &prename,
-                           const string &name, const string &postname) const;
-  void write_typedef_name(ostream &out, bool brief, int indent_level,
-                          const string &prename, const string &name,
-                          const string &postname) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
+  virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                               const std::string &name, const std::string &postname) const=0;
+  virtual void write_instance(std::ostream &out, bool brief, int indent_level,
+                              const std::string &prename, const std::string &name,
+                              const std::string &postname) const;
+  void output_typedef_name(std::ostream &out, bool brief, const std::string &prename,
+                           const std::string &name, const std::string &postname) const;
+  void write_typedef_name(std::ostream &out, bool brief, int indent_level,
+                          const std::string &prename, const std::string &name,
+                          const std::string &postname) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
 
 
 private:
 private:

+ 57 - 57
direct/src/dcparser/dcParser.yxx

@@ -29,18 +29,18 @@
 #define YYINITDEPTH 1000
 #define YYINITDEPTH 1000
 #define YYMAXDEPTH 1000
 #define YYMAXDEPTH 1000
 
 
-DCFile *dc_file = (DCFile *)NULL;
-static DCClass *current_class = (DCClass *)NULL;
-static DCSwitch *current_switch = (DCSwitch *)NULL;
-static DCAtomicField *current_atomic = (DCAtomicField *)NULL;
-static DCMolecularField *current_molecular = (DCMolecularField *)NULL;
-static DCParameter *current_parameter = (DCParameter *)NULL;
+DCFile *dc_file = nullptr;
+static DCClass *current_class = nullptr;
+static DCSwitch *current_switch = nullptr;
+static DCAtomicField *current_atomic = nullptr;
+static DCMolecularField *current_molecular = nullptr;
+static DCParameter *current_parameter = nullptr;
 static DCKeywordList current_keyword_list;
 static DCKeywordList current_keyword_list;
 static DCPacker default_packer;
 static DCPacker default_packer;
 static DCPacker *current_packer;
 static DCPacker *current_packer;
 static DCDoubleRange double_range;
 static DCDoubleRange double_range;
 static DCUnsignedIntRange uint_range;
 static DCUnsignedIntRange uint_range;
-static DCField *parameter_description = (DCField *)NULL;
+static DCField *parameter_description = nullptr;
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 // Defining the interface to the parser.
 // Defining the interface to the parser.
@@ -55,7 +55,7 @@ dc_init_parser(istream &in, const string &filename, DCFile &file) {
 void
 void
 dc_init_parser_parameter_value(istream &in, const string &filename, 
 dc_init_parser_parameter_value(istream &in, const string &filename, 
                                DCPacker &packer) {
                                DCPacker &packer) {
-  dc_file = NULL;
+  dc_file = nullptr;
   current_packer = &packer;
   current_packer = &packer;
   dc_init_lexer(in, filename);
   dc_init_lexer(in, filename);
   dc_start_parameter_value();
   dc_start_parameter_value();
@@ -66,7 +66,7 @@ dc_init_parser_parameter_description(istream &in, const string &filename,
                                      DCFile *file) {
                                      DCFile *file) {
   dc_file = file;
   dc_file = file;
   dc_init_lexer(in, filename);
   dc_init_lexer(in, filename);
-  parameter_description = NULL;
+  parameter_description = nullptr;
   dc_start_parameter_description();
   dc_start_parameter_description();
 }
 }
 
 
@@ -77,7 +77,7 @@ dc_get_parameter_description() {
 
 
 void
 void
 dc_cleanup_parser() {
 dc_cleanup_parser() {
-  dc_file = (DCFile *)NULL;
+  dc_file = nullptr;
 }
 }
 
 
 %}
 %}
@@ -181,7 +181,7 @@ dc:
 {
 {
   if (!dc_file->add_class($2)) {
   if (!dc_file->add_class($2)) {
     DCClass *old_class = dc_file->get_class_by_name($2->get_name());
     DCClass *old_class = dc_file->get_class_by_name($2->get_name());
-    if (old_class != (DCClass *)NULL && old_class->is_bogus_class()) {
+    if (old_class != nullptr && old_class->is_bogus_class()) {
       yyerror("Base class defined after its first reference: " + $2->get_name());
       yyerror("Base class defined after its first reference: " + $2->get_name());
     } else {
     } else {
       yyerror("Duplicate class name: " + $2->get_name());
       yyerror("Duplicate class name: " + $2->get_name());
@@ -249,7 +249,7 @@ import_symbol_list:
 typedef_decl:
 typedef_decl:
         KW_TYPEDEF parameter_with_default
         KW_TYPEDEF parameter_with_default
 {
 {
-  if ($2 != (DCParameter *)NULL) {
+  if ($2 != nullptr) {
     DCTypedef *dtypedef = new DCTypedef($2);
     DCTypedef *dtypedef = new DCTypedef($2);
     
     
     if (!dc_file->add_typedef(dtypedef)) {
     if (!dc_file->add_typedef(dtypedef)) {
@@ -304,13 +304,13 @@ dclass:
 dclass_name:
 dclass_name:
         IDENTIFIER
         IDENTIFIER
 {
 {
-  if (dc_file == (DCFile *)NULL) {
+  if (dc_file == nullptr) {
     yyerror("No DCFile available, so no class names are predefined.");
     yyerror("No DCFile available, so no class names are predefined.");
-    $$ = NULL;
+    $$ = nullptr;
 
 
   } else {
   } else {
     DCClass *dclass = dc_file->get_class_by_name($1);
     DCClass *dclass = dc_file->get_class_by_name($1);
-    if (dclass == (DCClass *)NULL) {
+    if (dclass == nullptr) {
       // Create a bogus class as a forward reference.
       // Create a bogus class as a forward reference.
       dclass = new DCClass(dc_file, $1, false, true);
       dclass = new DCClass(dc_file, $1, false, true);
       dc_file->add_class(dclass);
       dc_file->add_class(dclass);
@@ -332,7 +332,7 @@ dclass_derivation:
 dclass_base_list:
 dclass_base_list:
         dclass_name
         dclass_name
 {
 {
-  if ($1 != (DCClass *)NULL) {
+  if ($1 != nullptr) {
     current_class->add_parent($1);
     current_class->add_parent($1);
   }
   }
 }
 }
@@ -342,7 +342,7 @@ dclass_base_list:
     yyerror("Multiple inheritance is not supported without \"dc-multiple-inheritance 1\" in your Config.prc file.");
     yyerror("Multiple inheritance is not supported without \"dc-multiple-inheritance 1\" in your Config.prc file.");
 
 
   } else {
   } else {
-    if ($3 != (DCClass *)NULL) {
+    if ($3 != nullptr) {
       current_class->add_parent($3);
       current_class->add_parent($3);
     }
     }
   }
   }
@@ -354,7 +354,7 @@ dclass_fields:
         | dclass_fields ';'
         | dclass_fields ';'
         | dclass_fields dclass_field ';'
         | dclass_fields dclass_field ';'
 {
 {
-  if ($2 == (DCField *)NULL) {
+  if ($2 == nullptr) {
     // Pass this error up.
     // Pass this error up.
   } else if (!current_class->add_field($2)) {
   } else if (!current_class->add_field($2)) {
     yyerror("Duplicate field name: " + $2->get_name());
     yyerror("Duplicate field name: " + $2->get_name());
@@ -367,7 +367,7 @@ dclass_fields:
 dclass_field:
 dclass_field:
         atomic_field keyword_list
         atomic_field keyword_list
 {
 {
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     if ($1->get_name().empty()) {
     if ($1->get_name().empty()) {
       yyerror("Field name required.");
       yyerror("Field name required.");
     }
     }
@@ -379,14 +379,14 @@ dclass_field:
         | unnamed_parameter_with_default keyword_list
         | unnamed_parameter_with_default keyword_list
 {
 {
   yyerror("Unnamed parameters are not allowed on a dclass");
   yyerror("Unnamed parameters are not allowed on a dclass");
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     $1->copy_keywords(current_keyword_list);
     $1->copy_keywords(current_keyword_list);
   }
   }
   $$ = $1;
   $$ = $1;
 }
 }
         | named_parameter_with_default keyword_list
         | named_parameter_with_default keyword_list
 {
 {
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     $1->copy_keywords(current_keyword_list);
     $1->copy_keywords(current_keyword_list);
   }
   }
   $$ = $1;
   $$ = $1;
@@ -408,13 +408,13 @@ struct:
 struct_name:
 struct_name:
         IDENTIFIER
         IDENTIFIER
 {
 {
-  if (dc_file == (DCFile *)NULL) {
+  if (dc_file == nullptr) {
     yyerror("No DCFile available, so no struct names are predefined.");
     yyerror("No DCFile available, so no struct names are predefined.");
-    $$ = NULL;
+    $$ = nullptr;
 
 
   } else {
   } else {
     DCClass *dstruct = dc_file->get_class_by_name($1);
     DCClass *dstruct = dc_file->get_class_by_name($1);
-    if (dstruct == (DCClass *)NULL) {
+    if (dstruct == nullptr) {
       // Create a bogus class as a forward reference.
       // Create a bogus class as a forward reference.
       dstruct = new DCClass(dc_file, $1, false, true);
       dstruct = new DCClass(dc_file, $1, false, true);
       dc_file->add_class(dstruct);
       dc_file->add_class(dstruct);
@@ -436,13 +436,13 @@ struct_derivation:
 struct_base_list:
 struct_base_list:
         struct_name
         struct_name
 {
 {
-  if ($1 != (DCClass *)NULL) {
+  if ($1 != nullptr) {
     current_class->add_parent($1);
     current_class->add_parent($1);
   }
   }
 }
 }
         | struct_base_list ',' struct_name
         | struct_base_list ',' struct_name
 {
 {
-  if ($3 != (DCClass *)NULL) {
+  if ($3 != nullptr) {
     current_class->add_parent($3);
     current_class->add_parent($3);
   }
   }
 }
 }
@@ -453,7 +453,7 @@ struct_fields:
         | struct_fields ';'
         | struct_fields ';'
         | struct_fields struct_field ';'
         | struct_fields struct_field ';'
 {
 {
-  if ($2 == (DCField *)NULL) {
+  if ($2 == nullptr) {
     // Pass this error up.
     // Pass this error up.
   } else if (!current_class->add_field($2)) {
   } else if (!current_class->add_field($2)) {
     yyerror("Duplicate field name: " + $2->get_name());
     yyerror("Duplicate field name: " + $2->get_name());
@@ -483,7 +483,7 @@ struct_field:
 atomic_field:
 atomic_field:
         optional_name '('
         optional_name '('
 {
 {
-  if (current_class == (DCClass *)NULL) {
+  if (current_class == nullptr) {
     yyerror("Cannot define a method outside of a struct or class.");
     yyerror("Cannot define a method outside of a struct or class.");
     DCClass *temp_class = new DCClass(dc_file, "temp", false, false);  // memory leak.
     DCClass *temp_class = new DCClass(dc_file, "temp", false, false);  // memory leak.
     current_atomic = new DCAtomicField($1, temp_class, false);
     current_atomic = new DCAtomicField($1, temp_class, false);
@@ -511,7 +511,7 @@ nonempty_parameter_list:
 atomic_element:
 atomic_element:
         parameter_with_default
         parameter_with_default
 {
 {
-  if ($1 != (DCParameter *)NULL) {
+  if ($1 != nullptr) {
     current_atomic->add_element($1);
     current_atomic->add_element($1);
   }
   }
 }
 }
@@ -538,14 +538,14 @@ named_parameter_with_default:
 {
 {
   current_packer = &default_packer;
   current_packer = &default_packer;
   current_packer->clear_data();
   current_packer->clear_data();
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     current_packer->begin_pack($1);
     current_packer->begin_pack($1);
   }
   }
 }
 }
         parameter_value
         parameter_value
 {
 {
   bool is_valid = false;
   bool is_valid = false;
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     is_valid = $1->is_valid();
     is_valid = $1->is_valid();
   }
   }
   if (current_packer->end_pack()) {
   if (current_packer->end_pack()) {
@@ -568,14 +568,14 @@ unnamed_parameter_with_default:
 {
 {
   current_packer = &default_packer;
   current_packer = &default_packer;
   current_packer->clear_data();
   current_packer->clear_data();
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     current_packer->begin_pack($1);
     current_packer->begin_pack($1);
   }
   }
 }
 }
         parameter_value
         parameter_value
 {
 {
   bool is_valid = false;
   bool is_valid = false;
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     is_valid = $1->is_valid();
     is_valid = $1->is_valid();
   }
   }
   if (current_packer->end_pack()) {
   if (current_packer->end_pack()) {
@@ -636,7 +636,7 @@ simple_type_name:
         | simple_type_name '(' double_range ')'
         | simple_type_name '(' double_range ')'
 {
 {
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  nassertr(simple_param != (DCSimpleParameter *)NULL, 0);
+  nassertr(simple_param != nullptr, 0);
   if (!simple_param->set_range(double_range)) {
   if (!simple_param->set_range(double_range)) {
     yyerror("Inappropriate range for type");
     yyerror("Inappropriate range for type");
   }
   }
@@ -645,7 +645,7 @@ simple_type_name:
         | simple_type_name '/' small_unsigned_integer
         | simple_type_name '/' small_unsigned_integer
 {
 {
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  nassertr(simple_param != (DCSimpleParameter *)NULL, 0);
+  nassertr(simple_param != nullptr, 0);
   if (!simple_param->is_numeric_type()) {
   if (!simple_param->is_numeric_type()) {
     yyerror("A divisor is only valid on a numeric type.");
     yyerror("A divisor is only valid on a numeric type.");
 
 
@@ -661,7 +661,7 @@ simple_type_name:
         | simple_type_name '%' number
         | simple_type_name '%' number
 { 
 { 
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  nassertr(simple_param != (DCSimpleParameter *)NULL, 0);
+  nassertr(simple_param != nullptr, 0);
   if (!simple_param->is_numeric_type()) {
   if (!simple_param->is_numeric_type()) {
     yyerror("A divisor is only valid on a numeric type.");
     yyerror("A divisor is only valid on a numeric type.");
 
 
@@ -676,22 +676,22 @@ type_name:
         simple_type_name
         simple_type_name
         | IDENTIFIER
         | IDENTIFIER
 {
 {
-  if (dc_file == (DCFile *)NULL) {
+  if (dc_file == nullptr) {
     yyerror("Invalid type.");
     yyerror("Invalid type.");
-    $$ = NULL;
+    $$ = nullptr;
 
 
   } else {
   } else {
     DCTypedef *dtypedef = dc_file->get_typedef_by_name($1);
     DCTypedef *dtypedef = dc_file->get_typedef_by_name($1);
-    if (dtypedef == (DCTypedef *)NULL) {
+    if (dtypedef == nullptr) {
       // Maybe it's a class name.
       // Maybe it's a class name.
       DCClass *dclass = dc_file->get_class_by_name($1);
       DCClass *dclass = dc_file->get_class_by_name($1);
-      if (dclass != (DCClass *)NULL) {
+      if (dclass != nullptr) {
         // Create an implicit typedef for this.
         // Create an implicit typedef for this.
         dtypedef = new DCTypedef(new DCClassParameter(dclass), true);
         dtypedef = new DCTypedef(new DCClassParameter(dclass), true);
       } else {
       } else {
         // Maybe it's a switch name.
         // Maybe it's a switch name.
         DCSwitch *dswitch = dc_file->get_switch_by_name($1);
         DCSwitch *dswitch = dc_file->get_switch_by_name($1);
-        if (dswitch != (DCSwitch *)NULL) {
+        if (dswitch != nullptr) {
           // This also gets an implicit typedef.
           // This also gets an implicit typedef.
           dtypedef = new DCTypedef(new DCSwitchParameter(dswitch), true);
           dtypedef = new DCTypedef(new DCSwitchParameter(dswitch), true);
         } else {
         } else {
@@ -709,10 +709,10 @@ type_name:
         | struct
         | struct
 {
 {
   // This is an inline struct definition.
   // This is an inline struct definition.
-  if ($1 == (DCClass *)NULL) {
-    $$ = NULL;
+  if ($1 == nullptr) {
+    $$ = nullptr;
   } else {
   } else {
-    if (dc_file != (DCFile *)NULL) {
+    if (dc_file != nullptr) {
       dc_file->add_thing_to_delete($1);
       dc_file->add_thing_to_delete($1);
     } else {
     } else {
       // This is a memory leak--this happens when we put an anonymous
       // This is a memory leak--this happens when we put an anonymous
@@ -725,10 +725,10 @@ type_name:
         | switch
         | switch
 {
 {
   // This is an inline switch definition.
   // This is an inline switch definition.
-  if ($1 == (DCSwitch *)NULL) {
-    $$ = NULL;
+  if ($1 == nullptr) {
+    $$ = nullptr;
   } else {
   } else {
-    if (dc_file != (DCFile *)NULL) {
+    if (dc_file != nullptr) {
       dc_file->add_thing_to_delete($1);
       dc_file->add_thing_to_delete($1);
     } else {
     } else {
       // This is a memory leak--this happens when we put an anonymous
       // This is a memory leak--this happens when we put an anonymous
@@ -840,8 +840,8 @@ type_definition:
         type_name
         type_name
         | type_definition '[' uint_range ']'
         | type_definition '[' uint_range ']'
 {
 {
-  if ($1 == (DCParameter *)NULL) {
-    $$ = NULL;
+  if ($1 == nullptr) {
+    $$ = nullptr;
   } else {
   } else {
     $$ = $1->append_array_specification(uint_range);
     $$ = $1->append_array_specification(uint_range);
   }
   }
@@ -857,7 +857,7 @@ parameter_definition:
         | parameter_definition '/' small_unsigned_integer
         | parameter_definition '/' small_unsigned_integer
 {
 {
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) {
+  if (simple_param == nullptr || simple_param->get_typedef() != nullptr) {
     yyerror("A divisor is only allowed on a primitive type.");
     yyerror("A divisor is only allowed on a primitive type.");
 
 
   } else if (!simple_param->is_numeric_type()) {
   } else if (!simple_param->is_numeric_type()) {
@@ -872,7 +872,7 @@ parameter_definition:
         | parameter_definition '%' number
         | parameter_definition '%' number
 {
 {
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) {
+  if (simple_param == nullptr || simple_param->get_typedef() != nullptr) {
     yyerror("A modulus is only allowed on a primitive type.");
     yyerror("A modulus is only allowed on a primitive type.");
 
 
   } else if (!simple_param->is_numeric_type()) {
   } else if (!simple_param->is_numeric_type()) {
@@ -1184,8 +1184,8 @@ atomic_name:
         IDENTIFIER
         IDENTIFIER
 {
 {
   DCField *field = current_class->get_field_by_name($1);
   DCField *field = current_class->get_field_by_name($1);
-  $$ = (DCAtomicField *)NULL;
-  if (field == (DCField *)NULL) {
+  $$ = nullptr;
+  if (field == nullptr) {
     // Maybe the field is unknown because the class is partially
     // Maybe the field is unknown because the class is partially
     // bogus.  In that case, allow it for now; create a bogus field as
     // bogus.  In that case, allow it for now; create a bogus field as
     // a placeholder.
     // a placeholder.
@@ -1200,7 +1200,7 @@ atomic_name:
 
 
   } else {
   } else {
     $$ = field->as_atomic_field();
     $$ = field->as_atomic_field();
-    if ($$ == (DCAtomicField *)NULL) {
+    if ($$ == nullptr) {
       yyerror("Not an atomic field: " + $1);
       yyerror("Not an atomic field: " + $1);
     }
     }
   }
   }
@@ -1210,13 +1210,13 @@ atomic_name:
 molecular_atom_list:
 molecular_atom_list:
         atomic_name
         atomic_name
 {
 {
-  if ($1 != (DCAtomicField *)NULL) {
+  if ($1 != nullptr) {
     current_molecular->add_atomic($1);
     current_molecular->add_atomic($1);
   }
   }
 }
 }
         | molecular_atom_list ',' atomic_name
         | molecular_atom_list ',' atomic_name
 {
 {
-  if ($3 != (DCAtomicField *)NULL) {
+  if ($3 != nullptr) {
     current_molecular->add_atomic($3);
     current_molecular->add_atomic($3);
     if (!$3->is_bogus_field() && !current_molecular->compare_keywords(*$3)) {
     if (!$3->is_bogus_field() && !current_molecular->compare_keywords(*$3)) {
       yyerror("Mismatched keywords in molecule between " + 
       yyerror("Mismatched keywords in molecule between " + 
@@ -1258,7 +1258,7 @@ switch_fields:
 {
 {
   if (!current_switch->is_field_valid()) {
   if (!current_switch->is_field_valid()) {
     yyerror("case declaration required before first element");
     yyerror("case declaration required before first element");
-  } else if ($2 != (DCField *)NULL) {
+  } else if ($2 != nullptr) {
     if (!current_switch->add_field($2)) {
     if (!current_switch->add_field($2)) {
       yyerror("Duplicate field name: " + $2->get_name());
       yyerror("Duplicate field name: " + $2->get_name());
     }
     }

+ 4 - 4
direct/src/dcparser/dcParserDefs.h

@@ -26,10 +26,10 @@ class DCParameter;
 class DCKeyword;
 class DCKeyword;
 class DCPacker;
 class DCPacker;
 
 
-void dc_init_parser(istream &in, const string &filename, DCFile &file);
-void dc_init_parser_parameter_value(istream &in, const string &filename,
+void dc_init_parser(std::istream &in, const std::string &filename, DCFile &file);
+void dc_init_parser_parameter_value(std::istream &in, const std::string &filename,
                                     DCPacker &packer);
                                     DCPacker &packer);
-void dc_init_parser_parameter_description(istream &in, const string &filename,
+void dc_init_parser_parameter_description(std::istream &in, const std::string &filename,
                                           DCFile *file);
                                           DCFile *file);
 DCField *dc_get_parameter_description();
 DCField *dc_get_parameter_description();
 void dc_cleanup_parser();
 void dc_cleanup_parser();
@@ -60,7 +60,7 @@ public:
     DCParameter *parameter;
     DCParameter *parameter;
     const DCKeyword *keyword;
     const DCKeyword *keyword;
   } u;
   } u;
-  string str;
+  std::string str;
 };
 };
 
 
 // The yacc-generated code expects to use the symbol 'YYSTYPE' to refer to the
 // The yacc-generated code expects to use the symbol 'YYSTYPE' to refer to the

+ 8 - 6
direct/src/dcparser/dcSimpleParameter.cxx

@@ -21,7 +21,7 @@
 #include <math.h>
 #include <math.h>
 
 
 DCSimpleParameter::NestedFieldMap DCSimpleParameter::_nested_field_map;
 DCSimpleParameter::NestedFieldMap DCSimpleParameter::_nested_field_map;
-DCClassParameter *DCSimpleParameter::_uint32uint8_type = NULL;
+DCClassParameter *DCSimpleParameter::_uint32uint8_type = nullptr;
 
 
 /**
 /**
  *
  *
@@ -186,7 +186,7 @@ DCSimpleParameter(DCSubatomicType type, unsigned int divisor) :
     _nested_field = create_uint32uint8_type();
     _nested_field = create_uint32uint8_type();
 
 
   } else {
   } else {
-    _nested_field = NULL;
+    _nested_field = nullptr;
   }
   }
 }
 }
 
 
@@ -2173,7 +2173,7 @@ unpack_skip(const char *data, size_t length, size_t &p,
 void DCSimpleParameter::
 void DCSimpleParameter::
 output_instance(ostream &out, bool brief, const string &prename,
 output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
                 const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {
@@ -2238,6 +2238,8 @@ output_instance(ostream &out, bool brief, const string &prename,
       }
       }
       break;
       break;
 
 
+    case ST_blob:
+    case ST_blob32:
     case ST_string:
     case ST_string:
       if (!_uint_range.is_empty()) {
       if (!_uint_range.is_empty()) {
         out << "(";
         out << "(";
@@ -2340,7 +2342,7 @@ do_check_match_array_parameter(const DCArrayParameter *other) const {
     // We cannot match a fixed-size array.
     // We cannot match a fixed-size array.
     return false;
     return false;
   }
   }
-  if (_nested_field == NULL) {
+  if (_nested_field == nullptr) {
     // Only an array-style simple parameter can match a DCArrayParameter.
     // Only an array-style simple parameter can match a DCArrayParameter.
     return false;
     return false;
   }
   }
@@ -2372,8 +2374,8 @@ create_nested_field(DCSubatomicType type, unsigned int divisor) {
  */
  */
 DCPackerInterface *DCSimpleParameter::
 DCPackerInterface *DCSimpleParameter::
 create_uint32uint8_type() {
 create_uint32uint8_type() {
-  if (_uint32uint8_type == NULL) {
-    DCClass *dclass = new DCClass(NULL, "", true, false);
+  if (_uint32uint8_type == nullptr) {
+    DCClass *dclass = new DCClass(nullptr, "", true, false);
     dclass->add_field(new DCSimpleParameter(ST_uint32));
     dclass->add_field(new DCSimpleParameter(ST_uint32));
     dclass->add_field(new DCSimpleParameter(ST_uint8));
     dclass->add_field(new DCSimpleParameter(ST_uint8));
     _uint32uint8_type = new DCClassParameter(dclass);
     _uint32uint8_type = new DCClassParameter(dclass);

+ 4 - 4
direct/src/dcparser/dcSimpleParameter.h

@@ -60,7 +60,7 @@ public:
                           bool &pack_error, bool &range_error) const;
                           bool &pack_error, bool &range_error) const;
   virtual void pack_uint64(DCPackData &pack_data, uint64_t value,
   virtual void pack_uint64(DCPackData &pack_data, uint64_t value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
-  virtual void pack_string(DCPackData &pack_data, const string &value,
+  virtual void pack_string(DCPackData &pack_data, const std::string &value,
                            bool &pack_error, bool &range_error) const;
                            bool &pack_error, bool &range_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
 
 
@@ -75,14 +75,14 @@ public:
   virtual void unpack_uint64(const char *data, size_t length, size_t &p,
   virtual void unpack_uint64(const char *data, size_t length, size_t &p,
                              uint64_t &value, bool &pack_error, bool &range_error) const;
                              uint64_t &value, bool &pack_error, bool &range_error) const;
   virtual void unpack_string(const char *data, size_t length, size_t &p,
   virtual void unpack_string(const char *data, size_t length, size_t &p,
-                             string &value, bool &pack_error, bool &range_error) const;
+                             std::string &value, bool &pack_error, bool &range_error) const;
   virtual bool unpack_validate(const char *data, size_t length, size_t &p,
   virtual bool unpack_validate(const char *data, size_t length, size_t &p,
                                bool &pack_error, bool &range_error) const;
                                bool &pack_error, bool &range_error) const;
   virtual bool unpack_skip(const char *data, size_t length, size_t &p,
   virtual bool unpack_skip(const char *data, size_t length, size_t &p,
                            bool &pack_error) const;
                            bool &pack_error) const;
 
 
-  virtual void output_instance(ostream &out, bool brief, const string &prename,
-                               const string &name, const string &postname) const;
+  virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                               const std::string &name, const std::string &postname) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
 
 
 protected:
 protected:

+ 1 - 1
direct/src/dcparser/dcSubatomicType.h

@@ -60,6 +60,6 @@ enum DCSubatomicType {
 };
 };
 END_PUBLISH
 END_PUBLISH
 
 
-ostream &operator << (ostream &out, DCSubatomicType type);
+std::ostream &operator << (std::ostream &out, DCSubatomicType type);
 
 
 #endif
 #endif

+ 25 - 25
direct/src/dcparser/dcSwitch.cxx

@@ -27,7 +27,7 @@ DCSwitch(const string &name, DCField *key_parameter) :
   _name(name),
   _name(name),
   _key_parameter(key_parameter)
   _key_parameter(key_parameter)
 {
 {
-  _default_case = NULL;
+  _default_case = nullptr;
   _fields_added = false;
   _fields_added = false;
 }
 }
 
 
@@ -36,7 +36,7 @@ DCSwitch(const string &name, DCField *key_parameter) :
  */
  */
 DCSwitch::
 DCSwitch::
 ~DCSwitch() {
 ~DCSwitch() {
-  nassertv(_key_parameter != (DCField *)NULL);
+  nassertv(_key_parameter != nullptr);
   delete _key_parameter;
   delete _key_parameter;
 
 
   Cases::iterator ci;
   Cases::iterator ci;
@@ -121,7 +121,7 @@ get_case_by_value(const string &case_value) const {
  */
  */
 DCPackerInterface *DCSwitch::
 DCPackerInterface *DCSwitch::
 get_case(int n) const {
 get_case(int n) const {
-  nassertr(n >= 0 && n < (int)_cases.size(), NULL);
+  nassertr(n >= 0 && n < (int)_cases.size(), nullptr);
   return _cases[n]->_fields;
   return _cases[n]->_fields;
 }
 }
 
 
@@ -157,8 +157,8 @@ get_num_fields(int case_index) const {
  */
  */
 DCField *DCSwitch::
 DCField *DCSwitch::
 get_field(int case_index, int n) const {
 get_field(int case_index, int n) const {
-  nassertr(case_index >= 0 && case_index < (int)_cases.size(), NULL);
-  nassertr(n >= 0 && n < (int)_cases[case_index]->_fields->_fields.size(), NULL);
+  nassertr(case_index >= 0 && case_index < (int)_cases.size(), nullptr);
+  nassertr(n >= 0 && n < (int)_cases[case_index]->_fields->_fields.size(), nullptr);
   return _cases[case_index]->_fields->_fields[n];
   return _cases[case_index]->_fields->_fields[n];
 }
 }
 
 
@@ -168,7 +168,7 @@ get_field(int case_index, int n) const {
  */
  */
 DCField *DCSwitch::
 DCField *DCSwitch::
 get_field_by_name(int case_index, const string &name) const {
 get_field_by_name(int case_index, const string &name) const {
-  nassertr(case_index >= 0 && case_index < (int)_cases.size(), NULL);
+  nassertr(case_index >= 0 && case_index < (int)_cases.size(), nullptr);
 
 
   const FieldsByName &fields_by_name = _cases[case_index]->_fields->_fields_by_name;
   const FieldsByName &fields_by_name = _cases[case_index]->_fields->_fields_by_name;
   FieldsByName::const_iterator ni;
   FieldsByName::const_iterator ni;
@@ -177,7 +177,7 @@ get_field_by_name(int case_index, const string &name) const {
     return (*ni).second;
     return (*ni).second;
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -226,7 +226,7 @@ add_invalid_case() {
  */
  */
 bool DCSwitch::
 bool DCSwitch::
 add_default() {
 add_default() {
-  if (_default_case != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
     add_invalid_case();
     add_invalid_case();
     return false;
     return false;
   }
   }
@@ -286,12 +286,12 @@ apply_switch(const char *value_data, size_t length) const {
   }
   }
 
 
   // Unexpected value--use the default.
   // Unexpected value--use the default.
-  if (_default_case != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
     return _default_case;
     return _default_case;
   }
   }
 
 
   // No default.
   // No default.
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -326,26 +326,26 @@ output_instance(ostream &out, bool brief, const string &prename,
   _key_parameter->output(out, brief);
   _key_parameter->output(out, brief);
   out << ") {";
   out << ") {";
 
 
-  const SwitchFields *last_fields = NULL;
+  const SwitchFields *last_fields = nullptr;
 
 
   Cases::const_iterator ci;
   Cases::const_iterator ci;
   for (ci = _cases.begin(); ci != _cases.end(); ++ci) {
   for (ci = _cases.begin(); ci != _cases.end(); ++ci) {
     const SwitchCase *dcase = (*ci);
     const SwitchCase *dcase = (*ci);
-    if (dcase->_fields != last_fields && last_fields != (SwitchFields *)NULL) {
+    if (dcase->_fields != last_fields && last_fields != nullptr) {
       last_fields->output(out, brief);
       last_fields->output(out, brief);
     }
     }
     last_fields = dcase->_fields;
     last_fields = dcase->_fields;
     out << "case " << _key_parameter->format_data(dcase->_value, false) << ": ";
     out << "case " << _key_parameter->format_data(dcase->_value, false) << ": ";
   }
   }
 
 
-  if (_default_case != (SwitchFields *)NULL) {
-    if (_default_case != last_fields && last_fields != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
+    if (_default_case != last_fields && last_fields != nullptr) {
       last_fields->output(out, brief);
       last_fields->output(out, brief);
     }
     }
     last_fields = _default_case;
     last_fields = _default_case;
     out << "default: ";
     out << "default: ";
   }
   }
-  if (last_fields != (SwitchFields *)NULL) {
+  if (last_fields != nullptr) {
     last_fields->output(out, brief);
     last_fields->output(out, brief);
   }
   }
 
 
@@ -372,12 +372,12 @@ write_instance(ostream &out, bool brief, int indent_level,
   _key_parameter->output(out, brief);
   _key_parameter->output(out, brief);
   out << ") {\n";
   out << ") {\n";
 
 
-  const SwitchFields *last_fields = NULL;
+  const SwitchFields *last_fields = nullptr;
 
 
   Cases::const_iterator ci;
   Cases::const_iterator ci;
   for (ci = _cases.begin(); ci != _cases.end(); ++ci) {
   for (ci = _cases.begin(); ci != _cases.end(); ++ci) {
     const SwitchCase *dcase = (*ci);
     const SwitchCase *dcase = (*ci);
-    if (dcase->_fields != last_fields && last_fields != (SwitchFields *)NULL) {
+    if (dcase->_fields != last_fields && last_fields != nullptr) {
       last_fields->write(out, brief, indent_level + 2);
       last_fields->write(out, brief, indent_level + 2);
     }
     }
     last_fields = dcase->_fields;
     last_fields = dcase->_fields;
@@ -385,15 +385,15 @@ write_instance(ostream &out, bool brief, int indent_level,
       << "case " << _key_parameter->format_data(dcase->_value, false) << ":\n";
       << "case " << _key_parameter->format_data(dcase->_value, false) << ":\n";
   }
   }
 
 
-  if (_default_case != (SwitchFields *)NULL) {
-    if (_default_case != last_fields && last_fields != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
+    if (_default_case != last_fields && last_fields != nullptr) {
       last_fields->write(out, brief, indent_level + 2);
       last_fields->write(out, brief, indent_level + 2);
     }
     }
     last_fields = _default_case;
     last_fields = _default_case;
     indent(out, indent_level)
     indent(out, indent_level)
       << "default:\n";
       << "default:\n";
   }
   }
-  if (last_fields != (SwitchFields *)NULL) {
+  if (last_fields != nullptr) {
     last_fields->write(out, brief, indent_level + 2);
     last_fields->write(out, brief, indent_level + 2);
   }
   }
 
 
@@ -428,7 +428,7 @@ generate_hash(HashGenerator &hashgen) const {
     }
     }
   }
   }
 
 
-  if (_default_case != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
     const SwitchFields *fields = _default_case;
     const SwitchFields *fields = _default_case;
     hashgen.add_int(fields->_fields.size());
     hashgen.add_int(fields->_fields.size());
     Fields::const_iterator fi;
     Fields::const_iterator fi;
@@ -446,7 +446,7 @@ generate_hash(HashGenerator &hashgen) const {
  */
  */
 bool DCSwitch::
 bool DCSwitch::
 pack_default_value(DCPackData &pack_data, bool &pack_error) const {
 pack_default_value(DCPackData &pack_data, bool &pack_error) const {
-  SwitchFields *fields = NULL;
+  SwitchFields *fields = nullptr;
   DCPacker packer;
   DCPacker packer;
   packer.begin_pack(_key_parameter);
   packer.begin_pack(_key_parameter);
   if (!_cases.empty()) {
   if (!_cases.empty()) {
@@ -466,7 +466,7 @@ pack_default_value(DCPackData &pack_data, bool &pack_error) const {
     pack_error = true;
     pack_error = true;
   }
   }
 
 
-  if (fields == (SwitchFields *)NULL) {
+  if (fields == nullptr) {
     pack_error = true;
     pack_error = true;
 
 
   } else {
   } else {
@@ -528,7 +528,7 @@ do_check_match_switch(const DCSwitch *other) const {
  */
  */
 DCSwitch::SwitchFields *DCSwitch::
 DCSwitch::SwitchFields *DCSwitch::
 start_new_case() {
 start_new_case() {
-  SwitchFields *fields = NULL;
+  SwitchFields *fields = nullptr;
 
 
   if (_current_fields.empty() || _fields_added) {
   if (_current_fields.empty() || _fields_added) {
     // If we have recently encountered a break (which removes all of the
     // If we have recently encountered a break (which removes all of the
@@ -587,7 +587,7 @@ DCSwitch::SwitchFields::
  */
  */
 DCPackerInterface *DCSwitch::SwitchFields::
 DCPackerInterface *DCSwitch::SwitchFields::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_fields.size(), nullptr);
   return _fields[n];
   return _fields[n];
 }
 }
 
 

+ 21 - 21
direct/src/dcparser/dcSwitch.h

@@ -29,29 +29,29 @@ class DCField;
  */
  */
 class DCSwitch : public DCDeclaration {
 class DCSwitch : public DCDeclaration {
 public:
 public:
-  DCSwitch(const string &name, DCField *key_parameter);
+  DCSwitch(const std::string &name, DCField *key_parameter);
   virtual ~DCSwitch();
   virtual ~DCSwitch();
 
 
 PUBLISHED:
 PUBLISHED:
   virtual DCSwitch *as_switch();
   virtual DCSwitch *as_switch();
   virtual const DCSwitch *as_switch() const;
   virtual const DCSwitch *as_switch() const;
 
 
-  const string &get_name() const;
+  const std::string &get_name() const;
   DCField *get_key_parameter() const;
   DCField *get_key_parameter() const;
 
 
   int get_num_cases() const;
   int get_num_cases() const;
-  int get_case_by_value(const string &case_value) const;
+  int get_case_by_value(const std::string &case_value) const;
   DCPackerInterface *get_case(int n) const;
   DCPackerInterface *get_case(int n) const;
   DCPackerInterface *get_default_case() const;
   DCPackerInterface *get_default_case() const;
 
 
-  string get_value(int case_index) const;
+  std::string get_value(int case_index) const;
   int get_num_fields(int case_index) const;
   int get_num_fields(int case_index) const;
   DCField *get_field(int case_index, int n) const;
   DCField *get_field(int case_index, int n) const;
-  DCField *get_field_by_name(int case_index, const string &name) const;
+  DCField *get_field_by_name(int case_index, const std::string &name) const;
 
 
 public:
 public:
   bool is_field_valid() const;
   bool is_field_valid() const;
-  int add_case(const string &value);
+  int add_case(const std::string &value);
   void add_invalid_case();
   void add_invalid_case();
   bool add_default();
   bool add_default();
   bool add_field(DCField *field);
   bool add_field(DCField *field);
@@ -59,13 +59,13 @@ public:
 
 
   const DCPackerInterface *apply_switch(const char *value_data, size_t length) const;
   const DCPackerInterface *apply_switch(const char *value_data, size_t length) const;
 
 
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
-  void output_instance(ostream &out, bool brief, const string &prename,
-                       const string &name, const string &postname) const;
-  void write_instance(ostream &out, bool brief, int indent_level,
-                      const string &prename, const string &name,
-                      const string &postname) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
+  void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                       const std::string &name, const std::string &postname) const;
+  void write_instance(std::ostream &out, bool brief, int indent_level,
+                      const std::string &prename, const std::string &name,
+                      const std::string &postname) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
 
 
@@ -73,19 +73,19 @@ public:
 
 
 public:
 public:
   typedef pvector<DCField *> Fields;
   typedef pvector<DCField *> Fields;
-  typedef pmap<string, DCField *> FieldsByName;
+  typedef pmap<std::string, DCField *> FieldsByName;
 
 
   class SwitchFields : public DCPackerInterface {
   class SwitchFields : public DCPackerInterface {
   public:
   public:
-    SwitchFields(const string &name);
+    SwitchFields(const std::string &name);
     ~SwitchFields();
     ~SwitchFields();
     virtual DCPackerInterface *get_nested_field(int n) const;
     virtual DCPackerInterface *get_nested_field(int n) const;
 
 
     bool add_field(DCField *field);
     bool add_field(DCField *field);
     bool do_check_match_switch_case(const SwitchFields *other) const;
     bool do_check_match_switch_case(const SwitchFields *other) const;
 
 
-    void output(ostream &out, bool brief) const;
-    void write(ostream &out, bool brief, int indent_level) const;
+    void output(std::ostream &out, bool brief) const;
+    void write(std::ostream &out, bool brief, int indent_level) const;
 
 
   protected:
   protected:
     virtual bool do_check_match(const DCPackerInterface *other) const;
     virtual bool do_check_match(const DCPackerInterface *other) const;
@@ -98,13 +98,13 @@ public:
 
 
   class SwitchCase {
   class SwitchCase {
   public:
   public:
-    SwitchCase(const string &value, SwitchFields *fields);
+    SwitchCase(const std::string &value, SwitchFields *fields);
     ~SwitchCase();
     ~SwitchCase();
 
 
     bool do_check_match_switch_case(const SwitchCase *other) const;
     bool do_check_match_switch_case(const SwitchCase *other) const;
 
 
   public:
   public:
-    string _value;
+    std::string _value;
     SwitchFields *_fields;
     SwitchFields *_fields;
   };
   };
 
 
@@ -112,7 +112,7 @@ private:
   SwitchFields *start_new_case();
   SwitchFields *start_new_case();
 
 
 private:
 private:
-  string _name;
+  std::string _name;
   DCField *_key_parameter;
   DCField *_key_parameter;
 
 
   typedef pvector<SwitchCase *> Cases;
   typedef pvector<SwitchCase *> Cases;
@@ -137,7 +137,7 @@ private:
   bool _fields_added;
   bool _fields_added;
 
 
   // This map indexes into the _cases vector, above.
   // This map indexes into the _cases vector, above.
-  typedef pmap<string, int> CasesByValue;
+  typedef pmap<std::string, int> CasesByValue;
   CasesByValue _cases_by_value;
   CasesByValue _cases_by_value;
 };
 };
 
 

+ 3 - 3
direct/src/dcparser/dcSwitchParameter.cxx

@@ -66,7 +66,7 @@ DCSwitchParameter(const DCSwitch *dswitch) :
   // Also consider the default case, if there is one.
   // Also consider the default case, if there is one.
   const DCSwitch::SwitchFields *fields =
   const DCSwitch::SwitchFields *fields =
     (DCSwitch::SwitchFields *)_dswitch->get_default_case();
     (DCSwitch::SwitchFields *)_dswitch->get_default_case();
-  if (fields != (DCSwitch::SwitchFields *)NULL) {
+  if (fields != nullptr) {
     if (!fields->has_fixed_byte_size() ||
     if (!fields->has_fixed_byte_size() ||
         fields->get_fixed_byte_size() != _fixed_byte_size) {
         fields->get_fixed_byte_size() != _fixed_byte_size) {
       _has_fixed_byte_size = false;
       _has_fixed_byte_size = false;
@@ -155,7 +155,7 @@ apply_switch(const char *value_data, size_t length) const {
 void DCSwitchParameter::
 void DCSwitchParameter::
 output_instance(ostream &out, bool brief, const string &prename,
 output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
                 const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {
@@ -171,7 +171,7 @@ void DCSwitchParameter::
 write_instance(ostream &out, bool brief, int indent_level,
 write_instance(ostream &out, bool brief, int indent_level,
                const string &prename, const string &name,
                const string &prename, const string &name,
                const string &postname) const {
                const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     write_typedef_name(out, brief, indent_level, prename, name, postname);
     write_typedef_name(out, brief, indent_level, prename, name, postname);
 
 
   } else {
   } else {

+ 5 - 5
direct/src/dcparser/dcSwitchParameter.h

@@ -41,11 +41,11 @@ public:
 
 
   const DCPackerInterface *apply_switch(const char *value_data, size_t length) const;
   const DCPackerInterface *apply_switch(const char *value_data, size_t length) const;
 
 
-  virtual void output_instance(ostream &out, bool brief, const string &prename,
-                               const string &name, const string &postname) const;
-  virtual void write_instance(ostream &out, bool brief, int indent_level,
-                              const string &prename, const string &name,
-                              const string &postname) const;
+  virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
+                               const std::string &name, const std::string &postname) const;
+  virtual void write_instance(std::ostream &out, bool brief, int indent_level,
+                              const std::string &prename, const std::string &name,
+                              const std::string &postname) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual void generate_hash(HashGenerator &hashgen) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
   virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
 
 

+ 5 - 5
direct/src/dcparser/dcTypedef.h

@@ -26,13 +26,13 @@ class DCParameter;
 class DCTypedef : public DCDeclaration {
 class DCTypedef : public DCDeclaration {
 public:
 public:
   DCTypedef(DCParameter *parameter, bool implicit = false);
   DCTypedef(DCParameter *parameter, bool implicit = false);
-  DCTypedef(const string &name);
+  DCTypedef(const std::string &name);
   virtual ~DCTypedef();
   virtual ~DCTypedef();
 
 
 PUBLISHED:
 PUBLISHED:
   int get_number() const;
   int get_number() const;
-  const string &get_name() const;
-  string get_description() const;
+  const std::string &get_name() const;
+  std::string get_description() const;
 
 
   bool is_bogus_typedef() const;
   bool is_bogus_typedef() const;
   bool is_implicit_typedef() const;
   bool is_implicit_typedef() const;
@@ -41,8 +41,8 @@ public:
   DCParameter *make_new_parameter() const;
   DCParameter *make_new_parameter() const;
 
 
   void set_number(int number);
   void set_number(int number);
-  virtual void output(ostream &out, bool brief) const;
-  virtual void write(ostream &out, bool brief, int indent_level) const;
+  virtual void output(std::ostream &out, bool brief) const;
+  virtual void write(std::ostream &out, bool brief, int indent_level) const;
 
 
 private:
 private:
   DCParameter *_parameter;
   DCParameter *_parameter;

+ 7 - 16
direct/src/dcparser/dcbase.h

@@ -60,10 +60,7 @@
 #include <unistd.h>
 #include <unistd.h>
 #endif
 #endif
 
 
-using namespace std;
-
 #define INLINE inline
 #define INLINE inline
-#define TYPENAME typename
 
 
 // These symbols are used within the Panda environment for exporting classes
 // These symbols are used within the Panda environment for exporting classes
 // and functions to the scripting language.  They're largely meaningless if
 // and functions to the scripting language.  They're largely meaningless if
@@ -80,15 +77,9 @@ using namespace std;
 #define nassertv(condition) assert(condition)
 #define nassertv(condition) assert(condition)
 #define nassertv_always(condition) assert(condition)
 #define nassertv_always(condition) assert(condition)
 
 
-// Panda defines these export symbols for building DLL's.  Outside of Panda,
-// we assume we're not putting this code in a DLL, so we define them to
-// nothing.
-#define EXPCL_DIRECT
-#define EXPTP_DIRECT
-
 // Panda defines a special Filename class.  We'll use an ordinary string
 // Panda defines a special Filename class.  We'll use an ordinary string
 // instead.
 // instead.
-typedef string Filename;
+typedef std::string Filename;
 
 
 // Panda defines WORDS_BIGENDIAN on a bigendian machine; otherwise, the
 // Panda defines WORDS_BIGENDIAN on a bigendian machine; otherwise, the
 // machine is assumed to be littleendian.  Outside of Panda, you're
 // machine is assumed to be littleendian.  Outside of Panda, you're
@@ -98,15 +89,15 @@ typedef string Filename;
 #include <vector>
 #include <vector>
 #include <map>
 #include <map>
 #include <set>
 #include <set>
-#define pvector vector
-#define pmap map
-#define pset set
+#define pvector std::vector
+#define pmap std::map
+#define pset std::set
 
 
 #include <stdint.h>
 #include <stdint.h>
 
 
-typedef ifstream pifstream;
-typedef ofstream pofstream;
-typedef fstream pfstream;
+typedef std::ifstream pifstream;
+typedef std::ofstream pofstream;
+typedef std::fstream pfstream;
 
 
 #endif  // WITHIN_PANDA
 #endif  // WITHIN_PANDA
 
 

+ 2 - 2
direct/src/dcparser/dcindent.h

@@ -29,8 +29,8 @@
  * stream itself.  Useful for indenting a series of lines of text by a given
  * stream itself.  Useful for indenting a series of lines of text by a given
  * amount.
  * amount.
  */
  */
-ostream &
-indent(ostream &out, int indent_level);
+std::ostream &
+indent(std::ostream &out, int indent_level);
 
 
 #endif  // WITHIN_PANDA
 #endif  // WITHIN_PANDA
 
 

+ 6 - 9
direct/src/dcparser/dcmsgtypes.h

@@ -17,16 +17,13 @@
 // This file defines the server message types used within this module.  It
 // This file defines the server message types used within this module.  It
 // duplicates some symbols defined in MsgTypes.py and AIMsgTypes.py.
 // duplicates some symbols defined in MsgTypes.py and AIMsgTypes.py.
 
 
-#define CLIENT_OBJECT_UPDATE_FIELD                        24
-#define CLIENT_CREATE_OBJECT_REQUIRED                     34
-#define CLIENT_CREATE_OBJECT_REQUIRED_OTHER               35
+#define CLIENT_OBJECT_SET_FIELD                           120
+#define CLIENT_ENTER_OBJECT_REQUIRED                      142
+#define CLIENT_ENTER_OBJECT_REQUIRED_OTHER                143
 
 
-#define STATESERVER_OBJECT_GENERATE_WITH_REQUIRED         2001
-#define STATESERVER_OBJECT_GENERATE_WITH_REQUIRED_OTHER   2003
-#define STATESERVER_OBJECT_UPDATE_FIELD                   2004
-#define STATESERVER_OBJECT_CREATE_WITH_REQUIRED_CONTEXT   2050
-#define STATESERVER_OBJECT_CREATE_WITH_REQUIR_OTHER_CONTEXT  2051
-#define STATESERVER_BOUNCE_MESSAGE                        2086
+#define STATESERVER_CREATE_OBJECT_WITH_REQUIRED           2000
+#define STATESERVER_CREATE_OBJECT_WITH_REQUIRED_OTHER     2001
+#define STATESERVER_OBJECT_SET_FIELD                      2020
 
 
 #define CLIENT_OBJECT_GENERATE_CMU                        9002
 #define CLIENT_OBJECT_GENERATE_CMU                        9002
 
 

+ 1 - 1
direct/src/dcparser/hashGenerator.h

@@ -25,7 +25,7 @@ public:
   HashGenerator();
   HashGenerator();
 
 
   void add_int(int num);
   void add_int(int num);
-  void add_string(const string &str);
+  void add_string(const std::string &str);
 
 
   unsigned long get_hash() const;
   unsigned long get_hash() const;
 
 

+ 1 - 1
direct/src/dcparser/primeNumberGenerator.h

@@ -22,7 +22,7 @@
 #include "vector_int.h"
 #include "vector_int.h"
 
 
 #else
 #else
-typedef vector<int> vector_int;
+typedef std::vector<int> vector_int;
 #endif
 #endif
 
 
 /**
 /**

+ 4 - 0
direct/src/deadrec/config_deadrec.cxx

@@ -15,6 +15,10 @@
 
 
 #include "dconfig.h"
 #include "dconfig.h"
 
 
+#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_DEADREC)
+  #error Buildsystem error: BUILDING_DIRECT_DEADREC not defined
+#endif
+
 Configure(config_deadrec);
 Configure(config_deadrec);
 NotifyCategoryDef(deadrec, "");
 NotifyCategoryDef(deadrec, "");
 
 

+ 2 - 2
direct/src/deadrec/config_deadrec.h

@@ -18,10 +18,10 @@
 #include "notifyCategoryProxy.h"
 #include "notifyCategoryProxy.h"
 #include "configVariableBool.h"
 #include "configVariableBool.h"
 
 
-NotifyCategoryDecl(deadrec, EXPCL_DIRECT, EXPTP_DIRECT);
+NotifyCategoryDecl(deadrec, EXPCL_DIRECT_DEADREC, EXPTP_DIRECT_DEADREC);
 
 
 extern ConfigVariableBool accept_clock_skew;
 extern ConfigVariableBool accept_clock_skew;
 
 
-extern EXPCL_DIRECT void init_libdeadrec();
+extern EXPCL_DIRECT_DEADREC void init_libdeadrec();
 
 
 #endif
 #endif

+ 3 - 3
direct/src/deadrec/smoothMover.h

@@ -38,7 +38,7 @@ static const int max_timestamp_delays = 10;
  * update.  The assumption is that all SmoothMovers in the world will be
  * update.  The assumption is that all SmoothMovers in the world will be
  * operating in the same mode together.
  * operating in the same mode together.
  */
  */
-class EXPCL_DIRECT SmoothMover {
+class EXPCL_DIRECT_DEADREC SmoothMover {
 PUBLISHED:
 PUBLISHED:
   SmoothMover();
   SmoothMover();
   ~SmoothMover();
   ~SmoothMover();
@@ -137,8 +137,8 @@ PUBLISHED:
   INLINE void set_default_to_standing_still(bool flag);
   INLINE void set_default_to_standing_still(bool flag);
   INLINE bool get_default_to_standing_still();
   INLINE bool get_default_to_standing_still();
 
 
-  void output(ostream &out) const;
-  void write(ostream &out) const;
+  void output(std::ostream &out) const;
+  void write(std::ostream &out) const;
 
 
 private:
 private:
   void set_smooth_pos(const LPoint3 &pos, const LVecBase3 &hpr,
   void set_smooth_pos(const LPoint3 &pos, const LVecBase3 &hpr,

+ 54 - 4
direct/src/directbase/directsymbols.h

@@ -16,12 +16,62 @@
 
 
 /* See dtoolsymbols.h for a rant on the purpose of this file.  */
 /* See dtoolsymbols.h for a rant on the purpose of this file.  */
 
 
+/* BUILDING_DIRECT is just a buildsystem shortcut for all of these: */
 #ifdef BUILDING_DIRECT
 #ifdef BUILDING_DIRECT
-  #define EXPCL_DIRECT EXPORT_CLASS
-  #define EXPTP_DIRECT EXPORT_TEMPL
+  #define BUILDING_DIRECT_DEADREC
+  #define BUILDING_DIRECT_DIRECTD
+  #define BUILDING_DIRECT_INTERVAL
+  #define BUILDING_DIRECT_MOTIONTRAIL
+  #define BUILDING_DIRECT_SHOWBASE
+  #define BUILDING_DIRECT_DISTRIBUTED
+#endif
+
+#ifdef BUILDING_DIRECT_DEADREC
+  #define EXPCL_DIRECT_DEADREC EXPORT_CLASS
+  #define EXPTP_DIRECT_DEADREC EXPORT_TEMPL
+#else
+  #define EXPCL_DIRECT_DEADREC IMPORT_CLASS
+  #define EXPTP_DIRECT_DEADREC IMPORT_TEMPL
+#endif
+
+#ifdef BUILDING_DIRECT_DIRECTD
+  #define EXPCL_DIRECT_DIRECTD EXPORT_CLASS
+  #define EXPTP_DIRECT_DIRECTD EXPORT_TEMPL
+#else
+  #define EXPCL_DIRECT_DIRECTD IMPORT_CLASS
+  #define EXPTP_DIRECT_DIRECTD IMPORT_TEMPL
+#endif
+
+#ifdef BUILDING_DIRECT_INTERVAL
+  #define EXPCL_DIRECT_INTERVAL EXPORT_CLASS
+  #define EXPTP_DIRECT_INTERVAL EXPORT_TEMPL
+#else
+  #define EXPCL_DIRECT_INTERVAL IMPORT_CLASS
+  #define EXPTP_DIRECT_INTERVAL IMPORT_TEMPL
+#endif
+
+#ifdef BUILDING_DIRECT_MOTIONTRAIL
+  #define EXPCL_DIRECT_MOTIONTRAIL EXPORT_CLASS
+  #define EXPTP_DIRECT_MOTIONTRAIL EXPORT_TEMPL
+#else
+  #define EXPCL_DIRECT_MOTIONTRAIL IMPORT_CLASS
+  #define EXPTP_DIRECT_MOTIONTRAIL IMPORT_TEMPL
+#endif
+
+#ifdef BUILDING_DIRECT_SHOWBASE
+  #define EXPCL_DIRECT_SHOWBASE EXPORT_CLASS
+  #define EXPTP_DIRECT_SHOWBASE EXPORT_TEMPL
+#else
+  #define EXPCL_DIRECT_SHOWBASE IMPORT_CLASS
+  #define EXPTP_DIRECT_SHOWBASE IMPORT_TEMPL
+#endif
+
+#ifdef BUILDING_DIRECT_DISTRIBUTED
+  #define EXPCL_DIRECT_DISTRIBUTED EXPORT_CLASS
+  #define EXPTP_DIRECT_DISTRIBUTED EXPORT_TEMPL
 #else
 #else
-  #define EXPCL_DIRECT IMPORT_CLASS
-  #define EXPTP_DIRECT IMPORT_TEMPL
+  #define EXPCL_DIRECT_DISTRIBUTED IMPORT_CLASS
+  #define EXPTP_DIRECT_DISTRIBUTED IMPORT_TEMPL
 #endif
 #endif
 
 
 #endif
 #endif

+ 7 - 3
direct/src/directd/directd.cxx

@@ -30,6 +30,10 @@
 
 
 #include "pset.h"
 #include "pset.h"
 
 
+#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_DIRECTD)
+  #error Buildsystem error: BUILDING_DIRECT_DIRECTD not defined
+#endif
+
 namespace {
 namespace {
   // ...This section is part of the old stuff from the original
   // ...This section is part of the old stuff from the original
   // implementation.  The new stuff that uses job objects doesn't need this
   // implementation.  The new stuff that uses job objects doesn't need this
@@ -79,7 +83,7 @@ namespace {
     // If we can't open the process with PROCESS_TERMINATE rights, then we
     // If we can't open the process with PROCESS_TERMINATE rights, then we
     // give up immediately.
     // give up immediately.
     hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, dwPID);
     hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, dwPID);
-    if(hProc == NULL) {
+    if(hProc == nullptr) {
        return TA_FAILED;
        return TA_FAILED;
     }
     }
 
 
@@ -111,7 +115,7 @@ namespace {
     ZeroMemory(&si, sizeof(STARTUPINFO));
     ZeroMemory(&si, sizeof(STARTUPINFO));
     si.cb = sizeof(STARTUPINFO);
     si.cb = sizeof(STARTUPINFO);
     ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
     ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
-    if (CreateProcess(NULL, (char*)cmd.c_str(),
+    if (CreateProcess(nullptr, (char*)cmd.c_str(),
         0, 0, 1, NORMAL_PRIORITY_CLASS,
         0, 0, 1, NORMAL_PRIORITY_CLASS,
         0, 0, &si, &pi)) {
         0, 0, &si, &pi)) {
       pid=pi.dwProcessId;
       pid=pi.dwProcessId;
@@ -224,7 +228,7 @@ DirectD::start_app(const string& cmd) {
     ZeroMemory(&si, sizeof(STARTUPINFO));
     ZeroMemory(&si, sizeof(STARTUPINFO));
     si.cb = sizeof(STARTUPINFO);
     si.cb = sizeof(STARTUPINFO);
     ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
     ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
-    if (CreateProcess(NULL, (char*)cmd.c_str(),
+    if (CreateProcess(nullptr, (char*)cmd.c_str(),
         0, 0, 1, NORMAL_PRIORITY_CLASS | CREATE_SUSPENDED,
         0, 0, 1, NORMAL_PRIORITY_CLASS | CREATE_SUSPENDED,
         0, 0, &si, &pi)) {
         0, 0, &si, &pi)) {
       // The process must be created with CREATE_SUSPENDED to give us a chance
       // The process must be created with CREATE_SUSPENDED to give us a chance

+ 11 - 11
direct/src/directd/directd.h

@@ -52,7 +52,7 @@ typedef int HANDLE;
  * presented in order chronologically by their intended usage.  The first
  * presented in order chronologically by their intended usage.  The first
  * group will probably provide everthing needed for DirectD.
  * group will probably provide everthing needed for DirectD.
  */
  */
-class EXPCL_DIRECT DirectD {
+class EXPCL_DIRECT_DIRECTD DirectD {
 PUBLISHED:
 PUBLISHED:
   DirectD();
   DirectD();
   ~DirectD();
   ~DirectD();
@@ -73,7 +73,7 @@ PUBLISHED:
  * one command, you should use connect_to(), send_command(), and
  * one command, you should use connect_to(), send_command(), and
  * disconnect_from().
  * disconnect_from().
  */
  */
-  int client_ready(const string& server_host, int port, const string& cmd);
+  int client_ready(const std::string& server_host, int port, const std::string& cmd);
 
 
 /**
 /**
  * Tell the server to do the command cmd.  cmd is one of the following:
  * Tell the server to do the command cmd.  cmd is one of the following:
@@ -85,7 +85,7 @@ PUBLISHED:
  * client_ready(), it prefixes "!" for you.  A new connection will be created
  * client_ready(), it prefixes "!" for you.  A new connection will be created
  * and closed.
  * and closed.
  */
  */
-  int tell_server(const string& server_host, int port, const string& cmd);
+  int tell_server(const std::string& server_host, int port, const std::string& cmd);
 
 
 /**
 /**
  * Call this function from the client after calling <count> client_ready()
  * Call this function from the client after calling <count> client_ready()
@@ -102,7 +102,7 @@ PUBLISHED:
  * Call this function from the server when import ShowbaseGlobal is nearly
  * Call this function from the server when import ShowbaseGlobal is nearly
  * finished.
  * finished.
  */
  */
-  int server_ready(const string& client_host, int port);
+  int server_ready(const std::string& client_host, int port);
 
 
 /**
 /**
  * Call connect_to from client for each server.  returns the port number of
  * Call connect_to from client for each server.  returns the port number of
@@ -110,28 +110,28 @@ PUBLISHED:
  * second argument).  The return value can be used for the port arguemnt in
  * second argument).  The return value can be used for the port arguemnt in
  * disconnect_from().
  * disconnect_from().
  */
  */
-  int connect_to(const string& server_host, int port);
+  int connect_to(const std::string& server_host, int port);
 
 
 /**
 /**
  * This is the counterpart to connect_to().  Pass the same server_host as for
  * This is the counterpart to connect_to().  Pass the same server_host as for
  * connect_to(), but pass the return value from connect_to() for the port, not
  * connect_to(), but pass the return value from connect_to() for the port, not
  * the port passed to connect_to().
  * the port passed to connect_to().
  */
  */
-  void disconnect_from(const string& server_host, int port);
+  void disconnect_from(const std::string& server_host, int port);
 
 
 /**
 /**
  * Send the same command string to all current connections.
  * Send the same command string to all current connections.
  */
  */
-  void send_command(const string& cmd);
+  void send_command(const std::string& cmd);
 
 
 protected:
 protected:
-  void start_app(const string& cmd);
+  void start_app(const std::string& cmd);
   void kill_app(int index);
   void kill_app(int index);
   void kill_all();
   void kill_all();
-  virtual void handle_command(const string& cmd);
+  virtual void handle_command(const std::string& cmd);
   void handle_datagram(NetDatagram& datagram);
   void handle_datagram(NetDatagram& datagram);
-  void send_one_message(const string& host_name,
-      int port, const string& message);
+  void send_one_message(const std::string& host_name,
+      int port, const std::string& message);
 
 
   QueuedConnectionManager _cm;
   QueuedConnectionManager _cm;
   QueuedConnectionReader _reader;
   QueuedConnectionReader _reader;

+ 2 - 2
direct/src/directdServer/directdClient.cxx

@@ -24,7 +24,7 @@ DirectDClient::cli_command(const string& cmd) {
   cerr<<"command "<<cmd<<endl;
   cerr<<"command "<<cmd<<endl;
   if (cmd[0]==':') {
   if (cmd[0]==':') {
     // ...connect to host.
     // ...connect to host.
-    cerr<<"Local command "<<flush;
+    cerr<<"Local command "<<std::flush;
     string code;
     string code;
     cin >> code;
     cin >> code;
     string host;
     string host;
@@ -49,7 +49,7 @@ DirectDClient::run_client(const string& host, int port) {
   connect_to(host, port);
   connect_to(host, port);
 
 
   while (!cin.fail() && _connections.size()!=0) {
   while (!cin.fail() && _connections.size()!=0) {
-    cout << "directd send: " << flush;
+    cout << "directd send: " << std::flush;
     string d;
     string d;
     cin >> d;
     cin >> d;
     cli_command(d);
     cli_command(d);

+ 2 - 2
direct/src/directdServer/directdClient.h

@@ -21,8 +21,8 @@ public:
   DirectDClient();
   DirectDClient();
   ~DirectDClient();
   ~DirectDClient();
 
 
-  void run_client(const string& host, int port);
+  void run_client(const std::string& host, int port);
 
 
 protected:
 protected:
-  void cli_command(const string& cmd);
+  void cli_command(const std::string& cmd);
 };
 };

+ 2 - 2
direct/src/directdServer/directdServer.h

@@ -29,6 +29,6 @@ public:
   void run_server(int port);
   void run_server(int port);
 
 
 protected:
 protected:
-  void read_command(string& cmd);
-  virtual void handle_command(const string& cmd);
+  void read_command(std::string& cmd);
+  virtual void handle_command(const std::string& cmd);
 };
 };

+ 2 - 2
direct/src/directtools/DirectSelection.py

@@ -623,8 +623,8 @@ class SelectionRay(SelectionQueue):
     def pickBitMask(self, bitMask = BitMask32.allOff(),
     def pickBitMask(self, bitMask = BitMask32.allOff(),
                     targetNodePath = None,
                     targetNodePath = None,
                     skipFlags = SKIP_ALL):
                     skipFlags = SKIP_ALL):
-        if parentNodePath is None:
-            parentNodePath = render
+        if targetNodePath is None:
+            targetNodePath = render
         self.collideWithBitMask(bitMask)
         self.collideWithBitMask(bitMask)
         self.pick(targetNodePath)
         self.pick(targetNodePath)
         # Determine collision entry
         # Determine collision entry

+ 2 - 0
direct/src/distributed/CRDataCache.py

@@ -2,6 +2,8 @@ from direct.distributed.CachedDOData import CachedDOData
 from panda3d.core import ConfigVariableInt
 from panda3d.core import ConfigVariableInt
 
 
 
 
+__all__ = ["CRDataCache"]
+
 class CRDataCache:
 class CRDataCache:
     # Stores cached data for DistributedObjects between instantiations on the client
     # Stores cached data for DistributedObjects between instantiations on the client
 
 

+ 3 - 3
direct/src/distributed/ClientRepositoryBase.py

@@ -175,7 +175,7 @@ class ClientRepositoryBase(ConnectionRepository):
         "generate" messages when they are replayed().
         "generate" messages when they are replayed().
         """
         """
 
 
-        if msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER:
+        if msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER:
             # It's a generate message.
             # It's a generate message.
             doId = extra
             doId = extra
             if doId in self.deferredDoIds:
             if doId in self.deferredDoIds:
@@ -263,7 +263,7 @@ class ClientRepositoryBase(ConnectionRepository):
             distObj.setLocation(parentId, zoneId)
             distObj.setLocation(parentId, zoneId)
             distObj.updateRequiredFields(dclass, di)
             distObj.updateRequiredFields(dclass, di)
             # updateRequiredFields calls announceGenerate
             # updateRequiredFields calls announceGenerate
-            print("New DO:%s, dclass:%s"%(doId, dclass.getName()))
+            self.notify.debug("New DO:%s, dclass:%s" % (doId, dclass.getName()))
         return distObj
         return distObj
 
 
     def generateWithRequiredOtherFields(self, dclass, doId, di,
     def generateWithRequiredOtherFields(self, dclass, doId, di,
@@ -381,7 +381,7 @@ class ClientRepositoryBase(ConnectionRepository):
             # The object had been deferred.  Great; we don't even have
             # The object had been deferred.  Great; we don't even have
             # to generate it now.
             # to generate it now.
             del self.deferredDoIds[doId]
             del self.deferredDoIds[doId]
-            i = self.deferredGenerates.index((CLIENT_CREATE_OBJECT_REQUIRED_OTHER, doId))
+            i = self.deferredGenerates.index((CLIENT_ENTER_OBJECT_REQUIRED_OTHER, doId))
             del self.deferredGenerates[i]
             del self.deferredGenerates[i]
             if len(self.deferredGenerates) == 0:
             if len(self.deferredGenerates) == 0:
                 taskMgr.remove('deferredGenerate')
                 taskMgr.remove('deferredGenerate')

+ 5 - 4
direct/src/distributed/ConnectionRepository.py

@@ -7,9 +7,10 @@ from direct.distributed.DoCollectionManager import DoCollectionManager
 from direct.showbase import GarbageReport
 from direct.showbase import GarbageReport
 from .PyDatagramIterator import PyDatagramIterator
 from .PyDatagramIterator import PyDatagramIterator
 
 
-import types
+import inspect
 import gc
 import gc
 
 
+__all__ = ["ConnectionRepository", "GCTrigger"]
 
 
 class ConnectionRepository(
 class ConnectionRepository(
         DoInterestManager, DoCollectionManager, CConnectionRepository):
         DoInterestManager, DoCollectionManager, CConnectionRepository):
@@ -326,13 +327,13 @@ class ConnectionRepository(
             if classDef is None:
             if classDef is None:
                 self.notify.debug("No class definition for %s." % (className))
                 self.notify.debug("No class definition for %s." % (className))
             else:
             else:
-                if type(classDef) == types.ModuleType:
+                if inspect.ismodule(classDef):
                     if not hasattr(classDef, className):
                     if not hasattr(classDef, className):
                         self.notify.warning("Module %s does not define class %s." % (className, className))
                         self.notify.warning("Module %s does not define class %s." % (className, className))
                         continue
                         continue
                     classDef = getattr(classDef, className)
                     classDef = getattr(classDef, className)
 
 
-                if type(classDef) != types.ClassType and type(classDef) != types.TypeType:
+                if not inspect.isclass(classDef):
                     self.notify.error("Symbol %s is not a class name." % (className))
                     self.notify.error("Symbol %s is not a class name." % (className))
                 else:
                 else:
                     dclass.setClassDef(classDef)
                     dclass.setClassDef(classDef)
@@ -387,7 +388,7 @@ class ConnectionRepository(
                     if classDef is None:
                     if classDef is None:
                         self.notify.error("No class definition for %s." % className)
                         self.notify.error("No class definition for %s." % className)
                     else:
                     else:
-                        if type(classDef) == types.ModuleType:
+                        if inspect.ismodule(classDef):
                             if not hasattr(classDef, className):
                             if not hasattr(classDef, className):
                                 self.notify.error("Module %s does not define class %s." % (className, className))
                                 self.notify.error("Module %s does not define class %s." % (className, className))
                             classDef = getattr(classDef, className)
                             classDef = getattr(classDef, className)

+ 2 - 0
direct/src/distributed/DistributedNode.py

@@ -15,6 +15,8 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath):
             self.DistributedNode_initialized = 1
             self.DistributedNode_initialized = 1
             self.gotStringParentToken = 0
             self.gotStringParentToken = 0
             DistributedObject.DistributedObject.__init__(self, cr)
             DistributedObject.DistributedObject.__init__(self, cr)
+            if not self.this:
+                NodePath.__init__(self, "DistributedNode")
 
 
             # initialize gridParent
             # initialize gridParent
             self.gridParent = None
             self.gridParent = None

+ 0 - 1
direct/src/distributed/DistributedNodeUD.py

@@ -1,4 +1,3 @@
-#from otp.ai.AIBaseGlobal import *
 from .DistributedObjectUD import DistributedObjectUD
 from .DistributedObjectUD import DistributedObjectUD
 
 
 class DistributedNodeUD(DistributedObjectUD):
 class DistributedNodeUD(DistributedObjectUD):

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff