mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Minor tweaks for hiding tiles, now it belongs to CGObjectInstance class.
This commit is contained in:
parent
ea150305a2
commit
a53be2d382
@ -422,6 +422,20 @@ void CGObjectInstance::getSightTiles(std::set<int3> &tiles) const //returns refe
|
|||||||
{
|
{
|
||||||
cb->getTilesInRange(tiles, getSightCenter(), getSightRadious(), tempOwner, 1);
|
cb->getTilesInRange(tiles, getSightCenter(), getSightRadious(), tempOwner, 1);
|
||||||
}
|
}
|
||||||
|
void CGObjectInstance::hideTiles(int ourplayer, int radius) const
|
||||||
|
{
|
||||||
|
for (std::map<ui8, PlayerState>::iterator i = cb->gameState()->players.begin(); i != cb->gameState()->players.end(); i++)
|
||||||
|
{
|
||||||
|
if (ourplayer != i->first && i->second.status == PlayerState::INGAME) //TODO: team support
|
||||||
|
{
|
||||||
|
FoWChange fw;
|
||||||
|
fw.mode = 0;
|
||||||
|
fw.player = i->first;
|
||||||
|
cb->getTilesInRange (fw.tiles, pos, radius, i->first, -1);
|
||||||
|
cb->sendAndApply (&fw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
int3 CGObjectInstance::getVisitableOffset() const
|
int3 CGObjectInstance::getVisitableOffset() const
|
||||||
{
|
{
|
||||||
for(int y = 0; y < 6; y++)
|
for(int y = 0; y < 6; y++)
|
||||||
@ -4470,17 +4484,7 @@ void CGObservatory::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
case 15://cover of darkness
|
case 15://cover of darkness
|
||||||
{
|
{
|
||||||
iw.text.addTxt (MetaString::ADVOB_TXT, 31);
|
iw.text.addTxt (MetaString::ADVOB_TXT, 31);
|
||||||
for (std::map<ui8, PlayerState>::iterator i = cb->gameState()->players.begin(); i != cb->gameState()->players.end(); i++)
|
hideTiles(h->tempOwner, 20);
|
||||||
{
|
|
||||||
if (h->tempOwner != i->first && i->second.status == PlayerState::INGAME) //TODO: team support
|
|
||||||
{
|
|
||||||
FoWChange fw;
|
|
||||||
fw.mode = 0;
|
|
||||||
fw.player = i->first;
|
|
||||||
cb->getTilesInRange (fw.tiles, pos, 20, i->first, -1);
|
|
||||||
cb->sendAndApply (&fw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,6 +190,7 @@ public:
|
|||||||
bool hasShadowAt(int x, int y) const;//returns true if object covers with shadow location (x, y) form left top tile of maximal possible image (8 x 6 tiles) (x, y in tiles)
|
bool hasShadowAt(int x, int y) const;//returns true if object covers with shadow location (x, y) form left top tile of maximal possible image (8 x 6 tiles) (x, y in tiles)
|
||||||
std::set<int3> getBlockedPos() const; //returns set of positions blocked by this object
|
std::set<int3> getBlockedPos() const; //returns set of positions blocked by this object
|
||||||
bool operator<(const CGObjectInstance & cmp) const; //screen printing priority comparing
|
bool operator<(const CGObjectInstance & cmp) const; //screen printing priority comparing
|
||||||
|
void hideTiles(int ourplayer, int radius) const;
|
||||||
CGObjectInstance();
|
CGObjectInstance();
|
||||||
virtual ~CGObjectInstance();
|
virtual ~CGObjectInstance();
|
||||||
//CGObjectInstance(const CGObjectInstance & right);
|
//CGObjectInstance(const CGObjectInstance & right);
|
||||||
|
@ -1037,19 +1037,9 @@ void CGameHandler::newTurn()
|
|||||||
}
|
}
|
||||||
if ((**j).hasBonusOfType (Bonus::DARKNESS))
|
if ((**j).hasBonusOfType (Bonus::DARKNESS))
|
||||||
{
|
{
|
||||||
for (std::map<ui8, PlayerState>::iterator i = gs->players.begin(); i != gs->players.end(); i++)
|
(**j).hideTiles((**j).getOwner(), (**j).getBonus(Selector::type(Bonus::DARKNESS))->val);
|
||||||
{
|
|
||||||
if (player != i->first && i->second.status == PlayerState::INGAME) //TODO: team support
|
|
||||||
{
|
|
||||||
FoWChange fw;
|
|
||||||
fw.mode = 0;
|
|
||||||
fw.player = i->first;
|
|
||||||
getTilesInRange (fw.tiles, (**j).getSightCenter(), (**j).getBonus(Selector::type(Bonus::DARKNESS))->val, i->first, -1);
|
|
||||||
sendAndApply (&fw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//unhiding what shouldn't be hidden?
|
//unhiding what shouldn't be hidden? //that's handled in netpacks client
|
||||||
}
|
}
|
||||||
|
|
||||||
sendAndApply(&n);
|
sendAndApply(&n);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user