本文整理汇总了C++中Q_atoi函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_atoi函数的具体用法?C++ Q_atoi怎么用?C++ Q_atoi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_atoi函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );
}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:29,代码来源:teamplay_round_timer.cpp
示例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
}
开发者ID:n00ner,项目名称:xash3d,代码行数:32,代码来源:build.c
示例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;
}
开发者ID:mefisto2009,项目名称:rehlds,代码行数:34,代码来源:buildnum.cpp
示例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);
}
开发者ID:AAS,项目名称:ezquake-source,代码行数:29,代码来源:cl_input.c
示例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 ));
}
开发者ID:Reedych,项目名称:xash3d,代码行数:34,代码来源:cl_parse.c
示例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
}
开发者ID:Reedych,项目名称:xash3d,代码行数:34,代码来源:build.c
示例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 );
}
开发者ID:FWGS,项目名称:XashXT,代码行数:29,代码来源:buttons.cpp
示例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);
}
}
}
开发者ID:AAS,项目名称:ezquake-source,代码行数:32,代码来源:tr_init.c
示例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);
}
开发者ID:Chuvi-w,项目名称:ReGameDLL_CS,代码行数:36,代码来源:buttons.cpp
示例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;
}
}
开发者ID:Arkshine,项目名称:ReGameDLL_CS,代码行数:29,代码来源:mortar.cpp
示例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);
}
}
开发者ID:jite,项目名称:jquake,代码行数:25,代码来源:tr_init.c
示例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);
}
}
开发者ID:s1lentq,项目名称:ReGameDLL_CS,代码行数:57,代码来源:vehicle.cpp
示例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;
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:54,代码来源:physpropclientside.cpp
示例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 );
}
开发者ID:XashDev,项目名称:XashXT,代码行数:49,代码来源:doors.cpp
示例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;
}
开发者ID:kostya7,项目名称:ezquake-source,代码行数:15,代码来源:vid_sdl2.c
示例16: NET_Port_f
static void NET_Port_f (void)
{
int n;
if (Cmd_Argc () != 2)
{
Con_Printf ("\"port\" is \"%u\"\n", net_hostport);
return;
}
n = Q_atoi(Cmd_Argv(1));
if (n < 1 || n > 65534)
{
Con_Printf ("Bad value, must be between 1 and 65534\n");
return;
}
DEFAULTnet_hostport = n;
net_hostport = n;
if (listening)
{
// force a change to the new port
Cbuf_AddText ("listen 0\n");
Cbuf_AddText ("listen 1\n");
}
}
开发者ID:Acidburn0zzz,项目名称:KatanaEngine,代码行数:27,代码来源:engine_netmain.c
示例17: Player_GetSlot
int Player_GetSlot(char *arg)
{
int response;
// Try getting the slot by name or id.
if ((response = Player_StringtoSlot(arg)) >= 0 )
//|| response == PLAYER_ID_NOMATCH)
{
return response;
}
// We didn't find any player or ID that matched
// so we'll try treating it as the players
// sorted position.
if (arg[0] != '#')
{
return response;
}
if ((response = Player_NumtoSlot(Q_atoi(arg + 1))) >= 0)
{
return response;
}
return PLAYER_NUM_NOMATCH;
}
开发者ID:AAS,项目名称:ezquake-source,代码行数:26,代码来源:utils.c
示例18: StringToRGB_W
/// \brief converts "255 255 0 128" to (255, 255, 0, 128) array and saves it to rgb output argument
/// \param[in] s string in "R G B A" format
/// \param[out] rgb array of 4 bytes
int StringToRGB_W(char *s, byte *rgb)
{
int i;
char buf[20]; // "255 255 255 255" - the longest possible string
char *result;
rgb[0] = rgb[1] = rgb[2] = rgb[3] = 255;
strlcpy(buf, s, sizeof(buf));
result = strtok(buf, " ");
for (i = 0; i < 4 && result; i++, result = strtok(NULL, " "))
{
rgb[i] = (byte) Q_atoi(result);
}
#ifdef GLQUAKE
// TODO: Ok to do this in software also?
// Use normal quake pallete if not all arguments where given.
if (i < 3)
{
byte *col = (byte *) &d_8to24table[rgb[0]];
rgb[0] = col[0];
rgb[1] = col[1];
rgb[2] = col[2];
}
#endif
return i;
}
开发者ID:AAS,项目名称:ezquake-source,代码行数:32,代码来源:utils.c
示例19: UTIL_GetPlayerConnectionInfo
//-----------------------------------------------------------------------------
// Purpose:
// Input : playerIndex -
// ping -
// packetloss -
//-----------------------------------------------------------------------------
void UTIL_GetPlayerConnectionInfo( int playerIndex, int& ping, int &packetloss )
{
edict_t *pEntity = pAdminOP.GetEntityList()+playerIndex;
CBasePlayer *player = (CBasePlayer *)VFuncs::Instance(pEntity);
INetChannelInfo *nci = engine->GetPlayerNetInfo(playerIndex);
if ( nci && player && pAdminOP.pAOPPlayers[playerIndex-1].NotBot() )
{
float latency = nci->GetAvgLatency( FLOW_OUTGOING ); // in seconds
// that should be the correct latency, we assume that cmdrate is higher
// then updaterate, what is the case for default settings
const char * szCmdRate = engine->GetClientConVarValue( playerIndex, "cl_cmdrate" );
int nCmdRate = max( 1, Q_atoi( szCmdRate ) );
latency -= (0.5f/nCmdRate) + TICKS_TO_TIME( 1.0f ); // correct latency
// in GoldSrc we had a different, not fixed tickrate. so we have to adjust
// Source pings by half a tick to match the old GoldSrc pings.
latency -= TICKS_TO_TIME( 0.5f );
ping = latency * 1000.0f; // as msecs
ping = clamp( ping, 5, 1000 ); // set bounds, dont show pings under 5 msecs
packetloss = 100.0f * nci->GetAvgLoss( FLOW_INCOMING ); // loss in percentage
packetloss = clamp( packetloss, 0, 100 );
}
else
{
ping = 0;
packetloss = 0;
}
}
开发者ID:kila58,项目名称:sourceop,代码行数:40,代码来源:util.cpp
示例20: PR2_Init
void PR2_Init(void)
{
int p;
int usedll;
Cvar_Register(&sv_progtype);
Cvar_Register(&sv_progsname);
#ifdef WITH_NQPROGS
Cvar_Register(&sv_forcenqprogs);
#endif
#ifdef QVM_PROFILE
Cvar_Register(&sv_enableprofile);
#endif
p = COM_CheckParm ("-progtype");
if (p && p < COM_Argc())
{
usedll = Q_atoi(COM_Argv(p + 1));
if (usedll > 2)
usedll = VM_NONE;
Cvar_SetValue(&sv_progtype,usedll);
}
Cmd_AddCommand ("edict", ED2_PrintEdict_f);
Cmd_AddCommand ("edicts", ED2_PrintEdicts);
Cmd_AddCommand ("edictcount", ED_Count);
Cmd_AddCommand ("profile", PR2_Profile_f);
Cmd_AddCommand ("mod", PR2_GameConsoleCommand);
memset(pr_newstrtbl, 0, sizeof(pr_newstrtbl));
}
开发者ID:Classic-Fortress,项目名称:server,代码行数:32,代码来源:pr2_exec.c
注:本文中的Q_atoi函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论