Commit 711e657b2f3b16eed04ee7817ed327ee039d45ed
1 parent
b368c30b
Revert "funcional tactical value will not get cached"
This reverts commit 368aa7a4.
Showing
1 changed file
with
4 additions
and
9 deletions
... | ... | @@ -1551,12 +1551,11 @@ function _M:aiTalentTactics(t, aitarget, target_list, tactic, tg, wt_mod) |
1551 | 1551 | if log_detail > 2 then print("\t__cached weight for tactic:", tact, "vs", act.uid, act.name, "==", tid_cache[tact] and tid_cache[tact][act]) end |
1552 | 1552 | tgt_weight = nil |
1553 | 1553 | end |
1554 | - local have_functional_value = false | |
1554 | + | |
1555 | 1555 | if not tgt_weight then -- compute the tactic weight value for this target |
1556 | 1556 | local val = val |
1557 | 1557 | if type(val) == "function" then -- evaluate a function |
1558 | 1558 | if log_detail > 2 then print("\t resolving functional tactic value", val) end |
1559 | - have_functional_value = true | |
1560 | 1559 | val = val(self, t, act) or 0 |
1561 | 1560 | if log_detail > 2 then print("\t tactic value:", val) table.print(val, "\t\t") end |
1562 | 1561 | end |
... | ... | @@ -1649,13 +1648,9 @@ function _M:aiTalentTactics(t, aitarget, target_list, tactic, tg, wt_mod) |
1649 | 1648 | print(("\t***TACTICAL WEIGHT CACHE MATCHES: [%d]%s %s (%s) on [%d]%s{%s}: %s vs %s(cache)"):format(self.uid, self.name, t.id, tact, act.uid, act.name, msg, tgt_weight, cache_tgt_weight)) |
1650 | 1649 | end |
1651 | 1650 | end |
1652 | - if not have_functional_value then | |
1653 | - tid_cache[tact][act] = tgt_weight | |
1654 | - tid_cache[tact][act.uid] = act.aiDHash | |
1655 | - if log_detail > 3 then print("\t__updated cached weight for tactic:", tact, "vs", act.uid, act.name, "==", tid_cache[tact][act]) end | |
1656 | - else | |
1657 | - if log_detail > 3 then print("\tNot cached weight for tactic:", tact, "vs", act.uid, act.name, "==", tgt_weight) end | |
1658 | - end | |
1651 | + tid_cache[tact][act] = tgt_weight | |
1652 | + tid_cache[tact][act.uid] = act.aiDHash | |
1653 | + if log_detail > 3 then print("\t__updated cached weight for tactic:", tact, "vs", act.uid, act.name, "==", tid_cache[tact][act]) end | |
1659 | 1654 | end |
1660 | 1655 | end -- end compute target weight branch |
1661 | 1656 | weighted_sum = weighted_sum + tgt_weight | ... | ... |
-
Please register or login to post a comment