Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Mod Components

Notices

Reply
 
Thread Tools
Old Dec 07, 2010, 06:08 PM   #1
Asaf
Sleep Deprived
 
Asaf's Avatar
 
Join Date: Mar 2010
Posts: 1,315
Ethnic Buildings Mod

===============================
= Ethnic Buildings by Asaf (version 0.1) =
===============================

Download here

This Mod component enables a modder to have different art for the same building for different civilizations, the same way units art works in BTS.

Building art info defined that way is displayed at the following places:
- On the map view - as a 3D model in the city (3D model)
- Inside the city screen, as a building production order button (button image)
- Inside the city screen, when the is building currently in queue (3D model)
- On the map in the city bar, when the building is currently being built (button image)
- On the popup where the player can select the next city production (button image)
- On the minimized production popup (if used) (button image)

This art is not used in the civilopedia (since it is not connected to a specific player).
Other places which are not in Vanilla BTS (such as in BUG) are not defined here, but can be easily modded.

All the changes I made (C++, Python and XML files) are marked with an 'Ethnic Buildings' comment.

Modders how-to:

XML
Spoiler:

A new type info was added: BuildingArtStyleTypeInfo.
This type info connects civilizations to the BuildingArtInfo's relevant for them.

In Civ4CivilizationInfos, a new tag was added under CivilizationInfo: <BuildingArtStyleType>.
Its value must be defined in the new file Civ4BuildingArtStyleTypeInfos.xml.
This tag may not appear, and in that case the art used by the building is the same as was used before (ArtDefineTag in BuildingInfo).
If it does appear, it should appear after <UnitArtStyleType>.

For example:

Civ4CivilizationInfos.xml:
PHP Code:
        <CivilizationInfo>
            <
Type>CIVILIZATION_AMERICA</Type>
            ...
            <
UnitArtStyleType>UNIT_ARTSTYLE_EUROPEAN</UnitArtStyleType>
            <
BuildingArtStyleType>BUILDING_ARTSTYLE_AMERICA</BuildingArtStyleType>
            <
bPlayable>1</bPlayable>
            ... 
Civ4BuildingArtStyleTypeInfos.xml:
PHP Code:
<Civ4BuildingArtStyleTypeInfos xmlns="x-schema:CIV4CivilizationsSchema.xml">
  <
BuildingArtStyleTypeInfos>
    <
BuildingArtStyleTypeInfo>
      <
Type>BUILDING_ARTSTYLE_AMERICA</Type>
      <
StyleBuildings>
        <
StyleBuilding>
          <
BuildingType>BUILDING_BARRACKS</BuildingType>
          <
BuildingMeshGroup>
            <
EarlyArtDefineTag>ART_DEF_BUILDING_BARRACKS_AMERICAN</EarlyArtDefineTag>
            <
LateArtDefineTag>ART_DEF_BUILDING_BARRACKS_AMERICAN</LateArtDefineTag>
            <
MiddleArtDefineTag>ART_DEF_BUILDING_BARRACKS_AMERICAN_MODERN</MiddleArtDefineTag>
          </
BuildingMeshGroup>
        </
StyleBuilding>
      </
StyleBuildings>
    </
BuildingArtStyleTypeInfo>
    ... 
Note that there can only be one mesh group (unlike unit art styles), and here too you can have different art for different eras (same as with units).

Of course, some or all eras may have the same art, but if you define a StyleBuilding, you must define a single BuildingMeshGroup in it with all 3 possible eras defined.

In this example, ART_DEF_BUILDING_BARRACKS_AMERICAN and ART_DEF_BUILDING_BARRACKS_AMERICAN_MODERN should be defined in CIV4ArtDefines_Building.xml, each as a BuildingArtInfo of its own.

Appropriate changes were made to the civilization scheme (make sure you merge it to your Mod).


Python
Spoiler:

In order for the correct 3D model to be displayed in the city screen, I used a minor 'hack':

