The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: jamespetts on April 26, 2010, 07:12:44 pm

Title: Further network compatibility query
Post by: jamespetts on April 26, 2010, 07:12:44 pm
If I want a particular method to be called whenever a player joins a network game, where should I put the instruction to call it?
Title: Re: Further network compatibility query
Post by: prissi on April 26, 2010, 08:25:40 pm
Depens if server or clientwise; but there is network_cmd.cc with nwc_join_t cl**** ...
Title: Re: Further network compatibility query
Post by: jamespetts on April 26, 2010, 10:15:16 pm
Suppose a new client joins the server - where are methods called then? The reason that I am asking is because, in Experimental, I am setting up a system to check which towns are connected to which other towns by road, and, because those values aren't saved or transmitted accross the network, they need to be recalculated (for all players) on loading or a new player joining.
Title: Re: Further network compatibility query
Post by: Dwachs on April 27, 2010, 05:02:29 am
... on loading or a new player joining.
After transmitting the game, it is loaded by the client the same way as a normal savegame. That said, it should be safe for you to put these calculations in the rdwr() methods.
Title: Re: Further network compatibility query
Post by: prissi on April 27, 2010, 07:43:21 am
All clients (and the server too) saves their game and loading it at the time another player joins, since also simutrans standrad has many stuff that happens during loading of games. You most likely do not have to change something.
Title: Re: Further network compatibility query
Post by: jamespetts on April 27, 2010, 09:15:01 am
Thank you very much :-)