src/City.cpp

Go to the documentation of this file.
00001 /* Crown and Cutlass
00002  * City Class
00003  *
00004  * This is inherited from the Environment Object. It will keep
00005  * the location, name, and economic information of the city.
00006  */
00007 
00008 #include <string>
00009 #include "GLee.h"
00010 #include "IEnvironmentObject.h"
00011 #include "image.h"
00012 #include "font.h"
00013 #include "Terrain.h"
00014 #include "Economy.h"
00015 #include "Product.h"
00016 #include "CityEconomy.h"
00017 #include "Config.h"
00018 #include "Log.h"
00019 #include "BuildingList.h"
00020 #include "City.h"
00021 
00022 using namespace std;
00023 
00024 City::City(Terrain *landIn, string cityName, int cityLocX, int cityLocZ, BuildingList *buildingsIn):
00025       IEnvironmentObject(cityName, cityLocX, cityLocZ, true) {
00026   int xDiff = (int) landIn->GetWidth() / 2;
00027   int zDiff = (int) landIn->GetHeight() / 2;
00028 
00029   height = landIn->GetHeight(cityLocX + xDiff, cityLocZ + zDiff);
00030 
00031   land = landIn;
00032 
00033   MyEconomy = Economy::s_economy->CreateCity(cityName.c_str());
00034 
00035   buildings = buildingsIn;
00036   buildings->AddCityLocation(locX, height, locZ);
00037 }
00038 
00039 City::~City() {
00040   delete buildings;
00041 }
00042 
00043 void City::DisplayObject() {
00044   buildings->Draw();
00045 }
00046 
00047 bool City::CheckName(const char *cityName) {
00048   if (name.compare(cityName)) return true;
00049 
00050   return false;
00051 }

Generated on Mon Jan 8 22:34:12 2007 for CrownandCutlass by  doxygen 1.4.7