Re: Breaking the 10-limit : Problems/Questions for Windows build

Annick et Jean-Philippe <[email protected]>
Newsgroups gmane.games.torcs.devel
Message-ID <[email protected]>
Hi, all.

This time, I've got it : this is the "no maximum number of interfaces for Torcs
modules" patch.

WARNING: This is only the first half of the patch (too big for Torcs-devel 
list); next half comes in the following message ...

It enable developper to write Torcs modules with any (positive) number of
interfaces ; as far as robots are concerned, it means any number of cars.

It is completely backward compatible with already written modules
(they can continue to have a maximum of 10 interfaces), as it does not change
nor the API nor the awaited behaviour of the module entry point
"int <module name>(tModInfo*)".
And even with robots that are written in other languages, as tModInfo structure
did not change.
As for the backward binary compatibility, I suppose it should be possible,
but I did not paid attention to the various modified DLL entries order.
May be there some little work on this side, if anyone need's it ...

If you want to write a module with more (or less) maximum number of interfaces,
you only have to add a new entry "int <module name>MaxNbItf()" in the module
code, and make that entry return the desired number.
Torcs TGF infrastructure uses that number to allocate the tModInfo array,
at module load time, taking a default 10 value when the new entry is not there.
The deallocation is also in charge of the TGF infrastructure.

I have not changed the published robots code in this patch (but see below, yet).
But I have "upgraded" all the other Torcs modules (ssggraph, track, telemetry,
simuv2 an simuv3), of course to save the huge amount of wasted memory, as these
module only have 1 interface ;-)

I have also upgraded the "human" module to enable any number of human drivers.

And also upgraded the driverconfig screen to make full use of the enhancement
(mainly added the vertical scrollbar for the driver scrolllist and a "new"
button to create a driver).
And also, even it was not absolutely necessary, I made the following improvements :
- added the "copy" button, to copy ANY driver settings (control settings and
calibration inluded),
- fixed the general OK/Cancel behaviour of the 4 screens driverconfig,
controlconfig, mousecoonfig and joystickconfig : now, when you cancel anywhere,
the modifications you made can't be saved in the preferences.xml file.

Also fixed some memory-leaks associated to modules interfaces management.

As an illustration, and also an example of how to use the new feature
in a robot code, you will also find a patch that adds an 11'th car
to the "bt" robot (I could not keep myself from choosing the Ford GT 40 Concept,
with its so gorgeous sound !).

Please, test it and tell me what you think !
Feel free to comment, propose more, ...

Cheers,

Jean-Philippe.

-- 
Annick MICHEL
Jean-Philippe MEURET
Place de l'Eglise
63260 Saint-Agoulin
Tél: 04 73 33 36 02

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

_______________________________________________
Torcs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/torcs-devel
noMaxModuleInterfaces.half1.patch.bz2 (application/x-bzip, 16.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.