| 349 | } |
| 350 | |
| 351 | bool CodeBlock::read(StringTableEntry fileName, Stream &st) |
| 352 | { |
| 353 | const StringTableEntry exePath = Platform::getMainDotCsDir(); |
| 354 | const StringTableEntry cwd = Platform::getCurrentDirectory(); |
| 355 | |
| 356 | name = fileName; |
| 357 | |
| 358 | if (fileName) |
| 359 | { |
| 360 | fullPath = NULL; |
| 361 | |
| 362 | if (Platform::isFullPath(fileName)) |
| 363 | fullPath = fileName; |
| 364 | |
| 365 | if (dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) |
| 366 | name = StringTable->insert(fileName + dStrlen(exePath) + 1, true); |
| 367 | else if (dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) |
| 368 | name = StringTable->insert(fileName + dStrlen(cwd) + 1, true); |
| 369 | |
| 370 | if (fullPath == NULL) |
| 371 | { |
| 372 | char buf[1024]; |
| 373 | fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true); |
| 374 | } |
| 375 | |
| 376 | modPath = Con::getModNameFromPath(fileName); |
| 377 | } |
| 378 | |
| 379 | // |
| 380 | addToCodeList(); |
| 381 | |
| 382 | U32 globalSize, size, i; |
| 383 | st.read(&size); |
| 384 | if (size) |
| 385 | { |
| 386 | globalStrings = new char[size]; |
| 387 | globalStringsMaxLen = size; |
| 388 | st.read(size, globalStrings); |
| 389 | } |
| 390 | globalSize = size; |
| 391 | st.read(&size); |
| 392 | if (size) |
| 393 | { |
| 394 | functionStrings = new char[size]; |
| 395 | functionStringsMaxLen = size; |
| 396 | st.read(size, functionStrings); |
| 397 | } |
| 398 | st.read(&size); |
| 399 | if (size) |
| 400 | { |
| 401 | globalFloats = new F64[size]; |
| 402 | for (i = 0; i < size; i++) |
| 403 | st.read(&globalFloats[i]); |
| 404 | } |
| 405 | st.read(&size); |
| 406 | if (size) |
| 407 | { |
| 408 | functionFloats = new F64[size]; |
no test coverage detected