[DLL] So... Would this work

Genghis.Khan

Person
Joined
Jun 9, 2012
Messages
934
Location
Somewhere
Ok, I found in CvBeliefClasses.cp this code

Code:
m_piYieldChangeTradeRoute(NULL)

For My Mod I wanted to add this very same table to Technologies, so I can with .xml have the same effect of this belief upon researching a Technology.

My .xml code

Code:
<Technology_YieldChangeTradeRoute>
		<Row>
			<TechType>TECH_ALPHABET</TechType>
			<YieldType>YIELD_SCIENCE</YieldType>
			<Yield>2</Yield>
		</Row>
	</Technology_YieldChangeTradeRoute>

So If I just copy

Code:
m_piYieldChangeTradeRoute(NULL)
to CvTechClasses.cpp

Would it work?
 
I would need to add this too...

Code:
int [COLOR="Red"]CvBeliefEntry[/COLOR]::GetYieldChangeTradeRoute(int i) const
{
	CvAssertMsg(i < NUM_YIELD_TYPES, "Index out of bounds");
	CvAssertMsg(i > -1, "Index out of bounds");
	return m_piYieldChangeTradeRoute ? m_piYieldChangeTradeRoute[i] : -1;
}

And Change the Higlighted to CvTechEntry?

I know nothing about C++ Programming. Sorry for being stupid and lazy :blush:
 
And the Highlighted too

