Fleet indicator for field effects

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Fleet indicator for field effects

#1 Post by The Silent One »

I'd like to add an indicator to the fleet button that becomes visible if a fleet is being affected by a field (e. g. a molecular cloud), but I'm unsure how to do it optimally. Should I introduce a new FOCS command like "SetAffectedByField value = true", which sets a universe object variable? Or maybe "AddAffectedByFieldTag tag = "MOLECULAR_CLOUD"? Alternatively I could possibly check from the C++ code for the effects of different field types, but that seems very hardcoded and inflexible. Thoughts?
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Fleet indicator for field effects

#2 Post by Geoff the Medio »

Whatever you do, it shouldn't use a Field-specific feature, as the idea of tracking what objects are affected by effects from particular content or source objects isn't specific to fields.

Do you really want an indicator for fleets, rather than ships, though? Few things directly affect fleets.

Using "tags" for this purpose is awkward as a name, because "tags" already exist but work in a different way; they are not possible to manipulate on an object after its creation.

Specials would be closer to what you want, in that they can be added to universe objects with an effect, but they're also persistent after being added to an object unless removed with another effect, whereas you want something that is tracked only for the most recent turn / effects execution.

Stacking groups are also similar, but are only tracked during effect execution and not retained after that.

You could perhaps query the FieldType's effects' scope and activation conditions to determine what objects it affects. This would be tricky as there are multiple effects groups and it's not clear in C++ code which should be used for UI display purposes.

I've also pondered adding an extra condition to various bits of content, such as field types, specifically to test what objects a field object affects for UI display purposes. If specified, this would be used for what you want to do. Same for buildings or ships, likely.

Post Reply