diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-11-06 08:19:46 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-11-06 08:19:46 -0500 |
commit | cb55d6e72ae1f48622ffc2a36d7bdb3719355afe (patch) | |
tree | e38b215d2fc45368a76bf9350138046c38afa946 /main.cpp | |
parent | f2886601e15f41938c6735feb552e831ffeeefc1 (diff) |
world save/load
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 } |