* Move constant MAX_DATA to messagedef.h
* Use strdup() instead of malloc() + strcpy() * Remove unused enmurant VIEW_TYPES git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5694 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
231866a510
commit
8eaf3bfa8b
|
@ -41,9 +41,6 @@
|
||||||
|
|
||||||
#include "multiplay.h"
|
#include "multiplay.h"
|
||||||
|
|
||||||
//max number of text strings or sequences for viewdata
|
|
||||||
#define MAX_DATA 4
|
|
||||||
|
|
||||||
//array of pointers for the view data
|
//array of pointers for the view data
|
||||||
static VIEWDATA_LIST *apsViewData;
|
static VIEWDATA_LIST *apsViewData;
|
||||||
|
|
||||||
|
@ -522,13 +519,12 @@ VIEWDATA *loadViewData(const char *pViewMsgData, UDWORD bufferSize)
|
||||||
psViewData->numText=(UBYTE)numText;
|
psViewData->numText=(UBYTE)numText;
|
||||||
|
|
||||||
//allocate storage for the name
|
//allocate storage for the name
|
||||||
psViewData->pName = malloc(strlen(name) + 1);
|
psViewData->pName = strdup(name);
|
||||||
if (psViewData->pName == NULL)
|
if (psViewData->pName == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(false, "Out of memory");
|
ASSERT(false, "Out of memory");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy(psViewData->pName, name);
|
|
||||||
debug(LOG_MSG, "Loaded %s", psViewData->pName);
|
debug(LOG_MSG, "Loaded %s", psViewData->pName);
|
||||||
|
|
||||||
//allocate space for text strings
|
//allocate space for text strings
|
||||||
|
@ -599,13 +595,12 @@ VIEWDATA *loadViewData(const char *pViewMsgData, UDWORD bufferSize)
|
||||||
if (strcmp(audioName, "0"))
|
if (strcmp(audioName, "0"))
|
||||||
{
|
{
|
||||||
//allocate space
|
//allocate space
|
||||||
psViewRes->pAudio = (char *) malloc(strlen(audioName) + 1);
|
psViewRes->pAudio = strdup(audioName);
|
||||||
if (psViewRes->pAudio == NULL)
|
if (psViewRes->pAudio == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(false, "loadViewData - Out of memory");
|
ASSERT(false, "loadViewData - Out of memory");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy(psViewRes->pAudio, audioName);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -715,14 +710,12 @@ VIEWDATA *loadViewData(const char *pViewMsgData, UDWORD bufferSize)
|
||||||
if (strcmp(audioName, "0"))
|
if (strcmp(audioName, "0"))
|
||||||
{
|
{
|
||||||
//allocate space
|
//allocate space
|
||||||
psViewReplay->pSeqList[dataInc].pAudio = (char *) malloc(
|
psViewReplay->pSeqList[dataInc].pAudio = strdup(audioName);
|
||||||
strlen(audioName) + 1);
|
|
||||||
if (psViewReplay->pSeqList[dataInc].pAudio == NULL)
|
if (psViewReplay->pSeqList[dataInc].pAudio == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(LOG_ERROR, "loadViewData - Out of memory");
|
ASSERT(LOG_ERROR, "loadViewData - Out of memory");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy(psViewReplay->pSeqList[dataInc].pAudio, audioName);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
#include "lib/ivis_common/ivisdef.h"
|
#include "lib/ivis_common/ivisdef.h"
|
||||||
#include "positiondef.h"
|
#include "positiondef.h"
|
||||||
|
|
||||||
|
/// max number of text strings or sequences for VIEWDATA
|
||||||
|
static const unsigned int MAX_DATA = 4;
|
||||||
|
|
||||||
typedef enum _message_type
|
typedef enum _message_type
|
||||||
{
|
{
|
||||||
MSG_RESEARCH, // Research message
|
MSG_RESEARCH, // Research message
|
||||||
|
@ -46,8 +49,6 @@ typedef enum _view_type
|
||||||
VIEW_RPLX, // full screen view sequence - flic. extended format
|
VIEW_RPLX, // full screen view sequence - flic. extended format
|
||||||
|
|
||||||
VIEW_BEACON, // Beacon message
|
VIEW_BEACON, // Beacon message
|
||||||
|
|
||||||
VIEW_TYPES,
|
|
||||||
} VIEW_TYPE;
|
} VIEW_TYPE;
|
||||||
|
|
||||||
typedef enum _prox_type
|
typedef enum _prox_type
|
||||||
|
|
Loading…
Reference in New Issue