mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Reworked resource piles loading to fix wog maps with mithril
This commit is contained in:
@ -31,7 +31,9 @@
|
||||
#include "../filesystem/Filesystem.h"
|
||||
#include "../mapObjectConstructors/AObjectTypeHandler.h"
|
||||
#include "../mapObjectConstructors/CObjectClassesHandler.h"
|
||||
#include "../mapObjectConstructors/CommonConstructors.h"
|
||||
#include "../mapObjects/CGCreature.h"
|
||||
#include "../mapObjects/CGResource.h"
|
||||
#include "../mapObjects/MapObjects.h"
|
||||
#include "../mapObjects/ObjectTemplate.h"
|
||||
#include "../modding/ModScope.h"
|
||||
@ -40,8 +42,6 @@
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../texts/TextOperations.h"
|
||||
|
||||
#include <boost/crc.hpp>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
static std::string convertMapName(std::string input)
|
||||
@ -1302,11 +1302,15 @@ CGObjectInstance * CMapLoaderH3M::readResource(const int3 & mapPosition, std::sh
|
||||
readMessageAndGuards(object->message, object, mapPosition);
|
||||
|
||||
object->amount = reader->readUInt32();
|
||||
if(GameResID(objectTemplate->subid) == GameResID(EGameResID::GOLD))
|
||||
|
||||
if (objectTemplate->id != Obj::RANDOM_RESOURCE)
|
||||
{
|
||||
// Gold is multiplied by 100.
|
||||
object->amount *= CGResource::GOLD_AMOUNT_MULTIPLIER;
|
||||
const auto & baseHandler = VLC->objtypeh->getHandlerFor(objectTemplate->id, objectTemplate->subid);
|
||||
const auto & ourHandler = std::dynamic_pointer_cast<ResourceInstanceConstructor>(baseHandler);
|
||||
|
||||
object->amount *= ourHandler->getAmountMultiplier();
|
||||
}
|
||||
|
||||
reader->skipZero(4);
|
||||
return object;
|
||||
}
|
||||
|
Reference in New Issue
Block a user