annotate scn2k/scn2k_flags.h @ 66:d112357a0ec1

Fix a bug with savegames introduced with changeset c7bcc0ec2267. Warning: savegames created since c7bcc0ec2267 are probably corrupted, you may have to start the game over. If you chose not to do so, you should replace all occurrences of 'TextWindow' by 'TextImplWindow', and 'Text Window' by 'TextImpl Window' in your save files.
author Thibaut Girka <thib@sitedethib.com>
date Sat, 11 Dec 2010 18:36:20 +0100
parents 4416cfac86ae
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
1 #ifndef __SCN2K_FLAGS_H__
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
2 #define __SCN2K_FLAGS_H__
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
3
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
4 #include <set>
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
5 #include <string>
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
6
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
7 struct VarInfo {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
8 #define TYPE_NONSYSVARMAX 5
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
9 #define TYPE_VARMAX 9
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
10 #define TYPE_VARLOCSTR 10
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
11 #define TYPE_VARSYSSTR 12
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
12 #define TYPE_VARSTR 18
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
13 #define TYPE_STR 58
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
14 #define TYPE_VAL 68
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
15 #define TYPE_SYS 0xc8
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
16 #define TYPE_END 0x7f
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
17
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
18 #define TYPE_SYS_SYS 0
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
19 #define TYPE_SYS_SKIPMODE 1
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
20 int type;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
21 int number;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
22 int value;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
23 VarInfo() { type = TYPE_VAL; value = 0;}
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
24 VarInfo(int n) { type = TYPE_VAL; value = n;}
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
25 VarInfo(const VarInfo& i) { type = i.type; number = i.number; value = i.value;}
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
26 };
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
27
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
28 class Flags {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
29 /* flag:
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 63
diff changeset
30 ** type 0-5 : ローカル整数、各2000個
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 63
diff changeset
31 ** type 6, 25 : グローバル整数、2000個
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 63
diff changeset
32 ** type 10,11: ローカル整数??、各2000個
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 63
diff changeset
33 ** type 12 : グローバル文字列、2000個 (今は無視しても良いが)
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 63
diff changeset
34 ** type 18 : ローカル文字列、2000個
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 63
diff changeset
35 ** type 25: システム変数(マウス座標など?) 1000 個?
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
36 ** type 26-32, 51 : 1-bit access to 0-6, 25
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
37 ** type 52-58, 77 : 2-bit access to 0-6, 25
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
38 ** type 78-84, 103 : 4-bit access to 0-6, 25
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
39 ** type 104-110, 129 : 8-bit access to 0-6, 25
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
40 */
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
41 private:
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
42 typedef unsigned int uint;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
43 int sys;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
44 int var[TYPE_VARMAX+1][2000];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
45 std::string str[2000];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
46 std::string sys_str[2000];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
47 std::string loc_str[3];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
48 public:
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
49 Flags(void);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
50 int operator () () const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
51 int operator () (VarInfo info) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
52 void Str(int type, unsigned int number, char* buf, int sz) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
53 std::string Str(int type, unsigned int number) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
54 std::set<int> cgm_data;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
55
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
56 bool IsInt(int type) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
57 int MaxIndex(int type) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
58
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
59 void Set(VarInfo info, int value);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
60 int Get(int type, int number) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
61 void SetSys(int value);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
62 void SetStr(VarInfo info, std::string val);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
63
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
64 bool Exec(class Cmd& cmd);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
65
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
66 void Load(const char* str);
63
4b9ffe15a87d Refactor Load/LoadSys
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
67 void LoadSys(const char* str);
4b9ffe15a87d Refactor Load/LoadSys
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
68 void Load(const char* str, bool sys);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
69
63
4b9ffe15a87d Refactor Load/LoadSys
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
70 void Save(std::string& str);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
71 void SaveSys(std::string& str);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
72 };
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
73
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
74 #endif