project_files/frontlib/ipc/ipcprotocol.c
changeset 7271 5608ac657362
parent 7230 240620f46dd7
child 7275 15f722e0b96f
--- a/project_files/frontlib/ipc/ipcprotocol.c	Thu Jun 21 21:32:12 2012 +0200
+++ b/project_files/frontlib/ipc/ipcprotocol.c	Mon Jun 25 00:42:07 2012 +0200
@@ -48,11 +48,22 @@
 		bool error = false;
 
 		if(map->mapgen == MAPGEN_NAMED) {
-			error |= flib_ipc_append_message(tempvector, "emap %s", map->name);
+			if(map->name) {
+				error |= flib_ipc_append_message(tempvector, "emap %s", map->name);
+			} else {
+				flib_log_e("Missing map name");
+				error = true;
+			}
 		}
 		if(map->theme && !mappreview) {
-			error |= flib_ipc_append_message(tempvector, "etheme %s", map->theme);
+			if(map->theme) {
+				error |= flib_ipc_append_message(tempvector, "etheme %s", map->theme);
+			} else {
+				flib_log_e("Missing map theme");
+				error = true;
+			}
 		}
+		error |= flib_ipc_append_seed(tempvector, map->seed);
 		error |= flib_ipc_append_message(tempvector, "e$template_filter %i", map->templateFilter);
 		error |= flib_ipc_append_message(tempvector, "e$mapgen %i", map->mapgen);
 
@@ -97,6 +108,15 @@
 	}
 }
 
+int flib_ipc_append_script(flib_vector *vec, const char *script) {
+	if(!vec || !script) {
+		flib_log_e("null parameter in flib_ipc_append_script");
+		return -1;
+	} else {
+		return flib_ipc_append_message(vec, "escript %s", script);
+	}
+}
+
 int flib_ipc_append_gamescheme(flib_vector *vec, const flib_cfg *scheme) {
 	int result = -1;
 	flib_vector *tempvector = flib_vector_create();
@@ -155,7 +175,8 @@
 			error |= flib_ipc_append_message(tempvector, "eammstore");
 		}
 
-		char *hash = team->hash ? team->hash : "00000000000000000000000000000000";
+		// TODO
+		char *hash = team->ownerName ? team->ownerName : "00000000000000000000000000000000";
 		error |= flib_ipc_append_message(tempvector, "eaddteam %s %"PRIu32" %s", hash, team->color, team->name);
 
 		if(team->remoteDriven) {
@@ -212,7 +233,6 @@
 		bool sharedAmmo = false;
 
 		error |= flib_ipc_append_message(vec, netgame ? "TN" : "TL");
-		error |= flib_ipc_append_seed(vec, setup->seed);
 		if(setup->map) {
 			error |= flib_ipc_append_mapconf(tempvector, setup->map, false);
 		}
@@ -225,13 +245,13 @@
 			// Shared ammo has priority over per-hog ammo
 			perHogAmmo = !sharedAmmo && getGameMod(setup->gamescheme, GAMEMOD_PERHOGAMMO_MASKBIT);
 		}
-		if(setup->teams && setup->teamcount>0) {
-			uint32_t *clanColors = flib_calloc(setup->teamcount, sizeof(uint32_t));
+		if(setup->teams && setup->teamCount>0) {
+			uint32_t *clanColors = flib_calloc(setup->teamCount, sizeof(uint32_t));
 			if(!clanColors) {
 				error = true;
 			} else {
 				int clanCount = 0;
-				for(int i=0; i<setup->teamcount; i++) {
+				for(int i=0; i<setup->teamCount; i++) {
 					flib_team *team = setup->teams[i];
 					bool newClan = false;