Skip to content

Commit d089312

Browse files
committed
Merge remote-tracking branch 'upstream/master' into sort_soldiers
2 parents f970302 + 52f0660 commit d089312

10 files changed

Lines changed: 36 additions & 29 deletions

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,14 @@ if ( BUILD_PACKAGE )
165165
endif()
166166

167167
if ( NOT WIN32 )
168-
install(FILES "${CMAKE_SOURCE_DIR}/res/linux/openxcom.desktop" DESTINATION share/applications)
169-
install(FILES "${CMAKE_SOURCE_DIR}/res/linux/icons/openxcom_48x48.png" DESTINATION share/icons/hicolor/48x48/apps RENAME openxcom.png)
170-
install(FILES "${CMAKE_SOURCE_DIR}/res/linux/icons/openxcom_128x128.png" DESTINATION share/icons/hicolor/128x128/apps RENAME openxcom.png)
171-
install(FILES "${CMAKE_SOURCE_DIR}/res/linux/icons/openxcom.svg" DESTINATION share/icons/hicolor/scalable/apps)
168+
install(FILES "${CMAKE_SOURCE_DIR}/res/linux/openxcom.desktop"
169+
DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications")
170+
install(FILES "${CMAKE_SOURCE_DIR}/res/linux/icons/openxcom_48x48.png"
171+
DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME openxcom.png)
172+
install(FILES "${CMAKE_SOURCE_DIR}/res/linux/icons/openxcom_128x128.png"
173+
DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME openxcom.png)
174+
install(FILES "${CMAKE_SOURCE_DIR}/res/linux/icons/openxcom.svg"
175+
DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/icons/hicolor/scalable/apps")
172176
endif ()
173177

174178
add_subdirectory ( docs )

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ OpenXcom requires the following developer libraries:
156156
- [SDL\_mixer](http://www.libsdl.org/projects/SDL_mixer/) (libsdl-mixer1.2)
157157
- [SDL\_gfx](http://www.ferzkopp.net/joomla/content/view/19/14/) (libsdl-gfx1.2), version 2.0.22 or later
158158
- [SDL\_image](http://www.libsdl.org/projects/SDL_image/) (libsdl-image1.2)
159-
- [yaml-cpp](http://code.google.com/p/yaml-cpp/), version 0.5 or later
159+
- [yaml-cpp](https://github.com/jbeder/yaml-cpp), version 0.5 or later
160160

161161
The source code includes files for the following build tools:
162162

src/Battlescape/BattlescapeGenerator.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ BattlescapeGenerator::~BattlescapeGenerator()
8787
/**
8888
* Sets up all our various arrays and whatnot according to the size of the map.
8989
*/
90-
void BattlescapeGenerator::init()
90+
void BattlescapeGenerator::init(bool resetTerrain)
9191
{
9292
_blocks.clear();
9393
_landingzone.clear();
@@ -101,7 +101,7 @@ void BattlescapeGenerator::init()
101101

102102
_blocksToDo = (_mapsize_x / 10) * (_mapsize_y / 10);
103103
// creates the tile objects
104-
_save->initMap(_mapsize_x, _mapsize_y, _mapsize_z);
104+
_save->initMap(_mapsize_x, _mapsize_y, _mapsize_z, resetTerrain);
105105
_save->initUtilities(_mod);
106106
}
107107

@@ -736,6 +736,8 @@ void BattlescapeGenerator::deployXCOM()
736736
// equip soldiers based on equipment-layout
737737
for (std::vector<BattleItem*>::iterator i = _craftInventoryTile->getInventory()->begin(); i != _craftInventoryTile->getInventory()->end(); ++i)
738738
{
739+
// set all the items on this tile as belonging to the XCOM faction.
740+
(*i)->setXCOMProperty(true);
739741
// don't let the soldiers take extra ammo yet
740742
if ((*i)->getRules()->getBattleType() == BT_AMMO)
741743
continue;
@@ -1938,7 +1940,6 @@ void BattlescapeGenerator::loadWeapons()
19381940
if ((*j)->getSlot() == _game->getMod()->getInventory("STR_GROUND", true) && (*i)->setAmmoItem(*j) == 0)
19391941
{
19401942
_save->getItems()->push_back(*j);
1941-
(*j)->setXCOMProperty(true);
19421943
(*j)->setSlot(_game->getMod()->getInventory("STR_RIGHT_HAND", true));
19431944
loaded = true;
19441945
}
@@ -1969,7 +1970,7 @@ void BattlescapeGenerator::generateMap(const std::vector<MapScript*> *script)
19691970
// set up our map generation vars
19701971
_dummy = new MapBlock("dummy");
19711972

1972-
init();
1973+
init(true);
19731974

19741975
MapBlock* craftMap = 0;
19751976
std::vector<MapBlock*> ufoMaps;
@@ -2209,7 +2210,7 @@ void BattlescapeGenerator::generateMap(const std::vector<MapScript*> *script)
22092210
{
22102211
_mapsize_z = command->getSizeZ();
22112212
}
2212-
init();
2213+
init(false);
22132214
break;
22142215
default:
22152216
break;

src/Battlescape/BattlescapeGenerator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class BattlescapeGenerator
7777
MapBlock *_dummy;
7878

7979
/// sets the map size and associated vars
80-
void init();
80+
void init(bool resetTerrain);
8181
/// Generates a new battlescape map.
8282
void generateMap(const std::vector<MapScript*> *script);
8383
/// Adds a vehicle to the game.

src/Battlescape/DebriefingState.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,14 +1156,6 @@ void DebriefingState::prepareDebriefing()
11561156
}
11571157
}
11581158

1159-
// calculate the clips for each type based on the recovered rounds.
1160-
for (std::map<RuleItem*, int>::const_iterator i = _rounds.begin(); i != _rounds.end(); ++i)
1161-
{
1162-
int total_clips = i->second / i->first->getClipSize();
1163-
if (total_clips > 0)
1164-
base->getStorageItems()->addItem(i->first->getType(), total_clips);
1165-
}
1166-
11671159
// recover all our goodies
11681160
if (playersSurvived > 0)
11691161
{
@@ -1189,6 +1181,14 @@ void DebriefingState::prepareDebriefing()
11891181
recoverItems(battle->getGuaranteedRecoveredItems(), base);
11901182
}
11911183

1184+
// calculate the clips for each type based on the recovered rounds.
1185+
for (std::map<RuleItem*, int>::const_iterator i = _rounds.begin(); i != _rounds.end(); ++i)
1186+
{
1187+
int total_clips = i->second / i->first->getClipSize();
1188+
if (total_clips > 0)
1189+
base->getStorageItems()->addItem(i->first->getType(), total_clips);
1190+
}
1191+
11921192
// reequip craft after a non-base-defense mission (of course only if it's not lost already (that case craft=0))
11931193
if (craft)
11941194
{

src/Battlescape/InventoryState.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ void InventoryState::btnApplyTemplateClick(Action *)
673673

674674
// move matched item from ground to the appropriate inv slot
675675
(*groundItem)->setOwner(unit);
676+
(*groundItem)->setTile(0);
676677
(*groundItem)->setSlot(_game->getMod()->getInventory((*templateIt)->getSlot(), true));
677678
(*groundItem)->setSlotX((*templateIt)->getSlotX());
678679
(*groundItem)->setSlotY((*templateIt)->getSlotY());

src/Geoscape/GraphsState.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,6 @@ void GraphsState::drawCountryLines()
699699
double range = upperLimit - lowerLimit;
700700
double low = lowerLimit;
701701
int grids = 9; // cells in grid
702-
if (low<0) grids--;
703702
int check = _income ? 50 : 10;
704703
while (range > check * grids)
705704
{
@@ -870,14 +869,13 @@ void GraphsState::drawRegionLines()
870869
double low = lowerLimit;
871870
int check = 10;
872871
int grids = 9; // cells in grid
873-
if (low<0) grids--;
874872
while (range > check * grids)
875873
{
876874
check *= 2;
877875
}
878876

879877
lowerLimit = 0;
880-
upperLimit = check * 9;
878+
upperLimit = check * grids;
881879

882880
if (low < 0)
883881
{
@@ -1052,14 +1050,13 @@ void GraphsState::drawFinanceLines()
10521050
double low = lowerLimit;
10531051
int check = 250;
10541052
int grids = 9; // cells in grid
1055-
if (low<0) grids--;
10561053
while (range > check * grids)
10571054
{
10581055
check *= 2;
10591056
}
10601057

10611058
lowerLimit = 0;
1062-
upperLimit = check * 9;
1059+
upperLimit = check * grids;
10631060

10641061
if (low < 0)
10651062
{

src/Savegame/BattleUnit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ int BattleUnit::damage(Position relative, int power, ItemDamageType type, bool i
11331133
case 6: side = SIDE_LEFT; break;
11341134
case 7: side = RNG::generate(0,2) < 2 ? SIDE_FRONT:SIDE_LEFT; break;
11351135
}
1136-
if (relative.z > getHeight())
1136+
if (relative.z >= getHeight())
11371137
{
11381138
bodypart = BODYPART_HEAD;
11391139
}
@@ -3103,7 +3103,7 @@ void BattleUnit::recoverTimeUnits()
31033103
TURecovery = int(encumbrance * TURecovery);
31043104
}
31053105
// Each fatal wound to the left or right leg reduces the soldier's TUs by 10%.
3106-
TURecovery -= (TURecovery * (_fatalWounds[BODYPART_LEFTLEG]+_fatalWounds[BODYPART_RIGHTLEG] * 10))/100;
3106+
TURecovery -= (TURecovery * ((_fatalWounds[BODYPART_LEFTLEG]+_fatalWounds[BODYPART_RIGHTLEG]) * 10))/100;
31073107
setTimeUnits(TURecovery);
31083108

31093109
// recover energy

src/Savegame/SavedBattleGame.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ Tile **SavedBattleGame::getTiles() const
489489
* @param mapsize_y
490490
* @param mapsize_z
491491
*/
492-
void SavedBattleGame::initMap(int mapsize_x, int mapsize_y, int mapsize_z)
492+
void SavedBattleGame::initMap(int mapsize_x, int mapsize_y, int mapsize_z, bool resetTerrain)
493493
{
494494
// Clear old map data
495495
if (_mapsize_z * _mapsize_y * _mapsize_x > 0)
@@ -506,7 +506,11 @@ void SavedBattleGame::initMap(int mapsize_x, int mapsize_y, int mapsize_z)
506506
delete *i;
507507
}
508508
_nodes.clear();
509-
_mapDataSets.clear();
509+
510+
if (resetTerrain)
511+
{
512+
_mapDataSets.clear();
513+
}
510514

511515
// Create tile objects
512516
_mapsize_x = mapsize_x;

src/Savegame/SavedBattleGame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class SavedBattleGame
9090
/// Saves a saved battle game to YAML.
9191
YAML::Node save() const;
9292
/// Sets the dimensions of the map and initializes it.
93-
void initMap(int mapsize_x, int mapsize_y, int mapsize_z);
93+
void initMap(int mapsize_x, int mapsize_y, int mapsize_z, bool resetTerrain = true);
9494
/// Initialises the pathfinding and tileengine.
9595
void initUtilities(Mod *mod);
9696
/// Gets the game's mapdatafiles.

0 commit comments

Comments
 (0)