コード例 #1
0
void CBotComManager::DispatchVCommToBot() {
	//I think the compiler is optimizing the necessary null checks, so I'll do this
	volatile CHL2MP_Player* pContextPlayer = m_pContextPlayer;

	if (m_pContextPlayer) {
		if (m_eForcedContext) {
			m_eContext = m_eForcedContext;
			m_eForcedContext = CONTEXT_NONE;
			if (m_bRedirectForcedContextToTeammate) {
				pContextPlayer = m_pContextPlayer = ToHL2MPPlayer(CPlayerSearch::FriendlyBotNearestTo(m_pContextPlayer));
				m_bRedirectForcedContextToTeammate = false;
			}
		}
		//nearest bot might be null so check it again
		if (pContextPlayer && m_pContextPlayer && m_pContextPlayer->IsFakeClient()) {
			
			//build a vcomm
			static char vcommTemplate[64];
			Q_snprintf(vcommTemplate, sizeof vcommTemplate, "voicecomm %i\n", ParseContext(m_eContext));

			static CCommand vcommCmd;
			vcommCmd.Tokenize(vcommTemplate);
			m_pContextPlayer->ClientCommand(vcommCmd);
		}
	}
}
コード例 #2
0
ファイル: XParser.cpp プロジェクト: marsprj/Auge.GIS
	XDocument* XParser::ParseMemory(const char* content, bool keep_blank/*=false*/)
	{
		xmlParserCtxtPtr pxParseCtxt = NULL;

		xmlKeepBlanksDefault(keep_blank?1:0);
		xmlDoValidityCheckingDefaultValue =0;
		pxParseCtxt = xmlCreateMemoryParserCtxt((const char*)content, strlen(content));
		if(pxParseCtxt==NULL)
		{
			return NULL;
		}

		if(!ParseContext(pxParseCtxt))
		{
			xmlFreeParserCtxt(pxParseCtxt);
			return NULL;
		}

		XDocument* pagXmlDoc = NULL;
		pagXmlDoc = new XDocument(pxParseCtxt->myDoc);

		xmlFreeParserCtxt(pxParseCtxt);

		return pagXmlDoc;
	}
コード例 #3
0
ファイル: XParser.cpp プロジェクト: marsprj/Auge.GIS
	XDocument* XParser::Parse(const char* szPath, bool keep_blank/*=false*/)
	{
		if(szPath==NULL)
			return NULL;

		xmlKeepBlanksDefault(keep_blank?1:0);
		xmlDoValidityCheckingDefaultValue =0;

		xmlParserCtxtPtr pxParseCtxt = NULL;	
		pxParseCtxt = xmlCreateFileParserCtxt(szPath);
		if(pxParseCtxt==NULL)
		{
			return NULL;
		}

		if(pxParseCtxt->directory == NULL)
		{
			char* directory = xmlParserGetDirectory(szPath);
			pxParseCtxt->directory = (char*)xmlStrdup((xmlChar*)directory);
		}

		if(!ParseContext(pxParseCtxt))
		{
			xmlFreeParserCtxt(pxParseCtxt);
			return NULL;
		}

		XDocument* pagXmlDoc = NULL;
		pagXmlDoc = new XDocument(pxParseCtxt->myDoc);

		xmlFreeParserCtxt(pxParseCtxt);

		return pagXmlDoc;
	}
コード例 #4
0
void DOMRecursive()
{
  TDOMParser *domParser = new TDOMParser();
  TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
  domParser->SetValidate(false); // do not validate with DTD
  domParser->ParseFile(dir+"/person.xml");

  TXMLNode *node = domParser->GetXMLDocument()->GetRootNode();

  ParseContext(node);
}
コード例 #5
0
void ParseContext(TXMLNode *node)
{
   for ( ; node; node = node->GetNextNode()) {
      if (node->GetNodeType() == TXMLNode::kXMLElementNode) { // Element Node
         cout << node->GetNodeName() << ": ";
         if (node->HasAttributes()) {
            TList* attrList = node->GetAttributes();
            TIter next(attrList);
            TXMLAttr *attr;
            while ((attr =(TXMLAttr*)next())) {
               cout << attr->GetName() << ":" << attr->GetValue();
            }
         }
     }
     if (node->GetNodeType() == TXMLNode::kXMLTextNode) { // Text node
        cout << node->GetContent();
     }
     if (node->GetNodeType() == TXMLNode::kXMLCommentNode) { //Comment node
        cout << "Comment: " << node->GetContent();
     }

     ParseContext(node->GetChildren());
   }
}
コード例 #6
0
 void checkKeywords(const Deck& deck) {
     checkKeywords(deck, ParseContext(), ErrorGuard());
 }