Jean Elcard
The Flavournator
Any dll changes in s?
int aiValues[NUM_CITY_PLOTS];
//FfH: Modified by Kael 02/05/2009
// for (iI = 0; iI < NUM_CITY_PLOTS; iI++)
for (iI = 0; iI < getNumCityPlots(); iI++)
//FfH: End Modify
Merging your changes in Patch T and a couple things popped out at me:
CvCityAI:
You made this change:Code:int aiValues[NUM_CITY_PLOTS]; //FfH: Modified by Kael 02/05/2009 // for (iI = 0; iI < NUM_CITY_PLOTS; iI++) for (iI = 0; iI < getNumCityPlots(); iI++) //FfH: End Modify
But if you look at the first line in the code segment, you are still initializing your array to the global define size. Fortunately your global define is 37 (3 ring), so this isn't a PROBLEM, but it is still a waste of memory space.
Array indexing in python is annoying me right now.
Most all of the Marnok functions use a random selection from a list by getting a random number based on length of the list, then subtracting 1. Random numbers are 0 to (target -1), so by subtracting 1 you are making it impossible to get the last element of the array, and possible to try for a -1 index item.
Except of course that when I removed the -1 entries I later got a python error for being out of bounds...
So, we have Marnok functions for lairs, and even the selection of your elemental for the Tower of Mastery which seem to require a -1. Yet we ALSO have functions like insane which STILL pick from a list in an array, but do NOT require the -1.
What's the deal? How do you know which you need, or why is it working on some and not others?
No, the issue is that they DO work with the -1, and seem to require it. But that makes no sense overall. So I am wondering why it does work, and why only in certain cases.
Unrelated question:
Barbarian units can be blocked from targetting our cities by blocking chokepoints with units, ANY units. I see 2 solutions:
First:
Change
if (AI_targetCity())
to
if (AI_targetCity(MOVE_THROUGH_ENEMY | MOVE_IGNORE_DANGER))
The function allows you to pass in flags, but from what I see, nothing DOES pass any in for unit moves really. However, the actual path generation function is in the exe (which sucks since I would like to teach the AI to consider AutoAcquire Promotions when moving...)
The other option would be: CvUnitAI::AI_solveBlockageProblem
This function is not called by the Barbarians, and I haven't had time to completely pick it apart and see if it does what I think it ought to just yet. But it would seem that it is intended to clear chokepoint blocks, along with declaring war if neccessary to pass through someone's land.
You can't effectively write a wrapper because nobody outside of Firaxis has the sourcecode for the EXE, and re-writing the pathing algorithms would be a massive PITA.
<rant>Array indexing in python is annoying me right now.
Most all of the Marnok functions use a random selection from a list by getting a random number based on length of the list, then subtracting 1. Random numbers are 0 to (target -1), so by subtracting 1 you are making it impossible to get the last element of the array, and possible to try for a -1 index item.
Except of course that when I removed the -1 entries I later got a python error for being out of bounds...
sMonster = lList[CyGame().getSorenRandNum(len(lList), "Pick Monster")-1]
sMonster = lList[CyGame().getSorenRandNum(len(lList)-1, "Pick Monster")]