Skip to content

Commit

Permalink
autosave to prevent MAPBUFFER from growing to big
Browse files Browse the repository at this point in the history
  • Loading branch information
marius committed Dec 13, 2022
1 parent 9efefb9 commit 9b2f5e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12033,6 +12033,13 @@ void game::update_map( player &p )
int x = p.posx();
int y = p.posy();
update_map( x, y );
#ifdef __3DS__
// due to limited RAM we have to "unload" unused submaps. saving will do that for now.
if(MAPBUFFER.size() >= 200) {
printf("3DS: Reduce MAPBUFFER %d\n", MAPBUFFER.size());
quicksave();
}
#endif
}

point game::update_map( int &x, int &y )
Expand Down
6 changes: 6 additions & 0 deletions src/mapbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ class mapbuffer
inline submap_map_t::iterator end() {
return submaps.end();
}
#ifdef __3DS__
// only used in 3DS build
inline int size() {
return submaps.size();
}
#endif

private:
// There's a very good reason this is private,
Expand Down

0 comments on commit 9b2f5e6

Please sign in to comment.