An issue

#1
in BattleInfo::getAccessibility()

...
	bool ac[BFIELD_SIZE];
...
for(int b=0; b<BFIELD_SIZE; ++b)
			{
				if( ac** && !(s->attackerOwned ? ac** : ac**))
...

Obviously there’s an off by one error in ac** when b=BFIELD_SIZE. I don’t know what this code is doing so I won’t fix it.

#2
In AI, CBattleLogic::PerformBerserkAttack(int stackID, int &additionalInfo) doesn’t initialize additionalInfo.********

[quote=“ubuntux”]
#1
in BattleInfo::getAccessibility()

...
	bool ac[BFIELD_SIZE];
...
for(int b=0; b<BFIELD_SIZE; ++b)
			{
				if( ac** && !(s->attackerOwned ? ac** : ac**))
...

Obviously there’s an off by one error in ac** when b=BFIELD_SIZE. I don’t know what this code is doing so I won’t fix it.


b shouldn’t assume the value BFIELD_SIZE, as b is supposed to be less than BFIELD_SIZE, not less than or equal.

EDIT: Although, b + 1 does, which is probably what you meant. Does this issue bear any correlation to the problems with battles crashing? I get index out of bounds exceptions most of the time in battles caused by the server. I’m having a hard time debugging with MSVC so I am unable to look into it.[/quote]

I think the battlefield size isn’t total size - there is difrent odd and parity rows, there are additional row for battle machines etc. - I think those code is to support those when needed - until I guess correctly it’s proprer

@1 - fixed

Most left and most right colums of hexes shoud just be excluded.

OnionKnight, I was off by two when I wrote that :slight_smile: But there was indeed an off-by-one error. ac[BFIELD_SIZE+1-1] is out of bound.