The drawing of this model is done by calling addBuildingGraphicGFC(), which in turn calls the DLL function CvGame::getBuildingArtInfo(). Since in CvGame::getBuildingArtInfo() the player information does not exist, then before calling addBuildingGraphicGFC() the Python code calls the new function CyGame().setBuildingModelCity() and passes the city ID and the owner ID.
This enables the DLL to return the correct art for the player.
When merging the Python code to your Mod (or with BUG or any other Mod) make sure to leave these lines (see updatePlotListButtons() in CvMainInterface.py).

New exported functions to python:

void CyGame.setBuildingModelCity(int iCityId, int /*PlayerTypes*/ eOwner) - Described above.
int CvCivilizationInfo.getUnitArtStyleType() - For some reason was not defined.
int CvCivilizationInfo.getBuildingArtStyleType() - Returns the ID of the building art style type defined for this civilization (-1 for NONE)
string CyPlayer.getBuildingButton(int eBuilding) - Returns the building button for this player.

Credits:
========
DannyDaemonic - the fast Makefile (1.0). Downloaded from: http://forums.civfanatics.com/showthread.php?t=370861
j_mie6 - For the idea (requested this Mod)


EDIT: You are more than welcome to use this mod component in your own mods, but if you do - please let me know.
__________________
Civ IV Mod components: Power Up | Civics Dependency | Ethnic Buildings | My Custom DLL (Ver 7) | Fourth Yield | Unique Civics

Civ IV Modding Tutorials: Compiling the DLL (including Using Visual Studio & Debugging), Version Control with TSVN

New: A Game Font Editor for Civ IV (version 0.6, updated 15-Aug-2012)

Last edited by Asaf; Dec 09, 2010 at 02:54 AM.
Asaf is offline   Reply With Quote
Old Dec 07, 2010, 10:25 PM   #2
The Capo
godless Heathen
 
The Capo's Avatar
 
Join Date: Jan 2001
Location: Washington, DC
Posts: 8,957
So basically this just shows the ethnic improvement art (say from a mod like Cultural Citystyles) in the Civilopedia and City Screen?

I was wondering if this could be altered to make wonders ethnic as well? For instance could there be an ethnic wonder for the Great Wall, like the Romans would get Hadrian's wall instead or is that way too complex to do?
__________________
Religion flies men into buildings, science flies men to the moon...

Check out my stuff!!!
UNITS | LEADERHEADS | DIPLOMACY II
The Capo is offline   Reply With Quote
Old Dec 08, 2010, 02:18 AM   #3
Asaf
Sleep Deprived
 
Asaf's Avatar
 
Join Date: Mar 2010
Posts: 1,315
Quote:
Originally Posted by The Capo View Post
So basically this just shows the ethnic improvement art (say from a mod like Cultural Citystyles) in the Civilopedia and City Screen?

