Skip to content

Commit

Permalink
Merge branch '1.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorPhilipp committed May 18, 2017
2 parents dc99ae8 + 914df4a commit 89bf334
Show file tree
Hide file tree
Showing 208 changed files with 18,482 additions and 6,774 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ A work-in-progress modification for **Cities: Skylines** to add additional traff
User manual: http://www.viathinksoft.de/tmpe

# Changelog
1.9.0, 04/09/2017
- Updated for game version 1.7.0-f5
- New feature: Parking restrictions
- New feature: Speed limits can be set up for individual lanes with the Control key
- New feature: Added timed traffic light and speed limit support for monorails
- New feature: Copy & paste for individual timed traffic lights
- New feature: Rotate individual timed traffic lights
- New feature: Lane customizations may come into effect instantaneously
- Unified traffic light toggling feature with game code
- Performance improvements
- Reworked the way that traffic measurements are performed
- Advanced Vehicle AI: Algorithm updated, performance improved - Possible routing decisions are now being precalculated
- Path-finding cost multiplicator for vehicle restrictions is now configurable in TMPE_GlobalConfig.xml
- UI: More compact, movable main menu UI
- Added support for custom languages
- Updated translations: German, Polish, Russian, Portuguese, Traditional Chinese
- Major code refactorings
- AI: Tuned parameters
- New option: Main button position can be locked
- New option: Main menu position can be locked
- New option: Added language selection in options dialog
- New option: Customization of lane arrows, lane connections and vehicle restrictions can now come into effect instantaneously
- Bugfix: Cars sometimes get stuck forever when the Advanced Parking AI is activated (thanks to @cmfcmf for reporting this issue)
- Bugfix: Busses do not perform u-turns even if the transport line show u-turns (thanks to @dymanoid for reporting this issue)
- Bugfix: Timed traffic lights do not work as expected on single-direction train tracks (thanks to @DaEgi01 for reporting this issue)
- Bugfix: Vehicle restriction and speed limit signs overlay is displayed on the wrong side of inverted road segments
- Bugfix: Influx statistics value is zero (thanks to @hjo for reporting this issue)

1.8.16, 03/20/2017
- Lane connections can now also be removed by pressing the backspace key
- Improved lane selection for busses if the option "Busses may ignore lane arrows" is activated
Expand Down
60 changes: 60 additions & 0 deletions TLM/CSUtil.Commons/CSUtil.Commons.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D3ADE06E-F493-4819-865A-3BB44FEEDF01}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSUtil.Commons</RootNamespace>
<AssemblyName>CSUtil.Commons</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>D:\Games\Steam\steamapps\common\Cities_Skylines\Cities_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="EnumUtil.cs" />
<Compile Include="Log.cs" />
<Compile Include="LogicUtil.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ToStringExt.cs" />
<Compile Include="VectorUtil.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
12 changes: 12 additions & 0 deletions TLM/CSUtil.Commons/EnumUtil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSUtil.Commons {
public static class EnumUtil {
public static IEnumerable<T> GetValues<T>() {
return Enum.GetValues(typeof(T)).Cast<T>();
}
}
}
21 changes: 2 additions & 19 deletions TLM/TLM/Log.cs → TLM/CSUtil.Commons/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading;
using UnityEngine;

namespace TrafficManager {
namespace CSUtil.Commons {

public static class Log {
private enum LogLevel {
Expand All @@ -17,11 +17,8 @@ private enum LogLevel {

private static object logLock = new object();

const string Prefix = "TrafficLightManager: ";

private static string logFilename = Path.Combine(Application.dataPath, "TMPE.log");
private static string logFilename = Path.Combine(Application.dataPath, "TMPE.log"); // TODO refactor log filename to configuration
private static Stopwatch sw = Stopwatch.StartNew();
private static bool logToConsole = false;
private static bool logFileAccessible = true;


Expand All @@ -42,8 +39,6 @@ public static void _Debug(string s) {

try {
Monitor.Enter(logLock);
if (logToConsole)
UnityEngine.Debug.Log(Prefix + s);
LogToFile(s, LogLevel.Debug);
} catch (Exception) {

Expand All @@ -58,10 +53,6 @@ public static void Info(string s) {
}

try {
#if DEBUG
if (logToConsole)
UnityEngine.Debug.Log(Prefix + s);
#endif
Monitor.Enter(logLock);
LogToFile(s, LogLevel.Info);
} catch (Exception) {
Expand All @@ -77,10 +68,6 @@ public static void Error(string s) {
}

try {
#if DEBUG
if (logToConsole)
UnityEngine.Debug.LogError(Prefix + s + " " + (new System.Diagnostics.StackTrace()).ToString());
#endif
Monitor.Enter(logLock);
LogToFile(s, LogLevel.Error);
} catch (Exception) {
Expand All @@ -96,10 +83,6 @@ public static void Warning(string s) {
}

try {
#if DEBUG
if (logToConsole)
UnityEngine.Debug.LogWarning(Prefix + s + ": " + (new System.Diagnostics.StackTrace()).ToString());
#endif
Monitor.Enter(logLock);
LogToFile(s, LogLevel.Warning);
} catch (Exception) {
Expand Down
17 changes: 17 additions & 0 deletions TLM/CSUtil.Commons/LogicUtil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSUtil.Commons {
public static class LogicUtil {
public static bool CheckFlags(uint flags, uint flagMask, uint? expectedResult=null) {
uint res = flags & flagMask;
if (expectedResult == null) {
return res != 0;
} else {
return res == expectedResult;
}
}
}
}
36 changes: 36 additions & 0 deletions TLM/CSUtil.Commons/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Util")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Util")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d3ade06e-f493-4819-865a-3bb44feedf01")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
25 changes: 25 additions & 0 deletions TLM/CSUtil.Commons/ToStringExt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSUtil.Commons {
public static class ToStringExt {
public static string DictionaryToString<K, V>(this IDictionary<K, V> element) {
return string.Join(", ", element.Keys.Select(x => $"{ToString(x)}={ToString(element[x])}").ToArray());
}

public static string CollectionToString<T>(this ICollection<T> elements) {
return string.Join(", ", elements.Select(x => ToString(x)).ToArray());
}

public static string ArrayToString<T>(this T[] elements) {
return string.Join(", ", elements.Select(x => ToString(x)).ToArray());
}

public static string ToString(object obj) {
return obj == null ? "<null>" : obj.ToString();
}
}
}
20 changes: 20 additions & 0 deletions TLM/CSUtil.Commons/VectorUtil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace CSUtil.Commons {
public static class VectorUtil {
public static void ClampPosToScreen(ref Vector3 pos) {
if (pos.x < 0)
pos.x = 0;
if (pos.y < 0)
pos.y = 0;
if (pos.x >= Screen.currentResolution.width)
pos.x = Screen.currentResolution.width - 1;
if (pos.y >= Screen.currentResolution.height)
pos.y = Screen.currentResolution.height - 1;
}
}
}
64 changes: 64 additions & 0 deletions TLM/CSUtil.Redirection/CSUtil.Redirection.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7DCC08EF-DC85-47A4-BD6F-79FC52C7EF13}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSUtil.Redirection</RootNamespace>
<AssemblyName>CSUtil.Redirection</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RedirectionHelper.cs" />
<Compile Include="Redirector.cs" />
<Compile Include="MethodInfoExt.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CSUtil.Commons\CSUtil.Commons.csproj">
<Project>{D3ADE06E-F493-4819-865A-3BB44FEEDF01}</Project>
<Name>CSUtil.Commons</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
34 changes: 34 additions & 0 deletions TLM/CSUtil.Redirection/MethodInfoExt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Reflection;

namespace CSUtil.Redirection {
public static class MethodInfoExt
{
internal static Redirector.MethodRedirection RedirectTo(this MethodInfo originalMethod, MethodInfo newMethod, Assembly redirectionSource)
{
return new Redirector.MethodRedirection(originalMethod, newMethod, redirectionSource);
}

public static bool IsCompatibleWith(this MethodInfo thisMethod, MethodInfo otherMethod)
{
if (thisMethod.ReturnType != otherMethod.ReturnType)
return false;

ParameterInfo[] thisParameters = thisMethod.GetParameters();
ParameterInfo[] otherParameters = otherMethod.GetParameters();

if (thisParameters.Length != otherParameters.Length)
return false;

for (int i = 0; i < thisParameters.Length; i++)
{
if (!otherParameters[i].ParameterType.IsAssignableFrom(thisParameters[i].ParameterType))
{
return false;
}
}

return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=_005FExtensions/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Loading

0 comments on commit 89bf334

Please sign in to comment.