OnGlobalTypesInIt-event firing variable number of times.

Bug reports for the different beta versions of transcendence.
Post Reply
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

I got an unexpected result with the OnGlobalTypesInIt-event in relation with TypCreate.

In the below code snipped we see a virtual station that uses TypCreate to dynamically overwrite a system map:

Code: Select all

 1: <StationType UNID="&vtAdventureStation;"
 2:         name=               "(virtual settings station)"
 3:         virtual=            "true"
 4:         >
 5:     
 6:     <Events>
 7:         <OnGlobalTypesInIt>
 8:             (if (unvGetExtensionData 'local 'EngineReady)
 9:                 (block Nil
10:                     (dbgLog "Beyond the Mainline: Engine ready...")
11:                     
12:                     (if (not (unvGetExtensionData 'local 'TopologyCreated))
13:                         (block Nil
14:                             (dbgLog "Beyond the Mainline: Generating topology")
15:                             
16:                             (TypCreate &smHumanSpace; (TypGetStaticData &vtAdventureStation; 'smKnownSpace))
17:                         ;   (TypCreate &smKnownSpace; (TypGetStaticData &vtAdventureStation; 'smKnownSpace))
18:                             
19:                             (unvSetExtensionData 'local 'TopologyCreated True)
20:                             )
21:                         
22:                         (dbgLog "Beyond the Mainline: Topology already generated")
23:                         )
24:                     )
25:                 
26:                 (block Nil
27:                     (dbgLog "Beyond the Mainline: Flagging engine as ready")
28:                     (unvSetExtensionData 'local 'EngineReady True)
29:                     )
30:                 )
31:         </OnGlobalTypesInIt>
32:     </Events>
33:     
34:     <!-- (...) some static data (...) -->
35: 
36: </StationType>
If I run the above code as-is, the results are as expected (lines from debug.log):

Code: Select all

05/10/2014 23:03:29	Beyond the Mainline: Flagging engine as ready
05/10/2014 23:03:30	Loading user collection.
05/10/2014 23:03:31	Loading news.
05/10/2014 23:03:41	Initializing adventure: Transcendence.tdb
05/10/2014 23:03:41	Beyond the Mainline: Engine ready...
05/10/2014 23:03:41	Beyond the Mainline: Generating topology
05/10/2014 23:03:42	Created new game
05/10/2014 23:03:42	Starting new game.
However, if I run line 17 instead of line 16, I get:

Code: Select all

05/10/2014 23:04:52	Beyond the Mainline: Flagging engine as ready
05/10/2014 23:04:54	Loading user collection.
05/10/2014 23:04:55	Loading news.
05/10/2014 23:04:58	Initializing adventure: Transcendence.tdb
05/10/2014 23:04:58	Beyond the Mainline: Engine ready...
05/10/2014 23:04:58	Beyond the Mainline: Generating topology
05/10/2014 23:04:58	Beyond the Mainline: Engine ready...
05/10/2014 23:04:58	Beyond the Mainline: Topology already generated
05/10/2014 23:05:00	Created new game
05/10/2014 23:05:00	Starting new game.
In other words: If I (TypCreate &smKnownSpace; instead of (TypCreate &smHumanSpace; ...), the OnGlobalTypesInIt-event fires twice instead of once when creating a new game!

I don't understand why this would happen, I can only guess it is a bug.

@George, am I doing something wrong here? is there some different treatment between core and extension UNIDs with regard to overwriting them with typeCreate?

Cheers,
Brigand
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

OnGlobalTypesInit fires whenever you create a new universe.

But the intro screen counts as a "universe", so if you exit a game and go back to the intro screen, you might get called twice.

Would that explain what you're seeing?
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

Unfortunately not.

When the game starts (double click the icon, whatever), the OnGlobalTypesInIt-event fires. This works as expected.

Then, I click on 'New Game'.
In case A (line 16 is active, line 17 is commented out) the OnGlobalTypesInIt-event fire once more.
In case B (line 16 is commentd out, line 17 is active) the OnGlobalTypesInIt-event fire twice more.

So, depending on which line in my code example is active, I get different results from the engine with regard to events being triggered, while I perform the exact same action (=starting a new game).

I hope this explains it better,

regards,
Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
Post Reply