Asaf
Sleep Deprived
- Joined
- Mar 22, 2010
- Messages
- 1,326
hmm I will look in CvPlot then... Asaf what is "->" is it an object like . in python?
In C++ you can have a variable of a primitive type (int, float, char, ...), a complex type (any class or struct), or a pointer to any of those (there are more, such as reference and some modifiers, but I won't get into this).
A pointer is a variable which holds an address in memory to a certain type.
A pointer variable is defined like this:
Code:
int* pNumber;
CvArea* pArea;
And as you can see, a pointer is actually to data of a certain type.
When you have a non-pointer variable, the access to the members are done the same way you know - with a dot ('.').
When you want to access a member of a pointer, you use the -> operator:
Code:
pArea->getTargetCity();
On a general note, I suggest you learn some of the basics of C++ before, or during reading the code.
Try this site.
Btw, not really sure what to do... Ideally:
each player is given a different value of wanting for each area, areas being cutomly defined (if possible in anyway by 2 sets of coords or something along those lines, if not, then I need someway of defining the areas I need)
...
but currently I am thinking it will not happen like that... though, the Med and Agean, England and America would be the easiest as they would probs be an area anyway
SO... how would I actually get any code to work (not like I have the EventManager.py handy) and how would the above be done using the functions that we know of...
Baldyr's right - you have setArea() for each plot. You can find how it's used in the code.
The initial spreading of areas is not done in the DLL AFAIK - there's CvMap::calculateAreas() which goes over all the plots and calls an exposed method from the exe to do that.
You can add additional code to this function to replace this, if you want.
Apart from Byzantium it doesn't matter much about what city it wants just what areas it wants the most... will it pick the area with the city that it wants the most as it's next target?
I'm not sure, but I think that for each unit it will select the most important city in the area it's in. I don't know where the code is for moving units between areas.