Mod-Modders Guide to Fall Further

It shouldn't be a problem to compile with codeblocks. He would just have to add the extra files to his project, pretty simple to do really (you just go to File, and select Add File to Project. Far easier than modifications to a Makefile)

I didn't know that. VS is still useful for debugging, so you may need to use it eventually anyway, unless Xienwolf knows how to do that in Codeblocks too.;)
 
IIRC isBarBarian() returns true for all Barbarian factions in FF. To get a specific one, use gc.getANIMAL_PLAYER() which returns the ID of the barbarian player.
 
Sephi is correct. isBarbarian() notifies for all Barbs (though I think I wrote it stupid and it notifies for all that I wrote, and others have to be added, I should have made it generic to catch everything past Max_Civ_Players)
 
I'm trying to make a module for RifE (formerly known as FF+), and from what I understand it's the same modular loading code Xienwolf merged over from WoC Lite. Anyway, I've been getting some very strange bugs, mostly from buildings but occasionally from units as well (things like buildings granting thousands of commerce to specialists, units being able to cast every spell in the game, and other such things). A couple posts in this thread suggest other people are having similar issues. The bugs I've encountered are so problematic that I'm considering scrapping my module entirely. My questions are:

1.) Is there a post that describes the known issues with modular loading so that I can know what to look out for?
2.) What's the current progress on resolving these issues in the code? I'm not a code monkey, but I can be pretty good at catching typos; I'll take a look at the relevant lines if someone points me in the right direction. But I don't even know where the modular loading code is (it's somewhere in the DLL, right?).
 
Unfortunately the issues are fairly scattered. Most all made it into the bug thread, but I don't know for CERTAIN that I carried all of them to the first post. I think at some point I just admitted that I did the merge too quickly and needed to be more cautious in the rebuild and ensure I do not simply copy over my previous setup.

Sephi has found and fixed most of the issues. As far as I know modular loading works flawlessly in Wild Mana, so except for the new tags I have added which he has not imported, Valkrionn should look to snipe any differences in his code which involve the modular loading bits and just assume that they fix bugs. I know events were horrible, and I recall issues being mentioned with either (or maybe both) buildings or units. Been a while though since I looked at the bug thread's list, I am not anywhere NEAR implementing my old code yet in the rebuild, still cleaning up Kael's and Firaxis's code to be better optimized (hopefully) now that I understand how to do so and am willing to invest the time (when I have it to invest)

All of the code is in the DLL, and it isn't a matter of typos (the compiler catches those, except when you typo into another variable which would be legal there), but rather of either omissions, or format/concept issues. It'd be something you have to study fairly well first, THEN get lucky looking at the code (it is only fragmented into about 70 different locations, and each one looks almost the same as all of the others, leading to "road blindness" very quickly...)
 
actually the worst problems are kind of typos. Some 2D dynamic arrays in the building section where i and j was exchanged, leading to the million of points specialists give, etc. I fixed the bugs that stopped me from making modules, but there is lots of questionable stuff around.

events: don't work modular at all. You get really weird errors here. Not a big deal as modules rarely use this.

readpass3 seems odd too. I doubt they have tested it much in WoC. I wonder if copynondefault works here at all.

On the other hand, in RoM they seems to use lots of modular modmods. So either they don't use fancy tags, only add thigs rather than changing it, or there are some SDK changes (which I doubt, but haven't looked at it)
 
My pass3 is rather different from the basic WoCLite pass3, mostly because I have more complicated pass3 tags in most places, but also because I didn't think that their pass3 looked like it would work properly. I had tested it when rewriting it though, so for at least one file it works (can't recall which I tested with though)
 
Did you test the copynondefault? I only tested one readpass3 tag so far, but it didn't work. Prereqciv (which is similar to upgradeciv in unitinfos) for Gilden in unitinfos is set to CIVILIZATION_LJOSALFAR, in the module modifiying Gilden it isn't listed. The game loads NO_CIVILIZATION for Gilden. If I add CIVILIZATION_LJOSALFAR to the module the game loads the value CIVILIZATION_LJOSALFAR for Gilden.

I debugged readpass3 and CIVILIZATION_LJOSALFAR shows up in the array used for the pushback only if it is listed in the module.
 
might as well post the sourcecode, maybe you can spot the problem.

