Advanced Strategic Command
unitset.h
Go to the documentation of this file.
1 
2 /*
3  This file is part of Advanced Strategic Command; http://www.asc-hq.de
4  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; see the file COPYING. If not, write to the
18  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19  Boston, MA 02111-1307 USA
20 */
21 
22 
23 #ifndef unitsetH
24 #define unitsetH
25 
26 #include <vector>
27 #include "ascstring.h"
28 #include "typen.h"
29 
31  public:
32 
33  enum Type { unit, building };
34 
36  public:
37  std::vector<IntRange> translation;
38  std::string name;
39  void parseString ( const char* s );
40  };
41 
42 
43  int active;
44  int ID;
48 
49  std::vector<IntRange> unitIds;
50  std::vector<IntRange> buildingIds;
51  std::vector<TranslationTable*> transtab;
53 
54  SingleUnitSet ( void ) : active ( 1 ), ID(0), filterBuildings ( true ) {};
55  bool isMember ( int id, Type type );
56  void read ( tnstream* stream );
57  std::vector<IntRange> parseIDs ( const char* s );
58 
59  };
60 
62 extern UnitSets unitSets;
63 
64 extern void loadUnitSets ( void );
65 
66 
67 class VehicleType;
68 class BuildingType;
69 extern int getUnitSetID( const VehicleType* veh );
70 extern int getUnitSetID( const BuildingType* bld );
71 
72 extern bool vehicleComp( const VehicleType* v1, const VehicleType* v2 );
73 
74 
75 #endif
void read(tnstream *stream)
Definition: unitset.cpp:118
void parseString(const char *s)
Definition: unitset.cpp:86
void loadUnitSets(void)
Definition: unitset.cpp:190
ASCString information
Definition: unitset.h:47
bool isMember(int id, Type type)
Definition: unitset.cpp:36
int getUnitSetID(const VehicleType *veh)
Definition: unitset.cpp:216
SingleUnitSet(void)
Definition: unitset.h:54
The interface for all kinds of IO stream.
std::vector< IntRange > unitIds
Definition: unitset.h:49
bool vehicleComp(const VehicleType *v1, const VehicleType *v2)
Definition: unitset.cpp:234
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
std::vector< IntRange > parseIDs(const char *s)
Definition: unitset.cpp:52
ASCString name
Definition: unitset.h:45
The class describing properties that are common to all vehicles of a certain kind.
Definition: vehicletype.h:177
The class describing properties that are common to all buildings of a certain kind.
Definition: buildingtype.h:35
UnitSets unitSets
Definition: unitset.cpp:211
std::vector< IntRange > translation
Definition: unitset.h:37
ASCString maintainer
Definition: unitset.h:46
bool filterBuildings
Definition: unitset.h:52
int active
Definition: unitset.h:43
std::vector< TranslationTable * > transtab
Definition: unitset.h:51
std::vector< IntRange > buildingIds
Definition: unitset.h:50
a container that stores pointers and deletes the pointed-to objects on destruction ...
Definition: typen.h:314
deallocating_vector< SingleUnitSet * > UnitSets
Definition: unitset.h:61