I was wondering if this could be altered to make wonders ethnic as well? For instance could there be an ethnic wonder for the Great Wall, like the Romans would get Hadrian's wall instead or is that way too complex to do?
City screen - yes, civilopedia - no, although I can probably change it so that when watching the civilopedia in game (and there's an active player) it will display the player's art style. Not sure if that's a good thing though.
And not improvements (as in tile improvements - farm, mine, etc.) but buildings built in the city.

Wonders are basically buildings for which the building class has iMaxGlobalInstances=1, so yes, they will be ethnic as well.

The movies, however, are not included in the 'ethnic art'. I guess it's doable, but I haven't seen many movie makers for mods, so I'm not sure if it's needed.

Specifically for the Great Wall, the art of displaying the wall around the cultural borders is not included in the ethnic buildings since it's not part of the art assets (as far as I know), and not part of the BuildingArtInfo.
__________________
Civ IV Mod components: Power Up | Civics Dependency | Ethnic Buildings | My Custom DLL (Ver 7) | Fourth Yield | Unique Civics

Civ IV Modding Tutorials: Compiling the DLL (including Using Visual Studio & Debugging), Version Control with TSVN

New: A Game Font Editor for Civ IV (version 0.6, updated 15-Aug-2012)
Asaf is offline   Reply With Quote
Old Dec 08, 2010, 12:16 PM   #4
j_mie6
Deity
 
j_mie6's Avatar
 
Join Date: Dec 2009
Location: Swindon
Posts: 2,630
Images: 10
Great work I'm sure that many people (including myself), will be very happy to see this!

I will have a play on friday!
__________________
My mods = Jamie's Rome Mod 1.3.2, No Global Warming Mod My units = Great Generals, Ninja!, Desert Marine, African Marines, Chinese Rocketeer My utilities: XML text cleaner, City Optimiser/Simulator

Yay! 2 A* Grades, 6 A Grades and 2 B Grades!

State Property, the new Forbidden Palace?

Jamie
j_mie6 is offline   Reply With Quote
Old Dec 08, 2010, 01:09 PM   #5
The_J
Say No 2 Net Validations

 
The_J's Avatar
 
Join Date: Oct 2008
Location: Germany / Netherlands
Posts: 24,996
Images: 51
The sad part here: That was already possible in standard BtS .
The good part here: That implementation is definitely better and should have been done in that way by default .
__________________
Civ4-BtS-Mod "Mars, Now!"


Steam eats the souls of little gamers!!!
The_J is offline   Reply With Quote
Old Dec 08, 2010, 01:41 PM   #6
j_mie6
Deity
 
j_mie6's Avatar
 
Join Date: Dec 2009
Location: Swindon
Posts: 2,630
Images: 10
yer but the other way is very complicated and this would be so much better for new modders
__________________
My mods = Jamie's Rome Mod 1.3.2, No Global Warming Mod My units = Great Generals, Ninja!, Desert Marine, African Marines, Chinese Rocketeer My utilities: XML text cleaner, City Optimiser/Simulator

Yay! 2 A* Grades, 6 A Grades and 2 B Grades!

State Property, the new Forbidden Palace?

Jamie
j_mie6 is offline   Reply With Quote
Old Dec 09, 2010, 12:50 AM   #7
Asaf
Sleep Deprived
 
Asaf's Avatar
 
Join Date: Mar 2010
Posts: 1,315
Quote:
Originally Posted by The_J View Post
The sad part here: That was already possible in standard BtS .
Oh.
How? (Probably something that has to do with LSystem, which I could never understand)

Quote:
Originally Posted by The_J View Post
The good part here: That implementation is definitely better and should have been done in that way by default .
Yey!

Maybe I should open a thread for every mod comp I intend to make before I make it...
__________________
Civ IV Mod components: Power Up | Civics Dependency | Ethnic Buildings | My Custom DLL (Ver 7) | Fourth Yield | Unique Civics

Civ IV Modding Tutorials: Compiling the DLL (including Using Visual Studio & Debugging), Version Control with TSVN

New: A Game Font Editor for Civ IV (version 0.6, updated 15-Aug-2012)

Last edited by Asaf; Dec 09, 2010 at 01:00 AM.
Asaf is offline   Reply With Quote
Old Dec 09, 2010, 02:21 AM   #8
The_J
Say No 2 Net Validations

 
The_J's Avatar
 
Join Date: Oct 2008
Location: Germany / Netherlands
Posts: 24,996
Images: 51
Quote:
Originally Posted by Asaf View Post
Oh.
How? (Probably something that has to do with LSystem, which I could never understand)
Yup, that. I don't really understand it too.

Quote:
Originally Posted by Asaf View Post
Yey!

Maybe I should open a thread for every mod comp I intend to make before I make it...

If you make more, then maybe one big thread for all is better, then you also have your own "discussion" ground, that's maybe easier .
__________________
Civ4-BtS-Mod "Mars, Now!"


Steam eats the souls of little gamers!!!
The_J is offline   Reply With Quote
Old Dec 09, 2010, 02:59 AM   #9
Asaf
Sleep Deprived
 
Asaf's Avatar
 
Join Date: Mar 2010
Posts: 1,315
Quote:
Originally Posted by The_J View Post
Yup, that. I don't really understand it too.
If it's that complicated, maybe this mod will be useful after all
__________________
Civ IV Mod components: Power Up | Civics Dependency | Ethnic Buildings | My Custom DLL (Ver 7) | Fourth Yield | Unique Civics

Civ IV Modding Tutorials: Compiling the DLL (including Using Visual Studio & Debugging), Version Control with TSVN

New: A Game Font Editor for Civ IV (version 0.6, updated 15-Aug-2012)
Asaf is offline   Reply With Quote
Old Dec 09, 2010, 10:28 AM   #10
j_mie6
Deity
 
j_mie6's Avatar
 
Join Date: Dec 2009
Location: Swindon
Posts: 2,630
Images: 10
oh it is! You have given alot of new modders a great new asset previously too scary for them to handle!
__________________
My mods = Jamie's Rome Mod 1.3.2, No Global Warming Mod My units = Great Generals, Ninja!, Desert Marine, African Marines, Chinese Rocketeer My utilities: XML text cleaner, City Optimiser/Simulator

Yay! 2 A* Grades, 6 A Grades and 2 B Grades!

State Property, the new Forbidden Palace?

Jamie
j_mie6 is offline   Reply With Quote
Old Jan 17, 2011, 01:03 PM   #11
tootired22
Chieftain
 
tootired22's Avatar
 
Join Date: Oct 2010
Posts: 18
ummm I just downloaded complete edition, new to the game, can anyone tell me how to install mods? I download the file, and unzip it where??
tootired22 is offline   Reply With Quote
Old Jan 17, 2011, 11:28 PM   #12
j_mie6
Deity
 
j_mie6's Avatar
 
Join Date: Dec 2009
Location: Swindon
Posts: 2,630
Images: 10
unzip to your documents and drag the intire file to computer/program files/2k games/civilization complete/beyond the sword/mods or somethign simmilar

(you only have to past in documents if you are on vista)
__________________
My mods = Jamie's Rome Mod 1.3.2, No Global Warming Mod My units = Great Generals, Ninja!, Desert Marine, African Marines, Chinese Rocketeer My utilities: XML text cleaner, City Optimiser/Simulator

Yay! 2 A* Grades, 6 A Grades and 2 B Grades!

State Property, the new Forbidden Palace?

Jamie
j_mie6 is offline   Reply With Quote
Old Jan 18, 2011, 07:10 PM   #13
tootired22
Chieftain
 
tootired22's Avatar
 
Join Date: Oct 2010
Posts: 18
What about these files? Do they go to in the Custom Assests? The Ethnic buildings are more just graphics than gameplay enhancers right? So if i unzip to mods, wont i have to load it every time?
tootired22 is offline   Reply With Quote
Old Jan 19, 2011, 01:41 AM   #14
Asaf
Sleep Deprived
 
Asaf's Avatar
 
Join Date: Mar 2010
Posts: 1,315
This mod doesn't have any graphics of its own. It's just a mod component to make it easier for other modders to assign specific building art to specific civilizations.

Unless you have art files of your own (or somebody else's) that you want to use, you really don't need this mod.
__________________
Civ IV Mod components: Power Up | Civics Dependency | Ethnic Buildings | My Custom DLL (Ver 7) | Fourth Yield | Unique Civics

Civ IV Modding Tutorials: Compiling the DLL (including Using Visual Studio & Debugging), Version Control with TSVN

New: A Game Font Editor for Civ IV (version 0.6, updated 15-Aug-2012)
Asaf is offline   Reply With Quote
Old May 01, 2011, 04:57 AM   #15
cool3a2
Deity
 
cool3a2's Avatar
 
Join Date: Mar 2007
Posts: 2,151
Interesting... I would like to switch to this for my Magyar Mod, but there are some cons. But I have some questions.

1.) You said that this enables art for different eras which is misleading. Eras would be like ERA_INDUSTRIAL, but I see your point. Nevertheless, I would need eras in the actual sense as for some buildings I have art allowing me to flavor buildings more precisely. I have no clue about python modding, but I believe that the definitions for the eras should already be available as the game already uses them. For the XMLs, it should be rather unimportant what kind of eras you use. So, could you update this to use eras in the actual sense? Only then, I would use this.

2.) Does this support modular modding? I assume so.

