macressler / bwapi

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

Can't build/land/etc on far right and/or bottom edge of the map #489

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call canBuildHere(), placing a building at a clear location whose edge is 
against the far right and/or bottom edge of the map.

What is the expected output? What do you see instead?
It should return true, but it always returns false.

What version of the product are you using? On what operating system?
HEAD of branch bwapi4 of the src

Please provide any additional information below.
I think Shared\Templates.h:canBuildHere is returning false because the rb 
variable is initialised to an invalid location (i.e. off the edge of the map) 
during this statement:

TilePosition rb = position + TilePosition(width, height);

It would probably be simple to fix this function, but I expect that similar 
bugs exist in several other places in the BWAPI src, and there may be a lot of 
src in BWAPI (and other libraries & bots) that is only called if this function 
returns true and manipulates position-related objects without doing map array 
bounds safety checks.

My concern is that if just this function is fixed then unless all such src is 
fixed too then there may be crashes or strange problems caused by memory 
corruption, and these bugs may be hard to reproduce/debug because they would 
probably only occur in rare scenarios, and may not even be consistently 
reproducable.

So, risk may not be worth the effort.

Original issue reported on code.google.com by chris.c...@gmail.com on 23 May 2013 at 2:01

GoogleCodeExporter commented 9 years ago
Fixed in r4381.

Original comment by AHeinerm on 23 May 2013 at 7:27