Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
compilation error (*solved*)
The problem lies in function ChooseNextUnit()

const NumUnitsIter as Ubyte = 29

Function ChooseNextUnit() as byte
     if LastColorToMove=0 then
     end if

    for NumUnitsIter =1 to NumUnits 'NumUnitsIter is a global constant!
        if ActionPoints(NumUnitsIter)=3 then
            Exit for
        end if
end function

The FOR loop is using NumsUnitIter as a variable, but it's already declared globally as a const.
You should add the line
Dim NumUnitsIter as Ubyte
within the function body, so the compiler will understand you want to override the global constant using the same name for a local variable (the global constant NumUnitsIter won't be available within the function). The compiler won't override (declare) the local variable within the function for you (at the moment).
This is a compiler bug, anyway: it should either stop with an error, or issue a warning "Inner declaration hides global constant", or the like. I will fix it later.

Messages In This Thread

Forum Jump:

Users browsing this thread: 1 Guest(s)