Skip to content

Commit

Permalink
Fix UFO crash conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
MeridianOXC committed Jun 13, 2020
1 parent 01283d3 commit f54a3a2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
28 changes: 16 additions & 12 deletions src/Savegame/Ufo.cpp
Expand Up @@ -153,11 +153,12 @@ void Ufo::load(const YAML::Node &node, const Mod &mod, SavedGame &game)
}
else
{
if (_damage >= _stats.damageMax)
_huntBehavior = node["huntBehavior"].as<int>(_huntBehavior);
if (isDestroyed())
{
_status = DESTROYED;
}
else if (_damage >= _stats.damageMax / 2)
else if (isCrashed())
{
_status = CRASHED;
}
Expand Down Expand Up @@ -479,20 +480,13 @@ void Ufo::setDamage(int damage, const Mod *mod)
{
_damage = 0;
}
if (_damage >= _stats.damageMax)
if (isDestroyed())
{
_status = DESTROYED;
}
else if (_damage >= _stats.damageMax / 2)
else if (isCrashed())
{
if (_huntBehavior == 1 || _rules->isUnmanned())
{
// kamikaze never crash lands; unmanned ditto
}
else
{
_status = CRASHED;
}
_status = CRASHED;
}
if (_status == CRASHED || _status == DESTROYED)
{
Expand Down Expand Up @@ -619,6 +613,16 @@ void Ufo::setAltitude(const std::string &altitude)
*/
bool Ufo::isCrashed() const
{
// Note: yes, this condition is necessary (in OXCE) and cannot be removed!
if (isDestroyed())
return true;

if (_huntBehavior == 1 || _rules->isUnmanned())
{
// kamikaze never crash lands; unmanned ditto
return false;
}

return (_damage > _stats.damageMax / 2);
}

Expand Down
8 changes: 4 additions & 4 deletions src/version.h
Expand Up @@ -18,10 +18,10 @@
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/

#define OPENXCOM_VERSION_SHORT "Extended 6.5.3"
#define OPENXCOM_VERSION_LONG "6.5.3.0"
#define OPENXCOM_VERSION_NUMBER 6,5,3,0
#define OPENXCOM_VERSION_SHORT "Extended 6.5.3.1"
#define OPENXCOM_VERSION_LONG "6.5.3.1"
#define OPENXCOM_VERSION_NUMBER 6,5,3,1

#ifndef OPENXCOM_VERSION_GIT
#define OPENXCOM_VERSION_GIT " (v2020-05-28)"
#define OPENXCOM_VERSION_GIT " (v2020-06-13)"
#endif

0 comments on commit f54a3a2

Please sign in to comment.