View Issue Details

IDProjectCategoryView StatusLast Update
0003145FSSCPFREDpublic2015-02-24 03:03
ReporterAxem Assigned ToMageKing17  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
Summary0003145: Texture replace dialog entries are offset by one
DescriptionThe dialog appears to actually change the entry below the one currently selected. (-glow was right under the gtbrhea-unit02 in the list)
TagsNo tags attached.

Relationships

duplicate of 0001929 resolvedMageKing17 Texture replacement more problems 

Activities

Axem

2015-02-21 20:23

reporter  

texturereplacebroken.png (104,169 bytes)   
texturereplacebroken.png (104,169 bytes)   

MageKing17

2015-02-22 21:55

developer  

3145.patch (1,528 bytes)   
Index: code/fred2/fred.rc
===================================================================
--- code/fred2/fred.rc	(revision 11257)
+++ code/fred2/fred.rc	(working copy)
@@ -1928,7 +1928,7 @@
     PUSHBUTTON      "Cancel",IDCANCEL,239,35,50,14
     LTEXT           "Old texture:",IDC_LABEL1,7,7,44,9
     LTEXT           "New texture:",IDC_LABEL2,152,7,44,9
-    COMBOBOX        IDC_OLD_TEXTURE_LIST,7,16,137,85,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_OLD_TEXTURE_LIST,7,16,137,85,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
 END
 
 IDD_SPECIAL_HITPOINTS DIALOG  0, 0, 234, 85
Index: code/fred2/shiptexturesdlg.cpp
===================================================================
--- code/fred2/shiptexturesdlg.cpp	(revision 11257)
+++ code/fred2/shiptexturesdlg.cpp	(working copy)
@@ -217,20 +217,22 @@
 			// make old texture lowercase
 			strlwr(texture_file);
 
-			// now add it to the box
-			z = box->AddString(texture_file);
-
-			// and add it to the field as well
+			// add it to the field
 			strcpy_s(old_texture_name[texture_count], texture_file);
 
 			// increment
 			texture_count++;
-
-			// sort
-			sort_textures();
 		}
 	}
 
+	// now sort the filenames
+	sort_textures();
+
+	// and add them to the box
+	for (i=0; i<texture_count; i++) {
+		z = box->AddString(old_texture_name[i]);
+	}
+
 	// now look for new textures
 	for (SCP_vector<texture_replace>::iterator ii = Fred_texture_replacements.begin(); ii != Fred_texture_replacements.end(); ++ii)
 	{
3145.patch (1,528 bytes)   

MageKing17

2015-02-22 21:56

developer   ~0016506

I think this may be due to different sorting behavior between CBS_SORT and stricmp(). I've attached a patch that should unify the sorting behavior.

MageKing17

2015-02-22 23:11

developer   ~0016507

Closing as a duplicate of 1929.

Issue History

Date Modified Username Field Change
2015-02-21 20:23 Axem New Issue
2015-02-21 20:23 Axem File Added: texturereplacebroken.png
2015-02-22 21:55 MageKing17 File Added: 3145.patch
2015-02-22 21:56 MageKing17 Note Added: 0016506
2015-02-22 21:56 MageKing17 Assigned To => MageKing17
2015-02-22 21:56 MageKing17 Status new => code review
2015-02-22 22:29 MageKing17 Relationship added duplicate of 0001929
2015-02-22 23:11 MageKing17 Note Added: 0016507
2015-02-22 23:11 MageKing17 Assigned To MageKing17 =>
2015-02-22 23:11 MageKing17 Status code review => closed
2015-02-22 23:11 MageKing17 Resolution open => duplicate
2015-02-24 03:03 Goober5000 Assigned To => MageKing17