ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
map_action.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA_ULTIMA1_ACTIONS_MAP_ACTION_H
23 #define ULTIMA_ULTIMA1_ACTIONS_MAP_ACTION_H
24 
25 namespace Ultima {
26 namespace Ultima1 {
27 namespace Actions {
28 
29 #define MAP_ACTION(NAME, ACTION_NUM, MAP_METHOD) \
30  using Shared::C##NAME##Msg; \
31  class NAME : public Action { DECLARE_MESSAGE_MAP; bool NAME##Msg(C##NAME##Msg *msg) { \
32  addInfoMsg(getRes()->ACTION_NAMES[ACTION_NUM], false); \
33  getMap()->MAP_METHOD(); \
34  return true; } \
35  public: \
36  CLASSDEF; \
37  NAME(TreeItem *parent) : Action(parent) {} \
38  }; \
39  BEGIN_MESSAGE_MAP(NAME, Action) ON_MESSAGE(NAME##Msg) END_MESSAGE_MAP()
40 
41 #define MAP_ACTION_END_TURN(NAME, ACTION_NUM, MAP_METHOD) \
42  using Shared::C##NAME##Msg; \
43  class NAME : public Action { DECLARE_MESSAGE_MAP; bool NAME##Msg(C##NAME##Msg *msg) { \
44  addInfoMsg(getRes()->ACTION_NAMES[ACTION_NUM], false); \
45  getMap()->MAP_METHOD(); \
46  endOfTurn(); \
47  return true; } \
48  public: \
49  CLASSDEF; \
50  NAME(TreeItem *parent) : Action(parent) {} \
51  }; \
52  BEGIN_MESSAGE_MAP(NAME, Action) ON_MESSAGE(NAME##Msg) END_MESSAGE_MAP()
53 
54 } // End of namespace Actions
55 } // End of namespace Ultima1
56 } // End of namespace Ultima
57 
58 #endif
Definition: detection.h:27