View Single Post
Old 08-09-2009, 02:44 PM   #15
Strategy Master
Great Sage
 
Strategy Master's Avatar


Project Leader: AMAI
 
Join Date: Jun 2003
Posts: 711

Submissions (1)

Strategy Master has a spectacular aura about (77)Strategy Master has a spectacular aura about (77)Strategy Master has a spectacular aura about (77)

Default

I've had a look at the AMAI dialogue. The code responsible for the language mess is in the common.ai file.

Code:
function LookupCT takes string s returns string
  local integer i = StringHash(s)
  return char_table[i - (i/JASS_MAX_ARRAY_SIZE)*JASS_MAX_ARRAY_SIZE]
endfunction

//============================================================================
function AddToCT takes string s returns nothing
  local integer i = StringHash(SubString(s, 0, 1))
  set char_table[i - (i/JASS_MAX_ARRAY_SIZE)*JASS_MAX_ARRAY_SIZE] = s
endfunction

Obviously StringHash replaces the return bug usage to convert strings to ints but its resulting in gobbly gook dialogue. Converting to hashtable just results in AMAI displaying every message stored all at once (but without any text corruption). Fixing the array formula of char_table so its not effectivly always 0 results in no dialogue at all being displayed.

Most likely the problem is StringHash does something different to the old return bug from string to integers and another bug which the conditional system took advantage of has been squashed. The worst case scenario is language conditional responses will have to be scrapped. The actual translation system appears to be working correctly though.
__________________
Strategy Master is offline   Reply With Quote