frontlib: prevent writing a "binds" section of the team file when there are no binds
authorMedo <smaxein@googlemail.com>
Mon, 06 Aug 2012 22:32:46 +0200
changeset 7470 0db1780ca938
parent 7467 a9ab8067a2d1
child 7473 45b9f25ff611
frontlib: prevent writing a "binds" section of the team file when there are no binds
project_files/frontlib/model/team.c
project_files/frontlib/model/team.h
--- a/project_files/frontlib/model/team.c	Mon Aug 06 22:32:05 2012 +0200
+++ b/project_files/frontlib/model/team.c	Mon Aug 06 22:32:46 2012 +0200
@@ -196,6 +196,9 @@
 }
 
 static int writeBindingSection(const flib_team *team, flib_ini *ini) {
+	if(team->bindingCount == 0) {
+		return 0;
+	}
 	if(flib_ini_create_section(ini, "binds")) {
 		return -1;
 	}
--- a/project_files/frontlib/model/team.h	Mon Aug 06 22:32:05 2012 +0200
+++ b/project_files/frontlib/model/team.h	Mon Aug 06 22:32:46 2012 +0200
@@ -87,19 +87,13 @@
 } flib_team;
 
 /**
- * Returns a new team, or NULL on error. name must not be NULL.
- *
- * The new team is pre-filled with default settings (see hwconsts.h)
- */
-flib_team *flib_team_create(const char *name);
-
-/**
  * Free all memory associated with the team
  */
 void flib_team_destroy(flib_team *team);
 
 /**
- * Loads a team, returns NULL on error.
+ * Loads a team, returns NULL on error. Destroy this team using flib_team_destroy.
+ * This will not fill in the fields marked as "transient" in the structs above.
  */
 flib_team *flib_team_from_ini(const char *filename);