How to check if a condition is ever used in the source code?

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

Moderator: Committer

Post Reply
Message
Author
User avatar
Oberlus
Cosmic Dragon
Posts: 5704
Joined: Mon Apr 10, 2017 4:25 pm

How to check if a condition is ever used in the source code?

#1 Post by Oberlus »

I had a doubt while translating this keys: DESC_EMPIRE_STOCKPILE_VALUE and DESC_EMPIRE_STOCKPILE_VALUE_NOT
Do they refer to Imperial Stockpile? It seems they don't, since they were already translated in the Spanish stringtable, way before Imperial Stockpile was introduced.

I searched the source code and they are present in universe/Conditions.cpp. That code is too complex for me to understand, it is about evaluating conditions.

The thing is now I think that condition is to evaluate stock of a given resource. For a moment I thought it could be removed, since there is not resource that can be stocked aside from PPs in the Imperial Stockpile. Then I though that maybe it is used to query stockpiled PPs, and that it indeed could be used to query stockpiled influence once it is added to the game.

But the last doubt that remains is if there is any way to check out if a condition is never used in current implementation (so that I can skip the translation of that particular key).

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: How to check if a condition is ever used in the source code?

#2 Post by Ophiuchus »

Oberlus wrote: Sat Apr 11, 2020 5:41 pm But the last doubt that remains is if there is any way to check out if a condition is never used in current implementation (so that I can skip the translation of that particular key).
Yes, identifying the corresponding condition and then grepping the focs files for it.

But I think that translating the key is actually less work than finding that out.

What could help is a prioritized list of keys for all languages, so translators could start from top to bottom.
I guess conditions would be on the secondary tier of priority.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

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

Re: How to check if a condition is ever used in the source code?

#3 Post by Geoff the Medio »

The EmpireStockpileValue condition checks how much stockpile an empire has of a resource. That could be industry or trade (soon to be replaced with influence).

To check if a condition is used, you'd just have to search all the FOCS files, as noted.

User avatar
LienRag
Cosmic Dragon
Posts: 2103
Joined: Fri May 17, 2019 5:03 pm

Re: How to check if a condition is ever used in the source code?

#4 Post by LienRag »

Ophiuchus wrote: Sun Apr 12, 2020 12:07 pm What could help is a prioritized list of keys for all languages, so translators could start from top to bottom.
I guess conditions would be on the secondary tier of priority.
Very good idea.
Any progress on it ?

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: How to check if a condition is ever used in the source code?

#5 Post by Ophiuchus »

LienRag wrote: Wed Apr 28, 2021 12:12 pm
Ophiuchus wrote: Sun Apr 12, 2020 12:07 pm What could help is a prioritized list of keys for all languages, so translators could start from top to bottom.
I guess conditions would be on the secondary tier of priority.
Very good idea.
Any progress on it ?
Nobody working on that I guess
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Post Reply