Bug Reporting

So what was breaking, too many isHuman checks? I don't understand why those are there at all anyway.

No, in getWorstEnemyTeams() I was grabbing the WE of human teams and ignoring those of AI teams. It should be the other way around because human teams do not have a worst enemy even though you can ask the SDK for it and get a response based on attitude modifiers.

Anyway, the one bug I found was not from r2074 but from r2170 . . .

Thanks, fixed in r2179.
 
Such a simple error, was missing a "not" on line 407.

Fixed in r2177.
Glad you got it sorted. I figured it was going to be something simple since r2074 didn't change much. I didn't play through any turns, but I opened up a save-game and was greeted with the same alerts as before when I updated through 2180. Fix looks promising.

aB: you probably meant r2054? r2074 was the revision that broke it.
No, I meant r2074. I "reverse merged" using SVN, essentially undoing the changes that r2074 did, temporarily correcting the problem. I confirmed in my test case that r2074 was the problem, but didn't try it with my current game in-progress that uses BetterAI, BULL, etc. I was merely reporting back that the alerts came back when r2074 was undone.
 
just got this in late game, never seen before. latest svn:

attachment.php
 
I would like to annoucne that once I replaced by BUG with BAT the problem went away with missing TXT, please look into it, as I belive it might be related to something with the XML Single-PLayer (and Multiplayer) versions. I also have the BULL installed in Custom Assets.
 
In BAT 2.2, I get 198 similar errors in PythonErr.log upon accessing the Custom Game screen. They are all of the nature
Code:
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10.py
or
Code:
ERR: Call function isAdvancedMap failed. Can't find module Full_of_Resources_3_10
I don't see this problem when using Better BUG AI or previous BAT or BUG versions.

I dumped the entire contents into the spoiler below if you want to have a look.
The ones ending in "_publicmaps.py" are sitting in my My Games\Beyond the Sword\PublicMaps directory, and the rest are the ones that came with BAT.

