equal
deleted
inserted
replaced
160 var Result: PGear; |
160 var Result: PGear; |
161 begin |
161 begin |
162 inc(Counter); |
162 inc(Counter); |
163 {$IFDEF DEBUGFILE}AddFileLog('AddGear: ('+inttostr(x)+','+inttostr(y)+'), d('+floattostr(dX)+','+floattostr(dY)+')');{$ENDIF} |
163 {$IFDEF DEBUGFILE}AddFileLog('AddGear: ('+inttostr(x)+','+inttostr(y)+'), d('+floattostr(dX)+','+floattostr(dY)+')');{$ENDIF} |
164 New(Result); |
164 New(Result); |
165 {$IFDEF DEBUGFILE}AddFileLog('AddGear: type = '+inttostr(ord(Kind))+'; handle = '+inttostr(integer(Result)));{$ENDIF} |
165 {$IFDEF DEBUGFILE}AddFileLog('AddGear: type = ' + inttostr(ord(Kind)));{$ENDIF} |
166 FillChar(Result^, sizeof(TGear), 0); |
166 FillChar(Result^, sizeof(TGear), 0); |
167 Result^.X:= X; |
167 Result^.X:= X; |
168 Result^.Y:= Y; |
168 Result^.Y:= Y; |
169 Result^.Kind := Kind; |
169 Result^.Kind := Kind; |
170 Result^.State:= State; |
170 Result^.State:= State; |
284 if Gear^.CollIndex < High(Longword) then DeleteCI(Gear); |
284 if Gear^.CollIndex < High(Longword) then DeleteCI(Gear); |
285 if Gear^.Surf <> nil then SDL_FreeSurface(Gear^.Surf); |
285 if Gear^.Surf <> nil then SDL_FreeSurface(Gear^.Surf); |
286 if Gear^.Kind = gtHedgehog then |
286 if Gear^.Kind = gtHedgehog then |
287 if CurAmmoGear <> nil then |
287 if CurAmmoGear <> nil then |
288 begin |
288 begin |
289 {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: Sending gm_Destroy, hh handle = '+inttostr(integer(Gear)));{$ENDIF} |
|
290 Gear^.Message:= gm_Destroy; |
289 Gear^.Message:= gm_Destroy; |
291 CurAmmoGear^.Message:= gm_Destroy; |
290 CurAmmoGear^.Message:= gm_Destroy; |
292 exit |
291 exit |
293 end else |
292 end else |
294 begin |
293 begin |
303 FreeActionsList; // to avoid ThinkThread on drawned gear |
302 FreeActionsList; // to avoid ThinkThread on drawned gear |
304 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
303 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
305 inc(KilledHHs); |
304 inc(KilledHHs); |
306 RecountTeamHealth(team); |
305 RecountTeamHealth(team); |
307 end; |
306 end; |
308 {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: handle = '+inttostr(integer(Gear)));{$ENDIF} |
307 {$IFDEF DEBUGFILE}AddFileLog('DeleteGear');{$ENDIF} |
309 if CurAmmoGear = Gear then CurAmmoGear:= nil; |
308 if CurAmmoGear = Gear then CurAmmoGear:= nil; |
310 if FollowGear = Gear then FollowGear:= nil; |
309 if FollowGear = Gear then FollowGear:= nil; |
311 RemoveGearFromList(Gear); |
310 RemoveGearFromList(Gear); |
312 Dispose(Gear) |
311 Dispose(Gear) |
313 end; |
312 end; |
871 with ar[GetRandom(cnt)] do |
870 with ar[GetRandom(cnt)] do |
872 begin |
871 begin |
873 Gear^.X:= x; |
872 Gear^.X:= x; |
874 Gear^.Y:= y; |
873 Gear^.Y:= y; |
875 {$IFDEF DEBUGFILE} |
874 {$IFDEF DEBUGFILE} |
876 AddFileLog('Assigned Gear ' + inttostr(integer(Gear)) + |
875 AddFileLog('Assigned Gear coordinates (' + inttostr(x) + ',' + inttostr(y) + ')'); |
877 ' coordinates (' + inttostr(x) + |
|
878 ',' + inttostr(y) + ')'); |
|
879 {$ENDIF} |
876 {$ENDIF} |
880 exit |
877 exit |
881 end |
878 end |
882 until (x - Gear^.Radius < fx) and (x + Gear^.Radius > fx); |
879 until (x - Gear^.Radius < fx) and (x + Gear^.Radius > fx); |
883 dec(Delta, 20) |
880 dec(Delta, 20) |
884 until (Delta < 70); |
881 until (Delta < 70); |
885 OutError('Couldn''t find place for Gear ' + inttostr(integer(Gear)), false); |
882 OutError('Couldn''t find place for Gear', false); |
886 DeleteGear(Gear) |
883 DeleteGear(Gear) |
887 end; |
884 end; |
888 |
885 |
889 initialization |
886 initialization |
890 |
887 |