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

buildinglayer.h

00001 /***************************************************************************
00002                           buildinglayer.h  -  description
00003       $Id: buildinglayer.h 46 2006-09-16 10:02:10Z neoneurone $
00004                              -------------------
00005     begin                : sam sep 20 2003
00006     copyright            : (C) 2003-2005 by Duong-Khang NGUYEN
00007     email                : neoneurone @ users sourceforge net
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   any later version.                                                    *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef _OPENCITY_BUILDINGLAYER_H_
00020 #define _OPENCITY_BUILDINGLAYER_H_ 1
00021 
00022 #include "main.h"
00023 
00024 #include "layer.h"
00025 
00026 class City;
00027 
00031 class BuildingLayer : public Layer  {
00032 public:
00033 //constructor, should not be used. Call the constructor with parameters instead.
00034     //BuildingLayer();
00035 
00036     virtual ~BuildingLayer();               //dtor
00037 
00038     BuildingLayer( const City & rcCity );   //ctor with parameters
00039 
00040 
00041 //========================================================================
00046     void
00047     SaveTo( std::fstream& rfs );
00048 
00049 
00050 //========================================================================
00055     void
00056     LoadFrom( std::fstream& rfs );
00057 
00058 
00059 
00060 /*----- BEGIN: the following methods are inherited from other interfaces ----*/
00061     void uiKeyboard( const SDL_KeyboardEvent & rcsSDLKeyboardEvent );
00062     void uiMouseMotion( const SDL_MouseMotionEvent & rcsSDLMouseMotionEvent );
00063     void uiMouseButton( const SDL_MouseButtonEvent & rcsSDLMouseButtonEvent );
00064     void uiExpose( const SDL_ExposeEvent & rcsSDLExposeEvent );
00065     void uiResize( const SDL_ResizeEvent & rcsSDLResizeEvent );
00066 /*----- END -----------------------------------------------------------------*/
00067 
00068 
00069 //========================================================================
00077     const bool
00078     IsConstructive(
00079         uint W1, uint L1,
00080         uint W2, uint L2,
00081         const OPENCITY_STRUCTURE_CODE & enumStructCode ) const;
00082 
00083 
00084 //========================================================================
00088     const OPENCITY_ERR_CODE
00089     BuildPreview(
00090         const uint & W,
00091         const uint & L,
00092         const OPENCITY_STRUCTURE_CODE & enumStructCode,
00093         OPENCITY_GRAPHIC_CODE & enumGraphicCode ) const;
00094 
00095 
00096 //========================================================================
00100     const OPENCITY_ERR_CODE
00101     BuildStructure(
00102         const uint & W1,
00103         const uint & L1,
00104         const uint & W2,
00105         const uint & L2,
00106         const OPENCITY_STRUCTURE_CODE & enumStructCode,
00107         uint& rCost );
00108 
00109 
00110 //========================================================================
00116     const OPENCITY_ERR_CODE
00117     ResizeStructure(
00118         const uint & w,
00119         const uint & l,
00120         const OPENCITY_GRAPHIC_CODE & oldGC );
00121 
00122 
00123 //========================================================================
00130     const OPENCITY_ERR_CODE
00131     DestroyStructure(
00132         uint W1, uint L1,
00133         uint W2, uint L2,
00134         uint& rCost );
00135 
00136 
00137 //========================================================================
00144     Structure*
00145     GetLinearStructure(
00146         const uint cuiLinearIndex ) const;
00147 
00148 
00149     Structure*
00150     GetStructure(
00151         const uint & w,
00152         const uint & l ) const;
00153 
00154 
00155     Structure*
00156     GetRandomStructure(
00157         uint & w,
00158         uint & l,
00159         const OPENCITY_STRUCTURE_CODE & enumStructCode = OC_STRUCTURE_UNDEFINED ) const;
00160 
00161 
00162     const uint
00163     GetNumberStructure() const;
00164 
00165 
00166 //========================================================================
00170     void
00171     StructureSet(
00172         const OC_BYTE & status );
00173 
00174 
00175 //========================================================================
00180     void
00181     StructureUnset(
00182         const OC_BYTE & status );
00183 
00184 
00185 //========================================================================
00188     const bool
00189     ContainStructure(
00190         const uint & W1,
00191         const uint & L1,
00192         const uint & W2,
00193         const uint & L2,
00194         const OPENCITY_STRUCTURE_CODE & enumStructCode ) const;
00195 
00196 
00197 //========================================================================
00200     const bool
00201     ContainStructureOnly(
00202         const uint & W1,
00203         const uint & L1,
00204         const uint & W2,
00205         const uint & L2,
00206         const OPENCITY_STRUCTURE_CODE & enumStructCode ) const;
00207 
00208 
00209 //========================================================================
00212     GUIContainer*
00213     QueryStructure(
00214         const uint & w,
00215         const uint & l ) const;
00216 
00217 
00218     /*------ BEGIN: attributes inherited from Layer ------*/
00219 //protected:
00220 //  uint _uiLayerWidth;
00221 //  uint _uiLayerLength;
00222     /*------ END: attributes inherited from Layer ------*/
00223 
00224 private:
00226     Structure** _tabpStructure;
00227 
00228 
00229 
00230 
00231 
00232    /*=====================================================================*/
00233    /*                        PRIVATE     METHODS                          */
00234    /*=====================================================================*/
00235     const bool
00236     _IsPathConstructive(
00237         const uint & w,
00238         const uint & h,
00239         const OPENCITY_STRUCTURE_CODE & enumStructCode ) const;
00240 
00241 
00242 //========================================================================
00245     const OPENCITY_ERR_CODE
00246     _BuildPathStructure(
00247         uint W1, uint L1,
00248         uint W2, uint L2,
00249         const OPENCITY_STRUCTURE_CODE & enumStructCode,
00250         uint& rCost );
00251 
00252 
00253 //========================================================================
00262     void
00263     _BuildPathStructure(
00264         const uint & w,
00265         const uint & h,
00266         const uint & linearIndex,
00267         const OPENCITY_STRUCTURE_CODE & enumStructCode,
00268         uint& rCost );
00269 
00270 
00271     const OPENCITY_ERR_CODE
00272     _BuildRCIStructure(
00273         uint W1, uint L1,
00274         uint W2, uint L2,
00275         const OPENCITY_STRUCTURE_CODE & enumStructCode,
00276         uint& rCost );
00277 
00278 
00279     const OPENCITY_ERR_CODE
00280     _BuildFloraStructure(
00281         uint W1, uint L1,
00282         uint W2, uint L2,
00283         const OPENCITY_STRUCTURE_CODE & enumStructCode,
00284         uint& rCost );
00285 
00286 
00287     const OPENCITY_ERR_CODE
00288     _BuildWEGStructure(
00289         uint W1, uint L1,
00290         const OPENCITY_STRUCTURE_CODE & enumStructCode,
00291         uint& rCost );
00292 
00293 
00294     void
00295     _BuildWEGStructure(
00296         uint W1, uint L1,
00297         uint W2, uint L2,
00298         const OPENCITY_STRUCTURE_CODE & enumStructCode,
00299         uint& rCost );
00300 
00301 
00302 //========================================================================
00312     void
00313     _LoadStructure(
00314         const uint & w1,
00315         const uint & l1,
00316         Structure* pStruct );
00317 
00318 
00319 //========================================================================
00326     const OPENCITY_ERR_CODE
00327     _DestroyStructure(
00328         const uint & w,
00329         const uint & l,
00330         uint& rCost );
00331 
00332 
00333     const OPENCITY_ERR_CODE
00334     _DestroyPathStructure(
00335         uint w, uint l,
00336         const OPENCITY_STRUCTURE_CODE & enumStructCode );
00337 };
00338 
00339 #endif
00340 
00341 
00342 
00343 
00344 
00345 
00346 
00347 
00348 
00349 
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00358 
00359 
00360 
00361 
00362 
00363 
00364 

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