Skip to content

Commit 76b0d50

Browse files
committed
Merge branch 'master' of https://github.com/SupSuper/OpenXcom
Conflicts: bin/data/Ruleset/Xcom1Ruleset/alienMissions.rul src/Ruleset/RuleAlienMission.cpp src/Ruleset/RuleAlienMission.h
2 parents ccaf744 + 85f22aa commit 76b0d50

11 files changed

Lines changed: 82 additions & 74 deletions

File tree

‎bin/data/Ruleset/Xcom1Ruleset/alienMissions.rul‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ alienMissions:
244244
timer: 60
245245
- type: STR_ALIEN_TERROR
246246
points: 10
247+
specialUfo: STR_TERROR_SHIP
247248
deployment: STR_TERROR_MISSION
248249
markerName: STR_TERROR_SITE
249250
raceWeights:
@@ -288,6 +289,7 @@ alienMissions:
288289
timer: 9000
289290
- type: STR_ALIEN_RETALIATION
290291
points: 0
292+
specialUfo: STR_BATTLESHIP
291293
raceWeights: {} #Special case, race comes from trigger UFO.
292294
waves:
293295
- ufo: STR_SMALL_SCOUT
@@ -308,6 +310,7 @@ alienMissions:
308310
timer: 3000
309311
- type: STR_ALIEN_SUPPLY
310312
points: 0
313+
specialUfo: STR_SUPPLY_SHIP
311314
raceWeights: {} #Special case, race comes from base.
312315
waves:
313316
- ufo: STR_SUPPLY_SHIP

‎src/Battlescape/BattlescapeGenerator.cpp‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ void BattlescapeGenerator::run()
357357
{
358358
_worldShade = ruleDeploy->getShade();
359359
}
360-
360+
361361
const std::vector<MapScript*> *script = _game->getRuleset()->getMapScript(_terrain->getScript());
362362
if (_game->getRuleset()->getMapScript(ruleDeploy->getScript()))
363363
{
@@ -468,7 +468,7 @@ void BattlescapeGenerator::deployXCOM()
468468
_save->setSelectedUnit(unit);
469469
}
470470
}
471-
471+
472472
if (_save->getUnits()->empty())
473473
{
474474
throw Exception("Map generator encountered an error: no xcom units could be placed on the map.");
@@ -556,7 +556,7 @@ void BattlescapeGenerator::deployXCOM()
556556
continue;
557557
placeItemByLayout(*i);
558558
}
559-
559+
560560

