mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-15 11:46:56 +02:00
Some bugfixing, basic functionality of map objects seems to be working
This commit is contained in:
parent
d14a16249d
commit
ba5092d669
@ -84,12 +84,16 @@ void CObjectWithReward::onHeroVisit(const CGHeroInstance *h) const
|
||||
auto grantRewardWithMessage = [&](int index) -> void
|
||||
{
|
||||
grantReward(index, h);
|
||||
InfoWindow iw;
|
||||
iw.player = h->tempOwner;
|
||||
iw.soundID = soundID;
|
||||
iw.text = info[index].message;
|
||||
info[index].reward.loadComponents(iw.components);
|
||||
cb->showInfoDialog(&iw);
|
||||
// show message only if it is not empty
|
||||
if (!info[index].message.toString().empty())
|
||||
{
|
||||
InfoWindow iw;
|
||||
iw.player = h->tempOwner;
|
||||
iw.soundID = soundID;
|
||||
iw.text = info[index].message;
|
||||
info[index].reward.loadComponents(iw.components);
|
||||
cb->showInfoDialog(&iw);
|
||||
}
|
||||
};
|
||||
|
||||
if (!wasVisited(h))
|
||||
@ -102,7 +106,10 @@ void CObjectWithReward::onHeroVisit(const CGHeroInstance *h) const
|
||||
InfoWindow iw;
|
||||
iw.player = h->tempOwner;
|
||||
iw.soundID = soundID;
|
||||
iw.text = onEmpty;
|
||||
if (!onEmpty.toString().empty())
|
||||
iw.text = onEmpty;
|
||||
else
|
||||
iw.text = onVisited;
|
||||
cb->showInfoDialog(&iw);
|
||||
onRewardGiven(h); // FIXME: dummy call to properly act on empty objects (e.g. Floatsam that must be removed after visit)
|
||||
break;
|
||||
@ -142,7 +149,10 @@ void CObjectWithReward::onHeroVisit(const CGHeroInstance *h) const
|
||||
InfoWindow iw;
|
||||
iw.player = h->tempOwner;
|
||||
iw.soundID = soundID;
|
||||
iw.text = onVisited;
|
||||
if (!onVisited.toString().empty())
|
||||
iw.text = onVisited;
|
||||
else
|
||||
iw.text = onEmpty;
|
||||
cb->showInfoDialog(&iw);
|
||||
}
|
||||
}
|
||||
|
@ -1076,6 +1076,9 @@ struct ChangeObjectVisitors : public CPackForClient // 1003
|
||||
|
||||
DLL_LINKAGE void applyGs(CGameState *gs);
|
||||
|
||||
ChangeObjectVisitors()
|
||||
{ type = 1003; }
|
||||
|
||||
ChangeObjectVisitors(ui32 mode, ObjectInstanceID object, ObjectInstanceID heroID = ObjectInstanceID(-1)):
|
||||
mode(mode),
|
||||
object(object),
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CObjectHandler.h"
|
||||
#include "../CObjectWithReward.h"
|
||||
#include "../CObjectWithReward.h"
|
||||
#include "../CGameState.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
@ -80,12 +80,12 @@ void registerTypesMapObjects2(Serializer &s)
|
||||
s.template registerType<CGTownBuilding, CTownBonus>();
|
||||
s.template registerType<CGTownBuilding, COPWBonus>();
|
||||
|
||||
s.template registerType<CGObjectInstance, CObjectWithReward>();
|
||||
s.template registerType<CObjectWithReward, CGPickable>();
|
||||
s.template registerType<CObjectWithReward, CGVisitableOPH>();
|
||||
s.template registerType<CObjectWithReward, CGVisitableOPW>();
|
||||
s.template registerType<CObjectWithReward, CGOnceVisitable>();
|
||||
s.template registerType<CGVisitableOPW, CGMagicSpring>();
|
||||
s.template registerType<CGObjectInstance, CObjectWithReward>();
|
||||
s.template registerType<CObjectWithReward, CGPickable>();
|
||||
s.template registerType<CObjectWithReward, CGVisitableOPH>();
|
||||
s.template registerType<CObjectWithReward, CGVisitableOPW>();
|
||||
s.template registerType<CObjectWithReward, CGOnceVisitable>();
|
||||
s.template registerType<CGVisitableOPW, CGMagicSpring>();
|
||||
|
||||
s.template registerType<CGObjectInstance, CPlayersVisited>();
|
||||
s.template registerType<CPlayersVisited, CGWitchHut>();
|
||||
@ -188,6 +188,7 @@ void registerTypesClientPacks1(Serializer &s)
|
||||
s.template registerType<CPackForClient, CenterView>();
|
||||
s.template registerType<CPackForClient, HeroVisit>();
|
||||
s.template registerType<CPackForClient, SetCommanderProperty>();
|
||||
s.template registerType<CPackForClient, ChangeObjectVisitors>();
|
||||
}
|
||||
|
||||
template<typename Serializer>
|
||||
|
Loading…
x
Reference in New Issue
Block a user