1) Same issue as a city, the code to ascertain if a plot is coastal is in the C++ code and there is no Lua override available
2) Many, many places. A city doesn't store if it's coastal or not, it asks the plot every time it needs to know.
3) In theory yes, in practice no. Without the source code for the DLL you're using it's just not worth the weeks of effort it will take.
4) Get yourself a good multi-file search tool (eg Agent Ransack) and search all the .cpp/.h files for "isCoastal"
Hey tanks for your reply
I already found this:
CvCity.h
Line 267 :
bool isCoastal(int iMinWaterSize = -1) const;
CvCity.cpp
Line 6535 :
bool CvCity::isCoastal(int iMinWaterSize) const
{
VALIDATE_OBJECT
return plot()->isCoastalLand(iMinWaterSize);
}
What is the variable int "iMinWatersize" ?
So if i make the IsCoastal function return true, it will make the city coastal ?
EDIT
if I create a first table that contains the ids of the cities (or if it is possible to create a city table, a bit like the units you have their id in the game and their id in the DB, but their id in the game is called Unit and id in the DB Unit ID)
and another which contains bools if the city is coastal or not.
The first table will serve as an index, because I would have to look for the "i" of the city in the index, and this "i" will correspond to the "i" of if the city is coastal.
Then I modified the function, so that if the city is not coastal with the table, it looks if the Plot is coastal, and if when we look in the table, it is coastal then it does not even look at the plot.
EDIT 2
can you explain, in a nutshell, what happens when you call a function via lua, is the function executed in a kind of virtual environment, for example all the variables are recreated for this environment and therefore each city has its environment with it varies. where the function is executed regardless of the city?
for example what makes me ask is this: pPolt:GetImprovementType() in this function pPlot is a variable which represents the plot but how does the code of this function know that it must execute at this plot?