diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-01-09 14:44:31 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-01-09 14:44:31 -0500 |
| commit | b76e309166f714b0a66fb4802f02e92a82d09082 (patch) | |
| tree | 44244fc0e6f873e1ccf6e1e95e2fec62fcec394a /src/project.cpp | |
| parent | b04fefe8ee0086bc1404c06b8351ecb4e942f151 (diff) | |
flatten file structure + rename
Diffstat (limited to 'src/project.cpp')
| -rw-r--r-- | src/project.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/project.cpp b/src/project.cpp index 1c5572d..48c511b 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -120,7 +120,7 @@ void Proj_SerializeAsset(std::ofstream &stream, const Asset &asset) { /* void Proj_ParseProjectSettings(std::ifstream &stream) { - while (stream.getline(projReadLine, projReadLineLength)) { + while (memset(projReadLine, 0, projReadLineLength), stream.getline(projReadLine, projReadLineLength)) { if (strcmp(PKE_PROJ_FILE_OBJ_END, projReadLine) == 0) { return; } @@ -135,7 +135,7 @@ void Proj_ParseProjectSettings(std::ifstream &stream) { } if (strncmp(projReadLine, PKE_PROJ_FILE_PROJ_SETTINGS_SCENES_BEGIN, strlen(PKE_PROJ_FILE_PROJ_SETTINGS_SCENES_BEGIN)) == 0) { DynArray<pkstr> sceneFiles{16}; - while (stream.getline(projReadLine, projReadLineLength)) { + while (memset(projReadLine, 0, projReadLineLength), stream.getline(projReadLine, projReadLineLength)) { if (strcmp(PKE_PROJ_FILE_PROJ_SETTINGS_SCENES_END, projReadLine) == 0) { pkeProjectSettings.sceneCount = sceneFiles.Count(); pkeProjectSettings.scenes = pk_new<cpkstr>(sceneFiles.Count()); @@ -163,7 +163,7 @@ void Proj_ParseEntityType(std::ifstream &stream) { createInstanceSig[0] = '\0'; EntityType et{}; int64_t detailCount = 0; - while (stream.getline(projReadLine, projReadLineLength)) { + while (memset(projReadLine, 0, projReadLineLength), stream.getline(projReadLine, projReadLineLength)) { if (strcmp(PKE_PROJ_FILE_OBJ_END, projReadLine) == 0) { EntityType *existingPtr = EntityType_FindByTypeCode(et.entityTypeCode.val); if (existingPtr != nullptr) { @@ -212,8 +212,9 @@ void Proj_ParseEntityType(std::ifstream &stream) { if (strstr(projReadLine, PKE_PROJ_FILE_ENTITY_TYPE_ENTITY_HANDLE)) { uint64_t prefixLen = strlen(PKE_PROJ_FILE_ENTITY_TYPE_ENTITY_HANDLE); // 0x00000000 0x00000000 - STR2NUM_ERROR result1 = str2num(et.handle.bucketIndex, projReadLine + prefixLen); - STR2NUM_ERROR result2 = str2num(et.handle.itemIndex, projReadLine + prefixLen + 11); + projReadLine[prefixLen + 10] = '\0'; + STR2NUM_ERROR result1 = str2num(et.handle.bucketIndex, projReadLine + prefixLen + 2, 16); + STR2NUM_ERROR result2 = str2num(et.handle.itemIndex, projReadLine + prefixLen + 11, 16); assert(result1 == STR2NUM_ERROR::SUCCESS); assert(result2 == STR2NUM_ERROR::SUCCESS); continue; @@ -225,7 +226,7 @@ void Proj_ParseEntityType(std::ifstream &stream) { } if (strstr(projReadLine, PKE_PROJ_FILE_ENTITY_TYPE_DETAILS_BEGIN)) { EntityTypeDetails &etd = et.details[detailCount]; - while (stream.getline(projReadLine, projReadLineLength)) { + while (memset(projReadLine, 0, projReadLineLength), stream.getline(projReadLine, projReadLineLength)) { if (strstr(projReadLine, PKE_PROJ_FILE_ENTITY_TYPE_DETAILS_END)) { detailCount += 1; break; @@ -281,7 +282,7 @@ void Proj_ParseAssset(std::ifstream &stream) { basePath[0] = '\0'; basePath[255] = '\0'; AssetType at{PKE_ASSET_TYPE_UNSET}; - while (stream.getline(projReadLine, projReadLineLength)) { + while (memset(projReadLine, 0, projReadLineLength), stream.getline(projReadLine, projReadLineLength)) { if (strcmp(projReadLine, PKE_PROJ_FILE_OBJ_END) == 0) { AM_Register(keyStr, at, basePath); return; @@ -317,7 +318,7 @@ void PkeProject_Load(const char *filePath) { } memset(projReadLine, '\0', projReadLineLength); - while (f.getline(projReadLine, projReadLineLength)) { + while (memset(projReadLine, 0, projReadLineLength), f.getline(projReadLine, projReadLineLength)) { /* if (strcmp(PKE_PROJ_FILE_OBJ_PROJECT_SETTINGS, projReadLine) == 0) { Proj_ParseProjectSettings(f); |
