Hydromancerx
C2C Modder
Updates
- Added Orphanage, Hostel, Almshouse, Meal Center and National Medical Database.
- Added Orphanage, Hostel, Almshouse, Meal Center and National Medical Database.
Updates:
-Added the Ecologist and the Park Ranger
-Added AI for aforementioned units.
Note that the AI for these is quick and dirty, it will basically keep them from suiciding on enemy units.
The Park Ranger is frozen and the Ecologist has a red ball.
Updates:
-Added the Ecologist and the Park Ranger
-Added AI for aforementioned units.
Note that the AI for these is quick and dirty, it will basically keep them from suiciding on enemy units.
if ( canDefend() && group()->getNumUnits() == 1 )
{
...
}
...and it almost certainly breaks the AI for normal workers. Normal workers detect danger and get an escort before continuing. Once they have an escort they get on with whatever they wan to do. The changes you made will cause them to retreat to a city once their escort arrives! (at which point group()->canDefend() will be true).
Edit:
Without passing comment on the danger checks you are making (why the difference between in and out of border checks?), you could restrict your new clauses to only affecting combat workers (defend as anything that can defend itself and uses the worker AI by putting it inside:
Code:if ( canDefend() && group()->getNumUnits() == 1 ) { ... }
HELP RAGE QUIT!!!!
Ok so I've done X6 of the audio/text quotes in the text tree but it just won't commit. Its driving me insane for 12 hours! This is the error I get is:
Oh. I thought that by including the canDefend clause I was shielding that code from affecting normal workers. I'll change it that way, but I'd like to understand for future reference what I did wrong.
Also, the in and out of border checks were because I figure that if you are threatened in your borders the level of threat needs to be greater to actually do something, as there are a lot of friendly forces in the area normally when you are in your borders. I made it so that a worker outside of the borders tries to retreat to a city at ANY threat, and a worker in borders only retreats if it's victory odds are 80% or less.
CvSelectionGroup::canDefend() checks if any member of the group can defend. CvUnit::canDefend() checks if THIS unit can defend. In the case a regular worker has been joined by an escort the group will be able to defend, but the unit won't, so a call (from a CvUnitAI method) to canDefend () checks e worker itself, whereas a call to group()->canDefend() checks the entire group. The check for numUnits() == 1 is just belt and braces, and probably not ally actually needed now I think about it.