Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

EconData.cpp

Go to the documentation of this file.
00001 /*
00002 CS Senior Project 2003
00003 Team : Leftfield
00004 Project : ModernWarfare
00005 Members :
00006 - Russ Christensen              <rchriste@cs.utah.edu>
00007 - Todd Smith                    <tcsmith@cs.utah.edu>
00008 - Usit Duongsaa                 <duongsaa@cs.utah.edu>
00009 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00012 
00013 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
00014 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
00015 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00016 */
00017 
00021 #include "EconData.h"
00022 
00023 const string EconData::TOK_BEGIN_DATA = "BEGIN ECON DATA";
00024 const string EconData::TOK_END_DATA = "END ECON DATA";
00025 
00026 void EconData::initData(istream& in)
00027 {
00028   for(int i=0; i < UnitTypes::COUNT; ++i)
00029     in >> m_unitCosts[i];
00030   for(int i=0; i < UnitTypes::COUNT; ++i)
00031     in >> m_unitTrainingTime[i];
00032 
00033   in >> m_depositInterval;
00034   for( int level=1; level<=5; level++ )
00035         in >> m_depositPerCity[level-1];
00036 
00037   for( int econLevel=1; econLevel<=5; econLevel++ )
00038           in >> m_econUpgradeCost[econLevel-1];
00039 
00040   for( int econLevel=1; econLevel<=5; econLevel++ )
00041           in >> m_econUpgradeTime[econLevel-1];
00042 }
00043 
00044 int EconData::unitAmount(int type) const { return m_unitCosts[type]; }
00045 
00046 int EconData::unitTrainingTime(int type) const { return m_unitTrainingTime[type]; }
00047 
00048 DWORD EconData::depositInterval() const { return m_depositInterval; }
00049 
00050 int EconData::depositPerCity(int econLevel) const { assert(econLevel>=1 && econLevel<=5); return m_depositPerCity[econLevel-1]; }
00051 
00052 void EconData::shutdown() { this->releaseObj(); }
00053 
00054 int EconData::econUpgradeCost(int currentLevel) const
00055 {
00056         assert(currentLevel>=1 && currentLevel<=5);
00057         return m_econUpgradeCost[currentLevel-1];
00058 }
00059 
00060 int EconData::econUpgradeTime(int currentLevel) const
00061 {
00062         assert(currentLevel>=1 && currentLevel<=5);
00063         return m_econUpgradeTime[currentLevel-1];
00064 }

Generated on Wed Apr 23 05:50:15 2003 for Modern Warfare by doxygen1.3-rc2