View Issue Details

IDProjectCategoryView StatusLast Update
0002141FSSCPtablespublic2010-03-05 05:44
ReporterFUBAR-BDHR Assigned ToWanderer  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.11 
Summary0002141: Armor.tbl does not process correctly if more then one armor type starts with the same name.
DescriptionIf you have more then one armor type starting with the same characters such as Basestar and Basestar_guns it will always return Basestar if it's first in the table. This is due to ship.h line 185 which does a strnicmp resulting in true for the truncated string.
Additional Information3.6.13 built last night.
TagsNo tags attached.

Activities

FUBAR-BDHR

2010-02-25 10:22

developer   ~0011709

Patch attached. Looks like it was just a length check on the wrong variable.

Wanderer

2010-02-27 11:20

developer   ~0011717

Well.. the solution you are proposing only changes the issue and the problems. There are no guarantees for either way for the substrings to be different. What i wonder is why are we using substring comparison (strincmp) there instead of say string comparison (stricmp) ?

2010-03-04 22:58

 

armor_type_mantis_2141a.patch (517 bytes)   
Index: ship.h
===================================================================
--- ship.h	(revision 5992)
+++ ship.h	(working copy)
@@ -182,7 +182,7 @@
 
 	//Get
 	char *GetNamePtr(){return Name;}
-	bool IsName(char *in_name){return (strnicmp(in_name,Name,strlen(Name)) == 0);}
+	bool IsName(char *in_name){return (stricmp(in_name,Name)==0);}
 	float GetDamage(float damage_applied, int in_damage_type_idx);
 	float GetShieldPiercePCT(int damage_type_idx);
 	int GetPiercingType(int damage_type_idx);

FUBAR-BDHR

2010-03-04 23:14

developer   ~0011749

New patch attached with the stricmp instead of strnicmp. Tested through the parsing of about 20 ships with a modified armor.tbl. Modified table had the following classes:

Fighter1
Fighter
Fighter2


Read each one in just fine and returned the correct index during parse. Same with all the other existing classes until I got tired of hitting F10 and F5.

Issue History

Date Modified Username Field Change
2010-02-25 08:52 FUBAR-BDHR New Issue
2010-02-25 10:21 FUBAR-BDHR File Added: armor_type_mantis_2141.patch
2010-02-25 10:22 FUBAR-BDHR Note Added: 0011709
2010-02-27 11:20 Wanderer Note Added: 0011717
2010-03-04 22:58 FUBAR-BDHR File Deleted: armor_type_mantis_2141.patch
2010-03-04 22:58 FUBAR-BDHR File Added: armor_type_mantis_2141a.patch
2010-03-04 23:14 FUBAR-BDHR Note Added: 0011749
2010-03-05 05:44 Wanderer Status new => resolved
2010-03-05 05:44 Wanderer Resolution open => fixed
2010-03-05 05:44 Wanderer Assigned To => Wanderer