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

wegstructure.cpp

00001 /***************************************************************************
00002                         wegstructure.cpp  -  description
00003                             -------------------
00004     begin                : june 17th, 2003
00005     copyright            : (C) 2003-2006 by Duong-Khang NGUYEN
00006     email                : neoneurone @ users sourceforge net
00007     
00008     $Id: wegstructure.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 "wegstructure.h"
00021 
00022 #include "globalvar.h"
00023 extern GlobalVar gVars;
00024 
00025 
00026    /*=====================================================================*/
00027 WEGStructure::WEGStructure():
00028 Structure()
00029 {
00030     OPENCITY_DEBUG( "ctor" );
00031 }
00032 
00033 
00034    /*=====================================================================*/
00035 WEGStructure::WEGStructure(
00036     const OPENCITY_STRUCTURE_CODE & enumStructCode ):
00037 Structure( enumStructCode )
00038 {
00039     _eGC = gVars.gpPropertyMgr->GetGC( enumStructCode );
00040     _eType = gVars.gpPropertyMgr->GetST( enumStructCode );
00041 
00042 // IF this is an electric plant THEN turn on the electricity bit
00043     if (enumStructCode == OC_STRUCTURE_EPLANT_COAL) {
00044         Set( OC_STRUCTURE_E );
00045     }
00046 }
00047 
00048 
00049    /*=====================================================================*/
00050 WEGStructure::WEGStructure(
00051     const OPENCITY_STRUCTURE_CODE & enumStructCode,
00052     Structure * pMain ):
00053 Structure( enumStructCode, pMain )
00054 {
00055     assert( pMain != NULL );
00056 
00057     switch (enumStructCode) {
00058         case OC_STRUCTURE_PART:
00059             _eGC = OC_EMPTY;
00060            // If this is part of an electric plant
00061            // Then turn the E bit on
00062             if ( (pMain!= NULL) && (pMain->GetCode() == OC_STRUCTURE_EPLANT_COAL) )
00063                 this->Set( OC_STRUCTURE_E );
00064             break;
00065 
00066         default:
00067             OPENCITY_DEBUG( "Unknown structure" );
00068             assert(0);
00069             break;
00070     }
00071 
00072     _eType = gVars.gpPropertyMgr->GetST( enumStructCode );
00073 }
00074 
00075 
00076    /*=====================================================================*/
00077 WEGStructure::~WEGStructure(){
00078    OPENCITY_DEBUG( "dtor" );
00079 }
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 

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