Skip to content

Commit

Permalink
Update to v2.13
Browse files Browse the repository at this point in the history
Files extracted from the updater (source: 4players.de). According to the readme, the patch was completed on or around 21 May 2007. It was released on 19 July.
  • Loading branch information
f1rpo committed May 12, 2021
1 parent 812ec5c commit 6634cc8
Show file tree
Hide file tree
Showing 16 changed files with 745 additions and 469 deletions.
Binary file modified Warlords/Assets/CvGameCoreDLL.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Warlords/Assets/XML/GlobalDefines.xml
Expand Up @@ -6,7 +6,7 @@
<Civ4Defines xmlns="x-schema:CIV4GlobalDefinesSchema.xml">
<Define>
<DefineName>CIV4_VERSION</DefineName>
<iDefineIntVal>208</iDefineIntVal>
<iDefineIntVal>213</iDefineIntVal>
</Define>
<Define>
<DefineName>SAVE_VERSION</DefineName>
Expand Down
Expand Up @@ -1448,4 +1448,12 @@
<Plural>0:1</Plural>
</Spanish>
</TEXT>
<TEXT>
<Tag>TXT_KEY_UNIT_RIFLEMAN_STRATEGY</Tag>
<English>Build this moderate-strength gunpowder unit as a counter against mounted enemies like [COLOR_UNIT_TEXT]Cavalry[COLOR_REVERT].</English>
<French>Produisez cette unit&#233; de force moyenne et &#233;quip&#233;e d'une arme &#224; feu pour contrer des unit&#233;s ennemies mont&#233;es, telles que les unit&#233;s de [COLOR_UNIT_TEXT]cavalerie[COLOR_REVERT].</French>
<German>Bilden Sie diese mittelstarke Schie&#223;pulver-Einheit aus, um berittene Gegner wie die [COLOR_UNIT_TEXT]Kavallerie[COLOR_REVERT] aufzuhalten.</German>
<Italian>Realizza questa unit&#224; con armi da fuoco di forza moderata per contrastare le unit&#224; montate (come la [COLOR_UNIT_TEXT]cavalleria[COLOR_REVERT]).</Italian>
<Spanish>Esta unidad con armas de p&#243;lvora, de fuerza moderada, sirve para contrarrestar las unidades montadas del enemigo, como la [COLOR_UNIT_TEXT]Caballer&#237;a[COLOR_REVERT]).</Spanish>
</TEXT>
</Civ4GameText>
2 changes: 1 addition & 1 deletion Warlords/CvGameCoreDLL/CvCity.cpp
Expand Up @@ -4300,7 +4300,7 @@ int CvCity::getHurryCost(bool bExtra, BuildingTypes eBuilding, bool bIgnoreNew)

