Closed mabako closed 9 years ago
Hi, what exactly do you mean by they do not work? Does it crash the game? Or does the game stop upgrading buildings? Have you tried adding logging to see whether the patched method is called at all?
Placing new zones or removing existing zones has no effect, so you can unzone your whole city and all buildings persist. Likewise, zoned areas without buildings will never spawn buildings.
But your patch code is called?
If I add Unity's Application.Quit()
as the first line of either function, it's quitting Cities: Skylines, so I'm fairly sure it calls my code.
Good, then it should not be a problem with the patching. I unfortunately cannot help you with problems concerning the game logic.
Is there perhaps any difference in how C# calls struct methods? Both ZoneBlock and Building seem to be structs.
None that I know of. If the detour is called and its arguments are sensible, then I do not see how this could be related to the redirection. There are all sorts of things that can go wrong when patching in your custom code, but if the patching fails, your game will crash in 99.9% of the cases. If it was related to structs, then all the other methods that you are patching within that struct should show similar errors. I do not have the time to go over the whole of your code and check that you do not mess with the game data in bad ways, but I suspect that the error is to be found there.
Fixed it by replacing the methods which called said struct methods, instead of replacing the struct methods directly. Not sure that's how it should be, but hey ho.
Hey!
I've been using this for a while and it's been mostly just been great.
However, the following two methods I've tried patching (currently if false'd), and when I tried enabling them (albeit they're copied out from dotPeek 1:1) they do not work:
https://github.com/mabako/cities-skylines-unlimiter/blob/master/Zones/FakeZoneBlock.cs#L200 https://github.com/mabako/cities-skylines-unlimiter/blob/master/Zones/FakeBuilding.cs#L14
Do you have any idea why this is? Any help would be greatly appreciated.