Skip to content

Commit a488f90

Browse files
committed
TMPE version 1.7.15:
- Bugfix: Timed traffic lights window disappears when clicking on it with the middle mouse button (thanks to @nexus and @Mariobro14 for helping me identifying the cause of this bug)
1 parent 9b17297 commit a488f90

File tree

8 files changed

+31
-13
lines changed

8 files changed

+31
-13
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ A work-in-progress modification for **Cities: Skylines** to add additional traff
44
User manual: http://www.viathinksoft.de/tmpe
55

66
# Changelog
7+
1.7.15, 10/26/2016
8+
- Bugfix: Timed traffic lights window disappears when clicking on it with the middle mouse button (thanks to @Nexus and @Mariobro14 for helping me identifying the cause of this bug)
9+
10+
1.7.14, 10/18/2016
11+
- Updated for game version 1.5.2-f3
12+
713
1.7.13, 09/15/2016
814
- Implemented a permanent fix to solve problems with stuck vehicles/cims caused by third party mods
915
- Added a button to reset stuck vehicles/cims (see mod settings menu)

TLM/TLM/LoadingExtension.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,12 +1160,16 @@ public override void OnLevelLoaded(LoadMode mode) {
11601160
uint versionC = Convert.ToUInt32(versionElms[2]);
11611161

11621162
bool isModTooOld = TrafficManagerMod.GameVersionA < versionA ||
1163-
(TrafficManagerMod.GameVersionA == versionA && TrafficManagerMod.GameVersionB < versionB) ||
1164-
(TrafficManagerMod.GameVersionA == versionA && TrafficManagerMod.GameVersionB == versionB && TrafficManagerMod.GameVersionC < versionC);
1163+
(TrafficManagerMod.GameVersionA == versionA && TrafficManagerMod.GameVersionB < versionB)/* ||
1164+
(TrafficManagerMod.GameVersionA == versionA && TrafficManagerMod.GameVersionB == versionB && TrafficManagerMod.GameVersionC < versionC)*/;
1165+
1166+
bool isModNewer = TrafficManagerMod.GameVersionA < versionA ||
1167+
(TrafficManagerMod.GameVersionA == versionA && TrafficManagerMod.GameVersionB > versionB)/* ||
1168+
(TrafficManagerMod.GameVersionA == versionA && TrafficManagerMod.GameVersionB == versionB && TrafficManagerMod.GameVersionC > versionC)*/;
11651169

11661170
if (isModTooOld) {
11671171
UIView.library.ShowModal<ExceptionPanel>("ExceptionPanel").SetMessage("TM:PE has not been updated yet", $"Traffic Manager: President Edition detected that you are running a newer game version ({BuildConfig.applicationVersion}) than TM:PE has been built for ({BuildConfig.VersionToString(TrafficManagerMod.GameVersion, false)}). Please be aware that TM:PE has not been updated for the newest game version yet and thus it is very likely it will not work as expected.", false);
1168-
} else {
1172+
} else if (isModNewer) {
11691173
UIView.library.ShowModal<ExceptionPanel>("ExceptionPanel").SetMessage("Your game should be updated", $"Traffic Manager: President Edition has been built for game version {BuildConfig.VersionToString(TrafficManagerMod.GameVersion, false)}. You are running game version {BuildConfig.applicationVersion}. Some features of TM:PE will not work with older game versions. Please let Steam update your game.", false);
11701174
}
11711175
}

TLM/TLM/TrafficManagerMod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace TrafficManager {
66
public class TrafficManagerMod : IUserMod {
77

8-
public static readonly string Version = "1.7.14";
8+
public static readonly string Version = "1.7.15";
99

1010
public static readonly uint GameVersion = 155575056u;
1111
public static readonly uint GameVersionA = 1u;

TLM/TLM/UI/SubTool.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,15 @@ public virtual void ShowGUIOverlay(bool viewOnly) { }
5858
public virtual bool IsCursorInPanel() {
5959
return false;
6060
}
61+
62+
protected void DragWindow(ref Rect window) {
63+
window.x = Mathf.Clamp(window.x, 0, Screen.width - window.width);
64+
window.y = Mathf.Clamp(window.y, 0, Screen.height - window.height);
65+
66+
bool primaryMouseDown = Input.GetMouseButton(0);
67+
if (primaryMouseDown) {
68+
GUI.DragWindow();
69+
}
70+
}
6171
}
6272
}

TLM/TLM/UI/SubTools/SpeedLimitsTool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private void _guiSpeedLimitsWindow(int num) {
146146
}
147147

148148
GUILayout.EndHorizontal();
149-
GUI.DragWindow();
149+
DragWindow(ref windowRect);
150150
}
151151

152152
private bool drawSpeedLimitHandles(ushort segmentId, bool viewOnly, ref Vector3 camPos) {

TLM/TLM/UI/SubTools/TimedTrafficLightsTool.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ private void _guiTimedControlPanel(int num) {
248248
if (GUILayout.Button(Translation.GetString("Cancel"))) {
249249
TrafficManagerTool.SetToolMode(ToolMode.TimedLightsShowLights);
250250
} else {
251-
GUI.DragWindow();
251+
DragWindow(ref _windowRect);
252252
return;
253253
}
254254
}
@@ -259,7 +259,7 @@ private void _guiTimedControlPanel(int num) {
259259
if (nodeSimulation == null || timedNodeMain == null) {
260260
TrafficManagerTool.SetToolMode(ToolMode.TimedLightsSelectNode);
261261
//Log._Debug("nodesim or timednodemain is null");
262-
GUI.DragWindow();
262+
DragWindow(ref _windowRect);
263263
return;
264264
}
265265

@@ -531,7 +531,7 @@ private void _guiTimedControlPanel(int num) {
531531
}
532532

533533
if (_timedEditStep >= 0) {
534-
GUI.DragWindow();
534+
DragWindow(ref _windowRect);
535535
return;
536536
}
537537

@@ -555,7 +555,7 @@ private void _guiTimedControlPanel(int num) {
555555
TrafficManagerTool.SetToolMode(ToolMode.None);
556556
}
557557

558-
GUI.DragWindow();
558+
DragWindow(ref _windowRect);
559559
return;
560560
}
561561

@@ -681,7 +681,7 @@ private void _guiTimedTrafficLightsNodeWindow(int num) {
681681
TrafficManagerTool.SetToolMode(ToolMode.TimedLightsShowLights);
682682
}
683683

684-
GUI.DragWindow();
684+
DragWindow(ref _windowRect2);
685685
}
686686

687687
private string getWaitFlowBalanceInfo() {

TLM/TLM/UI/SubTools/VehicleRestrictionsTool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ private void _guiVehicleRestrictionsWindow(int num) {
195195
RefreshCurrentRestrictedSegmentIds();
196196
}
197197

198-
GUI.DragWindow();
198+
DragWindow(ref windowRect);
199199
}
200200

201201
private void ApplyRestrictionsToAllSegments(int? sortedLaneIndex=null) {

TLM/TLM/UI/TrafficManagerTool.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ protected override void OnToolUpdate() {
236236
}
237237

238238
protected override void OnToolGUI(Event e) {
239-
//Log._Debug($"OnToolGUI");
240-
241239
try {
242240
if (!Input.GetMouseButtonDown(0)) {
243241
mouseClickProcessed = false;

0 commit comments

Comments
 (0)