summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-26 01:13:33 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-26 01:13:33 (GMT)
commit9e1be78bc21d1fb76a19ce12ef36193aea6e2b93 (patch)
tree081b67d551bb44fecbf6deb99b6c44ea9789614c /src/simulation
parentb2d3257ae944a3ea3b57dc8ee4171b1b2f85483e (diff)
downloadpowder-9e1be78bc21d1fb76a19ce12ef36193aea6e2b93.zip
powder-9e1be78bc21d1fb76a19ce12ef36193aea6e2b93.tar.gz
I've got to a point where I can no longer be bothered to think of a proper commit comment
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/SaveLoader.cpp38
-rw-r--r--src/simulation/SaveLoader.h23
-rw-r--r--src/simulation/Simulation.cpp11
-rw-r--r--src/simulation/Simulation.h4
4 files changed, 75 insertions, 1 deletions
diff --git a/src/simulation/SaveLoader.cpp b/src/simulation/SaveLoader.cpp
new file mode 100644
index 0000000..350b54a
--- /dev/null
+++ b/src/simulation/SaveLoader.cpp
@@ -0,0 +1,38 @@
+/*
+ * SaveLoader.cpp
+ *
+ * Created on: Jan 26, 2012
+ * Author: Simon
+ */
+
+#include "SaveLoader.h"
+
+int SaveLoader::LoadSave(unsigned char * data, int dataLength, Simulation * sim)
+{
+ return 0;
+}
+
+unsigned char * SaveLoader::BuildSave(int & dataLength, Simulation * sim)
+{
+ return 0;
+}
+
+int SaveLoader::OPSLoadSave(unsigned char * data, int dataLength, Simulation * sim)
+{
+ return 0;
+}
+
+unsigned char * SaveLoader::OPSBuildSave(int & dataLength, Simulation * sim)
+{
+ return 0;
+}
+
+int SaveLoader::PSVLoadSave(unsigned char * data, int dataLength, Simulation * sim)
+{
+ return 0;
+}
+
+unsigned char * PSVBuildSave(int & dataLength, Simulation * sim)
+{
+ return 0;
+}
diff --git a/src/simulation/SaveLoader.h b/src/simulation/SaveLoader.h
new file mode 100644
index 0000000..e517a2b
--- /dev/null
+++ b/src/simulation/SaveLoader.h
@@ -0,0 +1,23 @@
+/*
+ * SaveLoader.h
+ *
+ * Created on: Jan 26, 2012
+ * Author: Simon
+ */
+
+#ifndef SAVELOADER_H_
+#define SAVELOADER_H_
+
+#include "Simulation.h"
+
+class SaveLoader {
+public:
+ static int LoadSave(unsigned char * data, int dataLength, Simulation * sim);
+ static unsigned char * BuildSave(int & dataLength, Simulation * sim);
+ static int OPSLoadSave(unsigned char * data, int dataLength, Simulation * sim);
+ static unsigned char * OPSBuildSave(int & dataLength, Simulation * sim);
+ static int PSVLoadSave(unsigned char * data, int dataLength, Simulation * sim);
+ static unsigned char * PSVBuildSave(int & dataLength, Simulation * sim);
+};
+
+#endif /* SAVELOADER_H_ */
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 243b903..8932863 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -6,6 +6,17 @@
#include "ElementFunctions.h"
#include "Air.h"
#include "Gravity.h"
+#include "SaveLoader.h"
+
+int Simulation::Load(unsigned char * data, int dataLength)
+{
+ return SaveLoader::LoadSave(data, dataLength, this);
+}
+
+unsigned char * Simulation::Save(int & dataLength)
+{
+ return SaveLoader::BuildSave(dataLength, this);
+}
void Simulation::clear_area(int area_x, int area_y, int area_w, int area_h)
{
diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h
index c36a18f..8a1ed16 100644
--- a/src/simulation/Simulation.h
+++ b/src/simulation/Simulation.h
@@ -204,7 +204,9 @@ public:
int sandcolour_r;
int sandcolour_g;
int sandcolour_b; //TODO: Make a single variable
- //Stuff
+ //TODO: Inlines for performance
+ int Load(unsigned char * data, int dataLength);
+ unsigned char * Save(int & dataLength);
int is_blocking(int t, int x, int y);
int is_boundary(int pt, int x, int y);
int find_next_boundary(int pt, int *x, int *y, int dm, int *em);