Remove scrvGetBaseObj

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1997 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-07-01 14:51:28 +00:00
parent 49b1666441
commit e06f29f87c
4 changed files with 14 additions and 25 deletions

View File

@ -890,7 +890,8 @@ BOOL scrValDefLoad(SDWORD version, INTERP_VAL *psVal, char *pBuffer, UDWORD size
} }
else else
{ {
if (!scrvGetBaseObj(id, (BASE_OBJECT **)&(psVal->v.oval))) psVal->v.oval = (void*)getBaseObjFromId(id);
if (!psVal->v.oval)
{ {
debug( LOG_ERROR, "scrValDefLoad: couldn't find object id %d", id ); debug( LOG_ERROR, "scrValDefLoad: couldn't find object id %d", id );
abort(); abort();
@ -1128,7 +1129,8 @@ BOOL scrValDefLoad(SDWORD version, INTERP_VAL *psVal, char *pBuffer, UDWORD size
{ {
endian_udword((UDWORD*)pPos); endian_udword((UDWORD*)pPos);
id = *((UDWORD *) pPos); id = *((UDWORD *) pPos);
if (!scrvGetBaseObj(id, (BASE_OBJECT **)&psCDroid)) psCDroid = (DROID *)getBaseObjFromId(id);
if (!psCDroid)
{ {
debug( LOG_ERROR, "scrValDefLoad: couldn't find object id %d", id ); debug( LOG_ERROR, "scrValDefLoad: couldn't find object id %d", id );
abort(); abort();

View File

@ -239,21 +239,6 @@ BOOL scrvGetContext(char *pID, SCRIPT_CONTEXT **ppsContext)
} }
// Find a base object from it's id
BOOL scrvGetBaseObj(UDWORD id, BASE_OBJECT **ppsObj)
{
BASE_OBJECT *psObj;
psObj = getBaseObjFromId(id);
*ppsObj = psObj;
if (psObj == NULL)
{
return FALSE;
}
return TRUE;
}
// Find a string from it's (string)id // Find a string from it's (string)id
BOOL scrvGetString(const char *pStringID, char **ppString) BOOL scrvGetString(const char *pStringID, char **ppString)
{ {

View File

@ -117,9 +117,6 @@ extern BOOL scrvLoad(const char *pData, UDWORD size);
// Link any object types to the actual pointer values // Link any object types to the actual pointer values
//extern BOOL scrvLinkValues(void); //extern BOOL scrvLinkValues(void);
// Find a base object from it's id
extern BOOL scrvGetBaseObj(UDWORD id, BASE_OBJECT **ppsObj);
// Find a string from it's (string)id // Find a string from it's (string)id
extern BOOL scrvGetString(const char *pStringID, char **ppString); extern BOOL scrvGetString(const char *pStringID, char **ppString);
#endif #endif

View File

@ -248,7 +248,8 @@ var_init: var_entry TYPE var_value
scrv_error("Typemismatch for variable %d", $1); scrv_error("Typemismatch for variable %d", $1);
YYABORT; YYABORT;
} }
if (!scrvGetBaseObj((UDWORD)$3.index, &psObj)) psObj = getBaseObjFromId((UDWORD)$3.index);
if (!psObj)
{ {
scrv_error("Droid id %d not found", (UDWORD)$3.index); scrv_error("Droid id %d not found", (UDWORD)$3.index);
YYABORT; YYABORT;
@ -277,7 +278,8 @@ var_init: var_entry TYPE var_value
scrv_error("Typemismatch for variable %d", $1); scrv_error("Typemismatch for variable %d", $1);
YYABORT; YYABORT;
} }
if (!scrvGetBaseObj((UDWORD)$3.index, &psObj)) psObj = getBaseObjFromId((UDWORD)$3.index);
if (!psObj)
{ {
scrv_error("Structure id %d not found", (UDWORD)$3.index); scrv_error("Structure id %d not found", (UDWORD)$3.index);
YYABORT; YYABORT;
@ -305,7 +307,8 @@ var_init: var_entry TYPE var_value
scrv_error("Typemismatch for variable %d", $1); scrv_error("Typemismatch for variable %d", $1);
YYABORT; YYABORT;
} }
if (!scrvGetBaseObj((UDWORD)$3.index, &psObj)) psObj = getBaseObjFromId((UDWORD)$3.index);
if (!psObj)
{ {
scrv_error("Feature id %d not found", (UDWORD)$3.index); scrv_error("Feature id %d not found", (UDWORD)$3.index);
YYABORT; YYABORT;
@ -542,7 +545,8 @@ var_init: var_entry TYPE var_value
scrv_error("Typemismatch for variable %d", $1); scrv_error("Typemismatch for variable %d", $1);
YYABORT; YYABORT;
} }
if (!scrvGetBaseObj((UDWORD)$3.index, &psObj)) psObj = getBaseObjFromId((UDWORD)$3.index);
if (!psObj)
{ {
scrv_error("Structure id %d not found", (UDWORD)$3.index); scrv_error("Structure id %d not found", (UDWORD)$3.index);
YYABORT; YYABORT;
@ -568,7 +572,8 @@ var_init: var_entry TYPE var_value
scrv_error("Typemismatch for variable %d", $1); scrv_error("Typemismatch for variable %d", $1);
YYABORT; YYABORT;
} }
if (!scrvGetBaseObj((UDWORD)$3.index, &psObj)) psObj = getBaseObjFromId((UDWORD)$3.index);
if (!psObj)
{ {
scrv_error("Droid id %d not found", (UDWORD)$3.index); scrv_error("Droid id %d not found", (UDWORD)$3.index);
YYABORT; YYABORT;