Remove useless getCompFromResName()
parent
100f5e9560
commit
c14a32f481
|
@ -862,7 +862,7 @@ bool scrValDefLoad(INTERP_VAL *psVal, WzConfig &ini)
|
|||
psVal->v.ival = index;
|
||||
break;
|
||||
case ST_BODY:
|
||||
index = getCompFromResName(COMP_BODY, ini.value("data").toString().toAscii().constData());
|
||||
index = getCompFromName(COMP_BODY, ini.value("data").toString());
|
||||
if (index == -1)
|
||||
{
|
||||
debug(LOG_FATAL, "Could not find body component");
|
||||
|
@ -871,7 +871,7 @@ bool scrValDefLoad(INTERP_VAL *psVal, WzConfig &ini)
|
|||
psVal->v.ival = index;
|
||||
break;
|
||||
case ST_PROPULSION:
|
||||
index = getCompFromResName(COMP_PROPULSION, ini.value("data").toString().toAscii().constData());
|
||||
index = getCompFromName(COMP_PROPULSION, ini.value("data").toString());
|
||||
if (index == -1)
|
||||
{
|
||||
debug(LOG_FATAL, "Could not find propulsion component");
|
||||
|
@ -880,7 +880,7 @@ bool scrValDefLoad(INTERP_VAL *psVal, WzConfig &ini)
|
|||
psVal->v.ival = index;
|
||||
break;
|
||||
case ST_ECM:
|
||||
index = getCompFromResName(COMP_ECM, ini.value("data").toString().toAscii().constData());
|
||||
index = getCompFromName(COMP_ECM, ini.value("data").toString());
|
||||
if (index == -1)
|
||||
{
|
||||
debug(LOG_FATAL, "Could not find ECM component");
|
||||
|
@ -889,7 +889,7 @@ bool scrValDefLoad(INTERP_VAL *psVal, WzConfig &ini)
|
|||
psVal->v.ival = index;
|
||||
break;
|
||||
case ST_SENSOR:
|
||||
index = getCompFromResName(COMP_SENSOR, ini.value("data").toString().toAscii().constData());
|
||||
index = getCompFromName(COMP_SENSOR, ini.value("data").toString());
|
||||
if (index == -1)
|
||||
{
|
||||
debug(LOG_FATAL, "Could not find sensor component");
|
||||
|
@ -898,7 +898,7 @@ bool scrValDefLoad(INTERP_VAL *psVal, WzConfig &ini)
|
|||
psVal->v.ival = index;
|
||||
break;
|
||||
case ST_CONSTRUCT:
|
||||
index = getCompFromResName(COMP_CONSTRUCT, ini.value("data").toString().toAscii().constData());
|
||||
index = getCompFromName(COMP_CONSTRUCT, ini.value("data").toString());
|
||||
if (index == -1)
|
||||
{
|
||||
debug(LOG_FATAL, "Could not find constructor component");
|
||||
|
@ -907,7 +907,7 @@ bool scrValDefLoad(INTERP_VAL *psVal, WzConfig &ini)
|
|||
psVal->v.ival = index;
|
||||
break;
|
||||
case ST_WEAPON:
|
||||
index = getCompFromResName(COMP_WEAPON, ini.value("data").toString().toAscii().constData());
|
||||
index = getCompFromName(COMP_WEAPON, ini.value("data").toString());
|
||||
if (index == -1)
|
||||
{
|
||||
debug(LOG_FATAL, "Could not find weapon");
|
||||
|
@ -916,7 +916,7 @@ bool scrValDefLoad(INTERP_VAL *psVal, WzConfig &ini)
|
|||
psVal->v.ival = index;
|
||||
break;
|
||||
case ST_REPAIR:
|
||||
index = getCompFromResName(COMP_REPAIRUNIT, ini.value("data").toString().toAscii().constData());
|
||||
index = getCompFromName(COMP_REPAIRUNIT, ini.value("data").toString());
|
||||
if (index == -1)
|
||||
{
|
||||
debug(LOG_FATAL, "Could not find repair component");
|
||||
|
@ -925,7 +925,7 @@ bool scrValDefLoad(INTERP_VAL *psVal, WzConfig &ini)
|
|||
psVal->v.ival = index;
|
||||
break;
|
||||
case ST_BRAIN:
|
||||
index = getCompFromResName(COMP_BRAIN, ini.value("data").toString().toAscii().constData());
|
||||
index = getCompFromName(COMP_BRAIN, ini.value("data").toString());
|
||||
if (index == -1)
|
||||
{
|
||||
debug(LOG_FATAL, "Could not find repair brain");
|
||||
|
|
|
@ -1715,7 +1715,7 @@ yyreduce:
|
|||
yyerror("Typemismatch for variable %d", (yyvsp[(1) - (3)].vindex));
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_BODY, (yyvsp[(3) - (3)].sInit).pString);
|
||||
data.v.ival = getCompFromName(COMP_BODY, (yyvsp[(3) - (3)].sInit).pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("body component %s not found", (yyvsp[(3) - (3)].sInit).pString);
|
||||
|
@ -1733,7 +1733,7 @@ yyreduce:
|
|||
yyerror("Typemismatch for variable %d", (yyvsp[(1) - (3)].vindex));
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_PROPULSION, (yyvsp[(3) - (3)].sInit).pString);
|
||||
data.v.ival = getCompFromName(COMP_PROPULSION, (yyvsp[(3) - (3)].sInit).pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Propulsion component %s not found", (yyvsp[(3) - (3)].sInit).pString);
|
||||
|
@ -1751,7 +1751,7 @@ yyreduce:
|
|||
yyerror("Typemismatch for variable %d", (yyvsp[(1) - (3)].vindex));
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_ECM, (yyvsp[(3) - (3)].sInit).pString);
|
||||
data.v.ival = getCompFromName(COMP_ECM, (yyvsp[(3) - (3)].sInit).pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("ECM component %s not found", (yyvsp[(3) - (3)].sInit).pString);
|
||||
|
@ -1769,7 +1769,7 @@ yyreduce:
|
|||
yyerror("Typemismatch for variable %d", (yyvsp[(1) - (3)].vindex));
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_SENSOR, (yyvsp[(3) - (3)].sInit).pString);
|
||||
data.v.ival = getCompFromName(COMP_SENSOR, (yyvsp[(3) - (3)].sInit).pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Sensor component %s not found", (yyvsp[(3) - (3)].sInit).pString);
|
||||
|
@ -1787,7 +1787,7 @@ yyreduce:
|
|||
yyerror("Typemismatch for variable %d", (yyvsp[(1) - (3)].vindex));
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_CONSTRUCT, (yyvsp[(3) - (3)].sInit).pString);
|
||||
data.v.ival = getCompFromName(COMP_CONSTRUCT, (yyvsp[(3) - (3)].sInit).pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Construct component %s not found", (yyvsp[(3) - (3)].sInit).pString);
|
||||
|
@ -1805,7 +1805,7 @@ yyreduce:
|
|||
yyerror("Typemismatch for variable %d", (yyvsp[(1) - (3)].vindex));
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_REPAIRUNIT, (yyvsp[(3) - (3)].sInit).pString);
|
||||
data.v.ival = getCompFromName(COMP_REPAIRUNIT, (yyvsp[(3) - (3)].sInit).pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Repair component %s not found", (yyvsp[(3) - (3)].sInit).pString);
|
||||
|
@ -1823,7 +1823,7 @@ yyreduce:
|
|||
yyerror("Typemismatch for variable %d", (yyvsp[(1) - (3)].vindex));
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_BRAIN, (yyvsp[(3) - (3)].sInit).pString);
|
||||
data.v.ival = getCompFromName(COMP_BRAIN, (yyvsp[(3) - (3)].sInit).pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Brain component %s not found", (yyvsp[(3) - (3)].sInit).pString);
|
||||
|
@ -1841,7 +1841,7 @@ yyreduce:
|
|||
yyerror("Typemismatch for variable %d", (yyvsp[(1) - (3)].vindex));
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_WEAPON, (yyvsp[(3) - (3)].sInit).pString);
|
||||
data.v.ival = getCompFromName(COMP_WEAPON, (yyvsp[(3) - (3)].sInit).pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Weapon component %s not found", (yyvsp[(3) - (3)].sInit).pString);
|
||||
|
|
|
@ -379,7 +379,7 @@ var_init: var_entry TYPE var_value
|
|||
yyerror("Typemismatch for variable %d", $1);
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_BODY, $3.pString);
|
||||
data.v.ival = getCompFromName(COMP_BODY, $3.pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("body component %s not found", $3.pString);
|
||||
|
@ -397,7 +397,7 @@ var_init: var_entry TYPE var_value
|
|||
yyerror("Typemismatch for variable %d", $1);
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_PROPULSION, $3.pString);
|
||||
data.v.ival = getCompFromName(COMP_PROPULSION, $3.pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Propulsion component %s not found", $3.pString);
|
||||
|
@ -415,7 +415,7 @@ var_init: var_entry TYPE var_value
|
|||
yyerror("Typemismatch for variable %d", $1);
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_ECM, $3.pString);
|
||||
data.v.ival = getCompFromName(COMP_ECM, $3.pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("ECM component %s not found", $3.pString);
|
||||
|
@ -433,7 +433,7 @@ var_init: var_entry TYPE var_value
|
|||
yyerror("Typemismatch for variable %d", $1);
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_SENSOR, $3.pString);
|
||||
data.v.ival = getCompFromName(COMP_SENSOR, $3.pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Sensor component %s not found", $3.pString);
|
||||
|
@ -451,7 +451,7 @@ var_init: var_entry TYPE var_value
|
|||
yyerror("Typemismatch for variable %d", $1);
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_CONSTRUCT, $3.pString);
|
||||
data.v.ival = getCompFromName(COMP_CONSTRUCT, $3.pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Construct component %s not found", $3.pString);
|
||||
|
@ -469,7 +469,7 @@ var_init: var_entry TYPE var_value
|
|||
yyerror("Typemismatch for variable %d", $1);
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_REPAIRUNIT, $3.pString);
|
||||
data.v.ival = getCompFromName(COMP_REPAIRUNIT, $3.pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Repair component %s not found", $3.pString);
|
||||
|
@ -487,7 +487,7 @@ var_init: var_entry TYPE var_value
|
|||
yyerror("Typemismatch for variable %d", $1);
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_BRAIN, $3.pString);
|
||||
data.v.ival = getCompFromName(COMP_BRAIN, $3.pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Brain component %s not found", $3.pString);
|
||||
|
@ -505,7 +505,7 @@ var_init: var_entry TYPE var_value
|
|||
yyerror("Typemismatch for variable %d", $1);
|
||||
YYABORT;
|
||||
}
|
||||
data.v.ival = getCompFromResName(COMP_WEAPON, $3.pString);
|
||||
data.v.ival = getCompFromName(COMP_WEAPON, $3.pString);
|
||||
if (data.v.ival == -1)
|
||||
{
|
||||
yyerror("Weapon component %s not found", $3.pString);
|
||||
|
|
|
@ -1561,14 +1561,6 @@ unsigned int componentType(const char *pType)
|
|||
return 0; // Should never get here.
|
||||
}
|
||||
|
||||
//get the component Inc for a stat based on the Resource name and type
|
||||
//returns -1 if record not found
|
||||
//used in Scripts
|
||||
SDWORD getCompFromResName(UDWORD compType, const char *pName)
|
||||
{
|
||||
return getCompFromName((COMPONENT_TYPE)compType, pName);
|
||||
}
|
||||
|
||||
/// Get the component index for a stat based on the name, and verify correct type
|
||||
int getCompFromName(COMPONENT_TYPE compType, const QString &name)
|
||||
{
|
||||
|
|
|
@ -184,10 +184,6 @@ extern UDWORD componentType(const char* pType);
|
|||
//get the component Inc for a stat based on the name
|
||||
int getCompFromName(COMPONENT_TYPE compType, const QString &name);
|
||||
COMPONENT_STATS *getCompStatsFromName(const QString &name);
|
||||
//get details for given component type
|
||||
extern void getStatsDetails(UDWORD compType, BASE_STATS **ppsStats, UDWORD *pnumStats, UDWORD *pstatSize);
|
||||
//get the component Inc for a stat based on the Resource name held in Names.txt
|
||||
extern SDWORD getCompFromResName(UDWORD compType, const char *pName);
|
||||
/*returns the weapon sub class based on the string name passed in */
|
||||
extern bool getWeaponSubClass(const char* subClass, WEAPON_SUBCLASS* wclass);
|
||||
const char *getWeaponSubClass(WEAPON_SUBCLASS wclass);
|
||||
|
|
Loading…
Reference in New Issue