Fix TpvScene3D.TLight.BeforeDestruction #53

Open
michaliskambi wants to merge 1 commit from michaliskambi/master into master
michaliskambi commented 2026-04-03 00:55:30 +00:00 (Migrated from github.com)

Code in TpvScene3D.TLight.BeforeDestruction was accidentally doing

fSceneInstance.fManualLights[fIndex]:=OtherLight;

when fIndex is obviously -1 (set to -1 by finally clause a few lines higher).

This was causing range check errors when destroying certain animals in our game:)

It seems that it's a copy-paste error, the code under if fManualIndex>=0 then begin seems mostly a copy-paste of the code under if fIndex>=0 then begin, you possibly copied it and didn't adjust all occurences of fIndex -> fManualIndex?

Tested the solution on our game, and destroying some animals crashes no more:)

Code in `TpvScene3D.TLight.BeforeDestruction` was accidentally doing ``` fSceneInstance.fManualLights[fIndex]:=OtherLight; ``` when `fIndex` is obviously -1 (set to -1 by `finally` clause a few lines higher). This was causing range check errors when destroying certain animals in our game:) It seems that it's a copy-paste error, the code under `if fManualIndex>=0 then begin` seems mostly a copy-paste of the code under `if fIndex>=0 then begin`, you possibly copied it and didn't adjust all occurences of `fIndex` -> `fManualIndex`? Tested the solution on our game, and destroying some animals crashes no more:)
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin michaliskambi/master:michaliskambi/master
git switch michaliskambi/master

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff michaliskambi/master
git switch michaliskambi/master
git rebase master
git switch master
git merge --ff-only michaliskambi/master
git switch michaliskambi/master
git rebase master
git switch master
git merge --no-ff michaliskambi/master
git switch master
git merge --squash michaliskambi/master
git switch master
git merge --ff-only michaliskambi/master
git switch master
git merge michaliskambi/master
git push origin master
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BeRo1985/pasvulkan!53
No description provided.