这篇教程C++ str_comp_nocase函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中str_comp_nocase函数的典型用法代码示例。如果您正苦于以下问题:C++ str_comp_nocase函数的具体用法?C++ str_comp_nocase怎么用?C++ str_comp_nocase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了str_comp_nocase函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ifvoid CGameContext::ConSetEyeEmote(IConsole::IResult *pResult, void *pUserData){ CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; if(pResult->NumArguments() == 0) { pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "emote", (pPlayer->m_EyeEmote) ? "You can now use the preset eye emotes." : "You don't have any eye emotes, remember to bind some. (until you die)"); return; } else if(str_comp_nocase(pResult->GetString(0), "on") == 0) pPlayer->m_EyeEmote = true; else if(str_comp_nocase(pResult->GetString(0), "off") == 0) pPlayer->m_EyeEmote = false; else if(str_comp_nocase(pResult->GetString(0), "toggle") == 0) pPlayer->m_EyeEmote = !pPlayer->m_EyeEmote; pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, "emote", (pPlayer->m_EyeEmote) ? "You can now use the preset eye emotes." : "You don't have any eye emotes, remember to bind some. (until you die)");}
开发者ID:SoMeRelaX,项目名称:ddnet,代码行数:32,
示例2: ifvoid CVoting::ConVote(IConsole::IResult *pResult, void *pUserData){ CVoting *pSelf = (CVoting *)pUserData; if(str_comp_nocase(pResult->GetString(0), "yes") == 0) pSelf->Vote(1); else if(str_comp_nocase(pResult->GetString(0), "no") == 0) pSelf->Vote(-1);}
开发者ID:Ace-teeworlds,项目名称:Collect-mod,代码行数:8,
示例3: con_votestatic void con_vote(void *result, void *user_data, int cid){ if(str_comp_nocase(console_arg_string(result, 0), "yes") == 0) game.vote_enforce = GAMECONTEXT::VOTE_ENFORCE_YES; else if(str_comp_nocase(console_arg_string(result, 0), "no") == 0) game.vote_enforce = GAMECONTEXT::VOTE_ENFORCE_NO; dbg_msg("server", "forcing vote %s", console_arg_string(result, 0));}
开发者ID:Stitch626,项目名称:Teeworlds-0.5-Tee-Ball,代码行数:8,
示例4: ifvoid CGameContext::ConVote(IConsole::IResult *pResult, void *pUserData){ CGameContext *pSelf = (CGameContext *)pUserData; if(str_comp_nocase(pResult->GetString(0), "yes") == 0) pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_YES; else if(str_comp_nocase(pResult->GetString(0), "no") == 0) pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_NO; dbg_msg("server", "forcing vote %s", pResult->GetString(0));}
开发者ID:magnet,项目名称:teeworlds,代码行数:9,
示例5: ifvoid CGameContext::ConVote(IConsole::IResult *pResult, void *pUserData){ CGameContext *pSelf = (CGameContext *)pUserData; if(str_comp_nocase(pResult->GetString(0), "yes") == 0) pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_YES; else if(str_comp_nocase(pResult->GetString(0), "no") == 0) pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_NO; char aBuf[256]; str_format(aBuf, sizeof(aBuf), "forcing vote %s", pResult->GetString(0)); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);}
开发者ID:DarkTwister,项目名称:TDTW-0.6-trunk,代码行数:11,
示例6: ifint CConsole::Victim(const char *pVictim){ if(!str_comp_nocase(pVictim, "me")) return CResult::VICTIM_ME; else if(!str_comp_nocase(pVictim, "all")) return CResult::VICTIM_ALL; else if(!m_pNameToIDfn) return clamp<int>(str_toint(pVictim), 0, MAX_CLIENTS - 1); else return m_pNameToIDfn(m_pNameToIDfnArg, pVictim);}
开发者ID:ftk,项目名称:XXLDDRace,代码行数:11,
示例7: Kernelvoid CGameContext::OnInit(){ // init everything m_pServer = Kernel()->RequestInterface<IServer>(); m_pConsole = Kernel()->RequestInterface<IConsole>(); m_World.SetGameServer(this); m_Events.SetGameServer(this); for(int i = 0; i < NUM_NETOBJTYPES; i++) Server()->SnapSetStaticsize(i, m_NetObjHandler.GetObjSize(i)); m_Layers.Init(Kernel()); m_Collision.Init(&m_Layers); // select gametype if(str_comp_nocase(g_Config.m_SvGametype, "mod") == 0) m_pController = new CGameControllerMOD(this); else if(str_comp_nocase(g_Config.m_SvGametype, "ctf") == 0) m_pController = new CGameControllerCTF(this); else if(str_comp_nocase(g_Config.m_SvGametype, "lms") == 0) m_pController = new CGameControllerLMS(this); else if(str_comp_nocase(g_Config.m_SvGametype, "sur") == 0) m_pController = new CGameControllerSUR(this); else if(str_comp_nocase(g_Config.m_SvGametype, "tdm") == 0) m_pController = new CGameControllerTDM(this); else m_pController = new CGameControllerDM(this); // create all entities from the game layer CMapItemLayerTilemap *pTileMap = m_Layers.GameLayer(); CTile *pTiles = (CTile *)Kernel()->RequestInterface<IMap>()->GetData(pTileMap->m_Data); for(int y = 0; y < pTileMap->m_Height; y++) { for(int x = 0; x < pTileMap->m_Width; x++) { int Index = pTiles[y*pTileMap->m_Width+x].m_Index; if(Index >= ENTITY_OFFSET) { vec2 Pos(x*32.0f+16.0f, y*32.0f+16.0f); m_pController->OnEntity(Index-ENTITY_OFFSET, Pos); } } }#ifdef CONF_DEBUG if(g_Config.m_DbgDummies) { for(int i = 0; i < g_Config.m_DbgDummies ; i++) OnClientConnected(MAX_CLIENTS-i-1, true); }#endif}
开发者ID:pusdesris,项目名称:teeworlds,代码行数:53,
示例8: Setbool CTuningParams::Set(const char *pName, float Value){ for(int i = 0; i < Num(); i++) if(str_comp_nocase(pName, m_apNames[i]) == 0) return Set(i, Value); return false;}
开发者ID:CytraL,项目名称:MineTee,代码行数:7,
示例9: str_comp_nocasebool CServerBrowserFilter::CServerFilter::SortCompareMap(int Index1, int Index2) const{ CServerEntry *a = m_pServerBrowserFilter->m_ppServerlist[Index1]; CServerEntry *b = m_pServerBrowserFilter->m_ppServerlist[Index2]; int Result = str_comp_nocase(a->m_Info.m_aMap, b->m_Info.m_aMap); return Result < 0 || (Result == 0 && (a->m_Info.m_Flags&IServerBrowser::FLAG_PURE) && !(b->m_Info.m_Flags&IServerBrowser::FLAG_PURE));}
开发者ID:Fisico,项目名称:teeworlds,代码行数:7,
示例10: str_copyvoid CServerBrowser::DDNetFilterRem(char *pFilter, const char *pName){ if (!DDNetFiltered(pFilter, pName)) return; // rewrite exclude/filter list char aBuf[128]; char *p; str_copy(aBuf, pFilter, sizeof(aBuf)); pFilter[0] = '/0'; p = strtok(aBuf, ","); while(p) { if(str_comp_nocase(pName, p) != 0) { char aBuf2[128]; str_format(aBuf2, sizeof(aBuf2), ",%s", p); str_append(pFilter, aBuf2, 128); } p = strtok(NULL, ","); }}
开发者ID:Enyltyn,项目名称:AllTheHaxx,代码行数:26,
示例11: str_comp_nocaseCConsole::CCommand *CConsole::FindCommand(const char *pName, int FlagMask){ /* for(CCommand *pCommand = m_pFirstCommand; pCommand; pCommand = pCommand->m_pNext) { if(pCommand->m_Flags&FlagMask) { int comp = str_comp_nocase(pCommand->m_pName, pName); if(comp == 0) return pCommand; else if(comp > 0) // assume list is sorted return 0x0; } } */ unsigned hash = str_quickhash(pName); std::pair<hash_map_t::const_iterator, hash_map_t::const_iterator> range = commands.equal_range(hash); //hash_map_t::const_iterator it = commands.lower_bound(hash), end = commands.upper_bound(hash); hash_map_t::const_iterator it = range.first, end = range.second; while(it != end) { if(it->second->m_Flags&FlagMask && str_comp_nocase(it->second->m_pName, pName) == 0) return it->second; ++it; } return 0x0;}
开发者ID:ftk,项目名称:XXLDDRace,代码行数:27,
示例12: returnbool CServerBrowser::SortCompareName(int Index1, int Index2) const{ CServerEntry *a = m_ppServerlist[Index1]; CServerEntry *b = m_ppServerlist[Index2]; // make sure empty entries are listed last return (a->m_GotInfo && b->m_GotInfo) || (!a->m_GotInfo && !b->m_GotInfo) ? str_comp_nocase(a->m_Info.m_aName, b->m_Info.m_aName) < 0 : a->m_GotInfo ? true : false;}
开发者ID:Susa,项目名称:teeworlds,代码行数:8,
示例13: const CCountryFlags::CCountryFlag *CCountryFlags::GetByCountryCodeName(const char *CountryCodeName) const{ for (int i=0; i<m_aCountryFlags.size(); i++) { if (str_comp_nocase(m_aCountryFlags[i].m_aCountryCodeString, CountryCodeName) == 0) return &m_aCountryFlags[i]; } return 0x0;}
开发者ID:123pikapokapei,项目名称:HClient,代码行数:9,
示例14: DeleteLuaFilevoid CLua::DeleteLuaFile(char *pFileDir){ for (int i = 0; i < MAX_LUA_FILES; i++) { if (m_aLuaFiles[i] && str_comp_nocase(m_aLuaFiles[i], pFileDir)==0) //lua inactiv { str_copy(m_aLuaFiles[i], "", sizeof(m_aLuaFiles[i])); } }}
开发者ID:BugsBunny1605,项目名称:N-Client,代码行数:10,
示例15: str_comp_nocasevoid CSpoofRemote::ParseZervorMessage(const char *pMessage){ // ~~~ concerning dummies if(!IsSpfState(STATE_DUMMIES) && ( str_comp_nocase("[Server]: Dummies connected!", pMessage) == 0 || str_comp_nocase("[Server]: Dummies connected (voting...)!", pMessage) == 0)) m_State |= STATE_DUMMIES; if(IsSpfState(STATE_DUMMIES) && str_comp_nocase("[Server]: Dummies disconnected.", pMessage) == 0) m_State &= ~STATE_DUMMIES; if(!IsSpfState(STATE_DUMMYSPAM) && str_comp_nocase("[Server]: Dummyspam started!", pMessage) == 0) m_State |= STATE_DUMMYSPAM; if(IsSpfState(STATE_DUMMYSPAM) && str_comp_nocase("[Server]: Dummyspam stopped!", pMessage) == 0) m_State &= ~STATE_DUMMYSPAM;}
开发者ID:AllTheHaxx,项目名称:AllTheHaxx,代码行数:20,
示例16: definedvoid CSpoofRemote::Listener(void *pUserData){#if defined(CONF_SPOOFING) CSpoofRemote *pSelf = (CSpoofRemote *)pUserData; pSelf->Console()->Print(0, "spfrmt", "started listener thread", false); char rBuffer[512]; while(1) { if(!pSelf->IsConnected()) { pSelf->Console()->Print(0, "spfrmt", "closed listener thread", false); return; } // receive mem_zero(&rBuffer, sizeof(rBuffer)); int ret = net_tcp_recv(pSelf->m_Socket, rBuffer, sizeof(rBuffer)); if(ret <= 0 || str_comp(rBuffer, "") == 0) { dbg_msg("spfrmt", "error while receiving"); pSelf->Console()->Print(0, "spfrmt", "disconnected due to connection problems", false); pSelf->Disconnect(); } else { if(pSelf->m_SpoofRemoteID < 0) pSelf->m_SpoofRemoteID = atoi(rBuffer); if(str_comp_nocase(rBuffer, "ping") == 0) // keepalive from server { pSelf->m_LastAck = time(NULL); } else if(str_comp_nocase_num(rBuffer, "exit", 4) == 0) // connection ended { if(str_length(rBuffer) == 4) pSelf->Console()->Print(0, "spfrmt", "Disconneted from teh zervor.", true); // maybe leave these message to the server? else pSelf->Console()->Print(0, "spfrmt", rBuffer, true); pSelf->Disconnect(); } else { pSelf->Console()->Print(0, "spfrmtmsg", rBuffer, true); str_copy(pSelf->m_aLastMessage, rBuffer, sizeof(pSelf->m_aLastMessage)); pSelf->m_LastMessageTime = time_get(); pSelf->ParseZervorMessage(rBuffer); } } }#endif}
开发者ID:AllTheHaxx,项目名称:AllTheHaxx,代码行数:54,
示例17: COMMAND *console_get_command(const char *str){ COMMAND *cmd; for (cmd = first_command; cmd; cmd = cmd->next) { if(str_comp_nocase(cmd->name, str) == 0) return cmd; } return 0x0;}
开发者ID:allloo,项目名称:Teeworlds-0.5.2-S-DDRace-Mod,代码行数:11,
示例18: str_formatvoid CGameContext::ConSetTimerType(IConsole::IResult *pResult, void *pUserData){ CGameContext *pSelf = (CGameContext *) pUserData; if (!CheckClientID(pResult->m_ClientID)) return; CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID]; if (!pPlayer) return; const char msg[3][128] = {"game/round timer.", "broadcast.", "both game/round timer and broadcast."}; char aBuf[128]; if(pPlayer->m_TimerType <= 2 && pPlayer->m_TimerType >= 0) str_format(aBuf, sizeof(aBuf), "Timer is displayed in", msg[pPlayer->m_TimerType]); else if(pPlayer->m_TimerType == 3) str_format(aBuf, sizeof(aBuf), "Timer isn't displayed."); if(pResult->NumArguments() == 0) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD,"timer",aBuf); return; } else if(str_comp_nocase(pResult->GetString(0), "gametimer") == 0) { pSelf->SendBroadcast("", pResult->m_ClientID); pPlayer->m_TimerType = 0; } else if(str_comp_nocase(pResult->GetString(0), "broadcast") == 0) pPlayer->m_TimerType = 1; else if(str_comp_nocase(pResult->GetString(0), "both") == 0) pPlayer->m_TimerType = 2; else if(str_comp_nocase(pResult->GetString(0), "none") == 0) pPlayer->m_TimerType = 3; else if(str_comp_nocase(pResult->GetString(0), "cycle") == 0) { if(pPlayer->m_TimerType < 3) pPlayer->m_TimerType++; else if(pPlayer->m_TimerType == 3) pPlayer->m_TimerType = 0; } pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD,"timer",aBuf);}
开发者ID:SoMeRelaX,项目名称:ddnet,代码行数:40,
示例19: whilestd::list<CKeyStore::CKey>::iterator CKeyStore::Find(const char *pHost){ std::list<CKey>::iterator it = m_lKeys.begin(); while (it != m_lKeys.end()) { CKey *pKey = &(*it); if (str_comp_nocase(pHost, pKey->m_aHost) == 0) return it; ++it; } return m_lKeys.end();}
开发者ID:CytraL,项目名称:MineTee,代码行数:13,
示例20: CConsole::CCommand *CConsole::FindCommand(const char *pName, int FlagMask){ for(CCommand *pCommand = m_pFirstCommand; pCommand; pCommand = pCommand->m_pNext) { if(pCommand->m_Flags&FlagMask) { if(str_comp_nocase(pCommand->m_pName, pName) == 0) return pCommand; } } return 0x0;}
开发者ID:Henningstone,项目名称:Ninslash,代码行数:13,
示例21: str_formatvoid CGameContext::ConAddVote(IConsole::IResult *pResult, void *pUserData){ CGameContext *pSelf = (CGameContext *)pUserData; const char *pString = pResult->GetString(0); // check for valid option if(!pSelf->Console()->LineIsValid(pString)) { char aBuf[256]; str_format(aBuf, sizeof(aBuf), "skipped invalid option '%s'", pString); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf); return; } CGameContext::CVoteOption *pOption = pSelf->m_pVoteOptionFirst; while(pOption) { if(str_comp_nocase(pString, pOption->m_aCommand) == 0) { char aBuf[256]; str_format(aBuf, sizeof(aBuf), "option '%s' already exists", pString); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf); return; } pOption = pOption->m_pNext; } int Len = str_length(pString); pOption = (CGameContext::CVoteOption *)pSelf->m_pVoteOptionHeap->Allocate(sizeof(CGameContext::CVoteOption) + Len); pOption->m_pNext = 0; pOption->m_pPrev = pSelf->m_pVoteOptionLast; if(pOption->m_pPrev) pOption->m_pPrev->m_pNext = pOption; pSelf->m_pVoteOptionLast = pOption; if(!pSelf->m_pVoteOptionFirst) pSelf->m_pVoteOptionFirst = pOption; mem_copy(pOption->m_aCommand, pString, Len+1); char aBuf[256]; str_format(aBuf, sizeof(aBuf), "added option '%s'", pOption->m_aCommand); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf); CNetMsg_Sv_VoteOption OptionMsg; OptionMsg.m_pCommand = pOption->m_aCommand; pSelf->Server()->SendPackMsg(&OptionMsg, MSGFLAG_VITAL, -1);}
开发者ID:CoolerMAN,项目名称:tdtw,代码行数:47,
示例22: str_formatvoid CLua::AddLuaFile(char *pFileDir, bool NoSave){ char aBuf[1024]; str_format(aBuf, sizeof(aBuf), "lua/%s", pFileDir); int Free = -1; for (int i = 0; i < MAX_LUA_FILES; i++) { if (m_aLuaFiles[i] && !str_comp_nocase(m_aLuaFiles[i], aBuf)) Free = -2; if (m_aLuaFiles[i][0] == 0 && str_comp(m_aLuaFiles[i], aBuf) && Free == -1) //lua inactiv Free = i; if(Free == -2) break; } if (Free > -1 && Free < MAX_LUA_FILES) str_copy(m_aLuaFiles[Free], aBuf, sizeof(m_aLuaFiles[Free]));}
开发者ID:BugsBunny1605,项目名称:N-Client,代码行数:18,
示例23: AddLuaFilevoid CLua::AddLuaFile(char *pFileDir, bool NoSave){ int Free = -1; for (int i = 0; i < MAX_LUA_FILES; i++) { if (m_aLuaFiles[i] && !str_comp_nocase(m_aLuaFiles[i], pFileDir)) Free = -2; if (m_aLuaFiles[i][0] == 0 && str_comp(m_aLuaFiles[i], pFileDir) && Free == -1) //lua inactiv Free = i; if(Free == -2) break; } if (Free > -1 && Free < MAX_LUA_FILES) { m_aLuaFilesSave[Free] = !NoSave; str_copy(m_aLuaFiles[Free], pFileDir, sizeof(m_aLuaFiles[Free])); }}
开发者ID:BugsBunny1605,项目名称:N-Client,代码行数:19,
示例24: con_addvotestatic void con_addvote(void *result, void *user_data, int cid){ const char *string = console_arg_string(result, 0); VOTEOPTION *option = voteoption_first; while(option) { if(str_comp_nocase(string, option->command) == 0) { dbg_msg("server", "option '%s' already exists", string); return; } option = option->next; } int len = strlen(string); if(!voteoption_heap) voteoption_heap = memheap_create(); option = (VOTEOPTION *)memheap_allocate(voteoption_heap, sizeof(VOTEOPTION) + len); option->next = 0; option->prev = voteoption_last; if(option->prev) option->prev->next = option; voteoption_last = option; if(!voteoption_first) voteoption_first = option; mem_copy(option->command, string, len+1); if(game.players[cid]) dbg_msg("server", "added option '%s'", string); NETMSG_SV_VOTE_OPTION optionmsg; optionmsg.command = option->command; optionmsg.pack(MSGFLAG_VITAL); server_send_msg(-1);}
开发者ID:Stitch626,项目名称:Teeworlds-0.5-Tee-Ball,代码行数:40,
示例25: mem_freevoid CServerBrowser::Filter(){ if(m_ServerdataLocked) return; int i = 0, p = 0; m_NumSortedServers = 0; // allocate the sorted list if(m_NumSortedServersCapacity < m_NumServers) { if(m_pSortedServerlist) mem_free(m_pSortedServerlist); m_NumSortedServersCapacity = m_NumServers; m_pSortedServerlist = (int *)mem_alloc(m_NumSortedServersCapacity*sizeof(int), 1); } // filter the servers for(i = 0; i < m_NumServers; i++) { int Filtered = 0; if(g_Config.m_BrFilterEmpty && ((g_Config.m_BrFilterSpectators && m_ppServerlist[i]->m_Info.m_NumPlayers == 0) || m_ppServerlist[i]->m_Info.m_NumClients == 0)) Filtered = 1; else if(g_Config.m_BrFilterFull && ((g_Config.m_BrFilterSpectators && m_ppServerlist[i]->m_Info.m_NumPlayers == m_ppServerlist[i]->m_Info.m_MaxPlayers) || m_ppServerlist[i]->m_Info.m_NumClients == m_ppServerlist[i]->m_Info.m_MaxClients)) Filtered = 1; else if(g_Config.m_BrFilterPw && (m_ppServerlist[i]->m_Info.m_Flags&SERVER_FLAG_PASSWORD)) Filtered = 1; else if(g_Config.m_BrFilterPure && (str_comp(m_ppServerlist[i]->m_Info.m_aGameType, "DM") != 0 && str_comp(m_ppServerlist[i]->m_Info.m_aGameType, "TDM") != 0 && str_comp(m_ppServerlist[i]->m_Info.m_aGameType, "CTF") != 0)) { Filtered = 1; } else if(g_Config.m_BrFilterPureMap && !(str_comp(m_ppServerlist[i]->m_Info.m_aMap, "dm1") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "dm2") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "dm6") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "dm7") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "dm8") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "dm9") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "ctf1") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "ctf2") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "ctf3") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "ctf4") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "ctf5") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "ctf6") == 0 || str_comp(m_ppServerlist[i]->m_Info.m_aMap, "ctf7") == 0) ) { Filtered = 1; } else if(g_Config.m_BrFilterPing < m_ppServerlist[i]->m_Info.m_Latency) Filtered = 1; else if(g_Config.m_BrFilterCompatversion && str_comp_num(m_ppServerlist[i]->m_Info.m_aVersion, m_aNetVersion, 3) != 0) Filtered = 1; else if(g_Config.m_BrFilterServerAddress[0] && !str_find_nocase(m_ppServerlist[i]->m_Info.m_aAddress, g_Config.m_BrFilterServerAddress)) Filtered = 1; else if(g_Config.m_BrFilterGametypeStrict && g_Config.m_BrFilterGametype[0] && str_comp_nocase(m_ppServerlist[i]->m_Info.m_aGameType, g_Config.m_BrFilterGametype)) Filtered = 1; else if(!g_Config.m_BrFilterGametypeStrict && g_Config.m_BrFilterGametype[0] && !str_find_nocase(m_ppServerlist[i]->m_Info.m_aGameType, g_Config.m_BrFilterGametype)) Filtered = 1; else if(g_Config.m_BrFilterVersionStrict && g_Config.m_BrFilterVersion[0] && str_comp_nocase(m_ppServerlist[i]->m_Info.m_aVersion, g_Config.m_BrFilterVersion)) Filtered = 1; else if(!g_Config.m_BrFilterVersionStrict && g_Config.m_BrFilterVersion[0] && !str_find_nocase(m_ppServerlist[i]->m_Info.m_aVersion, g_Config.m_BrFilterVersion)) Filtered = 1; else if(g_Config.m_BrShowDDNet && g_Config.m_UiPage != CMenus::PAGE_DDNET && g_Config.m_UiPage != CMenus::PAGE_FAVORITES && str_find_nocase(m_ppServerlist[i]->m_Info.m_aName, "[DDRaceNetwork]")) Filtered = 1; else { if(g_Config.m_BrFilterCountry) { Filtered = 1; // match against player country for(p = 0; p < m_ppServerlist[i]->m_Info.m_NumClients; p++) { if(m_ppServerlist[i]->m_Info.m_aClients[p].m_Country == g_Config.m_BrFilterCountryIndex) { Filtered = 0; break; } } } if(!Filtered && g_Config.m_BrFilterString[0] != 0) { int MatchFound = 0; m_ppServerlist[i]->m_Info.m_QuickSearchHit = 0; // match against server name if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aName, g_Config.m_BrFilterString)) { MatchFound = 1; m_ppServerlist[i]->m_Info.m_QuickSearchHit |= IServerBrowser::QUICK_SERVERNAME; } // match against players for(p = 0; p < m_ppServerlist[i]->m_Info.m_NumClients; p++)//.........这里部分代码省略.........
开发者ID:Enyltyn,项目名称:AllTheHaxx,代码行数:101,
示例26: str_formatvoid CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID){ void *pRawMsg = m_NetObjHandler.SecureUnpackMsg(MsgID, pUnpacker); CPlayer *pPlayer = m_apPlayers[ClientID]; if(!pRawMsg) { char aBuf[256]; str_format(aBuf, sizeof(aBuf), "dropped weird message '%s' (%d), failed on '%s'", m_NetObjHandler.GetMsgName(MsgID), MsgID, m_NetObjHandler.FailedMsgOn()); Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "server", aBuf); return; } if(MsgID == NETMSGTYPE_CL_SAY) { CNetMsg_Cl_Say *pMsg = (CNetMsg_Cl_Say *)pRawMsg; int Team = pMsg->m_Team; if(Team) Team = pPlayer->GetTeam(); else Team = CGameContext::CHAT_ALL; if(g_Config.m_SvSpamprotection && pPlayer->m_LastChat && pPlayer->m_LastChat+Server()->TickSpeed() > Server()->Tick()) return; pPlayer->m_LastChat = Server()->Tick(); // check for invalid chars unsigned char *pMessage = (unsigned char *)pMsg->m_pMessage; while (*pMessage) { if(*pMessage < 32) *pMessage = ' '; pMessage++; } SendChat(ClientID, Team, pMsg->m_pMessage); } else if(MsgID == NETMSGTYPE_CL_CALLVOTE) { if(g_Config.m_SvSpamprotection && pPlayer->m_LastVoteTry && pPlayer->m_LastVoteTry+Server()->TickSpeed()*3 > Server()->Tick()) return; int64 Now = Server()->Tick(); pPlayer->m_LastVoteTry = Now; if(pPlayer->GetTeam() == TEAM_SPECTATORS) { SendChatTarget(ClientID, "Spectators aren't allowed to start a vote."); return; } if(m_VoteCloseTime) { SendChatTarget(ClientID, "Wait for current vote to end before calling a new one."); return; } int Timeleft = pPlayer->m_LastVoteCall + Server()->TickSpeed()*60 - Now; if(pPlayer->m_LastVoteCall && Timeleft > 0) { char aChatmsg[512] = {0}; str_format(aChatmsg, sizeof(aChatmsg), "You must wait %d seconds before making another vote", (Timeleft/Server()->TickSpeed())+1); SendChatTarget(ClientID, aChatmsg); return; } char aChatmsg[512] = {0}; char aDesc[VOTE_DESC_LENGTH] = {0}; char aCmd[VOTE_CMD_LENGTH] = {0}; CNetMsg_Cl_CallVote *pMsg = (CNetMsg_Cl_CallVote *)pRawMsg; const char *pReason = pMsg->m_Reason[0] ? pMsg->m_Reason : "No reason given"; if(str_comp_nocase(pMsg->m_Type, "option") == 0) { CVoteOptionServer *pOption = m_pVoteOptionFirst; while(pOption) { if(str_comp_nocase(pMsg->m_Value, pOption->m_aDescription) == 0) { str_format(aChatmsg, sizeof(aChatmsg), "'%s' called vote to change server option '%s' (%s)", Server()->ClientName(ClientID), pOption->m_aDescription, pReason); str_format(aDesc, sizeof(aDesc), "%s", pOption->m_aDescription); str_format(aCmd, sizeof(aCmd), "%s", pOption->m_aCommand); break; } pOption = pOption->m_pNext; } if(!pOption) { str_format(aChatmsg, sizeof(aChatmsg), "'%s' isn't an option on this server", pMsg->m_Value); SendChatTarget(ClientID, aChatmsg); return; } } else if(str_comp_nocase(pMsg->m_Type, "kick") == 0) { if(!g_Config.m_SvVoteKick) {//.........这里部分代码省略.........
开发者ID:DarkTwister,项目名称:TDTW-0.6-trunk,代码行数:101,
示例27: whilevoid CGameContext::ConForceVote(IConsole::IResult *pResult, void *pUserData){ CGameContext *pSelf = (CGameContext *)pUserData; const char *pType = pResult->GetString(0); const char *pValue = pResult->GetString(1); const char *pReason = pResult->NumArguments() > 2 && pResult->GetString(2)[0] ? pResult->GetString(2) : "No reason given"; char aBuf[128] = {0}; if(str_comp_nocase(pType, "option") == 0) { CVoteOptionServer *pOption = pSelf->m_pVoteOptionFirst; while(pOption) { if(str_comp_nocase(pValue, pOption->m_aDescription) == 0) { str_format(aBuf, sizeof(aBuf), "admin forced server option '%s' (%s)", pValue, pReason); pSelf->SendChatTarget(-1, aBuf); pSelf->Console()->ExecuteLine(pOption->m_aCommand); break; } pOption = pOption->m_pNext; } if(!pOption) { str_format(aBuf, sizeof(aBuf), "'%s' isn't an option on this server", pValue); pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf); return; } } else if(str_comp_nocase(pType, "kick") == 0) { int KickID = str_toint(pValue); if(KickID < 0 || KickID >= MAX_CLIENTS || !pSelf->m_apPlayers[KickID]) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "Invalid client id to kick"); return; } if (!g_Config.m_SvVoteKickBantime) { str_format(aBuf, sizeof(aBuf), "kick %d %s", KickID, pReason); pSelf->Console()->ExecuteLine(aBuf); } else { char aAddrStr[NETADDR_MAXSTRSIZE] = {0}; pSelf->Server()->GetClientAddr(KickID, aAddrStr, sizeof(aAddrStr)); str_format(aBuf, sizeof(aBuf), "ban %s %d %s", aAddrStr, g_Config.m_SvVoteKickBantime, pReason); pSelf->Console()->ExecuteLine(aBuf); } } else if(str_comp_nocase(pType, "spectate") == 0) { int SpectateID = str_toint(pValue); if(SpectateID < 0 || SpectateID >= MAX_CLIENTS || !pSelf->m_apPlayers[SpectateID] || pSelf->m_apPlayers[SpectateID]->GetTeam() == TEAM_SPECTATORS) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "Invalid client id to move"); return; } str_format(aBuf, sizeof(aBuf), "set_team %d -1", SpectateID); pSelf->Console()->ExecuteLine(aBuf); }}
开发者ID:DarkTwister,项目名称:TDTW-0.6-trunk,代码行数:66,
注:本文中的str_comp_nocase函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ str_copy函数代码示例 C++ str_comp函数代码示例 |