Quick Modding Questions Thread

CvCity.h has
PHP:
int getCultureGreatPeopleRateModifier() const;
This mean you can write it in the file and it compiles. However when linking all the files, it needs to link to CvCity:: CvCity::getCultureGreatPeopleRateModifier() const, which you didn't write. This mean your problem is in CvCity.cpp and not the file complaining about the issue.
As an additional hint: if you think this method is already implemented, check if it is also declared as const, otherwise the compiler won't link the implementation to the declaration.
 
I really need to debug this. It makes absolutely no sense to me, though it's good that you figured out how to avoid the crash.

I did some more testing and the nonsense continues... :D

I put back dacubz' file without the additional comment: CTD (normal...)

Without "correcting" the English entry of the tag TXT_KEY_CIV_GENOA_PEDIA, I just added Genoa in the French entry (which was empty like <French></French>), no more additional comment. The game loads fine and as I play in French, "Genoa" appears in the Civilopedia entry of the Civ in question.

I then delete Genoa from the French tag and the game crashes loading the XML!

Temporary conclusion: adding a comment in the file or an entry in a tag has the same effect to help to load the file.

I think I'll leave it like that for the time being... :crazyeye:
 
This mean your problem is in CvCity.cpp and not the file complaining about the issue.

But it actually works as intended in the game, in a city with a specialist the Great People Birth Rate jumps up from 3 per turn to 4 per turn if I have a Great Artist give it 4000 Culture, it only complains when I try to hover over the Great People Progress bar to see the breakdown. :confused:
 
I did some more testing and the nonsense continues... :D

I put back dacubz' file without the additional comment: CTD (normal...)

Without "correcting" the English entry of the tag TXT_KEY_CIV_GENOA_PEDIA, I just added Genoa in the French entry (which was empty like <French></French>), no more additional comment. The game loads fine and as I play in French, "Genoa" appears in the Civilopedia entry of the Civ in question.

I then delete Genoa from the French tag and the game crashes loading the XML!

Temporary conclusion: adding a comment in the file or an entry in a tag has the same effect to help to load the file.

I think I'll leave it like that for the time being... :crazyeye:
This is very very odd, especially since I've added approximately 10 civilizations since Genoa, and it didn't crash until now, even though I've probably loaded the mod 75 times without crash...very odd

However, I am seeing yet another odd xml problem. When adding resources I get a similar effect. Now that I look at it, not even adding resources. If I just add bonusinfo.xml into my mod, I get a weird error. The game loads fine (and even when I added cotton resource it looked fine in pedia), however when I load an actual game, weird things happen. If I load in ancient era, the game loads fine, but when I exit to main menu it crashes. If I load modern era, the game is absurdly slow, crashes within 30 seconds of loading the map. Here is the file I use, can you guys try to pop it in the mod and see what happens?
 

Attachments

I have to add to the oddness of this issue. The crash is in a MS dll file called by the exe. The last action in our dll is this function:
PHP:
void CvXMLLoadUtility::logMsg(char* format, ... )
{
	static char buf[kBufSize];
	_vsnprintf( buf, kBufSize-4, format, (char*)(&format+1) );
	gDLL->logMsg("xml.log", buf);
}
It crashes in the last line. buf is just the name of the xml file. That part should be ok.

It's like the more we learn about this crash, the more mysterious it becomes. I better investigate this further, but right now I need to figure out what to do in order to investigate further. Right now the only thing I can think of is to add a breakpoint for when the file starts to be loaded and then step through each line of C++ code to see what goes on. It's fairly time consuming, meaning it would be nice to come up with something faster to do first. I just haven't figured out what that would be yet.
 
This is very very odd, especially since I've added approximately 10 civilizations since Genoa, and it didn't crash until now, even though I've probably loaded the mod 75 times without crash...very odd

However, I am seeing yet another odd xml problem. When adding resources I get a similar effect. Now that I look at it, not even adding resources. If I just add bonusinfo.xml into my mod, I get a weird error. The game loads fine (and even when I added cotton resource it looked fine in pedia), however when I load an actual game, weird things happen. If I load in ancient era, the game loads fine, but when I exit to main menu it crashes. If I load modern era, the game is absurdly slow, crashes within 30 seconds of loading the map. Here is the file I use, can you guys try to pop it in the mod and see what happens?

I was having a similar issue recently with one particular unit causing the game to crash. If I removed it or commented it out everything worked, if I had it in CTD! I had just copied the unit above and changed the name nothing more.

Eventually I looked at all the logs being generated and in one I have never looked at before it said a TECH was missing. It was actually a dyslexic error on the OR (or was it AND) requirement techs I had "IE" rather than "EI" in the name. It wasn't even the tech the unit needed! Everything else was working - I could even play a few turns. Fixing the tech and the unit has worked since!

