Fixed inherited perks in gl_partycontrol

This commit is contained in:
NovaRain
2019-10-15 22:17:08 +08:00
parent d762f57cbc
commit 9fab4b32ee
5 changed files with 16 additions and 7 deletions
Binary file not shown.
+11 -2
View File
@@ -36,7 +36,7 @@ procedure combatturn_handler begin
variable
status := get_sfall_arg,
critter := get_sfall_arg,
pid, perkID, level;
pid, perkID, level, i;
//display_msg("Combat Turn: " + status + ", by " + obj_name(critter) + ", arg3: " + get_sfall_arg);
if npcControl then begin
@@ -55,7 +55,9 @@ procedure combatturn_handler begin
foreach (perkID in perksList) begin
level := has_trait(TRAIT_PERK, real_dude_obj, perkID);
if (level) then begin
critter_add_trait(critter, TRAIT_PERK, perkID, level);
for (i := 0; i < level; i++) begin
critter_add_trait(critter, TRAIT_PERK, perkID, 1);
end
end
end
intface_redraw;
@@ -77,6 +79,13 @@ procedure combatturn_handler begin
end
end
end else if inControl then begin
// remove perks before switching control (only work with 4.1.8+)
foreach (perkID in perksList) begin
level := has_trait(TRAIT_PERK, real_dude_obj, perkID);
if (level) then begin
critter_rm_trait(critter, TRAIT_PERK, perkID, level);
end
end
if isShowTag then begin
hide_iface_tag(displayName);
isShowTag := false;
+1 -1
View File
@@ -90,7 +90,7 @@ void ApplyDisplayKarmaChangesPatch() {
void ApplyKarmaFRMsPatch() {
auto karmaFrmList = GetConfigList("Misc", "KarmaFRMs", "", 512);
if (karmaFrmList.size() > 0) {
if (!karmaFrmList.empty()) {
dlog("Applying karma FRM patch.", DL_INIT);
auto karmaPointsList = GetConfigList("Misc", "KarmaPoints", "", 512);
+1 -1
View File
@@ -29,7 +29,7 @@ fo::PremadeChar* premade;
void Premade::init() {
auto premadePaths = GetConfigList("misc", "PremadePaths", "", 512);
auto premadeFids = GetConfigList("misc", "PremadeFIDs", "", 512);
if (premadePaths.size() > 0 && premadeFids.size() > 0) {
if (!premadePaths.empty() && !premadeFids.empty()) {
int count = min(premadePaths.size(), premadeFids.size());
premade = new fo::PremadeChar[count];
for (int i = 0; i < count; i++) {
+3 -3
View File
@@ -36,12 +36,12 @@ static CityRep* repList = nullptr;
void Reputations::init() {
auto cityRepList = GetConfigList("Misc", "CityRepsList", "", 512);
auto count = cityRepList.size();
size_t count = cityRepList.size();
if (count > 0) {
repList = new CityRep[cityRepList.size()];
repList = new CityRep[count];
std::vector<std::string> pair;
pair.reserve(2);
for (size_t i = 0; i < cityRepList.size(); i++) {
for (size_t i = 0; i < count; i++) {
pair.clear();
split(cityRepList[i], ':', std::back_inserter(pair), 2);
repList[i].cityID = atoi(pair[0].c_str());