[ctp2-commit] r1115 - in trunk/ctp2_code: GameWatch/gamewatch GameWatch/gwarchive GameWatch/gwciv GameWatch/gwfile ai ai/CityManagement ai/ctp2 ai/diplomacy ai/diplomacy_test/diptest ai/mapanalysis ai/personality ai/strategy/agents ai/strategy/goals ai/strategy/scheduler ai/strategy/squads ctp ctp/ctp2_rsrc ctp/ctp2_utils ctp/debugtools ctp/fingerprint gfx/gfx_utils gfx/layers gfx/spritesys gfx/tilesys gs/database gs/dbgen gs/events gs/fileio gs/gameobj gs/newdb gs/outcom gs/slic gs/utility gs/world libs/anet/demo/band libs/anet/demo/chat libs/anet/demo/chat/setupsrc libs/anet/demo/crash libs/anet/demo/gtest libs/anet/demo/java libs/anet/demo/porttest libs/anet/demo/pvtest libs/anet/demo/stattest libs/anet/demo/utils libs/anet/demo/utils/bad libs/anet/h libs/anet/src/aeh libs/anet/src/aeh/analaeh libs/anet/src/antp libs/anet/src/bhttp libs/anet/src/demo/client libs/anet/src/demo/dpioecho libs/anet/src/demo/iotest libs/anet/src/demo/lnchtest libs/anet/src/demo/rawtest libs/anet/src/demo/udptest libs/anet/src/doc libs/anet/src/dp libs/anet/src/java/Activision libs/anet/src/linux/dp libs/anet/src/linux/runsrvfil libs/anet/src/linux/server libs/anet/src/linux/uudp libs/anet/src/mac/3rdparty/macipx13/MacIPX_APIs libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes libs/anet/src/mac/AppleTalk libs/anet/src/mac/dp libs/anet/src/mac/h libs/anet/src/mac/main libs/anet/src/mac/minet libs/anet/src/mac/minets libs/anet/src/mac/mipx libs/anet/src/mac/mmodem libs/anet/src/mac/mserial libs/anet/src/mac/stub libs/anet/src/sbd libs/anet/src/score libs/anet/src/score/Activision libs/anet/src/tca libs/anet/src/test/PSP libs/anet/src/test/bench libs/anet/src/test/dpio libs/anet/src/test/dpiot libs/anet/src/test/dptab libs/anet/src/test/dptabt libs/anet/src/test/dpuser libs/anet/src/test/load libs/anet/src/test/pingt libs/anet/src/test/score libs/anet/src/win/anetdrop libs/anet/src/win/dp libs/anet/src/win/h libs/anet/src/win/main libs/anet/src/win/sendcrsh libs/anet/src/win/stub libs/anet/src/win/winets libs/anet/src/win/wipx libs/anet/src/win/wloop libs/anet/src/win/wmodem libs/anet/src/win/wserial libs/miles libs/tiff libs/zlib mapgen net/general net/io os/include os/nowin32 robot/aibackdoor robot/pathing robot/utility robotcom/Agent robotcom/Alloc robotcom/FrmState robotcom/InCom robotcom/Top robotcom/aimgr robotcom/backdoor robotcom/fuzzy robotcom/goals robotcom/planner sound ui/aui_common ui/aui_ctp2 ui/aui_directx ui/aui_sdl ui/aui_utils ui/freetype ui/interface ui/ldl ui/netshell ui/slic_debug user-robotcom/aimain user-robotcom/incom user-robotcom/outcom user-robotcom/shared

ctp2-commit at darkdust.net ctp2-commit at darkdust.net
Mon May 23 04:21:20 CEST 2016


Author: mi
Date: Mon May 23 04:21:18 2016
New Revision: 1115

Log:
Before doing anything else, let's clean up the vast amounts of
white-space accumulated in this code over the years:

	. Remove all spaces and tabs at ends of lines
	. Remove all blank lines at the beginnings and
	  ends of files
	. Turn all pairs of exactly two blank lines into
	  one blank line
	. Turn all sequences of three or more blank lines
	  into exactly two
	. Add a new line at EOF, whereever there was not
	  one before

Modified:
   trunk/ctp2_code/GameWatch/gamewatch/DLLTypes.h
   trunk/ctp2_code/GameWatch/gamewatch/GWDelivery.cpp
   trunk/ctp2_code/GameWatch/gamewatch/GWDelivery.h
   trunk/ctp2_code/GameWatch/gamewatch/GWRecord.cpp
   trunk/ctp2_code/GameWatch/gamewatch/GWRecord.h
   trunk/ctp2_code/GameWatch/gamewatch/GWRecorder.cpp
   trunk/ctp2_code/GameWatch/gamewatch/GWRecorder.h
   trunk/ctp2_code/GameWatch/gamewatch/GameWatch.cpp
   trunk/ctp2_code/GameWatch/gamewatch/GameWatch.h
   trunk/ctp2_code/GameWatch/gwarchive/GWArchive.cpp
   trunk/ctp2_code/GameWatch/gwarchive/GWArchive.h
   trunk/ctp2_code/GameWatch/gwarchive/GWArchiveDLL.h
   trunk/ctp2_code/GameWatch/gwarchive/main.cpp
   trunk/ctp2_code/GameWatch/gwciv/GWCiv.cpp
   trunk/ctp2_code/GameWatch/gwciv/GWCiv.h
   trunk/ctp2_code/GameWatch/gwciv/GWCivDLL.h
   trunk/ctp2_code/GameWatch/gwciv/GWCivRecord.cpp
   trunk/ctp2_code/GameWatch/gwciv/GWCivRecord.h
   trunk/ctp2_code/GameWatch/gwfile/GWFile.cpp
   trunk/ctp2_code/GameWatch/gwfile/GWFile.h
   trunk/ctp2_code/GameWatch/gwfile/GWFileDLL.h
   trunk/ctp2_code/ai/CityManagement/governor.cpp
   trunk/ctp2_code/ai/CityManagement/governor.h
   trunk/ctp2_code/ai/ctp2/ctp2.h
   trunk/ctp2_code/ai/ctp2/ctp_debug.h
   trunk/ctp2_code/ai/ctp2/ctp_types.h
   trunk/ctp2_code/ai/ctp2/ldl_strings.h
   trunk/ctp2_code/ai/ctpai.cpp
   trunk/ctp2_code/ai/ctpai.h
   trunk/ctp2_code/ai/ctpaidebug.cpp
   trunk/ctp2_code/ai/ctpaidebug.h
   trunk/ctp2_code/ai/diplomacy/AgreementMatrix.h
   trunk/ctp2_code/ai/diplomacy/CounterResponseEvent.h
   trunk/ctp2_code/ai/diplomacy/DStateEvent.h
   trunk/ctp2_code/ai/diplomacy/Diplomat.h
   trunk/ctp2_code/ai/diplomacy/Foreigner.h
   trunk/ctp2_code/ai/diplomacy/MotivationEvent.h
   trunk/ctp2_code/ai/diplomacy/NProposalEvent.h
   trunk/ctp2_code/ai/diplomacy/ProposalAnalysis.h
   trunk/ctp2_code/ai/diplomacy/ProposalResponseEvent.h
   trunk/ctp2_code/ai/diplomacy/ReactEvent.cpp
   trunk/ctp2_code/ai/diplomacy/RegardEvent.h
   trunk/ctp2_code/ai/diplomacy/RejectResponseEvent.cpp
   trunk/ctp2_code/ai/diplomacy/RejectResponseEvent.h
   trunk/ctp2_code/ai/diplomacy/ResponseEvent.cpp
   trunk/ctp2_code/ai/diplomacy/ResponseEvent.h
   trunk/ctp2_code/ai/diplomacy/SStateEvent.h
   trunk/ctp2_code/ai/diplomacy/ThreatResponseEvent.h
   trunk/ctp2_code/ai/diplomacy/agreementmatrix.cpp
   trunk/ctp2_code/ai/diplomacy/counterresponseevent.cpp
   trunk/ctp2_code/ai/diplomacy/diplomacyutil.cpp
   trunk/ctp2_code/ai/diplomacy/diplomacyutil.h
   trunk/ctp2_code/ai/diplomacy/diplomat.cpp
   trunk/ctp2_code/ai/diplomacy/diplomattypes.cpp
   trunk/ctp2_code/ai/diplomacy/diplomattypes.h
   trunk/ctp2_code/ai/diplomacy/dstateevent.cpp
   trunk/ctp2_code/ai/diplomacy/foreigner.cpp
   trunk/ctp2_code/ai/diplomacy/motivationevent.cpp
   trunk/ctp2_code/ai/diplomacy/nproposalevent.cpp
   trunk/ctp2_code/ai/diplomacy/proposalanalysis.cpp
   trunk/ctp2_code/ai/diplomacy/proposalresponseevent.cpp
   trunk/ctp2_code/ai/diplomacy/reactevent.h
   trunk/ctp2_code/ai/diplomacy/regardevent.cpp
   trunk/ctp2_code/ai/diplomacy/sstateevent.cpp
   trunk/ctp2_code/ai/diplomacy/threatresponseevent.cpp
   trunk/ctp2_code/ai/diplomacy_test/diptest/diptest.cpp
   trunk/ctp2_code/ai/diplomacy_test/diptest/stdafx.cpp
   trunk/ctp2_code/ai/diplomacy_test/diptest/stdafx.h
   trunk/ctp2_code/ai/mapanalysis/boundingrect.cpp
   trunk/ctp2_code/ai/mapanalysis/boundingrect.h
   trunk/ctp2_code/ai/mapanalysis/mapanalysis.cpp
   trunk/ctp2_code/ai/mapanalysis/mapanalysis.h
   trunk/ctp2_code/ai/mapanalysis/mapgrid.h
   trunk/ctp2_code/ai/mapanalysis/settlemap.cpp
   trunk/ctp2_code/ai/mapanalysis/settlemap.h
   trunk/ctp2_code/ai/personality/aip2.h
   trunk/ctp2_code/ai/profileai.h
   trunk/ctp2_code/ai/strategy/agents/agent.cpp
   trunk/ctp2_code/ai/strategy/agents/agent.h
   trunk/ctp2_code/ai/strategy/goals/Goal.cpp
   trunk/ctp2_code/ai/strategy/goals/Goal.h
   trunk/ctp2_code/ai/strategy/scheduler/Goal_And_Squad_Types.h
   trunk/ctp2_code/ai/strategy/scheduler/Plan.cpp
   trunk/ctp2_code/ai/strategy/scheduler/Plan.h
   trunk/ctp2_code/ai/strategy/scheduler/Scheduler.h
   trunk/ctp2_code/ai/strategy/scheduler/scheduler.cpp
   trunk/ctp2_code/ai/strategy/scheduler/scheduler_types.h
   trunk/ctp2_code/ai/strategy/squads/squad_Strength.cpp
   trunk/ctp2_code/ai/strategy/squads/squad_Strength.h
   trunk/ctp2_code/ctp/c3.cpp
   trunk/ctp2_code/ctp/c3.h
   trunk/ctp2_code/ctp/c3types.h
   trunk/ctp2_code/ctp/civ3_main.cpp
   trunk/ctp2_code/ctp/civ3_main.h
   trunk/ctp2_code/ctp/civapp.cpp
   trunk/ctp2_code/ctp/civapp.h
   trunk/ctp2_code/ctp/ctp2_rsrc/resource.h
   trunk/ctp2_code/ctp/ctp2_utils/AvlTree.h
   trunk/ctp2_code/ctp/ctp2_utils/BitMask.h
   trunk/ctp2_code/ctp/ctp2_utils/appstrings.cpp
   trunk/ctp2_code/ctp/ctp2_utils/appstrings.h
   trunk/ctp2_code/ctp/ctp2_utils/c3cmdline.cpp
   trunk/ctp2_code/ctp/ctp2_utils/c3cmdline.h
   trunk/ctp2_code/ctp/ctp2_utils/c3cpu.cpp
   trunk/ctp2_code/ctp/ctp2_utils/c3cpu.h
   trunk/ctp2_code/ctp/ctp2_utils/c3debug.cpp
   trunk/ctp2_code/ctp/ctp2_utils/c3debug.h
   trunk/ctp2_code/ctp/ctp2_utils/c3debugstl.h
   trunk/ctp2_code/ctp/ctp2_utils/c3errors.cpp
   trunk/ctp2_code/ctp/ctp2_utils/c3files.cpp
   trunk/ctp2_code/ctp/ctp2_utils/c3files.h
   trunk/ctp2_code/ctp/ctp2_utils/c3math.h
   trunk/ctp2_code/ctp/ctp2_utils/c3mem.cpp
   trunk/ctp2_code/ctp/ctp2_utils/cheatkey.cpp
   trunk/ctp2_code/ctp/ctp2_utils/cheatkey.h
   trunk/ctp2_code/ctp/ctp2_utils/command.cpp
   trunk/ctp2_code/ctp/ctp2_utils/command.h
   trunk/ctp2_code/ctp/ctp2_utils/ctpregistry.cpp
   trunk/ctp2_code/ctp/ctp2_utils/ctpregistry.h
   trunk/ctp2_code/ctp/ctp2_utils/ddhelp.cpp
   trunk/ctp2_code/ctp/ctp2_utils/minmax.h
   trunk/ctp2_code/ctp/ctp2_utils/netconsole.cpp
   trunk/ctp2_code/ctp/ctp2_utils/netconsole.h
   trunk/ctp2_code/ctp/ctp2_utils/pointerlist.h
   trunk/ctp2_code/ctp/ctp2_utils/tracklen.cpp
   trunk/ctp2_code/ctp/ctp2_utils/tracklen.h
   trunk/ctp2_code/ctp/debugtools/Timer.cpp
   trunk/ctp2_code/ctp/debugtools/Timer.h
   trunk/ctp2_code/ctp/debugtools/breakpoint.h
   trunk/ctp2_code/ctp/debugtools/debug.c
   trunk/ctp2_code/ctp/debugtools/debug.h
   trunk/ctp2_code/ctp/debugtools/debugassert.cpp
   trunk/ctp2_code/ctp/debugtools/debugassert.h
   trunk/ctp2_code/ctp/debugtools/debugcallstack.cpp
   trunk/ctp2_code/ctp/debugtools/debugcallstack.h
   trunk/ctp2_code/ctp/debugtools/debugexception.cpp
   trunk/ctp2_code/ctp/debugtools/debugexception.h
   trunk/ctp2_code/ctp/debugtools/debugmemory.cpp
   trunk/ctp2_code/ctp/debugtools/debugmemory.h
   trunk/ctp2_code/ctp/debugtools/log.cpp
   trunk/ctp2_code/ctp/debugtools/log.h
   trunk/ctp2_code/ctp/debugtools/log_off.h
   trunk/ctp2_code/ctp/debugtools/log_on.h
   trunk/ctp2_code/ctp/debugtools/main.cpp
   trunk/ctp2_code/ctp/display.cpp
   trunk/ctp2_code/ctp/display.h
   trunk/ctp2_code/ctp/fingerprint/ctp_finger.cpp
   trunk/ctp2_code/ctp/fingerprint/endecode.c
   trunk/ctp2_code/ctp/fingerprint/shroud.c
   trunk/ctp2_code/ctp/fingerprint/shroud.h
   trunk/ctp2_code/ctp/fingerprint/verify.c
   trunk/ctp2_code/ctp/fingerprint/verify.h
   trunk/ctp2_code/gfx/gfx_utils/ColorSet.cpp
   trunk/ctp2_code/gfx/gfx_utils/Queue.h
   trunk/ctp2_code/gfx/gfx_utils/arproces.cpp
   trunk/ctp2_code/gfx/gfx_utils/arproces.h
   trunk/ctp2_code/gfx/gfx_utils/colorset.h
   trunk/ctp2_code/gfx/gfx_utils/gfx_options.cpp
   trunk/ctp2_code/gfx/gfx_utils/gfx_options.h
   trunk/ctp2_code/gfx/gfx_utils/pixelutils.cpp
   trunk/ctp2_code/gfx/gfx_utils/pixelutils.h
   trunk/ctp2_code/gfx/gfx_utils/rimutils.h
   trunk/ctp2_code/gfx/gfx_utils/targautils.cpp
   trunk/ctp2_code/gfx/gfx_utils/targautils.h
   trunk/ctp2_code/gfx/gfx_utils/tiffutils.cpp
   trunk/ctp2_code/gfx/gfx_utils/tiffutils.h
   trunk/ctp2_code/gfx/gfx_utils/videoutils.cpp
   trunk/ctp2_code/gfx/layers/citylayer.cpp
   trunk/ctp2_code/gfx/layers/citylayer.h
   trunk/ctp2_code/gfx/spritesys/Action.h
   trunk/ctp2_code/gfx/spritesys/Actor.cpp
   trunk/ctp2_code/gfx/spritesys/Actor.h
   trunk/ctp2_code/gfx/spritesys/ActorPath.cpp
   trunk/ctp2_code/gfx/spritesys/ActorPath.h
   trunk/ctp2_code/gfx/spritesys/Anim.cpp
   trunk/ctp2_code/gfx/spritesys/Anim.h
   trunk/ctp2_code/gfx/spritesys/CitySpriteGroup.cpp
   trunk/ctp2_code/gfx/spritesys/CitySpriteGroup.h
   trunk/ctp2_code/gfx/spritesys/DirectorActions.cpp
   trunk/ctp2_code/gfx/spritesys/EffectActor.cpp
   trunk/ctp2_code/gfx/spritesys/EffectActor.h
   trunk/ctp2_code/gfx/spritesys/EffectSpriteGroup.h
   trunk/ctp2_code/gfx/spritesys/FacedSprite.cpp
   trunk/ctp2_code/gfx/spritesys/FacedSprite.h
   trunk/ctp2_code/gfx/spritesys/FacedSpriteWshadow.cpp
   trunk/ctp2_code/gfx/spritesys/FacedSpriteWshadow.h
   trunk/ctp2_code/gfx/spritesys/GoodActor.h
   trunk/ctp2_code/gfx/spritesys/GoodSpriteGroup.h
   trunk/ctp2_code/gfx/spritesys/Sprite.cpp
   trunk/ctp2_code/gfx/spritesys/Sprite.h
   trunk/ctp2_code/gfx/spritesys/SpriteFile.h
   trunk/ctp2_code/gfx/spritesys/SpriteGroup.cpp
   trunk/ctp2_code/gfx/spritesys/SpriteGroup.h
   trunk/ctp2_code/gfx/spritesys/SpriteGroupList.cpp
   trunk/ctp2_code/gfx/spritesys/SpriteGroupList.h
   trunk/ctp2_code/gfx/spritesys/SpriteHitTest.cpp
   trunk/ctp2_code/gfx/spritesys/SpriteList.cpp
   trunk/ctp2_code/gfx/spritesys/SpriteList.h
   trunk/ctp2_code/gfx/spritesys/SpriteLow555.cpp
   trunk/ctp2_code/gfx/spritesys/SpriteLow565.cpp
   trunk/ctp2_code/gfx/spritesys/SpriteState.h
   trunk/ctp2_code/gfx/spritesys/SpriteStateDB.cpp
   trunk/ctp2_code/gfx/spritesys/SpriteStateDB.h
   trunk/ctp2_code/gfx/spritesys/TradeActor.cpp
   trunk/ctp2_code/gfx/spritesys/TradeActor.h
   trunk/ctp2_code/gfx/spritesys/UnitActor.cpp
   trunk/ctp2_code/gfx/spritesys/UnitActor.h
   trunk/ctp2_code/gfx/spritesys/UnitSpriteGroup.cpp
   trunk/ctp2_code/gfx/spritesys/UnitSpriteGroup.h
   trunk/ctp2_code/gfx/spritesys/action.cpp
   trunk/ctp2_code/gfx/spritesys/battleviewactor.cpp
   trunk/ctp2_code/gfx/spritesys/battleviewactor.h
   trunk/ctp2_code/gfx/spritesys/director.cpp
   trunk/ctp2_code/gfx/spritesys/director.h
   trunk/ctp2_code/gfx/spritesys/directoractions.h
   trunk/ctp2_code/gfx/spritesys/directorevent.cpp
   trunk/ctp2_code/gfx/spritesys/effectspritegroup.cpp
   trunk/ctp2_code/gfx/spritesys/goodactor.cpp
   trunk/ctp2_code/gfx/spritesys/goodspritegroup.cpp
   trunk/ctp2_code/gfx/spritesys/screenmanager.cpp
   trunk/ctp2_code/gfx/spritesys/screenmanager.h
   trunk/ctp2_code/gfx/spritesys/spritefile.cpp
   trunk/ctp2_code/gfx/spritesys/spritelow.cpp
   trunk/ctp2_code/gfx/spritesys/spriteutils.cpp
   trunk/ctp2_code/gfx/spritesys/spriteutils.h
   trunk/ctp2_code/gfx/spritesys/workeractor.cpp
   trunk/ctp2_code/gfx/spritesys/workeractor.h
   trunk/ctp2_code/gfx/tilesys/BaseTile.cpp
   trunk/ctp2_code/gfx/tilesys/BaseTile.h
   trunk/ctp2_code/gfx/tilesys/TileDrawRoad.h
   trunk/ctp2_code/gfx/tilesys/TileHighlight.cpp
   trunk/ctp2_code/gfx/tilesys/TileInfo.cpp
   trunk/ctp2_code/gfx/tilesys/TileInfo.h
   trunk/ctp2_code/gfx/tilesys/maputils.cpp
   trunk/ctp2_code/gfx/tilesys/maputils.h
   trunk/ctp2_code/gfx/tilesys/resourcemap.cpp
   trunk/ctp2_code/gfx/tilesys/resourcemap.h
   trunk/ctp2_code/gfx/tilesys/tiledmap.cpp
   trunk/ctp2_code/gfx/tilesys/tiledmap.h
   trunk/ctp2_code/gfx/tilesys/tiledraw.cpp
   trunk/ctp2_code/gfx/tilesys/tiledrawroad.cpp
   trunk/ctp2_code/gfx/tilesys/tileset.cpp
   trunk/ctp2_code/gfx/tilesys/tileset.h
   trunk/ctp2_code/gfx/tilesys/tileutils.cpp
   trunk/ctp2_code/gfx/tilesys/tileutils.h
   trunk/ctp2_code/gfx/tilesys/workmap.cpp
   trunk/ctp2_code/gfx/tilesys/workmap.h
   trunk/ctp2_code/gs/database/DB.cpp
   trunk/ctp2_code/gs/database/DB.h
   trunk/ctp2_code/gs/database/EndGameDB.cpp
   trunk/ctp2_code/gs/database/EndGameRecord.cpp
   trunk/ctp2_code/gs/database/EndGameRecord.h
   trunk/ctp2_code/gs/database/EndGameToken.h
   trunk/ctp2_code/gs/database/PlayListDB.cpp
   trunk/ctp2_code/gs/database/PlayListDB.h
   trunk/ctp2_code/gs/database/Rec.cpp
   trunk/ctp2_code/gs/database/Rec.h
   trunk/ctp2_code/gs/database/StrDB.cpp
   trunk/ctp2_code/gs/database/StrDB.h
   trunk/ctp2_code/gs/database/StrRec.cpp
   trunk/ctp2_code/gs/database/StrRec.h
   trunk/ctp2_code/gs/database/UVDB.cpp
   trunk/ctp2_code/gs/database/UVDB.h
   trunk/ctp2_code/gs/database/UVRecord.cpp
   trunk/ctp2_code/gs/database/UVRecord.h
   trunk/ctp2_code/gs/database/dbtypes.h
   trunk/ctp2_code/gs/database/filenamedb.cpp
   trunk/ctp2_code/gs/database/filenamedb.h
   trunk/ctp2_code/gs/database/highscoredb.cpp
   trunk/ctp2_code/gs/database/moviedb.cpp
   trunk/ctp2_code/gs/database/moviedb.h
   trunk/ctp2_code/gs/database/profileDB.cpp
   trunk/ctp2_code/gs/database/profileDB.h
   trunk/ctp2_code/gs/database/thronedb.cpp
   trunk/ctp2_code/gs/database/thronedb.h
   trunk/ctp2_code/gs/dbgen/Datum.cpp
   trunk/ctp2_code/gs/dbgen/Datum.h
   trunk/ctp2_code/gs/dbgen/MemberClass.cpp
   trunk/ctp2_code/gs/dbgen/MemberClass.h
   trunk/ctp2_code/gs/dbgen/RecordDescription.cpp
   trunk/ctp2_code/gs/dbgen/RecordDescription.h
   trunk/ctp2_code/gs/dbgen/ctpdb.cpp
   trunk/ctp2_code/gs/dbgen/ctpdb.h
   trunk/ctp2_code/gs/dbgen/ctpdb.y
   trunk/ctp2_code/gs/events/GameEvent.cpp
   trunk/ctp2_code/gs/events/GameEvent.h
   trunk/ctp2_code/gs/events/GameEventArgList.cpp
   trunk/ctp2_code/gs/events/GameEventArgList.h
   trunk/ctp2_code/gs/events/GameEventArgument.cpp
   trunk/ctp2_code/gs/events/GameEventDescription.cpp
   trunk/ctp2_code/gs/events/GameEventDescription.h
   trunk/ctp2_code/gs/events/GameEventHook.cpp
   trunk/ctp2_code/gs/events/GameEventHook.h
   trunk/ctp2_code/gs/events/GameEventManager.cpp
   trunk/ctp2_code/gs/events/GameEventManager.h
   trunk/ctp2_code/gs/events/GameEventTypes.h
   trunk/ctp2_code/gs/events/GameEventUser.h
   trunk/ctp2_code/gs/fileio/CivPaths.cpp
   trunk/ctp2_code/gs/fileio/CivPaths.h
   trunk/ctp2_code/gs/fileio/GameFile.cpp
   trunk/ctp2_code/gs/fileio/StartingPosition.h
   trunk/ctp2_code/gs/fileio/Token.cpp
   trunk/ctp2_code/gs/fileio/Token.h
   trunk/ctp2_code/gs/fileio/civscenarios.cpp
   trunk/ctp2_code/gs/fileio/civscenarios.h
   trunk/ctp2_code/gs/fileio/gamefile.h
   trunk/ctp2_code/gs/fileio/prjfile.cpp
   trunk/ctp2_code/gs/fileio/prjfile.h
   trunk/ctp2_code/gs/gameobj/AchievementTracker.cpp
   trunk/ctp2_code/gs/gameobj/AchievementTracker.h
   trunk/ctp2_code/gs/gameobj/Advances.cpp
   trunk/ctp2_code/gs/gameobj/Advances.h
   trunk/ctp2_code/gs/gameobj/Agreement.cpp
   trunk/ctp2_code/gs/gameobj/Agreement.h
   trunk/ctp2_code/gs/gameobj/AgreementData.cpp
   trunk/ctp2_code/gs/gameobj/AgreementData.h
   trunk/ctp2_code/gs/gameobj/AgreementPool.cpp
   trunk/ctp2_code/gs/gameobj/AgreementPool.h
   trunk/ctp2_code/gs/gameobj/AgreementTypes.h
   trunk/ctp2_code/gs/gameobj/Army.cpp
   trunk/ctp2_code/gs/gameobj/Army.h
   trunk/ctp2_code/gs/gameobj/ArmyData.cpp
   trunk/ctp2_code/gs/gameobj/ArmyData.h
   trunk/ctp2_code/gs/gameobj/ArmyPool.cpp
   trunk/ctp2_code/gs/gameobj/ArmyPool.h
   trunk/ctp2_code/gs/gameobj/Barbarians.h
   trunk/ctp2_code/gs/gameobj/BldQue.h
   trunk/ctp2_code/gs/gameobj/CTP2Combat.cpp
   trunk/ctp2_code/gs/gameobj/CTP2Combat.h
   trunk/ctp2_code/gs/gameobj/CityData.cpp
   trunk/ctp2_code/gs/gameobj/CityEvent.cpp
   trunk/ctp2_code/gs/gameobj/CityInfluenceIterator.cpp
   trunk/ctp2_code/gs/gameobj/CityInfluenceIterator.h
   trunk/ctp2_code/gs/gameobj/CityRadius.cpp
   trunk/ctp2_code/gs/gameobj/CityRadius.h
   trunk/ctp2_code/gs/gameobj/Civilisation.cpp
   trunk/ctp2_code/gs/gameobj/Civilisation.h
   trunk/ctp2_code/gs/gameobj/CivilisationData.cpp
   trunk/ctp2_code/gs/gameobj/CivilisationData.h
   trunk/ctp2_code/gs/gameobj/CivilisationPool.h
   trunk/ctp2_code/gs/gameobj/CreateUnit.h
   trunk/ctp2_code/gs/gameobj/CriticalMessagesPrefs.cpp
   trunk/ctp2_code/gs/gameobj/CriticalMessagesPrefs.h
   trunk/ctp2_code/gs/gameobj/Diffcly.cpp
   trunk/ctp2_code/gs/gameobj/Diffcly.h
   trunk/ctp2_code/gs/gameobj/DiplomacyOffer.h
   trunk/ctp2_code/gs/gameobj/Diplomacy_Log.cpp
   trunk/ctp2_code/gs/gameobj/Diplomacy_Log.h
   trunk/ctp2_code/gs/gameobj/DiplomaticRequest.cpp
   trunk/ctp2_code/gs/gameobj/DiplomaticRequest.h
   trunk/ctp2_code/gs/gameobj/DiplomaticRequestData.cpp
   trunk/ctp2_code/gs/gameobj/DiplomaticRequestData.h
   trunk/ctp2_code/gs/gameobj/DiplomaticRequestPool.cpp
   trunk/ctp2_code/gs/gameobj/DiplomaticRequestPool.h
   trunk/ctp2_code/gs/gameobj/DiplomaticTypes.h
   trunk/ctp2_code/gs/gameobj/EmptyTile.cpp
   trunk/ctp2_code/gs/gameobj/EmptyTile.h
   trunk/ctp2_code/gs/gameobj/EndGame.h
   trunk/ctp2_code/gs/gameobj/EventTracker.cpp
   trunk/ctp2_code/gs/gameobj/EventTracker.h
   trunk/ctp2_code/gs/gameobj/Events.cpp
   trunk/ctp2_code/gs/gameobj/Exclusions.cpp
   trunk/ctp2_code/gs/gameobj/Exclusions.h
   trunk/ctp2_code/gs/gameobj/FeatTracker.cpp
   trunk/ctp2_code/gs/gameobj/FeatTracker.h
   trunk/ctp2_code/gs/gameobj/GSLogs.cpp
   trunk/ctp2_code/gs/gameobj/GSLogs.h
   trunk/ctp2_code/gs/gameobj/GameObj.cpp
   trunk/ctp2_code/gs/gameobj/GameObj.h
   trunk/ctp2_code/gs/gameobj/GameObj_types.h
   trunk/ctp2_code/gs/gameobj/GameOver.h
   trunk/ctp2_code/gs/gameobj/GameSettings.cpp
   trunk/ctp2_code/gs/gameobj/GameSettings.h
   trunk/ctp2_code/gs/gameobj/Gold.cpp
   trunk/ctp2_code/gs/gameobj/Gold.h
   trunk/ctp2_code/gs/gameobj/GoodyHuts.cpp
   trunk/ctp2_code/gs/gameobj/GoodyHuts.h
   trunk/ctp2_code/gs/gameobj/Happy.cpp
   trunk/ctp2_code/gs/gameobj/Happy.h
   trunk/ctp2_code/gs/gameobj/HappyTracker.h
   trunk/ctp2_code/gs/gameobj/ID.cpp
   trunk/ctp2_code/gs/gameobj/ID.h
   trunk/ctp2_code/gs/gameobj/LineDance.cpp
   trunk/ctp2_code/gs/gameobj/LineDance.h
   trunk/ctp2_code/gs/gameobj/MaterialPool.cpp
   trunk/ctp2_code/gs/gameobj/Message.cpp
   trunk/ctp2_code/gs/gameobj/MessageData.h
   trunk/ctp2_code/gs/gameobj/MessagePool.cpp
   trunk/ctp2_code/gs/gameobj/MessagePool.h
   trunk/ctp2_code/gs/gameobj/ObjPool.cpp
   trunk/ctp2_code/gs/gameobj/ObjPool.h
   trunk/ctp2_code/gs/gameobj/Order.cpp
   trunk/ctp2_code/gs/gameobj/Order.h
   trunk/ctp2_code/gs/gameobj/PlayHap.cpp
   trunk/ctp2_code/gs/gameobj/PlayHap.h
   trunk/ctp2_code/gs/gameobj/Player.cpp
   trunk/ctp2_code/gs/gameobj/PlayerEvent.cpp
   trunk/ctp2_code/gs/gameobj/PlayerTurn.cpp
   trunk/ctp2_code/gs/gameobj/Pollution.cpp
   trunk/ctp2_code/gs/gameobj/PollutionConst.h
   trunk/ctp2_code/gs/gameobj/Readiness.cpp
   trunk/ctp2_code/gs/gameobj/Readiness.h
   trunk/ctp2_code/gs/gameobj/Regard.cpp
   trunk/ctp2_code/gs/gameobj/Regard.h
   trunk/ctp2_code/gs/gameobj/Resources.cpp
   trunk/ctp2_code/gs/gameobj/Resources.h
   trunk/ctp2_code/gs/gameobj/Sci.cpp
   trunk/ctp2_code/gs/gameobj/Sci.h
   trunk/ctp2_code/gs/gameobj/Score.cpp
   trunk/ctp2_code/gs/gameobj/Score.h
   trunk/ctp2_code/gs/gameobj/Strengths.cpp
   trunk/ctp2_code/gs/gameobj/TaxRate.cpp
   trunk/ctp2_code/gs/gameobj/TaxRate.h
   trunk/ctp2_code/gs/gameobj/TerrImprove.h
   trunk/ctp2_code/gs/gameobj/TerrImproveData.cpp
   trunk/ctp2_code/gs/gameobj/TerrImproveData.h
   trunk/ctp2_code/gs/gameobj/TerrImprovePool.cpp
   trunk/ctp2_code/gs/gameobj/TerrImprovePool.h
   trunk/ctp2_code/gs/gameobj/TileVal.h
   trunk/ctp2_code/gs/gameobj/TopTen.cpp
   trunk/ctp2_code/gs/gameobj/TopTen.h
   trunk/ctp2_code/gs/gameobj/TradeBids.cpp
   trunk/ctp2_code/gs/gameobj/TradeBids.h
   trunk/ctp2_code/gs/gameobj/TradeOffer.cpp
   trunk/ctp2_code/gs/gameobj/TradeOffer.h
   trunk/ctp2_code/gs/gameobj/TradeOfferData.cpp
   trunk/ctp2_code/gs/gameobj/TradeOfferData.h
   trunk/ctp2_code/gs/gameobj/TradeOfferPool.cpp
   trunk/ctp2_code/gs/gameobj/TradeOfferPool.h
   trunk/ctp2_code/gs/gameobj/TradePool.cpp
   trunk/ctp2_code/gs/gameobj/TradePool.h
   trunk/ctp2_code/gs/gameobj/TradeRoute.cpp
   trunk/ctp2_code/gs/gameobj/TradeRoute.h
   trunk/ctp2_code/gs/gameobj/TradeRouteData.cpp
   trunk/ctp2_code/gs/gameobj/TradeRouteData.h
   trunk/ctp2_code/gs/gameobj/Unit.cpp
   trunk/ctp2_code/gs/gameobj/Unit.h
   trunk/ctp2_code/gs/gameobj/UnitData.cpp
   trunk/ctp2_code/gs/gameobj/UnitData.h
   trunk/ctp2_code/gs/gameobj/UnitPool.cpp
   trunk/ctp2_code/gs/gameobj/UnitPool.h
   trunk/ctp2_code/gs/gameobj/UnitTypes.h
   trunk/ctp2_code/gs/gameobj/UnoccupiedTiles.cpp
   trunk/ctp2_code/gs/gameobj/UnoccupiedTiles.h
   trunk/ctp2_code/gs/gameobj/Vision.cpp
   trunk/ctp2_code/gs/gameobj/Vision.h
   trunk/ctp2_code/gs/gameobj/WonderTracker.cpp
   trunk/ctp2_code/gs/gameobj/WonderTracker.h
   trunk/ctp2_code/gs/gameobj/Wormhole.cpp
   trunk/ctp2_code/gs/gameobj/Wormhole.h
   trunk/ctp2_code/gs/gameobj/XY_Coordinates.cpp
   trunk/ctp2_code/gs/gameobj/XY_Coordinates.h
   trunk/ctp2_code/gs/gameobj/advanceutil.cpp
   trunk/ctp2_code/gs/gameobj/advanceutil.h
   trunk/ctp2_code/gs/gameobj/armyevent.cpp
   trunk/ctp2_code/gs/gameobj/barbarians.cpp
   trunk/ctp2_code/gs/gameobj/bldque.cpp
   trunk/ctp2_code/gs/gameobj/buildingutil.cpp
   trunk/ctp2_code/gs/gameobj/buildingutil.h
   trunk/ctp2_code/gs/gameobj/citydata.h
   trunk/ctp2_code/gs/gameobj/civilisationpool.cpp
   trunk/ctp2_code/gs/gameobj/combatevent.cpp
   trunk/ctp2_code/gs/gameobj/combatevent.h
   trunk/ctp2_code/gs/gameobj/endgame.cpp
   trunk/ctp2_code/gs/gameobj/gaiacontroller.cpp
   trunk/ctp2_code/gs/gameobj/gaiacontroller.h
   trunk/ctp2_code/gs/gameobj/happytracker.cpp
   trunk/ctp2_code/gs/gameobj/improvementevent.cpp
   trunk/ctp2_code/gs/gameobj/installation.cpp
   trunk/ctp2_code/gs/gameobj/installation.h
   trunk/ctp2_code/gs/gameobj/installationdata.cpp
   trunk/ctp2_code/gs/gameobj/installationdata.h
   trunk/ctp2_code/gs/gameobj/installationpool.cpp
   trunk/ctp2_code/gs/gameobj/installationpool.h
   trunk/ctp2_code/gs/gameobj/message.h
   trunk/ctp2_code/gs/gameobj/messagedata.cpp
   trunk/ctp2_code/gs/gameobj/player.h
   trunk/ctp2_code/gs/gameobj/pollution.h
   trunk/ctp2_code/gs/gameobj/terrainutil.cpp
   trunk/ctp2_code/gs/gameobj/terrainutil.h
   trunk/ctp2_code/gs/gameobj/tradeevent.cpp
   trunk/ctp2_code/gs/gameobj/tradeevent.h
   trunk/ctp2_code/gs/gameobj/tradeutil.cpp
   trunk/ctp2_code/gs/gameobj/tradeutil.h
   trunk/ctp2_code/gs/gameobj/unitevent.cpp
   trunk/ctp2_code/gs/gameobj/unitutil.cpp
   trunk/ctp2_code/gs/gameobj/unitutil.h
   trunk/ctp2_code/gs/gameobj/wonderutil.cpp
   trunk/ctp2_code/gs/gameobj/wonderutil.h
   trunk/ctp2_code/gs/newdb/CTPDatabase.cpp
   trunk/ctp2_code/gs/newdb/CTPDatabase.h
   trunk/ctp2_code/gs/newdb/CTPRecord.cpp
   trunk/ctp2_code/gs/newdb/CTPRecord.h
   trunk/ctp2_code/gs/newdb/DBLexer.cpp
   trunk/ctp2_code/gs/newdb/DBLexer.h
   trunk/ctp2_code/gs/newdb/DBLexer.l
   trunk/ctp2_code/gs/newdb/DBTokens.h
   trunk/ctp2_code/gs/outcom/AICause.h
   trunk/ctp2_code/gs/outcom/AiMapSettle.cpp
   trunk/ctp2_code/gs/outcom/C3BlgDB.cpp
   trunk/ctp2_code/gs/outcom/C3BlgDB.h
   trunk/ctp2_code/gs/outcom/C3DipReq.cpp
   trunk/ctp2_code/gs/outcom/C3DipReq.h
   trunk/ctp2_code/gs/outcom/C3ErrorReport.cpp
   trunk/ctp2_code/gs/outcom/C3ErrorReport.h
   trunk/ctp2_code/gs/outcom/C3GameState.cpp
   trunk/ctp2_code/gs/outcom/C3GameState.h
   trunk/ctp2_code/gs/outcom/C3Government.cpp
   trunk/ctp2_code/gs/outcom/C3Government.h
   trunk/ctp2_code/gs/outcom/C3InstDB.cpp
   trunk/ctp2_code/gs/outcom/C3InstDB.h
   trunk/ctp2_code/gs/outcom/C3Player.cpp
   trunk/ctp2_code/gs/outcom/C3Player.h
   trunk/ctp2_code/gs/outcom/C3Population.cpp
   trunk/ctp2_code/gs/outcom/C3Population.h
   trunk/ctp2_code/gs/outcom/C3Rand.h
   trunk/ctp2_code/gs/outcom/C3Robot.h
   trunk/ctp2_code/gs/outcom/C3Science.cpp
   trunk/ctp2_code/gs/outcom/C3Science.h
   trunk/ctp2_code/gs/outcom/C3String.cpp
   trunk/ctp2_code/gs/outcom/C3String.h
   trunk/ctp2_code/gs/outcom/C3TerrDB.cpp
   trunk/ctp2_code/gs/outcom/C3TerrDB.h
   trunk/ctp2_code/gs/outcom/C3Trade.cpp
   trunk/ctp2_code/gs/outcom/C3Trade.h
   trunk/ctp2_code/gs/outcom/C3UnitDB.cpp
   trunk/ctp2_code/gs/outcom/C3UnitDB.h
   trunk/ctp2_code/gs/outcom/C3Wonder.cpp
   trunk/ctp2_code/gs/outcom/C3Wonder.h
   trunk/ctp2_code/gs/outcom/C3World.cpp
   trunk/ctp2_code/gs/outcom/C3World.h
   trunk/ctp2_code/gs/outcom/IC3BlgDB.h
   trunk/ctp2_code/gs/outcom/IC3DipReq.h
   trunk/ctp2_code/gs/outcom/IC3ErrorReport.h
   trunk/ctp2_code/gs/outcom/IC3GameState.h
   trunk/ctp2_code/gs/outcom/IC3Government.h
   trunk/ctp2_code/gs/outcom/IC3InstDB.h
   trunk/ctp2_code/gs/outcom/IC3Player.h
   trunk/ctp2_code/gs/outcom/IC3Population.h
   trunk/ctp2_code/gs/outcom/IC3Rand.h
   trunk/ctp2_code/gs/outcom/IC3RobotAstar.h
   trunk/ctp2_code/gs/outcom/IC3Science.h
   trunk/ctp2_code/gs/outcom/IC3String.h
   trunk/ctp2_code/gs/outcom/IC3TerrDB.h
   trunk/ctp2_code/gs/outcom/IC3Trade.h
   trunk/ctp2_code/gs/outcom/IC3UnitDB.h
   trunk/ctp2_code/gs/outcom/IC3Wonder.h
   trunk/ctp2_code/gs/outcom/IC3World.h
   trunk/ctp2_code/gs/outcom/IMapPointData.h
   trunk/ctp2_code/gs/outcom/Ic3CivArchive.h
   trunk/ctp2_code/gs/outcom/c3endgamedb.cpp
   trunk/ctp2_code/gs/outcom/c3endgamedb.h
   trunk/ctp2_code/gs/outcom/c3rand.cpp
   trunk/ctp2_code/gs/outcom/c3robot.cpp
   trunk/ctp2_code/gs/outcom/ic3endgamedb.h
   trunk/ctp2_code/gs/slic/QuickSlic.cpp
   trunk/ctp2_code/gs/slic/SlicArray.cpp
   trunk/ctp2_code/gs/slic/SlicArray.h
   trunk/ctp2_code/gs/slic/SlicBuiltin.cpp
   trunk/ctp2_code/gs/slic/SlicBuiltin.h
   trunk/ctp2_code/gs/slic/SlicButton.cpp
   trunk/ctp2_code/gs/slic/SlicButton.h
   trunk/ctp2_code/gs/slic/SlicConditional.cpp
   trunk/ctp2_code/gs/slic/SlicConst.cpp
   trunk/ctp2_code/gs/slic/SlicContext.cpp
   trunk/ctp2_code/gs/slic/SlicContext.h
   trunk/ctp2_code/gs/slic/SlicDBConduit.h
   trunk/ctp2_code/gs/slic/SlicEngine.cpp
   trunk/ctp2_code/gs/slic/SlicEngine.h
   trunk/ctp2_code/gs/slic/SlicEyePoint.cpp
   trunk/ctp2_code/gs/slic/SlicEyePoint.h
   trunk/ctp2_code/gs/slic/SlicFrame.cpp
   trunk/ctp2_code/gs/slic/SlicFrame.h
   trunk/ctp2_code/gs/slic/SlicFunc.h
   trunk/ctp2_code/gs/slic/SlicModFuncEnum.h
   trunk/ctp2_code/gs/slic/SlicModFunction.cpp
   trunk/ctp2_code/gs/slic/SlicModFunction.h
   trunk/ctp2_code/gs/slic/SlicNamedSymbol.cpp
   trunk/ctp2_code/gs/slic/SlicNamedSymbol.h
   trunk/ctp2_code/gs/slic/SlicObject.h
   trunk/ctp2_code/gs/slic/SlicRecord.cpp
   trunk/ctp2_code/gs/slic/SlicRecord.h
   trunk/ctp2_code/gs/slic/SlicSegment.cpp
   trunk/ctp2_code/gs/slic/SlicSegment.h
   trunk/ctp2_code/gs/slic/SlicStack.cpp
   trunk/ctp2_code/gs/slic/SlicStack.h
   trunk/ctp2_code/gs/slic/SlicStruct.cpp
   trunk/ctp2_code/gs/slic/SlicStruct.h
   trunk/ctp2_code/gs/slic/SlicSymTab.cpp
   trunk/ctp2_code/gs/slic/SlicSymTab.h
   trunk/ctp2_code/gs/slic/SlicSymbol.cpp
   trunk/ctp2_code/gs/slic/SlicSymbol.h
   trunk/ctp2_code/gs/slic/StringHash.h
   trunk/ctp2_code/gs/slic/scyaccdefs.h
   trunk/ctp2_code/gs/slic/slic.l
   trunk/ctp2_code/gs/slic/slic.y
   trunk/ctp2_code/gs/slic/sliccmd.cpp
   trunk/ctp2_code/gs/slic/sliccmd.h
   trunk/ctp2_code/gs/slic/sliccmd.l
   trunk/ctp2_code/gs/slic/sliccmd.y
   trunk/ctp2_code/gs/slic/slicfunc.cpp
   trunk/ctp2_code/gs/slic/slicfuncai.cpp
   trunk/ctp2_code/gs/slic/slicfuncai.h
   trunk/ctp2_code/gs/slic/slicif.cpp
   trunk/ctp2_code/gs/slic/slicif.h
   trunk/ctp2_code/gs/slic/slicif_sym.h
   trunk/ctp2_code/gs/slic/slicobject.cpp
   trunk/ctp2_code/gs/utility/AgreementDynArr.cpp
   trunk/ctp2_code/gs/utility/AgreementDynArr.h
   trunk/ctp2_code/gs/utility/Checksum.h
   trunk/ctp2_code/gs/utility/CivDynArr.cpp
   trunk/ctp2_code/gs/utility/CivDynArr.h
   trunk/ctp2_code/gs/utility/DataCheck.cpp
   trunk/ctp2_code/gs/utility/DataCheck.h
   trunk/ctp2_code/gs/utility/DiplDynArr.cpp
   trunk/ctp2_code/gs/utility/DiplDynArr.h
   trunk/ctp2_code/gs/utility/ErrMsg.cpp
   trunk/ctp2_code/gs/utility/ErrMsg.h
   trunk/ctp2_code/gs/utility/Globals.h
   trunk/ctp2_code/gs/utility/MapFile.cpp
   trunk/ctp2_code/gs/utility/MapFile.h
   trunk/ctp2_code/gs/utility/MsgDynArr.cpp
   trunk/ctp2_code/gs/utility/MsgDynArr.h
   trunk/ctp2_code/gs/utility/PQueue.h
   trunk/ctp2_code/gs/utility/QuadTree.h
   trunk/ctp2_code/gs/utility/RandGen.cpp
   trunk/ctp2_code/gs/utility/RandGen.h
   trunk/ctp2_code/gs/utility/SimpleDynArr.h
   trunk/ctp2_code/gs/utility/TradeDynArr.cpp
   trunk/ctp2_code/gs/utility/TradeDynArr.h
   trunk/ctp2_code/gs/utility/TurnCnt.cpp
   trunk/ctp2_code/gs/utility/TurnCnt.h
   trunk/ctp2_code/gs/utility/TurnCntEvent.cpp
   trunk/ctp2_code/gs/utility/UnitDynArr.cpp
   trunk/ctp2_code/gs/utility/UnitDynArr.h
   trunk/ctp2_code/gs/utility/checksum.cpp
   trunk/ctp2_code/gs/utility/clock.cpp
   trunk/ctp2_code/gs/utility/clock.h
   trunk/ctp2_code/gs/utility/gameinit.cpp
   trunk/ctp2_code/gs/utility/gameinit.h
   trunk/ctp2_code/gs/utility/newturncount.cpp
   trunk/ctp2_code/gs/utility/newturncount.h
   trunk/ctp2_code/gs/utility/stringutils.cpp
   trunk/ctp2_code/gs/utility/stringutils.h
   trunk/ctp2_code/gs/world/Cell.cpp
   trunk/ctp2_code/gs/world/Cell.h
   trunk/ctp2_code/gs/world/MapPoint.cpp
   trunk/ctp2_code/gs/world/MapPoint.h
   trunk/ctp2_code/gs/world/UnseenCell.cpp
   trunk/ctp2_code/gs/world/UnseenCell.h
   trunk/ctp2_code/gs/world/UnseenCellQuadTree.h
   trunk/ctp2_code/gs/world/World.h
   trunk/ctp2_code/gs/world/WorldDistance.cpp
   trunk/ctp2_code/gs/world/WorldDistance.h
   trunk/ctp2_code/gs/world/WrlEnv.cpp
   trunk/ctp2_code/gs/world/WrlImprove.cpp
   trunk/ctp2_code/gs/world/WrlUnit.cpp
   trunk/ctp2_code/gs/world/WrldCity.cpp
   trunk/ctp2_code/gs/world/WrldCont.cpp
   trunk/ctp2_code/gs/world/WrldPoll.cpp
   trunk/ctp2_code/gs/world/cellunitlist.cpp
   trunk/ctp2_code/gs/world/cellunitlist.h
   trunk/ctp2_code/gs/world/wldgen.cpp
   trunk/ctp2_code/gs/world/worldevent.cpp
   trunk/ctp2_code/gs/world/worldevent.h
   trunk/ctp2_code/gs/world/worldutils.cpp
   trunk/ctp2_code/gs/world/worldutils.h
   trunk/ctp2_code/libs/anet/demo/band/band.c
   trunk/ctp2_code/libs/anet/demo/chat/chat.c
   trunk/ctp2_code/libs/anet/demo/chat/setupsrc/dsetup.h
   trunk/ctp2_code/libs/anet/demo/chat/setupsrc/resource.h
   trunk/ctp2_code/libs/anet/demo/crash/crash.c
   trunk/ctp2_code/libs/anet/demo/gtest/gtest.c
   trunk/ctp2_code/libs/anet/demo/java/exec.c
   trunk/ctp2_code/libs/anet/demo/porttest/test.c
   trunk/ctp2_code/libs/anet/demo/pvtest/pvtest.c
   trunk/ctp2_code/libs/anet/demo/stattest/stattest.c
   trunk/ctp2_code/libs/anet/demo/utils/assoctab.c
   trunk/ctp2_code/libs/anet/demo/utils/avgstat.c
   trunk/ctp2_code/libs/anet/demo/utils/avgstat.h
   trunk/ctp2_code/libs/anet/demo/utils/bad/unistd.h
   trunk/ctp2_code/libs/anet/demo/utils/dpcrc32.c
   trunk/ctp2_code/libs/anet/demo/utils/dpcrc32.h
   trunk/ctp2_code/libs/anet/demo/utils/dynatab.c
   trunk/ctp2_code/libs/anet/demo/utils/eclock.c
   trunk/ctp2_code/libs/anet/demo/utils/logpkt.c
   trunk/ctp2_code/libs/anet/demo/utils/logpkt.h
   trunk/ctp2_code/libs/anet/demo/utils/logprint.c
   trunk/ctp2_code/libs/anet/demo/utils/logprint.h
   trunk/ctp2_code/libs/anet/demo/utils/mywcs.c
   trunk/ctp2_code/libs/anet/demo/utils/mywcs.h
   trunk/ctp2_code/libs/anet/demo/utils/raw.c
   trunk/ctp2_code/libs/anet/demo/utils/raw.h
   trunk/ctp2_code/libs/anet/demo/utils/rawbsd.c
   trunk/ctp2_code/libs/anet/demo/utils/rawlin.c
   trunk/ctp2_code/libs/anet/demo/utils/rawmac.c
   trunk/ctp2_code/libs/anet/demo/utils/rawmsdos.c
   trunk/ctp2_code/libs/anet/demo/utils/rawsun.c
   trunk/ctp2_code/libs/anet/demo/utils/rawvms.c
   trunk/ctp2_code/libs/anet/demo/utils/rawwin.c
   trunk/ctp2_code/libs/anet/demo/utils/strdup.c
   trunk/ctp2_code/libs/anet/demo/utils/strdup.h
   trunk/ctp2_code/libs/anet/demo/utils/stricmp.c
   trunk/ctp2_code/libs/anet/demo/utils/stricmp.h
   trunk/ctp2_code/libs/anet/demo/utils/strlkup.c
   trunk/ctp2_code/libs/anet/demo/utils/strlkup.h
   trunk/ctp2_code/libs/anet/demo/utils/unistd.c
   trunk/ctp2_code/libs/anet/demo/utils/win32dirent.c
   trunk/ctp2_code/libs/anet/demo/utils/win32dirent.h
   trunk/ctp2_code/libs/anet/demo/utils/win32direntry.c
   trunk/ctp2_code/libs/anet/demo/utils/win32direntry.h
   trunk/ctp2_code/libs/anet/h/anet.h
   trunk/ctp2_code/libs/anet/h/aneterr.h
   trunk/ctp2_code/libs/anet/h/assoctab.h
   trunk/ctp2_code/libs/anet/h/commapi.h
   trunk/ctp2_code/libs/anet/h/commerr.h
   trunk/ctp2_code/libs/anet/h/contract.h
   trunk/ctp2_code/libs/anet/h/delay.h
   trunk/ctp2_code/libs/anet/h/dictset.h
   trunk/ctp2_code/libs/anet/h/dp.h
   trunk/ctp2_code/libs/anet/h/dp2.h
   trunk/ctp2_code/libs/anet/h/dpcompat.h
   trunk/ctp2_code/libs/anet/h/dpdll.h
   trunk/ctp2_code/libs/anet/h/dpexcept.h
   trunk/ctp2_code/libs/anet/h/dpio.h
   trunk/ctp2_code/libs/anet/h/dplang.h
   trunk/ctp2_code/libs/anet/h/dpmem.h
   trunk/ctp2_code/libs/anet/h/dppack1.h
   trunk/ctp2_code/libs/anet/h/dppackn.h
   trunk/ctp2_code/libs/anet/h/dppkt.h
   trunk/ctp2_code/libs/anet/h/dppv.h
   trunk/ctp2_code/libs/anet/h/dprint.h
   trunk/ctp2_code/libs/anet/h/dptab.h
   trunk/ctp2_code/libs/anet/h/dpturn.h
   trunk/ctp2_code/libs/anet/h/dpunpack.h
   trunk/ctp2_code/libs/anet/h/dynatab.h
   trunk/ctp2_code/libs/anet/h/eclock.h
   trunk/ctp2_code/libs/anet/h/enumapps.h
   trunk/ctp2_code/libs/anet/h/enumserv.h
   trunk/ctp2_code/libs/anet/h/hkeytab.h
   trunk/ctp2_code/libs/anet/h/ini.h
   trunk/ctp2_code/libs/anet/h/launchparams.h
   trunk/ctp2_code/libs/anet/h/portable.h
   trunk/ctp2_code/libs/anet/h/q.h
   trunk/ctp2_code/libs/anet/h/types.h
   trunk/ctp2_code/libs/anet/src/aeh/aeh.c
   trunk/ctp2_code/libs/anet/src/aeh/aeh.h
   trunk/ctp2_code/libs/anet/src/aeh/aehlog.c
   trunk/ctp2_code/libs/anet/src/aeh/aehlog.h
   trunk/ctp2_code/libs/anet/src/aeh/aehmap.c
   trunk/ctp2_code/libs/anet/src/aeh/analaeh/aehsplit.c
   trunk/ctp2_code/libs/anet/src/aeh/analaeh/analcrsh.c
   trunk/ctp2_code/libs/anet/src/aeh/analaeh/modcrc.c
   trunk/ctp2_code/libs/anet/src/aeh/analaeh/procserv.c
   trunk/ctp2_code/libs/anet/src/aeh/detect.c
   trunk/ctp2_code/libs/anet/src/aeh/detect.h
   trunk/ctp2_code/libs/anet/src/aeh/getdisp.c
   trunk/ctp2_code/libs/anet/src/aeh/getdisp.h
   trunk/ctp2_code/libs/anet/src/aeh/registry.c
   trunk/ctp2_code/libs/anet/src/aeh/registry.h
   trunk/ctp2_code/libs/anet/src/aeh/tlstuff.c
   trunk/ctp2_code/libs/anet/src/aeh/tlstuff.h
   trunk/ctp2_code/libs/anet/src/aeh/win4alt.h
   trunk/ctp2_code/libs/anet/src/antp/antp.h
   trunk/ctp2_code/libs/anet/src/antp/antpclnt.c
   trunk/ctp2_code/libs/anet/src/antp/antpget.c
   trunk/ctp2_code/libs/anet/src/antp/antpget.h
   trunk/ctp2_code/libs/anet/src/antp/antpserv.c
   trunk/ctp2_code/libs/anet/src/antp/antpserv.h
   trunk/ctp2_code/libs/anet/src/antp/antpservd.c
   trunk/ctp2_code/libs/anet/src/antp/checksys.c
   trunk/ctp2_code/libs/anet/src/bhttp/bhttp.c
   trunk/ctp2_code/libs/anet/src/bhttp/bhttp.h
   trunk/ctp2_code/libs/anet/src/bhttp/bhttpt.c
   trunk/ctp2_code/libs/anet/src/demo/client/client.c
   trunk/ctp2_code/libs/anet/src/demo/dpioecho/dpioecho.c
   trunk/ctp2_code/libs/anet/src/demo/iotest/iotest.c
   trunk/ctp2_code/libs/anet/src/demo/lnchtest/lnchtest.c
   trunk/ctp2_code/libs/anet/src/demo/rawtest/rawtest.c
   trunk/ctp2_code/libs/anet/src/demo/udptest/udpsink.c
   trunk/ctp2_code/libs/anet/src/demo/udptest/udpspew.c
   trunk/ctp2_code/libs/anet/src/doc/delay.c
   trunk/ctp2_code/libs/anet/src/doc/delay.h
   trunk/ctp2_code/libs/anet/src/dp/assoctab.c
   trunk/ctp2_code/libs/anet/src/dp/delay.c
   trunk/ctp2_code/libs/anet/src/dp/deltas.c
   trunk/ctp2_code/libs/anet/src/dp/dictset.c
   trunk/ctp2_code/libs/anet/src/dp/dp2.c
   trunk/ctp2_code/libs/anet/src/dp/dp2t1.c
   trunk/ctp2_code/libs/anet/src/dp/dp2t2.c
   trunk/ctp2_code/libs/anet/src/dp/dpexcept.c
   trunk/ctp2_code/libs/anet/src/dp/dpgroup.c
   trunk/ctp2_code/libs/anet/src/dp/dpgroup.h
   trunk/ctp2_code/libs/anet/src/dp/dpio.c
   trunk/ctp2_code/libs/anet/src/dp/dpprivy.c
   trunk/ctp2_code/libs/anet/src/dp/dpprivy.h
   trunk/ctp2_code/libs/anet/src/dp/dppv.c
   trunk/ctp2_code/libs/anet/src/dp/dprint.c
   trunk/ctp2_code/libs/anet/src/dp/dpscore.c
   trunk/ctp2_code/libs/anet/src/dp/dpshutdn.c
   trunk/ctp2_code/libs/anet/src/dp/dptab.c
   trunk/ctp2_code/libs/anet/src/dp/dpturn.c
   trunk/ctp2_code/libs/anet/src/dp/dpuser.c
   trunk/ctp2_code/libs/anet/src/dp/dynatab.c
   trunk/ctp2_code/libs/anet/src/dp/enumsrv2.c
   trunk/ctp2_code/libs/anet/src/dp/hkeytab.c
   trunk/ctp2_code/libs/anet/src/dp/ini.c
   trunk/ctp2_code/libs/anet/src/dp/launchparams.c
   trunk/ctp2_code/libs/anet/src/dp/ptimer.c
   trunk/ctp2_code/libs/anet/src/dp/ptimer.h
   trunk/ctp2_code/libs/anet/src/dp/q.c
   trunk/ctp2_code/libs/anet/src/java/Activision/anetj.c
   trunk/ctp2_code/libs/anet/src/linux/dp/dpdll.c
   trunk/ctp2_code/libs/anet/src/linux/dp/dpmem.c
   trunk/ctp2_code/libs/anet/src/linux/dp/enumapp.c
   trunk/ctp2_code/libs/anet/src/linux/dp/launchap.c
   trunk/ctp2_code/libs/anet/src/linux/runsrvfil/runsrvfil.c
   trunk/ctp2_code/libs/anet/src/linux/server/server.c
   trunk/ctp2_code/libs/anet/src/linux/server/servlet.c
   trunk/ctp2_code/libs/anet/src/linux/server/servpw.c
   trunk/ctp2_code/libs/anet/src/linux/server/servpw.h
   trunk/ctp2_code/libs/anet/src/linux/server/servscor.c
   trunk/ctp2_code/libs/anet/src/linux/server/servscor.h
   trunk/ctp2_code/libs/anet/src/linux/uudp/uudps.c
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_APIs/binderyapi.c
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_APIs/ipxapi.c
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_APIs/sapapi.c
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_APIs/spxapi.c
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/bindery.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/binderypb.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/common_resource_defs.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/ipxcalls.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/ipxerror.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/ipxpb.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/lap_error.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/lap_if.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/rip.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/sap.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/sap_internal.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/sappb.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/spxcalls.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/spxerror.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/spxpb.h
   trunk/ctp2_code/libs/anet/src/mac/3rdparty/macipx13/MacIPX_includes/wds.h
   trunk/ctp2_code/libs/anet/src/mac/AppleTalk/AppleTalkDDP.c
   trunk/ctp2_code/libs/anet/src/mac/AppleTalk/AppleTalkDDP.h
   trunk/ctp2_code/libs/anet/src/mac/AppleTalk/Atalkdll.c
   trunk/ctp2_code/libs/anet/src/mac/AppleTalk/atalkdll.h
   trunk/ctp2_code/libs/anet/src/mac/dp/LoadTransport.h
   trunk/ctp2_code/libs/anet/src/mac/dp/dpdll.c
   trunk/ctp2_code/libs/anet/src/mac/dp/enumapp.c
   trunk/ctp2_code/libs/anet/src/mac/dp/exitapp.c
   trunk/ctp2_code/libs/anet/src/mac/dp/launchap.c
   trunk/ctp2_code/libs/anet/src/mac/dp/loadtransport.c
   trunk/ctp2_code/libs/anet/src/mac/dp/macapp.c
   trunk/ctp2_code/libs/anet/src/mac/dp/macapp.h
   trunk/ctp2_code/libs/anet/src/mac/h/ddprint.h
   trunk/ctp2_code/libs/anet/src/mac/h/macsystemcode.h
   trunk/ctp2_code/libs/anet/src/mac/h/transportutils.h
   trunk/ctp2_code/libs/anet/src/mac/h/util.h
   trunk/ctp2_code/libs/anet/src/mac/main/MW2TransportMain.cpp
   trunk/ctp2_code/libs/anet/src/mac/main/MW2TransportMain.h
   trunk/ctp2_code/libs/anet/src/mac/main/MacDPRINT.c
   trunk/ctp2_code/libs/anet/src/mac/main/MacMem.c
   trunk/ctp2_code/libs/anet/src/mac/main/MacMem.h
   trunk/ctp2_code/libs/anet/src/mac/main/OTDDP3.c
   trunk/ctp2_code/libs/anet/src/mac/main/OTDDP3.h
   trunk/ctp2_code/libs/anet/src/mac/main/OTUtils.c
   trunk/ctp2_code/libs/anet/src/mac/main/OTUtils.h
   trunk/ctp2_code/libs/anet/src/mac/main/TransportUtils.c
   trunk/ctp2_code/libs/anet/src/mac/main/macdll.c
   trunk/ctp2_code/libs/anet/src/mac/main/macdll.h
   trunk/ctp2_code/libs/anet/src/mac/main/otq.c
   trunk/ctp2_code/libs/anet/src/mac/main/otq.h
   trunk/ctp2_code/libs/anet/src/mac/minet/EnterNewAddress.c
   trunk/ctp2_code/libs/anet/src/mac/minet/HostDialog.c
   trunk/ctp2_code/libs/anet/src/mac/minet/HostDialog.h
   trunk/ctp2_code/libs/anet/src/mac/minet/inethead.h
   trunk/ctp2_code/libs/anet/src/mac/minet/otudp.c
   trunk/ctp2_code/libs/anet/src/mac/minet/otudp.h
   trunk/ctp2_code/libs/anet/src/mac/minet/trumpdll.c
   trunk/ctp2_code/libs/anet/src/mac/minet/trumpdll.h
   trunk/ctp2_code/libs/anet/src/mac/minet/trumpudp.c
   trunk/ctp2_code/libs/anet/src/mac/minet/trumpudp.h
   trunk/ctp2_code/libs/anet/src/mac/minets/EnterNewAddress.c
   trunk/ctp2_code/libs/anet/src/mac/minets/HostDialog.c
   trunk/ctp2_code/libs/anet/src/mac/minets/HostDialog.h
   trunk/ctp2_code/libs/anet/src/mac/minets/inethead.h
   trunk/ctp2_code/libs/anet/src/mac/minets/mstcp.c
   trunk/ctp2_code/libs/anet/src/mac/minets/mstcp.h
   trunk/ctp2_code/libs/anet/src/mac/minets/mstcpdll.c
   trunk/ctp2_code/libs/anet/src/mac/minets/mstcpdll.h
   trunk/ctp2_code/libs/anet/src/mac/minets/mstcplow.c
   trunk/ctp2_code/libs/anet/src/mac/minets/mstcplow.h
   trunk/ctp2_code/libs/anet/src/mac/minets/otudp.c
   trunk/ctp2_code/libs/anet/src/mac/minets/otudp.h
   trunk/ctp2_code/libs/anet/src/mac/mipx/Ipx2dll.c
   trunk/ctp2_code/libs/anet/src/mac/mipx/IpxTransport.h
   trunk/ctp2_code/libs/anet/src/mac/mipx/Ipxq.c
   trunk/ctp2_code/libs/anet/src/mac/mipx/ipx2.c
   trunk/ctp2_code/libs/anet/src/mac/mipx/ipx2.h
   trunk/ctp2_code/libs/anet/src/mac/mipx/ipxhead.h
   trunk/ctp2_code/libs/anet/src/mac/mmodem/CTBStuff.c
   trunk/ctp2_code/libs/anet/src/mac/mmodem/CTBStuff.h
   trunk/ctp2_code/libs/anet/src/mac/mmodem/GCLHack.c
   trunk/ctp2_code/libs/anet/src/mac/mmodem/GCLHack.h
   trunk/ctp2_code/libs/anet/src/mac/mmodem/LoadGlobalFrag.c
   trunk/ctp2_code/libs/anet/src/mac/mmodem/LoadGlobalFrag.h
   trunk/ctp2_code/libs/anet/src/mac/mmodem/PrefsStuff.c
   trunk/ctp2_code/libs/anet/src/mac/mmodem/PrefsStuff.h
   trunk/ctp2_code/libs/anet/src/mac/mmodem/modemhead.h
   trunk/ctp2_code/libs/anet/src/mac/mserial/CTBUtils.c
   trunk/ctp2_code/libs/anet/src/mac/mserial/CTBUtils.h
   trunk/ctp2_code/libs/anet/src/mac/mserial/CommCTB.c
   trunk/ctp2_code/libs/anet/src/mac/mserial/CommCTB.h
   trunk/ctp2_code/libs/anet/src/mac/mserial/CreateRes.c
   trunk/ctp2_code/libs/anet/src/mac/mserial/CreateRes.h
   trunk/ctp2_code/libs/anet/src/mac/stub/anetstub.c
   trunk/ctp2_code/libs/anet/src/sbd/sbd.h
   trunk/ctp2_code/libs/anet/src/sbd/sbdclnt.c
   trunk/ctp2_code/libs/anet/src/sbd/sbdclnt.h
   trunk/ctp2_code/libs/anet/src/sbd/sbdserv.c
   trunk/ctp2_code/libs/anet/src/sbd/sbdserv.h
   trunk/ctp2_code/libs/anet/src/sbd/sbdtestc.c
   trunk/ctp2_code/libs/anet/src/sbd/sbdtests.c
   trunk/ctp2_code/libs/anet/src/score/Activision/jscore2.c
   trunk/ctp2_code/libs/anet/src/score/scordump.c
   trunk/ctp2_code/libs/anet/src/score/scorerep.c
   trunk/ctp2_code/libs/anet/src/score/scorerep.h
   trunk/ctp2_code/libs/anet/src/score/scorerept.c
   trunk/ctp2_code/libs/anet/src/score/scorsend.c
   trunk/ctp2_code/libs/anet/src/score/sq.c
   trunk/ctp2_code/libs/anet/src/score/sq.h
   trunk/ctp2_code/libs/anet/src/score/sqdump.c
   trunk/ctp2_code/libs/anet/src/score/wmq.c
   trunk/ctp2_code/libs/anet/src/score/wmq.h
   trunk/ctp2_code/libs/anet/src/score/wmq2mysql.c
   trunk/ctp2_code/libs/anet/src/score/wmqdump.c
   trunk/ctp2_code/libs/anet/src/score/wmqfile.c
   trunk/ctp2_code/libs/anet/src/score/wmqfile.h
   trunk/ctp2_code/libs/anet/src/score/wmqmerge.c
   trunk/ctp2_code/libs/anet/src/score/wmqt.c
   trunk/ctp2_code/libs/anet/src/tca/aassoctab.h
   trunk/ctp2_code/libs/anet/src/tca/acctserv.c
   trunk/ctp2_code/libs/anet/src/tca/acctserv.h
   trunk/ctp2_code/libs/anet/src/tca/acctservd.c
   trunk/ctp2_code/libs/anet/src/tca/crypttab.c
   trunk/ctp2_code/libs/anet/src/tca/crypttab.h
   trunk/ctp2_code/libs/anet/src/tca/dbmod.c
   trunk/ctp2_code/libs/anet/src/tca/pwq.c
   trunk/ctp2_code/libs/anet/src/tca/pwq.h
   trunk/ctp2_code/libs/anet/src/tca/tca.c
   trunk/ctp2_code/libs/anet/src/tca/tca.h
   trunk/ctp2_code/libs/anet/src/tca/tcapw.c
   trunk/ctp2_code/libs/anet/src/tca/tcapw.h
   trunk/ctp2_code/libs/anet/src/tca/tcapwtab.c
   trunk/ctp2_code/libs/anet/src/tca/tcapwtab.h
   trunk/ctp2_code/libs/anet/src/tca/tcat.c
   trunk/ctp2_code/libs/anet/src/tca/tserv.c
   trunk/ctp2_code/libs/anet/src/tca/tserv.h
   trunk/ctp2_code/libs/anet/src/tca/tserva.c
   trunk/ctp2_code/libs/anet/src/tca/tservt.c
   trunk/ctp2_code/libs/anet/src/test/PSP/psp.c
   trunk/ctp2_code/libs/anet/src/test/bench/bench.c
   trunk/ctp2_code/libs/anet/src/test/bench/prog.c
   trunk/ctp2_code/libs/anet/src/test/bench/prog.h
   trunk/ctp2_code/libs/anet/src/test/dpio/dpiot1.c
   trunk/ctp2_code/libs/anet/src/test/dpio/dpiot2.c
   trunk/ctp2_code/libs/anet/src/test/dpiot/dpiot.c
   trunk/ctp2_code/libs/anet/src/test/dptab/dptabt1.c
   trunk/ctp2_code/libs/anet/src/test/dptabt/dptabt.c
   trunk/ctp2_code/libs/anet/src/test/dpuser/dpusert.c
   trunk/ctp2_code/libs/anet/src/test/load/load.c
   trunk/ctp2_code/libs/anet/src/test/pingt/pingt.c
   trunk/ctp2_code/libs/anet/src/test/score/dpscore.c
   trunk/ctp2_code/libs/anet/src/test/score/dpscore.h
   trunk/ctp2_code/libs/anet/src/test/score/dpscoret.c
   trunk/ctp2_code/libs/anet/src/test/score/servscor.c
   trunk/ctp2_code/libs/anet/src/test/score/servscor.h
   trunk/ctp2_code/libs/anet/src/win/anetdrop/anetdrop.c
   trunk/ctp2_code/libs/anet/src/win/anetdrop/cancelbox.c
   trunk/ctp2_code/libs/anet/src/win/anetdrop/cancelbox.h
   trunk/ctp2_code/libs/anet/src/win/anetdrop/loopdrop.c
   trunk/ctp2_code/libs/anet/src/win/dp/dllmain.c
   trunk/ctp2_code/libs/anet/src/win/dp/dpdllwin.c
   trunk/ctp2_code/libs/anet/src/win/dp/enumapp.c
   trunk/ctp2_code/libs/anet/src/win/dp/launchap.c
   trunk/ctp2_code/libs/anet/src/win/h/Mw2types.h
   trunk/ctp2_code/libs/anet/src/win/h/Userid.h
   trunk/ctp2_code/libs/anet/src/win/h/ddprint.h
   trunk/ctp2_code/libs/anet/src/win/main/ddprint.c
   trunk/ctp2_code/libs/anet/src/win/main/gnlframp.c
   trunk/ctp2_code/libs/anet/src/win/main/ser.c
   trunk/ctp2_code/libs/anet/src/win/main/ser.h
   trunk/ctp2_code/libs/anet/src/win/main/serio.c
   trunk/ctp2_code/libs/anet/src/win/main/serio.h
   trunk/ctp2_code/libs/anet/src/win/main/seriot.c
   trunk/ctp2_code/libs/anet/src/win/main/sertest.c
   trunk/ctp2_code/libs/anet/src/win/sendcrsh/sendbox.c
   trunk/ctp2_code/libs/anet/src/win/sendcrsh/sendbox.h
   trunk/ctp2_code/libs/anet/src/win/sendcrsh/sendboxrc.h
   trunk/ctp2_code/libs/anet/src/win/sendcrsh/sendcrsh.c
   trunk/ctp2_code/libs/anet/src/win/stub/anetstub.c
   trunk/ctp2_code/libs/anet/src/win/stub/anetstub.h
   trunk/ctp2_code/libs/anet/src/win/stub/resource.h
   trunk/ctp2_code/libs/anet/src/win/winets/adialup.c
   trunk/ctp2_code/libs/anet/src/win/winets/adialup.h
   trunk/ctp2_code/libs/anet/src/win/winets/wstcp.c
   trunk/ctp2_code/libs/anet/src/win/winets/wstcp.h
   trunk/ctp2_code/libs/anet/src/win/winets/wstcpdll.c
   trunk/ctp2_code/libs/anet/src/win/wipx/ipx2dll.c
   trunk/ctp2_code/libs/anet/src/win/wipx/ipx2win.c
   trunk/ctp2_code/libs/anet/src/win/wipx/ipx2win.h
   trunk/ctp2_code/libs/anet/src/win/wipx/nw.h
   trunk/ctp2_code/libs/anet/src/win/wloop/loop.c
   trunk/ctp2_code/libs/anet/src/win/wloop/loopwin.c
   trunk/ctp2_code/libs/anet/src/win/wloop/loopwin.h
   trunk/ctp2_code/libs/anet/src/win/wmodem/modmdll.c
   trunk/ctp2_code/libs/anet/src/win/wmodem/regmo.c
   trunk/ctp2_code/libs/anet/src/win/wmodem/regmo.h
   trunk/ctp2_code/libs/anet/src/win/wserial/serdll.c
   trunk/ctp2_code/libs/anet/src/win/wserial/sertest.c
   trunk/ctp2_code/libs/miles/mss.h
   trunk/ctp2_code/libs/tiff/tiff.h
   trunk/ctp2_code/libs/tiff/tiffio.h
   trunk/ctp2_code/libs/zlib/zlib.h
   trunk/ctp2_code/mapgen/Crater.cpp
   trunk/ctp2_code/mapgen/Crater.h
   trunk/ctp2_code/mapgen/FaultGen.cpp
   trunk/ctp2_code/mapgen/FaultGen.h
   trunk/ctp2_code/mapgen/Geometric.cpp
   trunk/ctp2_code/mapgen/Geometric.h
   trunk/ctp2_code/mapgen/IMapGen.h
   trunk/ctp2_code/mapgen/PlasmaGen1.cpp
   trunk/ctp2_code/mapgen/PlasmaGen1.h
   trunk/ctp2_code/mapgen/PlasmaGen2.cpp
   trunk/ctp2_code/mapgen/PlasmaGen2.h
   trunk/ctp2_code/net/general/chatlist.h
   trunk/ctp2_code/net/general/net_achievement.cpp
   trunk/ctp2_code/net/general/net_action.cpp
   trunk/ctp2_code/net/general/net_agreement.cpp
   trunk/ctp2_code/net/general/net_army.cpp
   trunk/ctp2_code/net/general/net_army.h
   trunk/ctp2_code/net/general/net_cell.cpp
   trunk/ctp2_code/net/general/net_cell.h
   trunk/ctp2_code/net/general/net_chat.cpp
   trunk/ctp2_code/net/general/net_chat.h
   trunk/ctp2_code/net/general/net_cheat.cpp
   trunk/ctp2_code/net/general/net_city.cpp
   trunk/ctp2_code/net/general/net_city.h
   trunk/ctp2_code/net/general/net_civ.cpp
   trunk/ctp2_code/net/general/net_civ.h
   trunk/ctp2_code/net/general/net_crc.cpp
   trunk/ctp2_code/net/general/net_crc.h
   trunk/ctp2_code/net/general/net_diff.cpp
   trunk/ctp2_code/net/general/net_diplomacy.cpp
   trunk/ctp2_code/net/general/net_diplomacy.h
   trunk/ctp2_code/net/general/net_endgame.cpp
   trunk/ctp2_code/net/general/net_endgame.h
   trunk/ctp2_code/net/general/net_exclusions.cpp
   trunk/ctp2_code/net/general/net_feat.cpp
   trunk/ctp2_code/net/general/net_feat.h
   trunk/ctp2_code/net/general/net_gameobj.cpp
   trunk/ctp2_code/net/general/net_gameobj.h
   trunk/ctp2_code/net/general/net_gamesettings.cpp
   trunk/ctp2_code/net/general/net_guid.cpp
   trunk/ctp2_code/net/general/net_happy.cpp
   trunk/ctp2_code/net/general/net_happy.h
   trunk/ctp2_code/net/general/net_hash.h
   trunk/ctp2_code/net/general/net_info.cpp
   trunk/ctp2_code/net/general/net_info.h
   trunk/ctp2_code/net/general/net_installation.cpp
   trunk/ctp2_code/net/general/net_keys.cpp
   trunk/ctp2_code/net/general/net_message.cpp
   trunk/ctp2_code/net/general/net_message.h
   trunk/ctp2_code/net/general/net_order.cpp
   trunk/ctp2_code/net/general/net_packet.h
   trunk/ctp2_code/net/general/net_player.cpp
   trunk/ctp2_code/net/general/net_player.h
   trunk/ctp2_code/net/general/net_playerdata.h
   trunk/ctp2_code/net/general/net_pollution.cpp
   trunk/ctp2_code/net/general/net_pollution.h
   trunk/ctp2_code/net/general/net_rand.cpp
   trunk/ctp2_code/net/general/net_rand.h
   trunk/ctp2_code/net/general/net_ready.cpp
   trunk/ctp2_code/net/general/net_report.cpp
   trunk/ctp2_code/net/general/net_report.h
   trunk/ctp2_code/net/general/net_research.cpp
   trunk/ctp2_code/net/general/net_research.h
   trunk/ctp2_code/net/general/net_strengths.cpp
   trunk/ctp2_code/net/general/net_strengths.h
   trunk/ctp2_code/net/general/net_terrain.cpp
   trunk/ctp2_code/net/general/net_tradeoffer.cpp
   trunk/ctp2_code/net/general/net_tradeoffer.h
   trunk/ctp2_code/net/general/net_traderoute.cpp
   trunk/ctp2_code/net/general/net_traderoute.h
   trunk/ctp2_code/net/general/net_unit.cpp
   trunk/ctp2_code/net/general/net_unit.h
   trunk/ctp2_code/net/general/net_vision.cpp
   trunk/ctp2_code/net/general/net_vision.h
   trunk/ctp2_code/net/general/net_wonder.cpp
   trunk/ctp2_code/net/general/net_world.cpp
   trunk/ctp2_code/net/general/net_world.h
   trunk/ctp2_code/net/general/network.cpp
   trunk/ctp2_code/net/general/network.h
   trunk/ctp2_code/net/general/networkevent.cpp
   trunk/ctp2_code/net/general/networkevent.h
   trunk/ctp2_code/net/io/net_anet.cpp
   trunk/ctp2_code/net/io/net_anet.h
   trunk/ctp2_code/net/io/net_debug.cpp
   trunk/ctp2_code/net/io/net_debug.h
   trunk/ctp2_code/net/io/net_error.h
   trunk/ctp2_code/net/io/net_io.cpp
   trunk/ctp2_code/net/io/net_io.h
   trunk/ctp2_code/net/io/net_list.h
   trunk/ctp2_code/net/io/net_thread.cpp
   trunk/ctp2_code/net/io/net_thread.h
   trunk/ctp2_code/os/include/config_win32.h
   trunk/ctp2_code/os/include/ctp2_config.h
   trunk/ctp2_code/os/include/ctp2_inttypes.h
   trunk/ctp2_code/os/include/noCOMBase.h
   trunk/ctp2_code/os/nowin32/nowin32.cpp
   trunk/ctp2_code/os/nowin32/tchar.h
   trunk/ctp2_code/os/nowin32/windows.h
   trunk/ctp2_code/robot/aibackdoor/avl.h
   trunk/ctp2_code/robot/aibackdoor/bit_table.h
   trunk/ctp2_code/robot/aibackdoor/bset.cpp
   trunk/ctp2_code/robot/aibackdoor/bset.h
   trunk/ctp2_code/robot/aibackdoor/civarchive.cpp
   trunk/ctp2_code/robot/aibackdoor/civarchive.h
   trunk/ctp2_code/robot/aibackdoor/common.h
   trunk/ctp2_code/robot/aibackdoor/dynarr.h
   trunk/ctp2_code/robot/aibackdoor/list_array.h
   trunk/ctp2_code/robot/aibackdoor/pool.h
   trunk/ctp2_code/robot/aibackdoor/priorityqueue.h
   trunk/ctp2_code/robot/aibackdoor/sdl_endian.h
   trunk/ctp2_code/robot/aibackdoor/semi_dynamic_array.h
   trunk/ctp2_code/robot/pathing/AVLHeap.cpp
   trunk/ctp2_code/robot/pathing/AVLHeap.h
   trunk/ctp2_code/robot/pathing/A_Star_Heuristic_Cost.cpp
   trunk/ctp2_code/robot/pathing/A_Star_Heuristic_Cost.h
   trunk/ctp2_code/robot/pathing/Astar.h
   trunk/ctp2_code/robot/pathing/AstarPnt.cpp
   trunk/ctp2_code/robot/pathing/AstarQ.cpp
   trunk/ctp2_code/robot/pathing/AstarQ.h
   trunk/ctp2_code/robot/pathing/BFS.cpp
   trunk/ctp2_code/robot/pathing/BFS.h
   trunk/ctp2_code/robot/pathing/CityAstar.cpp
   trunk/ctp2_code/robot/pathing/CityAstar.h
   trunk/ctp2_code/robot/pathing/Path.cpp
   trunk/ctp2_code/robot/pathing/Path.h
   trunk/ctp2_code/robot/pathing/TestP.cpp
   trunk/ctp2_code/robot/pathing/TestP.h
   trunk/ctp2_code/robot/pathing/TradeAstar.cpp
   trunk/ctp2_code/robot/pathing/TradeAstar.h
   trunk/ctp2_code/robot/pathing/UnitAstar.h
   trunk/ctp2_code/robot/pathing/astar.cpp
   trunk/ctp2_code/robot/pathing/astarpnt.h
   trunk/ctp2_code/robot/pathing/robotastar2.cpp
   trunk/ctp2_code/robot/pathing/robotastar2.h
   trunk/ctp2_code/robot/pathing/unitastar.cpp
   trunk/ctp2_code/robot/utility/RandTest.cpp
   trunk/ctp2_code/robot/utility/RoboInit.h
   trunk/ctp2_code/robot/utility/roboinit.cpp
   trunk/ctp2_code/robotcom/Agent/Agent.h
   trunk/ctp2_code/robotcom/Agent/AiBldQue.cpp
   trunk/ctp2_code/robotcom/Agent/AiBldQue.h
   trunk/ctp2_code/robotcom/Agent/ArmyAgent.h
   trunk/ctp2_code/robotcom/Agent/BldAgent.cpp
   trunk/ctp2_code/robotcom/Agent/BldAgent.h
   trunk/ctp2_code/robotcom/Agent/CityAgent.cpp
   trunk/ctp2_code/robotcom/Agent/CityAgent.h
   trunk/ctp2_code/robotcom/Agent/CityAgentPop.cpp
   trunk/ctp2_code/robotcom/Agent/CityAgentPop.h
   trunk/ctp2_code/robotcom/Agent/ForeignAgent.cpp
   trunk/ctp2_code/robotcom/Agent/ForeignAgent.h
   trunk/ctp2_code/robotcom/Agent/ForeignCity.cpp
   trunk/ctp2_code/robotcom/Agent/ForeignCity.h
   trunk/ctp2_code/robotcom/Agent/GoodAgent.cpp
   trunk/ctp2_code/robotcom/Agent/GoodAgent.h
   trunk/ctp2_code/robotcom/Agent/Pirate_Marker.cpp
   trunk/ctp2_code/robotcom/Agent/Pirate_Marker.h
   trunk/ctp2_code/robotcom/Agent/agent.cpp
   trunk/ctp2_code/robotcom/Agent/armyagent.cpp
   trunk/ctp2_code/robotcom/Agent/cityagentblg.cpp
   trunk/ctp2_code/robotcom/Agent/cityagentblg.h
   trunk/ctp2_code/robotcom/Agent/scienceagent.cpp
   trunk/ctp2_code/robotcom/Agent/scienceagent.h
   trunk/ctp2_code/robotcom/Alloc/AllocWGF.cpp
   trunk/ctp2_code/robotcom/Alloc/AllocWGF.h
   trunk/ctp2_code/robotcom/Alloc/CityAlloc.h
   trunk/ctp2_code/robotcom/Alloc/CityFP.cpp
   trunk/ctp2_code/robotcom/Alloc/CityFP.h
   trunk/ctp2_code/robotcom/Alloc/CityGrowth.cpp
   trunk/ctp2_code/robotcom/Alloc/CityGrowth.h
   trunk/ctp2_code/robotcom/Alloc/CityList.cpp
   trunk/ctp2_code/robotcom/Alloc/CityList.h
   trunk/ctp2_code/robotcom/Alloc/CityProd.cpp
   trunk/ctp2_code/robotcom/Alloc/CityProd.h
   trunk/ctp2_code/robotcom/Alloc/InstBidList.h
   trunk/ctp2_code/robotcom/Alloc/OTUtilityList.cpp
   trunk/ctp2_code/robotcom/Alloc/OTUtilityList.h
   trunk/ctp2_code/robotcom/Alloc/Plan.cpp
   trunk/ctp2_code/robotcom/Alloc/Plan.h
   trunk/ctp2_code/robotcom/Alloc/RouteUtilityList.cpp
   trunk/ctp2_code/robotcom/Alloc/RouteUtilityList.h
   trunk/ctp2_code/robotcom/Alloc/instbidlist.cpp
   trunk/ctp2_code/robotcom/Alloc/wotp.cpp
   trunk/ctp2_code/robotcom/Alloc/wotp.h
   trunk/ctp2_code/robotcom/FrmState/AIDipReq.cpp
   trunk/ctp2_code/robotcom/FrmState/AIDipReq.h
   trunk/ctp2_code/robotcom/FrmState/FSBeginTurn.cpp
   trunk/ctp2_code/robotcom/FrmState/FSBeginTurn.h
   trunk/ctp2_code/robotcom/FrmState/FSGold.cpp
   trunk/ctp2_code/robotcom/FrmState/FSGold.h
   trunk/ctp2_code/robotcom/FrmState/FSOppAction.cpp
   trunk/ctp2_code/robotcom/FrmState/FSOppAction.h
   trunk/ctp2_code/robotcom/FrmState/FSWar.cpp
   trunk/ctp2_code/robotcom/FrmState/FSWar.h
   trunk/ctp2_code/robotcom/FrmState/FrameState.h
   trunk/ctp2_code/robotcom/FrmState/FsDiplomat.h
   trunk/ctp2_code/robotcom/FrmState/fsalloc.cpp
   trunk/ctp2_code/robotcom/FrmState/fsalloc.h
   trunk/ctp2_code/robotcom/FrmState/fscompete.cpp
   trunk/ctp2_code/robotcom/FrmState/fscompete.h
   trunk/ctp2_code/robotcom/FrmState/fsdiplomat.cpp
   trunk/ctp2_code/robotcom/FrmState/fsfuzzy.cpp
   trunk/ctp2_code/robotcom/FrmState/fsfuzzy.h
   trunk/ctp2_code/robotcom/InCom/IGameState.h
   trunk/ctp2_code/robotcom/InCom/IRobot.h
   trunk/ctp2_code/robotcom/InCom/RobotCOM.cpp
   trunk/ctp2_code/robotcom/InCom/RobotCOM.h
   trunk/ctp2_code/robotcom/Top/AiCell.cpp
   trunk/ctp2_code/robotcom/Top/AiMap.cpp
   trunk/ctp2_code/robotcom/Top/AiMap.h
   trunk/ctp2_code/robotcom/Top/CityEdge.cpp
   trunk/ctp2_code/robotcom/Top/CityEdge.h
   trunk/ctp2_code/robotcom/Top/CityTree.cpp
   trunk/ctp2_code/robotcom/Top/CityTree.h
   trunk/ctp2_code/robotcom/Top/CityTreeQueue.cpp
   trunk/ctp2_code/robotcom/Top/CityTreeQueue.h
   trunk/ctp2_code/robotcom/Top/CityVertex.cpp
   trunk/ctp2_code/robotcom/Top/CityVertex.h
   trunk/ctp2_code/robotcom/Top/Cont.cpp
   trunk/ctp2_code/robotcom/Top/Cont.h
   trunk/ctp2_code/robotcom/Top/Delaunay.cpp
   trunk/ctp2_code/robotcom/Top/Delaunay.h
   trunk/ctp2_code/robotcom/Top/MST.cpp
   trunk/ctp2_code/robotcom/Top/MST.h
   trunk/ctp2_code/robotcom/Top/aicell.h
   trunk/ctp2_code/robotcom/Top/geom2d.cpp
   trunk/ctp2_code/robotcom/Top/geom2d.h
   trunk/ctp2_code/robotcom/Top/strategic_map.cpp
   trunk/ctp2_code/robotcom/Top/strategic_map.h
   trunk/ctp2_code/robotcom/aimgr/AiCell.cpp
   trunk/ctp2_code/robotcom/aimgr/AiCell.h
   trunk/ctp2_code/robotcom/aimgr/AiStats.cpp
   trunk/ctp2_code/robotcom/aimgr/AiStats.h
   trunk/ctp2_code/robotcom/aimgr/Foreigner.h
   trunk/ctp2_code/robotcom/aimgr/FrameClock.cpp
   trunk/ctp2_code/robotcom/aimgr/FrameClock.h
   trunk/ctp2_code/robotcom/aimgr/WonderBlg.cpp
   trunk/ctp2_code/robotcom/aimgr/WonderBlg.h
   trunk/ctp2_code/robotcom/aimgr/WonderTbl.cpp
   trunk/ctp2_code/robotcom/aimgr/WonderTbl.h
   trunk/ctp2_code/robotcom/aimgr/aimain.cpp
   trunk/ctp2_code/robotcom/aimgr/aimain.h
   trunk/ctp2_code/robotcom/aimgr/airndcnt.cpp
   trunk/ctp2_code/robotcom/aimgr/airndcnt.h
   trunk/ctp2_code/robotcom/aimgr/aitypes.h
   trunk/ctp2_code/robotcom/aimgr/c3ai.cpp
   trunk/ctp2_code/robotcom/aimgr/c3ai.h
   trunk/ctp2_code/robotcom/aimgr/c3aidebug.cpp
   trunk/ctp2_code/robotcom/aimgr/foreigner.cpp
   trunk/ctp2_code/robotcom/aimgr/gold.cpp
   trunk/ctp2_code/robotcom/aimgr/gold.h
   trunk/ctp2_code/robotcom/backdoor/AVL.h
   trunk/ctp2_code/robotcom/backdoor/BSet.cpp
   trunk/ctp2_code/robotcom/backdoor/BSet.h
   trunk/ctp2_code/robotcom/backdoor/Bit_Table.h
   trunk/ctp2_code/robotcom/backdoor/DMapPoint.cpp
   trunk/ctp2_code/robotcom/backdoor/DMapPoint.h
   trunk/ctp2_code/robotcom/backdoor/DynArr.h
   trunk/ctp2_code/robotcom/backdoor/FlatPtr.h
   trunk/ctp2_code/robotcom/backdoor/Memory_Manager.cpp
   trunk/ctp2_code/robotcom/backdoor/Memory_Manager.h
   trunk/ctp2_code/robotcom/backdoor/Wallclock.h
   trunk/ctp2_code/robotcom/backdoor/c3mem.cpp
   trunk/ctp2_code/robotcom/backdoor/civarchive.cpp
   trunk/ctp2_code/robotcom/backdoor/civarchive.h
   trunk/ctp2_code/robotcom/backdoor/common.h
   trunk/ctp2_code/robotcom/backdoor/list_array.h
   trunk/ctp2_code/robotcom/backdoor/pointer_pool.h
   trunk/ctp2_code/robotcom/backdoor/pool.h
   trunk/ctp2_code/robotcom/backdoor/popdata_leak_fix_pool.h
   trunk/ctp2_code/robotcom/backdoor/priorityqueue.h
   trunk/ctp2_code/robotcom/backdoor/sdl_endian.h
   trunk/ctp2_code/robotcom/backdoor/semi_dynamic_array.h
   trunk/ctp2_code/robotcom/backdoor/wallclock.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliAction.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliAction.h
   trunk/ctp2_code/robotcom/fuzzy/FliEngine.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliEngine.h
   trunk/ctp2_code/robotcom/fuzzy/FliFuncTab.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliFuncTab.h
   trunk/ctp2_code/robotcom/fuzzy/FliOutputProc.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliOutputProc.h
   trunk/ctp2_code/robotcom/fuzzy/FliRule.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliRule.h
   trunk/ctp2_code/robotcom/fuzzy/FliSetFunc.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliSetFunc.h
   trunk/ctp2_code/robotcom/fuzzy/FliStack.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliStack.h
   trunk/ctp2_code/robotcom/fuzzy/FliSymTab.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliSymTab.h
   trunk/ctp2_code/robotcom/fuzzy/FliSymbol.cpp
   trunk/ctp2_code/robotcom/fuzzy/FliSymbol.h
   trunk/ctp2_code/robotcom/fuzzy/FliWhen.h
   trunk/ctp2_code/robotcom/fuzzy/Fuzzy_Variables.h
   trunk/ctp2_code/robotcom/fuzzy/FzOut.h
   trunk/ctp2_code/robotcom/fuzzy/fli.l
   trunk/ctp2_code/robotcom/fuzzy/fli.y
   trunk/ctp2_code/robotcom/fuzzy/fliif.cpp
   trunk/ctp2_code/robotcom/fuzzy/fliif.h
   trunk/ctp2_code/robotcom/fuzzy/fzdipvars.h
   trunk/ctp2_code/robotcom/fuzzy/fzout.cpp
   trunk/ctp2_code/robotcom/goals/ArmyGoal.cpp
   trunk/ctp2_code/robotcom/goals/ArmyGoal.h
   trunk/ctp2_code/robotcom/goals/GLSettl.cpp
   trunk/ctp2_code/robotcom/goals/GlAttck.cpp
   trunk/ctp2_code/robotcom/goals/GlAttck.h
   trunk/ctp2_code/robotcom/goals/GlEnslave.cpp
   trunk/ctp2_code/robotcom/goals/GlEnslave.h
   trunk/ctp2_code/robotcom/goals/GlExpl.cpp
   trunk/ctp2_code/robotcom/goals/GlExpl.h
   trunk/ctp2_code/robotcom/goals/GlFreight.cpp
   trunk/ctp2_code/robotcom/goals/GlOvertime.cpp
   trunk/ctp2_code/robotcom/goals/GlOvertime.h
   trunk/ctp2_code/robotcom/goals/GlRoute.cpp
   trunk/ctp2_code/robotcom/goals/GlRoute.h
   trunk/ctp2_code/robotcom/goals/GlSettl.h
   trunk/ctp2_code/robotcom/goals/GlTrans.cpp
   trunk/ctp2_code/robotcom/goals/GlTrans.h
   trunk/ctp2_code/robotcom/goals/GoalBombard.cpp
   trunk/ctp2_code/robotcom/goals/GoalCityTarget.cpp
   trunk/ctp2_code/robotcom/goals/GoalCityTarget.h
   trunk/ctp2_code/robotcom/goals/GoalDefense.cpp
   trunk/ctp2_code/robotcom/goals/GoalDefense.h
   trunk/ctp2_code/robotcom/goals/GoalExpel.cpp
   trunk/ctp2_code/robotcom/goals/GoalExpel.h
   trunk/ctp2_code/robotcom/goals/GoalInst.cpp
   trunk/ctp2_code/robotcom/goals/GoalInst.h
   trunk/ctp2_code/robotcom/goals/GoalMapTarget.cpp
   trunk/ctp2_code/robotcom/goals/GoalMapTarget.h
   trunk/ctp2_code/robotcom/goals/GoalRetreat.cpp
   trunk/ctp2_code/robotcom/goals/GoalRetreat.h
   trunk/ctp2_code/robotcom/goals/GoalRoad.cpp
   trunk/ctp2_code/robotcom/goals/GoalRoad.h
   trunk/ctp2_code/robotcom/goals/GoalSally.cpp
   trunk/ctp2_code/robotcom/goals/GoalSally.h
   trunk/ctp2_code/robotcom/goals/GoalWonder.cpp
   trunk/ctp2_code/robotcom/goals/GoalWonder.h
   trunk/ctp2_code/robotcom/goals/Goal_Attack_Region.cpp
   trunk/ctp2_code/robotcom/goals/Goal_Attack_Region.h
   trunk/ctp2_code/robotcom/goals/Goal_Build_List.cpp
   trunk/ctp2_code/robotcom/goals/Goal_Build_List.h
   trunk/ctp2_code/robotcom/goals/Goal_Chokepoint.cpp
   trunk/ctp2_code/robotcom/goals/Goal_Chokepoint.h
   trunk/ctp2_code/robotcom/goals/Goal_Patrol.cpp
   trunk/ctp2_code/robotcom/goals/Goal_Patrol.h
   trunk/ctp2_code/robotcom/goals/Goal_Perimeter.cpp
   trunk/ctp2_code/robotcom/goals/Goal_Perimeter.h
   trunk/ctp2_code/robotcom/goals/OA_Entrench.cpp
   trunk/ctp2_code/robotcom/goals/OA_Entrench.h
   trunk/ctp2_code/robotcom/goals/OA_NoTrade.cpp
   trunk/ctp2_code/robotcom/goals/OA_NoTrade.h
   trunk/ctp2_code/robotcom/goals/OA_Paradrop.cpp
   trunk/ctp2_code/robotcom/goals/OA_Paradrop.h
   trunk/ctp2_code/robotcom/goals/OA_Pillage.cpp
   trunk/ctp2_code/robotcom/goals/OA_Pillage.h
   trunk/ctp2_code/robotcom/goals/OA_Refuel.cpp
   trunk/ctp2_code/robotcom/goals/OA_Refuel.h
   trunk/ctp2_code/robotcom/goals/OA_Repair_Installation.cpp
   trunk/ctp2_code/robotcom/goals/OA_Repair_Installation.h
   trunk/ctp2_code/robotcom/goals/Oa.cpp
   trunk/ctp2_code/robotcom/goals/Oa.h
   trunk/ctp2_code/robotcom/goals/glblg.cpp
   trunk/ctp2_code/robotcom/goals/glblg.h
   trunk/ctp2_code/robotcom/goals/glfreight.h
   trunk/ctp2_code/robotcom/goals/goal_build_supplemental.cpp
   trunk/ctp2_code/robotcom/goals/goal_build_supplemental.h
   trunk/ctp2_code/robotcom/goals/goalbombard.h
   trunk/ctp2_code/robotcom/goals/goalrustle.cpp
   trunk/ctp2_code/robotcom/goals/goalrustle.h
   trunk/ctp2_code/robotcom/goals/oa_loot.cpp
   trunk/ctp2_code/robotcom/goals/oa_loot.h
   trunk/ctp2_code/robotcom/planner/AIP_Manager.cpp
   trunk/ctp2_code/robotcom/planner/AIP_Manager.h
   trunk/ctp2_code/robotcom/planner/Red_Black_Tree.h
   trunk/ctp2_code/robotcom/planner/Scheduler.cpp
   trunk/ctp2_code/robotcom/planner/Scheduler.h
   trunk/ctp2_code/robotcom/planner/Squad.cpp
   trunk/ctp2_code/robotcom/planner/Squad_And_Goal_Types.h
   trunk/ctp2_code/robotcom/planner/ai_match.cpp
   trunk/ctp2_code/robotcom/planner/ai_match.h
   trunk/ctp2_code/robotcom/planner/ailog.h
   trunk/ctp2_code/robotcom/planner/aip.cpp
   trunk/ctp2_code/robotcom/planner/aip.h
   trunk/ctp2_code/robotcom/planner/dr_debug.h
   trunk/ctp2_code/robotcom/planner/expression.cpp
   trunk/ctp2_code/robotcom/planner/expressionP.h
   trunk/ctp2_code/robotcom/planner/goal.cpp
   trunk/ctp2_code/robotcom/planner/goal.h
   trunk/ctp2_code/robotcom/planner/grassfire.h
   trunk/ctp2_code/robotcom/planner/iparser.cpp
   trunk/ctp2_code/robotcom/planner/iparser.h
   trunk/ctp2_code/robotcom/planner/linked_list.cpp
   trunk/ctp2_code/robotcom/planner/linked_list.h
   trunk/ctp2_code/robotcom/planner/matrix.h
   trunk/ctp2_code/robotcom/planner/planner.cpp
   trunk/ctp2_code/robotcom/planner/planner.h
   trunk/ctp2_code/robotcom/planner/sorted_array.h
   trunk/ctp2_code/robotcom/planner/squad.h
   trunk/ctp2_code/robotcom/planner/squad_Strength.cpp
   trunk/ctp2_code/robotcom/planner/squad_strength.h
   trunk/ctp2_code/robotcom/planner/strategic_ai_forward.h
   trunk/ctp2_code/robotcom/planner/unitflow.h
   trunk/ctp2_code/sound/civsound.cpp
   trunk/ctp2_code/sound/civsound.h
   trunk/ctp2_code/sound/ear.h
   trunk/ctp2_code/sound/ear_proc.cpp
   trunk/ctp2_code/sound/ear_util.cpp
   trunk/ctp2_code/sound/ear_util.h
   trunk/ctp2_code/sound/gamesounds.cpp
   trunk/ctp2_code/sound/gamesounds.h
   trunk/ctp2_code/sound/soundevent.cpp
   trunk/ctp2_code/sound/soundevent.h
   trunk/ctp2_code/sound/soundmanager.cpp
   trunk/ctp2_code/sound/soundmanager.h
   trunk/ctp2_code/sound/soundutils.cpp
   trunk/ctp2_code/sound/soundutils.h
   trunk/ctp2_code/ui/aui_common/aui.h
   trunk/ctp2_code/ui/aui_common/aui_Factory.cpp
   trunk/ctp2_code/ui/aui_common/aui_Factory.h
   trunk/ctp2_code/ui/aui_common/aui_action.cpp
   trunk/ctp2_code/ui/aui_common/aui_action.h
   trunk/ctp2_code/ui/aui_common/aui_animate.cpp
   trunk/ctp2_code/ui/aui_common/aui_animate.h
   trunk/ctp2_code/ui/aui_common/aui_audiomanager.cpp
   trunk/ctp2_code/ui/aui_common/aui_audiomanager.h
   trunk/ctp2_code/ui/aui_common/aui_base.cpp
   trunk/ctp2_code/ui/aui_common/aui_base.h
   trunk/ctp2_code/ui/aui_common/aui_bitmapfont.cpp
   trunk/ctp2_code/ui/aui_common/aui_bitmapfont.h
   trunk/ctp2_code/ui/aui_common/aui_blitter.cpp
   trunk/ctp2_code/ui/aui_common/aui_blitter.h
   trunk/ctp2_code/ui/aui_common/aui_button.cpp
   trunk/ctp2_code/ui/aui_common/aui_button.h
   trunk/ctp2_code/ui/aui_common/aui_control.cpp
   trunk/ctp2_code/ui/aui_common/aui_control.h
   trunk/ctp2_code/ui/aui_common/aui_cursor.cpp
   trunk/ctp2_code/ui/aui_common/aui_cursor.h
   trunk/ctp2_code/ui/aui_common/aui_dimension.cpp
   trunk/ctp2_code/ui/aui_common/aui_dimension.h
   trunk/ctp2_code/ui/aui_common/aui_dirtylist.cpp
   trunk/ctp2_code/ui/aui_common/aui_dirtylist.h
   trunk/ctp2_code/ui/aui_common/aui_dragdropwindow.cpp
   trunk/ctp2_code/ui/aui_common/aui_dragdropwindow.h
   trunk/ctp2_code/ui/aui_common/aui_dropdown.cpp
   trunk/ctp2_code/ui/aui_common/aui_dropdown.h
   trunk/ctp2_code/ui/aui_common/aui_font.cpp
   trunk/ctp2_code/ui/aui_common/aui_font.h
   trunk/ctp2_code/ui/aui_common/aui_gamespecific.cpp
   trunk/ctp2_code/ui/aui_common/aui_gamespecific.h
   trunk/ctp2_code/ui/aui_common/aui_header.cpp
   trunk/ctp2_code/ui/aui_common/aui_header.h
   trunk/ctp2_code/ui/aui_common/aui_hypertextbase.cpp
   trunk/ctp2_code/ui/aui_common/aui_hypertextbase.h
   trunk/ctp2_code/ui/aui_common/aui_hypertextbox.cpp
   trunk/ctp2_code/ui/aui_common/aui_hypertextbox.h
   trunk/ctp2_code/ui/aui_common/aui_image.cpp
   trunk/ctp2_code/ui/aui_common/aui_image.h
   trunk/ctp2_code/ui/aui_common/aui_imagebase.cpp
   trunk/ctp2_code/ui/aui_common/aui_imagebase.h
   trunk/ctp2_code/ui/aui_common/aui_imagelist.cpp
   trunk/ctp2_code/ui/aui_common/aui_imagelist.h
   trunk/ctp2_code/ui/aui_common/aui_input.cpp
   trunk/ctp2_code/ui/aui_common/aui_input.h
   trunk/ctp2_code/ui/aui_common/aui_item.cpp
   trunk/ctp2_code/ui/aui_common/aui_item.h
   trunk/ctp2_code/ui/aui_common/aui_joystick.cpp
   trunk/ctp2_code/ui/aui_common/aui_joystick.h
   trunk/ctp2_code/ui/aui_common/aui_keyboard.cpp
   trunk/ctp2_code/ui/aui_common/aui_keyboard.h
   trunk/ctp2_code/ui/aui_common/aui_ldl.cpp
   trunk/ctp2_code/ui/aui_common/aui_ldl.h
   trunk/ctp2_code/ui/aui_common/aui_listbox.cpp
   trunk/ctp2_code/ui/aui_common/aui_listbox.h
   trunk/ctp2_code/ui/aui_common/aui_memmap.cpp
   trunk/ctp2_code/ui/aui_common/aui_memmap.h
   trunk/ctp2_code/ui/aui_common/aui_mouse.cpp
   trunk/ctp2_code/ui/aui_common/aui_mouse.h
   trunk/ctp2_code/ui/aui_common/aui_movie.cpp
   trunk/ctp2_code/ui/aui_common/aui_movie.h
   trunk/ctp2_code/ui/aui_common/aui_moviebutton.cpp
   trunk/ctp2_code/ui/aui_common/aui_moviebutton.h
   trunk/ctp2_code/ui/aui_common/aui_moviemanager.cpp
   trunk/ctp2_code/ui/aui_common/aui_moviemanager.h
   trunk/ctp2_code/ui/aui_common/aui_music.cpp
   trunk/ctp2_code/ui/aui_common/aui_music.h
   trunk/ctp2_code/ui/aui_common/aui_pixel.cpp
   trunk/ctp2_code/ui/aui_common/aui_pixel.h
   trunk/ctp2_code/ui/aui_common/aui_progressbar.cpp
   trunk/ctp2_code/ui/aui_common/aui_progressbar.h
   trunk/ctp2_code/ui/aui_common/aui_radio.cpp
   trunk/ctp2_code/ui/aui_common/aui_radio.h
   trunk/ctp2_code/ui/aui_common/aui_ranger.cpp
   trunk/ctp2_code/ui/aui_common/aui_ranger.h
   trunk/ctp2_code/ui/aui_common/aui_rectangle.cpp
   trunk/ctp2_code/ui/aui_common/aui_rectangle.h
   trunk/ctp2_code/ui/aui_common/aui_region.cpp
   trunk/ctp2_code/ui/aui_common/aui_region.h
   trunk/ctp2_code/ui/aui_common/aui_regiondispatch.cpp
   trunk/ctp2_code/ui/aui_common/aui_resource.h
   trunk/ctp2_code/ui/aui_common/aui_screen.cpp
   trunk/ctp2_code/ui/aui_common/aui_screen.h
   trunk/ctp2_code/ui/aui_common/aui_shell.cpp
   trunk/ctp2_code/ui/aui_common/aui_shell.h
   trunk/ctp2_code/ui/aui_common/aui_sound.cpp
   trunk/ctp2_code/ui/aui_common/aui_sound.h
   trunk/ctp2_code/ui/aui_common/aui_soundbase.cpp
   trunk/ctp2_code/ui/aui_common/aui_soundbase.h
   trunk/ctp2_code/ui/aui_common/aui_static.cpp
   trunk/ctp2_code/ui/aui_common/aui_static.h
   trunk/ctp2_code/ui/aui_common/aui_stringtable.cpp
   trunk/ctp2_code/ui/aui_common/aui_stringtable.h
   trunk/ctp2_code/ui/aui_common/aui_surface.cpp
   trunk/ctp2_code/ui/aui_common/aui_surface.h
   trunk/ctp2_code/ui/aui_common/aui_switch.cpp
   trunk/ctp2_code/ui/aui_common/aui_switch.h
   trunk/ctp2_code/ui/aui_common/aui_switchgroup.cpp
   trunk/ctp2_code/ui/aui_common/aui_switchgroup.h
   trunk/ctp2_code/ui/aui_common/aui_tab.cpp
   trunk/ctp2_code/ui/aui_common/aui_tab.h
   trunk/ctp2_code/ui/aui_common/aui_tabgroup.cpp
   trunk/ctp2_code/ui/aui_common/aui_tabgroup.h
   trunk/ctp2_code/ui/aui_common/aui_textbase.cpp
   trunk/ctp2_code/ui/aui_common/aui_textbase.h
   trunk/ctp2_code/ui/aui_common/aui_textbox.cpp
   trunk/ctp2_code/ui/aui_common/aui_textbox.h
   trunk/ctp2_code/ui/aui_common/aui_textfield.cpp
   trunk/ctp2_code/ui/aui_common/aui_textfield.h
   trunk/ctp2_code/ui/aui_common/aui_thumb.cpp
   trunk/ctp2_code/ui/aui_common/aui_thumb.h
   trunk/ctp2_code/ui/aui_common/aui_tipwindow.cpp
   trunk/ctp2_code/ui/aui_common/aui_tipwindow.h
   trunk/ctp2_code/ui/aui_common/aui_ui.cpp
   trunk/ctp2_code/ui/aui_common/aui_ui.h
   trunk/ctp2_code/ui/aui_common/aui_undo.cpp
   trunk/ctp2_code/ui/aui_common/aui_undo.h
   trunk/ctp2_code/ui/aui_common/aui_uniqueid.cpp
   trunk/ctp2_code/ui/aui_common/aui_uniqueid.h
   trunk/ctp2_code/ui/aui_common/aui_win.cpp
   trunk/ctp2_code/ui/aui_common/aui_win.h
   trunk/ctp2_code/ui/aui_common/aui_window.cpp
   trunk/ctp2_code/ui/aui_common/aui_window.h
   trunk/ctp2_code/ui/aui_common/auicfg.h
   trunk/ctp2_code/ui/aui_common/auidebug.h
   trunk/ctp2_code/ui/aui_common/auitypes.h
   trunk/ctp2_code/ui/aui_common/dxver.h
   trunk/ctp2_code/ui/aui_common/tech_memmap.cpp
   trunk/ctp2_code/ui/aui_common/tech_memmap.h
   trunk/ctp2_code/ui/aui_common/tech_memory.h
   trunk/ctp2_code/ui/aui_common/tech_wllist.h
   trunk/ctp2_code/ui/aui_ctp2/C3slider.cpp
   trunk/ctp2_code/ui/aui_ctp2/InfoBar.cpp
   trunk/ctp2_code/ui/aui_ctp2/InfoBar.h
   trunk/ctp2_code/ui/aui_ctp2/SelItem.cpp
   trunk/ctp2_code/ui/aui_ctp2/SelItem.h
   trunk/ctp2_code/ui/aui_ctp2/SelItemClick.cpp
   trunk/ctp2_code/ui/aui_ctp2/SelItemEvent.cpp
   trunk/ctp2_code/ui/aui_ctp2/SelItemEvent.h
   trunk/ctp2_code/ui/aui_ctp2/background.cpp
   trunk/ctp2_code/ui/aui_ctp2/background.h
   trunk/ctp2_code/ui/aui_ctp2/battleorderbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/battleorderbox.h
   trunk/ctp2_code/ui/aui_ctp2/battleorderboxactions.cpp
   trunk/ctp2_code/ui/aui_ctp2/battleorderboxactions.h
   trunk/ctp2_code/ui/aui_ctp2/bevellesswindow.cpp
   trunk/ctp2_code/ui/aui_ctp2/bevellesswindow.h
   trunk/ctp2_code/ui/aui_ctp2/c3_button.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_button.h
   trunk/ctp2_code/ui/aui_ctp2/c3_checkbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_checkbox.h
   trunk/ctp2_code/ui/aui_ctp2/c3_coloredstatic.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_coloredstatic.h
   trunk/ctp2_code/ui/aui_ctp2/c3_coloredswitch.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_coloredswitch.h
   trunk/ctp2_code/ui/aui_ctp2/c3_coloriconbutton.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_coloriconbutton.h
   trunk/ctp2_code/ui/aui_ctp2/c3_dropdown.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_dropdown.h
   trunk/ctp2_code/ui/aui_ctp2/c3_fancywindow.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_fancywindow.h
   trunk/ctp2_code/ui/aui_ctp2/c3_header.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_header.h
   trunk/ctp2_code/ui/aui_ctp2/c3_headerswitch.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_headerswitch.h
   trunk/ctp2_code/ui/aui_ctp2/c3_hypertextbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_hypertextbox.h
   trunk/ctp2_code/ui/aui_ctp2/c3_hypertipwindow.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_hypertipwindow.h
   trunk/ctp2_code/ui/aui_ctp2/c3_icon.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_icon.h
   trunk/ctp2_code/ui/aui_ctp2/c3_image.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_image.h
   trunk/ctp2_code/ui/aui_ctp2/c3_listbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_listbox.h
   trunk/ctp2_code/ui/aui_ctp2/c3_listitem.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_listitem.h
   trunk/ctp2_code/ui/aui_ctp2/c3_popupwindow.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_popupwindow.h
   trunk/ctp2_code/ui/aui_ctp2/c3_radio.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_radio.h
   trunk/ctp2_code/ui/aui_ctp2/c3_ranger.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_ranger.h
   trunk/ctp2_code/ui/aui_ctp2/c3_slidometer.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_slidometer.h
   trunk/ctp2_code/ui/aui_ctp2/c3_static.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_static.h
   trunk/ctp2_code/ui/aui_ctp2/c3_switch.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_switch.h
   trunk/ctp2_code/ui/aui_ctp2/c3_thumb.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_thumb.h
   trunk/ctp2_code/ui/aui_ctp2/c3_tradelistitem.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_tradelistitem.h
   trunk/ctp2_code/ui/aui_ctp2/c3_updateaction.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_updateaction.h
   trunk/ctp2_code/ui/aui_ctp2/c3_utilitydialogbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3_utilitydialogbox.h
   trunk/ctp2_code/ui/aui_ctp2/c3blitter.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3blitter.h
   trunk/ctp2_code/ui/aui_ctp2/c3dropdown.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3dropdown.h
   trunk/ctp2_code/ui/aui_ctp2/c3fancywindow.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3fancywindow.h
   trunk/ctp2_code/ui/aui_ctp2/c3imageformats.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3imageformats.h
   trunk/ctp2_code/ui/aui_ctp2/c3listbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3listbox.h
   trunk/ctp2_code/ui/aui_ctp2/c3memmap.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3memmap.h
   trunk/ctp2_code/ui/aui_ctp2/c3scroller.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3scroller.h
   trunk/ctp2_code/ui/aui_ctp2/c3slider.h
   trunk/ctp2_code/ui/aui_ctp2/c3spinner.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3spinner.h
   trunk/ctp2_code/ui/aui_ctp2/c3textfield.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3textfield.h
   trunk/ctp2_code/ui/aui_ctp2/c3thumb.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3thumb.h
   trunk/ctp2_code/ui/aui_ctp2/c3ui.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3ui.h
   trunk/ctp2_code/ui/aui_ctp2/c3window.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3window.h
   trunk/ctp2_code/ui/aui_ctp2/c3windows.cpp
   trunk/ctp2_code/ui/aui_ctp2/c3windows.h
   trunk/ctp2_code/ui/aui_ctp2/chart.cpp
   trunk/ctp2_code/ui/aui_ctp2/chart.h
   trunk/ctp2_code/ui/aui_ctp2/checkbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/checkbox.h
   trunk/ctp2_code/ui/aui_ctp2/cityinventorylistbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/cityinventorylistbox.h
   trunk/ctp2_code/ui/aui_ctp2/coloriconbutton.cpp
   trunk/ctp2_code/ui/aui_ctp2/coloriconbutton.h
   trunk/ctp2_code/ui/aui_ctp2/coloriconswitch.cpp
   trunk/ctp2_code/ui/aui_ctp2/coloriconswitch.h
   trunk/ctp2_code/ui/aui_ctp2/controlsheet.cpp
   trunk/ctp2_code/ui/aui_ctp2/controlsheet.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Menu.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Menu.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_MenuButton.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_MenuButton.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Static.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Static.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Switch.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Switch.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Tab.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Tab.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_TabButton.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_TabButton.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_TabGroup.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_TabGroup.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Window.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_Window.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_button.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_button.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_commandline.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_commandline.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_dropdown.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_dropdown.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_hypertextbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_hypertextbox.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_listbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_listbox.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_listitem.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_listitem.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_menubar.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_menubar.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_spinner.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_spinner.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_textbuffer.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_textbuffer.h
   trunk/ctp2_code/ui/aui_ctp2/ctp2_textfield.cpp
   trunk/ctp2_code/ui/aui_ctp2/ctp2_textfield.h
   trunk/ctp2_code/ui/aui_ctp2/directvideo.cpp
   trunk/ctp2_code/ui/aui_ctp2/directvideo.h
   trunk/ctp2_code/ui/aui_ctp2/grabitem.cpp
   trunk/ctp2_code/ui/aui_ctp2/grabitem.h
   trunk/ctp2_code/ui/aui_ctp2/icon.cpp
   trunk/ctp2_code/ui/aui_ctp2/icon.h
   trunk/ctp2_code/ui/aui_ctp2/iconbutton.cpp
   trunk/ctp2_code/ui/aui_ctp2/iconbutton.h
   trunk/ctp2_code/ui/aui_ctp2/iconswitch.cpp
   trunk/ctp2_code/ui/aui_ctp2/iconswitch.h
   trunk/ctp2_code/ui/aui_ctp2/icontab.cpp
   trunk/ctp2_code/ui/aui_ctp2/icontab.h
   trunk/ctp2_code/ui/aui_ctp2/iteminfo.cpp
   trunk/ctp2_code/ui/aui_ctp2/keyboardhandler.h
   trunk/ctp2_code/ui/aui_ctp2/keymap.cpp
   trunk/ctp2_code/ui/aui_ctp2/keymap.h
   trunk/ctp2_code/ui/aui_ctp2/keypress.cpp
   trunk/ctp2_code/ui/aui_ctp2/keypress.h
   trunk/ctp2_code/ui/aui_ctp2/linegraph.cpp
   trunk/ctp2_code/ui/aui_ctp2/linegraph.h
   trunk/ctp2_code/ui/aui_ctp2/pattern.cpp
   trunk/ctp2_code/ui/aui_ctp2/pattern.h
   trunk/ctp2_code/ui/aui_ctp2/patternbase.cpp
   trunk/ctp2_code/ui/aui_ctp2/patternbase.h
   trunk/ctp2_code/ui/aui_ctp2/picture.cpp
   trunk/ctp2_code/ui/aui_ctp2/picture.h
   trunk/ctp2_code/ui/aui_ctp2/picturebutton.cpp
   trunk/ctp2_code/ui/aui_ctp2/picturebutton.h
   trunk/ctp2_code/ui/aui_ctp2/pictureswitch.cpp
   trunk/ctp2_code/ui/aui_ctp2/pictureswitch.h
   trunk/ctp2_code/ui/aui_ctp2/picturetab.cpp
   trunk/ctp2_code/ui/aui_ctp2/picturetab.h
   trunk/ctp2_code/ui/aui_ctp2/radarmap.cpp
   trunk/ctp2_code/ui/aui_ctp2/radarmap.h
   trunk/ctp2_code/ui/aui_ctp2/radiogroup.cpp
   trunk/ctp2_code/ui/aui_ctp2/radiogroup.h
   trunk/ctp2_code/ui/aui_ctp2/staticpicture.cpp
   trunk/ctp2_code/ui/aui_ctp2/staticpicture.h
   trunk/ctp2_code/ui/aui_ctp2/statictext.cpp
   trunk/ctp2_code/ui/aui_ctp2/statictext.h
   trunk/ctp2_code/ui/aui_ctp2/statictextitem.cpp
   trunk/ctp2_code/ui/aui_ctp2/statictextitem.h
   trunk/ctp2_code/ui/aui_ctp2/statuswindow.cpp
   trunk/ctp2_code/ui/aui_ctp2/statuswindow.h
   trunk/ctp2_code/ui/aui_ctp2/textbox.cpp
   trunk/ctp2_code/ui/aui_ctp2/textbox.h
   trunk/ctp2_code/ui/aui_ctp2/textbutton.cpp
   trunk/ctp2_code/ui/aui_ctp2/textbutton.h
   trunk/ctp2_code/ui/aui_ctp2/textradio.cpp
   trunk/ctp2_code/ui/aui_ctp2/textradio.h
   trunk/ctp2_code/ui/aui_ctp2/textswitch.cpp
   trunk/ctp2_code/ui/aui_ctp2/textswitch.h
   trunk/ctp2_code/ui/aui_ctp2/texttab.cpp
   trunk/ctp2_code/ui/aui_ctp2/texttab.h
   trunk/ctp2_code/ui/aui_ctp2/texttable.cpp
   trunk/ctp2_code/ui/aui_ctp2/texttable.h
   trunk/ctp2_code/ui/aui_ctp2/thermometer.cpp
   trunk/ctp2_code/ui/aui_ctp2/thermometer.h
   trunk/ctp2_code/ui/aui_ctp2/thronecontrol.cpp
   trunk/ctp2_code/ui/aui_ctp2/thronecontrol.h
   trunk/ctp2_code/ui/aui_ctp2/thumbnailmap.cpp
   trunk/ctp2_code/ui/aui_ctp2/thumbnailmap.h
   trunk/ctp2_code/ui/aui_ctp2/tilecontrol.cpp
   trunk/ctp2_code/ui/aui_ctp2/tilecontrol.h
   trunk/ctp2_code/ui/aui_ctp2/tipwindow.cpp
   trunk/ctp2_code/ui/aui_ctp2/tipwindow.h
   trunk/ctp2_code/ui/aui_ctp2/unittabbutton.cpp
   trunk/ctp2_code/ui/aui_ctp2/unittabbutton.h
   trunk/ctp2_code/ui/aui_ctp2/videowindow.cpp
   trunk/ctp2_code/ui/aui_ctp2/videowindow.h
   trunk/ctp2_code/ui/aui_directx/aui_directaudiomanager.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directaudiomanager.h
   trunk/ctp2_code/ui/aui_directx/aui_directblitter.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directblitter.h
   trunk/ctp2_code/ui/aui_directx/aui_directinput.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directinput.h
   trunk/ctp2_code/ui/aui_directx/aui_directjoystick.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directjoystick.h
   trunk/ctp2_code/ui/aui_directx/aui_directkeyboard.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directkeyboard.h
   trunk/ctp2_code/ui/aui_directx/aui_directmouse.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directmouse.h
   trunk/ctp2_code/ui/aui_directx/aui_directmovie.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directmovie.h
   trunk/ctp2_code/ui/aui_directx/aui_directmoviemanager.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directmoviemanager.h
   trunk/ctp2_code/ui/aui_directx/aui_directsound.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directsound.h
   trunk/ctp2_code/ui/aui_directx/aui_directsurface.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directsurface.h
   trunk/ctp2_code/ui/aui_directx/aui_directui.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directui.h
   trunk/ctp2_code/ui/aui_directx/aui_directx.cpp
   trunk/ctp2_code/ui/aui_directx/aui_directx.h
   trunk/ctp2_code/ui/aui_sdl/aui_sdl.h
   trunk/ctp2_code/ui/aui_sdl/aui_sdlblitter.cpp
   trunk/ctp2_code/ui/aui_sdl/aui_sdlblitter.h
   trunk/ctp2_code/ui/aui_sdl/aui_sdlinput.h
   trunk/ctp2_code/ui/aui_sdl/aui_sdljoystick.cpp
   trunk/ctp2_code/ui/aui_sdl/aui_sdljoystick.h
   trunk/ctp2_code/ui/aui_sdl/aui_sdlkeyboard.cpp
   trunk/ctp2_code/ui/aui_sdl/aui_sdlmouse.cpp
   trunk/ctp2_code/ui/aui_sdl/aui_sdlmouse.h
   trunk/ctp2_code/ui/aui_sdl/aui_sdlsound.cpp
   trunk/ctp2_code/ui/aui_sdl/aui_sdlsound.h
   trunk/ctp2_code/ui/aui_sdl/aui_sdlsurface.cpp
   trunk/ctp2_code/ui/aui_sdl/aui_sdlsurface.h
   trunk/ctp2_code/ui/aui_sdl/aui_sdlui.cpp
   trunk/ctp2_code/ui/aui_sdl/aui_sdlui.h
   trunk/ctp2_code/ui/aui_utils/primitives.cpp
   trunk/ctp2_code/ui/aui_utils/primitives.h
   trunk/ctp2_code/ui/aui_utils/textutils.cpp
   trunk/ctp2_code/ui/aui_utils/textutils.h
   trunk/ctp2_code/ui/aui_utils/vidplay.cpp
   trunk/ctp2_code/ui/aui_utils/vidplay.h
   trunk/ctp2_code/ui/freetype/freetype.h
   trunk/ctp2_code/ui/freetype/fterrid.h
   trunk/ctp2_code/ui/freetype/ftnameid.h
   trunk/ctp2_code/ui/interface/AttractWindow.cpp
   trunk/ctp2_code/ui/interface/AttractWindow.h
   trunk/ctp2_code/ui/interface/CauseAndEffectTab.cpp
   trunk/ctp2_code/ui/interface/CauseAndEffectTab.h
   trunk/ctp2_code/ui/interface/CityControlPanel.cpp
   trunk/ctp2_code/ui/interface/CityControlPanel.h
   trunk/ctp2_code/ui/interface/CityEspionage.cpp
   trunk/ctp2_code/ui/interface/ControlTabPanel.cpp
   trunk/ctp2_code/ui/interface/ControlTabPanel.h
   trunk/ctp2_code/ui/interface/DiplomacyDetails.cpp
   trunk/ctp2_code/ui/interface/DiplomacyDetails.h
   trunk/ctp2_code/ui/interface/DomesticControlPanel.cpp
   trunk/ctp2_code/ui/interface/DomesticControlPanel.h
   trunk/ctp2_code/ui/interface/DomesticManagementDialog.cpp
   trunk/ctp2_code/ui/interface/DomesticManagementDialog.h
   trunk/ctp2_code/ui/interface/EditQueue.cpp
   trunk/ctp2_code/ui/interface/EditQueue.h
   trunk/ctp2_code/ui/interface/EndTurnButton.cpp
   trunk/ctp2_code/ui/interface/EndTurnButton.h
   trunk/ctp2_code/ui/interface/EndgameWindow.cpp
   trunk/ctp2_code/ui/interface/EndgameWindow.h
   trunk/ctp2_code/ui/interface/FileDialog.cpp
   trunk/ctp2_code/ui/interface/FileDialog.h
   trunk/ctp2_code/ui/interface/GovernmentTab.cpp
   trunk/ctp2_code/ui/interface/GovernmentTab.h
   trunk/ctp2_code/ui/interface/GreatLibraryTypes.h
   trunk/ctp2_code/ui/interface/InterfaceEventRegister.cpp
   trunk/ctp2_code/ui/interface/InterfaceEventRegister.h
   trunk/ctp2_code/ui/interface/IntroMovieWin.cpp
   trunk/ctp2_code/ui/interface/IntroMovieWin.h
   trunk/ctp2_code/ui/interface/IntroMovieWindow.cpp
   trunk/ctp2_code/ui/interface/IntroMovieWindow.h
   trunk/ctp2_code/ui/interface/MainControlPanel.cpp
   trunk/ctp2_code/ui/interface/MainControlPanel.h
   trunk/ctp2_code/ui/interface/MapCopyBuffer.cpp
   trunk/ctp2_code/ui/interface/MapCopyBuffer.h
   trunk/ctp2_code/ui/interface/MessageBoxDialog.cpp
   trunk/ctp2_code/ui/interface/MessageBoxDialog.h
   trunk/ctp2_code/ui/interface/MessageControlPanel.cpp
   trunk/ctp2_code/ui/interface/MessageControlPanel.h
   trunk/ctp2_code/ui/interface/NationalManagementDialog.cpp
   trunk/ctp2_code/ui/interface/NationalManagementDialog.h
   trunk/ctp2_code/ui/interface/ProfileEdit.cpp
   trunk/ctp2_code/ui/interface/ProfileEdit.h
   trunk/ctp2_code/ui/interface/ScienceManagementDialog.cpp
   trunk/ctp2_code/ui/interface/ScienceManagementDialog.h
   trunk/ctp2_code/ui/interface/ShortcutPad.cpp
   trunk/ctp2_code/ui/interface/ShortcutPad.h
   trunk/ctp2_code/ui/interface/SpecialAttackWindow.cpp
   trunk/ctp2_code/ui/interface/SpecialAttackWindow.h
   trunk/ctp2_code/ui/interface/StatusBar.cpp
   trunk/ctp2_code/ui/interface/StatusBar.h
   trunk/ctp2_code/ui/interface/String_Search.cpp
   trunk/ctp2_code/ui/interface/String_Search.h
   trunk/ctp2_code/ui/interface/TilesControlPanel.cpp
   trunk/ctp2_code/ui/interface/TilesControlPanel.h
   trunk/ctp2_code/ui/interface/TurnYearStatus.cpp
   trunk/ctp2_code/ui/interface/TurnYearStatus.h
   trunk/ctp2_code/ui/interface/UIUtils.cpp
   trunk/ctp2_code/ui/interface/UIUtils.h
   trunk/ctp2_code/ui/interface/UnitControlPanel.cpp
   trunk/ctp2_code/ui/interface/UnitControlPanel.h
   trunk/ctp2_code/ui/interface/WonderTab.cpp
   trunk/ctp2_code/ui/interface/WonderTab.h
   trunk/ctp2_code/ui/interface/ZoomPad.cpp
   trunk/ctp2_code/ui/interface/ZoomPad.h
   trunk/ctp2_code/ui/interface/agesscreen.cpp
   trunk/ctp2_code/ui/interface/ancientwindows.cpp
   trunk/ctp2_code/ui/interface/armymanagerwindow.cpp
   trunk/ctp2_code/ui/interface/armymanagerwindow.h
   trunk/ctp2_code/ui/interface/backgroundwin.cpp
   trunk/ctp2_code/ui/interface/backgroundwin.h
   trunk/ctp2_code/ui/interface/battle.cpp
   trunk/ctp2_code/ui/interface/battle.h
   trunk/ctp2_code/ui/interface/battleevent.cpp
   trunk/ctp2_code/ui/interface/battleevent.h
   trunk/ctp2_code/ui/interface/battleview.cpp
   trunk/ctp2_code/ui/interface/battleview.h
   trunk/ctp2_code/ui/interface/battleviewwindow.cpp
   trunk/ctp2_code/ui/interface/battleviewwindow.h
   trunk/ctp2_code/ui/interface/c3dialogs.cpp
   trunk/ctp2_code/ui/interface/c3dialogs.h
   trunk/ctp2_code/ui/interface/chatbox.cpp
   trunk/ctp2_code/ui/interface/chatbox.h
   trunk/ctp2_code/ui/interface/cityespionage.h
   trunk/ctp2_code/ui/interface/citymanager.cpp
   trunk/ctp2_code/ui/interface/citymanager.h
   trunk/ctp2_code/ui/interface/citywindow.cpp
   trunk/ctp2_code/ui/interface/citywindow.h
   trunk/ctp2_code/ui/interface/controlpanel.cpp
   trunk/ctp2_code/ui/interface/controlpanelwindow.cpp
   trunk/ctp2_code/ui/interface/controlpanelwindow.h
   trunk/ctp2_code/ui/interface/creditsscreen.cpp
   trunk/ctp2_code/ui/interface/creditsscreen.h
   trunk/ctp2_code/ui/interface/cursormanager.cpp
   trunk/ctp2_code/ui/interface/cursormanager.h
   trunk/ctp2_code/ui/interface/custommapscreen.cpp
   trunk/ctp2_code/ui/interface/custommapscreen.h
   trunk/ctp2_code/ui/interface/debugwindow.cpp
   trunk/ctp2_code/ui/interface/debugwindow.h
   trunk/ctp2_code/ui/interface/diplomacywindow.cpp
   trunk/ctp2_code/ui/interface/diplomacywindow.h
   trunk/ctp2_code/ui/interface/dipwizard.cpp
   trunk/ctp2_code/ui/interface/dipwizard.h
   trunk/ctp2_code/ui/interface/gameplayoptions.cpp
   trunk/ctp2_code/ui/interface/gameplayoptions.h
   trunk/ctp2_code/ui/interface/graphicsresscreen.cpp
   trunk/ctp2_code/ui/interface/graphicsresscreen.h
   trunk/ctp2_code/ui/interface/graphicsscreen.cpp
   trunk/ctp2_code/ui/interface/graphicsscreen.h
   trunk/ctp2_code/ui/interface/greatlibrary.cpp
   trunk/ctp2_code/ui/interface/greatlibrary.h
   trunk/ctp2_code/ui/interface/greatlibrary_util.cpp
   trunk/ctp2_code/ui/interface/greatlibrarywindow.cpp
   trunk/ctp2_code/ui/interface/greatlibrarywindow.h
   trunk/ctp2_code/ui/interface/helptile.cpp
   trunk/ctp2_code/ui/interface/hotseatlist.cpp
   trunk/ctp2_code/ui/interface/hotseatlist.h
   trunk/ctp2_code/ui/interface/infowin.cpp
   trunk/ctp2_code/ui/interface/infowin.h
   trunk/ctp2_code/ui/interface/infowindow.cpp
   trunk/ctp2_code/ui/interface/infowindow.h
   trunk/ctp2_code/ui/interface/initialplayscreen.cpp
   trunk/ctp2_code/ui/interface/initialplaywindow.cpp
   trunk/ctp2_code/ui/interface/initialplaywindow.h
   trunk/ctp2_code/ui/interface/intelligencewindow.cpp
   trunk/ctp2_code/ui/interface/intelligencewindow.h
   trunk/ctp2_code/ui/interface/interfaceevent.cpp
   trunk/ctp2_code/ui/interface/km_screen.cpp
   trunk/ctp2_code/ui/interface/km_screen.h
   trunk/ctp2_code/ui/interface/knowledgewin.cpp
   trunk/ctp2_code/ui/interface/loadsavemapscreen.cpp
   trunk/ctp2_code/ui/interface/loadsavemapwindow.cpp
   trunk/ctp2_code/ui/interface/loadsavemapwindow.h
   trunk/ctp2_code/ui/interface/loadsavescreen.cpp
   trunk/ctp2_code/ui/interface/loadsavewindow.cpp
   trunk/ctp2_code/ui/interface/loadsavewindow.h
   trunk/ctp2_code/ui/interface/messageactions.cpp
   trunk/ctp2_code/ui/interface/messageactions.h
   trunk/ctp2_code/ui/interface/messageadvice.cpp
   trunk/ctp2_code/ui/interface/messageadvice.h
   trunk/ctp2_code/ui/interface/messageeyepoint.cpp
   trunk/ctp2_code/ui/interface/messageeyepoint.h
   trunk/ctp2_code/ui/interface/messageiconbutton.cpp
   trunk/ctp2_code/ui/interface/messageiconbutton.h
   trunk/ctp2_code/ui/interface/messageiconwindow.cpp
   trunk/ctp2_code/ui/interface/messageiconwindow.h
   trunk/ctp2_code/ui/interface/messagelist.cpp
   trunk/ctp2_code/ui/interface/messagelist.h
   trunk/ctp2_code/ui/interface/messagemodal.cpp
   trunk/ctp2_code/ui/interface/messagemodal.h
   trunk/ctp2_code/ui/interface/messageresponse.cpp
   trunk/ctp2_code/ui/interface/messageresponse.h
   trunk/ctp2_code/ui/interface/messagewin.cpp
   trunk/ctp2_code/ui/interface/messagewin.h
   trunk/ctp2_code/ui/interface/messagewindow.cpp
   trunk/ctp2_code/ui/interface/messagewindow.h
   trunk/ctp2_code/ui/interface/musicscreen.cpp
   trunk/ctp2_code/ui/interface/musicscreen.h
   trunk/ctp2_code/ui/interface/musictrackscreen.cpp
   trunk/ctp2_code/ui/interface/musictrackscreen.h
   trunk/ctp2_code/ui/interface/optionsscreen.cpp
   trunk/ctp2_code/ui/interface/optionswindow.cpp
   trunk/ctp2_code/ui/interface/optionswindow.h
   trunk/ctp2_code/ui/interface/optionwarningscreen.cpp
   trunk/ctp2_code/ui/interface/optionwarningscreen.h
   trunk/ctp2_code/ui/interface/progresswindow.cpp
   trunk/ctp2_code/ui/interface/progresswindow.h
   trunk/ctp2_code/ui/interface/radarwin.cpp
   trunk/ctp2_code/ui/interface/radarwindow.cpp
   trunk/ctp2_code/ui/interface/radarwindow.h
   trunk/ctp2_code/ui/interface/rankingtab.cpp
   trunk/ctp2_code/ui/interface/rankingtab.h
   trunk/ctp2_code/ui/interface/scenarioeditor.cpp
   trunk/ctp2_code/ui/interface/scenarioeditor.h
   trunk/ctp2_code/ui/interface/scenarioscreen.cpp
   trunk/ctp2_code/ui/interface/scenariowindow.cpp
   trunk/ctp2_code/ui/interface/scenariowindow.h
   trunk/ctp2_code/ui/interface/sci_advancescreen.cpp
   trunk/ctp2_code/ui/interface/sci_advancescreen.h
   trunk/ctp2_code/ui/interface/sciencevictorydialog.cpp
   trunk/ctp2_code/ui/interface/sciencevictorydialog.h
   trunk/ctp2_code/ui/interface/sciencewin.cpp
   trunk/ctp2_code/ui/interface/sciencewin.h
   trunk/ctp2_code/ui/interface/sciencewindow.h
   trunk/ctp2_code/ui/interface/scoretab.cpp
   trunk/ctp2_code/ui/interface/scoretab.h
   trunk/ctp2_code/ui/interface/scorewarn.cpp
   trunk/ctp2_code/ui/interface/scorewarn.h
   trunk/ctp2_code/ui/interface/screenutils.cpp
   trunk/ctp2_code/ui/interface/screenutils.h
   trunk/ctp2_code/ui/interface/soundscreen.cpp
   trunk/ctp2_code/ui/interface/soundscreen.h
   trunk/ctp2_code/ui/interface/splash.cpp
   trunk/ctp2_code/ui/interface/splash.h
   trunk/ctp2_code/ui/interface/spnewgamediffscreen.cpp
   trunk/ctp2_code/ui/interface/spnewgamemapshapescreen.cpp
   trunk/ctp2_code/ui/interface/spnewgamemapshapescreen.h
   trunk/ctp2_code/ui/interface/spnewgamemapsizescreen.cpp
   trunk/ctp2_code/ui/interface/spnewgamemapsizescreen.h
   trunk/ctp2_code/ui/interface/spnewgameplayersscreen.cpp
   trunk/ctp2_code/ui/interface/spnewgameplayersscreen.h
   trunk/ctp2_code/ui/interface/spnewgamerandomcustomscreen.cpp
   trunk/ctp2_code/ui/interface/spnewgamerandomcustomscreen.h
   trunk/ctp2_code/ui/interface/spnewgamerulesscreen.cpp
   trunk/ctp2_code/ui/interface/spnewgamerulesscreen.h
   trunk/ctp2_code/ui/interface/spnewgamescreen.cpp
   trunk/ctp2_code/ui/interface/spnewgametribescreen.cpp
   trunk/ctp2_code/ui/interface/spnewgametribescreen.h
   trunk/ctp2_code/ui/interface/spnewgamewindow.cpp
   trunk/ctp2_code/ui/interface/spnewgamewindow.h
   trunk/ctp2_code/ui/interface/spriteeditor.cpp
   trunk/ctp2_code/ui/interface/spriteeditor.h
   trunk/ctp2_code/ui/interface/statictextbox.cpp
   trunk/ctp2_code/ui/interface/statictextbox.h
   trunk/ctp2_code/ui/interface/statswindow.cpp
   trunk/ctp2_code/ui/interface/statswindow.h
   trunk/ctp2_code/ui/interface/test.cpp
   trunk/ctp2_code/ui/interface/test.h
   trunk/ctp2_code/ui/interface/testwin.cpp
   trunk/ctp2_code/ui/interface/testwin.h
   trunk/ctp2_code/ui/interface/testwindow.cpp
   trunk/ctp2_code/ui/interface/testwindow.h
   trunk/ctp2_code/ui/interface/text_hasher.h
   trunk/ctp2_code/ui/interface/tileimptracker.cpp
   trunk/ctp2_code/ui/interface/tileimptracker.h
   trunk/ctp2_code/ui/interface/timelinetab.cpp
   trunk/ctp2_code/ui/interface/timelinetab.h
   trunk/ctp2_code/ui/interface/trademanager.cpp
   trunk/ctp2_code/ui/interface/trademanager.h
   trunk/ctp2_code/ui/interface/tutorialwin.cpp
   trunk/ctp2_code/ui/interface/tutorialwin.h
   trunk/ctp2_code/ui/interface/unitmanager.cpp
   trunk/ctp2_code/ui/interface/unitmanager.h
   trunk/ctp2_code/ui/interface/victorymoviewin.cpp
   trunk/ctp2_code/ui/interface/victorymoviewindow.cpp
   trunk/ctp2_code/ui/interface/victorymoviewindow.h
   trunk/ctp2_code/ui/interface/victorywin.cpp
   trunk/ctp2_code/ui/interface/victorywin.h
   trunk/ctp2_code/ui/interface/victorywindow.cpp
   trunk/ctp2_code/ui/interface/victorywindow.h
   trunk/ctp2_code/ui/interface/wondermoviewin.cpp
   trunk/ctp2_code/ui/interface/wondermoviewin.h
   trunk/ctp2_code/ui/interface/wondermoviewindow.cpp
   trunk/ctp2_code/ui/interface/wondermoviewindow.h
   trunk/ctp2_code/ui/interface/workwin.cpp
   trunk/ctp2_code/ui/interface/workwindow.cpp
   trunk/ctp2_code/ui/interface/workwindow.h
   trunk/ctp2_code/ui/ldl/ldl.h
   trunk/ctp2_code/ui/ldl/ldl.l
   trunk/ctp2_code/ui/ldl/ldl.y
   trunk/ctp2_code/ui/ldl/ldl_attr.cpp
   trunk/ctp2_code/ui/ldl/ldl_attr.hpp
   trunk/ctp2_code/ui/ldl/ldl_data.cpp
   trunk/ctp2_code/ui/ldl/ldl_data.hpp
   trunk/ctp2_code/ui/ldl/ldl_data_info.cpp
   trunk/ctp2_code/ui/ldl/ldl_file.cpp
   trunk/ctp2_code/ui/ldl/ldl_file.hpp
   trunk/ctp2_code/ui/ldl/ldl_list.h
   trunk/ctp2_code/ui/ldl/ldl_memmap.cpp
   trunk/ctp2_code/ui/ldl/ldl_memmap.h
   trunk/ctp2_code/ui/ldl/ldl_user.h
   trunk/ctp2_code/ui/ldl/ldlif.cpp
   trunk/ctp2_code/ui/ldl/ldlif.h
   trunk/ctp2_code/ui/ldl/ldlyaccdefs.h
   trunk/ctp2_code/ui/netshell/allinonewindow.cpp
   trunk/ctp2_code/ui/netshell/allinonewindow.h
   trunk/ctp2_code/ui/netshell/connectionselectwindow.cpp
   trunk/ctp2_code/ui/netshell/connectionselectwindow.h
   trunk/ctp2_code/ui/netshell/dialogboxwindow.cpp
   trunk/ctp2_code/ui/netshell/dialogboxwindow.h
   trunk/ctp2_code/ui/netshell/gameselectwindow.cpp
   trunk/ctp2_code/ui/netshell/gameselectwindow.h
   trunk/ctp2_code/ui/netshell/lobbychangewindow.cpp
   trunk/ctp2_code/ui/netshell/lobbychangewindow.h
   trunk/ctp2_code/ui/netshell/lobbywindow.cpp
   trunk/ctp2_code/ui/netshell/lobbywindow.h
   trunk/ctp2_code/ui/netshell/netfunc.cpp
   trunk/ctp2_code/ui/netshell/netfunc.h
   trunk/ctp2_code/ui/netshell/netshell.cpp
   trunk/ctp2_code/ui/netshell/netshell.h
   trunk/ctp2_code/ui/netshell/netshell_game.cpp
   trunk/ctp2_code/ui/netshell/netshell_game.h
   trunk/ctp2_code/ui/netshell/ns_accessor.h
   trunk/ctp2_code/ui/netshell/ns_aiplayer.cpp
   trunk/ctp2_code/ui/netshell/ns_aiplayer.h
   trunk/ctp2_code/ui/netshell/ns_aiplayersetup.cpp
   trunk/ctp2_code/ui/netshell/ns_aiplayersetup.h
   trunk/ctp2_code/ui/netshell/ns_chatbox.cpp
   trunk/ctp2_code/ui/netshell/ns_chatbox.h
   trunk/ctp2_code/ui/netshell/ns_civlistbox.cpp
   trunk/ctp2_code/ui/netshell/ns_civlistbox.h
   trunk/ctp2_code/ui/netshell/ns_customlistbox.cpp
   trunk/ctp2_code/ui/netshell/ns_customlistbox.h
   trunk/ctp2_code/ui/netshell/ns_game.cpp
   trunk/ctp2_code/ui/netshell/ns_game.h
   trunk/ctp2_code/ui/netshell/ns_gamesetup.cpp
   trunk/ctp2_code/ui/netshell/ns_gamesetup.h
   trunk/ctp2_code/ui/netshell/ns_gplayer.cpp
   trunk/ctp2_code/ui/netshell/ns_gplayer.h
   trunk/ctp2_code/ui/netshell/ns_header.cpp
   trunk/ctp2_code/ui/netshell/ns_header.h
   trunk/ctp2_code/ui/netshell/ns_headerswitch.cpp
   trunk/ctp2_code/ui/netshell/ns_headerswitch.h
   trunk/ctp2_code/ui/netshell/ns_improvements.cpp
   trunk/ctp2_code/ui/netshell/ns_improvements.h
   trunk/ctp2_code/ui/netshell/ns_item.cpp
   trunk/ctp2_code/ui/netshell/ns_item.h
   trunk/ctp2_code/ui/netshell/ns_listbox.h
   trunk/ctp2_code/ui/netshell/ns_lobby.cpp
   trunk/ctp2_code/ui/netshell/ns_lobby.h
   trunk/ctp2_code/ui/netshell/ns_object.h
   trunk/ctp2_code/ui/netshell/ns_player.cpp
   trunk/ctp2_code/ui/netshell/ns_player.h
   trunk/ctp2_code/ui/netshell/ns_playersetup.cpp
   trunk/ctp2_code/ui/netshell/ns_playersetup.h
   trunk/ctp2_code/ui/netshell/ns_rplayer.cpp
   trunk/ctp2_code/ui/netshell/ns_rplayer.h
   trunk/ctp2_code/ui/netshell/ns_server.cpp
   trunk/ctp2_code/ui/netshell/ns_server.h
   trunk/ctp2_code/ui/netshell/ns_session.cpp
   trunk/ctp2_code/ui/netshell/ns_session.h
   trunk/ctp2_code/ui/netshell/ns_spinner.cpp
   trunk/ctp2_code/ui/netshell/ns_spinner.h
   trunk/ctp2_code/ui/netshell/ns_string.cpp
   trunk/ctp2_code/ui/netshell/ns_string.h
   trunk/ctp2_code/ui/netshell/ns_transport.cpp
   trunk/ctp2_code/ui/netshell/ns_transport.h
   trunk/ctp2_code/ui/netshell/ns_tribes.cpp
   trunk/ctp2_code/ui/netshell/ns_tribes.h
   trunk/ctp2_code/ui/netshell/ns_units.cpp
   trunk/ctp2_code/ui/netshell/ns_units.h
   trunk/ctp2_code/ui/netshell/ns_window.cpp
   trunk/ctp2_code/ui/netshell/ns_window.h
   trunk/ctp2_code/ui/netshell/ns_wonders.cpp
   trunk/ctp2_code/ui/netshell/ns_wonders.h
   trunk/ctp2_code/ui/netshell/passwordscreen.cpp
   trunk/ctp2_code/ui/netshell/passwordscreen.h
   trunk/ctp2_code/ui/netshell/playereditwindow.cpp
   trunk/ctp2_code/ui/netshell/playereditwindow.h
   trunk/ctp2_code/ui/netshell/playerselectwindow.cpp
   trunk/ctp2_code/ui/netshell/playerselectwindow.h
   trunk/ctp2_code/ui/netshell/serverselectwindow.cpp
   trunk/ctp2_code/ui/netshell/serverselectwindow.h
   trunk/ctp2_code/ui/slic_debug/segmentlist.cpp
   trunk/ctp2_code/ui/slic_debug/segmentlist.h
   trunk/ctp2_code/ui/slic_debug/sourcelist.cpp
   trunk/ctp2_code/ui/slic_debug/sourcelist.h
   trunk/ctp2_code/ui/slic_debug/watchlist.cpp
   trunk/ctp2_code/ui/slic_debug/watchlist.h
   trunk/ctp2_code/user-robotcom/aimain/aimain.cpp
   trunk/ctp2_code/user-robotcom/aimain/aimain.h
   trunk/ctp2_code/user-robotcom/incom/irobot.h
   trunk/ctp2_code/user-robotcom/incom/robotcom.cpp
   trunk/ctp2_code/user-robotcom/incom/robotcom.h
   trunk/ctp2_code/user-robotcom/outcom/IC3Trade.h
   trunk/ctp2_code/user-robotcom/outcom/ic3BlgDB.h
   trunk/ctp2_code/user-robotcom/outcom/ic3CivArchive.h
   trunk/ctp2_code/user-robotcom/outcom/ic3DipReq.h
   trunk/ctp2_code/user-robotcom/outcom/ic3ErrorReport.h
   trunk/ctp2_code/user-robotcom/outcom/ic3GameState.h
   trunk/ctp2_code/user-robotcom/outcom/ic3Government.h
   trunk/ctp2_code/user-robotcom/outcom/ic3InstDB.h
   trunk/ctp2_code/user-robotcom/outcom/ic3Population.h
   trunk/ctp2_code/user-robotcom/outcom/ic3Rand.h
   trunk/ctp2_code/user-robotcom/outcom/ic3RobotAstar.h
   trunk/ctp2_code/user-robotcom/outcom/ic3Science.h
   trunk/ctp2_code/user-robotcom/outcom/ic3String.h
   trunk/ctp2_code/user-robotcom/outcom/ic3TerrDB.h
   trunk/ctp2_code/user-robotcom/outcom/ic3UnitDB.h
   trunk/ctp2_code/user-robotcom/outcom/ic3Wonder.h
   trunk/ctp2_code/user-robotcom/outcom/ic3endgamedb.h
   trunk/ctp2_code/user-robotcom/outcom/ic3player.h
   trunk/ctp2_code/user-robotcom/outcom/ic3world.h
   trunk/ctp2_code/user-robotcom/shared/aicause.h
   trunk/ctp2_code/user-robotcom/shared/ctp-types.h
   trunk/ctp2_code/user-robotcom/shared/ctp.h
   trunk/ctp2_code/user-robotcom/shared/diplomatictypes.h
   trunk/ctp2_code/user-robotcom/shared/globals.h
   trunk/ctp2_code/user-robotcom/shared/improvementtypes.h
   trunk/ctp2_code/user-robotcom/shared/mappointdata.h
   trunk/ctp2_code/user-robotcom/shared/order.h

Modified: trunk/ctp2_code/GameWatch/gamewatch/DLLTypes.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gamewatch/DLLTypes.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gamewatch/DLLTypes.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,19 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #ifndef _BMH_GW_DLL_TYPES_H_
 #define _BMH_GW_DLL_TYPES_H_
 
-
 #ifdef _MSC_VER
 #pragma warning(disable:4251)
 #endif
@@ -38,12 +25,12 @@
 
 #ifdef __GW_USE_IMPORT
 #define GWDllHeader DllImport
-#else 
+#else
 #ifdef __GW_USE_EXPORT
 #define GWDllHeader DllExport
-#else 
+#else
 #define GWDllHeader
-#endif 
-#endif 
+#endif
+#endif
 
-#endif 
+#endif

Modified: trunk/ctp2_code/GameWatch/gamewatch/GWDelivery.cpp
==============================================================================
--- trunk/ctp2_code/GameWatch/gamewatch/GWDelivery.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gamewatch/GWDelivery.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,70 +1,47 @@
-
-
-
-
-
-
-
-
-
 #include "GWDelivery.h"
 
-
 DllExport GWDeliveryList GWDelivery::deliverySystems;
 
-
 DllExport GWDelivery* GWDelivery::Find(char *deliveryName)
 {
-	
+
 	GWDeliveryList::iterator deliverySystem;
 
-	
 	for(deliverySystem = deliverySystems.begin(); deliverySystem != deliverySystems.end(); deliverySystem++) {
-		
+
 		if(!strcmp(deliveryName, (*deliverySystem)->name))
 			return(*deliverySystem);
 	}
 
-	
 	return(NULL);
 }
 
-
 DllExport GWDelivery::GWDelivery()
 {
-	
-	
-	
+
+
 	name = "unknown";
 
-	
 	parameters = NULL;
 
-	
 	deliverySystems.push_back(this);
 }
 
-
 DllExport GWDelivery::~GWDelivery()
 {
-	
-	
+
 	if(parameters) free(parameters);
 
-	
 	deliverySystems.remove(this);
 }
 
-
 DllExport void GWDelivery::SetParameters(char *systemParameters)
 {
-	
-	
+
 	if(parameters) {
 		free(parameters);
 		parameters = NULL;
 	}
 
-	
 	if(systemParameters) parameters = strdup(systemParameters);
 }

Modified: trunk/ctp2_code/GameWatch/gamewatch/GWDelivery.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gamewatch/GWDelivery.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gamewatch/GWDelivery.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,77 +1,55 @@
-
-
-
-
-
-
-
-
 #ifndef _BMH_GW_DELIVERY_H_
 #define _BMH_GW_DELIVERY_H_
 
-
 #include "DLLTypes.h"
 
-
 class GWDelivery;
 
-
 #include <List>
 
-
 using std::list;
 
-
 typedef list<GWDelivery*> GWDeliveryList;
 
-
 class GWDllHeader GWDelivery {
 public:
-	
+
 	static GWDelivery* Find(char *deliveryName);
 
-	
 	GWDelivery();
 
-	
 	virtual ~GWDelivery();
 
-	
-	
+
 	virtual bool Deliver(char *stamp, void *data, long numOfBytes) = 0;
 
-	
-	
-	
+
+
+
 	virtual bool Receive(char **stamp, void **data, long *numOfBytes) = 0;
 
-	
-	
-	
+
+
+
 	virtual void FreeStamp(char *stamp) = 0;
 	virtual void FreeData(void *data) = 0;
 
-	
 	void SetParameters(char *systemParameters);
 
 protected:
-	
-	
+
 	void SetName(char *registerName) { name = registerName; }
 
-	
-	
+
 	char *GetParameters() { return(parameters); }
 
 private:
-	
+
 	static GWDeliveryList deliverySystems;
 
-	
 	char *name;
 
-	
 	char *parameters;
 };
 
-#endif 
\ No newline at end of file
+#endif

Modified: trunk/ctp2_code/GameWatch/gamewatch/GWRecord.cpp
==============================================================================
--- trunk/ctp2_code/GameWatch/gamewatch/GWRecord.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gamewatch/GWRecord.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,52 +1,34 @@
-
-
-
-
-
-
-
-
-
 #include "GWRecord.h"
 
-
 DllExport int GWRecord::uniqueID = 0;
 
-
 DllExport GWRecordList GWRecord::records;
 
-
 DllExport GWRecord* GWRecord::Find(int recordID)
 {
-	
+
 	GWRecordList::iterator record;
 
-	
 	for(record = records.begin(); record != records.end(); record++) {
-		
+
 		if(recordID == (*record)->ID)
 			return(*record);
 	}
 
-	
 	return(NULL);
 }
 
 
-
 DllExport GWRecord::GWRecord()
 {
-	
-	
+
 	ID = uniqueID++;
 
-	
 	records.push_back(this);
 }
 
-
 DllExport GWRecord::~GWRecord()
 {
-	
+
 	records.remove(this);
 }

Modified: trunk/ctp2_code/GameWatch/gamewatch/GWRecord.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gamewatch/GWRecord.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gamewatch/GWRecord.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,70 +1,49 @@
-
-
-
-
-
-
-
-
 #ifndef _BMH_GW_RECORD_H_
 #define _BMH_GW_RECORD_H_
 
-
 #include "DLLTypes.h"
 
-
 class GWRecord;
 
-
 #include <list>
 
-
 using std::list;
 
-
 typedef list<GWRecord*> GWRecordList;
 
-
 class GWDllHeader GWRecord {
 public:
-	
+
 	static GWRecord* Find(int recordID);
 
-	
-	
+
 	GWRecord();
 
-	
 	virtual ~GWRecord();
 
-	
-	
+
 	virtual GWRecord* Merge(GWRecord *record) = 0;
 
-	
-	
-	
+
+
+
 	virtual char *Export(char *baseName, char *stamp) = 0;
 
-	
-	
-	
+
+
+
 	virtual void GetData(void **data, long *numOfBytes) = 0;
 
-	
-	
+
 	int GetID() { return(ID); }
 
 private:
-	
-	
+
 	static int uniqueID;
 
-	
 	static GWRecordList records;
 
-	
 	int ID;
 };
 
-#endif 
+#endif

Modified: trunk/ctp2_code/GameWatch/gamewatch/GWRecorder.cpp
==============================================================================
--- trunk/ctp2_code/GameWatch/gamewatch/GWRecorder.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gamewatch/GWRecorder.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,63 +1,43 @@
-
-
-
-
-
-
-
-
-
 #include "GWRecorder.h"
 
-
 #include "GWRecord.h"
 
-
 DllExport GWRecorderList GWRecorder::recordingSystems;
 
-
 DllExport GWRecorder* GWRecorder::Find(char *recordingName)
 {
-	
+
 	GWRecorderList::iterator recordingSystem;
 
-	
 	for(recordingSystem = recordingSystems.begin(); recordingSystem != recordingSystems.end(); recordingSystem++) {
-		
+
 		if(!strcmp(recordingName, (*recordingSystem)->name))
 			return(*recordingSystem);
 	}
 
-	
 	return(NULL);
 }
 
-
 DllExport GWRecorder::GWRecorder()
 {
-	
-	
-	
+
+
 	name = "unknown";
 
-	
 	recordingSystems.push_back(this);
 }
 
-
 DllExport GWRecorder::~GWRecorder()
 {
-	
+
 	recordingSystems.remove(this);
 }
 
-
 DllExport void GWRecorder::DeleteRecord(int recordID)
 {
-	
+
 	GWRecord *record = GWRecord::Find(recordID);
 
-	
 	if(record) delete record;
 }
 
@@ -66,18 +46,15 @@
 
 DllExport int GWRecorder::MergeRecords(int firstRecordID, int secondRecordID)
 {
-	
+
 	GWRecord *firstRecord = GWRecord::Find(firstRecordID);
 	GWRecord *secondRecord = GWRecord::Find(secondRecordID);
 
-	
 	GWRecord *mergedRecord = NULL;
 	if(firstRecord && secondRecord) mergedRecord = firstRecord->Merge(secondRecord);
 
-	
 	if(mergedRecord) return(mergedRecord->GetID());
 
-	
 	return(-1);
 }
 
@@ -86,26 +63,21 @@
 
 DllExport char *GWRecorder::ExportRecord(int recordID, char *baseName, char *stamp)
 {
-	
+
 	GWRecord *record = GWRecord::Find(recordID);
 
-	
 	if(record) return(record->Export(baseName, stamp));
 
-	
 	return(NULL);
 }
 
-
 DllExport void GWRecorder::GetRecord(int recordID, void **data, long *numOfBytes)
 {
-	
+
 	*data = NULL;
 	*numOfBytes = 0;
 
-	
 	GWRecord *record = GWRecord::Find(recordID);
 
-	
 	if(record) record->GetData(data, numOfBytes);
 }

Modified: trunk/ctp2_code/GameWatch/gamewatch/GWRecorder.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gamewatch/GWRecorder.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gamewatch/GWRecorder.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,82 +1,62 @@
-
-
-
-
-
-
-
-
 #ifndef _BMH_GW_RECORDER_H_
 #define _BMH_GW_RECORDER_H_
 
-
 #include "DLLTypes.h"
 
-
 class GWRecorder;
 
-
 #include <List>
 
-
 using std::list;
 
-
 typedef list<GWRecorder*> GWRecorderList;
 
-
 class GWDllHeader GWRecorder {
 public:
-	
+
 	static GWRecorder* Find(char *recordingName);
 
-	
 	GWRecorder();
 
-	
 	virtual ~GWRecorder();
 
-	
-	
-	
+
+
+
 	virtual int CreateRecord() = 0;
 
-	
-	
-	
-	
+
+
+
+
 	virtual int CreateRecord(void *data, long numOfBytes) = 0;
 
-	
 	virtual void DeleteRecord(int recordID);
 
-	
-	
-	
+
+
+
 	virtual int MergeRecords(int firstRecordID, int secondRecordID);
 
-	
-	
-	
-	
-	
+
+
+
+
+
 	virtual char *ExportRecord(int recordID, char *baseName, char *stamp);
 
-	
-	
+
 	virtual void GetRecord(int recordID, void **data, long *numOfBytes);
 
 protected:
-	
-	
+
 	void SetName(char *registerName) { name = registerName; }
 
 private:
-	
+
 	static GWRecorderList recordingSystems;
 
-	
 	char *name;
 };
 
-#endif 
\ No newline at end of file
+#endif

Modified: trunk/ctp2_code/GameWatch/gamewatch/GameWatch.cpp
==============================================================================
--- trunk/ctp2_code/GameWatch/gamewatch/GameWatch.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gamewatch/GameWatch.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,46 +1,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
 #include "GameWatch.h"
 
-
 #include <winbase.h>
 
-
 #include "GWDelivery.h"
 #include "GWRecorder.h"
 
-
 DllExport GameWatch gameWatch;
 
-
 DllExport GameWatch::GameWatch()
 {
-	
-	
+
 	deliverySystem = NULL;
 	deliveryLibrary = NULL;
 	recordingSystem = NULL;
 	recordingLibrary = NULL;
 }
 
-
 DllExport GameWatch::~GameWatch()
 {
-	
+
 	if(deliveryLibrary) FreeLibrary(deliveryLibrary);
 
-	
 	if(recordingLibrary) FreeLibrary(recordingLibrary);
 }
 
@@ -51,43 +31,36 @@
 
 DllExport bool GameWatch::DeliverySystem(char *name, char *parameters)
 {
-	
-	
+
 	deliverySystem = GWDelivery::Find(name);
 
-	
 	if(deliverySystem) {
-		
+
 		deliverySystem->SetParameters(parameters);
-		
-		
+
 		return(true);
 	}
 
-	
-	
-	
+
+
+
 	if(deliveryLibrary) FreeLibrary(deliveryLibrary);
 
-	
-	
-	
+
+
+
 	deliveryLibrary = LoadLibrary(name);
 
-	
-	
+
 	deliverySystem = GWDelivery::Find(name);
 
-	
 	if(deliverySystem) {
-		
+
 		deliverySystem->SetParameters(parameters);
-		
-		
+
 		return(true);
 	}
 
-	
 	return(false);
 }
 
@@ -96,31 +69,26 @@
 
 DllExport bool GameWatch::RecordingSystem(char *name)
 {
-	
-	
+
 	recordingSystem = GWRecorder::Find(name);
 
-	
 	if(recordingSystem) return(true);
 
-	
-	
-	
+
+
+
 	if(recordingLibrary) FreeLibrary(recordingLibrary);
 
-	
-	
-	
+
+
+
 	recordingLibrary = LoadLibrary(name);
 
-	
-	
+
 	recordingSystem = GWRecorder::Find(name);
 
-	
 	if(recordingSystem) return(true);
 
-	
 	return(false);
 }
 
@@ -129,10 +97,9 @@
 
 DllExport int GameWatch::StartGame()
 {
-	
+
 	if(recordingSystem) return(recordingSystem->CreateRecord());
 
-	
 	return(-1);
 }
 
@@ -141,22 +108,18 @@
 
 DllExport void GameWatch::EndGame(int gameID, char *stamp)
 {
-	
+
 	if(gameID < 0) return;
 
-	
 	if(!recordingSystem) return;
 
-	
 	void *data = NULL;
 	long numOfBytes = 0;
 	recordingSystem->GetRecord(gameID, &data, &numOfBytes);
 
-	
-	
+
 	if(deliverySystem) deliverySystem->Deliver(stamp, data, numOfBytes);
 
-	
 	recordingSystem->DeleteRecord(gameID);
 }
 
@@ -165,65 +128,49 @@
 
 DllExport void GameWatch::SaveGame(int gameID, char *filename)
 {
-	
+
 	if(gameID < 0) return;
 
-	
 	void *data = NULL;
 	long numOfBytes = 0;
 	recordingSystem->GetRecord(gameID, &data, &numOfBytes);
 
-	
 	FILE *saveFile = fopen(filename, "wb");
 
-	
 	if(!saveFile) return;
 
-	
 	fwrite(&numOfBytes, sizeof(numOfBytes), 1, saveFile);
 
-	
 	if(numOfBytes) fwrite(data, numOfBytes, 1, saveFile);
 
-	
 	fclose(saveFile);
 }
 
 
-
 DllExport int GameWatch::LoadGame(char *filename)
 {
-	
+
 	void *data = NULL;
 	long numOfBytes = 0;
 
-	
 	FILE *loadFile = fopen(filename, "rb");
 
-	
 	if(!loadFile) return(-1);
 
-	
 	fread(&numOfBytes, sizeof(numOfBytes), 1, loadFile);
 
-	
 	if(numOfBytes) {
-		
+
 		data = malloc(numOfBytes);
 
-		
 		fread(data, numOfBytes, 1, loadFile);
 	}
 
-	
 	fclose(loadFile);
 
-	
 	int gameID = recordingSystem->CreateRecord(data, numOfBytes);
 
-	
 	if(data) free(data);
 
-	
 	return(gameID);
 }

Modified: trunk/ctp2_code/GameWatch/gamewatch/GameWatch.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gamewatch/GameWatch.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gamewatch/GameWatch.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,98 +1,77 @@
+#ifndef _BMH_GAME_WATCH_H_
+#define _BMH_GAME_WATCH_H_
 
+#include "DLLTypes.h"
 
 
 
 
+#include <wtypes.h>
 
 
+class GWDelivery;
+class GWRecorder;
 
 
 
 
+class GWDllHeader GameWatch {
+public:
 
-#ifndef _BMH_GAME_WATCH_H_
-#define _BMH_GAME_WATCH_H_
+	GameWatch();
 
+	~GameWatch();
 
-#include "DLLTypes.h"
 
 
 
 
-#include <wtypes.h>
 
+	bool DeliverySystem(char *name, char *parameters);
 
 
-class GWDelivery;					
-class GWRecorder;					
 
 
+	bool RecordingSystem(char *name);
 
 
-class GWDllHeader GameWatch {
-public:
 
-	
-	GameWatch();
 
-	
-	~GameWatch();
+	int StartGame();
 
-	
-	
-	
-	
-	
-	bool DeliverySystem(char *name, char *parameters);
 
-	
-	
-	
-	bool RecordingSystem(char *name);
 
-	
-	
-	
-	int StartGame();
 
-	
-	
-	
 	void EndGame(int gameID, char *stamp);
 
-	
-	
-	
+
+
+
 	void SaveGame(int gameID, char *filename);
 
-	
-	
+
 	int LoadGame(char *filename);
 
 protected:
-	
-	
-	
-	
+
+
+
+
 	GWDelivery *GetDeliverySystem() { return(deliverySystem); }
 	GWRecorder *GetRecordingSystem() { return(recordingSystem); }
 
 private:
 
-	
 	GWDelivery *deliverySystem;
 
-	
 	HINSTANCE deliveryLibrary;
 
-	
 	GWRecorder *recordingSystem;
 
-	
 	HINSTANCE recordingLibrary;
 
 };
 
-GWDllHeader extern GameWatch gameWatch; 
+GWDllHeader extern GameWatch gameWatch;
 
-#endif 
\ No newline at end of file
+#endif

Modified: trunk/ctp2_code/GameWatch/gwarchive/GWArchive.cpp
==============================================================================
--- trunk/ctp2_code/GameWatch/gwarchive/GWArchive.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwarchive/GWArchive.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,145 +1,101 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
 #include "GWArchive.h"
 
-
 #include <errno.h>
 #include <direct.h>
 
-
 #include "GWDelivery.h"
 #include "GWRecorder.h"
 
-
 DllExport GWArchive gwArchive;
 
 
-
 DllExport void GWArchive::Archive(char *basePath)
 {
-	
+
 	CreateDirectory(basePath);
 
-	
 	GWDelivery *deliveryArchive = GetDeliverySystem();
 	GWRecorder *recordingArchive = GetRecordingSystem();
 
-	
 	int index = 0;
 
-	
 	char *stamp = NULL;
 	void *data = NULL;
 	long numOfBytes;
 
-	
 	int mergeID = recordingArchive->CreateRecord();
 
-	
 	while(deliveryArchive->Receive(&stamp, &data, &numOfBytes)) {
-		
+
 		int recordID = recordingArchive->CreateRecord(data, numOfBytes);
 
-		
 		char exportName[1024];
 		sprintf(exportName, "%s\\export%d", basePath, index);
 
-		
 		index++;
 
-		
-		
-		
+
+
+
 		recordingArchive->ExportRecord(recordID, exportName, stamp);
 
-		
 		int newMergeID = recordingArchive->MergeRecords(mergeID, recordID);
 
-		
 		recordingArchive->DeleteRecord(mergeID);
 
-		
 		mergeID = newMergeID;
 
-		
 		recordingArchive->DeleteRecord(recordID);
 
-		
 		deliveryArchive->FreeStamp(stamp);
 		deliveryArchive->FreeData(data);
 	}
 
-	
 	char mergeName[1024];
 	sprintf(mergeName, "%s\\summary", basePath);
 
-	
-	
+
 	recordingArchive->ExportRecord(mergeID, mergeName, NULL);
 
-	
 	recordingArchive->DeleteRecord(mergeID);
 }
 
-
 DllExport void GWArchive::CreateDirectory(char *path)
 {
-	
-	
+
 	if((_mkdir(path) == -1) && (errno == ENOENT)) {
-		
+
 		char *smallerPath = TruncatePath(path);
 
-		
 		if(smallerPath) {
-			
-			
+
 			CreateDirectory(smallerPath);
 
-			
 			_mkdir(path);
 
-			
 			free(smallerPath);
 		}
 	}
 }
 
-
 DllExport char *GWArchive::TruncatePath(char *path)
 {
-	
+
 	char *newPath = strdup(path);
 
-	
 	int length = strlen(newPath);
 
-	
 	for(int index = length - 1; index >= 0; index--) {
-		
+
 		if((newPath[index] == '/') || (newPath[index] == '\\')) {
-			
+
 			newPath[index] = '\0';
 
-			
 			return(newPath);
 		}
 	}
 
-	
 	free(newPath);
 
-	
 	return(NULL);
 }

Modified: trunk/ctp2_code/GameWatch/gwarchive/GWArchive.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gwarchive/GWArchive.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwarchive/GWArchive.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,39 +1,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #ifndef _BMH_GW_ARCHIVE_H_
 #define _BMH_GW_ARCHIVE_H_
 
-
 #include "GWArchiveDLL.h"
 
-
 #include "GameWatch.h"
 
-
 class GWArchiveDllHeader GWArchive : public GameWatch {
 public:
-	
-	
+
 	virtual void Archive(char *basePath);
 
 private:
-	
+
 	void CreateDirectory(char *path);
 
-	
 	char *TruncatePath(char *path);
 };
 
-GWArchiveDllHeader extern GWArchive gwArchive;	
+GWArchiveDllHeader extern GWArchive gwArchive;
 
-#endif 
\ No newline at end of file
+#endif

Modified: trunk/ctp2_code/GameWatch/gwarchive/GWArchiveDLL.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gwarchive/GWArchiveDLL.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwarchive/GWArchiveDLL.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,20 +1,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #ifndef _BMH_GWARCHIVE_DLL_TYPES_H_
 #define _BMH_GWARCHIVE_DLL_TYPES_H_
 
 
-
 #pragma warning(disable:4251)
 
 
@@ -38,12 +25,12 @@
 
 #ifdef __GWARCHIVE_USE_IMPORT
 #define GWArchiveDllHeader DllImport
-#else 
+#else
 #ifdef __GWARCHIVE_USE_EXPORT
 #define GWArchiveDllHeader DllExport
-#else 
+#else
 #define GWArchiveDllHeader
-#endif 
-#endif 
+#endif
+#endif
 
-#endif 
+#endif

Modified: trunk/ctp2_code/GameWatch/gwarchive/main.cpp
==============================================================================
--- trunk/ctp2_code/GameWatch/gwarchive/main.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwarchive/main.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,50 +1,31 @@
-
-
-
-
-
-
-
-
-
-
-
 #include <stdlib.h>
 #include <stdio.h>
 
-
 #include "GWArchive.h"
 
-
 void main(int argc, char **argv)
 {
-	
+
 	if(argc != 5) {
-		
+
 		fprintf(stderr, "usage: %s delivery deliveryArguments recording destDir\n", argv[0]);
 
-		
 		exit(EXIT_FAILURE);
 	}
 
-	
 	if(!(gwArchive.DeliverySystem(argv[1], argv[2]))) {
-		
+
 		fprintf(stderr, "error: delivery system (%s %s) failed\n", argv[1], argv[2]);
 
-		
 		exit(EXIT_FAILURE);
 	}
 
-	
 	if(!(gwArchive.RecordingSystem(argv[3]))) {
-		
+
 		fprintf(stderr, "error: recording system (%s) failed\n", argv[3]);
 
-		
 		exit(EXIT_FAILURE);
 	}
 
-	
 	gwArchive.Archive(argv[4]);
 }

Modified: trunk/ctp2_code/GameWatch/gwciv/GWCiv.cpp
==============================================================================
--- trunk/ctp2_code/GameWatch/gwciv/GWCiv.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwciv/GWCiv.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,29 +1,15 @@
-
-
-
-
-
-
-
-
-
 #include "GWCiv.h"
 
-
 #include "GWCivRecord.h"
 
-
 DllExport GWCiv gwCiv;
 
-
 DllExport GWCiv::GWCiv()
 {
-	
-	
+
 	SetName("gwciv");
 }
 
-
 DllExport GWCiv::~GWCiv()
 {
 }
@@ -33,10 +19,9 @@
 
 DllExport int GWCiv::CreateRecord()
 {
-	
+
 	GWCivRecord *newRecord = new GWCivRecord;
 
-	
 	return(newRecord->GetID());
 }
 
@@ -46,10 +31,9 @@
 
 DllExport int GWCiv::CreateRecord(void *data, long numOfBytes)
 {
-	
+
 	GWCivRecord *newRecord = new GWCivRecord(data, numOfBytes);
 
-	
 	return(newRecord->GetID());
 }
 
@@ -59,10 +43,9 @@
 
 DllExport void GWCiv::UnitBuilt(int recordID, char *unitName, int unitCost, char *builderAIP)
 {
-	
+
 	GWCivRecord *record = (GWCivRecord*)GWRecord::Find(recordID);
 
-	
 	if(record) record->UnitBuilt(unitName, unitCost, builderAIP);
 }
 
@@ -73,9 +56,8 @@
 
 DllExport void GWCiv::UnitKill(int recordID, char *unitName, int destroyedUnitCost, char *killerAIP, char *killedAIP)
 {
-	
+
 	GWCivRecord *record = (GWCivRecord*)GWRecord::Find(recordID);
 
-	
 	if(record) record->UnitKill(unitName, destroyedUnitCost, killerAIP, killedAIP);
 }

Modified: trunk/ctp2_code/GameWatch/gwciv/GWCiv.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gwciv/GWCiv.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwciv/GWCiv.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,54 +1,42 @@
+#ifndef _BMH_GW_CIV_H_
+#define _BMH_GW_CIV_H_
 
+#include "GWCivDLL.h"
 
+#include "GWRecorder.h"
 
+class GWCivDllHeader GWCiv : public GWRecorder {
+public:
 
+	GWCiv();
 
+	virtual ~GWCiv();
 
 
 
-#ifndef _BMH_GW_CIV_H_
-#define _BMH_GW_CIV_H_
 
+	virtual int CreateRecord();
 
-#include "GWCivDLL.h"
 
 
-#include "GWRecorder.h"
 
 
-class GWCivDllHeader GWCiv : public GWRecorder {
-public:
-	
-	GWCiv();
+	virtual int CreateRecord(void *data, long numOfBytes);
+
 
-	
-	virtual ~GWCiv();
 
-	
-	
-	
-	virtual int CreateRecord();
 
-	
-	
-	
-	
-	virtual int CreateRecord(void *data, long numOfBytes);
 
-	
-	
-	
-	
 	virtual void UnitBuilt(int recordID, char *unitName, int unitCost, char *builderAIP);
 
-	
-	
-	
-	
-	
+
+
+
+
+
 	virtual void UnitKill(int recordID, char *unitName, int destroyedUnitCost, char *killerAIP, char *killedAIP);
 };
 
-GWCivDllHeader extern GWCiv gwCiv;  
+GWCivDllHeader extern GWCiv gwCiv;
 
-#endif 
+#endif

Modified: trunk/ctp2_code/GameWatch/gwciv/GWCivDLL.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gwciv/GWCivDLL.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwciv/GWCivDLL.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,20 +1,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #ifndef _BMH_GW_CIV_DLL_TYPES_H_
 #define _BMH_GW_CIV_DLL_TYPES_H_
 
 
-
 #pragma warning(disable:4251)
 
 
@@ -38,12 +25,12 @@
 
 #ifdef __GWCIV_USE_IMPORT
 #define GWCivDllHeader DllImport
-#else 
+#else
 #ifdef __GWCIV_USE_EXPORT
 #define GWCivDllHeader DllExport
-#else 
+#else
 #define GWCivDllHeader
-#endif 
-#endif 
+#endif
+#endif
 
-#endif 
+#endif

Modified: trunk/ctp2_code/GameWatch/gwciv/GWCivRecord.cpp
==============================================================================
--- trunk/ctp2_code/GameWatch/gwciv/GWCivRecord.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwciv/GWCivRecord.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,118 +1,90 @@
-
-
-
-
-
-
-
-
-
 #include "GWCivRecord.h"
 
-
 class GWUnitRecord {
 public:
-	char name[128];	
-	int cost;		
-	int benefit;	
-
-	char builderAIP[80];	
-	char killerAIP[80];		
-	char killedAIP[80];		
+	char name[128];
+	int cost;
+	int benefit;
+
+	char builderAIP[80];
+	char killerAIP[80];
+	char killedAIP[80];
 
-	GWUnitRecord *next;		
+	GWUnitRecord *next;
 };
 
-
 DllExport GWCivRecord::GWCivRecord() : GWRecord()
 {
-	
+
 	head = NULL;
 	dataBuffer = NULL;
 }
 
 
-
 DllExport GWCivRecord::GWCivRecord(void *data, long numOfBytes) : GWRecord()
 {
-	
+
 	head = NULL;
 	dataBuffer = NULL;
 
-	
 	long size = numOfBytes / sizeof(GWUnitRecord);
 
-	
 	GWUnitRecord *unitArray = (GWUnitRecord*)data;
 
-	
-	
+
 	for(int index = 0; index < size; index++) {
-		
+
 		GWUnitRecord *record = new GWUnitRecord;
 
-		
 		strcpy(record->name, unitArray[index].name);
 		record->cost = unitArray[index].cost;
 		record->benefit = unitArray[index].benefit;
 		record->next = NULL;
 
-		
 		AddUnitRecord(record);
 	}
 }
 
-
 DllExport GWCivRecord::~GWCivRecord()
 {
-	
+
 	while(head) {
-		
+
 		GWUnitRecord *record = head;
 
-		
 		head = record->next;
 
-		
 		delete record;
 	}
 
-	
 	if(dataBuffer) delete [] dataBuffer;
 }
 
 
-
 DllExport GWRecord* GWCivRecord::Merge(GWRecord *record)
 {
-	
+
 	GWCivRecord *newRecord = new GWCivRecord;
 
-	
 	GWUnitRecord *current = head;
 
-	
 	while(current) {
-		
+
 		newRecord->UnitBuilt(current->name, current->cost, current->builderAIP);
 		newRecord->UnitKill(current->name, current->benefit, current->killerAIP, current->killedAIP);
 
-		
 		current = current->next;
 	}
 
-	
 	current = ((GWCivRecord*)record)->head;
 	while(current) {
-		
+
 		newRecord->UnitBuilt(current->name, current->cost, current->builderAIP);
 		newRecord->UnitKill(current->name, current->benefit, current->killerAIP, current->killedAIP);
 
-		
 		current = current->next;
 	}
 
-	
 	return(newRecord);
 }
 
@@ -121,16 +93,13 @@
 
 DllExport char *GWCivRecord::Export(char *baseName, char *stamp)
 {
-	
-	
+
 	char fileName[1024];
 	sprintf(fileName, "%s.txt", baseName);
 
-	
 	FILE *exportFile = fopen(fileName, "w");
 	if(!exportFile) return(NULL);
 
-	
 	if(stamp) fprintf(exportFile, "Unique identifier: %s\n\n", stamp);
 	else fprintf(exportFile, "Summary\n\n");
 
@@ -232,88 +201,69 @@
 
 
 
-	
-	
 
-	
+
+
+
 	oldList = head;
 
-	
 	head = NULL;
 
-	
 	while(oldList) {
-		
+
 		GWUnitRecord *nextRecord = oldList->next;
 
-		
 		oldList->next = NULL;
 
-		
 		SortUnitRecord(oldList);
 
-		
 		oldList = nextRecord;
 	}
 
-	
 	fprintf(exportFile, "------------------------------------------------------------------------------\n");
 	fprintf(exportFile, "Name                                               Benefit      Cost     Ratio\n");
 	fprintf(exportFile, "------------------------------------------------------------------------------\n\n");
 
-	
 	current = head;
 
-	
 	while(current) {
-		
+
 		float strength = current->cost ? (float(current->benefit) / float(current->cost)) : 0.0f;
 
-		
 		fprintf(exportFile, "%-48.48s%10d%10d%10.4g\n", current->name, current->benefit, current->cost, strength);
 
-		
 		current = current->next;
 	}
 
-	
 	fclose(exportFile);
 
-	
 	return(strdup(fileName));
 }
 
 
-
 DllExport void GWCivRecord::GetData(void **data, long *numOfBytes)
 {
-	
+
 	if(dataBuffer) delete [] dataBuffer;
 
-	
 	long counter = 0;
 	GWUnitRecord *current = head;
 
-	
 	while(current) {
-		counter++;					
-		current = current->next;	
+		counter++;
+		current = current->next;
 	}
 
-	
-	
+
 	dataBuffer = new GWUnitRecord[counter];
 
-	
 	*numOfBytes = counter * sizeof(GWUnitRecord);
 
-	
 	counter = 0;
 	current = head;
 
-	
 	while(current) {
-		
+
 		strcpy(dataBuffer[counter].name, current->name);
 		dataBuffer[counter].cost = current->cost;
 		dataBuffer[counter].benefit = current->benefit;
@@ -321,39 +271,31 @@
 		strcpy(dataBuffer[counter].killerAIP, current->killerAIP);
 		strcpy(dataBuffer[counter].killedAIP, current->killedAIP);
 
-		
 		dataBuffer[counter].next = NULL;
 
-		
 		current = current->next;
 
-		
 		counter++;
 	}
 
-	
 	*data = (void*)dataBuffer;
 }
 
 
-
 DllExport void GWCivRecord::UnitBuilt(char *unitName, int unitCost, char *builderAIP)
 {
-	
+
 	if(!unitName) return;
 
-	
 
 	GWUnitRecord *unitRecord = FindUnitRecord(unitName);
-	
-	
+
 	if(unitRecord) {
 		unitRecord->cost += unitCost;
-	} else { 
-		
+	} else {
+
 		unitRecord = new GWUnitRecord;
 
-		
 		strcpy(unitRecord->name, unitName);
 		unitRecord->cost = unitCost;
 		unitRecord->benefit = 0;
@@ -364,7 +306,6 @@
 		else
 			strcpy(unitRecord->builderAIP, "Unknown");
 
-		
 		AddUnitRecord(unitRecord);
 	}
 }
@@ -374,21 +315,18 @@
 
 DllExport void GWCivRecord::UnitKill(char *unitName, int destroyedUnitCost, char *killerAIP, char *killedAIP)
 {
-	
+
 	if(!unitName) return;
 
-	
 
 	GWUnitRecord *unitRecord = FindUnitRecord(unitName);
-	
-	
+
 	if(unitRecord) {
 		unitRecord->benefit += destroyedUnitCost;
-	} else { 
-		
+	} else {
+
 		unitRecord = new GWUnitRecord;
 
-		
 		strcpy(unitRecord->name, unitName);
 		unitRecord->cost = 0;
 		unitRecord->benefit = destroyedUnitCost;
@@ -404,186 +342,150 @@
 		else
 			strcpy(unitRecord->killedAIP, "Unknown");
 
-		
 		AddUnitRecord(unitRecord);
 	}
 }
 
-
 DllExport GWUnitRecord *GWCivRecord::FindUnitRecord(char *name)
 {
-	
+
 	GWUnitRecord *searchRecord = head;
 
-	
 	while(searchRecord) {
-		
+
 		if(!strcmp(name, searchRecord->name)) return(searchRecord);
 
-		
 		searchRecord = searchRecord->next;
 	}
 
-	
 	return(NULL);
 }
 
 
-
 DllExport GWUnitRecord *GWCivRecord::FindUnitRecordForBuilder(char *name, char *builderAIP)
 {
-	
+
 	GWUnitRecord *searchRecord = head;
 
-	
 	while(searchRecord) {
-		
+
 		if(!strcmp(name, searchRecord->name)
 			&&
-			!strcmp(name, searchRecord->builderAIP)) 
+			!strcmp(name, searchRecord->builderAIP))
 			return(searchRecord);
 
-		
 		searchRecord = searchRecord->next;
 	}
 
-	
 	return(NULL);
 }
 
-
 DllExport GWUnitRecord *GWCivRecord::FindUnitRecordForKiller(char *name, char *killerAIP)
 {
-	
+
 	GWUnitRecord *searchRecord = head;
 
-	
 	while(searchRecord) {
-		
+
 		if(!strcmp(name, searchRecord->name)
 			&&
-			!strcmp(name, searchRecord->killerAIP)) 
+			!strcmp(name, searchRecord->killerAIP))
 			return(searchRecord);
 
-		
 		searchRecord = searchRecord->next;
 	}
 
-	
 	return(NULL);
 }
 
 
-
 DllExport void GWCivRecord::AddUnitRecord(GWUnitRecord *record)
 {
-	
+
 	record->next = head;
 
-	
 	head = record;
 }
 
-
 DllExport void GWCivRecord::SortUnitRecord(GWUnitRecord *record)
 {
-	
+
 	GWUnitRecord *current = head;
 
-	
-	
+
 	if(!current || (strcmp(record->name, current->name) < 0)) {
-		
+
 		record->next = head;
 
-		
 		head = record;
 
-		
 		return;
 	}
 
-	
-	
+
 	while(current->next) {
-		
+
 		if(strcmp(record->name, current->next->name) < 0) break;
 
-		
 		current = current->next;
 	}
 
-	
 	record->next = current->next;
 	current->next = record;
 }
 
-
 DllExport void GWCivRecord::SortUnitRecordByBuilder(GWUnitRecord *record)
 {
-	
+
 	GWUnitRecord *current = head;
 
-	
-	
+
 	if(!current || (strcmp(record->name, current->name) < 0)) {
-		
+
 		record->next = head;
 
-		
 		head = record;
 
-		
 		return;
 	}
 
-	
-	
+
 	while(current->next) {
-		
+
 		if(strcmp(record->builderAIP, current->next->builderAIP) < 0
 			&& strcmp(record->name, current->next->name) < 0) break;
 
-		
 		current = current->next;
 	}
 
-	
 	record->next = current->next;
 	current->next = record;
 }
 
-
 DllExport void GWCivRecord::SortUnitRecordByKiller(GWUnitRecord *record)
 {
-	
+
 	GWUnitRecord *current = head;
 
-	
-	
+
 	if(!current || (strcmp(record->name, current->name) < 0)) {
-		
+
 		record->next = head;
 
-		
 		head = record;
 
-		
 		return;
 	}
 
-	
-	
+
 	while(current->next) {
-		
+
 		if(strcmp(record->killerAIP, current->next->killerAIP) < 0
 			&& strcmp(record->name, current->next->name) < 0) break;
 
-		
 		current = current->next;
 	}
 
-	
 	record->next = current->next;
 	current->next = record;
 }

Modified: trunk/ctp2_code/GameWatch/gwciv/GWCivRecord.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gwciv/GWCivRecord.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwciv/GWCivRecord.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,78 +1,57 @@
-
-
-
-
-
-
-
-
 #ifndef _BMH_GW_CIV_RECORD_H_
 #define _BMH_GW_CIV_RECORD_H_
 
-
 #include "GWCivDLL.h"
 
-
 #include "GWRecord.h"
 
-
 class GWUnitRecord;
 
-
 class GWCivDllHeader GWCivRecord : public GWRecord {
 public:
-	
+
 	GWCivRecord();
 
-	
-	
+
 	GWCivRecord(void *data, long numOfBytes);
 
-	
 	virtual ~GWCivRecord();
 
-	
-	
+
 	virtual GWRecord* Merge(GWRecord *record);
 
-	
-	
-	
+
+
+
 	virtual char *Export(char *baseName, char *stamp);
 
-	
-	
+
 	virtual void GetData(void **data, long *numOfBytes);
 
-	
-	
+
 	virtual void UnitBuilt(char *unitName, int unitCost, char *builderAIP);
 
-	
-	
-	
+
+
+
 	virtual void UnitKill(char *unitName, int destroyedUnitCost, char *killerAIP, char *killedAIP);
 
 private:
-	
+
 	GWUnitRecord *FindUnitRecord(char *name);
 	GWUnitRecord *FindUnitRecordForBuilder(char *name, char *builderAIP);
 	GWUnitRecord *FindUnitRecordForKiller(char *name, char *killerAIP);
 
-	
 	void AddUnitRecord(GWUnitRecord *record);
 
-	
 	void SortUnitRecord(GWUnitRecord *record);
 	void SortUnitRecordByBuilder(GWUnitRecord *record);
 	void SortUnitRecordByKiller(GWUnitRecord *record);
 
-	
 	GWUnitRecord *head;
 
-	
-	
+
 	GWUnitRecord *dataBuffer;
 };
 
-#endif 
+#endif

Modified: trunk/ctp2_code/GameWatch/gwfile/GWFile.cpp
==============================================================================
--- trunk/ctp2_code/GameWatch/gwfile/GWFile.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwfile/GWFile.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,34 +1,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #include "GWFile.h"
 
-
 #include <errno.h>
 #include <direct.h>
 #include <share.h>
 
-
 DllExport GWFile gwFile;
 
-
 DllExport GWFile::GWFile()
 {
-	
-	
+
 	SetName("gwfile");
 }
 
-
 DllExport GWFile::~GWFile()
 {
 }
@@ -38,100 +21,78 @@
 
 DllExport bool GWFile::Deliver(char *stamp, void *data, long numOfBytes)
 {
-	
-	
+
 	CreateDirectory(GetParameters());
 
-	
-	
-	
+
+
+
 	char *trackName = CreateFullName(GetParameters(), "track.dat");
 
-	
 	FILE *trackFile = _fsopen(trackName, "r+", _SH_DENYRW);
 
-	
 	int fileNumber = 1;
 
-	
 	if(trackFile) {
-		
+
 		fscanf(trackFile, "%d", &fileNumber);
 
-		
-		
+
 		rewind(trackFile);
-	} else { 
+	} else {
 		trackFile = _fsopen(trackName, "w", _SH_DENYRW);
 
-		
 		if(!trackFile) {
-			delete trackName; 
+			delete trackName;
 			return(false);
 		}
 	}
 
-	
 	char shortName[32];
 	sprintf(shortName, "record%d.dat", fileNumber);
 
-	
 	char *fileName = CreateFullName(GetParameters(), shortName);
 
-	
-	
-	
+
+
+
 	FILE *dataFile = _fsopen(fileName, "wb", _SH_DENYRW);
 
-	
-	
+
 	if(!dataFile) {
-		
+
 		fprintf(trackFile, "%d\n", fileNumber);
 
-		
 		fclose(trackFile);
 
-		
 		delete trackName;
 		delete fileName;
 		return(false);
 	}
 
-	
-	
-	size_t stampSize = strlen(stamp) + 1;  
 
-	
+	size_t stampSize = strlen(stamp) + 1;
+
 	fwrite(&stampSize, sizeof(stampSize), 1, dataFile);
 
-	
 	fwrite(stamp, stampSize, 1, dataFile);
 
-	
 	fwrite(&numOfBytes, sizeof(numOfBytes), 1, dataFile);
 
-	
 	if(numOfBytes) fwrite(data, numOfBytes, 1, dataFile);
 
-	
 	fclose(dataFile);
 
-	
-	
+
 	fileNumber++;
 
-	
 	fprintf(trackFile, "%d\n", fileNumber);
 
-	
 	fclose(trackFile);
 
-	
 	delete trackName;
 	delete fileName;
 
-	
 	return(true);
 }
 
@@ -140,108 +101,86 @@
 
 DllExport bool GWFile::Receive(char **stamp, void **data, long *numOfBytes)
 {
-	
-	
-	
-	
+
+
+
+
 	char *trackName = CreateFullName(GetParameters(), "track.dat");
 
-	
 	FILE *trackFile = _fsopen(trackName, "r+", _SH_DENYRW);
 
-	
 	int fileNumber = 1;
 
-	
 	if(trackFile) {
-		
+
 		fscanf(trackFile, "%d", &fileNumber);
 
-		
-		
+
 		rewind(trackFile);
-	} else { 
+	} else {
 		delete trackName;
 		return(false);
 	}
 
-	
 	fileNumber--;
 
-	
 	char shortName[32];
 	sprintf(shortName, "record%d.dat", fileNumber);
 
-	
 	char *fileName = CreateFullName(GetParameters(), shortName);
 
-	
-	
-	
+
+
+
 	FILE *dataFile = _fsopen(fileName, "rb", _SH_DENYRW);
 
-	
-	
+
 	if(!dataFile) {
-		
+
 		fprintf(trackFile, "%d\n", fileNumber+1);
 
-		
 		fclose(trackFile);
 
-		
 		delete trackName;
 		delete fileName;
 		return(false);
 	}
 
 
-	
-	
+
+
 	size_t stampSize = 0;
 
-	
 	fread(&stampSize, sizeof(stampSize), 1, dataFile);
 
-	
 	*stamp = new char[stampSize];
 
-	
 	fread(*stamp, stampSize, 1, dataFile);
 
-	
 	fread(numOfBytes, sizeof(*numOfBytes), 1, dataFile);
 
-	
 	if(*numOfBytes) {
-		
+
 		*data = malloc(*numOfBytes);
 
-		
 		fread(*data, *numOfBytes, 1, dataFile);
-	} else { 
+	} else {
 		*data = NULL;
 	}
 
-	
 	fclose(dataFile);
 
-	
-	
+
 	remove(fileName);
 
-	
-	
+
 	fprintf(trackFile, "%d\n", fileNumber);
 
-	
 	fclose(trackFile);
 
-	
 	delete trackName;
 	delete fileName;
 
-	
 	return(true);
 }
 
@@ -256,67 +195,52 @@
 
 DllExport char *GWFile::CreateFullName(char *path, char *fileName)
 {
-	
-	int length = strlen(path) + strlen(fileName) + 3; 
 
-	
+	int length = strlen(path) + strlen(fileName) + 3;
+
 	char *fullName = new char[length];
 
-	
 	sprintf(fullName, "%s\\%s", path, fileName);
 
-	
 	return(fullName);
 }
 
-
 DllExport void GWFile::CreateDirectory(char *path)
 {
-	
-	
+
 	if((_mkdir(path) == -1) && (errno == ENOENT)) {
-		
+
 		char *smallerPath = TruncatePath(path);
 
-		
 		if(smallerPath) {
-			
-			
+
 			CreateDirectory(smallerPath);
 
-			
 			_mkdir(path);
 
-			
 			free(smallerPath);
 		}
 	}
 }
 
-
 DllExport char *GWFile::TruncatePath(char *path)
 {
-	
+
 	char *newPath = strdup(path);
 
-	
 	int length = strlen(newPath);
 
-	
 	for(int index = length - 1; index >= 0; index--) {
-		
+
 		if((newPath[index] == '/') || (newPath[index] == '\\')) {
-			
+
 			newPath[index] = '\0';
 
-			
 			return(newPath);
 		}
 	}
 
-	
 	free(newPath);
 
-	
 	return(NULL);
 }

Modified: trunk/ctp2_code/GameWatch/gwfile/GWFile.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gwfile/GWFile.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwfile/GWFile.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,61 +1,43 @@
-
-
-
-
-
-
-
-
-
-
-
 #ifndef _BMH_GW_FILE_H_
 #define _BMH_GW_FILE_H_
 
-
 #include "GWFileDLL.h"
 
-
 #include "GWDelivery.h"
 
-
 class GWFileDllHeader GWFile : public GWDelivery {
 public:
-	
+
 	GWFile();
 
-	
 	virtual ~GWFile();
 
-	
-	
-	
+
+
+
 	virtual bool Deliver(char *stamp, void *data, long numOfBytes);
 
-	
-	
-	
+
+
+
 	virtual bool Receive(char **stamp, void **data, long *numOfBytes);
 
-	
-	
-	
+
+
+
 	virtual void FreeStamp(char *stamp);
 	virtual void FreeData(void *data);
 
 protected:
-	
-	
-	
+
+
 	char *CreateFullName(char *path, char *fileName);
 
-	
 	void CreateDirectory(char *path);
 
-	
 	char *TruncatePath(char *path);
 };
 
-GWFileDllHeader extern GWFile gwFile;  
+GWFileDllHeader extern GWFile gwFile;
 
-#endif 
+#endif

Modified: trunk/ctp2_code/GameWatch/gwfile/GWFileDLL.h
==============================================================================
--- trunk/ctp2_code/GameWatch/gwfile/GWFileDLL.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/GameWatch/gwfile/GWFileDLL.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,20 +1,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #ifndef _BMH_GWFILE_DLL_TYPES_H_
 #define _BMH_GWFILE_DLL_TYPES_H_
 
 
-
 #pragma warning(disable:4251)
 
 
@@ -38,12 +25,12 @@
 
 #ifdef __GWFILE_USE_IMPORT
 #define GWFileDllHeader DllImport
-#else 
+#else
 #ifdef __GWFILE_USE_EXPORT
 #define GWFileDllHeader DllExport
-#else 
+#else
 #define GWFileDllHeader
-#endif 
-#endif 
+#endif
+#endif
 
-#endif 
+#endif

Modified: trunk/ctp2_code/ai/CityManagement/governor.cpp
==============================================================================
--- trunk/ctp2_code/ai/CityManagement/governor.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/CityManagement/governor.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,13 +11,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 // _DEBUG
 // - Generate debug version when set.
 //
@@ -28,9 +28,9 @@
 //
 // Modifications from the original Activision code:
 //
-// - Consider other tile improvements when there is no fitting one for the 
+// - Consider other tile improvements when there is no fitting one for the
 //   preferred type.
-// - Adapted the tile improvement choice to take the CTP2 ringwise fractional 
+// - Adapted the tile improvement choice to take the CTP2 ringwise fractional
 //   worker utilisation into account.
 // - Ambiguous floor call removed for .NET compilation.
 // - Removed .NET warnings, by Martin Gühmann.
@@ -38,26 +38,26 @@
 // - Allowed AI to build food tile improvements when city growth is low, by Martin Gühmann.
 // - Allowed to link cities on different continents with undersea tunnels, by Martin Gühmann.
 // - Added owner call to FindRoadPath to match the new function signature, by Martin Gühmann.
-// - Added terrain boni arguments to FindBestTileImprovement to record the 
+// - Added terrain boni arguments to FindBestTileImprovement to record the
 //   already given terrain boni for that city, by Martin Gühmann
 // - Added roads around all cities. -Calvitix
-// - Disabled the last change as it takes to much roads even if there is no 
+// - Disabled the last change as it takes to much roads even if there is no
 //   city to bypass.
 // - Added GetBestTerraformImprovement function to find the best terraform
-//   improvement. - Sep. 21st 2004 Martin Gühmann 
-// - Modified FindBestTileImprovement function so that the AI can now 
+//   improvement. - Sep. 21st 2004 Martin Gühmann
+// - Modified FindBestTileImprovement function so that the AI can now
 //   terraform if there is no food improvement for that terrain, and the
-//   according city needs more food. - Sep. 21st 2004 Martin Gühmann 
+//   according city needs more food. - Sep. 21st 2004 Martin Gühmann
 // - Disabled the utilization factor for first ring food improvements, such
 //   cities benefit from food improvmements even if the ring is not filled.
-//   - Oct. 6th 2004 Martin Gühmann 
-// - Cleaned up GetBestTerraformImprovement function. - Oct. 6th 2004 Martin Gühmann 
+//   - Oct. 6th 2004 Martin Gühmann
+// - Cleaned up GetBestTerraformImprovement function. - Oct. 6th 2004 Martin Gühmann
 // - Fixed an error in the should terraform logic. - Oct. 6th 2004 Martin Gühmann
 // - Disabled the utilization factor for all first ring improvements, so that
 //   small ciries are more likly improved. - Feb. 21st 2005 Martin Gühmann
-// - Replaced c-sytle casts by by standart static_cast's. 
+// - Replaced c-sytle casts by by standart static_cast's.
 //   - Feb. 21st 2005 Martin Gühmann
-// - Fixed AssignPopulation function, at least it is now in the state as 
+// - Fixed AssignPopulation function, at least it is now in the state as
 //   supposed to be, however this is still far from perfect:
 //   - Fixed population assignment if city has slaves.
 //   - Allow usage of the first record in the pop database
@@ -73,22 +73,22 @@
 //   - April 4th 2005 Martin Gühmann
 // - Redesigned AssignPopulation function:
 //   - Instead calculating an assigned variable, the amount of free workers
-//     is now taken to figure out whether more pops can be assigned. This 
+//     is now taken to figure out whether more pops can be assigned. This
 //     method is less error prone.
-//   - Entertainer assignment was moved to the end and a happiness 
+//   - Entertainer assignment was moved to the end and a happiness
 //     recalculation is done, because happiness is dependent on the amount
 //     of assigned specialists at least if pollotion is on.
 //   - All pops are turned into workers before pop assignment to make
 //     assigned variable superflous.
 //   - April 4th 2005 Martin Gühmann
 // - Cleaned a little bit functions and added experimental code for slider
-//   optimization, the code is currently outcommented as it seemed that it 
+//   optimization, the code is currently outcommented as it seemed that it
 //   harms the AI more than it helps. - April 15th 2005 Martin Gühmann
 // - Improved cleanup to reduce memory leak reports.
 // - Removed debug allocator version.
-// - Added copy constructor to bypass a problem concerning memory 
+// - Added copy constructor to bypass a problem concerning memory
 //   allocation. - June 18th 2005 Martin Gühmann
-// - Added OptimizeSliders method and updated TestSliders method for 
+// - Added OptimizeSliders method and updated TestSliders method for
 //   better AI sliders optimisation routines. - Jul 18th 2005 Martin Gühmann
 // - Added code for new city resource calculation. (Aug 12th 2005 Martin Gühmann)
 // - Repaired incorrect AddEvent parameters.
@@ -106,9 +106,9 @@
 //   replacing its garrison units. (30-Jun-2008 Martin Gühmann)
 // - Corrected iterator problems (detected with _HAS_ITERATOR_DEBUGGING).
 // - Prepared for trade route ordering on profit per invested caravan.
-// - Allowed selection of government update when it will improve the situation 
+// - Allowed selection of government update when it will improve the situation
 //   w.r.t. the limit on the number of cities, even when it does not solve the
-//   problem completely. When having 21 cities, a limit of 20 will now be 
+//   problem completely. When having 21 cities, a limit of 20 will now be
 //   preferred when currently having a limit of 10.
 // - Prevented crash with missing population assignment data.
 // - If the AI loses its Capitol it builds a new one in its most productive
@@ -116,7 +116,7 @@
 // - Changed science formula to deduct crime after the government coefficient
 //   like all other resources. (22-Jul-2009 Maq)
 // - The AI can now select a special build list for small cities with enough
-//   garrison units, and can use a special build list for maximum size 
+//   garrison units, and can use a special build list for maximum size
 //   increasing increasing buildings. (20-Aug-2009 Martin Gühmann)
 // - Fixed AI city rank calculation. (9-Nov-2009 Martin Gühmann)
 //
@@ -193,7 +193,7 @@
 	sint32 const            MAX_DISTANCE                = 0x7fffffff;
 	Governor const          UniqueInvalidGovernor       = Governor(PLAYER_UNASSIGNED);
 	/// Value for a trade route not requiring caravans (should not occur)
-	double const            VALUE_FREE_LUNCH 	        = 
+	double const            VALUE_FREE_LUNCH 	        =
 		std::numeric_limits<double>::max();
 }
 
@@ -242,7 +242,7 @@
 // Returns    : -
 //
 // Remark(s)  : static function
-//              Assumption: The size of s_theGovernors has been updated 
+//              Assumption: The size of s_theGovernors has been updated
 //                          (read from stream) before calling this function.
 //
 //----------------------------------------------------------------------------
@@ -267,7 +267,7 @@
 // Returns    : -
 //
 // Remark(s)  : static function
-//              Assumption: The size of s_theGovernors has been saved 
+//              Assumption: The size of s_theGovernors has been saved
 //                          (written to stream) before calling this function.
 //
 //----------------------------------------------------------------------------
@@ -287,7 +287,7 @@
 //
 // Parameters : -
 //
-// Globals    : s_theGovernors  
+// Globals    : s_theGovernors
 //
 // Returns    : -
 //
@@ -309,7 +309,7 @@
 //
 // Parameters : playerId        : player to govern
 //
-// Globals    : s_theGovernors  
+// Globals    : s_theGovernors
 //
 // Returns    : Governor &      : governor of the player
 //
@@ -320,8 +320,8 @@
 {
 	Assert(playerId >= 0);
 	Assert(static_cast<size_t>(playerId) < s_theGovernors.size());
-	
-	return s_theGovernors[playerId]; 
+
+	return s_theGovernors[playerId];
 }
 
 //----------------------------------------------------------------------------
@@ -395,7 +395,7 @@
 //
 // Parameters : -
 //
-// Globals    : -  
+// Globals    : -
 //
 // Returns    : -
 //
@@ -432,13 +432,13 @@
 	Player * player_ptr = g_player[m_playerId];
 	Assert(player_ptr != NULL);
 
-	const StrategyRecord & strategy = 
+	const StrategyRecord & strategy =
 		Diplomat::GetDiplomat(m_playerId).GetCurrentStrategy();
 
 	for (sint32 gov_index = 0; gov_index < strategy.GetNumGovernment(); gov_index++)
 	{
 		const GovernmentRecord * rec = strategy.GetGovernment(gov_index);
-			
+
 		if(!player_ptr->HasAdvance(rec->GetEnableAdvanceIndex()))
 			continue;
 
@@ -455,7 +455,7 @@
 		sint32 const newCityLimit = rec->GetTooManyCitiesThreshold();
 		if (player_ptr->GetNumCities() > newCityLimit)
 		{
-			sint32 const oldCityLimit = 
+			sint32 const oldCityLimit =
 				strategy.GetGovernment(player_ptr->GetGovernmentType())->
 					GetTooManyCitiesThreshold();
 
@@ -475,7 +475,6 @@
 	return CTPRecord::INDEX_INVALID;
 }
 
-
 StringId Governor::GetGovernmentAdvice() const
 {
 	Player const *      player_ptr      = g_player[m_playerId];
@@ -486,10 +485,10 @@
 
 		if (new_gov_index != CTPRecord::INDEX_INVALID)
 		{
-			GovernmentRecord const *    new_gov_rec     = 
+			GovernmentRecord const *    new_gov_rec     =
 				g_theGovernmentDB->Get(new_gov_index);
 			sint32 const                new_rank        = new_gov_rec->GetRank();
-			sint32 const                current_rank    = 
+			sint32 const                current_rank    =
 				g_theGovernmentDB->Get(player_ptr->GetGovernmentType())->GetRank();
 
 			if (new_rank == current_rank)
@@ -534,13 +533,11 @@
 	else if(player_ptr->GetWorkdayExpectation() - sliders_setting.m_deltaProduction < -2)
 		sliders_setting.m_deltaProduction = 2 + static_cast<sint32>(player_ptr->GetWorkdayExpectation());
 
-	
 	if(player_ptr->GetWagesExpectation() - sliders_setting.m_deltaGold > 2)
 		sliders_setting.m_deltaGold = -2 + static_cast<sint32>(player_ptr->GetWagesExpectation());
 	else if(player_ptr->GetWagesExpectation() - sliders_setting.m_deltaGold < -2)
 		sliders_setting.m_deltaGold = 2 + static_cast<sint32>(player_ptr->GetWagesExpectation());
 
-
 	if(player_ptr->GetRationsExpectation() - sliders_setting.m_deltaFood > 2)
 		sliders_setting.m_deltaFood = -2 + static_cast<sint32>(player_ptr->GetRationsExpectation());
 	else if(player_ptr->GetRationsExpectation() - sliders_setting.m_deltaFood < -2)
@@ -553,7 +550,7 @@
 //
 // Description: Finds the possible maximal slider settings.
 //
-// Parameters : sliders_setting: Filled with the possible maximal slider 
+// Parameters : sliders_setting: Filled with the possible maximal slider
 //                               settings.
 //
 // Globals    : g_player: List of players
@@ -676,7 +673,6 @@
 	if(!update_cities)
 		return 0;
 
-
 	UnitDynamicArray * city_list = player_ptr->GetAllCitiesList();
 	sint32             cityCount = city_list ? city_list->Num() : 0;
 
@@ -686,7 +682,7 @@
 	{
 		CityData * city = city_list->Access(i)->GetCityData();
 		double old_happiness = city->GetHappiness();
-	
+
 		//Added by Martin Gühmann to take specialists into account.
 		//Well this has an effect but the AI seems to perform worse with it.
 		//Right direction but more debug work is needed.
@@ -724,10 +720,10 @@
 	Player * player_ptr = g_player[m_playerId];
 	Assert(player_ptr != NULL);
 
-	sliders_setting.m_deltaProduction = 
+	sliders_setting.m_deltaProduction =
 		static_cast<sint32>(player_ptr->GetWorkdayExpectation() - player_ptr->GetUnitlessWorkday());
 
-	sliders_setting.m_deltaGold = 
+	sliders_setting.m_deltaGold =
 		static_cast<sint32>(player_ptr->GetWagesExpectation() - player_ptr->GetUnitlessWages());
 
 	sliders_setting.m_deltaFood =
@@ -758,17 +754,16 @@
 	SlidersSetting tmp_sliders_setting;
 	sint32 prod, gold, food;
 
-	bool found = TestSliderSettings(sliders_setting, 
+	bool found = TestSliderSettings(sliders_setting,
 	                                production_test,
 	                                gold_test,
 	                                food_test,
 	                                happiness_test,
 	                                prod, gold, food);
-	
+
 	if(found)
 		return false;
 
-	
 	SlidersSetting orig_sliders_setting = sliders_setting;
 
 	bool changed = true;
@@ -783,7 +778,7 @@
 #endif
 		tmp_sliders_setting = sliders_setting;
 
-		found = TestSliderSettings(sliders_setting, 
+		found = TestSliderSettings(sliders_setting,
 		                           production_test,
 		                           gold_test,
 		                           food_test,
@@ -834,7 +829,7 @@
 		changed = (sliders_setting != tmp_sliders_setting );
 	}
 
-	found = TestSliderSettings(sliders_setting, 
+	found = TestSliderSettings(sliders_setting,
 	                           production_test,
 	                           gold_test,
 	                           food_test,
@@ -861,7 +856,7 @@
 //----------------------------------------------------------------------------
 bool Governor::ComputeBestSliders(SlidersSetting & sliders_setting) const
 {
-	const StrategyRecord & strategy = 
+	const StrategyRecord & strategy =
 		Diplomat::GetDiplomat(m_playerId).GetCurrentStrategy();
 
 	bool config_found = false;
@@ -905,7 +900,7 @@
 			{
 				sliders_setting.m_deltaFood = -1 * elem->GetDelta();
 			}
-		
+
 			found = FitSlidersToCities( sliders_setting );
 
 			sliders_setting.m_optimizeGold = false;
@@ -991,16 +986,15 @@
 		Assert(loop_test < 10000);
 		loop_test++;
 #endif
-			
-		found = TestSliderSettings(sliders_setting, 
+
+		found = TestSliderSettings(sliders_setting,
 		                           production_test,
 		                           gold_test,
 		                           food_test,
 		                           happiness_test,
 		                           prod, gold, food);
 		changed = false;
-		
-		
+
 		if(happiness_test == false)
 		{
 			if(sliders_setting.m_optimizeProduction == true
@@ -1044,8 +1038,8 @@
 			changed = true;
 		}
 
-		while((sliders_setting.m_deltaProduction + 
-		       sliders_setting.m_deltaGold + 
+		while((sliders_setting.m_deltaProduction +
+		       sliders_setting.m_deltaGold +
 		       sliders_setting.m_deltaFood) < 0
 		){
 			if(sliders_setting.m_deltaProduction < 0)
@@ -1074,7 +1068,7 @@
 //
 // Name       : Governor::TestSliderSettings
 //
-// Description: Checks if the given slider settings are enough to support 
+// Description: Checks if the given slider settings are enough to support
 //              the empire.
 //
 // Parameters : sliders_setting:  The slider settings to be tesed.
@@ -1082,12 +1076,12 @@
 //                                new slider settings allow to support units.
 //              gold_test:        Indicates after function execution whether
 //                                new slider settings allow to pay wages and
-//                                building upkeep or if building upkeep can't 
+//                                building upkeep or if building upkeep can't
 //                                be paid whether deficit spending is not to high.
-//              food_test:        Indicates after function execution whether 
+//              food_test:        Indicates after function execution whether
 //                                new slider settings allow to feed each city.
 //              happiness_test:   Indicates after function execution whether
-//                                new slider settings allow each city to stay 
+//                                new slider settings allow each city to stay
 //                                above the minimum happiness level.
 //              total_production: Filled with empire production (military support,
 //                                public works and production for buildings)
@@ -1125,7 +1119,7 @@
 	DPRINTF(k_DBG_GOVERNOR, ("//                         Rations %d\n", sliders_setting.m_deltaFood));
 #endif
 
-	const StrategyRecord & strategy = 
+	const StrategyRecord & strategy =
 		Diplomat::GetDiplomat(m_playerId).GetCurrentStrategy();
 
 	double deficit_spending;
@@ -1144,12 +1138,12 @@
 
 	food_test = true;
 	happiness_test = true;
-	
+
 	Player * player_ptr = g_player[m_playerId];
 	Assert(player_ptr);
 
 	SetSliders(sliders_setting, false);
-	
+
 	UnitDynamicArray *  city_list   = player_ptr->GetAllCitiesList();
 	sint32              num_cities  = city_list ? city_list->Num() : 0;
 
@@ -1196,7 +1190,7 @@
 		total_gold_cost += city->GetWagesNeeded();
 		total_gold += city->GetNetCityGold();
 		gross_gold += city->GetGrossCityGold();
-			
+
 		if(city->GetNetCityFood() < 0)
 		{
 			food_test = false;
@@ -1305,11 +1299,10 @@
 			adviceId = expectationStringId;
 		}
 	}
-	
+
 	return adviceId;
 }
 
-
 //----------------------------------------------------------------------------
 //
 // Name       : Governor::OptimizeSliders
@@ -1383,7 +1376,7 @@
 			valueFood = std::numeric_limits<sint32>::min();
 		}
 
-		// If all values are good and the people are 
+		// If all values are good and the people are
 		// happy enough, we are happy, too.
 		if(value >= valueProd
 		&& value >= valueGold
@@ -1555,7 +1548,7 @@
 		{
 			float   total_cost = 0.0;
 			Path    found_path;
-			
+
 			Unit    min_neighbor_unit = iter->m_city;
 
 			if (g_city_astar.FindRoadPath(city_unit.RetPos(), min_neighbor_unit.RetPos(),
@@ -1599,9 +1592,8 @@
 {
 	Player *                player_ptr  = g_player[m_playerId];
 	Assert(player_ptr);
-	StrategyRecord const &  strategy    = 
+	StrategyRecord const &  strategy    =
 	    Diplomat::GetDiplomat(m_playerId).GetCurrentStrategy();
-	
 
 	sint32  reserve_pw   = 0;
 	strategy.GetPublicWorksReserve(reserve_pw);
@@ -1627,8 +1619,8 @@
 		sint32  bonusFood = 0;
 		sint32  bonusProduction = 0;
 		sint32  bonusCommerce = 0;
-			
-		for (it.Start(); !it.End(); it.Next()) 
+
+		for (it.Start(); !it.End(); it.Next())
 		{
 			if(unit.RetPos() == it.Pos())
 				continue;
@@ -1650,11 +1642,11 @@
 
 	sint32 max_eval = 0;
 	(void) strategy.GetMaxEvalTileImprovements(max_eval);
-	TiGoalQueue::iterator max_iter = 
+	TiGoalQueue::iterator max_iter =
 		m_tileImprovementGoals.begin() + std::min(static_cast<size_t>(max_eval),
 												  m_tileImprovementGoals.size()
 												 );
-	
+
 	std::partial_sort(m_tileImprovementGoals.begin(),
 	                  max_iter,
 	                  m_tileImprovementGoals.end(),
@@ -1702,7 +1694,7 @@
 //				g_theWorld:      Map information
 //
 // Returns    : bool:            The tile can be improved
-//              goal:            Type and priority value of the tile improvement 
+//              goal:            Type and priority value of the tile improvement
 //              bonusFood:       Added food by the selected tile improvement
 //              bonusProduction: Added production(shields) by the selected tile improvement
 //              bonusCommerce:   Added commerce(gold) by the selected tile improvement
@@ -1725,11 +1717,11 @@
 	Unit city_owner = g_theWorld->GetCell(pos)->GetCityOwner();
 	CityData* city = city_owner.GetCityData();
 	Assert(city);
-	
+
 	double growth_rank     = the_map.GetGrowthRank    (city);
 	double production_rank = the_map.GetProductionRank(city);
 	double gold_rank       = the_map.GetCommerceRank  (city);
-	double terr_food_rank = (g_theWorld->GetCell(pos)->GetFoodFromTerrain()) / 
+	double terr_food_rank = (g_theWorld->GetCell(pos)->GetFoodFromTerrain()) /
 		(double) World::GetAvgFoodFromTerrain();
 	double terr_prod_rank = (g_theWorld->GetCell(pos)->GetShieldsFromTerrain()) /
 		(double) World::GetAvgShieldsFromTerrain();
@@ -1743,10 +1735,8 @@
 	sint32 best_gold_improvement;
 	GetBestFoodProdGoldImprovement(pos,best_growth_improvement, best_production_improvement, best_gold_improvement);
 
-	
 	goal.pos = pos;
 
-	
 	goal.type = -1;
 
 	sint32 food_ter = -1;
@@ -1782,12 +1772,12 @@
 			GetBestTerraformImprovement(pos, food_ter, prod_ter, gold_ter, true);
 		}
 	}
-	
+
 	sint32 foodMissing;
 	bool moreFoodNeeded = city->NeedMoreFood(bonusFood, foodMissing, true);
 //	bool moreProdNeeded = city->NeedMoreProdOrGold(bonusProd, bonusGold, true);
 
-	if((moreFoodNeeded 
+	if((moreFoodNeeded
 	|| (best_production_improvement < 0
 	&&  best_gold_improvement < 0))
 	&& (best_growth_improvement >= 0)
@@ -1804,9 +1794,9 @@
 
 		effect->GetBonusGold(tmp_bonus);
 		bonusCommerce += tmp_bonus;
-		
+
 		goal.type = best_growth_improvement;
-	
+
 		strategy.GetImproveGrowthBonus(bonus);
 		goal.utility = bonus * terr_food_rank;
 
@@ -1820,7 +1810,7 @@
 			goal.utility += bonus;
 		}
 	}
-	else if(moreFoodNeeded 
+	else if(moreFoodNeeded
 	&&      food_ter >= 0
 	){
 		if(g_theTerrainImprovementDB->Get(food_ter)->GetTerraformTerrainIndex(terrain))
@@ -1828,9 +1818,9 @@
 			bonusFood += g_theWorld->GetCell(pos)->GetFoodFromTerrain((sint8)terrain) - g_theWorld->GetCell(pos)->GetFoodFromTerrain();
 			bonusProduction += g_theWorld->GetCell(pos)->GetShieldsFromTerrain((sint8)terrain) - g_theWorld->GetCell(pos)->GetShieldsFromTerrain();
 			bonusCommerce += g_theWorld->GetCell(pos)->GetGoldFromTerrain((sint8)terrain) - g_theWorld->GetCell(pos)->GetGoldFromTerrain();
-	
+
 			goal.type = food_ter;
-	
+
 			if(terrain_type != terrainutil_GetDead())
 			{
 				strategy.GetImproveGrowthBonus(bonus);
@@ -1841,7 +1831,7 @@
 				    strategy.GetImproveSmallCityGrowthBonus(bonus);
 					goal.utility +=  bonus * (1.0 - growth_rank);
 				}
-		
+
 			}
 			else
 			{
@@ -1868,20 +1858,18 @@
 
 		effect->GetBonusGold(tmp_bonus);
 		bonusCommerce += tmp_bonus;
-			
+
 		goal.type = best_production_improvement;
-			
-			
+
 		strategy.GetImproveProductionBonus(bonus);
 		goal.utility =  bonus * terr_prod_rank;
-			
-			
+
 		if(production_rank > 0.8)
 		{
 			strategy.GetImproveLargeCityProductionBonus(bonus);
 			goal.utility += bonus *	production_rank;
 		}
-			
+
 		if(g_theWorld->IsGood(pos))
 		{
 			strategy.GetImproveGoodBonus(bonus);
@@ -1905,11 +1893,10 @@
 		bonusCommerce += tmp_bonus;
 
 		goal.type = best_gold_improvement;
-			
-			
+
 		strategy.GetImproveProductionBonus(bonus);
 		goal.utility = bonus * terr_gold_rank;
-			
+
 		if(production_rank > 0.8)
 		{
 			strategy.GetImproveLargeCityProductionBonus(bonus);
@@ -1924,8 +1911,8 @@
 	else if(g_theWorld->IsGood(pos) == FALSE)
 	{ // Should be removed
 		ERR_BUILD_INST err;
-		if(terrain_type == terrainutil_GetGlacier() 
-		|| terrain_type == terrainutil_GetSwamp() 
+		if(terrain_type == terrainutil_GetGlacier()
+		|| terrain_type == terrainutil_GetSwamp()
 		|| terrain_type == terrainutil_GetTundra()
 		){
 			if(player_ptr->CanCreateImprovement(terrainutil_GetTerraformHillsImprovement(), pos, 0, FALSE, err))
@@ -1969,7 +1956,7 @@
 #if defined(CTP1_HAS_RISEN_FROM_THE_GRAVE)
 	// CTP1: utilisation depends on worker placement, and is either 0 or 1.
 #else
-	// CTP2: utilisation depends on the number of available workers and the 
+	// CTP2: utilisation depends on the number of available workers and the
 	// (ring) distance from the city, and may be any fraction from 0.0 to 1.0.
 	if ((goal.type >= 0) && city)
 	{
@@ -2025,7 +2012,7 @@
 		return -1;
 	}
 
-	TerrainImprovementRecord const * terr_imp_rec = 
+	TerrainImprovementRecord const * terr_imp_rec =
 		terrainutil_GetBestRoad(m_playerId, pos);
 	if (terr_imp_rec == NULL)
 		return -1;
@@ -2036,13 +2023,13 @@
 	    return -1;
 
 	sint32 const old_move_cost = static_cast<sint32>(cell->GetMoveCost());
-	TerrainImprovementRecord::Effect const * effect = 
+	TerrainImprovementRecord::Effect const * effect =
 	    terrainutil_GetTerrainEffect(terr_imp_rec, pos);
 
 	sint32 cost;
 	if (effect && effect->GetMoveCost(cost) && cost >= old_move_cost)
 		return -1;
-	
+
 	return terr_imp_rec->GetIndex();
 }
 
@@ -2050,7 +2037,7 @@
 //
 // Name       : Governor::GetBestFoodProdGoldImprovement
 //
-// Description: Determines the best food, production and gold improvement 
+// Description: Determines the best food, production and gold improvement
 //              for a tile.
 //
 // Parameters : pos: Position of the tile on the map
@@ -2060,7 +2047,7 @@
 //              g_theTerrainImprovementDB: The tile improvement database
 //
 // Returns    : food_imp: Best food tile improvement
-//              prod_imp: Best production tile improvement 
+//              prod_imp: Best production tile improvement
 //              gold_imp: Best gold tile improvement
 //
 // Remark(s)  : The return values are filled with -1 if there is no according
@@ -2095,7 +2082,7 @@
 		if (effect == NULL)
 			continue;
 
-		if (!rec->GetClassRoad() && 
+		if (!rec->GetClassRoad() &&
 			!rec->GetClassLandDetector() &&
 			!rec->GetClassOceanDetector() &&
 			!rec->GetClassStructure1() && !rec->GetClassStructure2())
@@ -2108,33 +2095,33 @@
 		){
 			max_bonus_food = tmp_bonus;
 		}
-		
+
 		if(effect->GetBonusProduction(tmp_bonus)
 		&& tmp_bonus > max_bonus_prod
 		){
 			max_bonus_prod = tmp_bonus;
 		}
-		
+
 		if(effect->GetBonusGold(tmp_bonus)
 		&& tmp_bonus > max_bonus_gold
 		){
 			max_bonus_gold = tmp_bonus;
 		}
 	}
-	
+
 	Assert(g_player[m_playerId]);
 	Player *player_ptr = g_player[m_playerId];
-	
+
 	const TERRAIN_TYPES terrain_type = g_theWorld->GetTerrainType(pos);
-	
+
 	for (type = 0; type < g_theTerrainImprovementDB->NumRecords(); type++)
 	{
 		rec = g_theTerrainImprovementDB->Get(type);
 		ERR_BUILD_INST err;
-		
+
 		if (!player_ptr->CanCreateImprovement(type, pos, 0, FALSE, err))
 			continue;
-		
+
 		if (current_class != 0x0 && ((rec->GetClass() & current_class) == 0x0))
 			continue;
 
@@ -2147,7 +2134,7 @@
 				food_imp = type;
 				max_bonus_food = tmp_bonus;
 			}
-			
+
 			if(effect->GetBonusProduction(tmp_bonus)
 			&& tmp_bonus > max_bonus_prod
 			){
@@ -2180,7 +2167,7 @@
 //              g_theTerrainImprovementDB: The tile improvement database
 //
 // Returns    : food_imp: Best terraform food improvement
-//              prod_imp: Best terraform production improvement 
+//              prod_imp: Best terraform production improvement
 //              gold_imp: Best terraform gold improvement
 //
 // Remark(s)  : The return values are filled with -1 if there is no better
@@ -2222,7 +2209,7 @@
 	sint32 i;
 	for(i = 0; i < g_theTerrainDB->NumRecords(); ++i){
 		toRec = g_theTerrainDB->Get(i);
-	
+
 		if(!player_ptr->HasAdvance(toRec->GetAddAdvanceIndex()))
 			continue;
 
@@ -2266,7 +2253,7 @@
 			gold_ter = i;
 		}
 	}
-	
+
 	const TerrainImprovementRecord *rec;
 	sint32 ter;
 	for(i = 0; i < g_theTerrainImprovementDB->NumRecords(); ++i)
@@ -2321,13 +2308,12 @@
 	}
 }
 
-
 const StrategyRecord::PopAssignmentElement *Governor::GetMatchingPopAssignment(const CityData *city) const
 {
 	Assert(city);
 	Assert(g_player[m_playerId]);
 
-	const StrategyRecord & strategy = 
+	const StrategyRecord & strategy =
 	           Diplomat::GetDiplomat(m_playerId).GetCurrentStrategy();
 	const StrategyRecord::PopAssignmentElement *elem = NULL;
 
@@ -2340,11 +2326,11 @@
 		{
 			rank = MapAnalysis::GetMapAnalysis().GetProductionRank(city);
 		}
-		else if (elem->GetGrowthCities()) 
+		else if (elem->GetGrowthCities())
 		{
 			rank = MapAnalysis::GetMapAnalysis().GetGrowthRank(city);
 		}
-		else if (elem->GetGoldCities()) 
+		else if (elem->GetGoldCities())
 		{
 			rank = MapAnalysis::GetMapAnalysis().GetCommerceRank(city);
 		}
@@ -2353,7 +2339,7 @@
 			// Always OK, regardless of rank
 			return elem;
 		}
-		else 
+		else
 		{
 			// Try next one
 			continue;
@@ -2382,7 +2368,7 @@
 //
 // Description: Assigns the specialists
 //
-// Parameters : city: The city data of city for which the population should 
+// Parameters : city: The city data of city for which the population should
 //                    be assigned.
 //
 // Globals    : g_theCitySizeDB: The city size database.
@@ -2402,7 +2388,7 @@
 	Timer t1;
 #endif
 
-	StrategyRecord::PopAssignmentElement const * pop_assignment = 
+	StrategyRecord::PopAssignmentElement const * pop_assignment =
 		GetMatchingPopAssignment(city);
 	if (!pop_assignment)
 	{
@@ -2417,8 +2403,8 @@
 	city->ChangeSpecialists(POP_SCIENTIST,   -city->ScientistCount());
 
 	//////////////////////////////////////////////////////////////////////
-	// Not a pretty good idea to redo all the stuff, but to avoid this 
-	// the resources from the inner ring and the last ring must be 
+	// Not a pretty good idea to redo all the stuff, but to avoid this
+	// the resources from the inner ring and the last ring must be
 	// stored at seperated places to use them in the HowMuchMoreFoodNeeded
 	// method.
 #if !defined(NEW_RESOURCE_PROCESS)
@@ -2443,10 +2429,10 @@
 
 	///////////////////////////////////////////////////////////////
 	// Get the amount of workers needed for base resources supply.
-	sint32 farmers, laborers, merchants, scientists, 
-	       minFood, minProd, minGold, minScie; 
+	sint32 farmers, laborers, merchants, scientists,
+	       minFood, minProd, minGold, minScie;
 	double farmersEff, laborersEff, merchantsEff, scientistsEff;
-	sint32 min_workers = ComputeMinimumWorkers(city, 
+	sint32 min_workers = ComputeMinimumWorkers(city,
 	                     farmers, laborers, merchants, scientists,
 #if defined(NEW_RESOURCE_PROCESS)
 	                     minFood, minProd, minGold, minScie);
@@ -2564,13 +2550,13 @@
 		{
 			city->ChangeSpecialists(POP_LABORER, count);
 			city->ProcessProduction(true);
-		}			
+		}
 		else if(tmp_city->GetGrossCityProduction() < prev_result)
 		{
 			delta = (-city->LaborerCount());
 			city->ChangeSpecialists(POP_LABORER, delta);
 		}
-			
+
 		delta = city->LaborerCount() - tmp_city->LaborerCount();
 		tmp_city->ChangeSpecialists(POP_LABORER, delta );
 #endif
@@ -2624,7 +2610,7 @@
 		tmp_city->ChangeSpecialists(POP_FARMER, count);
 		tmp_city->CollectResourcesFinally();
 		tmp_city->ProcessFood();
-		
+
 		if(tmp_city->GetProducedFood() > prev_result)
 		{
 			// The specialists are beneficial: employ in the real city.
@@ -2633,21 +2619,21 @@
 		else if(tmp_city->GetProducedFood() < prev_result)
 		{
 			// The specialists are producing less than workers: fire them all?
-			// This should not do anything, because there should be none left 
+			// This should not do anything, because there should be none left
 			// after the reset at the start.
 			Assert(0 == city->FarmerCount());
 			delta = (-city->FarmerCount());
 			city->ChangeSpecialists(POP_FARMER, delta);
 		}
 //		DPRINTF(k_DBG_GAMESTATE, ("NewResult: %f\n", tmp_city->GetProducedFood()));
-		
+
 		// Synchronise the tmp_city with the real city.
 		delta = city->FarmerCount() - tmp_city->FarmerCount();
 		tmp_city->ChangeSpecialists(POP_FARMER, delta );
 #endif
 	}
 //	DPRINTF(k_DBG_GAMESTATE, ("Farmers: %i\n", city->FarmerCount()));
-	
+
 	best_specialist = city->GetBestSpecialist(POP_MERCHANT);
 
 	count = static_cast<sint32>
@@ -2660,7 +2646,7 @@
 
 	//////////////////////////////////
 	// First pop database index is 0
-	if((best_specialist >= 0) 
+	if((best_specialist >= 0)
 	&& (count > 0)
 	){
 #if defined(NEW_RESOURCE_PROCESS)
@@ -2673,7 +2659,7 @@
 		tmp_city->ChangeSpecialists(POP_MERCHANT, count);
 		tmp_city->CollectResourcesFinally();
 		tmp_city->CollectOtherTrade(TRUE);
-		
+
 		if(tmp_city->GetGrossCityGold() > prev_result)
 		{
 			city->ChangeSpecialists(POP_MERCHANT, count);
@@ -2683,14 +2669,14 @@
 			delta = (-city->MerchantCount());
 			city->ChangeSpecialists(POP_MERCHANT, delta);
 		}
-		
+
 		delta = city->MerchantCount() - tmp_city->MerchantCount();
 		tmp_city->ChangeSpecialists(POP_MERCHANT, delta );
 #endif
 	}
 
 #if !defined(NEW_RESOURCE_PROCESS)
-	// Not used anymore 
+	// Not used anymore
 	delete tmp_city;
 #endif
 
@@ -2761,7 +2747,7 @@
 
 		count = static_cast<sint32>
 			(ceil(specialists * pop_assignment->GetEntertainerPercent()));
-		
+
 		count = (count >= min_entertainers ? count : min_entertainers);
 		count = (count <= max_entertainers ? count : max_entertainers);
 
@@ -2792,7 +2778,7 @@
 // Description: Estimates the amount of entertainers needed to achieve
 //              minimum and full happiness.
 //
-// Parameters : city: The city data of city for which the amount of 
+// Parameters : city: The city data of city for which the amount of
 //                    entertainers should be estimated.
 //              min:  Filled with the minimum amount of enteriners needed.
 //              max:  Filled with the amount of entertainers needed for
@@ -2818,7 +2804,7 @@
 	sint32 per_pop_happiness = g_thePopDB->Get(entertainer_type)->GetHappiness();
 	if (per_pop_happiness <= 0)
 	{
-		DPRINTF(k_DBG_GAMESTATE, 
+		DPRINTF(k_DBG_GAMESTATE,
                 ("Entertainer pop type: %i, happiness: %i\n", entertainer_type, per_pop_happiness)
                );
 		Assert(0);
@@ -2829,12 +2815,11 @@
 	sint32 maximum = g_theConstDB->Get(0)->GetVeryHappyThreshold();
 	sint32 current = static_cast<sint32>(city->GetHappiness());
 
-
-	double min_delta = static_cast<double>(needed - current) / 
+	double min_delta = static_cast<double>(needed - current) /
 	                     static_cast<double>(per_pop_happiness);
-	double max_delta = static_cast<double>(maximum - current) / 
-	                     static_cast<double>(per_pop_happiness);	
-	
+	double max_delta = static_cast<double>(maximum - current) /
+	                     static_cast<double>(per_pop_happiness);
+
 	if (min_delta < 0)
 	{
 		min_delta = floor(min_delta);
@@ -2863,17 +2848,17 @@
 // Name       : Governor::GetMinNumOfFieldWorkers
 //
 // Description: Estimates the amount of needed workers to generate the amount
-//              of resources (food, production or gold) given by 
+//              of resources (food, production or gold) given by
 //              resourceFraction.
 //
-// Parameters : city:             The city data of city for which the amount 
+// Parameters : city:             The city data of city for which the amount
 //                                needed workers should be calculated.
 //              resourceFraction: The fraction of total resources that the
 //                                city needs as minimum.
 //
 // Globals    : g_theCitySizeDB:  The city size database.
 //
-// Returns    : The amount of minimum field wokers to generate the given 
+// Returns    : The amount of minimum field wokers to generate the given
 //              fraction of resources.
 //
 // Remark(s)  : -
@@ -2918,11 +2903,11 @@
 //
 // Description: Estimates the amount workers needed so that all kinds
 //              of ressources (food, production, gold and science) are
-//              positive. The amount of workers is estimated on the 
+//              positive. The amount of workers is estimated on the
 //              assumption the according resource is not by a specialists
 //              gained instead by the field worker.
 //
-// Parameters : city: The city data of city for which the amount of 
+// Parameters : city: The city data of city for which the amount of
 //                    workers should be estimated.
 //
 // Globals    : g_theCitySizeDB: The city size database
@@ -2934,13 +2919,13 @@
 //              minProd:         Filled minimum field workers for production.
 //              minGold:         Filled minimum field workers for gold.
 //              minScie:         Filled minimum field workers for science.
-//              farmersEff       Additional food of a farmer after 
+//              farmersEff       Additional food of a farmer after
 //                               deduction of field food.
-//              laborersEff      Additional production of a laborer after 
+//              laborersEff      Additional production of a laborer after
 //                               deduction of field production.
-//              merchantsEff     Additional gold of an merchant after 
+//              merchantsEff     Additional gold of an merchant after
 //                               deduction of field gold.
-//              scientistsEff    Additional science of an scientist after 
+//              scientistsEff    Additional science of an scientist after
 //                               deduction of field food.
 //
 // Returns    : Amount of workers needed.
@@ -2951,10 +2936,10 @@
 //              and production are needed.
 //
 //----------------------------------------------------------------------------
-sint32 Governor::ComputeMinimumWorkers(CityData *city, 
-                                       sint32 &farmers, 
-                                       sint32 &laborers, 
-                                       sint32 &merchants, 
+sint32 Governor::ComputeMinimumWorkers(CityData *city,
+                                       sint32 &farmers,
+                                       sint32 &laborers,
+                                       sint32 &merchants,
                                        sint32 &scientists,
                                        sint32 &minFood,
                                        sint32 &minProd,
@@ -2993,7 +2978,7 @@
 	double prodRequired = 1.0; // At least one production, better requirement needed.
 	double goldRequired = static_cast<double>(city->GetSupport());
 	double scieRequired = 1.0; // At least one science, better requirement needed.
-	
+
 	double foodFraction = foodRequired / food;
 	double prodFraction = prodRequired / prod;
 	double goldFraction = goldRequired / gold;
@@ -3185,16 +3170,16 @@
 	//	DPRINTF(k_DBG_GAMESTATE, ("part_size: %i\n", part_size));
 	//	DPRINTF(k_DBG_GAMESTATE, ("part_size_pop: %i\n", part_size_pop));
 		DPRINTF(k_DBG_GOVERNOR, ("//  elapsed time per city and pop asignment 0 = %f ms\n", t1.getElapsedTimeInMilliSec()));
-		part_radii_prod = city->ProcessProduction(true, 
-		                         grossProduction, 
-		                         part_radii_prod, 
-		                         crimeLoss, 
+		part_radii_prod = city->ProcessProduction(true,
+		                         grossProduction,
+		                         part_radii_prod,
+		                         crimeLoss,
 		                         specialLoss, true);
 		DPRINTF(k_DBG_GOVERNOR, ("//  elapsed time per city and pop asignment 1 = %f ms\n", t1.getElapsedTimeInMilliSec()));
-		full_radii_prod = city->ProcessProduction(true, 
-		                         grossProduction, 
-		                         full_radii_prod, 
-		                         crimeLoss, 
+		full_radii_prod = city->ProcessProduction(true,
+		                         grossProduction,
+		                         full_radii_prod,
+		                         crimeLoss,
 		                         specialLoss, true);
 		DPRINTF(k_DBG_GOVERNOR, ("//  elapsed time per city and pop asignment 2 = %f ms\n", t1.getElapsedTimeInMilliSec()));
 
@@ -3316,15 +3301,15 @@
 		&& full_radii_food + part_radii_food > city->GetFoodRequired()
 		&& part_radii_food > 0.0
 		){
-			utilization_needed = 
+			utilization_needed =
 			    (city->GetFoodRequired() - full_radii_food) / part_radii_food;
 
 			if (fullSquaredRadius > 0)
 			{
 				workers_needed = full_rec->GetMaxWorkers();
 			}
-	
-			workers_needed += static_cast<sint32>(ceil(utilization_needed * 
+
+			workers_needed += static_cast<sint32>(ceil(utilization_needed *
 									(part_rec->GetMaxWorkers() - workers_needed)));
 			if(WorkersNeeded < workers_needed)
 			{
@@ -3345,15 +3330,15 @@
 		&& full_radii_prod + part_radii_prod > 0 // Needs according function.
 		&& part_radii_prod > 0
 		){
-			utilization_needed = 
+			utilization_needed =
 			    static_cast<double>(0 - full_radii_prod) / static_cast<double>(part_radii_prod);
 
 			if (fullSquaredRadius > 0)
 			{
 				workers_needed = full_rec->GetMaxWorkers();
 			}
-	
-			workers_needed += static_cast<sint32>(ceil(utilization_needed * 
+
+			workers_needed += static_cast<sint32>(ceil(utilization_needed *
 									(part_rec->GetMaxWorkers() - workers_needed)));
 			if(WorkersNeeded < workers_needed)
 			{
@@ -3379,17 +3364,17 @@
 		&& full_radii_gold + part_radii_gold > support
 		&& part_radii_gold > 0
 		){
-			utilization_needed = 
+			utilization_needed =
 			    static_cast<double>(support - full_radii_gold) / static_cast<double>(part_radii_gold);
-	
+
 	//		DPRINTF(k_DBG_GAMESTATE, ("utilization_needed: %f\n", utilization_needed));
 
 			if (fullSquaredRadius > 0)
 			{
 				workers_needed = full_rec->GetMaxWorkers();
 			}
-	
-			workers_needed += static_cast<sint32>(ceil(utilization_needed * 
+
+			workers_needed += static_cast<sint32>(ceil(utilization_needed *
 									(part_rec->GetMaxWorkers() - workers_needed)));
 	//		DPRINTF(k_DBG_GAMESTATE, ("workers_needed: %i\n", workers_needed));
 			if(WorkersNeeded < workers_needed)
@@ -3411,15 +3396,15 @@
 		&& full_radii_science + part_radii_science > 0 // Better condition needed.
 		&& part_radii_science > 0
 		){
-			utilization_needed = 
+			utilization_needed =
 			    static_cast<double>(0 - full_radii_science) / static_cast<double>(part_radii_science);
 
 			if (fullSquaredRadius > 0)
 			{
 				workers_needed = full_rec->GetMaxWorkers();
 			}
-	
-			workers_needed += static_cast<sint32>(ceil(utilization_needed * 
+
+			workers_needed += static_cast<sint32>(ceil(utilization_needed *
 									(part_rec->GetMaxWorkers() - workers_needed)));
 			if(WorkersNeeded < workers_needed){
 				WorkersNeeded = workers_needed;
@@ -3475,21 +3460,21 @@
 	Assert(g_player[m_playerId]);
 	Player * player_ptr = g_player[m_playerId];
 
-	sint32 max_cities = 
+	sint32 max_cities =
 		g_theGovernmentDB->Get(player_ptr->GetGovernmentType())->GetTooManyCitiesThreshold();
 	sint32 num_cities = player_ptr->GetNumCities();
 	sint32 needed_cities = (max_cities - num_cities);
 	sint32 total_unallocated_support = 0;
-	
-	double unit_support_percent = 0.0; 
+
+	double unit_support_percent = 0.0;
 	(void) strategy.GetUnitSupportPercent(unit_support_percent);
-	
+
 	sint32 total_unit_support = static_cast<sint32>
 		(player_ptr->GetTotalProduction() * unit_support_percent);
-	
+
 	Assert(g_theUnitDB);
 	std::fill_n(m_currentUnitCount.begin(), g_theUnitDB->NumRecords(), 0);
-	
+
 	sint32 num_armies = player_ptr->m_all_armies->Num();
 	for (sint32 army_index = 0; army_index < num_armies; army_index++)
 	{
@@ -3504,8 +3489,8 @@
 				m_currentUnitCount[unit.GetType()]++;
 			}
 		}
-	} 
-	
+	}
+
 	sint32 city_index;
 	for (city_index = 0; city_index < num_cities; city_index++)
 	{
@@ -3513,7 +3498,7 @@
 
 		if (unit.IsValid())
 		{
-			BuildQueue * buildQueue = 
+			BuildQueue * buildQueue =
 			    unit->GetCityData() ? unit->GetCityData()->GetBuildQueue() : NULL;
 			Assert(buildQueue);
 			if (    buildQueue
@@ -3528,10 +3513,10 @@
 
 	m_maximumUnitShieldCost = 0;
 	m_currentUnitShieldCost = 0;
-	
+
 	sint32 needed_transport = Scheduler::GetScheduler(m_playerId).
 		                        GetMostNeededStrength().Get_Transport();
-	
+
 	for (int list_num = 0; list_num < BUILD_UNIT_LIST_MAX; list_num++)
 	{
 		m_buildUnitList[list_num].m_perCityGarrison =  0;
@@ -3549,31 +3534,31 @@
 		{
 		case BUILD_UNIT_LIST_OFFENSE:
 			(void) strategy.GetOffensiveGarrisonCount(garrison_count);
-			m_buildUnitList[list_num].m_perCityGarrison = 
+			m_buildUnitList[list_num].m_perCityGarrison =
 				static_cast<sint16>(garrison_count);
-			m_buildUnitList[list_num].m_maximumGarrisonCount = 
+			m_buildUnitList[list_num].m_maximumGarrisonCount =
 				static_cast<sint16>(garrison_count * player_ptr->GetNumCities());
-			
+
 			strategy.GetOffensiveUnitsPercent(unit_support_percent_by_type);
 			break;
 
 		case BUILD_UNIT_LIST_DEFENSE:
 			(void) strategy.GetDefensiveGarrisonCount(garrison_count);
-			m_buildUnitList[list_num].m_perCityGarrison = 
+			m_buildUnitList[list_num].m_perCityGarrison =
 				static_cast<sint16>(garrison_count);
-			m_buildUnitList[list_num].m_maximumGarrisonCount = 
+			m_buildUnitList[list_num].m_maximumGarrisonCount =
 				static_cast<sint16>(garrison_count * player_ptr->GetNumCities());
-			
+
 			strategy.GetDefensiveUnitsPercent(unit_support_percent_by_type);
 			break;
 
 		case BUILD_UNIT_LIST_RANGED:
 			(void) strategy.GetRangedGarrisonCount(garrison_count);
-			m_buildUnitList[list_num].m_perCityGarrison = 
+			m_buildUnitList[list_num].m_perCityGarrison =
 				static_cast<sint16>(garrison_count);
-			m_buildUnitList[list_num].m_maximumGarrisonCount = 
+			m_buildUnitList[list_num].m_maximumGarrisonCount =
 				static_cast<sint16>(garrison_count * player_ptr->GetNumCities());
-			
+
 			strategy.GetRangedUnitsPercent(unit_support_percent_by_type);
 			break;
 
@@ -3633,7 +3618,7 @@
 			break;
 
 		default:
-			
+
 			Assert(false);
 			break;
 		}
@@ -3651,10 +3636,10 @@
 		case BUILD_UNIT_LIST_RANGED:
 		case BUILD_UNIT_LIST_SEA:
 		case BUILD_UNIT_LIST_AIR:
-			
-			total_unit_support_by_type = 
+
+			total_unit_support_by_type =
 				static_cast<sint32>(total_unit_support * unit_support_percent_by_type);
-			
+
 			if (best_unit_type >= 0)
 			{
 				total_unit_support_by_type += total_unallocated_support;
@@ -3663,34 +3648,34 @@
 				if (bestUnitSupport > 0)
 				{
 					Assert(total_unit_support_by_type >= 0);
-					m_buildUnitList[list_num].m_maximumCount = 
+					m_buildUnitList[list_num].m_maximumCount =
 						static_cast<sint16>
-							(floor(static_cast<double>(total_unit_support_by_type) / 
+							(floor(static_cast<double>(total_unit_support_by_type) /
 								   bestUnitSupport
 								  )
 							);
-					
-					total_unallocated_support = total_unit_support_by_type - 
+
+					total_unallocated_support = total_unit_support_by_type -
 						m_buildUnitList[list_num].m_maximumCount * bestUnitSupport;
 				}
-				else 
+				else
 				{
-					m_buildUnitList[list_num].m_maximumCount = 
+					m_buildUnitList[list_num].m_maximumCount =
 						static_cast<sint16>(total_unit_support_by_type);
-					
+
 					total_unallocated_support = total_unit_support_by_type;
 				}
-				m_buildUnitList[list_num].m_desiredCount = 
-					m_buildUnitList[list_num].m_maximumCount - 
+				m_buildUnitList[list_num].m_desiredCount =
+					m_buildUnitList[list_num].m_maximumCount -
 					m_currentUnitCount[best_unit_type];
 
-				m_maximumUnitShieldCost += 
+				m_maximumUnitShieldCost +=
 					m_buildUnitList[list_num].m_maximumCount * bestUnitSupport;
 
-				m_currentUnitShieldCost += 
+				m_currentUnitShieldCost +=
 					m_currentUnitCount[best_unit_type] * bestUnitSupport;
 			}
-			else 
+			else
 			{
 				total_unallocated_support += total_unit_support_by_type;
 			}
@@ -3698,15 +3683,15 @@
 		case BUILD_UNIT_LIST_SETTLER:
 		case BUILD_UNIT_LIST_SEA_SETTLER:
 
-			if (    (best_unit_type >= 0) 
+			if (    (best_unit_type >= 0)
 			     && (desired_count > m_currentUnitCount[best_unit_type])
 			   )
 			{
 				m_buildUnitList[list_num].m_maximumCount =
 					static_cast<sint16>(needed_cities);
 
-				m_buildUnitList[list_num].m_desiredCount = 
-					m_buildUnitList[list_num].m_maximumCount - 
+				m_buildUnitList[list_num].m_desiredCount =
+					m_buildUnitList[list_num].m_maximumCount -
 					m_currentUnitCount[best_unit_type];
 			}
 			else
@@ -3722,8 +3707,8 @@
 			if (best_unit_type >= 0)
 			{
 				m_buildUnitList[list_num].m_maximumCount = desired_count;
-				m_buildUnitList[list_num].m_desiredCount = 
-				    static_cast<sint16>(desired_count 
+				m_buildUnitList[list_num].m_desiredCount =
+				    static_cast<sint16>(desired_count
 				                        - m_currentUnitCount[best_unit_type]
 				                       );
 			}
@@ -3732,9 +3717,9 @@
 			if (best_unit_type >= 0)
 			{
 				m_buildUnitList[list_num].m_maximumCount = desired_count + needed_transport;
-				m_buildUnitList[list_num].m_desiredCount = 
-				    static_cast<sint16>(desired_count 
-				                        + needed_transport 
+				m_buildUnitList[list_num].m_desiredCount =
+				    static_cast<sint16>(desired_count
+				                        + needed_transport
 				                        - m_currentUnitCount[best_unit_type]
 				                       );
 			}
@@ -3743,10 +3728,10 @@
 		case BUILD_UNIT_LIST_AIR_TRANSPORT:
 			if (best_unit_type >= 0)
 			{
-				if (m_buildUnitList[BUILD_UNIT_LIST_SEA_TRANSPORT].m_desiredCount == 0) 
+				if (m_buildUnitList[BUILD_UNIT_LIST_SEA_TRANSPORT].m_desiredCount == 0)
 				{
 					m_buildUnitList[list_num].m_maximumCount = desired_count;
-					m_buildUnitList[list_num].m_desiredCount = 
+					m_buildUnitList[list_num].m_desiredCount =
 					    static_cast<sint16>(desired_count
 					                        - m_currentUnitCount[best_unit_type]
 					                       );
@@ -3755,7 +3740,7 @@
 			break;
 
 		default:
-			
+
 			Assert(false);
 			break;
 		}
@@ -3764,7 +3749,7 @@
 	m_buildUnitList[BUILD_UNIT_LIST_OFFENSE].m_garrisonCount = 0;
 	m_buildUnitList[BUILD_UNIT_LIST_DEFENSE].m_garrisonCount = 0;
 	m_buildUnitList[BUILD_UNIT_LIST_RANGED].m_garrisonCount = 0;
-	
+
 	sint32 desired_offense;
 	sint32 desired_defense;
 	sint32 desired_ranged;
@@ -3815,13 +3800,13 @@
 
 		if ( desired_offense > 0)
 		{
-			m_buildUnitList[BUILD_UNIT_LIST_OFFENSE].m_garrisonCount += 
+			m_buildUnitList[BUILD_UNIT_LIST_OFFENSE].m_garrisonCount +=
 				static_cast<sint16>(desired_offense);
 		}
 
 		if ( desired_defense > 0 )
 		{
-			m_buildUnitList[BUILD_UNIT_LIST_DEFENSE].m_garrisonCount += 
+			m_buildUnitList[BUILD_UNIT_LIST_DEFENSE].m_garrisonCount +=
 				static_cast<sint16>(desired_defense);
 		}
 
@@ -3853,7 +3838,7 @@
 	bool first_turn_of_war = Diplomat::GetDiplomat(m_playerId).FirstTurnOfWar();
 
 	UnitDynamicArray *  city_list = player->GetAllCitiesList();
-	
+
 	for (sint32 i = 0; i < city_list->Num(); i++)
 	{
 		Unit        cityUnit    = city_list->Access(i);
@@ -3885,8 +3870,8 @@
 			continue;
 
 		bool insert_ok = false;
-		switch (cat) 
-		{ 
+		switch (cat)
+		{
 		case k_GAME_OBJ_TYPE_UNIT:
 			insert_ok = city->BuildUnit(type);
 			if (insert_ok && list_num < BUILD_UNIT_LIST_MAX)
@@ -3897,7 +3882,7 @@
 			break;
 		case k_GAME_OBJ_TYPE_IMPROVEMENT:
 			insert_ok = city->BuildImprovement(type);
-			break; 
+			break;
 		case k_GAME_OBJ_TYPE_CAPITALIZATION:
 			insert_ok = true;
 //			city->InsertCapitalization(); // How is Capitalization removed?
@@ -3991,7 +3976,7 @@
 {
 	StringId advice;
 	bool noUnits = false;
-	const BuildListSequenceRecord *build_list_sequence = 
+	const BuildListSequenceRecord *build_list_sequence =
 		GetMatchingSequence(city, !g_player[m_playerId]->IsRobot(), advice, noUnits);
 
 	if (city->GetUseGovernor() && !g_player[m_playerId]->IsRobot())
@@ -4006,9 +3991,9 @@
 			city->SetBuildListSequenceIndex(suggested_sequence);
 	}
 
-	bool city_full = 
+	bool city_full =
 		(g_theWorld->GetCell(city->GetHomeCity().RetPos())->GetNumUnits() >= k_MAX_ARMY_SIZE);
-	
+
 	for (sint32 i = 0; i < build_list_sequence->GetNumBuildListElement(); i++)
 	{
 		BuildListSequenceRecord::BuildListElement const * elem =
@@ -4128,7 +4113,7 @@
 
 	sint32 minNumUnits;
 	sint32 maxRawHappiness;
-	
+
 	SlidersSetting sliders_setting;
 	sint32 cityRawHappiness = static_cast<sint32>(city->GetHappiness()) - city->GetHappinessFromPops();
 
@@ -4291,9 +4276,8 @@
 		}
 	}
 
-
 	advice = -1;
-	
+
 	if (best_elem == NULL)
 	{
 		best_elem = strategy.GetBuildListSequenceElement(i-1);
@@ -4309,7 +4293,6 @@
 	return best_elem->GetBuildListSequence();
 }
 
-
 sint32 Governor::GetNeededUnitType(const CityData *city, sint32 & list_num) const
 {
 	Assert(g_player[m_playerId]);
@@ -4328,13 +4311,13 @@
 	strategy.GetBuildTransportProductionLevel(build_transport_production_level);
 	strategy.GetBuildSettlerProductionLevel(build_settler_production_level);
 
-	bool canBuildSettlers  = static_cast<double>(m_currentUnitShieldCost) / 
-	                         static_cast<double>(m_maximumUnitShieldCost) > 
+	bool canBuildSettlers  = static_cast<double>(m_currentUnitShieldCost) /
+	                         static_cast<double>(m_maximumUnitShieldCost) >
 	                                      build_settler_production_level;
 //	                      || city->GetNeededGarrisonStrength() * build_settler_production_level <= city->GetCurrentGarrisonStrength();
 
-	bool canBuildTransporters = static_cast<double>(m_currentUnitShieldCost) / 
-	                            static_cast<double>(m_maximumUnitShieldCost) > 
+	bool canBuildTransporters = static_cast<double>(m_currentUnitShieldCost) /
+	                            static_cast<double>(m_maximumUnitShieldCost) >
 	                                         build_settler_production_level;
 //	                      || city->GetNeededGarrisonStrength() * build_transport_production_level <= city->GetCurrentGarrisonStrength();
 
@@ -4363,12 +4346,12 @@
 			if (!g_theWorld->GetAdjacentOcean(city->GetHomeCity().RetPos(), cont))
 				continue;
 		}
-		
+
 		if(static_cast<BUILD_UNIT_LIST>(list_num) == BUILD_UNIT_LIST_FREIGHT)
 			continue;
-		
+
 		const BuildUnitList & list_ref = m_buildUnitList[list_num];
-		
+
 		if
 		  (
 		       list_ref.m_bestType < 0
@@ -4377,12 +4360,12 @@
 		{
 			continue;
 		}
-		
-		needed_production = 
+
+		needed_production =
 			GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
-		
+
 		turns_to_build = city->HowMuchLonger(needed_production);
-		
+
 		if
 		  (
 		       static_cast<BUILD_UNIT_LIST>(list_num) == BUILD_UNIT_LIST_SETTLER
@@ -4395,7 +4378,7 @@
 		{
 			needed_production *= list_ref.m_desiredCount;
 		}
-		
+
 		if ( needed_production > 0 )
 		{
 			if
@@ -4456,7 +4439,7 @@
 	{
 		type = m_buildUnitList[max_list].m_bestType;
 		list_num = max_list;
-		
+
 		if (!city->CanBuildUnit(type))
 		{
 			const UnitBuildListRecord *build_list_rec = GetBuildListRecord(strategy, max_list);
@@ -4533,7 +4516,7 @@
 		Assert(false);
 		return NULL;
 	}
-}	
+}
 
 double Governor::MaxiumGarrisonDefence(const MapPoint & pos) const
 {
@@ -4583,7 +4566,7 @@
 	sint32 cont;
 
 	Scheduler & scheduler = Scheduler::GetScheduler(m_playerId);
-	
+
 	for (list_num = BUILD_UNIT_LIST_SEA_TRANSPORT; list_num < BUILD_UNIT_LIST_MAX; list_num++)
 	{
 
@@ -4622,7 +4605,7 @@
 //			   && (PercentUnbuilt(static_cast<BUILD_UNIT_LIST>(list_num)) > PercentUnbuilt(BUILD_UNIT_LIST_SEA_SETTLER) || m_currentUnitCount[m_buildUnitList[BUILD_UNIT_LIST_SEA_SETTLER].m_bestType] > 2)
 			  )
 			{
-				needed_production = 
+				needed_production =
 					GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 
 				sint32 turns_to_build = city->HowMuchLonger(needed_production);
@@ -4644,7 +4627,7 @@
 					continue;
 				}
 
-				needed_production = 
+				needed_production =
 					GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 
 				sint32 turns_to_build = city->HowMuchLonger(needed_production);
@@ -4667,7 +4650,7 @@
 					continue;
 				}
 
-				needed_production = 
+				needed_production =
 					GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 
 				sint32 turns_to_build = city->HowMuchLonger(needed_production);
@@ -4687,7 +4670,7 @@
 			   && garrisonPercent > build_settler_production_level
 			  )
 			{
-				needed_production = 
+				needed_production =
 					GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 
 				sint32 turns_to_build = city->HowMuchLonger(needed_production);
@@ -4700,7 +4683,7 @@
 			}
 			else
 			{
-				needed_production = (list_ref.m_garrisonCount * 
+				needed_production = (list_ref.m_garrisonCount *
 									 GetDBUnitRec(list_ref.m_bestType)->GetShieldCost());
 			}
 		}
@@ -4720,7 +4703,7 @@
 			{
 				if(garrisonComplte >= 1.0) // Don't merge this part, since it may be exposed for the three types
 				{
-					needed_production = 
+					needed_production =
 						GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 
 					sint32 turns_to_build = city->HowMuchLonger(needed_production);
@@ -4741,7 +4724,7 @@
 
 				if(garrisonComplte >= 1.0)
 				{
-					needed_production = 
+					needed_production =
 						GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 
 					sint32 turns_to_build = city->HowMuchLonger(needed_production);
@@ -4762,7 +4745,7 @@
 
 				if(garrisonComplte >= 1.0)
 				{
-					needed_production = 
+					needed_production =
 						GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 
 					sint32 turns_to_build = city->HowMuchLonger(needed_production);
@@ -4783,7 +4766,7 @@
 			{
 				if(garrisonComplte >= 1.0)
 				{
-					needed_production = 
+					needed_production =
 						GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 
 					sint32 turns_to_build = city->HowMuchLonger(needed_production);
@@ -4797,7 +4780,7 @@
 			}
 			else
 			{
-				needed_production = list_ref.m_perCityGarrison * 
+				needed_production = list_ref.m_perCityGarrison *
 					GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 
 				g_theWorld->GetArmy( city->GetHomeCity().RetPos(), garrison_army );
@@ -4805,7 +4788,7 @@
 				{
 					if ( garrison_army.Get(i).GetDBRec()->GetIndex() == list_ref.m_bestType)
 					{
-						needed_production -= 
+						needed_production -=
 							GetDBUnitRec(list_ref.m_bestType)->GetShieldCost();
 					}
 				}
@@ -4840,11 +4823,10 @@
 	return type;
 }
 
-
 sint32 Governor::GetNeededBuildingType(const CityData *city, const BuildingBuildListRecord *build_list_rec ) const
 {
 	Assert(city);
-	
+
 	for (sint32 i = 0; i < build_list_rec->GetNumBuilding(); i++)
 	{
 		sint32 const building_type = build_list_rec->GetBuildingIndex(i);
@@ -4911,7 +4893,7 @@
 
 sint32 Governor::ComputeBestMilitaryReadiness() const
 {
-	
+
 	const StrategyRecord & strategy = Diplomat::GetDiplomat(m_playerId).GetCurrentStrategy();
 	sint32 new_level = 0;
 	(void) strategy.GetReadinessLevel(new_level);
@@ -4930,7 +4912,6 @@
 		max_support_cost = (static_cast<double>(support_percent) / 100.0);
 	}
 
-	
 	if(total_production
 	&& player_ptr->GetReadinessCost() > (max_support_cost * total_production)
 	){
@@ -4962,7 +4943,7 @@
 
 	Player *player_ptr = g_player[m_playerId];
 	Assert(g_player[m_playerId])
-	
+
 	if (player_ptr == NULL)
 		return -1;
 
@@ -5023,7 +5004,7 @@
 				garrison[j].IsEntrenching())
 				break;
 		}
-		
+
 		if (j == garrison.Num())
 		{
 			sc.AddCity(city);
@@ -5091,7 +5072,6 @@
 
 	m_neededFreight = 0.0;
 
-	
 	UnitDynamicArray * city_list = player_ptr->GetAllCitiesList();
 	sint32             cityCount = city_list ? city_list->Num() : 0;
 	for (sint32 i = 0; i < cityCount; i++)
@@ -5108,10 +5088,10 @@
 				if(!city.CD()->HasResource(g)
 				&&  city.CD()->GetResourceTradeRoute(g, curDestRoute))
 				{
-					sellingPrice = 
+					sellingPrice =
 						tradeutil_GetTradeValue(m_playerId, curDestRoute->GetDestination(), g);
 				}
-				else 
+				else
 				{
 					curDestRoute.m_id = 0;
 				}
@@ -5131,20 +5111,20 @@
 						if (!player_ptr->HasContactWith(op))
 							continue;
 
-						if (AgreementMatrix::s_agreements.TurnsAtWar(m_playerId, op) >= 0) 
+						if (AgreementMatrix::s_agreements.TurnsAtWar(m_playerId, op) >= 0)
 							continue;
-					
+
 						if (Diplomat::GetDiplomat(op).GetEmbargo(m_playerId))
 							continue;
 					}
-					
+
 					for (sint32 d = 0; d < g_player[op]->m_all_cities->Num(); d++) {
 						Unit destCity = g_player[op]->m_all_cities->Access(d);
-						
-						if(!(destCity.GetVisibility() & (1 << m_playerId))) 
+
+						if(!(destCity.GetVisibility() & (1 << m_playerId)))
 							continue;
-						
-						if(destCity.m_id == city.m_id) 
+
+						if(destCity.m_id == city.m_id)
 							continue;
 
 						if (Diplomat::GetDiplomat(m_playerId).
@@ -5152,7 +5132,7 @@
 							continue;
 
 						if(curDestRoute.m_id != 0 &&
-						    curDestRoute->GetDestination().m_id == destCity.m_id) 
+						    curDestRoute->GetDestination().m_id == destCity.m_id)
 							continue;
 
 						const sint32 price = tradeutil_GetTradeValue(m_playerId, destCity, g);
@@ -5163,22 +5143,22 @@
 							maxNeededFreight = cost;
 							bestPrice = price;
 						}
-						
+
 						if ((price > maxPrice) && (cost < total_freight))
 						{
 							maxPrice = price;
 							maxCity = destCity;
 							maxCost = cost;
 						}
-					} 
-				} 
-	
+					}
+				}
+
 				m_neededFreight += maxNeededFreight;
 
 				if (!player_ptr->IsRobot())
 					continue;
 
-				if (((sellingPrice < maxPrice) && (sellingPrice > 0) ) || 
+				if (((sellingPrice < maxPrice) && (sellingPrice > 0) ) ||
 					(curDestRoute.m_id != 0 && Diplomat::GetDiplomat(m_playerId).
 					GetTradeRoutePiracyRisk(city, curDestRoute->GetDestination())))
 				{
@@ -5194,14 +5174,14 @@
 					}
 				}
 
-				if ((maxPrice > 0) && ((sellingPrice < 0) || (sellingPrice < maxPrice))) 
+				if ((maxPrice > 0) && ((sellingPrice < 0) || (sellingPrice < maxPrice)))
 				{
 					new_route.m_sourceCity      = city;
 					new_route.m_destinationCity = maxCity;
 					new_route.m_cost            = maxCost;
 					new_route.m_value           = maxPrice;
 					new_route.m_resource        = g;
-					new_route.m_valuePerCaravan	= 
+					new_route.m_valuePerCaravan	=
 						(maxCost <= 0) ? VALUE_FREE_LUNCH
 									   : static_cast<double>(maxPrice) / maxCost;
 					new_routes.push_back(new_route);
@@ -5328,4 +5308,3 @@
 		newCapital->BuildImprovement(type);
 	}
 }
-

Modified: trunk/ctp2_code/ai/CityManagement/governor.h
==============================================================================
--- trunk/ctp2_code/ai/CityManagement/governor.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/CityManagement/governor.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,13 +11,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 // _DEBUG
 // - Generate debug version when set.
 //
@@ -28,18 +28,18 @@
 //
 // Modifications from the original Activision code:
 //
-// - Added terrain boni arguments to FindBestTileImprovement to record the 
+// - Added terrain boni arguments to FindBestTileImprovement to record the
 //   already given terrain boni for that city, by Martin Gühmann
 // - Added GetBestTerraformImprovement function to find the best terraform
-//   improvement. - Sep. 21st 2004 Martin Gühmann 
-// - Cleaned up GetBestTerraformImprovement function. - Oct. 6th 2004 Martin Gühmann 
+//   improvement. - Sep. 21st 2004 Martin Gühmann
+// - Cleaned up GetBestTerraformImprovement function. - Oct. 6th 2004 Martin Gühmann
 // - Replaced ComputeMinimumFoodWorkers by ComputeMinimumWorkers function.
 //   - April 4th 2005 Martin Gühmann
 // - Made some methods const. - April 15th 2005 Martin Gühmann
 // - Added Cleanup to reduce memory leak reports.
 // - Merged with linux changes.
 // - Improved import structure, removed debug allocator versions.
-// - Added copy constructor to bypass a problem concerning memory 
+// - Added copy constructor to bypass a problem concerning memory
 //   allocation. - June 18th 2005 Martin Gühmann
 // - Added no test sliders struct.
 // - Added OptimizeSliders method to have a better routine for AI sliders
@@ -102,20 +102,17 @@
 	typedef std::vector<sint16>     UnitCountVector;
 
 
-	
 	static void ResizeAll(const PLAYER_INDEX & newMaxPlayerId);
 	static void Cleanup(void);
-	
+
 	static void LoadAll(CivArchive & archive);
 	static void SaveAll(CivArchive & archive);
 
-	
 	static Governor & GetGovernor(const PLAYER_INDEX & playerId);
 
 	static Governor const &         INVALID;
 
-	
-	
+
 	enum BUILD_UNIT_LIST {
 		BUILD_UNIT_LIST_AIR,
 		BUILD_UNIT_LIST_SEA,
@@ -134,7 +131,6 @@
 		BUILD_UNIT_LIST_MAX
 	};
 
-	
 	Governor(PLAYER_INDEX const & playerId = PLAYER_UNASSIGNED);
 	Governor(Governor const &copyme);
 	~Governor();
@@ -145,26 +141,23 @@
 	             const sint16 & ySize,
 	             const sint16 & resolution );
 
-	
 	void Load(CivArchive & archive);
 
-	
 	void Save(CivArchive & archive) const;
 
 
-	
-	
-	
 
-	
+
+
+
+
 	sint32 ComputeBestGovernment() const;
 
-	
 	StringId GetGovernmentAdvice() const;
-	
-	
-	
-	
+
+
+
+
 
 	struct SlidersSetting
 	{
@@ -201,11 +194,10 @@
 			return !(*this==rval);
 		}
 
-		
 		sint32 m_deltaProduction;
 		sint32 m_deltaGold;
 		sint32 m_deltaFood;
-		
+
 		bool m_optimizeProduction;
 		bool m_optimizeGold;
 		bool m_optimizeFood;
@@ -247,20 +239,15 @@
 	// The sliders
 	void NormalizeSliders(SlidersSetting & sliders_setting) const;
 
-	
 	sint32 SetSliders(const SlidersSetting & sliders_setting, const bool & update_cities) const;
 
-	
 	void GetSliders(SlidersSetting & sliders_setting) const;
 
-	
-	
+
 	bool ComputeMinimumSliders( SlidersSetting & sliders_setting ) const;
 
-	
 	bool ComputeBestSliders( SlidersSetting & sliders_setting ) const;
 
-	
 	StringId GetSlidersAdvice() const;
 
 	// New slider function
@@ -272,36 +259,31 @@
 	bool FoodSliderReachedMin(SlidersSetting & sliders_setting) const;
 
 	// End of sliders
-	
-	
 
-	
+
+
+
 	bool AddRoadPriority(Path & path, const double & priority_delta);
 
-	
 	void ComputeRoadPriorities();
 
-	
 	void PlaceTileImprovements();
 
-	
-	
-	
 
-	
+
+
+
+
 	void AssignPopulations();
 
-	
 	void AssignPopulation(CityData *city) const;
 
-	
 	void ComputeMinMaxEntertainers(const CityData *city, sint32 & min, sint32 & max) const;
 
-
-	sint32 ComputeMinimumWorkers(CityData *city, 
-	                           sint32 &farmers, 
-	                           sint32 &laborers, 
-	                           sint32 &merchants, 
+	sint32 ComputeMinimumWorkers(CityData *city,
+	                           sint32 &farmers,
+	                           sint32 &laborers,
+	                           sint32 &merchants,
 	                           sint32 &scientists,
 	                           sint32 &minFood,
 	                           sint32 &minProd,
@@ -315,36 +297,31 @@
 	                           double &merchantsEff,
 	                           double &scientistsEff) const;
 #endif
-	
+
 	void ComputeDesiredUnits();
 
-	
 	void FillEmptyBuildQueues(bool noWarChange = false);
 
-	
 	double PercentUnbuilt(const BUILD_UNIT_LIST unit_list) const;
 
-	
 	StringId GetCityBuildQueueAdvice(const CityData *city) const;
 
-	
 	StringId GetUnitsAdvice(SlicContext & sc) const;
 
-	
-	
-	
 
-	
+
+
+
+
 	sint32 ComputeBestMilitaryReadiness() const;
 
-	
 	StringId GetTacticalAdvice(SlicContext & sc) const;
 
-	
-	
-	
 
-	
+
+
+
+
 	void ManageGoodsTradeRoutes();
 	void ComputeNextBuildItem(CityData *city, sint32 & cat, sint32 & type)
 	{
@@ -355,12 +332,12 @@
 	};
 
 private:
-	
+
 	static GovernorVector s_theGovernors;
 
-	
-	
-	
+
+
+
 
 	struct BuildUnitList {
 		BuildUnitList() {
@@ -378,16 +355,12 @@
 		sint16 m_perCityGarrison;
 	};
 
-	
 	sint32 m_maximumUnitShieldCost;
 
-	
 	sint32 m_currentUnitShieldCost;
 
-	
 	bool FitSlidersToCities( SlidersSetting & sliders_setting ) const;
 
-	
 	bool TestSliderSettings(const SlidersSetting & sliders_setting,
 	                        bool   & production_test,
 	                        bool   & gold_test,
@@ -401,7 +374,7 @@
 	(
 		SlidersSetting const &  sliders_setting,
 		SliderTests &           slider_tests
-	) const 
+	) const
 	{
 		return TestSliderSettings(sliders_setting,
 		                          slider_tests.m_productionTest,
@@ -415,43 +388,36 @@
 
 	void ComputeNextBuildItem(CityData *city, sint32 & cat, sint32 & type, sint32 & list_num) const;
 
-
 	const BuildListSequenceRecord * GetMatchingSequence(const CityData *city, const bool human_city, StringId & advice, bool & noUnits) const;
 
 	bool HasStopBuildings(const StrategyRecord::BuildListSequenceElement* elem, const CityData* cd) const;
 
 	sint32 GetNeededUnitType(const CityData *city, sint32 & list_num) const;
 
-	
 	const UnitBuildListRecord * GetBuildListRecord(const StrategyRecord & strategy, const BUILD_UNIT_LIST list_type) const;
 
-	
 	sint32 GetNeededGarrisonUnitType(const CityData * city, sint32 & list_num) const;
 
-	
 	sint32 GetNeededBuildingType(const CityData *city, const BuildingBuildListRecord *build_list_rec ) const;
 
-	
 	sint32 GetNeededWonderType(const CityData *city, const WonderBuildListRecord *build_list_rec ) const;
 
-	
 	sint32 GetNeededFreightType(sint32 & list_num) const;
 
-	
 	sint32 ComputeBestUnitType(const UnitBuildListRecord *build_list_rec, const CityData *city = NULL) const;
-	
-	
-	
-	
 
-	
+
+
+
+
+
 	const StrategyRecord::PopAssignmentElement *GetMatchingPopAssignment(const CityData *city) const;
 
-	
-	
-	
 
-	
+
+
+
+
 	struct TiGoal
 	{
 		TiGoal() { utility = -1.0; }
@@ -489,10 +455,8 @@
 
 	bool FindBestTileImprovement(const MapPoint &pos, TiGoal &goal, sint32 &bonusFood, sint32 &bonusProduction, sint32 &bonusCommerce) const;
 
-	
 	sint32 GetBestRoadImprovement(const MapPoint & pos) const;
 
-	
 	void GetBestFoodProdGoldImprovement(const MapPoint & pos, sint32 & food_imp, sint32 & prod_imp, sint32 & gold_imp) const;
 
 	void GetBestTerraformImprovement(const MapPoint & pos, sint32 & food_imp, sint32 & prod_imp, sint32 & gold_imp, bool pwPerBonus) const;

Modified: trunk/ctp2_code/ai/ctp2/ctp2.h
==============================================================================
--- trunk/ctp2_code/ai/ctp2/ctp2.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/ctp2/ctp2.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,15 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #ifdef HAVE_PRAGMA_ONCE
 #pragma once
 #endif
@@ -22,7 +10,6 @@
 
 #pragma warning( error : 4700 )
 
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -34,7 +21,6 @@
 #include <stdarg.h>
 #include <time.h>
 
-
 #include "ctp_types.h"
 #include "ctp_debug.h"
 

Modified: trunk/ctp2_code/ai/ctp2/ctp_debug.h
==============================================================================
--- trunk/ctp2_code/ai/ctp2/ctp_debug.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/ctp2/ctp_debug.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,7 +1 @@
-
-
-
-
-
-
 #define Assert

Modified: trunk/ctp2_code/ai/ctp2/ctp_types.h
==============================================================================
--- trunk/ctp2_code/ai/ctp2/ctp_types.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/ctp2/ctp_types.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,14 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
 #ifdef HAVE_PRAGMA_ONCE
 #pragma once
 #endif
@@ -18,27 +7,25 @@
 typedef signed char			schar;
 typedef unsigned char		uchar;
 
-typedef signed char			sint8; 
+typedef signed char			sint8;
 typedef unsigned char		uint8;
 typedef signed short int	sint16;
 typedef unsigned short int	uint16;
 typedef signed long int		sint32;
 typedef unsigned long int	uint32;
-typedef signed __int64		sint64; 
-typedef unsigned __int64	uint64; 
-
+typedef signed __int64		sint64;
+typedef unsigned __int64	uint64;
 
 typedef char				MBCHAR;
 
-
 #error "Do not use this"
 
 extern sint32 g_turn;
 extern sint32 g_numPlayers;
 
 struct MapPointData {
-	MapPointData(sint16 X=0, 
-		sint16 Y=0, 
+	MapPointData(sint16 X=0,
+		sint16 Y=0,
 		sint16 Z=0): x(X), y(Y), z(Z) {}
 	sint16 x,y,z;
 };
@@ -58,35 +45,34 @@
 enum CAUSE_REMOVE_ARMY {
 		CAUSE_REMOVE_ARMY_UNKNOWN,
 		CAUSE_REMOVE_ARMY_FLOOD,
-		
-		CAUSE_REMOVE_ARMY_ATTACKED, 
-		CAUSE_REMOVE_ARMY_CHEAT, 
+
+		CAUSE_REMOVE_ARMY_ATTACKED,
+		CAUSE_REMOVE_ARMY_CHEAT,
 		CAUSE_REMOVE_ARMY_TRANSPORTED,
-		CAUSE_REMOVE_ARMY_GROUPING, 
-		CAUSE_REMOVE_ARMY_UNGROUPING, 
-		CAUSE_REMOVE_ARMY_RAIL_LAUNCH, 
-		CAUSE_REMOVE_ARMY_PARADROP, 
-		CAUSE_REMOVE_ARMY_SETTLE, 
-		CAUSE_REMOVE_ARMY_STARVATION, 
-		CAUSE_REMOVE_ARMY_PARKRANGER,     
-		CAUSE_REMOVE_ARMY_NUKE, 
-		CAUSE_REMOVE_ARMY_BOMBARD, 
-		CAUSE_REMOVE_ARMY_SUE, 
-		CAUSE_REMOVE_ARMY_POLLUTION, 
-		CAUSE_REMOVE_ARMY_UPRISING,     
-		CAUSE_REMOVE_ARMY_SLAVE_UPRISING, 
+		CAUSE_REMOVE_ARMY_GROUPING,
+		CAUSE_REMOVE_ARMY_UNGROUPING,
+		CAUSE_REMOVE_ARMY_RAIL_LAUNCH,
+		CAUSE_REMOVE_ARMY_PARADROP,
+		CAUSE_REMOVE_ARMY_SETTLE,
+		CAUSE_REMOVE_ARMY_STARVATION,
+		CAUSE_REMOVE_ARMY_PARKRANGER,
+		CAUSE_REMOVE_ARMY_NUKE,
+		CAUSE_REMOVE_ARMY_BOMBARD,
+		CAUSE_REMOVE_ARMY_SUE,
+		CAUSE_REMOVE_ARMY_POLLUTION,
+		CAUSE_REMOVE_ARMY_UPRISING,
+		CAUSE_REMOVE_ARMY_SLAVE_UPRISING,
 		CAUSE_REMOVE_ARMY_ENSLAVED,
-		CAUSE_REMOVE_ARMY_DIPLOMACY, 
-		CAUSE_REMOVE_ARMY_NO_MAT_SUPPORT,  
-	
-		
-		CAUSE_REMOVE_ARMY_DIED_IN_ATTACK, 
+		CAUSE_REMOVE_ARMY_DIPLOMACY,
+		CAUSE_REMOVE_ARMY_NO_MAT_SUPPORT,
+
+		CAUSE_REMOVE_ARMY_DIED_IN_ATTACK,
 		CAUSE_REMOVE_ARMY_DIED_IN_ATTACK_ON_TOP,
-		CAUSE_REMOVE_ARMY_DIED_IN_SPYING, 
+		CAUSE_REMOVE_ARMY_DIED_IN_SPYING,
 		CAUSE_REMOVE_ARMY_DIED_IN_SLAVERAID,
 		CAUSE_REMOVE_ARMY_DIED_IN_UNDERGROUND_RR_RAID,
-		CAUSE_REMOVE_ARMY_DIED_IN_CONVERT_RAID, 
-		CAUSE_REMOVE_ARMY_DIED_IN_REFORMATION, 
+		CAUSE_REMOVE_ARMY_DIED_IN_CONVERT_RAID,
+		CAUSE_REMOVE_ARMY_DIED_IN_REFORMATION,
 		CAUSE_REMOVE_ARMY_COUNTERBOMBARD,
 		CAUSE_REMOVE_ARMY_OUTOFFUEL,
 		CAUSE_REMOVE_ARMY_REENTRY,
@@ -97,12 +83,12 @@
 		CAUSE_REMOVE_ARMY_TRANSPORT_DIED,
 		CAUSE_REMOVE_ARMY_DIDNT_NEED_IT_AFTER_ALL,
 		CAUSE_REMOVE_ARMY_DISBANDED,
-		
+
 		CAUSE_REMOVE_ARMY_PARADROP_COMPLETE,
 		CAUSE_REMOVE_ARMY_NUKES_ELIMINATED,
 		CAUSE_REMOVE_ARMY_EMANCIPATION,
 		CAUSE_REMOVE_ARMY_ILLEGAL_CELL,
-		CAUSE_REMOVE_ARMY_EXPELLED_NO_CITIES, 
+		CAUSE_REMOVE_ARMY_EXPELLED_NO_CITIES,
 		CAUSE_REMOVE_ARMY_SCENARIO,
 		CAUSE_REMOVE_ARMY_PROBE_RECOVERED,
 };
@@ -111,8 +97,8 @@
 	GSObj() {
 		owner = id = attack = 1;
 	}
-	GSObj(const sint32 &o, 
-		  const sint32 &i, 
+	GSObj(const sint32 &o,
+		  const sint32 &i,
 		  const sint32 a) : owner(o), id(i), attack(a) {}
 	sint32 owner;
 	sint32 id;
@@ -130,7 +116,7 @@
 		{ m_argLists[type][index] = val; return true; }
 	BOOL SetArg(const sint32 & type, const sint32 & index, const sint32 & val)
 		{ m_argLists[type][index].id = val; return true;}
-	BOOL SetCity(const sint32 & index, const Unit &c) 
+	BOOL SetCity(const sint32 & index, const Unit &c)
 		{ return SetArg(0,index,c); }
 	BOOL SetUnit(const sint32 & index, const Unit &u)
 		{ return SetArg(1,index,u); }
@@ -174,11 +160,9 @@
 	Scheduler() {
 	};
 
-	
-	static const Scheduler & GetScheduler(const PLAYER_INDEX playerId)	
+	static const Scheduler & GetScheduler(const PLAYER_INDEX playerId)
 		{ return s_scheduler[playerId]; }
 
-	
 	sint32 GetValueUnsatisfiedGoals(const GOAL_TYPE & goalType) const {
 		return 10;
 	};
@@ -225,4 +209,3 @@
 
 
 #endif
-

Modified: trunk/ctp2_code/ai/ctp2/ldl_strings.h
==============================================================================
--- trunk/ctp2_code/ai/ctp2/ldl_strings.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/ctp2/ldl_strings.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,25 +1,14 @@
-
-
-
-
-
-
-
-
-
 #ifdef HAVE_PRAGMA_ONCE
 #pragma once
 #endif
 #ifndef __LDL_STRINGS_H__
 #define __LDL_STRINGS_H__
 
-
 extern string ID_LOST_BATTLE;
 extern string ID_ATTACKED_CIVILIANS;
 extern string ID_UNPROVOKED_ATTACK;
 extern string ID_ACCIDENTAL_ATTACK;
 
-
 extern string ID_EXPLAIN_TRADE_CITY_FOR_PEACE;
 extern string ID_ADVICE_TRADE_CITY_FOR_PEACE;
 extern string ID_NEWS_TRADE_CITY_FOR_PEACE;
@@ -60,7 +49,6 @@
 extern string ID_ADVICE_ACCEPT_COUNTER;
 extern string ID_NEWS_ACCEPT_COUNTER;
 
-
 extern string ID_SPY_FULL_ATTACK_SS;
 extern string ID_ADVICE_FULL_ATTACK_SS;
 extern string ID_NEWS_FULL_ATTACK_SS;
@@ -68,7 +56,6 @@
 extern string ID_ADVICE_REGROUP_SS;
 extern string ID_NEWS_REGROUP_SS;
 
-
 extern string ID_SPY_PROVOKE_WAR_DS;
 extern string ID_ADVICE_PROVOKE_WAR_DS;
 extern string ID_NEWS_PROVOKE_WAR_DS;

Modified: trunk/ctp2_code/ai/ctpai.cpp
==============================================================================
--- trunk/ctp2_code/ai/ctpai.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/ctpai.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -32,19 +32,19 @@
 // - Add the same action to escort Transports as it exists for Settlers - Calvitix
 // - Allow army groups (size > 1) to escort settlers or transports - Calvitix
 // - Place Tile Improvement every turn instead of every 5 turns - Calvitix
-// - Add goals (Chokepoint - Goodyhuts) if there is only a third of maxeval 
-//   (and not just when there isn't anymore (if one goal remain and isn't 
+// - Add goals (Chokepoint - Goodyhuts) if there is only a third of maxeval
+//   (and not just when there isn't anymore (if one goal remain and isn't
 //   satisfied, it can freeze all the goals of this type)) - Calvitix
 // - AI now improves every turn its city tiles. - Calvitex
 // - Set explore resolution (an Explore goal every 4 tiles is a good compromise)
-// - Undid the last change as I still think it reduces game speed maybe 
-//   something else has to be improved to avaoid the long pauses caused 
+// - Undid the last change as I still think it reduces game speed maybe
+//   something else has to be improved to avaoid the long pauses caused
 //   by some AIs. - Martin Gühmann
-// - force to move the transport units out of city (12 units isn't much, and 
-//   their is problems when a group want to enter in a transport that is in 
-//   town(example : 5 - units group cannot enter transport if it is in a city 
+// - force to move the transport units out of city (12 units isn't much, and
+//   their is problems when a group want to enter in a transport that is in
+//   town(example : 5 - units group cannot enter transport if it is in a city
 //   and with 7 other garrison units(based on makeRoomForNewUnits code) - Calvitix
-// - Add UngroupGarrison method (to ungroup units blocked by garrison 
+// - Add UngroupGarrison method (to ungroup units blocked by garrison
 //   (for example seige force) - Calvitix
 // - Cleaned up data of dead player.
 // - Improved Diplomat cleanup.
@@ -87,7 +87,7 @@
 #include "mapanalysis.h"
 #include "governor.h"
 #include "AgreementMatrix.h"
-#include "Civilisation.h" 
+#include "Civilisation.h"
 #include "DiplomacyProposalRecord.h"
 #include "robotastar2.h"
 #include "gaiacontroller.h"
@@ -153,7 +153,7 @@
 namespace
 {
 	// Settings for periodic actions
-	// These should be > 0 (otherwise % will crash). 
+	// These should be > 0 (otherwise % will crash).
 	// The original ACTIVISION values are 5 for all period.
 	size_t const    PERIOD_COMPUTE_ROADS                = 2; // From 5
 	size_t const    PERIOD_COMPUTE_TILE_IMPROVEMENTS    = 5;
@@ -177,7 +177,7 @@
 		return GEV_HD_Continue;
 
 	PLAYER_INDEX    originalOwner = city.GetOwner();
-	
+
 	CtpAi::AddOwnerGoalsForCity(city, newOwner);
 	CtpAi::AddForeignerGoalsForCity(city, originalOwner);
 
@@ -202,7 +202,6 @@
 	if (!args->GetCity(0, city))
 		return GEV_HD_Continue;
 
-	
 	for (PLAYER_INDEX foreignerId = 0; foreignerId < CtpAi::s_maxPlayers; foreignerId++)
 	{
 		if (foreignerId != city.GetOwner())
@@ -289,8 +288,8 @@
 
 	static sint32 last_settle = NewTurnCount::GetCurrentRound();
 	static sint32 last_player = PLAYER_UNASSIGNED;
-	
-	if (!g_network.IsActive()) 
+
+	if (!g_network.IsActive())
 	{
 		if( player_ptr->IsRobot()
 		&&!(g_network.IsClient()
@@ -347,10 +346,10 @@
 
 		for (GOAL_TYPE goal_type = 0; goal_type < g_theGoalDB->NumRecords(); goal_type++)
 		{
-			if ( (!g_theWorld->IsWater(u.RetPos()) && 
-			       g_theGoalDB->Get(goal_type)->GetTargetTypeSettleLand() 
+			if ( (!g_theWorld->IsWater(u.RetPos()) &&
+			       g_theGoalDB->Get(goal_type)->GetTargetTypeSettleLand()
 			     ) ||
-			     (g_theWorld->IsWater(u.RetPos()) && 
+			     (g_theWorld->IsWater(u.RetPos()) &&
 			      g_theGoalDB->Get(goal_type)->GetTargetTypeSettleSea()
 			     )
 			   )
@@ -359,9 +358,9 @@
 				goal_ptr->Set_Type( goal_type );
 				goal_ptr->Set_Player_Index( playerId );
 				goal_ptr->Set_Target_Pos( u.RetPos() );
-				
+
 				scheduler.Add_New_Goal( goal_ptr );
-				
+
 				g_graphicsOptions->AddTextToCell(u.RetPos(), "KILLED", 0);
 			}
 		}
@@ -392,30 +391,29 @@
 	if (population <= 0)
 	{
 		SettleMap::s_settleMap.SetCanSettlePos(city.RetPos(), true);
-		
+
 		for (sint32 playerId = 1; playerId < CtpAi::s_maxPlayers; playerId++)
 		{
 			if (playerId != killer && playerId != city_owner)
 				continue;
-			
+
 			Scheduler & scheduler = Scheduler::GetScheduler(playerId);
-			
-			
+
 			for (GOAL_TYPE goal_type = 0; goal_type < g_theGoalDB->NumRecords(); goal_type++)
 			{
-				
-				if ( (g_theWorld->IsWater(city.RetPos()) == FALSE) && 
+
+				if ( (g_theWorld->IsWater(city.RetPos()) == FALSE) &&
 					(g_theGoalDB->Get(goal_type)->GetTargetTypeSettleLand()) ||
-					(g_theWorld->IsWater(city.RetPos()) == TRUE) && 
+					(g_theWorld->IsWater(city.RetPos()) == TRUE) &&
 					(g_theGoalDB->Get(goal_type)->GetTargetTypeSettleSea()))
 				{
 					Goal * goal_ptr = new Goal();
 					goal_ptr->Set_Type( goal_type );
 					goal_ptr->Set_Player_Index( playerId );
 					goal_ptr->Set_Target_Pos( city.RetPos() );
-					
+
 					scheduler.Add_New_Goal( goal_ptr );
-					
+
 					g_graphicsOptions->AddTextToCell(city.RetPos(), "NUKED", 0);
 				}
 			}
@@ -436,8 +434,8 @@
 
 	if (!args->GetArmy(0, army))
 		return GEV_HD_Continue;
-	
-	if (army->CanSettle() && 
+
+	if (army->CanSettle() &&
 		Diplomat::GetDiplomat(army.GetOwner()).ShouldEscortSettlers())
 	{
 		CtpAi::GroupWithEscort(army);
@@ -475,22 +473,19 @@
 			tmp_army = candidate_units[i].GetArmy();
 			Assert(tmp_army.IsValid());
 
-			
 			if (tmp_army == army)
 				continue;
 
-			
 			if (tmp_army.Num() > 1)
 				continue;
 
-			
 			if ((tmp_army->GetMovementType() &
 				 army->GetMovementType()) != army->GetMovementType())
 				continue;
 
 			unit_rec = tmp_army[0].GetDBRec();
 			tmp_strength = static_cast<sint32>
-				(unit_rec->GetAttack() * 
+				(unit_rec->GetAttack() *
 				 unit_rec->GetDefense() *
 				 unit_rec->GetFirepower() *
 				 unit_rec->GetArmor()
@@ -505,7 +500,7 @@
 
 	if (min_army.IsValid())
 	{
-		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_GroupUnitOrder, 
+		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_GroupUnitOrder,
 			GEA_Army, army,
 			GEA_Unit, min_army[0],
 			GEA_End);
@@ -518,7 +513,6 @@
 
 	Scheduler::GetScheduler(playerId).Add_New_Agent(new Agent(army));
 
-
 	for (PLAYER_INDEX foreignerId = 0; foreignerId < CtpAi::s_maxPlayers; foreignerId++)
 	{
 		if(g_player[foreignerId] != NULL)
@@ -560,12 +554,10 @@
 	DPRINTF(k_DBG_AI, ("// START NEGOTIATIONS -- Turn %d\n", round));
 	DPRINTF(k_DBG_AI, ("//					     Player %d\n", playerId));
 
-	
 	if (g_player[playerId]->m_civilisation->GetCivilisation() == 0)
 	{
 		DPRINTF(k_DBG_AI, ("//	*** Barbarians do not conduct diplomacy.\n"));
 
-		
 		g_director->AddBeginScheduler(playerId);
 
 		return GEV_HD_Continue;
@@ -578,12 +570,12 @@
 	&&   !g_player[playerId]->IsRobot()
 	  )
 	{
-		for (sint32 foreignerId = 1; foreignerId < CtpAi::s_maxPlayers; foreignerId++) 
+		for (sint32 foreignerId = 1; foreignerId < CtpAi::s_maxPlayers; foreignerId++)
 		{
 			if (g_player[foreignerId] &&
 				g_player[foreignerId]->IsRobot())
 			{
-				
+
 				Diplomat::GetDiplomat(foreignerId).StartNegotiations(playerId);
 			}
 		}
@@ -607,12 +599,12 @@
 STDEHANDLER(CtpAi_ConsiderNuclearWar)
 {
 	PLAYER_INDEX playerId;
-	
+
 	if (!args->GetPlayer(0, playerId))
 		return GEV_HD_Continue;
 
 	Player *player_ptr = g_player[playerId];
-	
+
 	if(!player_ptr->IsRobot() ||
 	   (g_network.IsActive() && playerId == g_selected_item->GetVisiblePlayer())) {
 		return GEV_HD_Continue;
@@ -620,16 +612,13 @@
 
 	Diplomat & diplomat = Diplomat::GetDiplomat(playerId);
 
-	
 	PLAYER_INDEX enemy_to_nuke = diplomat.ComputeNuclearLaunchTarget();
 
-	
-	bool fire_now = (enemy_to_nuke != -1) && 
+	bool fire_now = (enemy_to_nuke != -1) &&
 		          (AgreementMatrix::s_agreements.TurnsAtWar(playerId, enemy_to_nuke) > 15);
 
 	diplomat.TargetNuclearAttack(enemy_to_nuke, fire_now);
 
-
 	return GEV_HD_Continue;
 }
 
@@ -684,7 +673,7 @@
 	Scheduler::s_needAnotherCycle = false;
 	g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ProcessMatches,
 						   GEA_Player, playerId,
-						   GEA_Int, 0, 
+						   GEA_Int, 0,
 						   GEA_End);
 
 	return GEV_HD_Continue;
@@ -749,13 +738,13 @@
 	{
 		if(player_ptr->IsRobot())
 		{
-			if (player_ptr->GetGaiaController() && 
+			if (player_ptr->GetGaiaController() &&
 				player_ptr->GetGaiaController()->CanStartCountdown())
 			{
 				player_ptr->GetGaiaController()->StartCountdown();
 			}
 
-			const StrategyRecord & strategy = 
+			const StrategyRecord & strategy =
 				Diplomat::GetDiplomat(playerId).GetCurrentStrategy();
 
 			sint32 count;
@@ -769,7 +758,7 @@
 		if(player_ptr->IsRobot() &&
 		   (!g_network.IsClient() || g_network.IsLocalPlayer(playerId)))
 		{
-			for(sint32 i = 0; i < player_ptr->m_all_armies->Num(); i++) 
+			for(sint32 i = 0; i < player_ptr->m_all_armies->Num(); i++)
 			{
 				g_gevManager->AddEvent(GEV_INSERT_AfterCurrent, GEV_BeginTurnExecute,
 									   GEA_Army, player_ptr->m_all_armies->Access(i).m_id,
@@ -784,7 +773,7 @@
 			{
 				if(!g_network.IsActive() || g_network.IsLocalPlayer(playerId))
 				{
-					if(!g_network.IsClient() || 
+					if(!g_network.IsClient() ||
 						(g_network.IsClient() && player_ptr->IsRobot()))
 					{
 						DPRINTF(k_DBG_GAMESTATE, ("AI End turn, %d\n", playerId));
@@ -827,7 +816,7 @@
 
 	if(!args->GetPlayer(0, owner))
 		return GEV_HD_Continue;
-	
+
 	if(!args->GetInt(0, type))
 		return GEV_HD_Continue;
 
@@ -836,30 +825,30 @@
 		for (sint32 playerId = 1; playerId < CtpAi::s_maxPlayers; playerId++)
 		{
 			Scheduler & scheduler = Scheduler::GetScheduler(playerId);
-			const StrategyRecord & strategy = 
-				Diplomat::GetDiplomat(playerId).GetCurrentStrategy();	
+			const StrategyRecord & strategy =
+				Diplomat::GetDiplomat(playerId).GetCurrentStrategy();
 
-			for (sint16 goal_element = 0; goal_element < strategy.GetNumGoalElement(); goal_element++) 
+			for (sint16 goal_element = 0; goal_element < strategy.GetNumGoalElement(); goal_element++)
 			{
 				StrategyRecord::GoalElement const *
 				                    goal_element_ptr    = strategy.GetGoalElement(goal_element);
 				sint32              goal_type           = goal_element_ptr->GetGoalIndex();
 				GoalRecord const *  goal_rec            = g_theGoalDB->Get(goal_type);
-					
+
 				if ( !goal_rec->GetTargetTypeEndgame() )
 					continue;
-					
+
 				if (playerId != owner && goal_rec->GetTargetOwnerSelf())
 					continue;
-					
+
 				if (playerId == owner && !goal_rec->GetTargetOwnerSelf())
 					continue;
-					
+
 				Goal_ptr goal_ptr = new Goal();
 				goal_ptr->Set_Player_Index( playerId );
 				goal_ptr->Set_Type(static_cast<GOAL_TYPE>(goal_type));
 				goal_ptr->Set_Target_Pos( pos );
-					
+
 				scheduler.Add_New_Goal( goal_ptr );
 			}
 		}
@@ -894,7 +883,7 @@
 {
 	RegardEventCallbacks::AddCallbacks();
 	ReactEventCallbacks::AddCallbacks();
-	ProposalResponseEventCallbacks::AddCallbacks(); 
+	ProposalResponseEventCallbacks::AddCallbacks();
 	CounterResponseEventCallbacks::AddCallbacks();
 	ThreatResponseEventCallbacks::AddCallbacks();
 	RejectResponseEventCallbacks::AddCallbacks();
@@ -925,7 +914,7 @@
 	g_gevManager->AddCallback(GEV_BeginScheduler,
 		GEV_PRI_Primary,
 		&s_CtpAi_BeginSchedulerEvent);
-	
+
 	g_gevManager->AddCallback(GEV_ProcessMatches,
 		GEV_PRI_Primary,
 		&s_CtpAi_ProcessMatchesEvent);
@@ -949,7 +938,7 @@
 	g_gevManager->AddCallback(GEV_CreatedArmy,
 		GEV_PRI_Post,
 		&s_CtpAi_CreatedArmyEvent);
-	
+
 	g_gevManager->AddCallback(GEV_AddUnitToArmy,
 		GEV_PRI_Post,
 		&s_CtpAi_AddUnitToArmyEvent);
@@ -1009,7 +998,7 @@
 											  1 );
 	}
 
-	sint32 index;	
+	sint32 index;
 	g_theDiplomacyDB->GetNamedItem("DIPLOMACY_DEFAULT", index);
 	const DiplomacyRecord *default_rec = g_theDiplomacyDB->Get(index);
 	for (sint32 i = PROPOSAL_NONE+1; i < PROPOSAL_MAX; i++)
@@ -1018,7 +1007,7 @@
 
 		for (index = 0; index < default_rec->GetNumProposalElement(); index++)
 		{
-			
+
 			if (strcmp(s_proposalNames[i].c_str(),default_rec->GetProposalElement(index)->GetProposal()->GetType()) == 0)
 			{
 				Diplomat::s_proposalTypeToElemIndex[i] = index;
@@ -1027,10 +1016,10 @@
 		}
 	}
 
-	sm_unloadOrderRec = 
+	sm_unloadOrderRec =
 		g_theOrderDB->Get(g_theOrderDB->FindRecordNameIndex("ORDER_UNLOAD"));
 
-	sm_spaceLaunchOrderRec = 
+	sm_spaceLaunchOrderRec =
 		g_theOrderDB->Get(g_theOrderDB->FindRecordNameIndex("ORDER_SPACE_LAUNCH"));
 
 	sm_disbandArmyOrderRec =
@@ -1050,7 +1039,7 @@
 
 #if defined (_DEBUG) || defined(USE_LOGGING)
 	CellUnitList unit_list;
-	
+
 	CtpAiDebug::SetDebugPlayer(8);
 	CtpAiDebug::SetDebugGoalType(-1); // GOAL_SIEGE = 1, all goals = -1
 	CtpAiDebug::SetDebugArmies(unit_list);
@@ -1081,7 +1070,7 @@
 		{
 			Unit city = player_ptr->m_all_cities->Access(cityIndex);
 			Assert(city.IsValid() && city->GetCityData());
-			
+
 			for (PLAYER_INDEX foreignerId = 0; foreignerId < CtpAi::s_maxPlayers; foreignerId++)
 			{
 				if (foreignerId != city.GetOwner())
@@ -1141,10 +1130,10 @@
 	{
 		Diplomat::GetDiplomat(player).InitForeigner(deadPlayerId);
 	}
-	
+
 	AgreementMatrix::s_agreements.ClearAgreementsInvolving(deadPlayerId);
 	Diplomat::GetDiplomat(deadPlayerId).Cleanup();
-	
+
 	if (deadPlayerId + 1 >= s_maxPlayers)
 	{
 		// Last player in array
@@ -1155,7 +1144,7 @@
 void CtpAi::AddPlayer(const PLAYER_INDEX newPlayerId)
 {
 	Assert(g_player[newPlayerId]);
-	
+
 	if(newPlayerId >= s_maxPlayers)
 	{
 		Resize();
@@ -1240,13 +1229,13 @@
 	DPRINTF(k_DBG_AI, ("// CHANGE GOVERNMENT -- Turn %d\n", round));
 	DPRINTF(k_DBG_AI, ("//					    Player %d\n", player));
 
-	if (player_ptr != NULL && 
+	if (player_ptr != NULL &&
 		player_ptr->IsRobot() &&
-		!g_network.IsClient()) 
+		!g_network.IsClient())
 	{
 		sint32 government_type = Governor::GetGovernor(player).ComputeBestGovernment();
 		if (government_type >= 0 && government_type != player_ptr->GetGovernmentType())
-			
+
 			player_ptr->SetGovernmentType(government_type);
 	}
 
@@ -1257,12 +1246,12 @@
 	DPRINTF(k_DBG_AI, ("// PROCESS STRATEGY -- Turn %d\n", round));
 	DPRINTF(k_DBG_AI, ("//					   Player %d\n", player));
 
-	const StrategyRecord & strategy = 
+	const StrategyRecord & strategy =
 		Diplomat::GetDiplomat(player).GetCurrentStrategy();
 
 	if (player_ptr &&
 		player_ptr->IsRobot() &&
-		!g_network.IsClient()) 
+		!g_network.IsClient())
 	{
 		sint32 pw_percent   = 0;
 		sint32 sci_percent  = 0;
@@ -1274,13 +1263,12 @@
 		player_ptr->SetTaxes(sci_percent/100.0);
 
 		DPRINTF(k_DBG_AI, ("//  elapsed time = %d ms\n", (GetTickCount() - t1)));
-		
+
 		t1 = GetTickCount();
 		DPRINTF(k_DBG_AI, (LOG_SECTION_START));
 		DPRINTF(k_DBG_AI, ("// SET RESEARCH -- Turn %d\n", round));
 		DPRINTF(k_DBG_AI, ("//                 Player %d\n", player));
-		
-		
+
 		SetResearch(player);
 		DPRINTF(k_DBG_AI, ("//  elapsed time = %d ms\n", (GetTickCount() - t1)));
 	}
@@ -1296,7 +1284,6 @@
 		DPRINTF(k_DBG_AI, ("// PLACE ENDGAME INSTALLATIONS -- Turn %d\n", round));
 		DPRINTF(k_DBG_AI, ("//							  Player %d\n", player));
 
-		
 		gaia_controller->BuildProcessingTowers();
 		DPRINTF(k_DBG_AI, ("//  elapsed time = %d ms\n", (GetTickCount() - t1)));
 	}
@@ -1309,18 +1296,18 @@
 	Governor::GetGovernor(player).PlaceTileImprovements();
 	DPRINTF(k_DBG_AI, ("//  elapsed time = %d ms\n", (GetTickCount() - t1)));
 
-	if (player_ptr->IsRobot() && !g_network.IsClient()) 
+	if (player_ptr->IsRobot() && !g_network.IsClient())
 	{
 		t1 = GetTickCount();
 		DPRINTF(k_DBG_AI, (LOG_SECTION_START));
 		DPRINTF(k_DBG_AI, ("// SET MILITARY READINESS -- Turn %d\n", round));
 		DPRINTF(k_DBG_AI, ("//						     Player %d\n", player));
 
-		READINESS_LEVEL level = 
+		READINESS_LEVEL level =
 			(READINESS_LEVEL) Governor::GetGovernor(player).ComputeBestMilitaryReadiness();
 
 		player_ptr->SetReadinessLevel(level, FALSE);
-		
+
 		DPRINTF(k_DBG_AI, ("//  elapsed time = %d ms\n", (GetTickCount() - t1)));
 
 		t1 = GetTickCount();
@@ -1329,21 +1316,19 @@
 		DPRINTF(k_DBG_AI, ("//						     Player %d\n", player));
 
 		Governor::SlidersSetting sliders_setting;
-		
-		
+
 		Governor::GetGovernor(player).OptimizeSliders(sliders_setting);
 		Governor::GetGovernor(player).SetSliders(sliders_setting, true);
 
 		DPRINTF(k_DBG_AI, ("//  elapsed time = %d ms\n", (GetTickCount() - t1)));
-	
+
 		t1 = GetTickCount();
 		DPRINTF(k_DBG_AI, (LOG_SECTION_START));
 		DPRINTF(k_DBG_AI, ("// COMPUTE GOODS TRADE ROUTES -- Turn %d\n", round));
 		DPRINTF(k_DBG_AI, ("//				 			     Player %d\n", player));
-	
-		
+
 		Governor::GetGovernor(player).ManageGoodsTradeRoutes();
-	
+
 		DPRINTF(k_DBG_AI, ("//  elapsed time = %d ms\n", (GetTickCount() - t1)));
 	}
 
@@ -1362,7 +1347,6 @@
 			Unit city = player_ptr->m_all_cities->Access(i);
 			Assert( city.IsValid() );
 
-			
 			CtpAi::SellRandomBuildings(city, 0.3);
 		}
 	}
@@ -1399,7 +1383,7 @@
 
 		MapPoint	pos(city.RetPos());
 		g_theWorld->GetArmy(pos, garrison);
-		
+
 		Army		move_army;
 		sint32		min_size	= k_MAX_ARMY_SIZE;
 
@@ -1410,8 +1394,8 @@
 			if (candidate.IsValid())
 			{
 				Army const &	candidateArmy	= candidate.GetArmy();
-				
-				if (candidateArmy.IsValid()				&& 
+
+				if (candidateArmy.IsValid()				&&
 					candidateArmy.CanTransport()		&&
 					(candidateArmy.Num() < min_size)
 				   )
@@ -1500,14 +1484,14 @@
 			if (candidate.IsValid())
 			{
 				Army const &	candidateArmy	= candidate.GetArmy();
-				
-				if (candidateArmy.IsValid()				&& 
+
+				if (candidateArmy.IsValid()				&&
 					(candidateArmy.Num() > 1)			&&
 					(candidateArmy.IsEntrenched() || candidateArmy.IsEntrenching())
 				   )
 				{
-					g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_UngroupOrder, 
-										   GEA_Army,		candidateArmy, 
+					g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_UngroupOrder,
+										   GEA_Army,		candidateArmy,
 										   GEA_End
 										  );
 				}
@@ -1518,20 +1502,20 @@
 
 void CtpAi::MakeRoomForNewUnits(const PLAYER_INDEX playerId)
 {
-	
+
 	Player * player_ptr = g_player[playerId];
 	Assert(player_ptr != NULL);
 	sint32 num_cities = player_ptr->m_all_cities->Num();
-	
+
 	CellUnitList garrison;
-	
+
 	sint32 j;
 	MapPoint dest;
 	for (sint32 i = 0; i < num_cities; i++)
 	{
 		Unit        city    = player_ptr->m_all_cities->Access(i);
 		Assert(city.IsValid() && city->GetCityData());
-		
+
 		MapPoint    pos     = city.RetPos();
 		g_theWorld->GetArmy(pos, garrison);
 		if ((garrison.Num() >= k_MAX_ARMY_SIZE) &&
@@ -1540,7 +1524,7 @@
 			city.CD()->GetBuildQueue()->GetHead() &&
 			city.CD()->GetBuildQueue()->GetHead()->m_category == k_GAME_OBJ_TYPE_UNIT)
 		{
-			
+
 			Army    move_army;
 			sint32  min_size = k_MAX_ARMY_SIZE;
 			for (j = 0; j < garrison.Num(); j++)
@@ -1569,7 +1553,6 @@
 						tmpPath->AddDir((WORLD_DIRECTION)j);
 						tmpPath->Start(pos);
 
-						
 						g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_MoveOrder,
 							GEA_Army, move_army,
 							GEA_Path, tmpPath,
@@ -1629,7 +1612,7 @@
 	{
 		CtpAi::MakeRoomForNewUnits(player);
 #if 0
-		// No idea if this should be done like this, 
+		// No idea if this should be done like this,
 		// transport can also move out sleeping units
 		// to execute the new action :
 		CtpAi::MoveOutofCityTransportUnits(player);
@@ -1664,14 +1647,14 @@
 
 		sint32 government_type = Governor::GetGovernor(player).ComputeBestGovernment();
 		if (government_type >= 0 && government_type != player_ptr->GetGovernmentType())
-			
+
 			player_ptr->SetGovernmentType(government_type);
-		
+
 		{
 			sint32 pw_percent;
 			sint32 sci_percent;
-			
-			const StrategyRecord & strategy = 
+
+			const StrategyRecord & strategy =
 				Diplomat::GetDiplomat(player).GetCurrentStrategy();
 
 			strategy.GetPublicWorksPercent(pw_percent);
@@ -1690,12 +1673,12 @@
 		DPRINTF(k_DBG_AI, (LOG_SECTION_START));
 		DPRINTF(k_DBG_AI, ("// SET MILITARY READINESS -- Turn %d\n", g_player[player]->m_current_round));
 		DPRINTF(k_DBG_AI, ("//						     Player %d\n", player));
-		
-		READINESS_LEVEL level = 
+
+		READINESS_LEVEL level =
 			(READINESS_LEVEL) Governor::GetGovernor(player).ComputeBestMilitaryReadiness();
-		
+
 		player_ptr->SetReadinessLevel(level, FALSE);
-		
+
 		DPRINTF(k_DBG_AI, (LOG_SECTION_START));
 		DPRINTF(k_DBG_AI, ("// ADJUST SLIDER SETTINGS -- Turn %d\n", g_player[player]->m_current_round));
 		DPRINTF(k_DBG_AI, ("//						     Player %d\n", player));
@@ -1704,7 +1687,7 @@
 
 		Governor::GetGovernor(player).OptimizeSliders(sliders_setting);
 		Governor::GetGovernor(player).SetSliders(sliders_setting, true);
-		
+
 		DPRINTF(k_DBG_AI, (LOG_SECTION_START));
 		DPRINTF(k_DBG_AI, ("// COMPUTE GOODS TRADE ROUTES -- Turn %d\n", g_player[player]->m_current_round));
 		DPRINTF(k_DBG_AI, ("//				 			     Player %d\n", player));
@@ -1728,7 +1711,7 @@
 
 #if 0 /// @todo Finish modification of Ai/strategy code before activating this
     Assert(g_theGoalDB);
-    size_t const goalTypeCount = 
+    size_t const goalTypeCount =
         g_theGoalDB ? static_cast<size_t>(g_theGoalDB->NumRecords()) : 0;
     Scheduler::ResizeAll(s_maxPlayers, goalTypeCount);
 #else
@@ -1740,27 +1723,27 @@
 
 	sint16 resolution = 10;
 	MapAnalysis::GetMapAnalysis().Resize( s_maxPlayers,
-										  (sint16) g_theWorld->GetWidth(), 
-										  (sint16) g_theWorld->GetHeight(), 
+										  (sint16) g_theWorld->GetWidth(),
+										  (sint16) g_theWorld->GetHeight(),
 										  resolution);
-	
+
 	Governor::ResizeAll(s_maxPlayers);
 }
 
 void CtpAi::AddExploreTargets(const PLAYER_INDEX playerId)
 {
 	Scheduler & scheduler = Scheduler::GetScheduler(playerId);
-	const StrategyRecord & strategy = 
-		Diplomat::GetDiplomat(playerId).GetCurrentStrategy();	
+	const StrategyRecord & strategy =
+		Diplomat::GetDiplomat(playerId).GetCurrentStrategy();
 
 	Player *player_ptr = g_player[playerId];
 	Assert(player_ptr);
 
 	//Added by Martin Gühmann explore resolution is now constant
 	sint16 explore_res = EXPLORE_RESOLUTION;
-	for (sint16 goal_element = 0; goal_element < strategy.GetNumGoalElement(); goal_element++) 
+	for (sint16 goal_element = 0; goal_element < strategy.GetNumGoalElement(); goal_element++)
 	{
-		const StrategyRecord::GoalElement * 
+		const StrategyRecord::GoalElement *
 		            goal_element_ptr    = strategy.GetGoalElement(goal_element);
 		GOAL_TYPE   goal_type           = static_cast<GOAL_TYPE>(goal_element_ptr->GetGoalIndex());
 
@@ -1769,15 +1752,15 @@
 		if ( !g_theGoalDB->Get(goal_type)->GetTargetTypeUnexplored() )
 			continue;
 
-		// Add goals every turn (and not just when there isn't 
+		// Add goals every turn (and not just when there isn't
 		// anymore (if one goal remain and isn't satisfied,
 		// it can freeze all the goals of this type) - Calvitix
 		if (scheduler.CountGoalsOfType(goal_type) > (goal_element_ptr->GetMaxEval()/3))
 			continue;
-	
+
 		if (g_player[playerId]->m_civilisation->GetCivilisation() == 0)
 			continue;
-			
+
 		MapPoint pos;
 		for ( pos.x = 0; pos.x <  g_theWorld->GetWidth(); pos.x += explore_res)
 		{
@@ -1786,7 +1769,7 @@
 				if (player_ptr->IsExplored(pos))
 					continue;
 
-				// Something better has to be found than just selecting some 
+				// Something better has to be found than just selecting some
 				// points on the map for exploration targets.
 				// After completion of one exploration goal a human player
 				// explores the a map point nearby the old exploration target,
@@ -1805,7 +1788,7 @@
 void CtpAi::AddSettleTargets(const PLAYER_INDEX playerId)
 {
 	Scheduler & scheduler = Scheduler::GetScheduler(playerId);
-	const StrategyRecord & strategy = 
+	const StrategyRecord & strategy =
 		Diplomat::GetDiplomat(playerId).GetCurrentStrategy();
 
 	Player *player_ptr = g_player[playerId];
@@ -1820,7 +1803,7 @@
 		return;
 	}
 
-	for (sint16 goal_element = 0; goal_element < strategy.GetNumGoalElement(); goal_element++) 
+	for (sint16 goal_element = 0; goal_element < strategy.GetNumGoalElement(); goal_element++)
 	{
 		const StrategyRecord::GoalElement *
 		            goal_element_ptr    = strategy.GetGoalElement(goal_element);
@@ -1835,16 +1818,16 @@
 		    (goal_element_ptr->GetMaxEval() - scheduler.CountGoalsOfType(goal_type));
 		sint32  desired_goals       = max_desired_goals;
 
-		for (SettleMap::SettleTargetList::iterator iter = targets.begin(); 
-		     iter != targets.end() && (desired_goals > 0); 
+		for (SettleMap::SettleTargetList::iterator iter = targets.begin();
+		     iter != targets.end() && (desired_goals > 0);
 		     ++iter
 		    )
 		{
 			SettleMap::SettleTarget settle_target = *iter;
 
-			if ( (!g_theWorld->IsWater(settle_target.m_pos)) && 
+			if ( (!g_theWorld->IsWater(settle_target.m_pos)) &&
 				 (g_theGoalDB->Get(goal_type)->GetTargetTypeSettleLand()) ||
-				 (g_theWorld->IsWater(settle_target.m_pos)) && 
+				 (g_theWorld->IsWater(settle_target.m_pos)) &&
 				 (g_theGoalDB->Get(goal_type)->GetTargetTypeSettleSea()))
 			{
 				Goal_ptr goal_ptr = new Goal();
@@ -1868,13 +1851,13 @@
 void CtpAi::AddMiscMapTargets(const PLAYER_INDEX playerId)
 {
 	Scheduler & scheduler = Scheduler::GetScheduler(playerId);
-	const StrategyRecord & strategy = 
-		Diplomat::GetDiplomat(playerId).GetCurrentStrategy();	
+	const StrategyRecord & strategy =
+		Diplomat::GetDiplomat(playerId).GetCurrentStrategy();
 
 	Player *player_ptr = g_player[playerId];
 	Assert(player_ptr);
 
-	for (sint16 goal_element = 0; goal_element < strategy.GetNumGoalElement(); goal_element++) 
+	for (sint16 goal_element = 0; goal_element < strategy.GetNumGoalElement(); goal_element++)
 	{
 		const StrategyRecord::GoalElement *
 		            goal_element_ptr    = strategy.GetGoalElement(goal_element);
@@ -1894,9 +1877,9 @@
 			continue;
 
 		MapPoint pos;
-		for ( pos.x = 0; pos.x < g_theWorld->GetWidth(); pos.x++) 
+		for ( pos.x = 0; pos.x < g_theWorld->GetWidth(); pos.x++)
 		{
-			for (pos.y = 0; pos.y < g_theWorld->GetHeight(); pos.y++) 
+			for (pos.y = 0; pos.y < g_theWorld->GetHeight(); pos.y++)
 			{
 				Cell * cell = g_theWorld->GetCell(pos);
 				if (cell->GetIsChokePoint() &&
@@ -1928,8 +1911,8 @@
 {
 	Player *player_ptr = g_player[playerId];
 	Assert(player_ptr != NULL);
-	
-	const StrategyRecord & strategy = 
+
+	const StrategyRecord & strategy =
 		Diplomat::GetDiplomat(playerId).GetCurrentStrategy();
 
 	sint32 offensive_garrison;
@@ -1973,7 +1956,6 @@
 		if (army->NumOrders() > 0)
 			continue;
 
-		
 		MapPoint pos = army->RetPos();
 		Unit city = g_theWorld->GetCity(pos);
 		if (city.m_id == 0)
@@ -2017,7 +1999,7 @@
 	sint32 max_squared_dist = (g_theWorld->GetWidth() * g_theWorld->GetHeight());
 	max_squared_dist *= max_squared_dist;
 	sint32 squared_distance = max_squared_dist;
-	
+
 	for(sint32 i = 0; i < num_armies; i++)
 	{
 		Army    tmp_army = player_ptr->m_all_armies->Access(i);
@@ -2027,7 +2009,7 @@
 
 		if(!tmp_army->CanMoveIntoThisTransport(*tmp_army.GetData()))
 			continue;
-			
+
 		sint32 tmp_squared_distance = MapPoint::GetSquaredDistance(tmp_army->RetPos(), army->RetPos());
 		if(tmp_squared_distance < squared_distance)
 		{
@@ -2067,7 +2049,7 @@
 	if (!found && CtpAi::GetNearestAircraftCarrier(army, tmp_pos, distance))
 	{
 		distance = sqrt(distance);
-		
+
 		if (refueling_distance < 0 || distance < refueling_distance)
 		{
 			refueling_distance = static_cast<sint32>(distance);
@@ -2126,13 +2108,13 @@
 		army->GetMovementType(),
 		start_pos,
 		refueling_pos,
-		true, 
+		true,
 		g_theWorld->GetContinent(refueling_pos),
 		trans_max_r,
 		new_path,
 		total_cost))
 	{
-		
+
 		bool NO_REFUEL_PATH = false;
 		Assert(NO_REFUEL_PATH);
 		return;
@@ -2147,7 +2129,7 @@
 		GEA_MapPoint, target_pos,
 		GEA_Int, FALSE,
 		GEA_End);
-	
+
 	g_graphicsOptions->AddTextToArmy(army, "Refuel", 255);
 }
 
@@ -2257,9 +2239,9 @@
 
 	if(!Diplomat::HasDiplomat(player)) return;
 
-	const StrategyRecord & strategy = 
+	const StrategyRecord & strategy =
 		Diplomat::GetDiplomat(player).GetCurrentStrategy();
-	const AdvanceListRecord * advance_list = 
+	const AdvanceListRecord * advance_list =
 		strategy.GetResearchPtr();
 	Assert(advance_list);
 	if (advance_list == NULL)
@@ -2278,7 +2260,7 @@
 				if (foreignerId == player)
 					continue;
 
-				const ai::Agreement	& agreement = 
+				const ai::Agreement	& agreement =
 					AgreementMatrix::s_agreements.GetAgreement(player, foreignerId, PROPOSAL_OFFER_STOP_RESEARCH);
 
 				if (agreement.start != -1 && agreement.end == -1)
@@ -2293,22 +2275,19 @@
 
 			if (stop_research)
 			{
-				sint32 duration = 
+				sint32 duration =
 					AgreementMatrix::s_agreements.GetAgreementDuration(player, foreignerId, PROPOSAL_OFFER_STOP_RESEARCH);
 
-				
 				if (Diplomat::GetDiplomat(player).GetPersonality()->GetTrustworthinessChaotic())
 					break;
 
-				
 				else if (Diplomat::GetDiplomat(player).GetPersonality()->GetTrustworthinessLawful() &&
 					duration > 50)
 					break;
 
-				
 				else if (duration > 20)
 					break;
-				
+
 				continue;
 			}
 
@@ -2337,12 +2316,10 @@
 	Player *player_ptr = g_player[player];
 	Assert(player_ptr != NULL);
 	sint32 num_cities = player_ptr->m_all_cities->Num();
-	
-	
-	const StrategyRecord & strategy = 
+
+	const StrategyRecord & strategy =
 		Diplomat::GetDiplomat(player).GetCurrentStrategy();
 
-	
 	sint32 threat_bonus = 0;
 	(void) strategy.GetRushBuyThreatBonus(threat_bonus);
 
@@ -2352,14 +2329,14 @@
 	sint32 lost_to_cleric;
 	sint32 lost_to_crime;
 	sint32 maintenance;
-	sint32 wages; 
-	sint32 science; 
-	sint32 old_savings; 
+	sint32 wages;
+	sint32 science;
+	sint32 old_savings;
 	sint32 current_savings;
 	sint32 income;
 	player_ptr->m_gold->
-		GetGoldLevels(&income, &lost_to_cleric, &lost_to_crime, &maintenance, 
-					  &wages, &science, &old_savings, &current_savings); 
+		GetGoldLevels(&income, &lost_to_cleric, &lost_to_crime, &maintenance,
+					  &wages, &science, &old_savings, &current_savings);
 
 	sint32 reserve = sint32((lost_to_cleric + lost_to_crime + maintenance + wages +
 		science) * reserve_percent);
@@ -2434,7 +2411,7 @@
 		rush_buy.first = city.CD()->HowMuchLonger();
 		if(rush_buy.first > 1)
 		{
-			rush_buy.first += 
+			rush_buy.first +=
 				(sint32) ceil(1.0 - MapAnalysis::GetMapAnalysis().GetThreatRank(city.CD()) * threat_bonus);
 			rush_buy.second = city.m_id;
 
@@ -2468,9 +2445,9 @@
 	uint64 buildings = city.GetCityData()->GetEffectiveBuildings();
 	for (sint32 which = 0; which < 64; which++)
 	{
-		if((buildings & ((uint64)1 << uint64(which)))) 
+		if((buildings & ((uint64)1 << uint64(which))))
 		{
-			if(g_rand->Next(100) <= (100 * chance) ) 
+			if(g_rand->Next(100) <= (100 * chance) )
 			{
 				g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_SellBuilding,
 					GEA_City, city,
@@ -2493,7 +2470,7 @@
 	PLAYER_INDEX playerId = army->GetOwner();
 
 	// Bombard all including barbs
-	for(sint32 foreigner = 0; foreigner < CtpAi::s_maxPlayers; foreigner++) 
+	for(sint32 foreigner = 0; foreigner < CtpAi::s_maxPlayers; foreigner++)
 	{
 		if
 		  (
@@ -2525,7 +2502,7 @@
 				//visibility check
 				if(!def_army->IsVisible(playerId))
 					continue;
-				
+
 				def_army->GetPos(def_pos);
 
 				if(!army->CanBombard(def_pos))
@@ -2571,7 +2548,7 @@
 					min_dist = dist;
 					if(min_dist <= max_rge)
 					{
-						g_gevManager->AddEvent( GEV_INSERT_Tail, 
+						g_gevManager->AddEvent( GEV_INSERT_Tail,
 												GEV_BombardOrder,
 												GEA_Army, army.m_id,
 												GEA_MapPoint, def_pos,
@@ -2618,7 +2595,7 @@
 										GEA_Army, army.m_id,
 										GEA_MapPoint, adj,
 										GEA_End);
-							
+
 				return;
 			}
 		}

Modified: trunk/ctp2_code/ai/ctpai.h
==============================================================================
--- trunk/ctp2_code/ai/ctpai.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/ctpai.h	Mon May 23 04:21:18 2016	(r1115)
@@ -52,29 +52,21 @@
 class CtpAi {
 public:
 
-	
 	static PLAYER_INDEX s_maxPlayers; /// The maximum numbers of players in the game, including Barbarians
 
-	
 	static void Cleanup();
 	static void CleanupEvents();
 
-	
 	static void InitializeEvents();
 
-	
 	static void Initialize(bool initDiplomat = true);
 
-	
 	static void Load(CivArchive & archive);
 
-	
 	static void Save(CivArchive & archive);
 
-	
 	static void RemovePlayer(const PLAYER_INDEX player);
 
-	
 	static void AddPlayer(const PLAYER_INDEX newPlayerId);
 
 	static void BeginMapAnalysis(const PLAYER_INDEX player);
@@ -87,37 +79,27 @@
 
 	static void UnGroupGarrisonUnits(const PLAYER_INDEX playerId);
 
-	
 	static void FinishBeginTurn(const PLAYER_INDEX player);
 
-	
 	static void NetworkClientBeginTurn(const PLAYER_INDEX player);
 
-
 	static void AddForeignerGoalsForCity(const Unit & city, const PLAYER_INDEX ownerId);
 
-	
 	static void AddOwnerGoalsForCity(const Unit & city, const PLAYER_INDEX foreignerId);
 
-	
 	static void GroupWithEscort(const Army & army);
 
-	
 	static void AddGoalsForArmy(const Army & army);
 
-	
 	static bool GetNearestRefuel(const Army & army, const MapPoint & start_pos, MapPoint & refueling_pos, sint32 & refueling_distance);
 
-	
 	static void ExecuteOpportunityActions(const PLAYER_INDEX player);
 
-	
 	static const OrderRecord * GetUnloadOrder();
 	static const OrderRecord * GetSpaceLaunchOrder();
 	static const OrderRecord * GetDisbandArmyOrder();
 	static const OrderRecord * GetMoveOrder();
 
-	
 	static const sint32 GetGoalDefendIndex();
 	static const sint32 GetGoalSeigeIndex();
 	static const sint32 GetEndgameWorldUnionIndex();
@@ -126,20 +108,16 @@
 
 	static void SetResearch(const PLAYER_INDEX player);
 
-	
 	static void ComputeCityGarrisons(const PLAYER_INDEX player);
 
 private:
 
 	static void Resize();
 
-	
 	static void AddExploreTargets(const PLAYER_INDEX player);
 
-	
 	static void AddSettleTargets(const PLAYER_INDEX player);
 
-	
 	static void AddMiscMapTargets(const PLAYER_INDEX player);
 
 #if 0
@@ -151,14 +129,11 @@
 
 	static bool GetNearestAircraftCarrier(const Army & army, MapPoint & carrier_pos, double & distance);
 
-	
 	static void RefuelAirplane(const Army & army);
 
 
-	
 	static void SpendGoldToRushBuy(const PLAYER_INDEX player);
 
-	
 	static const OrderRecord * sm_unloadOrderRec;
 	static const OrderRecord * sm_spaceLaunchOrderRec;
 	static const OrderRecord * sm_disbandArmyOrderRec;

Modified: trunk/ctp2_code/ai/ctpaidebug.cpp
==============================================================================
--- trunk/ctp2_code/ai/ctpaidebug.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/ctpaidebug.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -49,12 +49,11 @@
 		{
 			if (s_debugArmies[i] == army_id)
 				return true;
-			
-			
+
 			if (s_debugArmies[i] != -1)
 				found = true;
 		}
-		
+
 		if (found)
 			return false;
 	}

Modified: trunk/ctp2_code/ai/ctpaidebug.h
==============================================================================
--- trunk/ctp2_code/ai/ctpaidebug.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/ctpaidebug.h	Mon May 23 04:21:18 2016	(r1115)
@@ -57,19 +57,14 @@
 
 	static bool DebugLogCheck(const sint32 player, const sint32 goal_type, const sint32 army_id);
 
-
 	static bool IsDebugGoalTypeSet();
 
-
 	static bool IsDebugArmyIdSet();
 
-
 	static void SetDebugPlayer(const sint32 debug_player);
 
-
 	static void SetDebugGoalType(const sint32 goal_type);
 
-
 	static void SetDebugArmies(const CellUnitList & unit_list);
 
 private:

Modified: trunk/ctp2_code/ai/diplomacy/AgreementMatrix.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/AgreementMatrix.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/AgreementMatrix.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -72,62 +72,48 @@
 
 	AgreementMatrix();
 
-	
 	void Resize(const PLAYER_INDEX & newMaxPlayers);
 
-	
 	void Load(CivArchive & archive);
 
-	
 	void Save(CivArchive & archive) const;
 
-	
 	const ai::Agreement & GetAgreement( const PLAYER_INDEX sender_player,
 										const PLAYER_INDEX receiver_player,
 										const PROPOSAL_TYPE type ) const;
 
-	
 	sint16 GetAgreementDuration( const PLAYER_INDEX sender_player,
 								 const PLAYER_INDEX receiver_player,
 								 const PROPOSAL_TYPE type ) const;
-	
-	
+
 	void SetAgreement( const ai::Agreement & agreement );
 
-	
-	
-	
+
+
+
 	bool HasAgreement(const PLAYER_INDEX & sender_player,
 					  const PLAYER_INDEX & receiver_player,
 					  const PROPOSAL_TYPE type) const;
 
-	
-	
+
 	bool HasAgreement(const PLAYER_INDEX & sender_player,
 					  const PROPOSAL_TYPE type) const;
 
-	
 	void CancelAgreement(const PLAYER_INDEX & sender_player,
-						 const PLAYER_INDEX & receiver_player, 
+						 const PLAYER_INDEX & receiver_player,
 						 const PROPOSAL_TYPE type );
 
-	
 	void BreakAgreements(const PLAYER_INDEX & sender_player,  const PLAYER_INDEX & foreign_player);
 
-	
 	sint32 TurnsSinceLastWar(const PLAYER_INDEX & player,
 							 const PLAYER_INDEX & foreigner) const;
 
-	
 	sint32 TurnsAtWar(const PLAYER_INDEX & player,
 					  const PLAYER_INDEX & foreigner) const;
 
-	
 	void SetAgreementFast(size_t index, const ai::Agreement &agreement);
- 
-	
-	sint16 GetMaxPlayers() const { return m_maxPlayers; }
 
+	sint16 GetMaxPlayers() const { return m_maxPlayers; }
 
 	size_t AgreementIndex
     (
@@ -142,7 +128,7 @@
               );
 
 		return static_cast<size_t>
-            ((PROPOSAL_MAX * m_maxPlayers * receiver_player) + 
+            ((PROPOSAL_MAX * m_maxPlayers * receiver_player) +
              (PROPOSAL_MAX * sender_player) +
              proposalType
             );

Modified: trunk/ctp2_code/ai/diplomacy/CounterResponseEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/CounterResponseEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/CounterResponseEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,17 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __COUNTER_RESPONSE_EVENT_H__
 

Modified: trunk/ctp2_code/ai/diplomacy/DStateEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/DStateEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/DStateEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,25 +1,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __DIPLOMATIC_STATE_EVENT_H__
 #define __DIPLOMATIC_STATE_EVENT_H__
 
-class DiplomaticStateEventCallbacks 
+class DiplomaticStateEventCallbacks
 {
 public:
-	
+
 	static void AddCallbacks();
 };
 
 #endif __DIPLOMATIC_STATE_EVENT_H__
-

Modified: trunk/ctp2_code/ai/diplomacy/Diplomat.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/Diplomat.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/Diplomat.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -62,7 +62,7 @@
 #include "DiplomacyRecord.h"        // DiplomacyRecord
 #include "diplomattypes.h"          // ai, AiState, Motivation, Threat, etc.
 #include "Foreigner.h"              // Foreigner
-#include "PersonalityRecord.h"      // PersonalityRecord     
+#include "PersonalityRecord.h"      // PersonalityRecord
 #include "player.h"                 // PLAYER_INDEX, k_MAX_PLAYERS
 #include "SlicContext.h"            // SlicContext
 #include "StrategyRecord.h"         // StrategyRecord
@@ -72,13 +72,13 @@
 // Class declarations
 //----------------------------------------------------------------------------
 
-class Diplomat 
+class Diplomat
 {
 public:
-	struct PiracyHistory 
+	struct PiracyHistory
 	{
 		PiracyHistory()
-		:   
+		:
 		    m_sourceCity        (),
 		    m_destinationCity   (),
 		    m_piratingPlayer    (PLAYER_UNASSIGNED),
@@ -106,8 +106,8 @@
 		Unit m_sourceCity;
 		Unit m_destinationCity;
 		PLAYER_INDEX m_piratingPlayer;
-		sint32 m_accumEvents;	
-		sint32 m_lastTurn;		
+		sint32 m_accumEvents;
+		sint32 m_lastTurn;
 	};
 
 	typedef std::list<Motivation> MotivationList;
@@ -122,7 +122,6 @@
 	typedef std::list<std::pair<sint32, Unit> > NukeTargetList;
 	typedef std::vector<bool> BoolVector;
 
-	
 	static AiState s_badAiState;
 	static Threat s_badThreat;
 	static Response s_badResponse;
@@ -130,12 +129,11 @@
 	static Motivation s_badMotivation;
 	static ai::Agreement s_badAgreement;
 
-	
 	static sint32 s_proposalTypeToElemIndex[PROPOSAL_MAX];
 
-	
-	
-	
+
+
+
 
 
 	static Diplomat & GetDiplomat(const PLAYER_INDEX & playerId);
@@ -143,35 +141,30 @@
 
 	static void ResizeAll(const PLAYER_INDEX & newMaxPlayers);
 
-	
-	
-	
+
+
+
 	static void CleanupAll();
 
-	
 	static void InitializeAll();
 
-	
 	static void LoadAll(CivArchive & archive);
 
-	
 	static void SaveAll(CivArchive & archive);
 
 	static void DebugStatusAll();
 
-	
 	static void AddDiplomacyArgToSlicContext(SlicContext & sc, const DiplomacyArg & dip_arg);
 
 	static void ExecuteDelayedNegotiations(const sint32 receiverID);
-	
+
 	sint32 GetNextId();
 
-	
 	void SetNextId(const sint32 & id);
 
-	
-	
-	
+
+
+
 
 	Diplomat();
 	Diplomat(Diplomat const & a_Original);
@@ -181,538 +174,406 @@
 
 	void Resize(const PLAYER_INDEX & newMaxPlayers);
 
-	
 	void Load(CivArchive & archive);
 
-	
 	void Save(CivArchive & archive) const;
 
-	
 	void Cleanup();
 
-	
 	void Initialize();
 
-	
 	void InitForeigner(const PLAYER_INDEX & foreigner);
 
-	
 	void DebugStatus(const PLAYER_INDEX & foreignerId = -1) const;
 
-	
 	void LogDebugStatus(const PLAYER_INDEX & foreignerId = -1) const;
 
-	
 	void SetPlayerId(const PLAYER_INDEX &playerId);
 
-	
 	PLAYER_INDEX GetPlayerId() const;
 
-	
 	void SetPersonalityName(const char *personality_name);
 
-	
 	std::string GetPersonalityName() const;
 
-	
 	const PersonalityRecord *GetPersonality() const;
 
-	
 	bool GetReceiverHasInitiative(const PLAYER_INDEX & foreignerId) const;
 
-	
 	void SetReceiverHasInitiative(const PLAYER_INDEX & foreignerId, const bool & hasInitiative);
 
-	
 	void BeginTurn();
 
-	
-	
-	
 
-	
-	
+
+
+
+
+
 	void LogRegardEvent( const PLAYER_INDEX & foreignerId,
 						 const sint32 & regardDelta,
 						 const REGARD_EVENT_TYPE & type,
 						 const StringId & explain,
 						 const sint16 duration = -1);
 
-	
 	void LogViolationEvent(const PLAYER_INDEX foreignerId, const PROPOSAL_TYPE proposal_type);
 
-	
 	const ai::Regard GetPublicRegard( const PLAYER_INDEX & foreignerId,
 									  const REGARD_EVENT_TYPE & type = REGARD_EVENT_ALL ) const;
 
-	
-	
+
 	StringId ExplainRegard( const PLAYER_INDEX & foreignerId,
 						  const REGARD_EVENT_TYPE & type = REGARD_EVENT_ALL ) const;
 
-	
 	const ai::Regard GetEffectiveRegard( const PLAYER_INDEX & foreignerId) const;
 
-	
 	static void ApplyGlobalTrustChange(const PLAYER_INDEX & foreignerId, const ai::Regard &trust_delta, const MBCHAR *reason = NULL);
 
-	
 	void ApplyTrustChange(const PLAYER_INDEX & foreignerId, const ai::Regard &trust_delta,  const MBCHAR *reason = NULL);
 
-	
 	const ai::Regard GetTrust(const PLAYER_INDEX & foreignerId) const;
 
-	
 	void SetTrust(const PLAYER_INDEX & foreignerId, const ai::Regard &trust);
 
-	
 	ai::Regard GetBaseRegard(const PLAYER_INDEX foreignerId) const;
 
-	
 	void RecomputeRegard();
 
-	
 	void UpdateRegard(const PLAYER_INDEX foreignerId);
 
-	
-	
-	
-
-	
-	
-	
+
+
+
+
+
+
+
 	sint32 AddAgreement(const PLAYER_INDEX & foreignerId);
 
-	
 	void EnactStopPiracy(const PLAYER_INDEX victimId, const PLAYER_INDEX pirateId);
 
-	
-	
+
 	bool CanAfford( const PLAYER_INDEX senderId,
 					const PLAYER_INDEX receiverId,
 					const ProposalData & proposal ) const;
 
-	
 	bool Execute_Agreement(const ai::Agreement & agreement);
 
-	
 	void DeclareWar(const PLAYER_INDEX foreginerId);
 
-	
 	void SetEmbargo(const PLAYER_INDEX foreignerId, const bool state);
 
-	
 	bool GetEmbargo(const PLAYER_INDEX foreignerId) const;
 
 
-	
-	
-	
 
-	
+
+
+
+
 	void AddRejection(const PLAYER_INDEX & foreignerId);
 
-	
-	
-	
 
-	
+
+
+
+
 	const Threat & GetThreatById(const sint32 & id) const;
 
-	
 	void RemoveThreatById(const sint32 & id);
 
-	
-	
+
 	sint32 AddThreat(const PLAYER_INDEX & foreignerId);
 
-	
 	const ThreatList & GetThreatList() const;
 
-	
 	bool ExecuteThreat(const Threat & threat);
 
-	
-	
+
 	bool HasThreat(const PLAYER_INDEX & foreignerId,
 				   const THREAT_TYPE type,
 				   Threat & threat) const;
 
-	
 	bool ComputeThreatResponse(const PLAYER_INDEX foreignerId, Response & threat_response) const;
 
-	
 	bool GetAgreementToBreak(const PLAYER_INDEX foreignerId, ai::Agreement & pact) const;
 
-	
-	
-	
-			
-	
+
+
+
+
+
 	void ConsiderResponse( const PLAYER_INDEX & senderId,
 						   const Response & response );
 
-	
 	void ConsiderResponse( const PLAYER_INDEX senderId,
 						   const RESPONSE_TYPE response_type,
 						   const sint32 priority);
 
-	
 	void ConsiderCounterResponse( const PLAYER_INDEX senderId,
 								  const PROPOSAL_TYPE counterProposalType,
 								  const DiplomacyArg & argument,
 								  const sint32 priority,
 								  const DIPLOMATIC_TONE tone);
 
-	
 	const Response & GetMyLastResponse(const PLAYER_INDEX & foreignId) const;
 
-	
-	void SetMyLastResponse( const PLAYER_INDEX & foreignId, 
+	void SetMyLastResponse( const PLAYER_INDEX & foreignId,
 							const Response & response );
 
-	
 	void ExecuteResponse( const PLAYER_INDEX sender,
-						  const PLAYER_INDEX receiver );	
+						  const PLAYER_INDEX receiver );
+
+
 
-	
 
-	
 	const Response & GetResponsePending(const PLAYER_INDEX foreignerId) const;
 
-	
 	const Response & GetResponse(const PLAYER_INDEX foreignerId) const;
 
-	
 	void ExecuteResponse(const Response & response, bool runAI = true);
 
-	
-	
-	
-
-	
-	
-	
-	
-	
-	
-	
-	
-	void ConsiderMotivation(const Motivation & motivation); 
 
-	
+
+
+
+
+
+
+
+
+
+
+
+	void ConsiderMotivation(const Motivation & motivation);
+
 	sint32 GetMotivationCount() const;
 
-	
 	void SortMotivations();
 
-	
 	const Motivation & GetCurrentMotivation() const;
 
-	
-	
+
 	StringId GetDiplomacyAdvice(SlicContext & sc, const PLAYER_INDEX & foreignerId = -1) const;
 
-	
-	
-	
-
-	
-	
-	
-	
+
+
+
+
+
+
+
+
 	void ContinueDiplomacy( const PLAYER_INDEX & foreignerId );
 
-	
-	
+
 	bool StartNegotiations(const PLAYER_INDEX hotseat_foreignerId = -1);
 
-	
 	bool InvalidNewProposal(const PLAYER_INDEX & foreignerId, const DiplomacyProposalRecord *rec) const;
 
-	
 	void ChooseNewProposal( const PLAYER_INDEX & foreignerId );
 
-	
 	void ConsiderNewProposal( const PLAYER_INDEX & foreignerId,
 							  const NewProposal & newProposal );
 
-	
 	const NewProposal & GetMyLastNewProposal(const PLAYER_INDEX & foreignId) const;
 
-	
-	void SetMyLastNewProposal( const PLAYER_INDEX & foreignId, 
+	void SetMyLastNewProposal( const PLAYER_INDEX & foreignId,
 							   const NewProposal & newProposal );
 
-
 	void ExecuteNewProposal     (const NewProposal  & proposal);
 	void ExecuteNewProposal     (const PLAYER_INDEX & receiver);
 	void ExecuteEventNewProposal(const PLAYER_INDEX & receiver);
 
 	void SetMyLastNegotiatedProposal( const PLAYER_INDEX & foreignerId, const ProposalData & data, const RESPONSE_TYPE & response );
-	
-	
+
 	RESPONSE_TYPE GetMyLastNegotiatedProposal( const PLAYER_INDEX & foreignerId, ProposalData & data ) const;
 
-	
 	bool GetNewProposalTimeout( const NewProposal & newProposal,
 								const sint16 timeout_period = 20) const;
 
-	
 	const NegotiationEventList & GetNegotiationEvents( const PLAYER_INDEX & foreignerId ) const;
 
-	
-	sint32 GetNewProposalPriority(const PLAYER_INDEX foreignerId, 
+	sint32 GetNewProposalPriority(const PLAYER_INDEX foreignerId,
 								  const PROPOSAL_TYPE proposalType ) const;
 
-	
-	sint32 GetAcceptPriority(const PLAYER_INDEX foreignerId, 
+	sint32 GetAcceptPriority(const PLAYER_INDEX foreignerId,
 							 const PROPOSAL_TYPE proposalType ) const;
 
-	
-	sint32 GetRejectPriority(const PLAYER_INDEX foreignerId, 
+	sint32 GetRejectPriority(const PLAYER_INDEX foreignerId,
 							 const PROPOSAL_TYPE proposalType ) const;
 
-	
-	sint32 GetSenderRegardResult(const PLAYER_INDEX foreignerId, 
+	sint32 GetSenderRegardResult(const PLAYER_INDEX foreignerId,
 								 const PROPOSAL_TYPE proposalType ) const;
 
-	
-	sint32 GetReceiverRegardResult(const PLAYER_INDEX foreignerId, 
+	sint32 GetReceiverRegardResult(const PLAYER_INDEX foreignerId,
 					 			   const PROPOSAL_TYPE proposalType ) const;
 
-	
-	sint32 GetViolationRegardCost(const PLAYER_INDEX foreignerId, 
+	sint32 GetViolationRegardCost(const PLAYER_INDEX foreignerId,
 					 			  const PROPOSAL_TYPE proposalType ) const;
 
-	
-	sint32 GetViolationTrustCost(const PLAYER_INDEX foreignerId, 
+	sint32 GetViolationTrustCost(const PLAYER_INDEX foreignerId,
 					 			 const PROPOSAL_TYPE proposalType ) const;
 
-	
 
-	
+
+
 	const NewProposal & GetNewProposalPending(const PLAYER_INDEX foreignerId) const;
 
-	
 	const NewProposal & GetNewProposalAdvice(const PLAYER_INDEX foreignerId) const;
 
-
 	void InitStrategicState();
 
-	
 	void NextStrategicState();
 
-	
 	void ConsiderStrategicState( const AiState & state );
 
-	
 	void SetStrategy(const sint32 index);
 
-	
 	void ComputeCurrentStrategy();
 
-	
 	const StrategyRecord & GetCurrentStrategy() const;
 
-	
-	
-	
 
-	
+
+
+
+
 	void InitDiplomaticState( const PLAYER_INDEX & foreignerId );
 
-	
 	void NextDiplomaticState( const PLAYER_INDEX & foreignerId );
 
-	
 	void ConsiderDiplomaticState( const PLAYER_INDEX & foreignerId, const AiState & state );
-	
-	
+
 	const AiState & GetBestDiplomaticState() const;
 
-	
 	const AiState & GetCurrentDiplomaticState( const PLAYER_INDEX & foreignerId ) const;
 
-	
 	void ChangeDiplomacy(const PLAYER_INDEX & foreignerId, const sint32 index);
 
-	
 	void SetDiplomaticState(const PLAYER_INDEX & foreignerId, const AiState & newState );
 
-	
 	const DiplomacyRecord & GetCurrentDiplomacy(const PLAYER_INDEX & foreignerId) const;
 
-	
-	
-	
 
-	
+
+
+
+
 	sint32 GetNextAdvance() const;
 
-	
 	sint32 GetDesiredAdvanceFrom( const PLAYER_INDEX & foreignerId, const sint32 min_cost, const sint32 max_cost ) const;
 
-	
 	sint32 GetStopResearchingAdvance( const PLAYER_INDEX & foreignerId) const;
 
-	
 	sint32 GetNextKeyAdvance() const;
 
-	
 	StringId GetScienceAdvice(SlicContext & sc, StringId & advance_advice);
 
-	
-	
-	
 
-	
+
+
+
+
 	sint32 GetTradeFrom(const PLAYER_INDEX &foreignId) const;
 
-	
 	sint32 GetTributeFrom(const PLAYER_INDEX &foreignId) const;
 
-	
 	sint32 GetGoldSurplusPercent() const;
 
-	
 	bool CanBuySurplus(const PLAYER_INDEX &foreignId) const;
 
-	
 	sint32 GetAdvanceLevelPercent(const PLAYER_INDEX &foreignId) const;
 
-	
 	sint32 AtWarCount() const;
 
-	
 	sint32 EffectiveAtWarCount() const;
 
-	
 	bool TestPublicRegard(const PLAYER_INDEX & foreignerId, const ai::Regard & test_regard) const;
 
-	
 	bool TestEffectiveRegard(const PLAYER_INDEX & foreignerId, const ai::Regard & test_regard) const;
 
-	
 	bool TestAlliedRegard(const PLAYER_INDEX & foreignerId) const;
 
-	
 	bool GetBorderIncursionBy(const PLAYER_INDEX & foreignerId) const;
 
-	
 	void SetBorderIncursionBy(const PLAYER_INDEX & foreignerId);
 
-	
 	void SetBorderPulloutBy(const PLAYER_INDEX & foreignerId);
 
-	
 	sint32 GetLastBorderIncursionBy(const PLAYER_INDEX & foreignerId) const;
 
-	
 	sint8 GetFriendCount() const;
 
-	
 	sint8 GetEnemyCount() const;
 
-	
 	sint32 GetFriendPower() const;
 
-	
 	sint32 GetEnemyThreat() const;
 
-	
 	bool GetTradeRoutePiracyRisk(const Unit & source_city, const Unit & dest_city) const;
 
-	
 	bool GetTradeRoutePiracyRisk(const PLAYER_INDEX foreignerId) const;
 
-	
 	void AddNewNegotiationEvent(const PLAYER_INDEX foreignerId, const NegotiationEvent &negotiation_event);
 
-	
 	uint32 GetIncursionPermission() const;
 
-	
 	bool IncursionPermission(const PLAYER_INDEX foreignerId) const;
 
-	
 	void SetHotwarAttack(const PLAYER_INDEX foreignerId, const sint16 last_hot_war_attack);
 
-	
 	sint32 GetLastHotwarAttack(const PLAYER_INDEX foreignerId) const;
 
-	
 	void SetColdwarAttack(const PLAYER_INDEX foreignerId, const sint16 last_cold_war_attack);
 
-	
 	sint32 GetLastColdwarAttack(const PLAYER_INDEX foreignerId) const;
 
-	
-	
+
 	PLAYER_INDEX ComputeNuclearLaunchTarget();
 
-	
 	PLAYER_INDEX GetNuclearLaunchTarget() const;
 
-	
 	void TargetNuclearAttack(const PLAYER_INDEX foreignerId, const bool launch_now);
 
-	
 	bool DesireWarWith(const PLAYER_INDEX foreignerId) const;
 
-	
 	bool ComputeDesireWarWith(const PLAYER_INDEX foreignerId) const;
 
 	void ComputeIncursionPermission();
 	void ComputeAllDesireWarWith();
 
-	
 	bool IsBestHotwarEnemy(const PLAYER_INDEX foreignerId) const;
 	sint32 GetWeakestEnemy() const;
 
-	
 	bool CanFormAlliance(const PLAYER_INDEX foreignerId);
 
-	
 	bool CanExtortCityFrom(const PLAYER_INDEX foreginerId, const sint32 max_value, Unit & city) const;
 
-	
 	void ThrowParty(const PLAYER_INDEX foreignerId);
 
-	
 	bool ReadyToParty() const;
 
-	
 	bool ShouldEscortSettlers() const;
 
-	
 	bool FearNukesFrom(const PLAYER_INDEX foreignerId) const;
 
-	
 	bool FearNanoAttackFrom(const PLAYER_INDEX foreignerId) const;
 
-	
 	bool HasLaunchedNukes() const;
 
-	
 	bool HasLaunchedNanoAttack() const;
 
-	
 	void SetHasLaunchedNukes(const bool val);
 
-	
 	void HasLaunchedNanoAttack(const bool val);
 
-	
 	void SendGreeting(const PLAYER_INDEX & foreignerId);
-	
-	
+
 	void ClearInitiatives();
 
-	
 	bool FirstTurnOfWar() const;
 
-
 	void ClearEffectiveRegardCache();
 
 	void SetDefaultStrategy();
@@ -720,140 +581,113 @@
 	bool HasUnitsInOurTerritory(sint32 foreignerId) const;
 
 private:
-	
+
 	static sint32 s_nextId;
 	static Diplomat::DiplomatVector s_theDiplomats;
 
-	
 	void RemoveBestMotivation();
 
-	
 	void UpdateAttributes();
 
-	
 	void MergeStrategy(const sint32 index);
 
-	
 	void Execute_Proposal( const PLAYER_INDEX & sender,
 						   const PLAYER_INDEX & receiver,
 						   const PROPOSAL_TYPE & type,
 						   const DiplomacyArg & argument );
 
-	
 	void ComputeTradeRoutePiracyRisk();
 
-	
-	
+
 	bool LaunchNuclearAttackOnCity(const Unit & city);
 
-	
 	void ComputeNukeTargets(NukeTargetList & city_list, const PLAYER_INDEX targetId) const;
 
-	
 	void DisbandNuclearWeapons(const double percent);
 
-	
 	void DisbandBioWeapons(const double percent);
 
-	
 	void DisbandNanoWeapons(const double percent);
 
-	
 	void ExecutePersistantAgreements();
 
-	
-	
-	
 
-	
+
+
+
+
 	PLAYER_INDEX m_playerId;
 	std::string m_personalityName;
 	const PersonalityRecord *m_personality;
 
-	
-	
-	
 
-	
+
+
+
+
 	MotivationList m_motivations;
 
-	
 	MotivationVector m_lastMotivation;
 
-	
 	AiStateVector m_diplomaticStates;
 
-	
 	AiStateList m_bestStrategicStates;
 
-	
 	AiState m_bestDiplomaticState;
 
-	
 	StrategyRecord m_strategy;
-	
-	
+
 	DiplomacyRecordVector m_diplomacy;
 
-	
 	ForeignerVector m_foreigners;
 
-	
 	ThreatList m_threats;
 
-	
-	
-	
+
+
+
 
 	sint8 m_friendCount;
 	sint8 m_enemyCount;
 	sint32 m_friendPower;
 	sint32 m_enemyThreat;
 
-	
 	PiracyHistoryList m_piracyHistory;
 
-	
 	uint32 m_incursionPermission;
 
-	
 	sint8 m_outstandingProposals;
 
-	
 	sint16 m_diplomcyVictoryCompleteTurn;
 
-	
 	PLAYER_INDEX m_nuclearAttackTarget;
 
-	
 	sint16 m_lastParty;
 
 	bool m_launchedNukes;
 	bool m_launchedNanoAttack;
 	BoolVector m_desireWarWith;
 
-	
-	
-	
-	
-	
-	
-	
+
+
+
+
+
+
+
 	bool ComputeEffectiveRegard(const PLAYER_INDEX & foreignerId, const ai::Regard & test_regard) const;
 
 	struct cEffectiveRegardEntry
 	{
 	public:
 		cEffectiveRegardEntry() {m_round=-666;}
-		int m_round;	
-		uint32 m_bits;	
+		int m_round;
+		uint32 m_bits;
+
 
-		
-		
 		int RegardToIndex(int regard) {return (regard>>6);}
 	};
 
-	
 	mutable cEffectiveRegardEntry m_effectiveRegardCache[k_MAX_PLAYERS];
 };
 

Modified: trunk/ctp2_code/ai/diplomacy/Foreigner.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/Foreigner.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/Foreigner.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -34,7 +34,6 @@
 #ifndef __FOREIGNER_H__
 #define __FOREIGNER_H__
 
-
 #include <list>
 #include <deque>
 
@@ -54,17 +53,17 @@
 
 struct RegardEvent {
 	RegardEvent() : turn(-1), explainStrId(-1), duration(-1) {}
-	RegardEvent(const ai::Regard r, 
+	RegardEvent(const ai::Regard r,
 		const sint16 t,
 		const StringId e,
 		const sint16 d) : regard(r), turn(t), explainStrId(e), duration(d) {};
 	bool operator>(const RegardEvent & a) const {
 		return ((regard > a.regard) && (turn > a.turn));
 	}
-	ai::Regard regard;		
-	sint16 turn;		
+	ai::Regard regard;
+	sint16 turn;
 	StringId explainStrId;
-	sint16 duration;    
+	sint16 duration;
 };
 
 typedef std::list<RegardEvent> RegardEventList;
@@ -72,206 +71,170 @@
 typedef std::list<ai::Agreement> AgreementList;
 typedef AgreementList::iterator AgreementListIter;
 
-class Foreigner 
+class Foreigner
 {
 public:
 	Foreigner();
 
 	void Initialize();
 
-	
 	void Load(CivArchive & archive);
 
-	
 	void Save(CivArchive & archive) const;
 
-	
 	void BeginTurn();
 
-	
-	
-	
 
-	
+
+
+
+
 	ai::Regard GetEffectiveRegard() const;
 
-	
 	const ai::Regard & GetPublicRegard(const REGARD_EVENT_TYPE &type = REGARD_EVENT_ALL ) const;
 
-	
 	const ai::Regard & GetTrust() const;
 
-	
 	void SetTrust(const ai::Regard &trust);
 
-	
-	
-	
 
-	
-	void LogRegardEvent( const REGARD_EVENT_TYPE & type, 
+
+
+
+
+	void LogRegardEvent( const REGARD_EVENT_TYPE & type,
 		const RegardEvent & regardEvent );
-		
-	
-	
+
+
 	void RecomputeRegard(const DiplomacyRecord & diplomacy,
 						 const sint32 & decayRound,
 						 const ai::Regard baseRegard);
 
-	
 	const StringId & GetBestRegardExplain(const REGARD_EVENT_TYPE &type = REGARD_EVENT_ALL) const;
 
-	
-	
-	
 
-	
+
+
+
+
 	void ConsiderResponse( const Response & response );
 
-	
 	const Response & GetMyLastResponse() const;
 
-	
 	void SetMyLastResponse(const Response & response);
 
-	
-	
-	
 
-	
+
+
+
+
 	void AddTradeValue(const sint32 value);
 
-	
 	sint32 GetTradeFrom() const;
 
-	
 	sint32 GetTributeFrom() const;
 
-	
-	
-	
 
-	
+
+
+
+
 	void ConsiderNewProposal(const NewProposal & newProposal );
 
-	
 	const NewProposal & GetMyLastNewProposal() const;
 
-	
 	void SetMyLastNewProposal(const NewProposal & newProposal);
 
-	
 
-	
-	
-	
 
-	
+
+
+
+
+
 	void SetMyLastNegotiatedProposal( const ProposalData & data, const RESPONSE_TYPE & response )
-		{ 
+		{
 			m_lastNegotiatedProposal = data;
 			m_lastNegotiatedProposalResult = response;
 		}
-	
-	
-	RESPONSE_TYPE GetMyLastNegotiatedProposal( ProposalData & data ) const 
-		{ 
+
+	RESPONSE_TYPE GetMyLastNegotiatedProposal( ProposalData & data ) const
+		{
 			data = m_lastNegotiatedProposal;
 			return m_lastNegotiatedProposalResult;
 		}
 
-	
 	NegotiationEventList::const_iterator GetNegotiationEventIndex( const NewProposal & newProposal ) const;
 
-	
-	bool GetNewProposalTimeout(const NewProposal & newProposal, 
+	bool GetNewProposalTimeout(const NewProposal & newProposal,
 							   const sint16 timeout_period) const;
 
-	
 	void AddNewNegotiationEvent(const NegotiationEvent & dip);
 
-	
 	const NegotiationEventList & GetNegotiationEvents() const;
 
-	
-	
-	
 
-	
+
+
+
+
 	void SetLastIncursion(const sint32 last_incursion);
 
-	
 	sint32 GetLastIncursion() const;
 
-	
 	void SetHotwarAttack(const sint16 last_hot_war_attack);
 
-	
 	sint32 GetLastHotwarAttack() const;
 
-	
 	void SetColdwarAttack(const sint16 last_cold_war_attack);
 
-	
 	sint32 GetLastColdwarAttack() const;
 
-	
 	void SetGreetingTurn();
 
-	
 	sint32 GetTurnsSinceGreeting() const;
 
-	
 	bool GetEmbargo() const;
 
-	
 	void SetEmbargo(const bool state);
 
-	
 	void DebugStatus() const;
 
-	
 	void LogDebugStatus(const DiplomacyRecord & diplomacy) const;
 
 	void ExecuteDelayedNegotiations();
 
-public:    
+public:
     bool m_hasInitiative;
 
 private:
-	ai::Regard m_regard[REGARD_EVENT_ALL];  
-	ai::Regard m_regardTotal;			  
-	StringId m_bestRegardExplain;	  
-	ai::Regard m_effectiveRegardModifier; 
-	ai::Regard m_trustworthiness;		  
+	ai::Regard m_regard[REGARD_EVENT_ALL];
+	ai::Regard m_regardTotal;
+	StringId m_bestRegardExplain;
+	ai::Regard m_effectiveRegardModifier;
+	ai::Regard m_trustworthiness;
 
-	
 	RegardEventList m_regardEventList[REGARD_EVENT_ALL];
 
-	
 	NewProposal m_myLastNewProposal;
 
-	
 	Response m_myLastResponse;
 
-	
 	sint32 m_goldFromTrade;
 	sint32 m_goldFromTribute;
 
-	
 	sint32 m_lastIncursion;
 
-	
 	RESPONSE_TYPE m_lastNegotiatedProposalResult;
 	ProposalData m_lastNegotiatedProposal;
 
 	NegotiationEventList m_negotiationEvents;
 
-	sint16 m_hotwarAttackedMe;  
-	sint16 m_coldwarAttackedMe; 
+	sint16 m_hotwarAttackedMe;
+	sint16 m_coldwarAttackedMe;
 
-	sint16 m_greetingTurn;		
-	bool m_embargo;				
+	sint16 m_greetingTurn;
+	bool m_embargo;
 
 };
 

Modified: trunk/ctp2_code/ai/diplomacy/MotivationEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/MotivationEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/MotivationEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,26 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __MOTIVATION_EVENT_H__
 #define __MOTIVATION_EVENT_H__
 
-class MotivationEventCallbacks 
+class MotivationEventCallbacks
 {
 public:
-	
-	
+
 	static void AddCallbacks();
 };
 

Modified: trunk/ctp2_code/ai/diplomacy/NProposalEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/NProposalEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/NProposalEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,17 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __NEW_PROPOSAL_EVENT_H__
 #define __NEW_PROPOSAL_EVENT_H__

Modified: trunk/ctp2_code/ai/diplomacy/ProposalAnalysis.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/ProposalAnalysis.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/ProposalAnalysis.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,32 +1,18 @@
-
-
-
-
-
-
-
-
-
-
-
 #ifdef HAVE_PRAGMA_ONCE
 #pragma once
 #endif
 #ifndef __PROPOSAL_ANALYSIS_H__
 #define __PROPOSAL_ANALYSIS_H__
 
-
 #include "diplomattypes.h"
 
 class ProposalAnalysis {
 public:
 
-	
 	static void ComputeResult( const NewProposal & proposal,
 							   DiplomacyResult & senderResult,
 							   DiplomacyResult & receiverResult );
 
-	
 	static void ComputeResult( const Response & response,
 							   DiplomacyResult & senderResult,
 							   DiplomacyResult & receiverResult );
@@ -39,61 +25,51 @@
 
 	static void LogDebugResult( const Response & response );
 
-	
 	static sint32 RoundGold( const sint32 gold );
 
-	
 	static double RoundPercentReduction( const double percent);
 
-	
 	static bool IsSimpleGift(const NewProposal & proposal);
 
-	
 	static bool IsGift(const ProposalData & proposal_data);
 
-	
-	static bool GetTreatyFromProposal(const ProposalData & proposal_data, 
-		PROPOSAL_TYPE & treaty_type, 
+	static bool GetTreatyFromProposal(const ProposalData & proposal_data,
+		PROPOSAL_TYPE & treaty_type,
 		DiplomacyArg & treaty_arg,
 		bool & includes_gift,
 		PROPOSAL_TYPE & other_type,
 		DiplomacyArg & other_arg);
 
-	
 	static bool IsAcceptResponse(const Response & response);
 
-	
-	
-	
+
+
+
 	static void AcceptTreatyCondition(
 		const PLAYER_INDEX playerId,
 		const PLAYER_INDEX foreignerId,
-		const PROPOSAL_TYPE treaty_type, 
-		const DiplomacyArg treaty_arg, 
-		PROPOSAL_TYPE & desire_type, 
+		const PROPOSAL_TYPE treaty_type,
+		const DiplomacyArg treaty_arg,
+		PROPOSAL_TYPE & desire_type,
 		DiplomacyArg & desire_arg );
 
-	
-	
+
 	static bool PlayerGetsEnoughValue(const PLAYER_INDEX playerId,
 									  const PLAYER_INDEX senderId,
 									  const PLAYER_INDEX receiverId,
 									  const ProposalData detail);
 private:
 
-	
-	static void ComputeResult( const PLAYER_INDEX &sender, 
-							   const PLAYER_INDEX &receiver, 
-							   const PROPOSAL_TYPE &proposal_type, 
+	static void ComputeResult( const PLAYER_INDEX &sender,
+							   const PLAYER_INDEX &receiver,
+							   const PROPOSAL_TYPE &proposal_type,
 							   const DiplomacyArg &proposal_arg,
 							   DiplomacyResult & senderResult,
 							   DiplomacyResult & receiverResult );
 
-	
 	static void ComputeRegardResultFromProfit(DiplomacyResult & senderResult,
 											  DiplomacyResult & receiverResult);
 
-
 };
 
 #endif // __PROPOSAL_ANALYSIS_H__

Modified: trunk/ctp2_code/ai/diplomacy/ProposalResponseEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/ProposalResponseEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/ProposalResponseEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,17 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __PROPOSAL_RESPONSE_EVENT_H__
 #define __PROPOSAL_RESPONSE_EVENT_H__
@@ -19,7 +5,7 @@
 class ProposalResponseEventCallbacks
 {
 public:
-	
+
 	static void AddCallbacks();
 };
 

Modified: trunk/ctp2_code/ai/diplomacy/ReactEvent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/ReactEvent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/ReactEvent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -3,7 +3,7 @@
 // Project      : Call To Power 2
 // File type    : C++ source
 // Description  : Diplomacy reaction events
-// Id           : $Id:$
+// Id           : $Id$
 //
 //----------------------------------------------------------------------------
 //
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -42,7 +42,6 @@
 #include "player.h"
 #include "c3_utilitydialogbox.h"
 
-
 #include "SlicObject.h"
 #include "SlicEngine.h"
 
@@ -53,11 +52,9 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -69,11 +66,9 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -81,7 +76,7 @@
 
 	sender_diplomat.ContinueDiplomacy(receiver);
 
-	return GEV_HD_Continue;	
+	return GEV_HD_Continue;
 }
 
 STDEHANDLER(ToggleInitiative)
@@ -89,53 +84,50 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
-	bool receiver_has_initiative = 
+	bool receiver_has_initiative =
 		sender_diplomat.GetReceiverHasInitiative(receiver);
-	
+
 	if (receiver_has_initiative) {
-		
+
 		sender_diplomat.SetReceiverHasInitiative(receiver, false);
 	}
 	else {
-		
 
-		if (sender_diplomat.GetMyLastResponse(receiver).type == RESPONSE_THREATEN) 
+		if (sender_diplomat.GetMyLastResponse(receiver).type == RESPONSE_THREATEN)
 		{
-			
+
 			Diplomat::GetDiplomat(receiver).SetMyLastResponse(sender, Diplomat::s_badResponse);
 		}
 
 		sender_diplomat.SetReceiverHasInitiative(receiver, true);
 	}
 
-	return GEV_HD_Continue;	
+	return GEV_HD_Continue;
 }
 
-void ReactEventCallbacks::AddCallbacks() 
+void ReactEventCallbacks::AddCallbacks()
 {
-	
-	g_gevManager->AddCallback(GEV_ResponseReady, 
-							  GEV_PRI_Primary, 
+
+	g_gevManager->AddCallback(GEV_ResponseReady,
+							  GEV_PRI_Primary,
 							  &s_ReactEvent);
 
-	g_gevManager->AddCallback(GEV_NewProposalReady, 
-							  GEV_PRI_Primary, 
+	g_gevManager->AddCallback(GEV_NewProposalReady,
+							  GEV_PRI_Primary,
 							  &s_ReactEvent);
 
-	g_gevManager->AddCallback(GEV_ContinueDiplomacy, 
-							  GEV_PRI_Primary, 
+	g_gevManager->AddCallback(GEV_ContinueDiplomacy,
+							  GEV_PRI_Primary,
 							  &s_ContinueDiplomacy);
 
-	g_gevManager->AddCallback(GEV_ToggleInitiative, 
-							  GEV_PRI_Primary, 
+	g_gevManager->AddCallback(GEV_ToggleInitiative,
+							  GEV_PRI_Primary,
 							  &s_ToggleInitiative);
 }

Modified: trunk/ctp2_code/ai/diplomacy/RegardEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/RegardEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/RegardEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,16 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __REGARD_EVENT_H__
 #define __REGARD_EVENT_H__

Modified: trunk/ctp2_code/ai/diplomacy/RejectResponseEvent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/RejectResponseEvent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/RejectResponseEvent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,17 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #include "c3.h"
 
 #include "RejectResponseEvent.h"
@@ -27,7 +13,7 @@
 #include "aicause.h"
 
 #include "Diplomat.h"
-#include "mapanalysis.h" 
+#include "mapanalysis.h"
 #include "player.h"
 
 
@@ -42,11 +28,9 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -56,24 +40,20 @@
 	if (1) {
 		Response response;
 
-		
-		response.priority = 50;						
-		response.type = RESPONSE_REJECT;			
-		response.counter.tone = DIPLOMATIC_TONE_EQUAL;	   
-
-		
-		response.receiverId = receiver;			
-		response.senderId = sender;				
+		response.priority = 50;
+		response.type = RESPONSE_REJECT;
+		response.counter.tone = DIPLOMATIC_TONE_EQUAL;
+
+		response.receiverId = receiver;
+		response.senderId = sender;
 
-		
 		g_theStringDB->GetStringID("EXPLAIN_NO_THREAT",response.explainStrId);
 		g_theStringDB->GetStringID("ADVICE_NO_THREAT",response.adviceStrId);
 		g_theStringDB->GetStringID("NEWS_NO_THREAT",response.newsStrId);
 
-		
 		sender_diplomat.ConsiderResponse(receiver, response);
 	}
-	
+
 	return GEV_HD_Continue;
 }
 
@@ -85,58 +65,50 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_TREATY_PEACE)
 		return GEV_HD_Continue;
 
 	PLAYER_INDEX foreignerId;
 	PLAYER_INDEX allyId = -1;
-	for (foreignerId = 0; foreignerId < CtpAi::s_maxPlayers; foreignerId++) 
+	for (foreignerId = 0; foreignerId < CtpAi::s_maxPlayers; foreignerId++)
 	{
 		if (AgreementMatrix::s_agreements.HasAgreement(sender, foreignerId,
 				PROPOSAL_TREATY_ALLIANCE) )
 				allyId = foreignerId;
 	}
 
-	
-	
+
 	if (allyId != -1) {
 		Response response;
 
-		
-		response.priority = 100;					
-		response.type = RESPONSE_THREATEN;			
-		response.counter.tone = DIPLOMATIC_TONE_INDIGNANT;	   
-
-		
-		response.receiverId = receiver;			
-		response.senderId = sender;				
+		response.priority = 100;
+		response.type = RESPONSE_THREATEN;
+		response.counter.tone = DIPLOMATIC_TONE_INDIGNANT;
+
+		response.receiverId = receiver;
+		response.senderId = sender;
 
 		response.threat.type = THREAT_DECLARE_WAR;
 
-		
 		g_theStringDB->GetStringID("EXPLAIN_NO_THREAT",response.explainStrId);
 		g_theStringDB->GetStringID("ADVICE_NO_THREAT",response.adviceStrId);
 		g_theStringDB->GetStringID("NEWS_NO_THREAT",response.newsStrId);
 
-		
 		sender_diplomat.ConsiderResponse(receiver, response);
 	}
-	
+
 	return GEV_HD_Continue;
 }
 
@@ -153,71 +125,60 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & diplomat = Diplomat::GetDiplomat(sender);
 
 	const NewProposal & proposal = diplomat.GetMyLastNewProposal(receiver);
-	const Response & response = 
+	const Response & response =
 		Diplomat::GetDiplomat(receiver).GetMyLastResponse(sender);
 
-	
-	
+
 	if ( proposal.detail.first_type == PROPOSAL_REQUEST_GIVE_CITY &&
 		 response.type == RESPONSE_REJECT)
 	{
-		
-		
-		
+
+
 		if (
-			
+
 			(AgreementMatrix::s_agreements.HasAgreement(
 				sender,
 				receiver,
 				PROPOSAL_TREATY_DECLARE_WAR)) &&
-			
-			
+
 			(diplomat.GetTrust(receiver) < NEUTRAL_REGARD) &&
 
-			
-			
+
 			(MapAnalysis::GetMapAnalysis().TotalThreat(sender) /
 			MapAnalysis::GetMapAnalysis().TotalThreat(receiver) >= 1.30)) {
-			
+
 			Response threat_response;
-			
-			
-			threat_response.priority = 75;							
-			threat_response.type = RESPONSE_THREATEN;				
-			threat_response.counter.tone = DIPLOMATIC_TONE_ANGRY;	
-			
-			
-			threat_response.threat.type = THREAT_DESTROY_CITY;	
-			threat_response.receiverId = receiver;			
-			threat_response.senderId = sender;				
+
+			threat_response.priority = 75;
+			threat_response.type = RESPONSE_THREATEN;
+			threat_response.counter.tone = DIPLOMATIC_TONE_ANGRY;
+
+			threat_response.threat.type = THREAT_DESTROY_CITY;
+			threat_response.receiverId = receiver;
+			threat_response.senderId = sender;
 			if(g_player[receiver] && g_player[receiver]->m_all_cities->Num() > 0) {
-				threat_response.threat.arg.cityId = g_player[receiver]->m_all_cities->Access(0).m_id;  
+				threat_response.threat.arg.cityId = g_player[receiver]->m_all_cities->Access(0).m_id;
 			} else {
 				threat_response.threat.arg.cityId = 0;
 			}
-			
-			
+
 			g_theStringDB->GetStringID("EXPLAIN_THREATEN_ATTACK_CITY",threat_response.explainStrId);
 			g_theStringDB->GetStringID("ADVICE_THREATEN_ATTACK_CITY",threat_response.adviceStrId);
 			g_theStringDB->GetStringID("NEWS_THREATEN_ATTACK_CITY",threat_response.newsStrId);
-			
-			
+
 			diplomat.ConsiderResponse(receiver, threat_response);
 		}
 	}
 
-	
 	if ( proposal.detail.first_type == PROPOSAL_REQUEST_WITHDRAW_TROOPS &&
 		 response.type == RESPONSE_REJECT )
 	{
@@ -225,53 +186,44 @@
 			diplomat.GetPersonality()->GetTrustworthinessChaotic())
 		{
 			Response response;
-			
-			
-			response.priority = 75;					
-			response.type = RESPONSE_THREATEN;		
-			response.counter.tone = DIPLOMATIC_TONE_ANGRY;	
-			
-			
-			response.threat.type = THREAT_DESTROY_CITY;	
-			response.receiverId = receiver;				
-			response.senderId = sender;					
+
+			response.priority = 75;
+			response.type = RESPONSE_THREATEN;
+			response.counter.tone = DIPLOMATIC_TONE_ANGRY;
+
+			response.threat.type = THREAT_DESTROY_CITY;
+			response.receiverId = receiver;
+			response.senderId = sender;
 			if(g_player[receiver] && g_player[receiver]->m_all_cities->Num() > 0) {
-				response.threat.arg.cityId = g_player[receiver]->m_all_cities->Access(0).m_id;  
+				response.threat.arg.cityId = g_player[receiver]->m_all_cities->Access(0).m_id;
 			} else {
 				response.threat.arg.cityId = 0;
 			}
-			
-			
+
 			g_theStringDB->GetStringID("EXPLAIN_THREATEN_ATTACK_CITY2",response.explainStrId);
 			g_theStringDB->GetStringID("ADVICE_THREATEN_ATTACK_CITY2",response.adviceStrId);
 			g_theStringDB->GetStringID("NEWS_THREATEN_ATTACK_CITY2",response.newsStrId);
-			
-			
+
 			diplomat.ConsiderResponse(receiver, response);
 		}
 	}
 
-	
 	return GEV_HD_Continue;
 }
 
-
 void RejectResponseEventCallbacks::AddCallbacks()
 {
-	
-	g_gevManager->AddCallback(GEV_Reject, 
-							  GEV_PRI_Pre, 
+
+	g_gevManager->AddCallback(GEV_Reject,
+							  GEV_PRI_Pre,
 							  &s_NoThreat_RejectResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Reject, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Reject,
+							  GEV_PRI_Pre,
 							  &s_ThreatenAlliedInvasion_RejectResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Reject, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Reject,
+							  GEV_PRI_Pre,
 							  &s_ThreatenAttackCity_RejectResponseEvent);
 
 }
-

Modified: trunk/ctp2_code/ai/diplomacy/RejectResponseEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/RejectResponseEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/RejectResponseEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,23 +1,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __REJECT_RESPONSE_EVENT_H__
 #define __REJECT_RESPONSE_EVENT_H__
 
-
-class RejectResponseEventCallbacks 
+class RejectResponseEventCallbacks
 {
 public:
 	static void AddCallbacks();

Modified: trunk/ctp2_code/ai/diplomacy/ResponseEvent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/ResponseEvent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/ResponseEvent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -3,7 +3,7 @@
 // Project      : Call To Power 2
 // File type    : C++ source
 // Description  : Diplomacy response events
-// Id           : $Id:$
+// Id           : $Id$
 //
 //----------------------------------------------------------------------------
 //
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -25,8 +25,8 @@
 // Modifications from the original Activision code:
 //
 // - Added HotSeat and PBEM human-human diplomacy support. (17-Oct-2007 Martin Gühmann)
-// - Seperated the NewProposal event from the Response event so that the 
-//   NewProposal event can be called from slic witout any problems. (17-Oct-2007 Martin Gühmann) 
+// - Seperated the NewProposal event from the Response event so that the
+//   NewProposal event can be called from slic witout any problems. (17-Oct-2007 Martin Gühmann)
 //
 //----------------------------------------------------------------------------
 
@@ -45,10 +45,10 @@
 #include "player.h"
 
 #include "Diplomat.h"
-#include "mapanalysis.h" 
+#include "mapanalysis.h"
 
 #include "SelItem.h"
-extern SelectedItem *g_selected_item; 
+extern SelectedItem *g_selected_item;
 
 #include "network.h"
 #include "TurnCnt.h"
@@ -58,11 +58,9 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -91,20 +89,20 @@
 	bool show_response;
 	if (sender_diplomat.GetReceiverHasInitiative(receiver))
 	{
-		show_response = 
+		show_response =
 		        receiver == g_selected_item->GetVisiblePlayer()
 		    &&!(sender_response_pending == Diplomat::s_badResponse);
 	}
 	else
 	{
-		show_response = 
+		show_response =
 		        sender == g_selected_item->GetVisiblePlayer()
 			&&!(receiver_response_pending == Diplomat::s_badResponse);
 	}
 
 	if (show_response)
 	{
-		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ResponseReady, 
+		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ResponseReady,
 							   GEA_Player, sender,
 							   GEA_Player, receiver,
 							   GEA_End);
@@ -160,22 +158,18 @@
 							  GEV_PRI_Primary,
 							  &s_NewProposalEvent);
 
-
 	g_gevManager->AddCallback(GEV_ProposalResponse,
 							  GEV_PRI_Primary,
 							  &s_ResponseEvent);
 
-
 	g_gevManager->AddCallback(GEV_Reject,
 							  GEV_PRI_Primary,
 							  &s_ResponseEvent);
 
-
 	g_gevManager->AddCallback(GEV_Counter,
 							  GEV_PRI_Primary,
 							  &s_ResponseEvent);
 
-
 	g_gevManager->AddCallback(GEV_Threaten,
 							  GEV_PRI_Primary,
 							  &s_ResponseEvent);

Modified: trunk/ctp2_code/ai/diplomacy/ResponseEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/ResponseEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/ResponseEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,28 +1,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __RESPONSE_EVENT_H__
 #define __RESPONSE_EVENT_H__
 
-class ResponseEventCallbacks 
+class ResponseEventCallbacks
 {
  public:
-	
+
 	static void AddCallbacks();
 };
 
-
 #endif __RESPONSE_EVENT_H__

Modified: trunk/ctp2_code/ai/diplomacy/SStateEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/SStateEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/SStateEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,17 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __STRATEGIC_STATE_EVENT_H__
 #define __STRATEGIC_STATE_EVENT_H__
@@ -19,10 +5,8 @@
 class StrategicStateEventCallbacks
 {
 public:
-	
+
 	static void AddCallbacks();
 };
 
 #endif __STRATEGIC_STATE_EVENT_H__
-
-

Modified: trunk/ctp2_code/ai/diplomacy/ThreatResponseEvent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/ThreatResponseEvent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/ThreatResponseEvent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,22 +1,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __THREAT_RESPONSE_EVENT_H__
 #define __THREAT_RESPONSE_EVENT_H__
 
-
 class ThreatResponseEventCallbacks
 {
 public:

Modified: trunk/ctp2_code/ai/diplomacy/agreementmatrix.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/agreementmatrix.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/agreementmatrix.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -47,11 +47,9 @@
 #include "Diplomat.h"
 #include "radarmap.h"
 
-
 ai::Agreement       AgreementMatrix::s_badAgreement;
 AgreementMatrix     AgreementMatrix::s_agreements;
 
-
 AgreementMatrix::AgreementMatrix()
 :
 	m_agreements    (),
@@ -59,14 +57,13 @@
 {
 }
 
-
 void AgreementMatrix::Resize(const PLAYER_INDEX & newMaxPlayers)
 {
 	// Just make sure that we can rely on testing against m_maxPlayers to have
 	// a valid index in g_player.
 	Assert(newMaxPlayers <= k_MAX_PLAYERS);
 	m_maxPlayers = std::min<sint16>(static_cast<sint16>(newMaxPlayers), k_MAX_PLAYERS);
-	
+
 	AgreementVector	old_agreements;
 	m_agreements.swap(old_agreements);
 
@@ -84,7 +81,7 @@
 				g_player[senderId] && !g_player[senderId]->IsDead() &&
 				g_player[receiverId] && !g_player[receiverId]->IsDead())
 			{
-				
+
 				SetAgreement( old_agreements[index] );
 			}
 		}
@@ -107,7 +104,6 @@
 	}
 }
 
-
 void AgreementMatrix::Save(CivArchive & archive) const
 {
 	archive << m_maxPlayers;
@@ -121,7 +117,6 @@
 	}
 }
 
-
 const ai::Agreement & AgreementMatrix::GetAgreement( const PLAYER_INDEX sender_player,
 													 const PLAYER_INDEX receiver_player,
 													 const PROPOSAL_TYPE type ) const
@@ -136,7 +131,7 @@
 		if ((agreement.receiverId != receiver_player && agreement.receiverId != sender_player) ||
 		    (agreement.senderId != sender_player && agreement.senderId != receiver_player))
 		{
-			
+
 			return AgreementMatrix::s_badAgreement;
 		}
 	}
@@ -145,30 +140,26 @@
 	return m_agreements[ index ];
 }
 
-
 sint16 AgreementMatrix::GetAgreementDuration( const PLAYER_INDEX sender_player,
 											  const PLAYER_INDEX receiver_player,
 											  const PROPOSAL_TYPE type ) const
 {
 	const ai::Agreement & agreement = GetAgreement(sender_player, receiver_player, type);
 
-	
 	if (agreement.start == -1 || agreement.end != -1)
 		return -1;
 
-	
 	return (NewTurnCount::GetCurrentRound() - agreement.start);
 }
 
-
 void AgreementMatrix::SetAgreement( const ai::Agreement & agreement )
 {
 	if (agreement == AgreementMatrix::s_badAgreement)
 		return;
 
-	size_t const firstAgreementIndex = 
-        AgreementIndex(agreement.senderId, 
-                       agreement.receiverId, 
+	size_t const firstAgreementIndex =
+        AgreementIndex(agreement.senderId,
+                       agreement.receiverId,
                        agreement.proposal.first_type
                       );
 
@@ -184,12 +175,12 @@
 
 	PROPOSAL_TYPE   reciprocalType    = agreement.proposal.first_type;
 	sint32          reciprocalDBIndex;
-	
+
 	if (diplomacyutil_GetRecord(agreement.proposal.first_type)->GetReciprocalIndex(reciprocalDBIndex)) {
 		reciprocalType = diplomacyutil_GetProposalType(reciprocalDBIndex);
-	}	
+	}
 
-	size_t const    firstReciprocalIndex = 
+	size_t const    firstReciprocalIndex =
         AgreementIndex(agreement.receiverId,
                        agreement.senderId,
                        reciprocalType
@@ -205,15 +196,14 @@
 	}
 #endif
 
-	
 	if (agreement.proposal.second_type != PROPOSAL_NONE)
 	{
-		size_t const secondAgreementIndex = 
-            AgreementIndex(agreement.senderId, 
+		size_t const secondAgreementIndex =
+            AgreementIndex(agreement.senderId,
                            agreement.receiverId,
                            agreement.proposal.second_type
                            );
-		
+
 		Assert(secondAgreementIndex < m_agreements.size());
 		m_agreements[secondAgreementIndex] = agreement;
 
@@ -224,24 +214,23 @@
 		}
 #endif
 
-
 		if(diplomacyutil_GetRecord(agreement.proposal.second_type)->GetReciprocalIndex(reciprocalDBIndex)) {
 			reciprocalType = diplomacyutil_GetProposalType(reciprocalDBIndex);
-		}	
+		}
 		else
 		{
 			reciprocalType = agreement.proposal.second_type;
 		}
-		
-		size_t const secondReciprocalIndex = 
+
+		size_t const secondReciprocalIndex =
             AgreementIndex(agreement.receiverId,
                            agreement.senderId,
                            reciprocalType
-                          );												   
-		
+                          );
+
 		Assert(secondReciprocalIndex < m_agreements.size());
 		m_agreements[secondReciprocalIndex] = agreement;
-		
+
 #ifdef _DEBUG
 		if (agreement != GetAgreement(agreement.receiverId, agreement.senderId, reciprocalType))
 		{
@@ -249,7 +238,7 @@
 		}
 #endif
 
-	} 
+	}
 	if(g_radarMap->IsDisplayRelations())
 		g_radarMap->Update();
 }
@@ -301,22 +290,18 @@
 		return false;
 
 	sint32 round = NewTurnCount::GetCurrentRound();
-	
-	
+
 	const ai::Agreement & agreement = GetAgreement(sender_player, receiver_player, type);
 
-	
 	if (agreement.start == -1)
 		return false;
 
-	
 	if (agreement.end > round || agreement.end == -1)
 		return true;
-	
+
 	return false;
 }
 
-
 bool AgreementMatrix::HasAgreement(const PLAYER_INDEX & sender_player,
 								   const PROPOSAL_TYPE type) const
 {
@@ -328,31 +313,25 @@
 	return false;
 }
 
-
 void AgreementMatrix::CancelAgreement(const PLAYER_INDEX & sender_player,
-									  const PLAYER_INDEX & receiver_player, 
+									  const PLAYER_INDEX & receiver_player,
 									  const PROPOSAL_TYPE type )
 {
-	ai::Agreement agreement = 
+	ai::Agreement agreement =
 		GetAgreement(sender_player, receiver_player, type);
-	
-	
+
 	agreement.end = NewTurnCount::GetCurrentRound();
 
-	
 	SetAgreement(agreement);
 
-	agreement = 
+	agreement =
 		GetAgreement(receiver_player, sender_player, type);
 
-	
 	agreement.end = NewTurnCount::GetCurrentRound();
 
-	
 	SetAgreement(agreement);
 }
 
-
 void AgreementMatrix::BreakAgreements(const PLAYER_INDEX & sender_player, const PLAYER_INDEX & foreign_player)
 {
 	Diplomat & foreign_diplomat = Diplomat::GetDiplomat(foreign_player);
@@ -388,66 +367,56 @@
 	}
 }
 
-
 sint32 AgreementMatrix::TurnsSinceLastWar(const PLAYER_INDEX & player,
 										  const PLAYER_INDEX & foreigner) const
 {
 
-	
 	if (HasAgreement(player, foreigner, PROPOSAL_TREATY_DECLARE_WAR))
 		return 0;
 
 	const ai::Agreement & last_war =
 		GetAgreement(player, foreigner, PROPOSAL_TREATY_DECLARE_WAR);
 
-	
 	if (last_war.start == -1)
 		return -1;
 
 	return (NewTurnCount::GetCurrentRound() - last_war.end);
 }
 
-
 sint32 AgreementMatrix::TurnsAtWar(const PLAYER_INDEX & player,
 											const PLAYER_INDEX & foreigner) const
 {
-	
+
 	if (HasAgreement(player, foreigner, PROPOSAL_TREATY_PEACE))
 		return -1;
 
-	
 	if (HasAgreement(player, foreigner, PROPOSAL_TREATY_CEASEFIRE))
 		return -1;
 
 	const ai::Agreement & last_war =
 		GetAgreement(player, foreigner, PROPOSAL_TREATY_DECLARE_WAR);
 
-	
 	if (!HasAgreement(player, foreigner, PROPOSAL_TREATY_DECLARE_WAR))
 		return -1;
 
-	
-	if (last_war.start == -1) 
+	if (last_war.start == -1)
 		return -1;
 
-	
-	
+
 	Assert(last_war.end == -1);
-	
-	
+
 	return (NewTurnCount::GetCurrentRound() - last_war.start);
 }
 
 void AgreementMatrix::SetAgreementFast(size_t index, const ai::Agreement &agreement)
 {
 	Assert(index < m_agreements.size());
-	if (index < m_agreements.size()) 
+	if (index < m_agreements.size())
     {
 		m_agreements[index] = agreement;
 	}
 }
 
-
 void AgreementMatrix::ClearAgreementsInvolving(const PLAYER_INDEX playerId)
 {
 	for (size_t i = 0; i < m_agreements.size(); i++)

Modified: trunk/ctp2_code/ai/diplomacy/counterresponseevent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/counterresponseevent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/counterresponseevent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -10,13 +10,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 // _DEBUG
 // - Generates debug information when set.
 //
@@ -34,7 +34,6 @@
 #include <algorithm>    // std::max
 #include "player.h"
 
-
 #include "Events.h"
 #include "GameEventUser.h"
 #include "Unit.h"
@@ -49,17 +48,14 @@
 #include "Strengths.h"
 
 
-
 STDEHANDLER(ThreatenAttackCity_CounterResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -69,89 +65,75 @@
 //	const NewProposal & proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 	const Response & response = receiver_diplomat.GetMyLastResponse(sender);
 
-	
 	if ( AgreementMatrix::s_agreements.HasAgreement(sender,
 													receiver,
 													PROPOSAL_TREATY_DECLARE_WAR) )
 		return GEV_HD_Continue;
 
-	
 	if ( AgreementMatrix::s_agreements.HasAgreement(sender,
 													receiver,
 													PROPOSAL_TREATY_PEACE) )
 		return GEV_HD_Continue;
 
-	
 	if ( !sender_diplomat.GetPersonality()->GetConquestAgressive() &&
 		 !sender_diplomat.GetPersonality()->GetDiscoveryMilitary())
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.TestEffectiveRegard(receiver, HOTWAR_REGARD))
-		return GEV_HD_Continue; 
+		return GEV_HD_Continue;
 
 	Response threat_response;
 
 	threat_response.priority = static_cast<sint16>
 		(sender_diplomat.GetRejectPriority(receiver, response.counter.second_type));
 
-	
-	threat_response.type = RESPONSE_THREATEN;				
-	threat_response.counter.tone = DIPLOMATIC_TONE_ANGRY;	
-	
-	
-	threat_response.threat.type = THREAT_DESTROY_CITY;	
-	threat_response.receiverId = receiver;			
-	threat_response.senderId = sender;				
+	threat_response.type = RESPONSE_THREATEN;
+	threat_response.counter.tone = DIPLOMATIC_TONE_ANGRY;
+
+	threat_response.threat.type = THREAT_DESTROY_CITY;
+	threat_response.receiverId = receiver;
+	threat_response.senderId = sender;
 
-	
 	Unit most_threatened_city;
 	sint32 percent_threatened =
 		MapAnalysis::GetMapAnalysis().MostAtRiskCity(receiver, most_threatened_city, sender);
 
-	
 	if (percent_threatened > 65)
-		threat_response.threat.arg.cityId = most_threatened_city.m_id; 
-	else 
+		threat_response.threat.arg.cityId = most_threatened_city.m_id;
+	else
 		return GEV_HD_Continue;
 
-	
 	sender_diplomat.ConsiderResponse(receiver, threat_response);
 
 	return GEV_HD_Continue;
 }
 
 
-
 STDEHANDLER(PayForCeasefire_CounterResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & proposal = 
+	const NewProposal & proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
-	const Response & response = 
+	const Response & response =
 		receiver_diplomat.GetMyLastResponse(sender);
 
-	
 	if ( proposal.detail.first_type != PROPOSAL_TREATY_CEASEFIRE ||
 		 response.type != RESPONSE_COUNTER ||
 		 response.counter.first_type != PROPOSAL_TREATY_CEASEFIRE)
 		return GEV_HD_Continue;
 
-	
-	sint32 at_risk_value_percent = 
+	sint32 at_risk_value_percent =
 		MapAnalysis::GetMapAnalysis().AtRiskCitiesValue(sender, receiver);
 
 	sint32 at_risk_value = (sint32) ((double)at_risk_value_percent / 100.0) *
@@ -161,11 +143,10 @@
 	DiplomacyResult receiver_result;
 	ProposalAnalysis::ComputeResult(response, sender_result, receiver_result);
 
-	sint32 accept_priority = 
+	sint32 accept_priority =
 		sender_diplomat.GetAcceptPriority(receiver, response.counter.second_type);
 
-	
-	
+
 	if ( response.counter.second_type == PROPOSAL_OFFER_GIVE_GOLD &&
 		 receiver_result.gold < at_risk_value * 1.6 &&
 		 receiver_result.gold < g_player[sender]->GetGold())
@@ -174,17 +155,15 @@
 		return GEV_HD_Continue;
 	}
 
-	
-	
-	if ( response.counter.second_type == PROPOSAL_OFFER_GIVE_ADVANCE && 
+
+	if ( response.counter.second_type == PROPOSAL_OFFER_GIVE_ADVANCE &&
 		 receiver_result.science < at_risk_value * 1.2 )
 	{
 		sender_diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);
 		return GEV_HD_Continue;
 	}
 
-	
-	
+
 	if ( response.counter.second_type == PROPOSAL_OFFER_MAP ||
 		 response.counter.second_type == PROPOSAL_OFFER_WITHDRAW_TROOPS ||
 		 response.counter.second_type == PROPOSAL_OFFER_STOP_PIRACY ||
@@ -198,52 +177,47 @@
 }
 
 
-
 STDEHANDLER(PayForGiveCity_CounterResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & proposal = 
+	const NewProposal & proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
-	const Response & response = 
+	const Response & response =
 		receiver_diplomat.GetMyLastResponse(sender);
 
-	
 	if ( proposal.detail.first_type != PROPOSAL_REQUEST_GIVE_CITY ||
 		 response.type != RESPONSE_COUNTER ||
 		 response.counter.first_type != PROPOSAL_REQUEST_GIVE_CITY )
 		return GEV_HD_Continue;
 
-	
-	
 
-	sint32 at_risk_value_percent = 
+
+
+	sint32 at_risk_value_percent =
 		MapAnalysis::GetMapAnalysis().AtRiskCitiesValue(receiver,sender);
 
 //	sint32 at_risk_value = (sint32) ((double)at_risk_value_percent / 100.0) *
 //		MapAnalysis::GetMapAnalysis().TotalValue(receiver);
 
-	sint32 accept_priority = 
+	sint32 accept_priority =
 		sender_diplomat.GetAcceptPriority(receiver, response.counter.second_type);
 
 	DiplomacyResult sender_result;
 	DiplomacyResult receiver_result;
 	ProposalAnalysis::ComputeResult(response, sender_result, receiver_result);
 	Response threat_response;
-	
-	
+
 	switch (response.counter.second_type)
 	{
 		case PROPOSAL_OFFER_WITHDRAW_TROOPS:
@@ -255,11 +229,10 @@
 			break;
 		case PROPOSAL_TREATY_CEASEFIRE:
 		case PROPOSAL_TREATY_PEACE:
-			
-			
+
 			if (at_risk_value_percent < 85)
 			{
-				sender_diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);		
+				sender_diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);
 			}
 			break;
 		case PROPOSAL_TREATY_TRADE_PACT:
@@ -300,22 +273,20 @@
 				sender_diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);
 			}
 		default:
-			
+
 			if (sender_diplomat.DesireWarWith(receiver))
 			{
-		
-				
+
 				if (sender_diplomat.ComputeThreatResponse(receiver, threat_response))
 				{
-					
+
 					sender_diplomat.ConsiderResponse(receiver, threat_response);
 				}
-				
+
 				return GEV_HD_Continue;
 			}
 	}
 
-	
 	return GEV_HD_Continue;
 }
 
@@ -327,21 +298,18 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & diplomat = Diplomat::GetDiplomat(sender);
 
 	const NewProposal & sender_proposal = diplomat.GetMyLastNewProposal(receiver);
-	const Response & receiver_response = 
+	const Response & receiver_response =
 		Diplomat::GetDiplomat(receiver).GetMyLastResponse(sender);
 
-	
 	if (  receiver_response.type != RESPONSE_COUNTER ||
 		  sender_proposal.detail.first_type != PROPOSAL_REQUEST_GIVE_ADVANCE ||
 		  receiver_response.counter.first_type != PROPOSAL_REQUEST_GIVE_ADVANCE)
@@ -349,57 +317,48 @@
 		return GEV_HD_Continue;
 	}
 
-	
 	if (!ProposalAnalysis::PlayerGetsEnoughValue(sender, sender, receiver, receiver_response.counter))
 	{
 		return GEV_HD_Continue;
 	}
 
-	
 	if ( receiver_response.counter.second_type == PROPOSAL_OFFER_GIVE_CITY)
 	{
 		return GEV_HD_Continue;
 	}
-	
+
 	sint32 accept_priority =
 			diplomat.GetAcceptPriority(receiver, receiver_response.counter.second_type);
-				
-	
+
 	diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);
-	
-	
+
 	return GEV_HD_Continue;
 }
 
 
-
 STDEHANDLER(AdvanceForGold_CounterResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
-	
-	
+
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
-	
-	
+
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
-	
+
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
-	
+
 	const NewProposal & sender_proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 	const Response & receiver_response = receiver_diplomat.GetMyLastResponse(sender);
-	
-	
+
 	if ( receiver_response.type != RESPONSE_COUNTER ||
 		receiver_response.counter.first_type != PROPOSAL_REQUEST_GIVE_GOLD)
 	{
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	DiplomacyResult sender_result;
 	DiplomacyResult receiver_result;
 	ProposalAnalysis::ComputeResult( receiver_response,
@@ -412,55 +371,48 @@
 	ProposalAnalysis::DebugResult(sender_proposal);
 	ProposalAnalysis::DebugResult(receiver_response);
 #endif _DEBUG
-	
-	sint32 accept_priority = 
+
+	sint32 accept_priority =
 		sender_diplomat.GetAcceptPriority(receiver, PROPOSAL_REQUEST_GIVE_GOLD);
-	
+
 	if (receiver_response.counter.second_type == PROPOSAL_OFFER_GIVE_ADVANCE)
 	{
-		
+
 		sint32 stop_advance = sender_diplomat.GetStopResearchingAdvance( receiver );
 		if (receiver_response.counter.second_arg.advanceType == stop_advance)
 		{
-			return GEV_HD_Continue;		
+			return GEV_HD_Continue;
 		}
-		
-		
-		
+
+
 		if (sender_result.gold < receiver_result.science * 1.2)
 			return GEV_HD_Continue;
-		
-		
+
 		sender_diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);
 	}
-	
-	
+
 	if (receiver_response.counter.second_type == PROPOSAL_TREATY_CEASEFIRE)
 	{
 		if (!sender_diplomat.DesireWarWith(receiver))
 		{
-			
+
 			sender_diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);
 		}
 	}
-	
-	
-	
+
+
 	if (receiver_response.counter.second_type == PROPOSAL_TREATY_CEASEFIRE)
 	{
-		
+
 		if (sender_diplomat.GetBorderIncursionBy(receiver))
 			return GEV_HD_Continue;
-		
-		
+
 		if (sender_diplomat.GetTrust(receiver) < COLDWAR_REGARD)
 			return GEV_HD_Continue;
-		
-		
+
 		if (sender_diplomat.DesireWarWith(receiver))
 			return GEV_HD_Continue;
-		
-		
+
 		sender_diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);
 	}
 
@@ -468,17 +420,14 @@
 }
 
 
-
 STDEHANDLER(ActionForValue_CounterResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -488,16 +437,13 @@
 	const NewProposal & sender_proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 	const Response & receiver_response = receiver_diplomat.GetMyLastResponse(sender);
 
-	
 	sint32 turns_since_last_war = AgreementMatrix::s_agreements.TurnsSinceLastWar(sender, receiver);
 	if (turns_since_last_war >= 0 && turns_since_last_war < 10)
-		return GEV_HD_Continue;		
+		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.TestEffectiveRegard(receiver, HOTWAR_REGARD))
 		return GEV_HD_Continue;
 
-	
 	if ( receiver_response.type != RESPONSE_COUNTER ||
 		 ( receiver_response.counter.first_type != PROPOSAL_REQUEST_GIVE_GOLD &&
 		   receiver_response.counter.first_type != PROPOSAL_REQUEST_GIVE_ADVANCE) )
@@ -505,7 +451,6 @@
 		return GEV_HD_Continue;
 	}
 
-	
 	DiplomacyResult sender_result;
 	DiplomacyResult receiver_result;
 	ProposalAnalysis::ComputeResult( receiver_response,
@@ -526,15 +471,13 @@
 	sint32 sender_piracy = map_analysis.GetPiracyIncomeByPlayer(sender, receiver);
     sint32 sender_result_value = std::max<sint32>(sender_result.science, sender_result.gold);
 
-	sint32 accept_priority = 
+	sint32 accept_priority =
 		sender_diplomat.GetAcceptPriority(receiver, receiver_response.counter.second_type);
 
-	
 	switch (receiver_response.counter.second_type)
 		{
 		case PROPOSAL_OFFER_WITHDRAW_TROOPS:
-			
-			
+
 			if (!sender_diplomat.GetBorderIncursionBy(receiver) &&
 				!sender_diplomat.DesireWarWith(receiver))
 			{
@@ -542,20 +485,20 @@
 			}
 			break;
 		case PROPOSAL_OFFER_STOP_PIRACY:
-			
+
 			// made AI consider more - tombom
 			if ((receiver_piracy <= 0 &&
-				(sender_result_value > sender_piracy * 4)) && 
+				(sender_result_value > sender_piracy * 4)) &&
 				(!sender_diplomat.DesireWarWith(receiver)||!receiver_diplomat.DesireWarWith(sender)))
 			{
 				sender_diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);
 			}
 			break;
 		case PROPOSAL_OFFER_END_EMBARGO:
-			
-			
-			
-			
+
+
+
+
 			if (!receiver_diplomat.GetEmbargo(sender) &&
 				(sender_result_value > (receiver_trade_total - sender_trade_total) * 3))
 			{
@@ -563,41 +506,35 @@
 			}
 			break;
 		default:
-			
+
 			return GEV_HD_Continue;
 		}
 
-	
 	if (sender_diplomat.DesireWarWith(receiver))
 	{
 		Response threat_response;
-		
-		
+
 		if (sender_diplomat.ComputeThreatResponse(receiver, threat_response))
 		{
-			
+
 			sender_diplomat.ConsiderResponse(receiver, threat_response);
 		}
-		
+
 		return GEV_HD_Continue;
 	}
 
-	
 	return GEV_HD_Continue;
 }
 
 
-
 STDEHANDLER(ReciprocateAction_CounterResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -607,7 +544,6 @@
 //	const NewProposal & sender_proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 	const Response & receiver_response = receiver_diplomat.GetMyLastResponse(sender);
 
-	
 	if ( receiver_response.type != RESPONSE_COUNTER ||
 		 (receiver_response.counter.first_type != PROPOSAL_REQUEST_WITHDRAW_TROOPS) ||
 		 (receiver_response.counter.first_type != PROPOSAL_REQUEST_STOP_PIRACY) ||
@@ -616,7 +552,6 @@
 		return GEV_HD_Continue;
 	}
 
-	
 	if ( receiver_response.type != RESPONSE_COUNTER ||
 		 (receiver_response.counter.first_type != PROPOSAL_OFFER_WITHDRAW_TROOPS) ||
 		 (receiver_response.counter.first_type != PROPOSAL_OFFER_STOP_PIRACY) ||
@@ -625,18 +560,16 @@
 		return GEV_HD_Continue;
 	}
 
-	
 	if (sender_diplomat.DesireWarWith(receiver))
 		{
 			Response threat_response;
-			
-			
+
 			if (sender_diplomat.ComputeThreatResponse(receiver, threat_response))
 				{
-					
+
 					sender_diplomat.ConsiderResponse(receiver, threat_response);
 				}
-			
+
 			return GEV_HD_Continue;
 		}
 
@@ -646,32 +579,30 @@
 	sint32 receiver_piracy = map_analysis.GetPiracyIncomeByPlayer(receiver,sender);
 	sint32 sender_piracy = map_analysis.GetPiracyIncomeByPlayer(sender, receiver);
 
-	DIPLOMATIC_STRENGTH sender_strength = 
+	DIPLOMATIC_STRENGTH sender_strength =
 		g_player[sender]->GetRelativeStrength(receiver);
 
 	if (receiver_response.counter.first_type == PROPOSAL_REQUEST_WITHDRAW_TROOPS)
 	{
 		if (receiver_response.counter.second_type == PROPOSAL_OFFER_WITHDRAW_TROOPS)
 		{
-			
+
 			if ( sender_strength > DIPLOMATIC_STRENGTH_VERY_STRONG)
 				return GEV_HD_Continue;
 		}
 	}
 	else if (receiver_response.counter.first_type == PROPOSAL_REQUEST_STOP_PIRACY)
 	{
-		
+
 		if (!sender_diplomat.TestEffectiveRegard(receiver, NEUTRAL_REGARD))
 		{
-			
-			
+
 			if (receiver_response.counter.second_type == PROPOSAL_OFFER_END_EMBARGO &&
 				(receiver_diplomat.GetEmbargo(sender) ||
 				((double) receiver_piracy / sender_trade_total) < 0.5))
 				return GEV_HD_Continue;
-			
-			
-			
+
+
 			if (receiver_response.counter.second_type == PROPOSAL_OFFER_STOP_PIRACY &&
 				sender_piracy > (receiver_piracy * 2))
 				return GEV_HD_Continue;
@@ -679,16 +610,14 @@
 	}
 	else if (receiver_response.counter.first_type == PROPOSAL_REQUEST_END_EMBARGO)
 	{
-		
+
 		if (!sender_diplomat.TestEffectiveRegard(receiver, NEUTRAL_REGARD))
 		{
-			
-			
+
 			if (receiver_response.counter.second_type == PROPOSAL_OFFER_END_EMBARGO &&
 				receiver_trade_total > (sender_trade_total * 2))
 				return GEV_HD_Continue;
-			
-			
+
 			if (receiver_response.counter.second_type == PROPOSAL_OFFER_STOP_PIRACY &&
 				sender_piracy > (sender_trade_total * 0.25))
 				return GEV_HD_Continue;
@@ -696,39 +625,34 @@
 	}
 	else
 	{
-		
+
 		return GEV_HD_Continue;
 	}
 
-	
-	sint32 accept_priority = 
+	sint32 accept_priority =
 		sender_diplomat.GetNewProposalPriority(receiver, receiver_response.counter.second_type);
-	
+
 	Response counter_response;
-	
+
 	counter_response.priority = static_cast<sint16>(accept_priority);
-	counter_response.type = RESPONSE_ACCEPT; 
-	counter_response.counter.tone = DIPLOMATIC_TONE_EQUAL;	
+	counter_response.type = RESPONSE_ACCEPT;
+	counter_response.counter.tone = DIPLOMATIC_TONE_EQUAL;
 	counter_response.senderId = sender;
 	counter_response.receiverId = receiver;
-	
-	
+
 	sender_diplomat.ConsiderResponse(receiver, counter_response);
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(Default_CounterResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -737,64 +661,52 @@
 
 	const Response & receiver_response = receiver_diplomat.GetMyLastResponse(sender);
 
-	
 	if (ProposalAnalysis::IsAcceptResponse(receiver_response))
 	{
-		sint32 accept_priority = 
+		sint32 accept_priority =
 			sender_diplomat.GetNewProposalPriority(receiver, receiver_response.counter.second_type);
 
 		sender_diplomat.ConsiderResponse(receiver, RESPONSE_ACCEPT, accept_priority);
 	}
 
-	
-	sender_diplomat.ConsiderResponse(receiver, RESPONSE_REJECT, 1);			
+	sender_diplomat.ConsiderResponse(receiver, RESPONSE_REJECT, 1);
 
-	
 	return GEV_HD_Continue;
 }
 
-
-void CounterResponseEventCallbacks::AddCallbacks() 
+void CounterResponseEventCallbacks::AddCallbacks()
 {
 
-	
-	g_gevManager->AddCallback(GEV_Counter, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Counter,
+							  GEV_PRI_Pre,
 							  &s_ThreatenAttackCity_CounterResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Counter, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Counter,
+							  GEV_PRI_Pre,
 							  &s_PayForCeasefire_CounterResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Counter, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Counter,
+							  GEV_PRI_Pre,
 							  &s_PayForGiveCity_CounterResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Counter, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Counter,
+							  GEV_PRI_Pre,
 							  &s_PayForAdvance_CounterResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Counter, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Counter,
+							  GEV_PRI_Pre,
 							  &s_AdvanceForGold_CounterResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Counter, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Counter,
+							  GEV_PRI_Pre,
 							  &s_ActionForValue_CounterResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Counter, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Counter,
+							  GEV_PRI_Pre,
 							  &s_ReciprocateAction_CounterResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Counter, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Counter,
+							  GEV_PRI_Pre,
 							  &s_Default_CounterResponseEvent);
 
 }

Modified: trunk/ctp2_code/ai/diplomacy/diplomacyutil.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/diplomacyutil.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/diplomacyutil.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,4 +1,3 @@
-
 #include "c3.h"
 #include "diplomacyutil.h"
 #include "DiplomacyProposalRecord.h"
@@ -12,17 +11,16 @@
 
 void diplomacyutil_Initialize()
 {
-	
+
 	Assert(g_theDiplomacyProposalDB->NumRecords() == PROPOSAL_MAX);
 
 	sint32 i, j;
-	
+
 	for(i = 0; i < sint32(PROPOSAL_MAX); i++) {
 		s_proposal_to_db_map[i] = -1;
 		s_db_to_proposal_map[i] = PROPOSAL_NONE;
 	}
 
-	
 	for(i = 0; i < g_theDiplomacyProposalDB->NumRecords(); i++) {
 		const DiplomacyProposalRecord *rec = g_theDiplomacyProposalDB->Get(i);
 		for(j = sint32(PROPOSAL_NONE); j < sint32(PROPOSAL_MAX); j++) {
@@ -34,7 +32,6 @@
 		}
 	}
 
-	
 	Assert(g_theDiplomacyThreatDB->NumRecords() == THREAT_MAX);
 	for(i = 0; i < sint32(THREAT_MAX); i++) {
 		s_threat_to_db_map[i] = -1;
@@ -53,7 +50,6 @@
 	}
 }
 
-
 const DiplomacyProposalRecord *diplomacyutil_GetRecord(PROPOSAL_TYPE type)
 {
 	return g_theDiplomacyProposalDB->Get(s_proposal_to_db_map[type]);
@@ -67,14 +63,12 @@
 PROPOSAL_TYPE diplomacyutil_GetProposalType(sint32 dbIndex)
 {
 	if(dbIndex < 0 || dbIndex >= PROPOSAL_MAX) {
-		
-		
+
 		return PROPOSAL_NONE;
 	}
 	return s_db_to_proposal_map[dbIndex];
 }
 
-
 const DiplomacyThreatRecord *diplomacyutil_GetRecord(THREAT_TYPE type)
 {
 	return g_theDiplomacyThreatDB->Get(s_threat_to_db_map[type]);

Modified: trunk/ctp2_code/ai/diplomacy/diplomacyutil.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/diplomacyutil.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/diplomacyutil.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,4 +1,3 @@
-
 #ifndef DIPLOMACY_UTIL_H__
 #define DIPLOMACY_UTIL_H__
 

Modified: trunk/ctp2_code/ai/diplomacy/diplomat.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/diplomat.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/diplomat.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -29,12 +29,12 @@
 //
 // Modifications from the original Activision code:
 //
-// - Minor modification of the Diplomat::StartNegotiations function 
+// - Minor modification of the Diplomat::StartNegotiations function
 //   by Peter Triggs to enable some minor AI-AI-Diplomacy.
 // - Corrected bug in list insertion.
 // - Corrected non-standard syntax and some compiler warnings.
 // - Prevented invalid strategies to be merged in.
-// - Prevented crash on number of strategies wrap-around to negative. 
+// - Prevented crash on number of strategies wrap-around to negative.
 // - Add an isStealth parameter in CharacterizeArmy method - Calvitix
 // - Made Cleanup really clean up.
 // - Prevented crash on incorrect input (0 foreigners).
@@ -47,7 +47,7 @@
 // - Made limited duration optional.
 // - Added war over message. (Feb 4th 2007 Martin Gühmann)
 // - Added HotSeat and PBEM human-human diplomacy support. (17-Oct-2007 Martin Gühmann)
-// - Seperated the NewProposal event from the Response event so that the 
+// - Seperated the NewProposal event from the Response event so that the
 //   NewProposal event can be called from slic witout any problems. (17-Oct-2007 Martin Gühmann)
 // - The player's default strategy is restored after save reloading. (13-Jun-2008 Martin Gühmann)
 //
@@ -146,11 +146,11 @@
     enum PROPOSAL_TYPE  prop_type
 )
 {
-	switch (prop_type) 
+	switch (prop_type)
     {
     // One-time gifts (no use cancelling these)
     default:
-        return k_EXPIRATION_NEVER;  
+        return k_EXPIRATION_NEVER;
 
     // Simple agreements
 	case PROPOSAL_OFFER_WITHDRAW_TROOPS:
@@ -188,7 +188,6 @@
 } // namespace
 
 
-
 AiState Diplomat::s_badAiState;
 Threat Diplomat::s_badThreat;
 Response Diplomat::s_badResponse;
@@ -211,7 +210,7 @@
 	Assert(static_cast<size_t>(playerId) < s_theDiplomats.size());
 	Assert(playerId == s_theDiplomats[playerId].GetPlayerId());
 
-	return s_theDiplomats[playerId]; 
+	return s_theDiplomats[playerId];
 }
 
 bool Diplomat::HasDiplomat(const PLAYER_INDEX & playerId)
@@ -222,7 +221,7 @@
 	&&      playerId == s_theDiplomats[playerId].GetPlayerId());
 }
 
-void Diplomat::ResizeAll(const PLAYER_INDEX & newMaxPlayers) 
+void Diplomat::ResizeAll(const PLAYER_INDEX & newMaxPlayers)
 {
 	sint32 old_size = s_theDiplomats.size();
 	s_theDiplomats.resize(newMaxPlayers);
@@ -260,8 +259,7 @@
 	DiplomatVector().swap(s_theDiplomats);
 }
 
-
-void Diplomat::InitializeAll() 
+void Diplomat::InitializeAll()
 {
 	for (size_t i = 0; i < s_theDiplomats.size(); ++i)
 	{
@@ -269,7 +267,6 @@
 	}
 }
 
-
 void Diplomat::LoadAll(CivArchive & archive)
 {
 	archive >> s_nextId;
@@ -281,7 +278,6 @@
 	}
 }
 
-
 void Diplomat::SaveAll(CivArchive & archive)
 {
 	archive << s_nextId;
@@ -293,9 +289,9 @@
 	}
 }
 
-void Diplomat::DebugStatusAll() 
+void Diplomat::DebugStatusAll()
 {
-	for (size_t playerId = 1; playerId < s_theDiplomats.size(); ++playerId) 
+	for (size_t playerId = 1; playerId < s_theDiplomats.size(); ++playerId)
     {
 		if (g_player[playerId] && !g_player[playerId]->IsDead())
 		{
@@ -312,7 +308,6 @@
 	}
 }
 
-
 void Diplomat::AddDiplomacyArgToSlicContext(SlicContext & sc, const DiplomacyArg & dip_arg)
 {
 	if (dip_arg.playerId != -1)
@@ -335,7 +330,6 @@
 		sc.AddInt(static_cast<sint32>(100.0 * dip_arg.percent));
 }
 
-
 void Diplomat::ExecuteDelayedNegotiations(const sint32 receiverID)
 {
 	// Add on screen check
@@ -353,13 +347,11 @@
 	return s_nextId++;
 }
 
-
 void Diplomat::SetNextId(const sint32 & id) {
 	s_nextId = id;
 }
 
-
-Diplomat::Diplomat() 
+Diplomat::Diplomat()
 :
     m_playerId                      (PLAYER_UNASSIGNED),
     m_personalityName               (),
@@ -367,8 +359,8 @@
     m_motivations                   (),
 	m_lastMotivation                (),
     m_diplomaticStates              (),
-    m_bestStrategicStates           (),	
-    m_bestDiplomaticState           (s_badAiState),	
+    m_bestStrategicStates           (),
+    m_bestDiplomaticState           (s_badAiState),
     m_strategy                      (),
 	m_diplomacy                     (),
     m_foreigners                    (),
@@ -397,8 +389,8 @@
     m_motivations                   (a_Original.m_motivations),
 	m_lastMotivation                (),
     m_diplomaticStates              (a_Original.m_diplomaticStates),
-    m_bestStrategicStates           (a_Original.m_bestStrategicStates),	
-    m_bestDiplomaticState           (a_Original.m_bestDiplomaticState),	
+    m_bestStrategicStates           (a_Original.m_bestStrategicStates),
+    m_bestDiplomaticState           (a_Original.m_bestDiplomaticState),
     m_strategy                      (a_Original.m_strategy),
 	m_diplomacy                     (a_Original.m_diplomacy),
     m_foreigners                    (a_Original.m_foreigners),
@@ -445,7 +437,7 @@
 	    m_personality                   = a_Original.m_personality;
         m_motivations                   = a_Original.m_motivations;
         m_diplomaticStates              = a_Original.m_diplomaticStates;
-        m_bestStrategicStates           = a_Original.m_bestStrategicStates;	
+        m_bestStrategicStates           = a_Original.m_bestStrategicStates;
         m_bestDiplomaticState           = a_Original.m_bestDiplomaticState;
         m_strategy                      = a_Original.m_strategy;
 	    m_diplomacy                     = a_Original.m_diplomacy;
@@ -467,7 +459,7 @@
 
         // Update the iterators in m_lastMotivation to point to the new list
 	    m_lastMotivation.clear();
-	    for 
+	    for
         (
             MotivationVector::const_iterator p = a_Original.m_lastMotivation.begin();
             p != a_Original.m_lastMotivation.end();
@@ -487,8 +479,7 @@
 
     return *this;
 }
-	
-	
+
 
 Diplomat::~Diplomat()
 {
@@ -513,7 +504,6 @@
 	m_desireWarWith.resize(newMaxPlayerId);
 }
 
-
 void Diplomat::Load(CivArchive & archive)
 {
 	uint16	count;
@@ -521,7 +511,6 @@
 	Threat  threat;
 	AiState ai_state;
 
-	
 	Initialize();
 
 	archive >> count;
@@ -531,7 +520,7 @@
 	if(count > 0)
 		SetPersonalityName(str);
 	delete [] str;
-	 
+
 	archive >> count;
 	for (i = 0; i < count; i++)
 	{
@@ -549,7 +538,6 @@
 		m_threats.push_back(threat);
 	}
 
-	
 	archive >> count;
 
 	Assert(count == CtpAi::s_maxPlayers);
@@ -572,11 +560,11 @@
 			m_foreigners[foreigner].Initialize();
 			ai_state.dbIndex = -1;
 		}
-		
+
 		PLAYER_INDEX const  foreignerId = static_cast<PLAYER_INDEX>(foreigner);
 
-		if (    g_player[m_playerId] 
-		     && g_player[foreigner] 
+		if (    g_player[m_playerId]
+		     && g_player[foreigner]
 		     && (m_playerId != foreignerId)
 		    )
 		{
@@ -602,7 +590,6 @@
 		m_launchedNanoAttack = (val?true:false) ;
 	}
 
-	
 	m_desireWarWith.resize(m_foreigners.size());
 
 	// Diplomats even exist for dead players.
@@ -614,7 +601,6 @@
 	ComputeIncursionPermission();
 }
 
-
 void Diplomat::Save(CivArchive & archive) const
 {
 	archive << static_cast<uint16>(m_personalityName.size());
@@ -627,8 +613,7 @@
 		archive.Store((uint8 *) &(*ai_state_iter), sizeof(AiState));
 		ai_state_iter++;
 	}
-	
-	
+
 	archive << static_cast<uint16>(m_threats.size());
 	ThreatList::const_iterator threat_iter = m_threats.begin();
 	while (threat_iter != m_threats.end())
@@ -637,13 +622,11 @@
 		threat_iter++;
 	}
 
-	
 	archive << static_cast<uint16>(m_foreigners.size());
 	for (uint32 foreigner=0; foreigner < m_foreigners.size(); foreigner++)
 	{
 		m_foreigners[foreigner].Save(archive);
 
-		
 		archive.Store((uint8 *) &(m_diplomaticStates[foreigner]), sizeof(AiState));
 	}
 	archive << m_diplomcyVictoryCompleteTurn;
@@ -657,7 +640,6 @@
 	archive << val;
 }
 
-
 void Diplomat::Cleanup()
 {
 	m_motivations.clear();
@@ -667,7 +649,7 @@
 	m_diplomacy.resize(0);
 	m_desireWarWith.resize(0);
 	m_threats.clear();
-	
+
 	m_bestDiplomaticState = s_badAiState;
 	m_personality                   = NULL;
 	m_nuclearAttackTarget = PLAYER_UNASSIGNED;
@@ -685,11 +667,10 @@
 	m_outstandingProposals			= 0;
 	m_personalityName.resize(0);
 	m_piracyHistory.clear();
-	
+
 	ClearEffectiveRegardCache();
 }
 
-
 void Diplomat::Initialize()
 {
 	if ((m_playerId >= 0) && (m_playerId < k_MAX_PLAYERS))
@@ -712,16 +693,16 @@
 	{
 		m_personality = g_thePersonalityDB->Get(0);
 	}
-	
+
 	m_motivations.clear();
-	
+
 	for (uint32 foreigner=0; foreigner < m_lastMotivation.size(); foreigner++)
 	{
 		InitForeigner(foreigner);
 	}
 
 	m_threats.clear();
-	
+
 	Assert(g_thePersonalityDB);
 	m_nuclearAttackTarget         = -1;
 	m_lastParty                   = -1;
@@ -732,59 +713,56 @@
 	ClearEffectiveRegardCache();
 }
 
-
 void Diplomat::InitForeigner(const PLAYER_INDEX & foreigner)
 {
 	m_lastMotivation[foreigner] = m_motivations.end();
 
-	
-	
-	
+
+
+
 	m_foreigners[foreigner].Initialize();
 	InitDiplomaticState(foreigner);
 }
 
-
 void Diplomat::DebugStatus(const PLAYER_INDEX & foreignerId) const
 {
-	
-	for 
+
+	for
     (
-        size_t tmp_foreignerIndex = 1; 
-        tmp_foreignerIndex < m_foreigners.size(); 
+        size_t tmp_foreignerIndex = 1;
+        tmp_foreignerIndex < m_foreigners.size();
         ++tmp_foreignerIndex
-    ) 
+    )
     {
-        PLAYER_INDEX    tmp_foreignerId = 
+        PLAYER_INDEX    tmp_foreignerId =
             static_cast<PLAYER_INDEX>(tmp_foreignerIndex);
 
 		if (tmp_foreignerId == m_playerId)
 			continue;
 
-		if (    (foreignerId != PLAYER_UNASSIGNED) 
+		if (    (foreignerId != PLAYER_UNASSIGNED)
              && (tmp_foreignerId != foreignerId)
            )
 			continue;
-		
+
 		const Foreigner &foreigner = m_foreigners[tmp_foreignerIndex];
-		
-		DPRINTF(k_DBG_DIPLOMACY, ("Player %d -> Foreigner %d\n", 
+
+		DPRINTF(k_DBG_DIPLOMACY, ("Player %d -> Foreigner %d\n",
 			m_playerId, tmp_foreignerId));
-		
-		
+
 		if (!g_player[m_playerId]->HasContactWith(tmp_foreignerId))
 		{
 			DPRINTF(k_DBG_DIPLOMACY, ("  No Contact\n" ));
 			continue;
 		}
-		
+
 		DPRINTF(k_DBG_DIPLOMACY, ("  Public Regard = %d\n",
 			foreigner.GetPublicRegard()));
 		DPRINTF(k_DBG_DIPLOMACY, ("  Effective Regard = %d\n",
 			foreigner.GetEffectiveRegard()));
 		DPRINTF(k_DBG_DIPLOMACY, ("  Trust = %d\n",
 			foreigner.GetTrust()));
-		
+
 		if (foreigner.GetBestRegardExplain() >= 0)
 		{
 			DPRINTF(k_DBG_DIPLOMACY, ("  Explaination = %s\n",
@@ -792,47 +770,42 @@
 		}
 		else
 			DPRINTF(k_DBG_DIPLOMACY, ("  Explaination = <NO EXPLAINATION>\n"));
-		
+
 		if (GetReceiverHasInitiative(tmp_foreignerId))
 		{
 			DPRINTF(k_DBG_DIPLOMACY, ("  (has initiative)\n"));
 		}
 
-		
 		if (foreignerId != PLAYER_UNASSIGNED)
 		{
 			foreigner.DebugStatus();
 		}
 	}
-	
+
 	DPRINTF(k_DBG_DIPLOMACY, ("\n"));
 }
 
-
 void Diplomat::LogDebugStatus(const PLAYER_INDEX & foreignerId) const
 {
-	
+
 	Player *player_ptr = g_player[m_playerId];
 
-	if(!player_ptr) 
+	if(!player_ptr)
 		return;
 
 	gslog_dipprint("[Player %d] [Turn %d]\n", m_playerId, player_ptr->m_current_round);
 
-	
 	StringId explainStrId;
 
-	
 	for (int tmp_foreignerId = 1; tmp_foreignerId < k_MAX_PLAYERS; tmp_foreignerId++)
 	{
-		
+
 		if (tmp_foreignerId == m_playerId)
 			continue;
 
 		if (foreignerId != -1 && tmp_foreignerId != foreignerId)
 			continue;
 
-		
 		if (g_player[tmp_foreignerId] == NULL)
 			continue;
 
@@ -845,7 +818,6 @@
 		gslog_dipprint("    Effective Regard = %d\n", foreigner.GetEffectiveRegard());
 		gslog_dipprint("    Trust = %d\n", foreigner.GetTrust());
 
-		
 		if (!g_player[m_playerId]->HasContactWith(tmp_foreignerId))
 		{
 			gslog_dipprint("    No Contact.\n" );
@@ -867,55 +839,47 @@
 		gslog_dipprint("    Regard Events:\n");
 
 		const DiplomacyRecord & diplomacy = GetCurrentDiplomacy(tmp_foreignerId);
-		
+
 		foreigner.LogDebugStatus(diplomacy);
 	}
-	
+
 	gslog_dipprint("\n");
 }
 
-
 void Diplomat::SetPlayerId(const PLAYER_INDEX &playerId) {
 	m_playerId = playerId;
 }
 
-
 PLAYER_INDEX Diplomat::GetPlayerId() const {
 	return m_playerId;
 }
 
-
 void Diplomat::SetPersonalityName(const char *personality_name) {
 	m_personalityName = std::string(personality_name);
 
-	
 	sint32 index;
 	bool found = g_thePersonalityDB->GetNamedItem(personality_name, index);
 	Assert(found);
 	if (found)
 		m_personality = g_thePersonalityDB->Get(index);
-	
-}
 
+}
 
-std::string Diplomat::GetPersonalityName() const 
+std::string Diplomat::GetPersonalityName() const
 {
 	return m_personalityName;
 }
 
-
 const PersonalityRecord *Diplomat::GetPersonality() const
 {
 	return m_personality;
 }
 
-
 bool Diplomat::GetReceiverHasInitiative(const PLAYER_INDEX & foreignerId) const {
 	return m_foreigners[foreignerId].m_hasInitiative;
 }
 
-
-void Diplomat::SetReceiverHasInitiative(const PLAYER_INDEX & foreignerId, 
+void Diplomat::SetReceiverHasInitiative(const PLAYER_INDEX & foreignerId,
 										const bool & hasInitiative) {
 	m_foreigners[foreignerId].m_hasInitiative = hasInitiative;
 
@@ -927,7 +891,6 @@
 	}
 }
 
-
 void Diplomat::BeginTurn()
 {
 	ClearEffectiveRegardCache();
@@ -952,15 +915,14 @@
 		m_lastMotivation[foreigner] = m_motivations.end();
 	}
 
-	for ( ForeignerVector::iterator iter = m_foreigners.begin(); 
-		  iter != m_foreigners.end(); 
+	for ( ForeignerVector::iterator iter = m_foreigners.begin();
+		  iter != m_foreigners.end();
 		  ++iter ) {
-		
+
 		iter->SetMyLastResponse( Diplomat::s_badResponse );
 		iter->SetMyLastNewProposal( Diplomat::s_badNewProposal );
 	}
 
-	
 	g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ComputeMotivations,
 			  GEA_Player, m_playerId,
 			  GEA_End);
@@ -974,7 +936,7 @@
 	         ++foreignerIndex
 	)
 	{
-		PLAYER_INDEX foreignerId = static_cast<PLAYER_INDEX>(foreignerIndex);	
+		PLAYER_INDEX foreignerId = static_cast<PLAYER_INDEX>(foreignerIndex);
 		if (foreignerId == m_playerId)
 			continue;
 
@@ -999,7 +961,7 @@
 		double land_percent;
 		PLAYER_INDEX leaderId           = PLAYER_UNASSIGNED;
 		double population_needed;
-		const EndGameObjectRecord *rec = 
+		const EndGameObjectRecord *rec =
 			g_theEndGameObjectDB->Get(diplomacyEndgameIndex);
 		MapAnalysis::GetMapAnalysis().ComputeAllianceSize(m_playerId, leaderId, population_percent, land_percent);
 
@@ -1034,14 +996,12 @@
 					 const REGARD_EVENT_TYPE & type,
 					 const StringId & explain,
 					 const sint16 duration) {
-	
-	
-	RegardEvent regardEvent(static_cast<ai::Regard>(regardDelta), 
+
+	RegardEvent regardEvent(static_cast<ai::Regard>(regardDelta),
 							static_cast<sint16>(NewTurnCount::GetCurrentRound()+1), explain, duration);
 	m_foreigners[foreignerId].LogRegardEvent(type, regardEvent);
 }
 
-
 void Diplomat::LogViolationEvent(const PLAYER_INDEX foreignerId, const PROPOSAL_TYPE proposal_type)
 {
 	StringId strId;
@@ -1049,38 +1009,33 @@
 	bool act_of_war = false;
 	char * trust_message = NULL;
 
-	
 	if (foreignerId == 0)
 		return;
 
-	
 	if (m_playerId == 0)
 		return;
 
 	switch (proposal_type)
 	{
-	
+
 	case PROPOSAL_REQUEST_WITHDRAW_TROOPS:
 		g_theStringDB->GetStringID("REGARD_EVENT_WITHDRAW_TROOPS_VIOLATION", strId);
 		regard_event_type = REGARD_EVENT_DIPLOMACY;
 		trust_message = "TrustLossFailToWithdraw";
 		break;
-	
-	
+
 	case PROPOSAL_REQUEST_STOP_PIRACY:
 		SetColdwarAttack(foreignerId, (sint16) NewTurnCount::GetCurrentRound());
-		
+
 		g_theStringDB->GetStringID("REGARD_EVENT_VIOLATED_STOP_PIRACY", strId);
 		regard_event_type = REGARD_EVENT_DIPLOMACY;
 		trust_message = "TrustLossFailToStopPiracy";
 
-		
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_MILITARY_PACT);
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_RESEARCH_PACT);
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_TRADE_PACT);
 		break;
 
-	
 	case PROPOSAL_REQUEST_STOP_RESEARCH:
 		g_theStringDB->GetStringID("REGARD_EVENT_STOP_RESEARCH_VIOLATION", strId);
 		regard_event_type = REGARD_EVENT_DIPLOMACY;
@@ -1088,7 +1043,6 @@
 
 		break;
 
-	
 	case PROPOSAL_REQUEST_REDUCE_POLLUTION:
 		g_theStringDB->GetStringID("REGARD_EVENT_PROPOSAL_REDUCE_POLLUTION", strId);
 		regard_event_type = REGARD_EVENT_DIPLOMACY;
@@ -1102,22 +1056,17 @@
 
 		trust_message = "TrustLossViolatedPeaceTreaty";
 		break;
-		
-	
+
 	case PROPOSAL_TREATY_CEASEFIRE:
 		g_theStringDB->GetStringID("REGARD_EVENT_UNPROVOKED_ATTACK",strId);
 		regard_event_type = REGARD_EVENT_MILITARY_SAFETY;
 
-		
 		LogViolationEvent(foreignerId, PROPOSAL_REQUEST_WITHDRAW_TROOPS);
 
-		
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_PEACE);
 
-		
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_ALLIANCE);
 
-		
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_MILITARY_PACT);
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_TRADE_PACT);
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_RESEARCH_PACT);
@@ -1129,18 +1078,15 @@
 		act_of_war = true;
 		break;
 
-	
 	case PROPOSAL_TREATY_TRADE_PACT:
 		g_theStringDB->GetStringID("REGARD_EVENT_VIOLATE_TRADE_PACT", strId);
 		regard_event_type = REGARD_EVENT_DIPLOMACY;
 
-		
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_ALLIANCE);
 
 		trust_message = "TrustLossViolatedTradePact";
 		break;
 
-	
 	case PROPOSAL_TREATY_MILITARY_PACT:
 		g_theStringDB->GetStringID("REGARD_EVENT_VIOLATED_MILITARY_PACT", strId);
 		regard_event_type = REGARD_EVENT_DIPLOMACY;
@@ -1148,7 +1094,6 @@
 		trust_message = "TrustLossViolatedMilitaryPact";
 		break;
 
-	
 	case PROPOSAL_TREATY_POLLUTION_PACT:
 		g_theStringDB->GetStringID("REGARD_EVENT_VIOLATED_POLLUTION_PACT", strId);
 		regard_event_type = REGARD_EVENT_DIPLOMACY;
@@ -1156,7 +1101,6 @@
 		trust_message = "TrustLossViolatedPollutionPact";
 		break;
 
-	
 	case PROPOSAL_TREATY_ALLIANCE:
 		g_theStringDB->GetStringID("REGARD_EVENT_VIOLATED_ALLIANCE", strId);
 		regard_event_type = REGARD_EVENT_DIPLOMACY;
@@ -1164,7 +1108,6 @@
 		trust_message = "TrustLossViolatedAlliance";
 		break;
 
-	
 	case PROPOSAL_TREATY_RESEARCH_PACT:
 		g_theStringDB->GetStringID("REGARD_EVENT_VIOLATED_RESEACH_PACT", strId);
 		regard_event_type = REGARD_EVENT_DIPLOMACY;
@@ -1173,30 +1116,27 @@
 		break;
 
 	default:
-		
+
 		Assert(0);
 		return;
 	}
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, proposal_type))
 	{
-		
+
 		sint32 regard_cost = GetViolationRegardCost(foreignerId, proposal_type);
-		
-		
+
 		sint32 trust_cost = GetViolationTrustCost(foreignerId, proposal_type);
 
 		if (trust_message != NULL && trust_cost != 0)
 		{
 			SlicObject *so = new SlicObject(trust_message) ;
-			so->AddCivilisation(foreignerId) ;		
+			so->AddCivilisation(foreignerId) ;
 			so->AddCivilisation(m_playerId) ;
 			so->AddRecipient(foreignerId);
 			g_slicEngine->Execute(so) ;
 		}
 
-		
 		const DiplomacyProposalRecord * rec = g_theDiplomacyProposalDB->Get(s_proposalTypeToElemIndex[proposal_type]);
 		const MBCHAR * reason = g_theStringDB->GetNameStr(strId);
 		if (rec->GetTrustViolationGlobal())
@@ -1207,28 +1147,24 @@
 		{
 			ApplyTrustChange(foreignerId, trust_cost, reason);
 		}
-		
+
 		LogRegardEvent( foreignerId, regard_cost, regard_event_type, strId);
 
-		
 		UpdateRegard( foreignerId );
-		
-		
+
 		AgreementMatrix::s_agreements.CancelAgreement(m_playerId, foreignerId, proposal_type);
 		AgreementMatrix::s_agreements.CancelAgreement(foreignerId, m_playerId, proposal_type);
 	}
 
-	
-	bool war_declared = 
+	bool war_declared =
 		AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR);
 
-	sint32 turnsatwar = 
+	sint32 turnsatwar =
 		AgreementMatrix::s_agreements.TurnsAtWar(m_playerId, foreignerId);
 
-	
 	if (act_of_war)
 	{
-		
+
 		ai::Agreement war_agreement = AgreementMatrix::s_agreements.GetAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR);
 		if (!war_declared || (turnsatwar == 0 && war_agreement.senderId != m_playerId))
 		{
@@ -1241,85 +1177,75 @@
 					REGARD_EVENT_MILITARY_SAFETY,
 					strId);
 			}
-		
+
 			sint32 trust_cost;
 			if (GetCurrentDiplomacy(foreignerId).GetPreemptiveAttackTrustCost(trust_cost))
 			{
-				Diplomat::ApplyGlobalTrustChange(foreignerId, static_cast<ai::Regard>(trust_cost), 
+				Diplomat::ApplyGlobalTrustChange(foreignerId, static_cast<ai::Regard>(trust_cost),
 												 "Made preemptive attack without declaring war first."
 												);
 			}
 		}
 	}
 
-	
 	if (act_of_war && !war_declared)
 	{
-		
+
 		DeclareWar(foreignerId);
 	}
 }
 
-
 const ai::Regard Diplomat::GetPublicRegard( const PLAYER_INDEX & foreignerId,
 								  const REGARD_EVENT_TYPE &type) const {
 	ai::Regard regard = m_foreigners[foreignerId].GetPublicRegard(type);
 
-	
 	if (foreignerId == 0)
 		return MIN_REGARD;
 
-	
 	if (m_playerId == 0)
 		return MIN_REGARD;
-	
-	
-	if ((regard > HOTWAR_REGARD) && 
+
+	if ((regard > HOTWAR_REGARD) &&
 		AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR))
 	{
 		regard = HOTWAR_REGARD;
 	}
-	
+
 	else if ((regard <= HOTWAR_REGARD) &&
 		AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_PEACE))
 	{
-		
+
 		regard = HOTWAR_REGARD + 1;
 	}
-	
+
 	else if ((regard <= COLDWAR_REGARD) &&
 		(AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_ALLIANCE) ||
 		 AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_RESEARCH_PACT) ||
 		 AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_MILITARY_PACT)))
 	{
-		
+
 		regard = COLDWAR_REGARD + 1;
 	}
 	return regard;
 }
 
 
-
 StringId Diplomat::ExplainRegard( const PLAYER_INDEX &foreignerId,
 								  const REGARD_EVENT_TYPE &type) const {
 	return m_foreigners[foreignerId].GetBestRegardExplain(type);
 }
 
-
 const ai::Regard Diplomat::GetEffectiveRegard( const PLAYER_INDEX & foreignerId) const {
 
-	
 	if (foreignerId == 0)
 		return MIN_REGARD;
 
-	
 	if (m_playerId == 0)
 		return MIN_REGARD;
 
 	return m_foreigners[foreignerId].GetEffectiveRegard();
 }
 
-
 void Diplomat::ApplyGlobalTrustChange(const PLAYER_INDEX & foreignerId, const ai::Regard &trust_delta, const MBCHAR *reason)
 {
 #ifndef _BFR_
@@ -1339,7 +1265,6 @@
 	}
 }
 
-
 void Diplomat::ApplyTrustChange(const PLAYER_INDEX & foreignerId, const ai::Regard &trust_delta, const MBCHAR *reason)
 {
 #ifndef _BFR_
@@ -1350,7 +1275,7 @@
 	}
 #endif
 
-	ai::Regard new_trust = 
+	ai::Regard new_trust =
         std::min<ai::Regard>(m_foreigners[foreignerId].GetTrust() + trust_delta,
                              MAX_REGARD
                             );
@@ -1358,8 +1283,7 @@
 	m_foreigners[foreignerId].SetTrust(new_trust);
 }
 
-
-const ai::Regard Diplomat::GetTrust(const PLAYER_INDEX & foreignerId) const 
+const ai::Regard Diplomat::GetTrust(const PLAYER_INDEX & foreignerId) const
 {
 	if (foreignerId == PLAYER_INDEX_VANDALS)
 		return MIN_REGARD;
@@ -1367,12 +1291,10 @@
 	return m_foreigners[foreignerId].GetTrust();
 }
 
-
 void Diplomat::SetTrust(const PLAYER_INDEX & foreignerId, const ai::Regard &trust) {
 	m_foreigners[foreignerId].SetTrust(trust);
 }
 
-
 ai::Regard Diplomat::GetBaseRegard(const PLAYER_INDEX foreignerId) const
 {
 	if (AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_ALLIANCE))
@@ -1390,27 +1312,26 @@
 		return COLDWAR_REGARD;
 	}
 
-	
-    
-	
-	
-	
-	
-	
+
+
+
+
+
+
+
 
 	return NEUTRAL_REGARD;
 }
 
-
-void Diplomat::RecomputeRegard() 
+void Diplomat::RecomputeRegard()
 {
 	sint32 wonder_regard = wonderutil_GetIncreaseRegard(g_player[m_playerId]->GetBuiltWonders());
 
-	for (size_t foreigner = 1; foreigner < m_foreigners.size(); ++foreigner) 
+	for (size_t foreigner = 1; foreigner < m_foreigners.size(); ++foreigner)
 	{
 		PLAYER_INDEX const  foreignerId = static_cast<PLAYER_INDEX>(foreigner);
-		
-		if (    (m_playerId != foreignerId) 
+
+		if (    (m_playerId != foreignerId)
 		     && g_player[foreignerId] != NULL
 		     && g_player[m_playerId]->HasContactWith(foreignerId)
 		   )
@@ -1420,41 +1341,37 @@
 				StringId strId;
 				g_theStringDB->GetStringID("REGARD_EVENT_WONDER",strId);
 				Diplomat::GetDiplomat(foreignerId).
-					LogRegardEvent(m_playerId, 
-					wonder_regard, 
+					LogRegardEvent(m_playerId,
+					wonder_regard,
 					REGARD_EVENT_DIPLOMACY,
 					strId,
 					1);
 			}
 
 			ai::Regard baseRegard = GetBaseRegard(foreignerId);
-			
+
 			m_foreigners[foreigner].RecomputeRegard
-                (m_diplomacy[foreigner], 
+                (m_diplomacy[foreigner],
 				 NewTurnCount::GetCurrentRound(),
 				 baseRegard
                 );
 		}
 
-	} 
+	}
 
-	
 	ClearEffectiveRegardCache();
 }
 
-
 void Diplomat::UpdateRegard(const PLAYER_INDEX foreignerId)
 {
 	Assert(foreignerId >= 0);
 	Assert(static_cast<size_t>(foreignerId) < m_foreigners.size());
 
-	
 	if (foreignerId < 0 || static_cast<size_t>(foreignerId) > m_foreigners.size())
 		return;
 
 	ai::Regard baseRegard = GetBaseRegard(foreignerId);
 
-	
 	m_foreigners[foreignerId].
 		RecomputeRegard(m_diplomacy[foreignerId], -1, baseRegard);
 }
@@ -1464,27 +1381,25 @@
 
 
 
-sint32 Diplomat::AddAgreement(const PLAYER_INDEX & foreignerId) 
+sint32 Diplomat::AddAgreement(const PLAYER_INDEX & foreignerId)
 {
-	
+
 	ClearEffectiveRegardCache();
 
 	ai::Agreement agreement;
 
-	const Response & receiver_response = 
+	const Response & receiver_response =
 		GetDiplomat(foreignerId).GetMyLastResponse(m_playerId);
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		GetMyLastNewProposal(foreignerId);
-	const Response & sender_response = 
+	const Response & sender_response =
 		GetMyLastResponse(foreignerId);
 
-	
-	if ( receiver_response.type == RESPONSE_ACCEPT ) 
+	if ( receiver_response.type == RESPONSE_ACCEPT )
 	{
 		agreement.proposal = sender_proposal.detail;
 		agreement.explainStrId = sender_proposal.explainStrId;
 
-		
 		if (sender_response.type == RESPONSE_THREATEN)
 		{
 			agreement.newsStrId = sender_response.newsStrId;
@@ -1494,7 +1409,7 @@
 			agreement.newsStrId = sender_proposal.newsStrId;
 		}
 	}
-	
+
 	else if ( receiver_response.type == RESPONSE_COUNTER &&
 			  sender_response.type == RESPONSE_ACCEPT )
 	{
@@ -1502,10 +1417,10 @@
 		agreement.explainStrId = receiver_response.explainStrId;
 		agreement.newsStrId = receiver_response.newsStrId;
 	}
-	
+
 	else
 	{
-		
+
 		Assert(false);
 		return -1;
 	}
@@ -1513,15 +1428,13 @@
 	Player * player_ptr = g_player[m_playerId];
 	Assert(player_ptr != NULL);
 
-	
 	agreement.id = GetNextId();
 	agreement.senderId = m_playerId;
 	agreement.receiverId = foreignerId;
 	agreement.start = static_cast<sint16>(player_ptr->GetCurRound());
-	
-	agreement.end = -1; 
 
-	
+	agreement.end = -1;
+
 	NegotiationEvent negotiation_event;
 	negotiation_event.proposal = sender_proposal;
 	negotiation_event.response = receiver_response;
@@ -1529,30 +1442,28 @@
 	negotiation_event.round = static_cast<sint16>(NewTurnCount::GetCurrentRound());
 	AddNewNegotiationEvent(foreignerId, negotiation_event);
 
-	
 	if (Execute_Agreement( agreement ))
 	{
-		
+
 		AgreementMatrix::s_agreements.SetAgreement( agreement );
 	}
 
 	return agreement.id;
 }
 
-
 void Diplomat::EnactStopPiracy(const PLAYER_INDEX victimId, const PLAYER_INDEX pirateId)
 {
 	Player * player_ptr = g_player[victimId];
 	Assert(player_ptr);
 
 	sint32 const num_cities = player_ptr ? player_ptr->m_all_cities->Num() : 0;
-	
+
 	for (sint32 i = 0; i < num_cities; i++)
 	{
 		Unit city = player_ptr->m_all_cities->Access(i);
 		Assert(city.IsValid());
-		
-		for (sint32 r = 0; r < city.CD()->GetTradeSourceList()->Num(); ++r) 
+
+		for (sint32 r = 0; r < city.CD()->GetTradeSourceList()->Num(); ++r)
 		{
 			TradeRoute  route = city.CD()->GetTradeSourceList()->Access(r);
 			Army        army  = route->GetPiratingArmy();
@@ -1566,12 +1477,11 @@
 					 GEA_End
                     );
 			}
-		} 
-	} 
+		}
+	}
 }
 
 
-
 bool Diplomat::CanAfford( const PLAYER_INDEX senderId,
 						  const PLAYER_INDEX receiverId,
 						  const ProposalData & proposal ) const
@@ -1581,7 +1491,7 @@
 		proposal.first_type == PROPOSAL_OFFER_GIVE_GOLD &&
 		proposal.first_arg.gold > g_player[senderId]->m_gold->GetLevel())
 		return false;
-	
+
 	if (senderId != -1 &&
 		proposal.second_type == PROPOSAL_OFFER_GIVE_GOLD &&
 		proposal.second_arg.gold > g_player[senderId]->m_gold->GetLevel())
@@ -1600,24 +1510,22 @@
 	return true;
 }
 
-
 bool Diplomat::Execute_Agreement( const ai::Agreement & agreement )
 {
-	
+
 	if (!CanAfford(agreement.senderId, agreement.receiverId, agreement.proposal))
 		return false;
 
-	Execute_Proposal( agreement.senderId, 
+	Execute_Proposal( agreement.senderId,
 					  agreement.receiverId,
 					  agreement.proposal.first_type,
 					  agreement.proposal.first_arg );
 
-	Execute_Proposal( agreement.senderId, 
+	Execute_Proposal( agreement.senderId,
 					  agreement.receiverId,
 					  agreement.proposal.second_type,
 					  agreement.proposal.second_arg );
 
-	
 	DiplomacyResult senderResult;
 	DiplomacyResult receiverResult;
 	StringId strId;
@@ -1627,11 +1535,10 @@
 	proposal.detail = agreement.proposal;
 	ProposalAnalysis::ComputeResult( proposal, senderResult, receiverResult);
 
-	
 	if (receiverResult.regard < 0)
 	{
 		g_theStringDB->GetStringID("REGARD_EVENT_NEGATIVE_RECEIVER_DIPLOMACY_RESULT",strId);
-		Diplomat::GetDiplomat(agreement.receiverId).LogRegardEvent( agreement.senderId,	
+		Diplomat::GetDiplomat(agreement.receiverId).LogRegardEvent( agreement.senderId,
 			receiverResult.regard, REGARD_EVENT_DIPLOMACY, strId);
 	}
 	else if (receiverResult.regard > 0)
@@ -1644,25 +1551,24 @@
 	if (senderResult.regard < 0)
 	{
 		g_theStringDB->GetStringID("REGARD_EVENT_NEGATIVE_SENDER_DIPLOMACY_RESULT",strId);
-		Diplomat::GetDiplomat(agreement.senderId).LogRegardEvent( agreement.receiverId, 
+		Diplomat::GetDiplomat(agreement.senderId).LogRegardEvent( agreement.receiverId,
 			senderResult.regard, REGARD_EVENT_DIPLOMACY, strId);
 	}
 	else if (senderResult.regard > 0)
 	{
 		g_theStringDB->GetStringID("REGARD_EVENT_POSITIVE_SENDER_DIPLOMACY_RESULT",strId);
-		Diplomat::GetDiplomat(agreement.senderId).LogRegardEvent( agreement.receiverId, 
+		Diplomat::GetDiplomat(agreement.senderId).LogRegardEvent( agreement.receiverId,
 			senderResult.regard, REGARD_EVENT_DIPLOMACY, strId);
 	}
 	return true;
 }
 
-
 void Diplomat::Execute_Proposal( const PLAYER_INDEX & sender,
 								 const PLAYER_INDEX & receiver,
 								 const PROPOSAL_TYPE & proposal_type,
 								 const DiplomacyArg & proposal_arg )
 {
-	
+
 	Assert(g_player[receiver]);
 	Assert(g_player[sender]);
 	if (g_player[sender] == NULL || g_player[receiver] == NULL)
@@ -1673,69 +1579,69 @@
 	case PROPOSAL_NONE:
 		break;
 	case PROPOSAL_OFFER_GIVE_CITY:
-		
+
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_GiveCity,
 			GEA_City, proposal_arg.cityId,
 			GEA_Player, receiver,
 			GEA_End);
 		break;
 	case PROPOSAL_REQUEST_GIVE_CITY:
-		
+
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_GiveCity,
 			GEA_City, proposal_arg.cityId,
 			GEA_Player, sender,
 			GEA_End);
 		break;
 	case PROPOSAL_OFFER_WITHDRAW_TROOPS:
-		
+
 		break;
 	case PROPOSAL_REQUEST_WITHDRAW_TROOPS:
-		
+
 		break;
 	case PROPOSAL_OFFER_STOP_PIRACY:
-		
+
 		EnactStopPiracy(receiver, sender);
 		break;
 	case PROPOSAL_REQUEST_STOP_PIRACY:
-		
+
 		EnactStopPiracy(sender, receiver);
 		break;
 	case PROPOSAL_OFFER_BREAK_AGREEMENT:
-		
+
 		AgreementMatrix::s_agreements.BreakAgreements(sender, proposal_arg.playerId);
 		break;
 	case PROPOSAL_REQUEST_BREAK_AGREEMENT:
-		
+
 		AgreementMatrix::s_agreements.BreakAgreements(receiver, proposal_arg.playerId);
 		break;
 	case PROPOSAL_OFFER_STOP_RESEARCH:
-		
+
 		break;
 	case PROPOSAL_REQUEST_STOP_RESEARCH:
-		
+
 		break;
 	case PROPOSAL_OFFER_REDUCE_NUCLEAR_WEAPONS:
-		
+
 		Diplomat::GetDiplomat(sender).DisbandNuclearWeapons(proposal_arg.percent);
 		break;
 	case PROPOSAL_REQUEST_REDUCE_NUCLEAR_WEAPONS:
-		
+
 		Diplomat::GetDiplomat(receiver).DisbandNuclearWeapons(proposal_arg.percent);
 		break;
 	case PROPOSAL_OFFER_REDUCE_BIO_WEAPONS:
-		
+
 		Diplomat::GetDiplomat(sender).DisbandBioWeapons(proposal_arg.percent);
 		break;
 	case PROPOSAL_REQUEST_REDUCE_BIO_WEAPONS:
-		
+
 		Diplomat::GetDiplomat(receiver).DisbandBioWeapons(proposal_arg.percent);
 		break;
 	case PROPOSAL_OFFER_REDUCE_NANO_WEAPONS:
-		
+
 		Diplomat::GetDiplomat(sender).DisbandNanoWeapons(proposal_arg.percent);
 		break;
 	case PROPOSAL_REQUEST_REDUCE_NANO_WEAPONS:
-		
+
 		Diplomat::GetDiplomat(receiver).DisbandNanoWeapons(proposal_arg.percent);
 		break;
 	case PROPOSAL_OFFER_GIVE_ADVANCE:
@@ -1753,10 +1659,9 @@
 			GEA_End);
 		break;
 	case PROPOSAL_OFFER_GIVE_GOLD:
-		
+
 		gold = std::min(proposal_arg.gold, g_player[sender]->m_gold->GetLevel());
 
-		
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_SubGold,
 			GEA_Player, sender,
 			GEA_Int, gold,
@@ -1768,10 +1673,9 @@
 			GEA_End);
 		break;
 	case PROPOSAL_REQUEST_GIVE_GOLD:
-		
+
 		gold = std::min(proposal_arg.gold, g_player[receiver]->m_gold->GetLevel());
 
-		
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_SubGold,
 			GEA_Player, receiver,
 			GEA_Int, gold,
@@ -1783,48 +1687,48 @@
 			GEA_End);
 		break;
 	case PROPOSAL_OFFER_REDUCE_POLLUTION:
-		
+
 		break;
 	case PROPOSAL_REQUEST_REDUCE_POLLUTION:
-		
+
 		break;
 	case PROPOSAL_OFFER_MAP:
-		
+
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_GiveMap,
 			GEA_Player, sender,
 			GEA_Player, receiver,
 			GEA_End);
 		break;
 	case PROPOSAL_REQUEST_MAP:
-		
+
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_GiveMap,
 			GEA_Player, receiver,
 			GEA_Player, sender,
 			GEA_End);
 		break;
-		
+
 	case PROPOSAL_OFFER_HONOR_MILITARY_AGREEMENT:
 		Diplomat::GetDiplomat(sender).DeclareWar(proposal_arg.playerId);
 		break;
-		
+
 	case PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT:
 		Diplomat::GetDiplomat(receiver).DeclareWar(proposal_arg.playerId);
 		break;
-		
+
 	case PROPOSAL_OFFER_HONOR_POLLUTION_AGREEMENT:
 		break;
-		
+
 	case PROPOSAL_REQUEST_HONOR_POLLUTION_AGREEMENT:
 		break;
-		
+
 	case PROPOSAL_OFFER_END_EMBARGO:
 		Diplomat::GetDiplomat(sender).SetEmbargo(receiver, false);
 		break;
-		
+
 	case PROPOSAL_REQUEST_END_EMBARGO:
 		Diplomat::GetDiplomat(receiver).SetEmbargo(sender, false);
 		break;
-	
+
 	case PROPOSAL_TREATY_DECLARE_WAR:
 		DeclareWar(proposal_arg.playerId);
 		break;
@@ -1854,24 +1758,21 @@
 	case PROPOSAL_TREATY_POLLUTION_PACT:
 		break;
 	case PROPOSAL_TREATY_ALLIANCE:
-		
-		
+
 		break;
 	case PROPOSAL_MAX:
 	default:
-		
+
 		Assert(0);
 	}
 }
 
-
 void Diplomat::DeclareWar(const PLAYER_INDEX foreignerId)
 {
 	Player * player_ptr = g_player[m_playerId];
 	Player * foreigner_ptr = g_player[foreignerId];
 	bool NO_CONTACT_DECLARE_WAR = false;
 
-	
 	if (foreignerId != 0)
 	{
 		if (!player_ptr || !player_ptr->HasContactWith(foreignerId))
@@ -1879,7 +1780,7 @@
 			Assert(NO_CONTACT_DECLARE_WAR)
 			return;
 		}
-		
+
 		if (!foreigner_ptr || !foreigner_ptr->HasContactWith(m_playerId))
 		{
 			Assert(NO_CONTACT_DECLARE_WAR)
@@ -1887,35 +1788,32 @@
 		}
 	}
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR))
 		return;
 
-	
 	if (m_playerId != 0 && foreignerId != 0)
 	{
 		SlicObject *so;
-		
+
 		if (foreignerId == g_selected_item->GetCurPlayer())
 		{
-			
+
 			so = new SlicObject((MBCHAR *)"DIPLOMACY_POPUP_DECLARE_WAR");
 			so->AddRecipient(foreignerId);
 			so->AddCivilisation(foreignerId) ;
 			so->AddCivilisation(m_playerId) ;
 			g_slicEngine->Execute(so);
 
-			
 			so = new SlicObject((MBCHAR *)"128CivStartedWar");
 			so->AddAllRecipientsBut(m_playerId, foreignerId);
 			so->AddCivilisation(m_playerId) ;
 			so->AddCivilisation(foreignerId) ;
 			g_slicEngine->Execute(so);
 		}
-		
+
 		else
 		{
-			
+
 			so = new SlicObject((MBCHAR *)"128CivStartedWar");
 			so->AddAllRecipientsBut(m_playerId);
 			so->AddCivilisation(m_playerId) ;
@@ -1933,19 +1831,15 @@
 
 	AgreementMatrix::s_agreements.SetAgreement(agreement);
 
-	
 	AgreementMatrix::s_agreements.
 		CancelAgreement(m_playerId, foreignerId, PROPOSAL_OFFER_WITHDRAW_TROOPS);
 
-	
 	AgreementMatrix::s_agreements.
 		CancelAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_PEACE);
 
-	
 	AgreementMatrix::s_agreements.
 		CancelAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_CEASEFIRE);
 
-		
 	AgreementMatrix::s_agreements.
 		CancelAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_TRADE_PACT);
 
@@ -1964,33 +1858,28 @@
 		g_network.Unblock(m_playerId);
 	}
 
-    
     g_theTradePool->BreakOffTrade(m_playerId, foreignerId);
 
-	
 	player_ptr->CloseEmbassy(foreignerId);
 	foreigner_ptr->CloseEmbassy(m_playerId);
 }
 
-
 void Diplomat::SetEmbargo(const PLAYER_INDEX foreignerId, const bool state)
 {
 	Diplomat & foreigner = Diplomat::GetDiplomat(foreignerId);
 
 	if (state == true && !m_foreigners[foreignerId].GetEmbargo())
 	{
-		
+
 		Threat threat;
 		threat.id = GetNextId();
 		threat.senderId = m_playerId;
 		threat.receiverId = foreignerId;
 		threat.start = static_cast<sint16>(NewTurnCount::GetCurrentRound());
-		threat.end = -1; 
-		
-		
+		threat.end = -1;
+
 		m_threats.push_back(threat);
 
-		
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_TRADE_PACT);
 
 		sint32 regard_cost = 0;
@@ -1998,23 +1887,22 @@
 		{
 			StringId strId;
 			g_theStringDB->GetStringID("REGARD_EVENT_EMBARGO_TRADE", strId);
-			foreigner.LogRegardEvent(m_playerId, 
-				regard_cost, 
-				REGARD_EVENT_GOLD, 
+			foreigner.LogRegardEvent(m_playerId,
+				regard_cost,
+				REGARD_EVENT_GOLD,
 				strId,
-				1); 
+				1);
 		}
-		
+
 		g_theTradePool->BreakOffTrade(m_playerId, foreignerId);
 	}
 
 	m_foreigners[foreignerId].SetEmbargo(state);
 }
 
-
 bool Diplomat::GetEmbargo(const PLAYER_INDEX foreignerId) const
 {
-	
+
 	if (AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR))
 		return true;
 	return m_foreigners[foreignerId].GetEmbargo();
@@ -2027,17 +1915,17 @@
 
 void Diplomat::AddRejection(const PLAYER_INDEX & foreignerId)
 {
-	const Response & receiver_response = 
+	const Response & receiver_response =
 		GetDiplomat(foreignerId).GetMyLastResponse(m_playerId);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		GetMyLastNewProposal(foreignerId);
 
-	
-	
 
-	
-	
+
+
+
+
 	if (sender_proposal.detail.first_type == PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT ||
 		sender_proposal.detail.second_type == PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT)
 	{
@@ -2056,7 +1944,6 @@
 		LogViolationEvent(foreignerId, PROPOSAL_TREATY_POLLUTION_PACT);
 	}
 
-	
 	sint32 regard_cost = GetViolationRegardCost(foreignerId, sender_proposal.detail.first_type) / 3;
 	if (regard_cost <= 0)
 	{
@@ -2065,7 +1952,6 @@
 		LogRegardEvent( foreignerId, regard_cost, REGARD_EVENT_DIPLOMACY, strId);
 	}
 
-	
 	NegotiationEvent negotiation_event;
 	negotiation_event.proposal = sender_proposal;
 	negotiation_event.response = receiver_response;
@@ -2080,7 +1966,7 @@
 
 const Threat & Diplomat::GetThreatById(const sint32 & id) const {
 	static Threat bad_threat;
-	
+
 	ThreatList::const_iterator found = std::find(m_threats.begin(), m_threats.end(), id);
 	if (found != m_threats.end())
 		return *found;
@@ -2088,34 +1974,31 @@
 		return bad_threat;
 }
 
-
 void Diplomat::RemoveThreatById(const sint32 & id) {
-	
+
 	ThreatList::iterator found = std::find(m_threats.begin(), m_threats.end(), id);
 	if (found != m_threats.end())
 		m_threats.erase(found);
 	else
 	{
-		
+
 		Assert(0);
 	}
 }
 
-
 sint32 Diplomat::AddThreat(const PLAYER_INDEX & foreignerId) {
 
 	Threat threat;
 
-	const Response & receiver_response = 
+	const Response & receiver_response =
 		GetDiplomat(foreignerId).GetMyLastResponse(m_playerId);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		GetMyLastNewProposal(foreignerId);
 
-	const Response & sender_response = 
+	const Response & sender_response =
 		GetMyLastResponse(foreignerId);
 
-	
 	if ( sender_response.type == RESPONSE_THREATEN &&
 		 receiver_response.type != RESPONSE_ACCEPT )
 	{
@@ -2125,19 +2008,17 @@
 	}
 	else
 	{
-		
+
 		Assert(false);
 		return -1;
 	}
 
-	
 	threat.id = GetNextId();
 	threat.senderId = m_playerId;
 	threat.receiverId = foreignerId;
 	threat.start = static_cast<sint16>(NewTurnCount::GetCurrentRound());
-	threat.end = -1; 
+	threat.end = -1;
 
-	
 	NegotiationEvent negotiation_event;
 	negotiation_event.proposal = sender_proposal;
 	negotiation_event.response = receiver_response;
@@ -2145,42 +2026,37 @@
 	negotiation_event.round = static_cast<sint16>(NewTurnCount::GetCurrentRound());
 	AddNewNegotiationEvent(foreignerId, negotiation_event);
 
-	
 	if (!ExecuteThreat(threat))
-		
+
 		m_threats.push_back(threat);
 
 	return threat.id;
 }
 
-
 const Diplomat::ThreatList & Diplomat::GetThreatList() const {
 	return m_threats;
 }
 
-
 bool Diplomat::LaunchNuclearAttackOnCity(const Unit & city)
 {
 	Assert(g_player[m_playerId]);
 	Player *player_ptr = g_player[m_playerId];
-	
+
 	Assert(city.m_id != 0x0);
 	if (city.m_id == 0x0)
 		return false;
 
-	
 	TargetNuclearAttack(city.GetOwner(), false);
-	
-	
+
 	sint32 num_units = player_ptr->m_all_units->Num();
-	
+
 	for (sint32 i = 0; i < num_units; i++)
 	{
 		Unit tmp_unit = player_ptr->m_all_units->Access(i);
 		Assert(tmp_unit.IsValid());
 
-		if (tmp_unit.IsValid() && tmp_unit.GetDBRec()->HasNuclearAttack()) 
-        {		
+		if (tmp_unit.IsValid() && tmp_unit.GetDBRec()->HasNuclearAttack())
+        {
 		    if (tmp_unit->GetTargetCity().m_id == city.m_id)
 		    {
 		        unitutil_ExecuteMadLaunch(tmp_unit);
@@ -2192,11 +2068,10 @@
 	return false;
 }
 
-
 bool Diplomat::ExecuteThreat(const Threat & threat)
 {
 #if 0   // unused
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		GetMyLastNewProposal(threat.receiverId);
 #endif
 	const Diplomat & receiver_diplomat = Diplomat::GetDiplomat(threat.receiverId);
@@ -2213,28 +2088,27 @@
 		trust_cost /= 2;
 		str_buf = "Threatened to destroy our city.";
 		break;
-	
-		
-		
-	
-	
-	
-	
-		
-		
-	
-	
-	
+
+
+
+
+
+
+
+
+
+
+
+
 	case THREAT_TRADE_EMBARGO:
-		
+
 		receiver_diplomat.GetCurrentDiplomacy(threat.senderId).GetEmbargoTradeRegardCost(regard_cost);
 		receiver_diplomat.GetCurrentDiplomacy(threat.senderId).GetFollowThroughTrustBonus(trust_cost);
 		trust_cost /= -2;
 		str_buf = "Threatened to embargo trade.";
 		break;
 	case THREAT_DECLARE_WAR:
-		
-		
+
 		receiver_diplomat.GetCurrentDiplomacy(threat.senderId).GetPreemptiveAttackRegardCost(regard_cost);
 		receiver_diplomat.GetCurrentDiplomacy(threat.senderId).GetPreemptiveAttackTrustCost(trust_cost);
 		trust_cost /= 2;
@@ -2242,12 +2116,11 @@
 		break;
 	}
 
-	
 	g_theStringDB->GetStringID("REGARD_EVENT_NEGATIVE_RECEIVER_DIPLOMACY_RESULT", strId);
-	
+
 	Diplomat::GetDiplomat(threat.receiverId).
-		LogRegardEvent(threat.senderId, 
-		regard_cost, 
+		LogRegardEvent(threat.senderId,
+		regard_cost,
 		REGARD_EVENT_DIPLOMACY,
 		strId);
 
@@ -2258,7 +2131,6 @@
 }
 
 
-
 bool Diplomat::HasThreat(const PLAYER_INDEX & foreignerId,
 						 const THREAT_TYPE type,
 						 Threat & threat) const
@@ -2279,41 +2151,38 @@
 	return false;
 }
 
-
 bool Diplomat::ComputeThreatResponse(const PLAYER_INDEX foreignerId, Response & threat_response) const
 {
-	
+
 	if (GetPersonality()->GetConquestPassive())
 		return false;
 
-	
 	ai::Regard regard = GetEffectiveRegard(foreignerId);
 	ai::Regard trust = GetTrust(foreignerId);
 
-	DIPLOMATIC_STRENGTH sender_strength = 
+	DIPLOMATIC_STRENGTH sender_strength =
 		g_player[m_playerId]->GetRelativeStrength(foreignerId);
-	
+
 	if (regard > FRIEND_REGARD)
 		{
-			
+
 			if (!GetPersonality()->GetAlignmentEvil() &&
 				!GetPersonality()->GetTrustworthinessChaotic())
 				 return false;
 		}
 	else if (regard > NEUTRAL_REGARD)
 		{
-			
+
 			if (!GetPersonality()->GetConquestAgressive() &&
 				!GetPersonality()->GetDiscoveryMilitary())
 				return false;
 
-			
 			if (sender_strength < DIPLOMATIC_STRENGTH_STRONG)
 				return false;
 		}
 	else if (regard > COLDWAR_REGARD)
 		{
-			
+
 			if (GetPersonality()->GetAlignmentGood() ||
 				GetPersonality()->GetConquestNeutral() ||
 				GetPersonality()->GetDiscoveryDiplomatic())
@@ -2326,10 +2195,9 @@
 #if 0 // unused
 	const Response & receiver_response = GetDiplomat(foreignerId).GetMyLastResponse(m_playerId);
 #endif
-	
+
 	ai::Agreement pact;
 
-	
 	bool has_pacts = GetAgreementToBreak(foreignerId, pact);
 
 	Unit atrisk_city;
@@ -2342,14 +2210,13 @@
 	sint32 turns_since_last_war = agreements.TurnsSinceLastWar(m_playerId, foreignerId);
 	bool threaten_declare_war = (turns_since_last_war > 5 || turns_since_last_war < 0);
 
-	bool has_more_nukes = 
+	bool has_more_nukes =
 		map_analysis.GetNuclearWeaponsCount(m_playerId) > map_analysis.GetNuclearWeaponsCount(foreignerId);
 	bool has_only_nano =
 		map_analysis.GetNanoWeaponsCount(m_playerId) && !map_analysis.GetNanoWeaponsCount(foreignerId);
 	bool has_only_bio =
 		map_analysis.GetBioWeaponsCount(m_playerId) && !map_analysis.GetBioWeaponsCount(foreignerId);
 
-	
 	if (GetPersonality()->GetTrustworthinessChaotic())
 	{
 		threaten_destroy_city = true;
@@ -2357,23 +2224,22 @@
 		threaten_pirate = true;
 		threaten_special_attack = true;
 	}
-	
+
 	else if (GetPersonality()->GetAlignmentEvil() ||
 			 GetPersonality()->GetConquestAgressive() ||
 			 GetPersonality()->GetDiscoveryMilitary())
 	{
-		
+
 		if (agreements.TurnsAtWar(m_playerId, foreignerId) >= 0)
 		{
-			
+
 			threaten_destroy_city &= (has_more_nukes || has_only_nano || has_only_bio);
 		}
 		else
 		{
 			threaten_destroy_city = false;
 			threaten_attack_city = false;
-			
-			
+
 			if (has_pacts || (regard > COLDWAR_REGARD))
 			{
 				threaten_pirate = false;
@@ -2384,14 +2250,14 @@
 			}
 		}
 	}
-	
+
 	else if (GetPersonality()->GetDiscoveryScientist()||
 		GetPersonality()->GetDiscoveryEconomic())
 	{
-		
+
 		if (agreements.TurnsAtWar(m_playerId, foreignerId) > 50)
 		{
-			
+
 			threaten_destroy_city = (regard < HOTWAR_REGARD && trust < HOTWAR_REGARD);
 			threaten_destroy_city &= (has_more_nukes || has_only_nano || has_only_bio);
 		}
@@ -2407,24 +2273,20 @@
 			}
 		}
 
-		
 		threaten_embargo = false;
 		threaten_pirate = false;
 	}
 
-	
 	else if (GetPersonality()->GetDiscoveryDiplomatic() &&
 		GetPersonality()->GetAlignmentNeutral())
 	{
-		
+
 		if (agreements.TurnsAtWar(m_playerId, foreignerId) > 75)
 		{
-			
-			
+
 			threaten_destroy_city = (trust < MIN_REGARD) && (regard < HOTWAR_REGARD);
 			threaten_destroy_city &= (has_more_nukes || has_only_nano || has_only_bio);
-			
-			
+
 			threaten_attack_city &= (trust <= HOTWAR_REGARD) || (regard < HOTWAR_REGARD);
 		}
 		else
@@ -2436,21 +2298,20 @@
 				threaten_special_attack = false;
 				threaten_declare_war = false;
 				threaten_pirate = false;
-				
+
 				threaten_embargo = false;
 			}
 		}
 	}
 
-	
 	if (GetPersonality()->GetAlignmentGood())
 	{
-		
+
 		if (agreements.TurnsAtWar(m_playerId, foreignerId) > 150)
 		{
 			if ((trust > MIN_REGARD) && (regard >= MIN_REGARD))
 			{
-				
+
 				threaten_destroy_city = false;
 				threaten_attack_city = false;
 				threaten_special_attack = false;
@@ -2472,12 +2333,10 @@
 		}
 	}
 
-	
 	threat_response.senderId = m_playerId;
 	threat_response.senderId = foreignerId;
 	threat_response.priority = 1;
 
-	
 	if (threaten_destroy_city)
 	{
 		NukeTargetList nuke_city_list;
@@ -2501,34 +2360,34 @@
 			return true;
 		}
 	}
-	
-	
-	
-	
-	
+
+
+
+
+
 	else if (threaten_declare_war)
 	{
 		threat_response.threat.type = THREAT_DECLARE_WAR;
 		return true;
 	}
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 	else if (threaten_embargo)
 	{
 		threat_response.threat.type = THREAT_TRADE_EMBARGO;
@@ -2538,7 +2397,6 @@
 	return false;
 }
 
-
 bool Diplomat::GetAgreementToBreak(const PLAYER_INDEX foreignerId, ai::Agreement & pact) const
 {
 	const AgreementMatrix & agreements = AgreementMatrix::s_agreements;
@@ -2574,29 +2432,27 @@
 		return true;
 	}
 
-
 	return false;
 }
-	
 
 
 
-			
+
+
 
 void Diplomat::ConsiderResponse( const PLAYER_INDEX & foreignId,
-								 const Response & response ) 
+								 const Response & response )
 {
-	
+
 	if (response.priority <= 0)
 		return;
 
-	Diplomat & sender_diplomat = 
+	Diplomat & sender_diplomat =
 		Diplomat::GetDiplomat(response.senderId);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(m_playerId);
 
-	
 	if (response.type == RESPONSE_ACCEPT &&
 		!CanAfford(-1, sender_proposal.receiverId, sender_proposal.detail))
 		return;
@@ -2607,8 +2463,7 @@
 	Assert(response.senderId != -1);
 	Assert(response.receiverId != -1);
 
-	
-	
+
 	m_foreigners[foreignId].ConsiderResponse(response);
 
 	DPRINTF(k_DBG_DIPLOMACY,("  Player %d considers Response: %s for player %d.\n",
@@ -2616,29 +2471,25 @@
 
 }
 
-
-void Diplomat::ConsiderResponse( const PLAYER_INDEX senderId, 
+void Diplomat::ConsiderResponse( const PLAYER_INDEX senderId,
 								 const RESPONSE_TYPE response_type,
 								 const sint32 priority)
 {
 	Assert(response_type == RESPONSE_REJECT || response_type == RESPONSE_ACCEPT);
-	
-	
+
 	if (priority <= 0)
 		return;
 
 	Response response;
-	
+
 	response.priority = static_cast<sint16>(priority);
 	response.receiverId = m_playerId;
 	response.senderId = senderId;
 	response.type = response_type;
-	
-	
+
 	ConsiderResponse( senderId, response);
 }
 
-
 void Diplomat::ConsiderCounterResponse( const PLAYER_INDEX senderId,
 									    const PROPOSAL_TYPE counterProposalType,
 									    const DiplomacyArg & argument,
@@ -2646,7 +2497,6 @@
 										const DIPLOMATIC_TONE tone)
 {
 
-	
 	if (priority <= 0)
 		return;
 
@@ -2658,7 +2508,7 @@
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(senderId);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(m_playerId);
 
 	if (sender_proposal.detail.second_type == counterProposalType &&
@@ -2670,30 +2520,24 @@
 	{
 		response.type = RESPONSE_COUNTER;
 
-		
 		response.counter = sender_proposal.detail;
 
-		
 		response.counter.tone = tone;
-		
-		
+
 		response.counter.second_type = counterProposalType;
 		response.counter.second_arg = argument;
 	}
-	
-	
+
 	ConsiderResponse(senderId, response);
 }
 
-
 const Response & Diplomat::GetMyLastResponse(const PLAYER_INDEX & foreignId) const {
 	return m_foreigners[foreignId].GetMyLastResponse();
 }
 
-
-void Diplomat::SetMyLastResponse( const PLAYER_INDEX & foreignId, 
+void Diplomat::SetMyLastResponse( const PLAYER_INDEX & foreignId,
 								  const Response & response ) {
-	m_foreigners[foreignId].SetMyLastResponse(response);	
+	m_foreigners[foreignId].SetMyLastResponse(response);
 
 	DPRINTF(k_DBG_DIPLOMACY,("  Player %d sets Response: %s for player %d.\n",
 			m_playerId, s_responseNames[response.type].c_str(), foreignId));
@@ -2705,7 +2549,6 @@
 	}
 }
 
-
 void Diplomat::ExecuteResponse( const PLAYER_INDEX sender,
 								const PLAYER_INDEX receiver )
 {
@@ -2714,7 +2557,6 @@
 	THREAT_TYPE threat_type;
 	PLAYER_INDEX other_player;
 
-	
 	if (m_playerId == sender)
 	{
 		response = GetMyLastResponse(receiver);
@@ -2778,12 +2620,10 @@
 		bool NO_RESPONSE_FOUND = false;
 		Assert(NO_RESPONSE_FOUND);
 
-		
 		response.type = RESPONSE_REJECT;
 	}
 
-	
-	
+
 	if (response.type == RESPONSE_ACCEPT) {
 
 		DPRINTF(k_DBG_DIPLOMACY, ("\n"));
@@ -2791,17 +2631,15 @@
 			static_cast<sint32>(m_playerId)));
 		DPRINTF(k_DBG_DIPLOMACY, ("    (new agreement created)\n\n"));
 
-		
-		
-		
-		
+
+
+
+
 		DipWizard::NotifyResponse(response, m_playerId, other_player);
 		g_network.NotifyDiplomacyResponse(response, m_playerId, other_player);
 
-		
 		Diplomat::GetDiplomat(sender).AddAgreement(receiver);
 
-		
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ContinueDiplomacy,
 			GEA_Player, sender,
 			GEA_Player, receiver,
@@ -2810,58 +2648,51 @@
 		return;
 	}
 
-	
 	else if ( (response.type == RESPONSE_REJECT) &&
 			  (m_playerId == sender) ) {
-		
+
 		DPRINTF(k_DBG_DIPLOMACY, ("\n"));
 		DPRINTF(k_DBG_DIPLOMACY, (">>> Agreement REJECTED by player %d.\n\n",
 			static_cast<sint32>(m_playerId)));
 
-		
-		
-		
-		
+
+
+
+
 		if (other_response == RESPONSE_COUNTER)
 		{
 			DipWizard::NotifyResponse(response, m_playerId, other_player);
 			g_network.NotifyDiplomacyResponse(response, m_playerId, other_player);
 		}
 
-		
 		Diplomat::GetDiplomat(sender).AddRejection(receiver);
 
-		
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ContinueDiplomacy,
 			GEA_Player, sender,
 			GEA_Player, receiver,
 			GEA_End);
-		
+
 		return;
 	} else {
 		g_network.NotifyDiplomacyResponse(response, m_playerId, other_player);
 	}
 
-	
 	const Response & sender_response =
 		Diplomat::GetDiplomat(sender).GetMyLastResponse(receiver);
 	if ( (response.type != RESPONSE_ACCEPT) &&
 		 (m_playerId == receiver) &&
 		 (sender_response.type == RESPONSE_THREATEN)) {
-		
+
 		DPRINTF(k_DBG_DIPLOMACY, ("\n"));
 		DPRINTF(k_DBG_DIPLOMACY, (">>> Threat REJECTED by player %d.\n",
 			static_cast<sint32>(m_playerId)));
 		DPRINTF(k_DBG_DIPLOMACY, ("    (new threat created)\n\n"));
 
-		
 		DipWizard::NotifyThreatRejected(response, sender_response, m_playerId, other_player);
 		g_network.NotifyDiplomacyThreatRejected(response, sender_response, m_playerId, other_player);
 
-		
 		Diplomat::GetDiplomat(sender).AddThreat(receiver);
 
-		
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ContinueDiplomacy,
 			GEA_Player, sender,
 			GEA_Player, receiver,
@@ -2877,7 +2708,7 @@
 
 	switch (response.type) {
 	case RESPONSE_REJECT:
-		
+
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_Reject,
 			GEA_Player, sender,
 			GEA_Player, receiver,
@@ -2885,8 +2716,7 @@
 		break;
 
 	case RESPONSE_COUNTER:
-		
-		
+
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_Counter,
 			GEA_Player, sender,
 			GEA_Player, receiver,
@@ -2895,7 +2725,7 @@
 		break;
 
 	case RESPONSE_THREATEN:
-		
+
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_Threaten,
 			GEA_Player, sender,
 			GEA_Player, receiver,
@@ -2904,7 +2734,7 @@
 	}
 }
 
-	
+
 
 
 const Response & Diplomat::GetResponsePending(const PLAYER_INDEX foreignerId) const
@@ -2913,13 +2743,12 @@
 
 	if (response != s_badResponse)
 	{
-		
+
 		if (response.senderId == m_playerId &&
 			GetReceiverHasInitiative(foreignerId) == false)
 			return s_badResponse;
 
-		
-		
+
 		if (response.receiverId == m_playerId &&
 			GetDiplomat(response.senderId).GetReceiverHasInitiative(m_playerId) == true)
 			return s_badResponse;
@@ -2927,7 +2756,6 @@
 
 	return response;
 }
-	
 
 const Response & Diplomat::GetResponse(const PLAYER_INDEX foreignerId) const
 {
@@ -2935,13 +2763,12 @@
 
 	if (response != s_badResponse)
 	{
-		
+
 		if (response.senderId == m_playerId &&
 			GetReceiverHasInitiative(foreignerId) == true)
 			return s_badResponse;
 
-		
-		
+
 		if (response.receiverId == m_playerId &&
 			GetDiplomat(response.senderId).GetReceiverHasInitiative(m_playerId) == false)
 			return s_badResponse;
@@ -2949,7 +2776,6 @@
 
 	return response;
 }
-	
 
 void Diplomat::ExecuteResponse(const Response & response, bool runAI)
 {
@@ -2980,7 +2806,7 @@
 	}
 	else
 	{
-		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ResponseReady, 
+		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ResponseReady,
 							   GEA_Player, response.senderId,
 							   GEA_Player, response.receiverId,
 							   GEA_End);
@@ -2992,16 +2818,16 @@
 	m_motivations.push_back(motivation);
 	DPRINTF(k_DBG_DIPLOMACY,(" Player %d consider motivation: %s.\n",
 			m_playerId, s_motivationNames[motivation.type].c_str()));
-} 
+}
 
-sint32 Diplomat::GetMotivationCount() const 
+sint32 Diplomat::GetMotivationCount() const
 {
 	return (m_motivations.size());
 }
 
-void Diplomat::SortMotivations() 
+void Diplomat::SortMotivations()
 {
-	
+
 	m_motivations.sort();
 }
 
@@ -3015,10 +2841,9 @@
 
 StringId Diplomat::GetDiplomacyAdvice(SlicContext & sc, const PLAYER_INDEX & foreignerId) const
 {
-	
+
 	sc.AddPlayer(m_playerId);
 
-	
 	if (foreignerId == m_playerId || foreignerId <= 0)
 	{
 		if (m_motivations.size() > 0)
@@ -3027,15 +2852,14 @@
 			return motivation.adviceStrId;
 		}
 	}
-	
+
 	else
 	{
-		
+
 		sc.AddPlayer(foreignerId);
 
 		MotivationList::const_iterator motivation_iter = m_lastMotivation[foreignerId];
 
-		
 		const NewProposal & new_proposal = GetMyLastNewProposal(foreignerId);
 		if (new_proposal.adviceStrId != -1)
 		{
@@ -3043,22 +2867,20 @@
 			Diplomat::AddDiplomacyArgToSlicContext(sc, new_proposal.detail.second_arg);
 			return new_proposal.adviceStrId;
 		}
-		
-		
+
 		else if (motivation_iter != m_motivations.end())
 		{
 			return m_lastMotivation[foreignerId]->adviceStrId;
 		}
-		
-		
-		
+
+
 		else
 		{
 			return m_diplomaticStates[foreignerId].adviceStrId;
 		}
-			
+
 	}
-	
+
 	return -1;
 }
 
@@ -3080,67 +2902,61 @@
 	if (motivation_iter != m_motivations.end())
 		topMotivation = *motivation_iter;
 
-	
-	
 
-	
+
+
+
 	bool end_diplomacy = false;
-	if ( Diplomat::GetDiplomat(foreignerId).GetMyLastResponse(m_playerId).type 
+	if ( Diplomat::GetDiplomat(foreignerId).GetMyLastResponse(m_playerId).type
 		 == RESPONSE_REJECT )
 		{
 			end_diplomacy = true;
-			response = RESPONSE_REJECT; 
+			response = RESPONSE_REJECT;
 		}
-	
-	else if ( ( Diplomat::GetDiplomat(foreignerId).GetMyLastResponse(m_playerId).type 
+
+	else if ( ( Diplomat::GetDiplomat(foreignerId).GetMyLastResponse(m_playerId).type
 				== RESPONSE_COUNTER ) &&
 			  ( Diplomat::GetDiplomat(m_playerId).GetMyLastResponse(foreignerId).type
 				== RESPONSE_REJECT ) )
 		{
 			end_diplomacy = true;
-			response = RESPONSE_REJECT; 
+			response = RESPONSE_REJECT;
 		}
 
-	
 	else if ( ( Diplomat::GetDiplomat(m_playerId).GetMyLastResponse(foreignerId).type
 				== RESPONSE_THREATEN ) &&
 			  ( Diplomat::GetDiplomat(m_playerId).GetMyLastResponse(foreignerId).type
 				!= RESPONSE_ACCEPT ) )
 		{
 			end_diplomacy = true;
-			response = RESPONSE_REJECT; 
+			response = RESPONSE_REJECT;
 		}
 	else
 		{
 			end_diplomacy = false;
-			response = RESPONSE_ACCEPT; 
+			response = RESPONSE_ACCEPT;
 		}
 
-	
-	SetMyLastNegotiatedProposal( foreignerId, 
-								 GetMyLastNewProposal(foreignerId).detail, 
+	SetMyLastNegotiatedProposal( foreignerId,
+								 GetMyLastNewProposal(foreignerId).detail,
 								 response );
 
-	
 	SetMyLastResponse( foreignerId, Diplomat::s_badResponse);
 	SetMyLastNewProposal( foreignerId, Diplomat::s_badNewProposal);
 
-	
-	if ( motivation_iter != m_motivations.end() ) 
+	if ( motivation_iter != m_motivations.end() )
 	{
 		motivation_iter++;
 		m_lastMotivation[foreignerId] = motivation_iter;
 	}
 	else
 	{
-		
+
 		end_diplomacy = true;
 	}
 
-	
 	m_outstandingProposals--;
 
-	
 	if (end_diplomacy)
 	{
 		if((g_turn->IsHotSeat()
@@ -3168,42 +2984,39 @@
 	}
 }
 
-
 bool Diplomat::StartNegotiations(const PLAYER_INDEX hotseat_foreignerId)
 {
 	Player *    player_ptr  = g_player[m_playerId];
 	Assert(player_ptr);
 
 	m_outstandingProposals = 0;
-	
+
 	if (g_network.IsHost() && !g_network.IsLocalPlayer(m_playerId)) {
-		
+
 		return false;
 	}
 
 	bool        found       = false;
-	
-	for 
+
+	for
     (
-        size_t foreignerIndex = 1; 
-        foreignerIndex < m_foreigners.size(); 
+        size_t foreignerIndex = 1;
+        foreignerIndex < m_foreigners.size();
         ++foreignerIndex
-    ) 
+    )
 	{
 		PLAYER_INDEX    foreignerId = static_cast<PLAYER_INDEX>(foreignerIndex);
 
         if (foreignerId == m_playerId)
 			continue;
 
-		
 		Player * foreigner_ptr = g_player[foreignerIndex];
 		if (foreigner_ptr == NULL)
 			continue;
 
-		
 		if (g_turn->IsHotSeat() || g_turn->IsEmail())
 		{
-			
+
 			if (hotseat_foreignerId != PLAYER_UNASSIGNED)
 			{
 				if (hotseat_foreignerId != foreignerId)
@@ -3213,11 +3026,10 @@
 				continue;
 		}
 
-		
 	//	Modification by Peter Triggs
-	//	from >=0 pt: 
-	//	if player has contact with foreignerId, 
-	//	set m_lastMotivation[foreignerId] = the player's top motivation 
+	//	from >=0 pt:
+	//	if player has contact with foreignerId,
+	//	set m_lastMotivation[foreignerId] = the player's top motivation
 	//	and choose a new proposal for foreignerId
 		if (m_foreigners[foreignerIndex].GetTurnsSinceGreeting() >= -1 &&
 			g_player[m_playerId] && g_player[m_playerId]->HasContactWith(foreignerId))
@@ -3225,7 +3037,7 @@
 			m_lastMotivation[foreignerIndex] = m_motivations.begin();
 
 			DPRINTF(k_DBG_AI, ("(Start Negotiations)%d choosing proposal for foreigner %d\n",m_playerId,foreignerId));
-			
+
 			ChooseNewProposal(foreignerId);
 			found = true;
 		}
@@ -3238,7 +3050,6 @@
 	return found;
 }
 
-
 bool Diplomat::InvalidNewProposal(const PLAYER_INDEX & foreignerId, const DiplomacyProposalRecord *rec) const
 {
 	if (foreignerId == PLAYER_UNASSIGNED)
@@ -3257,18 +3068,15 @@
 	if (foreigner_ptr == NULL)
 		return true;
 
-	
 	if (rec->GetHasPollution() &&
 		player_ptr->GetPollutionLevel() <= 0 &&
 		foreigner_ptr->GetPollutionLevel() <= 0)
 		return true;
 
-	
 	if (rec->GetHasEmbassy() &&
 		!player_ptr->HasEmbassyWith(foreignerId))
 		return true;
 
-	
 	if (rec->GetHasHotwar() &&
 		!AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR))
 		return true;
@@ -3294,7 +3102,6 @@
 		!AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_POLLUTION_PACT))
 		return true;
 
-	
 	if (rec->GetClassTreaty())
 	{
 		if ((rec == m_diplomacy[foreignerId].GetProposalElement(s_proposalTypeToElemIndex[PROPOSAL_TREATY_CEASEFIRE])->GetProposal()) &&
@@ -3324,11 +3131,11 @@
 
 	if (rec->GetCategoryGift())
 	{
-		
+
 		if (rec->GetHasAlly() &&
 			!AgreementMatrix::s_agreements.HasAgreement(foreignerId, PROPOSAL_TREATY_ALLIANCE))
 			return true;
-		
+
 		if (rec->GetHasBorderIncursion() &&
 			!foreign_diplomat.GetBorderIncursionBy(m_playerId))
 			return true;
@@ -3355,15 +3162,15 @@
 	}
 	else if (rec->GetCategoryRequest())
 	{
-		
+
 		if (rec->GetHasAlly() &&
 			!AgreementMatrix::s_agreements.HasAgreement(m_playerId, PROPOSAL_TREATY_ALLIANCE))
 			return true;
 
-		
-		
-		
-		
+
+
+
+
 
 		if (rec->GetIsPirating() &&
 			!MapAnalysis::GetMapAnalysis().GetMaxPiracyLoss(m_playerId))
@@ -3387,28 +3194,24 @@
 	}
 	else
 	{
-		
+
 	}
 	return false;
 }
 
-
 void Diplomat::ChooseNewProposal(const PLAYER_INDEX & foreignerId) {
 
-	
-	
+
+
 
 	DPRINTF(k_DBG_DIPLOMACY,("Player %d choosing new proposal for player %d\n",m_playerId, foreignerId));
 
-	
 	SetMyLastNewProposal( foreignerId, Diplomat::s_badNewProposal );
 
-	
 	SetReceiverHasInitiative(foreignerId, false);
 
 	MotivationList::iterator motivation_iter = m_lastMotivation[foreignerId];
 
-	
 	if (motivation_iter == m_motivations.end())
 		{
 			DPRINTF(k_DBG_DIPLOMACY,("  No Motivations.\n"));
@@ -3417,14 +3220,14 @@
 		{
 			Motivation topMotivation = *motivation_iter;
 			GAME_EVENT motivation_event = static_cast<GAME_EVENT>(0);
-	
+
 			switch (topMotivation.type)
 			{
 			case MOTIVATION_NONE:
-				
+
 				Assert(0);
 				break;
-			
+
 			case MOTIVATION_FEAR_SCENARIO:
 			case MOTIVATION_FEAR_INVASION:
 			case MOTIVATION_FEAR_CITY_DEFENSE:
@@ -3438,7 +3241,7 @@
 			case MOTIVATION_FEAR_POLLUTION:
 				motivation_event = GEV_FearMotivation;
 				break;
-			
+
 			case MOTIVATION_DESIRE_SCENARIO:
 			case MOTIVATION_DESIRE_ATTACK:
 			case MOTIVATION_DESIRE_ATTACK_CITY:
@@ -3452,14 +3255,13 @@
 				motivation_event = GEV_DesireMotivation;
 				break;
 			case MOTIVATION_MAX:
-				
+
 				Assert(0);
 			}
 
 			DPRINTF(k_DBG_DIPLOMACY,("  Player %d has top motivation: %s.\n",
 									 m_playerId, s_motivationNames[topMotivation.type].c_str()));
 
-			
 			g_gevManager->AddEvent(GEV_INSERT_Tail, motivation_event,
 								   GEA_Player, m_playerId,
 								   GEA_Player, foreignerId,
@@ -3468,31 +3270,26 @@
 
 		}
 
-	
-	
+
 	g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ReactionMotivation,
 		GEA_Player, m_playerId,
 		GEA_Player, foreignerId,
 		GEA_End);
 
-	
 	m_outstandingProposals++;
 }
 
 
-
 void Diplomat::ConsiderNewProposal( const PLAYER_INDEX & foreignerId,
 									const NewProposal & newProposal ) {
 
 	Assert(newProposal.senderId != -1);
 	Assert(newProposal.receiverId != -1);
 
-	
 	if (!CanAfford(newProposal.senderId, -1, newProposal.detail))
 		return;
 
-	
-	
+
 	m_foreigners[foreignerId].ConsiderNewProposal(newProposal);
 
 	DPRINTF(k_DBG_DIPLOMACY,("  Player %d considers New Proposal for player %d: first  = %s .\n",
@@ -3502,13 +3299,11 @@
 
 }
 
-
 const NewProposal & Diplomat::GetMyLastNewProposal(const PLAYER_INDEX & foreignerId) const {
 	return (m_foreigners[foreignerId].GetMyLastNewProposal());
 }
 
-
-void Diplomat::SetMyLastNewProposal( const PLAYER_INDEX & foreignerId, 
+void Diplomat::SetMyLastNewProposal( const PLAYER_INDEX & foreignerId,
 									 const NewProposal & newProposal ) {
 	m_foreigners[foreignerId].SetMyLastNewProposal(newProposal);
 
@@ -3551,11 +3346,9 @@
 {
 	SetMyLastResponse( receiver, Diplomat::s_badResponse );
 	GetDiplomat(receiver).SetMyLastResponse(m_playerId, Diplomat::s_badResponse );
-	
-	
+
 	SetReceiverHasInitiative(receiver, true);
 
-	
 	NewProposal proposal = m_foreigners[receiver].GetMyLastNewProposal();
 	proposal.id = GetNextId();
 	m_foreigners[receiver].SetMyLastNewProposal(proposal);
@@ -3565,7 +3358,6 @@
 	DPRINTF(k_DBG_DIPLOMACY,("                                               second = %s.\n",
 			s_proposalNames[GetMyLastNewProposal(receiver).detail.second_type].c_str()));
 
-	
 	// Added for PBEM and HotSeat human-human diplomacy support.
 	if((g_turn->IsEmail()
 	||  g_turn->IsHotSeat())
@@ -3590,23 +3382,20 @@
 #endif // _BFR_
 }
 
-
-void Diplomat::SetMyLastNegotiatedProposal( const PLAYER_INDEX & foreignerId, 
-										    const ProposalData & data, 
+void Diplomat::SetMyLastNegotiatedProposal( const PLAYER_INDEX & foreignerId,
+										    const ProposalData & data,
 										    const RESPONSE_TYPE & response )
 {
 	m_foreigners[foreignerId].SetMyLastNegotiatedProposal(data,response);
 }
-	
 
-RESPONSE_TYPE Diplomat::GetMyLastNegotiatedProposal( const PLAYER_INDEX & foreignerId, 
+RESPONSE_TYPE Diplomat::GetMyLastNegotiatedProposal( const PLAYER_INDEX & foreignerId,
 													 ProposalData & data ) const
 {
 	return m_foreigners[foreignerId].GetMyLastNegotiatedProposal(data);
 }
 
 
-
 bool Diplomat::GetNewProposalTimeout( const NewProposal & newProposal, const sint16 timeout_period ) const
 {
 	if (m_foreigners[newProposal.receiverId].GetNewProposalTimeout( newProposal, timeout_period))
@@ -3614,25 +3403,23 @@
 	return false;
 }
 
-
 const NegotiationEventList & Diplomat::GetNegotiationEvents( const PLAYER_INDEX & foreignerId ) const
 {
 	return m_foreigners[foreignerId].GetNegotiationEvents();
 }
 
-
-sint32 Diplomat::GetNewProposalPriority(const PLAYER_INDEX foreignerId, 
+sint32 Diplomat::GetNewProposalPriority(const PLAYER_INDEX foreignerId,
 							  const PROPOSAL_TYPE proposalType ) const
 {
 	Assert(s_proposalTypeToElemIndex[proposalType] < m_diplomacy[foreignerId].GetNumProposalElement());
-	
+
 	const DiplomacyRecord::ProposalElement * elem =
 		m_diplomacy[foreignerId].GetProposalElement(s_proposalTypeToElemIndex[proposalType]);
 
 //
 	if (elem == NULL)
 		return -1;
-//	
+//
 	const DiplomacyProposalRecord * rec = elem->GetProposal();
 	if (InvalidNewProposal(foreignerId, rec))
 		return -1;
@@ -3642,11 +3429,11 @@
 	return priority;
 }
 
-sint32 Diplomat::GetAcceptPriority(const PLAYER_INDEX foreignerId, 
+sint32 Diplomat::GetAcceptPriority(const PLAYER_INDEX foreignerId,
 						 const PROPOSAL_TYPE proposalType ) const
 {
 	Assert(s_proposalTypeToElemIndex[proposalType] < m_diplomacy[foreignerId].GetNumProposalElement());
-	
+
 	const DiplomacyRecord::ProposalElement * elem =
 		m_diplomacy[foreignerId].GetProposalElement(s_proposalTypeToElemIndex[proposalType]);
 	sint32 value;
@@ -3654,40 +3441,37 @@
 	return value;
 }
 
-
-sint32 Diplomat::GetRejectPriority(const PLAYER_INDEX foreignerId, 
+sint32 Diplomat::GetRejectPriority(const PLAYER_INDEX foreignerId,
 						 const PROPOSAL_TYPE proposalType ) const
 {
 	Assert(s_proposalTypeToElemIndex[proposalType] < m_diplomacy[foreignerId].GetNumProposalElement());
-	
+
 	const DiplomacyRecord::ProposalElement * elem =
 		m_diplomacy[foreignerId].GetProposalElement(s_proposalTypeToElemIndex[proposalType]);
-	
+
 	sint32 value;
 	elem->GetRejectPriority(value);
 	return value;
 }
 
-
-sint32 Diplomat::GetSenderRegardResult(const PLAYER_INDEX foreignerId, 
+sint32 Diplomat::GetSenderRegardResult(const PLAYER_INDEX foreignerId,
 							 const PROPOSAL_TYPE proposalType ) const
 {
 	Assert(s_proposalTypeToElemIndex[proposalType] < m_diplomacy[foreignerId].GetNumProposalElement());
-	
+
 	const DiplomacyRecord::ProposalElement * elem =
 		m_diplomacy[foreignerId].GetProposalElement(s_proposalTypeToElemIndex[proposalType]);
-	
+
 	sint32 value;
 	elem->GetSenderRegardResult(value);
 	return value;
 }
 
-
-sint32 Diplomat::GetReceiverRegardResult(const PLAYER_INDEX foreignerId, 
+sint32 Diplomat::GetReceiverRegardResult(const PLAYER_INDEX foreignerId,
 							   const PROPOSAL_TYPE proposalType ) const
 {
 	Assert(s_proposalTypeToElemIndex[proposalType] < m_diplomacy[foreignerId].GetNumProposalElement());
-	
+
 	const DiplomacyRecord::ProposalElement * elem =
 		m_diplomacy[foreignerId].GetProposalElement(s_proposalTypeToElemIndex[proposalType]);
 
@@ -3699,12 +3483,11 @@
 	return value;
 }
 
-
-sint32 Diplomat::GetViolationRegardCost(const PLAYER_INDEX foreignerId, 
+sint32 Diplomat::GetViolationRegardCost(const PLAYER_INDEX foreignerId,
 							  const PROPOSAL_TYPE proposalType ) const
 {
 	Assert(s_proposalTypeToElemIndex[proposalType] < m_diplomacy[foreignerId].GetNumProposalElement());
-	
+
 	const DiplomacyRecord::ProposalElement * elem =
 		m_diplomacy[foreignerId].GetProposalElement(s_proposalTypeToElemIndex[proposalType]);
 
@@ -3713,12 +3496,11 @@
 	return value;
 }
 
-
-sint32 Diplomat::GetViolationTrustCost(const PLAYER_INDEX foreignerId, 
+sint32 Diplomat::GetViolationTrustCost(const PLAYER_INDEX foreignerId,
 							 const PROPOSAL_TYPE proposalType ) const
 {
 	Assert(s_proposalTypeToElemIndex[proposalType] < m_diplomacy[foreignerId].GetNumProposalElement());
-	
+
 	const DiplomacyRecord::ProposalElement * elem =
 		m_diplomacy[foreignerId].GetProposalElement(s_proposalTypeToElemIndex[proposalType]);
 
@@ -3736,13 +3518,12 @@
 
 	if (new_proposal != s_badNewProposal)
 	{
-		
+
 		if (new_proposal.senderId == m_playerId &&
 			GetReceiverHasInitiative(foreignerId) == false)
 			return s_badNewProposal;
 
-		
-		
+
 		if (new_proposal.receiverId == m_playerId &&
 			GetDiplomat(new_proposal.senderId).GetReceiverHasInitiative(m_playerId) == true)
 			return s_badNewProposal;
@@ -3751,20 +3532,18 @@
 	return new_proposal;
 }
 
-
 const NewProposal & Diplomat::GetNewProposalAdvice(const PLAYER_INDEX foreignerId) const
 {
 	const NewProposal & new_proposal = GetMyLastNewProposal(foreignerId);
 
 	if (new_proposal != s_badNewProposal)
 	{
-		
+
 		if (new_proposal.senderId == m_playerId &&
 			GetReceiverHasInitiative(foreignerId) == true)
 			return s_badNewProposal;
 
-		
-		
+
 		if (new_proposal.receiverId == m_playerId &&
 			GetDiplomat(new_proposal.senderId).GetReceiverHasInitiative(m_playerId) == false)
 			return s_badNewProposal;
@@ -3775,16 +3554,14 @@
 
 void Diplomat::InitStrategicState() {
 
-	
-	
 
-	
+
+
+
 	Assert(m_playerId >=0);
 
-	
 	m_bestStrategicStates.clear();
 
-	
 	if (GetPersonality()->GetIndex() == 0)
 	{
 		sint32 index;
@@ -3794,7 +3571,6 @@
 	else
 	{
 
-		
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_InitStrategicState,
 							   GEA_Player, m_playerId,
 							   GEA_End);
@@ -3802,17 +3578,15 @@
 
 }
 
-
 void Diplomat::NextStrategicState() {
 
-	
-	
 
-	
+
+
+
 	m_bestStrategicStates.clear();
-		
 
-	
+
 	if (GetPersonality()->GetIndex() == 0)
 	{
 		sint32 index;
@@ -3821,14 +3595,13 @@
 	}
 	else
 	{
-		
+
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_NextStrategicState,
 							   GEA_Player, m_playerId,
 							   GEA_End);
 	}
 }
 
-
 void Diplomat::ConsiderStrategicState( const AiState & state )
 {
 	if (state.dbIndex < 0)
@@ -3838,7 +3611,7 @@
 		return;
 	}
 
-	AiStateList::iterator ai_state_iter = 
+	AiStateList::iterator ai_state_iter =
 		m_bestStrategicStates.begin();
 
 	while(ai_state_iter != m_bestStrategicStates.end())
@@ -3914,15 +3687,15 @@
 
 void Diplomat::MergeStrategy(const sint32 index) {
 	const StrategyRecord *strategy = g_theStrategyDB->Get(index);
-	
+
 	if (strategy && strategy->GetNumInherit() > 0) {
 		const StrategyRecord *inherit_strategy = strategy->GetInherit(0);
-		
+
 		MergeStrategy(inherit_strategy->GetIndex());
 		m_strategy.Merge(*strategy);
 	}
 	else if(strategy) {
-		
+
 		m_strategy.Merge(*strategy);
 	}
 }
@@ -3933,14 +3706,13 @@
 
 
 
-void Diplomat::InitDiplomaticState(const PLAYER_INDEX & foreignerId) 
+void Diplomat::InitDiplomaticState(const PLAYER_INDEX & foreignerId)
 {
 	m_bestDiplomaticState           = s_badAiState;
 	m_diplomaticStates[foreignerId] = s_badAiState;
 
-	
 	if (    g_player[m_playerId]             // Maybe this should be caught earlier
-		 && g_player[foreignerId] 
+		 && g_player[foreignerId]
          && !g_player[foreignerId]->IsDead()
          && (foreignerId != m_playerId)
        )
@@ -3953,21 +3725,20 @@
     }
 }
 
-
-void Diplomat::NextDiplomaticState( const PLAYER_INDEX & foreignerId ) 
+void Diplomat::NextDiplomaticState( const PLAYER_INDEX & foreignerId )
 {
 	m_bestDiplomaticState = s_badAiState;
-	
+
 	g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_NextDiplomaticState,
                            GEA_Player, m_playerId,
                            GEA_Player, foreignerId,
 			               GEA_End
                           );
-    
+
     /// @todo Make this a game setting. It is not really a user profile setting.
-    sint32 const        baseExpiryTurn = 
+    sint32 const        baseExpiryTurn =
         g_theProfileDB->GetValueByName("AutoExpireTreatyBase");
-    
+
     if (k_EXPIRATION_NEVER == baseExpiryTurn)
     {
         // No action: agreements will not be terminated automatically.
@@ -3982,16 +3753,16 @@
 	    for (sint32 prop_index = 1; prop_index < PROPOSAL_MAX; ++prop_index)
         {
             PROPOSAL_TYPE const prop_type   = static_cast<PROPOSAL_TYPE>(prop_index);
-    
+
 	        if (AgreementMatrix::s_agreements.HasAgreement
                     (m_playerId, foreignerId, prop_type)
-               ) 
+               )
             {
 			    sint32 const    duration        =
                     AgreementMatrix::s_agreements.GetAgreementDuration
                         (m_playerId, foreignerId, prop_type);
-				    
-                sint32 const    expiryTurn      = 
+
+                sint32 const    expiryTurn      =
                     ProposalAutoExpiryTurn(baseExpiryTurn, prop_type);
 
                 if (duration == expiryTurn)
@@ -4013,36 +3784,29 @@
     }
 }
 
-
 void Diplomat::ConsiderDiplomaticState( const PLAYER_INDEX & foreignerId, const AiState & state ) {
-	
-	
-	if (m_bestDiplomaticState.priority < state.priority) 
+
+	if (m_bestDiplomaticState.priority < state.priority)
 		m_bestDiplomaticState = state;
 }
-	
 
 const AiState & Diplomat::GetBestDiplomaticState() const {
 	return m_bestDiplomaticState;
 }
 
-
 const AiState & Diplomat::GetCurrentDiplomaticState( const PLAYER_INDEX & foreignerId ) const {
 	return m_diplomaticStates[foreignerId];
 }
 
-
 void Diplomat::SetDiplomaticState(const PLAYER_INDEX & foreignerId, const AiState & newState ) {
 	if (newState != s_badAiState) {
 		m_diplomaticStates[foreignerId] = newState;
 
-		
 		Assert(newState.dbIndex >= 0);
 		if (newState.dbIndex >= 0)
 			ChangeDiplomacy(foreignerId, newState.dbIndex);
 	}
 
-	
 	if(    g_player[m_playerId]
 	&& (   g_player[m_playerId]->IsRobot()
 	&&  ( !g_network.IsActive()
@@ -4056,23 +3820,20 @@
 		{
 			declare_war = false;
 
-			
-			
-			sint32 turns_since_last_war = 
+
+			sint32 turns_since_last_war =
 				AgreementMatrix::s_agreements.TurnsSinceLastWar(m_playerId, foreignerId);
 
-			
 			declare_war = TestPublicRegard(foreignerId, HOTWAR_REGARD);
-			
+
 			declare_war = declare_war && (turns_since_last_war > 5 || turns_since_last_war < 0);
-			
+
 			declare_war = declare_war && (AtWarCount() == 0);
-			
+
 			declare_war = declare_war && DesireWarWith(foreignerId);
-			
+
 			declare_war = declare_war && !m_personality->GetTrustworthinessChaotic();
-			
-			
+
 			Threat war_threat;
 			if (HasThreat(foreignerId, THREAT_DECLARE_WAR, war_threat))
 			{
@@ -4084,24 +3845,22 @@
 				}
 			}
 
-			
-			if (declare_war && 			
+			if (declare_war &&
 				wonderutil_GetCloseEmbassies(g_player[foreignerId]->GetBuiltWonders()))
 			{
 				declare_war = false;
 			}
 
-			if (declare_war) 
+			if (declare_war)
 			{
 				if(g_network.IsClient() && g_network.IsLocalPlayer(m_playerId)) {
 					g_network.SendAction(new NetAction(NET_ACTION_DECLARE_WAR, foreignerId));
 				}
-				
+
 				DeclareWar(foreignerId);
 			}
 		}
-		
-		
+
 		Threat embargo_threat;
 		if (HasThreat(foreignerId, THREAT_TRADE_EMBARGO, embargo_threat))
 		{
@@ -4113,53 +3872,49 @@
 					SetEmbargo(foreignerId, true);
 				}
 			}
-			
+
 			RemoveThreatById(embargo_threat.id);
 		}
 
 		Threat nuke_threat;
 		if (HasThreat(foreignerId, THREAT_DESTROY_CITY, nuke_threat))
 		{
-			if (declare_war && 
+			if (declare_war &&
 				MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(m_playerId) &&
 				g_theUnitPool->IsValid(nuke_threat.detail.arg.cityId))
 			{
-				
+
 				if (GetDiplomat(nuke_threat.receiverId).FearNukesFrom(m_playerId) ||
 					g_rand->Next(100) < m_personality->GetThreatFollowThrough() * 100)
 				{
-					
+
 					LaunchNuclearAttackOnCity(nuke_threat.detail.arg.cityId);
 				}
 			}
 
-			
 			RemoveThreatById(nuke_threat.id);
 		}
-	} 
+	}
 }
 
-
 const DiplomacyRecord & Diplomat::GetCurrentDiplomacy(const PLAYER_INDEX & foreignerId) const {
 	return m_diplomacy[foreignerId];
 }
 
-
 void Diplomat::ChangeDiplomacy(const PLAYER_INDEX & foreignerId, const sint32 index) {
 
-	
 	if (index < 0)
 		return;
 
 	const DiplomacyRecord *diplomacy = g_theDiplomacyDB->Get(index);
 	if (diplomacy->GetNumInherit() > 0) {
 		const DiplomacyRecord *inherit_diplomacy = diplomacy->GetInherit(0);
-		
+
 		ChangeDiplomacy(foreignerId, inherit_diplomacy->GetIndex());
 		m_diplomacy[foreignerId].Merge(*diplomacy);
 	}
 	else {
-		
+
 		m_diplomacy[foreignerId] = *diplomacy;
 	}
 }
@@ -4174,7 +3929,6 @@
 	if (g_player[m_playerId] == NULL)
 		return -1;
 
-	
 	const AdvanceListRecord *rec = m_strategy.GetResearchPtr();
 	if (rec == NULL)
 		return -1;
@@ -4192,7 +3946,6 @@
 	return -1;
 }
 
-
 sint32 Diplomat::GetDesiredAdvanceFrom( const PLAYER_INDEX & foreignerId, const sint32 min_cost, const sint32 max_cost ) const
 {
 	if (g_player[m_playerId] == NULL)
@@ -4211,36 +3964,30 @@
 	{
 		advance_index = rec->GetAdvance(wanted_advance)->GetIndex();
 
-		
 		if (rec->GetAdvance(wanted_advance)->GetCost() > max_cost)
 			continue;
 
-		
 		if (g_player[m_playerId]->HasAdvance(advance_index))
 			continue;
 
-		
 		if (!g_player[foreignerId]->HasAdvance(advance_index))
 			continue;
 
-		
 		break;
 	}
 
 	if (wanted_advance == rec->GetNumAdvance())
 	{
-		
+
 		return -1;
 	}
 
-	
 	return advance_index;
 }
 
-
 sint32 Diplomat::GetStopResearchingAdvance( const PLAYER_INDEX & foreignerId) const
 {
-	
+
 	Assert(g_player[m_playerId]);
 	Assert(g_player[foreignerId]);
 
@@ -4250,27 +3997,22 @@
 	if (g_player[foreignerId] == NULL)
 		return -1;
 
-	
 	AdvanceType foreigner_research = g_player[foreignerId]->m_advances->GetResearching();
 	AdvanceType my_research = g_player[m_playerId]->m_advances->GetResearching();
 
-	
 	const AdvanceListRecord *rec = m_strategy.GetStopResearchPtr();
 	if (rec == NULL)
 		return -1;
 
-	
 	sint32 max_cost = g_theAdvanceDB->Get(my_research)->GetCost();
 
-	
 	sint32 advance_index = -1;
 	for (sint32 stop_advance = 0; stop_advance < rec->GetNumAdvance(); stop_advance++)
 	{
-		
+
 		if (rec->GetAdvance(stop_advance)->GetIndex() != foreigner_research)
 			continue;
 
-		
 		if (rec->GetAdvance(stop_advance)->GetCost() > max_cost)
 			continue;
 
@@ -4281,7 +4023,6 @@
 	return advance_index;
 }
 
-
 sint32 Diplomat::GetNextKeyAdvance() const
 {
 	Assert(g_player[m_playerId]);
@@ -4296,7 +4037,7 @@
 	{
 		AdvanceRecord const *	rec = g_theAdvanceDB->Get(advance_index);
 
-		if (rec->HasKeyAdvanceAdvice() && 
+		if (rec->HasKeyAdvanceAdvice() &&
 			!g_player[m_playerId]->HasAdvance(advance_index)
 		   )
 		{
@@ -4307,7 +4048,6 @@
 	return -1;
 }
 
-
 StringId Diplomat::GetScienceAdvice(SlicContext & sc, StringId & advance_advice)
 {
 	static StringId enemyHasAdvanceAdvice = -1;
@@ -4316,16 +4056,14 @@
 	static StringId	nonProliferationAdvice = -1;
 	static StringId	manhattanProjectAdvice = -1;
 
-	stringutils_SetStaticStringId(enemyHasAdvanceAdvice, "ENEMY_HAS_ADVANCE_ADVICE");	
-	stringutils_SetStaticStringId(allyHasAdvanceAdvice, "ALLY_HAS_ADVANCE_ADVICE");	
+	stringutils_SetStaticStringId(enemyHasAdvanceAdvice, "ENEMY_HAS_ADVANCE_ADVICE");
+	stringutils_SetStaticStringId(allyHasAdvanceAdvice, "ALLY_HAS_ADVANCE_ADVICE");
 	stringutils_SetStaticStringId(keyAdvanceAdvice, "KEY_ADVANCE_ADVICE");
 	stringutils_SetStaticStringId(nonProliferationAdvice, "NON_PROLIFERATION_ADVICE");
 	stringutils_SetStaticStringId(manhattanProjectAdvice, "MANHATTAN_PROJECT_ADVICE");
 
-	
 	advance_advice = -1;
 
-	
 	sint32 stop_researching_adv;
 	uint32 foreignerId;
 	for (foreignerId = 1; foreignerId < s_theDiplomats.size(); foreignerId)
@@ -4334,12 +4072,12 @@
 			continue;
 
 		stop_researching_adv = GetStopResearchingAdvance(foreignerId);
-		
+
 		if (stop_researching_adv >= 0)
 		{
 			sc.AddPlayer(foreignerId);
 			sc.AddAdvance(stop_researching_adv);
-			
+
 			(void) g_theAdvanceDB->Get(stop_researching_adv)->GetKeyAdvanceAdvice(advance_advice);
 
 			if (g_player[m_playerId]->HasAdvance(stop_researching_adv))
@@ -4353,22 +4091,18 @@
 		}
 	}
 
-	
 	sint32 next_key_adv = GetNextKeyAdvance();
 
-	
 	if (next_key_adv != -1)
 	{
-		
+
 		sc.AddAdvance(next_key_adv);
 
-		
 		(void) g_theAdvanceDB->Get(next_key_adv)->GetKeyAdvanceAdvice(advance_advice);
-		
-		
+
 		ai::Regard best_enemy_regard = MAX_REGARD;
 		PLAYER_INDEX best_enemy = -1;
-		
+
 		ai::Regard best_friend_regard = MIN_REGARD;
 		PLAYER_INDEX best_friend = -1;
 
@@ -4381,7 +4115,6 @@
 				break;
 		}
 
-		
 		if (unit_type < g_theUnitDB->NumRecords())
 		{
 			sc.AddUnitRecord(unit_type);
@@ -4390,12 +4123,12 @@
 		{
 			sc.AddUnitRecord(0);
 		}
-		
+
 		ai::Regard regard;
 		for (foreignerId = 1; foreignerId < s_theDiplomats.size(); foreignerId++)
 		{
 			regard = GetEffectiveRegard(foreignerId);
-			
+
 			if ((g_player[foreignerId]->HasAdvance(next_key_adv)) &&
 				(regard < best_enemy_regard) &&
 				TestEffectiveRegard(foreignerId, COLDWAR_REGARD))
@@ -4403,7 +4136,7 @@
 				best_enemy_regard = regard;
 				best_enemy = foreignerId;
 			}
-			
+
 			if ((g_player[foreignerId]->HasAdvance(next_key_adv)) &&
 				(regard > best_friend_regard) &&
 				TestEffectiveRegard(foreignerId, NEUTRAL_REGARD))
@@ -4412,17 +4145,17 @@
 				best_friend = foreignerId;
 			}
 		}
-		
+
 		if (best_friend != -1)
 		{
 			sc.AddPlayer(best_friend);
-			
+
 			return allyHasAdvanceAdvice;
 		}
 		else if (best_enemy != -1)
 		{
 			sc.AddPlayer(best_enemy);
-			
+
 			return enemyHasAdvanceAdvice;
 		}
 		else
@@ -4431,9 +4164,9 @@
 		}
 	}
 
-	
 
-	
+
+
 
 	return -1;
 }
@@ -4441,64 +4174,59 @@
 
 
 
-	
 
-sint32 Diplomat::GetTradeFrom(const PLAYER_INDEX & foreignId) const 
+
+sint32 Diplomat::GetTradeFrom(const PLAYER_INDEX & foreignId) const
 {
 	return m_foreigners[foreignId].GetTradeFrom();
 }
 
-
-sint32 Diplomat::GetTributeFrom(const PLAYER_INDEX & foreignId) const 
+sint32 Diplomat::GetTributeFrom(const PLAYER_INDEX & foreignId) const
 {
 	return m_foreigners[foreignId].GetTributeFrom();
 }
 
-
-sint32 Diplomat::GetGoldSurplusPercent() const 
+sint32 Diplomat::GetGoldSurplusPercent() const
 {
 	Assert(g_player[m_playerId] != NULL);
 	Assert(g_player[m_playerId]->m_gold != NULL);
     sint32 lost_to_cleric;
 	sint32 lost_to_crime;
 	sint32 maintenance;
-	sint32 wages; 
-    sint32 science; 
-	sint32 old_savings; 
+	sint32 wages;
+    sint32 science;
+	sint32 old_savings;
 	sint32 current_savings;
 	sint32 income;
     g_player[m_playerId]->m_gold->
-		GetGoldLevels(&income, &lost_to_cleric, &lost_to_crime, &maintenance, 
-					  &wages, &science, &old_savings, &current_savings); 
+		GetGoldLevels(&income, &lost_to_cleric, &lost_to_crime, &maintenance,
+					  &wages, &science, &old_savings, &current_savings);
 
 	sint32 goldSpent = lost_to_cleric + lost_to_crime + maintenance + wages +
 		science;
 	return static_cast<sint32>(floor( (current_savings / goldSpent) * 100.0 ));
 }
 
-
 bool Diplomat::CanBuySurplus(const PLAYER_INDEX &foreignId) const {
     /// @todo Check meaning: always returns false now.
-	sint32 goldReserve = 100; 
-	sint32 minSurplusCost = 50; 
+	sint32 goldReserve = 100;
+	sint32 minSurplusCost = 50;
 	return ((minSurplusCost > 0) && (minSurplusCost > goldReserve));
 }
 
-
 sint32 Diplomat::GetAdvanceLevelPercent(const PLAYER_INDEX &foreignId) const {
 	sint32 foreign_advances;
 	if (g_player[foreignId] != NULL && (g_player[foreignId]->IsDead() == FALSE) )
-		
+
 		foreign_advances = g_player[foreignId]->NumAdvances();
-	else 
+	else
 		return 0;
 	Assert(g_player[m_playerId] != NULL);
 	sint32 my_advances = g_player[m_playerId]->NumAdvances();
 	return static_cast<sint32>(floor((foreign_advances/ my_advances) * 100.0));
 }
 
-
-sint32 Diplomat::AtWarCount() const 
+sint32 Diplomat::AtWarCount() const
 {
 	sint32 atWarCount = 0;
 
@@ -4516,7 +4244,6 @@
 	return atWarCount;
 }
 
-
 sint32 Diplomat::EffectiveAtWarCount() const
 {
 	int atWarCount = 0;
@@ -4536,7 +4263,6 @@
 	return atWarCount;
 }
 
-
 bool Diplomat::TestPublicRegard(const PLAYER_INDEX & foreignerId, const ai::Regard & test_regard) const
 {
 	ai::Regard regard = GetPublicRegard(foreignerId);
@@ -4563,16 +4289,16 @@
 bool Diplomat::TestEffectiveRegard(const PLAYER_INDEX & foreignerId, const ai::Regard & test_regard) const
 {
 	const sint32 curRound = NewTurnCount::GetCurrentRound();
-	static int s_regardList[7] = 
+	static int s_regardList[7] =
 	{MIN_REGARD,HOTWAR_REGARD,COLDWAR_REGARD,NEUTRAL_REGARD,FRIEND_REGARD,ALLIED_REGARD,MAX_REGARD};
 
 	cEffectiveRegardEntry * pEntry = &m_effectiveRegardCache[foreignerId];
 
 	if (pEntry->m_round != curRound) {
-		
+
 		pEntry->m_round = curRound;
 		pEntry->m_bits = 0;
-		
+
 		for (int i=0;i<7;++i) {
 			int regard = s_regardList[i];
 			if (ComputeEffectiveRegard(foreignerId,regard)) {
@@ -4592,20 +4318,19 @@
 
 void Diplomat::ClearEffectiveRegardCache()
 {
-	for (size_t i = 0; i < k_MAX_PLAYERS; ++i) 
+	for (size_t i = 0; i < k_MAX_PLAYERS; ++i)
     {
 		m_effectiveRegardCache[i].m_round = -666;
 	}
 }
 
-
 bool Diplomat::ComputeEffectiveRegard(const PLAYER_INDEX & foreignerId, const ai::Regard & test_regard) const
 {
 	ai::Regard regard = m_foreigners[foreignerId].GetEffectiveRegard();
 
 	if (AgreementMatrix::s_agreements.HasAgreement
-            (m_playerId, 
-		     foreignerId, 
+            (m_playerId,
+		     foreignerId,
 		     PROPOSAL_TREATY_DECLARE_WAR
             )
        )
@@ -4619,15 +4344,14 @@
 		{
 			if (!DesireWarWith(foreignerId))
 			{
-				
-				if (AgreementMatrix::s_agreements.HasAgreement(m_playerId, 
-					foreignerId, 
+
+				if (AgreementMatrix::s_agreements.HasAgreement(m_playerId,
+					foreignerId,
 					PROPOSAL_TREATY_CEASEFIRE))
 					return false;
-				
-				
-				if (AgreementMatrix::s_agreements.HasAgreement(m_playerId, 
-					foreignerId, 
+
+				if (AgreementMatrix::s_agreements.HasAgreement(m_playerId,
+					foreignerId,
 					PROPOSAL_TREATY_PEACE))
 					return false;
 			}
@@ -4642,9 +4366,9 @@
 		{
 			if (!DesireWarWith(foreignerId))
 			{
-				
-				if (AgreementMatrix::s_agreements.HasAgreement(m_playerId, 
-					foreignerId, 
+
+				if (AgreementMatrix::s_agreements.HasAgreement(m_playerId,
+					foreignerId,
 					PROPOSAL_TREATY_PEACE))
 					return false;
 			}
@@ -4682,51 +4406,43 @@
 	return (m_foreigners[foreignerId].GetLastIncursion() == NewTurnCount::GetCurrentRound());
 }
 
-
 void Diplomat::SetBorderIncursionBy(const PLAYER_INDEX & foreignerId)
 {
 	m_foreigners[foreignerId].
 		SetLastIncursion(NewTurnCount::GetCurrentRound());
 }
 
-
 void Diplomat::SetBorderPulloutBy(const PLAYER_INDEX & foreignerId)
 {
 	m_foreigners[foreignerId].
 		SetLastIncursion(NewTurnCount::GetCurrentRound()-1);
 }
 
-
 sint32 Diplomat::GetLastBorderIncursionBy(const PLAYER_INDEX & foreignerId) const
 {
 	return m_foreigners[foreignerId].GetLastIncursion();
 }
 
-
 sint8 Diplomat::GetFriendCount() const
 {
 	return m_friendCount;
 }
 
-
 sint8 Diplomat::GetEnemyCount() const
 {
 	return m_enemyCount;
 }
 
-
 sint32 Diplomat::GetFriendPower() const
 {
 	return m_friendPower;
 }
 
-
 sint32 Diplomat::GetEnemyThreat() const
 {
 	return m_enemyThreat;
 }
 
-
 void Diplomat::UpdateAttributes()
 {
 	Player *player_ptr = g_player[m_playerId];
@@ -4734,7 +4450,7 @@
 
 	m_friendCount = 0;
 	m_enemyCount = 0;
-	
+
 	m_friendPower = 0;
 	m_enemyThreat = 0;
 
@@ -4780,8 +4496,8 @@
 		{
 			if (GetCurrentDiplomacy(foreignerId).GetHasPactTrustBonus(add_trust))
 			{
-				ApplyTrustChange(foreignerId, 
-				                 static_cast<ai::Regard>(add_trust), 
+				ApplyTrustChange(foreignerId,
+				                 static_cast<ai::Regard>(add_trust),
 								 "Increase trust because they kept our pact."
 								);
 			}
@@ -4796,8 +4512,8 @@
 			{
 				if (GetTrust(foreignerId) < (NEUTRAL_REGARD + 20))
 				{
-					ApplyTrustChange(foreignerId, 
-					                 add_trust, 
+					ApplyTrustChange(foreignerId,
+					                 add_trust,
 					                 "Increase trust because we're not at war."
 					                );
 				}
@@ -4807,7 +4523,7 @@
 		if (AgreementMatrix::s_agreements.
 			HasAgreement(m_playerId, foreignerId, PROPOSAL_REQUEST_WITHDRAW_TROOPS))
 		{
-			sint16 duration = 
+			sint16 duration =
 				AgreementMatrix::s_agreements.GetAgreementDuration(m_playerId, foreignerId, PROPOSAL_REQUEST_WITHDRAW_TROOPS);
 
 			if ((duration > 20) &&
@@ -4823,7 +4539,7 @@
 		{
 			const ai::Agreement & agreement = AgreementMatrix::s_agreements.
 				GetAgreement(m_playerId, foreignerId, PROPOSAL_REQUEST_STOP_PIRACY);
-			
+
 			if ((NewTurnCount::GetCurrentRound() - agreement.start == 20) &&
 				GetCurrentDiplomacy(foreignerId).GetFollowThroughTrustBonus(add_trust)
 			   )
@@ -4837,7 +4553,7 @@
 		{
 			const ai::Agreement & agreement = AgreementMatrix::s_agreements.
 				GetAgreement(m_playerId, foreignerId, PROPOSAL_REQUEST_REDUCE_POLLUTION);
-			
+
 			if ((NewTurnCount::GetCurrentRound() - agreement.start == 20) &&
 				GetCurrentDiplomacy(foreignerId).GetFollowThroughTrustBonus(add_trust)
 			   )
@@ -4851,7 +4567,7 @@
 		{
 			const ai::Agreement & agreement = AgreementMatrix::s_agreements.
 				GetAgreement(m_playerId, foreignerId, PROPOSAL_REQUEST_STOP_RESEARCH);
-			
+
 			if ((NewTurnCount::GetCurrentRound() - agreement.start == 20) &&
 				GetCurrentDiplomacy(foreigner).GetFollowThroughTrustBonus(add_trust)
 			   )
@@ -4866,7 +4582,6 @@
 			continue;
 		}
 
-
 		if ( AgreementMatrix::s_agreements.
 			HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR) )
 			continue;
@@ -4906,16 +4621,15 @@
 	ComputeAllDesireWarWith();
 }
 
-
 bool Diplomat::GetTradeRoutePiracyRisk(const Unit & source_city, const Unit & dest_city) const
 {
-	for 
+	for
     (
-        PiracyHistoryList::const_iterator piracy_iter = m_piracyHistory.begin(); 
+        PiracyHistoryList::const_iterator piracy_iter = m_piracyHistory.begin();
 	    piracy_iter != m_piracyHistory.end();
         ++piracy_iter
     )
-	{ 
+	{
 		if ((piracy_iter->m_sourceCity == source_city) &&
 			(piracy_iter->m_destinationCity == dest_city) &&
 			!AgreementMatrix::s_agreements.HasAgreement(piracy_iter->m_piratingPlayer,
@@ -4932,7 +4646,6 @@
 	return false;
 }
 
-
 void Diplomat::ComputeTradeRoutePiracyRisk()
 {
 	Player * player_ptr = g_player[m_playerId];
@@ -4940,12 +4653,12 @@
 
 	sint32 cur_round = player_ptr->GetCurRound();
 
-	PiracyHistoryList::iterator piracy_iter = m_piracyHistory.begin(); 
+	PiracyHistoryList::iterator piracy_iter = m_piracyHistory.begin();
 	while (piracy_iter != m_piracyHistory.end())
-	{ 
+	{
 		sint32 piracy_memory_turns;
 		GetCurrentStrategy().GetPiracyMemoryTurns(piracy_memory_turns);
-		
+
 		if (cur_round > piracy_iter->m_lastTurn + piracy_memory_turns)
 		{
 			piracy_iter = m_piracyHistory.erase(piracy_iter);
@@ -4964,26 +4677,22 @@
 	g_theStringDB->GetStringID("REGARD_EVENT_PER_ROUTE_PIRACY", piracy_str_id);
 	sint32 piracy_regard_cost;
 
-	
 	for (sint32 i = 0; i < num_cities; i++)
 		{
 			city = player_ptr->m_all_cities->Access(i);
 			Assert(city.IsValid());
 
-			
 			for (sint32 r = 0; r < city.CD()->GetTradeSourceList()->Num(); r++) {
 				route = city.CD()->GetTradeSourceList()->Access(r);
 
-				
 				if (route->IsBeingPirated())
 					{
-						
+
 						piracy.m_sourceCity = route->GetSource();
 						piracy.m_destinationCity = route->GetDestination();
-						piracy.m_piratingPlayer = 
+						piracy.m_piratingPlayer =
 							route->GetPiratingArmy().GetOwner();
 
-						
 						GetCurrentDiplomacy(piracy.m_piratingPlayer).
 							GetPerRoutePiracyRegardCost(piracy_regard_cost);
 
@@ -4992,39 +4701,37 @@
 										REGARD_EVENT_GOLD,
 										piracy_str_id );
 
-						
-						piracy_iter = std::find(m_piracyHistory.begin(), 
-										        m_piracyHistory.end(), 
+						piracy_iter = std::find(m_piracyHistory.begin(),
+										        m_piracyHistory.end(),
 										        piracy);
 
 						if (piracy_iter != m_piracyHistory.end())
 							{
-								
+
 								piracy_iter->m_accumEvents++;
 								piracy_iter->m_lastTurn = cur_round;
 							}
 						else
 							{
-								
+
 								piracy.m_accumEvents = 1;
 								piracy.m_lastTurn = cur_round;
 								m_piracyHistory.push_front(piracy);
 							}
-					} 
-			} 
-		} 
+					}
+			}
+		}
 }
 
-
 bool Diplomat::GetTradeRoutePiracyRisk(const PLAYER_INDEX foreignerId) const
 {
-	for 
+	for
     (
-        PiracyHistoryList::const_iterator piracy_iter = m_piracyHistory.begin(); 
+        PiracyHistoryList::const_iterator piracy_iter = m_piracyHistory.begin();
 	    piracy_iter != m_piracyHistory.end();
         ++piracy_iter
     )
-	{ 
+	{
 		if ((piracy_iter->m_piratingPlayer == foreignerId) &&
 			!AgreementMatrix::s_agreements.HasAgreement
                 (piracy_iter->m_piratingPlayer, m_playerId, PROPOSAL_OFFER_STOP_PIRACY)
@@ -5037,7 +4744,6 @@
 	return false;
 }
 
-
 void Diplomat::AddNewNegotiationEvent(const PLAYER_INDEX foreignerId, const NegotiationEvent &negotiation_event)
 {
 	m_foreigners[foreignerId].AddNewNegotiationEvent(negotiation_event);
@@ -5049,15 +4755,14 @@
 	                      );
 }
 
-
 void Diplomat::ComputeIncursionPermission()
 {
-	m_incursionPermission = 1 << PLAYER_INDEX_VANDALS; 
+	m_incursionPermission = 1 << PLAYER_INDEX_VANDALS;
 
 	Player *                player_ptr = g_player[m_playerId];
 	Assert(player_ptr);
 	AgreementMatrix const & agreements = AgreementMatrix::s_agreements;
-	
+
 	for
 	(
 	    size_t  foreignerIndex = 1;
@@ -5084,46 +4789,39 @@
 	}
 }
 
-
 uint32 Diplomat::GetIncursionPermission() const
 {
 	return m_incursionPermission;
 }
 
-
 bool Diplomat::IncursionPermission(const PLAYER_INDEX foreignerId) const
 {
 	return (m_incursionPermission & (1 << foreignerId)) != 0;
 }
 
-
 void Diplomat::SetHotwarAttack(const PLAYER_INDEX foreignerId, const sint16 last_hot_war_attack)
 {
 	m_foreigners[foreignerId].SetHotwarAttack(last_hot_war_attack);
 }
 
-
 sint32 Diplomat::GetLastHotwarAttack(const PLAYER_INDEX foreignerId) const
 {
 	return m_foreigners[foreignerId].GetLastHotwarAttack();
 }
 
-
 void Diplomat::SetColdwarAttack(const PLAYER_INDEX foreignerId, const sint16 last_cold_war_attack)
 {
 	m_foreigners[foreignerId].SetColdwarAttack(last_cold_war_attack);
 }
 
-
 sint32 Diplomat::GetLastColdwarAttack(const PLAYER_INDEX foreignerId) const
 {
 	return m_foreigners[foreignerId].GetLastColdwarAttack();
 }
 
-
 PLAYER_INDEX Diplomat::ComputeNuclearLaunchTarget()
 {
-	
+
 	m_nuclearAttackTarget = -1;
 
 	if ((m_strategy.GetNuclearFirstStrikeDisabled() &&
@@ -5132,28 +4830,25 @@
 		 !m_strategy.GetNuclearTargetingEnabled()))
 		return -1;
 
-	
-	
-	
-	
-		
-		
-	
-	
 
-	sint32 our_nuke_count = 
+
+
+
+
+
+
+
+
+	sint32 our_nuke_count =
 		MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(m_playerId);
 
 	Player *player_ptr = g_player[m_playerId];
 	Assert(player_ptr);
 
-	
 	PLAYER_INDEX best_foreigner = PLAYER_UNASSIGNED;
 
-	
 	bool has_nuke_enemy = false;
 
-	
 	sint32 our_vulnerable_city_count = 0;
 	for (sint32 i = 0; i < player_ptr->GetNumCities(); i++)
 	{
@@ -5161,26 +4856,24 @@
 			our_vulnerable_city_count++;
 	}
 
-	
-	
+
 	sint32 tmp_nuke_count;
-	for 
+	for
     (
-        size_t foreignerIndex = 1; 
-        foreignerIndex < s_theDiplomats.size(); 
+        size_t foreignerIndex = 1;
+        foreignerIndex < s_theDiplomats.size();
         ++foreignerIndex
     )
 	{
 		player_ptr = g_player[foreignerIndex];
 		if (player_ptr == NULL)
 			continue;
-			
+
 		PLAYER_INDEX foreignerId = static_cast<PLAYER_INDEX>(foreignerIndex);
 
 		if (foreignerId == m_playerId)
 			continue;
 
-		
 		sint32 regard;
 		if (m_strategy.GetPreemptiveStrikeRegard(regard))
 		{
@@ -5188,14 +4881,12 @@
 				continue;
 		}
 
-		
 		if (!TestEffectiveRegard(foreignerId, HOTWAR_REGARD))
 			continue;
 
-		tmp_nuke_count = 
+		tmp_nuke_count =
 			MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(foreignerId);
 
-		
 		if (tmp_nuke_count > 0)
 		{
 			if (has_nuke_enemy)
@@ -5226,7 +4917,6 @@
 				return PLAYER_UNASSIGNED;
 		}
 
-		
 		best_foreigner = foreignerId;
 	}
 
@@ -5235,35 +4925,33 @@
 	return best_foreigner;
 }
 
-
 PLAYER_INDEX Diplomat::GetNuclearLaunchTarget() const
 {
 	return m_nuclearAttackTarget;
 }
 
-
 void Diplomat::TargetNuclearAttack(const PLAYER_INDEX foreignerId, const bool launch_now)
 {
-	sint32 our_nuke_count = 
+	sint32 our_nuke_count =
 		MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(m_playerId);
-	
+
 	if (our_nuke_count <= 0)
 		return;
-	
+
 	Player * player_ptr = g_player[m_playerId];
 	Assert(player_ptr && player_ptr->m_all_armies);
-	
+
 	NukeTargetList nuke_city_list;
 	ComputeNukeTargets(nuke_city_list, foreignerId);
 
 	sint32 num_armies = player_ptr->m_all_armies->Num();
-	
+
 	Unit unit;
 	std::list<Unit> weapon_list;
-	for (sint32 i = 0; i < num_armies; i++) 
+	for (sint32 i = 0; i < num_armies; i++)
     {
 		unit = player_ptr->m_all_units->Access(i);
-		
+
 		if (unit.GetDBRec()->HasNuclearAttack())
         {
     		if (unit->GetArmy().m_id != 0)
@@ -5280,10 +4968,10 @@
 		!m_strategy.GetNuclearFirstStrikeEnabled())
 	{
 		if (m_strategy.GetNuclearTargetingDisabled())
-			
+
 			return;
 		else
-			
+
 			no_first_strike = true;
 	}
 
@@ -5297,14 +4985,13 @@
 	sint32 tmp_nuke_dist;
 	Path found_path;
 	bool continue_targeting = true;
-	
+
 	while (continue_targeting)
 	{
-		
+
 		continue_targeting = false;
-		
-		
-		city_iter = nuke_city_list.begin(); 
+
+		city_iter = nuke_city_list.begin();
 		while(city_iter != nuke_city_list.end())
 		{
 			if (!city_iter->second.IsValid())
@@ -5313,12 +5000,11 @@
 				continue;
 			}
 
-			
 			closest_nuke_iter = weapon_list.end();
 			closest_nuke_dist = 99999;
 			target_pos = city_iter->second->GetPos();
-			
-			for 
+
+			for
             (
                 nuke_iter = weapon_list.begin();
 			    nuke_iter != weapon_list.end();
@@ -5336,8 +5022,7 @@
 				    }
                 }
 			}
-			
-			
+
 			bool close_enough = false;
 			if (closest_nuke_iter != weapon_list.end())
 			{
@@ -5348,35 +5033,30 @@
 
 			if (close_enough)
 			{
-				
+
 				(*closest_nuke_iter)->SetTargetCity(city_iter->second);
 
 				if (launch_now && !no_first_strike)
 				{
-					
-					
+
 					unitutil_ExecuteMadLaunch(*closest_nuke_iter);
 				}
-				
-				
+
 				weapon_list.erase(closest_nuke_iter);
 
-				
 				++city_iter;
 			}
 			else
 			{
-				
+
 				city_iter = nuke_city_list.erase(city_iter);
 
-				
 			}
-		} 
+		}
 		continue_targeting = (weapon_list.size() > 0) && (nuke_city_list.size() > 0);
-	} 
+	}
 }
 
-
 void Diplomat::ComputeNukeTargets(NukeTargetList & city_list, const PLAYER_INDEX targetId) const
 {
 	Player * player_ptr;
@@ -5385,11 +5065,10 @@
 
 	city_list.clear();
 
-	
-	for 
+	for
     (
-        size_t foreignerIndex = 0; 
-        foreignerIndex < s_theDiplomats.size(); 
+        size_t foreignerIndex = 0;
+        foreignerIndex < s_theDiplomats.size();
         ++foreignerIndex
     )
 	{
@@ -5404,42 +5083,37 @@
 
 		sint32 regard = GetPublicRegard(foreignerId);
 
-		
 		if (targetId != PLAYER_UNASSIGNED)
 		{
-			
+
 			if (foreignerId != targetId)
 				continue;
 		}
 		else
 		{
-			
+
 			if (regard >= COLDWAR_REGARD)
 				continue;
-			
-			sint32 const    nuke_count = 
+
+			sint32 const    nuke_count =
 				MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(foreignerId);
-			
-			
+
 			if (nuke_count <= 0)
 				continue;
 		}
 
-		
 		for (sint32 i = 0; i < player_ptr->GetNumCities(); i++)
 		{
 			city = player_ptr->GetCityFromIndex(i);
 			Assert(city.m_id != 0);
 			if (city.m_id && city.CD() && !city->SafeFromNukes())
 			{
-				
+
 				nuke_target.first = city.CD()->GetValue();
-				
-				
+
 				nuke_target.first += (city->IsCapitol() ? static_cast<sint32>(nuke_target.first * 0.25) : 0);
 
-				
-				nuke_target.first += (regard <= HOTWAR_REGARD ? static_cast<sint32>(nuke_target.first * 0.75) : 0); 
+				nuke_target.first += (regard <= HOTWAR_REGARD ? static_cast<sint32>(nuke_target.first * 0.75) : 0);
 
 				nuke_target.second = city.m_id;
 
@@ -5447,24 +5121,23 @@
 			}
 		}
 	}
-	
+
 	city_list.sort(std::greater<std::pair<sint32, Unit> >());
 }
 
-
 void Diplomat::DisbandNuclearWeapons(const double percent)
 {
 	Player *    player_ptr = g_player[m_playerId];
 	Assert(player_ptr && player_ptr->m_all_units);
-	
+
 	if (player_ptr == NULL)
 		return;
-	
+
 	sint32  total_weapons = 0;
 	Unit    unit;
     sint32  i;
 
-	for (i = player_ptr->m_all_units->Num() - 1; i >= 0; --i) 
+	for (i = player_ptr->m_all_units->Num() - 1; i >= 0; --i)
     {
 		unit = player_ptr->m_all_units->Access(i);
 		if (unit.IsValid() && unit.GetDBRec()->HasNuclearAttack())
@@ -5488,20 +5161,19 @@
 	MapAnalysis::GetMapAnalysis().SetNuclearWeaponsCount(m_playerId, total_weapons);
 }
 
-
 void Diplomat::DisbandBioWeapons(const double percent)
 {
 	Player *    player_ptr = g_player[m_playerId];
     Assert(player_ptr && player_ptr->m_all_units);
-	
+
 	if (player_ptr == NULL)
 		return;
-	
+
 	sint32  total_weapons = 0;
 	Unit    unit;
     sint32  i;
 
-	for (i = player_ptr->m_all_units->Num() - 1; i >= 0; --i) 
+	for (i = player_ptr->m_all_units->Num() - 1; i >= 0; --i)
     {
 		unit = player_ptr->m_all_units->Access(i);
 		if (unit.IsValid() && unit.GetDBRec()->HasBioTerror())
@@ -5512,7 +5184,7 @@
 
 	sint32 goal_weapons = static_cast<sint32>(total_weapons * (1.0 - percent));
 
-	for (i = player_ptr->m_all_units->Num() - 1; i >= 0 && (total_weapons > goal_weapons); --i) 
+	for (i = player_ptr->m_all_units->Num() - 1; i >= 0 && (total_weapons > goal_weapons); --i)
     {
 		unit = player_ptr->m_all_units->Access(i);
 		if (unit.IsValid() && unit.GetDBRec()->HasBioTerror())
@@ -5525,20 +5197,19 @@
 	MapAnalysis::GetMapAnalysis().SetBioWeaponsCount(m_playerId, total_weapons);
 }
 
-
 void Diplomat::DisbandNanoWeapons(const double percent)
 {
 	Player *    player_ptr = g_player[m_playerId];
 	Assert(player_ptr && player_ptr->m_all_units);
-	
+
 	if (player_ptr == NULL)
 		return;
-	
+
 	sint32  total_weapons = 0;
 	Unit    unit;
     sint32  i;
 
-	for (i = player_ptr->m_all_units->Num() - 1; i >= 0; --i) 
+	for (i = player_ptr->m_all_units->Num() - 1; i >= 0; --i)
     {
 		unit = player_ptr->m_all_units->Access(i);
 		if (unit.IsValid() && unit.GetDBRec()->HasCreateParks())
@@ -5549,7 +5220,7 @@
 
 	sint32 goal_weapons = static_cast<sint32>(total_weapons * (1.0 - percent));
 
-	for(i = player_ptr->m_all_units->Num() - 1; i >= 0 && (total_weapons > goal_weapons); --i) 
+	for(i = player_ptr->m_all_units->Num() - 1; i >= 0 && (total_weapons > goal_weapons); --i)
     {
 		unit = player_ptr->m_all_units->Access(i);
 		if (unit.IsValid() && unit.GetDBRec()->HasCreateParks())
@@ -5562,15 +5233,14 @@
 	MapAnalysis::GetMapAnalysis().SetNanoWeaponsCount(m_playerId, total_weapons);
 }
 
-
 void Diplomat::ExecutePersistantAgreements()
 {
 	AgreementMatrix & agreements = AgreementMatrix::s_agreements;
-	
+
 	for
 	(
-	    size_t foreignerIndex = 1; 
-	    foreignerIndex < m_foreigners.size(); 
+	    size_t foreignerIndex = 1;
+	    foreignerIndex < m_foreigners.size();
 	    ++foreignerIndex
 	)
 	{
@@ -5587,7 +5257,7 @@
 		            (m_playerId, foreignerId, PROPOSAL_REQUEST_WITHDRAW_TROOPS)
 		   )
 		{
-			sint16 duration = 
+			sint16 duration =
 				agreements.GetAgreementDuration(m_playerId, foreignerId, PROPOSAL_REQUEST_WITHDRAW_TROOPS);
 
 			if (duration > 20)
@@ -5596,14 +5266,14 @@
 			}
 		}
 
-		const ai::Agreement	& stop_research = 
+		const ai::Agreement	& stop_research =
 			agreements.GetAgreement(m_playerId, foreignerId, PROPOSAL_REQUEST_STOP_RESEARCH);
 
 		if (stop_research.start != -1 && stop_research.end == -1)
 		{
 			double science_tax;
 			g_player[foreignerIndex]->GetScienceTaxRate(science_tax);
-			if ( (g_player[foreignerIndex]->m_advances->GetResearching() == 
+			if ( (g_player[foreignerIndex]->m_advances->GetResearching() ==
 				  stop_research.proposal.first_arg.advanceType ) &&
 				 (science_tax > 0.0) )
 			{
@@ -5611,30 +5281,30 @@
 			}
 		}
 
-		const ai::Agreement	& reduce_pollution = 
+		const ai::Agreement	& reduce_pollution =
 			agreements.GetAgreement(m_playerId, foreignerId, PROPOSAL_REQUEST_REDUCE_POLLUTION);
-			
-		sint32 agreement_duration = 
+
+		sint32 agreement_duration =
 			NewTurnCount::GetCurrentRound() - reduce_pollution.start;
 
 		if (reduce_pollution.start != -1 && reduce_pollution.end == -1 &&
 			agreement_duration > 25)
 		{
 			uint32 target_pollution = reduce_pollution.proposal.first_arg.pollution;
-			
+
 			if (g_player[foreignerIndex]->GetPollutionLevel() > target_pollution)
 			{
 				LogViolationEvent(foreignerId, PROPOSAL_REQUEST_REDUCE_POLLUTION);
 			}
 		}
 
-		const ai::Agreement	& pollution_pact = 
+		const ai::Agreement	& pollution_pact =
 			agreements.GetAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_POLLUTION_PACT);
-		
-		const ai::Agreement	& honor_pollution_pact = 
+
+		const ai::Agreement	& honor_pollution_pact =
 			agreements.GetAgreement(m_playerId, foreignerId, PROPOSAL_REQUEST_HONOR_POLLUTION_AGREEMENT);
 
-		agreement_duration = 
+		agreement_duration =
 			NewTurnCount::GetCurrentRound() - honor_pollution_pact.start;
 
 		if (honor_pollution_pact.start != -1 && honor_pollution_pact.end == -1 &&
@@ -5650,16 +5320,14 @@
 	}
 }
 
-
 void Diplomat::SendGreeting(const PLAYER_INDEX & foreignerId)
 {
 	m_foreigners[foreignerId].SetGreetingTurn();
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR))
 		return;
 
-	DIPLOMATIC_STRENGTH sender_strength = 
+	DIPLOMATIC_STRENGTH sender_strength =
 		g_player[m_playerId]->GetRelativeStrength(foreignerId);
 
 	StringId greeting;
@@ -5681,7 +5349,6 @@
 	g_slicEngine->Execute(so);
 }
 
-
 bool Diplomat::DesireWarWith(const PLAYER_INDEX foreignerId) const
 {
 	Assert(foreignerId >= 0);
@@ -5698,11 +5365,11 @@
 {
 	if (!g_player[m_playerId])
 		return false;
-	sint32 const		turns_at_peace		= 
+	sint32 const		turns_at_peace		=
 		AgreementMatrix::s_agreements.TurnsSinceLastWar(m_playerId, foreignerId);
 	sint32 const		turns_at_war		=
 		AgreementMatrix::s_agreements.TurnsAtWar(m_playerId, foreignerId);
-	DIPLOMATIC_STRENGTH relative_strength = 
+	DIPLOMATIC_STRENGTH relative_strength =
 		g_player[m_playerId]->GetRelativeStrength(foreignerId);
 
 	sint32 last_hotwar_attack = GetLastHotwarAttack(foreignerId);
@@ -5826,7 +5493,7 @@
 		if (!other_ptr->HasWarWith(m_playerId))
 			continue;
 
-		DIPLOMATIC_STRENGTH const   relative_strength = 
+		DIPLOMATIC_STRENGTH const   relative_strength =
 		    other_ptr->GetRelativeStrength(m_playerId);
 
 		if (relative_strength < lowest_relative_strength)
@@ -5849,43 +5516,38 @@
 	Assert(player_ptr);
 	Assert(foreigner_ptr);
 
-	
-	for 
+	for
     (
-        size_t thirdPartyIndex = 1; 
-        thirdPartyIndex < m_foreigners.size(); 
+        size_t thirdPartyIndex = 1;
+        thirdPartyIndex < m_foreigners.size();
         ++thirdPartyIndex
-    ) 
+    )
     {
 		PLAYER_INDEX thirdpartyId   = static_cast<PLAYER_INDEX>(thirdPartyIndex);
 		if (thirdpartyId == m_playerId ||
 			thirdpartyId == foreignerId)
 			continue;
 
-		
 		if (!player_ptr->HasContactWith(thirdpartyId) ||
 			!foreigner_ptr->HasContactWith(thirdpartyId))
 			continue;
 
-		
 		if ((AgreementMatrix::s_agreements.HasAgreement(m_playerId, thirdpartyId, PROPOSAL_TREATY_PEACE) ||
-			 AgreementMatrix::s_agreements.HasAgreement(m_playerId, thirdpartyId, PROPOSAL_TREATY_ALLIANCE) || 
+			 AgreementMatrix::s_agreements.HasAgreement(m_playerId, thirdpartyId, PROPOSAL_TREATY_ALLIANCE) ||
 			 AgreementMatrix::s_agreements.HasAgreement(m_playerId, thirdpartyId, PROPOSAL_TREATY_MILITARY_PACT)) &&
 			AgreementMatrix::s_agreements.HasAgreement(foreignerId, thirdpartyId, PROPOSAL_TREATY_DECLARE_WAR))
 			return false;
 
-		
-		if ((AgreementMatrix::s_agreements.HasAgreement(foreignerId, thirdpartyId, PROPOSAL_TREATY_ALLIANCE) || 
+		if ((AgreementMatrix::s_agreements.HasAgreement(foreignerId, thirdpartyId, PROPOSAL_TREATY_ALLIANCE) ||
 			 AgreementMatrix::s_agreements.HasAgreement(foreignerId, thirdpartyId, PROPOSAL_TREATY_MILITARY_PACT)) &&
 			AgreementMatrix::s_agreements.HasAgreement(m_playerId, thirdpartyId, PROPOSAL_TREATY_DECLARE_WAR))
 			return false;
 
-	} 
+	}
 
 	return true;
 }
 
-
 bool Diplomat::CanExtortCityFrom(const PLAYER_INDEX foreginerId, const sint32 max_value, Unit & city) const
 {
 	city.m_id = 0;
@@ -5899,7 +5561,6 @@
 	if (receiver_ptr == NULL)
 		return GEV_HD_Continue;
 
-	
 	sint32 num_cities = receiver_ptr->m_all_cities->Num();
 	double risk_ratio;
 	for (sint32 i = num_cities-1; i >= 0; i--)
@@ -5928,7 +5589,6 @@
 	return false;
 }
 
-
 void Diplomat::ThrowParty(const PLAYER_INDEX foreignerId)
 {
 	if (ReadyToParty())
@@ -5938,7 +5598,7 @@
 
 //Add random regard bonus generator for throw party
 		GetCurrentDiplomacy(foreignerId).GetHoldReceptionRegardBonus(regard_bonus);
-		
+
 		g_theStringDB->GetStringID("REGARD_EVENT_HOLD_RECEPTION",strId);
 		LogRegardEvent(foreignerId,
 			regard_bonus,
@@ -5949,7 +5609,6 @@
 	}
 }
 
-
 bool Diplomat::ReadyToParty() const
 {
 	if (m_lastParty < 0)
@@ -5959,26 +5618,22 @@
 	return false;
 }
 
-
 bool Diplomat::ShouldEscortSettlers() const
 {
-	if (g_player[m_playerId] && 
+	if (g_player[m_playerId] &&
 		g_player[m_playerId]->IsHuman())
 		return false;
 
-	
 	if (AtWarCount() <= 0)
 		return false;
 
-	
-	if (g_player[m_playerId] && 
+	if (g_player[m_playerId] &&
 		g_player[m_playerId]->GetCargoCapacity() < 2)
 		return false;
 
 	return true;
 }
 
-
 bool Diplomat::FearNukesFrom(const PLAYER_INDEX foreignerId) const
 {
 	bool used_nukes = (Diplomat::GetDiplomat(foreignerId).HasLaunchedNukes());
@@ -5989,7 +5644,7 @@
 
 	bool at_war = AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR);
 
-	DIPLOMATIC_STRENGTH our_strength = 
+	DIPLOMATIC_STRENGTH our_strength =
 		g_player[m_playerId]->GetRelativeStrength(foreignerId);
 
 	sint32 their_nukes = MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(foreignerId);
@@ -5997,12 +5652,11 @@
 
 	bool has_more_nukes = (their_nukes > 3 * our_nukes);
 
-	return ((low_trust && hate_us) || at_war) && 
+	return ((low_trust && hate_us) || at_war) &&
 		used_nukes &&
 		(our_strength < DIPLOMATIC_STRENGTH_AVERAGE || has_more_nukes);
 }
 
-
 bool Diplomat::FearNanoAttackFrom(const PLAYER_INDEX foreignerId) const
 {
 	bool used_nano = (Diplomat::GetDiplomat(foreignerId).HasLaunchedNanoAttack());
@@ -6013,7 +5667,7 @@
 
 	bool at_war = AgreementMatrix::s_agreements.HasAgreement(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR);
 
-	DIPLOMATIC_STRENGTH our_strength = 
+	DIPLOMATIC_STRENGTH our_strength =
 		g_player[m_playerId]->GetRelativeStrength(foreignerId);
 
 	sint32 their_nano = MapAnalysis::GetMapAnalysis().GetNanoWeaponsCount(foreignerId);
@@ -6021,36 +5675,31 @@
 
 	bool has_more_nano = (their_nano > our_nano);
 
-	return ((low_trust && hate_us) || at_war) && 
+	return ((low_trust && hate_us) || at_war) &&
 		used_nano &&
 		(our_strength < DIPLOMATIC_STRENGTH_AVERAGE || has_more_nano);
 }
 
-
 bool Diplomat::HasLaunchedNukes() const
 {
 	return m_launchedNukes;
 }
 
-
 bool Diplomat::HasLaunchedNanoAttack() const
 {
 	return m_launchedNanoAttack;
 }
 
-
 void Diplomat::SetHasLaunchedNukes(const bool val)
 {
 	m_launchedNukes = val;
 }
 
-
 void Diplomat::HasLaunchedNanoAttack(const bool val)
 {
 	m_launchedNanoAttack = val;
 }
 
-
 void Diplomat::ClearInitiatives()
 {
 	for (sint32 p = 0; p < k_MAX_PLAYERS; p++) {
@@ -6063,7 +5712,6 @@
 	}
 }
 
-
 bool Diplomat::FirstTurnOfWar() const
 {
 	sint32 duration;
@@ -6072,31 +5720,29 @@
 		return false;
 
 	bool at_war = false;
-	for 
+	for
     (
-        PLAYER_INDEX foreignerId = 1; 
-        static_cast<size_t>(foreignerId) < m_foreigners.size(); 
+        PLAYER_INDEX foreignerId = 1;
+        static_cast<size_t>(foreignerId) < m_foreigners.size();
         ++foreignerId
     )
 	{
-		
+
 		if (foreignerId == m_playerId)
 			continue;
-		
-		
+
 		if (g_player[foreignerId] == NULL)
 			continue;
 
 		duration = AgreementMatrix::s_agreements.GetAgreementDuration(m_playerId, foreignerId, PROPOSAL_TREATY_DECLARE_WAR);
-		
+
 		if (duration > 1)
 			return false;
 
-		
 		if (duration == 1)
 			at_war = true;
 	}
-	
+
 	return at_war;
 }
 

Modified: trunk/ctp2_code/ai/diplomacy/diplomattypes.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/diplomattypes.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/diplomattypes.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,13 +1,3 @@
-
-
-
-
-
-
-
-
-
-
 #include "c3.h"
 #include "SlicConst.h"
 #include "SlicEngine.h"
@@ -66,13 +56,12 @@
 	"TREATY_ALLIANCE",
 };
 
-extern std::string s_threatNames[THREAT_MAX] = { 
+extern std::string s_threatNames[THREAT_MAX] = {
 	"NONE",
-	
-	
-	
+
+
 	"DESTROY_CITY",
-	
+
 	"TRADE_EMBARGO",
 	"DECLARE_WAR"
 };
@@ -82,13 +71,12 @@
 	"REJECT",
 	"ACCEPT",
 	"COUNTER",
-	"THREATEN",	
+	"THREATEN",
 };
 
-
 extern std::string s_motivationNames[MOTIVATION_MAX] = {
 	"NONE",
-	
+
 	"FEAR_SCENARIO",
 	"FEAR_INVASION",
 	"FEAR_CITY_DEFENSE",
@@ -100,7 +88,7 @@
 	"FEAR_MILITARY_RANK",
 	"FEAR_TRADE_RANK",
 	"FEAR_POLLUTION_RANK",
-	
+
 	"DESIRE_SCENARIO",
 	"DESIRE_ATTACK",
 	"DESIRE_ATTACK_CITY",
@@ -113,10 +101,8 @@
 	"DESIRE_ENLIST_FRIEND",
 };
 
-
 void DiplomatTypes::InitializeSlicConsts() {
 
-	
 	g_slicEngine->AddConst("MIN_REGARD", MIN_REGARD);
 	g_slicEngine->AddConst("HOTWAR_REGARD", HOTWAR_REGARD);
 	g_slicEngine->AddConst("COLDWAR_REGARD", COLDWAR_REGARD);
@@ -124,39 +110,32 @@
 	g_slicEngine->AddConst("FRIEND_REGARD", FRIEND_REGARD);
 	g_slicEngine->AddConst("ALLIED_REGARD", ALLIED_REGARD);
 	g_slicEngine->AddConst("MAX_REGARD", MAX_REGARD);
-	
+
 	sint32 i;
 	std::string fullname;
 
-	
 	for ( i = 0; i < REGARD_EVENT_MAX; i++) {
 		fullname = std::string("REGARD_EVENT_") + s_regardEventNames[i];
 		g_slicEngine->AddConst(fullname.c_str(), i);
 	}
 
-	
 	for ( i = PROPOSAL_NONE; i < PROPOSAL_MAX; i++) {
 		fullname = std::string("PROPOSAL_") + s_proposalNames[i];
 		g_slicEngine->AddConst(fullname.c_str(),i);
 	}
 
-	
 	for ( i = THREAT_NONE; i < THREAT_MAX; i++) {
 		fullname = std::string("THREAT_") + s_threatNames[i];
 		g_slicEngine->AddConst(fullname.c_str(),i);
 	}
 
-	
 	for ( i = RESPONSE_INVALID; i < RESPONSE_MAX; i++) {
 		fullname = std::string("RESPONSE_") + s_responseNames[i];
 		g_slicEngine->AddConst(fullname.c_str(),i);
 	}
 
-	
 	for ( i = MOTIVATION_NONE; i < MOTIVATION_MAX; i++) {
 		fullname = std::string("MOTIVATION_") +  s_motivationNames[i];
 		g_slicEngine->AddConst(fullname.c_str(),i);
 	}
 }
-
-

Modified: trunk/ctp2_code/ai/diplomacy/diplomattypes.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/diplomattypes.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/diplomattypes.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,20 +11,20 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 // _MSC_VER
 // - Compiler version (for the Microsoft C++ compiler only)
 //
 // Note: For the blocks with _MSC_VER preprocessor directives, the following
-//       holds: the (_MSC_VER) preprocessor directive lines, and the blocks 
-//       that are inactive for _MSC_VER value 1200 are modified Apolyton code. 
-//       The blocks that are inactiThe blocks that are active for _MSC_VER 
+//       holds: the (_MSC_VER) preprocessor directive lines, and the blocks
+//       that are inactive for _MSC_VER value 1200 are modified Apolyton code.
+//       The blocks that are inactiThe blocks that are active for _MSC_VER
 //       value 1200 are the original Activision code.
 //
 //----------------------------------------------------------------------------
@@ -67,11 +67,11 @@
 enum DIPLOMATIC_TONE
 {
 	DIPLOMATIC_TONE_NOT_CHOSEN = -1,
-	DIPLOMATIC_TONE_KIND, 
-	DIPLOMATIC_TONE_EQUAL, 
-	DIPLOMATIC_TONE_MEEK, 
-	DIPLOMATIC_TONE_INDIGNANT, 
-	DIPLOMATIC_TONE_ANGRY, 
+	DIPLOMATIC_TONE_KIND,
+	DIPLOMATIC_TONE_EQUAL,
+	DIPLOMATIC_TONE_MEEK,
+	DIPLOMATIC_TONE_INDIGNANT,
+	DIPLOMATIC_TONE_ANGRY,
 	DIPLOMATIC_TONE_MAX
 };
 
@@ -93,61 +93,60 @@
 enum PROPOSAL_TYPE
 {
 	PROPOSAL_NONE,
-	
-	PROPOSAL_OFFER_GIVE_CITY,			
-	PROPOSAL_REQUEST_GIVE_CITY,			
-	
-	PROPOSAL_OFFER_WITHDRAW_TROOPS,			
-	PROPOSAL_REQUEST_WITHDRAW_TROOPS,		
-	
-	PROPOSAL_OFFER_STOP_PIRACY,			
-	PROPOSAL_REQUEST_STOP_PIRACY,		
-	
-	PROPOSAL_OFFER_BREAK_AGREEMENT,			
-	PROPOSAL_REQUEST_BREAK_AGREEMENT,		
-	
-	PROPOSAL_OFFER_STOP_RESEARCH,			
-	PROPOSAL_REQUEST_STOP_RESEARCH,			
-	
-	PROPOSAL_OFFER_REDUCE_NUCLEAR_WEAPONS,	
+
+	PROPOSAL_OFFER_GIVE_CITY,
+	PROPOSAL_REQUEST_GIVE_CITY,
+
+	PROPOSAL_OFFER_WITHDRAW_TROOPS,
+	PROPOSAL_REQUEST_WITHDRAW_TROOPS,
+
+	PROPOSAL_OFFER_STOP_PIRACY,
+	PROPOSAL_REQUEST_STOP_PIRACY,
+
+	PROPOSAL_OFFER_BREAK_AGREEMENT,
+	PROPOSAL_REQUEST_BREAK_AGREEMENT,
+
+	PROPOSAL_OFFER_STOP_RESEARCH,
+	PROPOSAL_REQUEST_STOP_RESEARCH,
+
+	PROPOSAL_OFFER_REDUCE_NUCLEAR_WEAPONS,
 	PROPOSAL_REQUEST_REDUCE_NUCLEAR_WEAPONS,
-	
-	PROPOSAL_OFFER_REDUCE_BIO_WEAPONS,		
-	PROPOSAL_REQUEST_REDUCE_BIO_WEAPONS,	
-	
-	PROPOSAL_OFFER_REDUCE_NANO_WEAPONS,		
-	PROPOSAL_REQUEST_REDUCE_NANO_WEAPONS,	
-	
-	PROPOSAL_OFFER_GIVE_ADVANCE,			
-	PROPOSAL_REQUEST_GIVE_ADVANCE,			
-	
-	PROPOSAL_OFFER_GIVE_GOLD,				
-	PROPOSAL_REQUEST_GIVE_GOLD,				
-	
-	PROPOSAL_OFFER_REDUCE_POLLUTION,		
-	PROPOSAL_REQUEST_REDUCE_POLLUTION,		
-	
-	PROPOSAL_OFFER_MAP,						
-	PROPOSAL_REQUEST_MAP,					
-	
-	PROPOSAL_OFFER_HONOR_MILITARY_AGREEMENT,	
-	PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT,	
-	
-	PROPOSAL_OFFER_HONOR_POLLUTION_AGREEMENT,	
-	PROPOSAL_REQUEST_HONOR_POLLUTION_AGREEMENT,	
-	
-	PROPOSAL_OFFER_END_EMBARGO,				
-	PROPOSAL_REQUEST_END_EMBARGO,			
-	
-	
-	PROPOSAL_TREATY_DECLARE_WAR,			
-	PROPOSAL_TREATY_CEASEFIRE,				
-	PROPOSAL_TREATY_PEACE,					
-	PROPOSAL_TREATY_TRADE_PACT,				
-	PROPOSAL_TREATY_RESEARCH_PACT,			
-	PROPOSAL_TREATY_MILITARY_PACT,			
-	PROPOSAL_TREATY_POLLUTION_PACT,			
-	PROPOSAL_TREATY_ALLIANCE,				
+
+	PROPOSAL_OFFER_REDUCE_BIO_WEAPONS,
+	PROPOSAL_REQUEST_REDUCE_BIO_WEAPONS,
+
+	PROPOSAL_OFFER_REDUCE_NANO_WEAPONS,
+	PROPOSAL_REQUEST_REDUCE_NANO_WEAPONS,
+
+	PROPOSAL_OFFER_GIVE_ADVANCE,
+	PROPOSAL_REQUEST_GIVE_ADVANCE,
+
+	PROPOSAL_OFFER_GIVE_GOLD,
+	PROPOSAL_REQUEST_GIVE_GOLD,
+
+	PROPOSAL_OFFER_REDUCE_POLLUTION,
+	PROPOSAL_REQUEST_REDUCE_POLLUTION,
+
+	PROPOSAL_OFFER_MAP,
+	PROPOSAL_REQUEST_MAP,
+
+	PROPOSAL_OFFER_HONOR_MILITARY_AGREEMENT,
+	PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT,
+
+	PROPOSAL_OFFER_HONOR_POLLUTION_AGREEMENT,
+	PROPOSAL_REQUEST_HONOR_POLLUTION_AGREEMENT,
+
+	PROPOSAL_OFFER_END_EMBARGO,
+	PROPOSAL_REQUEST_END_EMBARGO,
+
+	PROPOSAL_TREATY_DECLARE_WAR,
+	PROPOSAL_TREATY_CEASEFIRE,
+	PROPOSAL_TREATY_PEACE,
+	PROPOSAL_TREATY_TRADE_PACT,
+	PROPOSAL_TREATY_RESEARCH_PACT,
+	PROPOSAL_TREATY_MILITARY_PACT,
+	PROPOSAL_TREATY_POLLUTION_PACT,
+	PROPOSAL_TREATY_ALLIANCE,
 	PROPOSAL_MAX
 };
 
@@ -221,7 +220,7 @@
 		    && gold         == a.gold
 		    && percent      == a.percent;
 	}
-	
+
 	bool operator<(const DiplomacyArg &a) const
 	{
 		return playerId     <= a.playerId
@@ -428,10 +427,10 @@
 	PLAYER_INDEX  senderId;
 	PLAYER_INDEX  receiverId;
 	RESPONSE_TYPE type;
-	
+
 	ProposalData  counter;
 	ThreatData    threat;
-	
+
 	StringId      explainStrId;
 	StringId      adviceStrId;
 	StringId      newsStrId;
@@ -448,7 +447,7 @@
 		explainStrId  (-1),
 		newsStrId     (-1)
 	{}
-	
+
 	bool operator==(const sint32 &tmpId) const
 	{
 		return tmpId == id;
@@ -458,7 +457,7 @@
 	{
 		return tmpId != id;
 	}
-	
+
 	bool operator==(const Threat &threat) const
 	{
 		return detail == threat.detail;
@@ -491,7 +490,7 @@
 namespace ai
 {
 	typedef sint16 Regard;
-	
+
 	struct Agreement
 	{
 		Agreement()
@@ -503,12 +502,12 @@
 			explainStrId  (-1),
 			newsStrId     (-1)
 		{}
-		
+
 		bool operator==(const sint32 &tmpId) const
 		{
-			return (tmpId == id); 
+			return (tmpId == id);
 		}
-		
+
 		bool operator==(const ai::Agreement & rval) const
 		{
 			return  senderId             == rval.senderId
@@ -548,7 +547,7 @@
 
 enum MOTIVATION_TYPE {
 	MOTIVATION_NONE,
-	
+
 	MOTIVATION_FEAR_SCENARIO,
 	MOTIVATION_FEAR_INVASION,
 	MOTIVATION_FEAR_CITY_DEFENSE,
@@ -560,7 +559,7 @@
 	MOTIVATION_FEAR_MILITARY_RANK,
 	MOTIVATION_FEAR_TRADE_RANK,
 	MOTIVATION_FEAR_POLLUTION,
-	
+
 	MOTIVATION_DESIRE_SCENARIO,
 	MOTIVATION_DESIRE_ATTACK,
 	MOTIVATION_DESIRE_ATTACK_CITY,
@@ -618,7 +617,7 @@
 		newsStrId   (-1)
 	{}
 
-	bool operator==(const AiState &a) const 
+	bool operator==(const AiState &a) const
 	{
 		return (dbIndex==a.dbIndex);
 	}

Modified: trunk/ctp2_code/ai/diplomacy/dstateevent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/dstateevent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/dstateevent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,17 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #include "c3.h"
 
 #include "DStateEvent.h"
@@ -24,11 +10,10 @@
 
 #include "aicause.h"
 #include "Diplomat.h"
-#include "mapanalysis.h" 
+#include "mapanalysis.h"
 #include "AgreementMatrix.h"
 #include "DiplomacyRecord.h"
 
-
 #include "player.h"
 
 
@@ -40,13 +25,11 @@
 STDEHANDLER(InitDStateEvent)
 {
 	PLAYER_INDEX playerId;
-	PLAYER_INDEX foreignerId;	
+	PLAYER_INDEX foreignerId;
 
-	
 	if (!args->GetPlayer(0, playerId))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, foreignerId))
 		return GEV_HD_Continue;
 
@@ -72,11 +55,9 @@
 	PLAYER_INDEX playerId;
 	PLAYER_INDEX foreignerId;
 
-	
 	if (!args->GetPlayer(0, playerId))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, foreignerId))
 		return GEV_HD_Continue;
 
@@ -97,20 +78,17 @@
 {
 	PLAYER_INDEX playerId;
 	PLAYER_INDEX foreignerId;
-	
-	
+
 	if (!args->GetPlayer(0, playerId))
 		return GEV_HD_Continue;
-	
-	
+
 	if (!args->GetPlayer(1, foreignerId))
 		return GEV_HD_Continue;
 
 	AiState state;
-	state.priority = 1;							
+	state.priority = 1;
 	g_theDiplomacyDB->GetNamedItem("DIPLOMACY_DEFAULT",state.dbIndex);
-	
-	
+
 	Diplomat & diplomat = Diplomat::GetDiplomat(playerId);
 	diplomat.ConsiderDiplomaticState(foreignerId, state);
 
@@ -118,136 +96,117 @@
 }
 
 
-
 STDEHANDLER(ProvokeWar_NextDStateEvent)
 {
 	PLAYER_INDEX playerId;
 	PLAYER_INDEX foreignerId;
-	
-	
+
 	if (!args->GetPlayer(0, playerId))
 		return GEV_HD_Continue;
-	
-	
+
 	if (!args->GetPlayer(1, foreignerId))
 		return GEV_HD_Continue;
 
 	Player * foreigner_ptr = g_player[foreignerId];
 	Player * player_ptr = g_player[playerId];
 
-	
 	if (foreigner_ptr == NULL || player_ptr == NULL)
 		return GEV_HD_Continue;
 
 	Diplomat & diplomat = Diplomat::GetDiplomat(playerId);
 
-	
 	if (!diplomat.DesireWarWith(foreignerId))
 		return GEV_HD_Continue;
-	
+
 	const PersonalityRecord * personality = diplomat.GetPersonality();
 
 	ai::Regard regard = diplomat.GetEffectiveRegard(foreignerId);
 
-	
-	if ( !personality->GetConquestAgressive() && 
+	if ( !personality->GetConquestAgressive() &&
 		 (!personality->GetAlignmentEvil() || !personality->GetDiscoveryMilitary()) )
 	{
 		return GEV_HD_Continue;
 	}
-	
 
-	
-	
+
+
+
 	if ( !personality->GetTrustworthinessChaotic() )
 	{
-		
+
 		if ( regard >= COLDWAR_REGARD && personality->GetAlignmentGood())
 		{
 			return GEV_HD_Continue;
 		}
-		
-		
+
 		if ( regard >= NEUTRAL_REGARD && personality->GetAlignmentNeutral())
 		{
 			return GEV_HD_Continue;
 		}
-		
-		DIPLOMATIC_STRENGTH player_strength = 
+
+		DIPLOMATIC_STRENGTH player_strength =
 			player_ptr->GetRelativeStrength(foreignerId);
-		
-		
-		
+
+
 		if (player_strength <= DIPLOMATIC_STRENGTH_VERY_WEAK)
 			return GEV_HD_Continue;
 	}
 
-	
 	AiState state;
-	state.priority = 75;							
+	state.priority = 75;
 	g_theDiplomacyDB->GetNamedItem("DIPLOMACY_PROVOKE_WAR",state.dbIndex);
-	
-	
+
 	g_theStringDB->GetStringID("SPY_PROVOKE_WAR_DS",state.spyStrId);
 	g_theStringDB->GetStringID("ADVICE_PROVOKE_WAR_DS",state.adviceStrId );
 	g_theStringDB->GetStringID("NEWS_PROVOKE_WAR_DS",state.newsStrId);
-	
-	
+
 	diplomat.ConsiderDiplomaticState(foreignerId, state);
 
 	return GEV_HD_Continue;
 }
 
 
-
 STDEHANDLER(MakeFriend_NextDStateEvent)
 {
 	PLAYER_INDEX playerId;
 	PLAYER_INDEX foreignerId;
 
-	
 	if (!args->GetPlayer(0, playerId))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, foreignerId))
 		return GEV_HD_Continue;
 
 	Player * foreigner_ptr = g_player[foreignerId];
 	Player * player_ptr = g_player[playerId];
 
-	
 	if (foreigner_ptr == NULL || player_ptr == NULL)
 		return GEV_HD_Continue;
 
 	Diplomat & diplomat = Diplomat::GetDiplomat(playerId);
-	
+
 	const PersonalityRecord * personality = diplomat.GetPersonality();
 
 //	ai::Regard regard = diplomat.GetEffectiveRegard(foreignerId);
 
-	
 	bool personality_match = (personality->GetConquestPassive() &&
 			personality->GetAlignmentGood() &&
 			personality->GetTrustworthinessLawful());
-	
-	
+
 	if (!personality_match && personality->GetConquestPassive())
 	{
-		personality_match = (personality->GetDiscoveryDiplomatic() || 
+		personality_match = (personality->GetDiscoveryDiplomatic() ||
 			 personality->GetDiscoveryEconomic());
 	}
 
-	
-	
+
 	if (!personality_match && personality->GetTrustworthinessChaotic())
 	{
-		DIPLOMATIC_STRENGTH player_strength = 
+		DIPLOMATIC_STRENGTH player_strength =
 			player_ptr->GetRelativeStrength(foreignerId);
-		
-		
-		
-		personality_match = (personality->GetAlignmentGood() && 
+
+
+		personality_match = (personality->GetAlignmentGood() &&
 			(player_strength >= DIPLOMATIC_STRENGTH_VERY_STRONG));
 	}
 
@@ -256,43 +215,38 @@
 		return GEV_HD_Continue;
 	}
 
-	
 	AiState state;
-	state.priority = 80;							
+	state.priority = 80;
 	g_theDiplomacyDB->GetNamedItem("DIPLOMACY_MAKE_FRIEND",state.dbIndex);
-	
-	
+
 	g_theStringDB->GetStringID("SPY_PROVOKE_WAR_DS",state.spyStrId);
 	g_theStringDB->GetStringID("ADVICE_PROVOKE_WAR_DS",state.adviceStrId );
 	g_theStringDB->GetStringID("NEWS_PROVOKE_WAR_DS",state.newsStrId);
-	
-	
+
 	diplomat.ConsiderDiplomaticState(foreignerId, state);
 
 	return GEV_HD_Continue;
 }
 
-
 void DiplomaticStateEventCallbacks::AddCallbacks()
 {
-	g_gevManager->AddCallback(GEV_InitDiplomaticState, 
-							  GEV_PRI_Primary, 
+	g_gevManager->AddCallback(GEV_InitDiplomaticState,
+							  GEV_PRI_Primary,
 							  &s_InitDStateEvent);
 
-	g_gevManager->AddCallback(GEV_NextDiplomaticState, 
-							  GEV_PRI_Primary, 
+	g_gevManager->AddCallback(GEV_NextDiplomaticState,
+							  GEV_PRI_Primary,
 							  &s_NextDStateEvent);
 
-	g_gevManager->AddCallback(GEV_NextDiplomaticState, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_NextDiplomaticState,
+							  GEV_PRI_Pre,
 							  &s_Default_NextDStateEvent);
 
-	g_gevManager->AddCallback(GEV_NextDiplomaticState, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_NextDiplomaticState,
+							  GEV_PRI_Pre,
 							  &s_ProvokeWar_NextDStateEvent);
 
-	g_gevManager->AddCallback(GEV_NextDiplomaticState, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_NextDiplomaticState,
+							  GEV_PRI_Pre,
 							  &s_MakeFriend_NextDStateEvent);
 }
-

Modified: trunk/ctp2_code/ai/diplomacy/foreigner.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/foreigner.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/foreigner.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -123,8 +123,8 @@
 		{
 			if (g_saveFileVersion >= 57)
 			{
-				archive >> event.regard;	
-				archive >> event.turn;		
+				archive >> event.regard;
+				archive >> event.turn;
 				archive >> event.duration;
 
 				archive >> buf_size;
@@ -191,21 +191,18 @@
 	archive << m_trustworthiness;
 	archive << (sint8)(m_hasInitiative?1:0);
 	archive << m_lastIncursion;
-	
-	
+
 	for (sint32 type = 0; type < (sint32) REGARD_EVENT_ALL; type++) {
 
-		
 		archive << (sint16) m_regardEventList[type].size();
 
-		
-		for (event_iter = m_regardEventList[type].begin(); 
-			 event_iter != m_regardEventList[type].end(); 
-			 ++event_iter) 
-		{
-			archive << (ai::Regard) event_iter->regard;	
-			archive << (sint16) event_iter->turn;		
-			archive << (sint16) event_iter->duration;    
+		for (event_iter = m_regardEventList[type].begin();
+			 event_iter != m_regardEventList[type].end();
+			 ++event_iter)
+		{
+			archive << (ai::Regard) event_iter->regard;
+			archive << (sint16) event_iter->turn;
+			archive << (sint16) event_iter->duration;
 			if (event_iter->explainStrId != -1)
 			{
 				name_str = g_theStringDB->GetIdStr(event_iter->explainStrId);
@@ -214,15 +211,14 @@
 			}
 			else
 			{
-				
+
 				archive << (sint16) 0;
 			}
 
-			
-			
-		} 
-		
-	} 
+
+		}
+
+	}
 
 	archive << (sint16) m_negotiationEvents.size();
 	NegotiationEventList::const_iterator negotiation_iter;
@@ -239,16 +235,16 @@
 	archive << (sint8)(m_embargo?1:0);
 }
 
-void Foreigner::BeginTurn() 
+void Foreigner::BeginTurn()
 {
 	m_goldFromTrade = 0;
 	m_goldFromTribute = 0;
 }
 
-ai::Regard Foreigner::GetEffectiveRegard() const 
+ai::Regard Foreigner::GetEffectiveRegard() const
 {
 	ai::Regard effectiveRegard = m_regardTotal + m_effectiveRegardModifier;
-	
+
 	if (effectiveRegard > MAX_REGARD)
 		effectiveRegard = MAX_REGARD;
 	else if (effectiveRegard < MIN_REGARD)
@@ -257,7 +253,6 @@
 	return effectiveRegard;
 }
 
-
 const ai::Regard & Foreigner::GetPublicRegard(const REGARD_EVENT_TYPE &type) const {
 	if (type == REGARD_EVENT_ALL)
 		return m_regardTotal;
@@ -265,12 +260,10 @@
 		return m_regard[type];
 }
 
-
 const ai::Regard & Foreigner::GetTrust() const {
 	return m_trustworthiness;
 }
 
-
 void Foreigner::SetTrust(const ai::Regard &trust) {
 	m_trustworthiness = trust;
 }
@@ -280,13 +273,12 @@
 
 
 
-void Foreigner::LogRegardEvent(const REGARD_EVENT_TYPE & type,  
+void Foreigner::LogRegardEvent(const REGARD_EVENT_TYPE & type,
 							   const RegardEvent & regardEvent ) {
 	m_regardEventList[type].push_front(regardEvent);
 }
 
 
-
 void Foreigner::RecomputeRegard(const DiplomacyRecord & diplomacy,
 								const sint32 & decayRound,
 								const ai::Regard baseRegard) {
@@ -294,17 +286,14 @@
 	ai::Regard max_regard_delta(0);
 	RegardEventList::iterator event_iter;
 
-	
 	m_regardTotal = baseRegard;
 	const DiplomacyRecord::RegardDecay *regard_decay = NULL;
-		
-	
+
 	for (sint32 type = 0; type < (sint32) REGARD_EVENT_ALL; type++) {
 
-		
 		m_regard[type] = NEUTRAL_REGARD;
 
-		switch (type) 
+		switch (type)
 		{
 		case REGARD_EVENT_SCENARIO:
 			diplomacy.GetScenarioEvent(regard_decay);
@@ -328,34 +317,31 @@
 			diplomacy.GetProductionEvent(regard_decay);
 			break;
 		default:
-			
+
 			Assert(0);
 		}
 
-		
 		event_iter = m_regardEventList[type].begin();
-		while (event_iter != m_regardEventList[type].end()) 
+		while (event_iter != m_regardEventList[type].end())
 		{
 			if (event_iter->turn < decayRound)
 			{
-				
+
 				if (event_iter->regard == 0 )
 				{
 					event_iter = m_regardEventList[type].erase(event_iter);
 					continue;
 				}
 
-				
 				if (event_iter->duration <= 0 && regard_decay != NULL)
 				{
 					if (event_iter->regard > 0)
 						event_iter->regard *= regard_decay->GetPositiveDecay();
 
-					
 					else
 						event_iter->regard *= regard_decay->GetNegativeDecay();
 				}
-				
+
 				else if ((sint32) event_iter->turn + (sint32) event_iter->duration < decayRound) {
 					event_iter = m_regardEventList[type].erase(event_iter);
 					continue;
@@ -377,7 +363,7 @@
 			}
 
 			if (abs(event_iter->regard) > max_regard_delta) {
-				
+
 				m_bestRegardExplain = event_iter->explainStrId;
 				max_regard_delta = abs(event_iter->regard);
 			}
@@ -388,7 +374,6 @@
 	}
 }
 
-
 const StringId & Foreigner::GetBestRegardExplain(const REGARD_EVENT_TYPE &type) const {
 	if (type == REGARD_EVENT_ALL)
 		return m_bestRegardExplain;
@@ -404,13 +389,11 @@
 	}
 }
 
-
 const Response & Foreigner::GetMyLastResponse() const
 {
 	return m_myLastResponse;
 }
 
-
 void Foreigner::SetMyLastResponse(const Response & response)
 {
 	m_myLastResponse = response;
@@ -424,16 +407,14 @@
 
 void Foreigner::AddTradeValue(const sint32 value)
 {
-	
+
 	m_goldFromTrade += value;
 }
 
-
 sint32 Foreigner::GetTradeFrom() const {
 	return m_goldFromTrade;
 }
 
-
 sint32 Foreigner::GetTributeFrom() const {
 	return m_goldFromTribute;
 }
@@ -444,8 +425,7 @@
 
 
 void Foreigner::ConsiderNewProposal(const NewProposal & newProposal ) {
-	
-	
+
 	if (m_myLastNewProposal.priority < newProposal.priority) {
 		m_myLastNewProposal = newProposal;
 	}
@@ -464,7 +444,7 @@
 	const NewProposal & newProposal
 ) const
 {
-	for 
+	for
 	(
 	    NegotiationEventList::const_iterator iter = m_negotiationEvents.begin();
 	    iter != m_negotiationEvents.end();
@@ -473,7 +453,7 @@
 	{
 		if(iter->proposal.senderId           == newProposal.senderId
 		&& iter->proposal.detail.first_type  == newProposal.detail.first_type
-		&& iter->proposal.detail.second_type == newProposal.detail.second_type 
+		&& iter->proposal.detail.second_type == newProposal.detail.second_type
 		){
 			if (iter->round >= 0)
 				return iter;
@@ -483,11 +463,10 @@
 	return m_negotiationEvents.end();
 }
 
-
-bool Foreigner::GetNewProposalTimeout(const NewProposal & newProposal, 
+bool Foreigner::GetNewProposalTimeout(const NewProposal & newProposal,
 						   const sint16 timeout_period) const
 {
-	NegotiationEventList::const_iterator iter = 
+	NegotiationEventList::const_iterator iter =
 		GetNegotiationEventIndex(newProposal);
 
 	if (iter == m_negotiationEvents.end())
@@ -500,10 +479,9 @@
 }
 
 
-
 void Foreigner::AddNewNegotiationEvent(const NegotiationEvent & event)
 {
-	
+
 	m_negotiationEvents.push_front(event);
 
 	sint32 numberOfNegotiatedEvents = 0;
@@ -528,7 +506,6 @@
 	}
 }
 
-
 const NegotiationEventList & Foreigner::GetNegotiationEvents() const
 {
 	return m_negotiationEvents;
@@ -586,19 +563,16 @@
 	m_lastIncursion = last_incursion;
 }
 
-
 sint32 Foreigner::GetLastIncursion() const
 {
 	return m_lastIncursion;
 }
 
-
 void Foreigner::SetHotwarAttack(const sint16 last_hot_war_attack)
 {
 	m_hotwarAttackedMe = last_hot_war_attack;
 }
 
-
 sint32 Foreigner::GetLastHotwarAttack() const
 {
 	if (m_hotwarAttackedMe == NEVER)
@@ -607,13 +581,11 @@
 	return NewTurnCount::GetCurrentRound() - m_hotwarAttackedMe;
 }
 
-
 void Foreigner::SetColdwarAttack(const sint16 last_cold_war_attack)
 {
 	m_coldwarAttackedMe = last_cold_war_attack;
 }
 
-
 sint32 Foreigner::GetLastColdwarAttack() const
 {
 	if (m_coldwarAttackedMe == NEVER)
@@ -622,13 +594,11 @@
 	return NewTurnCount::GetCurrentRound() - m_coldwarAttackedMe;
 }
 
-
 void Foreigner::SetGreetingTurn()
 {
 	m_greetingTurn = (sint16) NewTurnCount::GetCurrentRound();
 }
 
-
 sint32 Foreigner::GetTurnsSinceGreeting() const
 {
 	if (m_greetingTurn == NEVER)
@@ -637,45 +607,40 @@
 	return NewTurnCount::GetCurrentRound() - m_greetingTurn;
 }
 
-
 void Foreigner::DebugStatus() const
 {
 	RegardEventList::const_iterator event_iter;
 
-	
-	for (sint32 type = 0; type < (sint32) REGARD_EVENT_ALL; type++) 
+	for (sint32 type = 0; type < (sint32) REGARD_EVENT_ALL; type++)
 	{
 		DPRINTF(k_DBG_DIPLOMACY, ("Type = %s:\n",
 			s_regardEventNames[type].c_str()));
 
-		
-		for 
+		for
         (
             event_iter = m_regardEventList[type].begin();
 		    event_iter != m_regardEventList[type].end();
             ++event_iter
-        ) 
+        )
 		{
 			DPRINTF(k_DBG_DIPLOMACY, (" delta = %d [%s]\n",
 				event_iter->regard,
 				g_theStringDB->GetNameStr(event_iter->explainStrId) ));
-		} 
-	} 
+		}
+	}
 }
 
-
 void Foreigner::LogDebugStatus(const DiplomacyRecord & diplomacy) const
 {
 	RegardEventList::const_iterator event_iter;
 	double decay;
 	sint32 round;
 	const DiplomacyRecord::RegardDecay *regard_decay = NULL;
-	
-	
+
 	gslog_dipprint("     delta  : rnds/decay : regard change reason (type) \n");
-	for (sint32 type = 0; type < (sint32) REGARD_EVENT_ALL; type++) 
+	for (sint32 type = 0; type < (sint32) REGARD_EVENT_ALL; type++)
 	{
-		switch (type) 
+		switch (type)
 		{
 		case REGARD_EVENT_SCENARIO:
 			diplomacy.GetScenarioEvent(regard_decay);
@@ -699,27 +664,26 @@
 			diplomacy.GetProductionEvent(regard_decay);
 			break;
 		default:
-			
+
 			Assert(0);
 		}
-		
-		
-		for 
+
+		for
         (
             event_iter = m_regardEventList[type].begin();
 		    event_iter != m_regardEventList[type].end();
             ++event_iter
         )
 		{
-			
+
 			if (event_iter->duration < 0)
 			{
 				if (event_iter->regard < 0)
 					decay = regard_decay->GetNegativeDecay();
 				else
 					decay = regard_decay->GetPositiveDecay();
-				
-				gslog_dipprint("    %5d   :    %2.2f    : [%s] (%s)\n", 
+
+				gslog_dipprint("    %5d   :    %2.2f    : [%s] (%s)\n",
 					event_iter->regard,
 					decay,
 					event_iter->explainStrId<0?"":g_theStringDB->GetNameStr(event_iter->explainStrId),
@@ -729,24 +693,22 @@
 			{
 				round = (event_iter->turn - NewTurnCount::GetCurrentRound())
 					+ (sint32) event_iter->duration;
-				
-				gslog_dipprint("    %5d   :   %5d    : [%s] (%s)\n", 
+
+				gslog_dipprint("    %5d   :   %5d    : [%s] (%s)\n",
 					event_iter->regard,
 					round,
 					event_iter->explainStrId<0?"":g_theStringDB->GetNameStr(event_iter->explainStrId),
 					s_regardEventNames[type].c_str());
 			}
-		} 
-	} 
+		}
+	}
 }
 
-
 bool Foreigner::GetEmbargo() const
 {
 	return m_embargo;
 }
 
-
 void Foreigner::SetEmbargo(const bool embargo)
 {
 	m_embargo = embargo;

Modified: trunk/ctp2_code/ai/diplomacy/motivationevent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/motivationevent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/motivationevent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -3,7 +3,7 @@
 // Project      : Call To Power 2
 // File type    : C++ source
 // Description  : Diplomacy motivation events
-// Id           : $Id:$
+// Id           : $Id$
 //
 //----------------------------------------------------------------------------
 //
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -30,7 +30,6 @@
 
 #include "c3.h"
 
-
 #include "profileai.h"
 
 #include "Scheduler.h"
@@ -56,7 +55,6 @@
 #include "pollution.h"
 extern Pollution *g_thePollution;
 
-
 STDEHANDLER(MotivationEvent)
 {
 	sint32 playerId;
@@ -82,13 +80,11 @@
 
 	PLAYER_INDEX playerId;
 
-	
 	sint32 defend_goal_type = CtpAi::GetGoalDefendIndex();
 	Assert(defend_goal_type >= 0);
 	if (defend_goal_type < 0)
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(0, playerId))
 		return GEV_HD_Continue;
 
@@ -96,8 +92,7 @@
 	const Scheduler & scheduler = Scheduler::GetScheduler(playerId);
 	Motivation motivation;
 
-	
-	sint32 at_risk_value = 
+	sint32 at_risk_value =
 		scheduler.GetValueUnsatisfiedGoals(static_cast<GOAL_TYPE>(defend_goal_type));
 	Goal_ptr goal_ptr = scheduler.GetHighestPriorityGoal(static_cast<GOAL_TYPE>(defend_goal_type), false);
 
@@ -107,8 +102,7 @@
 
 	sint32 total_value = MapAnalysis::GetMapAnalysis().TotalValue(playerId);
 
-	
-	
+
 	if (at_risk_value > total_value * 0.10)
 	{
 		sint32 priority;
@@ -130,7 +124,7 @@
 	if (adviceId < 0)
 	{
 		char motivation_name[] = "MOTIVATION_DESIRE_GOLD_ADVICE";
-		BOOL found = 
+		BOOL found =
 			g_theStringDB->GetStringID(motivation_name, adviceId);
 		Assert(found);
 	}
@@ -146,7 +140,7 @@
 	bool low_reserves = (needed_reserves < g_player[playerId]->GetGold());
 	bool capitalist_personality = (diplomat.GetPersonality()->GetDiscoveryEconomic());
 
-	if ( rank < 75 || low_reserves || capitalist_personality) 
+	if ( rank < 75 || low_reserves || capitalist_personality)
 	{
 		sint32 priority;
 		diplomat.GetCurrentStrategy().GetDesireGold(priority);
@@ -182,7 +176,7 @@
 	sint32 friend_power = diplomat.GetFriendPower();
 	sint32 our_power = MapAnalysis::GetMapAnalysis().TotalThreat(playerId);
 	sint32 enemy_threat = diplomat.GetEnemyThreat();
-	bool friendly_personality = 
+	bool friendly_personality =
 		diplomat.GetPersonality()->GetDiscoveryDiplomatic() ||
 		diplomat.GetPersonality()->GetConquestPassive();
 
@@ -285,16 +279,16 @@
 
 	Diplomat & diplomat = Diplomat::GetDiplomat(playerId);
 	Motivation motivation;
-	
+
 	sint32 friend_power = diplomat.GetFriendPower();
 	sint32 our_power = MapAnalysis::GetMapAnalysis().TotalThreat(playerId);
 	sint32 enemy_threat = diplomat.GetEnemyThreat();
-	bool agressive_personality = 
+	bool agressive_personality =
 		diplomat.GetPersonality()->GetAlignmentEvil() ||
 		diplomat.GetPersonality()->GetDiscoveryMilitary() ||
 		diplomat.GetPersonality()->GetConquestAgressive();
 
-	bool friendly_personality = 
+	bool friendly_personality =
 		diplomat.GetPersonality()->GetDiscoveryDiplomatic() ||
 		diplomat.GetPersonality()->GetConquestPassive();
 
@@ -363,7 +357,7 @@
 
 	rank = g_player[playerId]->GetRank(STRENGTH_CAT_TRADE);
 
-	if ( rank < 75 || 
+	if ( rank < 75 ||
 		 (rank < 50 && diplomat.GetPersonality()->GetDiscoveryEconomic()) )
 	{
 		diplomat.GetCurrentStrategy().GetFearTradeRank(priority);
@@ -420,41 +414,41 @@
 	return GEV_HD_Continue;
 }
 
-void MotivationEventCallbacks::AddCallbacks() 
+void MotivationEventCallbacks::AddCallbacks()
 {
-	g_gevManager->AddCallback(GEV_ComputeMotivations, 
-							  GEV_PRI_Primary, 
+	g_gevManager->AddCallback(GEV_ComputeMotivations,
+							  GEV_PRI_Primary,
 							  &s_MotivationEvent);
 
 	g_gevManager->AddCallback(GEV_ComputeMotivations,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_ThreatenedCity_MotivationEvent);
 
 	g_gevManager->AddCallback(GEV_ComputeMotivations,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_DesireGold_MotivationEvent);
 
 	g_gevManager->AddCallback(GEV_ComputeMotivations,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_DesireMakeFriend_MotivationEvent);
 
 	g_gevManager->AddCallback(GEV_ComputeMotivations,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_StopPiracy_MotivationEvent);
 
 	g_gevManager->AddCallback(GEV_ComputeMotivations,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_EnlistFriends_MotivationEvent);
 
 	g_gevManager->AddCallback(GEV_ComputeMotivations,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_PressAdvantage_MotivationEvent);
 
 	g_gevManager->AddCallback(GEV_ComputeMotivations,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_FearRank_MotivationEvent);
 
 	g_gevManager->AddCallback(GEV_ComputeMotivations,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_FearPollution_MotivationEvent);
 }

Modified: trunk/ctp2_code/ai/diplomacy/nproposalevent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/nproposalevent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/nproposalevent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -24,8 +24,8 @@
 //
 // Modifications from the original Activision code:
 //
-// - Seperated the NewProposal event from the Response event so that the 
-//   NewProposal event can be called from slic witout any problems. (17-Oct-2007 Martin Gühmann) 
+// - Seperated the NewProposal event from the Response event so that the
+//   NewProposal event can be called from slic witout any problems. (17-Oct-2007 Martin Gühmann)
 //
 //----------------------------------------------------------------------------
 
@@ -41,7 +41,7 @@
 #include "player.h"
 #include "Strengths.h"
 #include "Diplomat.h"
-#include "mapanalysis.h" 
+#include "mapanalysis.h"
 #include "AdvanceRecord.h"
 #include "AgreementMatrix.h"
 #include "newturncount.h"
@@ -56,17 +56,14 @@
 #include "gold.h"
 
 
-
 STDEHANDLER(General_NewProposalEvent)
 {
 	PLAYER_INDEX sender;
-	PLAYER_INDEX receiver;	
+	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -75,28 +72,26 @@
 
 	const NewProposal & newProposal = sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if ( newProposal == Diplomat::s_badNewProposal ) {
-		
-		
+
 		sender_diplomat.ContinueDiplomacy(receiver);
-	} 
+	}
 	else {
-		
 
-		
-		
-		
-		
-		
+
+
+
+
+
+
 		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_NewProposalReady,
 						   GEA_Player, sender,
 						   GEA_Player, receiver,
 						   GEA_End);
 
-		
-		
-		
+
+
+
 		bool execute = false;
 		if(sender != g_selected_item->GetVisiblePlayer()) {
 			if(g_network.IsActive() && !g_network.IsLocalPlayer(sender)) {
@@ -116,8 +111,7 @@
 		if(execute) {
 			sender_diplomat.ExecuteNewProposal(receiver);
 		}
-		
-		
+
 		else {
 			if(!g_network.IsClient()) {
 				g_director->AddBeginScheduler(sender);
@@ -142,7 +136,6 @@
 	if (!args->GetInt(0, motivation_type))
 		return GEV_HD_Continue;
 
-	
 	if (gameEventType == GEV_FearMotivation) {
 		if (motivation_type != MOTIVATION_FEAR_SCENARIO)
 			return GEV_HD_Continue;
@@ -150,9 +143,9 @@
 	else if (gameEventType == GEV_DesireMotivation) {
 		if (motivation_type != MOTIVATION_DESIRE_SCENARIO)
 			return GEV_HD_Continue;
-	} 
+	}
 	else
-		
+
 		Assert(false);
 
 	if (!args->GetPlayer(0, sender))
@@ -163,100 +156,86 @@
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
-	
-	
 
-	
-	
+
+
+
+
 	sint32 priority = sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_TREATY_PEACE);
 
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
-	new_proposal.priority = static_cast<sint16>(priority);				  
-	
-	
-	new_proposal.detail.first_type = PROPOSAL_TREATY_PEACE; 
-	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;	   
-	
+
+	new_proposal.priority = static_cast<sint16>(priority);
+
+	new_proposal.detail.first_type = PROPOSAL_TREATY_PEACE;
+	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
+
 	new_proposal.receiverId = sender;
 	new_proposal.senderId = receiver;
-	
-	
-	
+
+
 	g_theStringDB->GetStringID("EXPLAIN_SCENARIO_FORCE_PEACE",new_proposal.explainStrId);
 	g_theStringDB->GetStringID("ADVICE_SCENARIO_FORCE_PEACE",new_proposal.adviceStrId);
 	g_theStringDB->GetStringID("NEWS_SCENARIO_FORCE_PEACE",new_proposal.newsStrId);
-	
-	
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 25 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
-	
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(LeaveOurBorders_NewProposalEvent) {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_ReactionMotivation)
 		return GEV_HD_Continue;
 
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
-	
+
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
-	
+
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
-	
-	
+
 	if (! sender_diplomat.GetBorderIncursionBy(receiver))
 		return GEV_HD_Continue;
-	
-	sint16 duration = 
+
+	sint16 duration =
 		AgreementMatrix::s_agreements.GetAgreementDuration(sender, receiver, PROPOSAL_REQUEST_WITHDRAW_TROOPS);
-	
-	
+
 	if (duration >= 0 && duration < 25)
 		return GEV_HD_Continue;
-	
-	
-	
-	sint32 priority = 
+
+
+	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_WITHDRAW_TROOPS);
-	
+
 	if (priority <= 0)
 		return GEV_HD_Continue;
-	
+
 	NewProposal new_proposal;
-	
-	
+
 	new_proposal.priority = static_cast<sint16>(priority);
-	
-	
-	new_proposal.detail.first_type = PROPOSAL_REQUEST_WITHDRAW_TROOPS;	
-	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;	   
-	
+
+	new_proposal.detail.first_type = PROPOSAL_REQUEST_WITHDRAW_TROOPS;
+	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
+
 	new_proposal.receiverId = receiver;
 	new_proposal.senderId = sender;
 
-	
-	
-	sint32 at_risk_value_percent = 
+
+	sint32 at_risk_value_percent =
 		MapAnalysis::GetMapAnalysis().AtRiskCitiesValue(sender, receiver);
 	if (at_risk_value_percent > 75)
 	{
@@ -265,26 +244,23 @@
 		{
 			sint32 max_cost = g_theAdvanceDB->Get(next_advance)->GetCost();
 			sint32 desired_advance = receiver_diplomat.GetDesiredAdvanceFrom( sender, 0, max_cost);
-			
-			
+
 			if (desired_advance >= 0)
 			{
 				new_proposal.detail.second_type = PROPOSAL_OFFER_GIVE_ADVANCE;
 				new_proposal.detail.second_arg.advanceType = desired_advance;
-				
+
 				new_proposal.detail.tone = DIPLOMATIC_TONE_MEEK;
 			}
 		}
 	}
 
-		
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 25 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
 
 	return GEV_HD_Continue;
@@ -303,7 +279,6 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -321,58 +296,48 @@
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
-	
 	if (sender_diplomat.GetTrust(receiver) < NEUTRAL_REGARD)
 		return GEV_HD_Continue;
 
 	Player *player_ptr = g_player[sender];
 	Assert(player_ptr != NULL);
 
-	
-	
-	sint32 offer_priority = 
+
+	sint32 offer_priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_OFFER_MAP);
 
-	sint32 request_priority = 
+	sint32 request_priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_MAP);
 
-	
 	if (sender_diplomat.TestPublicRegard(receiver, COLDWAR_REGARD))
 		return GEV_HD_Continue;
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(sender,receiver,PROPOSAL_TREATY_DECLARE_WAR) )
 		return GEV_HD_Continue;
 
-	
 	sint32 want_map_turns;
 	sender_diplomat.GetCurrentDiplomacy(receiver).GetWantMapTurns(want_map_turns);
 
 	ai::Agreement found;
 	found = AgreementMatrix::s_agreements.GetAgreement(sender,receiver, PROPOSAL_OFFER_MAP);
 
-	
 	sint32 sender_saw_map =
 		AgreementMatrix::s_agreements.GetAgreementDuration(sender, receiver, PROPOSAL_REQUEST_MAP);
 
-	
-	
+
 	if (sender_saw_map == -1 ||	sender_saw_map > want_map_turns)
 	{
 		NewProposal new_proposal;
 
-		
-		new_proposal.priority = static_cast<sint16>((offer_priority + request_priority) / 2);		
+		new_proposal.priority = static_cast<sint16>((offer_priority + request_priority) / 2);
+
+		new_proposal.detail.first_type = PROPOSAL_REQUEST_MAP;
+		new_proposal.detail.second_type = PROPOSAL_OFFER_MAP;
+		new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
 
-		
-		new_proposal.detail.first_type = PROPOSAL_REQUEST_MAP;	
-		new_proposal.detail.second_type = PROPOSAL_OFFER_MAP;	
-		new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;	    
-		
 		new_proposal.receiverId = receiver;
 		new_proposal.senderId = sender;
 
-		
 
 		g_theStringDB->GetStringID("EXPLAIN_EXCHANGE_MAPS_0001",new_proposal.explainStrId);
 		g_theStringDB->GetStringID("ADVICE_EXCHANGE_MAPS_0001",new_proposal.adviceStrId);
@@ -385,18 +350,16 @@
 			sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
 		}
 	}
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(MakePeace_NewProposalEvent)
 {
 	sint32 desireType;
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -415,80 +378,66 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_TREATY_PEACE);
 
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.TestEffectiveRegard(receiver, NEUTRAL_REGARD))
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetLastHotwarAttack(receiver) < 10)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetLastColdwarAttack(receiver) < 5)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetLastBorderIncursionBy(receiver) + 20 < NewTurnCount::GetCurrentRound())
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetTrust(receiver) < COLDWAR_REGARD)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.DesireWarWith(receiver))
 		return GEV_HD_Continue;
-	
+
 	NewProposal new_proposal;
-	
-	
-	new_proposal.priority = static_cast<sint16>(priority);	
-	new_proposal.senderId = sender;		
-	new_proposal.receiverId = receiver;	
-	new_proposal.detail.first_type = PROPOSAL_TREATY_PEACE; 
-	new_proposal.detail.tone = DIPLOMATIC_TONE_KIND;   
-	
-	
+
+	new_proposal.priority = static_cast<sint16>(priority);
+	new_proposal.senderId = sender;
+	new_proposal.receiverId = receiver;
+	new_proposal.detail.first_type = PROPOSAL_TREATY_PEACE;
+	new_proposal.detail.tone = DIPLOMATIC_TONE_KIND;
+
 	g_theStringDB->GetStringID("EXPLAIN_PEACE_TREATY",new_proposal.explainStrId);
 	g_theStringDB->GetStringID("ADVICE_PEACE_TREATY",new_proposal.adviceStrId);
 	g_theStringDB->GetStringID("NEWS_PEACE_TREATY",new_proposal.newsStrId);
-	
-	
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 25 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal( receiver, new_proposal);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(CeaseFire_NewProposalEvent)
 {
 	sint32 fearType;
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_FearMotivation)
 		return GEV_HD_Continue;
 
 	if (!args->GetInt(0, fearType))
 		return GEV_HD_Continue;
 
-	
 	if ((MOTIVATION_TYPE) fearType != MOTIVATION_FEAR_INVASION &&
 		(MOTIVATION_TYPE) fearType != MOTIVATION_FEAR_CITY_DEFENSE &&
 		(MOTIVATION_TYPE) fearType != MOTIVATION_FEAR_MILITARY_RANK )
@@ -503,95 +452,83 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_TREATY_CEASEFIRE);
 
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
-	DIPLOMATIC_STRENGTH sender_strength = 
+	DIPLOMATIC_STRENGTH sender_strength =
 		g_player[sender]->GetRelativeStrength(receiver);
 
-	
 	if (sender_strength > DIPLOMATIC_STRENGTH_AVERAGE )
 		return GEV_HD_Continue;
 
-	sint32 at_risk_value_percent = 
+	sint32 at_risk_value_percent =
 		MapAnalysis::GetMapAnalysis().AtRiskCitiesValue(sender, receiver);
 
-	
 	if (at_risk_value_percent < 75 && sender_diplomat.GetLastHotwarAttack(receiver) < 5)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetTrust(receiver) < HOTWAR_REGARD)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.DesireWarWith(receiver))
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
+
 	new_proposal.priority = static_cast<sint16>(priority);
-	new_proposal.senderId = sender;		
-	new_proposal.receiverId = receiver;	
-	new_proposal.detail.first_type = PROPOSAL_TREATY_CEASEFIRE; 
-	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;	   
+	new_proposal.senderId = sender;
+	new_proposal.receiverId = receiver;
+	new_proposal.detail.first_type = PROPOSAL_TREATY_CEASEFIRE;
+	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
+
 
-	
-	
 	if (at_risk_value_percent > 75)
 	{
-		
+
 		new_proposal.detail.tone = DIPLOMATIC_TONE_MEEK;
 
-		sint32 max_can_pay_gold = 
+		sint32 max_can_pay_gold =
             std::min(g_player[receiver]->m_gold->GetIncome() * 2, g_player[sender]->GetGold());
 
-		
 		max_can_pay_gold = ProposalAnalysis::RoundGold(max_can_pay_gold);
 		sint32 next_advance = receiver_diplomat.GetNextAdvance();
 
-		
 		if (max_can_pay_gold > 0)
 		{
 			new_proposal.detail.second_type = PROPOSAL_OFFER_GIVE_GOLD;
 			new_proposal.detail.second_arg.gold = max_can_pay_gold;
-	
+
 		}
-		
+
 		else if (next_advance >= 0)
 		{
 			sint32 max_cost = g_theAdvanceDB->Get(next_advance)->GetCost();
 			sint32 desired_advance = receiver_diplomat.GetDesiredAdvanceFrom( sender, 0, max_cost);
-			
-			
+
 			if (desired_advance >= 0)
 			{
 				new_proposal.detail.second_type = PROPOSAL_OFFER_GIVE_ADVANCE;
 				new_proposal.detail.second_arg.advanceType = desired_advance;
 			}
 		}
-		
+
 		else
 		{
-			
+
 			new_proposal.detail.second_type = PROPOSAL_OFFER_MAP;
 		}
 	}
 
-	
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 25 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal( receiver, new_proposal);
 
 	return GEV_HD_Continue;
@@ -603,14 +540,12 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_FearMotivation)
 		return GEV_HD_Continue;
 
 	if (!args->GetInt(0, fearType))
 		return GEV_HD_Continue;
 
-	
 	if ((MOTIVATION_TYPE) fearType != MOTIVATION_FEAR_POLLUTION)
 		return GEV_HD_Continue;
 
@@ -623,8 +558,7 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_REDUCE_POLLUTION);
 
@@ -635,14 +569,12 @@
 	uint32 receiver_pollution = g_player[receiver]->GetPollutionLevel();
 	double pollution_ratio = (double) sender_pollution / receiver_pollution;
 
-	
 	if (pollution_ratio > 1.5)
 		return GEV_HD_Continue;
 
-	double reduce_percent = 0.05; 
+	double reduce_percent = 0.05;
 	DIPLOMATIC_TONE tone = DIPLOMATIC_TONE_EQUAL;
 
-	
 	if (sender_diplomat.GetPersonality()->GetDiscoveryEcotopian() &&
 		pollution_ratio < 1.0)
 	{
@@ -656,21 +588,20 @@
 		tone = DIPLOMATIC_TONE_INDIGNANT;
 	}
 
-	
 	reduce_percent = ProposalAnalysis::RoundPercentReduction(reduce_percent);
 	sint32 target_pollution = static_cast<sint16>((1.0 - reduce_percent) * receiver_pollution);
 	target_pollution = ProposalAnalysis::RoundGold(target_pollution);
 	if (target_pollution > 0)
 	{
 		NewProposal new_proposal;
-		
+
 		new_proposal.priority = static_cast<sint16>(priority);
-		new_proposal.senderId = sender;		
-		new_proposal.receiverId = receiver;	
-		new_proposal.detail.first_type = PROPOSAL_REQUEST_REDUCE_POLLUTION; 
+		new_proposal.senderId = sender;
+		new_proposal.receiverId = receiver;
+		new_proposal.detail.first_type = PROPOSAL_REQUEST_REDUCE_POLLUTION;
 		new_proposal.detail.first_arg.pollution = target_pollution;
-		new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;	   
-		
+		new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
+
 		if (!sender_diplomat.GetNewProposalTimeout(new_proposal, 20))
 		{
 			sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
@@ -680,21 +611,18 @@
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(HonorPollutionAgreement_NewProposalEvent)
 {
 	sint32 fearType;
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_FearMotivation)
 		return GEV_HD_Continue;
 
 	if (!args->GetInt(0, fearType))
 		return GEV_HD_Continue;
 
-	
 	if ((MOTIVATION_TYPE) fearType != MOTIVATION_FEAR_POLLUTION)
 		return GEV_HD_Continue;
 
@@ -707,16 +635,14 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_HONOR_POLLUTION_AGREEMENT);
 
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
-	
-	ai::Agreement agreement = 
+	ai::Agreement agreement =
 		AgreementMatrix::s_agreements.GetAgreement(sender, receiver, PROPOSAL_TREATY_POLLUTION_PACT);
 
 	if (agreement == AgreementMatrix::s_badAgreement)
@@ -726,31 +652,28 @@
 		return GEV_HD_Continue;
 
 	uint32 receiver_pollution = g_player[receiver]->GetPollutionLevel();
-	uint32 promised_pollution = 
+	uint32 promised_pollution =
         static_cast<uint32>(std::max<sint32>(0, agreement.proposal.first_arg.pollution));
 	uint32 half_promised_pollution = promised_pollution / 2;
 	double pollution_ratio = (double) receiver_pollution / promised_pollution;
 
 	sint32 turns_since_start = NewTurnCount::GetCurrentRound() - agreement.start;
 
-	
 	if (pollution_ratio <= 1.0)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetPersonality()->GetDiscoveryEcotopian() &&
 		turns_since_start < 10)
 	{
 		return GEV_HD_Continue;
 	}
-	
-	else 
+
+	else
 	{
-		
-		if (turns_since_start < 20) 
+
+		if (turns_since_start < 20)
 			return GEV_HD_Continue;
-		
-		
+
 		if (turns_since_start > 20 && turns_since_start < 50 &&
 			receiver_pollution <= half_promised_pollution)
 			return GEV_HD_Continue;
@@ -759,36 +682,31 @@
 //	DIPLOMATIC_TONE tone = DIPLOMATIC_TONE_EQUAL;
 
 	NewProposal new_proposal;
-	
-	
-	new_proposal.priority = static_cast<sint16>(priority);	
-	new_proposal.senderId = sender;		
-	new_proposal.receiverId = receiver;	
-	new_proposal.detail.first_type = PROPOSAL_REQUEST_HONOR_POLLUTION_AGREEMENT; 
+
+	new_proposal.priority = static_cast<sint16>(priority);
+	new_proposal.senderId = sender;
+	new_proposal.receiverId = receiver;
+	new_proposal.detail.first_type = PROPOSAL_REQUEST_HONOR_POLLUTION_AGREEMENT;
 	new_proposal.detail.first_arg.pollution = promised_pollution;
-	new_proposal.detail.tone = DIPLOMATIC_TONE_INDIGNANT;	   
-	
-	
+	new_proposal.detail.tone = DIPLOMATIC_TONE_INDIGNANT;
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal( receiver, new_proposal);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(TradePact_NewProposalEvent)
 {
 	sint32 desireType;
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -808,35 +726,28 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_TRADE_PACT))
 		return GEV_HD_Continue;
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_TREATY_TRADE_PACT);
 
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.TestEffectiveRegard(receiver, FRIEND_REGARD))
 			return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetLastHotwarAttack(receiver) < 10)
 		return GEV_HD_Continue;
 
-	
 	if (MapAnalysis::GetMapAnalysis().GetPiracyIncomeByPlayer(receiver, sender) > 0)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetBorderIncursionBy(receiver))
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetTrust(receiver) < NEUTRAL_REGARD)
 		return GEV_HD_Continue;
 
@@ -844,24 +755,21 @@
 	sint32 receiver_trade_from = receiver_diplomat.GetTradeFrom(sender);
 	sint32 sender_trade_total = MapAnalysis::GetMapAnalysis().GetTotalTrade(sender);
 
-	
 	if ( ((double) sender_trade_from / sender_trade_total) < 0.10)
 		return GEV_HD_Continue;
 
-	
-	
+
 	if ( receiver_trade_from > sender_trade_from * 2)
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
+
 	new_proposal.priority = static_cast<sint16>(priority);
-	new_proposal.senderId = sender;		
-	new_proposal.receiverId = receiver;	
-	new_proposal.detail.first_type = PROPOSAL_TREATY_TRADE_PACT; 
-	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;   
-	
+	new_proposal.senderId = sender;
+	new_proposal.receiverId = receiver;
+	new_proposal.detail.first_type = PROPOSAL_TREATY_TRADE_PACT;
+	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
+
 	if (!sender_diplomat.GetNewProposalTimeout( new_proposal, 22 ) )
 	{
 		sender_diplomat.ConsiderNewProposal( receiver, new_proposal);
@@ -870,30 +778,28 @@
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(ResearchPact_NewProposalEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
-	if (gameEventType == GEV_DesireMotivation) 
+	if (gameEventType == GEV_DesireMotivation)
 	{
 		sint32 desireType;
-		
+
 		if (!args->GetInt(0, desireType))
 			return GEV_HD_Continue;
-		
+
 		if ((MOTIVATION_TYPE) desireType != MOTIVATION_DESIRE_MAKE_FRIEND)
 			return GEV_HD_Continue;
 	}
-	else if (gameEventType == GEV_FearMotivation) 
+	else if (gameEventType == GEV_FearMotivation)
 	{
 		sint32 fearType;
-		
+
 		if (!args->GetInt(0, fearType))
 			return GEV_HD_Continue;
-		
+
 		if ((MOTIVATION_TYPE) fearType != MOTIVATION_FEAR_SCIENCE_RANK)
 			return GEV_HD_Continue;
 	}
@@ -909,48 +815,41 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_TREATY_RESEARCH_PACT);
 
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.TestEffectiveRegard(receiver, FRIEND_REGARD))
 			return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetLastHotwarAttack(receiver) < 10)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetBorderIncursionBy(receiver))
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetTrust(receiver) < NEUTRAL_REGARD)
 		return GEV_HD_Continue;
 
 	sint32 sender_science = MapAnalysis::GetMapAnalysis().GetProjectedScience(sender);
 	sint32 receiver_science = MapAnalysis::GetMapAnalysis().GetProjectedScience(receiver);
 
-	
-	if ( sender_science > receiver_science && 
+	if ( sender_science > receiver_science &&
 		 ((double) receiver_science / sender_science < 0.8))
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
-	new_proposal.priority = static_cast<sint16>(priority);	
-	new_proposal.senderId = sender;		
-	new_proposal.receiverId = receiver;	
-	new_proposal.detail.first_type = PROPOSAL_TREATY_RESEARCH_PACT; 
-	new_proposal.detail.tone = 
+
+	new_proposal.priority = static_cast<sint16>(priority);
+	new_proposal.senderId = sender;
+	new_proposal.receiverId = receiver;
+	new_proposal.detail.first_type = PROPOSAL_TREATY_RESEARCH_PACT;
+	new_proposal.detail.tone =
 		(sender_science < receiver_science) ? DIPLOMATIC_TONE_MEEK : DIPLOMATIC_TONE_EQUAL;
-	
+
 	if (!sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 	{
 		sender_diplomat.ConsiderNewProposal( receiver, new_proposal);
@@ -959,31 +858,29 @@
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(MilitaryPact_NewProposalEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
-	if (gameEventType == GEV_DesireMotivation) 
+	if (gameEventType == GEV_DesireMotivation)
 	{
 		sint32 desireType;
-		
+
 		if (!args->GetInt(0, desireType))
 			return GEV_HD_Continue;
-		
+
 		if ((MOTIVATION_TYPE) desireType != MOTIVATION_DESIRE_MAKE_FRIEND ||
 			(MOTIVATION_TYPE) desireType != MOTIVATION_DESIRE_ENLIST_FRIEND)
 			return GEV_HD_Continue;
 	}
-	else if (gameEventType == GEV_FearMotivation) 
+	else if (gameEventType == GEV_FearMotivation)
 	{
 		sint32 fearType;
-		
+
 		if (!args->GetInt(0, fearType))
 			return GEV_HD_Continue;
-		
+
 		if ((MOTIVATION_TYPE) fearType != MOTIVATION_FEAR_MILITARY_RANK)
 			return GEV_HD_Continue;
 	}
@@ -999,64 +896,53 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_MILITARY_PACT))
 		return GEV_HD_Continue;
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_TREATY_MILITARY_PACT);
 
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.TestEffectiveRegard(receiver, FRIEND_REGARD))
 			return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetLastHotwarAttack(receiver) < 10)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetBorderIncursionBy(receiver))
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetTrust(receiver) < NEUTRAL_REGARD)
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.CanFormAlliance(receiver))
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
+
 	new_proposal.priority = static_cast<sint16>(priority);
-	new_proposal.senderId = sender;		
-	new_proposal.receiverId = receiver;	
-	new_proposal.detail.first_type = PROPOSAL_TREATY_MILITARY_PACT; 
-	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;   
-	
-	
+	new_proposal.senderId = sender;
+	new_proposal.receiverId = receiver;
+	new_proposal.detail.first_type = PROPOSAL_TREATY_MILITARY_PACT;
+	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
+
 	if (!sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 	{
 		sender_diplomat.ConsiderNewProposal( receiver, new_proposal);
 	}
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(PollutionPact_NewProposalEvent)
 {
 	sint32 fearType;
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_FearMotivation)
 		return GEV_HD_Continue;
 
@@ -1075,34 +961,27 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_POLLUTION_PACT))
 		return GEV_HD_Continue;
 
-	
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_TREATY_POLLUTION_PACT);
 
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.TestEffectiveRegard(receiver, NEUTRAL_REGARD))
 			return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetLastHotwarAttack(receiver) < 10)
 		return GEV_HD_Continue;
 
-	
 	if (MapAnalysis::GetMapAnalysis().GetPiracyIncomeByPlayer(receiver, sender) > 0)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetBorderIncursionBy(receiver))
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetTrust(receiver) < NEUTRAL_REGARD)
 		return GEV_HD_Continue;
 
@@ -1110,14 +989,12 @@
 	uint32 receiver_pollution = g_player[receiver]->GetPollutionLevel();
 	double pollution_ratio = (double) sender_pollution / receiver_pollution;
 
-	
 	if (pollution_ratio > 1.5)
 		return GEV_HD_Continue;
 
-	double reduce_percent = 0.05; 
+	double reduce_percent = 0.05;
 	DIPLOMATIC_TONE tone = DIPLOMATIC_TONE_EQUAL;
 
-	
 	if (sender_diplomat.GetPersonality()->GetDiscoveryEcotopian() &&
 		pollution_ratio < 1.0)
 	{
@@ -1131,7 +1008,6 @@
 		tone = DIPLOMATIC_TONE_EQUAL;
 	}
 
-	
 	reduce_percent = ProposalAnalysis::RoundPercentReduction(reduce_percent);
 	sint32 target_pollution = static_cast<sint32>(reduce_percent * receiver_pollution);
 	target_pollution = ProposalAnalysis::RoundGold(target_pollution);
@@ -1139,37 +1015,32 @@
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
+
 	new_proposal.priority = static_cast<sint16>(priority);
-	new_proposal.senderId = sender;		
-	new_proposal.receiverId = receiver;	
-	new_proposal.detail.first_type = PROPOSAL_TREATY_POLLUTION_PACT; 
-	new_proposal.detail.first_arg.pollution = 
+	new_proposal.senderId = sender;
+	new_proposal.receiverId = receiver;
+	new_proposal.detail.first_type = PROPOSAL_TREATY_POLLUTION_PACT;
+	new_proposal.detail.first_arg.pollution =
 		static_cast<sint32>((1.0 - reduce_percent) * receiver_pollution);
-	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;   
-	
-	
+	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal( receiver, new_proposal);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(Alliance_NewProposalEvent)
 {
 	sint32 desireType;
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -1188,80 +1059,66 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_ALLIANCE))
 		return GEV_HD_Continue;
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_TREATY_ALLIANCE);
 
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.TestEffectiveRegard(receiver, ALLIED_REGARD))
 			return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetLastHotwarAttack(receiver) < 25)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetLastColdwarAttack(receiver) < 15)
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetBorderIncursionBy(receiver))
 		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetTrust(receiver) < FRIEND_REGARD)
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.CanFormAlliance(receiver))
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
+
 	new_proposal.priority = static_cast<sint16>(priority);
-	new_proposal.senderId = sender;		
-	new_proposal.receiverId = receiver;	
-	new_proposal.detail.first_type = PROPOSAL_TREATY_ALLIANCE; 
-	new_proposal.detail.tone = DIPLOMATIC_TONE_KIND;   
-	
-	
+	new_proposal.senderId = sender;
+	new_proposal.receiverId = receiver;
+	new_proposal.detail.first_type = PROPOSAL_TREATY_ALLIANCE;
+	new_proposal.detail.tone = DIPLOMATIC_TONE_KIND;
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 50 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal( receiver, new_proposal);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(RequestAdvance_NewProposalEvent)
 {
 	sint32 fearType;
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_FearMotivation)
 		return GEV_HD_Continue;
 
 	if (!args->GetInt(0, fearType))
 		return GEV_HD_Continue;
 
-	
-	
+
 	if ((MOTIVATION_TYPE) fearType != MOTIVATION_FEAR_SCIENCE_RANK)
 		return GEV_HD_Continue;
 
@@ -1275,16 +1132,15 @@
 	sint32 receiver_science_rank = g_player[receiver]->GetRank(STRENGTH_CAT_KNOWLEDGE);
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
-	
+
 	if (
-		
+
 		sender_diplomat.TestEffectiveRegard(receiver, NEUTRAL_REGARD) &&
 
-		
-		
+
 		( receiver_science_rank > sender_science_rank + 20) )
 	{
-		
+
 		NewProposal new_proposal;
 
 		sint32 next_advance = sender_diplomat.GetNextAdvance();
@@ -1298,65 +1154,57 @@
 			return GEV_HD_Continue;
 		}
 
-		
 		max_cost = (sint32) ((double) max_cost * 1.20);
 		sint32 min_cost = (sint32) ((double) max_cost * 0.50);
 
 		sint32 desired_advance = sender_diplomat.GetDesiredAdvanceFrom( receiver,  min_cost, max_cost);
-		
+
 		if (desired_advance < 0)
 			{
 				return GEV_HD_Continue;
 			}
 
-		
 		sint32 priority =
 			sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_GIVE_ADVANCE);
 
 		new_proposal.priority = static_cast<sint16>(priority);
-		new_proposal.senderId = sender;			
-		new_proposal.receiverId = receiver;		
-		new_proposal.detail.first_type = PROPOSAL_REQUEST_GIVE_ADVANCE;	
+		new_proposal.senderId = sender;
+		new_proposal.receiverId = receiver;
+		new_proposal.detail.first_type = PROPOSAL_REQUEST_GIVE_ADVANCE;
 		new_proposal.detail.first_arg.advanceType = desired_advance;
-		new_proposal.detail.second_type = PROPOSAL_NONE;	
+		new_proposal.detail.second_type = PROPOSAL_NONE;
 
-		new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;	   
+		new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
 
-		
 		g_theStringDB->GetStringID("EXPLAIN_REQUEST_ADVANCE",new_proposal.explainStrId);
 		g_theStringDB->GetStringID("ADVICE_REQUEST_ADVANCE",new_proposal.adviceStrId);
 		g_theStringDB->GetStringID("NEWS_REQUEST_ADVANCE",new_proposal.newsStrId);
 
-		
 		if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 			{
-				
+
 				return GEV_HD_Continue;
 			}
 
-		
 		sender_diplomat.ConsiderNewProposal( receiver, new_proposal);
 	}
-	
+
 	return GEV_HD_Continue;
 }
 
 
-
 STDEHANDLER(StopPiracy_NewProposalEvent)
 {
 	sint32 motivation_type;
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_FearMotivation)
 		return GEV_HD_Continue;
 
 	if (!args->GetInt(0, motivation_type))
 		return GEV_HD_Continue;
 
-	
 	if ((MOTIVATION_TYPE) motivation_type != MOTIVATION_FEAR_PIRACY )
 		return GEV_HD_Continue;
 
@@ -1370,53 +1218,45 @@
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 	const MapAnalysis & map = MapAnalysis::GetMapAnalysis();
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_STOP_PIRACY);
 
-	
-	
+
 	sint32 turns_since_last_war = AgreementMatrix::s_agreements.TurnsSinceLastWar(sender, receiver);
 	if ( (map.GetPiracyIncomeByPlayer(receiver, sender) > 0) &&
 		  ((turns_since_last_war > 0) || (turns_since_last_war == -1)))
 	{
-		
+
 		NewProposal new_proposal;
 
-		
 		new_proposal.priority = static_cast<sint16>(priority);
-		new_proposal.senderId = sender;		
-		new_proposal.receiverId = receiver;	
-		new_proposal.detail.first_type = PROPOSAL_REQUEST_STOP_PIRACY; 
-		new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;	   
+		new_proposal.senderId = sender;
+		new_proposal.receiverId = receiver;
+		new_proposal.detail.first_type = PROPOSAL_REQUEST_STOP_PIRACY;
+		new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
 
-		
 		g_theStringDB->GetStringID("EXPLAIN_PEACE_TREATY",new_proposal.explainStrId);
 		g_theStringDB->GetStringID("ADVICE_PEACE_TREATY",new_proposal.adviceStrId);
 		g_theStringDB->GetStringID("NEWS_PEACE_TREATY",new_proposal.newsStrId);
 
-		
 		if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 			{
-				
+
 				return GEV_HD_Continue;
 			}
 
-		
 		sender_diplomat.ConsiderNewProposal( receiver, new_proposal );
 	}
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(BegForGold_NewProposalEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -1424,7 +1264,6 @@
 	if (!args->GetInt(0, desireType))
 		return GEV_HD_Continue;
 
-	
 	if ((MOTIVATION_TYPE) desireType != MOTIVATION_DESIRE_GOLD &&
 		(MOTIVATION_TYPE) desireType != MOTIVATION_DESIRE_ENLIST_FRIEND)
 		return GEV_HD_Continue;
@@ -1438,57 +1277,51 @@
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
-	bool allied = 
+	bool allied =
 		AgreementMatrix::s_agreements.HasAgreement(sender,receiver,PROPOSAL_TREATY_MILITARY_PACT) ||
 		AgreementMatrix::s_agreements.HasAgreement(sender,receiver,PROPOSAL_TREATY_ALLIANCE);
 
-	
 	if (!receiver_diplomat.TestPublicRegard(sender, FRIEND_REGARD) && !allied)
 		return GEV_HD_Continue;
 
-	DIPLOMATIC_STRENGTH receiver_strength = 
+	DIPLOMATIC_STRENGTH receiver_strength =
 		g_player[receiver]->GetRelativeStrength(sender);
 
-	
 	if (receiver_strength < DIPLOMATIC_STRENGTH_STRONG )
 		return GEV_HD_Continue;
 
-	
 	if (MapAnalysis::GetMapAnalysis().AtRiskCitiesValue(sender) < 60)
 		return GEV_HD_Continue;
 
-	
 	sint32 gold = ProposalAnalysis::RoundGold(5 * g_player[sender]->m_gold->GetIncome());
 
 	if (gold <= 0)
 		return GEV_HD_Continue;
-	
+
 	NewProposal new_proposal;
-	
+
 	new_proposal.priority               = static_cast<sint16>
         (sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_GIVE_GOLD));
-	new_proposal.detail.first_type      = PROPOSAL_REQUEST_GIVE_GOLD;	
-	new_proposal.detail.first_arg.gold  = gold; 
-    new_proposal.detail.tone            = 
-        (allied) ? DIPLOMATIC_TONE_KIND : DIPLOMATIC_TONE_MEEK;	   
+	new_proposal.detail.first_type      = PROPOSAL_REQUEST_GIVE_GOLD;
+	new_proposal.detail.first_arg.gold  = gold;
+    new_proposal.detail.tone            =
+        (allied) ? DIPLOMATIC_TONE_KIND : DIPLOMATIC_TONE_MEEK;
 	new_proposal.receiverId             = receiver;
 	new_proposal.senderId               = sender;
-	
+
 	if (!sender_diplomat.GetNewProposalTimeout(new_proposal, 50))
 	{
 	    sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
 	}
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(BlackmailGold_NewProposalEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -1496,7 +1329,6 @@
 	if (!args->GetInt(0, desireType))
 		return GEV_HD_Continue;
 
-	
 	if ((MOTIVATION_TYPE) desireType != MOTIVATION_DESIRE_GOLD &&
 		(MOTIVATION_TYPE) desireType != MOTIVATION_DESIRE_ATTACK)
 		return GEV_HD_Continue;
@@ -1509,77 +1341,64 @@
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
-	
 	if (!sender_diplomat.GetPersonality()->GetConquestAgressive() &&
 		!sender_diplomat.GetPersonality()->GetDiscoveryMilitary())
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.TestEffectiveRegard(receiver, COLDWAR_REGARD))
 		return GEV_HD_Continue;
 
 	Assert(g_player[sender]);
 	Assert(g_player[receiver]);
 
-	DIPLOMATIC_STRENGTH sender_strength = 
+	DIPLOMATIC_STRENGTH sender_strength =
 		g_player[sender]->GetRelativeStrength(receiver);
 
-	
 	if (sender_strength < DIPLOMATIC_STRENGTH_STRONG )
 		return GEV_HD_Continue;
 
-	sint32 at_risk_value_percent = 
+	sint32 at_risk_value_percent =
 		MapAnalysis::GetMapAnalysis().AtRiskCitiesValue(receiver,sender);
 
-	
-	
+
 	if (at_risk_value_percent < 30)
 		return GEV_HD_Continue;
 
-	
 	sint32 gold = ProposalAnalysis::RoundGold(2 * g_player[sender]->m_gold->GetIncome());
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_GIVE_GOLD);
-	
+
 	if (gold <= 0)
 		return GEV_HD_Continue;
-	
+
 	NewProposal new_proposal;
-	
-	
+
 	new_proposal.priority = static_cast<sint16>(priority);
-	
-	
-	new_proposal.detail.first_type = PROPOSAL_REQUEST_GIVE_GOLD;	
-	new_proposal.detail.first_arg.gold = gold; 
-
-	
-	new_proposal.detail.tone = DIPLOMATIC_TONE_ANGRY;	   
-	
+
+	new_proposal.detail.first_type = PROPOSAL_REQUEST_GIVE_GOLD;
+	new_proposal.detail.first_arg.gold = gold;
+
+	new_proposal.detail.tone = DIPLOMATIC_TONE_ANGRY;
+
 	new_proposal.receiverId = receiver;
 	new_proposal.senderId = sender;
-	
-	
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 50 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
-	
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(BreakAgreementWithEnemy_NewProposalEvent)
 {
-	
+
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -1587,7 +1406,6 @@
 	if (!args->GetInt(0, motivation_type))
 		return GEV_HD_Continue;
 
-	
 	if ((MOTIVATION_TYPE) motivation_type != MOTIVATION_DESIRE_ENLIST_FRIEND )
 		return GEV_HD_Continue;
 
@@ -1602,7 +1420,6 @@
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
-	
 	if (sender_diplomat.TestPublicRegard(receiver, FRIEND_REGARD) == false)
 		return GEV_HD_Continue;
 
@@ -1615,7 +1432,6 @@
 		if (g_player[cold_war_enemy] == NULL)
 			continue;
 
-		
 		if (receiver_diplomat.GetPublicRegard(cold_war_enemy) < FRIEND_REGARD)
 			continue;
 
@@ -1627,61 +1443,52 @@
 		if (agreement == AgreementMatrix::s_badAgreement)
 			agreement = AgreementMatrix::s_agreements.GetAgreement(receiver, cold_war_enemy, PROPOSAL_TREATY_MILITARY_PACT);
 
-		
 		if (agreement == AgreementMatrix::s_badAgreement)
 			continue;
-		
+
 		break;
 	}
 
-	
 	if (cold_war_enemy == CtpAi::s_maxPlayers)
 		return GEV_HD_Continue;
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_BREAK_AGREEMENT);
-	
+
 	if (priority > 0) {
 		NewProposal new_proposal;
 
-		
-		new_proposal.priority = priority;				
+		new_proposal.priority = priority;
 
-		
-		new_proposal.detail.first_type = PROPOSAL_REQUEST_BREAK_AGREEMENT;	
-		new_proposal.detail.first_arg.playerId = cold_war_enemy; 
-		
-		new_proposal.detail.tone = DIPLOMATIC_TONE_ANGRY;	   
+		new_proposal.detail.first_type = PROPOSAL_REQUEST_BREAK_AGREEMENT;
+		new_proposal.detail.first_arg.playerId = cold_war_enemy;
+
+		new_proposal.detail.tone = DIPLOMATIC_TONE_ANGRY;
 
 		new_proposal.receiverId = receiver;
 		new_proposal.senderId = sender;
 
-		
 
 		g_theStringDB->GetStringID("EXPLAIN_WITHDRAW_TROOPS_0001",new_proposal.explainStrId);
 		g_theStringDB->GetStringID("ADVICE_WITHDRAW_TROOPS_0001",new_proposal.adviceStrId);
 		g_theStringDB->GetStringID("NEWS_WITHDRAW_TROOPS_0001",new_proposal.newsStrId);
 
-		
 		if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 			{
-				
+
 				return GEV_HD_Continue;
 			}
 
-		
 		sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
 	}
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(StopResearch_NewProposalEvent)
 {
-	
+
 	if (gameEventType != GEV_FearMotivation)
 		return GEV_HD_Continue;
 
@@ -1689,7 +1496,6 @@
 	if (!args->GetInt(0, motivation_type))
 		return GEV_HD_Continue;
 
-	
 	if ((MOTIVATION_TYPE) motivation_type != MOTIVATION_FEAR_SCIENCE_RANK )
 		return GEV_HD_Continue;
 
@@ -1704,64 +1510,54 @@
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
-	
 	if (sender_diplomat.TestEffectiveRegard(receiver, COLDWAR_REGARD) == false)
 		return GEV_HD_Continue;
 
-	
 	Assert(g_player[sender])
 	if (g_player[sender]->HasEmbassyWith(receiver) == FALSE)
 		return GEV_HD_Continue;
 
 	AdvanceType adv_type = sender_diplomat.GetStopResearchingAdvance(receiver);
-	
-	
+
 	if (adv_type <= -1)
 		return GEV_HD_Continue;
 
-	
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_STOP_RESEARCH);
 
-	if (priority <= 0) 
+	if (priority <= 0)
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
-	new_proposal.priority = priority;				
-	
-	
-	new_proposal.detail.first_type = PROPOSAL_REQUEST_STOP_RESEARCH;	
-	new_proposal.detail.first_arg.advanceType = adv_type; 
-	new_proposal.detail.tone = DIPLOMATIC_TONE_INDIGNANT;	
+
+	new_proposal.priority = priority;
+
+	new_proposal.detail.first_type = PROPOSAL_REQUEST_STOP_RESEARCH;
+	new_proposal.detail.first_arg.advanceType = adv_type;
+	new_proposal.detail.tone = DIPLOMATIC_TONE_INDIGNANT;
 
 	new_proposal.receiverId = receiver;
 	new_proposal.senderId = sender;
-	
-	
-	
+
+
 	g_theStringDB->GetStringID("EXPLAIN_WITHDRAW_TROOPS_0001",new_proposal.explainStrId);
 	g_theStringDB->GetStringID("ADVICE_WITHDRAW_TROOPS_0001",new_proposal.adviceStrId);
 	g_theStringDB->GetStringID("NEWS_WITHDRAW_TROOPS_0001",new_proposal.newsStrId);
-	
-	
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(ReduceWeapons_NewProposalEvent)
 {
-	
+
 	if (gameEventType != GEV_FearMotivation)
 		return GEV_HD_Continue;
 
@@ -1769,7 +1565,6 @@
 	if (!args->GetInt(0, motivation_type))
 		return GEV_HD_Continue;
 
-	
 	if ((MOTIVATION_TYPE) motivation_type != MOTIVATION_FEAR_SCIENCE_RANK )
 		return GEV_HD_Continue;
 
@@ -1784,30 +1579,25 @@
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
-	
 	if (sender_diplomat.TestEffectiveRegard(receiver, COLDWAR_REGARD) == false)
 		return GEV_HD_Continue;
 
-	
 	Assert(g_player[sender]);
 	sint32 sender_city_count = g_player[sender]->GetNumCities();
 	Assert(g_player[receiver]);
 	sint32 receiver_city_count = g_player[receiver]->GetNumCities();
-	
-	
+
 	sint16 sender_nukes_count = MapAnalysis::GetMapAnalysis().GetNanoWeaponsCount(sender);
 	sint16 sender_bio_count = MapAnalysis::GetMapAnalysis().GetBioWeaponsCount(sender);
 	sint16 sender_nano_count = MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(sender);
 
-	
 	sint16 receiver_nukes_count = MapAnalysis::GetMapAnalysis().GetNanoWeaponsCount(receiver);
 	sint16 receiver_bio_count = MapAnalysis::GetMapAnalysis().GetBioWeaponsCount(receiver);
 	sint16 receiver_nano_count = MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(receiver);
 
-	
 	double sender_losses;
 	double receiver_losses;
-	
+
 	PROPOSAL_TYPE proposal_type;
 	if (receiver_nano_count > 0)
 	{
@@ -1828,27 +1618,25 @@
 		receiver_losses = ((double)sender_nukes_count / receiver_city_count);
 	}
 	else
-		
+
 		return GEV_HD_Continue;
 
-	
 	double reduce_percent;
 	if (receiver_losses <= 0.0)
 		reduce_percent = 1.0;
 	else if (sender_losses > 0.5)
 		reduce_percent = (sender_losses - 0.5) / sender_losses;
-	else 
+	else
 		reduce_percent = (sender_losses - (receiver_losses / 2)) / sender_losses;
 
 	if (reduce_percent <= 0.0)
-		
+
 		return GEV_HD_Continue;
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, proposal_type);
 
-	if (priority <= 0) 
+	if (priority <= 0)
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
@@ -1856,44 +1644,37 @@
 	reduce_percent = ProposalAnalysis::RoundPercentReduction(reduce_percent);
 	if (reduce_percent <= 0)
 		return GEV_HD_Continue;
-	
-	
-	new_proposal.priority = priority;				
-	
-	
-	new_proposal.detail.first_type = proposal_type;	
-	new_proposal.detail.first_arg.percent = reduce_percent; 
-	new_proposal.detail.tone = DIPLOMATIC_TONE_INDIGNANT;	
+
+	new_proposal.priority = priority;
+
+	new_proposal.detail.first_type = proposal_type;
+	new_proposal.detail.first_arg.percent = reduce_percent;
+	new_proposal.detail.tone = DIPLOMATIC_TONE_INDIGNANT;
 
 	new_proposal.receiverId = receiver;
 	new_proposal.senderId = sender;
-	
-	
-	
+
+
 	g_theStringDB->GetStringID("EXPLAIN_WITHDRAW_TROOPS_0001",new_proposal.explainStrId);
 	g_theStringDB->GetStringID("ADVICE_WITHDRAW_TROOPS_0001",new_proposal.adviceStrId);
 	g_theStringDB->GetStringID("NEWS_WITHDRAW_TROOPS_0001",new_proposal.newsStrId);
-	
-	
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(RequestTribute_NewProposalEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -1919,52 +1700,48 @@
 	sint32 receiver_income = g_player[receiver]->m_gold->GetIncome();
 	sint32 sender_savings = g_player[receiver]->m_gold->GetLevel();
 
-	DIPLOMATIC_STRENGTH sender_strength = 
+	DIPLOMATIC_STRENGTH sender_strength =
 		g_player[sender]->GetRelativeStrength(receiver);
 
-	
 	if ((MOTIVATION_TYPE) motivation_type == MOTIVATION_DESIRE_GOLD )
 	{
-		
+
 		if (!sender_diplomat.TestEffectiveRegard(receiver, NEUTRAL_REGARD) ||
 			sender_strength < DIPLOMATIC_STRENGTH_STRONG)
 		{
 			return GEV_HD_Continue;
 		}
-		
-		sint32 at_risk_value_percent = 
+
+		sint32 at_risk_value_percent =
 			MapAnalysis::GetMapAnalysis().AtRiskCitiesValue(receiver,sender);
-		
-		
+
 		if (at_risk_value_percent < 30)
 		{
 			return GEV_HD_Continue;
 		}
 		sint32 at_risk_value = static_cast<sint32>((static_cast<double>(at_risk_value_percent) / 100.0) *
 			MapAnalysis::GetMapAnalysis().TotalValue(receiver));
-		
+
 		type = PROPOSAL_REQUEST_GIVE_GOLD;
 		tone = DIPLOMATIC_TONE_ANGRY;
 		gold = std::min(at_risk_value, sender_income);
 	}
-	
+
 	else if ((MOTIVATION_TYPE) motivation_type == MOTIVATION_DESIRE_ENLIST_FRIEND)
 	{
-		
+
 		if (!sender_diplomat.TestPublicRegard(receiver, FRIEND_REGARD) ||
 			sender_strength < DIPLOMATIC_STRENGTH_STRONG)
 		{
 			return GEV_HD_Continue;
 		}
 
-		
 		if (sender_diplomat.GetPersonality()->GetDiscoveryMilitary() ||
 			sender_diplomat.GetPersonality()->GetAlignmentEvil())
 		{
 			return GEV_HD_Continue;
 		}
 
-		
 		if (sender_income < 3 * receiver_income)
 		{
 			return GEV_HD_Continue;
@@ -1976,14 +1753,12 @@
         gold = std::min(gold, sender_savings);
 	}
 	else
-		
+
 		return GEV_HD_Continue;
 
-	
 	gold = ProposalAnalysis::RoundGold(gold);
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, type);
 
@@ -1994,33 +1769,27 @@
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
-	new_proposal.priority = priority;				
-	
-	
-	new_proposal.detail.first_type = type;	
-	new_proposal.detail.first_arg.gold = gold; 
-	new_proposal.detail.tone = tone;	   
-	
+
+	new_proposal.priority = priority;
+
+	new_proposal.detail.first_type = type;
+	new_proposal.detail.first_arg.gold = gold;
+	new_proposal.detail.tone = tone;
+
 	new_proposal.receiverId = receiver;
 	new_proposal.senderId = sender;
-	
-	
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 50 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
-	
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(RequestCity_NewProposalEvent)
 {
 	Unit city;
@@ -2028,7 +1797,6 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -2048,76 +1816,63 @@
 
 //	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_GIVE_CITY);
 
-	
 	if (priority <= 0)
-		return GEV_HD_Continue;		
+		return GEV_HD_Continue;
 
-	
 	if (sender_diplomat.GetPublicRegard(receiver) >= COLDWAR_REGARD)
 		return GEV_HD_Continue;
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(sender,receiver,PROPOSAL_TREATY_DECLARE_WAR) )
 		return GEV_HD_Continue;
 
-	
 	if (!sender_diplomat.DesireWarWith(receiver))
 		return GEV_HD_Continue;
 
-	sint32 at_risk_value_percent = 
+	sint32 at_risk_value_percent =
 		MapAnalysis::GetMapAnalysis().AtRiskCitiesValue(receiver,sender);
 
 	sint32 at_risk_value = static_cast<sint32>((static_cast<double>(at_risk_value_percent) / 100.0) *
 		MapAnalysis::GetMapAnalysis().TotalValue(receiver));
 
-	
-	
+
 	if (at_risk_value_percent < 75)
-		return GEV_HD_Continue;		
+		return GEV_HD_Continue;
+
 
-	
-	
 	if ((double) MapAnalysis::GetMapAnalysis().TotalThreat(receiver) /
 		MapAnalysis::GetMapAnalysis().TotalThreat(sender) > 1.25)
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
 
-	
 	new_proposal.priority = priority;
 
-	
 	new_proposal.detail.first_type = PROPOSAL_REQUEST_GIVE_CITY;
 	new_proposal.detail.tone = tone;
-	
+
 	new_proposal.receiverId = receiver;
 	new_proposal.senderId = sender;
 
-	
 	if (!sender_diplomat.CanExtortCityFrom(receiver, at_risk_value, city))
 		return GEV_HD_Continue;
 
 	new_proposal.detail.first_arg.cityId = city.m_id;
 
-	
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ))
 		GEV_HD_Continue;
 
-	
 	sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(RequestHonorMilitaryAgeement_NewProposalEvent)
 {
-	
+
 	if (gameEventType != GEV_DesireMotivation)
 		return GEV_HD_Continue;
 
@@ -2139,86 +1894,71 @@
 	if (!AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_MILITARY_PACT) &&
 		!AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_ALLIANCE))
 		return GEV_HD_Continue;
-	
+
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	ai::Agreement agreement;
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT);
-	
-	
+
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	PLAYER_INDEX hot_war_enemy;
 	for (hot_war_enemy = 1; hot_war_enemy < CtpAi::s_maxPlayers; hot_war_enemy++)
 	{
 		if (g_player[hot_war_enemy] == NULL)
 			continue;
 
-		
 		if (AgreementMatrix::s_agreements.TurnsAtWar(sender, hot_war_enemy) < 10)
 			continue;
 
-		
 		if (AgreementMatrix::s_agreements.HasAgreement(receiver, hot_war_enemy, PROPOSAL_TREATY_DECLARE_WAR))
 			continue;
 
-		
 		if (!g_player[receiver]->HasContactWith(hot_war_enemy))
 			continue;
-		
+
 		break;
 	}
 
-	
 	if (hot_war_enemy == CtpAi::s_maxPlayers)
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
-	new_proposal.priority = priority;				
-	
-	
-	new_proposal.detail.first_type = PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT;	
-	new_proposal.detail.first_arg.playerId = hot_war_enemy; 
-	
-	new_proposal.detail.tone = DIPLOMATIC_TONE_ANGRY;	   
-	
+
+	new_proposal.priority = priority;
+
+	new_proposal.detail.first_type = PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT;
+	new_proposal.detail.first_arg.playerId = hot_war_enemy;
+
+	new_proposal.detail.tone = DIPLOMATIC_TONE_ANGRY;
+
 	new_proposal.receiverId = receiver;
 	new_proposal.senderId = sender;
-	
-	
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
 
-	
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(RequestEndEmbargo_NewProposalEvent)
 {
 	DIPLOMATIC_TONE tone = DIPLOMATIC_TONE_NOT_CHOSEN;
 
-	
 	if (gameEventType == GEV_DesireMotivation)
 	{
 		sint32 motivation_type;
 		if (!args->GetInt(0, motivation_type))
 			return GEV_HD_Continue;
 
-		
 		if ((MOTIVATION_TYPE) motivation_type != MOTIVATION_DESIRE_GOLD)
 			return GEV_HD_Continue;
 
@@ -2237,11 +1977,9 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	
 	if (receiver_diplomat.GetEmbargo(sender) == false)
 		return GEV_HD_Continue;
 
-	
 	if (gameEventType == GEV_ReactionMotivation)
 	{
 		if (sender_diplomat.GetEmbargo(receiver) == true)
@@ -2249,172 +1987,143 @@
 		tone = DIPLOMATIC_TONE_ANGRY;
 	}
 
-	
-	
+
 	sint32 priority =
 		sender_diplomat.GetNewProposalPriority(receiver, PROPOSAL_REQUEST_END_EMBARGO);
-	
-	
+
 	if (priority <= 0)
 		return GEV_HD_Continue;
 
 	NewProposal new_proposal;
-	
-	
+
 	new_proposal.priority = priority;
-	
-	
-	new_proposal.detail.first_type = PROPOSAL_REQUEST_END_EMBARGO;	
-	new_proposal.detail.first_arg.playerId = receiver; 
-	
+
+	new_proposal.detail.first_type = PROPOSAL_REQUEST_END_EMBARGO;
+	new_proposal.detail.first_arg.playerId = receiver;
+
 	new_proposal.detail.tone = tone;
-	
+
 	new_proposal.receiverId = receiver;
 	new_proposal.senderId = sender;
-	
-	
+
 	if (sender_diplomat.GetNewProposalTimeout( new_proposal, 20 ) )
 	{
-		
+
 		return GEV_HD_Continue;
 	}
-	
-	
+
 	sender_diplomat.ConsiderNewProposal(receiver, new_proposal);
 
-	
 	return GEV_HD_Continue;
 }
 
-
-void NewProposalEventCallbacks::AddCallbacks() 
+void NewProposalEventCallbacks::AddCallbacks()
 {
 
-	
 	g_gevManager->AddCallback(GEV_ReactionMotivation,
-							  GEV_PRI_Primary, 
+							  GEV_PRI_Primary,
 							  &s_General_NewProposalEvent);
 
-	
 
-	
-	
+
+
+
 	g_gevManager->AddCallback(GEV_ReactionMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_LeaveOurBorders_NewProposalEvent);
 
-	
 
-	
+
+
 	g_gevManager->AddCallback(GEV_FearMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_Scenario_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_FearMotivation,
 							  GEV_PRI_Pre,
 							  &s_StopPiracy_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_FearMotivation,
 							  GEV_PRI_Pre,
 							  &s_StopResearch_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_FearMotivation,
 							  GEV_PRI_Pre,
 							  &s_ReduceWeapons_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_FearMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_CeaseFire_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_FearMotivation,
 							  GEV_PRI_Pre,
 							  &s_ReducePollution_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_FearMotivation,
 							  GEV_PRI_Pre,
 							  &s_HonorPollutionAgreement_NewProposalEvent);
 
 
-	
 
-    
+
+
 	g_gevManager->AddCallback(GEV_DesireMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_Scenario_NewProposalEvent);
 
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_Alliance_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_TradePact_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_ResearchPact_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_FearMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_PollutionPact_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_FearMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_RequestAdvance_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_ExchangeMaps_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_MakePeace_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_BegForGold_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_BlackmailGold_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
 							  GEV_PRI_Pre,
 							  &s_RequestTribute_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
 							  GEV_PRI_Pre,
 							  &s_BreakAgreementWithEnemy_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
 							  GEV_PRI_Pre,
 							  &s_RequestCity_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
 							  GEV_PRI_Pre,
 							  &s_RequestHonorMilitaryAgeement_NewProposalEvent);
 
-	
 	g_gevManager->AddCallback(GEV_DesireMotivation,
 							  GEV_PRI_Pre,
 							  &s_RequestEndEmbargo_NewProposalEvent);

Modified: trunk/ctp2_code/ai/diplomacy/proposalanalysis.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/proposalanalysis.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/proposalanalysis.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,13 +1,3 @@
-
-
-
-
-
-
-
-
-
-
 #include "c3.h"
 #include "ProposalAnalysis.h"
 
@@ -26,7 +16,6 @@
 #include "DiplomacyProposalRecord.h"
 #include "diplomacyutil.h"
 
-
 void ProposalAnalysis::ComputeResult( const NewProposal & proposal,
 									  DiplomacyResult & senderResult,
 									  DiplomacyResult & receiverResult )
@@ -46,11 +35,10 @@
 				   receiverResult );
 
 
-	
-	
-}
 
 
+}
+
 void ProposalAnalysis::ComputeResult( const Response & response,
 									  DiplomacyResult & senderResult,
 									  DiplomacyResult & receiverResult )
@@ -73,18 +61,18 @@
 	}
 	else
 	{
-			
+
 		Assert(0);
 	}
 }
 
 void ProposalAnalysis::DebugResult( const NewProposal & proposal)
 {
-	DPRINTF(k_DBG_DIPLOMACY, ("Evaluated NEW PROPOSAL [sender = %d, receiver = %d]\n", 
+	DPRINTF(k_DBG_DIPLOMACY, ("Evaluated NEW PROPOSAL [sender = %d, receiver = %d]\n",
 		proposal.senderId, proposal.receiverId));
 	DPRINTF(k_DBG_DIPLOMACY, ("first = %s\n", s_proposalNames[proposal.detail.first_type].c_str()));
 	DPRINTF(k_DBG_DIPLOMACY, ("second = %s\n", s_proposalNames[proposal.detail.second_type].c_str()));
-	
+
 	DiplomacyResult sender_result;
 	DiplomacyResult receiver_result;
 	ComputeResult(proposal,sender_result, receiver_result);
@@ -103,7 +91,7 @@
 
 void ProposalAnalysis::DebugResult( const Response & response )
 {
-	DPRINTF(k_DBG_DIPLOMACY, ("Evaluated RESPONSE type %s [sender = %d, receiver = %d]\n", 
+	DPRINTF(k_DBG_DIPLOMACY, ("Evaluated RESPONSE type %s [sender = %d, receiver = %d]\n",
 		s_responseNames[response.type].c_str(),response.senderId, response.receiverId));
 
 	if (response.type == RESPONSE_THREATEN)
@@ -115,7 +103,7 @@
 		DPRINTF(k_DBG_DIPLOMACY, ("first = %s\n", s_proposalNames[response.counter.first_type].c_str()));
 		DPRINTF(k_DBG_DIPLOMACY, ("second = %s\n", s_proposalNames[response.counter.second_type].c_str()));
 	}
-	
+
 	DiplomacyResult sender_result;
 	DiplomacyResult receiver_result;
 	ComputeResult(response,sender_result, receiver_result);
@@ -134,11 +122,11 @@
 
 void ProposalAnalysis::LogDebugResult( const NewProposal & proposal)
 {
-	gslog_dipprint("   NEW PROPOSAL [sender = %d, receiver = %d]\n", 
+	gslog_dipprint("   NEW PROPOSAL [sender = %d, receiver = %d]\n",
 		proposal.senderId, proposal.receiverId);
 	gslog_dipprint("   first = %s\n", s_proposalNames[proposal.detail.first_type].c_str());
 	gslog_dipprint("   second = %s\n", s_proposalNames[proposal.detail.second_type].c_str());
-	
+
 	DiplomacyResult sender_result;
 	DiplomacyResult receiver_result;
 	ComputeResult(proposal,sender_result, receiver_result);
@@ -167,7 +155,7 @@
 
 void ProposalAnalysis::LogDebugResult( const Response & response )
 {
-	gslog_dipprint("   RESPONSE type %s [sender = %d, receiver = %d]\n", 
+	gslog_dipprint("   RESPONSE type %s [sender = %d, receiver = %d]\n",
 		s_responseNames[response.type].c_str(),response.senderId, response.receiverId);
 
 	if (response.type == RESPONSE_THREATEN)
@@ -206,7 +194,6 @@
 	gslog_dipprint("\n");
 }
 
-
 sint32 ProposalAnalysis::RoundGold( const sint32 gold )
 {
 	const sint32 unit = 100;
@@ -218,7 +205,6 @@
 	return tmp;
 }
 
-
 double ProposalAnalysis::RoundPercentReduction( const double percent)
 {
 	if (percent < 0.075)
@@ -229,7 +215,7 @@
 		return 0.20;
 	else if (percent < 0.625)
 		return 0.50;
-	else 
+	else
 		return 0.75;
 }
 
@@ -238,10 +224,10 @@
 
 
 
-void ProposalAnalysis::ComputeResult( const PLAYER_INDEX &sender, 
-									  const PLAYER_INDEX &receiver, 
-									  const PROPOSAL_TYPE &proposal_type, 
-									  const DiplomacyArg &proposal_arg, 
+void ProposalAnalysis::ComputeResult( const PLAYER_INDEX &sender,
+									  const PLAYER_INDEX &receiver,
+									  const PROPOSAL_TYPE &proposal_type,
+									  const DiplomacyArg &proposal_arg,
 									  DiplomacyResult & senderResult,
 									  DiplomacyResult & receiverResult )
 {
@@ -252,7 +238,7 @@
 	Player *sender_ptr = g_player[sender];
 	Assert(receiver_ptr);
 	Assert(sender_ptr);
-	
+
 	if (receiver_ptr == NULL || sender_ptr == NULL)
 		return;
 
@@ -261,28 +247,28 @@
 	sint32 turns_since_last_agreed
 		= agreements.GetAgreementDuration(sender, receiver, proposal_type);
 
-	sint32 duration = 20; 
+	sint32 duration = 20;
     double scale_regard;
     if ((turns_since_last_agreed < duration) || turns_since_last_agreed == -1)
     {
         scale_regard = 1.0;
     }
-    else 
+    else
     {
         scale_regard = 0.0;
     }
-	
+
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 	const MapAnalysis & map = MapAnalysis::GetMapAnalysis();
 
 	ai::Agreement agreement;
-	switch (proposal_type) 
+	switch (proposal_type)
     {
 	case PROPOSAL_OFFER_GIVE_CITY:
         {
 	        Unit city   = Unit(proposal_arg.cityId);
-		
+
 		    Assert(city.IsValid());
 		    if (city.IsValid())
             {
@@ -294,8 +280,8 @@
 		        receiverResult.production += city->GetNetCityProduction() * 10;
 		        receiverResult.science += city.CD()->GetScience() * 10;
 
-		        scale_regard = 
-			        (double) map.GetAlliedValue(sender, city.RetPos()) / 
+		        scale_regard =
+			        (double) map.GetAlliedValue(sender, city.RetPos()) /
 					         map.GetMaxAlliedValue(sender);
             }
         }
@@ -304,7 +290,7 @@
 	case PROPOSAL_REQUEST_GIVE_CITY:
         {
 	        Unit city   = Unit(proposal_arg.cityId);
-		
+
 		    Assert(city.IsValid());
 		    if (city.IsValid())
             {
@@ -316,15 +302,14 @@
 		        receiverResult.production -= city->GetNetCityProduction() * 10;
 		        receiverResult.science -= city.CD()->GetScience() * 10;
 
-		        scale_regard = 
-			        (double) map.GetAlliedValue(receiver, city.RetPos()) / 
+		        scale_regard =
+			        (double) map.GetAlliedValue(receiver, city.RetPos()) /
 					         map.GetMaxAlliedValue(receiver);
             }
         }
 		break;
 
 	case PROPOSAL_OFFER_WITHDRAW_TROOPS:
-		
 
 		scale_regard = 0.0;
 		if ((agreements.GetAgreementDuration(sender, receiver, proposal_type) > duration) &&
@@ -334,7 +319,6 @@
 		}
 		break;
 	case PROPOSAL_REQUEST_WITHDRAW_TROOPS:
-		
 
 		scale_regard = 0.0;
 		if ((agreements.GetAgreementDuration(receiver, sender, proposal_type) > duration) &&
@@ -345,95 +329,93 @@
 
 		break;
 	case PROPOSAL_OFFER_STOP_PIRACY:
-		
-		
+
 		scale_regard = 0.0;
 		if (map.TotalPiracyLoss(receiver) > 0)
 		{
-			scale_regard = (double) map.GetPiracyIncomeByPlayer(sender, receiver) / 
+			scale_regard = (double) map.GetPiracyIncomeByPlayer(sender, receiver) /
 				map.TotalPiracyLoss(receiver);
 		}
 
 		break;
 	case PROPOSAL_REQUEST_STOP_PIRACY:
-		
 
 		scale_regard = 0.0;
 		if (map.TotalPiracyLoss(sender) > 0)
 		{
-			scale_regard = (double) map.GetPiracyIncomeByPlayer(receiver, sender) / 
+			scale_regard = (double) map.GetPiracyIncomeByPlayer(receiver, sender) /
 				map.TotalPiracyLoss(sender);
 		}
 
 		break;
 	case PROPOSAL_OFFER_BREAK_AGREEMENT:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 
 		break;
 	case PROPOSAL_REQUEST_BREAK_AGREEMENT:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 
 		break;
 	case PROPOSAL_OFFER_STOP_RESEARCH:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 
 		break;
 	case PROPOSAL_REQUEST_STOP_RESEARCH:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 
 		break;
 	case PROPOSAL_OFFER_REDUCE_NUCLEAR_WEAPONS:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration/2)
             scale_regard = std::min((proposal_arg.percent + 0.25), 1.0);
 		break;
 	case PROPOSAL_REQUEST_REDUCE_NUCLEAR_WEAPONS:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration/2)
             scale_regard = std::min((proposal_arg.percent + 0.25), 1.0);
 		break;
 	case PROPOSAL_OFFER_REDUCE_BIO_WEAPONS:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration/2)
             scale_regard = std::min((proposal_arg.percent + 0.25), 1.0);
 		break;
 	case PROPOSAL_REQUEST_REDUCE_BIO_WEAPONS:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration/2)
             scale_regard = std::min((proposal_arg.percent + 0.25), 1.0);
 		break;
 	case PROPOSAL_OFFER_REDUCE_NANO_WEAPONS:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration/2)
             scale_regard = std::min((proposal_arg.percent + 0.25), 1.0);
 		break;
 	case PROPOSAL_REQUEST_REDUCE_NANO_WEAPONS:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration/2)
             scale_regard = std::min((proposal_arg.percent + 0.25), 1.0);
 		break;
 	case PROPOSAL_OFFER_GIVE_ADVANCE:
-	{	
+	{
 		const AdvanceRecord * advance_record = g_theAdvanceDB->Get(proposal_arg.advanceType);
 		Assert(advance_record != NULL);
 		if (advance_record != NULL)
 		{
-			senderResult.science -= 
+			senderResult.science -=
 				advance_record->GetCost();
-			receiverResult.science += 
+			receiverResult.science +=
 				advance_record->GetCost();
 
 			if (receiver_ptr->m_advances)
 			{
-				scale_regard = 
+				scale_regard =
 					(double) advance_record->GetCost() /
 					g_theAdvanceDB->Get(receiver_ptr->m_advances->GetResearching())->GetCost();
 			}
@@ -441,20 +423,20 @@
 	}
 		break;
 	case PROPOSAL_REQUEST_GIVE_ADVANCE:
-		
-	{	
+
+	{
 		const AdvanceRecord * advance_record = g_theAdvanceDB->Get(proposal_arg.advanceType);
 		Assert(advance_record != NULL);
 		if (advance_record != NULL)
 		{
-			senderResult.science += 
+			senderResult.science +=
 				advance_record->GetCost();
-			receiverResult.science -= 
+			receiverResult.science -=
 				advance_record->GetCost();
-			
+
 			if (sender_ptr->m_advances)
 			{
-				scale_regard = 
+				scale_regard =
 					(double) advance_record->GetCost() /
 					g_theAdvanceDB->Get(sender_ptr->m_advances->GetResearching())->GetCost();
 			}
@@ -463,74 +445,74 @@
 
 		break;
 	case PROPOSAL_OFFER_GIVE_GOLD:
-		
+
 		senderResult.gold -= proposal_arg.gold;
 		receiverResult.gold += proposal_arg.gold;
 
-		scale_regard = 
+		scale_regard =
 			(double) proposal_arg.gold / receiver_ptr->m_gold->GetIncome();
 
 		break;
 	case PROPOSAL_REQUEST_GIVE_GOLD:
-		
+
 		senderResult.gold += proposal_arg.gold;
 		receiverResult.gold -= proposal_arg.gold;
 
-		scale_regard = 
+		scale_regard =
 			(double) proposal_arg.gold / sender_ptr->m_gold->GetIncome();
 
 		break;
 	case PROPOSAL_OFFER_REDUCE_POLLUTION:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
             scale_regard = std::min((proposal_arg.percent + 0.25), 1.0);
 		break;
 	case PROPOSAL_REQUEST_REDUCE_POLLUTION:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = std::min((proposal_arg.percent + 0.25), 1.0);
 		break;
 	case PROPOSAL_OFFER_MAP:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 		break;
 	case PROPOSAL_REQUEST_MAP:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 		break;
 	case PROPOSAL_OFFER_HONOR_MILITARY_AGREEMENT:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 		break;
 	case PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 		break;
 	case PROPOSAL_OFFER_HONOR_POLLUTION_AGREEMENT:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 		break;
 	case PROPOSAL_REQUEST_HONOR_POLLUTION_AGREEMENT:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 		break;
 	case PROPOSAL_OFFER_END_EMBARGO:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 		break;
 	case PROPOSAL_REQUEST_END_EMBARGO:
-		
+
 		if (turns_since_last_agreed >= 0 && turns_since_last_agreed < duration)
 			scale_regard = ((double)turns_since_last_agreed / duration );
 		break;
-	
+
 	case PROPOSAL_TREATY_DECLARE_WAR:
 		scale_regard = 1.0;
 		break;
@@ -557,44 +539,39 @@
 		break;
 	case PROPOSAL_MAX:
 	default:
-		
+
 		Assert(0);
 	}
 
-	
-	senderResult.regard += 
+	senderResult.regard +=
 		(sint32) (scale_regard * receiver_diplomat.GetReceiverRegardResult(sender, proposal_type));
 
-	
-	receiverResult.regard += 
+	receiverResult.regard +=
 		(sint32) (scale_regard * sender_diplomat.GetSenderRegardResult(receiver, proposal_type));
 
 }
 
 
-
 void ProposalAnalysis::ComputeRegardResultFromProfit(DiplomacyResult & senderResult,
 													 DiplomacyResult & receiverResult)
 {
-	
-	
+
 	sint32 total_receiver_result = receiverResult.gold + receiverResult.production + receiverResult.science;
 	sint32 total_sender_result = senderResult.gold + senderResult.production + senderResult.science;
 
-	
-	
+
 	double sender_profit_ratio = 0.0;
-	
+
 	if (total_sender_result > total_receiver_result)
 	{
 		if (total_receiver_result > 0)
 		{
-			sender_profit_ratio = 
+			sender_profit_ratio =
 				(((double)total_sender_result - total_receiver_result) / (total_sender_result + total_receiver_result) );
 		}
 		else
 		{
-			
+
 			sender_profit_ratio = 1.0;
 		}
 	}
@@ -607,44 +584,41 @@
 		}
 		else
 		{
-			
+
 			sender_profit_ratio = -1.0;
 		}
 	}
 
-	
 
-	
-	
-	
+
+
+
+
 	senderResult.regard -= sender_profit_ratio * ((double)MAX_REGARD / 5);
 }
 
-
 bool ProposalAnalysis::IsSimpleGift(const NewProposal & proposal)
 {
-    DiplomacyProposalRecord const * first_rec = 
+    DiplomacyProposalRecord const * first_rec =
 		g_theDiplomacyProposalDB->Get(diplomacyutil_GetDBIndex(proposal.detail.first_type));
 
-    return first_rec->GetCategoryGift() && 
+    return first_rec->GetCategoryGift() &&
            (proposal.detail.second_type == PROPOSAL_NONE);
 }
 
-
 bool ProposalAnalysis::IsGift(const ProposalData & proposal_data)
 {
-	const DiplomacyProposalRecord *first_rec = 
+	const DiplomacyProposalRecord *first_rec =
 		g_theDiplomacyProposalDB->Get(diplomacyutil_GetDBIndex(proposal_data.first_type));
-	
-	const DiplomacyProposalRecord *second_rec = 
+
+	const DiplomacyProposalRecord *second_rec =
 		g_theDiplomacyProposalDB->Get(diplomacyutil_GetDBIndex(proposal_data.second_type));
-	
+
 	return second_rec->GetCategoryGift() || first_rec->GetCategoryGift();
 }
 
-
-bool ProposalAnalysis::GetTreatyFromProposal(const ProposalData & proposal_data, 
-		PROPOSAL_TYPE & treaty_type, 
+bool ProposalAnalysis::GetTreatyFromProposal(const ProposalData & proposal_data,
+		PROPOSAL_TYPE & treaty_type,
 		DiplomacyArg & treaty_arg,
 		bool & includes_gift,
 		PROPOSAL_TYPE & other_type,
@@ -654,10 +628,10 @@
 	other_type = PROPOSAL_NONE;
 	includes_gift = false;
 
-	const DiplomacyProposalRecord *first_rec = 
+	const DiplomacyProposalRecord *first_rec =
 		g_theDiplomacyProposalDB->Get(diplomacyutil_GetDBIndex(proposal_data.first_type));
 
-	const DiplomacyProposalRecord *second_rec = 
+	const DiplomacyProposalRecord *second_rec =
 		g_theDiplomacyProposalDB->Get(diplomacyutil_GetDBIndex(proposal_data.second_type));
 
 	if (first_rec->GetCategoryGift())
@@ -701,7 +675,6 @@
 	return treaty_found;
 }
 
-
 bool ProposalAnalysis::IsAcceptResponse(const Response & response)
 {
 	if (response.type == RESPONSE_COUNTER)
@@ -726,7 +699,7 @@
 			return true;
 		}
 	}
-	
+
 	return false;
 }
 
@@ -735,9 +708,9 @@
 
 void ProposalAnalysis::AcceptTreatyCondition(const PLAYER_INDEX playerId,
 											 const PLAYER_INDEX foreignerId,
-											 const PROPOSAL_TYPE treaty_type, 
-											 const DiplomacyArg treaty_arg, 
-											 PROPOSAL_TYPE & desire_type, 
+											 const PROPOSAL_TYPE treaty_type,
+											 const DiplomacyArg treaty_arg,
+											 PROPOSAL_TYPE & desire_type,
 											 DiplomacyArg & desire_arg )
 {
 	desire_type = PROPOSAL_MAX;
@@ -751,26 +724,19 @@
 
 	Diplomat & diplomat = Diplomat::GetDiplomat(playerId);
 
-	
 	bool not_friend = !diplomat.TestEffectiveRegard(foreignerId, FRIEND_REGARD);
 
-	
 	bool recent_attacks = (diplomat.GetLastHotwarAttack(foreignerId) < 10);
 
-	
 	bool piracy = (MapAnalysis::GetMapAnalysis().GetPiracyIncomeByPlayer(foreignerId, playerId) > 0);
 
-	
 //	bool border_incursion = (diplomat.GetBorderIncursionBy(foreignerId));
 
-	
 	bool untrustworthy = (diplomat.GetTrust(foreignerId) < NEUTRAL_REGARD);
 
-	
 	bool has_embargo = (Diplomat::GetDiplomat(foreignerId).GetEmbargo(playerId));
 
-	
-	bool has_alliance = 
+	bool has_alliance =
 		AgreementMatrix::s_agreements.HasAgreement(playerId, foreignerId, PROPOSAL_TREATY_ALLIANCE);
 
 	double regard_ratio = 1.0;
@@ -779,23 +745,20 @@
 		sint32 regard_delta = FRIEND_REGARD - diplomat.GetPublicRegard(foreignerId);
 		regard_ratio = regard_delta / diplomat.GetReceiverRegardResult(foreignerId, treaty_type);
 	}
-	
+
 	if (treaty_type == PROPOSAL_TREATY_TRADE_PACT)
 	{
 		sint32 trade_from = diplomat.GetTradeFrom(foreignerId);
 		sint32 trade_total = MapAnalysis::GetMapAnalysis().GetTotalTrade(playerId);
-		
-		
+
 		double trade_percent = (double) trade_from / trade_total;
 		bool not_trading_partner = (trade_percent < 0.10);
 
-		
 		if (!not_trading_partner && !not_friend && !recent_attacks && !piracy && !untrustworthy && !has_embargo)
 		{
 			desire_type = PROPOSAL_NONE;
 		}
 
-		
 		else if (not_friend && !not_trading_partner && !recent_attacks && !piracy && !untrustworthy && !has_embargo)
 		{
 			desire_type = PROPOSAL_OFFER_GIVE_GOLD;
@@ -807,15 +770,13 @@
 			}
 
 		}
-		
-		
+
 		else if (has_embargo && !not_trading_partner && !recent_attacks && !piracy && !untrustworthy && !not_friend )
 		{
 			desire_type = PROPOSAL_OFFER_END_EMBARGO;
 			desire_arg.gold = player_ptr->m_gold->GetIncome() * regard_ratio;
 		}
 
-		
 		else if (not_trading_partner && !has_embargo && !recent_attacks && !piracy && !untrustworthy && !not_friend )
 		{
 			if (trade_total > 0)
@@ -836,34 +797,29 @@
 		sint32 foreigner_science = MapAnalysis::GetMapAnalysis().GetProjectedScience(foreignerId);
 
 		bool very_low_science = (player_science > 5 * foreigner_science);
-		
-		
+
 		if (!very_low_science && !not_friend && !recent_attacks && !piracy && !untrustworthy && !has_embargo)
 		{
 			desire_type = PROPOSAL_NONE;
 		}
 
-		
 		else if (not_friend && !very_low_science && !recent_attacks && !piracy && !untrustworthy && !has_embargo)
 		{
 			desire_type = PROPOSAL_OFFER_GIVE_GOLD;
 			desire_arg.gold = player_ptr->m_gold->GetIncome() * regard_ratio;
 
-			
 			if (has_alliance)
 			{
 				desire_arg.gold = player_ptr->m_gold->GetIncome() * regard_ratio * 0.5;
 			}
 		}
-		
-		
+
 		else if (has_embargo && !very_low_science && !recent_attacks && !piracy && !untrustworthy && !not_friend )
 		{
 			desire_type = PROPOSAL_OFFER_END_EMBARGO;
 			desire_arg.gold = player_ptr->m_gold->GetIncome() * regard_ratio;
 		}
 
-		
 		else if (very_low_science && !has_embargo && !recent_attacks && !piracy && !untrustworthy && !not_friend )
 		{
 			if (player_science - foreigner_science > 100)
@@ -872,7 +828,6 @@
 				desire_arg.gold =  (player_science - foreigner_science) * 5;
 			}
 
-			
 			if (has_alliance)
 			{
 				desire_type = PROPOSAL_NONE;
@@ -880,33 +835,29 @@
 
 		}
 	}
-	
+
 	if (treaty_type == PROPOSAL_TREATY_MILITARY_PACT)
 	{
-		
+
 		bool cannot_form_alliance = !diplomat.CanFormAlliance(foreignerId);
 		bool desire_war = (diplomat.DesireWarWith(foreignerId));
 
-		
 		if (has_alliance)
 		{
 			desire_type = PROPOSAL_NONE;
 		}
 
-		
 		else if (!desire_war && !cannot_form_alliance && !not_friend && !recent_attacks && !piracy && !untrustworthy && !has_embargo)
 		{
 			desire_type = PROPOSAL_NONE;
 		}
 
-		
 		else if (not_friend && !desire_war && !cannot_form_alliance && !recent_attacks && !piracy && !untrustworthy && !has_embargo)
 		{
 			desire_type = PROPOSAL_OFFER_GIVE_GOLD;
 			desire_arg.gold = player_ptr->m_gold->GetIncome() * regard_ratio;
 		}
-		
-		
+
 		else if (has_embargo && !desire_war && !cannot_form_alliance && !recent_attacks && !piracy && !untrustworthy && !not_friend )
 		{
 			desire_type = PROPOSAL_OFFER_END_EMBARGO;
@@ -919,45 +870,39 @@
 		uint32 player_pollution = g_player[playerId]->GetPollutionLevel();
 		uint32 foreigner_pollution = g_player[foreignerId]->GetPollutionLevel();
 		double pollution_ratio = (double) player_pollution / foreigner_pollution;
-		
-		
+
 		double requested_reduction = 1.0 - ((double)treaty_arg.pollution / player_pollution);
 
-		
 		if (diplomat.GetPersonality()->GetDiscoveryEcotopian() && pollution_ratio > 1.05)
 		{
 			desire_type = PROPOSAL_OFFER_REDUCE_POLLUTION;
 			desire_arg.pollution = player_pollution * 1.05;
 		}
-		
-		
+
 		else if (diplomat.GetPersonality()->GetDiscoveryDiplomatic() &&
-			(pollution_ratio < 0.8 || 
+			(pollution_ratio < 0.8 ||
 			 requested_reduction > 0.2))
 		{
 			desire_type = PROPOSAL_MAX;
 		}
-		
+
 		else if (requested_reduction > 0.1)
 		{
 			desire_type = PROPOSAL_MAX;
 		}
-		
-		
+
 		desire_type = PROPOSAL_NONE;
 	}
 	if (treaty_type == PROPOSAL_TREATY_CEASEFIRE)
 	{
 		bool desire_war = (diplomat.DesireWarWith(foreignerId));
 
-		
 		if (!desire_war)
 		{
 			desire_type = PROPOSAL_NONE;
 		}
 
-		
-		else 
+		else
 		{
 			desire_type = PROPOSAL_OFFER_GIVE_GOLD;
 			desire_arg.gold = player_ptr->m_gold->GetIncome() * 33;
@@ -966,16 +911,14 @@
 }
 
 
-
 bool ProposalAnalysis::PlayerGetsEnoughValue(const PLAYER_INDEX playerId,
 											 const PLAYER_INDEX senderId,
 											 const PLAYER_INDEX receiverId,
-											 const ProposalData detail) 
+											 const ProposalData detail)
 {
 	DiplomacyResult senderResult;
 	DiplomacyResult receiverResult;
 
-	
 	ComputeResult( senderId,
 				   receiverId,
 				   detail.first_type,
@@ -989,53 +932,49 @@
 				   detail.second_arg,
 				   senderResult,
 				   receiverResult );
-	
 
 	const Diplomat & diplomat = Diplomat::GetDiplomat(playerId);
 
-	
 	double min_delta_gold_percent = -0.2;
-	
-	double min_delta_science_percent = -0.2; 
+
+	double min_delta_science_percent = -0.2;
 
 	/// @todo Check next 2 ifs. The first one is useless now.
 	if (diplomat.GetPersonality()->GetDiscoveryScientist())
 	{
-		
-		min_delta_gold_percent = -0.1; 
-		
-		min_delta_science_percent = -0.3; 
+
+		min_delta_gold_percent = -0.1;
+
+		min_delta_science_percent = -0.3;
 	}
 
-	
 	if (diplomat.GetPersonality()->GetDiscoveryScientist())
 	{
-		
-		min_delta_gold_percent = -0.3; 
-		
-		min_delta_science_percent = -0.1; 
+
+		min_delta_gold_percent = -0.3;
+
+		min_delta_science_percent = -0.1;
 	}
 
-	
 	ai::Regard regard = diplomat.GetEffectiveRegard(receiverId);
 	if (regard > ALLIED_REGARD ||
 		AgreementMatrix::s_agreements.HasAgreement(senderId, receiverId, PROPOSAL_TREATY_RESEARCH_PACT) ||
 		AgreementMatrix::s_agreements.HasAgreement(senderId, receiverId, PROPOSAL_TREATY_ALLIANCE))
 	{
-		
-		min_delta_gold_percent *= 2; 
-		
-		min_delta_science_percent *= 2; 
+
+		min_delta_gold_percent *= 2;
+
+		min_delta_science_percent *= 2;
 	}
 
 	if (regard < COLDWAR_REGARD)
 	{
-		
+
 		min_delta_gold_percent /= 2;
-		
-		min_delta_science_percent /= 2; 
+
+		min_delta_science_percent /= 2;
 	}
-	
+
 	DiplomacyResult & playerResult = senderResult;
 	DiplomacyResult & foreignerResult = receiverResult;
 	if (playerId == receiverId)
@@ -1044,18 +983,15 @@
 		foreignerResult = senderResult;
 	}
 
-	
 	if (playerResult.science <= 0)
 		return false;
 
-	
 	if (foreignerResult.science <= 0 &&
 		foreignerResult.gold < (playerResult.science + (playerResult.science * min_delta_gold_percent)))
 	{
 		return true;
 	}
-	
-	
+
 	if (playerResult.science > (foreignerResult.science + (playerResult.science * min_delta_science_percent)) &&
 		foreignerResult.gold <= 0)
 	{

Modified: trunk/ctp2_code/ai/diplomacy/proposalresponseevent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/proposalresponseevent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/proposalresponseevent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -25,8 +25,8 @@
 // Modifications from the original Activision code:
 //
 // - Initialized local variables. (Sep 9th 2005 Martin Gühmann)
-// - Seperated the NewProposal event from the Response event so that the 
-//   NewProposal event can be called from slic witout any problems. (17-Oct-2007 Martin Gühmann) 
+// - Seperated the NewProposal event from the Response event so that the
+//   NewProposal event can be called from slic witout any problems. (17-Oct-2007 Martin Gühmann)
 //
 //----------------------------------------------------------------------------
 
@@ -67,81 +67,71 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
-	
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
 	proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (proposal.detail.first_type != PROPOSAL_REQUEST_GIVE_CITY)
 		return GEV_HD_Continue;
 
 	cityId = proposal.detail.first_arg.cityId;
 
-	
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
-	
 
 	sint32 accept_priority =
 		receiver_diplomat.GetAcceptPriority( sender, proposal.detail.first_type);
 
-	sint32 at_risk_value_percent = 
+	sint32 at_risk_value_percent =
 		MapAnalysis::GetMapAnalysis().AtRiskCitiesValue(receiver,sender);
 
 	sint32 at_risk_value = (sint32) ((double)at_risk_value_percent / 100.0) *
 		MapAnalysis::GetMapAnalysis().TotalValue(receiver);
 
-	
-	
-	
 
-	
+
+
+
+
 	if (receiver_diplomat.GetTrust(sender) < COLDWAR_REGARD)
 		return GEV_HD_Continue;
 
-	
-	
+
 	if (at_risk_value_percent < 75)
 		return GEV_HD_Continue;
 
-	
-	
+
 	if ( at_risk_value < Unit(cityId)->GetCityData()->GetValue())
 		return GEV_HD_Continue;
 
-	
-	
+
 	if (((double) MapAnalysis::GetMapAnalysis().TotalThreat(receiver) /
 		MapAnalysis::GetMapAnalysis().TotalThreat(sender)) > 1.25)
 		return GEV_HD_Continue;
-	
-	
+
 	if (AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_DECLARE_WAR))
 	{
 		DiplomacyArg arg;
-		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_TREATY_CEASEFIRE, 
+		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_TREATY_CEASEFIRE,
 			arg, accept_priority, DIPLOMATIC_TONE_EQUAL);
 	}
 	else if (!AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_PEACE))
 	{
-		
+
 		DiplomacyArg arg;
-		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_TREATY_PEACE, 
+		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_TREATY_PEACE,
 			arg, accept_priority, DIPLOMATIC_TONE_EQUAL);
 	}
 
-	
-	
-	
-	
+
+
+
+
 
 	return GEV_HD_Continue;
 }
@@ -158,11 +148,9 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -175,26 +163,21 @@
 	sint32 accept_priority =
 		receiver_diplomat.GetAcceptPriority( sender, proposal.detail.first_type);
 
-	
 	if (accept_priority > 0) {
-		
+
 		Response response;
 
-		
 		response.priority = 50;    // Why is this hard coded?
-		response.type = RESPONSE_ACCEPT;		
+		response.type = RESPONSE_ACCEPT;
 		response.counter.tone = DIPLOMATIC_TONE_EQUAL;	   // Why is this always the same?
 
-		
-		response.senderId = sender;				
-		response.receiverId = receiver;			
+		response.senderId = sender;
+		response.receiverId = receiver;
 
-		
 		g_theStringDB->GetStringID("EXPLAIN_GENERIC_ACCEPT",response.explainStrId); // Which of them is used?
 		g_theStringDB->GetStringID("ADVICE_GENERIC_ACCEPT",response.adviceStrId);
 		g_theStringDB->GetStringID("NEWS_GENERIC_ACCEPT",response.newsStrId);
 
-		
 		receiver_diplomat.ConsiderResponse(sender, response);
 	}
 
@@ -212,11 +195,9 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -235,17 +216,14 @@
 }
 
 
-
 STDEHANDLER(PayTribute_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -254,7 +232,6 @@
 
 	const NewProposal & proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (proposal.detail.first_type != PROPOSAL_REQUEST_WITHDRAW_TROOPS)
 		return GEV_HD_Continue;
 
@@ -264,23 +241,20 @@
 	if (accept_priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	if (receiver_diplomat.GetBorderIncursionBy(sender))
 		return GEV_HD_Continue;
 
-	
 	if (!receiver_diplomat.DesireWarWith(sender))
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 		return GEV_HD_Continue;
 	}
 
-	
 	if ((double) MapAnalysis::GetMapAnalysis().TotalThreat(sender) /
 		MapAnalysis::GetMapAnalysis().TotalThreat(receiver) < 1.25)
 		return GEV_HD_Continue;
 
-	double const	extort_gold_precise = 0.85 * 
+	double const	extort_gold_precise = 0.85 *
 		std::min<sint32>(3 * g_player[receiver]->m_gold->GetIncome(), g_player[receiver]->GetGold());
 
 	sint32 extort_gold = ProposalAnalysis::RoundGold(static_cast<sint32>(extort_gold_precise));
@@ -291,28 +265,25 @@
 
 	DiplomacyArg arg;
 	arg.gold = extort_gold;
-	receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_GOLD, 
+	receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_GOLD,
 		arg, accept_priority, DIPLOMATIC_TONE_EQUAL);
 
-	
-	
-	
-	
+
+
+
+
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(MutualWithdraw_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -321,7 +292,6 @@
 
 	const NewProposal & proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (proposal.detail.first_type != PROPOSAL_REQUEST_WITHDRAW_TROOPS)
 		return GEV_HD_Continue;
 
@@ -331,47 +301,40 @@
 	if (accept_priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	if (!receiver_diplomat.GetBorderIncursionBy(sender))
 		return GEV_HD_Continue;
 
-	
 	if (receiver_diplomat.DesireWarWith(sender))
 		return GEV_HD_Continue;
 
 	DiplomacyArg arg;
-	receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_WITHDRAW_TROOPS, 
+	receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_WITHDRAW_TROOPS,
 		arg, accept_priority, DIPLOMATIC_TONE_EQUAL);
 
 	return GEV_HD_Continue;
 }
 
 
-
 STDEHANDLER(PayForAdvance_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_GIVE_ADVANCE)
 		return GEV_HD_Continue;
 
-	
 	DiplomacyResult proposal_sender_result;
 	DiplomacyResult proposal_receiver_result;
 	ProposalAnalysis::ComputeResult( sender_proposal,
@@ -384,45 +347,41 @@
 	ProposalAnalysis::DebugResult(sender_proposal);
 #endif _DEBUG
 
-	
 
 	sint32 regard = receiver_diplomat.GetEffectiveRegard(sender);
 	double desired_gold_precise = 0;
 
-	
 	if (regard >= NEUTRAL_REGARD)
 		desired_gold_precise = proposal_sender_result.science * 1.5;
 	else if (regard >= FRIEND_REGARD)
 		desired_gold_precise = proposal_sender_result.science * 1.0;
 	else if (regard >= ALLIED_REGARD)
 		desired_gold_precise = proposal_sender_result.science * 0.8;
-	else 
+	else
 		return GEV_HD_Continue;
-	
-	
+
 	sint32 const desired_gold = ProposalAnalysis::RoundGold
 									(static_cast<sint32>(desired_gold_precise));
 	if (desired_gold <= 0)
 		return GEV_HD_Continue;
-	
+
 	sint32 accept_priority =
 		receiver_diplomat.GetAcceptPriority( sender, sender_proposal.detail.first_type);
-	
-	
+
 	if (proposal_receiver_result.gold < desired_gold) {
 
 		DiplomacyArg arg;
 		arg.gold = desired_gold;
-		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_GOLD, 
+		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_GOLD,
 			arg, accept_priority, DIPLOMATIC_TONE_EQUAL);
 
-		
-		
-		
-		
+
+
+
+
 	}
-	
-	else if (proposal_receiver_result.gold >= desired_gold) 
+
+	else if (proposal_receiver_result.gold >= desired_gold)
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 	}
@@ -442,25 +401,21 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_GIVE_GOLD)
 		return GEV_HD_Continue;
 
-	
 	DiplomacyResult proposal_sender_result;
 	DiplomacyResult proposal_receiver_result;
 	ProposalAnalysis::ComputeResult( sender_proposal,
@@ -473,55 +428,52 @@
 	ProposalAnalysis::DebugResult(sender_proposal);
 #endif _DEBUG
 
-	
 
 	sint32 regard = receiver_diplomat.GetEffectiveRegard(sender);
 
 	sint32 min_cost = 0;
 	sint32 max_cost = 0;
 
-	
 	if (regard >= NEUTRAL_REGARD)
 		max_cost  = static_cast<sint32>(proposal_sender_result.science * 0.8);
 	else if (regard >= FRIEND_REGARD)
 		max_cost = proposal_sender_result.science;
 	else if (regard >= ALLIED_REGARD)
 		max_cost = proposal_sender_result.science * 3;
-	else 
+	else
 		return GEV_HD_Continue;
 
 	if (AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_RESEARCH_PACT) ||
 		AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_ALLIANCE) ||
 		receiver_diplomat.GetPersonality()->GetDiscoveryScientist())
 	{
-		
+
 		min_cost = static_cast<sint32>(proposal_sender_result.science * 0.5);
 		max_cost = std::min(max_cost, proposal_sender_result.science * 3);
 	}
 	else
 	{
-		
+
 		min_cost = static_cast<sint32>(proposal_sender_result.science * 0.8);
 		max_cost = std::min(max_cost, proposal_sender_result.science * 2);
 	}
 	sint32 desired_advance = receiver_diplomat.GetDesiredAdvanceFrom(sender, min_cost, max_cost);
-	
-	
+
 	if (desired_advance >= 0)
 	{
 		sint32 accept_priority = receiver_diplomat.GetAcceptPriority(sender, PROPOSAL_OFFER_GIVE_ADVANCE);
-		
+
 		DiplomacyArg arg;
 		arg.advanceType = desired_advance;
-		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_ADVANCE, 
+		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_ADVANCE,
 			arg, accept_priority, DIPLOMATIC_TONE_EQUAL);
-		
-		
-		
-		
-		
+
+
+
+
+
 	}
-		
+
 	return GEV_HD_Continue;
 }
 
@@ -533,25 +485,21 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_GIVE_ADVANCE)
 		return GEV_HD_Continue;
 
-	
 	DiplomacyResult proposal_sender_result;
 	DiplomacyResult proposal_receiver_result;
 	ProposalAnalysis::ComputeResult( sender_proposal,
@@ -564,13 +512,11 @@
 	ProposalAnalysis::DebugResult(sender_proposal);
 #endif _DEBUG
 
-	
 	sint32 regard = receiver_diplomat.GetEffectiveRegard(sender);
 
 	sint32 min_cost = 0;
 	sint32 max_cost = 0;
 
-	
 	if (regard < NEUTRAL_REGARD)
 		return GEV_HD_Continue;
 
@@ -578,22 +524,21 @@
 		AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_ALLIANCE) ||
 		receiver_diplomat.GetPersonality()->GetDiscoveryScientist())
 	{
-		
+
 		min_cost = static_cast<sint32>(proposal_sender_result.science * 0.5);
 		max_cost = proposal_sender_result.science * 2;
 	}
 	else
 	{
-		
+
 		min_cost = static_cast<sint32>(proposal_sender_result.science * 0.8);
 		max_cost = proposal_sender_result.science * 3;
 	}
 
-	
 
 	sint32 desired_advance = receiver_diplomat.GetDesiredAdvanceFrom(sender, min_cost, max_cost);
-	
-	sint32 accept_priority = 
+
+	sint32 accept_priority =
 		receiver_diplomat.GetAcceptPriority(sender, PROPOSAL_OFFER_GIVE_ADVANCE);
 
 	ai::Agreement agreement;
@@ -601,33 +546,30 @@
 		agreement =	AgreementMatrix::s_agreements.GetAgreement(sender, receiver, PROPOSAL_TREATY_RESEARCH_PACT);
 	else if (AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_ALLIANCE))
 		agreement =	AgreementMatrix::s_agreements.GetAgreement(sender, receiver, PROPOSAL_TREATY_ALLIANCE);
-	
-	
+
 	if (desired_advance >= 0)
 	{
 		DiplomacyArg arg;
 		arg.advanceType = desired_advance;
-		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_ADVANCE, 
+		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_ADVANCE,
 			arg, accept_priority, DIPLOMATIC_TONE_EQUAL);
 	}
-	
+
 	else if (proposal_receiver_result.science > proposal_sender_result.science)
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 	}
-	
-	else if (agreement != Diplomat::s_badAgreement && 
+
+	else if (agreement != Diplomat::s_badAgreement &&
 			 agreement.end == -1 &&
 			 agreement.start + 20 <= NewTurnCount::GetCurrentRound())
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 	}
 
-
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(StopPiracy_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
@@ -642,7 +584,7 @@
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_STOP_PIRACY)
@@ -671,7 +613,7 @@
 	if (piracy_income_from_sender <= 0)
 		return GEV_HD_Continue;
 
-	sint32 accept_priority = 
+	sint32 accept_priority =
 		receiver_diplomat.GetAcceptPriority(sender, PROPOSAL_REQUEST_STOP_PIRACY);
 
 	if (accept_priority <= 0)
@@ -681,47 +623,42 @@
 	{
 		DiplomacyArg arg;
 		arg.gold = piracy_income_from_sender * 3;
-		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_GOLD, 
+		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_GIVE_GOLD,
 			arg, accept_priority, DIPLOMATIC_TONE_EQUAL);
 	}
 	else if ( piracy_lost_to_sender >= piracy_income_from_sender )
 	{
 		DiplomacyArg arg;
-		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_STOP_PIRACY, 
+		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_STOP_PIRACY,
 			arg, accept_priority, DIPLOMATIC_TONE_INDIGNANT);
 	}
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(GiveMap_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_MAP)
 		return GEV_HD_Continue;
 
 	sint32 accept_priority =
 		receiver_diplomat.GetAcceptPriority( sender, sender_proposal.detail.first_type);
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_ALLIANCE) ||
 		AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_TRADE_PACT) ||
 		AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_MILITARY_PACT))
@@ -730,7 +667,6 @@
 		return GEV_HD_Continue;
 	}
 
-	
 	sint32 turns_since_last_war = AgreementMatrix::s_agreements.TurnsSinceLastWar(sender, receiver);
 	if (( (turns_since_last_war >= 0) && (turns_since_last_war < 5)) ||
 		receiver_diplomat.TestPublicRegard(sender, COLDWAR_REGARD))
@@ -738,24 +674,22 @@
 		return GEV_HD_Continue;
 	}
 
-	
 	sint32 receiver_saw_map =
 		AgreementMatrix::s_agreements.GetAgreementDuration(receiver, sender, PROPOSAL_REQUEST_MAP);
-	
+
 	sint32 want_map_turns;
 	receiver_diplomat.GetCurrentDiplomacy(sender).GetWantMapTurns(want_map_turns);
 
 	if (receiver_saw_map != -1 &&
 		receiver_saw_map < want_map_turns)
 	{
-		
-		
+
 		DiplomacyResult proposal_sender_result;
 		DiplomacyResult proposal_receiver_result;
 		ProposalAnalysis::ComputeResult( sender_proposal,
 			proposal_sender_result,
 			proposal_receiver_result );
-		
+
 		Player * receiver_ptr = g_player[receiver];
 		sint32 income = receiver_ptr->GetGold();
 		sint32 science_level = receiver_ptr->m_science->GetLevel();
@@ -767,40 +701,35 @@
 		return GEV_HD_Continue;
 	}
 
-	
 	DiplomacyArg arg;
 	receiver_diplomat.ConsiderCounterResponse(
-		sender, 
-		PROPOSAL_OFFER_MAP, 
-		arg, 
+		sender,
+		PROPOSAL_OFFER_MAP,
+		arg,
 		accept_priority,
 		DIPLOMATIC_TONE_EQUAL);
 
 	return GEV_HD_Continue;
 }
 
-							  
 
 STDEHANDLER(PeaceTreaty_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_TREATY_PEACE)
 		return GEV_HD_Continue;
 
@@ -810,48 +739,41 @@
 //	sint32 reject_priority =
 //		receiver_diplomat.GetRejectPriority( sender, sender_proposal.detail.first_type);
 
-	
 	if (accept_priority <= 0)
 		return GEV_HD_Continue;
-	
-	
-	
-	
+
+
+
+
 	if ((!receiver_diplomat.GetPersonality()->GetConquestAgressive() ||
 		 receiver_diplomat.GetPersonality()->GetDiscoveryDiplomatic()) &&
 		 AgreementMatrix::s_agreements.TurnsSinceLastWar(sender,receiver) == -1)
 	{
-		
+
 		if (receiver_diplomat.TestEffectiveRegard(sender, COLDWAR_REGARD))
 			return GEV_HD_Continue;
 	}
 
-	
 	else if (!receiver_diplomat.TestEffectiveRegard(sender, NEUTRAL_REGARD))
 		return GEV_HD_Continue;
 
-	
 	if (receiver_diplomat.GetLastHotwarAttack(sender) <= 10)
 		return GEV_HD_Continue;
-	
-	
+
 	if (receiver_diplomat.GetLastColdwarAttack(sender) <= 5)
 		return GEV_HD_Continue;
-	
-	
+
 	if (receiver_diplomat.GetTrust(sender) < COLDWAR_REGARD)
 		return GEV_HD_Continue;
-	
-	
+
 	if (receiver_diplomat.DesireWarWith(sender))
 		return GEV_HD_Continue;
 
-	
-	
+
 	if (receiver_diplomat.GetBorderIncursionBy(sender) &&
 		AgreementMatrix::s_agreements.HasAgreement(sender,receiver, PROPOSAL_OFFER_WITHDRAW_TROOPS))
 	{
-		
+
 		DiplomacyArg arg;
 		receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_OFFER_WITHDRAW_TROOPS, arg, accept_priority, DIPLOMATIC_TONE_INDIGNANT);
 
@@ -859,34 +781,30 @@
 	}
 	else
 	{
-		
+
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 	}
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(AcceptAlliance_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_TREATY_ALLIANCE)
 		return GEV_HD_Continue;
 
@@ -896,31 +814,24 @@
 	if (accept_priority <= 0)
 		return GEV_HD_Continue;
 
-	
 	if (!receiver_diplomat.TestEffectiveRegard(sender, ALLIED_REGARD))
 		return GEV_HD_Continue;
 
-	
 	if (receiver_diplomat.GetLastHotwarAttack(sender) < 25)
 		return GEV_HD_Continue;
 
-	
 	if (receiver_diplomat.GetLastColdwarAttack(sender) < 15)
 		return GEV_HD_Continue;
 
-	
 	if (receiver_diplomat.GetBorderIncursionBy(sender))
 		return GEV_HD_Continue;
 
-	
 	if (receiver_diplomat.GetTrust(sender) < FRIEND_REGARD)
 		return GEV_HD_Continue;
 
-	
 	if (!receiver_diplomat.CanFormAlliance(sender))
 		return GEV_HD_Continue;
-	
-	
+
 	receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 
 	return GEV_HD_Continue;
@@ -934,107 +845,91 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_GIVE_GOLD)
 		return GEV_HD_Continue;
 
 	sint32 accept_priority =
 		receiver_diplomat.GetAcceptPriority( sender, sender_proposal.detail.first_type);
 
-	
 	if (!AgreementMatrix::s_agreements.HasAgreement(sender, receiver, PROPOSAL_TREATY_DECLARE_WAR))
 		return GEV_HD_Continue;
 
-	
 	if (receiver_diplomat.GetTrust(sender) < COLDWAR_REGARD)
 		return GEV_HD_Continue;
 
-	
 	if (receiver_diplomat.DesireWarWith(sender))
 		return GEV_HD_Continue;
 
-	
-	sint32 extort_gold = 
+	sint32 extort_gold =
 	    std::min(3 * g_player[receiver]->m_gold->GetIncome(), static_cast<sint32>(g_player[receiver]->GetGold() * 0.85));
 
-	
 	if (sender_proposal.detail.first_arg.gold > extort_gold)
 		return GEV_HD_Continue;
 
 	DiplomacyArg arg;
-	receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_TREATY_CEASEFIRE, 
+	receiver_diplomat.ConsiderCounterResponse(sender, PROPOSAL_TREATY_CEASEFIRE,
 		arg, accept_priority, DIPLOMATIC_TONE_EQUAL);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(AcceptGifts_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
 	sint32 accept_priority =
 		receiver_diplomat.GetAcceptPriority( sender, sender_proposal.detail.first_type);
-	
+
 	if (!ProposalAnalysis::IsSimpleGift( sender_proposal ))
 		return GEV_HD_Continue;
 
-	
 	receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(StopResearch_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_STOP_RESEARCH)
 		return GEV_HD_Continue;
 
@@ -1054,30 +949,26 @@
 	sint32 stop_advance_type = sender_proposal.detail.first_arg.advanceType;
 	Assert(stop_advance_type  >= 0 && stop_advance_type < g_theAdvanceDB->NumRecords());
 
-	DIPLOMATIC_STRENGTH sender_strength = 
+	DIPLOMATIC_STRENGTH sender_strength =
 		g_player[sender]->GetRelativeStrength(receiver);
 
-	
 	bool personality_fails =
 		((receiver_diplomat.GetPersonality()->GetDiscoveryScientist() &&
 		  receiver_diplomat.GetPersonality()->GetConquestAgressive()) ||
 		 (receiver_diplomat.GetPersonality()->GetAlignmentEvil() &&
 		  receiver_diplomat.GetPersonality()->GetTrustworthinessLawful()));
 
-	
 	bool appropriate_advance = (sender_diplomat.GetStopResearchingAdvance(receiver) == stop_advance_type );
 
-	
-	if (personality_fails || 
-		(sender_strength > DIPLOMATIC_STRENGTH_AVERAGE) || 
+	if (personality_fails ||
+		(sender_strength > DIPLOMATIC_STRENGTH_AVERAGE) ||
 		!appropriate_advance)
 	{
-		
+
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
 		return GEV_HD_Continue;
 	}
 
-	
 	if (sender_strength > DIPLOMATIC_STRENGTH_AVERAGE)
 	{
 		bool researching_advance = (sender_ptr->m_advances->GetResearching() == stop_advance_type);
@@ -1085,30 +976,30 @@
 
 		if (researching_advance)
 		{
-			
+
 			DiplomacyArg arg;
 			arg.advanceType = stop_advance_type;
 			receiver_diplomat.ConsiderCounterResponse(
-				sender, 
-				PROPOSAL_OFFER_STOP_RESEARCH, 
-				arg, 
+				sender,
+				PROPOSAL_OFFER_STOP_RESEARCH,
+				arg,
 				accept_priority,
 				DIPLOMATIC_TONE_MEEK);
 		}
 		else if (has_advance && !AgreementMatrix::s_agreements.HasAgreement(sender,receiver,PROPOSAL_TREATY_PEACE))
 		{
-			
+
 			DiplomacyArg arg;
 			receiver_diplomat.ConsiderCounterResponse(
-				sender, 
-				PROPOSAL_TREATY_PEACE, 
-				arg, 
+				sender,
+				PROPOSAL_TREATY_PEACE,
+				arg,
 				accept_priority,
 				DIPLOMATIC_TONE_MEEK);
 		}
 		else
 		{
-			
+
 			receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			return GEV_HD_Continue;
 		}
@@ -1122,21 +1013,18 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_REDUCE_NANO_WEAPONS &&
 		sender_proposal.detail.first_type != PROPOSAL_REQUEST_REDUCE_BIO_WEAPONS &&
 		sender_proposal.detail.first_type != PROPOSAL_REQUEST_REDUCE_NUCLEAR_WEAPONS)
@@ -1155,28 +1043,23 @@
 	sint32 reject_priority =
 		receiver_diplomat.GetRejectPriority( sender, sender_proposal.detail.first_type);
 
-	
 	if (receiver_diplomat.GetTrust(sender) < NEUTRAL_REGARD)
 		return GEV_HD_Continue;
 
-	
 	sint32 sender_city_count = g_player[sender]->GetNumCities();
 	sint32 receiver_city_count = g_player[receiver]->GetNumCities();
-	
-	
+
 	sint16 sender_nukes_count = MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(sender);
 	sint16 sender_bio_count = MapAnalysis::GetMapAnalysis().GetBioWeaponsCount(sender);
 	sint16 sender_nano_count = MapAnalysis::GetMapAnalysis().GetNanoWeaponsCount(sender);
 
-	
 	sint16 receiver_nukes_count = MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(receiver);
 	sint16 receiver_bio_count = MapAnalysis::GetMapAnalysis().GetBioWeaponsCount(receiver);
 	sint16 receiver_nano_count = MapAnalysis::GetMapAnalysis().GetNanoWeaponsCount(receiver);
 
-	
 	double sender_losses;
 	double receiver_losses;
-	
+
 	PROPOSAL_TYPE proposal_type;
 	if (sender_nano_count > 0)
 	{
@@ -1198,69 +1081,62 @@
 	}
 	else
 	{
-		
+
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
 
 		return GEV_HD_Continue;
 	}
 
-	
 	double reduce_percent;
 	if (sender_losses <= 0.0)
 		reduce_percent = 1.0;
 	else if (receiver_losses > 0.5)
 		reduce_percent = (receiver_losses - 0.5) / receiver_losses;
-	else 
+	else
 		reduce_percent = (receiver_losses - (sender_losses / 2)) / receiver_losses;
 
 	if (reduce_percent <= 0.0)
 	{
-		
+
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
 
 		return GEV_HD_Continue;
 	}
 
-	
 	reduce_percent = ProposalAnalysis::RoundPercentReduction(reduce_percent);
 
 	if (reduce_percent <= 0)
 		return GEV_HD_Continue;
 
-	
 	DiplomacyArg arg;
 	arg.percent = reduce_percent;
 	receiver_diplomat.ConsiderCounterResponse(
-		sender, 
-		proposal_type, 
-		arg, 
+		sender,
+		proposal_type,
+		arg,
 		accept_priority,
 		DIPLOMATIC_TONE_EQUAL);
-	
+
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(ReducePollution_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_REDUCE_POLLUTION)
 		return GEV_HD_Continue;
 
@@ -1281,7 +1157,6 @@
 	uint32 receiver_pollution = g_player[receiver]->GetPollutionLevel();
 	double pollution_ratio = (double) sender_pollution / receiver_pollution;
 
-	
 	if (pollution_ratio > 1.5)
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
@@ -1289,10 +1164,9 @@
 		return GEV_HD_Continue;
 	}
 
-	double reduce_percent = 0.05; 
+	double reduce_percent = 0.05;
 	DIPLOMATIC_TONE tone = DIPLOMATIC_TONE_EQUAL;
 
-	
 	if (receiver_diplomat.GetPersonality()->GetDiscoveryEcotopian() &&
 		pollution_ratio > 1.0)
 	{
@@ -1305,8 +1179,8 @@
 		if (!AgreementMatrix::s_agreements.HasAgreement(sender,receiver,PROPOSAL_TREATY_PEACE))
 		{
 			receiver_diplomat.ConsiderResponse(
-				sender, 
-				RESPONSE_REJECT, 
+				sender,
+				RESPONSE_REJECT,
 				reject_priority);
 			return GEV_HD_Continue;
 		}
@@ -1314,16 +1188,14 @@
 		tone = DIPLOMATIC_TONE_INDIGNANT;
 	}
 
-	
 	reduce_percent = ProposalAnalysis::RoundPercentReduction(reduce_percent);
 
-	
 	DiplomacyArg arg;
 	arg.pollution = static_cast<sint32>((1.0 - reduce_percent) * sender_pollution);
 	receiver_diplomat.ConsiderCounterResponse(
-		sender, 
-		PROPOSAL_OFFER_REDUCE_POLLUTION, 
-		arg, 
+		sender,
+		PROPOSAL_OFFER_REDUCE_POLLUTION,
+		arg,
 		accept_priority,
 		tone);
 
@@ -1335,21 +1207,18 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_HONOR_MILITARY_AGREEMENT)
 		return GEV_HD_Continue;
 
@@ -1370,7 +1239,6 @@
 	sint32 reject_priority =
 		receiver_diplomat.GetRejectPriority( sender, sender_proposal.detail.first_type);
 
-	
 	if (foreigner == PLAYER_INDEX_VANDALS ||
 		AgreementMatrix::s_agreements.HasAgreement(receiver, foreigner, PROPOSAL_TREATY_DECLARE_WAR))
 	{
@@ -1378,7 +1246,6 @@
 		return GEV_HD_Continue;
 	}
 
-	
 	if (AgreementMatrix::s_agreements.HasAgreement(receiver, sender, PROPOSAL_TREATY_ALLIANCE) ||
 		receiver_diplomat.GetPersonality()->GetTrustworthinessLawful())
 	{
@@ -1386,43 +1253,38 @@
 		return GEV_HD_Continue;
 	}
 
-	DIPLOMATIC_STRENGTH sender_strength = 
+	DIPLOMATIC_STRENGTH sender_strength =
         std::max(g_player[sender]->GetRelativeStrength(foreigner),
 			     g_player[sender]->GetRelativeStrength(receiver)
                 );
 
-	
 	if (sender_strength > DIPLOMATIC_STRENGTH_VERY_STRONG)
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 		return GEV_HD_Continue;
 	}
 
-	DIPLOMATIC_STRENGTH foreigner_strength = 
+	DIPLOMATIC_STRENGTH foreigner_strength =
         foreigner_ptr->GetRelativeStrength(sender);
 
-	
 	if (foreigner_strength > DIPLOMATIC_STRENGTH_VERY_STRONG)
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
 		return GEV_HD_Continue;
 	}
 
-	
 	if (!receiver_diplomat.TestEffectiveRegard(sender, FRIEND_REGARD))
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
 		return GEV_HD_Continue;
 	}
 
-	
 	if (!receiver_diplomat.TestEffectiveRegard(foreigner, FRIEND_REGARD))
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 		return GEV_HD_Continue;
 	}
 
-	
 	return GEV_HD_Continue;
 }
 
@@ -1431,21 +1293,18 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_HONOR_POLLUTION_AGREEMENT)
 		return GEV_HD_Continue;
 
@@ -1462,8 +1321,7 @@
 	sint32 reject_priority =
 		receiver_diplomat.GetRejectPriority( sender, sender_proposal.detail.first_type);
 
-	
-	ai::Agreement receiver_agreement = 
+	ai::Agreement receiver_agreement =
 		AgreementMatrix::s_agreements.GetAgreement(sender, receiver, PROPOSAL_TREATY_POLLUTION_PACT);
 
 	ai::Agreement sender_agreement = receiver_agreement;
@@ -1476,7 +1334,7 @@
 
 	if (sender_agreement == AgreementMatrix::s_badAgreement)
 	{
-		
+
 		Assert(0);
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
 		return GEV_HD_Continue;
@@ -1485,29 +1343,25 @@
 	uint32 receiver_pollution = receiver_ptr->GetPollutionLevel();
 	uint32 sender_pollution = sender_ptr->GetPollutionLevel();
 
-	
 	sint32 receiver_promised_pollution = receiver_agreement.proposal.first_arg.pollution;
 //	double receiver_pollution_ratio = (double) receiver_pollution / receiver_promised_pollution;
 	sint32 requested_pollution = sender_proposal.detail.first_arg.pollution;
 
-	
 	if (requested_pollution > receiver_promised_pollution * 1.3)
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
 		return GEV_HD_Continue;
 	}
 
-	
 	if (receiver_agreement == AgreementMatrix::s_badAgreement)
 	{
 		sint32 sender_promised_pollution = sender_agreement.proposal.first_arg.pollution;
 		double sender_pollution_ratio = (double) sender_pollution / sender_promised_pollution;
 		uint32 half_sender_promised_pollution = sender_promised_pollution / 2;
-		
-		
+
 		if (sender_pollution_ratio > 1.0)
 		{
-			
+
 			DiplomacyArg arg;
 			double percent = ((double)sender_pollution - sender_promised_pollution) / sender_pollution;
 			percent = ProposalAnalysis::RoundPercentReduction(percent);
@@ -1516,28 +1370,26 @@
 			arg.pollution = ProposalAnalysis::RoundGold(arg.pollution);
 			if (arg.pollution <= 0)
 				return GEV_HD_Continue;
-			
+
 			sint32 turns_since_start = NewTurnCount::GetCurrentRound() - sender_agreement.start;
 
-			
 			if (receiver_diplomat.GetPersonality()->GetDiscoveryEcotopian() &&
 				turns_since_start < 10)
 			{
 				receiver_diplomat.ConsiderCounterResponse(
-					sender, 
-					PROPOSAL_OFFER_HONOR_POLLUTION_AGREEMENT, 
-					arg, 
+					sender,
+					PROPOSAL_OFFER_HONOR_POLLUTION_AGREEMENT,
+					arg,
 					accept_priority,
 					DIPLOMATIC_TONE_ANGRY);
 			}
-			
+
 			else if (turns_since_start < 20 )
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 				return GEV_HD_Continue;
 			}
-			
-			
+
 			else if (turns_since_start > 20 && turns_since_start < 50 &&
 				     sender_pollution <= half_sender_promised_pollution)
 			{
@@ -1546,24 +1398,24 @@
 			}
 			else
 			{
-				
+
 				receiver_diplomat.ConsiderCounterResponse(
-					sender, 
-					PROPOSAL_OFFER_HONOR_POLLUTION_AGREEMENT, 
-					arg, 
+					sender,
+					PROPOSAL_OFFER_HONOR_POLLUTION_AGREEMENT,
+					arg,
 					accept_priority,
 					DIPLOMATIC_TONE_INDIGNANT);
 				return GEV_HD_Continue;
 			}
 		}
 	}
-	
+
 	else if ((receiver_pollution / sender_pollution) < 1.0)
 	{
 		DiplomacyArg arg;
 		double percent = 0.0;
 		DIPLOMATIC_TONE tone = DIPLOMATIC_TONE_EQUAL;
-		
+
 		if (receiver_diplomat.GetPersonality()->GetDiscoveryEcotopian())
 		{
 			percent = (double)(sender_pollution - receiver_pollution) / sender_pollution;
@@ -1575,8 +1427,7 @@
 			percent = 0.1;
 			tone = DIPLOMATIC_TONE_INDIGNANT;
 		}
-		
-		
+
 		percent = ProposalAnalysis::RoundPercentReduction(percent);
 
 		arg.pollution = static_cast<sint32>(percent * sender_pollution);
@@ -1585,14 +1436,13 @@
 			return GEV_HD_Continue;
 
 		receiver_diplomat.ConsiderCounterResponse(
-			sender, 
+			sender,
 			PROPOSAL_OFFER_REDUCE_POLLUTION,
 			arg, accept_priority, tone);
 		return GEV_HD_Continue;
 	}
 
-	
-	
+
 	if (receiver_diplomat.GetPersonality()->GetDiscoveryEcotopian() ||
 		receiver_diplomat.GetPersonality()->GetTrustworthinessLawful() ||
 		receiver_diplomat.GetPersonality()->GetAlignmentGood())
@@ -1601,33 +1451,29 @@
 	}
 	else
 	{
-		
+
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
 	}
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(EndEmbargo_ProposalResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	if (sender_proposal.detail.first_type != PROPOSAL_REQUEST_END_EMBARGO)
 		return GEV_HD_Continue;
 
@@ -1644,7 +1490,6 @@
 	sint32 reject_priority =
 		receiver_diplomat.GetRejectPriority( sender, sender_proposal.detail.first_type);
 
-	
 	if (!receiver_diplomat.GetEmbargo(sender))
 	{
 		receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
@@ -1654,8 +1499,7 @@
 	sint32 receiver_trade_total =  MapAnalysis::GetMapAnalysis().GetTotalTrade(receiver);
 	sint32 sender_trade_total = MapAnalysis::GetMapAnalysis().GetTotalTrade(sender);
 
-	
-	
+
 	if (receiver_diplomat.TestPublicRegard(sender, FRIEND_REGARD) &&
 		(sender_trade_total > 1.5 * receiver_trade_total ))
 	{
@@ -1664,18 +1508,16 @@
 		arg.gold = ProposalAnalysis::RoundGold(arg.gold);
 		if (arg.gold <= 0)
 			return GEV_HD_Continue;
-		
-		
-		
+
+
 		receiver_diplomat.ConsiderCounterResponse(
-			sender, 
-			PROPOSAL_OFFER_GIVE_GOLD, 
+			sender,
+			PROPOSAL_OFFER_GIVE_GOLD,
 			arg, accept_priority, DIPLOMATIC_TONE_MEEK);
-		
+
 		return GEV_HD_Continue;
 	}
 
-	
 	if (sender_diplomat.GetEmbargo(receiver))
 	{
 		DiplomacyArg arg;
@@ -1684,16 +1526,14 @@
 		if (arg.gold <= 0)
 			return GEV_HD_Continue;
 
-		
 		receiver_diplomat.ConsiderCounterResponse(
-			sender, 
-			PROPOSAL_OFFER_END_EMBARGO, 
+			sender,
+			PROPOSAL_OFFER_END_EMBARGO,
 			arg, accept_priority, DIPLOMATIC_TONE_MEEK);
 		return GEV_HD_Continue;
 	}
 
-	
-	
+
 	receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 
 	return GEV_HD_Continue;
@@ -1704,21 +1544,18 @@
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 
-	const NewProposal & sender_proposal = 
+	const NewProposal & sender_proposal =
 		sender_diplomat.GetMyLastNewProposal(receiver);
 
-	
 	PROPOSAL_TYPE gift_type;
 	DiplomacyArg gift_arg;
 	PROPOSAL_TYPE desire_type;
@@ -1728,26 +1565,24 @@
 	bool includes_gift = false;
 	bool is_treaty = false;
 
-	
-	is_treaty = ProposalAnalysis::GetTreatyFromProposal(sender_proposal.detail, 
+	is_treaty = ProposalAnalysis::GetTreatyFromProposal(sender_proposal.detail,
 		treaty_type, treaty_arg, includes_gift, gift_type, gift_arg);
 
 	if (is_treaty)
 	{
-		
+
 		DiplomacyResult sender_result;
 		DiplomacyResult receiver_result;
 		ProposalAnalysis::ComputeResult( sender_proposal,
 			sender_result,
 			receiver_result );
 
-		sint32 accept_priority = 
+		sint32 accept_priority =
 			receiver_diplomat.GetAcceptPriority( sender, treaty_type);
-		
+
 		sint32 reject_priority =
 			receiver_diplomat.GetRejectPriority( sender, treaty_type);
 
-		
 		if (receiver_result.gold < 0 ||
 			receiver_result.science < 0 ||
 			receiver_result.production < 0)
@@ -1755,17 +1590,14 @@
 			return GEV_HD_Continue;
 		}
 
-		
 		ProposalAnalysis::AcceptTreatyCondition(receiver, sender, treaty_type, treaty_arg, desire_type, desire_arg );
 
-		
 		if (desire_type == PROPOSAL_NONE)
 		{
 			receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			return GEV_HD_Continue;
 		}
-		
-		
+
 		if (!includes_gift)
 		{
 			return GEV_HD_Continue;
@@ -1774,11 +1606,11 @@
 		switch (desire_type)
 		{
 		case PROPOSAL_MAX:
-			
+
 			receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, reject_priority);
 			break;
 		case PROPOSAL_OFFER_END_EMBARGO:
-			
+
 			if (gift_type == PROPOSAL_OFFER_END_EMBARGO ||
 				gift_type == PROPOSAL_OFFER_REDUCE_NUCLEAR_WEAPONS ||
 				gift_type == PROPOSAL_OFFER_REDUCE_BIO_WEAPONS ||
@@ -1786,19 +1618,19 @@
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
-			else if (gift_type == PROPOSAL_OFFER_GIVE_GOLD && 
+
+			else if (gift_type == PROPOSAL_OFFER_GIVE_GOLD &&
 					 (receiver_result.gold > desire_arg.gold))
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
-			else if (gift_type == PROPOSAL_OFFER_GIVE_ADVANCE && 
+
+			else if (gift_type == PROPOSAL_OFFER_GIVE_ADVANCE &&
 				receiver_result.science > desire_arg.gold)
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
+
 			else if (gift_type == PROPOSAL_OFFER_GIVE_CITY &&
 				receiver_result.science + receiver_result.gold > desire_arg.gold)
 			{
@@ -1807,7 +1639,7 @@
 
 			break;
 		case PROPOSAL_OFFER_STOP_PIRACY:
-			
+
 			if (gift_type == PROPOSAL_OFFER_STOP_PIRACY ||
 				gift_type == PROPOSAL_OFFER_END_EMBARGO ||
 				gift_type == PROPOSAL_OFFER_WITHDRAW_TROOPS ||
@@ -1817,19 +1649,19 @@
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
-			else if (gift_type == PROPOSAL_OFFER_GIVE_GOLD && 
+
+			else if (gift_type == PROPOSAL_OFFER_GIVE_GOLD &&
 					 (receiver_result.gold > desire_arg.gold))
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
-			else if (gift_type == PROPOSAL_OFFER_GIVE_ADVANCE && 
+
+			else if (gift_type == PROPOSAL_OFFER_GIVE_ADVANCE &&
 				receiver_result.science > desire_arg.gold)
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
+
 			else if (gift_type == PROPOSAL_OFFER_GIVE_CITY &&
 				receiver_result.science + receiver_result.gold > desire_arg.gold)
 			{
@@ -1837,7 +1669,7 @@
 			}
 			break;
 		case PROPOSAL_OFFER_WITHDRAW_TROOPS:
-			
+
 			if (gift_type == PROPOSAL_OFFER_WITHDRAW_TROOPS ||
 				gift_type == PROPOSAL_OFFER_STOP_PIRACY ||
 				gift_type == PROPOSAL_OFFER_REDUCE_NUCLEAR_WEAPONS ||
@@ -1847,7 +1679,7 @@
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
+
 			else if (gift_type == PROPOSAL_OFFER_GIVE_CITY &&
 				receiver_result.science + receiver_result.gold > desire_arg.gold)
 			{
@@ -1856,19 +1688,19 @@
 
 			break;
 		case PROPOSAL_OFFER_GIVE_GOLD:
-			
-			if (gift_type == PROPOSAL_OFFER_GIVE_GOLD && 
+
+			if (gift_type == PROPOSAL_OFFER_GIVE_GOLD &&
 				(receiver_result.gold > desire_arg.gold))
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
-			else if (gift_type == PROPOSAL_OFFER_GIVE_ADVANCE && 
+
+			else if (gift_type == PROPOSAL_OFFER_GIVE_ADVANCE &&
 				receiver_result.science > desire_arg.gold)
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
+
 			else if (gift_type == PROPOSAL_OFFER_GIVE_CITY &&
 				receiver_result.science + receiver_result.gold > desire_arg.gold)
 			{
@@ -1876,19 +1708,19 @@
 			}
 			break;
 		case PROPOSAL_OFFER_GIVE_ADVANCE:
-			
-			if (gift_type == PROPOSAL_OFFER_GIVE_GOLD && 
+
+			if (gift_type == PROPOSAL_OFFER_GIVE_GOLD &&
 					 (receiver_result.science > desire_arg.gold))
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
-			else if (gift_type == PROPOSAL_OFFER_GIVE_ADVANCE && 
+
+			else if (gift_type == PROPOSAL_OFFER_GIVE_ADVANCE &&
 				receiver_result.science > desire_arg.gold)
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
-			
+
 			else if (gift_type == PROPOSAL_OFFER_GIVE_CITY &&
 				receiver_result.science + receiver_result.gold > desire_arg.gold)
 			{
@@ -1896,7 +1728,7 @@
 			}
 			break;
 		case PROPOSAL_OFFER_GIVE_CITY:
-			
+
 			if (gift_type == PROPOSAL_OFFER_GIVE_CITY &&
 				receiver_result.science + receiver_result.gold > desire_arg.gold)
 			{
@@ -1904,9 +1736,9 @@
 			}
 			break;
 		case PROPOSAL_OFFER_REDUCE_POLLUTION:
-			
+
 			if (gift_type == PROPOSAL_OFFER_REDUCE_POLLUTION &&
-				gift_arg.pollution >= desire_arg.pollution) 
+				gift_arg.pollution >= desire_arg.pollution)
 			{
 				receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, accept_priority);
 			}
@@ -1916,80 +1748,75 @@
 	return GEV_HD_Continue;
 }
 
-
 void ProposalResponseEventCallbacks::AddCallbacks()
 {
-	
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_LandForPeace_ProposalResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_Accept_ProposalResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_Reject_ProposalResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_PayTribute_ProposalResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_PayForAdvance_ProposalResponseEvent);
 
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_AdvanceForGold_ProposalResponseEvent);
 
 	g_gevManager->AddCallback(GEV_ProposalResponse,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_AdvanceExchange_ProposalResponseEvent);
 
 	g_gevManager->AddCallback(GEV_ProposalResponse,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_StopPiracy_ProposalResponseEvent);
 
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_GiveMap_ProposalResponseEvent);
 
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_PeaceTreaty_ProposalResponseEvent);
 
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_AcceptAlliance_ProposalResponseEvent);
 
-	g_gevManager->AddCallback(GEV_ProposalResponse, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_ProposalResponse,
+							  GEV_PRI_Pre,
 							  &s_CeasefireForGold_ProposalResponseEvent);
 
 	g_gevManager->AddCallback(GEV_ProposalResponse,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_AcceptGifts_ProposalResponseEvent);
 
 	g_gevManager->AddCallback(GEV_ProposalResponse,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_StopResearch_ProposalResponseEvent);
 
 	g_gevManager->AddCallback(GEV_ProposalResponse,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_ReduceWeapons_ProposalResponseEvent);
 
 	g_gevManager->AddCallback(GEV_ProposalResponse,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_ReducePollution_ProposalResponseEvent);
 
 	g_gevManager->AddCallback(GEV_ProposalResponse,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_HonorMilitaryAgreement_ProposalResponseEvent);
 
 	g_gevManager->AddCallback(GEV_ProposalResponse,
@@ -2008,5 +1835,4 @@
 							  GEV_PRI_Pre,
 							  &s_MutualWithdraw_ProposalResponseEvent);
 
-
 }

Modified: trunk/ctp2_code/ai/diplomacy/reactevent.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/reactevent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/reactevent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,15 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __REACT_EVENT_H__
 #define __REACT_EVENT_H__

Modified: trunk/ctp2_code/ai/diplomacy/regardevent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/regardevent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/regardevent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -22,7 +22,7 @@
 // - Generate debug version when set.
 //
 // _SLOW_BUT_SAFE
-// - Define 2 other symbols (PROJECTED_CHECK_START and PROJECTED_CHECK_END) 
+// - Define 2 other symbols (PROJECTED_CHECK_START and PROJECTED_CHECK_END)
 //   when set. But the defined symbols are never used, so this doesn't do
 //   anything at all. This makes preprocessing and compilation slower, but
 //   should be safe.
@@ -31,8 +31,8 @@
 //
 // Modifications from the original Activision code:
 //
-//  - Hidden Nationality check added to AfterBattle by E 18 Nov 2005 if unit is 
-//    not Hidden Nationality then Regard Event is Logged 
+//  - Hidden Nationality check added to AfterBattle by E 18 Nov 2005 if unit is
+//    not Hidden Nationality then Regard Event is Logged
 //
 //----------------------------------------------------------------------------
 
@@ -82,8 +82,7 @@
 		return GEV_HD_Continue;
 
 	Diplomat & diplomat = Diplomat::GetDiplomat(u.GetOwner());
-	
-	
+
 	if (cause != CAUSE_REMOVE_ARMY_DIED_IN_ATTACK_ON_TOP &&
 		cause != CAUSE_REMOVE_ARMY_ATTACKED)
 		return GEV_HD_Continue;
@@ -94,12 +93,12 @@
 	}
 
 	DPRINTF(k_DBG_AI, ("//	Kill Unit regard event\n"));  //EMOD added
-	
+
 	CellUnitList army;
 	g_theWorld->GetArmy(u.RetPos(), army);
 	bool not_at_war = (AgreementMatrix::s_agreements.TurnsAtWar(killer, u.GetOwner()) < 1);
 
-	if (u.GetDBRec()->GetCivilian()) 
+	if (u.GetDBRec()->GetCivilian())
 	{
 		sint32 cost;
 
@@ -111,7 +110,7 @@
 			g_theStringDB->GetStringID("REGARD_EVENT_ATTACKED_CIVILIANS", strId);
 			diplomat.LogRegardEvent( killer,
 				cost,
-				REGARD_EVENT_MILITARY_SAFETY,	
+				REGARD_EVENT_MILITARY_SAFETY,
 				strId);
 
 			sint32 trust_cost;
@@ -147,11 +146,11 @@
 
 	sint32 turns_since_withdraw_troops_agreement = 	AgreementMatrix::s_agreements.
 		GetAgreementDuration(border_owner, army_owner,PROPOSAL_REQUEST_WITHDRAW_TROOPS);
-	if ((turns_since_withdraw_troops_agreement >= 20) && 
+	if ((turns_since_withdraw_troops_agreement >= 20) &&
 		(!AgreementMatrix::s_agreements.HasAgreement(border_owner, army_owner, PROPOSAL_TREATY_ALLIANCE)) &&
 		(!owner_diplomat.GetBorderIncursionBy(army_owner)))
 	{
-		
+
 		owner_diplomat.GetCurrentDiplomacy(army_owner).GetIncursionRegardCost(cost);
 		g_theStringDB->GetStringID("REGARD_EVENT_PEACETIME_BORDER_INCURSION", strId);
 		owner_diplomat.LogRegardEvent( army_owner,
@@ -171,7 +170,7 @@
 {
 	Army a;
 	MapPoint from, to;
-	
+
 	if(!args->GetArmy(0, a)) return GEV_HD_Continue;
 	if(!args->GetPos(0, from)) return GEV_HD_Continue;
 	if(!args->GetPos(1, to)) return GEV_HD_Continue;
@@ -191,8 +190,7 @@
 	sint32 invader_movement_cost;
 	StringId strId;
 
-	
-	if (g_player[new_cell_owner] && 
+	if (g_player[new_cell_owner] &&
 		!g_player[new_cell_owner]->HasContactWith(army_owner))
 		return GEV_HD_Continue;
 
@@ -215,7 +213,7 @@
 			invader_movement_cost,
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
-	
+
 	return GEV_HD_Continue;
 }
 
@@ -250,10 +248,10 @@
 	TradeRoute route;
 	Army army;
 
-	if(!args->GetTradeRoute(0, route)) 
+	if(!args->GetTradeRoute(0, route))
 		return GEV_HD_Continue;
-	
-	if(!args->GetArmy(0, army)) 
+
+	if(!args->GetArmy(0, army))
 		return GEV_HD_Continue;
 
 	PLAYER_INDEX army_owner = army->GetOwner();
@@ -334,7 +332,7 @@
 			cost,
 			REGARD_EVENT_MILITARY_POWER,
 			strId,
-			50); 
+			50);
 	}
 
 	return GEV_HD_Continue;
@@ -359,13 +357,11 @@
 
 	originalOwner = city.GetOwner();
 
-	
 	if ((CAUSE_REMOVE_CITY)cause != CAUSE_REMOVE_CITY_ATTACK)
 		return GEV_HD_Continue;
 
 	Diplomat & city_diplomat = Diplomat::GetDiplomat(originalOwner);
 
-	
 	StringId strId;
 	sint32 cost;
 
@@ -373,18 +369,16 @@
 	city_diplomat.GetCurrentDiplomacy(newOwner).GetTakeCityRegardCost(cost);
 	city_diplomat.LogRegardEvent( newOwner, cost, REGARD_EVENT_MILITARY_POWER, strId);
 
-	
 	city_diplomat.LogViolationEvent(newOwner, PROPOSAL_TREATY_CEASEFIRE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(InciteRevolution_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -397,11 +391,10 @@
 	Diplomat & city_diplomat = Diplomat::GetDiplomat(city_owner);
 
 	city_diplomat.SetColdwarAttack(attack_owner, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetInciteRevolutionRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_INCITED_REVOLUTION", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -409,21 +402,18 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_MILITARY_PACT);
-	
-	
+
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_ALLIANCE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(AssassinateRulerUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -436,11 +426,10 @@
 	Diplomat & city_diplomat = Diplomat::GetDiplomat(city_owner);
 
 	city_diplomat.SetColdwarAttack(attack_owner, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetAssassinateRulerRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_ASSASSINATED_RULER", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -448,21 +437,18 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_MILITARY_PACT);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_ALLIANCE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(MakeFranchise_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -475,11 +461,10 @@
 	Diplomat & city_diplomat = Diplomat::GetDiplomat(city_owner);
 
 	city_diplomat.SetColdwarAttack(attack_owner, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetFranchiseCityRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_FRANCHISED_CITY", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -487,17 +472,15 @@
 			REGARD_EVENT_GOLD,
 			strId);
 
-	
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(PlantNukeUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -514,7 +497,6 @@
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetPlantNukeRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_PLANTED_NUKE", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -522,7 +504,6 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	sint32 trust_cost;
@@ -535,19 +516,18 @@
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(EnslaveSettler_RegardEvent)
 {
 	Army a;
 	Unit slaver, settler;
-	
-	if(!args->GetArmy(0, a)) 
+
+	if(!args->GetArmy(0, a))
 		return GEV_HD_Continue;
-	
-	if(!args->GetUnit(0, slaver)) 
+
+	if(!args->GetUnit(0, slaver))
 		return GEV_HD_Continue;
-	
-	if(!args->GetUnit(1, settler)) 
+
+	if(!args->GetUnit(1, settler))
 		return GEV_HD_Continue;
 
 	PLAYER_INDEX attack_owner = slaver.GetOwner();
@@ -558,7 +538,6 @@
 	sint32 cost;
 	settler_diplomat.GetCurrentDiplomacy(attack_owner).GetEnslaveSettlerRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_ENSLAVED_SETTLER", strId);
 	settler_diplomat.LogRegardEvent( attack_owner,
@@ -566,18 +545,16 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	settler_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(SlaveRaidCity_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -593,7 +570,6 @@
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetSlaveRaidRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_SLAVE_RAIDED_CITY", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -606,17 +582,14 @@
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(EmbargoRegardEvent)
 {
 	PLAYER_INDEX playerId;
 	PLAYER_INDEX foreignerId;
 
-	
 	if (!args->GetPlayer(0, playerId))
 		return GEV_HD_Continue;
 
-	
 	if (playerId == 0)
 		return GEV_HD_Continue;
 
@@ -628,11 +601,10 @@
 
 	for (foreignerId = 1; foreignerId < CtpAi::s_maxPlayers; foreignerId++)
 	{
-		
+
 		if (foreignerId == playerId)
 			continue;
 
-		
 		if (g_player[foreignerId] == NULL ||
 			g_player[foreignerId]->HasContactWith(playerId) == FALSE)
 			continue;
@@ -640,29 +612,26 @@
 		if (g_player[playerId]->HasContactWith(foreignerId) == FALSE)
 			continue;
 
-		
 		if (Diplomat::GetDiplomat(foreignerId).GetEmbargo(playerId) == false)
 			continue;
 
-		
-		
+
 		sint32 regard_cost = 0;
 		if (diplomat.GetCurrentDiplomacy(foreignerId).GetEmbargoTradeRegardCost(regard_cost))
 		{
 			StringId strId;
 			g_theStringDB->GetStringID("REGARD_EVENT_EMBARGO_TRADE", strId);
-			diplomat.LogRegardEvent(foreignerId, 
-				regard_cost, 
-				REGARD_EVENT_GOLD, 
+			diplomat.LogRegardEvent(foreignerId,
+				regard_cost,
+				REGARD_EVENT_GOLD,
 				strId,
-				1); 
+				1);
 		}
 	}
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(Lawsuit_RegardEvent)
 {
 	Unit unit;
@@ -686,11 +655,10 @@
 	Diplomat & victim_diplomat = Diplomat::GetDiplomat(victim);
 
 	victim_diplomat.SetColdwarAttack(victim, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	victim_diplomat.GetCurrentDiplomacy(attack_owner).GetLawsuitRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_LAWSUIT", strId);
 	victim_diplomat.LogRegardEvent( attack_owner,
@@ -698,17 +666,15 @@
 			REGARD_EVENT_PRODUCTION,
 			strId);
 
-	
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(ExpelUnits_RegardEvent)
 {
 	Army army;
 	MapPoint pos;
-	
+
 	if (!args->GetArmy(0,army))
 		return GEV_HD_Continue;
 
@@ -717,22 +683,20 @@
 
 	PLAYER_INDEX attack_owner = army.GetOwner();
 
-	
 	Cell *cell = g_theWorld->GetCell(pos);
 	if(!cell->UnitArmy())
 		return GEV_HD_Continue;
 
 	PLAYER_INDEX victim = cell->AccessUnit(0)->GetOwner();
-	
+
 	Diplomat & victim_diplomat = Diplomat::GetDiplomat(victim);
 
-	
-	
-	
+
+
+
 	sint32 cost;
 	victim_diplomat.GetCurrentDiplomacy(attack_owner).GetExpelUnitsRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_EXPELLED_UNITS", strId);
 	victim_diplomat.LogRegardEvent( attack_owner,
@@ -740,17 +704,15 @@
 			REGARD_EVENT_MILITARY_POWER,
 			strId);
 
-	
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(NukeCityUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -767,7 +729,6 @@
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetNukeCityRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_NUKED_CITY", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -782,18 +743,16 @@
 		Diplomat::ApplyGlobalTrustChange(attack_owner, trust_cost*2, "Committed the war crime of nuking a city first.");
 	}
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(NukeLocationUnit_RegardEvent)
 {
 	Unit unit;
 	MapPoint pos;
-	
+
 	if(!args->GetUnit(0, unit)) return GEV_HD_Continue;
 	if(!args->GetPos(0, pos)) return GEV_HD_Continue;
 
@@ -809,14 +768,13 @@
 	else
 		pos_owner = g_theWorld->GetOwner(pos);
 
-	
 	if (pos_owner == -1)
 		return GEV_HD_Continue;
 
 	Diplomat & pos_diplomat = Diplomat::GetDiplomat(pos_owner);
 
 	pos_diplomat.SetColdwarAttack(attack_owner, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	pos_diplomat.GetCurrentDiplomacy(attack_owner).GetNukeCityRegardCost(cost);
 
@@ -827,7 +785,6 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	pos_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	sint32 trust_cost = 0;
@@ -840,12 +797,11 @@
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(UndergroundRailwayUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -860,7 +816,6 @@
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetUndergroundRailwayRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_FREED_SLAVES", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -868,18 +823,16 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(InciteUprisingUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -894,7 +847,6 @@
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetInciteUprisingRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_INCITED_UPRISING", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -902,18 +854,16 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(BioInfectCityUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -928,7 +878,6 @@
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetBioInfectedCityRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_BIO_INFECTED_CITY", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -936,18 +885,16 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(PlagueCityUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -960,11 +907,10 @@
 	Diplomat & city_diplomat = Diplomat::GetDiplomat(city_owner);
 
 	city_diplomat.SetColdwarAttack(attack_owner, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetPlagueCityRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_PLAGUED_CITY", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -972,18 +918,16 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(NanoInfectCityUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -996,11 +940,10 @@
 	Diplomat & city_diplomat = Diplomat::GetDiplomat(city_owner);
 
 	city_diplomat.SetColdwarAttack(attack_owner, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetNanoInfectCityRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_NANO_INFECTED_CITY", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -1008,18 +951,16 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(ConvertCityUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -1032,11 +973,10 @@
 	Diplomat & city_diplomat = Diplomat::GetDiplomat(city_owner);
 
 	city_diplomat.SetColdwarAttack(attack_owner, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetConvertCityRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_CONVERTED_CITY", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -1044,22 +984,19 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_MILITARY_PACT);
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_TRADE_PACT);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_ALLIANCE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(IndulgenceSaleMade_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -1072,11 +1009,10 @@
 	Diplomat & city_diplomat = Diplomat::GetDiplomat(city_owner);
 
 	city_diplomat.SetColdwarAttack(attack_owner, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetConvertCityRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_CONVERTED_CITY", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -1084,22 +1020,19 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_MILITARY_PACT);
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_TRADE_PACT);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_ALLIANCE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(CreateParkUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -1116,7 +1049,6 @@
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetCreateParkRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_CREATED_PARK", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -1131,28 +1063,24 @@
 		Diplomat::ApplyGlobalTrustChange(attack_owner, trust_cost*2, "Committed the war crime of nano-attacking a city first.");
 	}
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(PillageUnit_RegardEvent)
 {
 	Unit unit;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
 	PLAYER_INDEX attack_owner = unit.GetOwner();
 	PLAYER_INDEX victim = g_theWorld->GetOwner(unit.RetPos());
 
-	
 	if (victim == -1)
 		return GEV_HD_Continue;
 
-	
 	if (victim == attack_owner)
 		return GEV_HD_Continue;
 
@@ -1161,7 +1089,6 @@
 	sint32 cost;
 	victim_diplomat.GetCurrentDiplomacy(attack_owner).GetPillageRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_PILLAGED", strId);
 	victim_diplomat.LogRegardEvent( attack_owner,
@@ -1169,28 +1096,27 @@
 			REGARD_EVENT_MILITARY_SAFETY,
 			strId);
 
-// EMOD - Hidden Nationality check added by E 19 Nov 2005 - if unit is not Hidden Nationality then Regard Event is Logged 
+// EMOD - Hidden Nationality check added by E 19 Nov 2005 - if unit is not Hidden Nationality then Regard Event is Logged
 	if(!(unit.GetDBRec()->GetSneakPillage() == true)) {
 
-//; || (!(td.GetDBRec()->GetHiddenNationality() == true)); 
+//; || (!(td.GetDBRec()->GetHiddenNationality() == true));
 //original code
 	victim_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_CEASEFIRE);
 //  end original code
 	}
 // end EMOD
 
-	
+
 
 
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(InjoinUnit_RegardEvent)
 {
 	Unit unit;
 	Unit city;
-	
+
 	if (!args->GetUnit(0,unit))
 		return GEV_HD_Continue;
 
@@ -1203,11 +1129,10 @@
 	Diplomat & city_diplomat = Diplomat::GetDiplomat(city_owner);
 
 	city_diplomat.SetColdwarAttack(attack_owner, (sint16) NewTurnCount::GetCurrentRound());
-	
+
 	sint32 cost;
 	city_diplomat.GetCurrentDiplomacy(attack_owner).GetInjoinCityRegardCost(cost);
 
-	
 	StringId strId;
 	g_theStringDB->GetStringID("REGARD_EVENT_ENEMY_INJOINED_CITY", strId);
 	city_diplomat.LogRegardEvent( attack_owner,
@@ -1215,11 +1140,9 @@
 			REGARD_EVENT_PRODUCTION,
 			strId);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_TRADE_PACT);
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_RESEARCH_PACT);
 
-	
 	city_diplomat.LogViolationEvent(attack_owner, PROPOSAL_TREATY_ALLIANCE);
 
 	return GEV_HD_Continue;
@@ -1232,18 +1155,18 @@
 
 
 
-void RegardEventCallbacks::AddCallbacks() 
+void RegardEventCallbacks::AddCallbacks()
 {
-	
-	g_gevManager->AddCallback(GEV_KillUnit, 
-							  GEV_PRI_Pre, 
+
+	g_gevManager->AddCallback(GEV_KillUnit,
+							  GEV_PRI_Pre,
 							  &s_KillUnitRegardEvent);
 
 	g_gevManager->AddCallback(GEV_BorderIncursion,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_BorderIncursionRegardEvent);
 
-	
+
 
 
 
@@ -1268,103 +1191,83 @@
 	g_gevManager->AddCallback(GEV_BeginTurn,
 							  GEV_PRI_Pre,
 							  &s_NeighborHatredRegardEvent);
-	
-	
+
 	g_gevManager->AddCallback(GEV_InciteRevolutionUnit,
 							  GEV_PRI_Pre,
 							  &s_InciteRevolution_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_AssassinateRulerUnit,
 							  GEV_PRI_Pre,
 							  &s_AssassinateRulerUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_MakeFranchise,
 							  GEV_PRI_Pre,
 							  &s_MakeFranchise_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_PlantNukeUnit,
 							  GEV_PRI_Pre,
 							  &s_PlantNukeUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_SlaveRaidCity,
 							  GEV_PRI_Pre,
 							  &s_SlaveRaidCity_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_Lawsuit,
 							  GEV_PRI_Pre,
 							  &s_Lawsuit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_ExpelUnits,
 							  GEV_PRI_Pre,
 							  &s_ExpelUnits_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_NukeCityUnit,
 							  GEV_PRI_Pre,
 							  &s_NukeCityUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_NukeLocationUnit,
 							  GEV_PRI_Pre,
 							  &s_NukeLocationUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_EnslaveSettler,
 							  GEV_PRI_Pre,
 							  &s_EnslaveSettler_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_UndergroundRailwayUnit,
 							  GEV_PRI_Pre,
 							  &s_UndergroundRailwayUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_InciteUprisingUnit,
 							  GEV_PRI_Pre,
 							  &s_InciteUprisingUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_BioInfectCityUnit,
 							  GEV_PRI_Pre,
 							  &s_BioInfectCityUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_PlagueCityUnit,
 							  GEV_PRI_Pre,
 							  &s_PlagueCityUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_NanoInfectCityUnit,
 							  GEV_PRI_Pre,
 							  &s_NanoInfectCityUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_ConvertCityUnit,
 							  GEV_PRI_Pre,
 							  &s_ConvertCityUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_IndulgenceSaleMade,
 							  GEV_PRI_Pre,
 							  &s_IndulgenceSaleMade_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_CreateParkUnit,
 							  GEV_PRI_Pre,
 							  &s_CreateParkUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_PillageUnit,
 							  GEV_PRI_Pre,
 							  &s_PillageUnit_RegardEvent);
 
-	
 	g_gevManager->AddCallback(GEV_InjoinUnit,
 							  GEV_PRI_Pre,
 							  &s_InjoinUnit_RegardEvent);
@@ -1373,4 +1276,3 @@
 							  GEV_PRI_Pre,
 							  &s_EmbargoRegardEvent);
 }
-

Modified: trunk/ctp2_code/ai/diplomacy/sstateevent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/sstateevent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/sstateevent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -25,13 +25,13 @@
 // Modifications from the original Activision code:
 //
 // - Exposed strategies to personalities.txt by Martin Gühmann.
-// - Fixed advice string for BuildupStrength and SeigeCities 
+// - Fixed advice string for BuildupStrength and SeigeCities
 //   strategies by Martin Gühmann.
 // - Added over city limit strategy by Martin Gühmann.
-// - Restored backward compatibility with old personalities.txts 
+// - Restored backward compatibility with old personalities.txts
 //   by Martin Gühmann
 // - Activated consideration of a defined nuclear strike strategy.
-// - added difficulty where AI ignores any citylimit because the flag causes 
+// - added difficulty where AI ignores any citylimit because the flag causes
 //   no unhappiness for ai
 // - Moved code of InitSStateEvent to Diplomat. (13-Jun-2008 Martin Gühmann)
 // - Stopped the AI checking it's city limit if no city limit rule is enabled.
@@ -70,7 +70,7 @@
 //
 // Name       : InitSStateEvent
 //
-// Description: Initializes the default player's strategy 
+// Description: Initializes the default player's strategy
 //
 // Parameters : -
 //
@@ -99,7 +99,7 @@
 //
 // Name       : NextSStateEvent
 //
-// Description: Computes the current player's strategy 
+// Description: Computes the current player's strategy
 //
 // Parameters : -
 //
@@ -129,7 +129,7 @@
 // Name       : FullAttack_NextSStateEvent
 //
 // Description: Checks whether the player should use the full attack startegy
-//              and sets it if necessary. 
+//              and sets it if necessary.
 //
 // Parameters : -
 //
@@ -203,8 +203,8 @@
 //
 // Name       : BuildupStrength_NextSStateEvent
 //
-// Description: Checks whether the player should use the defend startegy 
-//              to build up its strength and sets it if necessary. 
+// Description: Checks whether the player should use the defend startegy
+//              to build up its strength and sets it if necessary.
 //
 // Parameters : -
 //
@@ -310,7 +310,7 @@
 		g_theStringDB->GetStringID(   "SPY_REGROUP_SS", state.spyStrId);
 		g_theStringDB->GetStringID("ADVICE_REGROUP_SS", state.adviceStrId);
 		g_theStringDB->GetStringID(  "NEWS_REGROUP_SS", state.newsStrId);
-		
+
 		diplomat.ConsiderStrategicState(state);
 	}
 
@@ -366,7 +366,7 @@
 			g_theStrategyDB->GetNamedItem("STRATEGY_CAREFUL_START", state.dbIndex);
 		}
 	}
-	
+
 	diplomat.ConsiderStrategicState(state);
 
 	return GEV_HD_Continue;
@@ -376,9 +376,9 @@
 //
 // Name       : NuclearStrike_NextSStateEvent
 //
-// Description: Checks whether the players's personality has a lunch nukes 
+// Description: Checks whether the players's personality has a lunch nukes
 //              strategy and sets it if the player's personalty has such a
-//              startegy. 
+//              startegy.
 //
 // Parameters : -
 //
@@ -413,8 +413,8 @@
 //
 // Name       : NuclearReadiness_NextSStateEvent
 //
-// Description: Determines which nuklear readiness strategy should be used. 
-//              This is dependent on the nuclear threat level. 
+// Description: Determines which nuklear readiness strategy should be used.
+//              This is dependent on the nuclear threat level.
 //
 // Parameters : -
 //
@@ -581,7 +581,7 @@
 //
 // Name       : SetExploration_NextSStateEvent
 //
-// Description: Loads the player's personality's exploration strategy. 
+// Description: Loads the player's personality's exploration strategy.
 //
 // Parameters : -
 //
@@ -873,7 +873,7 @@
 //
 // Name       : CheckCityLimit_NextSStateEvent
 //
-// Description: Loads the over city limit strategy 
+// Description: Loads the over city limit strategy
 //
 // Parameters : -
 //
@@ -885,7 +885,7 @@
 //
 //----------------------------------------------------------------------------
 STDEHANDLER(CheckCityLimit_NextSStateEvent)
-{	
+{
 	if(g_theDifficultyDB->Get(g_theGameSettings->GetDifficulty())->GetAINoCityLimit()
 		|| g_theProfileDB->IsNoCityLimit())
 		return GEV_HD_Continue;
@@ -897,7 +897,7 @@
 	Diplomat & diplomat = Diplomat::GetDiplomat(playerId);
 	AiState state;
 
-	const GovernmentRecord *government = 
+	const GovernmentRecord *government =
 	      g_theGovernmentDB->Get(g_player[playerId]->GetGovernmentType());
 
 	sint32 acceptedCityMaximum = diplomat.GetPersonality()->GetCitiesOverLimit() + government->GetTooManyCitiesThreshold();
@@ -909,7 +909,7 @@
 			state.priority = diplomat.GetPersonality()->GetOverCityLimitStrategyPtr()->GetPriority();
 			state.dbIndex  = diplomat.GetPersonality()->GetOverCityLimitStrategyPtr()->GetStrategyIndex();
 			diplomat.ConsiderStrategicState(state);
-		
+
 			if
 			  (
 			       wonderutil_GetRevoltingCitiesJoinPlayer(g_player[playerId]->m_builtWonders)
@@ -944,7 +944,7 @@
 // Name       : StrategicStateEventCallbacks::AddCallbacks
 //
 // Description: Adds the functions above to the event manager callback,
-//              so that all these functions are executed on the 
+//              so that all these functions are executed on the
 //              InitStrategicState or NextStrategicState event.
 //
 // Parameters : -
@@ -975,13 +975,13 @@
 							  &s_FullAttack_NextSStateEvent);
 
 	g_gevManager->AddCallback(GEV_NextStrategicState,
-							  GEV_PRI_Pre, 
+							  GEV_PRI_Pre,
 							  &s_BuildupStrength_NextSStateEvent);
 
 	g_gevManager->AddCallback(GEV_NextStrategicState,
 							  GEV_PRI_Pre,
 							  &s_SeigeCities_NextSStateEvent);
-	
+
 	g_gevManager->AddCallback(GEV_NextStrategicState,
 							  GEV_PRI_Pre,
 							  &s_NuclearReadiness_NextSStateEvent);

Modified: trunk/ctp2_code/ai/diplomacy/threatresponseevent.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy/threatresponseevent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy/threatresponseevent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,16 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
 #include "c3.h"
 
 #include "ThreatResponseEvent.h"
@@ -28,20 +15,16 @@
 #include "ProposalAnalysis.h"
 #include "UnitPool.h"
 
-
 #include "player.h"
 
-
 STDEHANDLER(DefaultReject_ThreatResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -59,29 +42,24 @@
 		Player *receiver_ptr = g_player[receiver];
 		if (receiver_ptr && receiver_ptr->GetNumCities() <= 2)
 		{
-			
+
 			priority = 500;
 		}
 	}
 
-	
 	receiver_diplomat.ConsiderResponse(sender, RESPONSE_REJECT, priority);
 
-	
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(DestroyCityAccept_ThreatResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -91,12 +69,10 @@
 	const NewProposal & sender_proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 	const Response & sender_response = sender_diplomat.GetMyLastResponse(receiver);
 
-	
 	Assert(sender_response.type == RESPONSE_THREATEN);
 	if (sender_response.threat.type != THREAT_DESTROY_CITY)
 		return GEV_HD_Continue;
 
-	
 	DiplomacyResult sender_result;
 	DiplomacyResult receiver_result;
 	ProposalAnalysis::ComputeResult( sender_proposal,
@@ -106,7 +82,6 @@
 	sint32 value_requested = -1 *
 		(receiver_result.gold + receiver_result.production + receiver_result.science);
 
-	
 	sint32 sender_nukes = MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(sender);
 	sint32 sender_nano  = MapAnalysis::GetMapAnalysis().GetNanoWeaponsCount(sender);
 //	sint32 receiver_nukes = MapAnalysis::GetMapAnalysis().GetNuclearWeaponsCount(receiver);
@@ -129,7 +104,7 @@
 
 		if ((fear_nukes_from || fear_nano_from) && reasonable_demand && !lost_respect)
 		{
-			
+
 			receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, 200);
 			return GEV_HD_Continue;
 		}
@@ -144,28 +119,24 @@
 
 		if (reasonable_demand && !lost_respect)
 		{
-			
+
 			receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, 200);
 			return GEV_HD_Continue;
 		}
-		
+
 	}
 
-	
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(TradeEmbargoAccept_ThreatResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -175,36 +146,33 @@
 	const NewProposal & sender_proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 	const Response & sender_response = sender_diplomat.GetMyLastResponse(receiver);
 
-	
 	Assert(sender_response.type == RESPONSE_THREATEN);
 	if (sender_response.threat.type != THREAT_TRADE_EMBARGO)
 		return GEV_HD_Continue;
 
-	
 	DiplomacyResult sender_result;
 	DiplomacyResult receiver_result;
 	ProposalAnalysis::ComputeResult( sender_proposal,
 									 sender_result,
 									 receiver_result );
 
-	sint32 value_at_stake = 
-		(-1 * receiver_result.gold) + 
-		(-1 * receiver_result.production) + 
+	sint32 value_at_stake =
+		(-1 * receiver_result.gold) +
+		(-1 * receiver_result.production) +
 		(-1 * receiver_result.science);
 
 	sint32 trade_from = receiver_diplomat.GetTradeFrom(sender);
 	sint32 receiver_trade_total =  MapAnalysis::GetMapAnalysis().GetTotalTrade(receiver);
 	bool major_trading_partner = (receiver_trade_total > 0 && ((double) trade_from/receiver_trade_total) > 0.3);
 
-	
-	
+
 	if (receiver_diplomat.GetPersonality()->GetDiscoveryEconomic())
 	{
-		if ((value_at_stake < trade_from/2) && 
-			(value_at_stake > 0) && 
+		if ((value_at_stake < trade_from/2) &&
+			(value_at_stake > 0) &&
 			major_trading_partner)
 		{
-			
+
 			receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, 200);
 			return GEV_HD_Continue;
 		}
@@ -213,17 +181,14 @@
 	return GEV_HD_Continue;
 }
 
-
 STDEHANDLER(DeclareWarAccept_ThreatResponseEvent)
 {
 	PLAYER_INDEX sender;
 	PLAYER_INDEX receiver;
 
-	
 	if (!args->GetPlayer(0, sender))
 		return GEV_HD_Continue;
 
-	
 	if (!args->GetPlayer(1, receiver))
 		return GEV_HD_Continue;
 
@@ -233,12 +198,10 @@
 	const NewProposal & sender_proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 	const Response & sender_response = sender_diplomat.GetMyLastResponse(receiver);
 
-	
 	Assert(sender_response.type == RESPONSE_THREATEN);
 	if (sender_response.threat.type != THREAT_DECLARE_WAR)
 		return GEV_HD_Continue;
 
-	
 	DiplomacyResult sender_result;
 	DiplomacyResult receiver_result;
 	ProposalAnalysis::ComputeResult( sender_proposal,
@@ -247,22 +210,22 @@
 
 	sint32 max_value = MapAnalysis::GetMapAnalysis().GetMaxAlliedValue(receiver);
 
-	sint32 value_at_stake = 
-		(-1 * receiver_result.gold) + 
-		(-1 * receiver_result.production) + 
+	sint32 value_at_stake =
+		(-1 * receiver_result.gold) +
+		(-1 * receiver_result.production) +
 		(-1 * receiver_result.science);
 
 	sint32 turns_at_peace = (AgreementMatrix::s_agreements.TurnsSinceLastWar(sender,receiver));
 	bool peace_time = (turns_at_peace < 0 || turns_at_peace > 5);
 	bool lost_respect = (receiver_diplomat.GetTrust(sender) < HOTWAR_REGARD / 2);
 
-	if (receiver_diplomat.GetPersonality()->GetConquestPassive() && 
+	if (receiver_diplomat.GetPersonality()->GetConquestPassive() &&
 		!receiver_diplomat.DesireWarWith(sender))
 	{
 		bool reasonable_demand = (value_at_stake < max_value * 0.1);
 		if (reasonable_demand && !lost_respect && peace_time)
 		{
-			
+
 			receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, 200);
 			return GEV_HD_Continue;
 		}
@@ -273,7 +236,7 @@
 		bool reasonable_demand = (value_at_stake < max_value * 0.05);
 		if (reasonable_demand && !lost_respect && peace_time)
 		{
-			
+
 			receiver_diplomat.ConsiderResponse(sender, RESPONSE_ACCEPT, 200);
 			return GEV_HD_Continue;
 		}
@@ -283,28 +246,23 @@
 }
 
 
-
 void ThreatResponseEventCallbacks::AddCallbacks()
 {
-	
-	g_gevManager->AddCallback(GEV_Threaten, 
-							  GEV_PRI_Pre, 
+
+	g_gevManager->AddCallback(GEV_Threaten,
+							  GEV_PRI_Pre,
 							  &s_DefaultReject_ThreatResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Threaten, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Threaten,
+							  GEV_PRI_Pre,
 							  &s_DestroyCityAccept_ThreatResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Threaten, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Threaten,
+							  GEV_PRI_Pre,
 							  &s_TradeEmbargoAccept_ThreatResponseEvent);
 
-	
-	g_gevManager->AddCallback(GEV_Threaten, 
-							  GEV_PRI_Pre, 
+	g_gevManager->AddCallback(GEV_Threaten,
+							  GEV_PRI_Pre,
 							  &s_DeclareWarAccept_ThreatResponseEvent);
 
-
 }

Modified: trunk/ctp2_code/ai/diplomacy_test/diptest/diptest.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy_test/diptest/diptest.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy_test/diptest/diptest.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,15 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #include <string>
 #include <vector>
 #include <list>
@@ -17,13 +5,11 @@
 #include <iostream>
 using namespace std;
 
-
 string ID_LOST_BATTLE("ID_LOST_BATTLE");
 string ID_ATTACKED_CIVILIANS("ID_ATTACKED_CIVILIANS");
 string ID_UNPROVOKED_ATTACK("ID_UNPROVOKED_ATTACK");
 string ID_ACCIDENTAL_ATTACK("ID_ACCIDENTAL_ATTACK");
 
-
 string ID_EXPLAIN_TRADE_CITY_FOR_PEACE("ID_EXPLAIN_TRADE_CITY_FOR_PEACE");
 string ID_ADVICE_TRADE_CITY_FOR_PEACE("ID_ADVICE_TRADE_CITY_FOR_PEACE");
 string ID_NEWS_TRADE_CITY_FOR_PEACE("ID_NEWS_TRADE_CITY_FOR_PEACE");
@@ -64,7 +50,6 @@
 string ID_ADVICE_ACCEPT_COUNTER("ID_ADVICE_ACCEPT_COUNTER");
 string ID_NEWS_ACCEPT_COUNTER("ID_NEWS_ACCEPT_COUNTER");
 
-
 string ID_SPY_FULL_ATTACK_SS("ID_SPY_FULL_ATTACK_SS");
 string ID_ADVICE_FULL_ATTACK_SS("ID_ADVICE_FULL_ATTACK_SS");
 string ID_NEWS_FULL_ATTACK_SS("ID_NEWS_FULL_ATTACK_SS");
@@ -72,7 +57,6 @@
 string ID_ADVICE_REGROUP_SS("ID_ADVICE_REGROUP_SS");
 string ID_NEWS_REGROUP_SS("ID_NEWS_REGROUP_SS");
 
-
 string ID_SPY_PROVOKE_WAR_DS("ID_SPY_PROVOKE_WAR_DS");
 string ID_ADVICE_PROVOKE_WAR_DS("ID_ADVICE_PROVOKE_WAR_DS");
 string ID_NEWS_PROVOKE_WAR_DS("ID_NEWS_PROVOKE_WAR_DS");
@@ -84,12 +68,10 @@
 #include "Diplomat.h"
 #include "mapanalysis.h"
 
-
 vector<Player> Player::s_players(g_numPlayers);
 vector<Scheduler> Scheduler::s_scheduler(g_numPlayers);
 vector<AIP> AIP::s_AIP(g_numPlayers);
 
-
 sint32 MapAnalysis::m_atRiskCitiesValue = 10;
 sint32 MapAnalysis::m_cityValue = 11;
 sint32 MapAnalysis::m_militaryPower = 12;
@@ -103,7 +85,6 @@
 	static PLAYER_INDEX humanId = 0;
 	static PLAYER_INDEX robotId = 1;
 
-	
 	Diplomat &robot = Diplomat::GetDiplomat(robotId);
 	robot.SetPlayerId(robotId);
 	AIP::GetAIP(robotId).SetPersonality("Homicidal_Scoundral");
@@ -114,20 +95,18 @@
 	AIP::GetAIP(humanId ).SetPersonality("Homicidal_Scoundral");
 	human.IsAiControlled(false);
 
-	
 	robot.InitStrategicState();
 	robot.InitDiplomaticState(humanId);
 
 	human.InitStrategicState();
 	human.InitDiplomaticState(robotId);
 
-	
 	MapAnalysis::m_atRiskCitiesValue = 20;
 	MapAnalysis::m_militaryPower = 10;
 
 
-	
-	
+
+
 	Diplomat::DebugStatusAll();
 
 	string choice;
@@ -136,7 +115,6 @@
 	PLAYER_INDEX current_player = robotId;
 	while ( choice != "q") {
 
-		
 
 		cout << endl;
 		choice = "";
@@ -144,18 +122,16 @@
 		cout << " command? (next, propose, event, help, quit)";
 		cin >> choice;
 		switch (tolower(choice[0])) {
-		case 'n': 
+		case 'n':
 			current_player = !current_player;
 			Diplomat::GetDiplomat(current_player).BeginTurn();
-		
-			
+
 			Diplomat::DebugStatusAll();
 
 			break;
 		case 'p':
 			Diplomat::GetDiplomat(current_player).BeginTurn();
 
-			
 			Diplomat::DebugStatusAll();
 
 			break;
@@ -165,17 +141,14 @@
 			cout << " has attacked a unit owned by " << (int) !current_player;
 			cout << endl << endl;
 
-			
-			u = Unit(!current_player,1,10); 
-			args.SetUnit(0,u); 
-			args.SetInt(0,static_cast<sint32>(CAUSE_REMOVE_ARMY_ATTACKED)); 
-			args.SetPlayer(0,current_player); 
-			
-			
+			u = Unit(!current_player,1,10);
+			args.SetUnit(0,u);
+			args.SetInt(0,static_cast<sint32>(CAUSE_REMOVE_ARMY_ATTACKED));
+			args.SetPlayer(0,current_player);
+
 			Diplomat::GetDiplomat(!current_player).LogEvent(GEV_KillUnit, &args);
 			Diplomat::GetDiplomat(!current_player).RecomputeRegard();
 
-			
 			Diplomat::DebugStatusAll();
 
 			break;

Modified: trunk/ctp2_code/ai/diplomacy_test/diptest/stdafx.cpp
==============================================================================
--- trunk/ctp2_code/ai/diplomacy_test/diptest/stdafx.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy_test/diptest/stdafx.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,8 +1 @@
-
-
-
-
 #include "stdafx.h"
-
-
-

Modified: trunk/ctp2_code/ai/diplomacy_test/diptest/stdafx.h
==============================================================================
--- trunk/ctp2_code/ai/diplomacy_test/diptest/stdafx.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/diplomacy_test/diptest/stdafx.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,14 +1,9 @@
-
-
-
-
-
 #if !defined(AFX_STDAFX_H__ED8DAD4D_758D_11D3_8029_006097B544EB__INCLUDED_)
 #define AFX_STDAFX_H__ED8DAD4D_758D_11D3_8029_006097B544EB__INCLUDED_
 
 #if _MSC_VER > 1000
 #pragma once
-#endif 
+#endif
 
 
 
@@ -16,4 +11,4 @@
 
 
 
-#endif 
+#endif

Modified: trunk/ctp2_code/ai/mapanalysis/boundingrect.cpp
==============================================================================
--- trunk/ctp2_code/ai/mapanalysis/boundingrect.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/mapanalysis/boundingrect.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -10,19 +10,19 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 //----------------------------------------------------------------------------
 //
 // Modifications from the original Activision code:
 //
 // - Corrected the bounding Rec computation (problem with wraping)
-// 
+//
 //----------------------------------------------------------------------------
 
 #include "c3.h"
@@ -254,7 +254,7 @@
 		m_upperLeft.y = add_rect.m_upperLeft.y;
 	}
 
-	if((m_lr_x_wrap != add_rect.m_lr_x_wrap) || (is_add_rect_lr_xWrapOk && (m_lr_x_wrap == add_rect.m_lr_x_wrap))) 
+	if((m_lr_x_wrap != add_rect.m_lr_x_wrap) || (is_add_rect_lr_xWrapOk && (m_lr_x_wrap == add_rect.m_lr_x_wrap)))
 	{
 		if (add_rect.m_lowerRight.x < m_lowerRight.x)
 		{
@@ -266,7 +266,7 @@
 		m_lowerRight.x = add_rect.m_lowerRight.x;
 	}
 
-	if((m_lr_y_wrap != add_rect.m_lr_y_wrap) || (is_add_rect_lr_yWrapOk && (m_lr_y_wrap == add_rect.m_lr_y_wrap))) 
+	if((m_lr_y_wrap != add_rect.m_lr_y_wrap) || (is_add_rect_lr_yWrapOk && (m_lr_y_wrap == add_rect.m_lr_y_wrap)))
 	{
 		if(add_rect.m_lowerRight.y < m_lowerRight.y)
 		{
@@ -361,7 +361,6 @@
 	if(pos.y >= m_mapSize.y) pos.y -= m_mapSize.y;
 }
 
-
 bool BoundingRect::Get(const sint32 & index, MapPoint & pos, const sint32 & max_rows, const sint32 & max_columns) const
 {
 	pos.y = (sint16)(index / max_columns);

Modified: trunk/ctp2_code/ai/mapanalysis/boundingrect.h
==============================================================================
--- trunk/ctp2_code/ai/mapanalysis/boundingrect.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/mapanalysis/boundingrect.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,25 +1,3 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 #ifdef HAVE_PRAGMA_ONCE
 #pragma once
 #endif
@@ -67,52 +45,40 @@
 			return *this;
 		}
 
-	
-	BoundingRect(const MapPoint & center, 
-				 const sint16 radius, 
+	BoundingRect(const MapPoint & center,
+				 const sint16 radius,
 				 const MapPoint & map_size,
-				 const bool & x_wrap_ok, 
+				 const bool & x_wrap_ok,
 				 const bool & y_wrap_ok)
 		{
 			Initialize(center, radius, map_size, x_wrap_ok, y_wrap_ok);
 		}
 
-	
 	bool IsValid() const { return m_isValid; }
 
-	
-	void Initialize(const MapPoint & center, 
+	void Initialize(const MapPoint & center,
 					const sint16 radius,
 					const MapPoint & map_size,
 					const bool & x_wrap_ok,
 					const bool & y_wrap_ok);
 
-	
 	bool Normalize();
 
-	
 	bool Add(const BoundingRect & rect);
 
-	
-	
+
 	bool Get(const sint32 & index, MapPoint & pos, const sint32 & max_rows, const sint32 & max_columns) const;
 
-	
 	const MapPoint & Get(const sint32 & index) const;
 
-	
 	bool Expand(const sint16 & size);
 
-	
 	bool IsMaxRect() const;
 
-	
 	MapPoint GetCenter() const;
 
-	
 	bool WithinRectangle(const MapPoint & pos) const;
 
-	
 	void Get(sint16 row, sint16 col, MapPoint & pos);
 	sint16 GetMaxCols();
 	sint16 GetMaxRows();
@@ -120,17 +86,14 @@
 private:
 	bool m_isValid;
 
-	
 	MapPoint m_upperLeft;
 	MapPoint m_lowerRight;
 
-	
 	bool m_xWrapOk;
 	bool m_yWrapOk;
 	MapPoint m_mapSize;
 
-	
-	
+
 	bool m_ul_x_wrap;
 	bool m_lr_x_wrap;
 	bool m_ul_y_wrap;
@@ -138,5 +101,3 @@
 };
 
 #endif // __BOUNDING_RECT_H
-
-

Modified: trunk/ctp2_code/ai/mapanalysis/mapanalysis.cpp
==============================================================================
--- trunk/ctp2_code/ai/mapanalysis/mapanalysis.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/mapanalysis/mapanalysis.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -60,16 +60,13 @@
 #include <vector>
 #include <limits>
 
-
 MapGrid < sint32 >::MapGridArray MapGrid < sint32 >::s_scratch;
 
-
 MapAnalysis MapAnalysis::s_mapAnalysis;
 
-
 MapAnalysis & MapAnalysis::GetMapAnalysis()
 {
-	return s_mapAnalysis; 
+	return s_mapAnalysis;
 }
 
 void MapAnalysis::Resize
@@ -135,7 +132,6 @@
     m_movementTypeUnion.resize(maxPlayerId);
 }
 
-
 void MapAnalysis::ResizeContinents()
 {
     sint32 maxLandCont = g_theWorld->GetMaxLandContinent() -
@@ -145,7 +141,6 @@
     m_armyOnContinent.Resize(maxPlayerId, maxLandCont, FALSE);
 }
 
-
 void MapAnalysis::AddPiracyIncome(const PLAYER_INDEX playerId,
 const PLAYER_INDEX victimId,
 const sint16 route_value)
@@ -304,7 +299,6 @@
 			m_bioWeapons[player]     += army->CountBioUnits();
 			m_nanoWeapons[player]    += army->CountNanoUnits();
 
-
 			if(m_empireCenter[player] == MapPoint())
 			{
 				CalcEmpireCenter(player);
@@ -338,7 +332,6 @@
 				}
 			}
 
-
             m_movementTypeUnion[player] |= army.GetMovementType();
 
             Assert(m_threatGrid      [player].GetTotalValue()  >= 0);
@@ -359,7 +352,6 @@
             Assert(m_totalTrade      [player]                  >= 0);
         }
 
-
         sint32 num_cities = player_ptr->m_all_cities->Num();
         for (i = 0; i < num_cities; i++)
         {
@@ -368,10 +360,8 @@
             city.GetPos(pos);
             sint32 total_value = city->GetCityData()->GetValue();
 
-
             m_totalTrade[player] += city->GetCityData()->GetGoldFromTradeRoutes();
 
-
             m_valueGrid[player].AddValue(pos, total_value);
 
             TradeDynamicArray * trade_routes = city.CD()->GetTradeSourceList();
@@ -393,7 +383,6 @@
                     AddValue(pirate_army->RetPos(), route_value);
                 }
 
-
                 const DynamicArray < MapPoint > * path = trade_routes->Get(j)->GetPath();
                 sint32 per_cell_value =
                             (sint32)(((double)route_value / path->Num()) * 1000.0);
@@ -411,7 +400,6 @@
             {
                 m_cityOnContinent.Set(player, cont, TRUE);
 
-
                 m_continentSize[player] += g_theWorld->GetLandContinentSize(cont) / num_cities;
             }
 
@@ -761,7 +749,6 @@
 	        m_empireCenter[playerId].y));
 }
 
-
 void MapAnalysis::UpdateBoundingRectangle(const Army & army)
 {
     const PLAYER_INDEX player = army.GetOwner();
@@ -816,7 +803,7 @@
     if ((xy_radius % 2) != 0)
         xy_radius++;
 
-    BoundingRect cityRect(xy_center, xy_radius, xy_map_size, 
+    BoundingRect cityRect(xy_center, xy_radius, xy_map_size,
 						  g_theWorld->IsXwrap(), g_theWorld->IsYwrap()
 						 );
 
@@ -880,7 +867,6 @@
     MapPoint pos;
     city.GetPos(pos);
 
-
     sint32  player_threat   = m_threatGrid[playerId].GetGridValue(pos);
     sint32  opponent_threat = (PLAYER_UNASSIGNED == opponentId) // In that case no opponent there, so it is the right way to calculate it?
                               ? GetThreat(playerId, pos)
@@ -899,7 +885,7 @@
 	{
 		ratio  = 0.0;
 	}
-	else 
+	else
 	{
 		ratio = 1.0;
 	}
@@ -966,7 +952,7 @@
     {
         Unit city = player_ptr->m_all_cities->Access(i);
         Assert(city.IsValid());
-		
+
         if (i < opponent_nukes && !city.GetCityData()->SafeFromNukes())
 		{
 			ratio = 1.0;
@@ -983,7 +969,7 @@
 
         return (sint32)(((double)at_risk_value / m_valueGrid[playerId].GetTotalValue()) * 100.0);
     else
-		
+
         return 100;
 }
 
@@ -1066,13 +1052,13 @@
 
 sint16 MapAnalysis::GetTotalPopulation(const PLAYER_INDEX playerId) const
 {
-    return (playerId == PLAYER_UNASSIGNED) ? m_worldPopulation 
+    return (playerId == PLAYER_UNASSIGNED) ? m_worldPopulation
                                            : m_totalPopulation[playerId];
 }
 
 sint16 MapAnalysis::GetLandArea(const PLAYER_INDEX playerId) const
 {
-	return m_landArea[playerId];	
+	return m_landArea[playerId];
 }
 
 double MapAnalysis::GetPopulationPercent(const PLAYER_INDEX playerId) const
@@ -1097,10 +1083,10 @@
     leaderId = playerId;
     sint32 max_population = m_totalPopulation[playerId];
     sint32 allies = 0;
-    for 
+    for
     (
-        PLAYER_INDEX foreignerId = 0; 
-        static_cast<size_t>(foreignerId) < m_threatGrid.size(); 
+        PLAYER_INDEX foreignerId = 0;
+        static_cast<size_t>(foreignerId) < m_threatGrid.size();
         ++foreignerId
     )
     {
@@ -1114,7 +1100,6 @@
             alliance_land += m_landArea[foreignerId];
             allies++;
 
-
             if(!g_player[foreignerId]->IsRobot()
             &&  m_totalPopulation[foreignerId] > max_population
             ){

Modified: trunk/ctp2_code/ai/mapanalysis/mapanalysis.h
==============================================================================
--- trunk/ctp2_code/ai/mapanalysis/mapanalysis.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/mapanalysis/mapanalysis.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -40,7 +40,6 @@
 
 class MapAnalysis;
 
-
 #include "mapgrid.h"
 #include "citydata.h"
 #include "boundingrect.h"
@@ -59,20 +58,18 @@
     typedef std::vector<uint32> Uint32Vector;
     typedef std::vector<MapPoint> MapPointVector;
     typedef std::vector<double> DoubleVector;
-	
+
 	static MapAnalysis & GetMapAnalysis();
 
 	~MapAnalysis();
-	
+
 	void Resize( const PLAYER_INDEX & maxPlayerId,
-				 const sint16 & xSize, 
-				 const sint16 & ySize, 
+				 const sint16 & xSize,
+				 const sint16 & ySize,
 				 const sint16 & resolution );
 
-	
 	void ResizeContinents();
 
-	
 	void BeginTurn();
 	void RecalcCityRanks(sint32 player);
 
@@ -154,19 +151,14 @@
 	double GetThreatRank    (const CityData *city) const;
 	double GetPowerRank     (const CityData *city) const;
 
-	
 	void UpdateBoundingRectangle(const Army & army);
 
-	
 	void UpdateBoundingRectangle(const Unit & city);
 
-	
 	const BoundingRect & GetBoundingRectangle(const PLAYER_INDEX & player) const;
 
-	
 	const MapPoint & GetEmpireCenter(const PLAYER_INDEX player) const;
 
-	
 	const MapPoint & GetNearestForeigner(const PLAYER_INDEX player, const MapPoint & pos) const;
 
 	sint32 TotalThreat(const PLAYER_INDEX & playerId) const {
@@ -177,129 +169,101 @@
 		return static_cast<sint32>(m_valueGrid[playerId].GetTotalValue());
 	}
 
-	
 	sint32 GetTotalTrade(const PLAYER_INDEX & playerId) const
 	{
-		
+
 		if (m_totalTrade.size() <= 0)
 			return 0;
 		return m_totalTrade[playerId];
 	}
 
-	
 	sint32 GetProjectedScience(const PLAYER_INDEX & playerId) const
 	{
 		return m_projectedScience[playerId];
 	}
 
-	
 	sint32 GetTradeAtRisk(const PLAYER_INDEX & playerId, const MapPoint & pos ) const {
-		
+
 		return static_cast<sint32>(m_tradeAtRiskGrid[playerId].GetGridValue(pos) / 1000);
 	}
 
-	
 	sint32 TotalTradeAtRisk(const PLAYER_INDEX & playerId) const {
-		
+
 		return static_cast<sint32>(m_tradeAtRiskGrid[playerId].GetTotalValue() / 1000);
 	}
 
-	
 	sint32 GetMaxTradeAtRisk(const PLAYER_INDEX & player) const {
-		
+
 		return static_cast<sint32>(m_tradeAtRiskGrid[player].GetMaxGridValue() / 1000);
 	}
 
-	
 	sint32 GetPiracyLoss(const PLAYER_INDEX & playerId, const MapPoint & pos ) const {
 		return static_cast<sint32>(m_piracyLossGrid[playerId].GetGridValue(pos));
 	}
 
-	
 	sint32 TotalPiracyLoss(const PLAYER_INDEX & playerId) const {
 		return static_cast<sint32>(m_piracyLossGrid[playerId].GetTotalValue());
 	}
 
-	
 	sint32 GetMaxPiracyLoss(const PLAYER_INDEX & player) const {
 		return static_cast<sint32>(m_piracyLossGrid[player].GetMaxGridValue());
 	}
 
-	
 	double CityAtRiskRatio(const Unit city, const PLAYER_INDEX opponentId) const;
 
-	
-	sint32 MostAtRiskCity(const PLAYER_INDEX & playerId, 
+	sint32 MostAtRiskCity(const PLAYER_INDEX & playerId,
 						  Unit & city,
 						  const PLAYER_INDEX & opponentId) const;
 
-	
 	sint32 AtRiskCitiesValue(const PLAYER_INDEX & playerId,
 							 const PLAYER_INDEX & opponentId = -1) const;
 
-	
 	sint32 GetPiracyIncomeByPlayer(const PLAYER_INDEX playerId,
 				 			       const PLAYER_INDEX victimId) const;
 
-	
 	bool ShareContinent(const PLAYER_INDEX playerId,
 						const PLAYER_INDEX foreignerId) const;
 
-	
 	bool PlayerCanEnter(const PLAYER_INDEX playerId,
 					    const MapPoint & pos ) const;
 
-	
 	sint16 GetNuclearWeaponsCount(const PLAYER_INDEX playerId) const;
 	sint16 GetNanoWeaponsCount(const PLAYER_INDEX playerId) const;
 	sint16 GetBioWeaponsCount(const PLAYER_INDEX playerId) const;
 
-	
 	void SetNuclearWeaponsCount(const PLAYER_INDEX playerId, const sint32 value);
 	void SetBioWeaponsCount(const PLAYER_INDEX playerId, const sint32 value);
 	void SetNanoWeaponsCount(const PLAYER_INDEX playerId, const sint32 value);
 
-	
 	sint16 GetSpecialAttackers(const PLAYER_INDEX playerId) const;
 
-	
 	sint32 AverageSettledContinentSize(const PLAYER_INDEX playerId) const;
 
-	
 	sint16 GetTotalPopulation(const PLAYER_INDEX playerId = -1) const;
 
-	
 	sint16 GetLandArea(const PLAYER_INDEX playerId = -1) const;
 
-	
 	double GetPopulationPercent(const PLAYER_INDEX playerId) const;
 
-	
 	double GetLandPercent(const PLAYER_INDEX playerId) const;
 
-	
 	void ComputeAllianceSize(const PLAYER_INDEX playerId, PLAYER_INDEX & leaderId, double & population, double & land) const;
 
-	
 	double GetProductionHandicapRatio(const PLAYER_INDEX playerId) const;
 
-	
 	double GetGoldHandicapRatio(const PLAYER_INDEX playerId) const;
 
-	
 	double GetScienceHandicapRatio(const PLAYER_INDEX playerId) const;
 
-
 	void Cleanup();
 
-
 	void CalcEmpireCenter(const PLAYER_INDEX playerId);
 
 private:
 	static MapAnalysis s_mapAnalysis;
 
-	void AddPiracyIncome( const PLAYER_INDEX playerId, 
-						  const PLAYER_INDEX victimId, 
+	void AddPiracyIncome( const PLAYER_INDEX playerId,
+						  const PLAYER_INDEX victimId,
 						  const sint16 route_value );
 
 	void ComputeHandicapRatios();
@@ -317,16 +281,12 @@
 
 	Sint32Vector m_totalTrade;
 
-	
 	Sint32Vector m_projectedScience;
 
-	
 	MapGridVector m_tradeAtRiskGrid;
 
-	
 	MapGridVector m_piracyLossGrid;
 
-	
 	Sint16Vector m_piracyIncomeMatrix;
 
 	sint32 m_minCityProduction;

Modified: trunk/ctp2_code/ai/mapanalysis/mapgrid.h
==============================================================================
--- trunk/ctp2_code/ai/mapanalysis/mapgrid.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/mapanalysis/mapgrid.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -39,48 +39,42 @@
 
 #include "c3debugstl.h"
 
-
 #include "MapPoint.h"
 
-
 #define RELAX_SHARED_SIDE (1.0)
-#define RELAX_DIAGONAL (0.41)   
+#define RELAX_DIAGONAL (0.41)
 
 template<class _Ty>
 class MapGrid {
 public:
-	
+
 	typedef std::valarray< _Ty > MapGridArray;
-	
-	
+
 	MapGrid()
 	{
 		m_xSize = 0;
 		m_ySize = 0;
 		m_resolution = 0;
-		
-		
+
 		Clear();
 	}
 
 	~MapGrid()
 	{
 		s_scratch.resize(0);
-		
-		
+
 		m_values.free();
 	}
-	
-	
+
 	void Resize(const sint32 & xSize,
 		const sint32 & ySize,
 		const sint32 & resolution)
 	{
-		
+
 		m_xSize = xSize;
 		m_ySize = ySize;
 		m_resolution = resolution;
-		
+
 		m_xGridSize = (xSize / resolution)*2;
 		m_yGridSize = (ySize / resolution);
 
@@ -92,8 +86,7 @@
 
 		m_values.resize( m_xGridSize * m_yGridSize );
 	}
-	
-	
+
 	void Clear()
 	{
 		m_values = 0;
@@ -116,82 +109,77 @@
 	{
 		MapPoint xy_pos;
 		xy_pos.rc2xy(rc_pos, MapPoint(m_xSize, m_ySize));
-		
-		int const elem = ( (xy_pos.y / m_resolution) * m_xGridSize) + 
+
+		int const elem = ( (xy_pos.y / m_resolution) * m_xGridSize) +
 			     (xy_pos.x / m_resolution);
 
 		Assert(elem >= 0);
 		Assert(static_cast<size_t>(elem) < m_values.size());
-		
-		
+
 		Assert(((double) m_values[elem] + value) == (double) (m_values[elem] + value));
 		m_values[elem] += value;
-		
+
 		Assert(((double) m_totalValue + value) == (double) (m_totalValue + value));
 		m_totalValue += value;
 
 		Assert(m_valuesCount >= 0);
 		m_valuesCount++;
-		
-		
+
 		if (value < m_minValue)
 			m_minValue = value;
 		if (value > m_maxValue)
 			m_maxValue = value;
-		
-		
+
 		if (m_values[elem] > m_maxGridValue)
 			m_maxGridValue = m_values[elem];
 		if (m_values[elem] < m_minGridValue)
 			m_minGridValue = m_values[elem];
 	}
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
+
+
+
+
+
+
+
+
+
+
+
+
 	void Relax(sint32 cycles, const float coefficient)
 	{
-		
+
 		if (cycles <= 0) return;
 
 		MapGridArray *map_from_ptr = &m_values;
 		MapGridArray *map_to_ptr = &s_scratch;
-		
+
 		s_scratch.resize(m_xGridSize*m_yGridSize);
 
 		while(cycles-- > 0)
 		{
-			
+
 			_Ty *pCurFrom = &((*map_from_ptr)[0]);
 			_Ty *pCurTo = &((*map_to_ptr)[0]);
 
-			
-			
+
 			sint32 up = (m_yGridSize-1)*m_xGridSize;
 			sint32 down = m_xGridSize;
 			for (sint32 y=0;y<m_yGridSize;++y) {
-				
+
 				if (y==m_yGridSize-1) down = -(m_yGridSize-1)*m_xGridSize;
-	
-				
+
 				sint32 left = m_xGridSize-1;
 				sint32 right = 1;
 				for (sint32 x=0;x<m_xGridSize;++x) {
-					
+
 					if (x==m_xGridSize-1) right =  -(m_xGridSize-1);
 
-					
-					
-					
-					
+
+
+
+
 					_Ty *pCur = pCurFrom + up + left;
 					_Ty max_value = *pCur;
 
@@ -203,7 +191,6 @@
 					cur_value = *pCur;
 					if (cur_value>max_value) max_value = cur_value;
 
-					
 					pCur = pCurFrom+left;
 					cur_value = *pCur;
 					if (cur_value>max_value) max_value = cur_value;
@@ -213,62 +200,54 @@
 					cur_value = *pCur;
 					if (cur_value>max_value) max_value = cur_value;
 
-					
 					pCur = pCurFrom + down + left;
 					cur_value = *pCur;
 					if (cur_value>max_value) max_value = cur_value;
 
 					pCur -= left;
-					cur_value = *pCur;					
+					cur_value = *pCur;
 					if (cur_value>max_value) max_value = cur_value;
 
 					pCur += right;
 					cur_value = *pCur;
 					if (cur_value>max_value) max_value = cur_value;
 
-					
-					
+
 					max_value = static_cast<_Ty>
-						(static_cast<double>(max_value) * 
-						 RELAX_DIAGONAL * 
+						(static_cast<double>(max_value) *
+						 RELAX_DIAGONAL *
 						 coefficient
 						);
-					
+
      				cur_value = *pCurFrom;
 					if (max_value > cur_value) cur_value = max_value;
 
-					
 					*pCurTo = cur_value;
-	
-					
+
 					left = -1;
-					
+
 					++pCurFrom;
 					++pCurTo;
 				}
 
-				
 				up = -m_xGridSize;
-			} 
-			
-			
+			}
+
 			MapGridArray *map_tmp_ptr;
 			map_tmp_ptr = map_from_ptr;
 			map_from_ptr = map_to_ptr;
 			map_to_ptr = map_tmp_ptr;
-		} 
-		
-		
-		
-		
+		}
+
+
+
+
 		if (map_from_ptr != &m_values)
 			m_values = *map_from_ptr;
 	}
 
-
 #if 0
-	
-	
+
 	void Relax(const sint8 & cycles, const float & coefficient)
 	{
 		sint32 elem;
@@ -277,78 +256,70 @@
 		bool rdiag;
 		bool cdiag;
 		sint8 delta_r, delta_c;
-		
-		
+
 		if (cycles <= 0)
 			return;
-		
+
 		MapGridArray *map_tmp_ptr;
 		MapGridArray *map_from_ptr = &m_values;
 		MapGridArray *map_to_ptr = &s_scratch;
-		
-		
+
 		*map_to_ptr = *map_from_ptr;
-		
+
 		for (sint8 cycle = 0; cycle < cycles; cycle++)
 		{
 			for (elem = 0; elem < m_values.size(); elem++)
 			{
-				
+
 				new_value = (*map_from_ptr)[elem];
-				
-				
+
 				for (delta_r = -1; delta_r <= 1; delta_r++)
 				{
 					for (delta_c = -1; delta_c <= 1; delta_c++)
 					{
-						
+
 						rdiag = (delta_r != 0);
 						cdiag = (delta_c != 0);
-						
-						
+
 						if ( !rdiag && !cdiag )
 							continue;
-						
-						
-						adj_value = GetRelaxValue( elem, 
-							delta_r, 
-							delta_c, 
+
+						adj_value = GetRelaxValue( elem,
+							delta_r,
+							delta_c,
 							*map_from_ptr);
 
-						
-						
+
 						adj_value *= coefficient;
-						
-						
-						
+
+
 						new_value = (new_value > adj_value ? new_value : adj_value);
-					} 
-				} 
-				
-				
+					}
+				}
+
 				(*map_to_ptr)[elem] = new_value;
-			} 
-			
+			}
+
 			map_tmp_ptr = map_from_ptr;
 			map_from_ptr = map_to_ptr;
 			map_to_ptr = map_tmp_ptr;
-		} 
-		
-		
-		
-		
+		}
+
+
+
+
 		if (map_from_ptr != &m_values)
 			m_values = *map_from_ptr;
 
 	}
 #endif
 
-	
-	
-	
+
+
+
 	_Ty GetGridValueXY(const MapPoint &xy_pos) const
 	{
-		int const elem = 
+		int const elem =
 			(1 == m_resolution)
 			? (xy_pos.y * m_xGridSize) + xy_pos.x
 			: ((xy_pos.y / m_resolution) * m_xGridSize) + (xy_pos.x / m_resolution);
@@ -358,14 +329,13 @@
 		return m_values[elem];
 	}
 
-	
-	
+
 	_Ty GetGridValue(const MapPoint &rc_pos) const
 	{
 		MapPoint xy_pos;
 		xy_pos.rc2xy(rc_pos, MapPoint(m_xSize, m_ySize));
-		
-		int const elem = ((xy_pos.y / m_resolution) * m_xGridSize) + 
+
+		int const elem = ((xy_pos.y / m_resolution) * m_xGridSize) +
 			    (xy_pos.x / m_resolution);
 		Assert(elem >= 0);
 		Assert(static_cast<size_t>(elem) < m_values.size());
@@ -373,13 +343,12 @@
 		return m_values[elem];
 	}
 
-	
 	void SetGridValue(const MapPoint &rc_pos, const _Ty value)
 	{
 		MapPoint xy_pos;
 		xy_pos.rc2xy(rc_pos, MapPoint(m_xSize, m_ySize));
 
-		int const elem = ((xy_pos.y / m_resolution) * m_xGridSize) + 
+		int const elem = ((xy_pos.y / m_resolution) * m_xGridSize) +
 						 (xy_pos.x / m_resolution);
 		Assert(elem >= 0);
 		Assert(static_cast<size_t>(elem) < m_values.size());
@@ -388,136 +357,113 @@
 	}
 
 
-	
 	_Ty GetGridValueFromXY(const MapPoint &xy_pos) const
 	{
-		int const elem = ((xy_pos.y / m_resolution) * m_xGridSize) + 
+		int const elem = ((xy_pos.y / m_resolution) * m_xGridSize) +
 						 (xy_pos.x / m_resolution);
 		Assert(elem >= 0);
 		Assert(static_cast<size_t>(elem) < m_values.size());
 
 		return m_values[elem];
 	}
-	
-	
+
 	_Ty GetMaxGridValue() const { return m_maxGridValue; }
-	
-	
+
 	_Ty GetMinGridValue() const { return m_minGridValue; }
-	
-	
+
 	_Ty GetMaxValue() const { return m_maxValue; }
-	
-	
+
 	_Ty GetMinValue() const { return m_minValue; }
-	
-	
+
 	sint32 GetValuesCount() const { return m_valuesCount; }
-	
-	
+
 	double GetTotalValue() const { return m_totalValue; }
 
-	
 	std::string GetDebugString() const
 	{
 		std::ostringstream ost;
-		
+
 		for (size_t elem = 0; elem < m_values.size(); ++elem)
 		{
 			ost.width( 8);
 			ost << m_values[elem];
 			ost << " ";
-			
+
 			if ( ((elem+1) % m_xGridSize) == 0)
 				ost << "\n";
 		}
-		
+
 		ost << "\n";
 		return ost.str();
 	}
-	
+
 private:
-	
+
 #if 0
-	
-	
-	
-	
-	_Ty GetRelaxValue( const sint32 & src_elem, 
-		const sint8 & delta_x, 
-		const sint8 & delta_y, 
+
+
+
+
+	_Ty GetRelaxValue( const sint32 & src_elem,
+		const sint8 & delta_x,
+		const sint8 & delta_y,
 		const MapGridArray & map_from ) const
 	{
-		
-		
-		
-		
-		
-		
+
+
+
+
+
+
 		bool diagonal = (delta_x != 0 || delta_y != 0);
-		
+
 		sint32 y = (sint32) (src_elem / m_xGridSize);
 		sint32 x = (src_elem - ( y * m_xGridSize));
-		
-		
+
 		x += delta_x;
 		y += delta_y;
-		
-		
-		
-		
+
+
+
+
 		if (y < 0) y = m_yGridSize - 1;
 		if (x < 0) x = m_xGridSize - 1;
 		if (y >= m_yGridSize) y = 0;
 		if (x >= m_xGridSize) x = 0;
-		
+
 		Assert( (y * m_xGridSize) + x < map_from.size() );
 
-		
 		if (diagonal)
 			return map_from[ (y * m_xGridSize) + x ] * RELAX_DIAGONAL;
 		else
 			return map_from[ (y * m_xGridSize) + x ] * RELAX_SHARED_SIDE;
 	}
 #endif
-	
-	
+
 	sint32 m_xSize;
-	
-	
+
 	sint32 m_ySize;
-	
-	
+
 	sint32 m_xGridSize;
 
-	
 	sint32 m_yGridSize;
 
-	
 	sint32 m_resolution;
-	
-	
+
 	static MapGridArray s_scratch;
-	
-	
+
 	MapGridArray m_values;
-	
-	
+
 	_Ty m_maxGridValue;
-	
-	
+
 	_Ty m_minGridValue;
-	
-	
+
 	_Ty m_maxValue;
-	
-	
+
 	_Ty m_minValue;
-	
-	
+
 	sint32 m_valuesCount;
-	
-	
+
 	double m_totalValue;
 };
 

Modified: trunk/ctp2_code/ai/mapanalysis/settlemap.cpp
==============================================================================
--- trunk/ctp2_code/ai/mapanalysis/settlemap.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/mapanalysis/settlemap.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -33,13 +33,12 @@
 //   question. (May 20th 2006 Martin Gühmann)
 // - Corrected delete operator for array.
 // - Improved settle radius determination on city growth.
-// 
+//
 //----------------------------------------------------------------------------
 
 #include "c3.h"
 #include "settlemap.h"
 
-
 #include "boundingrect.h"
 #include "Cell.h"
 #include "citydata.h"
@@ -51,7 +50,7 @@
 #include "StrategyRecord.h"
 #include "TerrainRecord.h"
 #include "UnitRecord.h"
-#include <utility> 
+#include <utility>
 #include <vector>
 #include "World.h"		            // g_theWorld
 
@@ -62,10 +61,8 @@
 
 SettleMap SettleMap::s_settleMap;
 
-
 MapGrid<double>::MapGridArray MapGrid<double>::s_scratch;
 
-
 SettleMap::SettleMap()
 :
     m_settleValues	(),
@@ -77,7 +74,7 @@
 //
 // Name       : SettleMap::ComputeSettleValue
 //
-// Description: Calculates a settling score for the given position, which is 
+// Description: Calculates a settling score for the given position, which is
 //              independent of unit abilities to settle at a certain location.
 //              The settle score is the sum of scores of tiles in a radius of
 //              two tiles around the given position.
@@ -97,7 +94,7 @@
 	sint32 score = 0;
 	RadiusIterator it(pos, k_minimum_settle_city_size);
 
-	for (it.Start(); !it.End(); it.Next()) 
+	for (it.Start(); !it.End(); it.Next())
 	{
 		const Cell * cell = g_theWorld->GetCell(it.Pos());
 		if (!cell->GetCityOwner())
@@ -118,7 +115,6 @@
     m_invalidCells.Resize(0, 0, false);
 }
 
-
 void SettleMap::Initialize()
 {
 	size_t const    x_size  = g_theWorld->GetWidth();
@@ -127,7 +123,7 @@
 	MapPoint xy_pos;
 
 	m_settleValues.Clear();
-	m_settleValues.Resize(x_size, y_size, 1); 
+	m_settleValues.Resize(x_size, y_size, 1);
 	m_invalidCells.Resize(x_size, y_size, 0);
 
 	for (rc_pos.x = 0; static_cast<size_t>(rc_pos.x) < x_size; rc_pos.x++)
@@ -145,11 +141,11 @@
 				   ( (xy_pos.y >= k_minimum_settle_city_size) &&
 				     (xy_pos.y + k_minimum_settle_city_size <= y_size)
                    )
-                 ) 
+                 )
                  &&
                  (  g_theWorld->IsXwrap() ||
 					( (xy_pos.x >= k_minimum_settle_city_size) &&
-					  (xy_pos.x + k_minimum_settle_city_size <= (x_size * 2)) 
+					  (xy_pos.x + k_minimum_settle_city_size <= (x_size * 2))
                     )
                  )
                )
@@ -177,16 +173,15 @@
 	/// This does not account for future growth (city spacing may become too tight), but it also
 	/// prevents any overlap.
 	radius += radius + 1;
-	
+
 	// Mark tiles near to the grown city as not worth to settle at all
 	RadiusIterator it(cityPos, radius);
-	for (it.Start(); !it.End(); it.Next()) 
+	for (it.Start(); !it.End(); it.Next())
 	{
 		MapPoint    clearPos = it.Pos();
 		m_invalidCells.Set(clearPos.x, clearPos.y, TRUE);
 	}
 
-	
 	const StrategyRecord & strategy = Diplomat::GetDiplomat(playerId).GetCurrentStrategy();
 	sint32                  min_settle_distance = 0;
 	strategy.GetMinSettleDistance(min_settle_distance);
@@ -194,13 +189,13 @@
 	// Mark tiles further away as having only half the usual value
 	/// \todo Optimise using CircleIterator, to skip computing values for the already invalidated tiles.
 	RadiusIterator settleIt(cityPos, min_settle_distance);
-	for (settleIt.Start(); !settleIt.End(); settleIt.Next()) 
+	for (settleIt.Start(); !settleIt.End(); settleIt.Next())
 	{
 		MapPoint        claimPos    = settleIt.Pos();
 		double const    new_value   = ComputeSettleValue(claimPos) * 0.5;
 		m_settleValues.SetGridValue(claimPos, new_value);
 	}
-	
+
 	MapAnalysis::GetMapAnalysis().UpdateBoundingRectangle(city);
 }
 
@@ -289,7 +284,7 @@
 	{
 		unit = player_ptr->m_all_units->Access(i);
 		const UnitRecord* rec = player_ptr->m_all_units->Access(i).GetDBRec();
-		
+
 		Assert(rec);
 		if(!rec) continue;
 
@@ -341,7 +336,6 @@
 			g_graphicsOptions->AddTextToCell(rc_pos, buf, 255);
 		}
 
-
 		if(!CanSettlePos(rc_pos))
 			continue;
 
@@ -379,22 +373,18 @@
 
 	targets.sort(std::greater<SettleTarget>());
 
-	
 	sint16 max_water_cont = g_theWorld->GetMaxWaterContinent() - g_theWorld->GetMinWaterContinent();
 	sint16 max_land_cont  = g_theWorld->GetMaxLandContinent () - g_theWorld->GetMinLandContinent ();
 
-	
 	std::vector<sint16> water_continent_count(max_water_cont, 0);
 	std::vector<sint16>  land_continent_count(max_land_cont,  0);
 	bool   is_land;
 	sint16 cont;
 
-	
 	const StrategyRecord & strategy = Diplomat::GetDiplomat(playerId).GetCurrentStrategy();
 	sint32 min_settle_distance = 0;
 	(void) strategy.GetMinSettleDistance(min_settle_distance);
 
-	
 	SettleMap::SettleTargetList::iterator iter  = targets.begin();
 	SettleMap::SettleTargetList::iterator tmp_iter;
 
@@ -444,7 +434,7 @@
 #endif _DEBUG
 		Assert(cont >= 0);
 
-		if ((is_land && (land_continent_count[cont] >= k_targets_per_continent)) ||  
+		if ((is_land && (land_continent_count[cont] >= k_targets_per_continent)) ||
 			(!is_land && (water_continent_count[cont] >= k_targets_per_continent)))
 		{
 			iter = targets.erase(iter);
@@ -514,7 +504,7 @@
 	{
 		unit = player_ptr->m_all_units->Access(i);
 		const UnitRecord* rec = player_ptr->m_all_units->Access(i).GetDBRec();
-		
+
 		Assert(rec);
 		if(!rec) continue;
 
@@ -566,7 +556,6 @@
 			g_graphicsOptions->AddTextToCell(rc_pos, buf, 255);
 		}
 
-
 		if(!CanSettlePos(rc_pos))
 			continue;
 
@@ -607,18 +596,15 @@
 	sint16 max_water_cont = g_theWorld->GetMaxWaterContinent() - g_theWorld->GetMinWaterContinent();
 	sint16 max_land_cont  = g_theWorld->GetMaxLandContinent () - g_theWorld->GetMinLandContinent ();
 
-	
 	std::vector<sint16> water_continent_count(max_water_cont, 0);
 	std::vector<sint16>  land_continent_count(max_land_cont,  0);
 	bool   is_land;
 	sint16 cont;
 
-	
 	const StrategyRecord & strategy = Diplomat::GetDiplomat(playerId).GetCurrentStrategy();
 	sint32 min_settle_distance = 0;
 	(void) strategy.GetMinSettleDistance(min_settle_distance);
 
-	
 	SettleMap::SettleTargetList::iterator iter  = targets.begin();
 	SettleMap::SettleTargetList::iterator tmp_iter;
 
@@ -635,7 +621,7 @@
 #endif _DEBUG
 		Assert(cont >= 0);
 
-		if ((is_land && (land_continent_count[cont] >= k_targets_per_continent)) ||  
+		if ((is_land && (land_continent_count[cont] >= k_targets_per_continent)) ||
 			(!is_land && (water_continent_count[cont] >= k_targets_per_continent)))
 		{
 			iter = targets.erase(iter);
@@ -689,13 +675,11 @@
     return !m_invalidCells.Get(rc_pos.x, rc_pos.y);
 }
 
-
 void SettleMap::SetCanSettlePos(const MapPoint & rc_pos, const bool can_settle)
 {
     m_invalidCells.Set(rc_pos.x, rc_pos.y, !can_settle);
 }
 
-
 double SettleMap::GetValue(const MapPoint &rc_pos) const
 {
     return m_settleValues.GetGridValue(rc_pos);

Modified: trunk/ctp2_code/ai/mapanalysis/settlemap.h
==============================================================================
--- trunk/ctp2_code/ai/mapanalysis/settlemap.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/mapanalysis/settlemap.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -55,7 +55,7 @@
 public:
 	struct SettleTarget
 	{
-		SettleTarget() 
+		SettleTarget()
 		:   m_value (0.0),
 		    m_pos   ()
 		{ ; };
@@ -76,7 +76,7 @@
 
 	void HandleCityGrowth(const Unit & city);
 
-	void GetSettleTargets(const PLAYER_INDEX &player, 
+	void GetSettleTargets(const PLAYER_INDEX &player,
 	                      SettleMap::SettleTargetList & targets) const;
 
 	bool HasSettleTargets(const PLAYER_INDEX &player, bool isWater) const;
@@ -84,7 +84,7 @@
 	bool CanSettlePos(const MapPoint & rc_pos) const;
 
 	void SetCanSettlePos(const MapPoint & rc_pos, const bool can_settle);
-	
+
 	double GetValue(const MapPoint & rc_pos) const;
 
 private:

Modified: trunk/ctp2_code/ai/personality/aip2.h
==============================================================================
--- trunk/ctp2_code/ai/personality/aip2.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/personality/aip2.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,22 +1,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
 #pragma once
 #ifndef __AIP2_H__
 #define __AIP2_H__
 
 #include "player.h"
 
-
 #include <string>
 #include <vector>
 #include "c3debugstl.h"
@@ -32,11 +19,10 @@
 		return true;
 	}
 
-	
 	std::string m_name;
-	sint8 m_offerPeace;   
-	sint8 m_acceptPeace;  
-	sint32 m_warCrimesRegardCost; 
+	sint8 m_offerPeace;
+	sint8 m_acceptPeace;
+	sint32 m_warCrimesRegardCost;
 	float m_GoodEventDecay[REGARD_EVENT_ALL];
 	float m_BadEventDecay[REGARD_EVENT_ALL];
 };
@@ -54,27 +40,23 @@
 		m_dipAIP.resize(k_MAX_PLAYERS);
 	}
 
-	
-	static AIP & GetAIP(const PLAYER_INDEX playerId)	
+	static AIP & GetAIP(const PLAYER_INDEX playerId)
 		{ return s_AIP[playerId]; }
 
-	
-	DipAIP & GetDipAIP(const PLAYER_INDEX foreignerId) 
+	DipAIP & GetDipAIP(const PLAYER_INDEX foreignerId)
 		{ return m_dipAIP[foreignerId]; }
 
-	const std::string & GetPersonality() const 
+	const std::string & GetPersonality() const
 		{return m_personality;}
 
-	void SetPersonality(const std::string & personality) 
+	void SetPersonality(const std::string & personality)
 		{m_personality = personality;}
 
-
 	bool SwitchAIP(const std::string &name) {
 		m_strategicStateName = name;
 		return true;
 	}
 
-	
 	sint32 BuildListCompletion(const std::string & buildListName) const {
 		return 20;
 	};
@@ -85,7 +67,6 @@
 
 	DipAIPVector m_dipAIP;
 
-	
 	std::string m_personality;
 	std::string m_strategicStateName;
 };

Modified: trunk/ctp2_code/ai/profileai.h
==============================================================================
--- trunk/ctp2_code/ai/profileai.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/profileai.h	Mon May 23 04:21:18 2016	(r1115)
@@ -3,7 +3,6 @@
 
 #ifdef _Debug
 
-
 #define Goal G1_
 #define Agent A1_
 #define Squad S1_
@@ -28,4 +27,3 @@
 #endif // _Debug
 
 #endif // __ai__profileai_h__
-

Modified: trunk/ctp2_code/ai/strategy/agents/agent.cpp
==============================================================================
--- trunk/ctp2_code/ai/strategy/agents/agent.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/agents/agent.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -287,9 +287,9 @@
 	            (g_theWorld->HasCity(pos) ? g_theWorld->GetCity(pos).GetName() : "field")
 	           )
 	          );
-	
+
 	AI_DPRINTF(log, -99, goal != NULL ? goal->Get_Goal_Type() : -1, m_army.m_id,
-		("\t\t   -------\n")); 
+		("\t\t   -------\n"));
 }
 
 bool Agent::FindPathToBoard(const uint32 & move_intersection, const MapPoint & dest_pos, const bool & check_dest, Path & found_path)
@@ -359,7 +359,7 @@
 	{
 		found_path.Clear();
 		found_path.JustSetStart( start_pos );
-		found_path.Restart( start_pos ); 
+		found_path.Restart( start_pos );
 		return true;
 	}
 
@@ -385,7 +385,7 @@
 		move_union = 0x0;
 		path_type = RobotAstar2::PATH_TYPE_DEFENSIVE;
 	}
-	
+
 	if (RobotAstar2::s_aiPathing.FindPath( path_type,
 										   army,
 										   move_union,
@@ -428,7 +428,7 @@
 
 	float cost = 0.0f;
 	g_city_astar.FindCantEnterPenaltyDistance(m_playerId, Get_Pos(), pos, cost, cells, move_union);
-	
+
 	move_point_cost = static_cast<double>(cost);
 	cells *= cells;
 #endif
@@ -441,7 +441,7 @@
 		Cell *          myCell      = g_theWorld->GetCell(pos);
 		Cell *          otherCell   = g_theWorld->GetCell(Get_Pos());
 		double const    movement    = 100.0;
-		// This does not do the trick, better avaerage 
+		// This does not do the trick, better avaerage
 		// over all tiles from pos to target, unfortunately this
 		// is slow.
 		//  std::min(myCell->GetMoveCost(), otherCell->GetMoveCost());
@@ -503,7 +503,6 @@
 	bool check_continents = !transport->m_army.GetMovementTypeAir();
 	bool is_land;
 
-
 	MapPoint trans_pos = transport->Get_Pos();
 	if (check_continents)
 	{
@@ -804,7 +803,7 @@
 
 	if (!Get_Can_Be_Executed())
 		return 0;
-	
+
 	if (!m_army->IsObsolete())
 		return 0;
 
@@ -815,9 +814,9 @@
 		return 0;
 
 	MapPoint    pos         = Get_Pos();
-	sint32      power       = 
+	sint32      power       =
 	    MapAnalysis::GetMapAnalysis().GetPower(m_playerId, pos);
-	sint32      threat      = 
+	sint32      threat      =
 	    MapAnalysis::GetMapAnalysis().GetThreat(m_playerId, pos);
 
 	if ( (power > 0) && ((threat/(double)power) > 1.0))
@@ -828,7 +827,7 @@
 	if (city_unit.m_id == 0)
 	{
 		MapPoint nearest_city_pos;
-		sint32 nearest_distance = g_mp_size.x + g_mp_size.y; 
+		sint32 nearest_distance = g_mp_size.x + g_mp_size.y;
 		sint32 distance;
 		bool found = false;
 
@@ -863,7 +862,7 @@
 	Assert(city);
 
 	CellUnitList city_units;
-	g_theWorld->GetArmy(pos, city_units); 
+	g_theWorld->GetArmy(pos, city_units);
 	sint32 remaining_defenders = city_units.Num() - unit_count;
 
 	if (remaining_defenders < city->GetNeededGarrison())

Modified: trunk/ctp2_code/ai/strategy/agents/agent.h
==============================================================================
--- trunk/ctp2_code/ai/strategy/agents/agent.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/agents/agent.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -113,10 +113,8 @@
 
 	const Army & Get_Army() const { return m_army; };
 
-
 	PLAYER_INDEX Get_Player_Number() const { return m_playerId; };
 
-
 	MapPoint Get_Pos() const { return m_army.IsValid() ? m_army->RetPos() : MapPoint(); };
 
 	sint32 GetUnitsAtPos() const { return g_theWorld->GetCell(Get_Pos())->GetNumUnits(); };
@@ -125,10 +123,8 @@
 
 	bool CanMove() const { return m_army.IsValid() && m_army->CanMove(); };
 
-
 	bool FindPathToBoard( const uint32 & move_intersection, const MapPoint & dest_pos, const bool & check_dest, Path & found_path );
 
-
 	static bool FindPath(const Army & army, const MapPoint & target_pos, const bool & check_dest, Path & found_path );
 	static bool FindPath(const Army & army, const MapPoint & target_pos, const bool & check_dest, Path & found_path, float & total_cost);
 
@@ -150,16 +146,12 @@
 
 	bool Can_Execute_Order(const sint32 & order_type) const;
 
-
 	void Execute_Order(const sint32 & order_type, const MapPoint & order_pos);
 
-
 	void Group_Order();
 
-
 	void Group_With( Agent_ptr second_army );
 
-
 	void Ungroup_Order();
 
 	sint32 DisbandObsoleteArmies();

Modified: trunk/ctp2_code/ai/strategy/goals/Goal.cpp
==============================================================================
--- trunk/ctp2_code/ai/strategy/goals/Goal.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/goals/Goal.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -38,10 +38,10 @@
 // - Added conditions for territory owner and IsVisible (see goals.txt) - Calvitix
 // - Correct the determination of Empire Center and foreign Empire center - Calvitix
 // - Invalid goals if in territory with nontrespassing treaty - Calvitix
-// - Consider a goal with max armies engaged as satisfied - the limitation of 
-//   army size : we cannot form a group with more armies than the max (can 
+// - Consider a goal with max armies engaged as satisfied - the limitation of
+//   army size : we cannot form a group with more armies than the max (can
 //   disturb the goals with RallyFirst() - Calvitix
-// - Changes the const attribute for Compute_Matching_Value (Raw_Priority will 
+// - Changes the const attribute for Compute_Matching_Value (Raw_Priority will
 //   be changed on wounded case) - Calvitix
 // - Linux support modifications + cleanup.
 // - Allow incursion permission to stealth units
@@ -213,7 +213,7 @@
 		return false;
 
 	// Limitation of army size: Cannot form a group with more
-	// armies than the max (without that limitation, it can 
+	// armies than the max (without that limitation, it can
 	// disturb the goals with RallyFirst() - Calvitix
 //	if (m_current_attacking_strength.Get_Agent_Count() == k_MAX_ARMY_SIZE)
 //		return true;
@@ -411,19 +411,19 @@
 	}
 
 	//Check if the army has too much units to fit in one tile - Calvitix
-	if (m_current_attacking_strength.Get_Agent_Count() + 
+	if (m_current_attacking_strength.Get_Agent_Count() +
 		army_strength.Get_Agent_Count() > k_MAX_ARMY_SIZE)
 		return false;
 
-	if ((needed_strength.Get_Agent_Count() > 0) && 
-		(army_strength.Get_Agent_Count() > 0)) 
+	if ((needed_strength.Get_Agent_Count() > 0) &&
+		(army_strength.Get_Agent_Count() > 0))
 		return true;
 
 	if ((needed_strength.Get_Attack() > 0) &&
 		(army_strength.Get_Attack() > 0))
 		return true;
 
-	if ((needed_strength.Get_Defense() > 0) && 
+	if ((needed_strength.Get_Defense() > 0) &&
 		(army_strength.Get_Defense() > 0) )
 		return true;
 
@@ -435,7 +435,7 @@
 		(army_strength.Get_Ranged() > 0))
 		return true;
 
-	if ((needed_strength.Get_Ranged_Units() > 0) && 
+	if ((needed_strength.Get_Ranged_Units() > 0) &&
 		(army_strength.Get_Ranged_Units() > 0))
 		return true;
 
@@ -851,7 +851,7 @@
 		{
 			if(!Pretest_Bid(agent_ptr, goalPos))
 			{
-				AI_DPRINTF(k_DBG_SCHEDULER, agent_ptr->Get_Army()->GetOwner(), m_goal_type, -1, 
+				AI_DPRINTF(k_DBG_SCHEDULER, agent_ptr->Get_Army()->GetOwner(), m_goal_type, -1,
 					("\t\tTransporter not needed anymore, removing from goal\n"));
 
 				Rollback_Agent(agent_iter); // increases the agent iterator
@@ -1005,9 +1005,9 @@
 
 		Assert( m_target_city.m_id != 0);
 
-		const TradeDynamicArray* trade_routes = 
+		const TradeDynamicArray* trade_routes =
 			m_target_city.GetCityData()->GetTradeSourceList();
-		for(sint32 i = 0; i < trade_routes->Num(); i++) 
+		for(sint32 i = 0; i < trade_routes->Num(); i++)
 		{
 			const DynamicArray<MapPoint>* path = (*trade_routes)[i].GetPath();
 
@@ -1020,7 +1020,7 @@
 
 				if (cell->CanEnter(army->GetMovementType()))
 				{
-					sint32 tmp_squared_dist = 
+					sint32 tmp_squared_dist =
 					MapPoint::GetSquaredDistance(path->Get(j), army->RetPos());
 					if (tmp_squared_dist < best_squared_dist)
 					{
@@ -1097,7 +1097,7 @@
 {
 	static MapPoint pos;    // ugly life-time extension
 
-	if (m_target_army != ID()) 
+	if (m_target_army != ID())
 	{
 		if (m_target_army.IsValid())
 		{
@@ -1183,13 +1183,12 @@
 	return value;
 }
 
-
 PLAYER_INDEX Goal::Get_Target_Owner() const
 {
 	PLAYER_INDEX       target_owner = PLAYER_UNASSIGNED;
 	GoalRecord const * goal_record  = g_theGoalDB->Get(m_goal_type);
 	Assert(goal_record);
-	
+
 	if(goal_record->GetTargetTypeAttackUnit()
 	|| goal_record->GetTargetTypeSpecialUnit()
 	)
@@ -1263,7 +1262,7 @@
 	{
 		if(goal_record->GetTargetOwnerSelf())
 			m_current_needed_strength.Set_Defense(threat);
-		
+
 		else
 			m_current_needed_strength.Set_Attack(threat);
 
@@ -1279,7 +1278,7 @@
 		// tweak to obtain RETREAT Goal definition : TO DO - 'cleaner' method - Calvitix
 		// Set to 2 to so that units with no goals will retreat to the nearest city
 		// (I Prefer that method than the GARRISON troops, that are not able to leave the city)
-		// cities will be better defended if their is enough units, otherwise units will be 
+		// cities will be better defended if their is enough units, otherwise units will be
 		// affected to relevant goals
 		if(g_theGoalDB->Get(m_goal_type)->GetTargetTypeCity()
 		&& g_theGoalDB->Get(m_goal_type)->GetTargetOwnerSelf()
@@ -1289,7 +1288,7 @@
 		}
 		else
 		{
-			const StrategyRecord & strategy = 
+			const StrategyRecord & strategy =
 				Diplomat::GetDiplomat(m_playerId).GetCurrentStrategy();
 
 			sint32 offensive_garrison;
@@ -1537,13 +1536,13 @@
 
 	Utility bonus = 0;
 
-	//Set if unit is wounded and it is a retreat of defense goal, add bonus 
+	//Set if unit is wounded and it is a retreat of defense goal, add bonus
 	//to goalpriority + matching
 
 	MapPoint armyPos      = agent_ptr->Get_Pos();
 	PLAYER_INDEX PosOwner = g_theWorld->GetOwner(armyPos);
 
-	if(g_theGoalDB->Get(m_goal_type)->GetTargetTypeCity() 
+	if(g_theGoalDB->Get(m_goal_type)->GetTargetTypeCity()
 	&& g_theGoalDB->Get(m_goal_type)->GetTargetOwnerSelf()
 	){
 		// For Defend or Retreat goals
@@ -1617,7 +1616,7 @@
 		{
 			bonus+= g_theGoalDB->Get(m_goal_type)->GetWoundedArmyBonus();
 		}
-		
+
 		if(PosOwner != m_playerId && !diplomat.IncursionPermission(PosOwner))
 		{
 			bonus += g_theGoalDB->Get(m_goal_type)->GetTreaspassingArmyBonus();
@@ -1637,7 +1636,7 @@
 #if defined(_DEBUG) || defined(USE_LOGGING)  // Add a debug report of goal computing (raw priority and all modifiers)
 	double report_wounded = bonus;
 #endif //_DEBUG
-	
+
 	if(agent_ptr->Get_Army()->HasCargo() ? agent_ptr->Get_Army()->IsCargoObsolete() : agent_ptr->Get_Army()->IsObsolete())
 		bonus += g_theGoalDB->Get(m_goal_type)->GetObsoleteArmyBonus();
 
@@ -1678,7 +1677,7 @@
 
 	Utility raw_priority = Get_Raw_Priority();
 
-	const StrategyRecord & strategy = 
+	const StrategyRecord & strategy =
 		Diplomat::GetDiplomat(m_playerId).GetCurrentStrategy();
 
 	sint32 distance_modifier = 1;
@@ -1833,7 +1832,7 @@
 	if
 	  (
 	        goal_rec->GetHasTransportersOrNoCoastalCities()
-	    && 
+	    &&
 	       (
 	            !player_ptr->CanUseSeaTab()
 	         ||
@@ -1891,9 +1890,9 @@
 	double maxThreat = static_cast<double>(map.GetMaxThreat(m_playerId));
 	if ( maxThreat > 0.0 )
 	{
-		cell_value += 
+		cell_value +=
 		( ( static_cast<double>(map.GetThreat(m_playerId, target_pos)) /
-		     maxThreat) * 
+		     maxThreat) *
 		  g_theGoalDB->Get(m_goal_type)->GetThreatBonus() );
 
 #if defined(_DEBUG) || defined(USE_LOGGING) // Add a debug report of goal computing (raw priority and all modifiers) - Calvitix
@@ -1905,9 +1904,9 @@
 	double maxEnemyValue = static_cast<double>(map.GetMaxEnemyValue(m_playerId));
 	if(maxEnemyValue > 0.0)
 	{
-		cell_value += 
+		cell_value +=
 		( ( static_cast<double>(map.GetEnemyValue( m_playerId, target_pos)) /
-		    maxEnemyValue ) * 
+		    maxEnemyValue ) *
 		  goal_rec->GetEnemyValueBonus() );
 
 #if defined(_DEBUG) || defined(USE_LOGGING) // Add a debug report of goal computing (raw priority and all modifiers) - Calvitix
@@ -1919,9 +1918,9 @@
 	double maxAlliedValue = static_cast<double>(map.GetMaxAlliedValue(m_playerId));
 	if ( maxAlliedValue > 0)
 	{
-		cell_value += 
+		cell_value +=
 		( ( static_cast<double>(map.GetAlliedValue(m_playerId, target_pos)) /
-		    maxAlliedValue ) * 
+		    maxAlliedValue ) *
 		  goal_rec->GetAlliedValueBonus() );
 
 #if defined(_DEBUG) || defined(USE_LOGGING) // Add a debug report of goal computing (raw priority and all modifiers) - Calvitix
@@ -1933,9 +1932,9 @@
 	double maxPower = static_cast<double>(map.GetMaxPower(m_playerId)); // Get Max Power of all Allies
 	if (maxPower > 0)
 	{
-		cell_value += 
+		cell_value +=
 		( ( static_cast<double>(map.GetPower( m_playerId, target_pos)) /  // Allies' Power at target_pos
-		    maxPower ) * 
+		    maxPower ) *
 		goal_rec->GetPowerBonus() );
 
 #if defined(_DEBUG) || defined(USE_LOGGING) // Add a debug report of goal computing (raw priority and all modifiers) - Calvitix
@@ -2344,9 +2343,9 @@
 		{
 			Agent_ptr    agent_ptr       = (Agent_ptr) *agent_iter;
 
-			// Add this condition to avoid that a 12 units army with SEIGE goal retreat 
-			// at 1 tile near the city, because it has left 1 unit and has to group with 
-			// another one. I Think it is better to go on an seige the city (if there is 
+			// Add this condition to avoid that a 12 units army with SEIGE goal retreat
+			// at 1 tile near the city, because it has left 1 unit and has to group with
+			// another one. I Think it is better to go on an seige the city (if there is
 			// more than 2/3 left, if more than 8 units).
 			/// @ToDo: Reconsider NeverSatisfied
 			MapPoint     target__pos     = Get_Target_Pos(agent_ptr->Get_Army());
@@ -2386,7 +2385,7 @@
 					}
 					else
 					{
-						// If hastogowithoutgrouping is true, execute the goal 
+						// If hastogowithoutgrouping is true, execute the goal
 						// even if the rally is not complete
 						if(!hastogowithoutgrouping)
 						{
@@ -2408,7 +2407,7 @@
 		// Added an Ungroup method (sometimes, for example to explore,
 		// it is more interessant to have a lot of small units rather
 		// than a huge army
-		else if(goal_record->GetUnGroupFirst()) 
+		else if(goal_record->GetUnGroupFirst())
 		{
 			Set_Sub_Task(SUB_TASK_UNGROUP);
 			if (!UnGroupTroops())
@@ -2506,7 +2505,7 @@
 	sint32 maxattack = 0;
 	bool iscivilian = false;
 	if ( goal_record->GetTargetTypeAttackUnit() ||
-		goal_record->GetTargetTypeSpecialUnit() ) 
+		goal_record->GetTargetTypeSpecialUnit() )
 	{
 		if(g_theWorld->GetCity(m_target_army->RetPos()).m_id != 0)
 			return true;
@@ -2573,7 +2572,7 @@
 			if ( (!regard_checked || !diplomacy_match) &&
 				goal_record->GetTargetOwnerColdEnemy() )
 			{
-				diplomacy_match = 
+				diplomacy_match =
 					diplomat.TestEffectiveRegard(target_owner, COLDWAR_REGARD);
 
 				regard_checked = true;
@@ -2582,7 +2581,7 @@
 			if ( (!regard_checked || !diplomacy_match) &&
 				goal_record->GetTargetOwnerHotEnemy() )
 			{
-				diplomacy_match = 
+				diplomacy_match =
 					diplomat.TestEffectiveRegard(target_owner, HOTWAR_REGARD);
 
 				regard_checked = true;
@@ -2591,13 +2590,13 @@
 			if ( (!regard_checked || !diplomacy_match) &&
 				goal_record->GetTargetOwnerAlly() )
 			{
-				diplomacy_match = 
+				diplomacy_match =
 					diplomat.TestEffectiveRegard(target_owner, ALLIED_REGARD);
 
 				regard_checked = true;
 			}
-			// If the goal is not executed by stealth units, forbid to 
-			// execute it if there is no incursion permission 
+			// If the goal is not executed by stealth units, forbid to
+			// execute it if there is no incursion permission
 			// (depending on alignement) - Calvitix
 			if ((!diplomat.IncursionPermission(target_owner) &&
 				(diplomat.GetPersonality()->GetAlignmentGood() ||
@@ -2928,7 +2927,7 @@
 bool Goal::Get_Removal_Time() const
 {
 	if ( Get_Invalid() ||
-		 (g_theGoalDB->Get(m_goal_type)->GetRemoveWhenComplete() && 
+		 (g_theGoalDB->Get(m_goal_type)->GetRemoveWhenComplete() &&
 		  Get_Totally_Complete() ) )
 		 return true;
 	return false;
@@ -2952,7 +2951,7 @@
 		MapPoint refuel_pos(-1, -1);
 		CtpAi::GetNearestRefuel(army, target_pos, refuel_pos, distance_to_refuel);
 
-		distance_to_target = 
+		distance_to_target =
 		    static_cast<sint32>(sqrt(static_cast<double>
 		    (MapPoint::GetSquaredDistance(army->RetPos(), target_pos))
 		    ));
@@ -3003,12 +3002,12 @@
 	bool needs_land_unit  = goal_rec->GetTargetTypeCity();
 	     needs_land_unit &= goal_rec->GetTargetOwnerSelf();
 	     needs_land_unit |= goal_rec->GetTargetTypeGoodyHut();
-	
+
 	uint32 movement_type  = army->GetMovementType();
 	if (army->HasCargo())
 	       movement_type |= army->GetCargoMovementType();
 
-	bool land_movement = ((movement_type & 
+	bool land_movement = ((movement_type &
 	        (k_Unit_MovementType_Land_Bit | k_Unit_MovementType_Mountain_Bit)) != 0x0);
 	land_movement &= ((movement_type & k_Unit_MovementType_Air_Bit) == 0x0);
 
@@ -3017,7 +3016,7 @@
 		return false;
 	}
 
-	if ( army->CanNukeCity() && 
+	if ( army->CanNukeCity() &&
 		 (g_theWorld->GetCell(target_pos)->GetOwner() != m_playerId ||
 		  g_theWorld->GetCity(target_pos).m_id != 0x0) )
 		return false;
@@ -3435,7 +3434,7 @@
 			return true;
 		}
 
-		uint32 move_intersection = 
+		uint32 move_intersection =
 			the_transport->Get_Army().GetMovementType() | the_army->Get_Army().GetMovementType();
 
 		found = the_transport->FindPathToBoard(move_intersection, dest_pos, check_dest, found_path);
@@ -3570,18 +3569,16 @@
 
 	sint32 range = 0;
 	(void) g_theGoalDB->Get(m_goal_type)->GetExecute()->GetRange(range);
-	
-	
+
 	bool check_dest;
 	const GoalRecord * goal_rec = g_theGoalDB->Get(m_goal_type);
-	if (range > 0  || 
+	if (range > 0  ||
 		goal_rec->GetExecute()->GetTargetPretestAttackPosition() ||
 		(goal_rec->GetTargetTypeCity() && goal_rec->GetTargetOwnerSelf()))
 		check_dest = false;
 	else
 		check_dest = true;
 
-
 	bool     waiting_for_buddies = !Ok_To_Rally()
 	                            && m_sub_task == SUB_TASK_RALLY
 	                            && g_theWorld->IsOnSameContinent(goal_pos, the_army->Get_Pos())
@@ -3600,10 +3597,10 @@
 		double city_distance = 0.0;
 		bool   city_found    = g_player[m_playerId]->
 		                       GetNearestCity(goal_pos, nearest_city, city_distance, false, target_cont);
-		
+
 		if (city_found)
 		{
-			found = Agent::FindPath(the_army->Get_Army(), nearest_city.RetPos(), true, found_path); 
+			found = Agent::FindPath(the_army->Get_Army(), nearest_city.RetPos(), true, found_path);
 			if (found) Set_Sub_Task(SUB_TASK_AIRLIFT);
 
 			if (the_army->Get_Pos() == nearest_city.RetPos())
@@ -3624,7 +3621,7 @@
 		// Check if is single squad
 		// Return true if we are a transporter and we need transporters
 		// SUB_TASK_TRANSPORT_TO_GOAL
-		uint32 move_intersection = 
+		uint32 move_intersection =
 		        the_army->Get_Army()->GetMovementType() | the_army->Get_Army()->GetCargoMovementType();
 
 		found = the_army->FindPathToBoard(move_intersection, goal_pos, false, found_path);
@@ -3761,18 +3758,18 @@
 
 	for
 	(
-	    Agent_List::const_iterator agent_iter  = m_agents.begin(); 
+	    Agent_List::const_iterator agent_iter  = m_agents.begin();
 	                               agent_iter != m_agents.end();
 	                             ++agent_iter
 	)
 	{
 		const Agent_ptr agent_ptr = (Agent_ptr) *agent_iter;
 		Assert(agent_ptr);
-		
+
 		if(!agent_ptr->Get_Is_Dead())
 		{
 			MapPoint const	army_pos		= agent_ptr->Get_Pos();
-			
+
 			if (g_theWorld->IsLand(army_pos))
 			{
 				if(g_theWorld->IsOnSameContinent(army_pos, targetPos))
@@ -3815,13 +3812,13 @@
 	for
 	(
 	    Agent_List::const_iterator agent_iter  = m_agents.begin();
-	                               agent_iter != m_agents.end(); 
+	                               agent_iter != m_agents.end();
 	                             ++agent_iter
 	)
 	{
 		Agent_ptr agent_ptr   = (Agent_ptr) *agent_iter;
 		Assert(agent_ptr);
-		
+
 		if (agent_ptr->Get_Is_Dead())
 			continue;
 
@@ -3907,7 +3904,7 @@
 	const GoalRecord * goal_rec = g_theGoalDB->Get(m_goal_type);
 	sint32 range = 0;
 	(void) goal_rec->GetExecute()->GetRange(range);
-	if (range > 0  || 
+	if (range > 0  ||
 		goal_rec->GetExecute()->GetTargetPretestAttackPosition() ||
 		(goal_rec->GetTargetTypeCity() && goal_rec->GetTargetOwnerSelf()))
 		check_dest = false;
@@ -4124,7 +4121,7 @@
 	{
 		Agent_ptr agent1_ptr = (Agent_ptr) *agent1_iter;
 		Assert(agent1_ptr);
-		
+
 		if( agent1_ptr->Get_Is_Dead()
 		|| !agent1_ptr->Get_Can_Be_Executed()
 		){
@@ -4158,7 +4155,7 @@
 				(agent2_is_partial != agent1_is_partial) )
 				continue;
 
-			sint32 const distance = 
+			sint32 const distance =
 			    MapPoint::GetSquaredDistance(agent1_ptr->Get_Pos(), agent2_ptr->Get_Pos());
 
 			if(distance < min_distance)
@@ -4167,7 +4164,7 @@
 				closest_agent_iter  = agent2_iter;
 			}
 
-			if( agent1_is_partial == agent2_is_partial && 
+			if( agent1_is_partial == agent2_is_partial &&
 				!partiality_found)
 			{
 				partiality_found = true;
@@ -4196,10 +4193,10 @@
 				closest_agent_pos = closest_agent_ptr->Get_Target_Pos();
 			}
 
-			// To avoid Groups to be blocked when an unit is in a city 
+			// To avoid Groups to be blocked when an unit is in a city
 			// (problem with garrison -> not enough room)
 			sint32 cells;
-			if(!g_theWorld->GetCity(closest_agent_pos).IsValid() 
+			if(!g_theWorld->GetCity(closest_agent_pos).IsValid()
 			||  agent1_ptr->GetRounds(closest_agent_pos, cells) > 2
 			){
 				// Should be superflous
@@ -4283,7 +4280,6 @@
 	return true;
 }
 
-
 bool Goal::UnGroupTroops()
 {
 	bool            breturn     = false;
@@ -4308,17 +4304,16 @@
 			breturn = true;
 		}
 	}
-	
+
 	return breturn;
 }
 
-
 bool Goal::UnGroupComplete() const
 {
 	for
 	(
-	    Agent_List::const_iterator agent_iter  = m_agents.begin(); 
-	                               agent_iter != m_agents.end(); 
+	    Agent_List::const_iterator agent_iter  = m_agents.begin();
+	                               agent_iter != m_agents.end();
 	                             ++agent_iter
 	)
 	{
@@ -4336,7 +4331,7 @@
 	return true;
 }
 
-bool Goal::TryTransport(Agent_ptr agent_ptr, const MapPoint & goal_pos) 
+bool Goal::TryTransport(Agent_ptr agent_ptr, const MapPoint & goal_pos)
 {
 	if (g_theGoalDB->Get(m_goal_type)->GetNoTransport())
 		return false;
@@ -4532,8 +4527,8 @@
 
 bool Goal::Goal_Too_Expensive() const
 {
-	return (m_current_attacking_strength.Get_Agent_Count() > k_MAX_ARMY_SIZE) 
-	    && (m_current_attacking_strength.Get_Value() > 
+	return (m_current_attacking_strength.Get_Agent_Count() > k_MAX_ARMY_SIZE)
+	    && (m_current_attacking_strength.Get_Value() >
 	            m_current_needed_strength.Get_Value() * 3
 	       );
 }

Modified: trunk/ctp2_code/ai/strategy/goals/Goal.h
==============================================================================
--- trunk/ctp2_code/ai/strategy/goals/Goal.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/goals/Goal.h	Mon May 23 04:21:18 2016	(r1115)
@@ -28,7 +28,7 @@
 // - Set the SUB_TASK_TYPE global - Calvitix
 // - Added an SUB_TASK_TYPE attribute (used for armytext display) - Calvitix
 // - Added methods to Ungroup armies - Calvitix
-// - Changes the const attribute for Compute_Matching_Value (Raw_Priority will 
+// - Changes the const attribute for Compute_Matching_Value (Raw_Priority will
 //   be changed on wounded case) - Calvitix
 // - Fixed Goal subtask handling. (26-Jan-2008 Martin Gühmann)
 // - Use more than one transporter if the goal needs more than one. (8-Feb-2008 Martin Gühmann)
@@ -86,42 +86,31 @@
     Goal(const Goal & goal);
     ~Goal();
 
-
     Goal & operator = (const Goal & goal);
     bool operator ==  (const Goal & rval) const;
     bool operator <   (const Goal & goal) const { return (m_raw_priority < goal.m_raw_priority); };
 
-
     GOAL_TYPE Get_Goal_Type() const { return m_goal_type; };
 
-
     void Set_Player_Index(const PLAYER_INDEX & playerId) { m_playerId = playerId; };
 
-
     PLAYER_INDEX Get_Player_Index() const { return m_playerId; };
 
-
     bool Is_Satisfied() const;
 
-
     bool Is_Goal_Undercommitted() const { return (!Is_Satisfied() && m_agents.size() > 0); };
 
-
     sint16 Get_Agent_Count() const { return m_agents.size(); };
 
-
     bool Is_Single_Agent() const { return m_agents.size() == 1; };
 
-
     void Commit_Agent(const Agent_ptr & agent);
 
-
     void Rollback_Agent(Agent_ptr agent_ptr);
     void Rollback_Emptied_Transporters();
 
     bool Is_Execute_Incrementally() const;
 
-
     void Compute_Needed_Troop_Flow();
 
     Utility Compute_Agent_Matching_Value(const Agent_ptr agent_ptr) const;
@@ -129,40 +118,28 @@
     Utility Get_Initial_Priority() const;
     Utility Compute_Raw_Priority();
 
-
     Utility Get_Raw_Priority() const { return m_raw_priority; };
 
-
     GOAL_RESULT Execute_Task();
 
-
     bool Get_Invalid() const;
 
-
     bool Get_Removal_Time() const;
 
-
     bool Can_Be_Executed() const;
 
-
     void Set_Can_Be_Executed(const bool & can_be_executed);
 
-
     void Set_Type(const GOAL_TYPE & type);
 
-
     void Set_Raw_Priority(const Utility & priority);
 
-
     bool Get_Is_Appropriate() const;
 
-
     bool Satisfied_By(const Squad_Strength & army_strength) const;
 
-
     bool Needs_Transporter() const;
 
-
     const Squad_Strength Get_Strength_Needed() const;
 
     Utility Compute_Matching_With_Generic_Matches(Goal_ptr genric_goal, const bool update = true) { return Compute_Matching_Value(genric_goal->m_matches, update); };
@@ -198,13 +175,10 @@
     void Sort_Matches_If_Necessary();
     void Set_Target_Pos(const MapPoint & pos);
 
-
     void Set_Target_Army(const Army & army);
 
-
     void Set_Target_City(const Unit & city);
 
-
     const MapPoint & Get_Target_Pos() const;
     const MapPoint Get_Target_Pos(const Army & army) const;
 
@@ -215,25 +189,18 @@
     void Set_Sub_Task(const SUB_TASK_TYPE & sub_task);
 
 
-
     const Unit & Get_Target_City() const;
 
-
     sint32 Get_Target_Value() const;
 
-
     PLAYER_INDEX Get_Target_Owner() const;
 
-
     bool Pretest_Bid(const Agent_ptr agent_ptr, const MapPoint & target_pos) const;
 
-
     bool ArmiesAtGoal() const;
 
-
     sint32 GetThreatenBonus() const;
 
-
     void Log_Debug_Info(const int & log) const;
     void Log_Debug_Info_Full(const int & log) const;
 
@@ -262,16 +229,12 @@
                           MapPoint & dest_pos,
                           Path & path);
 
-
     bool GotoTransportTaskSolution(Agent_ptr the_army, Agent_ptr the_transport, MapPoint & pos);
 
-
     bool GotoGoalTaskSolution(Agent_ptr the_army, MapPoint & goal_pos);
 
-
     bool Ok_To_Rally() const;
 
-
     bool RallyComplete() const;
 
     MapPoint MoveToTarget(Agent_ptr rallyAgent);
@@ -287,13 +250,10 @@
 
     bool Goal_Too_Expensive() const;
 
-
     bool TryTransport(Agent_ptr agent_ptr, const MapPoint & goal_pos);
 
-
     bool FindTransporters(const Agent_ptr & agent_ptr, std::list< std::pair<Utility, Agent_ptr> > & transporter_list);
 
-
     bool LoadTransporters(Agent_ptr agent_ptr);
 
     MapPoint GetClosestTransporterPos(const Agent_ptr agent_ptr) const;

Modified: trunk/ctp2_code/ai/strategy/scheduler/Goal_And_Squad_Types.h
==============================================================================
--- trunk/ctp2_code/ai/strategy/scheduler/Goal_And_Squad_Types.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/scheduler/Goal_And_Squad_Types.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,18 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
 #ifndef __GOAL_AND_SQUAD_TYPES_H__
 #define __GOAL_AND_SQUAD_TYPES_H__
 
-
 typedef sint8 GOAL_TYPE;
 const GOAL_TYPE GOAL_TYPE_NULL = -1;
 

Modified: trunk/ctp2_code/ai/strategy/scheduler/Plan.cpp
==============================================================================
--- trunk/ctp2_code/ai/strategy/scheduler/Plan.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/scheduler/Plan.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -34,16 +34,16 @@
 //
 // - Changed the > and < operator  (to change the Sort method see Sort_Matches) - Calvitix
 //   instead of only looking for the matching value, the new operator first
-//   compare the Goal Raw-priority. If it is equal, then compare matching 
+//   compare the Goal Raw-priority. If it is equal, then compare matching
 //   value. It has the advantage to give the possibility for high priority
-//   goal that demands many units to be considered. 
-//   For example :  3 units available, 
-//                  3 Goals : 
+//   goal that demands many units to be considered.
+//   For example :  3 units available,
+//                  3 Goals :
 //                  GOAL1  priority 50000, demands 2 units to be satisfied
 //                  GOAL2  priority 40000, demands 1 unit to be satisfied
 //                  GOAL3  priority 30000, demands 1 unit to be satisfied
 //
-//      the matches are : 
+//      the matches are :
 //
 //                  GOAL1 <-> UNIT1   52000
 //                  GOAL1 <-> UNIT2   49000
@@ -55,10 +55,10 @@
 //                  GOAL3 <-> UNIT2   53000
 //                  GOAL3 <-> UNIT3   55000
 //
-//      Original Sort_matches and agent committing : 
+//      Original Sort_matches and agent committing :
 //
 //              GOAL3  ->  UNIT3   --> OK
-//              GOAL2  ->  UNIT1   --> OK     
+//              GOAL2  ->  UNIT1   --> OK
 //              GOAL1  ->  FAILED to Satisfy, and it has the greatest priority !!!!
 //
 //
@@ -67,7 +67,7 @@
 //              GOAL1  -> UNIT1
 //                     -> UNIT2    --> OK
 //              GOAL2  -> UNIT3    --> OK
-//              GOAL3  -> FAILED to Satisfy       
+//              GOAL3  -> FAILED to Satisfy
 //
 // - Added an method that determines if the matches can be reevaluated)
 //   (ie the agent can be rollbacked and eventually be used for another goal)
@@ -236,10 +236,10 @@
 //
 // Globals    : -
 //
-// Returns    : bool    : This object has lower/higher priority than the object 
+// Returns    : bool    : This object has lower/higher priority than the object
 //                        to compare against.
 //
-// Remark(s)  : The order is determined by the priority of the goal, with 
+// Remark(s)  : The order is determined by the priority of the goal, with
 //              matching value as tie breaker.
 //
 //----------------------------------------------------------------------------
@@ -266,10 +266,10 @@
 //
 // Globals    : -
 //
-// Returns    : bool    : This object is equal to/different from the object 
+// Returns    : bool    : This object is equal to/different from the object
 //                        to compare against.
 //
-// Remark(s)  : Equality is defined is having the same agent and the same 
+// Remark(s)  : Equality is defined is having the same agent and the same
 //              matching value.
 //              Probably not used
 //

Modified: trunk/ctp2_code/ai/strategy/scheduler/Plan.h
==============================================================================
--- trunk/ctp2_code/ai/strategy/scheduler/Plan.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/scheduler/Plan.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -34,7 +34,7 @@
 //   pne agent pointer. (27-Aug-2008 Martin Gühmann)
 //
 //----------------------------------------------------------------------------
- 
+
 #if defined(HAVE_PRAGMA_ONCE)
 #pragma once
 #endif
@@ -65,7 +65,6 @@
 	bool operator== (const Plan &plan) const;
 	bool operator!= (const Plan &plan) const;
 
-
 	bool Plan_Is_Needed_And_Valid() const { return m_the_agent != NULL; };
 
 	Utility Compute_Matching_Value(Goal_ptr goal_ptr);
@@ -99,5 +98,4 @@
 	bool             m_needs_transporter;
 };
 
-
 #endif // PLAN_H__

Modified: trunk/ctp2_code/ai/strategy/scheduler/Scheduler.h
==============================================================================
--- trunk/ctp2_code/ai/strategy/scheduler/Scheduler.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/scheduler/Scheduler.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,13 +11,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 // _MSC_VER
 // - Compiler version (for the Microsoft C++ compiler only)
 //
@@ -43,7 +43,6 @@
 #include "squad_Strength.h"
 #include "StrategyRecord.h"
 
-
 #include <vector>
 #include <utility>
 #include <deque>
@@ -57,7 +56,6 @@
 class Scheduler;
 class Army;
 
-
 class Scheduler
 {
 
@@ -106,7 +104,7 @@
 	typedef std::vector<Sorted_Agent_List>                                   Sorted_Agent_List_Vector;
 	typedef Sorted_Agent_List::iterator                                      Sorted_Agent_Iter;
 
-#if defined(_MSC_VER) && (_MSC_VER < 1300)	// does not compile with newer version	
+#if defined(_MSC_VER) && (_MSC_VER < 1300)	// does not compile with newer version
 	typedef std::deque<Scheduler>                                            Scheduler_Vector;
 #else
 	typedef std::vector<Scheduler>                                           Scheduler_Vector;
@@ -115,7 +113,6 @@
 
 	static sint32 s_max_match_list_cycles;
 
-
 	static void ResizeAll(const PLAYER_INDEX & newMaxPlayerId);
 
 #if 0
@@ -127,32 +124,25 @@
 
 	static void CleanupAll(void);
 
-
 	static void       SetContactCache         (sint32 player);
 	static bool CachedHasContactWithExceptSelf(sint32 player1, sint32 player2);
-	
+
 	static void    SetIsNeutralRegardCache(sint32 player);
 	static bool CachedIsNeutralRegard     (sint32 player, sint32 opponent);
-	
-	
+
 	static void    SetIsAllyRegardCache(sint32 player);
 	static bool CachedIsAllyRegard     (sint32 player, sint32 ally);
 
-
 	Scheduler();
 
 
-
 	Scheduler(const Scheduler &scheduler);
 
 
-
 	~Scheduler();
 
-	
 	Scheduler& operator= (const Scheduler &scheduler);
 
-	
 	void Cleanup();
 
 #if 0
@@ -162,22 +152,18 @@
 
 	void Initialize();
 
-	
 	void SetPlayerId(const PLAYER_INDEX &team_index);
 
 	void Process_Agent_Changes();
 	void Process_Goal_Changes();
 
-
 	void Reset_Agent_Execution();
 
 	void Sort_Goals();
 
-
 	void Match_Resources(const bool move_armies);
 
-	
-	
+
 	void Add_New_Goal(const Goal_ptr & new_goal);
 
 	void Add_New_Agent(const Agent_ptr & new_agent);
@@ -185,30 +171,23 @@
 
 	Sorted_Goal_Iter Remove_Goal(const Sorted_Goal_Iter & sorted_goal_iter);
 
-	
 	void Remove_Goals_Type(const GoalRecord *rec);
 
-	
-	
-	Squad_Strength GetMostNeededStrength() const;
 
+	Squad_Strength GetMostNeededStrength() const;
 
 	sint32 GetValueUnsatisfiedGoals(const GOAL_TYPE & type) const;
 
-
 	Goal_ptr GetHighestPriorityGoal(const GOAL_TYPE & type, const bool satisfied) const;
 
-
 	sint16 CountGoalsOfType(const GOAL_TYPE & type) const;
 
-
 	void DisbandObsoleteArmies(const sint16 max_count);
 
 	bool Prioritize_Goals();
 
 	bool Prune_Goals();
 
-	
 	void SetArmyDetachState(const Army & army, const bool detach);
 	void Recompute_Goal_Strength();
 	void Compute_Agent_Strength();
@@ -227,26 +206,20 @@
 	    const bool       update_match_value = true
 	);
 
-
 	void Add_New_Matches_For_Agent(const Agent_ptr & agent);
 
-
 	void Remove_Matches_For_Goal( const Goal_ptr & goal );
 
-
 	void Remove_Matches_For_Agent( const Agent_ptr & agnet );
 
-
 	void Rollback_Matches_For_Goal(const Goal_ptr & goal_ptr);
 
 	void Reprioritize_Goal(Goal_List::iterator &goal_iter);
 
 	bool Add_Transport_Matches_For_Goal(const Goal_ptr & goal_ptr);
 
-	
 	GOAL_TYPE GetMaxEvalExec(const StrategyRecord::GoalElement *goal_element_ptr, sint16 & max_eval, sint16 & max_exec);
 
-	
 	bool GetArmyDetachState(const Army & army) const;
 
 private:

Modified: trunk/ctp2_code/ai/strategy/scheduler/scheduler.cpp
==============================================================================
--- trunk/ctp2_code/ai/strategy/scheduler/scheduler.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/scheduler/scheduler.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -31,7 +31,7 @@
 //
 // Modifications from the original Activision code:
 //
-// - Do not consider invalid goals (e.g. threatened city that has been 
+// - Do not consider invalid goals (e.g. threatened city that has been
 //   destroyed already).
 // - Marked MS version specific code.
 // - Added CanMatchesBeReevaluated() check -> to reevaluate the goals each turn
@@ -61,7 +61,6 @@
 #include <algorithm>
 #include <list>
 
-
 #include "goal.h"
 #include "Plan.h"
 #include "agent.h"
@@ -168,8 +167,8 @@
 {
 	Assert(playerId >= 0);
 	Assert(static_cast<size_t>(playerId) < s_theSchedulers.size());
-	
-	return s_theSchedulers[playerId]; 
+
+	return s_theSchedulers[playerId];
 }
 
 void Scheduler::CleanupAll(void)
@@ -662,7 +661,7 @@
 		MapPoint pos = (goal_ptr->Get_Target_Army().m_id == 0 || goal_ptr->Get_Target_Army().IsValid()) ? goal_ptr->Get_Target_Pos() : MapPoint(-1, -1);
 		AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, ("\n"));
 		AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, ("\n"));
-		AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+		AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 				("[%d] Starting to match resources to %s: %x (x=%d,y=%d), match %d, %s\n",
 					count, g_theGoalDB->Get(goal_ptr->Get_Goal_Type())->GetNameText(), goal_ptr, pos.x, pos.y, oldMatchValue, (g_theWorld->HasCity(pos) ? g_theWorld->GetCity(pos).GetName() : "field")));
 		count++;
@@ -670,7 +669,7 @@
 
 		if(oldMatchValue == Goal::BAD_UTILITY)
 		{
-			AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+			AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 					("\t\tGOAL (goal: %x) -- First goal with bad utility - stop matching\n",
 						goal_ptr));
 
@@ -685,7 +684,7 @@
 
 		if(newMatchValue == Goal::BAD_UTILITY)
 		{
-			AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+			AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 				("\t\tGOAL (goal: %x)(agent count: %d) -- Goal with bad utility, trying agian in next cycle.\n",
 						goal_ptr, goal_ptr->Get_Agent_Count()));
 
@@ -750,7 +749,7 @@
 			|| transNum == goal_ptr->Get_Transporters_Num()
 			){
 				// Has to be modified for partial transport
-				AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+				AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 					("\t\tGOAL_FAILED Not enough transporters (goal: %x)\n", goal_ptr));
 
 				Rollback_Matches_For_Goal(goal_ptr);
@@ -762,7 +761,7 @@
 
 		if(goal_ptr->Get_Agent_Count() == 0)
 		{
-			AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+			AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 					("\t\tGOAL (goal: %x) -- No agents were committed, maybe next time. Continuing...\n",
 						goal_ptr));
 			continue;
@@ -801,7 +800,7 @@
 #endif
 				if(goal_ptr->Get_Removal_Time())
 				{
-					AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+					AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 						("\t\tGOAL_COMPLETE (goal: %x) -- Removing matches for goal.\n",
 						goal_ptr));
 					Remove_Matches_For_Goal(goal_ptr);
@@ -818,18 +817,18 @@
 				// Optimization: If we have previously failed to get a transport, then skip trying to get a transport now:
 				if (!out_of_transports)
 				{
-					AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+					AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 						("\t\tGOAL_NEEDS_TRANSPORT (goal: %x)\n", goal_ptr));
 
 					if(!Add_Transport_Matches_For_Goal(goal_ptr))
 					{
 						out_of_transports = true; // record the fact we could not find a transport
-						AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+						AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 							("\t\t **NO transporters found. Failing.\n"));
 					}
 					else
 					{
-						AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+						AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 							("\t\t Transporters found.\n"));
 						--goal_iter;
 						committed_agents -= goal_ptr->Get_Agent_Count();
@@ -840,7 +839,7 @@
 			}
 			case GOAL_FAILED:
 			{
-				AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+				AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 					("\t\tGOAL_FAILED (goal: %x)\n", goal_ptr));
 
 				committed_agents -= goal_ptr->Get_Agent_Count();
@@ -894,7 +893,7 @@
 {
 	sint32 goal_type    = new_goal->Get_Goal_Type();
 
-	Sorted_Goal_Iter tmp_goal_iter = 
+	Sorted_Goal_Iter tmp_goal_iter =
 		m_goals_of_type[goal_type].begin();
 
 	while(tmp_goal_iter != m_goals_of_type[goal_type].end())
@@ -957,7 +956,7 @@
 	{
 		agent_iter++;
 	}
-	
+
 	Assert(agent_iter == m_agents.end());
 #endif // _DEBUG_SCHEDULER
 
@@ -1011,7 +1010,7 @@
 // Remark(s)  : Used in ThreatenedCity_MotivationEvent to trigger MOTIVATION_FEAR_CITY_DEFENSE
 //
 //----------------------------------------------------------------------------
-sint32 Scheduler::GetValueUnsatisfiedGoals(const GOAL_TYPE & type) const 
+sint32 Scheduler::GetValueUnsatisfiedGoals(const GOAL_TYPE & type) const
 {
 	sint32 total_value = 0;
 
@@ -1019,13 +1018,13 @@
 	{
 		for
 		(
-		    Sorted_Goal_List::const_iterator 
+		    Sorted_Goal_List::const_iterator
 		        sorted_goal_iter  = m_goals_of_type[type].begin();
 		        sorted_goal_iter != m_goals_of_type[type].end();
 		      ++sorted_goal_iter
 		)
 		{
-			Goal_ptr const goal_ptr = 
+			Goal_ptr const goal_ptr =
 				static_cast<Goal_ptr const>(sorted_goal_iter->second);
 
 			if(goal_ptr->Get_Invalid()		||
@@ -1066,19 +1065,19 @@
 //              MOTIVATION_FEAR_CITY_DEFENSE
 //
 //----------------------------------------------------------------------------
-Goal_ptr Scheduler::GetHighestPriorityGoal(const GOAL_TYPE & type, const bool satisfied) const 
+Goal_ptr Scheduler::GetHighestPriorityGoal(const GOAL_TYPE & type, const bool satisfied) const
 {
-	if(IsValid(type, m_goals_of_type)) 
+	if(IsValid(type, m_goals_of_type))
 	{
 		for
 		(
 		    Sorted_Goal_List::const_iterator
 		        sorted_goal_iter  = m_goals_of_type[type].begin();
-		        sorted_goal_iter != m_goals_of_type[type].end(); 
+		        sorted_goal_iter != m_goals_of_type[type].end();
 		      ++sorted_goal_iter
 		)
 		{
-			Goal_ptr	const	goal_ptr = 
+			Goal_ptr	const	goal_ptr =
 				static_cast<Goal_ptr const>(sorted_goal_iter->second);
 
 			if(goal_ptr->Get_Invalid()                  ||
@@ -1107,8 +1106,8 @@
 ///////////////////////////////////////////////////////////////////////////
 sint16 Scheduler::CountGoalsOfType(const GOAL_TYPE & type) const
 {
-	return IsValid(type, m_goals_of_type) 
-	       ? m_goals_of_type[type].size() 
+	return IsValid(type, m_goals_of_type)
+	       ? m_goals_of_type[type].size()
 	       : 0;
 }
 
@@ -1167,7 +1166,7 @@
 
 			if(goal_ptr->Get_Removal_Time())
 			{
-				AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1, 
+				AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, goal_ptr->Get_Goal_Type(), -1,
 					("\tRemoving Invalid/Completed Goal: %x\n", goal_ptr));
 
 				sorted_goal_iter = Remove_Goal(sorted_goal_iter);
@@ -1468,7 +1467,7 @@
 	{
 		Sorted_Goal_List & goal_list = m_goals_of_type[i];
 
-		SQUAD_CLASS goal_squad_class = 
+		SQUAD_CLASS goal_squad_class =
 				  g_theGoalDB->Get(i)->GetSquadClass();
 
 		if((goal_squad_class & squad_class) != goal_squad_class)
@@ -1499,7 +1498,6 @@
 	goal_ptr->Remove_Matches();
 }
 
-
 void Scheduler::Remove_Matches_For_Agent
 (
     const Agent_ptr & agent
@@ -1533,15 +1531,15 @@
 	AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, -1, -1, ("\n"));
 #endif
 
-	Squad_Strength needed_strength = 
+	Squad_Strength needed_strength =
 		goal->Get_Strength_Needed();
 
 #if defined(_DEBUG) || defined(USE_LOGGING)
-	AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, -1, -1, 
+	AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, -1, -1,
 		("\t\tMissing attack = %3.0f\n",needed_strength.Get_Attack()));
-	AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, -1, -1, 
+	AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, -1, -1,
 		("\t\tMissing transport = %d\n",needed_strength.Get_Transport()));
-	AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, -1, -1, 
+	AI_DPRINTF(k_DBG_SCHEDULER, m_playerId, -1, -1,
 		("\t\tMissing defense = %3.0f\n",needed_strength.Get_Defense()));
 
 #endif
@@ -1621,7 +1619,6 @@
 	Goal_List tmp_list;
 	tmp_list.splice(tmp_list.begin(), m_goals, goal_iter);
 
-
 	while(goal_ptr_iter != m_goals.end())
 	{
 		Utility tmpValue = static_cast<Goal_ptr>(*goal_ptr_iter)->Get_Matching_Value();
@@ -1643,15 +1640,13 @@
 	Assert(goal_type >= 0);
 	Assert(goal_type < g_theGoalDB->NumRecords());
 
-	
 	double tmp_eval = goal_element_ptr->GetMaxEval();
 	double tmp_exec = goal_element_ptr->GetMaxExec();
-	
+
 	if (goal_element_ptr->GetEvalPerCity() ||
 		goal_element_ptr->GetPerCity())
 		tmp_eval *= g_player[m_playerId]->GetNumCities();
 
-	
 	if (goal_element_ptr->GetExecPerCity() ||
 		goal_element_ptr->GetPerCity())
 		tmp_exec *= g_player[m_playerId]->GetNumCities();
@@ -1662,7 +1657,6 @@
 	return goal_type;
 }
 
-
 void Scheduler::DisbandObsoleteArmies(const sint16 max_count)
 {
 	sint32 count = 0;
@@ -1820,7 +1814,7 @@
 	{
 
 #ifdef _DEBUG
-		
+
 	//	Diplomat & diplomat = Diplomat::GetDiplomat(player);
 	//	int test1 = diplomat.TestAlliedRegard(ally);
 	//	int test2 = ((m_allyRegardCache>>ally) & 1) != 0;

Modified: trunk/ctp2_code/ai/strategy/scheduler/scheduler_types.h
==============================================================================
--- trunk/ctp2_code/ai/strategy/scheduler/scheduler_types.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/scheduler/scheduler_types.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,13 +11,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 // - None
 //
 //----------------------------------------------------------------------------
@@ -37,7 +37,6 @@
 
 #include "Goal_And_Squad_Types.h"
 
-
 enum GOAL_RESULT
 {
     GOAL_FAILED,
@@ -62,7 +61,6 @@
 typedef std::pair<Utility, Goal_ptr> Sorted_Goal_ptr;
 typedef std::pair<double, Agent_ptr> Sorted_Agent_ptr;
 
-
 template<class _T1, class _T2>
 bool operator <
 (

Modified: trunk/ctp2_code/ai/strategy/squads/squad_Strength.cpp
==============================================================================
--- trunk/ctp2_code/ai/strategy/squads/squad_Strength.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/squads/squad_Strength.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -2,7 +2,7 @@
 //
 // Project      : Call To Power 2
 // File type    : C++ source
-// Description  : Squad strength object 
+// Description  : Squad strength object
 // Id           : $Id$
 //
 //----------------------------------------------------------------------------
@@ -130,7 +130,7 @@
 	m_value             -= remove_me.m_value;
 	m_transport         -= remove_me.m_transport;
 	m_defenders         -= remove_me.m_defenders;
-	m_ranged            -= remove_me.m_ranged; 
+	m_ranged            -= remove_me.m_ranged;
 	m_land_bombard_str  -= remove_me.m_land_bombard_str;
 	m_water_bombard_str -= remove_me.m_water_bombard_str;
 	m_air_bombard_str   -= remove_me.m_air_bombard_str;
@@ -179,7 +179,7 @@
 	for(sint8 i = m_agent_count; i > 0; --i)
 	{
 		Unit const &	unit	= army->Get(i - 1);
-		
+
 		if(unit.IsValid())
 		{
 			m_value		+= unit.GetDBRec()->GetShieldCost();
@@ -252,7 +252,7 @@
 	for(sint8 i = m_agent_count; i > 0; --i)
 	{
 		Unit const &	unit	= army->Get(i - 1);
-		
+
 		if(unit.IsValid())
 		{
 			m_value		+= unit.GetDBRec()->GetShieldCost();

Modified: trunk/ctp2_code/ai/strategy/squads/squad_Strength.h
==============================================================================
--- trunk/ctp2_code/ai/strategy/squads/squad_Strength.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ai/strategy/squads/squad_Strength.h	Mon May 23 04:21:18 2016	(r1115)
@@ -2,7 +2,7 @@
 //
 // Project      : Call To Power 2
 // File type    : C++ header
-// Description  : Squad strength object 
+// Description  : Squad strength object
 // Id           : $Id$
 //
 //----------------------------------------------------------------------------
@@ -71,14 +71,12 @@
 	Squad_Strength & operator+=(const Squad_Strength & add_me);
 	Squad_Strength & operator-=(const Squad_Strength & remove_me);
 
-
 	sint32 Get_Agent_Count()                    const { return m_agent_count; };
 	void   Set_Agent_Count(const sint32 & count)      { m_agent_count = count; };
 
 	void Add_Agent_Strength(const Agent_ptr & agent);
 	void Remove_Agent_Strength(const Agent_ptr & agent);
 
-
 	void Set_Pos_Strength       (const MapPoint & pos);
 	void Set_Army_Strength      (const Army & army, bool noCargo = false);
 	void Set_Cargo_Strength     (const Army & army);
@@ -106,7 +104,6 @@
 	void Set_Defenders    (const sint8 & units)   { m_defenders         = units;   };
 	void Set_Ranged_Units (const sint8 & units)   { m_ranged            = units;   };
 
-
 	void Set_Force_Matching( const float attack_ratio,
 							 const float defense_ratio,
 							 const float ranged_ratio,
@@ -114,7 +111,6 @@
 							 const float value_ratio );
 	void Set_To_The_Maximum(Squad_Strength);
 
-
 	bool NothingNeeded() const;
 	void Log_Debug_Info(const int & log, sint32 playerId, sint32 goalType, char * text) const;
 	bool HasEnough(const Squad_Strength & otherStrength, bool ignoreBombard = false) const;

Modified: trunk/ctp2_code/ctp/c3.cpp
==============================================================================
--- trunk/ctp2_code/ctp/c3.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/c3.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------

Modified: trunk/ctp2_code/ctp/c3.h
==============================================================================
--- trunk/ctp2_code/ctp/c3.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/c3.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,20 +11,20 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 // _DEBUG
 // - Generate debug version.
 //
 // _DEBUGTOOLS
 // - Provides debug tools (leak reporter, asserts, ...)
 //
-// _MSC_VER		
+// _MSC_VER
 // - Compiler version (for the Microsoft C++ compiler only).
 //
 // __GNUC__
@@ -42,7 +42,7 @@
 // - Prevented useless warnings.
 // - Moved DirectX API-Version to use into "ctp2_config.h"
 // - Added struct for automatic debug tool initialization and
-//   cleanup so that it is the first respective the last thing 
+//   cleanup so that it is the first respective the last thing
 //   that is done in the program. (Oct 3rd 2005 Martin Gühmann)
 //
 //----------------------------------------------------------------------------
@@ -75,7 +75,7 @@
 //#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
 //#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 1
 // Suppress some rediculous MS warnings about "deprecated" standard functions
-#define _SECURE_SCL					0	
+#define _SECURE_SCL					0
 #define _SECURE_SCL_NO_DEPRECATE
 #define _CRT_SECURE_NO_DEPRECATE
 #define _CRT_NONSTDC_NO_DEPRECATE

Modified: trunk/ctp2_code/ctp/c3types.h
==============================================================================
--- trunk/ctp2_code/ctp/c3types.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/c3types.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,14 +11,14 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
-// _MSC_VER		
+//
+// _MSC_VER
 // - Use Microsoft C++ extensions when set.
 //
 //----------------------------------------------------------------------------

Modified: trunk/ctp2_code/ctp/civ3_main.cpp
==============================================================================
--- trunk/ctp2_code/ctp/civ3_main.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/civ3_main.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -182,7 +182,7 @@
 
 #if defined(_DEBUG)
 #include "debug.h"          // Os::SetThreadName
-#endif // _DEBUG 
+#endif // _DEBUG
 
 #include "SlicSegment.h"    // SlicSegment::Cleanup
 
@@ -210,7 +210,6 @@
 #define k_SHARED_SURFACE_HEIGHT     768
 #define k_SHARED_SURFACE_BPP        16
 
-
 #define k_SMOOTH_PIX_SEC_PER_SEC    8.0f
 #define k_SMOOTH_MIN_VELOCITY       4.0f
 #define k_SMOOTH_MAX_VELOCITY       (k_TILE_PIXEL_HEIGHT>>1)
@@ -225,7 +224,6 @@
 sint32                              g_ScreenWidth = 0;
 sint32                              g_ScreenHeight = 0;
 
-
 C3UI                                *g_c3ui = NULL;
 StatusWindow                        *g_statusWindow = NULL;
 aui_Surface                         *g_sharedSurface = NULL;
@@ -233,7 +231,6 @@
 BOOL                                g_smoothScroll = FALSE;
 
 
-
 RECT                                g_backgroundViewport = { 0, 0, 0, 0 };
 sint32                              g_is565Format = TRUE;
 sint32                              g_modalWindow = 0;
@@ -247,22 +244,17 @@
 
 sint32                              g_terrainPollution;
 
-
 Director                            *g_director;
 double                              g_ave_frame_rate = 10.0;
 double                              g_ave_frame_time = 200.0;
 ScreenManager                       *g_screenManager = NULL;
 
-
 TiledMap                            *g_tiledMap = NULL;
 
-
 RadarMap                            *g_radarMap = NULL;
 
-
 CivApp                              *g_civApp = NULL;
 
-
 LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
 
 #ifdef __AUI_USE_SDL__
@@ -275,14 +267,12 @@
 int WINAPI CivMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow);
 #endif
 
-
 Network g_network;
 
 BOOL g_letUIProcess = FALSE;
 BOOL g_useDDBlit = TRUE;
 BOOL g_powerPointsMode = FALSE;
 
-
 BOOL g_exclusiveMode = TRUE;
 BOOL g_hideTaskBar = FALSE;
 BOOL g_useIntroMovie = TRUE;
@@ -291,10 +281,8 @@
 BOOL g_eventLog = FALSE;
 
 
-
 BOOL g_use_profile_process = FALSE;
 
-
 BOOL g_createDirectDrawOnSecondary = FALSE;
 
 /// The whole world is visible at all times, even when unexplored.
@@ -302,7 +290,6 @@
 
 DWORD		g_dxver = 0;
 
-
 bool g_autoAltTab = false;
 
 #define RELDBG(x) { FILE *f = fopen("reldbg.txt", "a"); fprintf x; fclose(f); }
@@ -359,23 +346,23 @@
         std::basic_stringstream<TCHAR>  exeVersion;
 
 #if defined(WIN32)
-        HANDLE		fileHandle	= CreateFile(Os::GetExeName().c_str(), 
+        HANDLE		fileHandle	= CreateFile(Os::GetExeName().c_str(),
 											 GENERIC_READ,
-			                                 FILE_SHARE_READ, 
-											 NULL, 
-											 OPEN_ALWAYS, 
-											 FILE_ATTRIBUTE_NORMAL, 
+			                                 FILE_SHARE_READ,
+											 NULL,
+											 OPEN_ALWAYS,
+											 FILE_ATTRIBUTE_NORMAL,
 											 NULL
 											);
 
-		if (fileHandle != INVALID_HANDLE_VALUE) 
+		if (fileHandle != INVALID_HANDLE_VALUE)
 		{
 			FILETIME	lastWrite;
 			SYSTEMTIME	systemTime;
 
 			if (GetFileTime(fileHandle, NULL, NULL, &lastWrite)		&&
 				FileTimeToSystemTime(&lastWrite, &systemTime)
-			   ) 
+			   )
 			{
                 exeVersion << std::setfill('0')
                            << std::setw(4) << systemTime.wYear  << '-'
@@ -408,7 +395,6 @@
 
 	pixelutils_Initialize();
 
-	
 	MBCHAR ldlfile[_MAX_PATH];
 	g_civPaths->FindFile(C3DIR_LAYOUT, k_LDLName, ldlfile);
 
@@ -430,14 +416,11 @@
 	if (!g_exclusiveMode)
 		main_HideTaskBar();
 
-	
 	g_is565Format = AUI_SURFACE_PIXELFORMAT_565 == g_c3ui->PixelFormat();
 
-	
 	ColorSet::Initialize();
     g_c3ui->RegisterCleanup(&ColorSet::Cleanup);
 
-
 	SPLASH_STRING("Creating Blitter...");
 
 	g_c3ui->RegisterObject(new C3Blitter);
@@ -465,7 +448,7 @@
             g_c3ui->AddImageSearchPath(s);
         }
     }
-	
+
     for (i = 0; g_civPaths->FindPath(C3DIR_PICTURES, i, s); ++i)
     {
         if (s[0])
@@ -475,7 +458,7 @@
             g_c3ui->AddImageSearchPath(s);
         }
     }
-	
+
     for (i = 0; g_civPaths->FindPath(C3DIR_CURSORS, i, s); ++i)
     {
         if (s[0])
@@ -484,7 +467,7 @@
             g_c3ui->AddImageSearchPath(s);
         }
     }
-	
+
     for (i = 0; g_civPaths->FindPath(C3DIR_FONTS, i, s); ++i)
     {
         if (s[0])
@@ -495,7 +478,7 @@
 
 #ifdef WIN32
 	if (!GetWindowsDirectory(s, _MAX_PATH)) {
-		c3errors_FatalDialog(appstrings_GetString(APPSTR_FONTS), 
+		c3errors_FatalDialog(appstrings_GetString(APPSTR_FONTS),
 								appstrings_GetString(APPSTR_NOWINDOWSDIR));
 	}
 	strcat(s, FILE_SEP "fonts");
@@ -545,7 +528,7 @@
 		}
 	}
 #endif
-	
+
     for (i = 0; g_civPaths->FindPath(C3DIR_VIDEOS, i, s); ++i)
     {
         if (s[0])
@@ -555,7 +538,7 @@
     }
 
 	SPLASH_STRING("Creating Mouse...");
-	
+
 	BOOL const mouseExclusiveMode = TRUE;
 	g_c3ui->RegisterObject(aui_Factory::new_Mouse(auiErr, "CivMouse", mouseExclusiveMode));
 
@@ -563,7 +546,6 @@
 
 	g_c3ui->RegisterObject(aui_Factory::new_Keyboard(auiErr));
 
-
 #if !defined(__GNUC__)
 	SPLASH_STRING("Creating Movie manager...");
 	g_c3ui->RegisterObject(new aui_DirectMovieManager());
@@ -574,13 +556,11 @@
 	Assert(auiErr == AUI_ERRCODE_OK);
 	if ( auiErr != AUI_ERRCODE_OK ) return 14;
 
-
-#ifdef WIN32	
+#ifdef WIN32
 	while ( ShowCursor( FALSE ) >= 0 )
 	;
 #endif
 
-
 	return AUI_ERRCODE_OK;
 }
 
@@ -601,9 +581,9 @@
 	else
 	{
 		// Scroll main map (when available)
-		bool isMapScrolled = 
-		    g_civApp->IsGameLoaded() && 
-		    g_tiledMap && 
+		bool isMapScrolled =
+		    g_civApp->IsGameLoaded() &&
+		    g_tiledMap &&
 		    g_tiledMap->ScrollMap(0, 2 * ((delta < 0) ? 1 : -1));
 
 		if(isMapScrolled)
@@ -618,23 +598,19 @@
 
 bool compute_scroll_deltas(sint32 time,sint32 &deltaX,sint32 &deltaY)
 {
-	
+
 	bool retval = true;
 
-	
 	float real_time=(float)time/(1000.0f);
 
-	
 	real_time *= real_time;
 
 	float velocity = std::max<float>
 	    (real_time * 0.5f * k_SMOOTH_PIX_SEC_PER_SEC, k_SMOOTH_MIN_VELOCITY);
 
-	
 	deltaX *= (sint32)velocity;
 	deltaY *= (sint32)velocity;
 
-	
 	sint32 signx = (deltaX < 0 ? -1 : 1);
 	sint32 signy = (deltaY < 0 ? -1 : 1);
 
@@ -643,21 +619,19 @@
 		deltaX = k_SMOOTH_MAX_VELOCITY * signx;
 		retval = false;
 	}
-	
+
 	if (abs(deltaY)> k_SMOOTH_MAX_VELOCITY)
 	{
 		deltaY = k_SMOOTH_MAX_VELOCITY * signy;
 		retval = false;
 	}
 
-
 	deltaX &= 0xFFFFFFFE;
 	deltaY &= 0xFFFFFFFE;
 
 	return retval;
 }
 
-
 bool ui_CheckForScroll(void)
 {
 	if (!g_tiledMap) return false;
@@ -673,7 +647,7 @@
 	s_scrolllasttick = s_scrollcurtick;
 	s_scrollcurtick	 = GetTickCount();
 
-	if (!g_c3ui->TheMouse()) 
+	if (!g_c3ui->TheMouse())
 		return false;
 
 	sint32 x = g_c3ui->TheMouse()->X();
@@ -682,7 +656,7 @@
 	static bool     isMouseScrolling            = false;
 	static sint32   smoothX                     = 0;
 	static sint32   smoothY                     = 0;
-	static sint32	lastdeltaX                  = 0; 
+	static sint32	lastdeltaX                  = 0;
 	static sint32	lastdeltaY                  = 0;
 	static bool     scrolled_last_time          = false;
 	static uint32   scroll_start;
@@ -693,23 +667,22 @@
 	sint32	deltaX = 0,
 			deltaY = 0;
 
-
 	CURSORINDEX		scrollCursor = CURSORINDEX_DEFAULT;
 
 
 
-	
-	
-	
-	
-	
-	
+
+
+
+
+
+
 	bool        scrolled = false;
 
 	if (g_civApp->IsKeyboardScrolling() &&
-		(!g_c3ui->TopWindow() || !g_c3ui->TopWindow()->GetFocusControl())) 
+		(!g_c3ui->TopWindow() || !g_c3ui->TopWindow()->GetFocusControl()))
 	{
-		switch (g_civApp->GetKeyboardScrollingKey()) 
+		switch (g_civApp->GetKeyboardScrollingKey())
 		{
 		case AUI_KEYBOARD_KEY_UPARROW:
 			deltaX = 0;
@@ -733,17 +706,17 @@
 			break;
 		}
 
-		if (scrolled) 
+		if (scrolled)
 		{
 			aui_Window *topWindow = g_c3ui ? g_c3ui->TopWindow() : NULL;
 
-			if (topWindow && g_controlPanel) 
+			if (topWindow && g_controlPanel)
             {
-				if (topWindow != g_controlPanel->GetWindow() && 
-                    topWindow != g_statusWindow && 
-                    topWindow != g_radarWindow && 
+				if (topWindow != g_controlPanel->GetWindow() &&
+                    topWindow != g_statusWindow &&
+                    topWindow != g_radarWindow &&
                     topWindow != g_controlPanel->GetMenuBar()
-                   ) 
+                   )
                 {
 					return false;
 				}
@@ -760,10 +733,10 @@
 
 			return true;
 		}
-	} 
-	else 
+	}
+	else
 	{
-		if (x<4) 
+		if (x<4)
 		{
 			deltaX = -1;
 			deltaY = 0;
@@ -771,7 +744,7 @@
 			scrollCursor = CURSORINDEX_SCROLLLEFT;
 			isMouseScrolling = true;
 		}
-		else if (x > (g_ScreenWidth-4)) 
+		else if (x > (g_ScreenWidth-4))
 		{
 			deltaX = 1;
 			deltaY = 0;
@@ -780,7 +753,7 @@
 		    isMouseScrolling = true;
 		}
 
-		if (y <= 2) 
+		if (y <= 2)
 		{
 			deltaX = 0;
 			deltaY = -1;
@@ -788,7 +761,7 @@
 			scrollCursor = CURSORINDEX_SCROLLUP;
 			isMouseScrolling = true;
 		}
-		else if (y >= (g_ScreenHeight-2)) 
+		else if (y >= (g_ScreenHeight-2))
 		{
 			deltaX = 0;
 			deltaY = 1;
@@ -796,15 +769,14 @@
 			scrollCursor = CURSORINDEX_SCROLLDOWN;
 		    isMouseScrolling = true;
 		}
-		
-		
+
 
 		if(scrolled) {
 			if (isMouseScrolling)
 				g_cursorManager->SetCursor(scrollCursor);
 
 			if(!scrolled_last_time) {
-				scroll_start = GetTickCount();			
+				scroll_start = GetTickCount();
 			}
 
 			if(GetTickCount() < scroll_start + g_theProfileDB->GetScrollDelay() * 100) {
@@ -818,9 +790,9 @@
 		}
 	}
 
-	if (scrolled) 
+	if (scrolled)
 	{
-		
+
 		if (deltaX)
 			smoothY = deltaY = 0;
 		else
@@ -829,29 +801,24 @@
 		lastdeltaX = deltaX;
 		lastdeltaY = deltaY;
 
-		
-	   	
-	   	
+
+
+
 		g_tiledMap->SetScrolling(true);
 
-		
 		uint32 accellTickDelta = s_scrollcurtick - s_accelTickStart;
 
-		
 		if ((smoothY == 0) && (smoothX == 0))
 		{
-			
+
 			s_accelTickStart = s_scrollcurtick;
 
-			
 			accellTickDelta = 0;
 		}
 
-		
 		sint32 accel = (accellTickDelta/k_TICKS_PER_ACCELERATION)+1;
 
 
-		
         smoothX = std::min<sint32>(deltaX * accel, hscroll);
         smoothY = std::min<sint32>(deltaY * accel, vscroll);
 
@@ -866,11 +833,11 @@
 	  		g_tiledMap->ScrollMap(deltaX, deltaY);
 
 	}
-	else 
+	else
     {
 		s_scrolltime = k_SMOOTH_START_TIME;
 
-		if (isMouseScrolling) 
+		if (isMouseScrolling)
         {
 			g_cursorManager->SetCursor(CURSORINDEX_DEFAULT);
 		    isMouseScrolling = false;
@@ -890,13 +857,13 @@
     uint32			curTicks    = Os::GetTicks();
 	static uint32	lastTicks   = curTicks;
 
-	if (ui_CheckForScroll()) 
+	if (ui_CheckForScroll())
     {
-		do 
+		do
         {
 			g_tiledMap->CopyMixDirtyRects(g_background->GetDirtyList());
 			g_c3ui->Draw();
-		} 
+		}
         while (ui_CheckForScroll());
 
 		g_tiledMap->RetargetTileSurface(NULL);
@@ -904,25 +871,24 @@
 		g_tiledMap->InvalidateMap();
 
 		lastTicks = curTicks;
-	} 
-    else if (curTicks > lastTicks + k_TICKS_PER_GENERIC_FRAME) 
+	}
+    else if (curTicks > lastTicks + k_TICKS_PER_GENERIC_FRAME)
     {
 		g_tiledMap->RestoreMixFromMap(g_background->TheSurface());
 		g_background->Draw();
-		
+
 		lastTicks = curTicks;
 	}
-	
+
 	g_c3ui->Process();
 
 	return 0;
 }
 
 
-
-sint32 sharedsurface_Initialize( void ) 
+sint32 sharedsurface_Initialize( void )
 {
-	
+
 	AUI_ERRCODE errcode = AUI_ERRCODE_OK;
 	return errcode; // Return ends code here needs to be considered if g_sharedSurface is really needed
 
@@ -946,11 +912,11 @@
 }
 
 int sprite_Initialize(void)
-{	
+{
 	g_screenManager = new ScreenManager();
 
 	spritegrouplist_Initialize();
-	
+
 	g_director = new Director();
 
 	return 0;
@@ -960,7 +926,6 @@
 {
 
 
-
 	return 0;
 }
 
@@ -972,10 +937,9 @@
     allocated::clear(g_screenManager);
 }
 
-
 void ZoomPad_ZoomCallback()
 {
-	
+
 	MainControlPanel::UpdateZoom();
 }
 
@@ -983,24 +947,22 @@
 {
 	g_tiledMap = new TiledMap(*g_theWorld->GetSize());
 
-	
-	ZoomPad_ZoomCallback();		
+	ZoomPad_ZoomCallback();
 	g_tiledMap->SetZoomCallback(ZoomPad_ZoomCallback);
 
 	g_tiledMap->LoadTileset();
 
-
 	if (!isRestoring)
 		g_tiledMap->PostProcessMap();
 
-	RECT rect = 
+	RECT rect =
 	{
-		g_background->X(), 
-		g_background->Y(), 
+		g_background->X(),
+		g_background->Y(),
 		g_background->X() + g_background->Width(),
-		g_background->Y() + g_background->Height() 
+		g_background->Y() + g_background->Height()
 	};
-	
+
 	g_tiledMap->Initialize(&rect);
 
 	g_tiledMap->Refresh();
@@ -1025,7 +987,6 @@
 	return g_civApp->LoadSavedGame(filename);
 }
 
-
 int main_Restart()
 {
 	return g_civApp->RestartGame();
@@ -1079,7 +1040,7 @@
     Mix_CloseAudio();
 # endif
 	g_mouseShouldTerminateThread = TRUE;
-	
+
 	// Destroy the mutex used for the secondary keyboard event queue
 #ifdef __AUI_USE_SDL__
 	SDL_DestroyMutex(g_secondaryKeyboardEventQueueMutex);
@@ -1090,11 +1051,11 @@
 #endif
 }
 
-BOOL g_no_timeslice; 
-BOOL g_no_shell;  
-BOOL g_no_exit_action; 
+BOOL g_no_timeslice;
+BOOL g_no_shell;
+BOOL g_no_exit_action;
 BOOL g_cmdline_load;
-char g_cmdline_load_filename[160]; 
+char g_cmdline_load_filename[160];
 sint32 g_cheat_age;
 
 
@@ -1132,7 +1093,6 @@
 	szCmdLine[k_MAX_CMD_LINE-1]='\0';
 #endif // WIN32
 
-
 	char * archive_file = strstr(szCmdLine, "-l");
 
 	if (NULL == archive_file)
@@ -1141,7 +1101,7 @@
 	}
 	else
 	{
-		g_cmdline_load = TRUE; 
+		g_cmdline_load = TRUE;
 		g_useIntroMovie = FALSE;
 		g_no_shell = TRUE;
 
@@ -1153,14 +1113,14 @@
 			archive_file++;
 			gotQuote = TRUE;
 		}
-		
+
 		sint32 i;
 
 		// space or end of string mark end of the file name
-		for (i=0; i<160 &&  (0 != *archive_file) && 
+		for (i=0; i<160 &&  (0 != *archive_file) &&
 				 (((!gotQuote && ' ' != *archive_file)) ||
-				  (gotQuote && '"' != *archive_file)); i++, archive_file++) { 
-			g_cmdline_load_filename[i] = *archive_file; 
+				  (gotQuote && '"' != *archive_file)); i++, archive_file++) {
+			g_cmdline_load_filename[i] = *archive_file;
 		}
 
 		if (160 <= i)
@@ -1169,20 +1129,17 @@
 		}
 		else
 		{
-			g_cmdline_load_filename[i] = 0; 
+			g_cmdline_load_filename[i] = 0;
 		}
 	}
 
-	
 	MBCHAR * scenName = strstr(szCmdLine, "-s");
 
-	if (NULL != scenName) { 
-		
+	if (NULL != scenName) {
+
 
-		
 		scenName += 2;
 
-		
 		sint32		i;
 
 		for (i=0; i<k_SCENARIO_NAME_MAX && *scenName != '\0'; i++, scenName++)
@@ -1204,18 +1161,17 @@
 
 	g_no_timeslice = (NULL != strstr(szCmdLine, "notimeslice"));
 	if(!g_cmdline_load)
-		g_no_shell =  (NULL != strstr(szCmdLine, "noshell")); 
-	g_no_exit_action = (NULL != strstr(szCmdLine, "noexitaction")); 
+		g_no_shell =  (NULL != strstr(szCmdLine, "noshell"));
+	g_no_exit_action = (NULL != strstr(szCmdLine, "noexitaction"));
 	g_exclusiveMode = !(NULL != strstr(szCmdLine, "nonexclusive"));
 	g_hideTaskBar = (NULL != strstr(szCmdLine, "hidetaskbar"));
 	if(!g_cmdline_load)
 		g_useIntroMovie = !(NULL != strstr(szCmdLine, "nointromovie"));
 	g_noAssertDialogs = (NULL != strstr(szCmdLine, "noassertdialogs"));
 	g_runInBackground = (NULL != strstr(szCmdLine, "runinbackground"));
-	
+
 	g_eventLog = (NULL != strstr(szCmdLine, "eventlog"));
 
-	
 	g_createDirectDrawOnSecondary = (NULL != strstr(szCmdLine, "multimon"));
 	g_autoAltTab = (NULL != strstr(szCmdLine, "autoalttab"));
 
@@ -1254,9 +1210,9 @@
 int WINAPI main_filehelper_GetOS(void)
 {
 	OSVERSIONINFO osvi;
-	
+
 	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-	
+
 	GetVersionEx( &osvi );
 
 	return osvi.dwPlatformId;
@@ -1269,8 +1225,8 @@
 #if defined(_DEBUG) || defined(USE_LOGGING)
 
 	MBCHAR * s;
-	
-	switch (pException->ExceptionRecord->ExceptionCode) 
+
+	switch (pException->ExceptionRecord->ExceptionCode)
 	{
 	case EXCEPTION_ACCESS_VIOLATION:        s = "Access Violation";                break;
 	case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:   s = "Array Bounds Exceeded";           break;
@@ -1305,14 +1261,14 @@
 #else // _DEBUG
 
 #ifdef _BFR_
-	if (g_logCrashes) 
+	if (g_logCrashes)
 #endif
 	{
 		FILE * crashLog = fopen("logs" FILE_SEP "crash.txt", "w");
 		if (!crashLog)
 			crashLog = fopen("crash.txt", "w");
 
-		if (crashLog) 
+		if (crashLog)
         {
             fprintf(crashLog, "Version %s\n", Os::GetExeVersion().c_str());
 			fprintf(crashLog, "%s\n", c3debug_ExceptionStackTrace(pException));
@@ -1331,10 +1287,9 @@
 {
 	BOOL found = FALSE;
 
-	
 	HANDLE dll = LoadLibrary( "dll" FILE_SEP "util" FILE_SEP "dxver" );
 	if ( dll ) {
-		
+
 		typedef BOOL (WINAPI *FuncType)( DWORD *pVersion );
 		FuncType GetDirectXVersion = (FuncType)GetProcAddress( (HINSTANCE)dll, "MicrosoftDirectXInstalled" );
 		if ( !GetDirectXVersion )
@@ -1343,7 +1298,6 @@
 			return AUI_ERRCODE_HACK;    /// @todo Check: effectively this means true???
 		}
 
-		
 		if(GetDirectXVersion( &g_dxver ) > 0) {
 			found = TRUE;
 		}
@@ -1387,7 +1341,7 @@
 
 	DPRINTF(k_DBG_FIX, ("** BUILD EXE :%s\n", Os::GetExeName().c_str()));
 
-	HANDLE fileHandle = CreateFile(Os::GetExeName().c_str(), 
+	HANDLE fileHandle = CreateFile(Os::GetExeName().c_str(),
 	                               GENERIC_READ,
 	                               FILE_SHARE_READ,
 	                               NULL,
@@ -1476,7 +1430,7 @@
 {
 	int const   r = CivMain(argc, argv);
 
-	if (r < 0) 
+	if (r < 0)
 	{
 		DoFinalCleanup(r);
 	}
@@ -1520,13 +1474,12 @@
 
 #endif // __GNUC__
 
-
 void main_DisplayPatchDisclaimer()
 {
 	bool    isDisclaimerShown   = false;
 	FILE *  f                   = fopen(k_DisclaimerName, "rb");
 
-	if (f && (0 == fseek(f, 0, SEEK_END))) 
+	if (f && (0 == fseek(f, 0, SEEK_END)))
 	{
 		long const  positionEnd = ftell(f);
 
@@ -1562,7 +1515,7 @@
 #if defined(__GNUC__)
 int CivMain
 (
-	int		    iCmdShow,   // argc 
+	int		    iCmdShow,   // argc
 	char **	    pSzCmdLine   // argv
 )
 {
@@ -1574,28 +1527,28 @@
 
 	HWND hwnd = FindWindow (gszMainWindowClass, gszMainWindowName);
 	if (hwnd) {
-		
+
 		if (IsIconic(hwnd)) {
 			ShowWindow(hwnd, SW_RESTORE);
 		}
 		SetForegroundWindow (hwnd);
-		
+
 		return FALSE;
 	}
 #endif // __GNUC__
-	
+
 #ifdef WIN32
 	char exepath[_MAX_PATH];
-	if (GetModuleFileName(NULL, exepath, _MAX_PATH) != 0) 
+	if (GetModuleFileName(NULL, exepath, _MAX_PATH) != 0)
 	{
 		ctpregistry_SetKeyValue(HKEY_CLASSES_ROOT,
 								".c2g",
 								NULL,
 								"c2gfile");
-	
+
 		ctpregistry_SetKeyValue(HKEY_CLASSES_ROOT,
 								"c2gfile",
-								NULL, 
+								NULL,
 								"Call to Power 2 saved game");
 
 		char launchcommand[_MAX_PATH];
@@ -1605,7 +1558,7 @@
 								"c2gfile\\Shell\\Open\\command",
 								NULL,
 								launchcommand);
-			
+
 		char * lastbackslash = strrchr(exepath, FILE_SEPC);
 		if(lastbackslash) {
 			*lastbackslash = 0;
@@ -1630,18 +1583,17 @@
 	}
 #endif
 
-	
 #if defined(_DEBUG) || defined(USE_LOGGING)
 	main_InitializeLogs();
 #endif
 #if !defined(_DEBUG) && !defined(_BFR_)
-	
+
 	SECURITY_ATTRIBUTES		sa;
 
 	sa.nLength = sizeof(sa);
 	sa.lpSecurityDescriptor = NULL;
 	sa.bInheritHandle = TRUE;
-	
+
 	CreateDirectory((LPCTSTR)"logs", &sa);
 #endif
 
@@ -1660,22 +1612,18 @@
 		Scenario		*scen;
 
 		if (g_civScenarios->FindScenarioFromSaveFile(g_cmdline_load_filename, &pack, &scen)) {
-			
+
 			g_civPaths->SetCurScenarioPath(scen->m_path);
-			
-			
+
 			g_civPaths->SetCurScenarioPackPath(pack->m_path);
-			
-			
+
 			g_theProfileDB->SetIsScenario(TRUE);
 
-			
 			if (g_civScenarios->ScenarioHasSavedGame(scen)) {
-				
+
 				spnewgamescreen_scenarioExitCallback(NULL, 0, NULL, NULL);
 			} else {
-				
-				
+
 				spnewgamescreen_displayMyWindow();
 			}
 		} else {
@@ -1683,28 +1631,24 @@
 		}
 	} else if (g_no_shell) {
 		g_civApp->QuickInit(hInstance, iCmdShow);
-	} else if (g_launchScenario) {	
+	} else if (g_launchScenario) {
 		g_civApp->InitializeApp(hInstance, iCmdShow);
 		ScenarioPack	*pack;
 		Scenario		*scen;
 
 		if (g_civScenarios->FindScenario(g_scenarioName, &pack, &scen)) {
-			
+
 			g_civPaths->SetCurScenarioPath(scen->m_path);
-			
-			
+
 			g_civPaths->SetCurScenarioPackPath(pack->m_path);
-			
-			
+
 			g_theProfileDB->SetIsScenario(TRUE);
 
-			
 			if (g_civScenarios->ScenarioHasSavedGame(scen)) {
-				
+
 				spnewgamescreen_scenarioExitCallback(NULL, 0, NULL, NULL);
 			} else {
-				
-				
+
 				spnewgamescreen_displayMyWindow();
 			}
 		}
@@ -1743,22 +1687,22 @@
 			}
 			if (SDL_QUIT == event.type)
 				gDone = TRUE;
-			
+
 			// If a keyboard event then we must reenqueue it so that aui_sdlkeyboard has a chance to look at it
 			if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) {
 				if (-1==SDL_LockMutex(g_secondaryKeyboardEventQueueMutex)) {
 					fprintf(stderr, "[CivMain] SDL_LockMutex failed: %s\n", SDL_GetError());
 					break;
 				}
-				
+
 				g_secondaryKeyboardEventQueue.push(event);
-				
+
 				if (-1==SDL_UnlockMutex(g_secondaryKeyboardEventQueueMutex)) {
 					fprintf(stderr, "[CivMain] SDL_UnlockMutex failed: %s\n", SDL_GetError());
 					break;
 				}
 			}
-			
+
 			SDLMessageHandler(event);
 #else // __AUI_USE_SDL__
 
@@ -1984,17 +1928,17 @@
 
 //for the keys below set swallowNextChar
 
-                        case SDLK_BACKSPACE: 
+                        case SDLK_BACKSPACE:
 				wp = '\b' + 128;
                                 ui_HandleKeypress(wp, 0);
                                 swallowNextChar = TRUE;
 				break;
-                        case SDLK_TAB: 
+                        case SDLK_TAB:
 				wp = '\t' + 128;
                                 ui_HandleKeypress(wp, 0);
                                 swallowNextChar = TRUE;
 				break;
-                        case SDLK_RETURN: 
+                        case SDLK_RETURN:
 				wp = '\r' + 128;
                                 ui_HandleKeypress(wp, 0);
                                 swallowNextChar = TRUE;
@@ -2053,7 +1997,6 @@
 	case SDL_QUIT:
 		gDone = TRUE;
 
-		
 		DoFinalCleanup();
 
 #ifndef __AUI_USE_SDL__
@@ -2071,7 +2014,7 @@
 			ui_HandleMouseWheel(dir);
 		}
 
-	case WM_VSCROLL: 
+	case WM_VSCROLL:
 		{
 		sint16 scrollCode = LOWORD(wParam);
 		if (scrollCode == SB_LINEDOWN) {
@@ -2098,12 +2041,12 @@
 //                  }
 //              else if (event.button.button == SDL_BUTTON_WHEELDOWN)
 //  			ui_HandleMouseWheel((sint16)-1);
-        
+
              break;
 	}
-	
+
         //lynx: is a last default handling missing here??? DefWindowProc()
- 
+
 	return 0;
 #endif
 }
@@ -2118,7 +2061,7 @@
 
 	static bool swallowNextChar = false;
 
-	switch (iMsg) 
+	switch (iMsg)
 	{
 	case WM_CHAR:
 		if (!swallowNextChar)
@@ -2127,9 +2070,9 @@
 		}
 		swallowNextChar = false;
 		break;
-		
+
 	case WM_KEYDOWN:
-		switch (wParam) 
+		switch (wParam)
 		{
 		case VK_F1:
 		case VK_F2:
@@ -2180,7 +2123,7 @@
 		}
 		break;
 	case WM_SYSKEYDOWN:
-		
+
 		if(wParam == VK_F10) {
 			if(!(GetKeyState(VK_SHIFT) & 0x8000)) {
 				ui_HandleKeypress(wParam - VK_F10 + '0' + 128, lParam);
@@ -2204,14 +2147,14 @@
 			ui_HandleMouseWheel(dir);
 		}
 
-	case WM_VSCROLL: 
+	case WM_VSCROLL:
 		{
 			sint16 scrollCode = LOWORD(wParam);
-			if (scrollCode == SB_LINEDOWN) 
+			if (scrollCode == SB_LINEDOWN)
 			{
 				ui_HandleMouseWheel((sint16)-1);
 			}
-			else if (scrollCode == SB_LINEUP) 
+			else if (scrollCode == SB_LINEUP)
 			{
 				ui_HandleMouseWheel((sint16)1);
 			}
@@ -2232,19 +2175,19 @@
 	static double   fr_decay        = 0.85;
 	static uint32   g_old_last_tick = Os::GetTicks();
 
-	uint32          new_tick        = Os::GetTicks(); 
+	uint32          new_tick        = Os::GetTicks();
 	double          d               = double(new_tick) - double(g_old_last_tick);
 
 	g_old_last_tick = new_tick;
 
-	if (d < 1.0) 
-		return; 
+	if (d < 1.0)
+		return;
 
 	g_ave_frame_time = fr_decay * g_ave_frame_time + (1.0 - fr_decay) * d;
 	g_ave_frame_rate = fr_decay * g_ave_frame_rate + (1.0 - fr_decay) * (1000.0/d);
 
 	char str[80];
-	sprintf(str, "ave frame rate %4.2f/sec - ave frame time %5.1fms", 
+	sprintf(str, "ave frame rate %4.2f/sec - ave frame time %5.1fms",
 	        g_ave_frame_rate, g_ave_frame_time
 	       );
 	primitives_DrawText(surf, 100, 100, str, 1, 0);

Modified: trunk/ctp2_code/ctp/civ3_main.h
==============================================================================
--- trunk/ctp2_code/ctp/civ3_main.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/civ3_main.h	Mon May 23 04:21:18 2016	(r1115)
@@ -10,13 +10,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 //----------------------------------------------------------------------------
 //
 // Modifications from the original Activision code:
@@ -34,16 +34,13 @@
 #ifndef __CIV3_MAIN_H__
 #define __CIV3_MAIN_H__
 
-
-#define k_TICKS_PER_GENERIC_FRAME	100 
-#define k_TICKS_PER_SCROLL_FRAME	50	
-
+#define k_TICKS_PER_GENERIC_FRAME	100
+#define k_TICKS_PER_SCROLL_FRAME	50
 
 #define _NO_GAME_WATCH
 
 class aui_Surface;
 
-
 int ui_Initialize(void);
 int ui_Process(void);
 bool ui_CheckForScroll(void);
@@ -68,9 +65,8 @@
 
 int radar_Initialize(void);
 
-
 void DoFinalCleanup(int exitCode = -1);
 
 BOOL ExitGame(void);
 
-#endif 
+#endif

Modified: trunk/ctp2_code/ctp/civapp.cpp
==============================================================================
--- trunk/ctp2_code/ctp/civapp.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/civapp.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -26,7 +26,7 @@
 // - Generates extra memory debug information when both set, and _DEBUG set.
 //
 // _NO_GAME_WATCH
-// - Generates a game watch file when not set.  
+// - Generates a game watch file when not set.
 //
 // USE_SDL
 // - Use SDL as replacement for DirectX.
@@ -41,9 +41,9 @@
 //
 // - Keep the user's leader name when the data is consistent.
 // - Skip begin turn handling when loading from a file.
-// - Fixed a repetitive memory leak in the Great Libary caused by 
+// - Fixed a repetitive memory leak in the Great Libary caused by
 //   scenario loading, by Martin Gühmann.
-// - Removed some redundant code, because it is already done 
+// - Removed some redundant code, because it is already done
 //   somewhere else, by Martin Gühmann.
 //
 //----------------------------------------------------------------------------
@@ -55,7 +55,7 @@
 //   more details  _____ by MrBaggins Jan-04
 //
 //   * Reordered parsing of CTPDatabase templated classes to ensure that
-//     parsing Advances and Governments would occur before other DBs using 
+//     parsing Advances and Governments would occur before other DBs using
 //     GovernmentsModified, to ensure that Governments would be able to be
 //     inspected by those other database classes.
 //
@@ -63,7 +63,7 @@
 //
 // - When quitting to New Game, go to main menu rather than SP screen
 // - Removed cleanup code for SP screen (JJB)
-// - Removed some of Martin's library cleanup code, after correcting the 
+// - Removed some of Martin's library cleanup code, after correcting the
 //   problem at the root in GreatLibrary.cpp.
 // - Used the new ColorSet option to select civilisation colors.
 // - Memory leak repaired: clean up the turn counter override information.
@@ -79,7 +79,7 @@
 // - Replaced old civilisation database by new one. (Aug 22nd 2005 Martin Gühmann)
 // - Made progress bar more fluently. (Aug 22nd 2005 Martin Gühmann)
 // - Removed the old endgame and installation databases. (Aug 29th 2005 Martin Gühmann)
-// - Removed old sprite state databases, removed olf good's icon 
+// - Removed old sprite state databases, removed olf good's icon
 //   database (unused), replaced old risk database by new one. (Aug 29th 2005 Martin Gühmann)
 // - The right color set is now selected afterwards the ProfileDB is available. (Aug 29th 2005 Martin Gühmann)
 // - Added cleanup of gaia controller and info window. (Sep 13th 2005 Martin Gühmann)
@@ -276,7 +276,7 @@
 #ifndef _NO_GAME_WATCH
 #include "GameWatch.h"
 #include "GWCiv.h"
-#endif 
+#endif
 
 #ifdef LINUX
 #include <time.h>
@@ -327,7 +327,7 @@
 extern MBCHAR g_government_filename[_MAX_PATH];
 extern MBCHAR g_governmenticondb_filename[_MAX_PATH]; // Empty slot
 extern MBCHAR g_wonder_filename[_MAX_PATH];
-extern MBCHAR g_constdb_filename[_MAX_PATH]; 
+extern MBCHAR g_constdb_filename[_MAX_PATH];
 extern MBCHAR g_pop_filename[_MAX_PATH];
 extern MBCHAR g_civilisation_filename[_MAX_PATH];
 extern MBCHAR g_agedb_filename[_MAX_PATH];
@@ -339,7 +339,7 @@
 extern MBCHAR g_mapicondb_filename[_MAX_PATH]; // New map icon database
 extern MBCHAR g_tileimprovementdb_filename[_MAX_PATH];
 extern MBCHAR g_spritestatedb_filename[_MAX_PATH];
-extern MBCHAR g_specialeffectdb_filename[_MAX_PATH];	
+extern MBCHAR g_specialeffectdb_filename[_MAX_PATH];
 extern MBCHAR g_specialattackinfodb_filename[_MAX_PATH];
 extern MBCHAR g_goodsspritestatedb_filename[_MAX_PATH];
 extern MBCHAR g_cityspritestatedb_filename[_MAX_PATH];
@@ -363,7 +363,7 @@
 extern MBCHAR g_orderdb_filename[_MAX_PATH];
 extern MBCHAR g_mapdb_filename[_MAX_PATH];
 extern MBCHAR g_playlistdb_filename[_MAX_PATH];
-extern MBCHAR g_branchdb_filename[_MAX_PATH];	
+extern MBCHAR g_branchdb_filename[_MAX_PATH];
 extern MBCHAR g_endgameicondb_filename[_MAX_PATH]; // Empty slot
 extern MBCHAR g_citysize_filename[_MAX_PATH];
 extern MBCHAR g_featdb_filename[_MAX_PATH];
@@ -383,7 +383,6 @@
 extern MBCHAR g_diplomacy_proposal_filename[_MAX_PATH];
 extern MBCHAR g_diplomacy_threat_filename[_MAX_PATH];
 
-
 ProjectFile *g_GreatLibPF = NULL;
 ProjectFile *g_ImageMapPF = NULL;
 ProjectFile *g_SoundPF = NULL;
@@ -398,7 +397,7 @@
 
 #ifndef _NO_GAME_WATCH
 int g_gameWatchID = -1;
-#endif 
+#endif
 
 void InitializeGreatLibrary();
 void InitializeSoundPF();
@@ -426,9 +425,9 @@
 {
     MBCHAR          path[_MAX_PATH];
 
-    for (int i = 0; g_civPaths->FindPath(a_Type, i++, path); ) 
+    for (int i = 0; g_civPaths->FindPath(a_Type, i++, path); )
     {
-        if (path[0]) 
+        if (path[0])
         {
             // The directory, for looking up "loose" files
             a_ProjectFile->addPath(path);
@@ -455,9 +454,9 @@
 {
     MBCHAR          path[_MAX_PATH];
 
-    for (int i = 0; g_civPaths->FindPath(a_Type, i++, path); ) 
+    for (int i = 0; g_civPaths->FindPath(a_Type, i++, path); )
     {
-        if (path[0]) 
+        if (path[0])
         {
             // A predefined packed file in the directory
             strcat(path, FILE_SEP);
@@ -480,7 +479,7 @@
 //
 // Returns    : -
 //
-// Remark(s)  : The top directories (ctp2_data-style) are read from a 
+// Remark(s)  : The top directories (ctp2_data-style) are read from a
 //              semicolon-separated string 'Rulesets' in userprofile.txt.
 //
 //----------------------------------------------------------------------------
@@ -496,7 +495,7 @@
 	for (size_t	toDo = ruleSetSize; toDo > 0; )
 	{
 		pathStarts.push_back(nextPath);
-		nextPath = std::find(nextPath, nextPath + toDo, PATH_SEPC); 
+		nextPath = std::find(nextPath, nextPath + toDo, PATH_SEPC);
 
 		if (nextPath < ruleSets + ruleSetSize)
 		{
@@ -509,7 +508,7 @@
 		}
 	}
 
-	for 
+	for
 	(
 	    std::vector<MBCHAR *>::reverse_iterator p  = pathStarts.rbegin();
 	    p != pathStarts.rend();
@@ -579,20 +578,18 @@
 	}
 } // namespace Os
 
-
 void check_leak()
 {
 #ifdef _DEBUG
 	if (g_tempLeakCheck)
 	{
-		_CrtMemState new_state; 
+		_CrtMemState new_state;
 		_CrtMemCheckpoint(&new_state);
 		Assert(g_allocatedAtStart == new_state.lSizes[1]);
 		g_allocatedAtStart = new_state.lSizes[1];
 	}
 #endif
-}	
-
+}
 
 CivApp::CivApp()
 :
@@ -613,14 +610,14 @@
 	NETFunc::GameType	= GAMEID;				// CTP2 game id for Anet
 	NETFunc::DllPath	= "dll" FILE_SEP "net";	// Anet DLLs are in dll\net (relative to executable)
 
-	if (g_useIntroMovie && !g_no_shell) 
+	if (g_useIntroMovie && !g_no_shell)
 	{
   		intromoviewin_Initialize();
     	intromoviewin_DisplayIntroMovie();
-	} 
-	else 
+	}
+	else
 	{
-		if (g_soundManager) 
+		if (g_soundManager)
 		{
 			g_soundManager->EnableMusic();
 			g_soundManager->PickNextTrack();
@@ -747,7 +744,7 @@
 	g_theWonderMovieDB          = new CTPDatabase<WonderMovieRecord>;
 
     // Firstly get the string database up and running - so we can display texts
-    if (!g_theStringDB->Parse(g_stringdb_filename)) 
+    if (!g_theStringDB->Parse(g_stringdb_filename))
     {
         return false;
     }
@@ -764,7 +761,6 @@
 
 	g_theProgressWindow->StartCountingTo( 20 );
 
-    
 	if (strcmp(g_mapicondb_filename, ""))   // May not exist for mods
 	{
 		if (!g_theMapIconDB->Parse(C3DIR_GAMEDATA, g_mapicondb_filename))
@@ -782,9 +778,9 @@
 
 	g_theProgressWindow->StartCountingTo( 40 );
 
-	if (!g_theConstDB->Parse(C3DIR_GAMEDATA, g_constdb_filename)) 
+	if (!g_theConstDB->Parse(C3DIR_GAMEDATA, g_constdb_filename))
     {
-		return false; 
+		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 50 );
@@ -840,7 +836,7 @@
 
 	if (!g_theAdvanceDB->Parse(C3DIR_GAMEDATA, g_advancedb_filename))
     {
-		return false; 
+		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 130 );
@@ -852,14 +848,14 @@
 
 	g_theProgressWindow->StartCountingTo( 140 );
 
-	if (!g_theUnitDB->Parse(C3DIR_GAMEDATA, g_unitdb_filename)) 
+	if (!g_theUnitDB->Parse(C3DIR_GAMEDATA, g_unitdb_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 150 );
 
-	if (!g_theDifficultyDB->Parse(C3DIR_GAMEDATA, g_difficultydb_filename)) 
+	if (!g_theDifficultyDB->Parse(C3DIR_GAMEDATA, g_difficultydb_filename))
     {
 		ExitGame();
 		return false;
@@ -867,7 +863,7 @@
 
 	g_theProgressWindow->StartCountingTo( 160 );
 
-	if (!g_theAgeDB->Parse(C3DIR_GAMEDATA, g_agedb_filename)) 
+	if (!g_theAgeDB->Parse(C3DIR_GAMEDATA, g_agedb_filename))
     {
 		ExitGame();
 		return false;
@@ -879,7 +875,7 @@
 
 	g_theProgressWindow->StartCountingTo( 180 );
 
-	if (!g_theConceptDB->Parse(C3DIR_GAMEDATA, g_conceptdb_filename)) 
+	if (!g_theConceptDB->Parse(C3DIR_GAMEDATA, g_conceptdb_filename))
     {
 		ExitGame();
 		return false;
@@ -887,7 +883,7 @@
 
 	g_theProgressWindow->StartCountingTo( 190 );
 
-	if (!g_theTerrainImprovementDB->Parse(C3DIR_GAMEDATA, g_tileimprovementdb_filename)) 
+	if (!g_theTerrainImprovementDB->Parse(C3DIR_GAMEDATA, g_tileimprovementdb_filename))
     {
 		ExitGame();
 		return false;
@@ -895,7 +891,7 @@
 
 	g_theProgressWindow->StartCountingTo( 200 );
 
-	if (!g_theResourceDB->Parse(C3DIR_GAMEDATA, g_goods_filename)) 
+	if (!g_theResourceDB->Parse(C3DIR_GAMEDATA, g_goods_filename))
     {
 		ExitGame();
 		return false;
@@ -903,44 +899,44 @@
 
 	g_theProgressWindow->StartCountingTo( 210 );
 
-	if (!g_theTerrainDB->Parse(C3DIR_GAMEDATA, g_terrain_filename)) 
+	if (!g_theTerrainDB->Parse(C3DIR_GAMEDATA, g_terrain_filename))
     {
-		ExitGame(); 
+		ExitGame();
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 220 );
 
-	if (!g_theBuildingDB->Parse(C3DIR_GAMEDATA, g_improve_filename)) 
+	if (!g_theBuildingDB->Parse(C3DIR_GAMEDATA, g_improve_filename))
     {
-		return false; 
+		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 230 );
 
-	if (!g_thePollutionDB->Parse(C3DIR_GAMEDATA, g_pollution_filename)) 
+	if (!g_thePollutionDB->Parse(C3DIR_GAMEDATA, g_pollution_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 240 );
 
-	if (!g_theGlobalWarmingDB->Parse(C3DIR_GAMEDATA, g_global_warming_filename)) 
+	if (!g_theGlobalWarmingDB->Parse(C3DIR_GAMEDATA, g_global_warming_filename))
     {
-		return false; 
+		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 250 );
 
 	if (!g_theUVDB->Initialise(g_ozone_filename, C3DIR_GAMEDATA))
-	{ 
-		ExitGame(); 
+	{
+		ExitGame();
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 260 );
 
-	if (!g_theCivilisationDB->Parse(C3DIR_GAMEDATA, g_civilisation_filename)) 
+	if (!g_theCivilisationDB->Parse(C3DIR_GAMEDATA, g_civilisation_filename))
     {
 		return false;
 	}
@@ -951,21 +947,21 @@
 
 	g_theProgressWindow->StartCountingTo( 270 );
 
-	if (!g_theWonderDB->Parse(C3DIR_GAMEDATA, g_wonder_filename)) 
+	if (!g_theWonderDB->Parse(C3DIR_GAMEDATA, g_wonder_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 280 );
 
-	if (!g_theRiskDB->Parse(C3DIR_GAMEDATA, g_risk_filename)) 
+	if (!g_theRiskDB->Parse(C3DIR_GAMEDATA, g_risk_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 290 );
 
-	if (!g_theMessageIconFileDB->Parse(g_messageiconfdb_filename)) 
+	if (!g_theMessageIconFileDB->Parse(g_messageiconfdb_filename))
     {
 		ExitGame();
 		return false;
@@ -973,14 +969,14 @@
 
 	g_theProgressWindow->StartCountingTo( 300 );
 
-	if (!g_theMapDB->Parse(C3DIR_GAMEDATA, g_mapdb_filename)) 
+	if (!g_theMapDB->Parse(C3DIR_GAMEDATA, g_mapdb_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 310 );
 
-	if (!g_theOrderDB->Parse(C3DIR_GAMEDATA, g_orderdb_filename)) 
+	if (!g_theOrderDB->Parse(C3DIR_GAMEDATA, g_orderdb_filename))
     {
 		return false;
 	}
@@ -1001,63 +997,63 @@
 
 	g_theProgressWindow->StartCountingTo( 340 );
 
-	if (!g_theGoalDB->Parse(C3DIR_AIDATA, g_goal_db_filename)) 
+	if (!g_theGoalDB->Parse(C3DIR_AIDATA, g_goal_db_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 350 );
 
-	if (!g_thePersonalityDB->Parse(C3DIR_AIDATA, g_personality_db_filename)) 
+	if (!g_thePersonalityDB->Parse(C3DIR_AIDATA, g_personality_db_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 360 );
 
-	if (!g_theUnitBuildListDB->Parse(C3DIR_AIDATA, g_unit_buildlist_db_filename)) 
+	if (!g_theUnitBuildListDB->Parse(C3DIR_AIDATA, g_unit_buildlist_db_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 370 );
 
-	if (!g_theWonderBuildListDB->Parse(C3DIR_AIDATA, g_wonder_buildlist_db_filename)) 
+	if (!g_theWonderBuildListDB->Parse(C3DIR_AIDATA, g_wonder_buildlist_db_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 380 );
 
-	if (!g_theBuildingBuildListDB->Parse(C3DIR_AIDATA, g_building_buildlist_db_filename)) 
+	if (!g_theBuildingBuildListDB->Parse(C3DIR_AIDATA, g_building_buildlist_db_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 390 );
 
-	if (!g_theImprovementListDB->Parse(C3DIR_AIDATA, g_improvement_list_db_filename)) 
+	if (!g_theImprovementListDB->Parse(C3DIR_AIDATA, g_improvement_list_db_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 400 );
 
-	if (!g_theStrategyDB->Parse(C3DIR_AIDATA, g_strategy_db_filename)) 
+	if (!g_theStrategyDB->Parse(C3DIR_AIDATA, g_strategy_db_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 410 );
 
-	if (!g_theBuildListSequenceDB->Parse(C3DIR_AIDATA, g_buildlist_sequence_db_filename)) 
+	if (!g_theBuildListSequenceDB->Parse(C3DIR_AIDATA, g_buildlist_sequence_db_filename))
     {
 		return false;
 	}
 
 	g_theProgressWindow->StartCountingTo( 420 );
 
-	if (!g_theDiplomacyDB->Parse(C3DIR_AIDATA, g_diplomacy_db_filename)) 
+	if (!g_theDiplomacyDB->Parse(C3DIR_AIDATA, g_diplomacy_db_filename))
     {
 		return false;
 	}
@@ -1078,7 +1074,7 @@
 
 	g_theProgressWindow->StartCountingTo( 450 );
 
-	if (!g_theAdvanceListDB->Parse(C3DIR_AIDATA, g_advance_list_db_filename)) 
+	if (!g_theAdvanceListDB->Parse(C3DIR_AIDATA, g_advance_list_db_filename))
     {
 		return false;
 	}
@@ -1184,7 +1180,7 @@
 	FILE *dipFile = fopen("dipcombo.txt", "w");
 	if(dipFile) {
 		sint32 i,j;
-		
+
 		for(i = 1; i < g_theDiplomacyProposalDB->NumRecords(); i++) {
 			const DiplomacyProposalRecord *rec1 = g_theDiplomacyProposalDB->Get(i);
 			for(j = 1; j < g_theDiplomacyProposalDB->NumRecords(); j++) {
@@ -1192,7 +1188,7 @@
 
 				const DiplomacyProposalRecord *rec2 = g_theDiplomacyProposalDB->Get(j);
 				if(rec1->GetExcludes() & rec2->GetClass()) continue;
-				
+
 				StringId str1, str2;
 				const DiplomacyProposalRecord::StrengthStrings *strings1, *strings2;
 
@@ -1281,11 +1277,10 @@
 
 	CivPaths_InitCivPaths();
 
-	
-	g_theProfileDB = new ProfileDB; 
+	g_theProfileDB = new ProfileDB;
 	if (!g_theProfileDB->Init(FALSE)) {
 		c3errors_FatalDialog("CivApp", "Unable to init the ProfileDB.");
-		return -1; 
+		return -1;
 	}
 
 	g_logCrashes = g_theProfileDB->GetEnableLogs();
@@ -1298,20 +1293,18 @@
 #ifndef _NO_GAME_WATCH
 	gameWatch.DeliverySystem("gwfile", g_theProfileDB->GetGameWatchDirectory());
 	gameWatch.RecordingSystem("gwciv");
-#endif 
+#endif
 
 	display_Initialize(hInstance, iCmdShow);
 	init_keymap();
 	(void) ui_Initialize();
 	SoundManager::Initialize();
 
-	
 	if ( sharedsurface_Initialize() != AUI_ERRCODE_OK ) {
 		c3errors_FatalDialog( "CivApp", "Unable to init shared surface." );
 		return -1;
 	}
 
-	
 	CursorManager::Initialize();
 
 	InitializeImageMaps();
@@ -1335,7 +1328,7 @@
 
 	g_theProgressWindow->StartCountingTo( 540 );
 
-	if (!InitializeAppDB()) 
+	if (!InitializeAppDB())
     {
 		c3errors_FatalDialog("CivApp", "Unable to Init the Databases.");
 		return -1;
@@ -1365,7 +1358,7 @@
 
 		if (static_cast<int>(userCivIndex) < g_theCivilisationDB->NumRecords())
 		{
-			MBCHAR const * const    dbCivName = 
+			MBCHAR const * const    dbCivName =
 			    g_theStringDB->GetNameStr
 			        (g_theCivilisationDB->Get(userCivIndex)->GetPluralCivName());
 
@@ -1400,16 +1393,16 @@
 
 	g_theProgressWindow->StartCountingTo( 610 );
 
-	if (g_theProfileDB->IsUseFingerprinting()) 
+	if (g_theProfileDB->IsUseFingerprinting())
 		if (!ctpfinger_Check()) {
-			
-			c3errors_FatalDialog(appstrings_GetString(APPSTR_INITIALIZE), 
+
+			c3errors_FatalDialog(appstrings_GetString(APPSTR_INITIALIZE),
 									appstrings_GetString(APPSTR_CANTFINDFILE));
 		}
 
 	g_theProgressWindow->StartCountingTo( 620 );
 
-	if (g_c3ui->TheMouse()) 
+	if (g_c3ui->TheMouse())
     {
 		double const sensitivity = 0.25 * (1 + g_theProfileDB->GetMouseSpeed());
 		g_c3ui->TheMouse()->Sensitivity() = sensitivity;
@@ -1437,7 +1430,6 @@
 	return 0;
 }
 
-
 void CivApp::CleanupAppUI(void)
 {
 	NetShell::Leave( k_NS_FLAGS_DESTROY );
@@ -1465,7 +1457,7 @@
 	sint32 const cleanBaseRefCount = aui_Base::GetBaseRefCount();
 	Assert(0 == cleanBaseRefCount);
 #endif
-	
+
 	allocated::clear(g_GreatLibPF);
 	allocated::clear(g_ImageMapPF);
 	allocated::clear(g_SoundPF);
@@ -1552,7 +1544,7 @@
 		CivScenarios::Cleanup();
 		SoundManager::Cleanup();
 
-		allocated::clear(g_theProfileDB); 
+		allocated::clear(g_theProfileDB);
 
 		gameinit_Cleanup();
 		events_Cleanup();
@@ -1566,7 +1558,7 @@
 		CivPaths_CleanupCivPaths();
 		SlicSegment::Cleanup();
 
-#ifdef WIN32	
+#ifdef WIN32
 		// COM needed for DirectX Moviestuff
 		CoUninitialize();
 #endif
@@ -1611,7 +1603,6 @@
 
 	g_theProgressWindow->StartCountingTo( 20 );
 
-
 	SPLASH_STRING("Creating Game Window...");
 	errcode = backgroundWin_Initialize();
 	Assert(errcode == 0);
@@ -1707,20 +1698,19 @@
 
 	SPLASH_STRING("Initializing Sprite Engine...");
 
-	
 	sprite_Initialize();
 
 	g_theProgressWindow->StartCountingTo( 540 );
 
-    if (m_dbLoaded && g_theProfileDB->IsScenario()) 
+    if (m_dbLoaded && g_theProfileDB->IsScenario())
     {
         CleanupAppDB();
         InitializeAppDB();
 
-        // The cached patterns of the allocated windows have to be unloaded to 
+        // The cached patterns of the allocated windows have to be unloaded to
         // be able to reinitialise the image maps safely.
-        // InitializeGameUI will take care of this by closing most windows, but 
-        // the progress window stays open. It has to be handled manually to 
+        // InitializeGameUI will take care of this by closing most windows, but
+        // the progress window stays open. It has to be handled manually to
         // prevent possible corruption of its background and border patterns.
         g_theProgressWindow->PatternInfoSave();
 
@@ -1742,12 +1732,10 @@
 
 	g_theProgressWindow->StartCountingTo( 560 );
 
-	
 	ChatBox::Initialize();
 
 	g_theProgressWindow->StartCountingTo( 570 );
 
-	
 	GrabItem::Init();
 
 	g_theProgressWindow->StartCountingTo( 580 );
@@ -1759,10 +1747,9 @@
 
 	g_theProgressWindow->StartCountingTo( 590 );
 
-	
 	gameEventManager_Initialize();
 
-	// Prevent the event handler corrupting the (diplomacy) data in the 
+	// Prevent the event handler corrupting the (diplomacy) data in the
 	// middle of a file restore operation.
 	g_gevManager->Pause();
 
@@ -1770,11 +1757,9 @@
 
 	g_theProgressWindow->StartCountingTo( 600 );
 
-	
 	g_fog_toggle = FALSE;
 	g_god = FALSE;
 
-	
 	if (!gameinit_Initialize(-1, -1, archive)) {
 		g_gevManager->Resume();
 		return FALSE;
@@ -1785,7 +1770,7 @@
 	if(g_isScenario && (&archive != NULL &&
 	   (g_startInfoType != STARTINFOTYPE_NONE ||
 		g_saveFileVersion < gamefile_CurrentVersion()))) {
-		
+
 		for(sint32 i = 0; i < k_MAX_PLAYERS; i++) {
 			if(g_player[i]) {
 				g_player[i]->m_messages->Clear();
@@ -1801,7 +1786,7 @@
 		   g_player[g_scenarioUsePlayerNumber]->m_civilisation &&
 		   g_theCivilisationDB && g_theProfileDB) {
 			Player *        p       = g_player[g_scenarioUsePlayerNumber];
-			StringId        id      = 
+			StringId        id      =
                 (p->m_civilisation->GetDBRec())->GetLeaderNameMale();
 			const MBCHAR *name = g_theStringDB->GetNameStr(id);
 			if(name) {
@@ -1814,22 +1799,22 @@
 	g_theProgressWindow->StartCountingTo( 620 );
 
 	if(g_isScenario && !g_oldRandSeed) {
-		
-		
-		
-		
-		
-		
+
+
+
+
+
+
 		g_rand->Initialize(static_cast<sint32>(time(0)));
 	}
 
 	g_theProgressWindow->StartCountingTo( 630 );
 
-	if (g_isScenario) 
+	if (g_isScenario)
 	{
-		for (size_t p = 0; p < k_MAX_PLAYERS; ++p) 
+		for (size_t p = 0; p < k_MAX_PLAYERS; ++p)
 		{
-			if (g_player[p]) 
+			if (g_player[p])
 			{
 				g_player[p]->m_civilisation->ResetCiv
 					(g_player[p]->m_civilisation->GetCivilisation(),
@@ -1894,7 +1879,7 @@
 
 	g_theProgressWindow->StartCountingTo( 720 );
 
-	if(!g_network.IsActive()) { 
+	if(!g_network.IsActive()) {
 		if (NULL == &archive ||
 			(g_saveFileVersion >= 42 &&
 
@@ -1902,7 +1887,7 @@
 
 
 
-			(g_isScenario && g_startInfoType != STARTINFOTYPE_NOLOCS))) 
+			(g_isScenario && g_startInfoType != STARTINFOTYPE_NOLOCS)))
         {
 			if (g_director)
 				g_director->AddCopyVision();
@@ -1910,7 +1895,7 @@
 	}
 
 	g_theProgressWindow->StartCountingTo( 730 );
-	
+
 	g_director->ReloadAllSprites();
 
 	g_theProgressWindow->StartCountingTo( 740 );
@@ -1928,7 +1913,7 @@
 	}
 
 	g_theProgressWindow->StartCountingTo( 750 );
-	
+
 	if (!g_turn->IsHotSeat())
 	{
 		MainControlPanel::UpdateCityList();
@@ -1963,7 +1948,7 @@
 		MainControlPanel::UpdatePlayer(g_selected_item->GetCurPlayer());
 	}
 
-    if (g_launchIntoCheatMode) 
+    if (g_launchIntoCheatMode)
     {
         ScenarioEditor::Display();
     }
@@ -2012,7 +1997,7 @@
 
 	SPLASH_STRING("Creating Status Window...");
 	sint32          errcode;
-	
+
 	errcode = c3windows_MakeStatusWindow(TRUE);
 	Assert(errcode == 0);
 	if (errcode != 0) return 7;
@@ -2042,7 +2027,7 @@
 	g_theProgressWindow->StartCountingTo( 70 );
 
 	SPLASH_STRING("Creating Control Panel Window...");
-   
+
 	errcode = controlpanelwindow_Initialize();
 
 	g_theProgressWindow->StartCountingTo( 80 );
@@ -2053,7 +2038,7 @@
 	if (errcode != 0) return 7;
 
 	g_theProgressWindow->StartCountingTo( 90 );
-	
+
 	AUI_ERRCODE	auiErr = g_c3ui->AddWindow(g_background);
 	Assert(auiErr == AUI_ERRCODE_OK);
 	if ( auiErr != AUI_ERRCODE_OK ) return 11;
@@ -2096,37 +2081,31 @@
 
 	g_theProgressWindow->StartCountingTo(10, g_theStringDB->GetNameStr("LOADING"));
 
-	
 	g_fog_toggle = TRUE;
 
-	
 	init_keymap();
 
 	g_theProgressWindow->StartCountingTo( 20 );
 
 	SPLASH_STRING("Initializing Sprite Engine...");
 
-	
 	sprite_Initialize();
 
 	g_theProgressWindow->StartCountingTo( 140 );
 
-	
 	InitializeSpriteEditorUI();
 
 	g_theProgressWindow->StartCountingTo( 150 );
 
-	
 	ChatBox::Initialize();
 
 	g_theProgressWindow->StartCountingTo( 160 );
 
-	
 	GrabItem::Init();
 
 	g_theProgressWindow->StartCountingTo( 680 );
 
-	if (m_dbLoaded && g_theProfileDB->IsScenario()) 
+	if (m_dbLoaded && g_theProfileDB->IsScenario())
 	{
 		CleanupAppDB();
 		InitializeAppDB();
@@ -2142,16 +2121,16 @@
 
 	g_theProgressWindow->StartCountingTo( 710 );
 
-	if (!spriteEditor_Initialize(20,15)) 
+	if (!spriteEditor_Initialize(20,15))
 		return FALSE;
 
 	g_theProgressWindow->StartCountingTo( 720 );
 
-	if (    (&archive != NULL) 
+	if (    (&archive != NULL)
          && (g_startInfoType != STARTINFOTYPE_NONE ||
 		     g_saveFileVersion < gamefile_CurrentVersion()
             )
-       ) 
+       )
     {
         SlicEngine::Reload(g_slic_filename);
 	}
@@ -2166,7 +2145,7 @@
 	g_theProgressWindow->StartCountingTo( 740 );
 
 	SPLASH_STRING("Initializing AI...");
-	roboinit_Initalize(archive); 
+	roboinit_Initalize(archive);
 	CtpAi::Initialize();
 
 	g_theProgressWindow->StartCountingTo( 750 );
@@ -2185,14 +2164,14 @@
 	g_theProgressWindow->StartCountingTo( 780 );
 
 	m_gameLoaded = TRUE;
-	
+
 	g_director->CatchUp();
 
 	g_theProgressWindow->StartCountingTo( 790 );
-	
-	g_turn->BeginNewTurn(FALSE);  
 
-	if(!g_network.IsActive()) { 
+	g_turn->BeginNewTurn(FALSE);
+
+	if(!g_network.IsActive()) {
 		if (NULL == &archive ||
 			(g_saveFileVersion >= 42 &&
 
@@ -2205,7 +2184,7 @@
 
 
 
-			
+
 			if(g_scenarioUsePlayerNumber == 0 && !g_turn->IsHotSeat() &&
 				!g_turn->IsEmail()) {
 				g_selected_item->SetPlayerOnScreen(1);
@@ -2230,7 +2209,7 @@
 	}
 
 	g_theProgressWindow->StartCountingTo( 810 );
-	
+
 	g_scenarioUsePlayerNumber = 0;
 
 	if(g_selected_item) {
@@ -2239,11 +2218,9 @@
 			g_director->AddCenterMap(g_selected_item->GetCurSelectPos());
 	}
 
-	
 	g_oldRandSeed = FALSE;
 
-	
-	
+
 	if (g_launchIntoCheatMode) {
 		ScenarioEditor::Display();
 
@@ -2261,7 +2238,6 @@
 }
 
 
-
 void CivApp::CleanupGameUI(void)
 {
 	AttractWindow::Cleanup();
@@ -2282,7 +2258,6 @@
 
 	c3windows_MakeDebugWindow(FALSE);
 
-	
 	messagewin_PurgeMessages();
 
 	helptile_Cleanup();
@@ -2290,11 +2265,10 @@
 	radarwindow_Cleanup();
 	c3windows_MakeStatusWindow(FALSE);
 
-
 	InfoBar::Cleanup();
 	InfoWindow::Cleanup();
 	ScienceVictoryDialog::Cleanup();
-	
+
 	sci_advancescreen_Cleanup();
 	infowin_Cleanup();
 	infowin_Cleanup_Controls();
@@ -2303,13 +2277,12 @@
 	NationalManagementDialog::Cleanup();
 	tutorialwin_Cleanup();
 
-	
 	workwin_Cleanup();
 
-	
-	
 
-	
+
+
+
 	ScenarioEditor::Cleanup();
 	CityWindow::Cleanup();
 	DiplomacyWindow::Cleanup();
@@ -2320,12 +2293,11 @@
 	EditQueue::Cleanup();
 	ProfileEdit::Cleanup();
 
-	
-	
+
 	DipWizard::Cleanup();
 	DomesticManagementDialog::Cleanup();
 	initialplayscreen_Cleanup();
-	
+
 	DiplomacyDetails::Cleanup();
 }
 
@@ -2339,52 +2311,43 @@
 	gameinit_CleanupMessages();
 	uint32 target_milliseconds = 100000;
 	uint32 used_milliseconds;
-	ProcessUI(target_milliseconds, used_milliseconds); 
+	ProcessUI(target_milliseconds, used_milliseconds);
 
 	g_network.Cleanup();
 
-	
 	radarwindow_Cleanup();
 
-	
-	
+
 	GraphicsOptions::Cleanup();
 
-	
 	tile_Cleanup();
 
-	
 	ChatBox::Cleanup();
 
-	
 	CleanupGameUI();
 
-	
-	ProcessUI(target_milliseconds, used_milliseconds); 
-	
+	ProcessUI(target_milliseconds, used_milliseconds);
+
 	gameinit_Cleanup();
 
 	events_Cleanup();
 
-	
 	gameEventManager_Cleanup();
 
-	
 	sprite_Cleanup();
 
 	if (g_soundManager)
 		g_soundManager->DumpAllSounds();
 
-	
-	
-	
-	
-	
-	
-		
+
+
+
+
+
+
+
 	if(!keepScenInfo) {
-		
-		
+
 		g_theProfileDB->SetIsScenario(FALSE);
 		g_civPaths->ClearCurScenarioPath();
 		g_civPaths->ClearCurScenarioPackPath();
@@ -2395,29 +2358,25 @@
 
 #if defined(_DEBUG) && defined(_MEMORYLOGGING) && defined(_DEBUG_MEMORY)
 	DebugMemory_LeaksShow(8675209);
-#endif 
+#endif
 
 #ifndef _NO_GAME_WATCH
-	
-	
+
 	if (!g_no_exit_action) {
 		char userName[256];
 		DWORD size = 256;
 		userName[0] = '\0';
 		GetUserName(userName, &size);
 
-		
 		char computerName[256];
 		size = 256;
 		computerName[0] = '\0';
 		GetComputerName(computerName, &size);
 
-		
 		SYSTEMTIME localTime;
 		memset(&localTime, 0, sizeof(localTime));
 		GetLocalTime(&localTime);
 
-		
 		char stamp[1024];
 		sprintf(stamp, "Civilization III CTP - %s on %s at %d/%d/%d %d:%d:%d", userName, computerName,
 		        localTime.wMonth, localTime.wDay, localTime.wYear, localTime.wHour,
@@ -2505,7 +2464,7 @@
 	static uint32	lastTicks       = curTicks;
 
 	if (g_c3ui->TheMouse()) {
-		if (g_c3ui->TheMouse()->IsSuspended() ) 
+		if (g_c3ui->TheMouse()->IsSuspended() )
 		{
 			used_milliseconds = Os::GetTicks() - start_time_ms;
 
@@ -2527,45 +2486,40 @@
 		bool netGameLoading = (g_network.IsNetworkLaunch() || g_network.IsActive())
 			                  && !g_network.ReadyToStart();
 
-
 		if (m_gameLoaded && !g_modalWindow) {
 			if (!netGameLoading && ui_CheckForScroll()) {
 				do {
-					
-					
+
 					g_tiledMap->CopyMixDirtyRects(g_background->GetDirtyList());
 
-					
-					
-					
-					
-					
+
+
+
+
+
 
 					g_c3ui->Process();
 
-					
-					
+
 					uint32 target_milliseconds=30;
 					uint32 used_milliseconds;
 
 					ProcessNet(target_milliseconds, used_milliseconds);
 				} while (ui_CheckForScroll());
 
-				
 				g_tiledMap->RetargetTileSurface(NULL);
 				g_tiledMap->Refresh();
 				g_tiledMap->InvalidateMap();
 				g_tiledMap->ValidateMix();
-			} 
-            else 
+			}
+            else
             {
 				if(g_tiledMap) {
 					g_tiledMap->RestoreMixFromMap(g_background->TheSurface());
 				}
 				if(g_background)
 					g_background->Draw();
-				
-				
+
 			}
 
 			lastTicks = curTicks;
@@ -2577,8 +2531,7 @@
 	}
 
 	if (m_gameLoaded && !g_modalWindow && g_tiledMap) {
-		
-		
+
 		if (g_director)
 			g_director->Process();
 	}
@@ -2586,7 +2539,6 @@
 	return 0;
 }
 
-
 sint32 CivApp::ProcessAI()
 {
 	if((g_network.IsActive() || g_network.IsNetworkLaunch()) &&
@@ -2607,7 +2559,6 @@
 	return 1;
 }
 
-
 sint32 CivApp::ProcessRobot(const uint32 target_milliseconds, uint32 &used_milliseconds)
 {
 	if((g_network.IsActive() || g_network.IsNetworkLaunch()) &&
@@ -2618,8 +2569,8 @@
 		return 0;
 
 	uint32 const    start_time_ms = Os::GetTicks();
-	
-	if (g_c3ui->TheMouse()) 
+
+	if (g_c3ui->TheMouse())
 	{
 		if (g_c3ui->TheMouse()->IsSuspended() && !g_runInBackground && !g_theProfileDB->GetValueByName("RunInBackground"))
 		{
@@ -2628,15 +2579,14 @@
 	}
 
 	used_milliseconds = Os::GetTicks() - start_time_ms;
-	return 0; 
-} 
-
+	return 0;
+}
 
 sint32 CivApp::ProcessNet(const uint32 target_milliseconds, uint32 &used_milliseconds)
 {
 	uint32 const        start_time = Os::GetTicks();
 
-	if (m_gameLoaded) 
+	if (m_gameLoaded)
 	{
 		g_network.Process();
 	}
@@ -2645,7 +2595,7 @@
 	return 0;
 }
 
-sint32 CivApp::ProcessSLIC(void) 
+sint32 CivApp::ProcessSLIC(void)
 {
 	if (!g_slicEngine)
 		return 0;
@@ -2654,13 +2604,13 @@
 
 	static time_t   lastRanSlicTimers   = 0;
     time_t          now                 = time(0);
-	if (now > lastRanSlicTimers + g_slicEngine->GetTimerGranularity()) 
+	if (now > lastRanSlicTimers + g_slicEngine->GetTimerGranularity())
     {
 		g_slicEngine->RunTimerTriggers();
         /// @todo Check lastRanSlicTimers = now;
 	}
 
-	if (g_slicEngine->WaitingForLoad()) 
+	if (g_slicEngine->WaitingForLoad())
     {
 		main_RestoreGame(g_slicEngine->GetLoadName());
 	}
@@ -2668,7 +2618,6 @@
 	return 0;
 }
 
-
 sint32 CivApp::ProcessProfile(void)
 {
     uint32 target_milliseconds = (g_no_timeslice) ? 10000000 : 30;
@@ -2678,8 +2627,7 @@
 
 	ProcessUI(target_milliseconds, used_milliseconds);
 
-	
-	
+
 	ProcessSLIC();
 
 	ProcessRobot(target_milliseconds, used_milliseconds);
@@ -2694,28 +2642,26 @@
 {
 #ifdef _DEBUG
 	if(g_tempLeakCheck) {
-		_CrtMemState new_state; 
+		_CrtMemState new_state;
 		_CrtMemCheckpoint(&new_state);
 
 		g_allocatedAtStart = new_state.lSizes[1];
 	}
 #endif
 
-	
-	
+
 	if(g_netConsole) {
 		static uint32 last_tick = 0;
 
-		if (Os::GetTicks() > last_tick + 250) 
+		if (Os::GetTicks() > last_tick + 250)
 		{
 			g_netConsole->Idle();
 			last_tick = Os::GetTicks();
 		}
 	}
 
-	
 	// Sleep problem if the game is supposed to run in background
-	if (m_inBackground) 
+	if (m_inBackground)
 	{
 		Os::Sleep(50);
 		return 0;
@@ -2733,29 +2679,26 @@
 
 	ProcessUI(target_milliseconds, used_milliseconds);
 
-
 	if(g_attractWindow)
 		g_attractWindow->AppIdle();
 
-	
-	
+
 	ProcessSLIC();
 
 	ProcessRobot(target_milliseconds, used_milliseconds);
-	
+
 	if (g_soundManager)
 		g_soundManager->Process(target_milliseconds, used_milliseconds);
 
 	if(g_gevManager)
 		g_gevManager->Process();
 
-	
-	
-	if (m_gameLoaded && g_savedGameRequest && g_selected_item) 
+
+	if (m_gameLoaded && g_savedGameRequest && g_selected_item)
     {
         Player *    p = g_player[g_selected_item->GetCurPlayer()];
 		if(p && !p->IsRobot()
-		|| g_selected_item->GetVisiblePlayer() == g_selected_item->GetCurPlayer()) 
+		|| g_selected_item->GetVisiblePlayer() == g_selected_item->GetCurPlayer())
         {
 			if (g_director)
 				g_director->CatchUp();
@@ -2764,10 +2707,10 @@
 				g_theGameSettings->SetKeepScore(TRUE);
 
     		GameFile::SaveGame(g_savedGameRequest->pathName, g_savedGameRequest);
-					
+
 			if (g_launchIntoCheatMode)
 				g_theGameSettings->SetKeepScore(FALSE);
-	
+
 			allocated::clear(g_savedGameRequest);
 		}
 	}
@@ -2775,13 +2718,11 @@
     return 0;
 }
 
-
 sint32 CivApp::StartGame(void)
 {
 	return InitializeGame((*(CivArchive *)(NULL)));
 }
 
-
 sint32 CivApp::StartSpriteEditor(void)
 {
 	return InitializeSpriteEditor((*(CivArchive *)(NULL)));
@@ -2796,7 +2737,7 @@
 sint32 CivApp::EndGame(void)
 {
 	if (m_gameLoaded) {
-		CleanupGame(false); 
+		CleanupGame(false);
 		StartMessageSystem();
 	}
 
@@ -2806,7 +2747,6 @@
 	return initialplayscreen_displayMyWindow();
 }
 
-
 sint32 CivApp::LoadSavedGame(MBCHAR const * name)
 {
 
@@ -2821,7 +2761,7 @@
 	if (fin == NULL) {
 		c3errors_ErrorDialog("Load save game", "Could not open %s", name);
 		return 0;
-	} 
+	}
 	fclose(fin);
 
 	g_theProgressWindow->StartCountingTo( 20 );
@@ -2867,14 +2807,13 @@
 	return 0;
 }
 
-
 sint32 CivApp::LoadSavedGameMap(MBCHAR const * name)
 {
-	FILE * fin = fopen(name, "r"); 
+	FILE * fin = fopen(name, "r");
 
-    if (fin) 
-    { 
-    	fclose(fin); 
+    if (fin)
+    {
+    	fclose(fin);
 	    GameMapFile::RestoreGameMap(name);
 	    g_tiledMap->InvalidateMap();
 	    g_selected_item->NextUnmovedUnit(TRUE, FALSE);
@@ -2882,13 +2821,12 @@
     else
     {
 		c3errors_ErrorDialog("Load save game map", "Could not open %s", name);
-	} 
+	}
 
 	return 0;
 }
 
 
-
 sint32 CivApp::LoadScenarioGame(MBCHAR const * file)
 {
 	if (m_gameLoaded) {
@@ -2906,7 +2844,6 @@
 	return 0;
 }
 
-
 sint32 CivApp::RestartGame(void)
 {
 	if (m_gameLoaded) {
@@ -2917,7 +2854,6 @@
 	return StartGame();
 }
 
-
 sint32 CivApp::RestartGameSameMap(void)
 {
 	Assert(g_rand);
@@ -2940,10 +2876,9 @@
 	}
 }
 
-
 sint32 CivApp::QuitToSPShell(void)
 {
-	if (m_gameLoaded) 
+	if (m_gameLoaded)
 	{
 		CleanupGame(false);
 		StartMessageSystem();
@@ -2954,7 +2889,6 @@
 	return initialplayscreen_displayMyWindow();
 }
 
-
 sint32 CivApp::QuitToLobby(void)
 {
 	if (m_gameLoaded) {
@@ -2965,17 +2899,15 @@
 	return NetShell::Enter( k_NS_FLAGS_RETURN );
 }
 
-
 void CivApp::QuitGame(void)
 {
 	if (m_gameLoaded)
-		CleanupGame(true); 
+		CleanupGame(true);
 
 	CleanupApp();
 }
 
 
-
 void CivApp::AutoSave(sint32 player, bool isQuickSave)
 {
 	if ((g_network.IsActive() && !g_network.IsHost()) || g_network.IsNetworkLaunch())
@@ -3000,7 +2932,7 @@
 	MBCHAR			fullpath[_MAX_PATH];
 	sprintf(fullpath, "%s%s%s", path, FILE_SEP, leaderName);
 
-	if (c3files_PathIsValid(fullpath) || c3files_CreateDirectory(fullpath)) 
+	if (c3files_PathIsValid(fullpath) || c3files_CreateDirectory(fullpath))
 	{
 		strcat(fullpath, FILE_SEP);
 		strcat(fullpath, filename);
@@ -3023,19 +2955,16 @@
 }
 
 
-
 void CivApp::PostStartGameAction(void)
 {
 	g_c3ui->AddAction(new StartGameAction());
 }
 
-
 void CivApp::PostSpriteTestAction(void)
 {
 	g_c3ui->AddAction(new SpriteTestAction());
 }
 
-
 void CivApp::PostLoadSaveGameAction(MBCHAR const * name)
 {
 	g_c3ui->AddAction(new LoadSaveGameAction(name));
@@ -3045,7 +2974,7 @@
 {
 	/// @todo Check g_network.IsHost? See AutoSave. Otherwise, the dir assignment
 	///       becomes constant.
-	if (g_network.IsActive()) 
+	if (g_network.IsActive())
 	{
 		return;
 	}
@@ -3066,7 +2995,7 @@
 	MBCHAR			fullpath[_MAX_PATH];
 	sprintf(fullpath, "%s%s%s", path, FILE_SEP, leaderName);
 
-	if (c3files_PathIsValid(fullpath) || c3files_CreateDirectory(fullpath)) 
+	if (c3files_PathIsValid(fullpath) || c3files_CreateDirectory(fullpath))
 	{
 		strcat(fullpath, FILE_SEP);
 		strcat(fullpath, filename);
@@ -3100,7 +3029,7 @@
 {
 	Player * p = g_player[g_selected_item->GetVisiblePlayer()];
 
-	if (p && g_theProfileDB) 
+	if (p && g_theProfileDB)
 	{
 		g_theProfileDB->SetLeaderName(p->GetLeaderName());
 		g_theProfileDB->SetCivIndex(p->GetCivilisation()->GetCivilisation());
@@ -3134,7 +3063,6 @@
 	g_civApp->StartGame();
 }
 
-
 void SpriteTestAction::Execute(aui_Control *control, uint32 action, uint32 data )
 {
 	g_civApp->StartSpriteEditor();
@@ -3198,12 +3126,12 @@
     delete g_ImageMapPF;
     g_ImageMapPF = new ProjectFile();
 
-    if (g_c3ui->PixelFormat() == AUI_SURFACE_PIXELFORMAT_555) 
+    if (g_c3ui->PixelFormat() == AUI_SURFACE_PIXELFORMAT_555)
     {
         AddSearchPacks(g_ImageMapPF, C3DIR_PATTERNS, "pat555.zfs");
         AddSearchPacks(g_ImageMapPF, C3DIR_PICTURES, "pic555.zfs");
-    } 
-    else 
+    }
+    else
     {
         AddSearchPacks(g_ImageMapPF, C3DIR_PATTERNS, "pat565.zfs");
         AddSearchPacks(g_ImageMapPF, C3DIR_PICTURES, "pic565.zfs");

Modified: trunk/ctp2_code/ctp/civapp.h
==============================================================================
--- trunk/ctp2_code/ctp/civapp.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/civapp.h	Mon May 23 04:21:18 2016	(r1115)
@@ -10,7 +10,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -66,7 +66,7 @@
 //
 //----------------------------------------------------------------------------
 
-class CivApp 
+class CivApp
 {
 public:
 	CivApp();
@@ -77,9 +77,9 @@
 	void		CleanupAppDB(void);
 	sint32		EndGame(void);
 
-	sint32		GetKeyboardScrollingKey(void) const 
-    { 
-        return m_keyboardScrollingKey; 
+	sint32		GetKeyboardScrollingKey(void) const
+    {
+        return m_keyboardScrollingKey;
     };
 
     sint32		InitializeApp(HINSTANCE hInstance, int iCmdShow);
@@ -87,23 +87,23 @@
 	sint32		InitializeAppDB(CivArchive &archive);
 	sint32		InitializeGame(CivArchive &archive);
 
-   	bool		IsGameLoaded(void) const 
-    { 
-        return m_gameLoaded; 
+   	bool		IsGameLoaded(void) const
+    {
+        return m_gameLoaded;
     };
 
-	bool		IsInBackground(void) const 
-    { 
-        return m_inBackground; 
+	bool		IsInBackground(void) const
+    {
+        return m_inBackground;
     };
 
-	bool		IsKeyboardScrolling(void) const 
-    { 
-        return m_isKeyboardScrolling; 
+	bool		IsKeyboardScrolling(void) const
+    {
+        return m_isKeyboardScrolling;
     };
 
 	sint32		LoadSavedGame(MBCHAR const * name);
-	sint32		LoadSavedGameMap(MBCHAR const * name); 
+	sint32		LoadSavedGameMap(MBCHAR const * name);
 	sint32		LoadScenarioGame(MBCHAR const * name);
 	void		PostEndGameAction(void);
 	void        PostLoadQuickSaveAction(sint32 player);
@@ -123,13 +123,13 @@
 	sint32		QuitToSPShell(void);
 	sint32		RestartGame(void);
 	sint32		RestartGameSameMap(void);
-	bool		SaveDBInGameFile(void) const 
-    { 
-        return m_saveDBInGameFile; 
+	bool		SaveDBInGameFile(void) const
+    {
+        return m_saveDBInGameFile;
     }
-	void		SetInBackground(bool in = true) 
-    { 
-        m_inBackground = in; 
+	void		SetInBackground(bool in = true)
+    {
+        m_inBackground = in;
     }
 	sint32		StartSpriteEditor(void);
 	sint32		StartGame(void);
@@ -142,7 +142,7 @@
 	void 		InitializeAppUI(void);
 	sint32  	InitializeGameUI(void);
 	sint32		InitializeSpriteEditor(CivArchive &archive);
-	void		PostLoadSaveGameMapAction(MBCHAR const *); 
+	void		PostLoadSaveGameMapAction(MBCHAR const *);
 	sint32      ProcessAI();
 	sint32      ProcessNet(const uint32 target_milliseconds, uint32 &used_milliseconds);
 	sint32		ProcessProfile(void);
@@ -162,7 +162,6 @@
 	sint32		m_keyboardScrollingKey;
 };
 
-
 AUI_ACTION_BASIC(EndGameAction);
 AUI_ACTION_BASIC(QuitToSPShellAction);
 AUI_ACTION_BASIC(QuitToLobbyAction);
@@ -174,9 +173,9 @@
 class LoadSaveGameAction : public aui_Action
 {
 public:
-	LoadSaveGameAction(MBCHAR const * name = NULL) 
-    :   aui_Action  () 
-    { 
+	LoadSaveGameAction(MBCHAR const * name = NULL)
+    :   aui_Action  ()
+    {
         if (name)
         {
             strncpy(m_filename, name, k_AUI_LDL_MAXBLOCK);
@@ -202,9 +201,9 @@
 class LoadSaveGameMapAction : public aui_Action
 {
 public:
-	LoadSaveGameMapAction(MBCHAR const * name = NULL) 
-    :   aui_Action  () 
-    { 
+	LoadSaveGameMapAction(MBCHAR const * name = NULL)
+    :   aui_Action  ()
+    {
         if (name)
         {
             strncpy(m_filename, name, k_AUI_LDL_MAXBLOCK);
@@ -230,12 +229,12 @@
 class LoadScenarioGameAction : public aui_Action
 {
 public:
-	LoadScenarioGameAction(MBCHAR const * name) 
-    :   aui_Action  () 
-    { 
+	LoadScenarioGameAction(MBCHAR const * name)
+    :   aui_Action  ()
+    {
         if (name)
         {
-            strncpy(m_filename, name, _MAX_PATH); 
+            strncpy(m_filename, name, _MAX_PATH);
         }
         else
         {

Modified: trunk/ctp2_code/ctp/ctp2_rsrc/resource.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_rsrc/resource.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_rsrc/resource.h	Mon May 23 04:21:18 2016	(r1115)
@@ -23,7 +23,7 @@
 #define IDC_SLIDER1                     1008
 
 // Next default values for new objects
-// 
+//
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        148

Modified: trunk/ctp2_code/ctp/ctp2_utils/AvlTree.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/AvlTree.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/AvlTree.h	Mon May 23 04:21:18 2016	(r1115)
@@ -2,7 +2,7 @@
 //
 // Project      : Call To Power 2
 // File type    : C++ header file
-// Description  : 
+// Description  :
 // Id           : $Id$
 //
 //----------------------------------------------------------------------------
@@ -11,13 +11,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 //----------------------------------------------------------------------------
 //
 // Modifications from the original Activision code:
@@ -44,9 +44,9 @@
 
 
 enum  cmp_t {
-	MIN_CMP = -1,   
-	EQ_CMP  = 0,    
-	MAX_CMP = 1     
+	MIN_CMP = -1,
+	EQ_CMP  = 0,
+	MAX_CMP = 1
 };
 
 
@@ -57,22 +57,22 @@
 class Comparable {
 private:
 	KeyType  myKey;
-	
+
 public:
 	cmp_t (*m_compareFunction)(KeyType, KeyType);
 
 	Comparable(KeyType  key, cmp_t (*CFunc)(KeyType, KeyType) = NULL) : myKey(key) {
 		m_compareFunction = CFunc;
 	};
-	
+
 	void SetParams(KeyType key, cmp_t (*CFunc)(KeyType, KeyType)) {
 		myKey = key;
 		m_compareFunction = CFunc;
 	};
-	
-	
-	
-	
+
+
+
+
 	cmp_t Compare(KeyType  key) const {
 		if (m_compareFunction == NULL) {
 			return (key == myKey) ? EQ_CMP
@@ -81,11 +81,9 @@
 			return (m_compareFunction(myKey, key));
 		}
 	}
-	
-	
+
 	KeyType Key() const { return  myKey; }
-	
-	
+
 	std::ostream & Print(std::ostream & os) const
 	{
 		os << myKey;
@@ -108,198 +106,183 @@
 enum  dir_t { LEFT = 0, RIGHT = 1 };
 
 
-
 template <class KeyType>
 class AvlNode {
 public:
-      
+
    enum  { MAX_SUBTREES = 2 };
 
-      
    static  dir_t
-   Opposite(dir_t dir) { 
+   Opposite(dir_t dir) {
      return dir_t(1 - int(dir));
    }
 
-   
 
    AvlNode(Comparable<KeyType>  * item=NULL);
    virtual ~AvlNode(void);
 
-   
 
-      
+
+
    Comparable<KeyType> *
    Data() const { return  myData; }
 
-      
    KeyType
    Key() const { return  myData->Key(); }
 
-      
-      
-      
-      
-      
+
+
+
+
+
    short
    Bal(void) const { return  myBal; }
 
-      
-      
-      
+
+
+
    AvlNode *
    Subtree(dir_t dir) const { return  mySubtree[dir]; }
 
-   
-   
-   
-   
-   
-   
-   
-   
-   
-   
-      
-      
+
+
+
+
+
+
+
+
+
+
+
+
    static Comparable<KeyType> *
    Search(KeyType key, AvlNode<KeyType> * root, cmp_t cmp=EQ_CMP);
 
-      
-      
+
    static Comparable<KeyType> *
    Insert(Comparable<KeyType> * item, AvlNode<KeyType> * & root);
 
-      
-      
+
    static Comparable<KeyType> *
    Delete(KeyType key, AvlNode<KeyType> * & root, cmp_t cmp=EQ_CMP);
 
-   
 
-      
+
+
    int
    Height() const;
 
-      
-      
+
    int
    Check() const;
 
-      
-      
-      
-      
+
+
+
+
 #ifdef CUSTOM_ALLOCATE
    void *
    operator  new(size_t);
 
    void
    operator  delete(void *);
-#endif  
-
+#endif
 
 private:
 
-   
 
-   Comparable<KeyType> * myData;  
-   AvlNode<KeyType>    * mySubtree[MAX_SUBTREES];   
-   short      myBal;   
+   Comparable<KeyType> * myData;
+   AvlNode<KeyType>    * mySubtree[MAX_SUBTREES];
+   short      myBal;
 
-      
    void
    Reset(void) {
       myBal = 0 ;
       mySubtree[LEFT] = mySubtree[RIGHT] = NULL ;
    }
 
-   
 
-      
-      
-      
-      
-      
+
+
+
+
+
+
    static Comparable<KeyType> *
    Insert(Comparable<KeyType> * item,
              AvlNode<KeyType> * & root,
              int & change);
 
-      
-      
-      
-      
-      
+
+
+
+
+
    static Comparable<KeyType> *
    Delete(KeyType key,
              AvlNode<KeyType> * & root,
              int & change,
              cmp_t cmp=EQ_CMP);
 
-   
 
-      
-      
-      
+
+
+
+
    static int
    RotateOnce(AvlNode<KeyType> * & root, dir_t dir);
 
-      
-      
-      
+
+
+
    static int
    RotateTwice(AvlNode<KeyType> * & root, dir_t dir);
 
-      
    static int
    ReBalance(AvlNode<KeyType> * & root);
 
-      
-      
-      
-      
-      
-      
+
+
+
+
+
+
    cmp_t
    Compare(KeyType key, cmp_t cmp=EQ_CMP) const;
 
 private:
-      
+
    AvlNode(const AvlNode<KeyType> &);
    AvlNode & operator=(const AvlNode<KeyType> &);
 
 };
 
 
-   
-   
-   
+
+
+
 template <class KeyType>
 class AvlTree {
 private:
-      
+
    AvlTree(const AvlTree<KeyType> &);
    AvlTree & operator=(const AvlTree<KeyType> &);
 
-      
-   AvlNode<KeyType> * myRoot;   
+   AvlNode<KeyType> * myRoot;
 
 public:
-      
+
    AvlTree() : myRoot(NULL) {};
    ~AvlTree() { if (myRoot)  delete myRoot; }
 
-      
    void DumpTree(std::ostream & os) const;
 
-      
    int
    IsEmpty() const {
       return  (myRoot == NULL);
    }
 
-      
    Comparable<KeyType> *
    Search(KeyType key, cmp_t cmp=EQ_CMP) {
       return  AvlNode<KeyType>::Search(key, myRoot, cmp);
@@ -322,26 +305,21 @@
 };
 
 
-   
 enum balance_t { LEFT_HEAVY = -1, BALANCED = 0, RIGHT_HEAVY = 1 };
 
-   
 enum height_effect_t { HEIGHT_NOCHANGE = 0, HEIGHT_CHANGE = 1 };
 
-   
 inline static int
 LEFT_IMBALANCE(short bal) {
    return (bal < LEFT_HEAVY);
 }
 
-   
 inline static int
 RIGHT_IMBALANCE(short bal) {
    return (bal > RIGHT_HEAVY);
 }
 
 
-
 template <class KeyType>
 AvlNode<KeyType>::AvlNode(Comparable<KeyType> * item)
    : myData(item), myBal(0)
@@ -356,7 +334,6 @@
 }
 
 
-
 template <class KeyType>
 int
 AvlNode<KeyType>::RotateOnce(AvlNode<KeyType> * & root, dir_t dir)
@@ -364,21 +341,18 @@
    dir_t  otherDir = Opposite(dir);
    AvlNode<KeyType> * oldRoot = root;
 
-      
-      
-      
+
+
+
    int  heightChange = (root->mySubtree[otherDir]->myBal == 0)
                           ? HEIGHT_NOCHANGE
                           : HEIGHT_CHANGE;
 
-      
    root = oldRoot->mySubtree[otherDir];
 
-      
    oldRoot->mySubtree[otherDir] = root->mySubtree[dir];
    root->mySubtree[dir] = oldRoot;
 
-      
    oldRoot->myBal = -((dir == LEFT) ? --(root->myBal) : ++(root->myBal));
 
    return  heightChange;
@@ -392,23 +366,18 @@
    AvlNode<KeyType> * oldRoot = root;
    AvlNode<KeyType> * oldOtherDirSubtree = root->mySubtree[otherDir];
 
-      
    root = oldRoot->mySubtree[otherDir]->mySubtree[dir];
 
-      
    oldRoot->mySubtree[otherDir] = root->mySubtree[dir];
    root->mySubtree[dir] = oldRoot;
 
-      
    oldOtherDirSubtree->mySubtree[dir] = root->mySubtree[otherDir];
    root->mySubtree[otherDir] = oldOtherDirSubtree;
 
-      
    root->mySubtree[LEFT]->myBal  = - std::max<short>(root->myBal, 0);
    root->mySubtree[RIGHT]->myBal = - std::min<short>(root->myBal, 0);
    root->myBal = 0;
 
-      
    return  HEIGHT_CHANGE;
 }
 
@@ -418,21 +387,21 @@
    int  heightChange = HEIGHT_NOCHANGE;
 
    if (LEFT_IMBALANCE(root->myBal)) {
-         
+
       if (root->mySubtree[LEFT]->myBal  ==  RIGHT_HEAVY) {
-            
+
          heightChange = RotateTwice(root, RIGHT);
       } else {
-            
+
          heightChange = RotateOnce(root, RIGHT);
       }
    } else if (RIGHT_IMBALANCE(root->myBal)) {
-         
+
       if (root->mySubtree[RIGHT]->myBal  ==  LEFT_HEAVY) {
-            
+
          heightChange = RotateTwice(root, LEFT);
       } else {
-            
+
          heightChange = RotateOnce(root, LEFT);
       }
    }
@@ -441,19 +410,18 @@
 }
 
 
-
 template <class KeyType>
 cmp_t
 AvlNode<KeyType>::Compare(KeyType key, cmp_t cmp) const
 {
    switch (cmp) {
-      case EQ_CMP :  
+      case EQ_CMP :
          return  myData->Compare(key);
 
-      case MIN_CMP :  
+      case MIN_CMP :
          return  (mySubtree[LEFT] == NULL) ? EQ_CMP : MIN_CMP;
 
-      case MAX_CMP :  
+      case MAX_CMP :
          return  (mySubtree[RIGHT] == NULL) ? EQ_CMP : MAX_CMP;
    }
 
@@ -461,12 +429,11 @@
 }
 
 
-
 template <class KeyType>
 Comparable<KeyType> *
 AvlNode<KeyType>::Search(KeyType key, AvlNode<KeyType> * root, cmp_t cmp)
 {
-    while (root) 
+    while (root)
     {
         cmp_t const result  = root->Compare(key, cmp);
         if (EQ_CMP == result)
@@ -518,15 +485,15 @@
     {
         change  = HEIGHT_NOCHANGE;
         return root->myData;
-    }         
-      
+    }
+
     Comparable<KeyType> * found = Insert(item, root->mySubtree[dir], change);
     if (found)
     {
-        return found;   
+        return found;
     }
-    
-    int increase = result * change;  
+
+    int increase = result * change;
     root->myBal = root->myBal + static_cast<short>(increase);
 
     change =  (increase && root->myBal)
@@ -535,7 +502,6 @@
     return NULL;
 }
 
-
 template <class KeyType>
 Comparable<KeyType> *
 AvlNode<KeyType>::Delete(KeyType              key,
@@ -550,53 +516,50 @@
         return NULL;
     }
 
-
     Comparable<KeyType> * found = NULL;
     int  decrease = 0;
 
-      
     cmp_t  result = root->Compare(key, cmp);
     dir_t  dir = (result == MIN_CMP) ? LEFT : RIGHT;
 
     if (result != EQ_CMP) {
 
         found = Delete(key, root->mySubtree[dir], change, cmp);
-        if (!found) return found;   
-        decrease = result * change;    
-    } else  {   
-        found = root->myData;  
+        if (!found) return found;
+        decrease = result * change;
+    } else  {
+        found = root->myData;
 
         if ((root->mySubtree[LEFT] == NULL) &&
             (root->mySubtree[RIGHT] == NULL)) {
             delete root;
             root = NULL;
-            change = HEIGHT_CHANGE;    
+            change = HEIGHT_CHANGE;
             return found;
         } else if ((root->mySubtree[LEFT] == NULL) ||
                    (root->mySubtree[RIGHT] == NULL)) {
              AvlNode<KeyType> * toDelete = root;
              root = root->mySubtree[(root->mySubtree[RIGHT]) ? RIGHT : LEFT];
-             change = HEIGHT_CHANGE;    
-                
+             change = HEIGHT_CHANGE;
+
              toDelete->mySubtree[LEFT] = toDelete->mySubtree[RIGHT] = NULL;
              delete  toDelete;
              return  found;
         } else {
 
-
             root->myData = Delete(key, root->mySubtree[RIGHT],
                                decrease, MIN_CMP);
         }
     }
 
-    if (decrease) 
+    if (decrease)
     {
         root->myBal = root->myBal - static_cast<short>(decrease);
-        if (root->myBal) 
+        if (root->myBal)
         {
-            change = ReBalance(root);  
+            change = ReBalance(root);
         } else {
-            change = HEIGHT_CHANGE;   
+            change = HEIGHT_CHANGE;
         }
     } else {
         change = HEIGHT_NOCHANGE;
@@ -606,7 +569,6 @@
 }
 
 
-
 template <class KeyType>
 int
 AvlNode<KeyType>::Height() const {
@@ -620,15 +582,12 @@
 AvlNode<KeyType>::Check() const {
    int  valid = 1;
 
-      
    if (mySubtree[LEFT])   valid *= mySubtree[LEFT]->Check();
    if (mySubtree[RIGHT])  valid *= mySubtree[RIGHT]->Check();
 
-      
    int  leftHeight  = (mySubtree[LEFT])  ? mySubtree[LEFT]->Height()  : 0;
    int  rightHeight = (mySubtree[RIGHT]) ? mySubtree[RIGHT]->Height() : 0;
 
-      
    int  diffHeight = rightHeight - leftHeight;
    if (LEFT_IMBALANCE(diffHeight) || RIGHT_IMBALANCE(diffHeight)) {
       valid = 0;
@@ -636,7 +595,6 @@
                 << " at node " << Key() << std::endl;
    }
 
-      
    if (diffHeight != myBal) {
       valid = 0;
       std::cerr << "Height difference " << diffHeight
@@ -644,7 +602,6 @@
                 << " at node " << Key() << std::endl;
    }
 
-      
    if ((mySubtree[LEFT])
             &&
        (mySubtree[LEFT]->Compare(Key()) == MIN_CMP)) {
@@ -664,8 +621,7 @@
 }
 
 
-
-static inline std::ostream & Indent(std::ostream & os, int len) 
+static inline std::ostream & Indent(std::ostream & os, int len)
 {
    for (int i = 0; i < len; i++) {
       os << ' ';
@@ -715,10 +671,9 @@
 }
 
 template <class KeyType>
-void AvlTree<KeyType>::DumpTree(std::ostream & os) const 
+void AvlTree<KeyType>::DumpTree(std::ostream & os) const
 {
    Dump(os, myRoot);
 }
 
-
-#endif  
+#endif

Modified: trunk/ctp2_code/ctp/ctp2_utils/BitMask.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/BitMask.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/BitMask.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,4 +1,3 @@
-
 #ifndef BIT_MASK_H__
 #define BIT_MASK_H__
 
@@ -16,7 +15,6 @@
 		m_bytes = new uint8[SIZE_IN_BYTES(bitSize)];
 		m_sizeInBits = bitSize;
 
-		
 		memset(m_bytes, 0, SIZE_IN_BYTES(m_sizeInBits) * sizeof(uint8));
 	}
 
@@ -48,7 +46,7 @@
 		sint32 byte = bit / 8;
 		m_bytes[byte] |= (1 << (bit % 8));
 	}
-	
+
 	void ClearBit(sint32 bit) {
 		Assert(bit >= 0);
 		Assert(bit < m_sizeInBits);
@@ -81,13 +79,11 @@
 		if(!(m_sizeInBits % 8))
 			return m_bytes[SIZE_IN_BYTES(m_sizeInBits) - 1] == 0xff;
 
-		
 		if(m_bytes[SIZE_IN_BYTES(m_sizeInBits) - 1] == (0xff >> (8 - (m_sizeInBits % 8))))
 			return true;
 		return false;
 	}
-		   
-};
 
+};
 
 #endif

Modified: trunk/ctp2_code/ctp/ctp2_utils/appstrings.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/appstrings.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/appstrings.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -19,7 +19,6 @@
 #include "ctp2_config.h"
 #include "c3types.h"
 
-
 static MBCHAR **    s_appStrings        = NULL;
 static size_t	    s_numAppStrings     = 0;
 

Modified: trunk/ctp2_code/ctp/ctp2_utils/appstrings.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/appstrings.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/appstrings.h	Mon May 23 04:21:18 2016	(r1115)
@@ -31,7 +31,6 @@
 	APPSTR_MAX
 };
 
-
 void appstrings_Initialize(void);
 void appstrings_Cleanup(void);
 

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3cmdline.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3cmdline.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3cmdline.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -2,7 +2,7 @@
 //
 // Project      : Call To Power 2
 // File type    : C++ source file
-// Description  : 
+// Description  :
 // Id           : $Id$
 //
 //----------------------------------------------------------------------------
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -122,7 +122,6 @@
 
 #include "wonderutil.h"
 
-
 #include "Diplomat.h"
 #include "AgreementMatrix.h"
 
@@ -130,7 +129,6 @@
 #include "cellunitlist.h"
 #include "ctpaidebug.h"
 
-
 #include "gfx_options.h"
 
 extern DebugWindow *g_debugWindow;
@@ -139,7 +137,7 @@
 extern MBCHAR g_advancedb_filename[_MAX_PATH];
 extern MBCHAR g_terrain_filename[_MAX_PATH];
 extern MBCHAR g_unitdb_filename[_MAX_PATH];
-extern MBCHAR g_constdb_filename[_MAX_PATH]; 
+extern MBCHAR g_constdb_filename[_MAX_PATH];
 extern MBCHAR g_improve_filename[_MAX_PATH];
 extern MBCHAR g_wonder_filename[_MAX_PATH];
 extern MBCHAR g_installation_filename[_MAX_PATH];
@@ -166,7 +164,6 @@
 extern sint32               g_check_mem;
 extern sint32               g_robotMessages;
 
-
 #include "aui.h"
 #include "aui_surface.h"
 #include "primitives.h"
@@ -201,7 +198,7 @@
 
 #include "GameEventManager.h"
 
-extern TurnCount *g_turn; 
+extern TurnCount *g_turn;
 
 static sint32 s_helpLines = 15;
 
@@ -224,14 +221,12 @@
 extern sint32         g_isGridOn;
 extern bool           g_showHeralds;
 
-
 extern BOOL           g_useDDBlit;
 
 extern CivApp         *g_civApp;
 
 extern C3UI           *g_c3ui;
 
-
 extern BOOL           g_powerPointsMode;
 
 #if defined(_DEBUG) && defined(CELL_COLOR)
@@ -240,18 +235,16 @@
 BOOL                  g_show_ai_dbg;
 BOOL                  g_doingFastRounds = FALSE;
 
-
 extern BOOL           g_ai_revolt = TRUE;
 
 extern void WhackScreen();
 
 #include "Diplomacy_Log.h"
-extern Diplomacy_Log *g_theDiplomacyLog; 
+extern Diplomacy_Log *g_theDiplomacyLog;
 
 #include "director.h"
 extern Director *g_director;
 
-
 extern BOOL	g_drawArmyClumps;
 
 #include "sciencewin.h"
@@ -396,7 +389,6 @@
                       IsPollutionReducedCommand g_isPollutionReducedCommand;
                       IsViolatingBordersCommand g_isViolatingBordersCommand;
 
-
                       RequestExchangeMapCommand g_requestExchangeMapCommand;
                      SetMaterialsPercentCommand g_SetMaterialsPercentCommand;
                      RequestExchangeCityCommand g_requestExchangeCityCommand;
@@ -504,7 +496,7 @@
                                 MainMenuCommand g_mainMenuCommand;
                                SetupModeCommand g_setupModeCommand;
                                    ReadyCommand g_readyCommand;
-                              DisplayMemCommand g_displayMemCommand; 
+                              DisplayMemCommand g_displayMemCommand;
                                UseDDBlitCommand g_useDDBlitCommand;
                                   LoadDBCommand g_loadDBCommand;
                         SellImprovementsCommand g_sellImprovementsCommand;
@@ -533,7 +525,7 @@
                                  KillPopCommand g_killPopCommand;
                                    BoardCommand g_boardCommand;
                                AutoGroupCommand g_autoGroupCommand;
-                                  AddPopCommand g_addPopCommand; 
+                                  AddPopCommand g_addPopCommand;
                               CopyVisionCommand g_copyVisionCommand;
 
                                CombatLogCommand g_combatLogCommand;
@@ -552,11 +544,9 @@
                              CleanScreenCommand g_cleanScreenCommand;
                              ResetVisionCommand g_resetVisionCommand;
 
-
                                ExportMapCommand g_exportMapCommand;
                                ImportMapCommand g_importMapCommand;
 
-
                      InitializeDiplomacyCommand g_initializeDiplomacyCommand;
                           BeginDiplomacyCommand g_beginDiplomacyCommand;
                        ChooseNewProposalCommand g_chooseNewProposalCommand;
@@ -570,19 +560,15 @@
                           SetPersonalityCommand g_setPersonalityCommand;
                               DeclareWarCommand g_declareWar;
 
-
                       SetGovernorForCityCommand g_setGovernorForCityCommand;
                     SetGovernorPwReserveCommand g_setGovernorPwReserveCommand;
 
-
                                  ToggleCellText g_toggleCellText;
                                  ToggleArmyText g_toggleArmyText;
 								 ToggleArmyText g_toggleArmyName;
 
-
                                      ArmyClumps g_armyClumps;
 
-
                                 SetGoodsCommand g_setGoodsCommand;
 
 #ifdef DUMP_ASTAR
@@ -590,16 +576,12 @@
                                DumpAstarCommand g_dumpAstarCommand;
 #endif
 
-
                                  AiDebugCommand g_aiDebugCommand;
 
-
                              ShowVictoryCommand g_showVictoryCommand;
 
-
                            ReloadSpritesCommand g_reloadSpritesCommand;
 
-
 COMMAND(ShowVisCommand);
 ShowVisCommand g_showVisCommand;
 
@@ -630,8 +612,8 @@
 	{"whoami", &g_whoAmICommand, "whoami - what aip is loaded up"},
 	{"logai", &g_logAICommand,
 	"logai <log_level> <team_idx> - set AI's level of logging"},
-	{"diplogon", &g_dipLogOnCommand, "diplogon [player] - turn on diplomacy logging for player"}, 
-	{"diplogoff", &g_dipLogOffCommand, "diplogoff [player] - turn off diplomacy logging for player"}, 
+	{"diplogon", &g_dipLogOnCommand, "diplogon [player] - turn on diplomacy logging for player"},
+	{"diplogoff", &g_dipLogOffCommand, "diplogoff [player] - turn off diplomacy logging for player"},
 	{"restart", &g_restartCommand,
 	"restart - restart game (Rereading profile.txt)"},
 	{"improve", &g_improveCommand,
@@ -844,9 +826,9 @@
 	"createimprovement <type> - instantly place a building in the selected city"},
 	{"setcityname", &g_setCityNameCommand,
 	"setcityname <name> - set name of city"},
-	{"setcitysize", &g_setCitySizeCommand, 
+	{"setcitysize", &g_setCitySizeCommand,
 	"setcitysize <size> - set the size of the selected city"},
-	{"taistr", &g_toggleAiStr, "taistr - toggle to ai strings on and off"}, 
+	{"taistr", &g_toggleAiStr, "taistr - toggle to ai strings on and off"},
 
 	{"investigatecity", &g_investigateCityCommand,
 	"investigatecity - use the selected secret agent to investigate the pointed at city"},
@@ -909,7 +891,6 @@
 	{"soothsay", &g_soothsayCommand,
 	"soothsay - Say sooth. \"sooth! I say, SOOTH!\""},
 
-
 	{"cloak", &g_cloakCommand,
 	"cloak - cloak cloakable cloakers"},
 	{"uncloak", &g_uncloakCommand,
@@ -921,7 +902,7 @@
 	{"createrift", &g_createRiftCommand,
 	"createrift - Open a rift gate to the pointed at location"},
 	{"rnd", &g_fastRoundCommand,
-	"rnd <num> - make num rounds pass"}, 
+	"rnd <num> - make num rounds pass"},
 	{"killtile", &g_killTileCommand,
 	"killtile - kills the tile under the mouse"},
 	{"throneupgrade", &g_throneRoomUpgradeCommand,
@@ -941,7 +922,7 @@
 	 "giveswhat <num> - show what the advance will give you"},
 	{"howlong", &g_howLongCommand,
 	 "howlong - how long it will take the selected city to build the current item"},
-	{"checkmem", &g_debugCheckMem, "toggle Crt memory validate - the game goes really slow"}, 
+	{"checkmem", &g_debugCheckMem, "toggle Crt memory validate - the game goes really slow"},
 
 	{"slic", &g_slicCommand,
 	 "slic <expression> - add an expression to the watch window"},
@@ -951,7 +932,7 @@
 	"bequeathgold <amount> - just give a player some gold"},
 	{"testmessage", &g_testMessageCommand,
 	"testmessage - send a test message -- do not use!!"},
-	{"tcolor", &g_toggleMapColorCommand, "toggle map debug color"}, 
+	{"tcolor", &g_toggleMapColorCommand, "toggle map debug color"},
 	{"theuristic",  &g_toggleHeuristicCommand, "toggle the old astar heuristic"},
 	{"yum", &g_yumCommand,
 	 "yum - show food, production, goods for the pointed at square"},
@@ -981,11 +962,11 @@
 	"regard [civ] [regard] - set regard of current civ to other civ"},
 	{"attitude", &g_attitudeCommand,
 	"attitude [civ] [attitude] - set attitude of current civ to other civ"},
-	{"showregard", &g_dumpFZRegardCommand, 
+	{"showregard", &g_dumpFZRegardCommand,
 	    "showregard [player] - show the regard of the player to the screen"},
-	{"setregard", &g_setFZRegardCommand, 
+	{"setregard", &g_setFZRegardCommand,
 	    "setregard me him r - set the regard of player me to player him to r"},
-	{"totalwar", &g_totalWarCommand, "totalwar - everyone hates everyone"}, 
+	{"totalwar", &g_totalWarCommand, "totalwar - everyone hates everyone"},
 	{"unitmoves", &g_setUnitMovesStyleCommand,
 	 "unitmoves [nummoves] - set unit moves style game for network"},
 	{"classic", &g_setClassicStyleCommand,
@@ -1014,7 +995,7 @@
 	 "ready - signal done setting up"},
 	{"ddblit", &g_useDDBlitCommand, "ddblit [on/off] - use Direct Draw for blitting"},
 	{"tmem", &g_displayMemCommand, "tmem - toggle memory display"},
-	{"loaddb", &g_loadDBCommand, 
+	{"loaddb", &g_loadDBCommand,
 	 "loaddb [dbname] - reload a database (string, advance, terrain, unit, const, improve, wonder, civ, inst, pop)"},
 	{"sellunits", &g_sellUnitsCommand,
 	 "sellunits - trade pointed at units for points (when in setup/points mode)"},
@@ -1022,7 +1003,7 @@
 	 "sellimprovements - trade pointed at terrain improvements for points"},
 	{"robotmessages", &g_robotMessagesCommand,
 	 "robotmessages - toggle messages for robots on/off"},
-	{"fzcomment", &g_fzCommentCommand, 
+	{"fzcomment", &g_fzCommentCommand,
 	 "fzcomment - add a comment to this turn's fuzzy inputs log"},
 	{"descend", &g_descendCommand,
 	 "descend - descend from space"},
@@ -1034,7 +1015,7 @@
 	 "forcerevolt - force pointed at city to revolt"},
 	{"toe", &g_toeCommand,
 	 "toe - Toe of Death"},
-	{"autosave", &g_autoSaveCommand, 
+	{"autosave", &g_autoSaveCommand,
 	"autosave - Toggle the auto-save-at-turn-start functionality"},
 	{"heaptotals", &g_heapTotalsCommand,
 	"heaptotals - Dump a heap status to the debug log file (CTP_debug.txt)"},
@@ -1066,12 +1047,11 @@
 	{"autogroup", &g_autoGroupCommand,
 	 "autogroup - make the game a living hell"},
 
-	{"addpop", &g_addPopCommand, 
+	{"addpop", &g_addPopCommand,
 	    "addpop - add one or more new populations to the currently selected city"},
 	{"copyvision", &g_copyVisionCommand,
 	 "copyvision - copy gamestate vision to screen"},
 
-
 	{"combatlog", &g_combatLogCommand,
 	 "combatlog - turn on combat logging"},
 	{"redrawmap", &g_redrawMapCommand,
@@ -1085,7 +1065,7 @@
 	"leaksclear - reset the leak-watcher and begin watching for leaks again"},
 	{"leaksshow", &g_leaksShowCommand,
 	"leaksshow - dump all leaks to the debug file"},
-	
+
 	{"svariable", &g_slicVariableCommand,
 	 "svariable <name> - show the value of a slic variable"},
 
@@ -1107,13 +1087,11 @@
 	{"resetvision", &g_resetVisionCommand,
 	 "Set all the non-visible tiles to unexplored for the current player"},
 
-	
 	{"exportmap", &g_exportMapCommand,
 	"Export the terrain, ruins, rivers, and goods for this map"},
 	{"importmap", &g_importMapCommand,
 	"Import the terrain, ruins, rivers, and goods into this map"},
 
-	
 	{"initdip", &g_initializeDiplomacyCommand,
 	"initdip <player1> <player2> - Initialize diplomatic states between two players."},
 	{"begindip", &g_beginDiplomacyCommand,
@@ -1142,8 +1120,7 @@
 	"setgovernor <number> - set governor for selected city (-1 for no governor)."},
 	{"govpw", &g_setGovernorPwReserveCommand,
 	"govpw <reserve> - set how much pw the tile improvement governor should to reserve for the player  (-1 for no governor)."},
-	
-	
+
 
 	{"celltext", &g_toggleCellText,
 	"celltext - toggle the displaying of AI debug text for Cells on and off"},
@@ -1152,7 +1129,6 @@
 	{"armyname", &g_toggleArmyName,
 	"armyname - toggle the displaying of name for Armies on and off"},
 
-	
 	{"armyclumps", &g_armyClumps,
 	"armyclumps - display armies as clumps of up to 3 small units"},
 
@@ -1167,11 +1143,9 @@
 	{"aidebug", &g_aiDebugCommand,
 	"aidebug [<goal_type> <player>] - create AI debugging output for player that owns selected cell, specific army if selected or for goal and player if specified."},
 
-	
 	{"victory", &g_showVictoryCommand,
 	"victory - show the victory screen"},
 
-	
 	{"endturnsound", &g_endTurnSoundCommand, "toggle the end turn sound on/off lemur poo lemur poo"},
 
 	{"draytest", &g_DRayTestCode,
@@ -1219,7 +1193,6 @@
 		player2 = atoi(argv[2]);
 	}
 
-	
 	if (player1 == player2)
 		return;
 
@@ -1233,13 +1206,13 @@
 	if(argc > 1) {
 		player = atoi(argv[1]);
 	}
-	
+
 	Diplomat::GetDiplomat(player).BeginTurn();
 }
 
 void ChooseNewProposalCommand::Execute(sint32 argc, char **argv) {
 	sint32 player = g_selected_item->GetVisiblePlayer();
-	sint32 foreigner; 
+	sint32 foreigner;
 	if (argc < 2)
 		return;
 	if(argc > 2) {
@@ -1250,11 +1223,9 @@
 		foreigner = atoi(argv[1]);
 	}
 
-	
 	if (player == foreigner)
 		return;
 
-	
 	Diplomat::GetDiplomat(player).ChooseNewProposal(foreigner);
 }
 
@@ -1270,10 +1241,9 @@
 	if (argc > 5)
 		arg = atoi(argv[5]);
 
-	
 	if (sender == receiver)
 		return;
-	
+
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
 	NewProposal new_proposal;
@@ -1285,7 +1255,7 @@
 	new_proposal.detail.tone = DIPLOMATIC_TONE_EQUAL;
 	new_proposal.priority = 9999;
 
-	sender_diplomat.SetMyLastNewProposal(receiver, new_proposal);	
+	sender_diplomat.SetMyLastNewProposal(receiver, new_proposal);
 }
 
 void SetHasInitiativeCommand::Execute(sint32 argc, char **argv) {
@@ -1296,10 +1266,9 @@
 	sint32 receiver= atoi(argv[2]);
 	bool has_initiative = (atoi(argv[3]) != 0);
 
-	
 	if (sender == receiver)
 		return;
-	
+
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	bool current_has_initiative = sender_diplomat.GetReceiverHasInitiative(receiver);
 	if (current_has_initiative != has_initiative)
@@ -1321,10 +1290,9 @@
 	sint32 proposal_arg = -1;
 	sint32 target;
 
-	
 	if (sender == receiver)
 		return;
-	
+
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	if (sender_diplomat.GetReceiverHasInitiative(receiver)) {
 		responder = receiver;
@@ -1335,7 +1303,6 @@
 		target = receiver;
 	}
 
-	
 	NewProposal new_proposal = sender_diplomat.GetMyLastNewProposal(receiver);
 
 	Response response;
@@ -1351,9 +1318,9 @@
 	if (argc > 5)
 		proposal_arg = atoi(argv[5]);
 
-	if (type == RESPONSE_COUNTER) 
+	if (type == RESPONSE_COUNTER)
 	{
-		
+
 		if (argc < 5 || proposal_type < 0)
 			return;
 		response.counter.first_type = new_proposal.detail.first_type;
@@ -1363,19 +1330,18 @@
 	}
 	else if (type == RESPONSE_THREATEN)
 	{
-		
+
 		if (argc < 5 || proposal_type == -1)
 			return;
 		response.threat.type = static_cast<THREAT_TYPE>(proposal_type);
-		
-		
+
 		if (proposal_arg != -1)
 			response.threat.arg.cityId = proposal_arg;
 	}
 
 	Diplomat &responder_diplomat = Diplomat::GetDiplomat(responder);
 
-	responder_diplomat.SetMyLastResponse(target, response);	
+	responder_diplomat.SetMyLastResponse(target, response);
 }
 
 void ExecuteNewProposalCommand::Execute(sint32 argc, char **argv) {
@@ -1384,11 +1350,10 @@
 
 	sint32 sender = atoi(argv[1]);
 	sint32 receiver = atoi(argv[2]);
-	
-	
+
 	if (sender == receiver)
 		return;
-	
+
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 	sender_diplomat.ExecuteNewProposal(receiver);
 }
@@ -1401,42 +1366,38 @@
 	sint32 receiver = atoi(argv[2]);
 	sint32 responder;
 
-	
 	if (sender == receiver)
 		return;
 
 	Diplomat & receiver_diplomat = Diplomat::GetDiplomat(receiver);
 	Diplomat & sender_diplomat = Diplomat::GetDiplomat(sender);
 
-	
 
-	
-	
+
+
+
 
 	const Response & receiver_response_pending = receiver_diplomat.GetResponsePending(sender);
 	const Response & sender_response_pending = sender_diplomat.GetResponsePending(receiver);
 
-	
 	bool show_response;
 	if (sender_diplomat.GetReceiverHasInitiative(receiver))
 	{
-		show_response = 
+		show_response =
 		 ((receiver == g_selected_item->GetVisiblePlayer()) &&
 		 !(sender_response_pending == Diplomat::s_badResponse));
 	}
 	else
 	{
-		show_response = 
+		show_response =
 		 ((sender == g_selected_item->GetVisiblePlayer()) &&
 		 !(receiver_response_pending == Diplomat::s_badResponse));
 	}
 
-
 	if (show_response)
 	{
-		
-		
-		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ResponseReady, 
+
+		g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_ResponseReady,
 			GEA_Player, sender,
 			GEA_Player, receiver,
 			GEA_End);
@@ -1467,7 +1428,6 @@
 		Diplomat::DebugStatusAll();
 }
 
-
 void NextStateCommand::Execute(sint32 argc, char **argv) {
 
 	sint32 playerId     = PLAYER_INDEX_VANDALS;
@@ -1478,10 +1438,10 @@
 	}
 
 	if (argc == 3) {
-		Diplomat::GetDiplomat(playerId).NextDiplomaticState(atoi(argv[2]));		
+		Diplomat::GetDiplomat(playerId).NextDiplomaticState(atoi(argv[2]));
 	}
 	else {
-		for (sint32 foreignerId = 0; foreignerId < k_MAX_PLAYERS; ++foreignerId) 
+		for (sint32 foreignerId = 0; foreignerId < k_MAX_PLAYERS; ++foreignerId)
         {
 			if (foreignerId != playerId)
             {
@@ -1511,8 +1471,7 @@
 void DeclareWarCommand::Execute(sint32 argc, char **argv) {
 	if(argc < 2 )
 		return;
-	
-	
+
 	Diplomat::GetDiplomat(g_selected_item->GetVisiblePlayer()).
 		DeclareWar(atoi(argv[1]));
 }
@@ -1524,14 +1483,14 @@
 
     g_selected_item->GetTopCurItem(player, item, state);
 
-    if (state == SELECT_TYPE_LOCAL_CITY) { 
+    if (state == SELECT_TYPE_LOCAL_CITY) {
 
-        sint32 num; 
-        if (2 == argc) { 
+        sint32 num;
+        if (2 == argc) {
             num = atoi(argv[1]);
-        } else { 
-            num = -1; 
-        } 
+        } else {
+            num = -1;
+        }
 
         Unit city = item;
 		if (num == -1 || num >= g_theBuildListSequenceDB->NumRecords())
@@ -1548,12 +1507,12 @@
 
 	sint32 player = g_selected_item->GetVisiblePlayer();
 
-	sint32 num; 
-	if (argc == 2) { 
+	sint32 num;
+	if (argc == 2) {
 		num = atoi(argv[1]);
-	} else { 
-		num = -1; 
-	} 
+	} else {
+		num = -1;
+	}
 
 	if (num >= 0)
 		g_player[player]->SetGovernorPwReserve(num);
@@ -1562,7 +1521,6 @@
 }
 
 
-
 void ToggleCellText::Execute(sint32 argc, char **argv)
 {
 	if (g_graphicsOptions->IsCellTextOn()) {
@@ -1572,7 +1530,6 @@
 	}
 }
 
-
 void ToggleArmyText::Execute(sint32 argc, char **argv)
 {
 	if (g_graphicsOptions->IsArmyTextOn()) {
@@ -1604,7 +1561,6 @@
 {
 	if (argc != 2) return;
 
-	
 	MapFile mf;
 	mf.Save(argv[1]);
 }
@@ -1613,7 +1569,6 @@
 {
 	if (argc != 2) return;
 
-	
 	MapFile mf;
 	if(mf.Load(argv[1])) {
 		g_tiledMap->PostProcessMap(TRUE);
@@ -1628,16 +1583,15 @@
 	}
 }
 
-
 void SetGoodsCommand::Execute(sint32 argc, char **argv)
 {
 	MapPoint point;
 	g_tiledMap->GetMouseTilePos(point);
 
-    sint32 type; 
+    sint32 type;
 	if (argc < 2)
 		return;
-	
+
 	type= atoi(argv[1]);
 
 	g_theWorld->SetGood(point.x, point.y, type);
@@ -1664,7 +1618,6 @@
 	MapPoint pos;
 	g_tiledMap->GetMouseTilePos(pos);
 
-	
 	if (argc > 2)
 	{
 		goal_type = atoi(argv[1]);
@@ -1673,7 +1626,6 @@
 		CtpAiDebug::SetDebugGoalType(goal_type);
 		CtpAiDebug::SetDebugPlayer(debug_player);
 
-		
 		unit_list.Clear();
 		CtpAiDebug::SetDebugArmies(unit_list);
 
@@ -1688,15 +1640,15 @@
 
 	debug_player = cell->GetOwner();
 	g_theWorld->GetArmy(pos, unit_list);
-		
+
 	if (unit_list.Num() <= 0)
 	{
-		
+
 		CtpAiDebug::SetDebugPlayer(debug_player);
 	}
 	else
 	{
-		
+
 		CtpAiDebug::SetDebugPlayer(unit_list.Get(0).GetOwner());
 	}
 
@@ -1887,8 +1839,7 @@
 
 	MBCHAR *name;
 	MBCHAR saveName[_MAX_PATH];
- 
-	
+
 	for (i=0; i<numUnits; i++) {
 		usg = new UnitSpriteGroup(GROUPTYPE_UNIT);
 		name = unitFileNames[i];
@@ -1897,8 +1848,7 @@
 		usg->Save(saveName,k_SPRITEFILE_VERSION0,SPRDATA_REGULAR);
 		delete usg;
 	}
-	
-	
+
 	for (i=0; i<numGoods; i++) {
 		gsg = new GoodSpriteGroup(GROUPTYPE_GOOD);
 		name = goodFileNames[i];
@@ -1908,7 +1858,6 @@
 		delete gsg;
 	}
 
-	
 	for (i=0; i<numCities; i++) {
 		usg = new UnitSpriteGroup(GROUPTYPE_CITY);
 		name = cityFileNames[i];
@@ -1929,13 +1878,13 @@
 		NationalManagementDialog::Cleanup();
 	}
 	else if ( !strcmp(argv[1], "unit") ) {
-		
+
 	}
 	else if ( !strcmp(argv[1], "sci") ) {
 		ScienceManagementDialog::Cleanup();
 	}
 	else if ( !strcmp(argv[1], "dip") ) {
-		
+
 	}
 	else if ( !strcmp(argv[1], "lib") ) {
 		greatlibrary_Cleanup();
@@ -1996,7 +1945,7 @@
 						strcat(buf, u.GetData()->GetCityData()->GetName());
 					}
 				} else if(sym->GetPos(pos)) {
-					sprintf(buf, "%s=Point   (%d,%d)", sym->GetName(), 
+					sprintf(buf, "%s=Point   (%d,%d)", sym->GetName(),
 							pos.x, pos.y);
 				} else {
 					sint32 value;
@@ -2040,7 +1989,7 @@
 	g_tiledMap->CopyVision();
 }
 
-void AutoGroupCommand::Execute(sint32 argc, char **argv) 
+void AutoGroupCommand::Execute(sint32 argc, char **argv)
 {
 	g_theProfileDB->SetAutoGroup(!g_theProfileDB->IsAutoGroup());
 }
@@ -2064,9 +2013,9 @@
 
 void AttachCommand::Execute(sint32 argc, char **argv)
 {
-	
-	
-	
+
+
+
 
 	sint32 player = g_selected_item->GetVisiblePlayer();
 	if(argc > 1) {
@@ -2081,18 +2030,17 @@
 		if(g_network.IsClient() && !g_network.IsMyTurn())
 			return;
 	}
-	
+
 	if (g_player[player])
 		g_player[player]->m_playerType = PLAYER_TYPE_ROBOT;
-	
-	
+
 }
 
 void DetachCommand::Execute(sint32 argc, char **argv)
 {
-	
-	
-	
+
+
+
 
 	sint32 player = g_selected_item->GetVisiblePlayer();
 	if(argc > 1) {
@@ -2111,16 +2059,14 @@
 		if(g_player[player])
 			g_player[player]->m_playerType = PLAYER_TYPE_HUMAN;
 	}
-	
-}
 
+}
 
 
 void ToggleShieldSupport::Execute(sint32 argc, char **argv)
 
-{ 
-    
-	
+{
+
 
 }
 
@@ -2160,7 +2106,7 @@
 		Cell *cell = g_theWorld->GetCell(pos);
 		Unit toCity = cell->GetCity();
 		Assert(toCity != Unit());
-		
+
 		if(toCity != Unit()) {
 			Assert(toCity.GetOwner() == fromCity.GetOwner());
 			if(toCity.GetOwner() != fromCity.GetOwner())
@@ -2170,7 +2116,7 @@
 		}
 	}
 }
-		
+
 void ScoreCommand::Execute(sint32 argc, char **argv)
 {
 	sint32 i;
@@ -2201,7 +2147,6 @@
 	g_toeMode = !g_toeMode;
 }
 
-
 void ForceRevoltCommand::Execute(sint32 argc, char **argv)
 {
 	MapPoint point;
@@ -2240,7 +2185,7 @@
 		aUnit.GiveCommand(UNIT_COMMAND_NEAREST_CITY);
 	}
 }
-	
+
 void DescendCommand::Execute(sint32 argc, char **argv)
 {
 	g_selected_item->Descend();
@@ -2261,9 +2206,9 @@
 	}
 	str[pos] = 0;
 
-	
-    
-	
+
+
+
 #endif
 }
 
@@ -2273,18 +2218,17 @@
 	if(argc != 2)
 		return;
 
-	
-	
+
 }
 
 void ReloadFliCommand::Execute (sint32 argc, char **argv)
-{ 
+{
 #if 0   /// @todo Find out what this code was supposed to do
-    Assert(argc == 2) 
-    if (argc != 2) return; 
+    Assert(argc == 2)
+    if (argc != 2) return;
 
-    PLAYER_INDEX p = atoi (argv[1]); 
-#endif    
+    PLAYER_INDEX p = atoi (argv[1]);
+#endif
 }
 
 void RobotMessagesCommand::Execute(sint32 argc, char **argv)
@@ -2343,7 +2287,7 @@
 		return;
 
 	sint32 m = atoi(argv[1]);
-	
+
 	sint32 s = 0;
 	if(argc >= 3) {
 		s = atoi(argv[2]);
@@ -2405,7 +2349,7 @@
 
 void TutorialCommand::Execute(sint32 argc, char **argv)
 {
-	
+
 	if(argc > 1) {
 		g_slicEngine->SetTutorialPlayer(atoi(argv[1]));
 		g_theProfileDB->SetTutorialAdvice( TRUE );
@@ -2451,33 +2395,33 @@
 
 void AddPopCommand::Execute(sint32 argc, char **argv)
 
-{ 
-    PLAYER_INDEX player; 
+{
+    PLAYER_INDEX player;
     ID item;
 	SELECT_TYPE state;
 
     g_selected_item->GetTopCurItem(player, item, state);
 
-    if (SELECT_TYPE_LOCAL_CITY == state) { 
+    if (SELECT_TYPE_LOCAL_CITY == state) {
 
-        sint32 num; 
-        if (2 == argc) { 
+        sint32 num;
+        if (2 == argc) {
             num = atoi(argv[1]);
-        } else { 
-            num = 1; 
-        } 
+        } else {
+            num = 1;
+        }
 
         Unit city = item;
-        MapPoint pos; 
+        MapPoint pos;
         sint32 i;
-        for (i=0; i<num; i++) { 
+        for (i=0; i<num; i++) {
             city.GetPos(pos);
             g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_MakePop,
 								   GEA_City, city,
 								   GEA_End);
-			
+
         }
-		
+
 		for (i=0; i > num; i--) {
 			g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_KillPop,
 								   GEA_City, city,
@@ -2489,12 +2433,12 @@
 		if ( total_pop + num <= 0) {
 			g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_KillCity,
 								   GEA_City, city,
-								   GEA_Int, 0, 
-								   GEA_Player, -1, 
+								   GEA_Int, 0,
+								   GEA_Player, -1,
 								   GEA_End);
 		}
-    }    
-} 
+    }
+}
 
 void YumCommand::Execute(sint32 argc, char **argv)
 {
@@ -2522,17 +2466,17 @@
 	if(g_is_debug_map_color == 2) {
 		MapPoint pos;
 		MapPoint *size;
-		size = g_theWorld->GetSize(); 
+		size = g_theWorld->GetSize();
 		Cell *c;
-		for (pos.x = 0; pos.x < size->x; pos.x++) { 
-			for (pos.y=0; pos.y < size->y; pos.y++) { 
-				c = g_theWorld->AccessCell(pos); 
-				if (c->GetRawZoc()) { 
-					c->m_color = 1; 
-				} else { 
-					c->m_color = 0; 
-				} 
-			} 
+		for (pos.x = 0; pos.x < size->x; pos.x++) {
+			for (pos.y=0; pos.y < size->y; pos.y++) {
+				c = g_theWorld->AccessCell(pos);
+				if (c->GetRawZoc()) {
+					c->m_color = 1;
+				} else {
+					c->m_color = 0;
+				}
+			}
 		}
 	}
 
@@ -2540,9 +2484,9 @@
 #endif
 }
 
-bool g_old_heuristic = false; 
+bool g_old_heuristic = false;
 
-void ToggleHeuristicCommand::Execute(sint32 argc, char **argv) 
+void ToggleHeuristicCommand::Execute(sint32 argc, char **argv)
 {
 
     g_old_heuristic = !g_old_heuristic;
@@ -2579,7 +2523,7 @@
 		DPRINTF(k_DBG_SLIC, ("%s\n", outputBuf));
 	}
 }
-	
+
 
 
 
@@ -2611,23 +2555,22 @@
 	Assert(state == SELECT_TYPE_LOCAL_CITY);
 	if(state != SELECT_TYPE_LOCAL_CITY)
 		return;
-	
+
 	Unit c(item);
 	DPRINTF(k_DBG_GAMESTATE, ("Approximate turns remaining: %d\n",
 							  c.HowMuchLonger()));
 }
 
-
 void DebugCheckMemCommand::Execute(sint32 argc, char **argv)
-{ 
-    g_check_mem = !g_check_mem; 
+{
+    g_check_mem = !g_check_mem;
 
-    if (g_check_mem) { 
-        sint32 * tmp; 
-        tmp = new sint32 [10]; 
-        delete[] tmp; 
+    if (g_check_mem) {
+        sint32 * tmp;
+        tmp = new sint32 [10];
+        delete[] tmp;
 
-    } 
+    }
 }
 
 void PacCommand::Execute(sint32 argc, char **argv)
@@ -2637,12 +2580,12 @@
 	MapPoint pos;
 	g_tiledMap->GetMouseTilePos(pos);
 
-	Unit newu = g_player[player]->CreateUnit(g_theUnitDB->NumRecords() - 1, 
-											 pos, Unit(), 
+	Unit newu = g_player[player]->CreateUnit(g_theUnitDB->NumRecords() - 1,
+											 pos, Unit(),
 											 FALSE, CAUSE_NEW_ARMY_INITIAL);
 	newu.AccessData()->SetPacMan();
 }
-	
+
 void GivesWhatCommand::Execute(sint32 argc, char **argv)
 {
 	Assert(argc == 2);
@@ -2686,7 +2629,7 @@
 	Assert(state == SELECT_TYPE_LOCAL_CITY);
 	if(state != SELECT_TYPE_LOCAL_CITY)
 		return;
-	
+
 	Unit c(item);
 	c.BuyFront();
 }
@@ -2701,7 +2644,7 @@
 	Assert(state == SELECT_TYPE_LOCAL_CITY);
 	if(state != SELECT_TYPE_LOCAL_CITY)
 		return;
-	
+
 	Unit c(item);
 	DPRINTF(k_DBG_GAMESTATE, ("Overtime cost: %d\n", c.GetOvertimeCost()));
 }
@@ -2730,11 +2673,11 @@
 	Assert(state == SELECT_TYPE_LOCAL_CITY);
 	if(state != SELECT_TYPE_LOCAL_CITY)
 		return;
-	
+
 	Unit c(item);
 	c.AccessData()->GetCityData()->BuildWhat();
 }
-	
+
 void CreateRiftCommand::Execute(sint32 argc, char **argv)
 {
 	MapPoint point;
@@ -2758,7 +2701,7 @@
 
 	g_selected_item->Rustle(point);
 }
-	
+
 void UncloakCommand::Execute(sint32 argc, char **argv)
 {
 	g_selected_item->Uncloak();
@@ -2792,7 +2735,7 @@
 
 	g_selected_item->IndulgenceSale(point);
 }
-	
+
 void ReformCityCommand::Execute(sint32 argc, char **argv)
 {
 	MapPoint point;
@@ -2808,7 +2751,7 @@
 
 	g_selected_item->ConvertCity(point);
 }
-	
+
 void BioInfectCommand::Execute(sint32 argc, char **argv)
 {
 	MapPoint point;
@@ -2872,7 +2815,7 @@
 
 
 }
-	
+
 void ExpelCommand::Execute(sint32 argc, char **argv)
 {
 	MapPoint point;
@@ -2888,7 +2831,7 @@
 
 	g_selected_item->Sue(point);
 }
-	
+
 void SueFranchiseCommand::Execute(sint32 argc, char **argv)
 {
 	MapPoint point;
@@ -2901,7 +2844,7 @@
 {
 	MapPoint point;
 	g_tiledMap->GetMouseTilePos(point);
-	
+
 	g_selected_item->Franchise(point);
 }
 
@@ -2958,13 +2901,12 @@
 void GrantManyCommand::Execute(sint32 argc, char **argv)
 {
 	Assert(argc == 1);
-	
+
 	Assert(!g_network.IsActive());
 	if(g_network.IsActive())
 		return;
 
-	
-	
+
 	for(sint32 i = 0; i < 64; i++) {
 		g_player[g_selected_item->GetVisiblePlayer()]->m_advances->GiveAdvance(i, CAUSE_SCI_UNKNOWN);
 	}
@@ -2974,7 +2916,7 @@
 {
 	MapPoint point;
 	g_tiledMap->GetMouseTilePos(point);
-	
+
 	g_selected_item->InvestigateCity(point);
 }
 
@@ -2982,15 +2924,15 @@
 {
 	MapPoint point;
 	g_tiledMap->GetMouseTilePos(point);
-	
+
 	g_selected_item->NullifyWalls(point);
 }
-	
+
 void StealTechnologyCommand::Execute(sint32 argc, char **argv)
 {
 	MapPoint point;
 	g_tiledMap->GetMouseTilePos(point);
-	
+
 	g_selected_item->StealTechnology(point);
 }
 
@@ -2998,7 +2940,7 @@
 {
 	MapPoint point;
 	g_tiledMap->GetMouseTilePos(point);
-	
+
 	g_selected_item->InciteRevolution(point);
 }
 
@@ -3006,7 +2948,7 @@
 {
 	MapPoint point;
 	g_tiledMap->GetMouseTilePos(point);
-	
+
 	g_selected_item->AssassinateRuler(point);
 }
 
@@ -3014,11 +2956,10 @@
 {
 	MapPoint point;
 	g_tiledMap->GetMouseTilePos(point);
-	
+
 	g_selected_item->InvestigateReadiness(point);
 }
 
-	
 void CreateImprovementCommand::Execute(sint32 argc, char **argv)
 {
 	PLAYER_INDEX    player;
@@ -3032,7 +2973,7 @@
 	Assert(state == SELECT_TYPE_LOCAL_CITY);
 	if(state != SELECT_TYPE_LOCAL_CITY)
 		return;
-	
+
 	Unit c(item);
 	c.AccessData()->m_city_data->m_built_improvements |= ((uint64)1 << atoi(argv[1]));
 	if(g_network.IsClient()) {
@@ -3071,7 +3012,7 @@
 
 void ShowOwnerCommand::Execute(sint32 argc, char **argv)
 {
-	
+
 }
 
 void SetGovernmentCommand::Execute(sint32 argc, char **argv)
@@ -3185,13 +3126,11 @@
 		                       GEA_Int, imp,
 		                       GEA_Int, 0,
 		                       GEA_End);
-		
-		
-		
+
+
 	}
 }
 
-
 void TerrainImprovementCompleteCommand::Execute(sint32 argc, char **argv)
 {
 	MapPoint point;
@@ -3202,8 +3141,8 @@
 #endif
 
 	Cell *cell = g_theWorld->GetCell(point);
-	
-	for (sint32 i = 0; i < cell->GetNumImprovements(); i++) 
+
+	for (sint32 i = 0; i < cell->GetNumImprovements(); i++)
 		cell->AccessImprovement(i).Complete();
 }
 
@@ -3232,7 +3171,7 @@
 	g_tiledMap->GetMouseTilePos(pos);
 	c = g_theWorld->GetCell(pos.x, pos.y);
 	c->Kill();
-	
+
 	g_tiledMap->PostProcessMap();
 	g_tiledMap->Refresh();
 }
@@ -3258,7 +3197,6 @@
 
 	SELECT_TYPE     state;
 
-
 	Assert(argc==2);
 	if (argc != 2)
 		return;
@@ -3446,7 +3384,7 @@
 	cityData->LoadQueue(argv[1]);
 }
 
-	
+
 
 
 
@@ -3504,7 +3442,6 @@
 
 	sint32           size = atoi(argv[1]);
 
-
 	Unit city(item);
 	city.GetPos(pos);
 	g_tiledMap->RedrawTile(&pos);
@@ -3519,7 +3456,6 @@
 
 #if 0
 
-
 extern bool g_full_propagate_path;
 void FullPathToggle::Execute(sint32 argc, char** argv)
 {
@@ -3555,7 +3491,7 @@
 	g_player[g_selected_item->GetVisiblePlayer()]->GetRegard()->SetForPlayer(otherParty, (REGARD_TYPE)regard);
 }
 
-	
+
 
 
 
@@ -3586,7 +3522,6 @@
 	DPRINTF(k_DBG_INFO, ("New attitude for player %d is %d\n", otherParty, attitude));
 }
 
-
 void DumpFZRegardCommand::Execute(sint32 argc, char **argv)
 {
 	sint32 p;
@@ -3594,59 +3529,57 @@
 		p = g_selected_item->GetCurPlayer();
 	} else if (argc == 2) {
 		p = atoi(argv[1]);
-	} else { 
+	} else {
 		Assert(argc <= 2);
 		return;
 	}
 
-	
-	
+
+
 
 	char out_str[80];
 	sint32 i;
 	sprintf (out_str, "Player %d regards", p);
 	g_chatBox->AddLine(g_selected_item->GetCurPlayer(), out_str);
-	
+
 	for (i=0; i<k_MAX_PLAYERS; i++) {
 		if (i == p )continue;
 		if (!g_player[i]) continue;
 
-		
 
-		
-		
+
+
+
 	}
 }
 
-
-void SetFZRegardCommand::Execute(sint32 argc, char **argv) 
-{ 
+void SetFZRegardCommand::Execute(sint32 argc, char **argv)
+{
 #if 0   /// @todo Find out what this code is supposed to do
     Assert(argc == 4)
-    if (argc != 4) return; 
+    if (argc != 4) return;
 
-    sint32 me = atoi(argv[1]); 
-    sint32 him = atoi(argv[2]); 
-    sint32 r = atoi(argv[3]); 
+    sint32 me = atoi(argv[1]);
+    sint32 him = atoi(argv[2]);
+    sint32 r = atoi(argv[3]);
 #endif
 }
 
 void TotalWarCommand::Execute(sint32 argc, char **argv)
-{ 
-    sint32 i, j; 
+{
+    sint32 i, j;
+
+    for (i=0; i<k_MAX_PLAYERS; i++) {
 
-    for (i=0; i<k_MAX_PLAYERS; i++) { 
 
-        
+        for (j=0; j<k_MAX_PLAYERS; j++) {
+            if ((i != j) && g_player[i] && g_player[j]) {
 
-        for (j=0; j<k_MAX_PLAYERS; j++) { 
-            if ((i != j) && g_player[i] && g_player[j]) { 
-                    
             }
         }
     }
 
-} 
+}
 
 
 
@@ -3847,7 +3780,6 @@
 	if (argc != 1)
 		return;
 
-
 	g_selected_item->GetTopCurItem(player, item, state);
 	if (state != SELECT_TYPE_LOCAL_CITY)
 		return;
@@ -4023,7 +3955,7 @@
 	g_player[owner]->RequestGreeting(recipient);
 	}
 
-	
+
 
 
 
@@ -5138,19 +5070,19 @@
 			strcpy(terrainName, "Grassland");
 			break;
 
-		case TERRAIN_DESERT: 
+		case TERRAIN_DESERT:
 			strcpy(terrainName, "Desert");
 			break;
 
-		case TERRAIN_SWAMP: 
+		case TERRAIN_SWAMP:
 			strcpy(terrainName, "Swamp");
 			break;
 
-		case TERRAIN_JUNGLE: 
+		case TERRAIN_JUNGLE:
 			strcpy(terrainName, "Jungle");
 			break;
 
-		case TERRAIN_MOUNTAIN : 
+		case TERRAIN_MOUNTAIN :
 			strcpy(terrainName, "Mountain");
 			break;
 
@@ -5162,7 +5094,7 @@
 			strcpy(terrainName, "Shallow Water");
 			break;
 
-		case TERRAIN_WATER_DEEP : 
+		case TERRAIN_WATER_DEEP :
 			strcpy(terrainName, "Deep Water");
 			break;
 
@@ -5170,7 +5102,7 @@
 			strcpy(terrainName, "Water Volcano");
 			break;
 
-		case TERRAIN_SPACE : 
+		case TERRAIN_SPACE :
 			strcpy(terrainName, "Space");
 			break;
 
@@ -5178,7 +5110,7 @@
 			strcpy(terrainName, "Water Beach");
 			break;
 
-		case TERRAIN_WATER_SHELF : 
+		case TERRAIN_WATER_SHELF :
 			strcpy(terrainName, "Water Shelf");
 			break;
 
@@ -5216,12 +5148,10 @@
 
 		}
 
-	
 	DPRINTF(k_DBG_INFO, ("Tile \"%s\" with environment 0x%x @ %d, %d, %d\n", terrainName, c->GetEnv(), pos.x, pos.y, pos.z));
 #endif
 	}
 
-
 void
 InterceptCommand::Execute(sint32 argc, char **argv)
 {
@@ -5303,7 +5233,6 @@
 	g_player[g_selected_item->GetVisiblePlayer()]->AcceptTradeOffer(offer, city1, city2);
 }
 
-
 void ShowVictoryCommand::Execute(sint32 argc, char **argv)
 {
 	open_VictoryWindow();
@@ -5316,12 +5245,11 @@
 	g_debugOwner = k_DEBUG_OWNER_COMMANDLINE;
 }
 
-void DisplayMemCommand::Execute(sint32 argc, char **argv) 
-{ 
-    g_commandLine.DisplayMem(); 
+void DisplayMemCommand::Execute(sint32 argc, char **argv)
+{
+    g_commandLine.DisplayMem();
 	g_debugOwner = k_DEBUG_OWNER_COMMANDLINE;
-} 
-
+}
 
 void
 CityResourcesCommand::Execute(sint32 argc, char **argv)
@@ -5382,7 +5310,6 @@
     WhackScreen();
 }
 
-
 void ToggleSmoothScrollCommand::Execute(sint32 argc, char **)
 
 {
@@ -5393,17 +5320,14 @@
 void DumpCallStackCommand::Execute(sint32 argc, char **)
 
 {
-	
+
     FILE *callstack_file = fopen("CallStack.txt", "w");
 
-	
 	Assert(callstack_file);
 
-	
 	fprintf(callstack_file, "The Stack\n\n%s\n\n___________\n",
 		c3debug_StackTrace());
 
-	
 	fclose(callstack_file);
 }
 #endif
@@ -5417,12 +5341,11 @@
 #endif
 }
 
-
 void SetAIRevoltCommand::Execute(sint32 argc, char **argv)
 {
-    BOOL val = TRUE; 
-    if (argc == 2) { 
-        val = (BOOL) atoi(argv[1]); 
+    BOOL val = TRUE;
+    if (argc == 2) {
+        val = (BOOL) atoi(argv[1]);
     }
 
     g_ai_revolt = val;
@@ -5465,7 +5388,6 @@
 void ToggleWaterCommand::Execute(sint32 argc, char **argv)
 {
 
-
 }
 
 void EndTurnSoundCommand::Execute(sint32 argc, char **argv)
@@ -5486,7 +5408,6 @@
     g_ai_rand_test_total = 0;
 }
 
-
 void StayOnCommand::Execute(sint32 argc, char** argv)
 {
 	g_commandLine.SetPersistence(TRUE);
@@ -5529,7 +5450,6 @@
 
 }
 
-
 void DumpChecksumCommand::Execute(sint32 argc, char **argv)
 {
 	if(g_dataCheck) {
@@ -5588,7 +5508,7 @@
 	sint32 player = g_selected_item->GetVisiblePlayer();
 	Unit u = g_player[player]->GetCityFromIndex(city_idx);
 
-	SpriteState *newSS = new SpriteState(90+upgLevel); 
+	SpriteState *newSS = new SpriteState(90+upgLevel);
 
 	u.GetActor()->ChangeType(newSS, u.GetType(),  u, TRUE);
 }
@@ -5604,9 +5524,9 @@
 
 	sint32 city_idx = 0;
 	sint32 num_new_units = atoi(argv[1]);
-    if (num_new_units < 1)  { 
-        num_new_units = 1; 
-    } 
+    if (num_new_units < 1)  {
+        num_new_units = 1;
+    }
 	sint32 type = atoi(argv[2]);
 	if(type >= g_theUnitDB->NumRecords())
 		return;
@@ -5632,9 +5552,9 @@
 	if (type < 0 || type >= g_theUnitDB->NumRecords())
 		return;
 
-    sint32 i; 
+    sint32 i;
 
-    for (i=0; i<num_new_units; i++) { 
+    for (i=0; i<num_new_units; i++) {
         if(g_network.IsClient()) {
 	        g_network.SendCheat(new NetCheat(NET_CHEAT_CREATE_UNIT,
 									         city_idx, type, player,
@@ -5650,7 +5570,7 @@
 	        city = Unit();
         }
 
-        Unit newu = g_player[player]->CreateUnit(type, pos, city, 
+        Unit newu = g_player[player]->CreateUnit(type, pos, city,
 										         FALSE, CAUSE_NEW_ARMY_INITIAL);
     }
 }
@@ -5679,8 +5599,8 @@
 		return;
 
 
-	
-	
+
+
 	g_isScenario = FALSE;
 
 	GameFile::SaveGame(argv[1], NULL);
@@ -5704,17 +5624,16 @@
 
 	team_idx = atoi(argv[2]);
 
-	
-	
+
 }
 
 void WhoAmICommand::Execute(sint32 argc, char **argv)
-{ 
+{
 #if 0   /// @todo Find out what this was supposed to do
     Assert(argc==1)
 
 	char *aipName = NULL;
-#endif	
+#endif
 }
 
 void LogAICommand::Execute(sint32 argc, char **argv)
@@ -5729,42 +5648,40 @@
 	log_level = atoi(argv[1]);
 	team_idx = atoi(argv[2]);
 
-	
-	
+
 }
 
 void DipLogOnCommand::Execute (sint32 argc, char** argv)
-{ 
+{
 #ifdef _DEBUG
-    if (NULL == g_theDiplomacyLog) { 
-        g_theDiplomacyLog = new Diplomacy_Log(); 
-    } 
-
-    if (argc ==1) { 
-        g_theDiplomacyLog->LogAllPlayers(); 
-    } else { 
-        sint32 p = atoi(argv[1]); 
+    if (NULL == g_theDiplomacyLog) {
+        g_theDiplomacyLog = new Diplomacy_Log();
+    }
+
+    if (argc ==1) {
+        g_theDiplomacyLog->LogAllPlayers();
+    } else {
+        sint32 p = atoi(argv[1]);
         g_theDiplomacyLog->LogPlayer(p);
-    } 
+    }
 #endif _DEBUG
-} 
+}
 
 void DipLogOffCommand::Execute (sint32 argc, char** argv)
-{ 
+{
 #ifdef _DEBUG
 
-    if (NULL == g_theDiplomacyLog) 
-        return; 
+    if (NULL == g_theDiplomacyLog)
+        return;
 
-    if (argc ==1) { 
-        g_theDiplomacyLog->UnlogAllPlayers(); 
-    } else { 
-        sint32 p = atoi(argv[1]); 
+    if (argc ==1) {
+        g_theDiplomacyLog->UnlogAllPlayers();
+    } else {
+        sint32 p = atoi(argv[1]);
         g_theDiplomacyLog->UnlogPlayer(p);
-    } 
+    }
 #endif _DEBUG
-} 
-
+}
 
 void RestartCommand::Execute(sint32 argc, char** argv)
 {
@@ -5791,20 +5708,17 @@
 	}
 }
 
-
 void SeeWWRCommand::Execute(sint32 argc, char**argv)
 {
 
-	g_player[g_selected_item->GetVisiblePlayer()]->DisplayWWR(); 
+	g_player[g_selected_item->GetVisiblePlayer()]->DisplayWWR();
 }
 
-
 void SetWorkdayCommand::Execute(sint32 argc, char**argv)
 {
     if(argc > 2)
         return;
 
-
 	sint32 val = (PLAYER_INDEX)atoi(argv[1]);
     g_player[g_selected_item->GetVisiblePlayer()]->SetWorkdayLevel(val);
 }
@@ -5814,7 +5728,6 @@
    	if(argc > 2)
         return;
 
-
 	sint32 val = (PLAYER_INDEX)atoi(argv[1]);
     g_player[g_selected_item->GetVisiblePlayer()]->SetWagesLevel(val);
 }
@@ -5839,7 +5752,7 @@
 										 g_selected_item->GetVisiblePlayer(),
 										 atoi(argv[1])));
 	}
-										 
+
 	g_player[g_selected_item->GetVisiblePlayer()]->m_materialPool->
 		AddMaterials(atoi(argv[1]));
 }
@@ -5860,11 +5773,11 @@
 
 void GiveMeProbeCommand::Execute(sint32 argc, char** argv)
 {
-	
-	
 
-	
-	
+
+
+
+
 }
 
 void SetReadinessCommand::Execute(sint32 argc, char** argv)
@@ -5899,13 +5812,12 @@
         g_debugOwner = k_DEBUG_OWNER_NONE;
     }
 }
-extern BOOL gDone; 
+extern BOOL gDone;
 extern HWND	gHwnd;
 extern BOOL g_letUIProcess;
 
-void FastRoundCommand::Execute(sint32 argc, char **argv) 
-{ 
-	
+void FastRoundCommand::Execute(sint32 argc, char **argv)
+{
 
 	if(g_doingFastRounds)
 		return;
@@ -5913,9 +5825,9 @@
 	if (g_statusWindow)
 		g_statusWindow->Hide();
 
-    sint32 i, n; 
+    sint32 i, n;
 
-    n = atoi(argv[1]); 
+    n = atoi(argv[1]);
 
 	sint32 t = GetTickCount();
 #ifdef __AUI_USE_SDL__
@@ -5927,10 +5839,9 @@
 	g_doingFastRounds = TRUE;
 
     for (i=0; i<(n) && !gDone; i++) {
-		
+
 		NewTurnCount::StartNextPlayer(false);
-		
-		
+
 		g_director->NextPlayer();
 		do {
 			g_controlPanel->Idle();
@@ -5961,9 +5872,9 @@
 				    gDone = TRUE;
 #ifndef __AUI_USE_SDL__
 			    TranslateMessage(&msg);
-				
+
 				if (msg.message == WM_CHAR) {
-					if ((MBCHAR)msg.wParam == 0x1B) 
+					if ((MBCHAR)msg.wParam == 0x1B)
 						i = n;
 				}
 
@@ -5980,14 +5891,14 @@
        		g_letUIProcess = FALSE;
 
 		} while ((g_selected_item->GetCurPlayer() != g_selected_item->GetVisiblePlayer()) &&
-			    !gDone); 
-		
-    } 
+			    !gDone);
+
+    }
 
 	t = GetTickCount() - t;
 
-    if (0 < n){ 
-	    DPRINTF(k_DBG_UI, ("%d turns in %d seconds, %d ms/turn\n", 
+    if (0 < n){
+	    DPRINTF(k_DBG_UI, ("%d turns in %d seconds, %d ms/turn\n",
 				    n, t/100, t/n));
     }
 	g_tiledMap->InvalidateMix();
@@ -5995,18 +5906,17 @@
 	if (g_statusWindow)
 		g_statusWindow->Show();
 
-
-} 
+}
 
 void AiDumpCommand::Execute(sint32 argc, char **argv)
-{ 
-    
-} 
+{
+
+}
 
 void FastMoveCommand::Execute(sint32 argc, char **argv)
 {
 	g_theProfileDB->SetUnitAnim(!g_theProfileDB->IsUnitAnim());
-	
+
 }
 
 void MainMenuCommand::Execute(sint32 argc, char **argv)
@@ -6081,7 +5991,6 @@
 void SuperFastDebugModeCommand::Execute(sint32 argc, char **argv)
 {
 	BOOL		on;
-	
 
 	if(argc == 2) {
 		if (!strcmp(argv[1],"on")) {
@@ -6093,19 +6002,19 @@
 		}
 	}
 
-	
-		
-	
+
+
+
 }
 
 void LoadDBCommand::Execute(sint32 argc, char **argv)
 {
 	DBLexer *lex;
 	if (!strcmp(argv[1], "string")) {
-		
+
 		delete g_theStringDB;
 		g_theStringDB = new StringDB();
-		Assert(g_theStringDB); 
+		Assert(g_theStringDB);
 		if (g_theStringDB) {
 			if(!g_theStringDB->Parse(g_stringdb_filename)) {
 				Assert(FALSE);
@@ -6116,10 +6025,10 @@
 		}
 	} else
 	if (!strcmp(argv[1], "advance")) {
-		
+
 		delete g_theAdvanceDB;
         g_theAdvanceDB = new CTPDatabase<AdvanceRecord>;
-		Assert(g_theAdvanceDB); 
+		Assert(g_theAdvanceDB);
 		if (g_theAdvanceDB) {
 			if(!g_theAdvanceDB->Parse(C3DIR_GAMEDATA, g_advancedb_filename)) {
 				Assert(FALSE);
@@ -6130,7 +6039,7 @@
 		}
 	} else
 	if (!strcmp(argv[1], "terrain")) {
-		
+
 		delete g_theTerrainDB;
         g_theTerrainDB = new CTPDatabase<TerrainRecord>;
 		if (g_theTerrainDB) {
@@ -6141,15 +6050,14 @@
 		} else {
 			return;
 		}
-		
-		
-		
+
+
 	} else
 	if (!strcmp(argv[1], "unit")) {
-		
+
 		delete g_theUnitDB;
-        g_theUnitDB = new CTPDatabase<UnitRecord>;     
-		Assert(g_theUnitDB); 
+        g_theUnitDB = new CTPDatabase<UnitRecord>;
+		Assert(g_theUnitDB);
 		if (g_theUnitDB) {
 			lex = new DBLexer(C3DIR_GAMEDATA, g_unitdb_filename);
 			if (!g_theUnitDB->Parse(lex)) {
@@ -6157,14 +6065,14 @@
 				return;
 			}
 			delete lex;
-			
+
 		} else {
 			return;
 		}
 
 	} else
 	if (!strcmp(argv[1], "const")) {
-		
+
 		delete g_theConstDB;
         g_theConstDB = new CTPDatabase<ConstRecord>;
 
@@ -6179,10 +6087,10 @@
 		}
 	} else
 	if (!strcmp(argv[1], "wonder")) {
-		
+
 		delete g_theWonderDB;
 		g_theWonderDB = new CTPDatabase<WonderRecord>;
-		
+
 		if (g_theWonderDB) {
 			if(!g_theWonderDB->Parse(C3DIR_GAMEDATA, g_wonder_filename)) {
 				Assert(FALSE);
@@ -6193,7 +6101,7 @@
 		}
 	} else
 	if (!strcmp(argv[1], "civ")) {
-		
+
 		delete g_theCivilisationDB;
 		g_theCivilisationDB = new CTPDatabase<CivilisationRecord>;
 		if (g_theCivilisationDB) {
@@ -6205,7 +6113,7 @@
 			return;
 		}
 	} else
-	
+
 
 
 
@@ -6216,14 +6124,13 @@
 
 
 	if (!strcmp(argv[1], "pop")) {
-		
+
 	} else
 
-	
 	if (!strcmp(argv[1], "ai")) {
 		delete g_theGoalDB;
 		g_theGoalDB = new CTPDatabase<GoalRecord>();
-		Assert(g_theGoalDB ); 
+		Assert(g_theGoalDB );
 		if (g_theGoalDB) {
 			lex = new DBLexer(C3DIR_AIDATA, g_goal_db_filename);
 			if (!g_theGoalDB->Parse(lex)) {
@@ -6236,7 +6143,7 @@
 		}
 		delete g_theUnitBuildListDB;
 		g_theUnitBuildListDB= new CTPDatabase<UnitBuildListRecord>();
-		Assert(g_theUnitBuildListDB); 
+		Assert(g_theUnitBuildListDB);
 		if (g_theUnitBuildListDB) {
 			lex = new DBLexer(C3DIR_AIDATA, g_unit_buildlist_db_filename);
 			if (!g_theUnitBuildListDB->Parse(lex)) {
@@ -6249,7 +6156,7 @@
 		}
 		delete g_theWonderBuildListDB;
 		g_theWonderBuildListDB= new CTPDatabase<WonderBuildListRecord>();
-		Assert(g_theWonderBuildListDB); 
+		Assert(g_theWonderBuildListDB);
 		if (g_theWonderBuildListDB) {
 			lex = new DBLexer(C3DIR_AIDATA, g_wonder_buildlist_db_filename);
 			if (!g_theWonderBuildListDB->Parse(lex)) {
@@ -6262,7 +6169,7 @@
 		}
 		delete g_theBuildingBuildListDB;
 		g_theBuildingBuildListDB= new CTPDatabase<BuildingBuildListRecord>();
-		Assert(g_theBuildingBuildListDB); 
+		Assert(g_theBuildingBuildListDB);
 		if (g_theBuildingBuildListDB) {
 			lex = new DBLexer(C3DIR_AIDATA, g_building_buildlist_db_filename);
 			if (!g_theBuildingBuildListDB->Parse(lex)) {
@@ -6275,7 +6182,7 @@
 		}
 		delete g_theImprovementListDB;
 		g_theImprovementListDB= new CTPDatabase<ImprovementListRecord>();
-		Assert(g_theImprovementListDB); 
+		Assert(g_theImprovementListDB);
 		if (g_theImprovementListDB) {
 			lex = new DBLexer(C3DIR_AIDATA, g_improvement_list_db_filename);
 			if (!g_theImprovementListDB->Parse(lex)) {
@@ -6288,7 +6195,7 @@
 		}
 		delete g_theStrategyDB;
 		g_theStrategyDB = new CTPDatabase<StrategyRecord>();
-		Assert(g_theStrategyDB); 
+		Assert(g_theStrategyDB);
 		if (g_theStrategyDB) {
 			lex = new DBLexer(C3DIR_AIDATA, g_strategy_db_filename);
 			if (!g_theStrategyDB->Parse(lex)) {
@@ -6301,7 +6208,7 @@
 		}
 		delete g_theBuildListSequenceDB;
 		g_theBuildListSequenceDB = new CTPDatabase<BuildListSequenceRecord>();
-		Assert(g_theBuildListSequenceDB); 
+		Assert(g_theBuildListSequenceDB);
 		if (g_theBuildListSequenceDB) {
 			lex = new DBLexer(C3DIR_AIDATA, g_buildlist_sequence_db_filename);
 			if (!g_theBuildListSequenceDB->Parse(lex)) {
@@ -6314,7 +6221,7 @@
 		}
 		delete g_theDiplomacyDB;
 		g_theDiplomacyDB= new CTPDatabase<DiplomacyRecord>();
-		Assert(g_theDiplomacyDB); 
+		Assert(g_theDiplomacyDB);
 		if (g_theDiplomacyDB) {
 			lex = new DBLexer(C3DIR_AIDATA, g_diplomacy_db_filename);
 			if (!g_theDiplomacyDB->Parse(lex)) {
@@ -6327,7 +6234,7 @@
 		}
 		delete g_theAdvanceListDB;
 		g_theAdvanceListDB= new CTPDatabase<AdvanceListRecord>();
-		Assert(g_theAdvanceListDB); 
+		Assert(g_theAdvanceListDB);
 		if (g_theAdvanceListDB) {
 			lex = new DBLexer(C3DIR_AIDATA, g_advance_list_db_filename);
 			if (!g_theAdvanceListDB->Parse(lex)) {
@@ -6351,9 +6258,8 @@
 	return;
 }
 
-
 void DRayTestCode::Execute(sint32 argc, char **argv)
-{	
+{
 	int const curRound	= std::min<sint32>(NewTurnCount::GetCurrentRound(), 200);
 	int turnStrength[200];
 	int i;
@@ -6370,9 +6276,9 @@
 	m_persistent = FALSE;
 	m_displayCityResources = FALSE;
 
-    m_display_mem = FALSE; 
-    m_flux=0; 
-    m_flux_decay = 0.85; 
+    m_display_mem = FALSE;
+    m_flux=0;
+    m_flux_decay = 0.85;
 
 }
 
@@ -6398,12 +6304,12 @@
 							(MBCHAR*)"command <required_param> [optional_param]",
 							0,0);
 		sint32 i;
-		for 
+		for
 		(
 			i = m_helpStart;
             (i < arsize) && commands[i].m_name && (i < m_helpStart + k_HELP_LINES);
 			++i
-		) 
+		)
 		{
 			primitives_DrawText(surf, k_LEFT_EDGE, (k_TOP_EDGE + k_TEXT_SPACING) + (i-m_helpStart) * k_TEXT_SPACING,
 								(MBCHAR*)commands[i].m_helptext, 0, 0);
@@ -6414,7 +6320,7 @@
 
 		}
 		if (commands[i].m_name) {
-			
+
 			sprintf(buf, "[~help %d] for next page", (m_helpStart / k_HELP_LINES) + 1);
 			primitives_DrawText(surf, k_LEFT_EDGE, (k_TOP_EDGE + k_TEXT_SPACING) + (i - m_helpStart) * k_TEXT_SPACING,
 								(MBCHAR*)buf, 0, 0);
@@ -6432,9 +6338,9 @@
 				char buf[1024];
 				sprintf(buf, "    %2d %4d ", i, j);
 				CityData* cityData = cityList->Get(j).GetData()->GetCityData();
-				for(sint32 r = 0; r < g_theResourceDB->NumRecords(); r++) 
+				for(sint32 r = 0; r < g_theResourceDB->NumRecords(); r++)
                 {
-                     
+
 #ifdef CTP1_TRADE
 				    sint32 const rc = cityData->GetResourceCount(r);
 #else
@@ -6499,62 +6405,59 @@
 				l++;
 			}
 		}
-    } else if (m_display_mem) { 
+    } else if (m_display_mem) {
 #ifdef _DEBUG_MEMORY
-		
+
 		l=0;
-		sprintf (buf, "EXE total bytes: %d", DebugMemory_GetTotalFromEXE());       
-		primitives_DrawText(surf, k_LEFT_EDGE, 
+		sprintf (buf, "EXE total bytes: %d", DebugMemory_GetTotalFromEXE());
+		primitives_DrawText(surf, k_LEFT_EDGE,
 			k_TOP_EDGE + l * k_TEXT_SPACING, (MBCHAR *)buf, 0, 0);
-		
+
 		l++;
 		sprintf (buf, "DLL total bytes: %d", DebugMemory_GetTotalFromDLL());
 		primitives_DrawText(surf, k_LEFT_EDGE, k_TOP_EDGE + l * k_TEXT_SPACING,
 			(MBCHAR *)buf, 0, 0);
-		
+
 		l++;
 		sprintf (buf, "Combined total : %d", DebugMemory_GetTotalFromEXE()+DebugMemory_GetTotalFromDLL());
 		primitives_DrawText(surf, k_LEFT_EDGE, k_TOP_EDGE + l * k_TEXT_SPACING,
 			(MBCHAR *)buf, 0, 0);
 #elif defined(_DEBUG) && defined(WIN32)
-		
-		_CrtMemState new_state; 
+
+		_CrtMemState new_state;
        _CrtMemCheckpoint(&new_state);
 
        l = 0;
-       sprintf (buf, "call count %d", new_state.lCounts[1]);       
-	   primitives_DrawText(surf, 
+       sprintf (buf, "call count %d", new_state.lCounts[1]);
+	   primitives_DrawText(surf,
                 k_LEFT_EDGE, k_TOP_EDGE + l * k_TEXT_SPACING,
 									(MBCHAR *)buf, 0, 0);
         l++;
-       sprintf (buf, "currently allocated %d", new_state.lSizes[1]);       
-	   primitives_DrawText(surf, 
+       sprintf (buf, "currently allocated %d", new_state.lSizes[1]);
+	   primitives_DrawText(surf,
                 k_LEFT_EDGE, k_TOP_EDGE + l * k_TEXT_SPACING,
 									(MBCHAR *)buf, 0, 0);
 
-
        l++;
        l++;
-       sprintf (buf, "cumlative total %d", new_state.lTotalCount);       
-	   primitives_DrawText(surf, 
+       sprintf (buf, "cumlative total %d", new_state.lTotalCount);
+	   primitives_DrawText(surf,
                 k_LEFT_EDGE, k_TOP_EDGE + l * k_TEXT_SPACING,
 									(MBCHAR *)buf, 0, 0);
 
-       
        double raw_flux = new_state.lTotalCount - m_old_mem_count;
        m_old_mem_count = new_state.lTotalCount;
-       m_flux = m_flux_decay * m_flux + (1.0 - m_flux_decay) * raw_flux; 
-      
+       m_flux = m_flux_decay * m_flux + (1.0 - m_flux_decay) * raw_flux;
 
        l++;
-       sprintf (buf, "           flux %d", sint32(m_flux));  
+       sprintf (buf, "           flux %d", sint32(m_flux));
        sint32 color;
-       if (1000 < m_flux) { 
-          color = RGB(255,0, 0); 
-       } else { 
+       if (1000 < m_flux) {
+          color = RGB(255,0, 0);
+       } else {
            color = 0;
        }
-	   primitives_DrawText(surf, 
+	   primitives_DrawText(surf,
                 k_LEFT_EDGE, k_TOP_EDGE + l * k_TEXT_SPACING,
 									(MBCHAR *)buf, color , 0);
 #endif
@@ -6586,11 +6489,11 @@
 	m_persistent = FALSE;
 	m_displayCityResources = FALSE;
 	m_displayOffers = FALSE;
-    m_display_mem = !m_display_mem; 
+    m_display_mem = !m_display_mem;
 
 #if defined(_DEBUG) && defined(WIN32)
-    if (m_display_mem) { 
-        _CrtMemState new_state; 
+    if (m_display_mem) {
+        _CrtMemState new_state;
         _CrtMemCheckpoint(&new_state);
 
         m_old_mem_count = new_state.lTotalCount;
@@ -6601,26 +6504,26 @@
 BOOL
 CommandLine::AddKey(char c)
 {
-	
+
 	if(m_addingKey)
 		return FALSE;
 
 	m_addingKey = true;
-	
+
 	switch(c) {
 	case '\r':
 	case '\n':
 		m_buf[m_len] = 0;
-		m_displayHelp = FALSE; 
+		m_displayHelp = FALSE;
 		Execute();
 		Clear();
 		Draw();
-		if (!m_persistent) 
+		if (!m_persistent)
 			if (g_statusWindow)
 				g_statusWindow->Hide();
 		m_addingKey = false;
 		return m_persistent;
-	case 8: 
+	case 8:
 		if(m_len > 0) {
 			m_len--;
 		}
@@ -6628,7 +6531,7 @@
 			g_statusWindow->Draw();
 		m_addingKey = false;
 		return TRUE;
-	case 27: 
+	case 27:
 		m_len = 0;
 		if (g_statusWindow)
 			g_statusWindow->Draw();
@@ -6716,17 +6619,15 @@
 {
 	while(*y && *x) {
 		if(*x != *y)
-			
+
 			return FALSE;
 		x++;
 		y++;
 	}
 	if(*y == 0)
-		
-		
+
 		return TRUE;
 
-	
 	return FALSE;
 }
 
@@ -6748,5 +6649,4 @@
 }
 
 
-
-#endif 
+#endif

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3cmdline.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3cmdline.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3cmdline.h	Mon May 23 04:21:18 2016	(r1115)
@@ -12,7 +12,7 @@
 class Command;
 class CommandLine;
 
-class aui_Surface; 
+class aui_Surface;
 
 struct CommandRecord
 {
@@ -21,7 +21,6 @@
 	char* m_helptext;
 };
 
-
 class Command
 {
 public:
@@ -30,7 +29,6 @@
 
 #define COMMAND(x) class x : public Command { public: void Execute(sint32 argc, char **argv); }
 
-
 COMMAND(ZBCommand);
 COMMAND(BuildCommand);
 COMMAND(UpgradeCity);
@@ -49,7 +47,7 @@
 COMMAND(StayOnCommand);
 COMMAND(TurnOffCommand);
 COMMAND(RandTestCommand);
-COMMAND(ClearTextCommand); 
+COMMAND(ClearTextCommand);
 COMMAND(TradeRouteCommand);
 COMMAND(UntradeRouteCommand);
 COMMAND(CityResourcesCommand);
@@ -129,13 +127,13 @@
 COMMAND(RequestExchangeMapCommand) ;
 
 COMMAND(RevoltCommand);
-COMMAND(SeeWWRCommand); 
-COMMAND(SetWorkdayCommand); 
-COMMAND(SetWagesCommand); 
-COMMAND(SetRationsCommand); 
+COMMAND(SeeWWRCommand);
+COMMAND(SetWorkdayCommand);
+COMMAND(SetWagesCommand);
+COMMAND(SetRationsCommand);
 COMMAND(SetMaterialsPercentCommand);
 COMMAND(AddMaterialsCommand);
-COMMAND(SetReadinessCommand); 
+COMMAND(SetReadinessCommand);
 COMMAND(PactEndPollutionCommand);
 COMMAND(PactCaptureCityCommand);
 COMMAND(CaptureCityForGoldCommand);
@@ -152,7 +150,7 @@
 COMMAND(SetCityNameCommand) ;
 COMMAND(SetCitySizeCommand);
 
-COMMAND(ToggleAIStr); 
+COMMAND(ToggleAIStr);
 
 COMMAND(InvestigateCityCommand);
 COMMAND(NullifyWallsCommand);
@@ -190,7 +188,7 @@
 COMMAND(CreateParkCommand);
 COMMAND(CreateRiftCommand);
 
-COMMAND(FastRoundCommand); 
+COMMAND(FastRoundCommand);
 COMMAND(DumpAlliesCommand) ;
 
 COMMAND(HelpLinesCommand);
@@ -213,14 +211,14 @@
 COMMAND(InjoinCommand);
 COMMAND(GrantAllCommand);
 COMMAND(GrantManyCommand);
-COMMAND(DebugCheckMemCommand); 
+COMMAND(DebugCheckMemCommand);
 COMMAND(UseLadderCommand);
 COMMAND(TutorialCommand);
 COMMAND(ToggleMapColorCommand);
-COMMAND(ToggleHeuristicCommand); 
+COMMAND(ToggleHeuristicCommand);
 COMMAND(SimultaneousCommand);
 COMMAND(AutoCenterCommand);
-COMMAND(AiDumpCommand); 
+COMMAND(AiDumpCommand);
 COMMAND(SetUnitMovesStyleCommand);
 COMMAND(SetClassicStyleCommand);
 COMMAND(SetSpeedStyleCommand);
@@ -254,7 +252,7 @@
 
 COMMAND(ToeCommand);
 
-COMMAND(WhoAmICommand); 
+COMMAND(WhoAmICommand);
 COMMAND(AutoSaveCommand);
 COMMAND(HeapTotalsCommand);
 COMMAND(HotSeatCommand);
@@ -266,8 +264,7 @@
 COMMAND(DisbandCommand);
 COMMAND(AttachCommand);
 COMMAND(DetachCommand);
-COMMAND(ToggleShieldSupport); 
-
+COMMAND(ToggleShieldSupport);
 
 COMMAND(SuperFastDebugModeCommand);
 COMMAND(KillPopCommand);
@@ -276,31 +273,28 @@
 COMMAND(AddPopCommand);
 COMMAND(CopyVisionCommand);
 
-
 COMMAND(CombatLogCommand);
 
-
 COMMAND(ThroneRoomUpgradeCommand);
 
 
-
 COMMAND(GiveMeProbeCommand);
 
 COMMAND(RedrawMapCommand);
 COMMAND(GodCommand);
-COMMAND(ReloadFliCommand); 
+COMMAND(ReloadFliCommand);
 
 COMMAND(MultiCycleCommand);
-COMMAND(DumpFZRegardCommand); 
-COMMAND(SetFZRegardCommand); 
+COMMAND(DumpFZRegardCommand);
+COMMAND(SetFZRegardCommand);
 
 COMMAND(LeaksClearCommand);
 COMMAND(LeaksShowCommand);
-COMMAND(TotalWarCommand); 
+COMMAND(TotalWarCommand);
 
 COMMAND(SlicVariableCommand);
-COMMAND(DipLogOnCommand); 
-COMMAND(DipLogOffCommand); 
+COMMAND(DipLogOnCommand);
+COMMAND(DipLogOffCommand);
 
 COMMAND(DirectorDumpCommand);
 COMMAND(ResyncCommand);
@@ -311,11 +305,9 @@
 COMMAND(CleanScreenCommand);
 COMMAND(ResetVisionCommand);
 
-
 COMMAND(ExportMapCommand);
 COMMAND(ImportMapCommand);
 
-
 COMMAND(InitializeDiplomacyCommand);
 COMMAND(BeginDiplomacyCommand);
 COMMAND(ChooseNewProposalCommand);
@@ -329,32 +321,25 @@
 COMMAND(SetPersonalityCommand);
 COMMAND(DeclareWarCommand);
 
-
 COMMAND(SetGovernorForCityCommand);
 COMMAND(SetGovernorPwReserveCommand);
 
-
 COMMAND(ToggleCellText);
 COMMAND(ToggleArmyText);
 COMMAND(ToggleArmyName);
 
 COMMAND(ArmyClumps);
 
-
 COMMAND(SetGoodsCommand);
 
-
 COMMAND(AiDebugCommand);
 
-
 COMMAND(DRayTestCode);
 
-
 COMMAND(ShowVictoryCommand);
 
 COMMAND(ReloadSpritesCommand);
 
-
 #ifdef DUMP_ASTAR
 
 COMMAND(DumpAstarCommand);
@@ -370,7 +355,7 @@
 {
 public:
 	CommandLine();
-	
+
 	BOOL AddKey(char c);
 	void Clear();
 	void Execute();
@@ -388,7 +373,7 @@
 	sint32 Parse();
 	BOOL PartialMatch(const char* x, const char* y);
 
-	char* m_argv[256]; 
+	char* m_argv[256];
 	sint32 m_argc;
 
 	char m_buf[1024];
@@ -401,10 +386,10 @@
 
     bool m_addingKey;
 
-    BOOL m_display_mem; 
+    BOOL m_display_mem;
     sint32 m_old_mem_count;
-    double m_flux; 
-    double m_flux_decay; 
+    double m_flux;
+    double m_flux_decay;
 };
 
 extern CommandLine g_commandLine;

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3cpu.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3cpu.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3cpu.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -10,13 +10,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 //----------------------------------------------------------------------------
 //
 // Modifications from the original Activision code:
@@ -25,11 +25,9 @@
 //
 //----------------------------------------------------------------------------
 
-
 #include "c3.h"
 #include "c3cpu.h"
 
-
 // Stub versions of the above
 
 MBCHAR g_cpuString[] = "";
@@ -46,4 +44,3 @@
 {
 	return g_cpuString;
 }
-

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3cpu.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3cpu.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3cpu.h	Mon May 23 04:21:18 2016	(r1115)
@@ -7,29 +7,27 @@
 #if defined(WIN32)
 #define CPUINFODLL "dll\\util\\cpuinf32.dll"
 
-
 struct FREQ_INFO
 {
-	unsigned long in_cycles;	
-								
-	unsigned long ex_ticks;		
-								
-	unsigned long raw_freq;		
-	unsigned long norm_freq;	
-								
+	unsigned long in_cycles;
+
+	unsigned long ex_ticks;
+
+	unsigned long raw_freq;
+	unsigned long norm_freq;
+
 };
 
 struct TIME_STAMP
 {
-	DWORD High;					
-								
-	DWORD Low;					
-};								
+	DWORD High;
 
+	DWORD Low;
+};
 
-#define CLONE_MASK		0x8000	
+#define CLONE_MASK		0x8000
 
-#endif								
+#endif
 
 void		c3cpu_Initialize(void);
 void		c3cpu_Examine(void);

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3debug.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3debug.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3debug.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,7 +11,7 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
@@ -51,9 +51,8 @@
 
 #include "GameWatch.h"
 
-
 extern int g_gameWatchID;
-#endif 
+#endif
 
 uint32 g_debug_mask = k_DBG_NONE;
 static int g_useMask;
@@ -106,7 +105,7 @@
 	strcpy(path, "logs" FILE_SEP "*.*");
 
 	HANDLE lpFileList = FindFirstFile(path, &fileData);
-	
+
 	if(lpFileList != INVALID_HANDLE_VALUE)
 	{
 		MBCHAR fileName[256];
@@ -214,7 +213,7 @@
 		vsprintf(g_last_debug_text + strlen(g_last_debug_text), format, list);
 		va_end(list);
 #ifndef _AIDLL
-		
+
 		if (g_debugWindow)
 		{
 			g_debugWindow->AddText(g_last_debug_text);
@@ -268,7 +267,6 @@
 
 	DPRINTF(k_DBG_FIX, ("Exception: '%s' thrown.\n", s));
 
-	
 	s = c3debug_ExceptionStackTrace(exception_pointers);
 
 	DPRINTF(k_DBG_FIX, ("Exception Stack Trace:\n%s\n", s));
@@ -277,16 +275,16 @@
 
 	char userName[256];
 	DWORD size = 256;
-	userName[0] = '\0';		
+	userName[0] = '\0';
 	GetUserName(userName, &size);
 
 	char computerName[256];
 	size = 256;
-	computerName[0] = '\0';		
+	computerName[0] = '\0';
 	GetComputerName(computerName, &size);
 
 	SYSTEMTIME localTime;
-	memset(&localTime, 0, sizeof(localTime));	
+	memset(&localTime, 0, sizeof(localTime));
 	GetLocalTime(&localTime);
 
 	char stamp[1024];
@@ -315,15 +313,15 @@
 
 void c3debug_Assert(char const *s, char const * file, int line)
 {
-	DPRINTF(k_DBG_FIX, ("Assertion (%s) Failed in File:%s, Line:%ld\n", s, file, line)); 
+	DPRINTF(k_DBG_FIX, ("Assertion (%s) Failed in File:%s, Line:%ld\n", s, file, line));
 	DPRINTF(k_DBG_FIX, ("Stack Trace: '%s'\n", c3debug_StackTrace()));
 
 #if defined(_DEBUG)
 	do
 	{
-		if (_CrtDbgReport(_CRT_ASSERT, file, line, NULL, s) == 1) 
+		if (_CrtDbgReport(_CRT_ASSERT, file, line, NULL, s) == 1)
 		{
-			_CrtDbgBreak(); 
+			_CrtDbgBreak();
 		}
 	}
 	while (0);

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3debug.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3debug.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3debug.h	Mon May 23 04:21:18 2016	(r1115)
@@ -2,7 +2,7 @@
 //
 // Project      : Call To Power 2
 // File type    : C++ header
-// Description  : 
+// Description  :
 // Id           : $Id$
 //
 //----------------------------------------------------------------------------
@@ -70,7 +70,6 @@
 #define Report(x) { fprintf(stderr, "%s\n", x); }
 #endif
 
-
 typedef void (* CivExceptionFunction) (void);
 
 #define k_DBG_ALL               0xffffffff
@@ -93,7 +92,6 @@
 #define k_DBG_ASTAR             0x00008000
 #define k_DBG_GOVERNOR          0x00010000
 
-
 #define k_DEBUG_OWNER_NONE          0
 #define k_DEBUG_OWNER_CRC           1
 #define k_DEBUG_OWNER_COMMANDLINE   2

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3debugstl.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3debugstl.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3debugstl.h	Mon May 23 04:21:18 2016	(r1115)
@@ -10,18 +10,18 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
-// _MSC_VER		
+//
+// _MSC_VER
 // - Compiler version (for the Microsoft C++ compiler only)
 //
 // Note: For the blocks with _MSC_VER preprocessor directives, the following
-//       is implied: the (_MSC_VER) preprocessor directive lines and the blocks 
+//       is implied: the (_MSC_VER) preprocessor directive lines and the blocks
 //       between #else and #endif are modified Apolyton code. The blocks that
 //       are active for _MSC_VER value 1200 are the original Activision code.
 //
@@ -42,16 +42,15 @@
 
 #include <memory>
 
-
 #if defined(_MSC_VER) && (_MSC_VER < 1300)
 template<class _Ty>
-class dbgallocator : public std::allocator<_Ty> 
+class dbgallocator : public std::allocator<_Ty>
 {
 public:
     typedef std::allocator<_Ty> BaseAllocator;
-    
+
 	pointer allocate(size_type _N, const void *buf)
-	{ 
+	{
         if (_N > 0)
         {
             return BaseAllocator::allocate(_N, buf);
@@ -63,10 +62,10 @@
 		    return (pointer) buf;
 	    }
 	};
-	
+
 	void deallocate(void _FARQ *_P, size_type _N)
 	{
-        if (_P) 
+        if (_P)
         {
             BaseAllocator::deallocate(_P, _N);
         }
@@ -78,5 +77,4 @@
 #define dbgallocator std::allocator
 #endif
 
-
 #endif // __C3DEBUGSTL_H__

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3errors.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3errors.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3errors.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -55,7 +55,7 @@
 	va_end(list);
 
 	Assert(FALSE);
-	
+
 	Report("Fatal error.  Aborting.\n");
 
 #ifdef WIN32
@@ -66,11 +66,10 @@
 #endif
 #endif
 #endif
-	
+
 	exit(-1);
 }
 
-
 void c3errors_FatalDialogFromDB(const char *module, const char *err, ...)
 {
 	MBCHAR *    dbTitle;
@@ -96,7 +95,7 @@
 	MessageBox(NULL, str, dbTitle, MB_OK | MB_ICONEXCLAMATION);
 
 	Assert(FALSE);
-	
+
 	Report("Fatal error.  Aborting.\n");
 
 #if defined(WIN32)
@@ -111,7 +110,6 @@
 	exit(-1) ;
 }
 
-
 void c3errors_ErrorDialogFromDB(const char *module, const char *err, ...)
 {
     MBCHAR *    dbTitle;
@@ -131,7 +129,6 @@
 	MessageBox(NULL, str, dbTitle, MB_OK | MB_ICONEXCLAMATION) ;
 }
 
-
 void c3errors_ErrorDialog(const char* module, const char* fmt, ...)
 {
 	LPTSTR			szTitle;
@@ -171,13 +168,12 @@
 //	MessageBox(NULL, szFmtTmp, szTitle, MB_OK | MB_ICONEXCLAMATION);
 	sint32 result = MessageBox(NULL, Tmp, szTitle, MB_YESNO | MB_ICONEXCLAMATION);
 
-
 #if defined(WIN32)
 	LocalFree(szTitle);
 #else
    free(szTitle);
 #endif
-	
+
 #ifndef _DEBUG
 	extern bool g_autoAltTab;
 	if(g_autoAltTab && g_ui) {
@@ -191,4 +187,3 @@
 
 	return;
 }
-

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3files.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3files.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3files.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -79,7 +79,7 @@
     DriveIdType const   DRIVE_UNDETERMINED  = -1;
     size_t              DRIVE_COUNT         = 0;
 #endif
-    
+
     size_t const        VOLUME_NAME_SIZE    = 32;
 
     bool                g_hasCD             = false;
@@ -108,7 +108,6 @@
 	return freopen(s1, s2, file);
 }
 
-
 sint32 c3files_fclose(FILE *file)
 {
 	return (sint32)fclose(file);
@@ -122,7 +121,7 @@
 	va_start(valist, s);
 	val = (sint32)fscanf(file, s, valist);
 	va_end(valist);
-	
+
 	return val;
 }
 
@@ -147,14 +146,12 @@
 }
 
 
-
 size_t c3files_fwrite(const void *p, size_t i1, size_t i2, FILE *file)
 {
 	return fwrite(p, i1, i2, file);
 }
 
 
-
 sint32 c3files_fprintf(FILE *file, const MBCHAR *s, ...)
 {
 	va_list     valist;
@@ -163,75 +160,65 @@
 	va_start(valist, s);
 	val = (sint32)vfprintf(file, s, valist);
 	va_end(valist);
-	
+
 	return val;
 }
 
 
-
 sint32 c3files_fputc(sint32 i, FILE *file)
 {
 	return (sint32)fputc(i, file);
 }
 
 
-
 sint32 c3files_fputs(const MBCHAR *s, FILE *file)
 {
 	return (sint32)fputs(s, file);
 }
 
 
-
 sint32 c3files_fsetpos(FILE *file, const fpos_t *pos)
 {
 	return (sint32)fsetpos(file, pos);
 }
 
 
-
 sint32 c3files_fseek(FILE *file, sint32 i1, sint32 i2)
 {
 	return (sint32)fseek(file, i1, i2);
 }
 
 
-
 sint32 c3files_ftell(FILE *file)
 {
 	return (sint32)ftell(file);
 }
 
 
-
 sint32 c3files_feof(FILE *file)
 {
 	return (sint32)feof(file);
 }
 
 
-
 sint32 c3files_ferror(FILE *file)
 {
 	return (sint32)ferror(file);
 }
 
 
-
 void c3files_clearerr(FILE *file)
 {
 	clearerr(file);
 }
 
 
-
 sint32 c3files_fflush(FILE *file)
 {
 	return (sint32)fflush(file);
 }
 
 
-
 sint32 c3files_getfilesize(C3DIR dir, MBCHAR const *filename)
 {
 	sint32 filesize = 0;
@@ -240,7 +227,7 @@
 
 	if ( !f )
 		return -1;
-	
+
 	if (c3files_fseek(f, 0, SEEK_END) == 0) {
 		filesize = c3files_ftell(f);
 	} else {
@@ -254,7 +241,6 @@
 }
 
 
-
 uint8 *c3files_loadbinaryfile(C3DIR dir, MBCHAR const * filename, sint32 *size)
 {
 	if ( size ) *size = 0;
@@ -338,7 +324,7 @@
         }
     }
 
-    if (0 == copied) 
+    if (0 == copied)
     {
         strcpy(s, "-");
     }
@@ -360,21 +346,21 @@
 
 	g_civPaths->GetSavePath(dirID, path);
 
-#ifdef _WIN32	
+#ifdef _WIN32
 	if (ext) sprintf(strbuf,"*.%s",ext);
 	else strcpy(strbuf, "*.*");
-		
+
 	strcat(path,strbuf);
 
 	WIN32_FIND_DATA	fileData;
 	HANDLE          lpFileList = FindFirstFile(path, &fileData);
-	
+
 	if (lpFileList ==  INVALID_HANDLE_VALUE) return false;
-	
+
 	MBCHAR *lpFileName = new MBCHAR[256];
 	strcpy(lpFileName,fileData.cFileName);
 	list->AddTail(lpFileName);
-	
+
 	while (FindNextFile(lpFileList,&fileData))
 	{
 		lpFileName = new MBCHAR[256];
@@ -388,7 +374,7 @@
 	if (!dir)
 		return FALSE;
 	struct dirent *dent = NULL;
-	
+
 	while ((dent = readdir(dir)))
 	{
                 char *p = strrchr(dent->d_name, '.');
@@ -418,24 +404,23 @@
 {
 	MBCHAR strbuf[256];
 	MBCHAR path[_MAX_PATH];
-	
+
 	g_civPaths->GetSavePath(dirID, path);
-	
+
 	if (ext) sprintf(strbuf,"*.%s",ext);
 	else strcpy(strbuf, "*.*");
-		
+
 	strcat(path,strbuf);
 
-	
 	WIN32_FIND_DATA *   lpFileData  = new WIN32_FIND_DATA;
 	HANDLE              lpFileList  = FindFirstFile(path, lpFileData);
 
-	if (lpFileList == INVALID_HANDLE_VALUE) 
+	if (lpFileList == INVALID_HANDLE_VALUE)
     {
         delete lpFileData;
         return false;
     }
-    
+
 	list->AddTail(lpFileData);
 
 	lpFileData = new WIN32_FIND_DATA;
@@ -456,41 +441,40 @@
 {
 	bool success = false;
 
-	if (g_soundManager) 
+	if (g_soundManager)
     {
 		g_soundManager->CleanupRedbook();
 	}
 
-	while (!success) 
+	while (!success)
     {
 		success = c3files_FindCDByName(k_CTP_CD_VOLUME_NAME);
 
-		if (success && g_theProfileDB->IsProtected()) 
+		if (success && g_theProfileDB->IsProtected())
         {
 			success = (_TRACKLEN_OK == tracklen_CheckTrackLengths());
 		}
 
-		if (!success) 
+		if (!success)
 		{
 #ifdef _WIN32
 			int const rval = MessageBox
                                 (g_c3ui ? g_c3ui->TheHWND() : NULL,
 			                     appstrings_GetString(APPSTR_INSERTCDROM),
 			                     appstrings_GetString(APPSTR_CDROM),
-			                     MB_RETRYCANCEL         | 
-                                    MB_ICONEXCLAMATION  | 
-                                    MB_DEFBUTTON1       | 
-                                    MB_SYSTEMMODAL      | 
+			                     MB_RETRYCANCEL         |
+                                    MB_ICONEXCLAMATION  |
+                                    MB_DEFBUTTON1       |
+                                    MB_SYSTEMMODAL      |
                                     MB_SETFOREGROUND
                                 );
 
-			if (IDCANCEL == rval) 
+			if (IDCANCEL == rval)
             {
 #else
 	                c3errors_ErrorDialog(appstrings_GetString(APPSTR_CDROM),
 					     appstrings_GetString(APPSTR_NEEDCDROM));
 #endif
-				
 
                 // Do not annoy the user with more messages after cancelling
 				exit(-1);
@@ -505,7 +489,7 @@
 		}
 	}
 
-	if (g_soundManager) 
+	if (g_soundManager)
     {
 		g_soundManager->InitRedbook();
 	}
@@ -607,15 +591,15 @@
 	DWORD   FSFlags;
 
 	if (GetVolumeInformation
-            (drivepath, 
-             VolumeName, 
-             VOLUME_NAME_SIZE, 
-             &SerialNumber, 
-             &MaxComponentLen, 
-             &FSFlags, 
+            (drivepath,
+             VolumeName,
+             VOLUME_NAME_SIZE,
+             &SerialNumber,
+             &MaxComponentLen,
+             &FSFlags,
              FSName, sizeof(FSName)
             )
-       ) 
+       )
     {
 		return VolumeName;
 	}
@@ -682,7 +666,7 @@
 //
 // Parameters : name            : the name of the disk to look for
 //
-// Globals    : g_theProfileDB  : CD is required 
+// Globals    : g_theProfileDB  : CD is required
 //              g_hasCD         : updated
 //              WhichCD         : updated
 //
@@ -721,7 +705,7 @@
 	}
 #endif
     }
-    
+
     return g_hasCD || !g_theProfileDB->IsRequireCD();
 }
 

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3files.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3files.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3files.h	Mon May 23 04:21:18 2016	(r1115)
@@ -11,14 +11,14 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
 //
-// _WIN32		
+// _WIN32
 // - Microsoft Windows version
 //
 //----------------------------------------------------------------------------
@@ -48,12 +48,12 @@
 //----------------------------------------------------------------------------
 
 enum C3DIR {
-	C3DIR_DIRECT	= -1,	
+	C3DIR_DIRECT	= -1,
 
-	C3DIR_GAMEDATA,			
+	C3DIR_GAMEDATA,
   	C3DIR_GL,
 	C3DIR_AIDATA,
-    C3DIR_UIDATA,			
+    C3DIR_UIDATA,
 	C3DIR_LAYOUT,
 	C3DIR_FONTS,
 	C3DIR_GRAPHICS,
@@ -63,7 +63,7 @@
 	C3DIR_PICTURES,
 	C3DIR_ICONS,
 	C3DIR_CURSORS,
-    C3DIR_SOUNDS, 
+    C3DIR_SOUNDS,
 	C3DIR_VIDEOS,
 
 	C3DIR_MAX
@@ -138,13 +138,11 @@
 
 void		c3files_StripSpaces(MBCHAR *s);
 
-
 bool		c3files_getfilelist(C3SAVEDIR dirID, MBCHAR *ext, PointerList<MBCHAR> *plist);
 #ifdef _WIN32
 bool		c3files_getfilelist_ex(C3SAVEDIR dirID, MBCHAR *ext, PointerList<WIN32_FIND_DATA> *plist);
 #endif
 
-
 DriveIdType c3files_GetCtpCdId(void);
 bool		c3files_HasCD(void);
 bool		c3files_HasLegalCD(void);

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3math.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3math.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3math.h	Mon May 23 04:21:18 2016	(r1115)
@@ -2,7 +2,7 @@
 //
 // Project      : Call To Power 2
 // File type    : C++ header
-// Description  : 
+// Description  :
 //
 //----------------------------------------------------------------------------
 //
@@ -10,20 +10,20 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
-// _MSC_VER		
+//
+// _MSC_VER
 // - When defined, allows Microsoft C++ extensions.
 // - When not defined, generates standard C++.
 //
 // Note: For the blocks with _MSC_VER preprocessor directives, the following
-//       is implied: the (_MSC_VER) preprocessor directive lines and the blocks 
-//       between #else and #endif are modified Apolyton code. The blocks 
+//       is implied: the (_MSC_VER) preprocessor directive lines and the blocks
+//       between #else and #endif are modified Apolyton code. The blocks
 //       between #if and #else are the original Activision code.
 //
 //----------------------------------------------------------------------------
@@ -49,7 +49,6 @@
 #define MAX(x, y) std::max(x, y)
 #define MIN(x, y) std::min(x, y)
 
-
 //----------------------------------------------------------------------------
 //
 // Name       : AsPercentage
@@ -62,12 +61,12 @@
 //
 // Returns    : int				: percentage
 //
-// Remark(s)  : Direct floating point to integer conversion discards the 
-//              fraction, which makes it unreliable around the unit mark 
-//              (0.9999999 -> 0). Adding 0.5 makes it round, and moves the 
+// Remark(s)  : Direct floating point to integer conversion discards the
+//              fraction, which makes it unreliable around the unit mark
+//              (0.9999999 -> 0). Adding 0.5 makes it round, and moves the
 //              unreliable spot to the 0.5 mark - which is not used for the
 //              sliders.
-// 
+//
 // Example	  :	AsPercentage(0.1) = 10, AsPercentage(0.008) = 1.
 //              AsPercentage(0.005) may be 0 or 1, dependent on machine and
 //              compiler.
@@ -79,5 +78,4 @@
 	return static_cast<int>((a_Factor * 100.0) + 0.5);
 }
 
-
 #endif

Modified: trunk/ctp2_code/ctp/ctp2_utils/c3mem.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/c3mem.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/c3mem.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,24 +1,14 @@
-
-
-
-
-
-
-
-
-
-
 #include "c3.h"
 #include "debugmemory.h"
 #include "c3debug.h"
 
-sint32 g_check_mem; 
+sint32 g_check_mem;
 
 #ifndef _DEBUG_MEMORY
 
 void* operator new(const size_t size)
 {
-    Assert (0 < size); 
+    Assert (0 < size);
 	void* ptr = malloc(size);
 	Assert(ptr != NULL);
 
@@ -34,9 +24,9 @@
 #endif
 		exit(-1);
 	}
-  
-	if (g_check_mem) { 
-        Assert(_CrtCheckMemory()); 
+
+	if (g_check_mem) {
+        Assert(_CrtCheckMemory());
     }
 
 	return ptr;
@@ -48,10 +38,10 @@
 	if(ptr == NULL)
 		return;
 	free(ptr);
-    ptr = NULL; 
+    ptr = NULL;
 
-    if (g_check_mem) { 
-        Assert(_CrtCheckMemory());  
+    if (g_check_mem) {
+        Assert(_CrtCheckMemory());
     }
 }
 

Modified: trunk/ctp2_code/ctp/ctp2_utils/cheatkey.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/cheatkey.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/cheatkey.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -3,28 +3,25 @@
 
 #include "cheatkey.h"
 
-
 typedef struct {
 	int val[ CHEATKEY_LENGTH ];
 } cheatkey_t, *LP_cheatkey_t;
 
 
-
 cheatkey_t cheatkey_thisKey = {
-0x968861B9, 0x37999141, 0x9CB98A8D, 0x50115FB6, 0x1A221DE7, 0x8B0AFEBF, 0xD302DFF6, 0xD92CF444, 0x8A8CBB7E, 0x70532E03, 
-0x87643D56, 0x4D117B0C, 0x192518E9, 0xAD280F46, 0x0EDEA0B5, 0x941101E8, 0x3D9051CF, 0x4678CD01, 0xFDB2465D, 0xD1BDD3F1, 
-0xABAEC31B, 0x8175D5ED, 0x2861ACD6, 0x69E77D7F, 0x589F0BF4, 0xE18FD504, 0xA4AC8DEA, 0x039ECD2D, 0x78C406C4, 0x2C78B97E, 
-0xC694E9A1, 0x8134D0D1, 0x82BED134, 0x6820AED4, 0x2459FB45, 0x0B3BD287, 0x296FC92D, 0xD9B921BF, 0x937D405E, 0x048361A6, 
-0x64F78BD9, 0x04B4BF39, 0x26C276B5, 0x121C4BC8, 0x66B7F49F, 0xAEC1767A, 0x34269954, 0x1A599AC6, 0xA5512129, 0xDCD272FB, 
-0x52EDE783, 0x40CA9EB8, 0xD6A56F60, 0xD3172175, 0x5497DDCC, 0xE940E2F9, 0xEED57B6D, 0x19022EE1, 0x4FE437F8, 0xBCCC351F, 
-0x224022B8, 0x71438879, 0x99D7F20E, 0x9CBFA106, 0xE78981EC, 0xE2CC5CB4, 0xC6AF4C5A, 0xAFAA76C5, 0xF291F5F1, 0xB0CE154D, 
-0xABEDC262, 0x595F40B6, 0x37771CF0, 0x60B9623C, 0x5E5410F1, 0x40EDCB72, 0xEC9ED152, 0xB73F2FBB, 0x33E43410, 0x48A625D1, 
-0x87A732BF, 0xBA50A941, 0xC0DD6A07, 0x981C9BED, 0xBB719C22, 0xAF1E3D89, 0xD9C12F5F, 0x931EB91F, 0x7E1FACA2, 0x1919998B, 
+0x968861B9, 0x37999141, 0x9CB98A8D, 0x50115FB6, 0x1A221DE7, 0x8B0AFEBF, 0xD302DFF6, 0xD92CF444, 0x8A8CBB7E, 0x70532E03,
+0x87643D56, 0x4D117B0C, 0x192518E9, 0xAD280F46, 0x0EDEA0B5, 0x941101E8, 0x3D9051CF, 0x4678CD01, 0xFDB2465D, 0xD1BDD3F1,
+0xABAEC31B, 0x8175D5ED, 0x2861ACD6, 0x69E77D7F, 0x589F0BF4, 0xE18FD504, 0xA4AC8DEA, 0x039ECD2D, 0x78C406C4, 0x2C78B97E,
+0xC694E9A1, 0x8134D0D1, 0x82BED134, 0x6820AED4, 0x2459FB45, 0x0B3BD287, 0x296FC92D, 0xD9B921BF, 0x937D405E, 0x048361A6,
+0x64F78BD9, 0x04B4BF39, 0x26C276B5, 0x121C4BC8, 0x66B7F49F, 0xAEC1767A, 0x34269954, 0x1A599AC6, 0xA5512129, 0xDCD272FB,
+0x52EDE783, 0x40CA9EB8, 0xD6A56F60, 0xD3172175, 0x5497DDCC, 0xE940E2F9, 0xEED57B6D, 0x19022EE1, 0x4FE437F8, 0xBCCC351F,
+0x224022B8, 0x71438879, 0x99D7F20E, 0x9CBFA106, 0xE78981EC, 0xE2CC5CB4, 0xC6AF4C5A, 0xAFAA76C5, 0xF291F5F1, 0xB0CE154D,
+0xABEDC262, 0x595F40B6, 0x37771CF0, 0x60B9623C, 0x5E5410F1, 0x40EDCB72, 0xEC9ED152, 0xB73F2FBB, 0x33E43410, 0x48A625D1,
+0x87A732BF, 0xBA50A941, 0xC0DD6A07, 0x981C9BED, 0xBB719C22, 0xAF1E3D89, 0xD9C12F5F, 0x931EB91F, 0x7E1FACA2, 0x1919998B,
 0x935141E2, 0xDEBF4DFF, 0x051240AA, 0xBFF4A980, 0x448E9D99, 0x5F4F6467, 0xC5E973E1, 0xA59D9AE1, 0x80B97FCB, 0x3B5F4B70
 };
 
 
-
 BYTE *WINAPI cheatkey_get()
 {
 	return (BYTE*)cheatkey_thisKey.val;

Modified: trunk/ctp2_code/ctp/ctp2_utils/cheatkey.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/cheatkey.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/cheatkey.h	Mon May 23 04:21:18 2016	(r1115)
@@ -30,21 +30,16 @@
 #ifndef cheatkey_h
 #define cheatkey_h
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 #define CHEATKEY_LENGTH 100
 
-
 BYTE *WINAPI cheatkey_get();
 
-
 #ifdef __cplusplus
 }
 #endif
 
-
 #endif

Modified: trunk/ctp2_code/ctp/ctp2_utils/command.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/command.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/command.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,42 +1,30 @@
-
-
-
-
-
-
 #include "command.h"
 
-
 CommandLineParser::CommandLineParser()
 {
-  
-  Usage		= NULL; 
 
-  
-  Options	= NULL; 
-  XOption	= NULL; 
-}  
+  Usage		= NULL;
 
+  Options	= NULL;
+  XOption	= NULL;
+}
 
 CommandLineParser::~CommandLineParser()
 {
   ResetOptions();
 }
 
-
-void 
+void
 CommandLineParser::SetUsage(void (*UsageFunc)())
 {
   Usage = UsageFunc;
 }
 
-
-void 
+void
 CommandLineParser::ResetOptions()
 {
   __CBS *options=Options;
 
-  
   while(Options!=NULL)
   {
 	 options = Options->next;
@@ -44,28 +32,23 @@
 	 Options = options;
   }
 
-  
   if(XOption)
 	 delete XOption;
 
   XOption = NULL;
 
-  
   Usage   = NULL;
 }
 
-
-void 
+void
 CommandLineParser::AddCommandOption(char *Key,unsigned flags,bool (*ActionFunc)(char *,int len))
 {
-	
+
 	if(ActionFunc==NULL)
 		return;
 
-	
 	__CBS *new_option=new __CBS;
 
-	
 	new_option->Value.ActionFunc	= ActionFunc;
 	new_option->flags				= flags;
 
@@ -77,133 +60,112 @@
 		new_option->Key			= strdup(Key);
 	}
 
-	
 	AddCommandOption(new_option);
 }
 
-void 
+void
 CommandLineParser::AddCommandOption(char *Key,unsigned flags,bool *flag)
 {
-	
+
 	if((Key==NULL)||(flag==NULL))
 		return;
 
-	
 	__CBS *new_option=new __CBS;
 
-	
 	new_option->CommandType	= CT_USE_FLAG;
 	new_option->Key			= strdup(Key);
 	new_option->Value.flag	= flag;
 	new_option->flags		= flags;
 
-	
 	AddCommandOption(new_option);
 }
 
-void 
+void
 CommandLineParser::AddCommandOption(char *Key,unsigned flags,int *val)
 {
-	
+
 	if((Key==NULL)||(val==NULL))
 		return;
 
-	
 	__CBS *new_option=new __CBS;
 
-	
 	new_option->CommandType	= CT_USE_INT;
 	new_option->Key			= strdup(Key);
 	new_option->Value.ival  = val;
 	new_option->flags		= flags;
 
-	
 	AddCommandOption(new_option);
 }
 
-
-void 
+void
 CommandLineParser::AddCommandOption(char *Key,unsigned flags,float *val)
 {
-	
+
 	if((Key==NULL)||(val==NULL))
 		return;
 
-	
 	__CBS *new_option=new __CBS;
 
-	
 	new_option->CommandType	= CT_USE_FLOAT;
 	new_option->Key			= strdup(Key);
 	new_option->Value.fval	= val;
 	new_option->flags		= flags;
 
-	
 	AddCommandOption(new_option);
 }
 
-
-void 
+void
 CommandLineParser::AddCommandOption(char *Key,unsigned flags,char **val)
 {
-	
+
 	if((Key==NULL)||(val==NULL))
 		return;
 
-	
 	__CBS *new_option=new __CBS;
 
-	
 	new_option->CommandType	= CT_USE_STRING;
 	new_option->Key			= strdup(Key);
 	new_option->Value.sval  = val;
 	new_option->flags		= flags;
 
-	
 	AddCommandOption(new_option);
 }
 
 
-
-void 
+void
 CommandLineParser::AddCommandOption(__CBS *new_option)
 {
-	
+
 	if(new_option==NULL)
 		return;
 
-	
 	if(new_option->Key==NULL)
 	{
 	   if(XOption!=NULL)
 		  delete XOption;
 
-	   
 	   XOption = new_option;
-	
+
 	   return;
 	}
 	else
 	 new_option->KeyLen = strlen(new_option->Key);
 
-	
 	new_option->next= Options;
 	Options			= new_option;
 }
 
 
-
-__CBS * 
+__CBS *
 CommandLineParser::LookupCommandOption(char *str)
 {
-	
+
 	if(str==NULL)
 	   return NULL;
 
 	__CBS	*cur=Options;
 	int		test=true;
 
-	
 	while(cur!=NULL)
 	{
 		if(cur->Key!=NULL)
@@ -223,25 +185,22 @@
 	return NULL;
 }
 
-
-bool		 
+bool
 CommandLineParser::ExecuteOption(__CBS *option,char *buff)
 {
-	
+
 	if(option==NULL)
 		return false;
 
   	int  len=0;
   	bool retval = false;
-  	
-	
+
   	if(buff!=NULL)
   	{
   		 len   = strlen(buff)-option->KeyLen;
   		 buff += option->KeyLen;
   	}
-  	
-	
+
   	switch(option->CommandType)
   	{
   	case	CT_NOP              :
@@ -265,7 +224,7 @@
   	default:
   		    return false;
   	}
-  	
+
   	return retval;
 }
 
@@ -275,10 +234,10 @@
 
 
 
-bool		
+bool
 CommandLineParser::AssignFlag	(__CBS *option,char *buf,int len)
 {
-  
+
   bool  val=true;
 
   if(option->flags & CTFLAGS_INVERT)
@@ -289,35 +248,35 @@
   return true;
 }
 
-bool		
+bool
 CommandLineParser::AssignInt	(__CBS *option,char *buf,int len)
 {
-  
+
   if(!IsStringLegal(buf,len))
 	 return false;
 
   *(option->Value.ival) = atoi(buf);
-  
+
   return true;
 }
 
-bool		
+bool
 CommandLineParser::AssignFloat	(__CBS *option,char *buf,int len)
 {
-  
+
   if(!IsStringLegal(buf,len))
 	 return false;
 
   *(option->Value.fval) = (float)atof(buf);
-  
+
   return true;
-  
+
 }
 
-bool		
+bool
 CommandLineParser::AssignString(__CBS *option,char *buf,int len)
 {
-  
+
   if(!IsStringLegal(buf,len))
 	 return false;
   *(option->Value.sval) = strdup(buf);
@@ -325,8 +284,7 @@
   return true;
 }
 
-
-bool		
+bool
 CommandLineParser::IsStringLegal(char *buf,int len)
 {
   if(buf==NULL)
@@ -339,15 +297,13 @@
 }
 
 
-
-bool 
+bool
 CommandLineParser::Execute(char *command_line)
 {
   return true;
 }
 
-
-bool 
+bool
 CommandLineParser::Execute(int num_args,char **command_line)
 {
   if(num_args<=0)
@@ -358,7 +314,7 @@
   for(int i=0;i<num_args;i++)
   {
 	 option = LookupCommandOption(command_line[i]);
-     
+
 	 if(option==NULL)
 		option=XOption;
 
@@ -368,4 +324,3 @@
 
   return true;
 }
-

Modified: trunk/ctp2_code/ctp/ctp2_utils/command.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/command.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/command.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,34 +1,25 @@
-
-
-
-
-
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-
 enum COMMAND_TYPE
 {
   CT_NOP,
-  CT_USE_FUNCTION,	   
+  CT_USE_FUNCTION,
   CT_USE_FUNCTION_NULL,
-  CT_USE_FLAG,		   
-  CT_USE_INT,		   
-  CT_USE_FLOAT,		   
-  CT_USE_STRING		   
-};		   
+  CT_USE_FLAG,
+  CT_USE_INT,
+  CT_USE_FLOAT,
+  CT_USE_STRING
+};
+
+#define CTFLAGS_NOP			0x00000000
+#define CTFLAGS_WARN		0x00000001
+#define CTFLAGS_ERROR		0x00000002
+#define CTFLAGS_REQUIRED	0x00000004
+#define CTFLAGS_NOCASE		0x00000008
+#define CTFLAGS_INVERT		0x00000010
 
-
-#define CTFLAGS_NOP			0x00000000 
-#define CTFLAGS_WARN		0x00000001 
-#define CTFLAGS_ERROR		0x00000002 
-#define CTFLAGS_REQUIRED	0x00000004 
-#define CTFLAGS_NOCASE		0x00000008 
-#define CTFLAGS_INVERT		0x00000010 
-
-	
 	typedef struct command_block_struct
 	{
 		COMMAND_TYPE  CommandType;
@@ -36,17 +27,17 @@
   		char         *Key;
   		int		      KeyLen;
   		struct        command_block_struct	*next;
-  		
+
   		union
   		{
   			bool (*ActionFunc)(char *,int len);
-  			bool  *flag;              
-  			int   *ival;              
-  			float *fval;              
-  			char **sval;              
-  		
+  			bool  *flag;
+  			int   *ival;
+  			float *fval;
+  			char **sval;
+
   		} Value;
-  		
+
   		command_block_struct()
   		{
   			CommandType	= CT_NOP;
@@ -55,7 +46,7 @@
   			KeyLen		= 0;
   			Value.ival	= NULL;
   		};
-  		
+
 	} __CBS;
 
 
@@ -67,52 +58,41 @@
 protected:
 public:
 
-   	
    	CommandLineParser();
    ~CommandLineParser();
 
-	
 	void SetUsage(void (*UsageFunc)());
 
-	
    	void AddCommandOption(char *Key,unsigned flags,bool (*ActionFunc)(char *,int len));
    	void AddCommandOption(char *Key,unsigned flags,bool *flag);
    	void AddCommandOption(char *Key,unsigned flags,int   *val);
    	void AddCommandOption(char *Key,unsigned flags,float *val);
    	void AddCommandOption(char *Key,unsigned flags,char **val);
 
-	
    	bool Execute(char *command_line);
    	bool Execute(int num_args,char **command_line);
 
-	
 	void ResetOptions();
 
 protected:
 
-	
    	void		AddCommandOption(__CBS *);
 
-	
 	__CBS		*LookupCommandOption(char *str);
 
-	
 	bool		 ExecuteOption(__CBS *option,char *buf);
 
-	
 	bool		AssignFlag	(__CBS *option,char *buf,int len);
     bool		AssignInt	(__CBS *option,char *buf,int len);
 	bool		AssignFloat	(__CBS *option,char *buf,int len);
 	bool		AssignString(__CBS *option,char *buf,int len);
 
-	
 	bool		IsStringLegal(char *buf,int len);
 
-	
 	void        (*Usage)();
-	__CBS		*Options;		
-	__CBS		*XOption;		
+	__CBS		*Options;
+	__CBS		*XOption;
 
 private:
 
-};
\ No newline at end of file
+};

Modified: trunk/ctp2_code/ctp/ctp2_utils/ctpregistry.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/ctpregistry.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/ctpregistry.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -8,9 +8,9 @@
 	BOOL opened;
 	HKEY newKey;
 
-	opened = RegOpenKeyEx((HKEY)key, subKey, 
-						  0,  
-						  KEY_READ, 
+	opened = RegOpenKeyEx((HKEY)key, subKey,
+						  0,
+						  KEY_READ,
 						  &newKey) == ERROR_SUCCESS;
 	if(opened) {
 		RegCloseKey(newKey);
@@ -23,7 +23,7 @@
 
 
 
-BOOL ctpregistry_SetKeyValue(void *key, MBCHAR *subKey, 
+BOOL ctpregistry_SetKeyValue(void *key, MBCHAR *subKey,
 							 MBCHAR *name,
 							 MBCHAR *value)
 {
@@ -57,16 +57,15 @@
 								MBCHAR *subKey,
 								MBCHAR *name)
 {
-	
-	
+
 	static MBCHAR valBuf[_MAX_PATH];
 	BOOL opened;
 	HKEY theKey;
 	DWORD valueType;
 	DWORD bufSize;
-	opened = RegOpenKeyEx((HKEY)key, subKey, 
-						  0,  
-						  KEY_READ, 
+	opened = RegOpenKeyEx((HKEY)key, subKey,
+						  0,
+						  KEY_READ,
 						  &theKey) == ERROR_SUCCESS;
 	if(opened) {
 		BOOL queried;

Modified: trunk/ctp2_code/ctp/ctp2_utils/ctpregistry.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/ctpregistry.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/ctpregistry.h	Mon May 23 04:21:18 2016	(r1115)
@@ -3,7 +3,7 @@
 
 #if defined(WIN32)
 BOOL ctpregistry_DoesKeyExist(void *key, MBCHAR *subKey);
-BOOL ctpregistry_SetKeyValue(void *key, MBCHAR *subKey, 
+BOOL ctpregistry_SetKeyValue(void *key, MBCHAR *subKey,
 							 MBCHAR *name,
 							 MBCHAR *value);
 MBCHAR *ctpregistry_GetKeyValue(void *key, MBCHAR *subKey,

Modified: trunk/ctp2_code/ctp/ctp2_utils/ddhelp.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/ddhelp.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/ddhelp.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,117 +1,116 @@
-
 #include "c3.h"
 #if !defined(__AUI_USE_SDL__)
 #include <ddraw.h>
 
-void TraceErrorDD(HRESULT hErr, char *sFile, int nLine) 
+void TraceErrorDD(HRESULT hErr, char *sFile, int nLine)
 {
-	char dderr[256];     
-	char err[1024];      
+	char dderr[256];
+	char err[1024];
 
-	switch (hErr)     {         
-		case DDERR_ALREADYINITIALIZED : sprintf(dderr, "DDERR_ALREADYINITIALIZED"); break;         
-		case DDERR_CANNOTATTACHSURFACE : sprintf(dderr, "DDERR_CANNOTATTACHSURFACE"); break;         
-		case DDERR_CANNOTDETACHSURFACE : sprintf(dderr, "DDERR_CANNOTDETACHSURFACE"); break;         
-		case DDERR_CURRENTLYNOTAVAIL : sprintf(dderr, "DDERR_CURRENTLYNOTAVAIL"); break;         
-		case DDERR_EXCEPTION : sprintf(dderr, "DDERR_EXCEPTION"); break;         
-		case DDERR_GENERIC : sprintf(dderr, "DDERR_GENERIC"); break;         
-		case DDERR_HEIGHTALIGN : sprintf(dderr, "DDERR_HEIGHTALIGN"); break;         
-		case DDERR_INCOMPATIBLEPRIMARY : sprintf(dderr, "DDERR_INCOMPATIBLEPRIMARY"); break;         
-		case DDERR_INVALIDCAPS : sprintf(dderr, "DDERR_INVALIDCAPS"); break;         
-		case DDERR_INVALIDCLIPLIST : sprintf(dderr, "DDERR_INVALIDCLIPLIST"); break;         
-		case DDERR_INVALIDMODE : sprintf(dderr, "DDERR_INVALIDMODE"); break;         
-		case DDERR_INVALIDOBJECT : sprintf(dderr, "DDERR_INVALIDOBJECT"); break;         
-		case DDERR_INVALIDPARAMS : sprintf(dderr, "DDERR_INVALIDPARAMS"); break;         
-		case DDERR_INVALIDPIXELFORMAT : sprintf(dderr, "DDERR_INVALIDPIXELFORMAT"); break;         
-		case DDERR_INVALIDRECT : sprintf(dderr, "DDERR_INVALIDRECT"); break;         
-		case DDERR_LOCKEDSURFACES : sprintf(dderr, "DDERR_LOCKEDSURFACES"); break;         
-		case DDERR_NO3D : sprintf(dderr, "DDERR_NO3D"); break;         
-		case DDERR_NOALPHAHW : sprintf(dderr, "DDERR_NOALPHAHW"); break;         
-		case DDERR_NOCLIPLIST : sprintf(dderr, "DDERR_NOCLIPLIST"); break;         
-		case DDERR_NOCOLORCONVHW : sprintf(dderr, "DDERR_NOCOLORCONVHW"); break;         
-		case DDERR_NOCOOPERATIVELEVELSET : sprintf(dderr, "DDERR_NOCOOPERATIVELEVELSET"); break;         
-		case DDERR_NOCOLORKEY : sprintf(dderr, "DDERR_NOCOLORKEY"); break;         
-		case DDERR_NOCOLORKEYHW : sprintf(dderr, "DDERR_NOCOLORKEYHW"); break;         
-		case DDERR_NODIRECTDRAWSUPPORT : sprintf(dderr, "DDERR_NODIRECTDRAWSUPPORT"); break;         
-		case DDERR_NOEXCLUSIVEMODE : sprintf(dderr, "DDERR_NOEXCLUSIVEMODE"); break;         
-		case DDERR_NOFLIPHW : sprintf(dderr, "DDERR_NOFLIPHW"); break;         
-		case DDERR_NOGDI : sprintf(dderr, "DDERR_NOGDI"); break;         
-		case DDERR_NOMIRRORHW : sprintf(dderr, "DDERR_NOMIRRORHW"); break;         
-		case DDERR_NOTFOUND : sprintf(dderr, "DDERR_NOTFOUND"); break;         
-		case DDERR_NOOVERLAYHW : sprintf(dderr, "DDERR_NOOVERLAYHW"); break;         
-		case DDERR_NORASTEROPHW : sprintf(dderr, "DDERR_NORASTEROPHW"); break;         
-		case DDERR_NOROTATIONHW : sprintf(dderr, "DDERR_NOROTATIONHW"); break;         
-		case DDERR_NOSTRETCHHW : sprintf(dderr, "DDERR_NOSTRETCHHW"); break;         
-		case DDERR_NOT4BITCOLOR : sprintf(dderr, "DDERR_NOT4BITCOLOR"); break;         
-		case DDERR_NOT4BITCOLORINDEX : sprintf(dderr, "DDERR_NOT4BITCOLORINDEX"); break;         
-		case DDERR_NOT8BITCOLOR : sprintf(dderr, "DDERR_NOT8BITCOLOR"); break;         
-		case DDERR_NOTEXTUREHW : sprintf(dderr, "DDERR_NOTEXTUREHW"); break;         
-		case DDERR_NOVSYNCHW : sprintf(dderr, "DDERR_NOVSYNCHW"); break;         
-		case DDERR_NOZBUFFERHW : sprintf(dderr, "DDERR_NOZBUFFERHW"); break;         
-		case DDERR_NOZOVERLAYHW : sprintf(dderr, "DDERR_NOZOVERLAYHW"); break;         
-		case DDERR_OUTOFCAPS : sprintf(dderr, "DDERR_OUTOFCAPS"); break;         
-		case DDERR_OUTOFMEMORY : sprintf(dderr, "DDERR_OUTOFMEMORY"); break;         
-		case DDERR_OUTOFVIDEOMEMORY : sprintf(dderr, "DDERR_OUTOFVIDEOMEMORY"); break;         
-		case DDERR_OVERLAYCANTCLIP : sprintf(dderr, "DDERR_OVERLAYCANTCLIP"); break;         
-		case DDERR_OVERLAYCOLORKEYONLYONEACTIVE : sprintf(dderr, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"); break;         
-		case DDERR_PALETTEBUSY : sprintf(dderr, "DDERR_PALETTEBUSY"); break;         
-		case DDERR_COLORKEYNOTSET : sprintf(dderr, "DDERR_COLORKEYNOTSET"); break;         
-		case DDERR_SURFACEALREADYATTACHED : sprintf(dderr, "DDERR_SURFACEALREADYATTACHED"); break;         
-		case DDERR_SURFACEALREADYDEPENDENT : sprintf(dderr, "DDERR_SURFACEALREADYDEPENDENT"); break;         
-		case DDERR_SURFACEBUSY : sprintf(dderr, "DDERR_SURFACEBUSY"); break;         
-		case DDERR_CANTLOCKSURFACE : sprintf(dderr, "DDERR_CANTLOCKSURFACE"); break;         
-		case DDERR_SURFACEISOBSCURED : sprintf(dderr, "DDERR_SURFACEISOBSCURED"); break;         
-		case DDERR_SURFACELOST : sprintf(dderr, "DDERR_SURFACELOST"); break;         
-		case DDERR_SURFACENOTATTACHED : sprintf(dderr, "DDERR_SURFACENOTATTACHED"); break;         
-		case DDERR_TOOBIGHEIGHT : sprintf(dderr, "DDERR_TOOBIGHEIGHT"); break;         
-		case DDERR_TOOBIGSIZE : sprintf(dderr, "DDERR_TOOBIGSIZE"); break;         
-		case DDERR_TOOBIGWIDTH : sprintf(dderr, "DDERR_TOOBIGWIDTH"); break;         
-		case DDERR_UNSUPPORTED : sprintf(dderr, "DDERR_UNSUPPORTED"); break;         
-		case DDERR_UNSUPPORTEDFORMAT : sprintf(dderr, "DDERR_UNSUPPORTEDFORMAT"); break;         
-		case DDERR_UNSUPPORTEDMASK : sprintf(dderr, "DDERR_UNSUPPORTEDMASK"); break;         
-		case DDERR_VERTICALBLANKINPROGRESS : sprintf(dderr, "DDERR_VERTICALBLANKINPROGRESS"); break;         
-		case DDERR_WASSTILLDRAWING : sprintf(dderr, "DDERR_WASSTILLDRAWING"); break;         
-		case DDERR_XALIGN : sprintf(dderr, "DDERR_XALIGN"); break;         
-		case DDERR_INVALIDDIRECTDRAWGUID : sprintf(dderr, "DDERR_INVALIDDIRECTDRAWGUID"); break;         
-		case DDERR_DIRECTDRAWALREADYCREATED : sprintf(dderr, "DDERR_DIRECTDRAWALREADYCREATED"); break;         
-		case DDERR_NODIRECTDRAWHW : sprintf(dderr, "DDERR_NODIRECTDRAWHW"); break;         
-		case DDERR_PRIMARYSURFACEALREADYEXISTS : sprintf(dderr, "DDERR_PRIMARYSURFACEALREADYEXISTS"); break;         
-		case DDERR_NOEMULATION : sprintf(dderr, "DDERR_NOEMULATION"); break;         
-		case DDERR_REGIONTOOSMALL : sprintf(dderr, "DDERR_REGIONTOOSMALL"); break;         
-		case DDERR_CLIPPERISUSINGHWND : sprintf(dderr, "DDERR_CLIPPERISUSINGHWND"); break;         
-		case DDERR_NOCLIPPERATTACHED : sprintf(dderr, "DDERR_NOCLIPPERATTACHED"); break;         
-		case DDERR_NOHWND : sprintf(dderr, "DDERR_NOHWND"); break;         
-		case DDERR_HWNDSUBCLASSED : sprintf(dderr, "DDERR_HWNDSUBCLASSED"); break;         
-		case DDERR_HWNDALREADYSET : sprintf(dderr, "DDERR_HWNDALREADYSET"); break;         
-		case DDERR_NOPALETTEATTACHED : sprintf(dderr, "DDERR_NOPALETTEATTACHED"); break;         
-		case DDERR_NOPALETTEHW : sprintf(dderr, "DDERR_NOPALETTEHW"); break;         
-		case DDERR_BLTFASTCANTCLIP : sprintf(dderr, "DDERR_BLTFASTCANTCLIP"); break;         
-		case DDERR_NOBLTHW : sprintf(dderr, "DDERR_NOBLTHW"); break;         
-		case DDERR_NODDROPSHW : sprintf(dderr, "DDERR_NODDROPSHW"); break;         
-		case DDERR_OVERLAYNOTVISIBLE : sprintf(dderr, "DDERR_OVERLAYNOTVISIBLE"); break;         
-		case DDERR_NOOVERLAYDEST : sprintf(dderr, "DDERR_NOOVERLAYDEST"); break;         
-		case DDERR_INVALIDPOSITION : sprintf(dderr, "DDERR_INVALIDPOSITION"); break;         
-		case DDERR_NOTAOVERLAYSURFACE : sprintf(dderr, "DDERR_NOTAOVERLAYSURFACE"); break;         
-		case DDERR_EXCLUSIVEMODEALREADYSET : sprintf(dderr, "DDERR_EXCLUSIVEMODEALREADYSET"); break;         
-		case DDERR_NOTFLIPPABLE : sprintf(dderr, "DDERR_NOTFLIPPABLE"); break;         
-		case DDERR_CANTDUPLICATE : sprintf(dderr, "DDERR_CANTDUPLICATE"); break;         
-		case DDERR_NOTLOCKED : sprintf(dderr, "DDERR_NOTLOCKED"); break;         
-		case DDERR_CANTCREATEDC : sprintf(dderr, "DDERR_CANTCREATEDC"); break;         
-		case DDERR_NODC : sprintf(dderr, "DDERR_NODC"); break;         
-		case DDERR_WRONGMODE : sprintf(dderr, "DDERR_WRONGMODE"); break;         
-		case DDERR_IMPLICITLYCREATED : sprintf(dderr, "DDERR_IMPLICITLYCREATED"); break;         
-		case DDERR_NOTPALETTIZED : sprintf(dderr, "DDERR_NOTPALETTIZED"); break;         
-		case DDERR_UNSUPPORTEDMODE : sprintf(dderr, "DDERR_UNSUPPORTEDMODE"); break;         
-		case DDERR_NOMIPMAPHW : sprintf(dderr, "DDERR_NOMIPMAPHW"); break;         
-		case DDERR_INVALIDSURFACETYPE : sprintf(dderr, "DDERR_INVALIDSURFACETYPE"); break;         
-		case DDERR_DCALREADYCREATED : sprintf(dderr, "DDERR_DCALREADYCREATED"); break;         
-		case DDERR_CANTPAGELOCK : sprintf(dderr, "DDERR_CANTPAGELOCK"); break;         
-		case DDERR_CANTPAGEUNLOCK : sprintf(dderr, "DDERR_CANTPAGEUNLOCK"); break;         
-		case DDERR_NOTPAGELOCKED : sprintf(dderr, "DDERR_NOTPAGELOCKED"); break;         
-		case DDERR_NOTINITIALIZED : sprintf(dderr, "DDERR_NOTINITIALIZED"); break;          
-		default : sprintf(dderr, "Unknown Error"); break;     
-	}     
-	sprintf(err, "DirectDraw Error %s\nin file %s at line %d", dderr, sFile, nLine);     
+	switch (hErr)     {
+		case DDERR_ALREADYINITIALIZED : sprintf(dderr, "DDERR_ALREADYINITIALIZED"); break;
+		case DDERR_CANNOTATTACHSURFACE : sprintf(dderr, "DDERR_CANNOTATTACHSURFACE"); break;
+		case DDERR_CANNOTDETACHSURFACE : sprintf(dderr, "DDERR_CANNOTDETACHSURFACE"); break;
+		case DDERR_CURRENTLYNOTAVAIL : sprintf(dderr, "DDERR_CURRENTLYNOTAVAIL"); break;
+		case DDERR_EXCEPTION : sprintf(dderr, "DDERR_EXCEPTION"); break;
+		case DDERR_GENERIC : sprintf(dderr, "DDERR_GENERIC"); break;
+		case DDERR_HEIGHTALIGN : sprintf(dderr, "DDERR_HEIGHTALIGN"); break;
+		case DDERR_INCOMPATIBLEPRIMARY : sprintf(dderr, "DDERR_INCOMPATIBLEPRIMARY"); break;
+		case DDERR_INVALIDCAPS : sprintf(dderr, "DDERR_INVALIDCAPS"); break;
+		case DDERR_INVALIDCLIPLIST : sprintf(dderr, "DDERR_INVALIDCLIPLIST"); break;
+		case DDERR_INVALIDMODE : sprintf(dderr, "DDERR_INVALIDMODE"); break;
+		case DDERR_INVALIDOBJECT : sprintf(dderr, "DDERR_INVALIDOBJECT"); break;
+		case DDERR_INVALIDPARAMS : sprintf(dderr, "DDERR_INVALIDPARAMS"); break;
+		case DDERR_INVALIDPIXELFORMAT : sprintf(dderr, "DDERR_INVALIDPIXELFORMAT"); break;
+		case DDERR_INVALIDRECT : sprintf(dderr, "DDERR_INVALIDRECT"); break;
+		case DDERR_LOCKEDSURFACES : sprintf(dderr, "DDERR_LOCKEDSURFACES"); break;
+		case DDERR_NO3D : sprintf(dderr, "DDERR_NO3D"); break;
+		case DDERR_NOALPHAHW : sprintf(dderr, "DDERR_NOALPHAHW"); break;
+		case DDERR_NOCLIPLIST : sprintf(dderr, "DDERR_NOCLIPLIST"); break;
+		case DDERR_NOCOLORCONVHW : sprintf(dderr, "DDERR_NOCOLORCONVHW"); break;
+		case DDERR_NOCOOPERATIVELEVELSET : sprintf(dderr, "DDERR_NOCOOPERATIVELEVELSET"); break;
+		case DDERR_NOCOLORKEY : sprintf(dderr, "DDERR_NOCOLORKEY"); break;
+		case DDERR_NOCOLORKEYHW : sprintf(dderr, "DDERR_NOCOLORKEYHW"); break;
+		case DDERR_NODIRECTDRAWSUPPORT : sprintf(dderr, "DDERR_NODIRECTDRAWSUPPORT"); break;
+		case DDERR_NOEXCLUSIVEMODE : sprintf(dderr, "DDERR_NOEXCLUSIVEMODE"); break;
+		case DDERR_NOFLIPHW : sprintf(dderr, "DDERR_NOFLIPHW"); break;
+		case DDERR_NOGDI : sprintf(dderr, "DDERR_NOGDI"); break;
+		case DDERR_NOMIRRORHW : sprintf(dderr, "DDERR_NOMIRRORHW"); break;
+		case DDERR_NOTFOUND : sprintf(dderr, "DDERR_NOTFOUND"); break;
+		case DDERR_NOOVERLAYHW : sprintf(dderr, "DDERR_NOOVERLAYHW"); break;
+		case DDERR_NORASTEROPHW : sprintf(dderr, "DDERR_NORASTEROPHW"); break;
+		case DDERR_NOROTATIONHW : sprintf(dderr, "DDERR_NOROTATIONHW"); break;
+		case DDERR_NOSTRETCHHW : sprintf(dderr, "DDERR_NOSTRETCHHW"); break;
+		case DDERR_NOT4BITCOLOR : sprintf(dderr, "DDERR_NOT4BITCOLOR"); break;
+		case DDERR_NOT4BITCOLORINDEX : sprintf(dderr, "DDERR_NOT4BITCOLORINDEX"); break;
+		case DDERR_NOT8BITCOLOR : sprintf(dderr, "DDERR_NOT8BITCOLOR"); break;
+		case DDERR_NOTEXTUREHW : sprintf(dderr, "DDERR_NOTEXTUREHW"); break;
+		case DDERR_NOVSYNCHW : sprintf(dderr, "DDERR_NOVSYNCHW"); break;
+		case DDERR_NOZBUFFERHW : sprintf(dderr, "DDERR_NOZBUFFERHW"); break;
+		case DDERR_NOZOVERLAYHW : sprintf(dderr, "DDERR_NOZOVERLAYHW"); break;
+		case DDERR_OUTOFCAPS : sprintf(dderr, "DDERR_OUTOFCAPS"); break;
+		case DDERR_OUTOFMEMORY : sprintf(dderr, "DDERR_OUTOFMEMORY"); break;
+		case DDERR_OUTOFVIDEOMEMORY : sprintf(dderr, "DDERR_OUTOFVIDEOMEMORY"); break;
+		case DDERR_OVERLAYCANTCLIP : sprintf(dderr, "DDERR_OVERLAYCANTCLIP"); break;
+		case DDERR_OVERLAYCOLORKEYONLYONEACTIVE : sprintf(dderr, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"); break;
+		case DDERR_PALETTEBUSY : sprintf(dderr, "DDERR_PALETTEBUSY"); break;
+		case DDERR_COLORKEYNOTSET : sprintf(dderr, "DDERR_COLORKEYNOTSET"); break;
+		case DDERR_SURFACEALREADYATTACHED : sprintf(dderr, "DDERR_SURFACEALREADYATTACHED"); break;
+		case DDERR_SURFACEALREADYDEPENDENT : sprintf(dderr, "DDERR_SURFACEALREADYDEPENDENT"); break;
+		case DDERR_SURFACEBUSY : sprintf(dderr, "DDERR_SURFACEBUSY"); break;
+		case DDERR_CANTLOCKSURFACE : sprintf(dderr, "DDERR_CANTLOCKSURFACE"); break;
+		case DDERR_SURFACEISOBSCURED : sprintf(dderr, "DDERR_SURFACEISOBSCURED"); break;
+		case DDERR_SURFACELOST : sprintf(dderr, "DDERR_SURFACELOST"); break;
+		case DDERR_SURFACENOTATTACHED : sprintf(dderr, "DDERR_SURFACENOTATTACHED"); break;
+		case DDERR_TOOBIGHEIGHT : sprintf(dderr, "DDERR_TOOBIGHEIGHT"); break;
+		case DDERR_TOOBIGSIZE : sprintf(dderr, "DDERR_TOOBIGSIZE"); break;
+		case DDERR_TOOBIGWIDTH : sprintf(dderr, "DDERR_TOOBIGWIDTH"); break;
+		case DDERR_UNSUPPORTED : sprintf(dderr, "DDERR_UNSUPPORTED"); break;
+		case DDERR_UNSUPPORTEDFORMAT : sprintf(dderr, "DDERR_UNSUPPORTEDFORMAT"); break;
+		case DDERR_UNSUPPORTEDMASK : sprintf(dderr, "DDERR_UNSUPPORTEDMASK"); break;
+		case DDERR_VERTICALBLANKINPROGRESS : sprintf(dderr, "DDERR_VERTICALBLANKINPROGRESS"); break;
+		case DDERR_WASSTILLDRAWING : sprintf(dderr, "DDERR_WASSTILLDRAWING"); break;
+		case DDERR_XALIGN : sprintf(dderr, "DDERR_XALIGN"); break;
+		case DDERR_INVALIDDIRECTDRAWGUID : sprintf(dderr, "DDERR_INVALIDDIRECTDRAWGUID"); break;
+		case DDERR_DIRECTDRAWALREADYCREATED : sprintf(dderr, "DDERR_DIRECTDRAWALREADYCREATED"); break;
+		case DDERR_NODIRECTDRAWHW : sprintf(dderr, "DDERR_NODIRECTDRAWHW"); break;
+		case DDERR_PRIMARYSURFACEALREADYEXISTS : sprintf(dderr, "DDERR_PRIMARYSURFACEALREADYEXISTS"); break;
+		case DDERR_NOEMULATION : sprintf(dderr, "DDERR_NOEMULATION"); break;
+		case DDERR_REGIONTOOSMALL : sprintf(dderr, "DDERR_REGIONTOOSMALL"); break;
+		case DDERR_CLIPPERISUSINGHWND : sprintf(dderr, "DDERR_CLIPPERISUSINGHWND"); break;
+		case DDERR_NOCLIPPERATTACHED : sprintf(dderr, "DDERR_NOCLIPPERATTACHED"); break;
+		case DDERR_NOHWND : sprintf(dderr, "DDERR_NOHWND"); break;
+		case DDERR_HWNDSUBCLASSED : sprintf(dderr, "DDERR_HWNDSUBCLASSED"); break;
+		case DDERR_HWNDALREADYSET : sprintf(dderr, "DDERR_HWNDALREADYSET"); break;
+		case DDERR_NOPALETTEATTACHED : sprintf(dderr, "DDERR_NOPALETTEATTACHED"); break;
+		case DDERR_NOPALETTEHW : sprintf(dderr, "DDERR_NOPALETTEHW"); break;
+		case DDERR_BLTFASTCANTCLIP : sprintf(dderr, "DDERR_BLTFASTCANTCLIP"); break;
+		case DDERR_NOBLTHW : sprintf(dderr, "DDERR_NOBLTHW"); break;
+		case DDERR_NODDROPSHW : sprintf(dderr, "DDERR_NODDROPSHW"); break;
+		case DDERR_OVERLAYNOTVISIBLE : sprintf(dderr, "DDERR_OVERLAYNOTVISIBLE"); break;
+		case DDERR_NOOVERLAYDEST : sprintf(dderr, "DDERR_NOOVERLAYDEST"); break;
+		case DDERR_INVALIDPOSITION : sprintf(dderr, "DDERR_INVALIDPOSITION"); break;
+		case DDERR_NOTAOVERLAYSURFACE : sprintf(dderr, "DDERR_NOTAOVERLAYSURFACE"); break;
+		case DDERR_EXCLUSIVEMODEALREADYSET : sprintf(dderr, "DDERR_EXCLUSIVEMODEALREADYSET"); break;
+		case DDERR_NOTFLIPPABLE : sprintf(dderr, "DDERR_NOTFLIPPABLE"); break;
+		case DDERR_CANTDUPLICATE : sprintf(dderr, "DDERR_CANTDUPLICATE"); break;
+		case DDERR_NOTLOCKED : sprintf(dderr, "DDERR_NOTLOCKED"); break;
+		case DDERR_CANTCREATEDC : sprintf(dderr, "DDERR_CANTCREATEDC"); break;
+		case DDERR_NODC : sprintf(dderr, "DDERR_NODC"); break;
+		case DDERR_WRONGMODE : sprintf(dderr, "DDERR_WRONGMODE"); break;
+		case DDERR_IMPLICITLYCREATED : sprintf(dderr, "DDERR_IMPLICITLYCREATED"); break;
+		case DDERR_NOTPALETTIZED : sprintf(dderr, "DDERR_NOTPALETTIZED"); break;
+		case DDERR_UNSUPPORTEDMODE : sprintf(dderr, "DDERR_UNSUPPORTEDMODE"); break;
+		case DDERR_NOMIPMAPHW : sprintf(dderr, "DDERR_NOMIPMAPHW"); break;
+		case DDERR_INVALIDSURFACETYPE : sprintf(dderr, "DDERR_INVALIDSURFACETYPE"); break;
+		case DDERR_DCALREADYCREATED : sprintf(dderr, "DDERR_DCALREADYCREATED"); break;
+		case DDERR_CANTPAGELOCK : sprintf(dderr, "DDERR_CANTPAGELOCK"); break;
+		case DDERR_CANTPAGEUNLOCK : sprintf(dderr, "DDERR_CANTPAGEUNLOCK"); break;
+		case DDERR_NOTPAGELOCKED : sprintf(dderr, "DDERR_NOTPAGELOCKED"); break;
+		case DDERR_NOTINITIALIZED : sprintf(dderr, "DDERR_NOTINITIALIZED"); break;
+		default : sprintf(dderr, "Unknown Error"); break;
+	}
+	sprintf(err, "DirectDraw Error %s\nin file %s at line %d", dderr, sFile, nLine);
 	DPRINTF(k_DBG_FIX, ("%s\n", err));
-}  
+}
 #endif

Modified: trunk/ctp2_code/ctp/ctp2_utils/minmax.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/minmax.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/minmax.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,66 +1,65 @@
-//----------------------------------------------------------------------------
-//
-// Project      : Call To Power 2
-// File type    : C++ header
-// Description  : Contains the definitions of std::min and std::max which are
-//                missing in MSVC6
-// Id           : $Id$
-//
-//----------------------------------------------------------------------------
-//
-// Disclaimer
-//
-// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
-//
-// This material has been developed at apolyton.net by the Apolyton CtP2 
-// Source Code Project. Contact the authors at ctp2source at apolyton.net.
-//
-//----------------------------------------------------------------------------
-//
-// Compiler flags
-//
-// - None
-//
-//----------------------------------------------------------------------------
-//
-// Modifications from the original Activision code:
-//
-// - Created file (31-Mar-2007 Martin Gühmann)
-// - Moved min and max from c3.h so that we can use it also in the other 
-//   projects so that we don't have to include everything from c3,h.
-//
-//----------------------------------------------------------------------------
-//
-//  Remarks
-//
-// - I do not know whether the location of this file is right, maybe it should
-//   be put into the compiler subdirectory.
-//
-//----------------------------------------------------------------------------
-
-#ifdef HAVE_PRAGMA_ONCE
-#pragma once
-#endif
-#ifndef __MINMAX__H__
-#define __MINMAX__H__ 1
-
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
-	// MSVC 6.0 does not have std::min and std::max.
-	namespace std
-	{
-		template <typename T>
-		inline T const & min(T const & a, T const & b)
-		{
-			return (a < b) ? a : b;
-		};
-
-		template <typename T>
-		inline T const & max(T const & a, T const & b)
-		{
-			return (a < b) ? b : a;
-		};
-	};	// namespace std
-#endif	// _MSC_VER < 1300
-
-#endif
-
+//----------------------------------------------------------------------------
+//
+// Project      : Call To Power 2
+// File type    : C++ header
+// Description  : Contains the definitions of std::min and std::max which are
+//                missing in MSVC6
+// Id           : $Id$
+//
+//----------------------------------------------------------------------------
+//
+// Disclaimer
+//
+// THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
+//
+// This material has been developed at apolyton.net by the Apolyton CtP2
+// Source Code Project. Contact the authors at ctp2source at apolyton.net.
+//
+//----------------------------------------------------------------------------
+//
+// Compiler flags
+//
+// - None
+//
+//----------------------------------------------------------------------------
+//
+// Modifications from the original Activision code:
+//
+// - Created file (31-Mar-2007 Martin Gühmann)
+// - Moved min and max from c3.h so that we can use it also in the other
+//   projects so that we don't have to include everything from c3,h.
+//
+//----------------------------------------------------------------------------
+//
+//  Remarks
+//
+// - I do not know whether the location of this file is right, maybe it should
+//   be put into the compiler subdirectory.
+//
+//----------------------------------------------------------------------------
+
+#ifdef HAVE_PRAGMA_ONCE
+#pragma once
+#endif
+#ifndef __MINMAX__H__
+#define __MINMAX__H__ 1
+
+#if defined(_MSC_VER) && (_MSC_VER < 1300)
+	// MSVC 6.0 does not have std::min and std::max.
+	namespace std
+	{
+		template <typename T>
+		inline T const & min(T const & a, T const & b)
+		{
+			return (a < b) ? a : b;
+		};
+
+		template <typename T>
+		inline T const & max(T const & a, T const & b)
+		{
+			return (a < b) ? b : a;
+		};
+	};	// namespace std
+#endif	// _MSC_VER < 1300
+
+#endif

Modified: trunk/ctp2_code/ctp/ctp2_utils/netconsole.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/netconsole.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/netconsole.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -66,9 +66,9 @@
 		return;
 	}
 
-	WORD wVersionRequested = MAKEWORD(1, 1);        
-	WSADATA wsaData;                                                        
-	int nErrorStatus;                                                       
+	WORD wVersionRequested = MAKEWORD(1, 1);
+	WSADATA wsaData;
+	int nErrorStatus;
 
 	nErrorStatus = WSAStartup(wVersionRequested, &wsaData);
 
@@ -77,7 +77,7 @@
 	}
 
 	if( LOBYTE(wsaData.wVersion) != LOBYTE(wVersionRequested) ||  HIBYTE(wsaData.wVersion) != HIBYTE(wVersionRequested) ) {
-		WSACleanup();   
+		WSACleanup();
 		return;
 	}
 
@@ -126,7 +126,7 @@
 			m_listenSock = -1;
 		} else {
 			if(listen(m_listenSock, 1) < 0) {
-				
+
 				c3errors_ErrorDialog("NetConsole", "Can't listen on port");
 #if defined(WIN32)
 				closesocket(m_listenSock);
@@ -190,7 +190,6 @@
 		}
 	}
 
-	
 	tv.tv_sec = 0;
 	tv.tv_usec = 0;
 	sint32 st = select(maxSock + 1, &readFds, 0, 0, &tv);
@@ -223,7 +222,7 @@
 
 		for(i = 0; i < k_MAX_CONNECTIONS; i++) {
 			if(m_connections[i] >= 0 && FD_ISSET(m_connections[i], &readFds)) {
-				
+
 				uint8 buf[k_MAX_SOCK_READ];
 				sint32 r = recv(m_connections[i], (char *)buf, k_MAX_SOCK_READ - 1, 0);
 				if(r < 0) {
@@ -256,14 +255,12 @@
 
 void NetConsole::Print(const char *fmt, va_list vl)
 {
-	
-	
+
 	static char buf[33000];
 	sint32 len;
 	vsprintf((char *)buf, fmt, vl);
 	len = strlen(buf);
 
-	
 	char *c = buf;
 	while(*c && c < buf+len && len < k_MAX_SOCK_READ) {
 		if(*c == '\n') {

Modified: trunk/ctp2_code/ctp/ctp2_utils/netconsole.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/netconsole.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/netconsole.h	Mon May 23 04:21:18 2016	(r1115)
@@ -32,7 +32,6 @@
 
 typedef sint32 sock_t;
 
-
 #define k_MAX_CONNECTIONS 4
 
 void netconsole_Initialize();
@@ -54,5 +53,5 @@
 };
 
 extern NetConsole *g_netConsole;
-	
+
 #endif

Modified: trunk/ctp2_code/ctp/ctp2_utils/pointerlist.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/pointerlist.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/pointerlist.h	Mon May 23 04:21:18 2016	(r1115)
@@ -10,13 +10,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 //----------------------------------------------------------------------------
 //
 // Modifications from the original Activision code:
@@ -61,12 +61,12 @@
 			m_next(NULL),
 			m_prev(NULL)
         { ; };
-		
-		virtual ~PointerListNode() 
+
+		virtual ~PointerListNode()
         { ; };
-		
+
 		T* GetObj() { return m_obj; };
-		
+
 		PointerListNode *GetNext() { return m_next; };
 		PointerListNode *GetPrev() { return m_prev; };
 	private:
@@ -77,14 +77,14 @@
 		PointerListNode* m_prev;
 	};
 
-	PointerList() : m_head(NULL), 
+	PointerList() : m_head(NULL),
 				m_tail(NULL),
 				m_count(0)
     { ; };
 
-	virtual ~PointerList() 
+	virtual ~PointerList()
 	{
-		while (m_head) 
+		while (m_head)
         {
 			PointerListNode * node = m_head;
 			m_head = m_head->m_next;
@@ -94,7 +94,7 @@
 
 	void DeleteAll()
 	{
-		while (m_head) 
+		while (m_head)
         {
 			PointerListNode * node = m_head;
 			m_head = m_head->m_next;
@@ -129,51 +129,51 @@
 	sint32 GetCount() const { return m_count; }
 
 	PointerListNode *Find(T *obj);
-	
+
 	void Swap(PointerListNode *node, PointerListNode *swap) {
 		PointerListNode *oldNext = node->m_next;
 		PointerListNode *oldPrev = node->m_prev;
 		PointerListNode *swapNext = swap->m_next;
 		PointerListNode *swapPrev = swap->m_prev;
-		
+
 		if(oldPrev) {
 			oldPrev->m_next = swap;
 		}
-		
+
 		if(oldNext) {
 			oldNext->m_prev = swap;
 		}
-		
+
 		if(oldPrev == swap) {
 			swap->m_prev = node;
 		} else {
 			swap->m_prev = oldPrev;
 		}
-		
+
 		if(oldNext == swap) {
 			swap->m_next = node;
 		} else {
 			swap->m_next = oldNext;
 		}
-		
+
 		if(swapNext == node) {
 			node->m_next = swap;
 		} else {
 			node->m_next = swapNext;
 		}
-		
+
 		if(swapPrev == node) {
 			node->m_prev = swap;
 		} else {
 			node->m_prev = swapPrev;
 		}
-		
+
 		if(node->m_prev) {
 			node->m_prev->m_next = node;
 		} else {
 			m_head = node;
 		}
-		
+
 		if(node->m_next) {
 			node->m_next->m_prev = node;
 		} else {
@@ -191,14 +191,14 @@
 
 	class Walker {
 	public:
-		Walker(PointerList * list = NULL) 
+		Walker(PointerList * list = NULL)
         :
             m_node  (list ? list->m_head : NULL),
 			m_list  (list)
 		{
 		};
 
-		void SetList(PointerList *list) 
+		void SetList(PointerList *list)
         {
             m_node = list ? list->m_head : NULL;
 			m_list = list;
@@ -207,11 +207,11 @@
 		void Prev() { Assert(m_node); m_node = m_node->GetPrev(); }
 		bool IsValid() { return m_node != NULL; }
 		T *GetObj() { Assert(m_node); return m_node->GetObj(); }
-		T *Remove() 
-		{ 
+		T *Remove()
+		{
 			T *obj = m_node->GetObj();
 			PointerListNode* nextNode = m_node->GetNext();
-			m_list->Remove(m_node); 
+			m_list->Remove(m_node);
 			m_node = nextNode;
 			return obj;
 		}
@@ -224,7 +224,7 @@
 
 		void MoveUp() {
 			if(!m_node->GetPrev()) {
-				
+
 				return;
 			}
 
@@ -233,7 +233,7 @@
 
 		void MoveDown() {
 			if(!m_node->GetNext()) {
-				
+
 				return;
 			}
 			m_list->Swap(m_node, m_node->GetNext());
@@ -342,7 +342,7 @@
     if (!node)
         return;
 
-	if (node == m_head) 
+	if (node == m_head)
     {
 		m_head = node->m_next;
         if (m_head)
@@ -354,7 +354,7 @@
 			m_tail = NULL;
         }
 	}
-    else if (node == m_tail) 
+    else if (node == m_tail)
     {
 		m_tail = node->m_prev;
 		if (m_tail)
@@ -382,10 +382,9 @@
 	delete node;
 }
 
-
 template <class T> void PointerList<T>::InsertAt(PointerListNode *node, T *obj)
 {
-	if (node) 
+	if (node)
     {
 	    PointerListNode * newNode = new PointerListNode(obj);
 		newNode->m_next = node->m_next;
@@ -404,7 +403,7 @@
     else
     {
 		AddHead(obj);   // AddTail would have been more logical
-	} 
+	}
 }
 
 template <class T> void PointerList<T>::InsertBefore(PointerListNode *node, T *obj)
@@ -430,7 +429,7 @@
         AddHead(obj);
     }
 }
-	
+
 template <class T> typename PointerList<T>::PointerListNode *PointerList<T>::Find(T *obj)
 {
 	for (PointerListNode * search = m_head; search; search = search->m_next)

Modified: trunk/ctp2_code/ctp/ctp2_utils/tracklen.cpp
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/tracklen.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/tracklen.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -55,7 +55,6 @@
 
 char tracklen_buf[512];
 
-
 char *tracklen_cryptAscii(char *s)
 {
 	static char *keyy = "Checking aspiration formants.\n";
@@ -92,11 +91,10 @@
 #endif
 }
 
-
 #else
-#define tracklen_DPRINT(ss) 
+#define tracklen_DPRINT(ss)
 #define DMCIError(error)
-#endif 
+#endif
 
 
 
@@ -130,18 +128,17 @@
 	memset(&mp, 0, sizeof(mp));
 	mp.dwTimeFormat = MCI_FORMAT_MILLISECONDS;
 	iRet = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)&mp);
-	if (iRet) 
+	if (iRet)
     {
 		tracklen_DPRINT((tracklen_buf, "GetTrackLengths: failed to set time format.\n" ));
 		return __LINE__;
 	}
 	tracklen_DPRINT((tracklen_buf, "GetTrackLengths: set time format to milliseconds.\n"));
 
-	
 	memset(&msp, 0, sizeof(msp));
 	msp.dwItem = MCI_STATUS_NUMBER_OF_TRACKS;
 	iRet = mciSendCommand( wDeviceID, MCI_STATUS, MCI_STATUS_ITEM, (DWORD_PTR)&msp );
-	if (iRet) 
+	if (iRet)
 	{
 		tracklen_DPRINT((tracklen_buf,  "GetTrackLengths: failed to read # of tracks\n"));
 		DMCIError( iRet );
@@ -252,8 +249,8 @@
 	mop.wDeviceID = 0;
 
 	iRet = mciSendCommand
-                    (0, MCI_OPEN, 
-                     MCI_WAIT | MCI_OPEN_ELEMENT | MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE, 
+                    (0, MCI_OPEN,
+                     MCI_WAIT | MCI_OPEN_ELEMENT | MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE,
                      (DWORD_PTR) &mop
                     );
 	if (iRet)
@@ -277,7 +274,7 @@
 	SDL_CDClose(cdrom);
 #else
 	iRet = tracklen_GetTrackLengthsViaHandle( trackLenBuf, mop.wDeviceID);
-	
+
 	mciSendCommand( mop.wDeviceID, MCI_CLOSE, 0, NULL );
 #endif
 
@@ -300,7 +297,7 @@
 		SendMessage( hCD, WM_CLOSE, 0, 0 );
 	}
 #endif
-	
+
 	int iDrive;
 #ifdef USE_SDL
 	for (iDrive=0; iDrive<SDL_CDNumDrives(); iDrive++) {
@@ -320,7 +317,7 @@
 #ifdef USE_SDL
 		if (driveName)
 			szDrive[0] = driveName[0];
-		else             
+		else
 			szDrive[0] = ' ';
 #else
 		szDrive[0] = static_cast<char>(iDrive + 'A');
@@ -349,7 +346,6 @@
 			tracklen_DPRINT((tracklen_buf,  "CheckTrackLengths2: drive %s has %d tracks, wanted %d\n", szDrive, newbuf[0], trackLenBuf[0] ));
 			continue;
 		}
-		
 
 
 		for (i=2; i< (int)(newbuf[0]); i++) {
@@ -358,7 +354,7 @@
 				break;
 			}
 		}
-		
+
 		if (i == ((int) newbuf[0])) {
 			tracklen_DPRINT((tracklen_buf,  "CheckTrackLengths2: success!\n"));
 			return 0;
@@ -397,7 +393,7 @@
 
 		if (!S_ISLNK(st.st_mode))
 			return NULL;
-		
+
 		int size = readlink(szLink, szTemp, sizeof(szTemp));
 		if ((size < 0) || (static_cast<size_t>(size) > sizeof(szTemp)))
 			return NULL;
@@ -422,13 +418,13 @@
 	if( hFile == INVALID_HANDLE_VALUE ) {
 #else
 	FILE *f = fopen(szTemp, "r");
-	
+
 	if (!f)
 	{
 		strcpy( szTemp, szFile );
 		f = fopen(szTemp, "r");
 	}
-	
+
 	if (!f) {
 #endif
 		tracklen_DPRINT((tracklen_buf, "tracklen_LoadEncryptedKey: can't open %s\n", szTemp));
@@ -483,13 +479,13 @@
 
 char *GetVersionInfo( DWORD *trackLenBuffer )
 {
-	
+
 	char *szVersionPtr = (char*)&trackLenBuffer[1];
 	if( szVersionPtr[0] != 'V' || szVersionPtr[3] != '.' )
 	{
 #ifdef tracklen_LOGGING
 		tracklen_DPRINT((tracklen_buf, "GetVersionInfo: outdated tracklen file: does not contain version information. Version information has been implemented as of 08/21/00\n"));
-#endif	
+#endif
 		return( NULL );
 	}
 
@@ -512,7 +508,6 @@
 
 	BYTE byRet = _TRACKLEN_OK;
 
-	
 	char *szVersionPtr = GetVersionInfo( trackLenBuf );
 #ifdef tracklen_LOGGING
 	if( !szVersionPtr )
@@ -520,13 +515,13 @@
                 tracklen_DPRINT((tracklen_buf, "tracklen_CheckTrackLengths: Warning: tracklen file does not contain any version information and was most likely created using a previous version of this SDK\n"));
 		byRet = _TRACKLEN_VERSIONMISMATCH;
 	}
-#endif	
+#endif
 
 	if( szVersionPtr && szVersionInfoBuffer )
 		strncpy( szVersionInfoBuffer, szVersionPtr, CHRVERSIONINFOLEN );
 
 #ifdef tracklen_LOGGING
-	
+
 	if( szVersionPtr )
 	{
 		if( strcmp( szVersionPtr, VERSIONINFO ) )
@@ -539,31 +534,28 @@
 			tracklen_DPRINT((tracklen_buf, "tracklen_CheckTrackLengths: Verified version info: %s\n", szVersionPtr ));
 		}
 	}
-#endif	
+#endif
 
 	if( szVersionPtr )
 	{
 		trackLenBuf[ DWVERSIONINFOLEN ] = trackLenBuf[0] - (DWORD)(DWVERSIONINFOLEN);
 		if( tracklen_CheckTrackLengths2( trackLenBuf + DWVERSIONINFOLEN ) )
 			return( _TRACKLEN_CHECKFAILED );
-		
+
 		return( byRet );
 	}
 	else if( tracklen_CheckTrackLengths2( trackLenBuf ) )
 		return( _TRACKLEN_CHECKFAILED );
-	
+
 	return( byRet );
 }
 
-
-#define AUTORUN_UNKNOWN 0		
+#define AUTORUN_UNKNOWN 0
 #define AUTORUN_DEFAULT 0x95
 #define AUTORUN_DISABLE 0xff
 
-
 static ULONG s_oldAutoRunValue = AUTORUN_UNKNOWN;
 
-
 void tracklen_AutoPlay_Disable()
 {
 #ifdef _WIN32
@@ -572,12 +564,12 @@
 
 	hkey = NULL;
 	res = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", 0, KEY_ALL_ACCESS, &hkey);
-	if (res == ERROR_SUCCESS) {	
+	if (res == ERROR_SUCCESS) {
 		if (s_oldAutoRunValue == AUTORUN_UNKNOWN) {
 			unsigned long ulDataSize = sizeof(s_oldAutoRunValue);
 			res = RegQueryValueEx(hkey, "NoDriveTypeAutoRun", 0, NULL, (unsigned char*)&s_oldAutoRunValue, &ulDataSize);
 		}
-		
+
 		if (res == ERROR_SUCCESS) {
 			unsigned long ulDisableAutoRun = AUTORUN_DISABLE;
 			RegSetValueEx(hkey, "NoDriveTypeAutoRun", 0, REG_BINARY, (const unsigned char*)&ulDisableAutoRun, 4);
@@ -594,13 +586,12 @@
 	int res;
 	HKEY hkey = NULL;
 
-	
 	if (s_oldAutoRunValue == AUTORUN_UNKNOWN) {
 		return;
 	}
 
 	res = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", 0, KEY_ALL_ACCESS, &hkey);
-	if (res == ERROR_SUCCESS) {	
+	if (res == ERROR_SUCCESS) {
 		RegSetValueEx(hkey, "NoDriveTypeAutoRun", 0, REG_BINARY, (const unsigned char*)&s_oldAutoRunValue, 4);
 		RegFlushKey(hkey);
 		RegCloseKey(hkey);

Modified: trunk/ctp2_code/ctp/ctp2_utils/tracklen.h
==============================================================================
--- trunk/ctp2_code/ctp/ctp2_utils/tracklen.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/ctp2_utils/tracklen.h	Mon May 23 04:21:18 2016	(r1115)
@@ -40,7 +40,6 @@
 extern "C" {
 #endif
 
-
 #define VERSIONINFO			"V01.000 Overburn"
 #define CHRVERSIONINFOLEN	30
 #define DWVERSIONINFOLEN	CHRVERSIONINFOLEN / sizeof( DWORD ) + 1
@@ -49,7 +48,6 @@
 
 #define tracklen_MAXTRACKS 128
 
-
 #define tracklen_DATFILE "texture.dat"
 
 #ifdef tracklen_LOGGING
@@ -78,4 +76,4 @@
 }
 #endif
 
-#endif 
+#endif

Modified: trunk/ctp2_code/ctp/debugtools/Timer.cpp
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/Timer.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/Timer.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,133 +1,126 @@
-//////////////////////////////////////////////////////////////////////////////
-// Timer.cpp
-// =========
-// High Resolution Timer.
-// This timer is able to measure the elapsed time with 1 micro-second accuracy
-// in both Windows, Linux and Unix system 
-//
-//  AUTHOR: Song Ho Ahn (song.ahn at gmail.com)
-// CREATED: 2003-01-13
-// UPDATED: 2006-01-13
-//
-// Copyright (c) 2003 Song Ho Ahn
-//////////////////////////////////////////////////////////////////////////////
-
-#include "c3.h"
-#include "Timer.h"
-#include <stdlib.h>
-
-///////////////////////////////////////////////////////////////////////////////
-// constructor
-///////////////////////////////////////////////////////////////////////////////
-Timer::Timer()
-{
-#ifdef WIN32
-    QueryPerformanceFrequency(&frequency);
-    startCount.QuadPart = 0;
-    endCount.QuadPart = 0;
-#else
-    startCount.tv_sec = startCount.tv_usec = 0;
-    endCount.tv_sec = endCount.tv_usec = 0;
-#endif
-
-    stopped = 0;
-    startTimeInMicroSec = 0;
-    endTimeInMicroSec = 0;
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// distructor
-///////////////////////////////////////////////////////////////////////////////
-Timer::~Timer()
-{
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// start timer.
-// startCount will be set at this point.
-///////////////////////////////////////////////////////////////////////////////
-void Timer::start()
-{
-    stopped = 0; // reset stop flag
-#ifdef WIN32
-    QueryPerformanceCounter(&startCount);
-#else
-    gettimeofday(&startCount, NULL);
-#endif
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// stop the timer.
-// endCount will be set at this point.
-///////////////////////////////////////////////////////////////////////////////
-void Timer::stop()
-{
-    stopped = 1; // set timer stopped flag
-
-#ifdef WIN32
-    QueryPerformanceCounter(&endCount);
-#else
-    gettimeofday(&endCount, NULL);
-#endif
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// compute elapsed time in micro-second resolution.
-// other getElapsedTime will call this first, then convert to correspond resolution.
-///////////////////////////////////////////////////////////////////////////////
-double Timer::getElapsedTimeInMicroSec()
-{
-#ifdef WIN32
-    if(!stopped)
-        QueryPerformanceCounter(&endCount);
-
-    startTimeInMicroSec = startCount.QuadPart * (1000000.0 / frequency.QuadPart);
-    endTimeInMicroSec = endCount.QuadPart * (1000000.0 / frequency.QuadPart);
-#else
-    if(!stopped)
-        gettimeofday(&endCount, NULL);
-
-    startTimeInMicroSec = (startCount.tv_sec * 1000000.0) + startCount.tv_usec;
-    endTimeInMicroSec = (endCount.tv_sec * 1000000.0) + endCount.tv_usec;
-#endif
-
-    return endTimeInMicroSec - startTimeInMicroSec;
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// divide elapsedTimeInMicroSec by 1000
-///////////////////////////////////////////////////////////////////////////////
-double Timer::getElapsedTimeInMilliSec()
-{
-    return this->getElapsedTimeInMicroSec() * 0.001;
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// divide elapsedTimeInMicroSec by 1000000
-///////////////////////////////////////////////////////////////////////////////
-double Timer::getElapsedTimeInSec()
-{
-    return this->getElapsedTimeInMicroSec() * 0.000001;
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// same as getElapsedTimeInSec()
-///////////////////////////////////////////////////////////////////////////////
-double Timer::getElapsedTime()
-{
-    return this->getElapsedTimeInSec();
-}
+//////////////////////////////////////////////////////////////////////////////
+// Timer.cpp
+// =========
+// High Resolution Timer.
+// This timer is able to measure the elapsed time with 1 micro-second accuracy
+// in both Windows, Linux and Unix system
+//
+//  AUTHOR: Song Ho Ahn (song.ahn at gmail.com)
+// CREATED: 2003-01-13
+// UPDATED: 2006-01-13
+//
+// Copyright (c) 2003 Song Ho Ahn
+//////////////////////////////////////////////////////////////////////////////
+
+#include "c3.h"
+#include "Timer.h"
+#include <stdlib.h>
+
+///////////////////////////////////////////////////////////////////////////////
+// constructor
+///////////////////////////////////////////////////////////////////////////////
+Timer::Timer()
+{
+#ifdef WIN32
+    QueryPerformanceFrequency(&frequency);
+    startCount.QuadPart = 0;
+    endCount.QuadPart = 0;
+#else
+    startCount.tv_sec = startCount.tv_usec = 0;
+    endCount.tv_sec = endCount.tv_usec = 0;
+#endif
+
+    stopped = 0;
+    startTimeInMicroSec = 0;
+    endTimeInMicroSec = 0;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// distructor
+///////////////////////////////////////////////////////////////////////////////
+Timer::~Timer()
+{
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// start timer.
+// startCount will be set at this point.
+///////////////////////////////////////////////////////////////////////////////
+void Timer::start()
+{
+    stopped = 0; // reset stop flag
+#ifdef WIN32
+    QueryPerformanceCounter(&startCount);
+#else
+    gettimeofday(&startCount, NULL);
+#endif
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// stop the timer.
+// endCount will be set at this point.
+///////////////////////////////////////////////////////////////////////////////
+void Timer::stop()
+{
+    stopped = 1; // set timer stopped flag
+
+#ifdef WIN32
+    QueryPerformanceCounter(&endCount);
+#else
+    gettimeofday(&endCount, NULL);
+#endif
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// compute elapsed time in micro-second resolution.
+// other getElapsedTime will call this first, then convert to correspond resolution.
+///////////////////////////////////////////////////////////////////////////////
+double Timer::getElapsedTimeInMicroSec()
+{
+#ifdef WIN32
+    if(!stopped)
+        QueryPerformanceCounter(&endCount);
+
+    startTimeInMicroSec = startCount.QuadPart * (1000000.0 / frequency.QuadPart);
+    endTimeInMicroSec = endCount.QuadPart * (1000000.0 / frequency.QuadPart);
+#else
+    if(!stopped)
+        gettimeofday(&endCount, NULL);
+
+    startTimeInMicroSec = (startCount.tv_sec * 1000000.0) + startCount.tv_usec;
+    endTimeInMicroSec = (endCount.tv_sec * 1000000.0) + endCount.tv_usec;
+#endif
+
+    return endTimeInMicroSec - startTimeInMicroSec;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// divide elapsedTimeInMicroSec by 1000
+///////////////////////////////////////////////////////////////////////////////
+double Timer::getElapsedTimeInMilliSec()
+{
+    return this->getElapsedTimeInMicroSec() * 0.001;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// divide elapsedTimeInMicroSec by 1000000
+///////////////////////////////////////////////////////////////////////////////
+double Timer::getElapsedTimeInSec()
+{
+    return this->getElapsedTimeInMicroSec() * 0.000001;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// same as getElapsedTimeInSec()
+///////////////////////////////////////////////////////////////////////////////
+double Timer::getElapsedTime()
+{
+    return this->getElapsedTimeInSec();
+}

Modified: trunk/ctp2_code/ctp/debugtools/Timer.h
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/Timer.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/Timer.h	Mon May 23 04:21:18 2016	(r1115)
@@ -1,56 +1,53 @@
-//////////////////////////////////////////////////////////////////////////////
-// Timer.h
-// =======
-// High Resolution Timer.
-// This timer is able to measure the elapsed time with 1 micro-second accuracy
-// in both Windows, Linux and Unix system 
-//
-//  AUTHOR: Song Ho Ahn (song.ahn at gmail.com)
-// CREATED: 2003-01-13
-// UPDATED: 2006-01-13
-//
-// Copyright (c) 2003 Song Ho Ahn
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef TIMER_H_DEF
-#define TIMER_H_DEF
-
-#ifdef WIN32   // Windows system specific
-#include <windows.h>
-#else          // Unix based system specific
-#include <sys/time.h>
-#endif
-
-
-class Timer
-{
-public:
-    Timer();                                    // default constructor
-    ~Timer();                                   // default destructor
-
-    void   start();                             // start timer
-    void   stop();                              // stop the timer
-    double getElapsedTime();                    // get elapsed time in second
-    double getElapsedTimeInSec();               // get elapsed time in second (same as getElapsedTime)
-    double getElapsedTimeInMilliSec();          // get elapsed time in milli-second
-    double getElapsedTimeInMicroSec();          // get elapsed time in micro-second
-
-
-protected:
-
-
-private:
-    double startTimeInMicroSec;                 // starting time in micro-second
-    double endTimeInMicroSec;                   // ending time in micro-second
-    int    stopped;                             // stop flag 
-#ifdef WIN32
-    LARGE_INTEGER frequency;                    // ticks per second
-    LARGE_INTEGER startCount;                   //
-    LARGE_INTEGER endCount;                     //
-#else
-    timeval startCount;                         //
-    timeval endCount;                           //
-#endif
-};
-
-#endif // TIMER_H_DEF
+//////////////////////////////////////////////////////////////////////////////
+// Timer.h
+// =======
+// High Resolution Timer.
+// This timer is able to measure the elapsed time with 1 micro-second accuracy
+// in both Windows, Linux and Unix system
+//
+//  AUTHOR: Song Ho Ahn (song.ahn at gmail.com)
+// CREATED: 2003-01-13
+// UPDATED: 2006-01-13
+//
+// Copyright (c) 2003 Song Ho Ahn
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef TIMER_H_DEF
+#define TIMER_H_DEF
+
+#ifdef WIN32   // Windows system specific
+#include <windows.h>
+#else          // Unix based system specific
+#include <sys/time.h>
+#endif
+
+class Timer
+{
+public:
+    Timer();                                    // default constructor
+    ~Timer();                                   // default destructor
+
+    void   start();                             // start timer
+    void   stop();                              // stop the timer
+    double getElapsedTime();                    // get elapsed time in second
+    double getElapsedTimeInSec();               // get elapsed time in second (same as getElapsedTime)
+    double getElapsedTimeInMilliSec();          // get elapsed time in milli-second
+    double getElapsedTimeInMicroSec();          // get elapsed time in micro-second
+
+protected:
+
+private:
+    double startTimeInMicroSec;                 // starting time in micro-second
+    double endTimeInMicroSec;                   // ending time in micro-second
+    int    stopped;                             // stop flag
+#ifdef WIN32
+    LARGE_INTEGER frequency;                    // ticks per second
+    LARGE_INTEGER startCount;                   //
+    LARGE_INTEGER endCount;                     //
+#else
+    timeval startCount;                         //
+    timeval endCount;                           //
+#endif
+};
+
+#endif // TIMER_H_DEF

Modified: trunk/ctp2_code/ctp/debugtools/breakpoint.h
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/breakpoint.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/breakpoint.h	Mon May 23 04:21:18 2016	(r1115)
@@ -41,11 +41,10 @@
 #define Breakpoint() __asm { int 03h }
 
 
-
 #ifdef __cplusplus
 }
 #endif
 
-#endif  
+#endif
 
-#endif 
+#endif

Modified: trunk/ctp2_code/ctp/debugtools/debug.c
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/debug.c	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/debug.c	Mon May 23 04:21:18 2016	(r1115)
@@ -10,7 +10,7 @@
  *
  * THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
  *
- * This material has been developed at apolyton.net by the Apolyton CtP2 
+ * This material has been developed at apolyton.net by the Apolyton CtP2
  * Source Code Project. Contact the authors at ctp2source at apolyton.net.
  *
  *----------------------------------------------------------------------------
@@ -20,7 +20,7 @@
  * _DEBUG
  * This code is only activated when this flag has been set.
  *
- * _MSC_VER		
+ * _MSC_VER
  * - Compiler version (for the Microsoft C++ compiler only).
  *
  *----------------------------------------------------------------------------
@@ -32,7 +32,6 @@
  *----------------------------------------------------------------------------
  */
 
-
 #ifdef _DEBUG
 
 #include "debug.h"  // Own declarations: consistency check
@@ -90,7 +89,6 @@
 #endif
 }
 
-
 //
 // Only close memory system ... logs asserts etc may be used in static desctructors
 //
@@ -187,4 +185,3 @@
 #endif
 
 #endif // def _DEBUG
-

Modified: trunk/ctp2_code/ctp/debugtools/debug.h
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/debug.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/debug.h	Mon May 23 04:21:18 2016	(r1115)
@@ -10,13 +10,13 @@
  *
  * THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
  *
- * This material has been developed at apolyton.net by the Apolyton CtP2 
+ * This material has been developed at apolyton.net by the Apolyton CtP2
  * Source Code Project. Contact the authors at ctp2source at apolyton.net.
  *
  *----------------------------------------------------------------------------
  *
  * Compiler flags
- * 
+ *
  * _DEBUG
  * This code is only activated when this flag has been set.
  *

Modified: trunk/ctp2_code/ctp/debugtools/debugassert.cpp
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/debugassert.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/debugassert.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -1,6 +1,5 @@
 #ifdef _DEBUG
 
-
 #include "debugassert.h"
 #include "debugcallstack.h"
 #include "breakpoint.h"
@@ -14,9 +13,8 @@
 
 struct DebugAssert
 {
-	
-	
-	
+
+
 	DebugAssertClientFunction DebugAssert_Enter;
 	DebugAssertClientFunction DebugAssert_Leave;
 };
@@ -59,7 +57,7 @@
 
 void DebugAssert_Close (void)
 {
-	
+
 }
 
 
@@ -80,30 +78,26 @@
 
 
 
-	
+
 void DebugAssert_Assert (const char *module_name, int module_line, const char *log_class, const char *condition_string)
 {
-	
+
 	Log_Enable (log_class);
 
-	
 	LOG_INDIRECT (module_name, module_line, (log_class, "ASSERT (%s)", condition_string));
 
-	
 	DebugCallStack_Dump (log_class);
 
-	
 	if (debug_assert.DebugAssert_Enter)
 	{
 		debug_assert.DebugAssert_Enter();
 	}
 
-	
-	Breakpoint();	
+	Breakpoint();
+
+
+
 
-	
-	
-	
 	if (debug_assert.DebugAssert_Leave)
 	{
 		debug_assert.DebugAssert_Leave();

Modified: trunk/ctp2_code/ctp/debugtools/debugassert.h
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/debugassert.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/debugassert.h	Mon May 23 04:21:18 2016	(r1115)
@@ -16,7 +16,6 @@
 extern "C" {
 #endif
 
-	
 #include "log.h"
 
 
@@ -69,7 +68,7 @@
 
 
 
-#undef ASSERT    
+#undef ASSERT
 #define ASSERT(condition)													\
 	{if (! ((int) (condition))) {											\
 		DebugAssert_Assert ( __FILE__, __LINE__, LOG_ASSERT, #condition);	\
@@ -122,7 +121,7 @@
 
 
 
-	
+
 void DebugAssert_Assert (const char *module_name, int module_line, const char *log_class, const char *condition_string);
 
 
@@ -134,4 +133,4 @@
 
 #endif
 
-#endif 
+#endif

Modified: trunk/ctp2_code/ctp/debugtools/debugcallstack.cpp
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/debugcallstack.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/debugcallstack.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,13 +11,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 // _DEBUG
 // - Generate debug version
 //
@@ -55,7 +55,7 @@
 #include <string.h>
 #include <stdio.h>
 #ifdef WIN32
-#include <imagehlp.h>      
+#include <imagehlp.h>
 #endif
 
 #ifndef _DEBUG
@@ -84,15 +84,12 @@
 
 #endif // WIN32
 
-
 void Debug_FunctionNameClose (void);
 char *Debug_FunctionNameGet (unsigned address);
 
-
-#define DEBUG_CODE_LIMIT 0x80000000 
+#define DEBUG_CODE_LIMIT 0x80000000
 #define BUFFER_SIZE      (2000)
 
-
 #ifdef _DEBUG
 #define k_MAP_FILE "civctp_dbg.map"
 #else
@@ -114,9 +111,7 @@
 
 #define k_STACK_TRACE_LEN 32768
 
-
-const int k_CALL_STACK_SIZE = 29;			
-
+const int k_CALL_STACK_SIZE = 29;
 
 static MBCHAR s_stackTraceString[k_STACK_TRACE_LEN];
 
@@ -133,7 +128,7 @@
 
 void DebugCallStack_Open (void)
 {
-	
+
 	Debug_FunctionNameOpen (k_MAP_FILE);
 }
 
@@ -170,16 +165,14 @@
 
 static LONG _cdecl MemoryAccessExceptionFilter (LPEXCEPTION_POINTERS ep)
 {
-  
+
   if (ep->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
     return (EXCEPTION_EXECUTE_HANDLER);
 
-  
   if (ep->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW)
     return (EXCEPTION_EXECUTE_HANDLER);
 
 
-  
   return (EXCEPTION_CONTINUE_SEARCH);
 }
 
@@ -195,9 +188,9 @@
 
 
 
-static char *unknown = "(unknown)";  
-static char *kernel  = "(kernel)";   
-static int function_name_open = 0;   
+static char *unknown = "(unknown)";
+static char *kernel  = "(kernel)";
+static int function_name_open = 0;
 
 
 
@@ -208,8 +201,7 @@
   char *name;
 } FUNCTION_ADDRESS;
 
-static FUNCTION_ADDRESS *fa_first = NULL;  
-
+static FUNCTION_ADDRESS *fa_first = NULL;
 
 void *Debug_GetFAFirst(void)
 {
@@ -231,7 +223,6 @@
   FUNCTION_ADDRESS *pointer = NULL;
   FUNCTION_ADDRESS *last = NULL;
 
-  
   new_function = (FUNCTION_ADDRESS *) malloc (sizeof (FUNCTION_ADDRESS));
   if (!new_function)
   {
@@ -239,7 +230,6 @@
   }
   new_function->address = address;
 
-  
   if (name[0] == '?')
   {
 	#ifndef _BFR_
@@ -255,43 +245,38 @@
     }
   }
 
-  
   else if (name[0] == '_')
   {
     new_function->name = strdup (name + 1);
   }
 
-  
   else
   {
     new_function->name = strdup (name);
   }
 
-  
 
-  
+
+
   if (fa_first == NULL) {
     new_function->next = NULL;
     fa_first = new_function;
     return;
   }
 
-  
   if (address >= fa_first->address) {
     new_function->next = fa_first;
     fa_first = new_function;
     return;
   }
 
-  
   pointer = fa_first;
   while ((pointer) && (address < pointer->address)) {
-    
+
     last = pointer;
     pointer = pointer->next;
   }
 
-  
   new_function->next = last->next;
   last->next = new_function;
 }
@@ -326,7 +311,6 @@
   int log_correct;
 #endif
 
-  
   fp = fopen (map_file_name, "rt");
   if (!fp) {
 #ifdef REQUIRE_CORRECT_LOG
@@ -336,52 +320,41 @@
 #endif
   }
 
-  
   done = 0;
   while (!done) {
     fgets (buffer, BUFFER_SIZE, fp);
 
-    
     if (feof (fp))
       done = 1;
 
-    
     if (sscanf (buffer, "%s", name) == 1) {
       if (strcmp (name, "Address") == 0)
         done = 1;
     }
   }
 
-  
   fgets (buffer, BUFFER_SIZE, fp);
 
-  
   done = 0;
   while (!done) {
 
-    
     fgets (buffer, BUFFER_SIZE, fp);
 
-    
     if ((buffer[0] == ' ') &&
         (buffer[1] == '0') &&
         (buffer[5] == ':') &&
 
-        
         (sscanf (buffer, "%x:%x %s %x", &crap, &crap, name, &address) == 4))
     {
       Debug_AddFunction (name, address);
     }
 
-    
     if (feof (fp))
       done = 1;
   }
 
-  
   fclose (fp);
 
-
   function_name_open = 1;
   return (1);
 
@@ -389,10 +362,8 @@
 }
 
 
-
-static HANDLE	hProc,					
-				hThread;				
-
+static HANDLE	hProc,
+				hThread;
 
 #ifdef WIN32
 
@@ -422,18 +393,18 @@
 {
 	#ifndef _BFR_
 		int					err;
-		
+
 		// Seems that SysEnumerateSymbols changed???
 #if defined(_MSC_VER) && (_MSC_VER < 1400)
 		if (!SymEnumerateSymbols(hProc, dllBase, Debug_EnumSymbolsCallback, userContext)) {
 			err = GetLastError();
 			LOG ((LOG_FATAL, "SymEnumerateSymbols failed in module '%s' with error %d", moduleName, err));
-		
+
 			return FALSE;
 		}
 #endif
 	#endif
-	
+
 	return TRUE;
 }
 
@@ -461,7 +432,6 @@
 
   function_name_open = 0;
 
-  
   while (pointer) {
 #ifdef GENERATE_ADDRESS_LOG
     fprintf(fh,"%08X %s\n",pointer->address,pointer->name);
@@ -498,17 +468,15 @@
     return (kernel);
   }
 
-  
   if (!function_name_open)
   {
     return (unknown);
   }
-  else 
+  else
   {
-    
+
     pointer = fa_first;
 
-    
     while (pointer) {
       if (address >= pointer->address)
         return (pointer->name);
@@ -516,44 +484,39 @@
       pointer = pointer->next;
     }
 
-    
     return (unknown);
   }
 }
 
 
-
 char *Debug_FunctionNameAndOffsetGet (unsigned address, int *offset)
 {
 	FUNCTION_ADDRESS *pointer;
 	*offset = 0;
-	
+
 	if (address > DEBUG_CODE_LIMIT)
 	{
 		return (kernel);
 	}
-	
-	
+
 	if (!function_name_open)
 	{
 		return (unknown);
 	}
-	else 
+	else
 	{
-		
+
 		pointer = fa_first;
-		
-		
+
 		while (pointer) {
 			if (address >= pointer->address) {
 				*offset = address - pointer->address;
 				return (pointer->name);
 			}
-			
+
 			pointer = pointer->next;
 		}
-		
-		
+
 		return (unknown);
 	}
 }
@@ -608,7 +571,6 @@
 	char	*caller_name;
 	int		offset;
 
-
 	caller_name = Debug_FunctionNameAndOffsetGet (address, &offset);
 
 	LOG_INDIRECT (NULL, 0, (log_class, "  0x%08x  [%s + 0x%x]\n", address, caller_name, offset));
@@ -623,10 +585,9 @@
 void DebugCallStack_Dump (LogClass log_class)
 {
 #ifdef WIN32
-	unsigned base_pointer;   
+	unsigned base_pointer;
 	__asm mov base_pointer, ebp;
 
-	
 	DebugCallStack_DumpFrom (log_class, base_pointer);
 #endif // WIN32
 }
@@ -639,13 +600,13 @@
 void DebugCallStack_DumpFrom (LogClass log_class, unsigned base_pointer)
 {
 #ifdef WIN32
-  unsigned frame_limit;    
-  unsigned frame_pointer;  
-  unsigned caller;         
-  int finished;            
-  int registers_printed;   
+  unsigned frame_limit;
+  unsigned frame_pointer;
+  unsigned caller;
+  int finished;
+  int registers_printed;
 
-  int debug_dump_whole_stack = 0; 
+  int debug_dump_whole_stack = 0;
 
   unsigned regs_eax;
   unsigned regs_ebx;
@@ -656,7 +617,6 @@
   unsigned regs_esp;
   unsigned regs_ebp;
 
-  
   __asm mov regs_eax, eax;
   __asm mov regs_ebx, ebx;
   __asm mov regs_ecx, ecx;
@@ -666,13 +626,11 @@
   __asm mov regs_esp, esp;
   __asm mov regs_ebp, ebp;
 
-  
   finished = 0;
   registers_printed = 0;
-  while (!finished) 
+  while (!finished)
   {
 
-    
     __try
     {
       caller = *((unsigned *) (base_pointer + 4));
@@ -683,21 +641,18 @@
     }
 
 
-    
     if (caller >= DEBUG_CODE_LIMIT)
     {
       finished = 1;
     }
 
-    
-    if (!finished) 
+    if (!finished)
     {
-      
+
 		DebugCallStack_DumpAddress (log_class, caller);
 
-      
-      
-      if ((debug_dump_whole_stack) && (!registers_printed)) 
+
+      if ((debug_dump_whole_stack) && (!registers_printed))
 	  {
         LOG_INDIRECT (NULL, 0, (log_class, "    EAX %08x  EBX %08x  ECX %08x  EDX %08x\n",
           regs_eax,
@@ -713,26 +668,26 @@
         registers_printed = 1;
       }
 
-      
-      
-      
-      
-      
-      
-      
-      
-      
-      
-      
-      
-      
-      
-
-      frame_pointer = base_pointer + 8;             
-      frame_limit = * ((unsigned *) base_pointer);  
-      if (debug_dump_whole_stack) 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+      frame_pointer = base_pointer + 8;
+      frame_limit = * ((unsigned *) base_pointer);
+      if (debug_dump_whole_stack)
 	  {
-        while (frame_pointer < frame_limit) 
+        while (frame_pointer < frame_limit)
 		{
           LOG_INDIRECT(NULL, 0, (log_class, "    %02x %02x %02x %02x    '%c%c%c%c'\n",
             (unsigned) (* ((unsigned char *) (frame_pointer + 0))),
@@ -748,7 +703,6 @@
         }
       }
 
-      
       base_pointer = frame_limit;
     }
   }
@@ -775,33 +729,31 @@
 void DebugCallStack_Save  (unsigned *call_stack, int number, unsigned long Ebp)
 {
 #ifdef WIN32
-  unsigned base_pointer;   
-  unsigned caller;         
-  int finished;            
-  int index;               
+  unsigned base_pointer;
+  unsigned caller;
+  int finished;
+  int index;
 
   if(Ebp == 0) {
-	  
+
 	  __asm mov base_pointer, ebp;
   } else {
 	  base_pointer = Ebp;
   }
 
-  
   finished = 0;
   caller = 0;
   index = 0;
-  while ((!finished) && ( index < number)) 
+  while ((!finished) && ( index < number))
   {
 
-    
     if ((caller >= DEBUG_CODE_LIMIT) || (base_pointer == 0))
     {
       finished = 1;
     }
     else
     {
-      
+
       __try
       {
         caller = *((unsigned *) (base_pointer + 4));
@@ -812,30 +764,25 @@
       }
     }
 
-    
     if (!finished) {
 
-      
       call_stack[index] = caller;
 
 
-      
       base_pointer = * ((unsigned *) base_pointer);
 
-	  
 	  if ((index != 0) && (call_stack[index - 1] == call_stack[index]))
 	  {
-		  
+
 	  }
 	  else
 	  {
-	      
+
 		  index ++;
 	  }
     }
   }
 
-  
   while (index < number) {
     call_stack[index] = 0;
 
@@ -854,20 +801,18 @@
 void DebugCallStack_Show  (LogClass log_class, unsigned *call_stack, int number)
 {
 #ifdef WIN32
-  unsigned caller;         
-  char *caller_name;       
-  int index;               
+  unsigned caller;
+  char *caller_name;
+  int index;
 
 
-  
   index = 0;
   while ((index < number) && (call_stack[index] != 0)) {
 
-    
     caller = call_stack[index];
 
 	int offset;
-	
+
 	caller_name = Debug_FunctionNameAndOffsetGet (caller, &offset);
 
 	LOG_INDIRECT (NULL, 0, (log_class, "  0x%08x  [%s + 0x%x]\n", caller, caller_name, offset));
@@ -903,31 +848,28 @@
 void DebugCallStack_ShowToFile  (LogClass log_class, unsigned *call_stack, int number, FILE *file)
 {
 #ifdef WIN32
-	unsigned caller;         
-	char *caller_name;       
-	int index;               
-	
+	unsigned caller;
+	char *caller_name;
+	int index;
+
 	char allocator_name[1024];
-	
-	
+
 	index = 0;
 	while ((index < number) && (call_stack[index] != 0)) {
-		
-		
+
 		caller = call_stack[index];
-		
+
 		int offset;
-		
+
 		caller_name = Debug_FunctionNameAndOffsetGet (caller, &offset);
-		
+
 		if (index == 3) {
 			strcpy(allocator_name, caller_name);
 		}
 
 		fprintf(file, "0x%08x [%s+0x%x] / ", caller, caller_name, offset);
-		
-		
-		
+
+
 		index ++;
 	}
 
@@ -955,31 +897,29 @@
 //----------------------------------------------------------------------------
 void DebugCallStack_ShowToAltFile  (LogClass log_class, unsigned *call_stack, int number, FILE *file)
 {
-	unsigned caller;         
-	char *caller_name;       
+	unsigned caller;
+	char *caller_name;
 	int index = 3;
-	
+
 	char buff[8196];
 	char cpyBuff[8196];
-	
+
 	caller = call_stack[index];
-	int offset;		
+	int offset;
 	caller_name = Debug_FunctionNameAndOffsetGet (caller, &offset);
 	sprintf(buff, "[%s]", caller_name, buff);
 	index++;
-	
+
 	while ((index < number) && (call_stack[index] != 0)) {
-		
-		
+
 		caller = call_stack[index];
 		int offset;
 		caller_name = Debug_FunctionNameAndOffsetGet (caller, &offset);
-		
+
 		strcpy(cpyBuff, buff);
 		sprintf(buff, "[%s] %s", caller_name, cpyBuff);
-		
-		
-		
+
+
 		index++;
 	}
 
@@ -989,45 +929,35 @@
 
 char * c3debug_StackTrace(void)
 {
-	unsigned caller;					
-	char *caller_name;					
-	int index;							
-	MBCHAR function_name[16384];	
+	unsigned caller;
+	char *caller_name;
+	int index;
+	MBCHAR function_name[16384];
 
-	
 	unsigned callstack_function[k_CALL_STACK_SIZE];
 
-	
 	DebugCallStack_Save(callstack_function, k_CALL_STACK_SIZE, 0);
 
-	
 	s_stackTraceString[0] = 0;
 
-	
 	index = 0;
-	while ((index < k_CALL_STACK_SIZE) && (callstack_function[index] != 0)) 
+	while ((index < k_CALL_STACK_SIZE) && (callstack_function[index] != 0))
 	{
-		
+
 		caller = callstack_function[index];
 
-		
 		int offset;
 
-		
 		caller_name = Debug_FunctionNameAndOffsetGet (caller, &offset);
 
-		
 		sprintf(function_name, "  0x%08x  [%s + 0x%x]\n", caller, caller_name, offset);
 
-		
 		if (strlen(s_stackTraceString) + strlen(function_name) < k_STACK_TRACE_LEN - 1 )
 			strcat(s_stackTraceString, function_name);
 
-		
 		index ++;
 	}
 
-	
 	return s_stackTraceString;
 }
 
@@ -1038,83 +968,69 @@
 		DebugCallStack_Open();
 	}
 
-	unsigned caller;					
-	char *caller_name;					
-	int index;							
-	MBCHAR function_name[_MAX_PATH];	
+	unsigned caller;
+	char *caller_name;
+	int index;
+	MBCHAR function_name[_MAX_PATH];
 
-	
 	unsigned callstack_function[k_CALL_STACK_SIZE];
 
-	
 	callstack_function[0] = exception->ContextRecord->Eip;
 
-	
 	DebugCallStack_Save(&callstack_function[1], k_CALL_STACK_SIZE - 1, exception->ContextRecord->Ebp);
 
-	
 	s_stackTraceString[0] = 0;
 
-	
 	index = 0;
-	while ((index < k_CALL_STACK_SIZE) && (callstack_function[index] != 0)) 
+	while ((index < k_CALL_STACK_SIZE) && (callstack_function[index] != 0))
 	{
-		
+
 		caller = callstack_function[index];
 
-		
 		int offset;
 
-
 		if(function_name_open) {
-			
+
 			caller_name = Debug_FunctionNameAndOffsetGet (caller, &offset);
 
-			
 			sprintf(function_name, "  0x%08x  [%s + 0x%x]\n", caller, caller_name, offset);
-			
+
 		} else {
 			sprintf(function_name, "  0x%08x\n", caller);
 		}
 
-		
 		if (strlen(s_stackTraceString) + strlen(function_name) < k_STACK_TRACE_LEN - 1 )
 			strcat(s_stackTraceString, function_name);
 
-		
-		
+
 		index ++;
 	}
 
-	
 	return s_stackTraceString;
 }
 #endif // WIN32
- 
+
 char * c3debug_ExceptionStackTraceFromFile(FILE *f)
 {
 	if(!function_name_open) {
 		DebugCallStack_Open();
 	}
 
-
 	unsigned caller;
 	char line[1024];
-	char *caller_name;					
+	char *caller_name;
 
 	int offset;
 
-	MBCHAR function_name[_MAX_PATH];	
+	MBCHAR function_name[_MAX_PATH];
 	s_stackTraceString[0] = 0;
 	while(!feof(f)) {
 		if(fgets(line, 1024, f)) {
 			if(sscanf(line, "  0x%08x", &caller) == 1) {
 				caller_name = Debug_FunctionNameAndOffsetGet(caller, &offset);
-				
-				
+
 				sprintf(function_name, "  0x%08x  [%s + 0x%x]\n", caller, caller_name, offset);
 
-				
 				if (strlen(s_stackTraceString) + strlen(function_name) < k_STACK_TRACE_LEN - 1 )
 					strcat(s_stackTraceString, function_name);
 			}
@@ -1147,21 +1063,20 @@
 cDebugCallStackSet::cDebugCallStackSet(int depth)
 {
 	m_depth = depth;
-	m_blockSize = m_depth + 1;	
+	m_blockSize = m_depth + 1;
 	m_numStacks = 0;
-	
+
 	m_maxNumStacks = 16;
-	m_caller = 0;	
-	
-	
+	m_caller = 0;
+
 	m_stacks = new unsigned[m_blockSize*m_maxNumStacks];
-	
+
 	m_curStack = new unsigned[m_depth+2];
 
 }
 
 cDebugCallStackSet::~cDebugCallStackSet()
-{		
+{
 	delete [] m_stacks;
 	delete [] m_curStack;
 }
@@ -1176,11 +1091,9 @@
 
 void cDebugCallStackSet::Add()
 {
-	
-	
+
 	DebugCallStack_Save(m_curStack,m_depth+2,0);
-	
-	
+
 	int i;
 	for (i=0;i<m_numStacks;++i) {
 		if (memcmp(m_curStack+2,&m_stacks[m_blockSize*i+1],sizeof(unsigned)*m_depth)==0) {
@@ -1194,15 +1107,14 @@
 		}
 	}
 
-	
-	
+
 	if (m_numStacks>=m_maxNumStacks) {
-		
+
 		int newMax = m_maxNumStacks*=2;
 		unsigned *pNewStack = new unsigned[m_blockSize * newMax];
-		
+
 		memcpy(pNewStack,m_stacks,m_numStacks*m_blockSize*sizeof(unsigned));
-		
+
 		delete [] m_stacks;
 		m_stacks = pNewStack;
 		m_maxNumStacks = newMax;
@@ -1213,34 +1125,28 @@
 	m_stacks[m_blockSize*i] = 1;
 	m_numStacks++;
 
-	
-	
-	
+
+
+
 	qsort(m_stacks,m_numStacks,m_blockSize*sizeof(unsigned),qsortDebugCallStack);
 
-	
 	if (m_numStacks > 1) {
 		Assert(m_stacks[0] >= m_stacks[m_blockSize]);
 	}
 }
 
-
 void cDebugCallStackSet::Dump(const char *filename)
-{		
-	const char *caller_name;	
+{
+	const char *caller_name;
 	int offset;
 
-	
 	qsort(m_stacks,m_numStacks,m_blockSize*sizeof(unsigned),qsortDebugCallStack);
 
-	
-	
+
 	FILE *fp = fopen(filename,"wt");
 
-	
 	caller_name = Debug_FunctionNameAndOffsetGet(m_caller,&offset);
 
-
 	int totalCalls = 0;
 	int i;
 	for (i=0;i<m_numStacks;++i) {
@@ -1262,9 +1168,3 @@
 	}
 	fclose(fp);
 }
-
-
-
-
-
-

Modified: trunk/ctp2_code/ctp/debugtools/debugcallstack.h
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/debugcallstack.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/debugcallstack.h	Mon May 23 04:21:18 2016	(r1115)
@@ -61,18 +61,18 @@
 public:
 	cDebugCallStackSet(int depth);
 	~cDebugCallStackSet();
-	
+
 	void Add();
 	void Dump(const char *filename);
 
 private:
-	int m_maxNumStacks;	
-	unsigned m_caller;	
-	int m_depth;		
-	int m_blockSize;	
-	int m_numStacks;	
-	unsigned *m_stacks;	
-	unsigned *m_curStack;	
+	int m_maxNumStacks;
+	unsigned m_caller;
+	int m_depth;
+	int m_blockSize;
+	int m_numStacks;
+	unsigned *m_stacks;
+	unsigned *m_curStack;
 };
 #endif
 

Modified: trunk/ctp2_code/ctp/debugtools/debugexception.cpp
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/debugexception.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/debugexception.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -5,7 +5,7 @@
 #include "debugcallstack.h"
 #include "breakpoint.h"
 #include "log.h"
-#include <windows.h>		
+#include <windows.h>
 
 
 
@@ -16,9 +16,8 @@
 
 struct DebugException
 {
-	
-	
-	
+
+
 	DebugAssertClientFunction DebugException_Enter;
 };
 
@@ -62,7 +61,7 @@
 
 void DebugException_Close (void)
 {
-	
+
 }
 
 
@@ -78,9 +77,9 @@
 
 inline static void DebugExceptionFilter_LogExceptionType (LPEXCEPTION_POINTERS ep)
 {
-	
-	
-	
+
+
+
 
 	switch(ep->ExceptionRecord->ExceptionCode)
 	{
@@ -172,9 +171,9 @@
 
 inline static void DebugExceptionFilter_LogRegisterState (LPEXCEPTION_POINTERS ep)
 {
-	
-	
-	
+
+
+
 
 	LOG ((LOG_EXCEPTION, "  EAX: %08xh      ESI: %08xh", (DWORD) ep->ContextRecord->Eax, (DWORD) ep->ContextRecord->Esi));
 	LOG ((LOG_EXCEPTION, "  EBX: %08xh      EDI: %08xh", (DWORD) ep->ContextRecord->Ebx, (DWORD) ep->ContextRecord->Edi));
@@ -196,24 +195,20 @@
 		(int) ep->ContextRecord->EFlags & 0x1000 ? 1 : 0));
 }
 
-
 static LONG _cdecl DebugException_Filter (LPEXCEPTION_POINTERS exception_pointers)
 {
-	
+
 	DebugExceptionFilter_LogExceptionType (exception_pointers);
 	DebugExceptionFilter_LogRegisterState (exception_pointers);
 
-	
 	DebugCallStack_DumpAddress (LOG_EXCEPTION, exception_pointers->ContextRecord->Eip);
 	DebugCallStack_DumpFrom (LOG_EXCEPTION, exception_pointers->ContextRecord->Ebp);
 
-	
 	if (debug_exception.DebugException_Enter)
 	{
 		debug_exception.DebugException_Enter();
 	}
 
-	
 	return (EXCEPTION_CONTINUE_SEARCH);
 }
 
@@ -231,18 +226,16 @@
 
 void DebugException_Execute (DebugExceptionClientFunction function_monitored)
 {
-	
+
 	__try
 	{
 		function_monitored();
 	}
 
-	
 	__except (DebugException_Filter (GetExceptionInformation()))
 	{
 	}
 }
 
 
-
 #endif

Modified: trunk/ctp2_code/ctp/debugtools/debugexception.h
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/debugexception.h	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/debugexception.h	Mon May 23 04:21:18 2016	(r1115)
@@ -16,7 +16,7 @@
 extern "C" {
 #endif
 
-	
+
 
 
 
@@ -74,4 +74,4 @@
 
 #endif
 
-#endif 
+#endif

Modified: trunk/ctp2_code/ctp/debugtools/debugmemory.cpp
==============================================================================
--- trunk/ctp2_code/ctp/debugtools/debugmemory.cpp	Tue Mar  1 21:22:05 2016	(r1114)
+++ trunk/ctp2_code/ctp/debugtools/debugmemory.cpp	Mon May 23 04:21:18 2016	(r1115)
@@ -11,13 +11,13 @@
 //
 // THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
 //
-// This material has been developed at apolyton.net by the Apolyton CtP2 
+// This material has been developed at apolyton.net by the Apolyton CtP2
 // Source Code Project. Contact the authors at ctp2source at apolyton.net.
 //
 //----------------------------------------------------------------------------
 //
 // Compiler flags
-// 
+//
 // _DEBUG
 // - Generate debug version
 //
@@ -51,7 +51,7 @@
 #include "debugcallstack.h"
 #include "debugassert.h"
 #include "breakpoint.h"
-#include <windows.h>		
+#include <windows.h>
 #include <string.h>
 
 
@@ -73,33 +73,30 @@
 
 struct DebugMemory
 {
-	
+
 	bool open;
 
-	
-	
-	
-	
+
+
+
+
 	bool initialised;
 
-	
 	MemoryHeap default_heap;
 
-	
-	int total_outstanding;		
-	int total_allocations;		
-	int total_user_memory;		
-	int total_overhead_memory;	
-	int max_user_memory;		
-	int max_overhead_memory;	
-
-	
-	bool log_callstack;			
-	bool log_module_totals;		
-	bool log_malloc_totals;		
+	int total_outstanding;
+	int total_allocations;
+	int total_user_memory;
+	int total_overhead_memory;
+	int max_user_memory;
+	int max_overhead_memory;
+
+	bool log_callstack;
+	bool log_module_totals;
+	bool log_malloc_totals;
 
-	int total_from_dll;	
-	int total_from_exe; 
+	int total_from_dll;
+	int total_from_exe;
 };
 
 
@@ -120,46 +117,39 @@
 
 
 
-struct MemoryHeapDescriptor 
+struct MemoryHeapDescriptor
 {
-	
-	
-	
+
+
 	int type;
 
-	
 	HANDLE handle;
 
-	
 	const char *name;
 
-	
-	
-	
+
+
+
 
 #ifdef MEMORY_LOGGED
-	
+
 	const char *module_name;
 	int module_line;
 
-	
 	bool is_default_heap;
 
-	
-	
+
 	bool is_open;
 
-	
-	AllocHeader *first_memory_block;	
-	int total_outstanding;		
-	int total_allocations;		
-	int total_user_memory;		
-	int total_overhead_memory;	
-	int max_user_memory;		
-	int max_overhead_memory;	
+	AllocHeader *first_memory_block;
+	int total_outstanding;
+	int total_allocations;
+	int total_user_memory;
+	int total_overhead_memory;
+	int max_user_memory;
+	int max_overhead_memory;
 
 
-	
 	MemoryHeap next;
 	MemoryHeap last;
 #endif
@@ -187,26 +177,21 @@
 {
 	MemoryHeap heap;
 
-	
 	heap = (MemoryHeap) malloc (sizeof (MemoryHeapDescriptor));
 
-	
 	heap->name = _strdup ("Default Heap");
 
-	
 	heap->type = 'HEAP';
 
-	
 	heap->handle = GetProcessHeap();
 
 #i