mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-13 01:20:34 +02:00
Some bugfixing, basic functionality of map objects seems to be working
This commit is contained in:
@ -84,12 +84,16 @@ void CObjectWithReward::onHeroVisit(const CGHeroInstance *h) const
|
|||||||
auto grantRewardWithMessage = [&](int index) -> void
|
auto grantRewardWithMessage = [&](int index) -> void
|
||||||
{
|
{
|
||||||
grantReward(index, h);
|
grantReward(index, h);
|
||||||
|
// show message only if it is not empty
|
||||||
|
if (!info[index].message.toString().empty())
|
||||||
|
{
|
||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = h->tempOwner;
|
iw.player = h->tempOwner;
|
||||||
iw.soundID = soundID;
|
iw.soundID = soundID;
|
||||||
iw.text = info[index].message;
|
iw.text = info[index].message;
|
||||||
info[index].reward.loadComponents(iw.components);
|
info[index].reward.loadComponents(iw.components);
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!wasVisited(h))
|
if (!wasVisited(h))
|
||||||
@ -102,7 +106,10 @@ void CObjectWithReward::onHeroVisit(const CGHeroInstance *h) const
|
|||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = h->tempOwner;
|
iw.player = h->tempOwner;
|
||||||
iw.soundID = soundID;
|
iw.soundID = soundID;
|
||||||
|
if (!onEmpty.toString().empty())
|
||||||
iw.text = onEmpty;
|
iw.text = onEmpty;
|
||||||
|
else
|
||||||
|
iw.text = onVisited;
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
onRewardGiven(h); // FIXME: dummy call to properly act on empty objects (e.g. Floatsam that must be removed after visit)
|
onRewardGiven(h); // FIXME: dummy call to properly act on empty objects (e.g. Floatsam that must be removed after visit)
|
||||||
break;
|
break;
|
||||||
@ -142,7 +149,10 @@ void CObjectWithReward::onHeroVisit(const CGHeroInstance *h) const
|
|||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = h->tempOwner;
|
iw.player = h->tempOwner;
|
||||||
iw.soundID = soundID;
|
iw.soundID = soundID;
|
||||||
|
if (!onVisited.toString().empty())
|
||||||
iw.text = onVisited;
|
iw.text = onVisited;
|
||||||
|
else
|
||||||
|
iw.text = onEmpty;
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1076,6 +1076,9 @@ struct ChangeObjectVisitors : public CPackForClient // 1003
|
|||||||
|
|
||||||
DLL_LINKAGE void applyGs(CGameState *gs);
|
DLL_LINKAGE void applyGs(CGameState *gs);
|
||||||
|
|
||||||
|
ChangeObjectVisitors()
|
||||||
|
{ type = 1003; }
|
||||||
|
|
||||||
ChangeObjectVisitors(ui32 mode, ObjectInstanceID object, ObjectInstanceID heroID = ObjectInstanceID(-1)):
|
ChangeObjectVisitors(ui32 mode, ObjectInstanceID object, ObjectInstanceID heroID = ObjectInstanceID(-1)):
|
||||||
mode(mode),
|
mode(mode),
|
||||||
object(object),
|
object(object),
|
||||||
|
@ -188,6 +188,7 @@ void registerTypesClientPacks1(Serializer &s)
|
|||||||
s.template registerType<CPackForClient, CenterView>();
|
s.template registerType<CPackForClient, CenterView>();
|
||||||
s.template registerType<CPackForClient, HeroVisit>();
|
s.template registerType<CPackForClient, HeroVisit>();
|
||||||
s.template registerType<CPackForClient, SetCommanderProperty>();
|
s.template registerType<CPackForClient, SetCommanderProperty>();
|
||||||
|
s.template registerType<CPackForClient, ChangeObjectVisitors>();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Serializer>
|
template<typename Serializer>
|
||||||
|
Reference in New Issue
Block a user