diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index d243f2462..d75674076 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -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(obj); heroKilled(h); + } else if (VLC->objtypeh->getObjectHandlerName(obj->ID) == "pickable") { + waitWhileDialog(); + CCS->soundh->playSoundFromSet(CCS->soundh->pickupSounds); } } diff --git a/lib/mapObjects/CObjectClassesHandler.cpp b/lib/mapObjects/CObjectClassesHandler.cpp index 8c276e05a..f47c20a3c 100644 --- a/lib/mapObjects/CObjectClassesHandler.cpp +++ b/lib/mapObjects/CObjectClassesHandler.cpp @@ -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; diff --git a/lib/mapObjects/CObjectClassesHandler.h b/lib/mapObjects/CObjectClassesHandler.h index 30a4ef88f..526fd8ad1 100644 --- a/lib/mapObjects/CObjectClassesHandler.h +++ b/lib/mapObjects/CObjectClassesHandler.h @@ -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 void serialize(Handler &h, const int version) {