View Single Post
Old 06-23-2011, 03:13 PM   #8
BBQ
User
 
Join Date: May 2011
Posts: 85

Submissions (2)

BBQ will become famous soon enough (30)BBQ will become famous soon enough (30)

Default

Collapse JASS:
    function GetUnitScale takes unit u returns real
      static if USE_AUTOINDEX_IF_PRESENT and LIBRARY_AutoIndex then
        return unitsScale[GetUnitId(u)]
      else
        return unitScale[u]*0.001
      endif
    endfunction
Collapse JASS:
    function GetUnitTimeScale takes unit u returns real
      static if USE_AUTOINDEX_IF_PRESENT and LIBRARY_AutoIndex then
        return unitsSpeed[GetUnitId(u)]
      else
        return unitSpeed[u]*0.001
      endif
    endfunction

Now that you added the PRECISION constant, shouldn't these be return (unitScale[u]/PRECISION) and return (unitSpeed[u]/PRECISION) respectively?

Also, how about using a native hashtable instead of Table in order to store reals directly and avoid all those multiplications/divisions altogether? A single hashtable won't contribute much to reaching the 256-instance limit.
BBQ is offline   Reply With Quote