Spoiler PythonErr.log :
Code:
ERR: Call function getModPath failed. Can't find module Continents_and_Islands_publicmaps.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10_publicmaps.py
ERR: Call function getModPath failed. Can't find module jraySmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module LandMassesBonuses.py
ERR: Call function getModPath failed. Can't find module LandMassesFeatures.py
ERR: Call function getModPath failed. Can't find module LandMassesLands.py
ERR: Call function getModPath failed. Can't find module LandMassesMapSize.py
ERR: Call function getModPath failed. Can't find module LandMassesTerrain.py
ERR: Call function getModPath failed. Can't find module Lows_Random_Maps_3_0_publicmaps.py
ERR: Call function getModPath failed. Can't find module Maze_publicmaps.py
ERR: Call function getModPath failed. Can't find module Modules.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld_publicmaps.py
ERR: Call function getModPath failed. Can't find module Planet_Generator_0_68_publicmaps.py
ERR: Call function getModPath failed. Can't find module Ring_World_publicmaps.py
ERR: Call function getModPath failed. Can't find module SmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module Smart_Map_publicmaps.py
ERR: Call function getModPath failed. Can't find module Team_Battleground_publicmaps.py
ERR: Call function getModPath failed. Can't find module Tectonics_publicmaps.py
ERR: Call function getModPath failed. Can't find module Continents_and_Islands_publicmaps.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10_publicmaps.py
ERR: Call function getModPath failed. Can't find module jraySmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module LandMassesBonuses.py
ERR: Call function getModPath failed. Can't find module LandMassesFeatures.py
ERR: Call function getModPath failed. Can't find module LandMassesLands.py
ERR: Call function getModPath failed. Can't find module LandMassesMapSize.py
ERR: Call function getModPath failed. Can't find module LandMassesTerrain.py
ERR: Call function getModPath failed. Can't find module Lows_Random_Maps_3_0_publicmaps.py
ERR: Call function getModPath failed. Can't find module Maze_publicmaps.py
ERR: Call function getModPath failed. Can't find module Modules.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld_publicmaps.py
ERR: Call function getModPath failed. Can't find module Planet_Generator_0_68_publicmaps.py
ERR: Call function getModPath failed. Can't find module Ring_World_publicmaps.py
ERR: Call function getModPath failed. Can't find module SmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module Smart_Map_publicmaps.py
ERR: Call function getModPath failed. Can't find module Team_Battleground_publicmaps.py
ERR: Call function getModPath failed. Can't find module Tectonics_publicmaps.py
ERR: Call function getModPath failed. Can't find module Continents_and_Islands_publicmaps.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10_publicmaps.py
ERR: Call function getModPath failed. Can't find module jraySmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module LandMassesBonuses.py
ERR: Call function getModPath failed. Can't find module LandMassesFeatures.py
ERR: Call function getModPath failed. Can't find module LandMassesLands.py
ERR: Call function getModPath failed. Can't find module LandMassesMapSize.py
ERR: Call function getModPath failed. Can't find module LandMassesTerrain.py
ERR: Call function getModPath failed. Can't find module Lows_Random_Maps_3_0_publicmaps.py
ERR: Call function getModPath failed. Can't find module Maze_publicmaps.py
ERR: Call function getModPath failed. Can't find module Modules.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld_publicmaps.py
ERR: Call function getModPath failed. Can't find module Planet_Generator_0_68_publicmaps.py
ERR: Call function getModPath failed. Can't find module Ring_World_publicmaps.py
ERR: Call function getModPath failed. Can't find module SmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module Smart_Map_publicmaps.py
ERR: Call function getModPath failed. Can't find module Team_Battleground_publicmaps.py
ERR: Call function getModPath failed. Can't find module Tectonics_publicmaps.py
ERR: Call function getModPath failed. Can't find module Continents_and_Islands_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module Continents_and_Islands_publicmaps
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10.py
ERR: Call function isAdvancedMap failed. Can't find module Full_of_Resources_3_10
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module Full_of_Resources_3_10_publicmaps
ERR: Call function getModPath failed. Can't find module jraySmartMap_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module jraySmartMap_publicmaps
ERR: Call function getModPath failed. Can't find module LandMassesBonuses.py
ERR: Call function isAdvancedMap failed. Can't find module LandMassesBonuses
ERR: Call function getModPath failed. Can't find module LandMassesFeatures.py
ERR: Call function isAdvancedMap failed. Can't find module LandMassesFeatures
ERR: Call function getModPath failed. Can't find module LandMassesLands.py
ERR: Call function isAdvancedMap failed. Can't find module LandMassesLands
ERR: Call function getModPath failed. Can't find module LandMassesMapSize.py
ERR: Call function isAdvancedMap failed. Can't find module LandMassesMapSize
ERR: Call function getModPath failed. Can't find module LandMassesTerrain.py
ERR: Call function isAdvancedMap failed. Can't find module LandMassesTerrain
ERR: Call function getModPath failed. Can't find module Lows_Random_Maps_3_0_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module Lows_Random_Maps_3_0_publicmaps
ERR: Call function getModPath failed. Can't find module Maze_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module Maze_publicmaps
ERR: Call function getModPath failed. Can't find module Modules.py
ERR: Call function isAdvancedMap failed. Can't find module Modules
ERR: Call function getModPath failed. Can't find module PerfectWorld2f.py
ERR: Call function isAdvancedMap failed. Can't find module PerfectWorld2f
ERR: Call function getModPath failed. Can't find module PerfectWorld2f_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module PerfectWorld2f_publicmaps
ERR: Call function getModPath failed. Can't find module PerfectWorld2_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module PerfectWorld2_publicmaps
ERR: Call function getModPath failed. Can't find module PerfectWorld_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module PerfectWorld_publicmaps
ERR: Call function getModPath failed. Can't find module Planet_Generator_0_68_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module Planet_Generator_0_68_publicmaps
ERR: Call function getModPath failed. Can't find module Ring_World_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module Ring_World_publicmaps
ERR: Call function getModPath failed. Can't find module SmartMap_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module SmartMap_publicmaps
ERR: Call function getModPath failed. Can't find module Smart_Map_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module Smart_Map_publicmaps
ERR: Call function getModPath failed. Can't find module Team_Battleground_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module Team_Battleground_publicmaps
ERR: Call function getModPath failed. Can't find module Tectonics_publicmaps.py
ERR: Call function isAdvancedMap failed. Can't find module Tectonics_publicmaps
ERR: Call function getModPath failed. Can't find module Continents_and_Islands_publicmaps.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10_publicmaps.py
ERR: Call function getModPath failed. Can't find module jraySmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module LandMassesBonuses.py
ERR: Call function getModPath failed. Can't find module LandMassesFeatures.py
ERR: Call function getModPath failed. Can't find module LandMassesLands.py
ERR: Call function getModPath failed. Can't find module LandMassesMapSize.py
ERR: Call function getModPath failed. Can't find module LandMassesTerrain.py
ERR: Call function getModPath failed. Can't find module Lows_Random_Maps_3_0_publicmaps.py
ERR: Call function getModPath failed. Can't find module Maze_publicmaps.py
ERR: Call function getModPath failed. Can't find module Modules.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld_publicmaps.py
ERR: Call function getModPath failed. Can't find module Planet_Generator_0_68_publicmaps.py
ERR: Call function getModPath failed. Can't find module Ring_World_publicmaps.py
ERR: Call function getModPath failed. Can't find module SmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module Smart_Map_publicmaps.py
ERR: Call function getModPath failed. Can't find module Team_Battleground_publicmaps.py
ERR: Call function getModPath failed. Can't find module Tectonics_publicmaps.py
ERR: Call function getModPath failed. Can't find module Continents_and_Islands_publicmaps.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10_publicmaps.py
ERR: Call function getModPath failed. Can't find module jraySmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module LandMassesBonuses.py
ERR: Call function getModPath failed. Can't find module LandMassesFeatures.py
ERR: Call function getModPath failed. Can't find module LandMassesLands.py
ERR: Call function getModPath failed. Can't find module LandMassesMapSize.py
ERR: Call function getModPath failed. Can't find module LandMassesTerrain.py
ERR: Call function getModPath failed. Can't find module Lows_Random_Maps_3_0_publicmaps.py
ERR: Call function getModPath failed. Can't find module Maze_publicmaps.py
ERR: Call function getModPath failed. Can't find module Modules.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld_publicmaps.py
ERR: Call function getModPath failed. Can't find module Planet_Generator_0_68_publicmaps.py
ERR: Call function getModPath failed. Can't find module Ring_World_publicmaps.py
ERR: Call function getModPath failed. Can't find module SmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module Smart_Map_publicmaps.py
ERR: Call function getModPath failed. Can't find module Team_Battleground_publicmaps.py
ERR: Call function getModPath failed. Can't find module Tectonics_publicmaps.py
ERR: Call function getModPath failed. Can't find module Continents_and_Islands_publicmaps.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10_publicmaps.py
ERR: Call function getModPath failed. Can't find module jraySmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module LandMassesBonuses.py
ERR: Call function getModPath failed. Can't find module LandMassesFeatures.py
ERR: Call function getModPath failed. Can't find module LandMassesLands.py
ERR: Call function getModPath failed. Can't find module LandMassesMapSize.py
ERR: Call function getModPath failed. Can't find module LandMassesTerrain.py
ERR: Call function getModPath failed. Can't find module Lows_Random_Maps_3_0_publicmaps.py
ERR: Call function getModPath failed. Can't find module Maze_publicmaps.py
ERR: Call function getModPath failed. Can't find module Modules.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld_publicmaps.py
ERR: Call function getModPath failed. Can't find module Planet_Generator_0_68_publicmaps.py
ERR: Call function getModPath failed. Can't find module Ring_World_publicmaps.py
ERR: Call function getModPath failed. Can't find module SmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module Smart_Map_publicmaps.py
ERR: Call function getModPath failed. Can't find module Team_Battleground_publicmaps.py
ERR: Call function getModPath failed. Can't find module Tectonics_publicmaps.py
ERR: Call function getModPath failed. Can't find module Continents_and_Islands_publicmaps.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10.py
ERR: Call function getModPath failed. Can't find module Full_of_Resources_3_10_publicmaps.py
ERR: Call function getModPath failed. Can't find module jraySmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module LandMassesBonuses.py
ERR: Call function getModPath failed. Can't find module LandMassesFeatures.py
ERR: Call function getModPath failed. Can't find module LandMassesLands.py
ERR: Call function getModPath failed. Can't find module LandMassesMapSize.py
ERR: Call function getModPath failed. Can't find module LandMassesTerrain.py
ERR: Call function getModPath failed. Can't find module Lows_Random_Maps_3_0_publicmaps.py
ERR: Call function getModPath failed. Can't find module Maze_publicmaps.py
ERR: Call function getModPath failed. Can't find module Modules.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2f_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld2_publicmaps.py
ERR: Call function getModPath failed. Can't find module PerfectWorld_publicmaps.py
ERR: Call function getModPath failed. Can't find module Planet_Generator_0_68_publicmaps.py
ERR: Call function getModPath failed. Can't find module Ring_World_publicmaps.py
ERR: Call function getModPath failed. Can't find module SmartMap_publicmaps.py
ERR: Call function getModPath failed. Can't find module Smart_Map_publicmaps.py
ERR: Call function getModPath failed. Can't find module Team_Battleground_publicmaps.py
ERR: Call function getModPath failed. Can't find module Tectonics_publicmaps.py

EDIT: Also noticed many entries of this in PythonDbg.log too, although that's not too surprising since BAT Mod 2.2 doesn't have a UserSettings directory. Once I added one, it was fine.

Code:
ERROR: BugOptions - Cannot locate settings folder
 
I dumped the entire contents into the spoiler below if you want to have a look.The ones ending in "_publicmaps.py" are sitting in my My Games\Beyond the Sword\PublicMaps directory, and the rest are the ones that came with BAT.
BAT is looking for those maps to be in the "My Games\BTS\MODS\BAT Mod 2.2\Private Maps" folder.
 
User is reporting some error messages BUG is throwing at him. Looked over the python error logs, and looks like it's a problem with a character being passed to BugEventManager outside the normal 128 ascii range. Posting the python error logs for you guys to take a look at, please let me know if you find anything useful so I can post a fix for this user. They report things "work" but the error messages they are getting at the top of the screen are annoying.


Edit:
Also another unrelated bug reported here:
http://forums.civfanatics.com/showpost.php?p=9006280&postcount=1692
The user is playing hotseat on the same computer, and both users are getting cross player notifications. See the post linked for more details.
 
Hidden Attitude, First Impressions:
[Diety game with Random Personalities, No Barbs/Huts/Random Events/Vassals; no spoiler cflag]
For First Impression I should see -1 for me (player 0) from difficulty and nothing for inter-AI relations (or do AIs really get +1 to each other?).
Yet what I see is: player 1 gets no first impression modifiers, player 2 gets +1 from everyone, player 3 +2, etc until player 6 who gets +5 from everyone.

