Permalink
Browse files

fix more pre-battle fov shenannigans

i swear to god i'm going to pistol whip the next person to encounter one.
  • Loading branch information...
Warboy1982 committed Jul 21, 2018
1 parent 1a1fe3f commit ac1b8274bd7fcbd555661fe88ec0c36682ed5e0a
Showing with 10 additions and 7 deletions.
  1. +7 −4 src/Battlescape/BattlescapeState.cpp
  2. +2 −2 src/Battlescape/BattlescapeState.h
  3. +1 −1 src/Battlescape/InventoryState.cpp
@@ -996,13 +996,13 @@ void BattlescapeState::btnPrevSoldierClick(Action *)
* @param setReselect When true, flag the current unit first.
* @param checkInventory When true, don't select a unit that has no inventory.
*/
void BattlescapeState::selectNextPlayerUnit(bool checkReselect, bool setReselect, bool checkInventory)
void BattlescapeState::selectNextPlayerUnit(bool checkReselect, bool setReselect, bool checkInventory, bool checkFOV)
{
if (allowButtons())
{
if (_battleGame->getCurrentAction()->type != BA_NONE) return;
BattleUnit *unit = _save->selectNextPlayerUnit(checkReselect, setReselect, checkInventory);
updateSoldierInfo();
updateSoldierInfo(checkFOV);
if (unit) _map->getCamera()->centerOnPosition(unit->getPosition());
_battleGame->cancelCurrentAction();
_battleGame->getCurrentAction()->actor = unit;
@@ -1276,7 +1276,7 @@ bool BattlescapeState::playableUnitSelected()
/**
* Updates a soldier's name/rank/tu/energy/health/morale.
*/
void BattlescapeState::updateSoldierInfo()
void BattlescapeState::updateSoldierInfo(bool checkFOV)
{
BattleUnit *battleUnit = _save->getSelectedUnit();
@@ -1371,7 +1371,10 @@ void BattlescapeState::updateSoldierInfo()
}
}
_save->getTileEngine()->calculateFOV(_save->getSelectedUnit());
if (checkFOV)
{
_save->getTileEngine()->calculateFOV(_save->getSelectedUnit());
}
int j = 0;
for (std::vector<BattleUnit*>::iterator i = battleUnit->getVisibleUnits()->begin(); i != battleUnit->getVisibleUnits()->end() && j < VISIBLE_MAX; ++i)
{
@@ -91,7 +91,7 @@ class BattlescapeState : public State
void toggleKneelButton(BattleUnit* unit);
public:
/// Selects the next soldier.
void selectNextPlayerUnit(bool checkReselect = false, bool setReselect = false, bool checkInventory = false);
void selectNextPlayerUnit(bool checkReselect = false, bool setReselect = false, bool checkInventory = false, bool checkFOV = true);
/// Selects the previous soldier.
void selectPreviousPlayerUnit(bool checkReselect = false, bool setReselect = false, bool checkInventory = false);
static const int DEFAULT_ANIM_SPEED = 100;
@@ -162,7 +162,7 @@ class BattlescapeState : public State
/// Determines whether a playable unit is selected.
bool playableUnitSelected();
/// Updates soldier name/rank/tu/energy/health/morale.
void updateSoldierInfo();
void updateSoldierInfo(bool checkFOV = true);
/// Animates map objects on the map, also smoke,fire, ...
void animate();
/// Handles the battle game state.
@@ -288,7 +288,7 @@ void InventoryState::init()
{
if (_parent)
{
_parent->selectNextPlayerUnit(false, false, true);
_parent->selectNextPlayerUnit(false, false, true, _tu);
}
else
{

0 comments on commit ac1b827

Please sign in to comment.