Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed crash when trying to change targeting mode of vehicle turrets #35622

Merged
merged 2 commits into from
Nov 22, 2019
Merged

Fixed crash when trying to change targeting mode of vehicle turrets #35622

merged 2 commits into from
Nov 22, 2019

Conversation

Night-Pryanik
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Fixed crash when trying to change targeting mode of vehicle turrets."

Purpose of change

Closes #34831 - Game crash with the new autoturret system.

I made a mistake when I was implementing the new system, cause for this mistake I described here. This PR fixes situation when game is trying to access out-of-bounds element of vector, which obviously results in crash.

Describe the solution

  1. Loop through all available TCUs.
  2. If TCU is located on a tile with a turret we're changing targeting mode for, set its enabled state equal to enabled state of turret in question.

Describe alternatives you've considered

  • Remove the new TCU mechanics altogether;
  • Remove enabling and disabling of TCUs, which fixes the crash (no vector -> not even trying to access out-of-bounds element of vector -> no crash), but that removes power consume of TCU as well, so no.

Testing

Installed several turrets and TCUs on the vehicle, turned them all on and off in various combinations, checked for crashes (none onserved).

Additional context

Sorry for my incompetence.

@Night-Pryanik Night-Pryanik added Vehicles Vehicles, parts, mechanics & interactions <Bugfix> This is a fix for a bug (or closes open issue) labels Nov 20, 2019
@ZhilkinSerg ZhilkinSerg merged commit 0f93de3 into CleverRaven:master Nov 22, 2019
@Night-Pryanik Night-Pryanik deleted the fix-crash-auto-turrets branch November 22, 2019 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Game crash with the new autoturret system
2 participants