mirror of
https://github.com/vcmi/vcmi.git
synced 2026-04-26 20:02:20 +02:00
8014b05399
Mostly based on the mysterious island map test results Added support for: - Pandoras or map events can now grant movement points - Pandoras or map events can now specify map difficulties on which these objects are present - Timed events and town events can now specify map difficulties on which these objects are present - Creature banks now support selection of difficulty preset (number of guards/reward) instead of random-selection - Wandering monsters "joins only for money" flag is now supported - Wandering monsters presence of upgraded stack can now be configured in map - Pyramid can now grant specific spell configured in map - Treasure Chest, Corpse, Sea Chest, Flotsam, Tree of Knowledge can now grant specific reward instead of randomly selected one - Treasure Chest, Corpse, Warrior's Tomb, Shipwreck Survivor and Sea Chest can now grant specific artifact configured in map
49 lines
877 B
C++
49 lines
877 B
C++
/*
|
|
* MapDifficulty.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
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
enum class EMapDifficulty : uint8_t
|
|
{
|
|
EASY = 0,
|
|
NORMAL = 1,
|
|
HARD = 2,
|
|
EXPERT = 3,
|
|
IMPOSSIBLE = 4,
|
|
COUNT = 5
|
|
};
|
|
|
|
class MapDifficultySet
|
|
{
|
|
static constexpr uint8_t allDifficultiesMask = (1 << static_cast<uint8_t>(EMapDifficulty::COUNT)) - 1;
|
|
|
|
uint8_t mask = allDifficultiesMask;
|
|
public:
|
|
MapDifficultySet() = default;
|
|
explicit MapDifficultySet(uint8_t mask)
|
|
:mask(mask)
|
|
{}
|
|
|
|
bool contains(const EMapDifficulty & difficulty) const
|
|
{
|
|
return (1 << static_cast<uint8_t>(difficulty)) & mask;
|
|
}
|
|
|
|
template <typename Handler>
|
|
void serialize(Handler & h)
|
|
{
|
|
h & mask;
|
|
}
|
|
};
|
|
|
|
VCMI_LIB_NAMESPACE_END
|