I was trying to move a human unit in the game using code.
I can now move a unit in the game, but the game crashes the next turn. I have the following code in the ctpai.cpp file in the BeginTurn method:
Once the first settler moves, I can move the second settler, it then allows me to move the first settler again (I am guessing it does not recognise the move which happened due to code). In the next turn, it gives me an Assertion failure
Program: CivCTP_dgb.exe
File:gameobj/objpool.h
line:93
If I ignore this error, it gives me another failure, then gives me a Gameobj.cpp Error, then gives me another assertion failure and then the game exits.
What I think is that I am not updating some game state information and hence the is some synchronization problem the next turn. Can someone please let me know what am I doing wrong/what else I need to do to move a unit?
Thanks
Cheers,
Ushhan
For backgroud information about my work, please have a look at the CTPII GameState Information thread in this section
I can now move a unit in the game, but the game crashes the next turn. I have the following code in the ctpai.cpp file in the BeginTurn method:
Code:
if (player_ptr != NULL && player_ptr->m_playerType == PLAYER_TYPE_HUMAN) { if (round >= 3) { a = player_ptr->m_all_armies->Access(0); for (int dir = 0; !found && (dir < NOWHERE); ++dir) { MapPoint dest; if (pos.GetNeighborPosition (static_cast(dir), dest) && a.CanEnter(dest)) { Path * tmpPath = new Path; tmpPath->SetStart(pos); tmpPath->AddDir(static_cast(dir)); tmpPath->Start(pos); g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_MoveOrder, GEA_Army, a, GEA_Path, tmpPath, GEA_MapPoint, dest, GEA_Int, FALSE, GEA_End ); found = true; } } } }
Program: CivCTP_dgb.exe
File:gameobj/objpool.h
line:93
If I ignore this error, it gives me another failure, then gives me a Gameobj.cpp Error, then gives me another assertion failure and then the game exits.
What I think is that I am not updating some game state information and hence the is some synchronization problem the next turn. Can someone please let me know what am I doing wrong/what else I need to do to move a unit?
Thanks
Cheers,
Ushhan
For backgroud information about my work, please have a look at the CTPII GameState Information thread in this section
Comment