(Which almost looks not like a check for random personalities gone wrong but like a variable that is never set back to 0 and gets +1 for every iteration. Not sure why that happens though but once I have time I'll try and see if my change to CvPlayerAI::AI_getFirstImpressionAttitude() helps.)

Spoiler :
Code:
[COLOR="Green"]// BEGIN: Show Hidden Attitude Mod 01/22/2009[/COLOR]
int CvPlayerAI::AI_getFirstImpressionAttitude(PlayerTypes ePlayer) const
{
    int iAttitude [B]= GC.getHandicapInfo(GET_PLAYER(ePlayer).getHandicapType()).getAttitudeChange()[/B];

[COLOR="Blue"]#ifdef _MOD_SHAM_SPOILER[/COLOR]
	bool bShowPersonalityAttitude = true;
[COLOR="Blue"]#else[/COLOR]
	bool bShowPersonalityAttitude = !GC.getGameINLINE().isOption(GAMEOPTION_RANDOM_PERSONALITIES);
[COLOR="Blue"]#endif[/COLOR]

	if (bShowPersonalityAttitude)
	{
		iAttitude += GC.getLeaderHeadInfo(getPersonalityType()).getBaseAttitude();
	}

	if (!(GET_PLAYER(ePlayer).isHuman()) && bShowPersonalityAttitude)
	{
[COLOR="Blue"]#ifdef _MOD_SHAM_SPOILER[/COLOR]
		[COLOR="Green"]// iBasePeaceWeight + iPeaceWeightRand[/COLOR]
		iAttitude += (4 - abs(AI_getPeaceWeight() - GET_PLAYER(ePlayer).AI_getPeaceWeight()));
[COLOR="Blue"]#else[/COLOR]
		[COLOR="Green"]// iBasePeaceWeight[/COLOR]
        iAttitude += (4 - abs(GC.getLeaderHeadInfo(getPersonalityType()).getBasePeaceWeight() - GC.getLeaderHeadInfo(GET_PLAYER(ePlayer).getPersonalityType()).getBasePeaceWeight()));
[COLOR="Blue"]#endif[/COLOR]
		iAttitude += std::min(GC.getLeaderHeadInfo(getPersonalityType()).getWarmongerRespect(), GC.getLeaderHeadInfo(GET_PLAYER(ePlayer).getPersonalityType()).getWarmongerRespect());
	}

    return iAttitude;
}

edit2: Isn't attitudeChange only for humans? No it's not
 
Is there another change besides moving the call to CvHandicapInfo::getAttitudeChange() to the top and changing an = to a +=? I agree that makes it clearer, but I just want to make sure I'm not missing anything else.
 
Looking at the part for iBasePeaceWeight and AI_getPeaceWeight(), it may be misleading. This function returns the actual random pieceweight, right? And this value is a random function of getBasePeaceWeight() for the two leaders, right? If so, then it may be best to leave it off when not showing spoiler information rather than assume the worst case (or best, whatever the function does now).
 
I agree the numbers you saw looked suspicious, but the calls to get those numbers are separate and don't use static variables AFAICT. I have seen variations in the number in my games, so I'm inclined to think this was just a coincidence.

Did you find something else that I need to look at? Sorry, I'm a bit brain-dead from work right now. ;)
 
Not sure what the rest of this function does, I was hoping you do though ;) I see no flaw in the logic though: show what can be known, hide what is random - even if that means assuming worst/best/whatever.
BUT what i do know is that with random personalities all I should see is the change from handicap info (difficulty level), and I doubt that ranges from 0 to +5 for AIs.
 
