unitset.h

Go to the documentation of this file.
00001 
00002 /*
00003     This file is part of Advanced Strategic Command; http://www.asc-hq.de
00004     Copyright (C) 1994-2010  Martin Bickel  and  Marc Schellenberger
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; see the file COPYING. If not, write to the 
00018     Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
00019     Boston, MA  02111-1307  USA
00020 */
00021 
00022 
00023 #ifndef unitsetH
00024 #define unitsetH
00025 
00026 #include <vector>
00027 #include "ascstring.h"
00028 #include "typen.h"
00029 
00030 class SingleUnitSet {
00031       public:
00032 
00033          enum Type { unit, building };
00034 
00035          class TranslationTable {
00036                   public:
00037                      std::vector<IntRange> translation;
00038                      std::string name;
00039                      void parseString ( const char* s );
00040                };
00041 
00042 
00043          int active;
00044          int ID;
00045          ASCString name;
00046          ASCString maintainer;
00047          ASCString information;
00048 
00049          std::vector<IntRange> unitIds;
00050          std::vector<IntRange> buildingIds;
00051          std::vector<TranslationTable*> transtab;
00052          bool filterBuildings;
00053 
00054          SingleUnitSet ( void ) : active ( 1 ), ID(0), filterBuildings ( true ) {};
00055          bool isMember ( int id, Type type );
00056          void read ( tnstream* stream );
00057          std::vector<IntRange> parseIDs ( const char* s );
00058 
00059      };
00060 
00061 typedef deallocating_vector<SingleUnitSet*> UnitSets;
00062 extern UnitSets unitSets;
00063 
00064 extern void loadUnitSets ( void );
00065 
00066 
00067 class VehicleType;
00068 class BuildingType;
00069 extern int getUnitSetID( const VehicleType* veh );
00070 extern int getUnitSetID( const BuildingType* bld );
00071 
00072 extern bool vehicleComp( const VehicleType* v1, const VehicleType* v2 );
00073 
00074 
00075 #endif

Generated on Mon May 21 01:26:39 2012 for Advanced Strategic Command by  doxygen 1.5.1