typos
[k8-i-v-a-n.git] / src / game / command.h
blob5a8aad862aab3db38e181aeb6a5b3e79eec5ec39
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __COMMAND_H__
13 #define __COMMAND_H__
15 #include "ivancommon.h"
17 #include <vector>
19 #include "ivandef.h"
22 typedef truth (item::*sorter) (ccharacter *) const;
24 class command {
25 public:
26 command (cchar *name, truth (*LinkedFunction)(character *), cchar *Description,
27 char Key1, char Key2, truth UsableInWilderness, truth WizardModeFunction=false);
29 truth (*GetLinkedFunction() const) (character *) { return LinkedFunction; }
31 cchar *GetDescription () const { return Description; }
32 const festring &GetName () const { return mName; }
33 char GetKey () const;
34 char GetKey1 () const { return Key1; }
35 char GetKey2 () const { return Key2; }
36 void SetKeys (char k1, char k2) { Key1 = k1; Key2 = k2; }
37 truth IsUsableInWilderness () const { return UsableInWilderness; }
38 truth IsWizardModeFunction () const { return WizardModeFunction; }
40 private:
41 festring mName;
42 truth (*LinkedFunction) (character *);
43 cchar *Description;
44 char Key1;
45 char Key2;
46 truth UsableInWilderness;
47 truth WizardModeFunction;
51 class commandsystem {
52 public:
53 commandsystem ();
55 static void ConfigureKeys ();
56 static void SaveKeys (truth forced=false);
58 static command *GetCommand (int idx) { return (idx >= 0 && idx < (int)mCommands.size()) ? mCommands[idx] : 0; }
60 static truth Consume (character*, cchar*, sorter);
62 static void RegisterCommand (command *);
64 protected:
65 //static command *Command[];
66 static std::vector<command *> mCommands;
70 #endif