Ah okay, I didn't understand that you had random personalities turned on. If you look at the code that does the hover, I think you'll find that more than this goes into the first impression, or I'm wrong. I only tweaked the code to work in BULL so I'm not very familiar with it. I'll dig into it later tonight.
 
I looked at the code that does the hover, and iirc all it did was call AI_getFirstImpressionAttitude(). And with the game option Random Personalities on, bShowPersonalityAttitude will be false, and the only lines that got executed were
int iAttitude; (which does exactly nothing)
and
iAttitude += GC.getHandicapInfo(GET_PLAYER(ePlayer).getHandicapType()).getAttitudeChange(); (which only adds, it does not reset the variable)

edit: after that change, everyone gets -1 attitude from everyone else from first impression, I assume that is the way it's suposed to be.
Now I'm off to bed, I still have tomorrow to figure out why I get crashes and endless-loops for both my siege unit and happy/health building valuation >_<
 
Oh, I see. Yes I suppose there could be trouble not initializing iAttitude there to 0. It seems odd that the stars would align in such a way for that variable to be placed in the same spot in memory for each call given that it's a local (stack-based) variable and other things are happening, but it's possible. I also thought that the compiler for release auto-initialized variables.

In any case, did your change fix it?
 
Cool. Well, the easiest way for me to learn a chunk of code is to rewrite it. ;) I had been meaning to make the checking of debug mode more uniform, and I have. Debug mode now shows all hidden, random, and personality-based modifiers (just as the compile-time SPOILER flag does). I added two functions to ease the checking of this and make all the main functions easier to read (no more #ifdefs).

I'll do some testing before I commit this, but it compiles. ;) Feel free to check it out if you like. Replace everything between the SHAM tags in CvPlayerAI.cpp.

Code:
// BEGIN: Show Hidden Attitude Mod 01/22/2009
bool isShowPersonalityModifiers()
{
#ifdef _MOD_SHAM_SPOILER
	return true;
#else
	return !GC.getGameINLINE().isOption(GAMEOPTION_RANDOM_PERSONALITIES) || GC.getGameINLINE().isDebugMode();
#endif
}

bool isShowSpoilerModifiers()
{
#ifdef _MOD_SHAM_SPOILER
	return true;
#else
	return GC.getGameINLINE().isDebugMode();
#endif
}

int CvPlayerAI::AI_getFirstImpressionAttitude(PlayerTypes ePlayer) const
{
	bool bShowPersonalityAttitude = isShowPersonalityModifiers();
	CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);
    int iAttitude = GC.getHandicapInfo(kPlayer.getHandicapType()).getAttitudeChange();

	if (bShowPersonalityAttitude)
	{
		iAttitude += GC.getLeaderHeadInfo(getPersonalityType()).getBaseAttitude();
		if (!kPlayer.isHuman())
		{
			if (isShowSpoilerModifiers())
			{
				// iBasePeaceWeight + iPeaceWeightRand
				iAttitude += (4 - abs(AI_getPeaceWeight() - kPlayer.AI_getPeaceWeight()));
			}
			else
			{
				// iBasePeaceWeight
				iAttitude += (4 - abs(GC.getLeaderHeadInfo(getPersonalityType()).getBasePeaceWeight() - GC.getLeaderHeadInfo(kPlayer.getPersonalityType()).getBasePeaceWeight()));
			}
			iAttitude += std::min(GC.getLeaderHeadInfo(getPersonalityType()).getWarmongerRespect(), GC.getLeaderHeadInfo(kPlayer.getPersonalityType()).getWarmongerRespect());
		}
	}

    return iAttitude;
}

