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

rcistructure.cpp

00001 /***************************************************************************
00002                         rcistructure.cpp  -  description
00003                             -------------------
00004     begin                : mar jun 17 2003
00005     copyright            : (C) 2003-2006 by Duong-Khang NGUYEN
00006     email                : neoneurone @ users sourceforge net
00007     
00008     $Id: rcistructure.cpp 63 2006-10-17 20:45:12Z neoneurone $
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *   This program is free software; you can redistribute it and/or modify  *
00014  *   it under the terms of the GNU General Public License as published by  *
00015  *   the Free Software Foundation; either version 2 of the License, or     *
00016  *   any later version.                                                    *
00017  *                                                                         *
00018  ***************************************************************************/
00019 
00020 #include "rcistructure.h"
00021 
00022 #include "globalvar.h"
00023 extern GlobalVar gVars;
00024 
00025 
00026    /*=====================================================================*/
00027 RCIStructure::RCIStructure():
00028 Structure()
00029 {
00030     OPENCITY_DEBUG( "ctor" );
00031 }
00032 
00033 
00034    /*=====================================================================*/
00035 RCIStructure::RCIStructure(
00036     const OPENCITY_STRUCTURE_CODE & enumStructCode):
00037 Structure( enumStructCode )
00038 {
00039     OPENCITY_DEBUG( "ctor param" );
00040 
00041     _eGC = gVars.gpPropertyMgr->GetGC( enumStructCode );
00042     _eType = gVars.gpPropertyMgr->GetST( enumStructCode );
00043 }
00044 
00045 
00046    /*=====================================================================*/
00047 RCIStructure::RCIStructure(
00048     const OPENCITY_STRUCTURE_CODE & enumStructCode,
00049     Structure * pMain ):
00050 Structure( enumStructCode, pMain )
00051 {
00052     assert( pMain != NULL );
00053 
00054     _eGC = gVars.gpPropertyMgr->GetGC( enumStructCode );
00055     _eType = gVars.gpPropertyMgr->GetST( enumStructCode );
00056 }
00057 
00058 
00059    /*=====================================================================*/
00060 RCIStructure::~RCIStructure(){
00061    OPENCITY_DEBUG( "dtor" );
00062 }
00063 
00064 
00065    /*=====================================================================*/
00066 const OPENCITY_GRAPHIC_CODE
00067 RCIStructure::GetNextLevelGraphicCode() const
00068 {
00069 //  OPENCITY_DEBUG("WARNING: Inside RCI");
00070     if (_uiLevel < OC_STRUCTURE_LEVEL_MAX)
00071         return (OPENCITY_GRAPHIC_CODE)(this->GetBaseGraphicCode() + ((_uiLevel+1) / 10));
00072     else
00073         return _eGC;
00074 }
00075 
00076 
00077    /*=====================================================================*/
00078 const OPENCITY_GRAPHIC_CODE
00079 RCIStructure::GetPreviousLevelGraphicCode() const
00080 {
00081     if (_uiLevel > OC_STRUCTURE_LEVEL_MIN)
00082         return (OPENCITY_GRAPHIC_CODE)(this->GetBaseGraphicCode() + ((_uiLevel-1) / 10));
00083     else
00084         return _eGC;
00085 }
00086 
00087 
00088    /*=====================================================================*/
00089 const bool
00090 RCIStructure::LevelUp()
00091 {
00092     OPENCITY_GRAPHIC_CODE newGC;
00093     
00094     newGC = this->GetNextLevelGraphicCode();
00095 
00096     if (this->Structure::LevelUp() == true) {
00097         _eGC = newGC;
00098         return true;
00099     }
00100     else {
00101         return false;
00102     }
00103 }
00104 
00105 
00106    /*=====================================================================*/
00107 const bool
00108 RCIStructure::LevelDown()
00109 {
00110     OPENCITY_GRAPHIC_CODE newGC;
00111     
00112     newGC = this->GetPreviousLevelGraphicCode();
00113 
00114     if (this->Structure::LevelDown() == true) {
00115         _eGC = newGC;
00116         return true;
00117     }
00118     else {
00119         return false;
00120     }
00121 }
00122 
00123 
00124    /*=====================================================================*/
00125 
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 

Generated on Sat Nov 11 10:21:10 2006 for OpenCity by  doxygen 1.4.2