fix ai bug
This commit is contained in:
1 parent
a24876cf79
commit
a11ce3005c
3 files changed
+11
-2
No files matched your search
@@ -50,8 +50,10 @@ public:
|
|||||||
virtual ~CustomAI();
|
virtual ~CustomAI();
|
||||||
|
|
||||||
// Attaches the player context handed out by the server at
|
// Attaches the player context handed out by the server at
|
||||||
// cmNewGame/cmLoadGame (TNewGameData.RO[nation]).
|
// cmNewGame/cmLoadGame (TNewGameData.RO[nation]). Virtual so an AI can
|
||||||
void bind(TPlayerContext *playerContext);
|
// 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
|
// Set once per module from cmInitModule's TInitModuleData.Server; shared
|
||||||
// by every CustomAI instance in this process, matching the original's
|
// by every CustomAI instance in this process, matching the original's
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class AI : public Barbarina {
|
|||||||
public:
|
public:
|
||||||
explicit AI(int nation);
|
explicit AI(int nation);
|
||||||
|
|
||||||
|
void bind(TPlayerContext *playerContext) override;
|
||||||
void setDataDefaults() override;
|
void setDataDefaults() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -146,6 +146,12 @@ const std::array<int, nAdv> LeaveOutValue = computeLeaveOutValue();
|
|||||||
|
|
||||||
AI::AI(int nation) : Barbarina(nation) {}
|
AI::AI(int nation) : Barbarina(nation) {}
|
||||||
|
|
||||||
|
void AI::bind(TPlayerContext *playerContext)
|
||||||
|
{
|
||||||
|
Barbarina::bind(playerContext);
|
||||||
|
data = static_cast<TPersistentData *>(ro->Data);
|
||||||
|
}
|
||||||
|
|
||||||
void AI::setDataDefaults()
|
void AI::setDataDefaults()
|
||||||
{
|
{
|
||||||
data->LastResearchTech = -1;
|
data->LastResearchTech = -1;
|
||||||
|
|||||||
Reference in new issue
Block a user