Code:
//XML LOAD
	pXML->GetChildXmlValByName(szTextVal, "PrereqCiv","NO_CIVILIZATION");
    m_aszExtraXML1forPass3.push_back(szTextVal);
//READPASS3
	iSize = m_aszExtraXML1forPass3.size();
	for ( int i = 0; i < iSize; i++ )
	{
		if ( GC.getInfoTypeForString(m_aszExtraXML1forPass3[i], true) != -1)
		{
            m_iPrereqCiv = GC.getInfoTypeForString(m_aszExtraXML1forPass3[i]);
			break;
		}
	}
	m_aszExtraXML1forPass3.clear();
//copynondefaults
	for ( int i = 0; i < pClassInfo->getPrereqCivVectorSize(); i++ )
	{
		m_aszExtraXML1forPass3.push_back(pClassInfo->getPrereqCivVectorElement(i));
	}
 
Ok, so while reading it picks up the text key and tacks it on at the end of the list (which is empty as I don't re-use the list, so there is now one entry)

Next would be the CND, if the pClassInfo held any data for this tag (which it will, since NO_CIVILIZATION is loaded if tag is excluded), then whatever it holds is placed at the END of the list. So whatever was in the module (last loaded) will always be listed first.

Final is the pass3 to translate it. This will go through the list and load the first entry it finds which is NOT NO_CIVILIZATION, thus the LAST module loaded which was non-blank (or the original file if all modules were blank).

Potential issue: What is that True for in the IF (getInfo) check? Is that giving false non-negatives? I should do a temp variable which stores the integer for getInfoType, and then check in the IF that the temp variable is not -1.

Other potential issue: Pretty sure that m_iPrereqCiv has a default of -1 when the info class is built, but if not, then it ought to store a -1 here in the case of all fields in the list being NO_CIVILIZATION.


So it looks like it OUGHT to work. That true in the IF check could cause some issues, I have a vague recollection of that either ignoring a silly assert, or allowing new items to be added. The second makes little sense, but would cause issues if it is the accurate memory.

EDIT: Correction: there is no break; in the IF check, so what you will keep is the last actual entry in the list, thus the original XML or the first module which was loaded with the field filled. That needs fixed.

You could also tell CND not to use the pushback command on any entry which == NO_CIVILIZATION
 
I checked and prereqciv is initialized as -1
Don't think it is the true.
Code:
int CvGlobals::getInfoTypeForString(const char* szType, bool hideAssert) const
	{
	FAssertMsg(szType, "null info type string");
	InfosMap::const_iterator it = m_infosMap.find(szType);
	if (it!=m_infosMap.end())
	{
		return it->second;
	}

	if(!hideAssert)
	{
		CvString szError;
		szError.Format("info type %s not found, Current XML file is: %s", szType, GC.getCurrentXMLFile().GetCString());
		FAssertMsg(strcmp(szType, "NONE")==0 || strcmp(szType, "")==0, szError.c_str());
		gDLL->logMsg("xml.log", szError);
	}

	return -1;
}
 
Editted previous post, re-read it after getting Xien to sleep and noticed something. Looks like my first memory was right about the purpose of the true. Ought to be false there anyway just to help XML only modders in case they make a typo.
 
events: don't work modular at all. You get really weird errors here. Not a big deal as modules rarely use this.

They must work somewhat. I disable the "Goblins permanently damage your territory" event and raise the cost of the prophets to 250:gold:. As far as I can tell, it works flawlessly.

Once I added the option to clean up the damage caused by the goblins for 50:gold: and that worked too.
 
Hmm. Trying to allow promotions to affect buildorders, but I can't tell if it should be done in CvPlayer::CanBuild or CvUnit::CanBuild?

CvUnit. In CvPlayer it is mostly just checking for Technologies and other things which are a quick way to eliminate the check for a lot of orders and make things faster. Once that has been checked, then the unit itself is checked (pretty sure you'll find that the CvPlayer one is called at the start of the CvUnit one actually)
 
They must work somewhat. I disable the "Goblins permanently damage your territory" event and raise the cost of the prophets to 250:gold:. As far as I can tell, it works flawlessly.

Once I added the option to clean up the damage caused by the goblins for 50:gold: and that worked too.

you are correct, I should have been more accurate. When making events modular, a lot can go wrong. When I added the MoreEventsMod as a Module, I had errors all over the place. I only had to move the new events and triggers to the base files and the errors were completly gone.
 
Back
Top Bottom