Fix RestoreState for subclass instance vars
parent
48666c4604
commit
397e312424
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include "CBot/CBotStack.h"
|
#include "CBot/CBotStack.h"
|
||||||
|
|
||||||
|
#include "CBot/CBotClass.h"
|
||||||
|
|
||||||
#include "CBot/CBotInstr/CBotFunction.h"
|
#include "CBot/CBotInstr/CBotFunction.h"
|
||||||
|
|
||||||
#include "CBot/CBotVar/CBotVarPointer.h"
|
#include "CBot/CBotVar/CBotVarPointer.h"
|
||||||
|
@ -866,10 +868,11 @@ bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
|
||||||
if (isClass && p == nullptr) // set id for each item in this instance
|
if (isClass && p == nullptr) // set id for each item in this instance
|
||||||
{
|
{
|
||||||
CBotVar* pVars = pNew->GetItemList();
|
CBotVar* pVars = pNew->GetItemList();
|
||||||
long itemId = 1;
|
CBotVar* pv = pNew->GetClass()->GetVar();
|
||||||
while (pVars != nullptr)
|
while (pVars != nullptr && pv != nullptr)
|
||||||
{
|
{
|
||||||
pVars->m_ident = itemId++;
|
pVars->m_ident = pv->m_ident;
|
||||||
|
pv = pv->GetNext();
|
||||||
pVars = pVars->GetNext();
|
pVars = pVars->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue