-void check_map_values( const char **returnMsg ){
- static char message[1024];
- int count = 0;
- int teams = 0;
- int ent_flags;
- Entity* worldspawn;
- char str[64];
-
- worldspawn = Scene_FindEntityByClass( "worldspawn" );
- if ( !worldspawn ) {
- globalOutputStream() << "UFO:AI: Could not find worldspawn.\n";
- *returnMsg = "Could not find worldspawn";
- return;
- }
-
- *message = '\0';
- *str = '\0';
-
- // multiplayer start positions
- get_team_count( "info_player_start", &count, &teams );
- if ( !count ) {
- strncat( message, "No multiplayer start positions (info_player_start)\n", sizeof( message ) - 1 );
- }
-
- // singleplayer map?
- count = 0;
- get_team_count( "info_human_start", &count, NULL );
- if ( !count ) {
- strncat( message, "No singleplayer start positions (info_human_start)\n", sizeof( message ) - 1 );
- }
-
- // singleplayer map?
- count = 0;
- get_team_count( "info_2x2_start", &count, NULL );
- if ( !count ) {
- strncat( message, "No singleplayer start positions for 2x2 units (info_2x2_start)\n", sizeof( message ) - 1 );
- }
-
- // search for civilians
- count = 0;
- get_team_count( "info_civilian_start", &count, NULL );
- if ( !count ) {
- strncat( message, "No civilian start positions (info_civilian_start)\n", sizeof( message ) - 1 );
- }
-
- // check maxlevel
- if ( string_empty( worldspawn->getKeyValue( "maxlevel" ) ) ) {
- strncat( message, "Worldspawn: No maxlevel defined\n", sizeof( message ) - 1 );
- }
- else if ( atoi( worldspawn->getKeyValue( "maxlevel" ) ) > 8 ) {
- strncat( message, "Worldspawn: Highest maxlevel is 8\n", sizeof( message ) - 1 );
- worldspawn->setKeyValue( "maxlevel", "8" );
- }
-
- ent_flags = check_entity_flags( "func_door", "spawnflags" );
- if ( ent_flags ) {
- snprintf( &message[strlen( message )], sizeof( message ) - 1 - strlen( message ), "Found %i func_door with no spawnflags\n", ent_flags );
- }
- ent_flags = check_entity_flags( "func_breakable", "spawnflags" );
- if ( ent_flags ) {
- snprintf( &message[strlen( message )], sizeof( message ) - 1 - strlen( message ), "Found %i func_breakable with no spawnflags\n", ent_flags );
- }
- ent_flags = check_entity_flags( "misc_sound", "spawnflags" );
- if ( ent_flags ) {
- snprintf( &message[strlen( message )], sizeof( message ) - 1 - strlen( message ), "Found %i misc_sound with no spawnflags\n", ent_flags );
- }
- ent_flags = check_entity_flags( "misc_model", "spawnflags" );
- if ( ent_flags ) {
- snprintf( &message[strlen( message )], sizeof( message ) - 1 - strlen( message ), "Found %i misc_model with no spawnflags\n", ent_flags );
- }
- ent_flags = check_entity_flags( "misc_particle", "spawnflags" );
- if ( ent_flags ) {
- snprintf( &message[strlen( message )], sizeof( message ) - 1 - strlen( message ), "Found %i misc_particle with no spawnflags\n", ent_flags );
- }
- ent_flags = check_entity_flags( "info_player_start", "team" );
- if ( ent_flags ) {
- snprintf( &message[strlen( message )], sizeof( message ) - 1 - strlen( message ), "Found %i info_player_start with no team assigned\n!!Teamcount may change after you've fixed this\n", ent_flags );
- }
- ent_flags = check_entity_flags( "light", "color" );
- ent_flags = check_entity_flags( "light", "_color" );
- if ( ent_flags ) {
- snprintf( &message[strlen( message )], sizeof( message ) - 1 - strlen( message ), "Found %i lights with no color value\n", ent_flags );
- }
-
- // no errors found
- if ( !strlen( message ) ) {
- snprintf( message, sizeof( message ) - 1, "No errors found - you are ready to compile the map now\n" );
- }
-
- *returnMsg = message;
+void check_map_values(const char **returnMsg)
+{
+ static char message[1024];
+ int count = 0;
+ int teams = 0;
+ int ent_flags;
+ Entity *worldspawn;
+ char str[64];
+
+ worldspawn = Scene_FindEntityByClass("worldspawn");
+ if (!worldspawn) {
+ globalOutputStream() << "UFO:AI: Could not find worldspawn.\n";
+ *returnMsg = "Could not find worldspawn";
+ return;
+ }
+
+ *message = '\0';
+ *str = '\0';
+
+ // multiplayer start positions
+ get_team_count("info_player_start", &count, &teams);
+ if (!count) {
+ strncat(message, "No multiplayer start positions (info_player_start)\n", sizeof(message) - 1);
+ }
+
+ // singleplayer map?
+ count = 0;
+ get_team_count("info_human_start", &count, NULL);
+ if (!count) {
+ strncat(message, "No singleplayer start positions (info_human_start)\n", sizeof(message) - 1);
+ }
+
+ // singleplayer map?
+ count = 0;
+ get_team_count("info_2x2_start", &count, NULL);
+ if (!count) {
+ strncat(message, "No singleplayer start positions for 2x2 units (info_2x2_start)\n", sizeof(message) - 1);
+ }
+
+ // search for civilians
+ count = 0;
+ get_team_count("info_civilian_start", &count, NULL);
+ if (!count) {
+ strncat(message, "No civilian start positions (info_civilian_start)\n", sizeof(message) - 1);
+ }
+
+ // check maxlevel
+ if (string_empty(worldspawn->getKeyValue("maxlevel"))) {
+ strncat(message, "Worldspawn: No maxlevel defined\n", sizeof(message) - 1);
+ } else if (atoi(worldspawn->getKeyValue("maxlevel")) > 8) {
+ strncat(message, "Worldspawn: Highest maxlevel is 8\n", sizeof(message) - 1);
+ worldspawn->setKeyValue("maxlevel", "8");
+ }
+
+ ent_flags = check_entity_flags("func_door", "spawnflags");
+ if (ent_flags) {
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message),
+ "Found %i func_door with no spawnflags\n", ent_flags);
+ }
+ ent_flags = check_entity_flags("func_breakable", "spawnflags");
+ if (ent_flags) {
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message),
+ "Found %i func_breakable with no spawnflags\n", ent_flags);
+ }
+ ent_flags = check_entity_flags("misc_sound", "spawnflags");
+ if (ent_flags) {
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message),
+ "Found %i misc_sound with no spawnflags\n", ent_flags);
+ }
+ ent_flags = check_entity_flags("misc_model", "spawnflags");
+ if (ent_flags) {
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message),
+ "Found %i misc_model with no spawnflags\n", ent_flags);
+ }
+ ent_flags = check_entity_flags("misc_particle", "spawnflags");
+ if (ent_flags) {
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message),
+ "Found %i misc_particle with no spawnflags\n", ent_flags);
+ }
+ ent_flags = check_entity_flags("info_player_start", "team");
+ if (ent_flags) {
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message),
+ "Found %i info_player_start with no team assigned\n!!Teamcount may change after you've fixed this\n",
+ ent_flags);
+ }
+ ent_flags = check_entity_flags("light", "color");
+ ent_flags = check_entity_flags("light", "_color");
+ if (ent_flags) {
+ snprintf(&message[strlen(message)], sizeof(message) - 1 - strlen(message),
+ "Found %i lights with no color value\n", ent_flags);
+ }
+
+ // no errors found
+ if (!strlen(message)) {
+ snprintf(message, sizeof(message) - 1, "No errors found - you are ready to compile the map now\n");
+ }
+
+ *returnMsg = message;