frontlib: Return more filled-in team objects
authorMedo <smaxein@googlemail.com>
Sat, 18 Aug 2012 18:08:37 +0200
changeset 7566 57d343ee382f
parent 7563 09a44c8fbfba
child 7568 75ba91f14ed5
frontlib: Return more filled-in team objects
project_files/frontlib/hwconsts.h
project_files/frontlib/net/netconn.c
project_files/frontlib/net/netprotocol.c
--- a/project_files/frontlib/hwconsts.h	Sat Aug 18 13:45:00 2012 +0200
+++ b/project_files/frontlib/hwconsts.h	Sat Aug 18 18:08:37 2012 +0200
@@ -34,6 +34,9 @@
 #include <stdbool.h>
 
 #define HEDGEHOGS_PER_TEAM 8
+#define DEFAULT_HEDGEHOG_COUNT 4
+#define DEFAULT_COLOR_INDEX 0
+
 #define NETGAME_DEFAULT_PORT 46631
 #define PROTOCOL_VERSION 42
 #define MIN_SERVER_VERSION 1
--- a/project_files/frontlib/net/netconn.c	Sat Aug 18 13:45:00 2012 +0200
+++ b/project_files/frontlib/net/netconn.c	Sat Aug 18 18:08:37 2012 +0200
@@ -333,7 +333,6 @@
 					conn->onDisconnectedCb(conn->onDisconnectedCtx, NETCONN_DISCONNECT_INTERNAL_ERROR, "Internal error");
 					exit = true;
 	        	} else {
-	        		team->remoteDriven = true;
 	        		conn->onTeamAddCb(conn->onTeamAddCtx, team);
 	        	}
 	        }
--- a/project_files/frontlib/net/netprotocol.c	Sat Aug 18 13:45:00 2012 +0200
+++ b/project_files/frontlib/net/netprotocol.c	Sat Aug 18 18:08:37 2012 +0200
@@ -57,6 +57,11 @@
 			return -1;
 		}
 	}
+
+	// Set some default assumptions as well
+	team->colorIndex = DEFAULT_COLOR_INDEX;
+	team->hogsInGame = DEFAULT_HEDGEHOG_COUNT;
+	team->remoteDriven = true;
 	return 0;
 }