google-code-export / bwapi

Automatically exported from code.google.com/p/bwapi
0 stars 0 forks source link

getGroundHeight returns 0 for tiles with creep. #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
> What steps will reproduce the problem?
eg

editing the ExampleAI::OnFrame

// for(x, y) etc
int height = Broodwar->getGroundHeight(x*4+2, y*4+2)
Color c;
// Set colour based on the height
// 0->Red, 1->Orange, 2->Green
Broodwar->drawDotMap(x*32+16,y*32+16, c)

Play as zerg starting on high ground (eg astral balance)

> What is the expected output? What do you see instead?
Creep gets the colour corresponding to 0, no matter the height of the
underlying ground.  Creating a creep colony shows the colours changing.

> What version of the product are you using? On what operating system?
2.4

> Please provide any additional information below.

Original issue reported on code.google.com by danielst...@gmail.com on 11 Dec 2009 at 12:23

GoogleCodeExporter commented 9 years ago

Original comment by lowerlo...@gmail.com on 12 Dec 2009 at 3:10

GoogleCodeExporter commented 9 years ago
It looks like creep unsets all mini-tile flags except for walkable, so we will 
need
to find a different way to read ground height information.

Original comment by lowerlo...@gmail.com on 12 Dec 2009 at 4:51

GoogleCodeExporter commented 9 years ago
this looks like it gives the mostly correct ground height in build tile 
resolution
(not affected by zerg creep):

  int Map::getGroundHeight(int x, int y) const
  {
    if ((unsigned int)x>=buildability.getWidth() || (unsigned
int)y>=buildability.getHeight())
      return false;
    u32 value =  (*this->fogOfWar)[y][x];
    value = value >> 16;
    int h=0;
    if ((value & (0x200))!=0)
    {
      h=1;
    }
    if ((value & (0x400))!=0)
    {
      h=2;
    }
    return h;
  }

Original comment by lowerlo...@gmail.com on 12 Dec 2009 at 6:49

GoogleCodeExporter commented 9 years ago
this is interesting (though unrelated): it appears value & 0x800 !=0 if and 
only if
some building is on the given build tile. Could be used to make a non-static
Game::isBuildable function that takes into account buildings (but not 
infantry/vehicles):
isNowBuildable(x,y) := isBuildable(x,y) && ((value & 0x800) == 0)

Original comment by lowerlo...@gmail.com on 12 Dec 2009 at 6:59

GoogleCodeExporter commented 9 years ago

Original comment by lowerlo...@gmail.com on 20 Dec 2009 at 11:03

GoogleCodeExporter commented 9 years ago

Original comment by lowerlo...@gmail.com on 7 Mar 2010 at 5:59

GoogleCodeExporter commented 9 years ago
Fixed in r2436.

Original comment by lowerlo...@gmail.com on 13 Jun 2010 at 4:35