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

Timed Traffic Light tool not properly cleaned up on close #861

Closed
krzychu124 opened this issue Apr 24, 2020 · 1 comment · Fixed by #880
Closed

Timed Traffic Light tool not properly cleaned up on close #861

krzychu124 opened this issue Apr 24, 2020 · 1 comment · Fixed by #880
Assignees
Labels
BUG Defect detected LABS TM:PE LABS branch STABLE TM:PE STABLE branch TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc
Milestone

Comments

@krzychu124
Copy link
Member

Describe the problem

Timed Traffic lights UI breaks when user closing UI or selecting other tool without unselecting node first.

Steps to reproduce

  1. Set up simple TTL at any intersection you want
  2. You can start TTL sequence but not required
  3. Hit close tool (Esc) or change tool to other one
  4. Enable TTL tool again (breaks UI - screenshot below)

Log files

Error 851.9354609: TimedTrafficLightsTool._guiTimedControlPanel: System.ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
  at System.Collections.Generic.List`1[System.UInt16].get_Item (Int32 index) [0x00000] in <filename unknown>:0 
  at TrafficManager.UI.SubTools.TimedTrafficLights.TimedTrafficLightsTool.GuiTimedControlPanel (Int32 num) [0x00000] in <filename unknown>:0 
   at CSUtil.Commons.Log.LogToFile(System.String log, LogLevel level)
   at CSUtil.Commons.Log.Error(System.String s)
   at TrafficManager.UI.SubTools.TimedTrafficLights.TimedTrafficLightsTool.GuiTimedControlPanel(Int32 num)
   at UnityEngine.GUILayout+LayoutedWindow.DoWindow(Int32 windowID)
   at UnityEngine.GUI.CallWindowDelegate(UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style)

Savegame?

Not necessary, UI always breaks

Screenshots?

image

Notes

Tested on TM:PE 11.4.0:FullDebug-master, works on 11.2.x

When UI became broken, RightClick anywhere to reset internal node selection then all should start work correctly

@krzychu124 krzychu124 added BUG Defect detected LABS TM:PE LABS branch STABLE TM:PE STABLE branch TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc labels Apr 24, 2020
@krzychu124
Copy link
Member Author

It's not cleanup issue, but one of last menu/UI refactoring process introduced a little bug.
Previously default action when user activated Timed Traffic Lights tool was setting subTool mode to: TimedTrafficSelectNode.
During refactoring, Traffic Lights specific subTool modes were extracted to internal TTLToolMode.
Now during initialization of TTL tool, SelectTool is set, but not each time when user activates tool, which is causing above issues misinterpreted as improper cleanup on tool deactivation.

Possible quick fix: add code to set internal TTLToolMode to SelectNode each time tool is activating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Defect detected LABS TM:PE LABS branch STABLE TM:PE STABLE branch TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants