mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-14 10:12:59 +02:00
36c1ed670f
Removed most of hardcoded checks for fort level or for presence of fort/ citadel/castle buildings. It is now possible to define which parts of town fortifications are provided by town buildings Configuration for H3-like fortifications is provided in buildingsLibrary.json and will be used automatically by mods as long as mods have buidings named "fort", "citadel" and "castle". Alternatively, mods can separately define: - hitpoints of walls (shared value for all sections) - hitpoints of central, upper and lower towers (separate values) - presence of moat - shooters for each tower (separate values)
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
/*
|
|
* TownFortifications.h, part of VCMI engine
|
|
*
|
|
* Authors: listed in file AUTHORS in main folder
|
|
*
|
|
* License: GNU General Public License v2.0 or later
|
|
* Full text of license available in license.txt file, in main folder
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#include "../../constants/EntityIdentifiers.h"
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
struct TownFortifications
|
|
{
|
|
CreatureID citadelShooter;
|
|
CreatureID upperTowerShooter;
|
|
CreatureID lowerTowerShooter;
|
|
SpellID moatSpell;
|
|
|
|
int8_t wallsHealth = 0;
|
|
int8_t citadelHealth = 0;
|
|
int8_t upperTowerHealth = 0;
|
|
int8_t lowerTowerHealth = 0;
|
|
bool hasMoat = false;
|
|
|
|
const TownFortifications & operator +=(const TownFortifications & other)
|
|
{
|
|
if (other.citadelShooter.hasValue())
|
|
citadelShooter = other.citadelShooter;
|
|
if (other.upperTowerShooter.hasValue())
|
|
upperTowerShooter = other.upperTowerShooter;
|
|
if (other.lowerTowerShooter.hasValue())
|
|
lowerTowerShooter = other.lowerTowerShooter;
|
|
if (other.moatSpell.hasValue())
|
|
moatSpell = other.moatSpell;
|
|
|
|
wallsHealth = std::max(wallsHealth, other.wallsHealth);
|
|
citadelHealth = std::max(citadelHealth, other.citadelHealth);
|
|
upperTowerHealth = std::max(upperTowerHealth, other.upperTowerHealth);
|
|
lowerTowerHealth = std::max(lowerTowerHealth, other.lowerTowerHealth);
|
|
hasMoat = hasMoat || other.hasMoat;
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
VCMI_LIB_NAMESPACE_END
|