int CvPlayerAI::AI_getTeamSizeAttitude(PlayerTypes ePlayer) const
{
	return -std::max(0, (GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getNumMembers() - GET_TEAM(getTeam()).getNumMembers()));
}

// Count only players visible on the active player's scoreboard
int CvPlayerAI::AI_getKnownPlayerRank(PlayerTypes ePlayer) const
{
    PlayerTypes eActivePlayer = GC.getGameINLINE().getActivePlayer();
    if (NO_PLAYER == eActivePlayer || GC.getGameINLINE().isDebugMode()) {
        // Use the full scoreboard
        return GC.getGameINLINE().getPlayerRank(ePlayer);
    }

	TeamTypes eActiveTeam = GC.getGameINLINE().getActiveTeam();
    int iRank = 0;
    for (int iI = 0; iI < MAX_CIV_PLAYERS; iI++)
    {
        PlayerTypes eRankPlayer = GC.getGameINLINE().getRankPlayer(iI);
		if (eRankPlayer != NO_PLAYER)
		{
			CvTeam& kRankTeam = GET_TEAM(GET_PLAYER(eRankPlayer).getTeam());
			if (kRankTeam.isAlive() && (kRankTeam.isHasMet(eActiveTeam) || kRankTeam.isHuman()))
			{
				if (eRankPlayer == ePlayer) {
					return iRank;
				}
				iRank++;
			}
        }
    }

    // Should only get here if we tried to find the rank of an unknown player
    return iRank + 1;
}

