]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Devtools/ConsoleCmds.cpp
Cleaned up Objects handling
[lugaru.git] / Source / Devtools / ConsoleCmds.cpp
index dc4c275d58989bae4427039e53d1ac72fb8f4c72..baa1463893dae10c5dbab20b068de2002900c766 100644 (file)
@@ -18,11 +18,12 @@ You should have received a copy of the GNU General Public License
 along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "Game.h"
-#include "Devtools/ConsoleCmds.h"
-#include "Level/Dialog.h"
-#include "Level/Hotspot.h"
-#include "Utils/Folders.h"
+#include "Devtools/ConsoleCmds.hpp"
+
+#include "Game.hpp"
+#include "Level/Dialog.hpp"
+#include "Level/Hotspot.hpp"
+#include "Utils/Folders.hpp"
 
 const char *cmd_names[cmd_count] = {
 #define DECLARE_COMMAND(cmd) #cmd,
@@ -51,7 +52,6 @@ extern float slomofreq;
 extern int tutoriallevel;
 extern int hostile;
 extern int maptype;
-extern Objects objects;
 extern int slomo;
 extern float slomodelay;
 extern bool skyboxtexture;
@@ -209,14 +209,14 @@ void ch_save(const char *args)
 
     fpackf(tfile, "Bi", environment);
 
-    fpackf(tfile, "Bi", objects.numobjects);
+    fpackf(tfile, "Bi", Object::objects.size());
 
-    for (int k = 0; k < objects.numobjects; k++)
-        fpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", objects.type[k], objects.yaw[k], objects.pitch[k],
-               objects.position[k].x, objects.position[k].y, objects.position[k].z, objects.scale[k]);
+    for (int k = 0; k < Object::objects.size(); k++)
+        fpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", Object::objects[k]->type, Object::objects[k]->yaw, Object::objects[k]->pitch,
+               Object::objects[k]->position.x, Object::objects[k]->position.y, Object::objects[k]->position.z, Object::objects[k]->scale);
 
     fpackf(tfile, "Bi", Hotspot::hotspots.size());
-    for (int i = 0; i < Hotspot::hotspots.size(); i++) {
+    for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) {
         fpackf(tfile, "Bi Bf Bf Bf Bf", Hotspot::hotspots[i].type, Hotspot::hotspots[i].size, Hotspot::hotspots[i].position.x, Hotspot::hotspots[i].position.y, Hotspot::hotspots[i].position.z);
         int templength = strlen(Hotspot::hotspots[i].text);
         fpackf(tfile, "Bi", templength);
@@ -261,7 +261,8 @@ void ch_save(const char *args)
             bodyprop = Person::players[j]->proportionbody.x / 1.1;
             armprop = Person::players[j]->proportionarms.x / 1.1;
             legprop = Person::players[j]->proportionlegs.x / 1.1;
-        } else if (Person::players[j]->creature == rabbittype) {
+        } else {
+            // rabbittype
             headprop = Person::players[j]->proportionhead.x / 1.2;
             bodyprop = Person::players[j]->proportionbody.x / 1.05;
             armprop = Person::players[j]->proportionarms.x / 1.00;
@@ -655,7 +656,7 @@ void ch_play(const char *args)
     sscanf(args, "%d", &dlg);
     Dialog::whichdialogue = dlg;
 
-    if (Dialog::whichdialogue >= Dialog::dialogs.size()) {
+    if (Dialog::whichdialogue >= int(Dialog::dialogs.size())) {
         return;
     }
 
@@ -715,7 +716,7 @@ void ch_skytint(const char *args)
     SetUpLighting();
 
     terrain.DoShadows();
-    objects.DoShadows();
+    Object::DoShadows();
 }
 
 void ch_skylight(const char *args)
@@ -725,7 +726,7 @@ void ch_skylight(const char *args)
     SetUpLighting();
 
     terrain.DoShadows();
-    objects.DoShadows();
+    Object::DoShadows();
 }
 
 void ch_skybox(const char *args)
@@ -735,5 +736,5 @@ void ch_skybox(const char *args)
     SetUpLighting();
 
     terrain.DoShadows();
-    objects.DoShadows();
+    Object::DoShadows();
 }