int get_name_from_addr (struct qsockaddr *addr, char *name) { struct hostent *hostentry; hostentry = gethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_addr, sizeof(struct in_addr), AF_INET); if (hostentry) { Q_strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1); return 0; } Q_strcpy (name, addr_to_string (addr)); return 0; }
void Host_Tell_f(void) { client_t *client; client_t *save; int j; char *p; char text[64]; if (cmd_source == src_command) { Cmd_ForwardToServer (); return; } if (Cmd_Argc () < 3) return; Q_strcpy(text, host_client->name); Q_strcat(text, ": "); p = Cmd_Args(); // remove quotes if present if (*p == '"') { p++; p[Q_strlen(p)-1] = 0; } // check length & truncate if necessary j = sizeof(text) - 2 - Q_strlen(text); // -2 for /n and null terminator if (Q_strlen(p) > j) p[j] = 0; strcat (text, p); strcat (text, "\n"); save = host_client; for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) { if (!client->active || !client->spawned) continue; if (Q_strcasecmp(client->name, Cmd_Argv(1))) continue; host_client = client; SV_ClientPrintf("%s", text); break; } host_client = save; }
int WINS_GetNameFromAddr (struct qsockaddr *addr, char *name) { struct hostent *hostentry; hostentry = pgethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_addr, sizeof(struct in_addr), AF_INET); if (hostentry) { Q_strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1); return 0; } Q_strcpy (name, WINS_AddrToString (addr)); return 0; }
void CServerRemoteAccess::GetMapList(CUtlBuffer &value) { const char *findfn; char *extension; char curDir[MAX_PATH]; char mapName[MAX_PATH]; char mapwild[64]; Q_strcpy(mapwild, "maps/*.bsp"); for (findfn = Sys_FindFirst(mapwild, 0); findfn; findfn = Sys_FindNext(0)) { Q_snprintf(curDir, ARRAYSIZE(curDir), "maps/%s", findfn); #ifdef REHLDS_CHECKS curDir[ARRAYSIZE(curDir) - 1] = 0; #endif FS_GetLocalPath(curDir, curDir, ARRAYSIZE(curDir)); if (Q_strstr(curDir, com_gamedir)) { #ifdef REHLDS_CHECKS Q_strncpy(mapName, findfn, ARRAYSIZE(mapName)); mapName[ARRAYSIZE(mapName) - 1] = 0; #else Q_strcpy(mapName, findfn); #endif extension = Q_strstr(mapName, ".bsp"); if (extension) *extension = 0; value.PutString(mapName); value.PutString("\n"); } } Sys_FindClose(); value.PutChar(0); }
/* <25bb65> ../cstrike/dlls/wpn_shared/wpn_flashbang.cpp:133 */ bool CFlashbang::ShieldSecondaryFire(int iUpAnim, int iDownAnim) { if (!m_pPlayer->HasShield() || m_flStartThrow > 0) { return false; } if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN) { m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN; SendWeaponAnim(iDownAnim, UseDecrement() != FALSE); Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldgren"); m_fMaxSpeed = FLASHBANG_MAX_SPEED; m_pPlayer->m_bShieldDrawn = false; } else { m_iWeaponState |= WPNSTATE_SHIELD_DRAWN; SendWeaponAnim(iUpAnim, UseDecrement() != FALSE); Q_strcpy(m_pPlayer->m_szAnimExtention, "shielded"); m_fMaxSpeed = FLASHBANG_MAX_SPEED_SHIELD; m_pPlayer->m_bShieldDrawn = true; } m_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) != WPNSTATE_SHIELD_DRAWN); m_pPlayer->ResetMaxSpeed(); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4; m_flNextPrimaryAttack = GetNextAttackDelay(0.4); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6; return true; }
/* ===================================== Cmd_GetCdCommands Prints or complete CD command name ===================================== */ qboolean Cmd_GetCdCommands( const char *s, char *completedname, int length ) { int i, numcdcommands; string cdcommands[8]; string matchbuf; const char *cd_command[] = { "info", "loop", "off", "on", "pause", "play", "resume", "stop", }; // compare CD command list with current keyword for( i = 0, numcdcommands = 0; i < 8; i++ ) { if(( *s == '*' ) || !Q_strnicmp( cd_command[i], s, Q_strlen( s ))) Q_strcpy( cdcommands[numcdcommands++], cd_command[i] ); } if( !numcdcommands ) return false; Q_strncpy( matchbuf, cdcommands[0], MAX_STRING ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); if( numcdcommands == 1 ) return true; for( i = 0; i < numcdcommands; i++ ) { Q_strncpy( matchbuf, cdcommands[i], MAX_STRING ); Msg( "%16s\n", matchbuf ); } Msg( "\n^3 %i commands found.\n", numcdcommands ); // cut shortestMatch to the amount common with s if( completedname && length ) { for( i = 0; matchbuf[i]; i++ ) { if( Q_tolower( completedname[i] ) != Q_tolower( matchbuf[i] )) completedname[i] = 0; } } return true; }
//--------------------------------------------------------------------------------- // Purpose: Level Loaded //--------------------------------------------------------------------------------- void ManiAutoMap::LevelInit(void) { this->ResetTimeout(mani_automap_timer.GetInt()); ignore_this_map = false; if (set_next_map) { int map_choice = this->ChooseMap(); Q_strcpy(forced_nextmap, automap_list[map_choice].map_name); Q_strcpy(next_map, automap_list[map_choice].map_name); mani_nextmap.SetValue(automap_list[map_choice].map_name); override_changelevel = MANI_MAX_CHANGELEVEL_TRIES; override_setnextmap = true; // Make sure end of map vote doesn't try and override it gpManiVote->SysSetMapDecided(true); set_next_map = false; ignore_this_map = true; SetChangeLevelReason("Automap set nextmap"); LogCommand (NULL, "Autochange set nextmap %s while server idle\n", automap_list[map_choice].map_name); } }
//----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void CBindPanel::DrawBindingName() { int iconWide = m_iIconTall * m_fWidthScale * m_fScale; int x = (iconWide>>1); int y = ( m_iIconTall * m_fScale ) * 0.5f; if ( !m_bController && !IsConsole() ) { // Draw the caption vgui::surface()->DrawSetTextFont( m_hKeysFont ); int fontTall = vgui::surface()->GetFontTall( m_hKeysFont ); char szBinding[ 256 ]; Q_strcpy( szBinding, m_szKey ); if ( Q_strcmp( szBinding, "SEMICOLON" ) == 0 ) { Q_strcpy( szBinding, ";" ); } else if ( Q_strlen( szBinding ) == 1 && szBinding[ 0 ] >= 'a' && szBinding[ 0 ] <= 'z' ) { // Make single letters uppercase szBinding[ 0 ] += ( 'A' - 'a' ); } wchar wszCaption[ 64 ]; g_pVGuiLocalize->ConstructString( wszCaption, sizeof(wchar)*64, szBinding, NULL ); int iWidth = GetScreenWidthForCaption( wszCaption, m_hKeysFont ); // Draw black text vgui::surface()->DrawSetTextColor( 0,0,0, 255 ); vgui::surface()->DrawSetTextPos( x - (iWidth>>1) - 1, y - (fontTall >>1) - 1 ); vgui::surface()->DrawUnicodeString( wszCaption ); }
/* ================= CL_InternetServers_f ================= */ void CL_InternetServers_f( void ) { netadr_t adr; char fullquery[512] = "\x31\xFF" "0.0.0.0:0\0" "\\gamedir\\"; MsgDev( D_INFO, "Scanning for servers on the internet area...\n" ); NET_Config( true ); // allow remote if( !NET_StringToAdr( MASTERSERVER_ADR, &adr ) ) MsgDev( D_INFO, "Can't resolve adr: %s\n", MASTERSERVER_ADR ); Q_strcpy( &fullquery[21], GI->gamedir ); NET_SendPacket( NS_CLIENT, Q_strlen( GI->gamedir ) + 22, fullquery, adr ); }
void S_PlayVol(void) { static int hash=543; int i; float vol; char name[256]; sfx_t *sfx; i = 1; while (i<Cmd_Argc()) { if (!Q_strrchr(Cmd_Argv(i), '.')) { Q_strcpy(name, Cmd_Argv(i)); Q_strcat(name, ".wav"); } else Q_strcpy(name, Cmd_Argv(i)); sfx = S_PrecacheSound(name); vol = Q_atof(Cmd_Argv(i+1)); S_StartSound(hash++, 0, sfx, listener_origin, vol, 1.0); i+=2; } }
void CNodeCallback::RestoreFromKeyValues_Specific( KeyValues *pKV ) { const char *cbname = pKV->GetString( "sz_callbackname" ); if ( Q_strlen( cbname ) ) { delete [] szCallbackName; szCallbackName = new char [ Q_strlen( cbname ) + 1 ]; Q_strcpy( szCallbackName, cbname ); } iNumComponents = pKV->GetInt( "i_numc", iNumComponents ); UpdateNode(); OnUpdateHierachy( NULL, NULL ); }
/* ============ COM_ExtractFilePath ============ */ void COM_ExtractFilePath( const char *path, char *dest ) { const char *src; src = path + Q_strlen( path ) - 1; // back up until a \ or the start while( src != path && !(*(src - 1) == '\\' || *(src - 1) == '/' )) src--; if( src != path ) { memcpy( dest, path, src - path ); dest[src - path - 1] = 0; // cutoff backslash } else Q_strcpy( dest, "" ); // file without path }
/* ================= CL_InternetServers_f ================= */ void CL_InternetServers_f( void ) { netadr_t adr; char fullquery[512] = MS_SCAN_REQUEST; MsgDev( D_INFO, "Scanning for servers on the internet area...\n" ); NET_Config( true ); // allow remote if( !NET_StringToAdr( sv_master->string, &adr ) ) { MsgDev( D_INFO, "Can't resolve adr: %s\n", sv_master->string ); return; } NET_SendPacket( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strcpy( fullquery + sizeof( MS_SCAN_REQUEST ) - 1, GI->gamedir ), fullquery, adr ); }
CGEWebRequest::CGEWebRequest( const char *addr, WEBRQST_CLBK callback /*=NULL*/ ) { m_pAddress = new char[Q_strlen(addr)+1]; Q_strcpy( m_pAddress, addr ); m_pError = new char[CURL_ERROR_SIZE+1]; m_pError[0] = '\0'; m_bFinished = false; m_pCallback = callback; // Start the thread SetName( "GEWebRequest" ); Start(); }
void Delta_InitFields( void ) { char *afile, *pfile; string encodeDll, encodeFunc, token; delta_info_t *dt; afile = FS_LoadFile( DELTA_PATH, NULL, false ); if( !afile ) { static string errormsg; Q_snprintf( errormsg, sizeof( errormsg ), "DELTA_Load: couldn't load file %s\n", DELTA_PATH ); Sys_Error( errormsg ); } pfile = afile; while(( pfile = COM_ParseFile( pfile, token )) != NULL ) { dt = Delta_FindStruct( token ); if( dt == NULL ) { Sys_Error( "delta.lst: unknown struct %s\n", token ); } pfile = COM_ParseFile( pfile, encodeDll ); if( !Q_stricmp( encodeDll, "none" )) Q_strcpy( encodeFunc, "null" ); else pfile = COM_ParseFile( pfile, encodeFunc ); // jump to '{' pfile = COM_ParseFile( pfile, token ); if( token[0] != '{' ) { Sys_Error( "delta.lst: missing '{' in section %s\n", dt->pName ); } Delta_ParseTable( &pfile, dt, encodeDll, encodeFunc ); } Mem_Free( afile ); // adding some requrid fields fields that user may forget or don't know how to specified Delta_AddField( "event_t", "velocity[0]", DT_SIGNED | DT_FLOAT, 16, 8.0f, 1.0f ); Delta_AddField( "event_t", "velocity[1]", DT_SIGNED | DT_FLOAT, 16, 8.0f, 1.0f ); Delta_AddField( "event_t", "velocity[2]", DT_SIGNED | DT_FLOAT, 16, 8.0f, 1.0f ); }
/* <189df> ../engine/cvar.c:391 */ void EXT_FUNC Cvar_RegisterVariable(cvar_t *variable) { char *oldstr; cvar_t *v, *c; cvar_t dummyvar; if (Cvar_FindVar(variable->name)) { Con_Printf("Can't register variable \"%s\", already defined\n", variable->name); return; } if (Cmd_Exists(variable->name)) { Con_Printf(__FUNCTION__ ": \"%s\" is a command\n", variable->name); return; } oldstr = variable->string; // Alloc string, so it will not dissapear on side modules unloading and to maintain the same name during run variable->string = (char *)Z_Malloc(Q_strlen(variable->string) + 1); Q_strcpy(variable->string, oldstr); variable->value = (float)Q_atof(oldstr); dummyvar.name = " "; dummyvar.next = cvar_vars; v = cvar_vars; c = &dummyvar; // Insert with alphabetic order while (v) { if (Q_stricmp(v->name, variable->name) > 0) { break; } c = v; v = v->next; } c->next = variable; variable->next = v; cvar_vars = dummyvar.next; }
/* ===================================== Cmd_GetTexturemodes Prints or complete sound filename ===================================== */ qboolean Cmd_GetTexturemodes( const char *s, char *completedname, int length ) { int i, numtexturemodes; string texturemodes[6]; // keep an actual ( sizeof( gl_texturemode) / sizeof( gl_texturemode[0] )) string matchbuf; const char *gl_texturemode[] = { "GL_LINEAR", "GL_LINEAR_MIPMAP_LINEAR", "GL_LINEAR_MIPMAP_NEAREST", "GL_NEAREST", "GL_NEAREST_MIPMAP_LINEAR", "GL_NEAREST_MIPMAP_NEAREST", }; // compare gamelist with current keyword for( i = 0, numtexturemodes = 0; i < 6; i++ ) { if(( *s == '*' ) || !Q_strnicmp( gl_texturemode[i], s, Q_strlen( s ))) Q_strcpy( texturemodes[numtexturemodes++], gl_texturemode[i] ); } if( !numtexturemodes ) return false; Q_strncpy( matchbuf, gl_texturemode[0], MAX_STRING ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); if( numtexturemodes == 1 ) return true; for( i = 0; i < numtexturemodes; i++ ) { Q_strncpy( matchbuf, texturemodes[i], MAX_STRING ); Msg( "%16s\n", matchbuf ); } Msg( "\n^3 %i filters found.\n", numtexturemodes ); // cut shortestMatch to the amount common with s if( completedname && length ) { for( i = 0; matchbuf[i]; i++ ) { if( Q_tolower( completedname[i] ) != Q_tolower( matchbuf[i] )) completedname[i] = 0; } } return true; }
sfxcache_t *S_LoadSound (sfx_t *s) { char namebuffer[512]; byte *data; wavinfo_t info; int len; float stepscale; sfxcache_t *sc; byte stackbuf[1*1024]; // avoid dirtying the cache heap // see if still in memory sc = (sfxcache_t*)Cache_Check(&s->cache); if(sc) return sc; // load it in Q_strcpy(namebuffer,Global.cSoundPath); Q_strcat(namebuffer,s->name); data = COM_LoadStackFile(namebuffer, stackbuf, sizeof(stackbuf)); if (!data) { Con_Warning("Couldn't load %s\n", namebuffer); return NULL; } info = GetWavinfo (s->name, data, com_filesize); stepscale = (float)info.rate / shm->speed; len = info.samples / stepscale; len = len * info.width * info.channels; sc = (sfxcache_t*)Cache_Alloc ( &s->cache, len + sizeof(sfxcache_t), s->name); if (!sc) return NULL; sc->length = info.samples; sc->loopstart = info.loopstart; sc->speed = info.rate; sc->width = info.width; sc->stereo = info.channels; ResampleSfx (s, sc->speed, sc->width, data + info.dataofs); return sc; }
void Movie_Start_f (void) { char name[MAX_OSPATH], path[256]; //qb: jqavi was MAX_FILELENGTH int i; if (Cmd_Argc() != 2) //qb: autogenerate file name if none is given. { Q_strcpy(name,"qbs8_000.avi"); //qb: screenshots dir for (i=0 ; i<=999 ; i++) { name[5] = i/100 + '0'; name[6] = (i/10)%10 + '0'; name[7] = i%10 + '0'; sprintf (path, "%s/%s/%s", com_gamedir, "screenshots", name); if (Sys_FileTime(path) == -1) break; // file doesn't exist } if (i==1000) { Con_Printf ("Movie_Start_f: Too many AVI files in directory.\n"); return; } } else { Q_strncpyz (name, Cmd_Argv(1), sizeof(name)); COM_ForceExtension (name, ".avi"); } hack_ctr = capture_hack.value; Q_snprintfz (path, sizeof(path), "%s/%s/%s", com_gamedir, "screenshots", name); if (!(moviefile = fopen(path, "wb"))) { COM_CreatePath (path); if (!(moviefile = fopen(path, "wb"))) { Con_Printf ("ERROR: Couldn't open %s\n", name); return; } } movie_is_capturing = Capture_Open (path); if (movie_is_capturing) Con_DPrintf("Capturing video %s\n", path); //qb: is printed on the vid, so only in debug mode. else Con_Printf("Movie_Start_f: Movie capture open failed.\n"); }
unsigned short CCountedStringPool::ReferenceStringHandle( const char* pIntrinsic ) { if( pIntrinsic == NULL ) return INVALID_ELEMENT; unsigned short nHashBucketIndex = (HashStringCaseless( pIntrinsic ) % HASH_TABLE_SIZE); unsigned short nCurrentBucket = m_HashTable[ nHashBucketIndex ]; // Does the bucket already exist? if( nCurrentBucket != INVALID_ELEMENT ) { for( ; nCurrentBucket != INVALID_ELEMENT ; nCurrentBucket = m_Elements[nCurrentBucket].nNextElement ) { if( !Q_stricmp( pIntrinsic, m_Elements[nCurrentBucket].pString ) ) { // Anyone who hits 65k references is permanant if( m_Elements[nCurrentBucket].nReferenceCount < MAX_REFERENCE ) { m_Elements[nCurrentBucket].nReferenceCount ++ ; } return nCurrentBucket; } } } if( m_FreeListStart != INVALID_ELEMENT ) { nCurrentBucket = m_FreeListStart; m_FreeListStart = m_Elements[nCurrentBucket].nNextElement; } else { nCurrentBucket = m_Elements.AddToTail(); } m_Elements[nCurrentBucket].nReferenceCount = 1; // Insert at the beginning of the bucket: m_Elements[nCurrentBucket].nNextElement = m_HashTable[ nHashBucketIndex ]; m_HashTable[ nHashBucketIndex ] = nCurrentBucket; m_Elements[nCurrentBucket].pString = new char[Q_strlen( pIntrinsic ) + 1]; Q_strcpy( m_Elements[nCurrentBucket].pString, pIntrinsic ); return nCurrentBucket; }
/* ============ Cvar_Set ============ */ void Cvar_SetQuick (cvar_t *var, char *value) { qboolean changed; changed = Q_strcmp(var->string, value); Z_Free (var->string); // free the old value string var->string = Z_Malloc (Q_strlen(value)+1); Q_strcpy (var->string, value); var->value = Q_atof (var->string); if (var->server && changed) { if (sv.active) SV_BroadcastPrintf ("\"%s\" changed to \"%s\"\n", var->name, var->string); } }
void SystemWrapper_CommandForwarder() { char cmd[MAX_CMD_LINE]; Q_strcpy(cmd, Cmd_Argv(0)); if (Cmd_Argc() > 1) { Q_strcat(cmd, " "); Q_strcat(cmd, Cmd_Args()); } cmd[sizeof(cmd) - 1] = '\0'; if (cmd[0]) { SystemWrapper_ExecuteString(cmd); } }
//--------------------------------------------------------------------------------- // Purpose: Check Player on disconnect //--------------------------------------------------------------------------------- void ManiSaveScores::ClientDisconnect(player_t *player_ptr) { save_cash_list[player_ptr->index - 1].trigger = false; save_cash_list[player_ptr->index - 1].cash = 0; if (war_mode) return; if (mani_save_scores.GetInt() == 0) return; if (IsLAN()) return; if (player_ptr->is_bot) return; int frag_count = 0; int death_count = 0; int cash = 0; CBaseEntity *pCBE = EdictToCBE(player_ptr->entity); // Need to save the players score if (Map_CanUseMap(pCBE, MANI_VAR_FRAGS)) { frag_count = Map_GetVal(pCBE, MANI_VAR_FRAGS, 0); } if (Map_CanUseMap(pCBE, MANI_VAR_DEATHS)) { death_count = Map_GetVal(pCBE, MANI_VAR_DEATHS, 0); } if ((gpManiGameType->IsGameType(MANI_GAME_CSS) || gpManiGameType->IsGameType(MANI_GAME_CSGO)) && mani_save_scores_css_cash.GetInt() == 1) { cash = Prop_GetVal(player_ptr->entity, MANI_PROP_ACCOUNT, 0); } save_scores_t save_scores; Q_strcpy(save_scores.steam_id, player_ptr->steam_id); time_t current_time; time(¤t_time); save_scores.kills = frag_count; save_scores.deaths = death_count; save_scores.cash = cash; save_scores.disconnection_time = current_time + (mani_save_scores_tracking_time.GetInt() * 60); save_scores_list.push_back(save_scores); }
//--------------------------------------------------------------------------------- // Purpose: Get sql server version //--------------------------------------------------------------------------------- char *ManiMySQL::GetServerVersion(void) { if (strcmp(sql_server_version,"") == 0) { Q_strcpy(sql_server_version, mysql_get_server_info(my_data)); if (strcmp(sql_server_version, "") != 0) { int i = 0; int j = 0; char buffer[32]; while (sql_server_version[i] != '.') { buffer[j++] = sql_server_version[i++]; } buffer[j] = '\0'; i++; major = atoi(buffer); j = 0; while (sql_server_version[i] != '.') { buffer[j++] = sql_server_version[i++]; } buffer[j] = '\0'; i++; minor = atoi(buffer); j = 0; // We add isdigit here because sometimes they like to do things like // '5.0.24-standard' while (sql_server_version[i] != '\0' && isdigit(sql_server_version[i]) != 0) { buffer[j++] = sql_server_version[i++]; } buffer[j] = '\0'; issue = atoi(buffer); } } return sql_server_version; }
TM_CALLABLE void AddMsg2List(qboolean IsSysMsg, char *msg) { int cnt = messages.count; int msglen = Q_strlen(msg)+1; if ( cnt < MAX_MESSAGES) { if ((messages.pos + msglen) < 2*MAXPRINTMSG) { Q_strcpy(&messages.msg[messages.pos], msg); messages.lenght[cnt] = msglen; messages.msg_type[cnt] = IsSysMsg; messages.count++; messages.pos += msglen; } } }
int FileSystem_Init(char *basedir, void *voidfilesystemFactory) { #ifdef REHLDS_CHECKS Q_strncpy(s_pBaseDir, basedir, ARRAYSIZE(s_pBaseDir)); s_pBaseDir[ARRAYSIZE(s_pBaseDir) - 1] = 0; #else Q_strcpy(s_pBaseDir, basedir); #endif host_parms.basedir = s_pBaseDir; if (FileSystem_LoadDLL((CreateInterfaceFn)voidfilesystemFactory)) { return COM_SetupDirectories() != 0; } return 0; }
/* ============ KB_Add Add a kbutton_t * to the list of pointers the engine can retrieve via KB_Find ============ */ void KB_Add( const char *name, kbutton_t *pkb ) { kblist_t *p; kbutton_t *kb; kb = (kbutton_t *)KB_Find( name ); if( kb ) return; p = ( kblist_t *)malloc( sizeof( kblist_t )); memset( p, 0, sizeof( *p )); Q_strcpy( p->name, name ); p->pkey = pkb; p->next = g_kbkeys; g_kbkeys = p; }
void CCSBot::SpawnBot() { CCSBotManager *ctrl = TheCSBots(); ctrl->ValidateMapData(); ResetValues(); Q_strcpy(m_name, STRING(pev->netname)); SetState(&m_buyState); SetTouch(&CCSBot::BotTouch); if (!TheNavAreaList.Count () && !ctrl->IsLearningMap()) { ctrl->SetLearningMapFlag(); StartLearnProcess(); } }
/* ============ Cmd_TokenizeString Parses the given string into command line tokens. ============ */ void Cmd_TokenizeString (char *text) { int i; // clear the args from the last string for (i=0 ; i<cmd_argc ; i++) Z_Free (cmd_argv[i]); cmd_argc = 0; cmd_args = NULL; while (1) { // skip whitespace up to a /n while (*text && *text <= ' ' && *text != '\n') { text++; } if (*text == '\n') { // a newline seperates commands in the buffer text++; break; } if (!*text) return; if (cmd_argc == 1) cmd_args = text; text = COM_Parse (text); if (!text) return; if (cmd_argc < MAX_ARGS) { cmd_argv[cmd_argc] = Z_Malloc (Q_strlen(com_token)+1); Q_strcpy (cmd_argv[cmd_argc], com_token); cmd_argc++; } } }
bool CEnvProjectedTexture::KeyValue( const char *szKeyName, const char *szValue ) { if ( FStrEq( szKeyName, "lightcolor" ) ) { Vector tmp; UTIL_ColorStringToLinearFloatColor( tmp, szValue ); m_LinearFloatLightColor = tmp; } else if ( FStrEq(szKeyName, "texturename" ) ) { Q_strcpy( m_SpotlightTextureName.GetForModify(), szValue ); } else { return BaseClass::KeyValue( szKeyName, szValue ); } return true; }