Exemplo n.º 1
0
void Player::PostFreshMonsterVec()
{
	stringstream ss;
	ss << _grade;
	CCString str = CCString(ss.str().c_str());
	CCNotificationCenter::sharedNotifCenter()->postNotification(NOTIFY_MONSTER_UPDATEKIND,&str);
	ss.str("");
	ss.clear();
}
Exemplo n.º 2
0
HRESULT CMixerControl::GetNode(XMLDoc* pDoc, XMLEl* pLibrary, XMLEl** p, BOOL bCreate)
{
    if(m_pLine)
    {
        return XMLFindControl(pDoc, pLibrary,
            m_pLine->m_pOwner->m_pOwner->m_uID, CCString(m_pLine->m_pOwner->m_pOwner->m_mc.szPname),
            m_pLine->m_pOwner->m_ml.dwLineID, CCString(m_pLine->m_pOwner->m_ml.szName), m_pLine->m_pOwner->m_Type,
            m_pLine->m_ml.dwLineID, CCString(m_pLine->m_ml.szName), m_pLine->m_Type,
            m_mc.dwControlID, CCString(m_mc.szName), m_Type,
            p, bCreate);
    }
    else if(m_pDest)
    {
        return XMLFindControl(pDoc, pLibrary,
            m_pDest->m_pOwner->m_uID, CCString(m_pDest->m_pOwner->m_mc.szPname),
            m_pDest->m_ml.dwLineID, CCString(m_pDest->m_ml.szName), m_pDest->m_Type,
            m_mc.dwControlID, CCString(m_mc.szName), m_Type,
            p, bCreate);
    }

    return E_FAIL;// Internal error! (bug in the program)
}
Exemplo n.º 3
0
/*
    010510 Carl Corcoran
*/
void CCString::FormatvA(PCSTR szFormat, va_list arg)
{
    CHAR sz[1024];
    wvsprintfA(sz, szFormat, arg);
    this->cpy(CCString(sz));
}
Exemplo n.º 4
0
/*
    010510 Carl Corcoran
*/
const CCString& CCString::operator += (WCHAR wc)
{
    this->_CatW((PCWSTR)CCString(wc));
    return (*this);
}
Exemplo n.º 5
0
HRESULT CMixerControl::LoadControl(XMLEl* pLibrary)
{
    XMLEl* pThis = 0;
    CCString sValues;
    PCWSTR wszCurrent = 0;// Current place in the sValues string.
    WCHAR* wszToken = 0;// The token.  To avoid a buffer-overrun we make this string the same size as sValues.
    int i = 0;// Current index we're workin on.

    MIXERCONTROLDETAILS_BOOLEAN* pBoolean = (MIXERCONTROLDETAILS_BOOLEAN*)m_pRaw;
    MIXERCONTROLDETAILS_UNSIGNED* pUnsigned = (MIXERCONTROLDETAILS_UNSIGNED*)m_pRaw;
    MIXERCONTROLDETAILS_SIGNED* pSigned = (MIXERCONTROLDETAILS_SIGNED*)m_pRaw;

    if(FAILED(GetNode(0, pLibrary, &pThis, FALSE)))
    {
        return MIX_E_XMLERR;
    }

    // Here, we concern ourself with the value attribute.
    if(FAILED(XMLGetAttribute(pThis, CCString(L"Values"), &sValues)))
    {
        SAFE_RELEASE(pThis);
        return MIX_E_XMLERR;
    }

    // Let's go case-insensitive.
    sValues.upr();

    // If we're doing raw binary data, we can skip all the parsing.
    if(m_DataType == MIXDT_CUSTOM)
    {
        sValues.ToBinary(m_pRaw, m_mc.Metrics.cbCustomData);
        SAFE_RELEASE(pThis);
        return S_OK;
    }

    // Set up our looping stuff.
    wszCurrent = sValues;
    wszToken = (WCHAR*)malloc((wcslen(wszCurrent)+1)*sizeof(WCHAR));

    while(1)
    {
        wszCurrent = NextToken(wszToken, wszCurrent);

        if(m_DataType == MIXDT_BOOLEAN)
        {
            // Now wszToken is the current token.
            if(wcsicmp(wszToken, L"TRUE") == 0)
            {
                pBoolean[i].fValue = TRUE;
            }
            else if(wcsicmp(wszToken, L"FALSE") == 0)
            {
                pBoolean[i].fValue = FALSE;
            }
        }
        else if(m_DataType == MIXDT_SIGNED)
        {
            pSigned[i].lValue = wcstol(wszToken, 0, 10);
        }
        else if(m_DataType == MIXDT_UNSIGNED)
        {
            pUnsigned[i].dwValue = wcstoul(wszToken, 0, 10);
        }

        i++;

        if(i >= m_nRawItems) break;
        if(wszCurrent == 0) break;
    }

    free(wszToken);
    wszToken = 0;

    SAFE_RELEASE(pThis);

    // Now commit the buffer.
    _CommitRawBuffer();

    return S_OK;
}
Exemplo n.º 6
0
HRESULT CMixerControl::SaveControl(XMLDoc* pDoc, XMLEl* pParent)
{
    XMLEl* pThis = 0;
    HRESULT hr;
    CCString sValues;
    CCString sTemp;
    BOOL bFirst;

    if(FAILED(hr = XMLFindControl(pDoc, pParent, 
        m_mc.dwControlID, CCString(m_mc.szName), m_Type, &pThis, TRUE)))
    {
        return hr;
    }

    // Save the values of this control.
    // We just go in order, separating values with a comma.

    bFirst = TRUE;// This will determine if we need to add a comma or not.
    int i = 0;

    switch(m_DataType)
    {
    case MIXDT_CUSTOM:
        {
            sValues.FromBinary(m_pRaw, m_mc.Metrics.cbCustomData);
            pThis->setAttribute(CCString(L"Values"), sValues.variant());
            break;
        }
    case MIXDT_SIGNED:
        {
            MIXERCONTROLDETAILS_SIGNED* p = (MIXERCONTROLDETAILS_SIGNED*)m_pRaw;

            sValues.froml(p[0].lValue, 10);

            for(i=1;i<m_nRawItems;i++)
            {
                sValues.cat(L", ");
                sTemp.froml(p[i].lValue, 10);
                sValues.cat(sTemp);
            }

            pThis->setAttribute(CCString(L"Values"), sValues.variant());

            break;
        }
    case MIXDT_UNSIGNED:
        {
            MIXERCONTROLDETAILS_UNSIGNED* p = (MIXERCONTROLDETAILS_UNSIGNED*)m_pRaw;

            sValues.fromul(p[0].dwValue, 10);

            for(i=1;i<m_nRawItems;i++)
            {
                sValues.cat(L", ");
                sTemp.fromul(p[i].dwValue, 10);
                sValues.cat(sTemp);
            }

            pThis->setAttribute(CCString(L"Values"), sValues.variant());

            break;
        }
    case MIXDT_BOOLEAN:
        {
            MIXERCONTROLDETAILS_BOOLEAN* p = (MIXERCONTROLDETAILS_BOOLEAN*)m_pRaw;

            sValues = (p[0].fValue == TRUE) ? L"TRUE" : L"FALSE";

            for(i=1;i<m_nRawItems;i++)
            {
                sTemp.FormatW(L", %s", (p[i].fValue == TRUE) ? L"TRUE" : L"FALSE");
                sValues.cat(sTemp);
            }

            pThis->setAttribute(CCString(L"Values"), sValues.variant());

            break;
        }
    default:
        {
            //
        }
    }

    SAFE_RELEASE(pThis);

    return hr;
}