mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-18 13:12:50 +00:00
Some additional wrapping for faction rank instructions
This commit is contained in:
parent
7f26843dc3
commit
2451eead8a
@ -623,7 +623,8 @@ namespace MWScript
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) != player.getClass().getNpcStats(player).getFactionRanks().end())
|
||||
{
|
||||
player.getClass().getNpcStats(player).getFactionRanks()[factionID] = player.getClass().getNpcStats(player).getFactionRanks()[factionID] -1;
|
||||
player.getClass().getNpcStats(player).getFactionRanks()[factionID] =
|
||||
std::max(0, player.getClass().getNpcStats(player).getFactionRanks()[factionID]-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1031,7 +1032,7 @@ namespace MWScript
|
||||
return;
|
||||
|
||||
std::map<std::string, int>& ranks = ptr.getClass().getNpcStats(ptr).getFactionRanks ();
|
||||
ranks[factionID] = ranks[factionID]+1;
|
||||
ranks[factionID] = std::min(9, ranks[factionID]+1);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1058,7 +1059,7 @@ namespace MWScript
|
||||
return;
|
||||
|
||||
std::map<std::string, int>& ranks = ptr.getClass().getNpcStats(ptr).getFactionRanks ();
|
||||
ranks[factionID] = ranks[factionID]-1;
|
||||
ranks[factionID] = std::max(0, ranks[factionID]-1);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user