project_files/frontlib/ipc/gameconn.c
changeset 7271 5608ac657362
parent 7234 613998625a3c
child 7275 15f722e0b96f
--- a/project_files/frontlib/ipc/gameconn.c	Thu Jun 21 21:32:12 2012 +0200
+++ b/project_files/frontlib/ipc/gameconn.c	Mon Jun 25 00:42:07 2012 +0200
@@ -85,7 +85,7 @@
 	return result;
 }
 
-flib_gameconn *flib_gameconn_create(const char *playerName, flib_gamesetup *setup, bool netgame) {
+flib_gameconn *flib_gameconn_create(const char *playerName, const flib_gamesetup *setup, bool netgame) {
 	flib_gameconn *result = NULL;
 	flib_gameconn *tempConn = flib_gameconn_create_partial(true, playerName, netgame);
 	if(tempConn) {
@@ -124,6 +124,22 @@
 	return result;
 }
 
+flib_gameconn *flib_gameconn_create_campaign(const char *playerName, const char *seed, const char *script) {
+	flib_gameconn *result = NULL;
+	flib_gameconn *tempConn = flib_gameconn_create_partial(true, playerName, false);
+	if(tempConn) {
+		if(!flib_ipc_append_message(tempConn->configBuffer, "TL")
+				&& !flib_ipc_append_seed(tempConn->configBuffer, seed)
+				&& !flib_ipc_append_script(tempConn->configBuffer, script)
+				&& !flib_ipc_append_message(tempConn->configBuffer, "!")) {
+			result = tempConn;
+			tempConn = NULL;
+		}
+	}
+	flib_gameconn_destroy(tempConn);
+	return result;
+}
+
 void flib_gameconn_destroy(flib_gameconn *conn) {
 	if(conn) {
 		if(conn->running) {