561561
// auto-equip soldiers (only soldiers without layout)
562562
for (int pass = 0; pass != 4; ++pass)
@@ -590,7 +590,7 @@ void BattlescapeGenerator::deployXCOM()
590590
default:
591591
break;
592592
}
593-
593+
594594
if (add)
595595
{
596596
for (std::vector<BattleUnit*>::iterator i = _save->getUnits()->begin(); i != _save->getUnits()->end(); ++i)
@@ -773,9 +773,9 @@ BattleUnit *BattlescapeGenerator::addXCOMUnit(BattleUnit *unit)
773773
bool BattlescapeGenerator::canPlaceXCOMUnit(Tile *tile)
774774
{
775775
// to spawn an xcom soldier, there has to be a tile, with a floor, with the starting point attribute and no object in the way
776-
if (tile &&
777-
tile->getMapData(MapData::O_FLOOR) &&
778-
tile->getMapData(MapData::O_FLOOR)->getSpecialType() == START_POINT &&
776+
if (tile &&
777+
tile->getMapData(MapData::O_FLOOR) &&
778+
tile->getMapData(MapData::O_FLOOR)->getSpecialType() == START_POINT &&
779779
!tile->getMapData(MapData::O_OBJECT) &&
780780
tile->getMapData(MapData::O_FLOOR)->getTUCost(MT_WALK) < 255)
781781
{
@@ -828,7 +828,7 @@ void BattlescapeGenerator::deployAliens(AlienDeployment *deployment)
828828
std::string alienName = race->getMember((*d).alienRank);
829829

830830
int quantity;
831-
831+
832832
if (_game->getSavedGame()->getDifficulty() < DIFF_VETERAN)
833833
quantity = (*d).lowQty + RNG::generate(0, (*d).dQty); // beginner/experienced
834834
else if (_game->getSavedGame()->getDifficulty() < DIFF_SUPERHUMAN)
@@ -1297,7 +1297,7 @@ int BattlescapeGenerator::loadMAP(MapBlock *mapblock, int xoff, int yoff, RuleTe
12971297
throw Exception(ss.str());
12981298
}
12991299

1300-
if (sizex != mapblock->getSizeX() ||
1300+
if (sizex != mapblock->getSizeX() ||
13011301
sizey != mapblock->getSizeY())
13021302
{
13031303
ss <<"Map block is not of the size specified " + filename.str() + " is " << sizex << "x" << sizey << " , expected: " << mapblock->getSizeX() << "x" << mapblock->getSizeY();
@@ -1366,7 +1366,7 @@ int BattlescapeGenerator::loadMAP(MapBlock *mapblock, int xoff, int yoff, RuleTe
13661366
}
13671367

13681368
mapFile.close();
1369-
1369+
13701370
if (_generateFuel)
13711371
{
13721372
// if one of the mapBlocks has an items array defined, don't deploy fuel algorithmically
@@ -1456,7 +1456,7 @@ void BattlescapeGenerator::fuelPowerSources()
14561456
{
14571457
for (int i = 0; i < _save->getMapSizeXYZ(); ++i)
14581458
{
1459-
if (_save->getTiles()[i]->getMapData(MapData::O_OBJECT)
1459+
if (_save->getTiles()[i]->getMapData(MapData::O_OBJECT)
14601460
&& _save->getTiles()[i]->getMapData(MapData::O_OBJECT)->getSpecialType() == UFO_POWER_SOURCE)
14611461
{
14621462
BattleItem *alienFuel = new BattleItem(_game->getRuleset()->getItem(_game->getRuleset()->getAlienFuel()), _save->getCurrentItemId());
@@ -1687,7 +1687,7 @@ void BattlescapeGenerator::generateMap(const std::vector<MapScript*> *script)
16871687
_save->getMapDataSets()->push_back(*i);
16881688
mapDataSetIDOffset++;
16891689
}
1690-
1690+
16911691
// lets generate the map now and store it inside the tile objects
16921692

16931693
// this mission type is "hard-coded" in terms of map layout
@@ -1899,7 +1899,7 @@ void BattlescapeGenerator::generateMap(const std::vector<MapScript*> *script)
18991899
{
19001900
throw Exception("Map failed to fully generate.");
19011901
}
1902-
1902+
19031903
loadNodes();
19041904

19051905
if (ufoMap)
@@ -2245,7 +2245,7 @@ bool BattlescapeGenerator::addCraft(MapBlock *craftMap, MapScript *command, SDL_
22452245
craftPos.h = craftMap->getSizeY();
22462246
bool placed = false;
22472247
int x, y;
2248-
2248+
22492249
placed = selectPosition(command->getRects(), x, y, craftPos.w, craftPos.h);
22502250
// if ok, allocate it
22512251
if (placed)
@@ -2449,7 +2449,7 @@ void BattlescapeGenerator::drillModules(TunnelData* data, const std::vector<SDL_
24492449
}
24502450
}
24512451
}
2452-
2452+
24532453
if (nWall)
24542454
{
24552455
md = _terrain->getMapDataSets()->at(nWall->set)->getObjects()->at(nWall->entry);
@@ -2458,7 +2458,7 @@ void BattlescapeGenerator::drillModules(TunnelData* data, const std::vector<SDL_
24582458
tile = _save->getTile(Position((i*10)+9, (j*10)+rect.y+rect.h, data->level));
24592459
tile->setMapData(md, nWall->entry, nWall->set, MapData::O_NORTHWALL);
24602460
}
2461-
2461+
24622462
if (corner)
24632463
{
24642464
md = _terrain->getMapDataSets()->at(corner->set)->getObjects()->at(corner->entry);
@@ -2497,7 +2497,7 @@ void BattlescapeGenerator::drillModules(TunnelData* data, const std::vector<SDL_
24972497
}
24982498
}
24992499
}
2500-
2500+
25012501
if (wWall)
25022502
{
25032503
md = _terrain->getMapDataSets()->at(wWall->set)->getObjects()->at(wWall->entry);
@@ -2506,7 +2506,7 @@ void BattlescapeGenerator::drillModules(TunnelData* data, const std::vector<SDL_
25062506
tile = _save->getTile(Position((i*10)+rect.x+rect.w, (j*10)+9, data->level));
25072507
tile->setMapData(md, wWall->entry, wWall->set, MapData::O_WESTWALL);
25082508
}
2509-
2509+
25102510
if (corner)
25112511
{
25122512
md = _terrain->getMapDataSets()->at(corner->set)->getObjects()->at(corner->entry);

‎src/Geoscape/Globe.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,13 +1331,13 @@ void Globe::drawDetail()
13311331
// Convert coordinates
13321332
polarToCart((*j)->getLongitude(), (*j)->getLatitude(), &x, &y);
13331333

1334-
Surface *marker = _markerSet->getFrame(CITY_MARKER);
1335-
marker->setX(x - 1);
1336-
marker->setY(y - 1);
1337-
marker->blit(_countries);
1338-
13391334
if (_zoom >= (*j)->getZoomLevel())
13401335
{
1336+
Surface *marker = _markerSet->getFrame(CITY_MARKER);
1337+
marker->setX(x - 1);
1338+
marker->setY(y - 1);
1339+
marker->blit(_countries);
1340+
13411341
label->setX(x - 40);
13421342
label->setY(y + 2);
13431343
label->setText(_game->getLanguage()->getString((*j)->getName()));

‎src/Ruleset/RuleAlienMission.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ void RuleAlienMission::load(const YAML::Node &node)
6464
_type = node["type"].as<std::string>(_type);
6565
_points = node["points"].as<int>(_points);
6666
_waves = node["waves"].as< std::vector<MissionWave> >(_waves);
67+
_specialUfo = node["specialUfo"].as<std::string>(_specialUfo);
6768
_deployment = node["deployment"].as<std::string>(_deployment);
6869
_markerName = node["markerName"].as<std::string>(_markerName);
6970
_markerIcon = node["markerIcon"].as<int>(_markerIcon);
@@ -135,7 +136,7 @@ const std::string RuleAlienMission::generateRace(const size_t monthsPassed) cons
135136

136137
const std::string RuleAlienMission::getTopRace(const size_t monthsPassed) const
137138
{
138-
std::vector<std::pair<size_t, WeightedOptions*> >::const_iterator rc = _raceDistribution.begin();
139+
std::vector<std::pair<size_t, WeightedOptions*> >::const_iterator rc = _raceDistribution.begin();
139140
return rc->second->top();
140141
}
141142

‎src/Ruleset/RuleAlienMission.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ class RuleAlienMission
7878
const MissionWave &getWave(size_t index) const { return _waves[index]; }
7979
/// Gets the score for this mission.
8080
int getPoints() const;
81+
/// Gets type of special ufo type for special action like retaliation or supply.
82+
const std::string &getSpecialUfo() const { return _specialUfo; }
8183
/// Gets the alien deployment for this mission.
8284
std::string getDeployment() const;
8385
/// Gets the marker name for this mission.
@@ -87,6 +89,8 @@ class RuleAlienMission
8789
private:
8890
/// The mission's type ID.
8991
std::string _type;
92+
/// Type of special ufo type.
93+
std::string _specialUfo;
9094
/// The race distribution over game time.
9195
std::vector<std::pair<size_t, WeightedOptions*> > _raceDistribution;
9296
/// The mission's waves.

‎src/Ruleset/RuleUfo.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ int RuleUfo::getScore() const
200200
* Gets the terrain data needed to draw the UFO in the battlescape.
201201
* @return The RuleTerrain.
202202
*/
203-
RuleTerrain *RuleUfo::getBattlescapeTerrainData()
203+
RuleTerrain *RuleUfo::getBattlescapeTerrainData() const
204204
{
205205
return _battlescapeTerrainData;
206206
}

‎src/Ruleset/RuleUfo.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class RuleUfo
7272
/// Gets the UFO's score.
7373
int getScore() const;
7474
/// Sets the battlescape terrain data ruleset for this UFO
75-
RuleTerrain *getBattlescapeTerrainData();
75+
RuleTerrain *getBattlescapeTerrainData() const;
7676
/// Gets the reload time of the UFO's weapon.
7777
int getWeaponReload() const;
7878
/// Gets the UFO's escape time.

0 commit comments

Comments
 (0)