3.) Is it multiplayer save?

4.) Would it be possible to flavour the citysets, too? I mean, not only those buildings that the player wants to build at some point, but also those generic houses? Even if not, This file would simplify my mod and merging it, so I could live without it.

So, if you could update this so that point 1 to 3 are fulfilled, I'd gladly use this...
__________________
"Nobody can take us our history away. But it is ours only if we know it." –István Nemeskürty
"If one man dreams, it's only a dream. If a lot of men dream, it's the beginning of a new reality."

Join the hungarian forum http://civilizacio.road2us.com/ today!
cool3a2 is offline   Reply With Quote
Old May 02, 2011, 03:33 AM   #16
Asaf
Sleep Deprived
 
Asaf's Avatar
 
Join Date: Mar 2010
Posts: 1,315
Quote:
Originally Posted by cool3a2 View Post
1.) You said that this enables art for different eras which is misleading. Eras would be like ERA_INDUSTRIAL, but I see your point. Nevertheless, I would need eras in the actual sense as for some buildings I have art allowing me to flavor buildings more precisely. I have no clue about python modding, but I believe that the definitions for the eras should already be available as the game already uses them. For the XMLs, it should be rather unimportant what kind of eras you use. So, could you update this to use eras in the actual sense? Only then, I would use this.
True, it might be a bit misleading, but it works the same as with the unit art style per era (you have early, middle, and late, which consist of 25%, 25% and 50% of the eras, if I'm not mistaken).
It could be done, but unfortunately I simply don't have time to mod, and will probably won't have time in the near future. So if someone else wants to do it - you're more than welcome to.

Quote:
Originally Posted by cool3a2 View Post
2.) Does this support modular modding? I assume so.
I guess so, but I've never tried it like that myself.

