Thalassicus / cep-bnw

Civ V Communitas Expansion Pack
32 stars 22 forks source link

Leader 'X' has no personality #238

Open GrantSP opened 10 years ago

GrantSP commented 10 years ago

Every so often I check the logs of games that run perfectly and see this sort of ERROR listing:

MT_Initialize: ERROR Ashurbanipal has no personality

Clearly this isn't the case. The database shows ALL the leaders have defined personalities, so just what is this ERROR?

I can see in MT_Player.lua the function that handles this message state.

function PlayerClass.GetPersonalityInfo(player)
local leaderInfo = GameInfo.Leaders[player:GetLeaderType()]
if not leaderInfo then
    log:Error("%s is not a leader", player:GetName())
    return GameInfo.Personalities.PERSONALITY_DIPLOMAT
elseif not leaderInfo.Personality then
    log:Error("%s has no personality", player:GetName())
    return GameInfo.Personalities.PERSONALITY_DIPLOMAT
elseif not GameInfo.Personalities[leaderInfo.Personality] then
    log:Error("%s %s is not a personality type", player:GetName(), leaderInfo.Personality)
    return GameInfo.Personalities.PERSONALITY_DIPLOMAT
end
return GameInfo.Personalities[leaderInfo.Personality]
end

Why is this flagged as an error in the log? Does this mean every leader with a personality other than DIPLOMAT will force this error?

Thalassicus commented 10 years ago

The way to read that line is: "If a leader's Personality column is undefined (blank/null), define it as a Diplomat."

Everyone has a defined personality, and the code looks correct, so I think the problem is not in this block of code. It's probably somewhere else. Is Ashurbanipal's name misspelled anywhere? Did you change any code involving personalities? Do any other leaders produce this error?

GrantSP commented 10 years ago

I haven't touched any of this, or related code. I am sure this occurs with other leaders also. I wasn't keeping tabs on it, but from memory yes, other leaders have this happen.

Thalassicus commented 10 years ago

I ask because this function is mainly used for IsMilitaristicLeader, which gets called so often any bugs there would have shown up in... wait

That part's disabled, and I'm not sure why I did it. I'm checking when the function was changed...

Thalassicus commented 10 years ago

Hmm it appears I may have disabled it back when we didn't have personalities assigned to the new leaders yet. I think it's okay to re-enable it, and will try that. I doubt it will fix the problem you encountered (since the code was disabled) but might lead us to the source.