int CvPlayerAI::AI_getBetterRankDifferenceAttitude(PlayerTypes ePlayer) const
{
	if (!isShowPersonalityModifiers())
	{
		return 0;
	}

	int iRankDifference;
	if (isShowSpoilerModifiers())
	{
	    iRankDifference = GC.getGameINLINE().getPlayerRank(ePlayer) - GC.getGameINLINE().getPlayerRank(getID());
	}
	else
	{
	    iRankDifference = AI_getKnownPlayerRank(ePlayer) - AI_getKnownPlayerRank(getID());
	}

	if (iRankDifference > 0)
	{
		return GC.getLeaderHeadInfo(getPersonalityType()).getBetterRankDifferenceAttitudeChange() * iRankDifference / (GC.getGameINLINE().countCivPlayersEverAlive() + 1);
	}

    return 0;
}

int CvPlayerAI::AI_getWorseRankDifferenceAttitude(PlayerTypes ePlayer) const
{
	if (!isShowPersonalityModifiers())
	{
		return 0;
	}

	int iRankDifference;
	if (isShowSpoilerModifiers())
	{
	    iRankDifference = GC.getGameINLINE().getPlayerRank(getID()) - GC.getGameINLINE().getPlayerRank(ePlayer);
	}
	else
	{
	    iRankDifference = AI_getKnownPlayerRank(getID()) - AI_getKnownPlayerRank(ePlayer);
	}

	if (iRankDifference > 0)
	{
		return GC.getLeaderHeadInfo(getPersonalityType()).getWorseRankDifferenceAttitudeChange() * iRankDifference / (GC.getGameINLINE().countCivPlayersEverAlive() + 1);
	}

    return 0;
}

int CvPlayerAI::AI_getLowRankAttitude(PlayerTypes ePlayer) const
{
	int iThisPlayerRank;
	int iPlayerRank;
	if (isShowSpoilerModifiers())
	{
		iThisPlayerRank = GC.getGameINLINE().getPlayerRank(getID());
		iPlayerRank = GC.getGameINLINE().getPlayerRank(ePlayer);
	}
	else
	{
		iThisPlayerRank = AI_getKnownPlayerRank(getID());
		iPlayerRank = AI_getKnownPlayerRank(ePlayer);
	}

	int iMedianRank = GC.getGameINLINE().countCivPlayersEverAlive() / 2;
	return (iThisPlayerRank >= iMedianRank && iPlayerRank >= iMedianRank) ? 1 : 0;
}

int CvPlayerAI::AI_getLostWarAttitude(PlayerTypes ePlayer) const
{
	if (!isShowPersonalityModifiers())
	{
		return 0;
	}

	TeamTypes eTeam = GET_PLAYER(ePlayer).getTeam();
    if (!isShowSpoilerModifiers() && NO_PLAYER != GC.getGameINLINE().getActivePlayer())
    {
        // Hide war success for wars you are not involved in
        if (GC.getGameINLINE().getActiveTeam() != getTeam() && GC.getGameINLINE().getActiveTeam() != eTeam)
        {
            return 0;
        }
    }

	if (GET_TEAM(eTeam).AI_getWarSuccess(getTeam()) > GET_TEAM(getTeam()).AI_getWarSuccess(eTeam))
	{
		return GC.getLeaderHeadInfo(getPersonalityType()).getLostWarAttitudeChange();
	}

    return 0;
}
// END: Show Hidden Attitude Mod
 
I have noticed a few little bugs in the logging of diplomatic interaction. I trade gets canceled (which is logged) but then renegotiated (which is not logged). Finally, an AI demands gold and the log just says ...

Diplomacy (Tribute Demand): Joao II (Portugal) demands that King Dork (Fanatics) gives ; King Dork AGREES.

I have a save that generates these guys after a few turns (less than 15). I'll try and get saves that do them next turn.
 
Back
Top Bottom