Planeshift
autoexec.h
Go to the documentation of this file.
1 /*
2  * autoexec.h
3  *
4  * Author: Fabian Stock (Aiwendil)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation (version 2 of the License)
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16  *
17  */
18 
19 #ifndef AUTOEXEC_HEADER
20 #define AUTOEXEC_HEADER
21 
22 // Crystal Space Includes
23 #include <csutil/csstring.h>
24 #include <csutil/array.h>
25 
27 {
31  csString name;
32  csString cmd;
33 };
34 
36 class Autoexec
37 {
38  public:
39  Autoexec();
40  ~Autoexec();
41  void execute();
42 
45  bool GetEnabled() { return enabled; };
49  void SetEnabled(const bool en) {enabled = en;};
50  void SaveCommands();
51  void LoadDefault();
52 
57  csString getCommands(csString name);
62  void addCommand(csString name, csString cmd);
63  protected:
67  void LoadCommands(const char * fileName);
68  bool enabled;
69  csArray<AutoexecCommand> cmds;
70 };
71 
72 
73 #endif // AUTOEXEC_HEADER
74 
csString name
Charname associated to the player.
Definition: autoexec.h:31
class handling autoexecution of commands at the startup.
Definition: autoexec.h:36
csString cmd
The commands to run.
Definition: autoexec.h:32
csArray< AutoexecCommand > cmds
Stores all the commands which are in the data file.
Definition: autoexec.h:69
bool GetEnabled()
Gets if the autoexec is enabled and will trigger.
Definition: autoexec.h:45
void SetEnabled(const bool en)
Sets if the autoexec is enabled and will trigger.
Definition: autoexec.h:49
bool enabled
Stores if the autoexec functionality is enabled.
Definition: autoexec.h:68