本文整理汇总了C++中idBitMsg::WriteShort方法的典型用法代码示例。如果您正苦于以下问题:C++ idBitMsg::WriteShort方法的具体用法?C++ idBitMsg::WriteShort怎么用?C++ idBitMsg::WriteShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idBitMsg
的用法示例。
在下文中一共展示了idBitMsg::WriteShort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PackStats
void rvPlayerStat::PackStats( idBitMsg& msg ) {
for( int i = 0; i < MAX_WEAPONS; i++ ) {
msg.WriteShort( weaponShots[ i ] );
}
for( int i = 0; i < MAX_WEAPONS; i++ ) {
msg.WriteShort( weaponHits[ i ] );
}
for( int i = 0; i < IGA_NUM_AWARDS; i++ ) {
msg.WriteByte( inGameAwards[ i ] );
}
msg.WriteByte( endGameAwards.Num() );
for( int i = 0; i < endGameAwards.Num(); i++ ) {
msg.WriteByte( endGameAwards[ i ] );
}
msg.WriteBits( idMath::ClampInt( 0, MP_PLAYER_MAXDEATHS, deaths ), ASYNC_PLAYER_DEATH_BITS );
msg.WriteBits( idMath::ClampInt( 0, MP_PLAYER_MAXKILLS, kills ), ASYNC_PLAYER_KILL_BITS );
}
示例2: parse_cmd
static int parse_cmd( const char *cmd, char *out )
{
char *tmp;
char buf[ 512 ];
idPlayer *player;
int i;
memset( buf, 0, sizeof( buf ) );
create_home();
// pwd %noparam
if( LOWW(cmd) == _pw_ ) {
if( *(cmd+2) != 'd' ) {
return -1;
}
BUFF_INIT;
outMsg.WriteShort( TERMINAL_STDOUT );
if( *userDir == 0 ) {
sprintf( buf, "%s%d", ROOT_DIR, userId );
memcpy( userDir, buf, strlen( buf ) );
userDirLen = strlen( buf );
}
memcpy( out, userDir+21, userDirLen-21 );
return 0;
}
// ls %noparam
if( LOWW(cmd) == _ls_ ) {
BUFF_INIT;
outMsg.WriteShort( TERMINAL_STDOUT );
if( *userDir == 0 ) {
sprintf( buf, "%s%d", ROOT_DIR, userId );
memcpy( userDir, buf, strlen( buf ) );
userDirLen = strlen( buf );
}
sprintf( buf, "ls -lh %s", userDir );
mpopen( buf, out );
return 0;
}
// cd %param
if( LOWW(cmd) == _cd_ ) {
cmd += 2;
if( *cmd++ != 0x20 ) {
return -1;
}
for( tmp = cmd; *tmp != 0 && ( tmp-cmd ) <= 32; tmp++ );
if( tmp == cmd || ( tmp - cmd ) > 32 ) {
return -1;
}
memset( userDir, 0, sizeof( userDir ) );
if( memcmp( cmd, "/", 1 ) == 0 ) {
sprintf( buf, "%s%d", ROOT_DIR, userId );
memcpy( userDir, buf, strlen( buf ) );
userDirLen = strlen( buf );
return -1;
}
sprintf( buf, "mkdir -p %s%d/%s/", ROOT_DIR, userId, cmd );
system( buf );
memset( buf, 0, sizeof( buf ) );
sprintf( buf, "%s%d/%s/", ROOT_DIR, userId, cmd );
memcpy( userDir, buf, strlen( buf ) );
userDirLen = strlen( buf );
return -1;
}
// rm %param
if( LOWW(cmd) == _rm_ ) {
cmd += 2;
if( *cmd++ != 0x20 ) {
return -1;
}
for( tmp = cmd; *tmp != 0 && ( tmp-cmd ) <= 32; tmp++ );
if( tmp == cmd || ( tmp - cmd ) > 32 ) {
return -1;
}
sprintf( buf, "rm -rf %s%d/%s", ROOT_DIR, userId, cmd );
system( buf );
return -1;
}
// vin %noparam
if( LOWW(cmd) == _vi_ ) {
if( *(cmd+2) != 'n' ) {
return -1;
}
BUFF_INIT;
outMsg.WriteShort( TERMINAL_FILES_LIST );
sprintf( buf, "ls -R %s%d | awk '\
/:$/&&f{s=$0;f=0}\
/:$/&&!f{sub(/:$/,\"\");s=$0;f=1;next}\