Tile.h

Go to the documentation of this file.
00001 //**********************************************************************
00002 //
00003 //  REGCOM: Regimental Command
00004 //  Copyright (C) 2008 Randi J. Relander
00005 //    <rjrelander@users.sourceforge.net>
00006 //
00007 //  This program is free software; you can redistribute it and/or
00008 //  modify it under the terms of the GNU General Public License
00009 //  as published by the Free Software Foundation; either version 3
00010 //  of the License, or (at your option) any later version.
00011 //  
00012 //  This program is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU General Public License for more details.
00016 //  
00017 //  You should have received a copy of the GNU General Public
00018 //  License along with this program.  If not, see 
00019 //  <http://www.gnu.org/licenses/>.
00020 //  
00021 //**********************************************************************
00022 
00023 #ifndef REGCOM_COMMON_TILE_H
00024 #define REGCOM_COMMON_TILE_H
00025 
00026 // PROJECT INCLUDES
00027 #include "regcom/common/ErrorCode.h"
00028 
00029 // NAMESPACES
00030 namespace regcom {
00031 namespace common {
00032 
00033 // FORWARD REFERENCES
00034 class Unit;
00035 
00037 //  CLASS: Tile
00043 class Tile
00044 {
00045 public:
00046 
00047     // PUBLIC METHODS
00048 
00050     Tile();
00051 
00053     virtual ~Tile();
00054 
00056     void Clear()
00057     {
00058         m_Level = 0;
00059         m_Depth = 0;
00060         m_Trees = 0;
00061     }
00062 
00064     void SetLevel(int level) { m_Level = level; }
00065 
00067     void SetDepth(int depth) { m_Depth = depth; }
00068 
00070     void SetTrees(int trees) { m_Trees = trees; }
00071 
00073     bool IsClear() const { return m_Depth == 0; }
00074 
00076     bool IsWater() const { return m_Depth >= 1; }
00077 
00079     bool IsWoods() const { return m_Trees >= 1; }
00080 
00082     bool IsLight() const { return m_Trees == 1; }
00083 
00085     bool IsHeavy() const { return m_Trees == 2; }
00086 
00088     int GetLevel() const { return m_Level; }
00089 
00091     int GetDepth() const { return m_Depth; }
00092 
00094     int GetTrees() const { return m_Trees; }
00095 
00097     common::ErrorCodeType AddUnit(Unit* unit);
00098 
00100     common::ErrorCodeType RemoveUnit(Unit* unit);
00101 
00102 private:
00103     
00104     // MEMBER VARIABLES
00105 
00107     signed char m_Level;
00108 
00110     signed char m_Depth;
00111 
00113     signed char m_Trees;
00114 };
00115 
00116 } // namespace common
00117 } // namespace regcom
00118 
00119 #endif