Deck units no longer unique

This commit is contained in:
Jørgen Kvalsvik
2016-10-13 13:37:56 +02:00
parent 37c04328ca
commit bf057f157c
3 changed files with 38 additions and 41 deletions

View File

@@ -788,6 +788,18 @@ std::vector<std::string> Parser::getAllDeckNames () const {
void Parser::applyUnitsToDeck(Deck& deck) const {
/*
* If multiple unit systems are requested, metric is preferred over
* lab, and field over metric, for as long as we have no easy way of
* figuring out which was requested last.
*/
if( deck.hasKeyword( "LAB" ) )
deck.getActiveUnitSystem() = UnitSystem::newLAB();
if( deck.hasKeyword( "FIELD" ) )
deck.getActiveUnitSystem() = UnitSystem::newFIELD();
if( deck.hasKeyword( "METRIC" ) )
deck.getActiveUnitSystem() = UnitSystem::newMETRIC();
for( auto& deckKeyword : deck ) {
if( !isRecognizedKeyword( deckKeyword.name() ) ) continue;