Compounds | |
| struct | WorldMap |
| Holds dimension data for the overhead view. Basically creates a bounding rectangle that should contain ALL units and structures in the game. Failure to keep a unit or structure inside this bounding rectangle will cause problems with the AI. More... | |
Functions | |
| WorldMap | createWorldMap (string &line) |
| creates a world map that contains bounds information for the map. | |
| Vec3D | getColorVec3D (string &color) |
| , converts a color name to the Vec3D color | |
| MilitaryUnit * | createUnit (string &line) |
| Create a new military unit. | |
| City * | createCity (string &line) |
| Create a new City. | |
| const string | TOK_COMMENT ("//") |
| Tokens used in map file parsing. | |
| const string | TOK_MAP_DIMS ("MAP DIMS:") |
| const string | TOK_CREATE_UNIT ("CREATE UNIT:") |
| const string | TOK_CREATE_CITY ("CREATE CITY:") |
| const string | TOK_LIGHT_TANK ("LIGHT_TANK") |
| const string | TOK_NEUTRAL ("NEUTRAL") |
| Denotes the owner of a unit or structure. | |
| const string | TOK_BLACK ("BLACK") |
| const string | TOK_RED ("RED") |
| const string | TOK_GREEN ("GREEN") |
| const string | TOK_BLUE ("BLUE") |
| const string | TOK_CYAN ("CYAN") |
| const string | TOK_MAGENTA ("MAGENTA") |
| const string | TOK_YELLOW ("YELLOW") |
| const string | TOK_WHITE ("WHITE") |
|
|
Create a new City.
Definition at line 70 of file Map.cpp. References Vec3D.
|
|
|
Create a new military unit.
Definition at line 55 of file Map.cpp. References getColorVec3D(), and Vec3D.
00056 {
00057 istringstream is(line);
00058 string type;
00059 float x,y,z;
00060 string color;
00061
00062 is >> type >> x >> y >> z >> color;
00063
00064 if( type == TOK_LIGHT_TANK )
00065 return new LightTank(Vec3D(x,y,z), GameState::findPlayer(getColorVec3D(color)), DEFAULT_LIGHT_TANK_SIZE );
00066 else
00067 throw Error("Map parse error Map::createUnit Invalid Unit Type");
00068 }
|
|
|
creates a world map that contains bounds information for the map.
Definition at line 24 of file Map.cpp. References Map::WorldMap::bounds, Map::WorldMap::gridHeight, Map::WorldMap::gridWidth, Map::WorldMap::height, Rect::setBounds(), Vec2D, and Map::WorldMap::width. Referenced by Overhead::loadMap().
00025 {
00026 WorldMap wm;
00027 istringstream is(line);
00028
00029 Vec2D ul, lr;
00030
00031 is >> ul.x >> ul.y >> lr.x >> lr.y >> wm.gridWidth >> wm.gridHeight;
00032 wm.bounds.setBounds(ul, lr);
00033 wm.width = lr.x - ul.x;
00034 wm.height = lr.y - ul.y;
00035
00036 return wm;
00037 }
|
|
|
, converts a color name to the Vec3D color
Definition at line 41 of file Map.cpp. References Vec3D. Referenced by createUnit(), and HUD::init().
00042 {
00043 if( color == TOK_NEUTRAL) return Globals::NO_OWNER;
00044 else if( color == TOK_BLACK) return Colors::black;
00045 else if( color == TOK_BLUE ) return Colors::blue;
00046 else if( color == TOK_CYAN ) return Colors::cyan;
00047 else if( color == TOK_GREEN ) return Colors::green;
00048 else if( color == TOK_MAGENTA ) return Colors::magenta;
00049 else if( color == TOK_RED ) return Colors::red;
00050 else if( color == TOK_WHITE ) return Colors::white;
00051 else if( color == TOK_YELLOW ) return Colors::yellow;
00052 else throw Error("Map parse error Map::getColorVec3D Invalid Color");
00053 }
|
|
|
|
|
|
|
|
|
Tokens used in map file parsing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Denotes the owner of a unit or structure.
|
|
|
|
|
|
|
|
|
|
1.3-rc2