1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00
Files
vcmi/lib/mapObjectConstructors/DwellingInstanceConstructor.h
Ivan Savenko cb70cc48d6 Fixes for handling of oversized map dwellings
- Marked large version of H3 Unicorn's Glade as not usable for random
dwelling replacement
- Shifted oversized dwellings - that have at most 2x2 as blocked tile,
but have non-blocked tile column will now be placed correctly
- This fixes incorrect random dwelling replacement of the only oversized
H3 dwelling - Portal of Glory
- Game will now detect & report invalid dwelling templates from mods
- Updated docs to clarify dwellings format
2025-05-12 18:01:46 +03:00

45 lines
1.2 KiB
C++

/*
* DwellingInstanceConstructor.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 "CDefaultObjectTypeHandler.h"
#include "../json/JsonNode.h"
#include "../mapObjects/CGDwelling.h"
VCMI_LIB_NAMESPACE_BEGIN
class CGDwelling;
class DwellingInstanceConstructor : public CDefaultObjectTypeHandler<CGDwelling>
{
std::vector<std::vector<const CCreature *>> availableCreatures;
JsonNode guards;
bool bannedForRandomDwelling = false;
protected:
bool objectFilter(const CGObjectInstance * obj, std::shared_ptr<const ObjectTemplate> tmpl) const override;
void initTypeData(const JsonNode & input) override;
void onTemplateAdded(const std::shared_ptr<const ObjectTemplate>) override;
public:
bool hasNameTextID() const override;
void initializeObject(CGDwelling * object) const override;
void randomizeObject(CGDwelling * object, vstd::RNG & rng) const override;
bool isBannedForRandomDwelling() const;
bool producesCreature(const CCreature * crea) const;
std::vector<const CCreature *> getProducedCreatures() const;
};
VCMI_LIB_NAMESPACE_END