View Issue Details

IDProjectCategoryView StatusLast Update
0002882FSSCPSEXPspublic2014-07-12 17:27
ReporterAxem Assigned ToMageKing17  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0002882: change-team-color with None color results in error
DescriptionIf someone's got a team color and you change it to the default (None in the menu) through the sexp you get...

---------------------------
Error
---------------------------
Error in mission event "mission!": Unhandled sexp error code!

...

(Error appears to be: None)
---------------------------
OK Cancel
---------------------------

Work around seems to be if you have a ship with a 0,0,0 team color on everything, but since None is there, seems like it should be used.
TagsNo tags attached.

Activities

The_E

2013-06-03 17:53

administrator   ~0015117

Fix committed to trunk@9692.

chief1983

2013-06-03 19:18

administrator   ~0015118

Fix was reverted, reopening.

MageKing17

2014-07-12 16:59

developer  

2882.patch (5,644 bytes)   
Index: code/fred2/initialstatus.cpp
===================================================================
--- code/fred2/initialstatus.cpp	(revision 10911)
+++ code/fred2/initialstatus.cpp	(working copy)
@@ -540,7 +540,7 @@
 	if (m_team_color_setting.IsWindowEnabled() && m_team_color_setting.GetCurSel() > 0)
 		Ships[m_ship].team_name = Team_Names[m_team_color_setting.GetCurSel() - 1];
 	else
-		Ships[m_ship].team_name = "None";
+		Ships[m_ship].team_name = "none";
 
 	update_docking_info();
 
