我有一个非常奇怪的错误。我有一个 int 类型的对象属性,称为 currentState
这是声明
class WorkerAgent : public BaseAgent {
private:
int currentState;
下面的代码在游戏的循环中运行了很多次,但有时(在随机时间)代码会在行 (270)
*OBS: currentState 在运行这行代码时已经初始化(270)!
if (currentState == REPAIRING) {
if (!unit->isRepairing()) {
setState(GATHER_MINERALS);
BaseAgent* base = AgentManager::getInstance()->getClosestBase(unit->getTilePosition());
if (base != NULL) {
unit->rightClick(base->getUnit());
return;
}
} else {
return;
}
}
int cur = currentState; // (line 270)
bool b = cur == FIND_BUILDSPOT;
我有一个 EXCEPTION_ACCESS_VIOLATION 并且程序 chashes.. 我不知道会发生什么,因为currentState
也不是指针cur
错误
VERSION: 1.16.1.1
BWAPI:
REVISION: 4160
BUILD: RELEASE
ERROR: None
LOCATION: Single Player
MAP: Stepping Stones
(3)Stepping Stones.scm
EXCEPTION: 0xC0000005 EXCEPTION_ACCESS_VIOLATION
FAULT: 0x10044217 BWAPI.dll
REGISTERS:
EDI: 00000140
ESI: 00000003
EBX: 00000000
EDX: C208C483
ECX: 5B46A60C
EAX: 035F0001
EBP: 0018EEE8
EIP: 10044217
ESP: 0018E4C4
STACK:
BWAPI.dll 0x10044217 ----
BWAPI.dll 0x10046C38 ----
BWAPI.dll 0x10047A43 ----
BWAPI.dll 0x100408C6 ----
DUMB.DLL 0x5B4254A0 WorkerAgent::computeActions
d:\programming\mestrado\bots\dumb\bthaimodule\source\workeragent.cpp:270
关于案件的其他信息,请询问我!我对这个问题感到疯狂!