mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 15:41:13 -04: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();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) != player.getClass().getNpcStats(player).getFactionRanks().end())
|
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;
|
return;
|
||||||
|
|
||||||
std::map<std::string, int>& ranks = ptr.getClass().getNpcStats(ptr).getFactionRanks ();
|
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;
|
return;
|
||||||
|
|
||||||
std::map<std::string, int>& ranks = ptr.getClass().getNpcStats(ptr).getFactionRanks ();
|
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…
x
Reference in New Issue
Block a user