annotate scn2k/scn2k_impl.h @ 47:5f548e5957a8

* get rid of the "deprecated conversion from string constant to ‘char*’" warnings
author thib
date Wed, 15 Apr 2009 20:26:32 +0000
parents 5ae5533b3a9a
children 15a18fbe6f21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
1 /*
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
2 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
3 * All rights reserved.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
4 *
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
5 * Redistribution and use in source and binary forms, with or without
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
6 * modification, are permitted provided that the following conditions
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
7 * are met:
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
8 * 1. Redistributions of source code must retain the above copyright
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
9 * notice, this list of conditions and the following disclaimer.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
10 * 2. Redistributions in binary form must reproduce the above copyright
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
11 * notice, this list of conditions and the following disclaimer in the
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
12 * documentation and/or other materials provided with the distribution.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
13 * 3. The name of the author may not be used to endorse or promote products
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
14 * derived from this software without specific prior written permission.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
15 *
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
26 */
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
27
0
223b71206888 Initial import
thib
parents:
diff changeset
28 #ifndef __SCN2k_IMPL_H__
223b71206888 Initial import
thib
parents:
diff changeset
29 #define __SCN2k_IMPL_H__
223b71206888 Initial import
thib
parents:
diff changeset
30
223b71206888 Initial import
thib
parents:
diff changeset
31 #include"scn2k.h"
223b71206888 Initial import
thib
parents:
diff changeset
32 #include"window/widget.h"
223b71206888 Initial import
thib
parents:
diff changeset
33 #include"window/event.h"
223b71206888 Initial import
thib
parents:
diff changeset
34 #include<vector>
223b71206888 Initial import
thib
parents:
diff changeset
35 #include<string>
223b71206888 Initial import
thib
parents:
diff changeset
36 #include<map>
223b71206888 Initial import
thib
parents:
diff changeset
37 #include<set>
223b71206888 Initial import
thib
parents:
diff changeset
38
223b71206888 Initial import
thib
parents:
diff changeset
39 struct StackItem {
223b71206888 Initial import
thib
parents:
diff changeset
40 int scn_number;
223b71206888 Initial import
thib
parents:
diff changeset
41 int scn_pt;
223b71206888 Initial import
thib
parents:
diff changeset
42 StackItem(int number, int pt) : scn_number(number), scn_pt(pt) {}
223b71206888 Initial import
thib
parents:
diff changeset
43 };
223b71206888 Initial import
thib
parents:
diff changeset
44
223b71206888 Initial import
thib
parents:
diff changeset
45 struct SaveTitle {
223b71206888 Initial import
thib
parents:
diff changeset
46 virtual std::string operator()(int number) const = 0;
223b71206888 Initial import
thib
parents:
diff changeset
47 };
223b71206888 Initial import
thib
parents:
diff changeset
48
223b71206888 Initial import
thib
parents:
diff changeset
49 struct Scn2kMenu {
223b71206888 Initial import
thib
parents:
diff changeset
50 Cmd cmd;
223b71206888 Initial import
thib
parents:
diff changeset
51 class Scn2kMenuImpl* pimpl;
223b71206888 Initial import
thib
parents:
diff changeset
52 enum MenuType { MENU_LOAD, MENU_SAVE, MENU_CONFIG, MENU_BACKLOG, MENU_BACKLOG2};
223b71206888 Initial import
thib
parents:
diff changeset
53 MenuType type;
223b71206888 Initial import
thib
parents:
diff changeset
54 enum MenuStatus { MENU_CONTINUE=0, MENU_CMD=1, MENU_DELETE=2};
223b71206888 Initial import
thib
parents:
diff changeset
55 MenuStatus status;
223b71206888 Initial import
thib
parents:
diff changeset
56 void InitPanel(Event::Container& event, PicContainer& parent);
223b71206888 Initial import
thib
parents:
diff changeset
57 void InitTitle(const SaveTitle&);
223b71206888 Initial import
thib
parents:
diff changeset
58 void Cancel(void);
223b71206888 Initial import
thib
parents:
diff changeset
59 void Exec(Cmd& cmd);
223b71206888 Initial import
thib
parents:
diff changeset
60 void activate(void);
223b71206888 Initial import
thib
parents:
diff changeset
61 void deactivate(void);
223b71206888 Initial import
thib
parents:
diff changeset
62 Scn2kMenu(MenuType type, class Scn2k& scn_impl, const Flags& flags, Text& text, int system_version);
223b71206888 Initial import
thib
parents:
diff changeset
63 ~Scn2kMenu();
223b71206888 Initial import
thib
parents:
diff changeset
64 };
223b71206888 Initial import
thib
parents:
diff changeset
65
223b71206888 Initial import
thib
parents:
diff changeset
66 struct Scn2kSaveTitle : SaveTitle {
223b71206888 Initial import
thib
parents:
diff changeset
67 const class Scn2k& impl;
223b71206888 Initial import
thib
parents:
diff changeset
68 std::string operator() (int number) const;
223b71206888 Initial import
thib
parents:
diff changeset
69 Scn2kSaveTitle(const Scn2k& _impl) : impl(_impl) {}
223b71206888 Initial import
thib
parents:
diff changeset
70 };
223b71206888 Initial import
thib
parents:
diff changeset
71
223b71206888 Initial import
thib
parents:
diff changeset
72 class Scn2k : Event::Time {
223b71206888 Initial import
thib
parents:
diff changeset
73 Event::Container& event;
223b71206888 Initial import
thib
parents:
diff changeset
74 PicContainer& parent;
223b71206888 Initial import
thib
parents:
diff changeset
75 AyuSysConfig& config;
223b71206888 Initial import
thib
parents:
diff changeset
76 WidMouseCursor* mcursor;
223b71206888 Initial import
thib
parents:
diff changeset
77 Flags flag;
223b71206888 Initial import
thib
parents:
diff changeset
78 Text text_exec;
223b71206888 Initial import
thib
parents:
diff changeset
79 Grp grp_exec;
223b71206888 Initial import
thib
parents:
diff changeset
80 int system_version;
223b71206888 Initial import
thib
parents:
diff changeset
81 SkipMode skip_mode;
223b71206888 Initial import
thib
parents:
diff changeset
82 int scn_number;
223b71206888 Initial import
thib
parents:
diff changeset
83 int scn_point;
223b71206888 Initial import
thib
parents:
diff changeset
84 enum {SCN_INFO=999999, SCN_INFO_MENU=10000001, SCN_INFO_LOCALS = 10000100, SCN_INFO_LOCALSTR = 10000200, SCN_INFO_RETSTR = 10000300}; // stack ¤ËÀѤޤì¤ëÆüì¤ÊÈÖ¹æ
223b71206888 Initial import
thib
parents:
diff changeset
85
223b71206888 Initial import
thib
parents:
diff changeset
86 int save_scn, save_point;
223b71206888 Initial import
thib
parents:
diff changeset
87
223b71206888 Initial import
thib
parents:
diff changeset
88 char* script_start;
223b71206888 Initial import
thib
parents:
diff changeset
89 char* script_end;
223b71206888 Initial import
thib
parents:
diff changeset
90 const char* script;
223b71206888 Initial import
thib
parents:
diff changeset
91
223b71206888 Initial import
thib
parents:
diff changeset
92 int backlog_script_scn;
223b71206888 Initial import
thib
parents:
diff changeset
93 char* backlog_script_start;
223b71206888 Initial import
thib
parents:
diff changeset
94 char* backlog_script_end;
223b71206888 Initial import
thib
parents:
diff changeset
95
223b71206888 Initial import
thib
parents:
diff changeset
96 std::string window_title;
223b71206888 Initial import
thib
parents:
diff changeset
97 std::vector<StackItem> stack;
223b71206888 Initial import
thib
parents:
diff changeset
98 std::vector<std::string> stack_strbuffer;
223b71206888 Initial import
thib
parents:
diff changeset
99 std::vector<CmdSimplified> cmd_stack;
223b71206888 Initial import
thib
parents:
diff changeset
100 std::vector<std::string> rollback_save;
223b71206888 Initial import
thib
parents:
diff changeset
101 std::string new_rollback_save;
223b71206888 Initial import
thib
parents:
diff changeset
102 std::map<int, std::set<int> > text_readflag;
223b71206888 Initial import
thib
parents:
diff changeset
103 char* cmd_stack_str;
223b71206888 Initial import
thib
parents:
diff changeset
104 char cmd_stack_str_orig[32768];
223b71206888 Initial import
thib
parents:
diff changeset
105
223b71206888 Initial import
thib
parents:
diff changeset
106 Cmdtype dialog_type;
223b71206888 Initial import
thib
parents:
diff changeset
107 class WidDialog* dialog;
223b71206888 Initial import
thib
parents:
diff changeset
108 Scn2kMenu* menu;
223b71206888 Initial import
thib
parents:
diff changeset
109 bool menu_mouseshown;
223b71206888 Initial import
thib
parents:
diff changeset
110
223b71206888 Initial import
thib
parents:
diff changeset
111 Surface* mouse_surface;
223b71206888 Initial import
thib
parents:
diff changeset
112 int mouse_type;
223b71206888 Initial import
thib
parents:
diff changeset
113 int mouse_pressed;
223b71206888 Initial import
thib
parents:
diff changeset
114 void ShowCursor();
223b71206888 Initial import
thib
parents:
diff changeset
115 void HideCursor();
223b71206888 Initial import
thib
parents:
diff changeset
116
223b71206888 Initial import
thib
parents:
diff changeset
117 void SetSkipMode(SkipMode mode);
223b71206888 Initial import
thib
parents:
diff changeset
118
223b71206888 Initial import
thib
parents:
diff changeset
119 virtual void Elapsed(unsigned int current_time);
223b71206888 Initial import
thib
parents:
diff changeset
120
223b71206888 Initial import
thib
parents:
diff changeset
121 // ¥»¡¼¥Ö´ØÏ¢
223b71206888 Initial import
thib
parents:
diff changeset
122 std::string MakeSaveFile(void) const;
223b71206888 Initial import
thib
parents:
diff changeset
123 bool StatSaveFile(int num, int& year, int& month, int& day, int& wday, int& hour,int& min, int& sec, int& msec, std::string& title) const;
223b71206888 Initial import
thib
parents:
diff changeset
124 void SaveImpl(std::string& s);
223b71206888 Initial import
thib
parents:
diff changeset
125 void LoadImpl(const char* s);
223b71206888 Initial import
thib
parents:
diff changeset
126 void Save(Cmd& cmd);
223b71206888 Initial import
thib
parents:
diff changeset
127 void Load(Cmd& cmd);
223b71206888 Initial import
thib
parents:
diff changeset
128 void SaveRollback(void);
223b71206888 Initial import
thib
parents:
diff changeset
129 void LoadRollback(Cmd& cmd);
223b71206888 Initial import
thib
parents:
diff changeset
130 void SaveSys(void);
223b71206888 Initial import
thib
parents:
diff changeset
131 void LoadSys(void);
223b71206888 Initial import
thib
parents:
diff changeset
132 public:
223b71206888 Initial import
thib
parents:
diff changeset
133 Scn2k(Event::Container& _event, PicContainer& _parent, class MuSys& mu, AyuSysConfig& config);
223b71206888 Initial import
thib
parents:
diff changeset
134 ~Scn2k();
223b71206888 Initial import
thib
parents:
diff changeset
135 static char* OpenScript(int scn_number, char*& end, int* call_vec, int& system_version);
223b71206888 Initial import
thib
parents:
diff changeset
136 bool ChangeScript(int scn_number, int call_no);
223b71206888 Initial import
thib
parents:
diff changeset
137 bool ReadCmdAt(Cmd& cmd, int scn, int pt);
223b71206888 Initial import
thib
parents:
diff changeset
138 void show_textwindow(int type);
223b71206888 Initial import
thib
parents:
diff changeset
139 void hide_textwindow(void);
223b71206888 Initial import
thib
parents:
diff changeset
140 void SysExec(Cmd& cmd);
223b71206888 Initial import
thib
parents:
diff changeset
141 bool SysWait(Cmd& cmd);
223b71206888 Initial import
thib
parents:
diff changeset
142
223b71206888 Initial import
thib
parents:
diff changeset
143 friend struct Scn2kSaveTitle;
223b71206888 Initial import
thib
parents:
diff changeset
144 };
223b71206888 Initial import
thib
parents:
diff changeset
145 #endif