|
@@ -4035,10 +4035,11 @@ void CGShipyard::onHeroVisit( const CGHeroInstance * h ) const
|
|
|
|
|
|
void CCartographer::onHeroVisit( const CGHeroInstance * h ) const
|
|
void CCartographer::onHeroVisit( const CGHeroInstance * h ) const
|
|
{
|
|
{
|
|
- if (!hasVisited (h->getOwner()) )
|
|
|
|
|
|
+ if (!hasVisited (h->getOwner()) ) //if hero has not visited yet this cartographer
|
|
{
|
|
{
|
|
- if (cb->getResource(h->tempOwner, 6) >= 1000)
|
|
|
|
|
|
+ if (cb->getResource(h->tempOwner, 6) >= 1000) //if he can afford a map
|
|
{
|
|
{
|
|
|
|
+ //ask if he wants to buy one
|
|
int text;
|
|
int text;
|
|
if (cb->getTile(pos)->tertype == 8) //water
|
|
if (cb->getTile(pos)->tertype == 8) //water
|
|
text = 25;
|
|
text = 25;
|
|
@@ -4055,7 +4056,7 @@ void CCartographer::onHeroVisit( const CGHeroInstance * h ) const
|
|
bd.text.addTxt (MetaString::ADVOB_TXT, text);
|
|
bd.text.addTxt (MetaString::ADVOB_TXT, text);
|
|
cb->showBlockingDialog (&bd, boost::bind (&CCartographer::buyMap, this, h, _1));
|
|
cb->showBlockingDialog (&bd, boost::bind (&CCartographer::buyMap, this, h, _1));
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else //if he cannot afford
|
|
{
|
|
{
|
|
InfoWindow iw;
|
|
InfoWindow iw;
|
|
iw.player = h->getOwner();
|
|
iw.player = h->getOwner();
|
|
@@ -4064,7 +4065,7 @@ void CCartographer::onHeroVisit( const CGHeroInstance * h ) const
|
|
cb->showInfoDialog (&iw);
|
|
cb->showInfoDialog (&iw);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else //if he already visited carographer
|
|
{
|
|
{
|
|
InfoWindow iw;
|
|
InfoWindow iw;
|
|
iw.player = h->getOwner();
|
|
iw.player = h->getOwner();
|
|
@@ -4073,9 +4074,10 @@ void CCartographer::onHeroVisit( const CGHeroInstance * h ) const
|
|
cb->showInfoDialog (&iw);
|
|
cb->showInfoDialog (&iw);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
void CCartographer::buyMap (const CGHeroInstance *h, ui32 accept) const
|
|
void CCartographer::buyMap (const CGHeroInstance *h, ui32 accept) const
|
|
{
|
|
{
|
|
- if (accept)
|
|
|
|
|
|
+ if (accept) //if hero wants to buy map
|
|
{
|
|
{
|
|
cb->giveResource (h->tempOwner, 6, -1000);
|
|
cb->giveResource (h->tempOwner, 6, -1000);
|
|
FoWChange fw;
|
|
FoWChange fw;
|
|
@@ -4090,8 +4092,9 @@ void CCartographer::buyMap (const CGHeroInstance *h, ui32 accept) const
|
|
else
|
|
else
|
|
floor = 2;
|
|
floor = 2;
|
|
|
|
|
|
|
|
+ //reveal apropriate tiles
|
|
cb->getAllTiles (fw.tiles, h->tempOwner, floor, surface);
|
|
cb->getAllTiles (fw.tiles, h->tempOwner, floor, surface);
|
|
cb->sendAndApply (&fw);
|
|
cb->sendAndApply (&fw);
|
|
cb->setObjProperty (id, 10, h->tempOwner);
|
|
cb->setObjProperty (id, 10, h->tempOwner);
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|