summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 6ce4847..f464c41 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -192,13 +192,13 @@ void ParseInstance(std::ifstream &stream) {
char entTypeCode[21];
memset(reinterpret_cast<void *>(entTypeCode), '\0', 21);
while (stream.getline(readLine, readLineLength)) {
- if (strcmp(PKE_FILE_OBJ_END, readLine) == 0) {
+ if (strstr(PKE_FILE_OBJ_END, readLine)) {
if (entTypeCode[0] == '\0') {
printf("[Game::ParseInstance] Failed to create instance from save file. No EntTypeCode present.");
break;
}
int64_t existingEntityTypeIndex = EntityType_FindByTypeCode(entTypeCode);
- if (existingEntityTypeIndex != -1) {
+ if (existingEntityTypeIndex == -1) {
printf("[Game::ParseInstance] Failed to create instance from save file. Unknown EntityTypeCode: \"%s\"", entTypeCode);
break;
}
@@ -230,7 +230,7 @@ void ParseInstance(std::ifstream &stream) {
long index = 0;
do {
assert(index < 3);
- STR2NUM_ERROR result = str2num(comp.instPos.scale[index], startingChar, pEnd);
+ STR2NUM_ERROR result = str2num(comp.instPos.pos[index], startingChar, pEnd);
assert(result == STR2NUM_ERROR::SUCCESS);
startingChar = pEnd + 1;
++index;
@@ -245,7 +245,7 @@ void ParseInstance(std::ifstream &stream) {
long index = 0;
do {
assert(index < 4);
- STR2NUM_ERROR result = str2num(comp.instPos.scale[index], startingChar, pEnd);
+ STR2NUM_ERROR result = str2num(comp.instPos.rot[index], startingChar, pEnd);
assert(result == STR2NUM_ERROR::SUCCESS);
startingChar = pEnd + 1;
++index;
@@ -298,6 +298,7 @@ void SaveSceneFile(const char *sceneFilePath) {
const auto &instance = instances[i];
if (instance.entHandle == EntityHandle_MAX)
continue;
+ f << PKE_FILE_OBJ_INSTANCE << std::endl;
SerializeInstance(f, instance);
f << PKE_FILE_OBJ_END << std::endl;
}