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