FreeOrion

Forums for the FreeOrion project
It is currently Wed May 22, 2013 2:55 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Rework effects code to preserve ordering
PostPosted: Sun Nov 20, 2011 12:31 pm 
Offline
Space Floater

Joined: Sun Nov 06, 2011 11:04 am
Posts: 34
As I was playing around with effects it came up that the ordering was not always as expected, which is species first, specials, techs, buildings and then ships (as they are loaded in Universe::GetEffectsAndTargets).

The cause of this was due to them being stored as a map, however, they are never accessed by key, only iterated over.

When it came to Universe::ExecuteEffects there was no guarantee that they would be executed in the order they were loaded.

This patch is a simple refactoring from being a map to a vector of pairs.

Please review.

Edit:
Not all the variables were renamed consistently to remove the _map suffix, this has been fixed in the patch now.
Also, some comments were referring to a variable name from some other previous revision, with inconsistencies between the header and the code files with comments and variable names. In other words, grooming/maintenance.


Attachments:
vectorize-targets-causes.patch [11.56 KiB]
Downloaded 11 times
Top
 Profile  
 
 Post subject: Re: Rework effects code to preserve ordering
PostPosted: Thu Nov 24, 2011 8:34 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
Could you state that you release these changes under the GPL 2.0 or later? Otherwise, we can't use them...

It would also be good to note in your other post about resource / effects changes that you release those under the GPL 2.0 or later and the CC-BY-SA 3.0 license.


Top
 Profile  
 
 Post subject: Re: Rework effects code to preserve ordering
PostPosted: Sun Nov 27, 2011 6:35 am 
Offline
Space Floater

Joined: Sun Nov 06, 2011 11:04 am
Posts: 34
Yep, sorry my bad, changes are under the GPL v2.0 (or later).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group