Make Simutrans speak your language.

Assertion failed when closing network game

Started by Dwachs, September 18, 2022, 12:53:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


CLosing the window of a running network game throws this:
sim-gitsvn: src/simutrans/utils/ uint32 simrand(uint32): Assertion `(random_origin&INTERACTIVE_RANDOM) == 0' failed.

Thread 1 "sim-gitsvn" received signal SIGABRT, Aborted.
0x00007ffff6229cdb in raise () from /lib64/
(gdb) bt
#0  0x00007ffff6229cdb in raise () from /lib64/
#1  0x00007ffff622b375 in abort () from /lib64/
#2  0x00007ffff6221cda in __assert_fail_base () from /lib64/
#3  0x00007ffff6221d62 in __assert_fail () from /lib64/
#4  0x000000000074d970 in simrand (max=<optimized out>) at src/simutrans/utils/
#5  0x0000000000704076 in haltestelle_t::fetch_goods (this=<optimized out>, load=..., good_category=<optimized out>,
    requested_amount=3, destination_halts=...) at src/simutrans/
#6  0x00000000007647b1 in vehicle_t::load_cargo (this=this@entry=0x63db710, halt=..., halt@entry=...,
    destination_halts=..., max_amount=<optimized out>) at src/simutrans/vehicle/
#7  0x00000000006e85c9 in convoi_t::hat_gehalten (this=0x63db130, halt=...) at src/simutrans/
#8  0x00000000006ff00e in haltestelle_t::request_loading (this=0x4a1b9a0, cnv=...) at src/simutrans/
#9  0x00000000006e34f3 in convoi_t::laden (this=this@entry=0x63db130) at src/simutrans/
#10 0x00000000006ed799 in convoi_t::step (this=0x63db130) at src/simutrans/
#11 0x0000000000792af8 in karte_t::step (this=this@entry=0x4a5c330) at src/simutrans/world/
#12 0x00000000007938a6 in karte_t::interactive (this=this@entry=0x4a5c330, quit_month=quit_month@entry=2147483647)
    at src/simutrans/world/
#13 0x0000000000713e97 in simu_main (argc=argc@entry=9, argv=argv@entry=0x7fffffffdb88)
    at src/simutrans/
#14 0x00000000007171a9 in sysmain (argc=9, argv=0x7fffffffdb88) at src/simutrans/sys/
#15 0x00000000007dac54 in main (argc=<optimized out>, argv=<optimized out>) at src/simutrans/sys/

Parsley, sage, rosemary, and maggikraut.


same reason as in,21928

INT_CHECK is called from somewhere, the quit-event is processed, which disables network mode. This prevents the random-mode to be reset in siminteraction, further down the assertion is triggered.

Honestly, I think calling check_events in sync_step is a bad idea.
Parsley, sage, rosemary, and maggikraut.


Processing the events more frequently was necessary due to the broken way SDL handles finger events. Touching the screen fires between 50-100 identical event events (especially considering also the  useless floating point precision of my finger with at best 10 dpi compared to the integer values of an 8000 dpi mouse ... ) In the step, then often only once every second events were processed, making Simutrans unuseable.

So moving back is not really an option on weak devices like ARM.

EDIT: The quit event does call the quit tool in r10754, which is not safegame save and thus only executed in a step().


The reason, why tool_quit was set to network-safe, was that quitting client will not send the quit command over network. Also in network games, no password should be needed to quit a game as client.

I did not test, but I suspect that with this change a clitting client will quit the server, too.

Edit: Tested. Closing the client sends a quit command to the server.
Parsley, sage, rosemary, and maggikraut.


I think we need another property for tools that prevents that they are send via network. This applies to quit, load/save functions.
Parsley, sage, rosemary, and maggikraut.


Setting the local flag for local only commands does the trick in r10758. Still need the proper tools for loading.


Thanks for looking into this. Sorry for bringing this up once more:

When closing the server window (with one client connected) still triggers the assertion for the server.
Parsley, sage, rosemary, and maggikraut.