1 /***************************************************************************
2                           action.h  -  description
3                              -------------------
4     begin                : Mon Apr 1 2002
5     copyright            : (C) 2001 by Michael Speck
6     email                : kulkanie@gmx.net
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef __ACTION_H
19 #define __ACTION_H
20 
21 /*
22 ====================================================================
23 Engine actions
24 ====================================================================
25 */
26 enum {
27     ACTION_NONE = 0,
28     ACTION_END_TURN,
29     ACTION_MOVE,
30     ACTION_ATTACK,
31     ACTION_STRATEGIC_ATTACK,	/* carpet bombing on _empty_ tile;
32 				 * if unit present, regular attack checks
33 				 * for passive carpet bombing */
34     ACTION_SUPPLY,
35     ACTION_EMBARK_SEA,
36     ACTION_DEBARK_SEA,
37     ACTION_EMBARK_AIR,
38     ACTION_DEBARK_AIR,
39     ACTION_MERGE,
40     ACTION_SPLIT,
41     ACTION_DISBAND,
42     ACTION_DEPLOY,
43     ACTION_DRAW_MAP,
44     ACTION_SET_SPOT_MASK,
45     ACTION_SET_VMODE,
46     ACTION_QUIT,
47     ACTION_RESTART,
48     ACTION_LOAD,
49     ACTION_OVERWRITE,
50     ACTION_START_SCEN,
51     ACTION_START_CAMP
52 };
53 typedef struct {
54     int type;       /* type as above */
55     Unit *unit;     /* unit performing the action */
56     Unit *target;   /* target if attack */
57     int x, y;       /* dest position if movement */
58     int w, h, full; /* video mode settings */
59     int id;         /* slot id if any */
60     int str;        /* strength of split */
61 } Action;
62 
63 /*
64 ====================================================================
65 Create/delete engine action queue
66 ====================================================================
67 */
68 void actions_create();
69 void actions_delete();
70 
71 /*
72 ====================================================================
73 Get next action or clear all actions. The returned action struct
74 must be cleared by engine after usage.
75 ====================================================================
76 */
77 Action* actions_dequeue();
78 void actions_clear();
79 
80 /*
81 ====================================================================
82 Remove the last action in queue (cancelled confirmation)
83 ====================================================================
84 */
85 void action_remove_last();
86 
87 /*
88 ====================================================================
89 Returns topmost action in queue or 0 if none available.
90 ====================================================================
91 */
92 Action *actions_top(void);
93 
94 /*
95 ====================================================================
96 Get number of queued actions
97 ====================================================================
98 */
99 int actions_count();
100 
101 /*
102 ====================================================================
103 Create an engine action and automatically queue it. The engine
104 will perform security checks before handling an action to prevent
105 illegal actions.
106 ====================================================================
107 */
108 void action_queue_none();
109 void action_queue_end_turn();
110 void action_queue_move( Unit *unit, int x, int y );
111 void action_queue_attack( Unit *unit, Unit *target );
112 void action_queue_supply( Unit *unit );
113 void action_queue_embark_sea( Unit *unit, int x, int y );
114 void action_queue_debark_sea( Unit *unit, int x, int y );
115 void action_queue_embark_air( Unit *unit, int x, int y );
116 void action_queue_debark_air( Unit *unit, int x, int y, int normal_landing );
117 void action_queue_merge( Unit *unit, Unit *partner );
118 void action_queue_split( Unit *unit, int str, int x, int y, Unit *partner );
119 void action_queue_disband( Unit *unit );
120 void action_queue_deploy( Unit *unit, int x, int y );
121 void action_queue_draw_map();
122 void action_queue_set_spot_mask();
123 void action_queue_set_vmode( int w, int h, int fullscreen );
124 void action_queue_quit();
125 void action_queue_restart();
126 void action_queue_load( int id );
127 void action_queue_overwrite( int id );
128 void action_queue_start_scen();
129 void action_queue_start_camp();
130 void action_queue_strategic_attack( Unit *unit);
131 
132 #endif
133