1 /*
2  *
3  *  Iter Vehemens ad Necem (IVAN)
4  *  Copyright (C) Timo Kiviluoto
5  *  Released under the GNU General
6  *  Public License
7  *
8  *  See LICENSING which should be included
9  *  along with this file for more details
10  *
11  */
12 
13 #ifndef __COMMAND_H__
14 #define __COMMAND_H__
15 
16 #include "ivandef.h"
17 
18 typedef truth (item::*sorter)(ccharacter*) const;
19 
20 class command
21 {
22  public:
23   command(truth (*)(character*), cchar*, char, char, char, truth, truth = false);
GetLinkedFunction()24   truth (*GetLinkedFunction() const)(character*) { return LinkedFunction; }
GetDescription()25   cchar* GetDescription() const { return Description; }
26   int GetKey() const;
IsUsableInWilderness()27   truth IsUsableInWilderness() const { return UsableInWilderness; }
IsWizardModeFunction()28   truth IsWizardModeFunction() const { return WizardModeFunction; }
SetCustomKey(int iKey)29   int SetCustomKey(int iKey){ int iKeyBkp=Key4; Key4 = iKey; return iKeyBkp; }
30  private:
31   truth (*LinkedFunction)(character*);
32   cchar* Description;
33   char Key1;
34   char Key2;
35   char Key3;
36   int Key4; // custom keys can be more than 1 char long as ex.: KEY_HOME is 0x147 or 0x0147
37   truth UsableInWilderness;
38   truth WizardModeFunction;
39 };
40 
41 class commandsystem
42 {
43  public:
GetCommand(int I)44   static command* GetCommand(int I) { return Command[I]; }
45   static truth IsForRegionListItem(int iIndex);
46   static truth IsForRegionSilhouette(int iIndex);
47   static void PlayerDiedLookMode(bool bSeeWholeMapCheatMode=false);
48   static void PlayerDiedWeaponSkills();
49   static void SaveSwapWeapons(outputfile& SaveFile);
50   static void LoadSwapWeapons(inputfile& SaveFile);
51   static void ClearSwapWeapons();
52   static std::vector<v2> GetRouteGoOnCopy();
53  private:
54   static truth Apply(character*);
55   static truth ApplyWork(character* Char,item* itOverride=NULL);
56   static truth ApplyAgain(character* Char);
57   static truth Close(character*);
58   static truth Eat(character*);
59   static truth Drink(character*);
60   static truth Taste(character*);
61   static truth Dip(character*);
62   static truth DrawMessageHistory(character*);
63   static truth SwapWeapons(character* Char);
64   static truth SwapWeaponsWork(character* Char, int iIndexOverride=-1);
65   static truth SwapWeaponsCfg(character* Char);
66   static truth Drop(character*);
67   static truth ForceVomit(character*);
68   static truth GoDown(character*);
69   static truth GoUp(character*);
70   static truth Kick(character*);
71   static truth Look(character*);
72   static truth NOP(character*);
73   static truth Offer(character*);
74   static truth Open(character*);
75   static truth PickUp(character*);
76   static truth Pray(character*);
77   static truth Craft(character*);
78   static truth Quit(character*);
79   static truth Read(character*);
80   static truth Save(character*);
81   static truth ShowInventory(character*);
82   static truth ShowKeyLayout(character*);
83   static truth ShowWeaponSkills(character*);
84   static truth Talk(character*);
85   static truth Throw(character*);
86   static truth EquipmentScreen(character*);
87   static truth WhatToEngrave(character*);
88   static truth WhatToEngrave(character* Char,bool bEngraveNote,v2 v2EngraveNotePos);
89   static truth Zap(character*);
90   static truth Rest(character*);
91   static truth Sit(character*);
92   static truth ShowMap(character*);
93   static truth ShowMapWork(character* Char,v2* pv2ChoseLocation=NULL);
94   static truth Go(character*);
95   static truth ShowConfigScreen(character*);
96   static truth ScrollMessagesDown(character*);
97   static truth ScrollMessagesUp(character*);
98   static truth WieldInRightArm(character*);
99   static truth WieldInLeftArm(character*);
100   static truth AssignName(character*);
101   static truth Search(character*);
102   static truth Consume(character*, cchar*, cchar*, sorter, truth = false);
103   static truth ShowWorldSeed(character*);
104 #ifdef WIZARD
105   static truth WizardMode(character*);
106   static truth AutoPlay(character* Char);
107   static truth RaiseStats(character*);
108   static truth LowerStats(character*);
109   static truth SeeWholeMap(character*);
110   static truth WalkThroughWalls(character*);
111   static truth RaiseGodRelations(character*);
112   static truth LowerGodRelations(character*);
113   static truth GainDivineKnowledge(character*);
114   static truth GainAllItems(character*);
115   static truth SecretKnowledge(character*);
116   static truth DetachBodyPart(character*);
117   static truth SetFireToBodyPart(character*);
118   static truth SummonMonster(character*);
119   static truth LevelTeleport(character*);
120   static truth Possess(character*);
121   static truth Polymorph(character*);
122 #else
123   static truth DevConsCmd(character* Char);
124 #endif
125   static truth ToggleRunning(character*);
126   static truth IssueCommand(character*);
127   static command* Command[];
128 };
129 
130 #endif
131