Bugs!!!

Status
Not open for further replies.
Just some things I spotted, not sure if any of them are causing problems or not...


In CvUnit.cpp, around line 609...

Code:
// ELM / Warhammer Mod / 12th August 2006
    // Animosity
    CyUnit* pyUnit = new CyUnit(this);

    CyArgsList pyArgs;
    pyArgs.add(gDLL->getPythonIFace()->makePythonObject(pyUnit));
    gDLL->getEventReporterIFace()->genericEvent("endUnitTurn", pyArgs.makeFunctionArgs());
    //ELM End

Don't forget to:

Code:
delete pyUnit;

afterwords! Otherwise, the pointer variable is deleted when it goes out of scope and the memory is leaked. You might want to check any other events you've created, just in case.

---

I am getting a ton of Assertion failures over anyplace where there's a check for UNITAI types. This is probably from Spellbook and Wizard being added to the list of UNITAI types in CvEnums. Anywhere where there's:

Code:
switch (AI_getUnitAIType())

and no mention of the new types it hits it's default case and throws an assert, which although shouldn't do anything bad it annoys me since it pops up the assertion 20-some times every turn, and I'm not one to ignore assertions :P

---

When checking for promotions ( the Animosity.py, around line 175) there are a few getInfoTypeForString messages that are sometimes having an empty string passed in, throwing an assert. Perhaps you can make sure that the strings returned from getProtagonist1, 2, & 3 are not empty before calling getInfoTypeForString? Otherwise, that function is being called many times without it needing to be (and each time throwing an assertion... I stopped counting after 200 :P)

---


The assertion error is being thrown on CvUnit.cpp 9959 (CvUnit::animosityAttack).

Code:
FAssert(canMoveInto(pPlot, true, false, true));

The reason the unit couldn't move into the plot is because the pCurrPlot and pPlot were the same plot. When you check for if the plot's valid in python, are you checking to make sure that the plots aren't the same?
 
When checking for promotions ( the Animosity.py, around line 175) there are a few getInfoTypeForString messages that are sometimes having an empty string passed in, throwing an assert. Perhaps you can make sure that the strings returned from getProtagonist1, 2, & 3 are not empty before calling getInfoTypeForString? Otherwise, that function is being called many times without it needing to be (and each time throwing an assertion... I stopped counting after 200 :P)

Ahhh, your right. The check was there when I was only using one tag but because I put the new check on 3 tags in a new function, I forgot the content check.

delete pyUnit;
Hmm, I thought about this, but because I was using a cut&paste from another part of the code which didn't delete the pointer anywhere in the funciton, I thought "I'll leave it for now, just in case, and come back to it". Obviously I never came back to it ...... I'll change it in the next code change I do. Oh, and it's the only event I created so it will be the only place that needs it.
 
Gerikes said:
Do you remember where this was that you C&P'ed from?

Sorry about the incredibly late reply. It's not actually a true cut & paste but used the structure from updateCombat but know I noticed it used a Struct not a class, which maybe why it was never deleted... so I've added the delete to the warlords version that I'm currently testing.
 
I should be able to build 'woodland cottages' according to the techtree, but I cannot.
Are those treehouses for woodelves only (missing woodelf only note) or is this a true bug?
 
Status
Not open for further replies.
Back
Top Bottom