Exemplo n.º 1
0
HRESULT CAGCEventDef::GetEventDescription(IAGCEvent* pEvent, BSTR* pbstrOut,
  const XEventDef* pDefHint)
{
  // Initialize the [out] parameter
  *pbstrOut = NULL;
  assert(pEvent);

  // Find the definition of the event ID, if not specified
  if (!pDefHint)
  {
    // Get the specified event's ID
    AGCEventID idEvent;
    RETURN_FAILED(pEvent->get_ID(&idEvent));

    // Lookup the event ID in the table
    const XEventDef* it = find(idEvent);
    if (end() == it)
      return E_INVALIDARG;
    pDefHint = it;
  }
  else
  {
    #ifdef _DEBUG
      // Get the specified event's ID
      AGCEventID idEvent;
      RETURN_FAILED(pEvent->get_ID(&idEvent));
      assert(pDefHint->m_id == idEvent);
    #endif // _DEBUG
  }

  // Get the event description formatting string
  CComBSTR bstrFmt;
  HRESULT hr = GetString(pDefHint->m_pszFormatDescription, &bstrFmt);
  RETURN_FAILED(hr);
  if (S_FALSE == hr)
  {
    // Use the static description
    return GetEventDescription(pDefHint->m_id, pbstrOut);
  }

  // Format the event
  assert(pEvent);
  return ExpandFmtString(bstrFmt, pEvent, pbstrOut);
}
idStr ScriptEventDocGeneratorMediaWiki::GetEventDoc(const idEventDef* ev, bool includeSpawnclassInfo)
{
	idStr out;

	idTypeDef* returnType = idCompiler::GetTypeForEventArg(ev->GetReturnType());

	idStr signature = GetEventArgumentString(*ev);
	idStr description = GetEventDescription(*ev);

	idStr outStr = va("==== scriptEvent %s '''%s'''(%s); ====\n", 
		returnType->Name(), ev->GetName(), signature.c_str());

	out += outStr + "\n";
	out += description + "\n";

	// Get type response info
	idList<idTypeInfo*> list = GetRespondingTypes(*ev);
	list.Sort(SortTypesByClassname);

	if (includeSpawnclassInfo)
	{
		idStr typeInfoStr;

		for (int t = 0; t < list.Num(); ++t)
		{
			idTypeInfo* type = list[t];

			typeInfoStr += (typeInfoStr.IsEmpty()) ? "" : ", ";
			typeInfoStr += "''";
			typeInfoStr += type->classname;
			typeInfoStr += "''";
		}

		typeInfoStr = ":Spawnclasses responding to this event: " + typeInfoStr;
		out += typeInfoStr + "\n";
	}

	return out;
}
Exemplo n.º 3
0
 void Event::LogEvent()
 {
     Log(m_VerbosityLevel, "%s", GetEventDescription());
 }