Cokemonkey11
Spell Reviewer
- Joined
- May 9, 2006
- Messages
- 3,570
Hey y'all,
Just debugged a silly problem in my map, which I was ready to chalk up to 1.31.x problemos.
Myboard (link: [PROTOTYPE] myBoard) has some code that looks like this:
private constant integer MAX_ROW_COUNT = 100
private constant integer MAX_COLUMN_COUNT = 30
...
method setLocalValue takes player whichPlayer, integer col, integer row, string newValue returns nothing
local integer arrIndex = MAX_COLUMN_COUNT*col + row
if GetLocalPlayer() == whichPlayer then
set .curValue[arrIndex] = newValue
endif
call MultiboardSetItemValue(.brdItem[arrIndex],.curValue[arrIndex])
endmethod
You can trivially see that if you set MAX_COLUMN_COUNT to 2, and MAX_ROW_COUNT to 3, then cells (2, 1) and (1, 2) resolve to the same element.
Indeed, the provided default script with 100 and 30 is bugged.
Solution: always use a max colcount that is at least 1 greater than your max rowcount.
THBAPSA
Just debugged a silly problem in my map, which I was ready to chalk up to 1.31.x problemos.
Myboard (link: [PROTOTYPE] myBoard) has some code that looks like this:
private constant integer MAX_ROW_COUNT = 100
private constant integer MAX_COLUMN_COUNT = 30
...
method setLocalValue takes player whichPlayer, integer col, integer row, string newValue returns nothing
local integer arrIndex = MAX_COLUMN_COUNT*col + row
if GetLocalPlayer() == whichPlayer then
set .curValue[arrIndex] = newValue
endif
call MultiboardSetItemValue(.brdItem[arrIndex],.curValue[arrIndex])
endmethod
You can trivially see that if you set MAX_COLUMN_COUNT to 2, and MAX_ROW_COUNT to 3, then cells (2, 1) and (1, 2) resolve to the same element.
Indeed, the provided default script with 100 and 30 is bugged.
Solution: always use a max colcount that is at least 1 greater than your max rowcount.
THBAPSA