Another possibility may be that that line of text in the XML may not have a "proper" end of line and carriage return some editors only put one and not the other whereas Windows needs both. We have had that happen also but it usually results in strange formatting.
 
Is it possible to make the AI settle on their starting spot always?
In FFH2 the starting settlers have very high visibility and movement, so often the AI tends to move and settle right next to another capital :/
 
@ dacubz145 - on BonusInfo.

I did not download your mod, I just compared your file with the Warlords one (since BtS did not update that file).

For Sheep, I noticed this:
Code:
	<YieldChanges>
		<iYieldChange>1</iYieldChange>
		<iYieldChange>0</iYieldChange>
		<iYieldChange></iYieldChange>
	</YieldChanges>
.

In the Civilopedia for "Mouton", it results in the attached file. Commerce is obviously wrong (overflow).

Putting a 0 value in the 3rd iYieldChange corrects the issue.

PS: the tests were done in a mod with just your BonusInfo file.
 
Hi,
dont know if this is correct place to ask but since this is kind of modding question and I would like to have quick answer..:)

Is it legimate to offer payment for modding help in this forum?

I have problem with my personal mod mod project and because I have no skills to find bug my self and no time learn more I would be most willing to pay someone more skilled to get help. Since I only mod xml this is probably easy task to someone able to find bugs..
 
Is it legimate to offer payment for modding help in this forum?
Not really. Supposedly it is against the EULA for civ4 to mod for profit. If anything, the "currency" for paid modding is modding something else, like "If I fix your bugs, you draw that unit for me".

I have problem with my personal mod mod project and because I have no skills to find bug my self and no time learn more I would be most willing to pay someone more skilled to get help. Since I only mod xml this is probably easy task to someone able to find bugs..
I once thought xml bugs would be easy to fix. Look back in this thread and there is a bug where the game crashes unless there is a comment in one of the xml files and nobody can come up with an explanation to why it is like that. Another time I spent ages investigating why a unit didn't exist ingame when it looked ok in xml. It turned out to be a nameclash with something in globalDefineALT.

Having said that, the majority of bugs aren't that tricky to locate. Predicting which bugs are simple and which aren't takes some experience as well as technical knowledge and even then it can't be predicted with 100% accuracy.

You could like the rest of us just tell about the problem itself. We will never know if anybody knows the answer offhand unless we know the problem.
 
FYI, the strange CTD I was experiencing when I added a new building but not for all new buildings was a noob mistake - I was missing the leading comma on one of the civic button definitions!
 
@ dacubz145 - on BonusInfo.

I did not download your mod, I just compared your file with the Warlords one (since BtS did not update that file).

For Sheep, I noticed this:
Code:
	<YieldChanges>
		<iYieldChange>1</iYieldChange>
		<iYieldChange>0</iYieldChange>
		<iYieldChange></iYieldChange>
	</YieldChanges>
.

In the Civilopedia for "Mouton", it results in the attached file. Commerce is obviously wrong (overflow).

Putting a 0 value in the 3rd iYieldChange corrects the issue.

PS: the tests were done in a mod with just your BonusInfo file.

Wow, I am on a streak of silly xml errors that dont come up with the debug:(....thanks for the help
 
Wow, I am on a streak of silly xml errors that dont come up with the debug:(....thanks for the help
I know that feeling. I released RaRE today (hence the signature). It's primarily a bugfix because I forgot get city plot could return null plot pointers, which it does at the edge of the map. What makes this particularly silly is that I tell other people on the forum about that very issue... and then I make that mistake myself without thinking twice about it :wallbash:

I would say the real issue with the Sheep bug is that the game accepts an empty string as an int and just writes something. Generally speaking vanilla accepts way too many silly bugs from xml without even as much as asserting. I ran into a similar problem in M:C at some point and after spending hours tracking down the bug, I said something like "you broke the game, which is bad. My code allowed you to do it, which is far worse" and then I started looking into xml error checking at startup. Sadly it turned out that in order to have proper error checking for everything, it would require rewriting CvInfos.cpp and since that file is often modded, the concept of making such a check as a modcomp doesn't seem realistic :(

If I figure out a way to check without that much DLL work, I will let you know.
 
Civchecker by davidlallen doesn't do that. It mainly checks for missing art and undefined symbols.

edit: I see that in the meantime you have edited your post and that you have specified another utility. I should check it out!
 
The XML Validator by Alberts has the advantage that it reads the schema to create the checks. This means it should work even if you have modded the schema files.

It found the problem I was having;)
 
Good! :)

But I just tested it with dacubz' BonusInfos file and it couldn't find any errors in it. I guess that there are no miracle tools for all that would need to be checked in the xml.
 
Back
Top Bottom