1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-24 03:47:18 +02:00

Fixed sound on object pickup with dialog

This commit is contained in:
rhn 2014-07-30 18:07:30 +02:00
parent d918621d66
commit e9534603c2
3 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include "../lib/Connection.h"
#include "../lib/CSpellHandler.h"
#include "../lib/CTownHandler.h"
#include "../lib/mapObjects/CObjectClassesHandler.h" // For displaying correct UI when interacting with objects
#include "../lib/BattleState.h"
#include "../lib/JsonNode.h"
#include "CMusicHandler.h"
@ -1519,6 +1520,9 @@ void CPlayerInterface::objectRemoved( const CGObjectInstance *obj )
{
const CGHeroInstance *h = static_cast<const CGHeroInstance*>(obj);
heroKilled(h);
} else if (VLC->objtypeh->getObjectHandlerName(obj->ID) == "pickable") {
waitWhileDialog();
CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds);
}
}

View File

@ -318,6 +318,11 @@ std::string CObjectClassesHandler::getObjectName(si32 type, si32 subtype) const
return getObjectName(type);
}
std::string CObjectClassesHandler::getObjectHandlerName(si32 type) const
{
return objects.at(type)->handlerName;
}
void AObjectTypeHandler::setType(si32 type, si32 subtype)
{
this->type = type;

View File

@ -221,6 +221,9 @@ public:
std::string getObjectName(si32 type) const;
std::string getObjectName(si32 type, si32 subtype) const;
/// Returns handler string describing the handler (for use in client)
std::string getObjectHandlerName(si32 type) const;
template <typename Handler> void serialize(Handler &h, const int version)
{