Code:
[COLOR="Red"]bool CvBeliefEntry::CacheResults(Database::Results& kResults, CvDatabaseUtility& kUtility)
{
	if(!CvBaseInfo::CacheResults(kResults, kUtility))
		return false;
[/COLOR]
	//Basic Properties
	[COLOR="red"]setShortDescription(kResults.GetText("ShortDescription"));[COLOR="red"][/COLOR]

	const char* szBeliefType = GetType();
	kUtility.SetYields(m_piYieldChangeTradeRoute, "Belief_YieldChangeTradeRoute", "BeliefType", szBeliefType);[/COLOR]
 
And this

Code:
int CvReligionBeliefs::GetYieldChangeTradeRoute(YieldTypes eYieldType) const
{
	CvBeliefXMLEntries* pBeliefs = GC.GetGameBeliefs();
	int rtnValue = 0;

	for(int i = 0; i < pBeliefs->GetNumBeliefs(); i++)
	{
		if(HasBelief((BeliefTypes)i))
		{
			rtnValue += pBeliefs->GetEntry(i)->GetYieldChangeTradeRoute(eYieldType);
		}
	}

	return rtnValue;
}
 
The first change will add a member variable to the class, the second would give you a accessor for it.

But you've added/changed nothing to actually USE it

Edit: And now you're just posting chunks of random code!
 
The first change will add a member variable to the class, the second would give you a accessor for it.

But you've added/changed nothing to actually USE it

Edit: And now you're just posting chunks of random code!

Ok, whoward, probably I'm the most annoying guy you ever met.

Still how can I add something to use

Really sorry about bothering with my questions for the 1000th time
 
I am in a similar process learning how to get new XML attributes in C++ and also how functions are exposed to LUA.

Take a look at this, it is for CivIV, but I think nearly all of it applies to CivV, at least the code is nearly identical.

http://forums.civfanatics.com/showthread.php?t=166935
 
Ok, whoward, probably I'm the most annoying guy you ever met.

Still how can I add something to use

Really sorry about bothering with my questions for the 100000000000th time :blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush::blush:

Oh look, a "steering wheel" - if I stick one on the passenger's side dash can they steer as well? Oh look, a spark plug, if I add it to my bicycle can I stop peddling?

Step one. Learn to drive, ie learn enough C++ so that you know what you are looking at, know what questions to ask, but more importantly, stand a fair chance of being able to understand the anwers!

Fair enough that you don't know C++ programming, but at least make the effort to learn it. Don't expect reasonable answers if, by your own admission, you are "being stupid and lazy" and just seem to be chucking stuff around in the hope that you will hit something useful!
 
So, my .h file (Highligted Changes)

Code:
/*	-------------------------------------------------------------------------------------------------------
	© 1991-2012 Take-Two Interactive Software and its subsidiaries.  Developed by Firaxis Games.  
	Sid Meier's Civilization V, Civ, Civilization, 2K Games, Firaxis Games, Take-Two Interactive Software 
	and their respective logos are all trademarks of Take-Two interactive Software, Inc.  
	All other marks and trademarks are the property of their respective owners.  
	All rights reserved. 
	------------------------------------------------------------------------------------------------------- */
#pragma once

#ifndef CIV5_TECH_CLASSES_H
#define CIV5_TECH_CLASSES_H

// Forward definitions
class CvTeam;
class CvTechAI;

#include "CvInfos.h"

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//  CLASS:      CvTechEntry
//!  \brief		A single entry in the tech tree
//
//!  Key Attributes:
//!  - Used to be called CvTechInfo
//!  - Populated from XML\Technologies\CIV5TechInfos.xml
//!  - Array of these contained in CvTechXMLEntries class
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class CvTechEntry: public CvBaseInfo
{
public:
	CvTechEntry(void);
	~CvTechEntry(void);

	virtual bool CacheResults(Database::Results& kResults, CvDatabaseUtility& kUtility);

	// Accessor Functions (Non-Arrays)
	int GetAIWeight() const;
	int GetAITradeModifier() const;
	int GetResearchCost() const;
	int GetAdvancedStartCost() const;
	int GetEra() const;
	int GetFeatureProductionModifier() const;
	int GetUnitFortificationModifier() const;
	int GetUnitBaseHealModifier() const;
	int GetWorkerSpeedModifier() const;
	int GetFirstFreeUnitClass() const;
	int GetFirstFreeTechs() const;
	int GetEmbarkedMoveChange() const;
       [COLOR="Red"]int YieldChangeTradeRoute() const;[/COLOR]

	int GetGridX() const;
	int GetGridY() const;

	bool IsEndsGame() const;
	bool IsAllowsEmbarking() const;
	bool IsAllowsDefensiveEmbarking() const;
	bool IsEmbarkedAllWaterPassage() const;
	bool IsAllowsBarbarianBoats() const;
	bool IsRepeat() const;
	bool IsTrade() const;
	bool IsDisable() const;
	bool IsGoodyTech() const;
	bool IsExtraWaterSeeFrom() const;
	bool IsMapCentering() const;
	bool IsMapVisible() const;
	bool IsMapTrading() const;
	bool IsTechTrading() const;
	bool IsGoldTrading() const;
	bool IsAllowEmbassyTradingAllowed() const;
	bool IsOpenBordersTradingAllowed() const;
	bool IsDefensivePactTradingAllowed() const;
	bool IsResearchAgreementTradingAllowed() const;
	bool IsTradeAgreementTradingAllowed() const;
	bool IsPermanentAllianceTrading() const;
	bool IsBridgeBuilding() const;
	bool IsWaterWork() const;
	int IsFreePromotion(int i) const;

	std::string pyGetQuote()
	{
		return GetQuote();
	}
	const char* GetQuote();
	void SetQuoteKey(const char* szVal);
	const char* GetSound() const;
	void SetSound(const char* szVal);
	const char* GetSoundMP() const;
	void SetSoundMP(const char* szVal);

	// Accessor Functions (Arrays)
	int GetDomainExtraMoves(int i) const;
	int GetFlavorValue(int i) const;
	int GetPrereqOrTechs(int i) const;
	int GetPrereqAndTechs(int i) const;

private:
	int m_iAIWeight;
	int m_iAITradeModifier;
	int m_iResearchCost;
	int m_iAdvancedStartCost;
	int m_iEra;
	int m_iFeatureProductionModifier;
	int m_iUnitFortificationModifier;
	int m_iUnitBaseHealModifier;
	int m_iWorkerSpeedModifier;
	int m_iFirstFreeUnitClass;
	int m_iFirstFreeTechs;
	int m_iEmbarkedMoveChange;

	int m_iGridX;
	int m_iGridY;

	bool m_bEndsGame;
	bool m_bAllowsEmbarking;
	bool m_bAllowsDefensiveEmbarking;
	bool m_bEmbarkedAllWaterPassage;
	bool m_bAllowsBarbarianBoats;
	bool m_bRepeat;
	bool m_bTrade;
	bool m_bDisable;
	bool m_bGoodyTech;
	bool m_bExtraWaterSeeFrom;
	bool m_bMapCentering;
	bool m_bMapVisible;
	bool m_bMapTrading;
	bool m_bTechTrading;
	bool m_bGoldTrading;
	bool m_bAllowEmbassyTradingAllowed;
	bool m_bOpenBordersTradingAllowed;
	bool m_bDefensivePactTradingAllowed;
	bool m_bResearchAgreementTradingAllowed;
	bool m_bTradeAgreementTradingAllowed;
	bool m_bPermanentAllianceTrading;
	bool m_bBridgeBuilding;
	bool m_bWaterWork;

	CvString m_strQuoteKey;
	CvString m_wstrQuote;
	CvString m_strSound;
	CvString m_strSoundMP;

	// Arrays
	int* m_piDomainExtraMoves;
	int* m_piFlavorValue;
	int* m_piPrereqOrTechs;
	int* m_piPrereqAndTechs;
  [COLOR="red"]int* m_piYieldChangeTradeRoute;[/COLOR]
	bool* m_pabFreePromotion;
};

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//  CLASS:      CvTechXMLEntries
//!  \brief		Game-wide information about the tech tree
//
//! Key Attributes:
//! - Plan is it will be contained in CvGameRules object within CvGame class
//! - Populated from XML\Technologies\CIV5TechInfos.xml
//! - Contains an array of CvTechEntry from the above XML file
//! - One instance for the entire game
//! - Accessed heavily by CvPlayerTechs class (which stores the tech state for 1 player)
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class CvTechXMLEntries
{
public:
	CvTechXMLEntries(void);
	~CvTechXMLEntries(void);

	// Accessor functions
	std::vector<CvTechEntry*>& GetTechEntries();
	int GetNumTechs();
	_Ret_maybenull_ CvTechEntry* GetEntry(int index);

	void DeleteArray();

private:
	std::vector<CvTechEntry*> m_paTechEntries;
};

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//  CLASS:      CvPlayerTechs
//!  \brief		Information about the technologies being researched by a single player
//
//!  Key Attributes:
//!  - Plan is it will be contained in CvPlayerState object within CvPlayer class
//!  - One instance for each civ (player or AI)
//!  - Accessed by any class that needs to check technology research state
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class CvPlayerTechs: public CvFlavorRecipient
{
public:
	CvPlayerTechs(void);
	~CvPlayerTechs(void);
	void Init(CvTechXMLEntries* pTechs, CvPlayer* pPlayer, bool bIsCity);
	void Uninit();
	void Reset();
	void Read(FDataStream& kStream);
	void Write(FDataStream& kStream);

	// Flavor recipient required function
	void FlavorUpdate();

	CvPlayer* GetPlayer();
	CvTechAI* GetTechAI();

	// Accessor functions
	void SetResearchingTech(TechTypes eIndex, bool bNewValue);
	bool IsResearchingTech(TechTypes eIndex) const;
	void SetCivTechPriority(TechTypes eIndex, int iNewValue);
	int GetCivTechPriority(TechTypes eIndex) const;
	void SetLocaleTechPriority(TechTypes eIndex, int iNewValue);
	int GetLocaleTechPriority(TechTypes eIndex) const;
	ResourceTypes GetLocaleTechResource(TechTypes eIndex) const;
	UnitTypes GetCivTechUniqueUnit(TechTypes eIndex) const;
	BuildingTypes GetCivTechUniqueBuilding(TechTypes eIndex) const;
	ImprovementTypes GetCivTechUniqueImprovement(TechTypes eIndex) const;
	void SetLocalePriorities();
	bool IsResearch() const;
	bool CanEverResearch(TechTypes eTech) const;
	bool CanResearch(TechTypes eTech, bool bTrade = false) const;
	bool CanResearchForFree(TechTypes eTech) const;
	TechTypes GetCurrentResearch() const;
	bool IsCurrentResearchRepeat() const;
	bool IsNoResearchAvailable() const;
	void CheckForTechAchievement() const;
	int GetResearchTurnsLeft(TechTypes eTech, bool bOverflow) const;
	int GetResearchTurnsLeftTimes100(TechTypes eTech, bool bOverflow) const;
	int GetNumTechsCanBeResearched() const;
	CvTechXMLEntries* GetTechs() const;
	int GetResearchCost(TechTypes eTech) const;
	int GetResearchProgress(TechTypes eTech) const;
	int GetMedianTechResearch() const;

private:
	void AddFlavorAsStrategies(int iPropagatePercent);

	// Logging functions
	void LogFlavors(FlavorTypes eFlavor = NO_FLAVOR);

	bool* m_pabResearchingTech;
	int* m_piCivTechPriority;
	int* m_piLocaleTechPriority;
	ResourceTypes* m_peLocaleTechResources;
	UnitTypes* m_peCivTechUniqueUnits;
	BuildingTypes* m_peCivTechUniqueBuildings;
	ImprovementTypes* m_peCivTechUniqueImprovements;
	CvTechXMLEntries* m_pTechs;
	CvPlayer* m_pPlayer;
	CvTechAI* m_pTechAI;
};

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//  CLASS:      CvTeamTechs
//!  \brief		Information about the technologies owned by a team of players
//
//!  Key Attributes:
//!  - Plan is it will be contained in CvTeamState object within CvTeam class
//!  - One instance for each team of civs
//!  - Accessed by any class that needs to check technology ownership
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class CvTeamTechs
{
public:
	CvTeamTechs(void);
	~CvTeamTechs(void);
	void Init(CvTechXMLEntries* pTechs, CvTeam* pTeam);
	void Uninit();
	void Reset();
	void Read(FDataStream& kStream);
	void Write(FDataStream& kStream);

	// Accessor functions
	void SetHasTech(TechTypes eIndex, bool bNewValue);
	bool HasTech(TechTypes eIndex) const;

	TechTypes GetLastTechAcquired() const;
	void SetLastTechAcquired(TechTypes eTech);

	int GetNumTechsKnown() const;
	bool HasResearchedAllTechs() const;

	void SetNoTradeTech(TechTypes eIndex, bool bNewValue);
	bool IsNoTradeTech(TechTypes eIndex) const;
	void IncrementTechCount(TechTypes eIndex);
	int GetTechCount(TechTypes eIndex) const;
	void SetResearchProgress(TechTypes eIndex, int iNewValue, PlayerTypes ePlayer);
	void SetResearchProgressTimes100(TechTypes eIndex, int iNewValue, PlayerTypes ePlayer);
	int GetResearchProgress(TechTypes eIndex) const;
	int GetResearchProgressTimes100(TechTypes eIndex) const;
	void ChangeResearchProgress(TechTypes eIndex, int iChange, PlayerTypes ePlayer);
	void ChangeResearchProgressTimes100(TechTypes eIndex, int iChange, PlayerTypes ePlayer);
	int ChangeResearchProgressPercent(TechTypes eIndex, int iPercent, PlayerTypes ePlayer);
	int GetResearchCost(TechTypes eTech) const;
	int GetResearchLeft(TechTypes eTech) const;
	CvTechXMLEntries* GetTechs() const;

private:
	TechTypes m_eLastTechAcquired;

	bool* m_pabHasTech;
	bool* m_pabNoTradeTech;
	int* m_paiResearchProgress;  // Stored in hundredths
	int* m_paiTechCount;
	CvTechXMLEntries* m_pTechs;
	CvTeam* m_pTeam;
};

#endif //CIV5_TECH_CLASSES_H
 
And the .cpp one (only untill finish changes)

Do this work? For some reason I can not install VS 2008 and therefore compile the dll

Code:
/*	-------------------------------------------------------------------------------------------------------
	© 1991-2012 Take-Two Interactive Software and its subsidiaries.  Developed by Firaxis Games.  
	Sid Meier's Civilization V, Civ, Civilization, 2K Games, Firaxis Games, Take-Two Interactive Software 
	and their respective logos are all trademarks of Take-Two interactive Software, Inc.  
	All other marks and trademarks are the property of their respective owners.  
	All rights reserved. 
	------------------------------------------------------------------------------------------------------- */
#include "CvGameCoreDLLPCH.h"
#include "CvGameCoreDLLUtil.h"
#include "CvTechAI.h"
#include "CvFlavorManager.h"
#include "ICvDLLUserInterface.h"
#include "CvGameCoreUtils.h"
#include "CvCitySpecializationAI.h"
#include "CvGrandStrategyAI.h"
#include "CvInfosSerializationHelper.h"

#include "LintFree.h"

/// Constructor
CvTechEntry::CvTechEntry(void):
	m_iAIWeight(0),
	m_iAITradeModifier(0),
	m_iResearchCost(0),
	m_iAdvancedStartCost(0),
	m_iEra(NO_ERA),
	m_iFeatureProductionModifier(0),
	m_iUnitFortificationModifier(0),
	m_iUnitBaseHealModifier(0),
	m_iWorkerSpeedModifier(0),
	m_iFirstFreeUnitClass(NO_UNITCLASS),
	m_iFirstFreeTechs(0),  
	m_iEmbarkedMoveChange(0),
	m_iGridX(0),
	m_iGridY(0),
	m_bEndsGame(false),
	m_bAllowsEmbarking(false),
	m_bAllowsDefensiveEmbarking(false),
	m_bEmbarkedAllWaterPassage(false),
	m_bAllowsBarbarianBoats(false),
	m_bRepeat(false),
	m_bTrade(false),
	m_bDisable(false),
	m_bGoodyTech(false),
	m_bExtraWaterSeeFrom(false),
	m_bMapCentering(false),
	m_bMapVisible(false),
	m_bMapTrading(false),
	m_bTechTrading(false),
	m_bGoldTrading(false),
	m_bAllowEmbassyTradingAllowed(false),
	m_bOpenBordersTradingAllowed(false),
	m_bDefensivePactTradingAllowed(false),
	m_bResearchAgreementTradingAllowed(false),
	m_bTradeAgreementTradingAllowed(false),
	m_bPermanentAllianceTrading(false),
	m_bBridgeBuilding(false),
	m_bWaterWork(false),
	m_piDomainExtraMoves(NULL),
	m_piFlavorValue(NULL),
             [COLOR='RED'] m_piYieldChangeTradeRoute(NULL)[/COLOR]
	m_piPrereqOrTechs(NULL),
	m_piPrereqAndTechs(NULL),
	m_pabFreePromotion(NULL)
{
}

/// Destructor
CvTechEntry::~CvTechEntry(void)
{
	SAFE_DELETE_ARRAY(m_piDomainExtraMoves);
	SAFE_DELETE_ARRAY(m_piFlavorValue);
	SAFE_DELETE_ARRAY(m_piPrereqOrTechs);
	SAFE_DELETE_ARRAY(m_piPrereqAndTechs);
	SAFE_DELETE_ARRAY(m_pabFreePromotion);
}

bool CvTechEntry::CacheResults(Database::Results& kResults, CvDatabaseUtility& kUtility)
{
	if(!CvBaseInfo::CacheResults(kResults, kUtility))
		return false;

	//Basic Properties
	m_iAIWeight = kResults.GetInt("AIWeight");
	m_iAITradeModifier = kResults.GetInt("AITradeModifier");
	m_iResearchCost = kResults.GetInt("Cost");
	m_iAdvancedStartCost = kResults.GetInt("AdvancedStartCost");
	m_iFeatureProductionModifier = kResults.GetInt("FeatureProductionModifier");
	m_iUnitFortificationModifier = kResults.GetInt("UnitFortificationModifier");
	m_iUnitBaseHealModifier = kResults.GetInt("UnitBaseHealModifier");
	m_iWorkerSpeedModifier = kResults.GetInt("WorkerSpeedModifier");
	m_iFirstFreeTechs = kResults.GetInt("FirstFreeTechs");
	m_iEmbarkedMoveChange = kResults.GetInt("EmbarkedMoveChange");
	m_bEndsGame = kResults.GetBool("EndsGame");
	m_bAllowsEmbarking = kResults.GetBool("AllowsEmbarking");
	m_bAllowsDefensiveEmbarking = kResults.GetBool("AllowsDefensiveEmbarking");
	m_bEmbarkedAllWaterPassage = kResults.GetBool("EmbarkedAllWaterPassage");
	m_bAllowsBarbarianBoats = kResults.GetBool("AllowsBarbarianBoats");
	m_bRepeat = kResults.GetBool("Repeat");
	m_bTrade = kResults.GetBool("Trade");
	m_bDisable = kResults.GetBool("Disable");
	m_bGoodyTech = kResults.GetBool("GoodyTech");
	m_bExtraWaterSeeFrom = kResults.GetBool("ExtraWaterSeeFrom");
	m_bMapCentering = kResults.GetBool("MapCentering");
	m_bMapVisible = kResults.GetBool("MapVisible");
	m_bMapTrading = kResults.GetBool("MapTrading");
	m_bTechTrading = kResults.GetBool("TechTrading");
	m_bGoldTrading = kResults.GetBool("GoldTrading");
	m_bAllowEmbassyTradingAllowed = kResults.GetBool("AllowEmbassyTradingAllowed");
	m_bOpenBordersTradingAllowed = kResults.GetBool("OpenBordersTradingAllowed");
	m_bDefensivePactTradingAllowed = kResults.GetBool("DefensivePactTradingAllowed");
	m_bResearchAgreementTradingAllowed = kResults.GetBool("ResearchAgreementTradingAllowed");
	m_bTradeAgreementTradingAllowed = kResults.GetBool("TradeAgreementTradingAllowed");
	m_bPermanentAllianceTrading = kResults.GetBool("PermanentAllianceTradingAllowed");
	m_bBridgeBuilding = kResults.GetBool("BridgeBuilding");
	m_bWaterWork = kResults.GetBool("WaterWork");
	m_iGridX = kResults.GetInt("GridX");
	m_iGridY = kResults.GetInt("GridY");

	//References
	const char* szTextVal = NULL;
	szTextVal = kResults.GetText("Era");
	m_iEra = GC.getInfoTypeForString(szTextVal, true);

	szTextVal = kResults.GetText("FirstFreeUnitClass");
	m_iFirstFreeUnitClass = GC.getInfoTypeForString(szTextVal, true);

	szTextVal = kResults.GetText("Quote");
	SetQuoteKey(szTextVal);

	szTextVal = kResults.GetText("AudioIntro");
	SetSound(szTextVal);

	szTextVal = kResults.GetText("AudioIntroHeader");
	SetSoundMP(szTextVal);

	//Arrays
	const char* szTechType = GetType();
	kUtility.PopulateArrayByValue(m_piDomainExtraMoves, "Domains", "Technology_DomainExtraMoves", "DomainType", "TechType", szTechType, "Moves", 0, NUM_DOMAIN_TYPES);
	kUtility.PopulateArrayByExistence(m_pabFreePromotion, "UnitPromotions", "Technology_FreePromotions", "PromotionType", "TechType", szTechType);
	kUtility.SetFlavors(m_piFlavorValue, "Technology_Flavors", "TechType", szTechType);

	const size_t TechnologiesCount = kUtility.MaxRows("Technologies");

	//ORPrereqTechs
	{
		//PrereqTech array must be initialized to NO_TECH.

		kUtility.InitializeArray(m_piPrereqOrTechs, TechnologiesCount, NO_TECH);

		std::string strKey = "Technologies - Technology_ORPrereqTechs";
		Database::Results* pResults = kUtility.GetResults(strKey);
		if(pResults == NULL)
		{
			pResults = kUtility.PrepareResults(strKey, "select Technologies.ID from Technology_ORPrereqTechs inner join Technologies on Technologies.Type = PrereqTech where TechType = ?;");
		}

		pResults->Bind(1, szTechType, -1, false);

		int i = 0;
		while(pResults->Step())
		{
			m_piPrereqOrTechs[i++] = pResults->GetInt(0);
		}

		pResults->Reset();
	}

	//PrereqTechs
	{
		//PrereqTech array must be initialized to NO_TECH.
		kUtility.InitializeArray(m_piPrereqAndTechs, TechnologiesCount, NO_TECH);

		std::string strKey = "Technologies - Technology_PrereqTechs";
		Database::Results* pResults = kUtility.GetResults(strKey);
		if(pResults == NULL)
		{
			pResults = kUtility.PrepareResults(strKey, "select Technologies.ID from Technology_PrereqTechs inner join Technologies on Technologies.Type = PrereqTech where TechType = ?;");
		}

		pResults->Bind(1, szTechType, -1, false);

		int i = 0;
		while(pResults->Step())
		{
			m_piPrereqAndTechs[i++] = pResults->GetInt(0);
		}

		pResults->Reset();
	}

	return true;
}

/// Additional weight to having AI purchase this
int CvTechEntry::GetAIWeight() const
{
	return m_iAIWeight;
}

/// Additional weight to having AI trade for this
int CvTechEntry::GetAITradeModifier() const
{
	return m_iAITradeModifier;
}

/// Research/science points required to obtain tech
int CvTechEntry::GetResearchCost() const
{
	return m_iResearchCost;
}

/// Cost if starting midway through game
int CvTechEntry::GetAdvancedStartCost() const
{
	return m_iAdvancedStartCost;
}

/// Historical era within tech tree
int CvTechEntry::GetEra() const
{
	return m_iEra;
}

/// Changes builder production
int CvTechEntry::GetFeatureProductionModifier() const
{
	return m_iFeatureProductionModifier;
}

/// Changes combat bonus from fortification
int CvTechEntry::GetUnitFortificationModifier() const
{
	return m_iUnitFortificationModifier;
}

/// Changes base unit healing rate
int CvTechEntry::GetUnitBaseHealModifier() const
{
	return m_iUnitBaseHealModifier;
}

/// Improvement in worker speed
int CvTechEntry::GetWorkerSpeedModifier() const
{
	return m_iWorkerSpeedModifier;
}

/// Free unit if first to discover this tech
int CvTechEntry::GetFirstFreeUnitClass() const
{
	return m_iFirstFreeUnitClass;
}

/// Earn another tech for free if first to discover this one
int CvTechEntry::GetFirstFreeTechs() const
{
	return m_iFirstFreeTechs;
}

/// Number of additional moves provided to land Units embarked on the water
int CvTechEntry::GetEmbarkedMoveChange() const
{
	return m_iEmbarkedMoveChange;
}

/// X location on tech tree page
int CvTechEntry::GetGridX() const
{
	return m_iGridX;
}

/// Y location on tech tree page
int CvTechEntry::GetGridY() const
{
	return m_iGridY;
}

/// Does this Tech end the game?
bool CvTechEntry::IsEndsGame() const
{
	return m_bEndsGame;
}

/// Unlocks the ability to embark land Units onto self-carried boats
bool CvTechEntry::IsAllowsEmbarking() const
{
	return m_bAllowsEmbarking;
}

/// Allows embarked units to defend themselves
bool CvTechEntry::IsAllowsDefensiveEmbarking() const
{
	return m_bAllowsDefensiveEmbarking;
}

/// Allows embarked Units to enter deep ocean
bool CvTechEntry::IsEmbarkedAllWaterPassage() const
{
	return m_bEmbarkedAllWaterPassage;
}

/// Are the Barbarians allowed to have Boats yet?
bool CvTechEntry::IsAllowsBarbarianBoats() const
{
	return m_bAllowsBarbarianBoats;
}

/// Can this be researched repeatedly (future tech)
bool CvTechEntry::IsRepeat() const
{
	return m_bRepeat;
}

/// Is it tradeable?
bool CvTechEntry::IsTrade() const
{
	return m_bTrade;
}

/// Currently disabled (not in game)?
bool CvTechEntry::IsDisable() const
{
	return m_bDisable;
}

/// Can you receive it from a goody hut?
bool CvTechEntry::IsGoodyTech() const
{
	return m_bGoodyTech;
}

/// Expand visibility over water?
bool CvTechEntry::IsExtraWaterSeeFrom() const
{
	return m_bExtraWaterSeeFrom;
}

/// Does it center your mini-map in the overall world?
bool CvTechEntry::IsMapCentering() const
{
	return m_bMapCentering;
}

/// Does this tech reveal the entire map?
bool CvTechEntry::IsMapVisible() const
{
	return m_bMapVisible;
}

/// Does it enable world map trades?
bool CvTechEntry::IsMapTrading() const
{
	return m_bMapTrading;
}

/// Does it enable technology trading?
bool CvTechEntry::IsTechTrading() const
{
	return m_bTechTrading;
}

/// Does it enable gold trading?
bool CvTechEntry::IsGoldTrading() const
{
	return m_bGoldTrading;
}

/// Can you permit allow embassy to be traded?
bool CvTechEntry::IsAllowEmbassyTradingAllowed() const
{
	return m_bAllowEmbassyTradingAllowed;
}

/// Can you permit open borders?
bool CvTechEntry::IsOpenBordersTradingAllowed() const
{
	return m_bOpenBordersTradingAllowed;
}

/// Can you form defensive treaties?
bool CvTechEntry::IsDefensivePactTradingAllowed() const
{
	return m_bDefensivePactTradingAllowed;
}

/// Can you form Research Agreements?
bool CvTechEntry::IsResearchAgreementTradingAllowed() const
{
	return m_bResearchAgreementTradingAllowed;
}

/// Can you form Trade Agreements?
bool CvTechEntry::IsTradeAgreementTradingAllowed() const
{
	return m_bTradeAgreementTradingAllowed;
}

/// Can you form a permanent alliance?
bool CvTechEntry::IsPermanentAllianceTrading() const
{
	return m_bPermanentAllianceTrading;
}

/// Are river crossings treated as bridges?
bool CvTechEntry::IsBridgeBuilding() const
{
	return m_bBridgeBuilding;
}

/// Enable working of water tiles?
bool CvTechEntry::IsWaterWork() const
{
	return m_bWaterWork;
}

/// Grants free promotion?
int CvTechEntry::IsFreePromotion(int i) const
{
	return m_pabFreePromotion ? m_pabFreePromotion[i] : -1;
}
[COLOR='RED']///My New Acessor
int CvTechEntry::GetYieldChangeTradeRoute(int i) const {CvAssertMsg(i < NUM_YIELD_TYPES, "Index out of bounds");
CvAssertMsg(i > -1, "Index out of bounds");return m_piYieldChangeTradeRoute ? m_piYieldChangeTradeRoute[i] : -1;
}[/COLOR]
 
Back
Top Bottom