Remove unused config string code from botlib

This commit is contained in:
Zack Middleton 2013-02-27 15:50:36 -06:00
parent 57cb0b2d89
commit b9a33f84be
4 changed files with 1 additions and 110 deletions

View file

@ -34,10 +34,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//debugging on //debugging on
#define AAS_DEBUG #define AAS_DEBUG
#define CS_SCORES 32
#define CS_MODELS (CS_SCORES+MAX_CLIENTS)
#define CS_SOUNDS (CS_MODELS+MAX_MODELS)
#define DF_AASENTNUMBER(x) (x - aasworld.entities) #define DF_AASENTNUMBER(x) (x - aasworld.entities)
#define DF_NUMBERAASENT(x) (&aasworld.entities[x]) #define DF_NUMBERAASENT(x) (&aasworld.entities[x])
#define DF_AASENTCLIENT(x) (x - aasworld.entities - 1) #define DF_AASENTCLIENT(x) (x - aasworld.entities - 1)
@ -47,13 +43,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_PATH MAX_QPATH #define MAX_PATH MAX_QPATH
#endif #endif
//string index (for model, sound and image index)
typedef struct aas_stringindex_s
{
int numindexes;
char **index;
} aas_stringindex_t;
//structure to link entities to areas and areas to entities //structure to link entities to areas and areas to entities
typedef struct aas_link_s typedef struct aas_link_s
{ {
@ -254,9 +243,6 @@ typedef struct aas_s
int maxentities; int maxentities;
int maxclients; int maxclients;
aas_entity_t *entities; aas_entity_t *entities;
//string indexes
char *configstrings[MAX_CONFIGSTRINGS];
int indexessetup;
//index to retrieve travel flag for a travel type //index to retrieve travel flag for a travel type
int travelflagfortype[MAX_TRAVELTYPES]; int travelflagfortype[MAX_TRAVELTYPES];
//travel flags for each area based on contents //travel flags for each area based on contents

View file

@ -70,96 +70,6 @@ void QDECL AAS_Error(char *fmt, ...)
// Returns: - // Returns: -
// Changes Globals: - // Changes Globals: -
//=========================================================================== //===========================================================================
char *AAS_StringFromIndex(char *indexname, char *stringindex[], int numindexes, int index)
{
if (!aasworld.indexessetup)
{
botimport.Print(PRT_ERROR, "%s: index %d not setup\n", indexname, index);
return "";
} //end if
if (index < 0 || index >= numindexes)
{
botimport.Print(PRT_ERROR, "%s: index %d out of range\n", indexname, index);
return "";
} //end if
if (!stringindex[index])
{
if (index)
{
botimport.Print(PRT_ERROR, "%s: reference to unused index %d\n", indexname, index);
} //end if
return "";
} //end if
return stringindex[index];
} //end of the function AAS_StringFromIndex
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int AAS_IndexFromString(char *indexname, char *stringindex[], int numindexes, char *string)
{
int i;
if (!aasworld.indexessetup)
{
botimport.Print(PRT_ERROR, "%s: index not setup \"%s\"\n", indexname, string);
return 0;
} //end if
for (i = 0; i < numindexes; i++)
{
if (!stringindex[i]) continue;
if (!Q_stricmp(stringindex[i], string)) return i;
} //end for
return 0;
} //end of the function AAS_IndexFromString
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
char *AAS_ModelFromIndex(int index)
{
return AAS_StringFromIndex("ModelFromIndex", &aasworld.configstrings[CS_MODELS], MAX_MODELS, index);
} //end of the function AAS_ModelFromIndex
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int AAS_IndexFromModel(char *modelname)
{
return AAS_IndexFromString("IndexFromModel", &aasworld.configstrings[CS_MODELS], MAX_MODELS, modelname);
} //end of the function AAS_IndexFromModel
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_UpdateStringIndexes(int numconfigstrings, char *configstrings[])
{
int i;
//set string pointers and copy the strings
for (i = 0; i < numconfigstrings; i++)
{
if (configstrings[i])
{
//if (aasworld.configstrings[i]) FreeMemory(aasworld.configstrings[i]);
aasworld.configstrings[i] = (char *) GetMemory(strlen(configstrings[i]) + 1);
strcpy(aasworld.configstrings[i], configstrings[i]);
} //end if
} //end for
aasworld.indexessetup = qtrue;
} //end of the function AAS_UpdateStringIndexes
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int AAS_Loaded(void) int AAS_Loaded(void)
{ {
return aasworld.loaded; return aasworld.loaded;

View file

@ -51,10 +51,6 @@ int AAS_StartFrame(float time);
int AAS_Initialized(void); int AAS_Initialized(void);
//returns true if the AAS file is loaded //returns true if the AAS file is loaded
int AAS_Loaded(void); int AAS_Loaded(void);
//returns the model name from the given index
char *AAS_ModelFromIndex(int index);
//returns the index from the given model name
int AAS_IndexFromModel(char *modelname);
//returns the current time //returns the current time
float AAS_Time(void); float AAS_Time(void);
// //

View file

@ -558,10 +558,9 @@ void BotInitLevelItems(void)
//if there's no AAS file loaded //if there's no AAS file loaded
if (!AAS_Loaded()) return; if (!AAS_Loaded()) return;
//update the modelindexes of the item info //validate the modelindexes of the item info
for (i = 0; i < ic->numiteminfo; i++) for (i = 0; i < ic->numiteminfo; i++)
{ {
//ic->iteminfo[i].modelindex = AAS_IndexFromModel(ic->iteminfo[i].model);
if (!ic->iteminfo[i].modelindex) if (!ic->iteminfo[i].modelindex)
{ {
Log_Write("item %s has modelindex 0", ic->iteminfo[i].classname); Log_Write("item %s has modelindex 0", ic->iteminfo[i].classname);