| 230 | } |
| 231 | |
| 232 | void aithread::saveDebug(const char prefix, int iOpcode, const char *pszFormat, ...) |
| 233 | { |
| 234 | if ( retryBlock ) |
| 235 | return; |
| 236 | |
| 237 | char szFinalBuffer[512]; |
| 238 | char szBuffer[256]; |
| 239 | |
| 240 | szFinalBuffer[0] = 0; |
| 241 | szBuffer[0] = 0; |
| 242 | |
| 243 | if ( pszFormat ) |
| 244 | { |
| 245 | va_list ap; |
| 246 | va_start(ap, pszFormat); |
| 247 | vsnprintf_s(szBuffer, 256, 256, pszFormat, ap); |
| 248 | va_end(ap); |
| 249 | } |
| 250 | sprintf_s(szFinalBuffer, 512, "%c%s %s", prefix, AISCRIPT::getOpcodeName(iOpcode), szBuffer); |
| 251 | |
| 252 | char *tmp = (char*)malloc(strlen(szFinalBuffer)+1); |
| 253 | strcpy_s(tmp, strlen(szFinalBuffer)+1, szFinalBuffer); |
| 254 | |
| 255 | if ( this->debugQueue.size() > 32 ) |
| 256 | { |
| 257 | char *front = this->debugQueue.front(); |
| 258 | free(front); |
| 259 | this->debugQueue.pop_front(); |
| 260 | } |
| 261 | this->debugQueue.push_back(tmp); |
| 262 | } |
| 263 | bool aithread::retry() |
| 264 | { |
| 265 | this->dwScriptOffset -= this->dwBytesRead; |