mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-29 00:41:38 +02:00
Fixed wrong sight center (#276)
This commit is contained in:
@ -398,7 +398,7 @@ int CGObjectInstance::getSightRadious() const
|
|||||||
}
|
}
|
||||||
void CGObjectInstance::getSightTiles(std::set<int3> &tiles) const //returns reference to the set
|
void CGObjectInstance::getSightTiles(std::set<int3> &tiles) const //returns reference to the set
|
||||||
{
|
{
|
||||||
cb->getTilesInRange(tiles, pos, getSightRadious(), tempOwner, 1);
|
cb->getTilesInRange(tiles, getSightCenter(), getSightRadious(), tempOwner, 1);
|
||||||
}
|
}
|
||||||
int3 CGObjectInstance::getVisitableOffset() const
|
int3 CGObjectInstance::getVisitableOffset() const
|
||||||
{
|
{
|
||||||
|
@ -1397,22 +1397,7 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
|
|||||||
BOOST_FOREACH(CGObjectInstance *obj, map->objects)
|
BOOST_FOREACH(CGObjectInstance *obj, map->objects)
|
||||||
{
|
{
|
||||||
if(obj->tempOwner != k->first) continue; //not a flagged object
|
if(obj->tempOwner != k->first) continue; //not a flagged object
|
||||||
/*
|
|
||||||
int3 objCenter = obj->getSightCenter();
|
|
||||||
int radious = obj->getSightRadious();
|
|
||||||
if (radious == -1) //maybe better handle it via getTilesInRange as below?
|
|
||||||
radious = map->width + map->height;
|
|
||||||
|
|
||||||
for (int xd = std::max<int>(objCenter.x - radious , 0); xd <= std::min<int>(objCenter.x + radious, map->width - 1); xd++)
|
|
||||||
{
|
|
||||||
for (int yd = std::max<int>(objCenter.y - radious, 0); yd <= std::min<int>(objCenter.y + radious, map->height - 1); yd++)
|
|
||||||
{
|
|
||||||
double distance = objCenter.dist2d(int3(xd,yd,objCenter.z)) - 0.5;
|
|
||||||
if(distance <= radious)
|
|
||||||
k->second.fogOfWarMap[xd][yd][objCenter.z] = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
std::set<int3> tiles;
|
std::set<int3> tiles;
|
||||||
obj->getSightTiles(tiles);
|
obj->getSightTiles(tiles);
|
||||||
BOOST_FOREACH(int3 tile, tiles)
|
BOOST_FOREACH(int3 tile, tiles)
|
||||||
@ -1421,20 +1406,6 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//for(int xd=0; xd<map->width; ++xd) //revealing part of map around heroes
|
|
||||||
//{
|
|
||||||
// for(int yd=0; yd<map->height; ++yd)
|
|
||||||
// {
|
|
||||||
// for(int ch=0; ch<k->second.heroes.size(); ++ch)
|
|
||||||
// {
|
|
||||||
// int deltaX = (k->second.heroes[ch]->getPosition(false).x-xd)*(k->second.heroes[ch]->getPosition(false).x-xd);
|
|
||||||
// int deltaY = (k->second.heroes[ch]->getPosition(false).y-yd)*(k->second.heroes[ch]->getPosition(false).y-yd);
|
|
||||||
// if(deltaX+deltaY<k->second.heroes[ch]->getSightDistance()*k->second.heroes[ch]->getSightDistance())
|
|
||||||
// k->second.fogOfWarMap[xd][yd][k->second.heroes[ch]->getPosition(false).z] = 1;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//starting bonus
|
//starting bonus
|
||||||
if(si->playerInfos[k->second.serial].bonus==brandom)
|
if(si->playerInfos[k->second.serial].bonus==brandom)
|
||||||
si->playerInfos[k->second.serial].bonus = ran()%3;
|
si->playerInfos[k->second.serial].bonus = ran()%3;
|
||||||
|
Reference in New Issue
Block a user