--- a/project_files/frontlib/model/gamesetup.c Wed Jun 27 22:52:19 2012 +0200
+++ b/project_files/frontlib/model/gamesetup.c Thu Jul 05 00:33:24 2012 +0200
@@ -18,6 +18,7 @@
*/
#include "gamesetup.h"
+#include "../util/util.h"
#include <stdlib.h>
@@ -30,3 +31,25 @@
free(gamesetup);
}
}
+
+flib_gamesetup *flib_gamesetup_copy(flib_gamesetup *setup) {
+ if(!setup) {
+ return NULL;
+ }
+
+ flib_gamesetup *result = flib_calloc(1, sizeof(flib_gamesetup));
+ if(result) {
+ result->script = flib_strdupnull(setup->script);
+ result->gamescheme = flib_cfg_copy(setup->gamescheme);
+ result->map = flib_map_copy(setup->map);
+ result->teamlist = flib_teamlist_copy(setup->teamlist);
+ if((setup->script && !result->script)
+ || (setup->gamescheme && !result->gamescheme)
+ || (setup->map && !result->map)
+ || (setup->teamlist && !result->teamlist)) {
+ flib_gamesetup_destroy(result);
+ result = NULL;
+ }
+ }
+ return result;
+}