Sorry about the poor commenting. This is my first mod, and I haven't done any merging yet, so I am blissfully unaware of what coding style makes things easier for merging. I tried to enclose multi-line changes in the code with //Super Forts begin ... //Super Forts end. If a change was only a single line with perhaps some brackets then I just put a single //Super Forts comment.
It's mostly fine, I think there were two instances of new code with just one comment above, and one had new brackets without any comments, with the closing one being in a later part of original code, that was the confusing part.
Is there a tutorial somewhere to help me improve my commenting? or perhaps a mod that is a good example of proper commenting? I have RevDCM and FFH2 downloaded and could look at their code if one of them is a good example.
You can do use the big, clear blocks that RevDCM & its modcomps have, or use the concise begin... end comments, doesn't really matter. I'd just make sure that if it's not within a block of new code, then every line, including single curly brackets, are clearly marked as part of the mod.
BTW I think stuff like ePlayer = getOwnerINLINE() is redundant since it's just replaced with m_eOwner anyway
I probably need to add calls to the function that determines if a unit should defend a fort in more of the AI types. I believe only CITY_DEFENSE and RESERVE currently call it, and that was how it already was in the vanilla code. It would probably also be simple for me to tweak the AI so that if a unit is the only one defending a fort it will not leave its post.
When I was play testing, the AI was poor at defending forts in the early game when they had fewer units, but after they had built up their units in cities they put plenty of defenders in forts. For example, I razed a city next to some iron, and planned on building a fort on the iron. However, one of the other AI players built a fort on the iron before I could, and then promptly put 4 units in the fort to protect it.
I think it makes sense for just these two UNITAIs to be used to defend forts. It's possible that there's just a deficit of defenders in my scenario, although many forts remain empty throughout the game. I've also seen stuff like, AI putting 4 good defensive units in one fort, while leaving other naked.
The biggest problem is no capturing right now, although iCulture=0 eventually produces satisfactory borders since it makes flipping of undefended forts much easier.
As a side-note, I'm also using Influence Driven War, which goes well with this modcomp, but with iCulture=0 it can take away that 1 point of static culture, making "holes" in fort borders. I fixed that by using iCulture=1 but with a maximum of 10 culture / plot. Another way would be to simply make sure that 1 point of static culture is re-added every turn, if it's not there.
I also noticed forts are disappearing sometimes, even though they are placed in locations where nothing else can be built. I'm wondering how is that even possible... Considering that forts are now owned, it'd mean the AI is pillaging its own forts for some reason.