本文整理汇总了C++中INTEL_INT函数的典型用法代码示例。如果您正苦于以下问题:C++ INTEL_INT函数的具体用法?C++ INTEL_INT怎么用?C++ INTEL_INT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了INTEL_INT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResendData
static int ResendData (struct sockaddr_in *fromAddr, ubyte *buf)
{
int i, j, nFirst, nLast, nDrop;
tDestListEntry *pdl;
tPacketProps *ppp;
time_t t;
//if (!extraGameInfo [1].bSafeUDP)
// return 0;
if (strncmp ((char *) buf, RESEND_ID, RESEND_ID_LEN))
return 0;
if (destAddrNum <= (i = FindDestInList (fromAddr)))
return 1;
nFirst = * ((int *) (buf + RESEND_ID_LEN));
nFirst = INTEL_INT (nFirst);
nLast = * ((int *) (buf + RESEND_ID_LEN + 4));
nLast = INTEL_INT (nLast);
pdl = destList + i;
if (!pdl->numPackets)
return 1;
ppp = pdl->packetProps + pdl->firstPacket;
if (nFirst < (nDrop = ppp->id)) {
DropData (pdl, nDrop); //have the receiver 'forget' data not buffered any more
if (nDrop > nLast)
return 1;
nFirst = nDrop;
}
nDrop = -1;
t = SDL_GetTicks ();
#ifdef _DEBUG
//LogErr ("resending packets %d - %d to", nFirst, nLast); dumpaddr (&pdl->addr); //LogErr ("\n");
#endif
for (i = pdl->numPackets, j = pdl->firstPacket; i; i--, j++) {
j %= MAX_BUF_PACKETS;
ppp = pdl->packetProps + j;
if (ppp->id > nLast)
break;
if (ppp->id < nFirst)
continue;
if (t - ppp->timeStamp > 3000) {
nDrop = ppp->id;
continue;
}
if (nDrop >= 0) { //have the receiver 'forget' outdated data
DropData (pdl, nDrop);
nDrop = -1;
}
// nDrop = * ((int *) (ppp->data + ppp->len - 4));
// nDrop = INTEL_INT (nDrop);
//LogErr (" resending packet %d (%d)\n", ppp - pdl->packetProps, pdl->numPackets);
sendto (pdl->fd, ppp->data, ppp->len, 0, (struct sockaddr *) &pdl->addr, sizeof (pdl->addr));
}
return 1;
}
示例2: get_local_options
// get data from multi_local_options struct
void get_local_options(ubyte *data, int *size, multi_local_options *mlo)
{
int offset = *size;
GET_DATA(*mlo);
mlo->flags = INTEL_INT(mlo->flags); //-V570
mlo->obj_update_level = INTEL_INT(mlo->obj_update_level); //-V570
*size = offset;
}
示例3: pcx_read_header
// reads header information from the PCX file into the bitmap pointer
int pcx_read_header(char *real_filename, int *w, int *h, ubyte *pal )
{
PCXHeader header;
CFILE * PCXfile;
char filename[MAX_FILENAME_LEN];
strcpy( filename, real_filename );
char *p = strchr( filename, '.' );
if ( p ) *p = 0;
strcat( filename, ".pcx" );
PCXfile = cfopen( filename , "rb" );
if ( !PCXfile )
return PCX_ERROR_OPENING;
// read 128 char PCX header
if (cfread( &header, sizeof(PCXHeader), 1, PCXfile )!=1) {
cfclose( PCXfile );
return PCX_ERROR_NO_HEADER;
}
header.Xmin = INTEL_SHORT( header.Xmin );
header.Ymin = INTEL_SHORT( header.Ymin );
header.Xmax = INTEL_SHORT( header.Xmax );
header.Ymax = INTEL_SHORT( header.Ymax );
header.Hdpi = INTEL_SHORT( header.Hdpi );
header.Vdpi = INTEL_SHORT( header.Vdpi );
for ( int i=0; i<16; i++ ){
for ( int j=0; j<3; j++){
header.ColorMap[i][j] = INTEL_INT( header.ColorMap[i][j] );
}
}
header.BytesPerLine = INTEL_SHORT( header.BytesPerLine );
for ( int i=0; i<60; i++ ){
header.filler[i] = INTEL_INT( header.filler[i] );
}
// Is it a 256 color PCX file?
if ((header.Manufacturer != 10)||(header.Encoding != 1)||(header.Nplanes != 1)||(header.BitsPerPixel != 8)||(header.Version != 5)) {
cfclose( PCXfile );
return PCX_ERROR_WRONG_VERSION;
}
if (w) *w = header.Xmax - header.Xmin + 1;
if (h) *h = header.Ymax - header.Ymin + 1;
if ( pal ) {
cfseek( PCXfile, -768, CF_SEEK_END );
cfread( pal, 3, 256, PCXfile );
}
cfclose(PCXfile);
return PCX_ERROR_NONE;
}
示例4: add_local_options
// add data from a multi_local_options struct
void add_local_options(ubyte *data, int *size, multi_local_options *mlo)
{
int packet_size = *size;
multi_local_options mlo_tmp;
memcpy(&mlo_tmp, mlo, sizeof(multi_local_options));
mlo_tmp.flags = INTEL_INT(mlo->flags);
mlo_tmp.obj_update_level = INTEL_INT(mlo->obj_update_level);
ADD_DATA(mlo_tmp);
*size = packet_size;
}
示例5: get_server_options
// get data from multi_server_options struct
void get_server_options(ubyte *data, int *size, multi_server_options *mso)
{
int offset = *size;
GET_DATA(*mso);
mso->flags = INTEL_INT(mso->flags); //-V570
mso->respawn = INTEL_INT(mso->respawn); //-V570
mso->voice_token_wait = INTEL_INT(mso->voice_token_wait); //-V570
mso->voice_record_time = INTEL_INT(mso->voice_record_time); //-V570
// mso->mission_time_limit = INTEL_INT(mso->mission_time_limit);
mso->kill_limit = INTEL_INT(mso->kill_limit); //-V570
*size = offset;
}
示例6: BESendNetPlayersPacket
void BESendNetPlayersPacket(ubyte *server, ubyte *node)
{
int i, tmpi;
int loc = 0;
short tmps;
memset(out_buffer, 0, sizeof(out_buffer));
out_buffer[0] = netPlayers.type; loc++;
tmpi = INTEL_INT(netPlayers.Security);
memcpy(out_buffer + loc, &tmpi, 4); loc += 4;
for (i = 0; i < MAX_PLAYERS+4; i++) {
memcpy(out_buffer + loc, netPlayers.players[i].callsign, CALLSIGN_LEN+1); loc += CALLSIGN_LEN+1;
memcpy(out_buffer + loc, netPlayers.players[i].network.ipx.server, 4); loc += 4;
memcpy(out_buffer + loc, netPlayers.players[i].network.ipx.node, 6); loc += 6;
memcpy(out_buffer + loc, &(netPlayers.players[i].version_major), 1); loc++;
memcpy(out_buffer + loc, &(netPlayers.players[i].version_minor), 1); loc++;
memcpy(out_buffer + loc, &(netPlayers.players[i].computer_type), 1); loc++;
memcpy(out_buffer + loc, &(netPlayers.players[i].connected), 1); loc++;
tmps = INTEL_SHORT(netPlayers.players[i].socket);
memcpy(out_buffer + loc, &tmps, 2); loc += 2;
memcpy(out_buffer + loc, &(netPlayers.players[i].rank), 1); loc++;
}
if ((server == NULL) && (node == NULL))
IPXSendBroadcastData(out_buffer, loc);
else
IPXSendInternetPacketData(out_buffer, loc, server, node);
}
示例7: CFReadInt
int CFReadInt (CFILE *file)
{
int32_t i;
CFCriticalError (CFRead (&i, sizeof (i), 1, file) != 1);
//Error ("Error reading int in CFReadInt ()");
return INTEL_INT (i);
}
示例8: Read
uint CFile::ReadUInt (void)
{
uint32_t i;
Read (&i, sizeof (i), 1);
//Error ("Error reading int in CFile::ReadInt ()");
return INTEL_INT (i);
}
示例9: add_server_options
// add data from a multi_server_options struct
void add_server_options(ubyte *data, int *size, multi_server_options *mso)
{
int packet_size = *size;
multi_server_options mso_tmp;
memcpy(&mso_tmp, mso, sizeof(multi_server_options));
mso_tmp.flags = INTEL_INT(mso->flags);
mso_tmp.respawn = INTEL_INT(mso->respawn);
mso_tmp.voice_token_wait = INTEL_INT(mso->voice_token_wait);
mso_tmp.voice_record_time = INTEL_INT(mso->voice_record_time);
// mso_tmp.mission_time_limit = INTEL_INT(mso->mission_time_limit);
mso_tmp.kill_limit = INTEL_INT(mso->kill_limit);
ADD_DATA(mso_tmp);
*size = packet_size;
}
示例10: CFReadInt
int CFReadInt (CFILE *file)
{
int32_t i;
if (CFRead (&i, sizeof (i), 1, file) != 1)
return nCFileError;
//Error ("Error reading int in CFReadInt()");
return INTEL_INT (i);
}
示例11: DropData
static int DropData (tDestListEntry *pdl, int nDrop)
{
ubyte buf [40];
memcpy (buf, FORGET_ID, FORGET_ID_LEN);
* ((int *) (buf + FORGET_ID_LEN)) = INTEL_INT (nDrop);
sendto (pdl->fd, buf, FORGET_ID_LEN + 4, 0, (struct sockaddr *) &pdl->addr, sizeof (pdl->addr));
return 1;
}
示例12: BEReceiveSequencePacket
void BEReceiveSequencePacket(ubyte *data, sequence_packet *seq)
{
int loc = 0;
seq->type = data[0]; loc++;
memcpy(&(seq->Security), data + loc, 4); loc += 4; loc += 3; // +3 for pad byte
seq->Security = INTEL_INT(seq->Security);
BEReceiveNetPlayerInfo(data + loc, &(seq->player));
}
示例13: CFReadFix
fix CFReadFix (CFILE *file)
{
fix f;
CFCriticalError (CFRead (&f, sizeof (f), 1, file) != 1);
//Error ("Error reading fix in CFReadFix ()");
return (fix) INTEL_INT ((int) f);
return f;
}
示例14: CFInitHogFile
// ----------------------------------------------------------------------------
//returns 1 if file loaded with no errors
int CFInitHogFile (const char *pszFile, const char *folder, tHogFile *hogFiles, int *nFiles)
{
char id [4];
FILE *fp;
int i, len;
char fn [FILENAME_LEN];
const char *psz;
CFCriticalError (0);
if (*folder) {
sprintf (fn, "%s/%s", folder, pszFile);
pszFile = fn;
}
*nFiles = 0;
if (! (fp = CFGetFileHandle (pszFile, "", "rb")))
return 0;
if ((psz = strstr (pszFile, ".rdl")) || (psz = strstr (pszFile, ".rl2"))) {
while ((psz >= pszFile) && (*psz != '\\') && (*psz != '/') && (*psz != ':'))
psz--;
*nFiles = 1;
strncpy (hogFiles [0].name, psz + 1, 13);
hogFiles [0].offset = 0;
hogFiles [0].length = -1;
return 1;
}
fread (id, 3, 1, fp);
if (strncmp (id, "DHF", 3)) {
fclose (fp);
return 0;
}
for (;;) {
if (*nFiles >= MAX_HOGFILES) {
fclose (fp);
Error ("HOGFILE is limited to %d files.\n", MAX_HOGFILES);
}
i = (int) fread (hogFiles [*nFiles].name, 13, 1, fp);
if (i != 1) { //eof here is ok
fclose (fp);
return 1;
}
hogFiles [*nFiles].name [12] = '\0';
i = (int) fread (&len, 4, 1, fp);
if (i != 1) {
fclose (fp);
return 0;
}
len = INTEL_INT (len);
hogFiles [*nFiles].length = len;
hogFiles [*nFiles].offset = ftell (fp);
(*nFiles)++;
// Skip over
i = fseek (fp, len, SEEK_CUR);
}
}
示例15: cfile_read_fix
fix cfile_read_fix(CFILE *file)
{
fix f;
if (cfread( &f, sizeof(f), 1, file) != 1)
Error( "Error reading fix in cfile_read_fix()" );
f = (fix)INTEL_INT((int)f);
return f;
}