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

Map.h

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 
00020 #pragma once 
00021 
00022 #include "..\AEngine\AEngine.h"
00023 #include "Globals.h"
00024 #include "MilitaryUnit.h"
00025 #include "Player.h"
00026 #include "City.h"
00027 #include "Rect.h"
00028 
00029 #include <string>
00030 
00031 using namespace std;
00032 
00033 namespace Map 
00034 {
00037   static const string TOK_COMMENT("//");
00038   static const string TOK_MAP_DIMS("MAP DIMS:");
00039   static const string TOK_CREATE_UNIT("CREATE UNIT:");
00040   static const string TOK_CREATE_CITY("CREATE CITY:");
00041 
00042   static const string TOK_LIGHT_TANK("LIGHT_TANK");
00043 
00046   static const string TOK_NEUTRAL("NEUTRAL");
00047   static const string TOK_BLACK("BLACK");
00048   static const string TOK_RED("RED");
00049   static const string TOK_GREEN("GREEN");
00050   static const string TOK_BLUE("BLUE");
00051   static const string TOK_CYAN("CYAN");
00052   static const string TOK_MAGENTA("MAGENTA");
00053   static const string TOK_YELLOW("YELLOW");
00054   static const string TOK_WHITE("WHITE");
00055 
00059   //class WorldMap
00060   //{
00061   //public:
00062   //  WorldMap(Vec2D start, Vec2D end, gridWidth, gridHeight);
00063 
00064   //  Int2Tuple worldToGridCoord(const Vec3D& loc) const;
00065   //  const Vec2D& start() const;
00066   //  const Vec2D& end() const;
00067   //  FLOAT width() const;
00068   //  FLOAT height() const;
00069   //  bool contains(const Vec2D& pt) const;
00070 
00071   //private:
00072   //  Rect m_bounds;
00073   //  FLOAT m_width;
00074   //  FLOAT m_height;
00075 
00076 
00077   struct WorldMap
00078   {
00079     Rect bounds;
00080     //Vec2D start;
00081     //Vec2D end;
00082     FLOAT width;
00083     FLOAT height;
00085     int gridWidth;
00086     int gridHeight;
00087 
00094     Int2Tuple worldToGridCoord(Vec3D loc)
00095     {
00096       return Int2Tuple(static_cast<int>((loc.y - this->bounds.bounds()[0].y) / (this->height /this->gridHeight)),
00097         static_cast<int>((loc.x - this->bounds.bounds()[0].x) / (this->width / this->gridWidth)));
00098     }
00099   };
00100 
00105   WorldMap createWorldMap(string &line);
00106 
00107 
00109   Vec3D getColorVec3D(string &color);
00110 
00111 
00117   MilitaryUnit * createUnit(string &line);
00118 
00119 
00125   City * createCity(string &line);
00126 
00127 
00128 
00129 } // end namespace Map

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