It would be more efficient to use a variable to remember what the last place cell that was transparent was rather than wasting cycles on looping.

<pre>
+    // Unset the previously hovered cell (remove transparent unit)
+    if (unit_list[lastHover].state == UNIT_STATE_TRANSPARENT)
+        unit_list[lastHover].state = UNIT_STATE_NONE;
 </pre>

initialize lastHover in the constructor as 0 and set it to be "lastHover = id;" at the end of the function.