All pastes #806678 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-05 20:41 UTC
rendered paste body
    int len = data->auras.size();
    char *s = new char[len+1];
    memcpy(s, data->auras.c_str(), len*sizeof(char));

    char *p = s, *q = s;
    int nr = 0, state = 0;

    uint32 spellId, effIndex;

    while(1)
    {
        if(!*p)
        {
            if(state == 1) { effIndex = atoi(q); _AddAuraTo(this, spellId, effIndex); state = 0; }
            else sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) has wrong aura defined.", GetGUIDLow(), GetEntry());
            break;
        }
        else if(*p == ' ')
        {
            *p = 0;
            if(state == 0) { spellId = atoi(q); state = 1; }
            else { effIndex = atoi(q); _AddAuraTo(this, spellId, effIndex); state = 0; }
            p++; q = p;
        }
    }