Quote:
Originally Posted by cool3a2 View Post
3.) Is it multiplayer safe?
It should be. I don't see a reason it won't be. But again, never tested.

Quote:
Originally Posted by cool3a2 View Post
4.) Would it be possible to flavour the citysets, too? I mean, not only those buildings that the player wants to build at some point, but also those generic houses? Even if not, This file would simplify my mod and merging it, so I could live without it.
Oh, I don't really know. I'm guessing it's doable, but I have never looked at this code so I can't say for sure if and how easy it would be.

Sorry I couldn't be more helpful...
__________________
Civ IV Mod components: Power Up | Civics Dependency | Ethnic Buildings | My Custom DLL (Ver 7) | Fourth Yield | Unique Civics

Civ IV Modding Tutorials: Compiling the DLL (including Using Visual Studio & Debugging), Version Control with TSVN

New: A Game Font Editor for Civ IV (version 0.6, updated 15-Aug-2012)
Asaf is offline   Reply With Quote
Old May 02, 2011, 10:05 AM   #17
cool3a2
Deity
 
cool3a2's Avatar
 
Join Date: Mar 2007
Posts: 2,151
I see... I might try to get help with this from other users. Sounds like that would be okay to you.
__________________
"Nobody can take us our history away. But it is ours only if we know it." –István Nemeskürty
"If one man dreams, it's only a dream. If a lot of men dream, it's the beginning of a new reality."

Join the hungarian forum http://civilizacio.road2us.com/ today!
cool3a2 is offline   Reply With Quote
Old May 15, 2011, 01:56 PM   #18
cool3a2
Deity
 
cool3a2's Avatar
 
Join Date: Mar 2007
Posts: 2,151
So I've started to work on this. I think I successfully merged your package with WoC Lite, now I'm working on the era thing. Basically, I replace all the early, middle and late functions / calls with ancient, classical, medieval, renaissance, industrial, modern and future counterparts. It basically works, but there are two problems. A basic problem is that the game crashes if there is an invalid artdef referenced in the buildingartstyletype file, even without telling the user why. It would be the best if we would get a parse error if such things happen or at least if we simply don't show any building. Hints? These are the errors I got when the game crashed and debug mode was enabled:
Spoiler:
Assert Failed

File: CvArtFileMgr.cpp
Line: 175
Expression: false
Message: get##name##ArtInfo: ART_DEF_BUILDING_HUNG_VEGVARE was not found



Assert Failed