Index: code/graphics/gropengltnl.cpp
===================================================================
--- code/graphics/gropengltnl.cpp	(revision 10911)
+++ code/graphics/gropengltnl.cpp	(working copy)
@@ -484,7 +484,7 @@
 }
 
 void gr_opengl_set_team_color(const SCP_string &team, const SCP_string &secondaryteam, fix timestamp, int fadetime) {
-	if (secondaryteam == "<none>") {
+	if (!stricmp(secondaryteam.c_str(), "none")) {
 		if (Team_Colors.find(team) != Team_Colors.end()) {
 			Current_team_color = &Team_Colors[team];
 			Using_Team_Color = true;
Index: code/graphics/gropengltnl.h
===================================================================
--- code/graphics/gropengltnl.h	(revision 10911)
+++ code/graphics/gropengltnl.h	(working copy)
@@ -56,7 +56,7 @@
 int gr_opengl_end_state_block();
 void gr_opengl_set_state_block(int);
 
-void gr_opengl_set_team_color(const SCP_string &team, const SCP_string &secondaryteam = "<none>", fix timestamp = 0, int fadetime = 0);
+void gr_opengl_set_team_color(const SCP_string &team, const SCP_string &secondaryteam = "none", fix timestamp = 0, int fadetime = 0);
 void gr_opengl_disable_team_color();
 
 void opengl_tnl_shutdown();
Index: code/lab/lab.cpp
===================================================================
--- code/lab/lab.cpp	(revision 10911)
+++ code/lab/lab.cpp	(working copy)
@@ -728,7 +728,7 @@
 		}
 
 		if (sip->uses_team_colors && !Teamcolor_override) {
-			gr_set_team_color(Lab_team_color, "<none>", 0, 0);
+			gr_set_team_color(Lab_team_color, "none", 0, 0);
 		}
 	}
 
Index: code/menuui/techmenu.cpp
===================================================================
--- code/menuui/techmenu.cpp	(revision 10911)
+++ code/menuui/techmenu.cpp	(working copy)
@@ -468,7 +468,7 @@
 	ship_info *sip = &Ship_info[Cur_entry_index];
 
 	if (sip->uses_team_colors) {
-		gr_set_team_color(sip->default_team_name, "<none>", 0, 0);
+		gr_set_team_color(sip->default_team_name, "none", 0, 0);
 	}
 
 	// get correct revolution rate
Index: code/missionui/missionshipchoice.cpp
===================================================================
--- code/missionui/missionshipchoice.cpp	(revision 10911)
+++ code/missionui/missionshipchoice.cpp	(working copy)
@@ -1538,7 +1538,7 @@
 			}
 
 			if (sip->uses_team_colors) {
-				gr_set_team_color(sip->default_team_name, "<none>", 0, 0);
+				gr_set_team_color(sip->default_team_name, "none", 0, 0);
 			}
 
 			draw_model_rotating(ShipSelectModelNum,
Index: code/object/object.cpp
===================================================================
--- code/object/object.cpp	(revision 10911)
+++ code/object/object.cpp	(working copy)
@@ -1244,12 +1244,12 @@
 
 			//Check for changing team colors
 			ship* shipp = &Ships[objp->instance];
-			if (Ship_info[shipp->ship_info_index].uses_team_colors && shipp->secondary_team_name != "<none>") {
+			if (Ship_info[shipp->ship_info_index].uses_team_colors && stricmp(shipp->secondary_team_name.c_str(), "none")) {
 				if (f2fl(Missiontime) * 1000 > f2fl(shipp->team_change_timestamp) * 1000 + shipp->team_change_time) {
 					shipp->team_name = shipp->secondary_team_name;
 					shipp->team_change_timestamp = 0;
 					shipp->team_change_time = 0;
-					shipp->secondary_team_name = "<none>";
+					shipp->secondary_team_name = "none";
 				}
 			}
 
Index: code/parse/lua.cpp
===================================================================
--- code/parse/lua.cpp	(revision 10911)
+++ code/parse/lua.cpp	(working copy)
@@ -6041,7 +6041,7 @@
 	ship_info *sip = &Ship_info[idx];
 
 	if (sip->uses_team_colors) {
-		gr_set_team_color(sip->default_team_name, "<none>", 0, 0);
+		gr_set_team_color(sip->default_team_name, "none", 0, 0);
 	}
 
 	//Make sure model is loaded
@@ -6119,7 +6119,7 @@
 	ship_info *sip = &Ship_info[idx];
 
 	if (sip->uses_team_colors) {
-		gr_set_team_color(sip->default_team_name, "<none>", 0, 0);
+		gr_set_team_color(sip->default_team_name, "none", 0, 0);
 	}
 
 	//Make sure model is loaded
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp	(revision 10911)
+++ code/parse/sexp.cpp	(working copy)
@@ -2768,6 +2768,9 @@
 					return SEXP_CHECK_TYPE_MISMATCH;
 				}
 
+				if (!stricmp(CTEXT(node), "none"))
+					break;
+
 				if (Team_Colors.find(CTEXT(node)) == Team_Colors.end())
 					return SEXP_CHECK_INVALID_TEAM_COLOR;
 				
@@ -27889,6 +27892,9 @@
 		case SEXP_CHECK_INVALID_SHIP_FLAG:
 			return "Invalid ship flag";
 
+		case SEXP_CHECK_INVALID_TEAM_COLOR:
+			return "Not a valid Team Color setting";
+
 		default:
 			Warning(LOCATION, "Unhandled sexp error code %d!", num);
 			return "Unhandled sexp error code!";
Index: code/ship/ship.cpp
===================================================================
--- code/ship/ship.cpp	(revision 10911)
+++ code/ship/ship.cpp	(working copy)
@@ -5313,7 +5313,7 @@
 
 	// Team colors
 	shipp->team_name.assign( sip->default_team_name);
-	shipp->secondary_team_name = "<none>";
+	shipp->secondary_team_name = "none";
 
 	shipp->autoaim_fov = sip->autoaim_fov;
 }
2882.patch (5,644 bytes)   

MageKing17

2014-07-12 17:01

developer   ~0016069

I've gone through and made a more complete version of the r9692 changes and given them some preliminary testing.

The_E

2014-07-12 17:27

administrator   ~0016070

Fix committed to trunk@10914.

Related Changesets

fs2open: trunk r9692

2013-06-03 14:52

The_E


Ported: N/A

Details Diff
Fix for Mantis 2882: "None" team color setting causes errors. Also fixes a few other oversights.
Affected Issues
0002882
mod - /trunk/fs2_open/code/fred2/initialstatus.cpp Diff File
mod - /trunk/fs2_open/code/graphics/gropengltnl.cpp Diff File
mod - /trunk/fs2_open/code/object/object.cpp Diff File
mod - /trunk/fs2_open/code/parse/sexp.cpp Diff File
mod - /trunk/fs2_open/code/ship/ship.cpp Diff File

fs2open: trunk r10914

2014-07-12 13:50

The_E


Ported: N/A

Details Diff
Fix for Mantis 2882 by Mageking17 (change-team-color with None color results in error) Affected Issues
0002882
mod - /trunk/fs2_open/code/parse/sexp.cpp Diff File
mod - /trunk/fs2_open/code/menuui/techmenu.cpp Diff File
mod - /trunk/fs2_open/code/graphics/gropengltnl.cpp Diff File
mod - /trunk/fs2_open/code/parse/lua.cpp Diff File
mod - /trunk/fs2_open/code/lab/lab.cpp Diff File
mod - /trunk/fs2_open/code/object/object.cpp Diff File
mod - /trunk/fs2_open/code/fred2/initialstatus.cpp Diff File
mod - /trunk/fs2_open/code/missionui/missionshipchoice.cpp Diff File
mod - /trunk/fs2_open/code/graphics/gropengltnl.h Diff File
mod - /trunk/fs2_open/code/ship/ship.cpp Diff File

Issue History

Date Modified Username Field Change
2013-06-02 18:19 Axem New Issue
2013-06-03 17:53 The_E Changeset attached => fs2open trunk r9692
2013-06-03 17:53 The_E Note Added: 0015117
2013-06-03 17:53 The_E Status new => resolved
2013-06-03 17:53 The_E Resolution open => fixed
2013-06-03 19:18 chief1983 Assigned To => chief1983
2013-06-03 19:18 chief1983 Note Added: 0015118
2013-06-03 19:18 chief1983 Status resolved => feedback
2013-06-03 19:18 chief1983 Resolution fixed => reopened
2014-07-12 16:59 MageKing17 File Added: 2882.patch
2014-07-12 17:00 MageKing17 Assigned To chief1983 => MageKing17
2014-07-12 17:00 MageKing17 Status feedback => code review
2014-07-12 17:00 MageKing17 Resolution reopened => open
2014-07-12 17:01 MageKing17 Note Added: 0016069
2014-07-12 17:27 The_E Changeset attached => fs2open trunk r10914
2014-07-12 17:27 The_E Note Added: 0016070
2014-07-12 17:27 The_E Status code review => resolved
2014-07-12 17:27 The_E Resolution open => fixed