fix ai bug

This commit is contained in:
Geoffray Levasseur committed 2026-11-04 14:46:26 +01:00
1 parent a24876cf79
commit a11ce3005c
3 files changed
+11 -2

No files matched your search

+4 -2
View File
@@ -50,8 +50,10 @@ public:
virtual ~CustomAI();
// Attaches the player context handed out by the server at
// cmNewGame/cmLoadGame (TNewGameData.RO[nation]).
void bind(TPlayerContext *playerContext);
// cmNewGame/cmLoadGame (TNewGameData.RO[nation]). Virtual so an AI can
// pick up its persistent data (the original did it in its constructor,
// but here the context only arrives after construction).
virtual void bind(TPlayerContext *playerContext);
// Set once per module from cmInitModule's TInitModuleData.Server; shared
// by every CustomAI instance in this process, matching the original's
+1
View File
@@ -66,6 +66,7 @@ class AI : public Barbarina {
public:
explicit AI(int nation);
void bind(TPlayerContext *playerContext) override;
void setDataDefaults() override;
protected:
+6
View File
@@ -146,6 +146,12 @@ const std::array<int, nAdv> LeaveOutValue = computeLeaveOutValue();
AI::AI(int nation) : Barbarina(nation) {}
void AI::bind(TPlayerContext *playerContext)
{
Barbarina::bind(playerContext);
data = static_cast<TPersistentData *>(ro->Data);
}
void AI::setDataDefaults()
{
data->LastResearchTech = -1;