本文整理汇总了C++中Q_atoi函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_atoi函数的具体用法?C++ Q_atoi怎么用?C++ Q_atoi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_atoi函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: STRING
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTeamRoundTimer::InputAddTeamTime( inputdata_t &input )
{
char token[128];
const char *p = STRING( input.value.StringID() );
int nTeam = TEAM_UNASSIGNED;
int nSeconds = 0;
// get the team
p = nexttoken( token, p, ' ' );
if ( token )
{
nTeam = Q_atoi( token );
}
// get the time
p = nexttoken( token, p, ' ' );
if ( token )
{
nSeconds = Q_atoi( token );
}
if ( nSeconds != 0 )
{
AddTimerSeconds( nSeconds, nTeam );
}
}
示例2: Q_buildnum
// returns days since Feb 13 2007
int Q_buildnum( void )
{
// do not touch this! Only author of Xash3D can increase buildnumbers!
#if 0
int m = 0, d = 0, y = 0;
static int b = 0;
if( b != 0 ) return b;
for( m = 0; m < 11; m++ )
{
if( !Q_strnicmp( &date[0], mon[m], 3 ))
break;
d += mond[m];
}
d += Q_atoi( &date[4] ) - 1;
y = Q_atoi( &date[7] ) - 1900;
b = d + (int)((y - 1) * 365.25f );
if((( y % 4 ) == 0 ) && m > 1 )
{
b += 1;
}
b -= 38752; // Feb 13 2007
return b;
#else
return 3030;
#endif
}
示例3: build_number
int build_number(void)
{
int m = 0;
int d = 0;
int y = 0;
static int b = 0;
if (b != 0)
return b;
for (m = 0; m < 11; m++)
{
if (Q_strnicmp(&date[0], mon[m], 3) == 0)
break;
d += mond[m];
}
d += Q_atoi(&date[4]) - 1;
y = Q_atoi(&date[7]) - 1900;
b = d + (int)((y - 1) * 365.25);
if (((y % 4) == 0) && m > 1)
{
b += 1;
}
#ifdef REHLDS_FIXES
b -= 41374; // return days since initial commit on Apr 12 2014 (Happy Cosmonautics Day!)
#else // REHLDS_FIXES
b -= 34995; // return days since Oct 24 1996
#endif // REHLDS_FIXES
return b;
}
示例4: IN_FireDown
void IN_FireDown(void)
{
int key_code = VOID_KEY;
int last_arg_idx = Cmd_Argc() - 1;
int i;
if (Cmd_Argc() < 2) {
Com_Printf("Usage: %s <weapon number>\n", Cmd_Argv(0));
return;
}
if (IN_IsLastArgKeyCode()) {
key_code = Q_atoi(Cmd_Argv(last_arg_idx));
last_arg_idx--;
}
for (i = 1; i <= last_arg_idx && i <= MAXWEAPONS; i++) {
int desired_impulse = Q_atoi(Cmd_Argv(i));
weapon_order[i - 1] = desired_impulse;
}
for (; i <= MAXWEAPONS; i++) {
weapon_order[i - 1] = 0;
}
in_impulse = IN_BestWeapon();
KeyDown_common(&in_attack, key_code);
}
示例5: CL_UpdateUserinfo
/*
================
CL_UpdateUserinfo
collect userinfo from all players
================
*/
void CL_UpdateUserinfo( sizebuf_t *msg )
{
int slot;
qboolean active;
player_info_t *player;
slot = BF_ReadUBitLong( msg, MAX_CLIENT_BITS );
if( slot >= MAX_CLIENTS )
Host_Error( "CL_ParseServerMessage: svc_updateuserinfo > MAX_CLIENTS\n" );
player = &cl.players[slot];
active = BF_ReadOneBit( msg ) ? true : false;
if( active )
{
Q_strncpy( player->userinfo, BF_ReadString( msg ), sizeof( player->userinfo ));
Q_strncpy( player->name, Info_ValueForKey( player->userinfo, "name" ), sizeof( player->name ));
Q_strncpy( player->model, Info_ValueForKey( player->userinfo, "model" ), sizeof( player->model ));
cl.playermodels[slot] = 0;
player->topcolor = Q_atoi( Info_ValueForKey( player->userinfo, "topcolor" ));
player->bottomcolor = Q_atoi( Info_ValueForKey( player->userinfo, "bottomcolor" ));
if( slot == cl.playernum ) Q_memcpy( &menu.playerinfo, player, sizeof( player_info_t ));
}
else Q_memset( player, 0, sizeof( *player ));
}
示例6: Q_buildnum
// returns days since Feb 13 2007
int Q_buildnum( void )
{
// do not touch this! Only author of Xash3D can increase buildnumbers!
// Xash3D SDL: HAHAHA! I TOUCHED THIS!
#if defined(XASH_GENERATE_BUILDNUM)
int m = 0, d = 0, y = 0;
static int b = 0;
if( b != 0 ) return b;
for( m = 0; m < 11; m++ )
{
if( !Q_strnicmp( &date[0], mon[m], 3 ))
break;
d += mond[m];
}
d += Q_atoi( &date[4] ) - 1;
y = Q_atoi( &date[7] ) - 1900;
b = d + (int)((y - 1) * 365.25f );
if((( y % 4 ) == 0 ) && m > 1 )
{
b += 1;
}
//b -= 38752; // Feb 13 2007
b -= 41728; // Apr 1 2015. Date of first release of crossplatform Xash3D
return b;
#else
return 500; // Aug 13 2016
#endif
}
示例7: KeyValue
void CBaseButton :: KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "locked_sound" ))
{
m_iLockedSound = ALLOC_STRING( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "locked_sentence" ))
{
m_bLockedSentence = Q_atoi( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ))
{
m_iUnlockedSound = ALLOC_STRING( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ))
{
m_bUnlockedSentence = Q_atoi( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "sounds" ))
{
m_sounds = ALLOC_STRING( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else CBaseToggle::KeyValue( pkvd );
}
示例8: OnChange_vid_wideaspect
void OnChange_vid_wideaspect (cvar_t *var, char *string, qbool *cancel)
{
extern float nonwidefov;
extern int nonwideconheight;
extern cvar_t scr_fov, r_conheight;
if ( (Q_atoi(string) == vid_wideaspect.value) || (Q_atoi(string) > 1) || (Q_atoi(string) < 0))
{
*cancel = true;
return;
}
Cvar_Set (&vid_wideaspect, string);
if(!host_everything_loaded)
return;
if (nonwidefov != 0 && nonwideconheight != 0)
{
if (vid_wideaspect.integer == 0)
{
scr_fov.OnChange(&scr_fov, Q_ftos(nonwidefov), cancel);
r_conheight.OnChange(&r_conheight, Q_ftos(nonwideconheight), cancel);
}
else
{
scr_fov.OnChange(&scr_fov, Q_ftos(scr_fov.value), cancel);
r_conheight.OnChange(&r_conheight, Q_ftos(r_conheight.value), cancel);
}
}
}
示例9: ALLOC_STRING
// Cache user-entity-field values until spawn is called.
void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "changetarget"))
{
m_strChangeTarget = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "locked_sound"))
{
m_bLockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "locked_sentence"))
{
m_bLockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "unlocked_sound"))
{
m_bUnlockedSound = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "unlocked_sentence"))
{
m_bUnlockedSentence = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "sounds"))
{
m_sounds = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CBaseToggle::KeyValue(pkvd);
}
示例10: ALLOC_STRING
/* <f6d87> ../cstrike/dlls/mortar.cpp:71 */
void CFuncMortarField::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "m_iszXController"))
{
m_iszXController = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "m_iszYController"))
{
m_iszYController = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "m_flSpread"))
{
m_flSpread = Q_atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "m_fControl"))
{
m_fControl = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "m_iCount"))
{
m_iCount = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
}
示例11: OnChange_vid_wideaspect
void OnChange_vid_wideaspect (cvar_t *var, char *string, qbool *cancel)
{
// FIXME conheight
extern int nonwideconheight;
extern cvar_t r_conheight;
if ( (Q_atoi(string) == vid_wideaspect.value) || (Q_atoi(string) > 1) || (Q_atoi(string) < 0))
{
*cancel = true;
return;
}
Cvar_Set (&vid_wideaspect, string);
if(!host_everything_loaded)
return;
if (nonwideconheight != 0)
{
if (vid_wideaspect.integer == 0)
r_conheight.OnChange(&r_conheight, Q_ftos(nonwideconheight), cancel);
else
r_conheight.OnChange(&r_conheight, Q_ftos(r_conheight.value), cancel);
}
}
示例12: Q_atof
void CFuncVehicle::KeyValue(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "length"))
{
m_length = Q_atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "width"))
{
m_width = Q_atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "height"))
{
m_height = Q_atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "startspeed"))
{
m_startSpeed = Q_atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "sounds"))
{
m_sounds = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "volume"))
{
// rounding values to integer
m_flVolume = Q_atoi(pkvd->szValue);
m_flVolume *= 0.1f;
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "bank"))
{
m_flBank = Q_atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "acceleration"))
{
m_acceleration = Q_atoi(pkvd->szValue);
if (m_acceleration < 1)
m_acceleration = 1;
else if (m_acceleration > 10)
m_acceleration = 10;
pkvd->fHandled = TRUE;
}
else
{
CBaseEntity::KeyValue(pkvd);
}
}
示例13: atof
bool C_PhysPropClientside::KeyValue( const char *szKeyName, const char *szValue )
{
if (FStrEq(szKeyName, "physdamagescale"))
{
m_impactEnergyScale = atof(szValue);
}
else if ( FStrEq(szKeyName, "health") )
{
m_iHealth = Q_atoi(szValue);
}
else if (FStrEq(szKeyName, "spawnflags"))
{
m_spawnflags = Q_atoi(szValue);
}
else if (FStrEq(szKeyName, "model"))
{
SetModelName( AllocPooledString( szValue ) );
}
else if (FStrEq(szKeyName, "fademaxdist"))
{
m_fadeMaxDist = Q_atof(szValue);
}
else if (FStrEq(szKeyName, "fademindist"))
{
m_fadeMinDist = Q_atof(szValue);
}
else if (FStrEq(szKeyName, "fadescale"))
{
m_flFadeScale = Q_atof(szValue);
}
else if (FStrEq(szKeyName, "inertiaScale"))
{
m_inertiaScale = Q_atof(szValue);
}
else if (FStrEq(szKeyName, "skin"))
{
m_nSkin = Q_atoi(szValue);
}
else if (FStrEq(szKeyName, "physicsmode"))
{
m_iPhysicsMode = Q_atoi(szValue);
}
else
{
if ( !BaseClass::KeyValue( szKeyName, szValue ) )
{
// key hasn't been handled
return false;
}
}
return true;
}
示例14: ALLOC_STRING
void CBaseDoor::KeyValue( KeyValueData *pkvd )
{
if( FStrEq( pkvd->szKeyName, "movesnd" ))
{
m_iMoveSnd = ALLOC_STRING( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "stopsnd" ))
{
m_iStopSnd = ALLOC_STRING(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "healthvalue" ))
{
m_bHealthValue = Q_atoi( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "locked_sound" ))
{
m_iLockedSound = ALLOC_STRING( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "locked_sentence" ))
{
m_bLockedSentence = Q_atoi( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "unlocked_sound" ))
{
m_iUnlockedSound = ALLOC_STRING( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "unlocked_sentence" ))
{
m_bUnlockedSentence = Q_atoi( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "WaveHeight" ))
{
pev->scale = Q_atof( pkvd->szValue ) * (1.0f / 8.0f);
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "chaintarget" ))
{
m_iChainTarget = ALLOC_STRING( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else BaseClass :: KeyValue( pkvd );
}
示例15: conres_changed_callback
static void conres_changed_callback (cvar_t *var, char *string, qbool *cancel)
{
if (var == &r_conwidth) {
Cvar_SetValue(&r_conwidth, Q_atoi(string));
} else if (var == &r_conheight) {
Cvar_SetValue(&r_conheight, Q_atoi(string));
} else if (var == &r_conscale) {
Cvar_SetValue(&r_conscale, Q_atof(string));
} else {
Com_Printf("Called with unknown variable: %s\n", var->name ? var->name : "unknown");
}
VID_UpdateConRes();
*cancel = true;
}