Source Code Project Mantis - FSSCP
View Issue Details
0002920FSSCPPilot datapublic2013-09-19 02:412014-06-14 05:41
ReporterGoober5000 
Assigned Toniffiwan 
PriorityhighSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.7.1 
Target Version3.7.2Fixed in Version 
Summary0002920: Pilot file code can't handle localization for intel entries
DescriptionI made the same error when coding up tech-add-intel, but the problem created for pilot files is much more complicated.

The problem is that intel entry names are translatable strings, whereas normally names that serve as lookup keys aren't. This is because if you translate the key, obviously it's not going to be good anymore as a lookup entry.

Since the intel names are always going to be translated, the solution is to also translate the lookup keys so that what you look up is the same as what is in the table. The preloader for tech-add-intel-xstr does this. The pilot file code should handle this the same way.

...Actually, the pilot code may already do this. All it does is save keys that are visible in the tech db, right? So that means it saves translated keys. As long as the pilot doesn't switch languages, it may not be a problem.

What about adding in a safeguard to prevent the pilot from switching languages? :)
TagsNo tags attached.
related to 0002919resolved Goober5000 Tech-add-intel can't handle localization for intel entries 
Attached Files

Notes
(0015294)
niffiwan   
2013-09-26 21:57   
I'm thinking of:

a) storing the pilots language in the .plr
b) when leaving the start screen or the barracks; generate an error if the pilots language doesn't match the current FSO language, and don't let the player proceed

Changing the techroom intel entries to work like ships (i.e. change the lookup keys to an array/vector index) would probably be a fair bit of work. I may have a look just to see how much work anyway.
(0015748)
niffiwan   
2014-05-15 04:38   
This seems to do the job in my testing. A pilot created with the language set to German can no longer be selected in the initial selection screen. Nor will the barracks allow this pilot to be selected when exiting the barracks.

Review and comments welcome!

https://github.com/niffiwan/fs2open.github.com/commit/e0377cd7ec454ea7438f5b9819f090d01cc60380
(0015864)
Echelon9   
2014-06-14 03:36   
Have commented (to the extent I can) on the Github issue.
(0015867)
niffiwan   
2014-06-14 05:41   
Thanks to Echelon9, MageKing17 & Zacam for their reviews. Added commend explaining the reason for the PLR version bump.
(0015868)
niffiwan   
2014-06-14 05:41   
Fix committed to trunk@10817.

Issue History
2013-09-19 02:41Goober5000New Issue
2013-09-19 02:41Goober5000Statusnew => assigned
2013-09-19 02:41Goober5000Assigned To => niffiwan
2013-09-19 02:41Goober5000Relationship addedrelated to 0002919
2013-09-26 21:57niffiwanNote Added: 0015294
2014-05-15 04:38niffiwanNote Added: 0015748
2014-05-15 04:38niffiwanStatusassigned => code review
2014-06-14 03:36Echelon9Note Added: 0015864
2014-06-14 05:41niffiwanNote Added: 0015867
2014-06-14 05:41niffiwanChangeset attached => fs2open trunk r10817
2014-06-14 05:41niffiwanNote Added: 0015868
2014-06-14 05:41niffiwanStatuscode review => resolved
2014-06-14 05:41niffiwanResolutionopen => fixed