2012-08-02, 04:59 AM
I have a compilation eror where it thinks a byte is a label
| The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "bas" - Line: 4649 - File: inc/functions.php PHP 8.2.31 (Linux)
|
|
compilation error (*solved*)
|
|
2012-08-02, 11:49 PM
The problem lies in function ChooseNextUnit()
Code: const NumUnitsIter as Ubyte = 29
Function ChooseNextUnit() as byte
if LastColorToMove=0 then
LastColorToMove=red
end if
for NumUnitsIter =1 to NumUnits 'NumUnitsIter is a global constant!
if ActionPoints(NumUnitsIter)=3 then
UnitMoving=NumUnitsIter
Exit for
end if
next
end functionThe FOR loop is using NumsUnitIter as a variable, but it's already declared globally as a const. You should add the line Code: Dim NumUnitsIter as UbyteThis 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.
2012-08-03, 12:50 AM
thanks :oops:
By the way do you think it will be quicker to: 1. take away 1 from a number, or 2. get a global variable? so i can loop through an array with FOR
2012-08-03, 07:55 AM
slenkar Wrote:thanks :oops:I think the 2nd is faster. Anyway, just use DIM within the function and your code is OK! ;-) (outside the function you will be using the constant).
2012-08-05, 01:17 AM
This has been fixed (I think).
Please, download and install the version 1.2.9s910. Try it and tell me.
2012-08-05, 01:32 AM
yep that works thanks,
it says its not a variable |
|
« Next Oldest | Next Newest »
|