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, Mart, and all.

> I only read your patch, I didn't actually test it (will do later), but I think 
> there is at least one problem with it.
> 
> It is about the function linuxModLoad. What should it do? It should load the 
> module and return if it was succesfull. So, at some point this function is 
> called. Then the caller only knows if loading the module was succesfull or 
> not. So it must obtain the data of the loaded module on another way. This is 
> done by an assumption: modules are always placed in front of the list. So, by 
> dereferencing the module list, it gets the module which has just been loaded.
> 
> But as far as I can see, you break that assumption. If a module is already 
> loaded, nothing happends. 

You are right.

> Because raceinit.cpp in raceengineclient use that 
> assumption, it will assign the wrong robot to a car, and proberbly causes 
> crashes in some cases.

I had not noticed this assumption, and I have not checked robot/car associations
: so I must go on working !

> Of course, there also is an (easy) solution: if a module is already loaded, 
> move it to the front.

Good solution !

> It is possible that one library can be loaded by several sopath's. Think about 
> a relative path and a absolute path. I don't see any circumstanses where this 
> could happen in Torcs. And even if it happends, it will work the same way as 
> it works now. I think documenting this assumption is a good idea.

Your are right : I check if a module has already been loaded only by comparing
the stored sopath. And nothing guarantees that the stored sopath is the absolute
normalized user-expanded ... path of the library. So the check is not perfect !
So, 2 solutions : document or fix !

> I see that you check if calloc was succesfull. It means that Torcs doesn't 
> directly crash if the computer is out of memory. Is this a good thing?

I've always been thinking that a brutal crash whithout any explanation
is NEVER a solution ... So in this case, I printf a message on the console,
and return to the caller ... But you may argue that :
- the message is only seeable in debug mode and if torcs is run
   in a console
- Torcs will soon crash because other m/callocs are not checked ...
But isn't it a (very small) improvement, yet ?

Thank for your help, Mart !

Cheers,

Jean-Philippe.



-------------------------------------------------------------------------
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
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.