objects.h

Go to the documentation of this file.
00001 
00005 /***************************************************************************
00006                           gamemap.h  -  description
00007                              -------------------
00008     begin                : Tue Feb 17 2001
00009     copyright            : (C) 2001 by Martin Bickel
00010     email                : bickel@asc-hq.org
00011  ***************************************************************************/
00012 
00013 /***************************************************************************
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
00019  *                                                                         *
00020  ***************************************************************************/
00021 
00022 
00023 #ifndef objectsH
00024  #define objectsH
00025 
00026  #include <vector>
00027 
00028  #include "typen.h"
00029  #include "mapitemtype.h"
00030  #include "overviewmapimage.h"
00031  #include "graphics/surface.h"
00032  
00033  class ObjectType;
00034 
00035 class AgeableItem {
00036     protected:
00037        AgeableItem() : lifetimer(-1) {};
00038     public:
00039        int lifetimer;
00040 
00042        static bool age( AgeableItem& obj );
00043 };
00044 
00046 class Object : public AgeableItem {
00047     public:
00048        const ObjectType* typ;
00049        const ObjectType* getType() const { return typ; };
00050        int damage;
00051        int dir;
00052        int remainingGrowthTime;
00053        
00054        Object ();
00055        Object ( const ObjectType* o );
00056        void display ( Surface& surface, const SPoint& pos, int weather = 0 ) const;
00057        const OverviewMapImage* getOverviewMapImage( int weather );
00058        void setDir ( int dir );
00059        int  getDir() const;
00060 
00061        void write ( tnstream& stream );
00062        void read ( tnstream& stream );
00063        
00064 };
00065 
00066 const int cminenum = 4;
00067 extern const char* MineNames[cminenum] ;
00068 extern const int MineBasePunch[cminenum]  ;
00069 
00070 enum MineTypes { cmantipersonnelmine = 1 , cmantitankmine, cmmooredmine, cmfloatmine  };
00071 
00072 class MineType : public MapItemType {
00073       MineTypes type;
00074    public:
00075       int id;
00076 
00078       vector<int> secondaryIDs;
00079 
00080       ASCString name;
00081       ASCString location;
00082       
00083       int getID() const { return id; }; 
00084       
00085       MineType( MineTypes t ) : type ( t ), id( int(t)) {};
00086       MineType( const MineType& w ) : type ( w.type ) {};
00087       ASCString getName() const {
00088          return MineNames[int(type)-1];
00089       };
00090       
00091       void paint ( Surface& surface, const SPoint& pos ) const ;
00092       static void paint( MineTypes type, int player, Surface& surf, const SPoint& pos );
00093 };
00094 
00095 #endif
00096 

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