Skyscraper 2.0
section.h
Go to the documentation of this file.
1/*
2 Skyscraper 2.0 Alpha - Script Processor - Script Section
3 Copyright (C)2003-2024 Ryan Thoryk
4 https://www.skyscrapersim.net
5 https://sourceforge.net/projects/skyscraper/
6 Contact - ryan@skyscrapersim.net
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21*/
22
23#ifndef SCRIPTSECTION_H
24#define SCRIPTSECTION_H
25
26namespace Skyscraper {
27
29{
30friend class ScriptProcessor;
31
32public:
34 virtual ~Section() {}
35 virtual void Reset() {}
36 virtual int Run(std::string &LineData) { return 0; }
37 int SplitData(const std::string &string, int start, bool calc = true);
38 int SplitAfterEquals(const std::string &string, bool calc = true);
39 std::string GetAfterEquals(const std::string &string, bool &found_equals);
40 std::string GetBeforeEquals(const std::string &string, bool calc = true);
41 bool GetRange(const std::string &string, int &start, int &end);
42 int ScriptError(std::string message, bool warning = false);
43 int ScriptError();
44 int ScriptWarning(std::string message);
45 bool IfProc(const std::string &expression);
46 void StoreCommand(SBS::Object *object);
47 int MathFunctions(std::string &LineData);
48 ::SBS::MeshObject* GetMeshObject(std::string name);
49 bool GetElevatorCar(std::string &value, int floor, int &elevator, int &car);
50 void GetDirectionStrings(int direction, std::string &face_direction, std::string &open_direction);
51
52protected:
56 std::vector<std::string> tempdata;
59
60 std::string Calc(const std::string &expression);
61};
62
64{
65public:
68 void Reset();
69
70 //shared values for sections
71 bool setkey;
79 int Current, CurrentOld; //current range iteration
80 int SectionNum; //current section number
81 std::string Context, ContextOld; //section context
83 bool InWhile;
85 bool CheckScript; //if true, quick-checks script execution, and exits
86};
87
95
103
111
119
144
152
160
168
176
184
185}
186
187#endif
CommandsSection(ScriptProcessor *parent)
Definition commands.cpp:56
FloorSection(ScriptProcessor *parent)
Definition floors.cpp:53
GlobalsSection(ScriptProcessor *parent)
Definition globals.cpp:36
std::string Calc(const std::string &expression)
Definition section.cpp:1030
std::vector< std::string > tempdata
Definition section.h:56
int SplitData(const std::string &string, int start, bool calc=true)
Definition section.cpp:52
bool GetRange(const std::string &string, int &start, int &end)
Definition section.cpp:176
int MathFunctions(std::string &LineData)
Definition section.cpp:430
int SplitAfterEquals(const std::string &string, bool calc=true)
Definition section.cpp:78
bool GetElevatorCar(std::string &value, int floor, int &elevator, int &car)
Definition section.cpp:1198
void StoreCommand(SBS::Object *object)
Definition section.cpp:425
Section(ScriptProcessor *parent)
Definition section.cpp:42
virtual int Run(std::string &LineData)
Definition section.h:36
ScriptProcessor::ConfigHandler * config
Definition section.h:58
std::string GetBeforeEquals(const std::string &string, bool calc=true)
Definition section.cpp:129
int ScriptWarning(std::string message)
Definition section.cpp:212
::SBS::MeshObject * GetMeshObject(std::string name)
Definition section.cpp:1035
void GetDirectionStrings(int direction, std::string &face_direction, std::string &open_direction)
Definition section.cpp:1254
bool IfProc(const std::string &expression)
Definition section.cpp:217
std::string GetAfterEquals(const std::string &string, bool &found_equals)
Definition section.cpp:107
TexturesSection(ScriptProcessor *parent)
Definition textures.cpp:34
VehicleSection(ScriptProcessor *parent)
Definition vehicles.cpp:34
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57