mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-23 12:08:45 +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);
|
||||
// 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;
|
||||
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;
|
||||
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),
|
||||
|
@ -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