aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2015-11-06 08:19:46 -0500
committerClyne Sullivan <tullivan99@gmail.com>2015-11-06 08:19:46 -0500
commitcb55d6e72ae1f48622ffc2a36d7bdb3719355afe (patch)
treee38b215d2fc45368a76bf9350138046c38afa946 /main.cpp
parentf2886601e15f41938c6735feb552e831ffeeefc1 (diff)
world save/load
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 30869bf..90b673d 100644
--- a/main.cpp
+++ b/main.cpp
@@ -485,6 +485,15 @@ int main(int argc, char *argv[]){
SDL_GL_DeleteContext(mainGLContext);
SDL_DestroyWindow(window);
+ FILE *worldSave = fopen("world.dat","w");
+ char *worldBuf;
+ unsigned int worldSize;
+ worldBuf=currentWorld->save(&worldSize);
+ std::cout<<worldSize<<" "<<(int)worldBuf<<std::endl;
+ std::cout<<fwrite(worldBuf,1,worldSize,worldSave)<<std::endl;
+ if(ferror(worldSave))perror("HEY: ");
+ fclose(worldSave);
+
return 0; // Calls everything passed to atexit
}