OSDN Git Service

Added a check to ensure that a floor's altitude is properly set at the end of a Floor...
authorryan <>
Mon, 15 Aug 2016 03:44:02 +0000 (03:44 +0000)
committerryan <>
Mon, 15 Aug 2016 03:44:02 +0000 (03:44 +0000)
src/frontend/script_floors.cpp
src/sbs/floor.cpp
src/sbs/floor.h

index 8d77d8f..c770bab 100644 (file)
@@ -1859,6 +1859,10 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
        //handle end of floor section
        if (linecheck == "<endfloor>" && config->RangeL == config->RangeH)
        {
+               //when finishing a floor, make sure the altitude is valid
+               if (floor->AltitudeSet == false)
+                       return ScriptError("Floor altitude or height has not been set");
+
                config->SectionNum = 0;
                config->Context = "None";
                engine->Report("Finished floor");
index c773d45..bd8d3a1 100644 (file)
@@ -85,6 +85,7 @@ Floor::Floor(Object *parent, FloorManager *manager, int number) : Object(parent)
        InterfloorHeight = 0;
        EnabledGroup = false;
        EnabledGroup_Floor = 0;
+       AltitudeSet = false;
 
        //create a dynamic mesh for doors
        DoorWrapper = new DynamicMesh(this, GetSceneNode(), GetName() + " Door Container", 0, true);
@@ -1379,6 +1380,7 @@ void Floor::SetAltitude(float altitude)
        //position object at altitude
        SetPositionY(altitude);
        Altitude = altitude;
+       AltitudeSet = true;
 }
 
 void Floor::ShowInfo(bool detailed, bool display_header)
index b297b66..24caf83 100644 (file)
@@ -52,6 +52,7 @@ public:
        std::vector<int> Group; //floor group
        bool EnabledGroup; //true if floor was enabled as part of a group, not directly
        int EnabledGroup_Floor; //number of floor that enabled this floor as part of it's own group
+       bool AltitudeSet; //has altitude been set?
 
        //functions
        Floor(Object *parent, FloorManager *manager, int number);