Main Page | Class List | File List | Class Members | Related Pages

tile.h

00001 /***************************************************************************
00002                            tile.h
00003                            -------------------
00004     begin                : 2004-04-18
00005     copyright            : (C) 2004-2005 by Michael Menne
00006     email                : menne@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  This program is free software; you can redistribute it and/or
00011  modify it under the terms of the GNU General Public License
00012  as published by the Free Software Foundation; either version 2
00013  of the License, or (at your option) any later version.
00014 
00015  This program is distributed in the hope that it will be useful,
00016  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  GNU General Public License for more details.
00019 
00020  You should have received a copy of the GNU General Public License
00021  along with this program; if not, write to the Free Software
00022  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023  ***************************************************************************/
00024 
00025 #ifndef TILE_H
00026 #define TILE_H
00027 
00028 #include "global.h"
00029 
00030 namespace WDS
00031 {
00032 
00033 // Forward declarations
00034 class CTexture;
00035 class CGLCanvas;
00036 
00037 
00042 enum
00043 {
00044     RACE_MENSCH=0,      // Menschen
00045     RACE_ELF,           // Elfen
00046     RACE_ZWERG,         // Zwerge
00047     RACE_ORK,           // Orks
00048     RACE_NUMOF
00049 };
00050 
00051 enum
00052 {
00053     PATH_NONE=0,
00054     PATH_OPEN,
00055     PATH_CLOSE,
00056     PATH_ACTIVE
00057 };
00058 
00068 class CTile
00069 {
00070 public:
00071     CTile();
00072     ~CTile();
00073 
00074     static void Init();     // Läd alle benötigten Graphiken
00075     static void Shut();     // Löscht alle geladenen Graphiken
00076 
00077     void Draw( Rect &rcTile, bool bFOW );
00078     void DrawOverlay( Rect &rcTile );
00079 
00080     void SetFrame   ( int nID );
00081     void SetTerrain ( int nID, int nBorder );
00082     void SetFogOfWar( int nFOW );
00083     void SetBuilding( int nID );
00084     void SetBorder  ( int nID );
00085     void SetUnit    ( int nID );
00086     void SetStreet  ( int nID );
00087     void Reset      ( );
00088 
00089     bool  IsStreet() { return (m_nStreet > 0 ); }
00090 
00091     float   GetWeigth( );
00092 
00093     // Variablen
00094     char  m_Parent, m_State, m_nTerrain1;           //  3 Byte
00095     BYTE  m_nTerrain2;                              //  1 Byte
00096     short m_nBuilding;                              //  2 Byte
00097     BYTE  m_nFrame  : 4;                            //  4 Bit
00098     BYTE  m_nBorder : 4;                            //  4 Bit
00099     BYTE  m_nStreet : 4;                            //  4 Bit
00100     BYTE  m_nUnit   : 4;                            //  4 Bit
00101     BYTE  m_nFOW    : 1;                            //  1 Bit => 1 Byte
00102 
00103     float m_CostF,  m_CostG;                        //  8 Byte
00104                                                     // -------
00105                                                     // 15 Byte => 16 Byte pro Tile
00106 
00107 protected:
00108     void DrawTile( Rect &rcTile, CTexture *pTex );
00109 
00110     static CGLCanvas* GetGLCanvas();
00111 
00112     // Statische Felder fuer die geladenen Graphiken
00113     static bool m_bLoaded;
00114     static CTexture *m_pTerrains[9][241];
00115     static CTexture *m_pFrames[8];
00116     static CTexture *m_pBuildings[500];
00117     static CTexture *m_pStreets[15];
00118     static CTexture *m_pBorders[15];
00119     static CTexture *m_pUnits[RACE_NUMOF];
00120 };
00121 
00122 }
00123 
00124 #endif // TILE_H
00125 
00126 // kate: space-indent off; tab-width 4; replace-tabs off;

Generated on Sun Jan 16 18:20:26 2005 for WDSMap by  doxygen 1.3.9.1