File: CvArtFileMgr.cpp
Line: 175
Expression: false
Message: get##name##ArtInfo: ERROR was not found


The second problem is that the modern and the future eras don't work properly. I assume it is because of the following code (CvInfos.cpp):
Spoiler:
if ((eEra >= 6) && !CvString(getFutureArtDefineTag(eStyle)).empty())
{
return ARTFILEMGR.getBuildingArtInfo(getFutureArtDefineTa g(eStyle));
}
else if ((eEra == 5) && !CvString(getModernArtDefineTag(eStyle)).empty())
{
return ARTFILEMGR.getBuildingArtInfo(getModernArtDefineTa g(eStyle));
}
else if ((eEra == 4) && !CvString(getIndustrialArtDefineTag(eStyle)).empty ())
{
return ARTFILEMGR.getBuildingArtInfo(getIndustrialArtDefi neTag(eStyle));
}
else if ((eEra == 3) && !CvString(getRenaissanceArtDefineTag(eStyle)).empt y())
{
return ARTFILEMGR.getBuildingArtInfo(getRenaissanceArtDef ineTag(eStyle));
}
else if ((eEra == 2) && !CvString(getMedievalArtDefineTag(eStyle)).empty() )
{
return ARTFILEMGR.getBuildingArtInfo(getMedievalArtDefine Tag(eStyle));
}
else if ((eEra == 1) && !CvString(getClassicalArtDefineTag(eStyle)).empty( ))
{
return ARTFILEMGR.getBuildingArtInfo(getClassicalArtDefin eTag(eStyle));
}
else if (!CvString(getAncientArtDefineTag(eStyle)).empty() )
{
return ARTFILEMGR.getBuildingArtInfo(getAncientArtDefineT ag(eStyle));
}

which replaced
Spoiler:
if ((eEra > GC.getNumEraInfos() / 2) && !CvString(getLateArtDefineTag(eStyle)).empty())
{
return ARTFILEMGR.getBuildingArtInfo(getLateArtDefineTag( eStyle));
}
else if ((eEra > GC.getNumEraInfos() / 4) && !CvString(getMiddleArtDefineTag(eStyle)).empty())
{
return ARTFILEMGR.getBuildingArtInfo(getMiddleArtDefineTa g(eStyle));
}
else if (!CvString(getEarlyArtDefineTag(eStyle)).empty())
{
return ARTFILEMGR.getBuildingArtInfo(getEarlyArtDefineTag (eStyle));
}

I was assuming GC.getNumEraInfos() returns 7 for default BtS games as there are 7 eras. Dividing it by 2 returns 3.5, thus 4, 5 and 6 make the expression true. Late therefor stood for industrial, modern and future. Dividing it by 4 makes 1,75 and as 4, 5 and 6 are already out, 2 and 3 make the expression true. Thus, Medieval and Renaissance make up what was middle before or is for units. 0 and 1 thus stand for ancient and classical. Am I right? I have used fixed numbers to get this work for all the eras (I used >= 6 to have the code keep working if someone hacked the eras). Did I make any msitake?
__________________
"Nobody can take us our history away. But it is ours only if we know it." –István Nemeskürty
"If one man dreams, it's only a dream. If a lot of men dream, it's the beginning of a new reality."

Join the hungarian forum http://civilizacio.road2us.com/ today!
cool3a2 is offline   Reply With Quote
Old May 16, 2011, 02:30 AM   #19
cool3a2
Deity
 
cool3a2's Avatar
 
Join Date: Mar 2007
Posts: 2,151
Seems like I was wrong and the selection of the building art in-deed works as expected. My problem was only that in workbuilder I had choosen the wrong technologies, so the future era was never actually reached. After I added a breakpoint, I noticed that the function I cited from was never called as I had expected it. After selecting a few techs more the function got called and everything worked as expected. Now I will try to find a way to avoid a crash if an artdef is invalid or at least tell the user about the reasons. Besides of this, the new modcomp is functional and if anyone cares, I could upload it already so you can test it...

EDIT: I believe I found an acceptable solution using this code:
Spoiler:
Quote:
CvArtInfoBuilding* dummy = NULL;

