CitiesSkylinesMods / TMPE

Cities: Skylines Traffic Manager: President Edition
https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252
MIT License
574 stars 85 forks source link

use harmony prepare instead of manual patch #1457

Closed kianzarrin closed 2 years ago

kianzarrin commented 2 years ago

Review hint: I have not added any new line of code here. I have only moved/modified several lines. But mostly I have deleted lines.

@sway2020 Sorry to change your code but I think: 1- there is no need to use manual patch when we can just use harmony prepare. This way it patches are more consistent/self-contained and have less lines of code. 2- there is no need to use DeclaredMethod<TargetDelegate>() if the target method is not overloaded. A simple Type.GetMethod() would do.

latest test build: https://ci.appveyor.com/api/projects/krzychu124/tmpe/artifacts/TMPE.zip?branch=prepare-patch

kianzarrin commented 2 years ago

Test: I loaded a new city and there was no error. I don't have a city to test if this works though.

kianzarrin commented 2 years ago

@chameleon-tbn Can you please test if this works with the mod?

sway2020 commented 2 years ago

@kianzarrin no need to say sorry! I am far away from my gaming PC so I can't run the game and test this