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 /include/world.h | |
parent | f2886601e15f41938c6735feb552e831ffeeefc1 (diff) |
world save/load
Diffstat (limited to 'include/world.h')
-rw-r--r-- | include/world.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/include/world.h b/include/world.h index 81ec335..e3c7f15 100644 --- a/include/world.h +++ b/include/world.h @@ -4,9 +4,11 @@ #include <common.h> // For HLINE, vec2, OpenGL utilities, etc. #include <entities.h> -typedef struct { - vec2 p1,p2; -} __attribute__ ((packed)) Platform; +struct line_t { + bool gs; + float y,gh[2]; + unsigned char color; +} __attribute__ ((packed)); /* * World - creates and handles an area of land @@ -27,11 +29,7 @@ protected: * */ - struct line_t { - bool gs; - float y,gh[2]; - unsigned char color; - } __attribute__ ((packed)) *line; + struct line_t *line; /* * Keeps a dynamically allocated array of platforms in the world. @@ -132,6 +130,20 @@ public: */ int getTheWidth(void); + + /* + * Stores all of this class's contents in a string for saving to a file. This array should + * be freed after being written to a file. + */ + + char *save(unsigned int *ssize); + + /* + * Loads a previous world's contents (from save()) into this one. + */ + + void load(char *buf); + }; /* |