1: fgroupnumber has no value anywhere. Therefore, the best position for assigning a value to fgroupnumber is the tsprite. setgroupnumber process. Therefore, the followingCodeIs the modified Code:
Procedure Tsprite. setgroupnumber (agroupnumber: integer );
Begin
If (Agroupnumber <> Groupnumber) And
(Engine <> Nil ) Then
Begin
If Groupnumber > = 0 Then
Engine. Groups [groupnumber]. Remove (Self );
If Agroupnumber > = 0 Then
Begin
Engine. Groups [agroupnumber]. Add (Self );
// Add By zhaogw: Update fgroupnumber Is No way
Fgroupnumber: = Agroupnumber;
End ;
End ;
End ; { Setgroupnumber }
2: Where there is a bug: The tspriteengine. getgroup process. The error is caused by an incorrect judgment condition. The modified code is as follows:
Function Tspriteengine. getgroup (Index: integer): tlist;
Begin
// If (Index > = 0 ) Or (Index < Fgroupcount) Then Edit by zhaogw, this Is Old
If (Index > = 0 ) And (Index < Fgroupcount) Then
Result: = Fgroups [Index]
Else
Result: = Nil ;
End ; { Getgroup }
Here it turns out to be the condition for determining or. After using or, it is obviously infinite. Therefore, we should change or to and here.