]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Objects/Object.cpp
Fixing some warnings
[lugaru.git] / Source / Objects / Object.cpp
index 1189f365243c75a0fdb33193a35f599313c5213b..c91e5d8c2b3faf84a973c965856403fcc3168c91 100644 (file)
@@ -49,7 +49,7 @@ Texture Object::rocktextureptr;
 
 Object::Object() :
     position(),
-    type(0),
+    type(boxtype),
     yaw(0),
     pitch(0),
     rotx(0),
@@ -70,7 +70,7 @@ Object::Object() :
 {
 }
 
-Object::Object(int _type, XYZ _position, float _yaw, float _pitch, float _scale) : Object()
+Object::Object(object_type _type, XYZ _position, float _yaw, float _pitch, float _scale) : Object()
 {
     scale = _scale;
     type = _type;
@@ -689,7 +689,7 @@ void Object::ComputeRadius()
 {
     float maxdistance = 0;
     float tempdist;
-    for (int i = 0; i < objects.size(); i++) {
+    for (unsigned int i = 0; i < objects.size(); i++) {
         tempdist = distsq(&center, &objects[i]->position);
         if (tempdist > maxdistance) {
             maxdistance = tempdist;
@@ -714,7 +714,7 @@ void Object::LoadObjectsFromFile(FILE* tfile, bool skip)
             if (type == treeleavestype) {
                 scale = lastscale;
             }
-            objects.emplace_back(new Object(type, position, yaw, pitch, scale));
+            objects.emplace_back(new Object(object_type(type), position, yaw, pitch, scale));
             lastscale = scale;
         }
     }
@@ -788,7 +788,7 @@ void Object::MakeObject(int atype, XYZ where, float ayaw, float apitch, float as
 {
     if ((atype != treeleavestype && atype != bushtype) || foliage == 1) {
         unsigned nextid = objects.size();
-        objects.emplace_back(new Object(atype, where, ayaw, apitch, ascale));
+        objects.emplace_back(new Object(object_type(atype), where, ayaw, apitch, ascale));
         objects.back()->addToTerrain(nextid);
     }
 }
@@ -825,9 +825,9 @@ int Object::checkcollide(XYZ startpoint, XYZ endpoint)
     maxy = max(startpoint.y, endpoint.y) + 1;
     maxz = max(startpoint.z, endpoint.z) + 1;
 
-    for (int i = 0; i < objects.size(); i++) {
+    for (unsigned int i = 0; i < objects.size(); i++) {
         if (checkcollide(startpoint, endpoint, i, minx, miny, minz, maxx, maxy, maxz) != -1) {
-            return i;
+            return (int) i;
         }
     }