diff --git a/artifacts/mods/gl_partycontrol.int b/artifacts/mods/gl_partycontrol.int index 3d56e1b9..a45c5279 100644 Binary files a/artifacts/mods/gl_partycontrol.int and b/artifacts/mods/gl_partycontrol.int differ diff --git a/artifacts/mods/gl_partycontrol.ssl b/artifacts/mods/gl_partycontrol.ssl index 8bf38d85..c1145ec3 100644 --- a/artifacts/mods/gl_partycontrol.ssl +++ b/artifacts/mods/gl_partycontrol.ssl @@ -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; diff --git a/sfall/Modules/Karma.cpp b/sfall/Modules/Karma.cpp index 2dcbc874..183cf3e7 100644 --- a/sfall/Modules/Karma.cpp +++ b/sfall/Modules/Karma.cpp @@ -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); diff --git a/sfall/Modules/Premade.cpp b/sfall/Modules/Premade.cpp index 2b7f9525..2cd3df1d 100644 --- a/sfall/Modules/Premade.cpp +++ b/sfall/Modules/Premade.cpp @@ -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++) { diff --git a/sfall/Modules/Reputations.cpp b/sfall/Modules/Reputations.cpp index 4fe3e553..05e02fdb 100644 --- a/sfall/Modules/Reputations.cpp +++ b/sfall/Modules/Reputations.cpp @@ -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 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());