int CvCity::getHurryCost(bool bExtra, int iProductionLeft, int iHurryModifier, int iModifier) const
{
int iProduction = (iProductionLeft * iHurryModifier) / 100;
int iProduction = (iProductionLeft * iHurryModifier + 99) / 100; // round up

if (bExtra)
{
Expand Down
2 changes: 1 addition & 1 deletion Warlords/CvGameCoreDLL/CvDLLButtonPopup.cpp
Expand Up @@ -584,7 +584,7 @@ void CvDLLButtonPopup::OnOkClicked(CvPopup* pPopup, PopupReturn *pPopupReturn, C
else if (pPopupReturn->getButtonClicked() == 1)
{
// exit to main menu
if (GC.getGameINLINE().isNetworkMultiPlayer() && GC.getGameINLINE().canDoControl(CONTROL_RETIRE))
if (GC.getGameINLINE().isNetworkMultiPlayer() && GC.getGameINLINE().canDoControl(CONTROL_RETIRE) && GC.getGameINLINE().countHumanPlayersAlive() > 1)
{
GC.getGameINLINE().doControl(CONTROL_RETIRE);
}
Expand Down
76 changes: 70 additions & 6 deletions Warlords/CvGameCoreDLL/CvGame.cpp
Expand Up @@ -6686,23 +6686,87 @@ void CvGame::createBarbarianUnits()

for (iJ = 0; iJ < GC.getNumUnitClassInfos(); iJ++)
{
bool bValid = false;
eLoopUnit = ((UnitTypes)(GC.getCivilizationInfo(GET_PLAYER(BARBARIAN_PLAYER).getCivilizationType()).getCivilizationUnits(iJ)));

if (eLoopUnit != NO_UNIT)
{
if (GC.getUnitInfo(eLoopUnit).getUnitAIType(eBarbUnitAI))
CvUnitInfo& kUnit = GC.getUnitInfo(eLoopUnit);

bValid = (kUnit.getCombat() > 0 && !kUnit.isOnlyDefensive());

if (bValid)
{
if (GET_PLAYER(BARBARIAN_PLAYER).canTrain(eLoopUnit))
if (pLoopArea->isWater() && kUnit.getDomainType() != DOMAIN_SEA)
{
bValid = false;
}
else if (!pLoopArea->isWater() && kUnit.getDomainType() != DOMAIN_LAND)
{
iValue = (1 + getSorenRandNum(1000, "Barb Unit Selection"));
bValid = false;
}
}

if (bValid)
{
if (!GET_PLAYER(BARBARIAN_PLAYER).canTrain(eLoopUnit))
{
bValid = false;
}
}

if (iValue > iBestValue)
if (bValid)
{
if (NO_BONUS != kUnit.getPrereqAndBonus())
{
if (!GET_TEAM(BARBARIAN_TEAM).isHasTech((TechTypes)GC.getBonusInfo((BonusTypes)kUnit.getPrereqAndBonus()).getTechCityTrade()))
{
eBestUnit = eLoopUnit;
iBestValue = iValue;
bValid = false;
}
}
}

if (bValid)
{
bool bFound = false;
bool bRequires = false;
for (int i = 0; i < GC.getNUM_UNIT_PREREQ_OR_BONUSES(); ++i)
{
TechTypes eTech = (TechTypes)kUnit.getPrereqOrBonuses(i);

if (NO_TECH != eTech)
{
bRequires = true;

if (GET_TEAM(BARBARIAN_TEAM).isHasTech(eTech))
{
bFound = true;
break;
}
}
}

if (bRequires && !bFound)
{
bValid = false;
}
}

if (bValid)
{
iValue = (1 + getSorenRandNum(1000, "Barb Unit Selection"));

if (kUnit.getUnitAIType(eBarbUnitAI))
{
iValue += 200;
}

if (iValue > iBestValue)
{
eBestUnit = eLoopUnit;
iBestValue = iValue;
}
}
}
}

Expand Down
52 changes: 26 additions & 26 deletions Warlords/CvGameCoreDLL/CvGameTextMgr.cpp
Expand Up @@ -1208,19 +1208,19 @@ bool CvGameTextMgr::setCombatPlotHelp(CvWString &szString, CvPlot* pPlot)
if (pAttacker->getDomainType() != DOMAIN_AIR)
{
int iCombatOdds = getCombatOdds(pAttacker, pDefender);
if (iCombatOdds > 999)
{
if (iCombatOdds > 999)
{
szTempBuffer = "&gt; 99.9";
}
else if (iCombatOdds < 1)
{
}
else if (iCombatOdds < 1)
{
szTempBuffer = "&lt; 0.1";
}
else
{
szTempBuffer.Format(L"%.1f", ((float)iCombatOdds) / 10.0f);
}
szString += gDLL->getText("TXT_KEY_COMBAT_PLOT_ODDS", szTempBuffer.GetCString());
}
else
{
szTempBuffer.Format(L"%.1f", ((float)iCombatOdds) / 10.0f);
}
szString += gDLL->getText("TXT_KEY_COMBAT_PLOT_ODDS", szTempBuffer.GetCString());

if (pAttacker->withdrawalProbability() > 0)
{
Expand Down Expand Up @@ -1273,7 +1273,7 @@ bool CvGameTextMgr::setCombatPlotHelp(CvWString &szString, CvPlot* pPlot)
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_MOD_VS_TYPE", iModifier, GC.getDomainInfo(pDefender->getDomainType()).getTextKeyWide());
}

if (pPlot->isCity(true))
if (pPlot->isCity(true, pDefender->getTeam()))
{
iModifier = pAttacker->cityAttackModifier();

Expand Down Expand Up @@ -1430,7 +1430,7 @@ bool CvGameTextMgr::setCombatPlotHelp(CvWString &szString, CvPlot* pPlot)
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_FORTIFY_MOD", iModifier);
}

if (pPlot->isCity(true))
if (pPlot->isCity(true, pDefender->getTeam()))
{
iModifier = pDefender->cityDefenseModifier();

Expand Down Expand Up @@ -3811,7 +3811,7 @@ void CvGameTextMgr::setBasicUnitHelp(CvWString &szBuffer, UnitTypes eUnit, bool
if (GC.getUnitInfo(eUnit).getTerrainImpassable(iI))
{
CvWString szTerrain;
szTerrain.Format(L"<link=literal>%s</link>", GC.getTerrainInfo((TerrainTypes)iI).getDescription());
szTerrain.Format(L"<link=literal>%s</link>", GC.getTerrainInfo((TerrainTypes)iI).getDescription());
setListHelp(szBuffer, szTempBuffer, szTerrain, L", ", bFirst);
bFirst = false;
}
Expand All @@ -3822,7 +3822,7 @@ void CvGameTextMgr::setBasicUnitHelp(CvWString &szBuffer, UnitTypes eUnit, bool
if (GC.getUnitInfo(eUnit).getFeatureImpassable(iI))
{
CvWString szFeature;
szFeature.Format(L"<link=literal>%s</link>", GC.getFeatureInfo((FeatureTypes)iI).getDescription());
szFeature.Format(L"<link=literal>%s</link>", GC.getFeatureInfo((FeatureTypes)iI).getDescription());
setListHelp(szBuffer, szTempBuffer, szFeature, L", ", bFirst);
bFirst = false;
}
Expand Down Expand Up @@ -4867,8 +4867,8 @@ void CvGameTextMgr::setBuildingHelp(CvWString &szBuffer, BuildingTypes eBuilding

if (GC.getBuildingInfo(eBuilding).getAnarchyModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_ANARCHY_MOD", GC.getBuildingInfo(eBuilding).getAnarchyModifier());
}
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_ANARCHY_MOD", GC.getBuildingInfo(eBuilding).getAnarchyModifier());
}

if (GC.getBuildingInfo(eBuilding).getGlobalHurryModifier() != 0)
{
Expand Down Expand Up @@ -5741,15 +5741,15 @@ void CvGameTextMgr::setProjectHelp(CvWString &szBuffer, ProjectTypes eProject, b
{
if (GC.getUnitInfo((UnitTypes)iI).getSpecialUnitType() == GC.getProjectInfo(eProject).getEveryoneSpecialUnit())
{
if (GC.getUnitInfo((UnitTypes)iI).getNukeRange() != -1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_NO_NUKES");
}
if (GC.getUnitInfo((UnitTypes)iI).getNukeRange() != -1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_NO_NUKES");
}
}
}
}
}
}

if (GC.getProjectInfo(eProject).getAnyoneProjectPrereq() != NO_PROJECT)
{
Expand Down Expand Up @@ -8528,34 +8528,34 @@ void CvGameTextMgr::setCommerceHelp(CvWString &szBuffer, CvCity& city, CommerceT
if (0 != iSpecialistCommerce)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_SPECIALIST_COMMERCE", iSpecialistCommerce, info.getChar(), L"TXT_KEY_CONCEPT_SPECIALISTS") + NEWLINE;
iBaseCommerceRate += 100*iSpecialistCommerce;
iBaseCommerceRate += 100 * iSpecialistCommerce;
}

int iReligionCommerce = city.getReligionCommerce(eCommerceType);
if (0 != iReligionCommerce)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_RELIGION_COMMERCE", iReligionCommerce, info.getChar()) + NEWLINE;
iBaseCommerceRate += 100*iReligionCommerce;
iBaseCommerceRate += 100 * iReligionCommerce;
}

int iBuildingCommerce = city.getBuildingCommerce(eCommerceType);
if (0 != iBuildingCommerce)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_BUILDING_COMMERCE", iBuildingCommerce, info.getChar()) + NEWLINE;
iBaseCommerceRate += 100*iBuildingCommerce;
iBaseCommerceRate += 100 * iBuildingCommerce;
}

int iFreeCityCommerce = owner.getFreeCityCommerce(eCommerceType);
if (0 != iFreeCityCommerce)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_FREE_CITY_COMMERCE", iFreeCityCommerce, info.getChar()) + NEWLINE;
iBaseCommerceRate += 100*iFreeCityCommerce;
iBaseCommerceRate += 100 * iFreeCityCommerce;
}


FAssertMsg(city.getBaseCommerceRateTimes100(eCommerceType) == iBaseCommerceRate, "Base Commerce rate does not agree with actual value");
//szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_COMMERCE_BASE", info.getTextKeyWide(), iBaseYield, info.getChar()) + NEWLINE;

int iModifier = 100;

// Buildings
Expand Down
28 changes: 20 additions & 8 deletions Warlords/CvGameCoreDLL/CvPlayer.cpp
Expand Up @@ -1549,12 +1549,10 @@ void CvPlayer::acquireCity(CvCity* pOldCity, bool bConquest, bool bTrade)

if (bProduction)
{
if (!(pNewCity->isOccupation()))
if (isHuman())
{
if (isHuman())
{
pNewCity->chooseProduction();
}
pNewCity->chooseProduction();
gDLL->getEventReporterIFace()->cityAcquiredAndKept(GC.getGameINLINE().getActivePlayer(), pNewCity);
}
}
}
Expand Down Expand Up @@ -2287,7 +2285,7 @@ void CvPlayer::doTurn()

updateWarWearinessPercentAnger();

updateEconomyHistory(GC.getGameINLINE().getGameTurn(), calculateTotalYield(YIELD_COMMERCE) - calculateInflatedCosts());
updateEconomyHistory(GC.getGameINLINE().getGameTurn(), calculateTotalCommerce());
updateIndustryHistory(GC.getGameINLINE().getGameTurn(), calculateTotalYield(YIELD_PRODUCTION));
updateAgricultureHistory(GC.getGameINLINE().getGameTurn(), calculateTotalYield(YIELD_FOOD));
updatePowerHistory(GC.getGameINLINE().getGameTurn(), getPower());
Expand Down Expand Up @@ -5152,7 +5150,7 @@ int CvPlayer::getBuildingClassPrereqBuilding(BuildingTypes eBuilding, BuildingCl

if (!isLimitedWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())))
{
return (iPrereqs * (getBuildingClassCount((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())) + iExtra + 1));
iPrereqs *= (getBuildingClassCount((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())) + iExtra + 1);
}

if (GC.getGameINLINE().isOption(GAMEOPTION_ONE_CITY_CHALLENGE) && isHuman())
Expand Down Expand Up @@ -5767,6 +5765,20 @@ int CvPlayer::calculateResearchRate(TechTypes eTech)
return iRate;
}

int CvPlayer::calculateTotalCommerce()
{
int iTotalCommerce = calculateBaseNetGold() + calculateBaseNetResearch();

for (int i = 0; i < NUM_COMMERCE_TYPES; ++i)
{
if (COMMERCE_GOLD != i && COMMERCE_RESEARCH != i)
{
iTotalCommerce += getCommerceRate((CommerceTypes)i);
}
}

return iTotalCommerce;
}

bool CvPlayer::isResearch()
{
Expand Down Expand Up @@ -11889,7 +11901,7 @@ void CvPlayer::read(FDataStreamBase* pStream)
}

{
m_mapAgricultureHistory.clear();
m_mapCultureHistory.clear();
uint iSize;
pStream->Read(&iSize);
for (uint i = 0; i < iSize; i++)
Expand Down
1 change: 1 addition & 0 deletions Warlords/CvGameCoreDLL/CvPlayer.h
Expand Up @@ -199,6 +199,7 @@ class CvPlayer
int calculateResearchModifier(TechTypes eTech); // Exposed to Python
int calculateGoldRate(); // Exposed to Python
int calculateResearchRate(TechTypes eTech = NO_TECH); // Exposed to Python
int calculateTotalCommerce();

bool isResearch(); // Exposed to Python
DllExport bool canEverResearch(TechTypes eTech); // Exposed to Python
Expand Down

0 comments on commit 6634cc8

Please sign in to comment.