News:

SimuTranslator
Make Simutrans speak your language.

Network compatibility query

Started by jamespetts, March 18, 2010, 10:16:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

I am trying to work on making the automatic convoy  replacer in Simutrans-Experimental network compatible. In former verseions of Experimental, the convoy replacer has used a vector of vehicles and a few bool flags in convoi_t object itself, but I am moving the system over to using a new class. replace_data_t, in order to save memory when the convoy replacing is not being used (storing just a single null pointer in that case rather than an empty vector and a large number of bool flags).

However, to make it network compatible, I have to pass more than a pointer from simwerkz.cc, since the pointers will, of course, point to different memory locations on different machines. How do I best propogate a new replace_data_t class amongst convoys from a GIUI window? I imagine that it would be something similar to the position in respect of schedules/lines - is that right? Also, to copy from one convoy to another, I have to use, I imagine, call_convoi_tool to pass the ID of the convoy from which the object needs to be copied to the convoy to which the object needs to be copied;  how best to modifiy call_convoi_tool to take an additional parameter being an additional convoy  ID? I tried last night, and it didn't work properly?

I should be very grateful for any assistance with the tricky network compatibility complexities!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

Why not use a procedure similar to the transferring of the schedule's: printf/scanf everything to/from the extra parameter.
Parsley, sage, rosemary, and maggikraut.

jamespetts

That's what I wad thinking, but I haven't delved into that code in detail - how does it work, in outline? How best to implement it?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

Jsut look in
bool wkz_change_convoi_t::init( karte_t *welt, spieler_t *sp )
case 'g'.

There fpl->sscanf_schedule( p ); appears.

The printf is somewhere else. You should figure this out youself ;)
Parsley, sage, rosemary, and maggikraut.