boformer / BuildingThemes

Mod for Cities:Skylines
http://steamcommunity.com/sharedfiles/filedetails/?id=466158459
MIT License
13 stars 11 forks source link

Better Detour Usage #48

Closed boformer closed 9 years ago

boformer commented 9 years ago

GetRandomBuildingInfo is called in 3 places:

We ran into trouble when we tried to detour PrivateBuildingAI.GetUpgradeInfo and PrivateBuildingAI.SimulationStep.

That's why we used a LevelUpExtension and other hacky methods to determine where the building is/will be located.

Luckily I found out how we can detour all of the 3 methods. It will make the code of this mod much clearer and maybe even improve performance:

We have to detour the AI methods for every subclass of PrivateBuildingAI. A very elegant way to do it is to use generics, as seen here.