OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BattlescapeGenerator.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_BATTLESCAPEGENERATOR_H
20 #define OPENXCOM_BATTLESCAPEGENERATOR_H
21 
22 namespace OpenXcom
23 {
24 
25 class SavedBattleGame;
26 class Craft;
27 class Ufo;
28 class RuleTerrain;
29 class ResourcePack;
30 class BattleItem;
31 class MapBlock;
32 class Vehicle;
33 class Tile;
34 class RuleItem;
35 class Unit;
36 class AlienRace;
37 class AlienDeployment;
38 class Game;
39 class Base;
40 class TerrorSite;
41 class AlienBase;
42 class BattleUnit;
43 
48 {
49 private:
50  Game *_game;
51  SavedBattleGame *_save;
52  ResourcePack *_res;
53  Craft *_craft;
54  Ufo *_ufo;
55  Base *_base;
56  TerrorSite *_terror;
57  AlienBase *_alienBase;
58  RuleTerrain *_terrain;
59  int _mapsize_x, _mapsize_y, _mapsize_z;
60  int _worldTexture, _worldShade;
61  int _unitSequence;
62  Tile *_craftInventoryTile;
63  std::string _alienRace;
64  int _alienItemLevel;
65  bool _allowAutoLoadout, _baseInventory;
66  int _craftX, _craftY, _craftZ;
67 
69  void generateMap();
71  BattleUnit *addXCOMVehicle(Vehicle *v);
73  BattleUnit *addXCOMUnit(BattleUnit *unit);
75  BattleUnit *addAlien(Unit *rules, int alienRank, bool outside);
77  BattleUnit *addCivilian(Unit *rules);
79  bool placeItemByLayout(BattleItem *item);
81  bool addItem(BattleItem *item, BattleUnit *unit, bool allowSecondClip = false);
83  int loadMAP(MapBlock *mapblock, int xoff, int yoff, RuleTerrain *terrain, int objectIDOffset, bool discovered = false, bool craft = false);
85  void loadRMP(MapBlock *mapblock, int xoff, int yoff, int segment);
87  void fuelPowerSources();
89  void explodePowerSources();
91  void deployXCOM();
93  bool canPlaceXCOMUnit(Tile *tile);
95  void deployAliens(AlienRace *race, AlienDeployment *deployment);
97  void deployCivilians(int max);
99  RuleTerrain *getTerrain(int tex, double lat);
100 public:
102  BattlescapeGenerator(Game *game);
106  void setCraft(Craft *craft);
108  void setUfo(Ufo* ufo);
110  void setWorldTexture(int texture);
112  void setWorldShade(int shade);
114  void setAlienRace(const std::string &alienRace);
116  void setAlienItemlevel(int alienItemLevel);
118  void setBase(Base *base);
120  void setTerrorSite(TerrorSite* site);
122  void setAlienBase(AlienBase* base);
124  void run();
126  void nextStage();
128  bool placeUnitNearFriend(BattleUnit *unit);
130  void runInventory(Craft *craft);
132  void loadWeapons();
133 };
134 
135 }
136 
137 #endif
void setWorldTexture(int texture)
Sets the polygon texture.
Definition: BattlescapeGenerator.cpp:111
~BattlescapeGenerator()
Cleans up the BattlescapeGenerator.
Definition: BattlescapeGenerator.cpp:82
Represents a craft stored in a base.
Definition: Craft.h:44
Represents a vehicle (tanks etc.) kept in a craft.
Definition: Vehicle.h:35
Represents an alien base on the world.
Definition: AlienBase.h:32
void runInventory(Craft *craft)
Generates an inventory battlescape.
Definition: BattlescapeGenerator.cpp:1896
void run()
Runs the generator.
Definition: BattlescapeGenerator.cpp:282
Represents a Terrain Map Block.
Definition: MapBlock.h:37
void setWorldShade(int shade)
Sets the polygon shade.
Definition: BattlescapeGenerator.cpp:121
void setUfo(Ufo *ufo)
Sets the ufo.
Definition: BattlescapeGenerator.cpp:101
Represents an alien terror site on the world.
Definition: TerrorSite.h:32
void setAlienItemlevel(int alienItemLevel)
Sets the alien item level.
Definition: BattlescapeGenerator.cpp:145
BattlescapeGenerator(Game *game)
Creates a new BattlescapeGenerator class.
Definition: BattlescapeGenerator.cpp:73
void setTerrorSite(TerrorSite *site)
Sets the terror site.
Definition: BattlescapeGenerator.cpp:164
Represents a single item in the battlescape.
Definition: BattleItem.h:39
void nextStage()
Sets up the next stage (for cydonia/tftd terror missions).
Definition: BattlescapeGenerator.cpp:174
Represents a specific race "family", or a "main race" if you wish.
Definition: AlienRace.h:35
void setAlienBase(AlienBase *base)
Sets the alien base.
Definition: BattlescapeGenerator.cpp:1833
A utility class that generates the initial battlescape data.
Definition: BattlescapeGenerator.h:47
Represents a player base on the globe.
Definition: Base.h:47
Basic element of which a battle map is build.
Definition: Tile.h:43
Packs of external game media.
Definition: ResourcePack.h:50
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:50
Represents an alien UFO on the map.
Definition: Ufo.h:41
bool placeUnitNearFriend(BattleUnit *unit)
Finds a spot near a friend to spawn at.
Definition: BattlescapeGenerator.cpp:1844
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:44
Represents a specific type of Alien Deployment.
Definition: AlienDeployment.h:55
void setBase(Base *base)
Sets the XCom base.
Definition: BattlescapeGenerator.cpp:154
Represents a specific type of Battlescape Terrain.
Definition: RuleTerrain.h:41
void setAlienRace(const std::string &alienRace)
Sets the alien race.
Definition: BattlescapeGenerator.cpp:132
void setCraft(Craft *craft)
Sets the XCom craft.
Definition: BattlescapeGenerator.cpp:91
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58
void loadWeapons()
Load all Xcom weapons.
Definition: BattlescapeGenerator.cpp:1926
Represents the static data for a unit that is generated on the battlescape, this includes: HWPs...
Definition: Unit.h:50