Remove unused HASH_NAMES code.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1250 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
aec9db0a8f
commit
6e21dbe859
45
src/design.c
45
src/design.c
|
@ -526,18 +526,14 @@ static BOOL _intAddDesign( BOOL bShowCentreScreen )
|
|||
if (psCurrTemplate != NULL)
|
||||
{
|
||||
memcpy(&sCurrDesign, psCurrTemplate, sizeof(DROID_TEMPLATE));
|
||||
#ifndef HASH_NAMES
|
||||
strncpy(aCurrName, getStatName( psCurrTemplate ), WIDG_MAXSTR - 1);
|
||||
strcpy( sCurrDesign.aName, aCurrName );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&sCurrDesign, &sDefaultDesignTemplate, sizeof(DROID_TEMPLATE));
|
||||
strcpy(aCurrName, strresGetString(psStringRes, STR_DES_NEWVEH));
|
||||
#ifndef HASH_NAMES
|
||||
strcpy( sCurrDesign.aName, aCurrName );
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Add the design templates form */
|
||||
|
@ -1129,11 +1125,7 @@ BOOL intAddTemplateButtons(UDWORD formID, UDWORD formWidth, UDWORD formHeight,
|
|||
|
||||
|
||||
// On the playstation the tips are additionaly setup when they are displayed ... because we only have one text name buffer
|
||||
#ifdef HASH_NAMES
|
||||
strncpy(aButText, "TempTip", DES_COMPBUTMAXCHAR);
|
||||
#else
|
||||
strncpy(aButText, getTemplateName( psTempl ), DES_COMPBUTMAXCHAR);
|
||||
#endif
|
||||
sButInit.pTip = getTemplateName(psTempl);
|
||||
|
||||
BufferID = GetStatBuffer();
|
||||
|
@ -4093,9 +4085,7 @@ static BOOL intValidTemplate(DROID_TEMPLATE *psTempl)
|
|||
psTempl->droidType = droidTemplateType(psTempl);
|
||||
|
||||
/* copy current name into template */
|
||||
#ifndef HASH_NAMES
|
||||
strcpy( sCurrDesign.aName, aCurrName );
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -4163,7 +4153,6 @@ static void intSetButtonFlash( UDWORD id, BOOL bFlash )
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef HASH_NAMES
|
||||
/*
|
||||
* desTemplateNameCustomised
|
||||
*
|
||||
|
@ -4183,7 +4172,6 @@ static BOOL desTemplateNameCustomised( DROID_TEMPLATE *psTemplate )
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Process return codes from the design screen */
|
||||
void intProcessDesign(UDWORD id)
|
||||
|
@ -4193,9 +4181,7 @@ void intProcessDesign(UDWORD id)
|
|||
UDWORD currID;
|
||||
// DES_COMPMODE currCompMode;
|
||||
UDWORD i;
|
||||
#ifndef HASH_NAMES
|
||||
BOOL bTemplateNameCustomised;
|
||||
#endif
|
||||
|
||||
// if (pie_GetRenderEngine() == ENGINE_GLIDE)
|
||||
// {
|
||||
|
@ -4216,12 +4202,7 @@ void intProcessDesign(UDWORD id)
|
|||
|
||||
strncpy(aCurrName, strresGetString(psStringRes, STR_DES_NEWVEH),
|
||||
WIDG_MAXSTR-1);
|
||||
#ifdef HASH_NAMES
|
||||
// sCurrDesign.NameHash=HashString(aCurrName);
|
||||
sCurrDesign.NameHash=0; // As we are creating a new design the name must be NULL - This is needed for the save games
|
||||
#else
|
||||
strcpy( sCurrDesign.aName, aCurrName );
|
||||
#endif
|
||||
// strncpy(aCurrName, strresGetString(psStringRes, STR_DES_NEWVEH),
|
||||
// WIDG_MAXSTR-1);
|
||||
|
||||
|
@ -4262,12 +4243,9 @@ void intProcessDesign(UDWORD id)
|
|||
{
|
||||
/* Set the new template */
|
||||
memcpy(&sCurrDesign, psTempl, sizeof(DROID_TEMPLATE));
|
||||
#ifdef HASH_NAMES
|
||||
strncpy(aCurrName, strresGetString(NULL,psTempl->NameHash), WIDG_MAXSTR-1);
|
||||
#else
|
||||
//strcpy( sCurrDesign.aName, aCurrName );
|
||||
strncpy( aCurrName, getTemplateName(psTempl), WIDG_MAXSTR-1);
|
||||
#endif
|
||||
|
||||
/* reveal body and propulsion component buttons */
|
||||
widgReveal( psWScreen, IDDES_BODYBUTTON );
|
||||
widgReveal( psWScreen, IDDES_PROPBUTTON );
|
||||
|
@ -4355,9 +4333,7 @@ void intProcessDesign(UDWORD id)
|
|||
else if (id >= IDDES_COMPSTART && id <= IDDES_COMPEND)
|
||||
{
|
||||
/* check whether can change template name */
|
||||
#ifndef HASH_NAMES
|
||||
bTemplateNameCustomised = desTemplateNameCustomised( &sCurrDesign );
|
||||
#endif
|
||||
|
||||
/* Component stats button has been pressed - clear the old button */
|
||||
if (desCompID != 0)
|
||||
|
@ -4582,13 +4558,11 @@ void intProcessDesign(UDWORD id)
|
|||
intSetBodyPoints(&sCurrDesign);
|
||||
|
||||
/* update name if not customised */
|
||||
#ifndef HASH_NAMES
|
||||
if ( bTemplateNameCustomised == FALSE )
|
||||
{
|
||||
strcpy( sCurrDesign.aName,
|
||||
GetDefaultTemplateName(&sCurrDesign) );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Update the name in the edit box */
|
||||
intSetEditBoxTextFromTemplate( &sCurrDesign );
|
||||
|
@ -4645,9 +4619,7 @@ void intProcessDesign(UDWORD id)
|
|||
else if (id >= IDDES_EXTRASYSSTART && id <= IDDES_EXTRASYSEND)
|
||||
{
|
||||
/* check whether can change template name */
|
||||
#ifndef HASH_NAMES
|
||||
bTemplateNameCustomised = desTemplateNameCustomised( &sCurrDesign );
|
||||
#endif
|
||||
|
||||
// Extra component stats button has been pressed - clear the old button
|
||||
if (desCompID != 0)
|
||||
|
@ -4751,13 +4723,12 @@ void intProcessDesign(UDWORD id)
|
|||
intSetBodyPoints(&sCurrDesign);
|
||||
|
||||
/* update name if not customised */
|
||||
#ifndef HASH_NAMES
|
||||
if ( bTemplateNameCustomised == FALSE )
|
||||
{
|
||||
strcpy( sCurrDesign.aName,
|
||||
GetDefaultTemplateName(&sCurrDesign) );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Update the name in the edit box */
|
||||
intSetEditBoxTextFromTemplate( &sCurrDesign );
|
||||
|
||||
|
@ -4808,12 +4779,9 @@ void intProcessDesign(UDWORD id)
|
|||
break;
|
||||
/* The name edit box */
|
||||
case IDDES_NAMEBOX:
|
||||
#ifdef HASH_NAMES
|
||||
#else
|
||||
strncpy(sCurrDesign.aName, widgGetString(psWScreen, IDDES_NAMEBOX),
|
||||
DROID_MAXNAME);
|
||||
strncpy(aCurrName, sCurrDesign.aName,WIDG_MAXSTR-1);
|
||||
#endif
|
||||
break;
|
||||
case IDDES_BIN:
|
||||
/* Find the template for the current button */
|
||||
|
@ -4895,12 +4863,9 @@ void intProcessDesign(UDWORD id)
|
|||
|
||||
/* Set the new template */
|
||||
memcpy(&sCurrDesign, psTempl, sizeof(DROID_TEMPLATE));
|
||||
#ifdef HASH_NAMES
|
||||
strncpy(aCurrName, strresGetString(NULL,psTempl->NameHash), WIDG_MAXSTR-1);
|
||||
#else
|
||||
//strcpy( sCurrDesign.aName, aCurrName );
|
||||
strncpy( aCurrName, getTemplateName(psTempl), WIDG_MAXSTR-1);
|
||||
#endif
|
||||
|
||||
intSetEditBoxTextFromTemplate( psTempl );
|
||||
|
||||
intSetDesignStats(&sCurrDesign);
|
||||
|
@ -5576,12 +5541,8 @@ BOOL saveTemplate(void)
|
|||
|
||||
/* Copy the template */
|
||||
memcpy(psTempl, &sCurrDesign, sizeof(DROID_TEMPLATE));
|
||||
#ifdef HASH_NAMES
|
||||
// NameHash already copied
|
||||
#else
|
||||
strncpy(psTempl->aName, aCurrName, DROID_MAXNAME);
|
||||
psTempl->aName[DROID_MAXNAME - 1] = 0;
|
||||
#endif
|
||||
|
||||
/* Now update the droid template form */
|
||||
widgDelete(psWScreen, IDDES_TEMPLFORM);
|
||||
|
|
195
src/droid.c
195
src/droid.c
|
@ -2784,9 +2784,6 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
int cnt;
|
||||
UDWORD NumDroids = 0, i, player;
|
||||
char componentName[MAX_NAME_SIZE];
|
||||
#ifdef HASH_NAMES
|
||||
char droidName[MAX_NAME_SIZE];
|
||||
#endif
|
||||
BOOL found = FALSE; //,EndOfFile;
|
||||
DROID_TEMPLATE *pDroidDesign;
|
||||
COMP_BASE_STATS *pStats;
|
||||
|
@ -2795,14 +2792,7 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
#ifdef STORE_RESOURCE_ID
|
||||
// char *pDroidName = droidName;
|
||||
#endif
|
||||
#ifdef RESOURCE_NAMES
|
||||
UDWORD id;
|
||||
#endif
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedName;
|
||||
#else
|
||||
UDWORD id;
|
||||
#endif
|
||||
|
||||
|
||||
/* init default template */
|
||||
|
@ -2822,23 +2812,15 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
}
|
||||
memset(pDroidDesign, 0, sizeof(DROID_TEMPLATE));
|
||||
|
||||
#ifndef HASH_NAMES
|
||||
//pDroidDesign->pName = pDroidDesign->aName;
|
||||
//only fill in aName now
|
||||
pDroidDesign->pName = NULL;
|
||||
#endif
|
||||
|
||||
//read the data into the storage - the data is delimited using comma's
|
||||
componentName[0] = '\0';
|
||||
sscanf(pDroidData, "%[^','],%d,%n", componentName, &templateID, &cnt);
|
||||
pDroidData += cnt;
|
||||
|
||||
// Hideous mishmash of ifdef's ... sorry about that
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(componentName);
|
||||
pDroidDesign->NameHash=HashedName;
|
||||
strcpy(droidName,strresGetString(NULL,HashedName));
|
||||
#else
|
||||
|
||||
//We ain't EVER going back to the way it was so..just store the long (translated) name in aName
|
||||
/*#ifdef RESOURCE_NAMES
|
||||
|
@ -2883,7 +2865,6 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
//get the string from the id and copy into the Name space
|
||||
strcpy(pDroidDesign->aName,strresGetString(psStringRes, id));
|
||||
pDroidDesign->aName[DROID_MAXNAME-1] = 0;
|
||||
#endif
|
||||
|
||||
//store the unique template id
|
||||
|
||||
|
@ -2910,17 +2891,10 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(componentName);
|
||||
#endif
|
||||
for (inc=0; inc < numBodyStats; inc++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (pStats->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(componentName, pStats->pName))
|
||||
#endif
|
||||
{
|
||||
pDroidDesign->asParts[COMP_BODY] = inc;
|
||||
found = TRUE;
|
||||
|
@ -2955,17 +2929,11 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(componentName);
|
||||
#endif
|
||||
|
||||
for (inc=0; inc < numBrainStats; inc++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (pStats->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(componentName, pStats->pName))
|
||||
#endif
|
||||
{
|
||||
pDroidDesign->asParts[COMP_BRAIN] = inc;
|
||||
found = TRUE;
|
||||
|
@ -3001,17 +2969,10 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(componentName);
|
||||
#endif
|
||||
for (inc=0; inc < numConstructStats; inc++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (pStats->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(componentName, pStats->pName))
|
||||
#endif
|
||||
{
|
||||
pDroidDesign->asParts[COMP_CONSTRUCT] = inc;
|
||||
found = TRUE;
|
||||
|
@ -3046,17 +3007,10 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(componentName);
|
||||
#endif
|
||||
for (inc=0; inc < numECMStats; inc++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (pStats->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(componentName, pStats->pName))
|
||||
#endif
|
||||
{
|
||||
pDroidDesign->asParts[COMP_ECM] = inc;
|
||||
found = TRUE;
|
||||
|
@ -3098,17 +3052,10 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(componentName);
|
||||
#endif
|
||||
for (inc=0; inc < numPropulsionStats; inc++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (pStats->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(componentName, pStats->pName))
|
||||
#endif
|
||||
{
|
||||
pDroidDesign->asParts[COMP_PROPULSION] = inc;
|
||||
found = TRUE;
|
||||
|
@ -3143,17 +3090,10 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(componentName);
|
||||
#endif
|
||||
for (inc=0; inc < numRepairStats; inc++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (pStats->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(componentName, pStats->pName))
|
||||
#endif
|
||||
{
|
||||
pDroidDesign->asParts[COMP_REPAIRUNIT] = inc;
|
||||
found = TRUE;
|
||||
|
@ -3224,18 +3164,10 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(componentName);
|
||||
#endif
|
||||
|
||||
for (inc=0; inc < numSensorStats; inc++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (pStats->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(componentName, pStats->pName))
|
||||
#endif
|
||||
{
|
||||
pDroidDesign->asParts[COMP_SENSOR] = inc;
|
||||
found = TRUE;
|
||||
|
@ -3245,11 +3177,7 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
}
|
||||
if (!found)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "Sensor not found for droid Template: %s", strresGetString( NULL, pDroidDesign->NameHash ) );
|
||||
#else
|
||||
debug( LOG_ERROR, "Sensor not found for droid Template: %s", pDroidDesign->aName );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3265,13 +3193,8 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
pDroidDesign->numWeaps) || */
|
||||
if (pDroidDesign->numWeaps > DROID_MAXWEAPS)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "Too many weapons have been allocated for droid Template: %s (%x)", strresGetString( NULL, pDroidDesign->NameHash ), pDroidDesign->NameHash );
|
||||
#else
|
||||
debug( LOG_ERROR, "Too many weapons have been allocated for droid Template: %s", pDroidDesign->aName );
|
||||
#endif
|
||||
abort();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
//check that not allocating more programs than allowed
|
||||
|
@ -3279,11 +3202,7 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
pDroidDesign->numProgs) ||
|
||||
pDroidDesign->numProgs > DROID_MAXPROGS)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
DBERROR(("Too many programs have been allocated for droid Template: %s",strresGetString(NULL,pDroidDesign->NameHash)));
|
||||
#else
|
||||
DBERROR(("Too many programs have been allocated for droid Template: %s",getName(pDroidDesign->pName)));
|
||||
#endif
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
|
@ -3493,9 +3412,7 @@ BOOL loadDroidWeapons(char *pWeaponData, UDWORD bufferSize)
|
|||
BOOL recFound;
|
||||
UWORD SkippedWeaponCount=0;
|
||||
SDWORD incW[DROID_MAXWEAPS];
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedName;
|
||||
#endif
|
||||
|
||||
//initialise the store count variable
|
||||
for (player=0; player < MAX_PLAYERS; player++)
|
||||
{
|
||||
|
@ -3538,21 +3455,12 @@ BOOL loadDroidWeapons(char *pWeaponData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(TemplateName);
|
||||
#endif
|
||||
|
||||
if (player < MAX_PLAYERS)
|
||||
{
|
||||
for(pTemplate = apsDroidTemplates[player]; pTemplate != NULL; pTemplate =
|
||||
pTemplate->psNext)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (pTemplate->NameHash==HashedName)
|
||||
#else
|
||||
//if (!(strcmp(TemplateName, pTemplate->pName)))
|
||||
if (!(strcmp(TemplateName, pTemplate->aName)))
|
||||
#endif
|
||||
{
|
||||
//Template found
|
||||
recFound = TRUE;
|
||||
|
@ -3563,12 +3471,7 @@ BOOL loadDroidWeapons(char *pWeaponData, UDWORD bufferSize)
|
|||
if (!recFound)
|
||||
{
|
||||
pTemplate = &sDefaultDesignTemplate;
|
||||
#ifdef HASH_NAMES
|
||||
if (pTemplate->NameHash!=HashedName)
|
||||
#else
|
||||
//if ( strcmp(TemplateName, pTemplate->pName) )
|
||||
if ( strcmp(TemplateName, pTemplate->aName) )
|
||||
#endif
|
||||
{
|
||||
debug( LOG_ERROR, "Unable to find Template - %s", TemplateName );
|
||||
abort();
|
||||
|
@ -3656,10 +3559,6 @@ BOOL loadDroidWeapons(char *pWeaponData, UDWORD bufferSize)
|
|||
BOOL recFound;
|
||||
UWORD SkippedProgramCount=0;
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedTemplateName,HashedProgramName;
|
||||
#endif
|
||||
|
||||
//initialise the store count variable
|
||||
for (player=0; player < MAX_PLAYERS; player++)
|
||||
{
|
||||
|
@ -3695,10 +3594,6 @@ BOOL loadDroidWeapons(char *pWeaponData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HASH_NAMES
|
||||
HashedTemplateName=HashString(TemplateName);
|
||||
HashedProgramName=HashString(ProgramName);
|
||||
#endif
|
||||
|
||||
if (player < MAX_PLAYERS)
|
||||
{
|
||||
|
@ -3707,22 +3602,13 @@ BOOL loadDroidWeapons(char *pWeaponData, UDWORD bufferSize)
|
|||
pTemplate->psNext)
|
||||
{
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
if (pTemplate->NameHash==HashedTemplateName)
|
||||
#else
|
||||
//if (!(strcmp(TemplateName, pTemplate->pName)))
|
||||
if (!(strcmp(TemplateName, pTemplate->aName)))
|
||||
#endif
|
||||
{
|
||||
|
||||
//Template found
|
||||
for (incP=0; incP < numProgramStats; incP++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (pPrograms[incP].NameHash==HashedProgramName)
|
||||
#else
|
||||
if (!(strcmp(ProgramName, pPrograms[incP].pName)))
|
||||
#endif
|
||||
{
|
||||
//Program found, alloc this to the current Template
|
||||
pTemplate->asProgs[pTemplate->storeCount] = incP;
|
||||
|
@ -4187,13 +4073,8 @@ DROID* buildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y, UDWORD player,
|
|||
//fill in other details
|
||||
//psDroid->pTemplate = pTemplate;
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
psDroid->HashedDroidName=pTemplate->NameHash;
|
||||
droidSetName(psDroid,strresGetString(NULL,pTemplate->NameHash));
|
||||
#else
|
||||
//droidSetName(psDroid,pTemplate->pName);
|
||||
droidSetName(psDroid,pTemplate->aName);
|
||||
#endif
|
||||
|
||||
// Set the droids type
|
||||
psDroid->droidType = droidTemplateType(pTemplate);
|
||||
|
||||
|
@ -5294,17 +5175,11 @@ DROID_TEMPLATE * getTemplateFromName(char *pName)
|
|||
UDWORD player;
|
||||
DROID_TEMPLATE *psCurr;
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedName=HashString(pName);
|
||||
#endif
|
||||
|
||||
#ifdef RESOURCE_NAMES
|
||||
|
||||
if (!getResourceName(pName))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*all droid and template names are now stored as the translated
|
||||
|
@ -5330,12 +5205,7 @@ DROID_TEMPLATE * getTemplateFromName(char *pName)
|
|||
*/
|
||||
for (psCurr = apsDroidTemplates[player]; psCurr != NULL; psCurr = psCurr->psNext)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (psCurr->NameHash==HashedName)
|
||||
#else
|
||||
//if (!strcmp(psCurr->pName, pName))
|
||||
if (!strcmp(psCurr->aName, pName))
|
||||
#endif
|
||||
{
|
||||
//if template is selectedPlayers' it must be a CYBORG or we ignore it
|
||||
|
||||
|
@ -5599,22 +5469,7 @@ UDWORD getBound(UDWORD level)
|
|||
//
|
||||
char *droidGetName(DROID *psDroid)
|
||||
{
|
||||
#ifndef HASH_NAMES
|
||||
return (psDroid->aName);
|
||||
#else
|
||||
const char ConstructedName[]="Body Mk XXIV"; // dummy name
|
||||
|
||||
// if the hashed name is 0 - it must be a user created droid so we construct its name
|
||||
if (psDroid->HashedDroidName!=0x0)
|
||||
{
|
||||
char *DroidName;
|
||||
DroidName=strresGetString(NULL,psDroid->HashedDroidName);
|
||||
if (DroidName!=NULL) return(DroidName); // if we found a name then return it... other wise build the name
|
||||
}
|
||||
|
||||
return(ConstructedName);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -5626,10 +5481,8 @@ char *droidGetName(DROID *psDroid)
|
|||
//
|
||||
void droidSetName(DROID *psDroid,const char *pName)
|
||||
{
|
||||
#ifndef HASH_NAMES
|
||||
strncpy(psDroid->aName,pName, DROID_MAXNAME);
|
||||
psDroid->aName[DROID_MAXNAME-1] = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -6240,10 +6093,6 @@ void setUpBuildModule(DROID *psDroid)
|
|||
|
||||
// We just need 1 buffer for the current displayed droid (or template) name
|
||||
#define MAXCONNAME WIDG_MAXSTR //(32)
|
||||
#ifdef HASH_NAMES
|
||||
static char ConstructedName[MAXCONNAME+1]="Body Mk XXIV"; // dummy name
|
||||
#endif
|
||||
|
||||
|
||||
char *getDroidName(DROID *psDroid)
|
||||
{
|
||||
|
@ -6260,41 +6109,6 @@ char *getDroidName(DROID *psDroid)
|
|||
a string ID or something the user types in*/
|
||||
char* getTemplateName(DROID_TEMPLATE *psTemplate)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
char *TempName;
|
||||
|
||||
char *NewName;
|
||||
/* - Performed in GetDefaultTemplateName - with other droids
|
||||
|
||||
// We only want database name if it's a cyborg.
|
||||
if(psTemplate->droidType == DROID_CYBORG) {
|
||||
if (psTemplate->NameHash!=NULL)
|
||||
{
|
||||
TempName=(strresGetString(psStringRes, psTemplate->NameHash));
|
||||
if (TempName!=NULL)
|
||||
{
|
||||
// DBPRINTF(("name1 [%s]\n",TempName));
|
||||
return(TempName);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// If the above failed or it's not a cyborg then construct the name from the components.
|
||||
NewName=GetDefaultTemplateName(psTemplate);
|
||||
|
||||
if (NewName==NULL || NewName[0]==0)
|
||||
{
|
||||
// No name ... we assume its the NEW VEHICLE BUTTON
|
||||
strcpy(ConstructedName, strresGetString(psStringRes, STR_DES_NEWVEH));
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(ConstructedName,NewName,MAXCONNAME);
|
||||
}
|
||||
return(ConstructedName);
|
||||
|
||||
#else
|
||||
//char *pNameID=psTemplate->pName;
|
||||
char *pNameID = psTemplate->aName;
|
||||
#ifdef STORE_RESOURCE_ID
|
||||
UDWORD id;
|
||||
|
@ -6316,13 +6130,12 @@ char* getTemplateName(DROID_TEMPLATE *psTemplate)
|
|||
{
|
||||
return pNameID;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
#else
|
||||
//just return the name passed in
|
||||
return pNameID;
|
||||
#endif
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Just returns true if the droid's present body points aren't as high as the original*/
|
||||
|
|
|
@ -211,14 +211,10 @@ BOOL loadFeatureStats(char *pFeatureData, UDWORD bufferSize)
|
|||
psFeature->baseBreadth=(UWORD)Breadth;
|
||||
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
psFeature->NameHash=HashString(featureName);
|
||||
#else
|
||||
if (!allocateName(&psFeature->pName, featureName))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
//determine the feature type
|
||||
featureType(psFeature, type);
|
||||
|
@ -243,11 +239,7 @@ BOOL loadFeatureStats(char *pFeatureData, UDWORD bufferSize)
|
|||
psFeature->psImd = (iIMDShape *) resGetData("IMD", GfxFile);
|
||||
if (psFeature->psImd == NULL)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "Cannot find the feature PIE for record %s", strresGetString( NULL, psFeature->NameHash ) );
|
||||
#else
|
||||
debug( LOG_ERROR, "Cannot find the feature PIE for record %s", getName( psFeature->pName ) );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1181,10 +1173,6 @@ SDWORD getFeatureStatFromName( char *pName )
|
|||
UDWORD inc;
|
||||
FEATURE_STATS *psStat;
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedName=HashString(pName);
|
||||
#endif
|
||||
|
||||
#ifdef RESOURCE_NAMES
|
||||
|
||||
if (!getResourceName(pName))
|
||||
|
@ -1197,11 +1185,7 @@ SDWORD getFeatureStatFromName( char *pName )
|
|||
for (inc = 0; inc < numFeatureStats; inc++)
|
||||
{
|
||||
psStat = &asFeatureStats[inc];
|
||||
#ifdef HASH_NAMES
|
||||
if (psStat->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(psStat->pName, pName))
|
||||
#endif
|
||||
{
|
||||
return inc;
|
||||
}
|
||||
|
|
|
@ -301,9 +301,6 @@ BOOL loadFunctionStats(char *pFunctionData, UDWORD bufferSize)
|
|||
// Allocate storage for the name
|
||||
BOOL storeName(FUNCTION* pFunction, char* pNameToStore)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
pFunction->NameHash=HashString(pNameToStore);
|
||||
#else
|
||||
pFunction->pName = (char *)MALLOC(strlen(pNameToStore)+1);
|
||||
if (pFunction->pName == NULL)
|
||||
{
|
||||
|
@ -312,7 +309,6 @@ BOOL storeName(FUNCTION* pFunction, char* pNameToStore)
|
|||
return FALSE;
|
||||
}
|
||||
strcpy(pFunction->pName,pNameToStore);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -368,10 +364,8 @@ BOOL loadProduction(char *pData)
|
|||
UDWORD productionOutput;
|
||||
//char propulsionType[MAX_NAME_SIZE];
|
||||
//PROPULSION_TYPES* pPropulsionType;
|
||||
/*#ifdef HASH_NAMES
|
||||
UDWORD HashedName;
|
||||
#endif*/
|
||||
//allocate storage
|
||||
|
||||
psFunction = (PRODUCTION_FUNCTION *)MALLOC(sizeof(PRODUCTION_FUNCTION));
|
||||
if (psFunction == NULL)
|
||||
{
|
||||
|
@ -403,17 +397,10 @@ BOOL loadProduction(char *pData)
|
|||
//get the propulsion stats pointer
|
||||
/* pPropulsionType = asPropulsionTypes;
|
||||
psFunction->propulsionType = 0;
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(propulsionType);
|
||||
#endif
|
||||
for (i=0; i < numPropulsionTypes; i++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (HashedName== pPropulsionType->NameHash)
|
||||
#else
|
||||
if (!strcmp(propulsionType, pPropulsionType->pName))
|
||||
#endif
|
||||
{
|
||||
psFunction->propulsionType = pPropulsionType;
|
||||
break;
|
||||
|
@ -1433,9 +1420,6 @@ BOOL loadRepairDroidFunction(char *pData)
|
|||
char repairType[MAX_NAME_SIZE];
|
||||
REPAIR_STATS* pRepairType;
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedName;
|
||||
#endif
|
||||
//allocate storage
|
||||
psFunction = (REPAIR_UPGRADE_FUNCTION *)MALLOC(sizeof(REPAIR_UPGRADE_FUNCTION));
|
||||
if (psFunction == NULL)
|
||||
|
@ -1472,19 +1456,11 @@ BOOL loadRepairDroidFunction(char *pData)
|
|||
//get the repair stats pointer
|
||||
pRepairType = asRepairStats;
|
||||
psFunction->pRepair = NULL;
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(repairType);
|
||||
#endif
|
||||
|
||||
|
||||
for (i=0; i < numRepairStats; i++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (HashedName== pRepairType->NameHash)
|
||||
#else
|
||||
if (!strcmp(repairType, pRepairType->pName))
|
||||
#endif
|
||||
{
|
||||
psFunction->pRepair = pRepairType;
|
||||
break;
|
||||
|
@ -1586,16 +1562,12 @@ BOOL loadWallFunction(char *pData)
|
|||
return FALSE;
|
||||
}
|
||||
strcpy(psFunction->pStructName,structureName);*/
|
||||
#ifdef HASH_NAMES
|
||||
psFunction->StructNameHash=HashString(structureName);
|
||||
#else
|
||||
if (!allocateName(&psFunction->pStructName, structureName))
|
||||
{
|
||||
debug( LOG_ERROR, "Structure Stats Invalid for function - %s", functionName );
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
psFunction->pCornerStat = NULL;
|
||||
|
||||
return TRUE;
|
||||
|
@ -2258,9 +2230,7 @@ BOOL FunctionShutDown(void)
|
|||
for (inc=0; inc < numFunctions; inc++)
|
||||
{
|
||||
pFunction = *asFunctions;
|
||||
#ifndef HASH_NAMES
|
||||
FREE(pFunction->pName);
|
||||
#endif
|
||||
|
||||
//#ifndef RESOURCE_NAMES
|
||||
#if !defined (RESOURCE_NAMES) && !defined(STORE_RESOURCE_ID)
|
||||
|
|
|
@ -70,17 +70,11 @@ enum FUNCTION_TYPES
|
|||
|
||||
/*Common stats for all Structure Functions*/
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
#define FUNCTION_STATS \
|
||||
UDWORD ref; /* Unique ID of the item */ \
|
||||
UDWORD NameHash; /* Hashed version of Text name of the component */ \
|
||||
UBYTE type /* The type of Function */
|
||||
#else
|
||||
#define FUNCTION_STATS \
|
||||
UDWORD ref; /* Unique ID of the item */ \
|
||||
char* pName; /* Text name of the component */ \
|
||||
UBYTE type /* The type of Function */
|
||||
#endif
|
||||
|
||||
/*Common struct for all functions*/
|
||||
typedef struct _function
|
||||
{
|
||||
|
@ -120,11 +114,7 @@ typedef struct _wall_function
|
|||
{
|
||||
//common stats
|
||||
FUNCTION_STATS;
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD StructNameHash;
|
||||
#else
|
||||
char *pStructName; //storage space for the name so can work out
|
||||
#endif
|
||||
//which stat when structs are loaded in
|
||||
struct _structure_stats *pCornerStat; //pointer to which stat to use as a corner wall
|
||||
} WALL_FUNCTION;
|
||||
|
|
15
src/game.c
15
src/game.c
|
@ -17,9 +17,6 @@
|
|||
along with Warzone 2100; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/*
|
||||
ALL PSX, HASH_NAMES AND WIN32 excluded stuff removed - Alex M.
|
||||
*/
|
||||
|
||||
/* Standard library headers */
|
||||
#include <physfs.h>
|
||||
|
@ -5938,11 +5935,7 @@ static BOOL buildSaveDroidFromDroid(SAVE_DROID* psSaveDroid, DROID* psCurr, DROI
|
|||
//psSaveDroid->numWeaps = psCurr->numWeaps;
|
||||
/*for (i=0; i < psCurr->numWeaps; i++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (!getHashFromComp(COMP_WEAPON, &psSaveDroid->asWeaps[i].NameHash, psCurr->asWeaps[i].nStat))
|
||||
#else
|
||||
if (!getNameFromComp(COMP_WEAPON, psSaveDroid->asWeaps[i].name, psCurr->asWeaps[i].nStat))
|
||||
#endif
|
||||
{
|
||||
//ignore this record
|
||||
//continue;
|
||||
|
@ -6128,11 +6121,7 @@ static BOOL buildSaveDroidFromDroid(SAVE_DROID* psSaveDroid, DROID* psCurr, DROI
|
|||
psSaveDroid->numProgs = psCurr->numProgs;
|
||||
for (i=0; i < psCurr->numProgs; i++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (!getHashFromComp(COMP_PROGRAM, & psSaveDroid->HashProgs[i], psCurr->asProgs[i].psStats - asProgramStats))
|
||||
#else
|
||||
if (!getNameFromComp(COMP_PROGRAM, psSaveDroid->asProgs[i], psCurr->asProgs[i].psStats - asProgramStats))
|
||||
#endif
|
||||
{
|
||||
//ignore this record
|
||||
continue;
|
||||
|
@ -9554,11 +9543,7 @@ static BOOL writeCompListFile(char *pFileName)
|
|||
/*for(i = 0; i < numProgramStats; i++)
|
||||
{
|
||||
psStats = (COMP_BASE_STATS *)(asProgramStats + i);
|
||||
#ifdef HASH_NAMES
|
||||
psSaveCompList->NameHash=psStats->NameHash;
|
||||
#else
|
||||
strcpy(psSaveCompList->name, psStats->pName);
|
||||
#endif
|
||||
psSaveCompList->type = COMP_PROGRAM;
|
||||
psSaveCompList->player = (UBYTE)player;
|
||||
psSaveCompList->state = apCompLists[player][COMP_PROGRAM][i];
|
||||
|
|
20
src/hci.c
20
src/hci.c
|
@ -4773,19 +4773,11 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
ASSERT( FALSE, "intAddObject: invalid structure type" );
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
sBFormInit.pTip = strresGetString(NULL,(((STRUCTURE *)psObj)->pStructureType->NameHash));
|
||||
#else
|
||||
sBFormInit.pTip = getName(((STRUCTURE *)psObj)->pStructureType->pName);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case OBJ_FEATURE:
|
||||
#ifdef HASH_NAMES
|
||||
sBFormInit.pTip = strresGetString(NULL,(((FEATURE *)psObj)->psStats->NameHash));
|
||||
#else
|
||||
sBFormInit.pTip = getName(((FEATURE *)psObj)->psStats->pName);
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -4874,11 +4866,7 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
sBFormInit2.pTip = strresGetString(NULL,psStats->NameHash);
|
||||
#else
|
||||
sBFormInit2.pTip = getName(psStats->pName);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -5499,11 +5487,7 @@ static void intSetStats(UDWORD id, BASE_STATS *psStats)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
sFormInit.pTip = strresGetString(NULL,psStats->NameHash);
|
||||
#else
|
||||
sFormInit.pTip = getName(psStats->pName);
|
||||
#endif
|
||||
}
|
||||
|
||||
BufferID = (sFormInit.id-IDOBJ_STATSTART)*2+1;
|
||||
|
@ -5930,11 +5914,7 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
sBFormInit.pTip = strresGetString(NULL,ppsStatsList[i]->NameHash);
|
||||
#else
|
||||
sBFormInit.pTip = getName(ppsStatsList[i]->pName);
|
||||
#endif
|
||||
}
|
||||
BufferID = i;
|
||||
ASSERT( BufferID < NUM_STATBUFFERS,"BufferID > NUM_STATBUFFERS" );
|
||||
|
|
|
@ -134,7 +134,6 @@ void embalm(BASE_OBJECT *psDead)
|
|||
psSlot->died = psDead->died;
|
||||
|
||||
pName = NULL;
|
||||
#ifndef HASH_NAMES
|
||||
switch (psDead->type)
|
||||
{
|
||||
case OBJ_BULLET:
|
||||
|
@ -152,7 +151,6 @@ void embalm(BASE_OBJECT *psDead)
|
|||
pName = ((FEATURE *)psDead)->psStats->pName;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pName != NULL)
|
||||
{
|
||||
|
|
154
src/research.c
154
src/research.c
|
@ -129,13 +129,8 @@ UDWORD aDefaultSensor[MAX_PLAYERS];
|
|||
UDWORD aDefaultECM[MAX_PLAYERS];
|
||||
UDWORD aDefaultRepair[MAX_PLAYERS];
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
static UWORD setIconIDFromHashedName(char *pIconName, UDWORD NameHash);
|
||||
#else
|
||||
//set the iconID based on the name read in in the stats
|
||||
static UWORD setIconID(char *pIconName, char *pName);
|
||||
#endif
|
||||
|
||||
static COMP_BASE_STATS * getComponentDetails(char *pName, char *pCompName);
|
||||
static void replaceComponent(COMP_BASE_STATS *pNewComponent, COMP_BASE_STATS *pOldComponent,
|
||||
UBYTE player);
|
||||
|
@ -144,11 +139,7 @@ static BOOL checkResearchName(RESEARCH *psRes, UDWORD numStats);
|
|||
|
||||
static char *getResearchName(RESEARCH *pResearch)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
return(strresGetString(NULL,pResearch->NameHash));
|
||||
#else
|
||||
return(getName(pResearch->pName));
|
||||
#endif
|
||||
}
|
||||
|
||||
//flag that indicates whether the player can self repair
|
||||
|
@ -330,14 +321,10 @@ BOOL loadResearch(char *pResearchData, UDWORD bufferSize)
|
|||
//allocate storage for the name
|
||||
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
pResearch->NameHash=HashString(ResearchName);
|
||||
#else
|
||||
if (!allocateName(&pResearch->pName, ResearchName))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
//check the name hasn't been used already
|
||||
if (!checkResearchName(pResearch, i))
|
||||
|
@ -407,11 +394,7 @@ BOOL loadResearch(char *pResearchData, UDWORD bufferSize)
|
|||
}*/
|
||||
if (strcmp(ResearchName, "0"))
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
pResearch->subGroup = setIconIDFromHashedName(ResearchName, pResearch->NameHash);
|
||||
#else
|
||||
pResearch->subGroup = setIconID(ResearchName, pResearch->pName);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -487,11 +470,7 @@ BOOL loadResearch(char *pResearchData, UDWORD bufferSize)
|
|||
//set the iconID
|
||||
if (strcmp(iconID, "0"))
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
pResearch->iconID = setIconIDFromHashedName(iconID, pResearch->NameHash);
|
||||
#else
|
||||
pResearch->iconID = setIconID(iconID, pResearch->pName);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -813,17 +792,10 @@ BOOL loadResearchPR(char *pPRData, UDWORD bufferSize)
|
|||
char *pStartPRData;
|
||||
UDWORD NumToAlloc = 0, i;
|
||||
char ResearchName[MAX_NAME_SIZE], PRName[MAX_NAME_SIZE];
|
||||
//UBYTE incR, incPR;
|
||||
UWORD incR, incPR;
|
||||
UWORD incR, incPR;
|
||||
RESEARCH *pResearch = asResearch, *pPRResearch = asResearch;
|
||||
BOOL recFound;
|
||||
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedResearchName;
|
||||
UDWORD HashedPRName;
|
||||
#endif
|
||||
|
||||
pStartPRData = pPRData;
|
||||
|
||||
NumToAlloc = numCR(pPRData, bufferSize);
|
||||
|
@ -848,29 +820,17 @@ BOOL loadResearchPR(char *pPRData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HASH_NAMES
|
||||
HashedResearchName=HashString(ResearchName);
|
||||
HashedPRName=HashString(PRName);
|
||||
#endif
|
||||
|
||||
//loop through each Research to compare the name
|
||||
for (incR=0; incR < numResearch; incR++)
|
||||
{
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
if ( pResearch[incR].NameHash == HashedResearchName)
|
||||
#else
|
||||
if (!(strcmp(ResearchName, pResearch[incR].pName)))
|
||||
#endif
|
||||
{
|
||||
//Research found
|
||||
for (incPR=0; incPR < numResearch; incPR++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if ( pPRResearch[incPR].NameHash == HashedPRName )
|
||||
#else
|
||||
if (!(strcmp(PRName, pPRResearch[incPR].pName)))
|
||||
#endif
|
||||
{
|
||||
//check not allocating more than allowed
|
||||
if ((pResearch[incR].storeCount + 1) >
|
||||
|
@ -1090,19 +1050,12 @@ BOOL loadResearchStructures(char *pStructData, UDWORD bufferSize,UDWORD listNumb
|
|||
char *pStartStructData;
|
||||
UDWORD NumToAlloc = 0, i;
|
||||
char ResearchName[MAX_NAME_SIZE], StructureName[MAX_NAME_SIZE];
|
||||
//UBYTE incR;
|
||||
UWORD incR;
|
||||
UWORD incS;
|
||||
UWORD incR, incS;
|
||||
RESEARCH *pResearch = asResearch;
|
||||
STRUCTURE_STATS *pStructure = asStructureStats;
|
||||
BOOL recFound;
|
||||
UDWORD numToFind;
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedResearchName;
|
||||
UDWORD HashedStructureName;
|
||||
#endif
|
||||
|
||||
//initialise the storage flags
|
||||
for (incR = 0; incR < numResearch; incR++)
|
||||
{
|
||||
|
@ -1151,28 +1104,15 @@ BOOL loadResearchStructures(char *pStructData, UDWORD bufferSize,UDWORD listNumb
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
HashedResearchName=HashString(ResearchName);
|
||||
HashedStructureName=HashString(StructureName);
|
||||
#endif
|
||||
|
||||
//loop through each Research to compare the name
|
||||
for (incR=0; incR < numResearch; incR++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (pResearch[incR].NameHash==HashedResearchName)
|
||||
#else
|
||||
if (!(strcmp(ResearchName, pResearch[incR].pName)))
|
||||
#endif
|
||||
{
|
||||
//Research found
|
||||
for (incS=0; incS < numStructureStats; incS++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (pStructure[incS].NameHash==HashedStructureName)
|
||||
#else
|
||||
if (!(strcmp(StructureName, pStructure[incS].pName)))
|
||||
#endif
|
||||
{
|
||||
//Structure found - alloc this to the current Research
|
||||
switch (listNumber)
|
||||
|
@ -1263,10 +1203,6 @@ BOOL loadResearchFunctions(char *pFunctionData, UDWORD bufferSize)
|
|||
RESEARCH *pResearch = asResearch;
|
||||
FUNCTION **pFunction = asFunctions;
|
||||
BOOL recFound;
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedResearchName;
|
||||
UDWORD HashedFunctionName;
|
||||
#endif
|
||||
|
||||
//initialise the storage flags
|
||||
for (incR = 0; incR < numResearch; incR++)
|
||||
|
@ -1295,28 +1231,15 @@ BOOL loadResearchFunctions(char *pFunctionData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
HashedResearchName=HashString(ResearchName);
|
||||
HashedFunctionName=HashString(FunctionName);
|
||||
#endif
|
||||
|
||||
//loop through each Research to compare the name
|
||||
for (incR=0; incR < numResearch; incR++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (pResearch[incR].NameHash==HashedResearchName)
|
||||
#else
|
||||
if (!(strcmp(ResearchName, pResearch[incR].pName)))
|
||||
#endif
|
||||
{
|
||||
//Research found
|
||||
for (incF=0; incF < numFunctions; incF++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if ((*pFunction[incF]).NameHash==HashedFunctionName)
|
||||
#else
|
||||
if (!(strcmp(FunctionName, (*pFunction[incF]).pName)))
|
||||
#endif
|
||||
{
|
||||
//Function found alloc this to the current Research
|
||||
pResearch[incR].pFunctionList[pResearch[incR].
|
||||
|
@ -2411,34 +2334,6 @@ RESEARCH * getResearchForMsg(VIEWDATA *pViewData)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
|
||||
static UWORD setIconIDFromHashedName(char *pIconName, UDWORD NameHash)
|
||||
{
|
||||
IMAGEDEF *Image;
|
||||
UWORD i;
|
||||
UDWORD IconHash = HashString(pIconName);
|
||||
IMAGEFILE *Images = (IMAGEFILE*)resGetData("IMG","intfac.img");
|
||||
|
||||
Image = Images->ImageDefs;
|
||||
for(i=0; i<Images->Header.NumImages; i++) {
|
||||
if(IconHash == Image->HashValue) {
|
||||
// DBPRINTF(("Matched research icon #%d\n",IconHash));
|
||||
return i;
|
||||
}
|
||||
|
||||
Image++;
|
||||
}
|
||||
|
||||
//add more names as images are created
|
||||
// ASSERT( FALSE, "Invalid icon graphic %s for topic %s", pIconName, pName );
|
||||
debug( LOG_NEVER, "Failed to matched research icon %s #%d\n", pIconName, IconHash );
|
||||
|
||||
return 0; // Should never get here.
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
//set the iconID based on the name read in in the stats
|
||||
static UWORD setIconID(char *pIconName, char *pName)
|
||||
{
|
||||
|
@ -2544,8 +2439,6 @@ static UWORD setIconID(char *pIconName, char *pName)
|
|||
return 0; // Should never get here.
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
SDWORD mapRIDToIcon( UDWORD rid )
|
||||
{
|
||||
|
@ -2695,9 +2588,6 @@ COMP_BASE_STATS * getComponentDetails(char *pName, char *pCompName)
|
|||
{
|
||||
UDWORD stat, size, quantity, inc;
|
||||
COMP_BASE_STATS *pArtefact;
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedName;
|
||||
#endif
|
||||
|
||||
stat = componentType(pName);
|
||||
//get the stat list
|
||||
|
@ -2775,17 +2665,9 @@ COMP_BASE_STATS * getComponentDetails(char *pName, char *pCompName)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(pCompName);
|
||||
#endif
|
||||
|
||||
for (inc = 0; inc < quantity; inc++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (pArtefact->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(pArtefact->pName, pCompName))
|
||||
#endif
|
||||
{
|
||||
return pArtefact;
|
||||
}
|
||||
|
@ -2802,9 +2684,6 @@ RESEARCH * getResearch(char *pName, BOOL resName)
|
|||
{
|
||||
UDWORD inc;
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedName=HashString(pName);
|
||||
#endif
|
||||
//need to get the in game name if a resource name has been passed in
|
||||
if (resName)
|
||||
{
|
||||
|
@ -2817,11 +2696,7 @@ RESEARCH * getResearch(char *pName, BOOL resName)
|
|||
|
||||
for (inc=0; inc < numResearch; inc++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (asResearch[inc].NameHash==HashedName)
|
||||
#else
|
||||
if (!strcasecmp(asResearch[inc].pName, pName))
|
||||
#endif
|
||||
{
|
||||
return &asResearch[inc];
|
||||
}
|
||||
|
@ -3005,7 +2880,6 @@ void replaceComponent(COMP_BASE_STATS *pNewComponent, COMP_BASE_STATS *pOldCompo
|
|||
|
||||
/*Looks through all the currently allocated stats to check the name is not
|
||||
a duplicate*/
|
||||
#ifndef HASH_NAMES
|
||||
static BOOL checkResearchName(RESEARCH *psResearch, UDWORD numStats)
|
||||
{
|
||||
UDWORD inc;
|
||||
|
@ -3026,26 +2900,6 @@ static BOOL checkResearchName(RESEARCH *psResearch, UDWORD numStats)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static BOOL checkResearchName(RESEARCH *psResearch, UDWORD numStats)
|
||||
{
|
||||
UDWORD inc;
|
||||
|
||||
for (inc = 0; inc < numStats; inc++)
|
||||
{
|
||||
if (asResearch[inc].NameHash==psResearch->NameHash)
|
||||
{
|
||||
//oops! found the name
|
||||
ASSERT( FALSE, "Research name has already been used - %x", psResearch->NameHash );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Sets the 'possible' flag for a player's research so the topic will appear in
|
||||
the research list next time the Research Facilty is selected */
|
||||
BOOL enableResearch(RESEARCH *psResearch, UDWORD player)
|
||||
|
@ -3146,11 +3000,7 @@ void researchReward(UBYTE losingPlayer, UBYTE rewardPlayer)
|
|||
|
||||
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
#define getResearchName(res) (strresGetString(NULL,res.NameHash))
|
||||
#else
|
||||
#define getResearchName(res) (res.pName)
|
||||
#endif
|
||||
|
||||
|
||||
/*checks that the research has loaded up as expected - must be done after
|
||||
|
|
|
@ -4357,11 +4357,7 @@ BOOL scrStructureBuiltInRange(void)
|
|||
if (xdiff*xdiff + ydiff*ydiff <= rangeSquared)
|
||||
{
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
if( psCurr->pStructureType->NameHash == psTarget->NameHash )
|
||||
#else
|
||||
if( strcmp(psCurr->pStructureType->pName,psTarget->pName) == 0 )
|
||||
#endif
|
||||
{
|
||||
if (psCurr->status == SS_BUILT)
|
||||
{
|
||||
|
@ -8168,12 +8164,7 @@ BOOL scrNumStructsByStatInRange(void)
|
|||
ydiff = (SDWORD)psCurr->y - y;
|
||||
if (xdiff*xdiff + ydiff*ydiff <= rangeSquared)
|
||||
{
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
if( psCurr->pStructureType->NameHash == psTarget->NameHash )
|
||||
#else
|
||||
if( strcmp(psCurr->pStructureType->pName,psTarget->pName) == 0 )
|
||||
#endif
|
||||
{
|
||||
if(psCurr->visible[lookingPlayer]) //can we see it?
|
||||
{
|
||||
|
|
101
src/stats.c
101
src/stats.c
|
@ -260,12 +260,7 @@ void statsDealloc(COMP_BASE_STATS* pStats, UDWORD listSize, UDWORD structureSize
|
|||
|
||||
static BOOL allocateStatName(BASE_STATS* pStat, char *Name)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
pStat->NameHash=HashString(Name);
|
||||
return(TRUE);
|
||||
#else
|
||||
return (allocateName(&pStat->pName, Name));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -478,11 +473,7 @@ char *getStatName(void * Stat)
|
|||
{
|
||||
BASE_STATS *psStats=(BASE_STATS * )Stat;
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
return(strresGetString(NULL,psStats->NameHash));
|
||||
#else
|
||||
return(getName(psStats->pName));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -772,11 +763,7 @@ BOOL loadWeaponStats(char *pWeaponData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
StatsName=NULL;
|
||||
#else
|
||||
StatsName=psStats->pName;
|
||||
#endif
|
||||
|
||||
//covered by the movement model now - AB 15/06/98
|
||||
//set the homing round
|
||||
|
@ -2188,9 +2175,7 @@ BOOL loadPropulsionTypes(char *pPropTypeData, UDWORD bufferSize)
|
|||
(char*)&PropulsionName, (char*)&flightName, &multiplier);
|
||||
|
||||
//allocate storage for the name
|
||||
/*#ifdef HASH_NAMES
|
||||
asPropulsionTypes->NameHash=HashString(PropulsionName);
|
||||
#else
|
||||
/*
|
||||
asPropulsionTypes->pName = (char *)MALLOC((strlen(PropulsionName))+1);
|
||||
if (asPropulsionTypes->pName == NULL)
|
||||
{
|
||||
|
@ -2198,7 +2183,6 @@ BOOL loadPropulsionTypes(char *pPropTypeData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
strcpy(asPropulsionTypes->pName,PropulsionName);
|
||||
#endif
|
||||
*/
|
||||
//set the pointer for this record based on the name
|
||||
type = getPropulsionType(PropulsionName);
|
||||
|
@ -2395,9 +2379,7 @@ BOOL loadBodyPropulsionIMDs(char *pData, UDWORD bufferSize)
|
|||
leftIMD[MAX_NAME_SIZE], rightIMD[MAX_NAME_SIZE];
|
||||
iIMDShape **startIMDs;
|
||||
BOOL found;
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedName;
|
||||
#endif
|
||||
|
||||
//check that the body and propulsion stats have already been read in
|
||||
|
||||
ASSERT( asBodyStats != NULL, "Body Stats have not been set up" );
|
||||
|
@ -2447,19 +2429,11 @@ BOOL loadBodyPropulsionIMDs(char *pData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(bodyName);
|
||||
#endif
|
||||
|
||||
|
||||
for (numStats = 0; numStats < numBodyStats; numStats++)
|
||||
{
|
||||
psBodyStat = &asBodyStats[numStats];
|
||||
#ifdef HASH_NAMES
|
||||
if (psBodyStat->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(psBodyStat->pName, bodyName))
|
||||
#endif
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
|
@ -2479,18 +2453,10 @@ BOOL loadBodyPropulsionIMDs(char *pData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(propulsionName);
|
||||
#endif
|
||||
|
||||
for (numStats = 0; numStats < numPropulsionStats; numStats++)
|
||||
{
|
||||
psPropulsionStat = &asPropulsionStats[numStats];
|
||||
#ifdef HASH_NAMES
|
||||
if (psPropulsionStat->NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(psPropulsionStat->pName, propulsionName))
|
||||
#endif
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
|
@ -2586,13 +2552,7 @@ BOOL loadWeaponSounds(char *pSoundData, UDWORD bufferSize)
|
|||
//SBYTE *pData;
|
||||
SDWORD NumRecords = 0, i, weaponSoundID, explosionSoundID, inc, iDum;
|
||||
char WeaponName[MAX_NAME_SIZE];
|
||||
|
||||
char szWeaponWav[MAX_NAME_SIZE], szExplosionWav[MAX_NAME_SIZE];
|
||||
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedName;
|
||||
#endif
|
||||
BOOL Ok = TRUE;
|
||||
|
||||
NumRecords = numCR(pSoundData, bufferSize);
|
||||
|
@ -2625,18 +2585,9 @@ BOOL loadWeaponSounds(char *pSoundData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
HashedName=HashString(WeaponName);
|
||||
#endif
|
||||
|
||||
|
||||
for (inc = 0; inc < (SDWORD)numWeaponStats; inc++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (asWeaponStats[inc].NameHash==HashedName)
|
||||
#else
|
||||
if (!strcmp(asWeaponStats[inc].pName, WeaponName))
|
||||
#endif
|
||||
{
|
||||
asWeaponStats[inc].iAudioFireID = weaponSoundID;
|
||||
asWeaponStats[inc].iAudioImpactID = explosionSoundID;
|
||||
|
@ -3051,12 +3002,12 @@ void deallocPropulsionTypes(void)
|
|||
//UBYTE inc;
|
||||
// PROPULSION_TYPES* pList = asPropulsionTypes;
|
||||
|
||||
/*#ifndef HASH_NAMES
|
||||
/*
|
||||
for (inc=0; inc < numPropulsionTypes; inc++, pList++)
|
||||
{
|
||||
FREE(pList->pName);
|
||||
}
|
||||
#endif*/
|
||||
*/
|
||||
FREE (asPropulsionTypes);
|
||||
}
|
||||
|
||||
|
@ -3445,41 +3396,6 @@ SDWORD getCompFromName(UDWORD compType, char *pName)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
//get the component Inc for a stat based on the name and type
|
||||
//returns -1 if record not found
|
||||
SDWORD getCompFromHash(UDWORD compType, UDWORD HashedName)
|
||||
{
|
||||
BASE_STATS *psStats = NULL;
|
||||
UDWORD numStats = 0, count, statSize = 0;
|
||||
|
||||
|
||||
|
||||
getStatsDetails(compType, &psStats,&numStats,&statSize);
|
||||
|
||||
//find the stat with the same name
|
||||
|
||||
// DBPRINTF(("hunting %d stats for hash %x\n",numStats,HashedName);
|
||||
|
||||
for(count = 0; count < numStats; count++)
|
||||
{
|
||||
// DBPRINTF(("%x ",psStats->NameHash);
|
||||
if (HashedName==psStats->NameHash)
|
||||
{
|
||||
// DBPRINTF(("found at %d\n",count);
|
||||
return count;
|
||||
}
|
||||
psStats = (BASE_STATS *)((void*)psStats + statSize);
|
||||
}
|
||||
// DBPRINTF(("not found\n");
|
||||
//return -1 if record not found or an invalid component type is passed in
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//converts the name read in from Access into the name which is used in the Stat lists
|
||||
BOOL getResourceName(char *pName)
|
||||
{
|
||||
|
@ -3593,11 +3509,7 @@ BOOL setTechLevel(BASE_STATS *psStats, char *pLevel)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
ASSERT( FALSE, "Invalid stat id for %x", psStats->NameHash );
|
||||
#else
|
||||
ASSERT( FALSE, "Invalid stat id for %s", psStats->pName );
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -3781,8 +3693,6 @@ WEAPON_EFFECT getWeaponEffect(char *pWeaponEffect)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef HASH_NAMES // don't allocate name
|
||||
|
||||
/*
|
||||
looks up the name to get the resource associated with it - or allocates space
|
||||
and stores the name. Eventually ALL names will be 'resourced' for translation
|
||||
|
@ -3831,9 +3741,6 @@ BOOL allocateName(char **ppStore, char *pName)
|
|||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*Access functions for the upgradeable stats of a weapon*/
|
||||
UDWORD weaponFirePause(WEAPON_STATS *psStats, UBYTE player)
|
||||
{
|
||||
|
|
|
@ -27,17 +27,10 @@
|
|||
#define _statsdef_h
|
||||
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
/* Elements common to all stats structures */
|
||||
#define STATS_BASE \
|
||||
UDWORD ref; /* Unique ID of the item */ \
|
||||
UDWORD NameHash /* unique hash value of the item (hashed version of pName below) */
|
||||
#else
|
||||
/* Elements common to all stats structures */
|
||||
#define STATS_BASE \
|
||||
UDWORD ref; /* Unique ID of the item */ \
|
||||
char *pName /* pointer to the text id name (i.e. short language-independant name) */
|
||||
#endif
|
||||
|
||||
/* Stats common to all stats structs */
|
||||
typedef struct _base_stats
|
||||
|
@ -482,11 +475,9 @@ typedef enum _travel_medium
|
|||
typedef struct _propulsion_types
|
||||
{
|
||||
//Name isn't used anymore - AB 16/06/98
|
||||
/*#ifdef HASH_NAMES
|
||||
UDWORD NameHash;
|
||||
#else
|
||||
/*
|
||||
char *pName; // Text name of the component
|
||||
#endif*/
|
||||
*/
|
||||
UWORD powerRatioMult; // Multiplier for the calculated power ratio of
|
||||
// the droid
|
||||
UDWORD travel; // Which medium the propulsion travels in
|
||||
|
|
132
src/structure.c
132
src/structure.c
|
@ -509,11 +509,7 @@ static void structureType(STRUCTURE_STATS *pStructure, char *pType)
|
|||
|
||||
static char *getStructName(STRUCTURE_STATS *psStruct)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
return( strresGetString(NULL,psStruct->NameHash));
|
||||
#else
|
||||
return( getName(psStruct->pName));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*returns the structure strength based on the string name passed in */
|
||||
|
@ -772,16 +768,11 @@ BOOL loadStructureStats(char *pStructData, UDWORD bufferSize)
|
|||
STRUCTURE_STATS *psStructure, *pStartStats;
|
||||
ECM_STATS* pECMType;
|
||||
SENSOR_STATS* pSensorType;
|
||||
UDWORD module;
|
||||
UDWORD module;
|
||||
//UDWORD length, module;
|
||||
//char charNum[2];
|
||||
UDWORD iID;
|
||||
UDWORD dummyVal;
|
||||
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD HashedType;
|
||||
#endif
|
||||
UDWORD dummyVal;
|
||||
|
||||
#if (MAX_PLAYERS != 8)
|
||||
char NotUsedString[MAX_NAME_SIZE];
|
||||
|
@ -888,14 +879,10 @@ BOOL loadStructureStats(char *pStructData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
strcpy(psStructure->pName,StructureName);*/
|
||||
#ifdef HASH_NAMES
|
||||
psStructure->NameHash=HashString(StructureName);
|
||||
#else
|
||||
if (!allocateName(&psStructure->pName, StructureName))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
psStructure->ref = REF_STRUCTURE_START + i;
|
||||
|
||||
|
@ -929,18 +916,11 @@ BOOL loadStructureStats(char *pStructData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HASH_NAMES
|
||||
HashedType=HashString(ecmType);
|
||||
#endif
|
||||
|
||||
for (inc=0; inc < numECMStats; inc++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (pECMType->NameHash==HashedType)
|
||||
#else
|
||||
if (!strcmp(ecmType, pECMType->pName))
|
||||
#endif
|
||||
{
|
||||
psStructure->pECM = pECMType;
|
||||
break;
|
||||
|
@ -960,17 +940,10 @@ BOOL loadStructureStats(char *pStructData, UDWORD bufferSize)
|
|||
return FALSE;
|
||||
}
|
||||
pSensorType = asSensorStats;
|
||||
#ifdef HASH_NAMES
|
||||
HashedType=HashString(sensorType);
|
||||
#endif
|
||||
for (inc=0; inc < numSensorStats; inc++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (pSensorType->NameHash==HashedType)
|
||||
#else
|
||||
if (!strcmp(sensorType, pSensorType->pName))
|
||||
#endif
|
||||
{
|
||||
psStructure->pSensor = pSensorType;
|
||||
break;
|
||||
|
@ -980,8 +953,7 @@ BOOL loadStructureStats(char *pStructData, UDWORD bufferSize)
|
|||
//check not allocating a turret sensor if have weapons attached
|
||||
ASSERT( psStructure->pSensor != NULL,
|
||||
"loadStructureStats: should have a sensor attached to %s!", StructureName );
|
||||
//if (psStructure->pSensor->location == LOC_TURRET && psStructure->numWeaps)
|
||||
if (psStructure->pSensor->location == LOC_TURRET && numWeaps)
|
||||
if (psStructure->pSensor->location == LOC_TURRET && numWeaps)
|
||||
{
|
||||
debug( LOG_ERROR, "loadStructureStats: a Turret Sensor and weapon \
|
||||
have been assigned to %s", StructureName );
|
||||
|
@ -1208,12 +1180,6 @@ BOOL loadStructureWeapons(char *pWeaponData, UDWORD bufferSize)
|
|||
BOOL weaponFound, structureFound;
|
||||
UBYTE j;
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD StructureHash;
|
||||
UDWORD WeaponHash;
|
||||
#endif
|
||||
|
||||
|
||||
pStartWeaponData = pWeaponData;
|
||||
|
||||
NumToAlloc = numCR(pWeaponData, bufferSize);
|
||||
|
@ -1240,19 +1206,10 @@ BOOL loadStructureWeapons(char *pWeaponData, UDWORD bufferSize)
|
|||
weaponFound = structureFound = FALSE;
|
||||
//loop through each Structure_Stat to compare the name
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
StructureHash=HashString(StructureName);
|
||||
WeaponHash=HashString(WeaponName);
|
||||
#endif
|
||||
|
||||
for (incS=0; incS < numStructureStats; incS++)
|
||||
{
|
||||
|
||||
#ifdef HASH_NAMES
|
||||
if (pStructure[incS].NameHash==StructureHash)
|
||||
#else
|
||||
if (!(strcmp(StructureName, pStructure[incS].pName)))
|
||||
#endif
|
||||
{
|
||||
//Structure found, so loop through each weapon
|
||||
structureFound = TRUE;
|
||||
|
@ -1260,11 +1217,7 @@ BOOL loadStructureWeapons(char *pWeaponData, UDWORD bufferSize)
|
|||
{
|
||||
for (incW=0; incW < numWeaponStats; incW++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (pWeapon[incW].NameHash==WeaponHash)
|
||||
#else
|
||||
if (!(strcmp(WeaponName[j], pWeapon[incW].pName)))
|
||||
#endif
|
||||
{
|
||||
weaponFound = TRUE;
|
||||
//weapon found alloc this weapon to the current Structure
|
||||
|
@ -1322,10 +1275,6 @@ BOOL loadStructureFunctions(char *pFunctionData, UDWORD bufferSize)
|
|||
STRUCTURE_STATS *pStructure = asStructureStats;
|
||||
FUNCTION *pFunction, **pStartFunctions = asFunctions;
|
||||
BOOL functionFound, structureFound;
|
||||
#ifdef HASH_NAMES
|
||||
UDWORD StructureHash;
|
||||
UDWORD FunctionHash;
|
||||
#endif
|
||||
|
||||
pStartFunctionData = pFunctionData;
|
||||
|
||||
|
@ -1347,19 +1296,11 @@ BOOL loadStructureFunctions(char *pFunctionData, UDWORD bufferSize)
|
|||
{
|
||||
return FALSE;
|
||||
}*/
|
||||
#ifdef HASH_NAMES
|
||||
StructureHash=HashString(StructureName);
|
||||
FunctionHash=HashString(FunctionName);
|
||||
#endif
|
||||
|
||||
//loop through each Structure_Stat to compare the name
|
||||
for (incS=0; incS < numStructureStats; incS++)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
if (pStructure[incS].NameHash==StructureHash)
|
||||
#else
|
||||
if (!(strcmp(StructureName, pStructure[incS].pName)))
|
||||
#endif
|
||||
{
|
||||
//Structure found, so loop through each Function
|
||||
structureFound = TRUE;
|
||||
|
@ -1367,11 +1308,7 @@ BOOL loadStructureFunctions(char *pFunctionData, UDWORD bufferSize)
|
|||
for (incF=0; incF < numFunctions; incF++)
|
||||
{
|
||||
pFunction = *pStartFunctions;
|
||||
#ifdef HASH_NAMES
|
||||
if (pFunction->NameHash==FunctionHash)
|
||||
#else
|
||||
if (!(strcmp(FunctionName, pFunction->pName)))
|
||||
#endif
|
||||
{
|
||||
//function found alloc this function to the current Structure
|
||||
functionFound = TRUE;
|
||||
|
@ -1426,11 +1363,7 @@ BOOL loadStructureFunctions(char *pFunctionData, UDWORD bufferSize)
|
|||
for (i=0; i < numStructureStats; i++)
|
||||
{
|
||||
//compare the names
|
||||
#ifdef HASH_NAMES
|
||||
if (((WALL_FUNCTION *)pFunction)->StructNameHash == pStructure->NameHash)
|
||||
#else
|
||||
if (!strcmp(((WALL_FUNCTION *)pFunction)->pStructName, pStructure->pName))
|
||||
#endif
|
||||
{
|
||||
((WALL_FUNCTION *)pFunction)->pCornerStat = pStructure;
|
||||
break;
|
||||
|
@ -1440,11 +1373,7 @@ BOOL loadStructureFunctions(char *pFunctionData, UDWORD bufferSize)
|
|||
//if haven't found the STRUCTURE STAT, then problem
|
||||
if (!((WALL_FUNCTION *)pFunction)->pCornerStat)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "Unknown Corner Wall stat for function %x", pFunction->NameHash );
|
||||
#else
|
||||
debug( LOG_ERROR, "Unknown Corner Wall stat for function %s", pFunction->pName );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2831,11 +2760,7 @@ BOOL setFunctionality(STRUCTURE *psBuilding, UDWORD functionType)
|
|||
//this structure must have a function assigned to the stat
|
||||
if (psBuilding->pStructureType->numFuncs == 0)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %x", psBuilding );
|
||||
#else
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", getName( psBuilding->pStructureType->pName ) );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2953,11 +2878,7 @@ BOOL setFunctionality(STRUCTURE *psBuilding, UDWORD functionType)
|
|||
//this structure must have a function assigned to the stat
|
||||
if (psBuilding->pStructureType->numFuncs == 0)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", strresGetString( NULL, psBuilding->pStructureType->NameHash ) );
|
||||
#else
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", getName( psBuilding->pStructureType->pName ) );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3023,11 +2944,7 @@ BOOL setFunctionality(STRUCTURE *psBuilding, UDWORD functionType)
|
|||
//this structure must have a function assigned to the stat
|
||||
if (psBuilding->pStructureType->numFuncs == 0)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", strresGetString( NULL, psBuilding->pStructureType->NameHash ) );
|
||||
#else
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", getName( psBuilding->pStructureType->pName ) );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3064,11 +2981,7 @@ BOOL setFunctionality(STRUCTURE *psBuilding, UDWORD functionType)
|
|||
//this structure must have a function assigned to the stat
|
||||
if (psBuilding->pStructureType->numFuncs == 0)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", strresGetString( NULL, psBuilding->pStructureType->NameHash ) );
|
||||
#else
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", getName( psBuilding->pStructureType->pName ) );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3107,11 +3020,7 @@ BOOL setFunctionality(STRUCTURE *psBuilding, UDWORD functionType)
|
|||
//this structure must have a function assigned to the stat
|
||||
if (psBuilding->pStructureType->numFuncs == 0)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", strresGetString( NULL, psBuilding->pStructureType->NameHash ) );
|
||||
#else
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", getName( psBuilding->pStructureType->pName ) );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3124,11 +3033,7 @@ BOOL setFunctionality(STRUCTURE *psBuilding, UDWORD functionType)
|
|||
//this structure must have a function assigned to the stat - this is just a check!
|
||||
if (psBuilding->pStructureType->numFuncs == 0)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", strresGetString( NULL, psBuilding->pStructureType->NameHash ) );
|
||||
#else
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", getName( psBuilding->pStructureType->pName ) );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3139,11 +3044,7 @@ BOOL setFunctionality(STRUCTURE *psBuilding, UDWORD functionType)
|
|||
//this structure must have a function assigned to the stat
|
||||
if (psBuilding->pStructureType->numFuncs == 0)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", strresGetString( NULL, psBuilding->pStructureType->NameHash ) );
|
||||
#else
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", getName( psBuilding->pStructureType->pName ) );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -3205,11 +3106,7 @@ BOOL setFunctionality(STRUCTURE *psBuilding, UDWORD functionType)
|
|||
//this structure must have a function assigned to the stat
|
||||
if (psBuilding->pStructureType->numFuncs == 0)
|
||||
{
|
||||
#ifdef HASH_NAMES
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", strresGetString( NULL, psBuilding->pStructureType->NameHash ) );
|
||||
#else
|
||||
debug( LOG_ERROR, "There must be a function assigned to this building - %s", getName( psBuilding->pStructureType->pName ) );
|
||||
#endif
|
||||
abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -6786,28 +6683,6 @@ SWORD buildFoundation(STRUCTURE_STATS *psStructStats, UDWORD x, UDWORD y)
|
|||
|
||||
/* gets a structure stat from its name - relies on the name being unique (or it will
|
||||
return the first one it finds!! */
|
||||
#ifdef HASH_NAMES
|
||||
SDWORD getStructStatFromName(char *pName)
|
||||
{
|
||||
UDWORD inc;
|
||||
STRUCTURE_STATS *psStat;
|
||||
UDWORD HashValue;
|
||||
|
||||
HashValue=HashString(pName);
|
||||
|
||||
|
||||
for (inc = 0; inc < numStructureStats; inc++)
|
||||
{
|
||||
psStat = &asStructureStats[inc];
|
||||
if (psStat->NameHash==HashValue)
|
||||
{
|
||||
return inc;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
SDWORD getStructStatFromName(char *pName)
|
||||
{
|
||||
UDWORD inc;
|
||||
|
@ -6831,7 +6706,6 @@ SDWORD getStructStatFromName(char *pName)
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*check to see if the structure is 'doing' anything - return TRUE if idle*/
|
||||
BOOL structureIdle(STRUCTURE *psBuilding)
|
||||
|
|
Loading…
Reference in New Issue