Ejemplo n.º 1
0
void plParticleEmitter::read(hsStream* S, plResManager* mgr) {
    setGenerator(plParticleGenerator::Convert(mgr->ReadCreatable(S)));

    fSpanIndex = S->readInt();
    fMaxParticles = S->readInt();
    fMiscFlags = S->readInt();
    fColor.read(S);
}
Ejemplo n.º 2
0
void plParticleEmitter::IPrcParse(const pfPrcTag* tag, plResManager* mgr) {
    if (tag->getName() == "Generator") {
        if (tag->hasChildren())
            setGenerator(plParticleGenerator::Convert(mgr->prcParseCreatable(tag->getFirstChild())));
    } else if (tag->getName() == "EmitterParams") {
        fSpanIndex = tag->getParam("SpanIndex", "0").toUint();
        fMaxParticles = tag->getParam("MaxParticles", "0").toUint();
        fMiscFlags = tag->getParam("MiscFlags", "0").toUint();
    } else if (tag->getName() == "Color") {
        if (tag->hasChildren())
            fColor.prcParse(tag->getFirstChild());
    } else {
        plCreatable::IPrcParse(tag, mgr);
    }
}
Ejemplo n.º 3
0
// --> strIdent: public key, account ID, or regular seed.
// --> bStrict: Only allow account id or public key.
// <-- bIndex: true if iIndex > 0 and used the index.
//
// Returns a Json::objectValue, containing error information if there was one.
Json::Value accountFromString (
    Ledger::ref lrLedger,
    RippleAddress& naAccount,
    bool& bIndex,
    std::string const& strIdent,
    int const iIndex,
    bool const bStrict,
    NetworkOPs& netOps)
{
    RippleAddress   naSeed;

    if (naAccount.setAccountPublic (strIdent) ||
        naAccount.setAccountID (strIdent))
    {
        // Got the account.
        bIndex = false;
        return Json::Value (Json::objectValue);
    }

    if (bStrict)
    {
        auto success = naAccount.setAccountID (
            strIdent, Base58::getBitcoinAlphabet ());
        return rpcError (success ? rpcACT_BITCOIN : rpcACT_MALFORMED);
    }

    // Otherwise, it must be a seed.
    if (!naSeed.setSeedGeneric (strIdent))
        return rpcError (rpcBAD_SEED);

    // We allow the use of the seeds to access #0.
    // This is poor practice and merely for debugging convenience.
    RippleAddress naRegular0Public;
    RippleAddress naRegular0Private;

    auto naGenerator = RippleAddress::createGeneratorPublic (naSeed);

    naRegular0Public.setAccountPublic (naGenerator, 0);
    naRegular0Private.setAccountPrivate (naGenerator, naSeed, 0);

    SLE::pointer sleGen = netOps.getGenerator (
        lrLedger, naRegular0Public.getAccountID ());

    if (sleGen)
    {
        // Found master public key.
        Blob vucCipher = sleGen->getFieldVL (sfGenerator);
        Blob vucMasterGenerator = naRegular0Private.accountPrivateDecrypt (
            naRegular0Public, vucCipher);

        if (vucMasterGenerator.empty ())
            rpcError (rpcNO_GEN_DECRYPT);

        naGenerator.setGenerator (vucMasterGenerator);
    }
    // Otherwise, if we didn't find a generator map, assume it is a master
    // generator.

    bIndex  = !iIndex;
    naAccount.setAccountPublic (naGenerator, iIndex);

    return Json::Value (Json::objectValue);
}