2019-12-07 16:53 EST


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002372FSSCPtablespublic2012-11-19 10:25
ReporterFury 
Assigned ToThe_E 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product VersionAntipodes 8 
Target VersionFixed in Version3.6.13 
Summary0002372: +Description broken in ships.tbl
DescriptionNo idea if it has ever worked, but it's broken now.

Example:
$Name: GTF Myrmidon
+nocreate
    +Description: XSTR("
    insert
    bunch of text
    here
    ", -1 )
    $end_multi_text

Produces exactly jack squat on ship's loadout display.
TagsNo tags attached.
Attached Files
  • patch file icon mantis_2372.patch (2,901 bytes) 2011-01-29 18:50 -
    Index: multiteamselect.cpp
    ===================================================================
    --- multiteamselect.cpp	(revision 6979)
    +++ multiteamselect.cpp	(working copy)
    @@ -2625,40 +2625,43 @@
     	// split the text info up	
     	
     	Assert(Multi_ts_select_ship_class >= 0);
    -	Assert((Ship_info[Multi_ts_select_ship_class].desc != NULL) && strlen(Ship_info[Multi_ts_select_ship_class].desc));
    +//	Assert((Ship_info[Multi_ts_select_ship_class].desc != NULL) && strlen(Ship_info[Multi_ts_select_ship_class].desc));
    +	if (Ship_info[Multi_ts_select_ship_class].desc != NULL)
    +	{
     
    -	// strip out newlines
    -	memset(ship_desc,0,1000);
    -	strcpy_s(ship_desc,Ship_info[Multi_ts_select_ship_class].desc);
    -	token = strtok(ship_desc,"\n");
    -	if(token != NULL){
    -		strcpy_s(Multi_ts_ship_info_text,token);
    -		while(token != NULL){
    -			token = strtok(NULL,"\n");
    -			if(token != NULL){
    -				strcat_s(Multi_ts_ship_info_text," ");
    -				strcat_s(Multi_ts_ship_info_text,token);
    +		// strip out newlines
    +		memset(ship_desc,0,1000);
    +		strcpy_s(ship_desc,Ship_info[Multi_ts_select_ship_class].desc);
    +		token = strtok(ship_desc,"\n");
    +		if(token != NULL){
    +			strcpy_s(Multi_ts_ship_info_text,token);
    +			while(token != NULL){
    +				token = strtok(NULL,"\n");
    +				if(token != NULL){
    +					strcat_s(Multi_ts_ship_info_text," ");
    +					strcat_s(Multi_ts_ship_info_text,token);
    +				}
     			}
     		}
    -	}
     	
    -	if(strlen(Multi_ts_ship_info_text) > 0){
    -		// split the string into multiple lines
    -		n_lines = split_str(Multi_ts_ship_info_text, Multi_ts_ship_info_coords[gr_screen.res][MULTI_TS_W_COORD], n_chars, p_str, MULTI_TS_SHIP_INFO_MAX_LINES, 0);	
    +		if(strlen(Multi_ts_ship_info_text) > 0){
    +			// split the string into multiple lines
    +			n_lines = split_str(Multi_ts_ship_info_text, Multi_ts_ship_info_coords[gr_screen.res][MULTI_TS_W_COORD], n_chars, p_str, MULTI_TS_SHIP_INFO_MAX_LINES, 0);	
     
    -		// copy the split up lines into the text lines array
    -		for (int idx = 0;idx<n_lines;idx++ ) {
    -			Assert(n_chars[idx] < MULTI_TS_SHIP_INFO_MAX_LINE_LEN);
    -			strncpy(Multi_ts_ship_info_lines[idx], p_str[idx], n_chars[idx]);
    -			Multi_ts_ship_info_lines[idx][n_chars[idx]] = 0;
    -			drop_leading_white_space(Multi_ts_ship_info_lines[idx]);		
    +			// copy the split up lines into the text lines array
    +			for (int idx = 0;idx<n_lines;idx++ ) {
    +				Assert(n_chars[idx] < MULTI_TS_SHIP_INFO_MAX_LINE_LEN);
    +				strncpy(Multi_ts_ship_info_lines[idx], p_str[idx], n_chars[idx]);
    +				Multi_ts_ship_info_lines[idx][n_chars[idx]] = 0;
    +				drop_leading_white_space(Multi_ts_ship_info_lines[idx]);		
    +			}
    +
    +			// get the line count
    +			Multi_ts_ship_info_line_count = n_lines;
    +		} else {
    +			// set the line count to 
    +			Multi_ts_ship_info_line_count = 0;
     		}
    -
    -		// get the line count
    -		Multi_ts_ship_info_line_count = n_lines;
    -	} else {
    -		// set the line count to 
    -		Multi_ts_ship_info_line_count = 0;
     	}	
     }
     
    
    patch file icon mantis_2372.patch (2,901 bytes) 2011-01-29 18:50 +

-Relationships
+Relationships

-Notes

~0012610

The_E (administrator)

Fixed in revision 6969

~0012617

FUBAR-BDHR (developer)

Well this fix breaks multiplayer and the description is not like broke correctly resulting in a possible second assert for MAX_NUM_SHIP_DESC_LINES being exceeded. This one happens in both single and multi.

Example:

+Description: XSTR("test description", -1)
$end_multi_text

results in:
test
descr
iption

+Description: XSTR("A much longer test description of this ship to see what happens", -1)
$end_multi_text

results in the assert.

I'll attach a diff that seems to work around the first multi problem.

~0013170

chief1983 (administrator)

Apparently this patch was committed in 7002. Is there anything still broken mentioned in this ticket?

~0013174

Zacam (administrator)

Tested with the above snippets. No Assert reached.

The second +Description entry did lead to a bit of a text area over draw in the interface though: http://img713.imageshack.us/img713/7347/descriptiontest.png

Additionally, when setting up for the second +Description test, I accidentally forgot to include the "$end_multi_text" which did not result in any pop-up warnings, but did lead to this easily missed entry in the log:
"Error. Too much text (28553 chars, 4096 allowed) before $end_multi_text"

Build test: Antipodes 8370 build.

~0014008

chief1983 (administrator)

Closing then if no other complaints.

~0014077

Goober5000 (administrator)

Resolving as it was apparently fixed by The E, twice.
+Notes

-Issue History
Date Modified Username Field Change
2011-01-07 12:18 Fury New Issue
2011-01-23 16:19 The_E Note Added: 0012610
2011-01-23 16:20 The_E Status new => resolved
2011-01-23 16:20 The_E Fixed in Version => 3.6.13
2011-01-23 16:20 The_E Resolution open => fixed
2011-01-23 16:20 The_E Assigned To => The_E
2011-01-29 18:45 FUBAR-BDHR Note Added: 0012617
2011-01-29 18:45 FUBAR-BDHR Status resolved => feedback
2011-01-29 18:45 FUBAR-BDHR Resolution fixed => reopened
2011-01-29 18:50 FUBAR-BDHR File Added: mantis_2372.patch
2012-01-27 17:10 chief1983 Note Added: 0013170
2012-01-28 01:47 Zacam Note Added: 0013174
2012-10-27 07:24 The_E Assigned To The_E =>
2012-10-31 16:30 chief1983 Note Added: 0014008
2012-11-19 10:25 Goober5000 Note Added: 0014077
2012-11-19 10:25 Goober5000 Assigned To => The_E
2012-11-19 10:25 Goober5000 Status feedback => resolved
2012-11-19 10:25 Goober5000 Resolution reopened => fixed
+Issue History