Advanced Strategic Command
spfst.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of Advanced Strategic Command; http://www.asc-hq.de
9  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
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  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; see the file COPYING. If not, write to the
23  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
24  Boston, MA 02111-1307 USA
25 */
26 
27 #ifndef spfstH
28  #define spfstH
29 
30  #include <sigc++/sigc++.h>
31 
32 
33  #include "typen.h"
34  #include "gamemap.h"
35 
36 
38 extern void putbuilding( GameMap* gamemap,
39  const MapCoordinate& entryPosition,
40  int color,
41  const BuildingType* buildingtyp,
42  int completion,
43  int ignoreunits = 0 );
44 
45 
47 extern void calculateallobjects( GameMap* m );
48 
56 extern void calculateobject(int x,
57  int y,
58  bool mof,
59  const ObjectType* obj,
60  GameMap* gamemap );
61 
62 extern void calculateobject( const MapCoordinate& pos,
63  bool mof,
64  const ObjectType* obj,
65  GameMap* gamemap );
66 
67 
68 
76 extern int fieldAccessible( const MapField* field,
77  const Vehicle* vehicle,
78  int uheight = -2,
79  const bool* attacked = NULL,
80  bool ignoreVisibility = false );
81 
82 
85 extern void checkunitsforremoval( GameMap* gamemap );
86 
88 extern void checkobjectsforremoval( GameMap* gamemap );
89 
91 extern int getmaxwindspeedforunit ( const Vehicle* eht );
92 
96 extern int getwindheightforunit ( const Vehicle* eht, int uheight = -1 );
97 
98 
107 extern int terrainaccessible ( const MapField* field, const Vehicle* vehicle, int uheight = -1 );
108 
121 extern int terrainaccessible2 ( const MapField* field, const Vehicle* vehicle, int uheight = -1 );
122 
123 
133 int terrainaccessible2 ( const MapField* field, const TerrainAccess& terrainAccess, int uheight );
134 
135 
142 extern int getheightdelta ( const ContainerBase* c1, const ContainerBase* c2 );
143 
149  extern bool fieldvisiblenow( const MapField* pe, Vehicle* veh, int player );
151  inline bool fieldvisiblenow( const MapField* pe, int player ) { return fieldvisiblenow( pe, NULL, player); };
152  inline bool fieldvisiblenow( const MapField* pe, Vehicle* veh ) { return fieldvisiblenow( pe, veh, pe->getMap()->actplayer); };
153  inline bool fieldvisiblenow( const MapField* pe ) { return fieldvisiblenow( pe, pe->getMap()->actplayer);};
155 
161  extern VisibilityStates fieldVisibility ( const MapField* pe );
163  extern VisibilityStates fieldVisibility ( const MapField* pe, int player );
165 
166 
167 extern sigc::signal<void> repaintMap;
168 extern sigc::signal<void> repaintDisplay;
169 extern sigc::signal<void> updateFieldInfo;
170 extern sigc::signal<void> cursorMoved;
171 
173 extern sigc::signal<void> viewChanged;
174 extern sigc::signal<void,GameMap*> mapChanged;
175 extern sigc::signal<void,ContainerBase*> showContainerInfo;
176 extern sigc::signal<void,VehicleType*> showVehicleTypeInfo;
177 extern sigc::signal<bool> idleEvent;
178 extern sigc::signal<void, const Context&> fieldCrossed;
179 
180 extern void displaymap();
181 
182 
183 #endif
184 
185 
int getwindheightforunit(const Vehicle *eht, int uheight=-1)
Wind may be different at different heights.
Definition: spfst.cpp:318
sigc::signal< void, GameMap * > mapChanged
Definition: spfst.cpp:52
int getheightdelta(const ContainerBase *c1, const ContainerBase *c2)
calculate the height difference between two levels of height.
Definition: spfst.cpp:393
sigc::signal< void > repaintDisplay
Definition: spfst.cpp:46
sigc::signal< void, VehicleType * > showVehicleTypeInfo
Definition: spfst.cpp:50
sigc::signal< void > viewChanged
the view of the player onto the map changed, for example because he scrolled the map ...
Definition: spfst.cpp:51
VisibilityStates
the different states that a player's view on a field can have
Definition: typen.h:403
void calculateobject(int x, int y, bool mof, const ObjectType *obj, GameMap *gamemap)
recalculates the connection (like road interconnections) of an object
Definition: spfst.cpp:471
sigc::signal< void > updateFieldInfo
Definition: spfst.cpp:47
void displaymap()
Definition: spfst.cpp:58
a single field of the map
Definition: mapfield.h:26
int getmaxwindspeedforunit(const Vehicle *eht)
returns the maximum wind speed that the unit can endure
Definition: spfst.cpp:332
void calculateallobjects(GameMap *m)
recalculates the connection (like road interconnections) of all objects on the map ...
Definition: spfst.cpp:562
VisibilityStates fieldVisibility(const MapField *pe)
}@
Definition: spfst.cpp:440
sigc::signal< void > cursorMoved
Definition: spfst.cpp:48
The class describing properties that are common to all buildings of a certain kind.
Definition: buildingtype.h:35
This class is used by buildings, vehicles and objects to specify which terrain it can move to / be bu...
Definition: terraintype.h:42
void checkobjectsforremoval(GameMap *gamemap)
removes all objects that cannot exist where they currently are (terrainaccess)
Definition: spfst.cpp:247
GameMap * getMap() const
Definition: mapfield.h:38
An object that can be placed on fields. Roads, pipelines and ditches are examples of objects...
Definition: objecttype.h:30
Coordinate on the twodimensional map.
Definition: typen.h:202
Definition of THE central asc class: GameMap.
int fieldAccessible(const MapField *field, const Vehicle *vehicle, int uheight=-2, const bool *attacked=NULL, bool ignoreVisibility=false)
Definition: spfst.cpp:124
sigc::signal< bool > idleEvent
Definition: spfst.cpp:53
signed char actplayer
the player who is currently making his moves (may be human or AI)
Definition: gamemap.h:232
sigc::signal< void, ContainerBase * > showContainerInfo
Definition: spfst.cpp:49
sigc::signal< void > repaintMap
}@
Definition: spfst.cpp:45
bool fieldvisiblenow(const MapField *pe, Vehicle *veh, int player)
{@
Definition: spfst.cpp:399
The parent class of Vehicle and Building; The name Container originates from Battle Isle...
Definition: containerbase.h:40
int terrainaccessible2(const MapField *field, const Vehicle *vehicle, int uheight=-1)
Checks if the unit can drive on the field.
Definition: spfst.cpp:79
int terrainaccessible(const MapField *field, const Vehicle *vehicle, int uheight=-1)
Checks if the unit can drive on the field.
Definition: spfst.cpp:70
sigc::signal< void, const Context & > fieldCrossed
Definition: spfst.cpp:54
void putbuilding(GameMap *gamemap, const MapCoordinate &entryPosition, int color, const BuildingType *buildingtyp, int completion, int ignoreunits=0)
puts a building onto the map. To be used by the map editor! For ingame usage, see ConstructBuildingCo...
Definition: spfst.cpp:210
void checkunitsforremoval(GameMap *gamemap)
removes all units that cannot exist any more, either due to invalid terrin (like tanks on melting ice...
Definition: spfst.cpp:261
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182