Seite 161 von 180 ErsteErste ... 61111151157158159160161162163164165171 ... LetzteLetzte
Ergebnis 2.401 bis 2.415 von 2699

Thema: Der SDK-Fragen-Thread

  1. #2401
    Registrierter Benutzer Avatar von Monaldinio
    Registriert seit
    10.11.09
    Ort
    HRO
    Beiträge
    7.650
    Also so einfach wir ich mir das mit dem Button vorgestellt habe für die CvCivicPedia geht das wohl nicht.

    Wenn ich das richtig verstanden habe muss ich im SDK zunächst erst mal eine Funktion definieren/deklarieren die mir überhaupt erst den Zugriff per Python für mein PediaButton (die Civ soll als Voraussetzung bei der Civic gezeigt werden) auf validCivics ermöglicht?

    also ungefähr so.

    CvInfo.cpp


    Code:
    bool CvCivilizationInfo::isValidCivics() const
    {
    	return m_pbValidCivics;
    }
    CvInfo.h

    Code:
    bool isValidCivics() const;				// Exposed to Python


    Ne is klar, ist schon da...

    Und dann müsste das doch so funzen...

    Code:
    for iCiv in range(gc.getNumCivilizationInfos()):
    			civ = gc.getCivilizationInfo(iCiv)
    			if civ.isValidCivics(self.iValidCivics):
    				screen.setImageButton(self.top.getNextWidgetName(), civ.getButton(), self.X_CIV, self.Y_CIV, self.W_CIV, self.H_CIV, WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIV, iCiv, 1)
    Geändert von Monaldinio (05. Oktober 2015 um 10:09 Uhr)
    Conflict on Chiron - Sid Meier's Alpha Centauri vs. Call to Power!

    Neu Version Conflict on Chiron v3.4 BETA - 16.01.16

    Patch1 - 07.04.16

    Die deutschen Sounds und Wunderfilme sind bereits in der MainFile integriert!
    Ihr könnt sofort loslegen.

    Über Feedback würde ich mich freuen...

  2. #2402
    Registrierter Benutzer Avatar von alpha civ
    Registriert seit
    22.07.06
    Beiträge
    16.757
    In CyInfoInterface.cpp musst du folgenden Eintrag ergänzen:

    Code:
    	python::class_<CvCivilizationInfo, python::bases<CvInfoBase> >("CvCivilizationInfo")
    		.def("getDefaultPlayerColor", &CvCivilizationInfo::getDefaultPlayerColor, "int ()")
    		.def("getArtStyleType", &CvCivilizationInfo::getArtStyleType, "int ()")
    		.def("getNumCityNames", &CvCivilizationInfo::getNumCityNames, "int ()")
    		.def("getNumLeaders", &CvCivilizationInfo::getNumLeaders, "int ()")
    
    		.def("getSelectionSoundScriptId", &CvCivilizationInfo::getSelectionSoundScriptId)
    		.def("getActionSoundScriptId", &CvCivilizationInfo::getActionSoundScriptId)
    
    		.def("isAIPlayable", &CvCivilizationInfo::isAIPlayable, "bool ()")
    		.def("isPlayable", &CvCivilizationInfo::isPlayable, "bool ()")
    
    		.def("getShortDescription", &CvCivilizationInfo::pyGetShortDescription, "wstring ()")
    		.def("getShortDescriptionKey", &CvCivilizationInfo::pyGetShortDescriptionKey, "wstring ()")
    		.def("getAdjective", &CvCivilizationInfo::pyGetAdjective, "wstring ()")
    		.def("getFlagTexture", &CvCivilizationInfo::getFlagTexture, "string ()")
    		.def("getArtDefineTag", &CvCivilizationInfo::getArtDefineTag, "string ()")
    		.def("getButton", &CvCivilizationInfo::getButton, "string ()")
    
    		.def("getDerivativeCiv", &CvCivilizationInfo::getDerivativeCiv, "int ()")
    
    		// Arrays
    
    		.def("getCivilizationBuildings", &CvCivilizationInfo::getCivilizationBuildings, "int (int i)")
    		.def("getCivilizationUnits", &CvCivilizationInfo::getCivilizationUnits, "int (int i)")
    		.def("getCivilizationFreeUnitsClass", &CvCivilizationInfo::getCivilizationFreeUnitsClass, "int (int i)")
    		.def("getCivilizationInitialCivics", &CvCivilizationInfo::getCivilizationInitialCivics, "int (int i)")
    
    		.def("isValidCivic", &CvCivilizationInfo::isValidCivic, "bool (int i)")
    
    		.def("isLeaders", &CvCivilizationInfo::isLeaders, "bool (int i)")
    		.def("isCivilizationFreeBuildingClass", &CvCivilizationInfo::isCivilizationFreeBuildingClass, "bool (int i)")
    		.def("isCivilizationFreeTechs", &CvCivilizationInfo::isCivilizationFreeTechs, "bool (int i)")
    		.def("isCivilizationDisableTechs", &CvCivilizationInfo::isCivilizationDisableTechs, "bool (int i)")
    
    		.def("getCityNames", &CvCivilizationInfo::getCityNames, "string (int i)")
    		;

  3. #2403
    Civ4 BASE Coder Avatar von rucivfan
    Registriert seit
    10.07.11
    Ort
    Antarktika
    Beiträge
    19.017
    Zitat Zitat von Monaldinio Beitrag anzeigen
    Also so einfach wir ich mir das mit dem Button vorgestellt habe für die CvCivicPedia geht das wohl nicht.

    Wenn ich das richtig verstanden habe muss ich im SDK zunächst erst mal eine Funktion definieren/deklarieren die mir überhaupt erst den Zugriff per Python für mein PediaButton (die Civ soll als Voraussetzung bei der Civic gezeigt werden) auf validCivics ermöglicht?

    also ungefähr so.

    CvInfo.cpp


    Code:
    bool CvCivilizationInfo::isValidCivics() const
    {
    	return m_pbValidCivics;
    }
    CvInfo.h

    Code:
    bool isValidCivics() const;				// Exposed to Python
    Mona, sieht das wirklich bei dir so aus? Die Abfrage isValidCivics() ist so immer true. Hier wird nicht nach einer Spezifischen Civic gefragt.

  4. #2404
    Registrierter Benutzer Avatar von Monaldinio
    Registriert seit
    10.11.09
    Ort
    HRO
    Beiträge
    7.650
    Ja so sieht das aus! Alphas gedanken warum er das so gemacht hast, kannst du ja im Thread nachlesen.

    Kurzform

    Zitat Zitat von alpha civ Beitrag anzeigen
    Es müsste wenn schon so aussehen:

    Code:
                              <ValidCivics>
    				<ValidCivic>
    					<CivicType>CIVIC_GUIDING_MIND</CivicType>
    					<bValid>0</bValid>
                                    </ValidCivic>
                                    <ValidCivic>
    					<CivicType>NONE</CivicType>
    					<bValid>0</bValid>
                                     </ValidCivic>
                                     <ValidCivic>
    					<CivicType>NONE</CivicType>
    					<bValid>0</bValid>
    				</ValidCivic>
    			</ValidCivics>
    Aber die None-Einträge sind überflüssig:

    Code:
                              <ValidCivics>
    				<ValidCivic>
    					<CivicType>CIVIC_GUIDING_MIND</CivicType>
    					<bValid>0</bValid>
                                    </ValidCivic>
    			</ValidCivics>
    Du gibt hier einfach die Civics an, die nicht von der Ziv ausgewählt werden können (bValid hat den Wert 0). Alle nicht aufgeführten Civics sind erlaubt.
    Funktionieren tut es so aber prima.
    Conflict on Chiron - Sid Meier's Alpha Centauri vs. Call to Power!

    Neu Version Conflict on Chiron v3.4 BETA - 16.01.16

    Patch1 - 07.04.16

    Die deutschen Sounds und Wunderfilme sind bereits in der MainFile integriert!
    Ihr könnt sofort loslegen.

    Über Feedback würde ich mich freuen...

  5. #2405
    Registrierter Benutzer Avatar von alpha civ
    Registriert seit
    22.07.06
    Beiträge
    16.757
    Zitat Zitat von Monaldinio Beitrag anzeigen
    CvInfo.cpp

    Code:
    bool CvCivilizationInfo::isValidCivics() const
    {
    	return m_pbValidCivics;
    }
    CvInfo.h

    Code:
    bool isValidCivics() const;				// Exposed to Python
    So sieht das aber nicht bei mir aus!

  6. #2406
    Registrierter Benutzer Avatar von Monaldinio
    Registriert seit
    10.11.09
    Ort
    HRO
    Beiträge
    7.650


    Stimmt!

    Bei dir und mir sieht es so

    Code:
    bool CvCivilizationInfo::isValidCivic(int i) const
    {
    	FAssertMsg(i < GC.getNumCivicOptionInfos(), "Index out of bounds");
    	FAssertMsg(i > -1, "Index out of bounds");
    	return m_piValidCivics ? m_pbValidCivics[i] : -1;
    }

    Code:
    	DllExport bool isValidCivic(int i) const;
    Conflict on Chiron - Sid Meier's Alpha Centauri vs. Call to Power!

    Neu Version Conflict on Chiron v3.4 BETA - 16.01.16

    Patch1 - 07.04.16

    Die deutschen Sounds und Wunderfilme sind bereits in der MainFile integriert!
    Ihr könnt sofort loslegen.

    Über Feedback würde ich mich freuen...

  7. #2407
    Registrierter Benutzer Avatar von Monaldinio
    Registriert seit
    10.11.09
    Ort
    HRO
    Beiträge
    7.650
    Also dieses C++ macht mich fertig!

    Ich wollte jetzt Alphas ValidCivic Tag 1 zu 1 kopieren...


    Hatte keine Fehler beim kompilieren.
    Aber beim laden hatte ich wieder diesen

    XML Error
    Allocating zero or less memory in
    CvXMLLoadUtility::setVariableListTagPair

    Diesen Fehler hatte ich schon mal als ich versucht habe in der FeatureInfo den TechReveal Tag einzubauen.
    Der Fehler war damals im TerrainSchema.

    http://www.civforum.de/attachment.ph...7&d=1442471155

    Die Lösung hat damals Kathy gefunden.

    Edit: Die andere Möglichkeit ist, dass er durch die Änderung an dem Schema-Datei die gesamte TerrainInfos.xml nicht mehr laden kann und daher Ozean nicht finden. Da kommt mir eine Idee: Vielleicht liegt es daran, dass "TechReveal" zweimal definiert wurde, einmal für Feature und einmal für Bonus. Probier einmal, was passiert, wenn du diese Zeile
    Code:

    Code:
    <ElementType name="TechReveal" content="textOnly"/>
    1x entfernst, am besten die neue von dir.

    Mein CivilizationChema sieht so aus, Alphas Teil...mein Teil.
    Da ich mich an Kathys Lösung erinnerte, habe ich danach diesen CodeTeil

    <ElementType name="bValid" content="textOnly" dt:type="boolean"/>

    in meinen Teil gelöscht, ob mit oder ohne diesen Teil, Fehlermeldung.



    Code:
    </ElementType>
    	<ElementType name="FreeBuildingClasses" content="eltOnly">
    		<element type="FreeBuildingClass" minOccurs="0" maxOccurs="*"/>
    	</ElementType>
    	<ElementType name="TechType" content="textOnly"/>
    	<ElementType name="bFreeTech" content="textOnly" dt:type="boolean"/>
    	<ElementType name="FreeTech" content="eltOnly">
    		<element type="TechType"/>
    		<element type="bFreeTech"/>
    	</ElementType>
    	<ElementType name="FreeTechs" content="eltOnly">
    		<element type="FreeTech" minOccurs="0" maxOccurs="*"/>
    	</ElementType>
    	<ElementType name="bDisableTech" content="textOnly" dt:type="boolean"/>
    	<ElementType name="DisableTech" content="eltOnly">
    		<element type="TechType"/>
    		<element type="bDisableTech"/>
    	</ElementType>
    	<ElementType name="DisableTechs" content="eltOnly">
    		<element type="DisableTech" minOccurs="0" maxOccurs="*"/>
    	</ElementType>
    	<ElementType name="CivicType" content="textOnly"/>
    	<ElementType name="InitialCivics" content="eltOnly">
    		<element type="CivicType" minOccurs="0" maxOccurs="*"/>
    	</ElementType>
    
    
    	<ElementType name="bValid" content="textOnly" dt:type="boolean"/>
    	<ElementType name="ValidCivic" content="eltOnly">
    		<element type="CivicType"/>
    		<element type="bValid"/>
    	</ElementType>
    	<ElementType name="ValidCivics" content="eltOnly">
    		<element type="ValidCivic" minOccurs="0" maxOccurs="*"/>
    	</ElementType>
    
    
    	<ElementType name="ValidReligion" content="eltOnly">
    		<element type="ReligionType"/>
    		<element type="bValid"/>
    	</ElementType>
    	<ElementType name="ValidReligions" content="eltOnly">
    		<element type="ValidReligion" minOccurs="0" maxOccurs="*"/>
    	</ElementType>
    
    
    	<ElementType name="AnarchyCivics" content="eltOnly">
    		<element type="CivicType" minOccurs="0" maxOccurs="*"/>
    	</ElementType>
    Code:
    <ElementType name="CivilizationInfo" content="eltOnly">
    		<element type="Type"/>
    		<element type="Description"/>
    
    		<!-- Added for Planetfall -->
    		<element type="SpawningTech" minOccurs="0"/>
    		<element type="bAquatic" minOccurs="0"/>
    		<element type="bCharter" minOccurs="0"/>
    		<element type="bExpansion" minOccurs="0"/>
    		<element type="bFanExpansion" minOccurs="0"/>
    		<element type="bIsolated" minOccurs="0"/>
    		<element type="bPluralName" minOccurs="0"/>
    		<element type="bProgenitor" minOccurs="0"/>
    		<element type="iCityPlanet" minOccurs="0"/> <!-- Extra + or - planet that this civilization gets at all their cities-->
    		<element type="iMinEra" minOccurs="0"/>
    		<element type="Title" minOccurs="0"/>
    		<element type="CharacterGoodAdjective" minOccurs="0"/>
    		<element type="CharacterBadAdjective" minOccurs="0"/>
    		<element type="FollowerGoodAdjective" minOccurs="0"/>
    		<element type="FollowerBadAdjective" minOccurs="0"/>
    		<element type="ToCarryOutMission" minOccurs="0"/>
    		<element type="GoodActivityIsAre" minOccurs="0"/>
    		<element type="BadActivityIsAre" minOccurs="0"/>
    		<element type="BadHabits" minOccurs="0"/>
    		<element type="Insult" minOccurs="0"/>
    
    		<!-- End Added for Planetfall -->
    
    		<element type="ShortDescription"/>
    		<element type="Adjective"/>
    		<element type="Civilopedia"/>
    		<element type="DefaultPlayerColor"/>
    		<element type="ArtDefineTag"/>
    		<element type="ArtStyleType"/>
    		<element type="UnitArtStyleType" minOccurs="0" maxOccurs="1"/>
    		<element type="bPlayable"/>
    		<element type="bAIPlayable"/>
    		<element type="Cities"/>
    		<element type="SeaBases" minOccurs="0"/>
    		<element type="Buildings"/>
    		<element type="Units"/>
    		<element type="FreeUnitClasses"/>
    		<element type="FreeBuildingClasses"/>
    		<element type="FreeTechs"/>
    		<element type="DisableTechs"/>
    		<element type="InitialCivics"/>
    		<element type="ValidCivics"/>
    
    		<element type="ValidReligions"/>
    
    		<element type="AnarchyCivics" minOccurs="0"/>
    		<element type="Leaders" minOccurs="0"/>
    		<element type="DerivativeCiv"/>
    		<element type="CivilizationSelectionSound"/>
    		<element type="CivilizationActionSound"/>
    	</ElementType>
    	<ElementType name="CivilizationInfos" content="eltOnly">
    		<element type="CivilizationInfo" maxOccurs="*"/>
    	</ElementType>

    in der civilizationinfo sieht es so aus.

    Code:
    <InitialCivics>
    				<CivicType>CIVIC_MISSION_COMMAND</CivicType>
    				<CivicType>CIVIC_SUBSISTENCE</CivicType>
    				<CivicType>CIVIC_SURVIVAL</CivicType>
    				<CivicType>CIVIC_NONE</CivicType>
    				<CivicType>CIVIC_NO_MEMBER</CivicType>
    			</InitialCivics>
    			<ValidCivics>
    				<ValidCivic>
    					<CivicType>CIVIC_GUIDING_MIND</CivicType>
    					<bValid>0</bValid>
    				</ValidCivic>
    			</ValidCivics>
    			<ValidReligions>
    				<ValidReligion>
    					<ReligionType>RELIGION_ECHO</ReligionType>
    					<bValid>0</bValid>
    				</ValidReligion>
    			</ValidReligions>	
    			<Leaders>
    				<Leader>
    					<LeaderName>LEADER_WELLEN</LeaderName>
    					<bLeaderAvailability>1</bLeaderAvailability>
    				</Leader>
    			</Leaders>
    CvInfo.h

    Code:
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    //
    //  class : CvCivilizationInfo
    //
    //  DESC:
    //
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    class CvArtInfoCivilization;
    class CvCivilizationInfo :
    	public CvInfoBase
    {
    	//---------------------------------------PUBLIC INTERFACE---------------------------------
    public:
    
    	DllExport CvCivilizationInfo();
    	DllExport virtual ~CvCivilizationInfo();
    	DllExport virtual void reset();
    
    	DllExport int getDefaultPlayerColor() const;				// Expose to Python
    	DllExport int getArtStyleType() const;				// Expose to Python
    	DllExport int getUnitArtStyleType() const;         // Expose to Python
    	DllExport int getNumCityNames() const;				// Expose to Python
    	DllExport int getNumLeaders() const;				// Exposed to Python - the number of leaders the Civ has, this is needed so that random leaders can be generated easily
    	DllExport int getSelectionSoundScriptId() const;				// Expose to Python
    	DllExport int getActionSoundScriptId() const;				// Expose to Python
    
    	DllExport bool isAIPlayable() const;				// Expose to Python
    	DllExport bool isPlayable() const;				// Expose to Python
    
    	std::wstring pyGetShortDescription(uint uiForm) { return getShortDescription(uiForm); }				// Exposed to Python
    	DllExport const wchar* getShortDescription(uint uiForm = 0);
    	DllExport const wchar* getShortDescriptionKey() const;				// Exposed to Python
    	std::wstring pyGetShortDescriptionKey() { return getShortDescriptionKey(); }				// Exposed to Python
    
    	std::wstring pyGetAdjective(uint uiForm) { return getAdjective(uiForm);  }	// Exposed to Python
    	DllExport const wchar* getAdjective(uint uiForm = 0);
    	DllExport const wchar* getAdjectiveKey() const;				// Exposed to Python
    	std::wstring pyGetAdjectiveKey() { return getAdjectiveKey(); }				// Exposed to Python
    
    	DllExport const TCHAR* getFlagTexture() const;
    	DllExport const TCHAR* getArtDefineTag() const;
    	DllExport void setArtDefineTag(const TCHAR* szVal);
    	// Arrays
    
    	DllExport int getCivilizationBuildings(int i) const;				// Exposed to Python
    	DllExport int getCivilizationUnits(int i) const;				// Exposed to Python
    	DllExport int getCivilizationFreeUnitsClass(int i) const;				// Exposed to Python
    	DllExport int getCivilizationInitialCivics(int i) const;				// Exposed to Python
    	//Versuch
    	DllExport bool isValidCivic(int i) const;
    	DllExport bool isValidReligion(int i) const;
    	//Versuch
    
    	DllExport bool isLeaders(int i) const;				// Exposed to Python
    Code:
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    //
    //  class : CvCivilizationInfo
    //
    //  DESC:
    //
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    class CvArtInfoCivilization;
    class CvCivilizationInfo :
    	public CvInfoBase
    {
    	//---------------------------------------PUBLIC INTERFACE---------------------------------
    public:
    
    	DllExport CvCivilizationInfo();
    	DllExport virtual ~CvCivilizationInfo();
    	DllExport virtual void reset();
    
    	DllExport int getDefaultPlayerColor() const;				// Expose to Python
    	DllExport int getArtStyleType() const;				// Expose to Python
    	DllExport int getUnitArtStyleType() const;         // Expose to Python
    	DllExport int getNumCityNames() const;				// Expose to Python
    	DllExport int getNumLeaders() const;				// Exposed to Python - the number of leaders the Civ has, this is needed so that random leaders can be generated easily
    	DllExport int getSelectionSoundScriptId() const;				// Expose to Python
    	DllExport int getActionSoundScriptId() const;				// Expose to Python
    
    	DllExport bool isAIPlayable() const;				// Expose to Python
    	DllExport bool isPlayable() const;				// Expose to Python
    
    	std::wstring pyGetShortDescription(uint uiForm) { return getShortDescription(uiForm); }				// Exposed to Python
    	DllExport const wchar* getShortDescription(uint uiForm = 0);
    	DllExport const wchar* getShortDescriptionKey() const;				// Exposed to Python
    	std::wstring pyGetShortDescriptionKey() { return getShortDescriptionKey(); }				// Exposed to Python
    
    	std::wstring pyGetAdjective(uint uiForm) { return getAdjective(uiForm);  }	// Exposed to Python
    	DllExport const wchar* getAdjective(uint uiForm = 0);
    	DllExport const wchar* getAdjectiveKey() const;				// Exposed to Python
    	std::wstring pyGetAdjectiveKey() { return getAdjectiveKey(); }				// Exposed to Python
    
    	DllExport const TCHAR* getFlagTexture() const;
    	DllExport const TCHAR* getArtDefineTag() const;
    	DllExport void setArtDefineTag(const TCHAR* szVal);
    	// Arrays
    
    	DllExport int getCivilizationBuildings(int i) const;				// Exposed to Python
    	DllExport int getCivilizationUnits(int i) const;				// Exposed to Python
    	DllExport int getCivilizationFreeUnitsClass(int i) const;				// Exposed to Python
    	DllExport int getCivilizationInitialCivics(int i) const;				// Exposed to Python
    	//Versuch
    	DllExport bool isValidCivic(int i) const;
    	DllExport bool isValidReligion(int i) const;
    	//Versuch
    
    	DllExport bool isLeaders(int i) const;				// Exposed to Python

    CvInfo.cpp

    Code:
    //======================================================================================================
    //					CvCivilizationInfo
    //======================================================================================================
    
    //------------------------------------------------------------------------------------------------------
    //
    //  FUNCTION:   CvCivilizationInfo()
    //
    //  PURPOSE :   Default constructor
    //
    //------------------------------------------------------------------------------------------------------
    CvCivilizationInfo::CvCivilizationInfo():
    m_iDefaultPlayerColor(NO_PLAYERCOLOR),
    m_iArtStyleType(NO_ARTSTYLE),
    m_iUnitArtStyleType(NO_UNIT_ARTSTYLE),
    m_iNumCityNames(0),
    m_iNumLeaders(0),
    m_iSelectionSoundScriptId(0),
    m_iActionSoundScriptId(0),
    m_iDerivativeCiv(NO_CIVILIZATION),
    m_bPlayable(false),
    m_bAIPlayable(false),
    m_piCivilizationBuildings(NULL),
    m_piCivilizationUnits(NULL),
    m_piCivilizationFreeUnitsClass(NULL),
    m_piCivilizationInitialCivics(NULL),
    //Versuch
    m_pbValidCivics(NULL),
    m_pbValidReligions(NULL),
    //Versuch
    m_pbLeaders(NULL),

    Code:
    //------------------------------------------------------------------------------------------------------
    //
    //  FUNCTION:   ~CvCivilizationInfo()
    //
    //  PURPOSE :   Default destructor
    //
    //------------------------------------------------------------------------------------------------------
    CvCivilizationInfo::~CvCivilizationInfo()
    {
    	SAFE_DELETE_ARRAY(m_piCivilizationBuildings);
    	SAFE_DELETE_ARRAY(m_piCivilizationUnits);
    	SAFE_DELETE_ARRAY(m_piCivilizationFreeUnitsClass);
    	SAFE_DELETE_ARRAY(m_piCivilizationInitialCivics);
    	//Versuch
    	SAFE_DELETE_ARRAY(m_pbValidCivics);
    	SAFE_DELETE_ARRAY(m_pbValidReligions);
    	//Versuch
    	SAFE_DELETE_ARRAY(m_pbLeaders);

    Code:
    // Arrays
    
    int CvCivilizationInfo::getCivilizationBuildings(int i) const
    {
    	FAssertMsg(i < GC.getNumBuildingClassInfos(), "Index out of bounds");
    	FAssertMsg(i > -1, "Index out of bounds");
    	return m_piCivilizationBuildings ? m_piCivilizationBuildings[i] : -1;
    }
    
    int CvCivilizationInfo::getCivilizationUnits(int i) const
    {
    	FAssertMsg(i < GC.getNumUnitClassInfos(), "Index out of bounds");
    	FAssertMsg(i > -1, "Index out of bounds");
    	return m_piCivilizationUnits ? m_piCivilizationUnits[i] : -1;
    }
    
    int CvCivilizationInfo::getCivilizationFreeUnitsClass(int i) const
    {
    	FAssertMsg(i < GC.getNumUnitClassInfos(), "Index out of bounds");
    	FAssertMsg(i > -1, "Index out of bounds");
    	return m_piCivilizationFreeUnitsClass ? m_piCivilizationFreeUnitsClass[i] : -1;
    }
    
    int CvCivilizationInfo::getCivilizationInitialCivics(int i) const
    {
    	FAssertMsg(i < GC.getNumCivicOptionInfos(), "Index out of bounds");
    	FAssertMsg(i > -1, "Index out of bounds");
    	return m_piCivilizationInitialCivics ? m_piCivilizationInitialCivics[i] : -1;
    }
    //Versuch
    bool CvCivilizationInfo::isValidCivic(int i) const
    {
    	FAssertMsg(i < GC.getNumCivicOptionInfos(), "Index out of bounds");
    	FAssertMsg(i > -1, "Index out of bounds");
    	return m_pbValidCivics ? m_pbValidCivics[i] : -1;
    }
    
    bool CvCivilizationInfo::isValidReligion(int i) const
    {
    	FAssertMsg(i < GC.getNumReligionOptionInfos(), "Index out of bounds");
    	FAssertMsg(i > -1, "Index out of bounds");
    	return m_pbValidReligions ? m_pbValidReligions[i] : -1;
    }
    //Versuch
    
    bool CvCivilizationInfo::isLeaders(int i) const
    {
    	FAssertMsg(i < GC.getNumLeaderHeadInfos(), "Index out of bounds");
    	FAssertMsg(i > -1, "Index out of bounds");
    	return m_pbLeaders ? m_pbLeaders[i] : false;
    }

    Code:
    // Arrays
    
    	SAFE_DELETE_ARRAY(m_piCivilizationBuildings);
    	m_piCivilizationBuildings = new int[GC.getNumBuildingClassInfos()];
    	stream->Read(GC.getNumBuildingClassInfos(), m_piCivilizationBuildings);
    
    	SAFE_DELETE_ARRAY(m_piCivilizationUnits);
    	m_piCivilizationUnits = new int[GC.getNumUnitClassInfos()];
    	stream->Read(GC.getNumUnitClassInfos(), m_piCivilizationUnits);
    
    	SAFE_DELETE_ARRAY(m_piCivilizationFreeUnitsClass);
    	m_piCivilizationFreeUnitsClass = new int[GC.getNumUnitClassInfos()];
    	stream->Read(GC.getNumUnitClassInfos(), m_piCivilizationFreeUnitsClass);
    
    	SAFE_DELETE_ARRAY(m_piCivilizationInitialCivics);
    	m_piCivilizationInitialCivics = new int[GC.getNumCivicOptionInfos()];
    	stream->Read(GC.getNumCivicOptionInfos(), m_piCivilizationInitialCivics);
    	
    	//Versuch
    	SAFE_DELETE_ARRAY(m_pbValidCivics);
    	m_pbValidCivics = new bool[GC.getNumCivicInfos()];
    	stream->Read(GC.getNumCivicInfos(), m_pbValidCivics);
    	
    	SAFE_DELETE_ARRAY(m_pbValidReligions);
    	m_pbValidReligions = new bool[GC.getNumReligionInfos()];
    	stream->Read(GC.getNumReligionInfos(), m_pbValidReligions);
    	//Versuch
    
    	SAFE_DELETE_ARRAY(m_pbLeaders);
    	m_pbLeaders = new bool[GC.getNumLeaderHeadInfos()];
    	stream->Read(GC.getNumLeaderHeadInfos(), m_pbLeaders);
    Code:
    	// Arrays
    
    	stream->Write(GC.getNumBuildingClassInfos(), m_piCivilizationBuildings);
    	stream->Write(GC.getNumUnitClassInfos(), m_piCivilizationUnits);
    	stream->Write(GC.getNumUnitClassInfos(), m_piCivilizationFreeUnitsClass);
    	stream->Write(GC.getNumCivicOptionInfos(), m_piCivilizationInitialCivics);
    	//Versuch
    	stream->Write(GC.getNumCivicInfos(), m_pbValidCivics);
    	stream->Write(GC.getNumReligionInfos(), m_pbValidReligions);
    	//Versuch
    	stream->Write(GC.getNumLeaderHeadInfos(), m_pbLeaders);
    Code:
    bool CvCivilizationInfo::read(CvXMLLoadUtility* pXML)
    {
    	char szClassVal[256];					// holds the text value of the relevant classinfo
    
    	CvString szTextVal;
    	if (!CvInfoBase::read(pXML))
    	{
    		return false;
    	}
    
    	int j, iNumSibs;
    
    	pXML->GetChildXmlValByName(m_szShortDescriptionKey, "ShortDescription");
    	// Get the Text from Text/Civ4GameTextXML.xml
    
    	pXML->GetChildXmlValByName(m_szAdjectiveKey, "Adjective");
    	// Get the Text from Text/Civ4GameTextXML.xml
    
    	pXML->GetChildXmlValByName(szTextVal, "DefaultPlayerColor");
    	m_iDefaultPlayerColor = pXML->FindInInfoClass(szTextVal);
    
    	pXML->GetChildXmlValByName(szTextVal, "ArtDefineTag");
    	setArtDefineTag(szTextVal);
    
    	pXML->GetChildXmlValByName(szTextVal, "ArtStyleType");
    	m_iArtStyleType = GC.getTypesEnum(szTextVal);
    
    	pXML->GetChildXmlValByName(szTextVal, "UnitArtStyleType");
    	m_iUnitArtStyleType = pXML->FindInInfoClass(szTextVal);
    
    	pXML->GetChildXmlValByName(szTextVal, "CivilizationSelectionSound");
    	m_iSelectionSoundScriptId = (szTextVal.GetLength() > 0) ? gDLL->getAudioTagIndex( szTextVal.GetCString(), AUDIOTAG_3DSCRIPT ) : -1;
    	pXML->GetChildXmlValByName(szTextVal, "CivilizationActionSound");
    	m_iActionSoundScriptId = (szTextVal.GetLength() > 0) ? gDLL->getAudioTagIndex( szTextVal.GetCString(), AUDIOTAG_3DSCRIPT ) : -1;
    
    	// set the current xml node to it's next sibling and then
    	pXML->GetChildXmlValByName(&m_bPlayable, "bPlayable");
    	pXML->GetChildXmlValByName(&m_bAIPlayable, "bAIPlayable");
    
    	if (gDLL->getXMLIFace()->SetToChildByTagName(pXML->GetXML(),"Cities"))
    	{
    		pXML->SetStringList(&m_paszCityNames, &m_iNumCityNames);
    		gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
    	}
    
    	// if we can set the current xml node to it's next sibling
    	if (gDLL->getXMLIFace()->SetToChildByTagName(pXML->GetXML(),"Buildings"))
    	{
    		// pXML->Skip any comments and stop at the next value we might want
    		if (pXML->SkipToNextVal())
    		{
    			// call the function that sets the default civilization buildings
    			pXML->InitBuildingDefaults(&m_piCivilizationBuildings);
    			// get the total number of children the current xml node has
    			iNumSibs = gDLL->getXMLIFace()->GetNumChildren(pXML->GetXML());
    			// if the call to the function that sets the current xml node to it's first non-comment
    			// child and sets the parameter with the new node's value succeeds
    			if ( (0 < iNumSibs) && (gDLL->getXMLIFace()->SetToChild(pXML->GetXML())) )
    			{
    				int iBuildingClassIndex;
    
    				FAssertMsg((iNumSibs <= GC.getNumBuildingClassInfos()) ,"In SetGlobalCivilizationInfo iNumSibs is greater than GC.getNumBuildingClassInfos()");
    
    				// loop through all the siblings
    				for (j=0;j<iNumSibs;j++)
    				{
    					if (pXML->GetChildXmlVal(szClassVal))
    					{
    						// get the index into the array based on the building class type
    						iBuildingClassIndex = pXML->FindInInfoClass(szClassVal);
    						if (-1 < iBuildingClassIndex)
    						{
    							// get the next value which should be the building type to set this civilization's version of this building class too
    							pXML->GetNextXmlVal( szTextVal);
    							// call the find in list function to return either -1 if no value is found
    							// or the index in the list the match is found at
    							m_piCivilizationBuildings[iBuildingClassIndex] = pXML->FindInInfoClass(szTextVal);
    						}
    						else
    						{
    							FAssertMsg(0,"BuildingClass index is -1 in SetGlobalCivilizationInfo function");
    						}
    
    						// set the current xml node to it's parent node
    						gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
    					}
    
    					// if the call to the function that sets the current xml node to it's first non-comment
    					// sibling and sets the parameter with the new node's value does not succeed
    					// we will break out of this for loop
    					if (!gDLL->getXMLIFace()->NextSibling(pXML->GetXML()))
    					{
    						break;
    					}
    				}
    
    				// set the current xml node to it's parent node
    				gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
    			}
    		}
    
    		// set the current xml node to it's parent node
    		gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
    	}
    
    	// if we can set the current xml node to it's next sibling
    	if (gDLL->getXMLIFace()->SetToChildByTagName(pXML->GetXML(),"Units"))
    	{
    		// pXML->Skip any comments and stop at the next value we might want
    		if (pXML->SkipToNextVal())
    		{
    			// call the function that sets the default civilization buildings
    			pXML->InitUnitDefaults(&m_piCivilizationUnits);
    			// get the total number of children the current xml node has
    			iNumSibs = gDLL->getXMLIFace()->GetNumChildren(pXML->GetXML());
    			// if the call to the function that sets the current xml node to it's first non-comment
    			// child and sets the parameter with the new node's value succeeds
    			if ( (0 < iNumSibs) && (gDLL->getXMLIFace()->SetToChild(pXML->GetXML())) )
    			{
    				int iUnitClassIndex;
    
    				FAssertMsg((iNumSibs <= GC.getNumUnitClassInfos()),"In SetGlobalCivilizationInfo iNumSibs is greater than GC.getNumUnitClassInfos()");
    
    				// loop through all the siblings
    				for (j=0;j<iNumSibs;j++)
    				{
    					if (pXML->GetChildXmlVal(szClassVal))
    					{
    						// set the unit class index
    						iUnitClassIndex = pXML->FindInInfoClass(szClassVal);
    						if (-1 < iUnitClassIndex)
    						{
    							// get the next value which should be the building type to set this civilization's version of this building class too
    							pXML->GetNextXmlVal( szTextVal);
    							// call the find in list function to return either -1 if no value is found
    							// or the index in the list the match is found at
    							m_piCivilizationUnits[iUnitClassIndex] = pXML->FindInInfoClass(szTextVal);
    						}
    						else
    						{
    							FAssertMsg(0, "UnitClass index is -1 in SetGlobalCivilizationInfo function");
    						}
    
    						// set the current xml node to it's parent node
    						gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
    					}
    
    					// if the call to the function that sets the current xml node to it's first non-comment
    					// sibling and sets the parameter with the new node's value does not succeed
    					// we will break out of this for loop
    					if (!gDLL->getXMLIFace()->NextSibling(pXML->GetXML()))
    					{
    						break;
    					}
    				}
    
    				// set the current xml node to it's parent node
    				gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
    			}
    		}
    
    		// set the current xml node to it's parent node
    		gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
    	}
    
    	pXML->SetVariableListTagPair(&m_piCivilizationFreeUnitsClass, "FreeUnitClasses", sizeof(GC.getUnitClassInfo((UnitClassTypes)0)), GC.getNumUnitClassInfos());
    
    	pXML->SetVariableListTagPair(&m_pbCivilizationFreeBuildingClass, "FreeBuildingClasses", sizeof(GC.getBuildingClassInfo((BuildingClassTypes)0)), GC.getNumBuildingClassInfos());
    
    	pXML->SetVariableListTagPair(&m_pbCivilizationFreeTechs, "FreeTechs", sizeof(GC.getTechInfo((TechTypes)0)), GC.getNumTechInfos());
    	pXML->SetVariableListTagPair(&m_pbCivilizationDisableTechs, "DisableTechs", sizeof(GC.getTechInfo((TechTypes)0)), GC.getNumTechInfos());
    
    	if (gDLL->getXMLIFace()->SetToChildByTagName(pXML->GetXML(),"InitialCivics"))
    	{
    		if (pXML->SkipToNextVal())
    		{
    			iNumSibs = gDLL->getXMLIFace()->GetNumChildren(pXML->GetXML());
    			pXML->InitList(&m_piCivilizationInitialCivics, GC.getNumCivicOptionInfos());
    
    			if (0 < iNumSibs)
    			{
    				if (pXML->GetChildXmlVal(szTextVal))
    				{
    					FAssertMsg((iNumSibs <= GC.getNumCivicOptionInfos()),"For loop iterator is greater than array size");
    					for (j=0;j<iNumSibs;j++)
    					{
    						m_piCivilizationInitialCivics[j] = pXML->FindInInfoClass(szTextVal);
    						if (!pXML->GetNextXmlVal(szTextVal))
    						{
    							break;
    						}
    					}
    
    					gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
    				}
    			}
    		}
    
    		gDLL->getXMLIFace()->SetToParent(pXML->GetXML());
    	}
    	
    	//Versuch
    	pXML->SetVariableListTagPair(&m_pbValidCivics, "ValidCivics", sizeof(GC.getCivicInfo((CivicTypes)0)), GC.getNumCivicInfos(), true);
    	pXML->SetVariableListTagPair(&m_pbValidReligions, "ValidReligions", sizeof(GC.getReligionInfo((ReligionTypes)0)), GC.getNumReligionInfos(), true);
    	//Versuch
    	
    	pXML->SetVariableListTagPair(&m_pbLeaders, "Leaders", sizeof(GC.getLeaderHeadInfo((LeaderHeadTypes)0)), GC.getNumLeaderHeadInfos());

    ich glaube ich bin zu nass für paste and copy.
    Geändert von Monaldinio (08. Oktober 2015 um 15:59 Uhr)
    Conflict on Chiron - Sid Meier's Alpha Centauri vs. Call to Power!

    Neu Version Conflict on Chiron v3.4 BETA - 16.01.16

    Patch1 - 07.04.16

    Die deutschen Sounds und Wunderfilme sind bereits in der MainFile integriert!
    Ihr könnt sofort loslegen.

    Über Feedback würde ich mich freuen...

  8. #2408
    Registrierter Benutzer Avatar von alpha civ
    Registriert seit
    22.07.06
    Beiträge
    16.757
    Wahrscheinlich musst du im Schema vor

    <ElementType name="ValidReligion" content="eltOnly">


    noch

    <ElementType name="ReligionType" content="textOnly"/>

    hinzufügem, sofern ein solches Element noch nicht existiert. Und in BtS existiert das im Schema noch nicht.

  9. #2409
    Registrierter Benutzer Avatar von Monaldinio
    Registriert seit
    10.11.09
    Ort
    HRO
    Beiträge
    7.650
    Also! Du hattest recht!!! Daran lag es!
    Leider, wenn ich über den WB einer STadt die AlienReli gebe (nicht heilge Stadt, auch nicht die Tech die die Reli gründet) kann ich zur Reli wechseln.

    Konnte in der CvPlayer.cpp der fehler liegen?

    Code:
    bool CvPlayer::canDoReligion(ReligionTypes eReligion) const
    {
    	if (GET_TEAM(getTeam()).getHasReligionCount(eReligion) == 0)
    	{
    		return false;
    	}
    
    	return true;
    	
    //Versuch
    	if (!GC.getCivilizationInfo(getCivilizationType()).isValidReligion(eReligion))
    	{
    		return false;
    	}
    //Versuch
    	
    }
    Conflict on Chiron - Sid Meier's Alpha Centauri vs. Call to Power!

    Neu Version Conflict on Chiron v3.4 BETA - 16.01.16

    Patch1 - 07.04.16

    Die deutschen Sounds und Wunderfilme sind bereits in der MainFile integriert!
    Ihr könnt sofort loslegen.

    Über Feedback würde ich mich freuen...

  10. #2410
    Registrierter Benutzer Avatar von alpha civ
    Registriert seit
    22.07.06
    Beiträge
    16.757
    Ne, das stimmt schon. Der Worldbuilder fragt das halt nicht ab. Mit dem kann man auch ganz andere Sachen machen, was im Spiel so nicht gehen würde.

  11. #2411
    Registrierter Benutzer Avatar von Monaldinio
    Registriert seit
    10.11.09
    Ort
    HRO
    Beiträge
    7.650
    Naja...es ist ja nix anderes als wenn die Alienreli sich zur stadt verbreitet hätte...und dann dürfte ich sie trotzdem nicht annehmen können.

    Moment, vielleicht muss das unter canChangeReligion auch noch?
    Conflict on Chiron - Sid Meier's Alpha Centauri vs. Call to Power!

    Neu Version Conflict on Chiron v3.4 BETA - 16.01.16

    Patch1 - 07.04.16

    Die deutschen Sounds und Wunderfilme sind bereits in der MainFile integriert!
    Ihr könnt sofort loslegen.

    Über Feedback würde ich mich freuen...

  12. #2412
    Registrierter Benutzer Avatar von alpha civ
    Registriert seit
    22.07.06
    Beiträge
    16.757
    Zitat Zitat von Monaldinio Beitrag anzeigen
    Moment, vielleicht muss das unter canChangeReligion auch noch?
    Nein, dass wird schon da abgehandelt (genauer: in CvPlayer::canConvert).

  13. #2413
    Registrierter Benutzer Avatar von alpha civ
    Registriert seit
    22.07.06
    Beiträge
    16.757
    Wie sieht es denn mit RELIGION_ECHO aus? Kann die nicht angenommen werden?

  14. #2414
    Registrierter Benutzer Avatar von Monaldinio
    Registriert seit
    10.11.09
    Ort
    HRO
    Beiträge
    7.650
    Wenn ich der normalen Civ die entsprechende Tech geben würde, würde die Reli gegründet werden... Also habe ich der normalen Civ, zum Test, nicht die Tech gegeben sondern der Stadt nur die Reli...und dann bin auf die ReliBildschirm und konnte zur Reli wechseln, mit einer Normalen Civ. Soll aber so nicht sein. Soll nur von den Alien Civs angenommen werden können, deswegen habe ich ja deinen Tag kopiert weil der ja auf die gleiche weise die AlienCivic steuert.
    Geändert von Monaldinio (08. Oktober 2015 um 17:27 Uhr)
    Conflict on Chiron - Sid Meier's Alpha Centauri vs. Call to Power!

    Neu Version Conflict on Chiron v3.4 BETA - 16.01.16

    Patch1 - 07.04.16

    Die deutschen Sounds und Wunderfilme sind bereits in der MainFile integriert!
    Ihr könnt sofort loslegen.

    Über Feedback würde ich mich freuen...

  15. #2415
    Ein Platz an der Sonne Avatar von Commander Bello
    Registriert seit
    05.06.05
    Ort
    Nähe Koblenz
    Beiträge
    6.209
    Mir fällt ad hoc auf, dass
    Code:
    m_piCivilizationFreeUnitsClass(NULL),
    m_piCivilizationInitialCivics(NULL),
    //Versuch
    m_pbValidCivics(NULL),
    m_pbValidReligions(NULL),
    //Versuch
    m_pbLeaders(NULL),
    die letzten drei Zeilen m.E. falsch sind. Der zugewiesene Wert müsste true oder false sein, aber nicht NULL. Es handelt sich ja um Bool-Variablen


Seite 161 von 180 ErsteErste ... 61111151157158159160161162163164165171 ... LetzteLetzte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •