✅Crash when changing bridge type
- DreamBuilder
- Inhabitant of a Megacity
- Reactions:
- Posts: 203
- Joined: 18 Jan 2017, 14:36
- Location: Cemetery but not dead
- Plugins: Showcase Store
- Version: Beta
-
Platform
✅Crash when changing bridge type
My game instantly crashes when i change bridge type on highways especially long ones
I like pineapple pizza but I don't like pineapple on it
- Brody Craft
- Inhabitant of a Infinity
- Reactions:
- Posts: 8034
- Joined: 24 Jan 2017, 11:15
- Location: SE Asia
- Plugins: Showcase Store
- Version: Beta
-
Platform
Re: Crash when changing bridge type
that happens when theres too much things to process, also happens on weak devices
When you get to be called a Board Index because you are too good.>:3
- Lobby
- Developer
- Reactions:
- Posts: 3705
- Joined: 26 Oct 2008, 12:34
- Plugins: Showcase Store
- Version: Beta
-
Platform
Re: Crash when changing bridge type
I was lazy when I implemented it. The code looks a bit like
The problem here is that the function calls itself. For each function call within a function memory on the so called stack is needed. As stack size is most often not huge you should avoid too many function calls in other functions
Code: Select all
void setBridge(Road r, Bridge b) {
r.bridge = b;
for (Road _r neighbor of r with _r.bridge != b) {
setBridge(_r, b);
}
}
=^._.^= ∫
- Lobby
- Developer
- Reactions:
- Posts: 3705
- Joined: 26 Oct 2008, 12:34
- Plugins: Showcase Store
- Version: Beta
-
Platform
Re: Crash when changing bridge type
Will be fixed in the next update.
The solution to such recursion problems is to use a queue of roads from which you remove roads until it's empty. For every road you might have to add new ones to the queue (neighbor roads), so you have to ensure that you don't add already processed roads again. Otherwise it will take a long long time:
∞
The solution to such recursion problems is to use a queue of roads from which you remove roads until it's empty. For every road you might have to add new ones to the queue (neighbor roads), so you have to ensure that you don't add already processed roads again. Otherwise it will take a long long time:
∞
=^._.^= ∫