if (eStyle != NO_BUILDING_ARTSTYLE)
{
if ((eEra >= 6) && !CvString(getFutureArtDefineTag(eStyle)).empty())
{
dummy = ARTFILEMGR.getBuildingArtInfo(getFutureArtDefineTa g(eStyle));
}
else if ((eEra == 5) && !CvString(getModernArtDefineTag(eStyle)).empty())
{
dummy = ARTFILEMGR.getBuildingArtInfo(getModernArtDefineTa g(eStyle));
}
else if ((eEra == 4) && !CvString(getIndustrialArtDefineTag(eStyle)).empty ())
{
dummy = ARTFILEMGR.getBuildingArtInfo(getIndustrialArtDefi neTag(eStyle));
}
else if ((eEra == 3) && !CvString(getRenaissanceArtDefineTag(eStyle)).empt y())
{
dummy = ARTFILEMGR.getBuildingArtInfo(getRenaissanceArtDef ineTag(eStyle));
}
else if ((eEra == 2) && !CvString(getMedievalArtDefineTag(eStyle)).empty() )
{
dummy = ARTFILEMGR.getBuildingArtInfo(getMedievalArtDefine Tag(eStyle));
}
else if ((eEra == 1) && !CvString(getClassicalArtDefineTag(eStyle)).empty( ))
{
dummy = ARTFILEMGR.getBuildingArtInfo(getClassicalArtDefin eTag(eStyle));
}
else if (!CvString(getAncientArtDefineTag(eStyle)).empty() )
{
dummy = ARTFILEMGR.getBuildingArtInfo(getAncientArtDefineT ag(eStyle));
}
if (dummy!=NULL)
return dummy;
}

return ARTFILEMGR.getBuildingArtInfo(getArtDefineTag());

The ARTFILEMGR.getBuildingArtInfo(getXYZArtDefineTag(e Style)); will return NULL if the artdef is invalid, so we'll save the return value in dummy and then evaluate it. If it isn't NULL, everything was okay and we can leave the function returning dummy's value, otherwise we will stay in the function. Next and last thing the function will try is retrieving the buildings default artdef and return that. If there is no default artdef, I think the game would have thrown an error at us at mod loading phase, although I'm not too sure about that. At least, this should be a far more obvious xml mistake then a typo in the eras artdefs. To summarize it up, the game now should fall back to the default artdef if no valid artdef is available for the desired era. This ways, the modder might not even notice that there is an error, but that's still better than a crash. Also, if I'm not mistaken, it should be possible to just not give an artdef for certain eras that shall use the default art. Haven't tried what would have happened with asafs original dll and what happens now in this case though. Let me know if you guys see any problem with this code.
__________________
"Nobody can take us our history away. But it is ours only if we know it." –István Nemeskürty
"If one man dreams, it's only a dream. If a lot of men dream, it's the beginning of a new reality."

Join the hungarian forum http://civilizacio.road2us.com/ today!

Last edited by cool3a2; May 16, 2011 at 03:13 AM.
cool3a2 is offline   Reply With Quote
Old May 16, 2011, 03:03 AM   #20
Asaf
Sleep Deprived
 
Asaf's Avatar
 
Join Date: Mar 2010
Posts: 1,315
In C++, the result of dividing an int is always rounded down - the non-integer part is truncated. So when you divide 7 by 2 you get 3, not 4.

As for the crush - I think that's true for all the art definitions in the game, even for the original DLL (unit art style etc.).
If you want to solve this, you could probably assign a default art style when the art style is invalid.

If it's working - sure! post your mod comp, and add a link here.
__________________
Civ IV Mod components: Power Up | Civics Dependency | Ethnic Buildings | My Custom DLL (Ver 7) | Fourth Yield | Unique Civics

Civ IV Modding Tutorials: Compiling the DLL (including Using Visual Studio & Debugging), Version Control with TSVN

New: A Game Font Editor for Civ IV (version 0.6, updated 15-Aug-2012)
Asaf is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Mod Components > [MODCOMP] Ethnic Buildings Mod

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 06:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR