当前位置: 首页>>代码示例>>C++>>正文


C++ PyTuple::SetItem方法代码示例

本文整理汇总了C++中PyTuple::SetItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PyTuple::SetItem方法的具体用法?C++ PyTuple::SetItem怎么用?C++ PyTuple::SetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyTuple的用法示例。


在下文中一共展示了PyTuple::SetItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PyTuple

PyTuple *Character::GetSkillQueue() {
    // return skills from skill queue
    PyList *list = new PyList;

    SkillQueue::iterator cur, end;
    cur = m_skillQueue.begin();
    end = m_skillQueue.end();
    for(; cur != end; cur++)
    {
        SkillQueue_Element el;

        el.typeID = cur->typeID;
        el.level = cur->level;

        list->AddItem( el.Encode() );
    }

	// now encapsulate it in a tuple with the free points
	PyTuple *tuple = new PyTuple(2);
	tuple->SetItem(0, list);
	// sending 0, as done on retail, doesn't fuck up calculation for some reason
	// so we can take the same shortcut here
	tuple->SetItem(1, new PyInt(0));

    return tuple;
}
开发者ID:Logomorph,项目名称:evemu_crucible,代码行数:26,代码来源:Character.cpp

示例2: return

PyTuple *DBResultToRowList(DBQueryResult &result, const char *type) {
    uint32 cc = result.ColumnCount();
    if(cc == 0)
        return(new PyTuple(0));
    uint32 r;

    PyTuple *res = new PyTuple(2);
    PyList *cols = new PyList(cc);
    PyList *reslist = new PyList();
    res->SetItem( 0, cols );
    res->SetItem( 1, reslist );

    //list off the column names:
    for(r = 0; r < cc; r++) {
        cols->SetItemString(r, result.ColumnName(r));
    }

    //add a line entry for each result row:
    DBResultRow row;
    while(result.GetRow(row)) {
        //this could be more efficient by not building the column list each time, but cloning it instead.
        PyObject *o = DBRowToRow(row, type);
        reslist->items.push_back(o);
    }

    return res;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:27,代码来源:EVEDBUtils.cpp

示例3: EncodeChanges

void ClientSession::EncodeChanges( PyDict* into )
{
    PyDict::const_iterator cur, end;
    cur = mSession->begin();
    end = mSession->end();
    for(; cur != end; cur++)
    {
        PyString* str = cur->first->AsString();
        PyTuple* value = cur->second->AsTuple();

        PyRep* last = value->GetItem( 0 );
        PyRep* current = value->GetItem( 1 );

        if( last->hash() != current->hash() )
        {
            // Duplicate tuple
            PyTuple* t = new PyTuple( 2 );
            t->SetItem( 0, last ); PyIncRef( last );
            t->SetItem( 1, current ); PyIncRef( current );
            into->SetItem( str, t ); PyIncRef( str );

            // Update our tuple
            value->SetItem( 0, current ); PyIncRef( current );
        }
    }

	mDirty = false;
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:28,代码来源:ClientSession.cpp

示例4: _CreateArgs

PyTuple* PasswordString::_CreateArgs( PyWString* password )
{
    PyTuple* head = new PyTuple( 2 );
    head->SetItem( 0, new PyToken( "util.PasswordString" ) );
    head->SetItem( 1, password );

    return head;
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:8,代码来源:PyUtils.cpp

示例5: _CreateArgs

PyTuple* UserError::_CreateArgs( const char* msg )
{
    PyTuple* args = new PyTuple( 2 );
    args->SetItem( 0, new PyString( msg ) );
    args->SetItem( 1, new PyDict );

    return args;
}
开发者ID:eve-moo,项目名称:evemu_server,代码行数:8,代码来源:PyExceptions.cpp

示例6: AddColumn

void DBRowDescriptor::AddColumn( const char* name, DBTYPE type )
{
	PyTuple* col = new PyTuple( 2 );

	col->SetItem( 0, new PyString( name ) );
	col->SetItem( 1, new PyInt( type ) );

	_GetColumnList()->items.push_back( col );
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:9,代码来源:PyDatabase.cpp

示例7: GetFormations

PyTuple* ShipDB::GetFormations()
{
    //vicious crap... but this is gunna be a bit of work to load from the DB (nested tuples)
    PyTuple* res = new PyTuple( 2 );

    Beyonce_Formation f;

    //Diamond formation
    f.name = "Diamond";

    f.pos1.x = 100;
    f.pos1.y = 0;
    f.pos1.z = 0;

    f.pos2.x = 0;
    f.pos2.y = 100;
    f.pos2.z = 0;

    f.pos3.x = -100;
    f.pos3.y = 0;
    f.pos3.z = 0;

    f.pos4.x = 0;
    f.pos4.y = -100;
    f.pos4.z = 0;

    res->SetItem( 0, f.Encode() );

    //Arrow formation
    f.name = "Arrow";

    f.pos1.x = 100;
    f.pos1.y = 0;
    f.pos1.z = -50;

    f.pos2.x = 50;
    f.pos2.y = 0;
    f.pos2.z = 0;

    f.pos3.x = -100;
    f.pos3.y = 0;
    f.pos3.z = -50;

    f.pos4.x = -50;
    f.pos4.y = 0;
    f.pos4.z = 0;

    res->SetItem( 1, f.Encode() );

    return res;
}
开发者ID:Ddrumm13,项目名称:evemu_crucible,代码行数:51,代码来源:ShipDB.cpp

示例8: _CreateArgs

PyTuple* CRowSet::_CreateArgs()
{
	PyTuple* args = new PyTuple( 1 );
	args->SetItem( 0, new PyToken( "dbutil.CRowset" ) );

	return args;
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:7,代码来源:PyDatabase.cpp

示例9: _ShowCycle

void HybridTurret::_ShowCycle()
{
	//m_Item->SetActive(true, effectProjectileFired, m_Item->GetAttribute(AttrSpeed).get_float(), true);

	// Create Destiny Updates:
	Notify_OnGodmaShipEffect shipEff;
	shipEff.itemID = m_Item->itemID();
	shipEff.effectID = effectProjectileFired;		// From EVEEffectID::
	shipEff.when = Win32TimeNow();
	shipEff.start = 1;
	shipEff.active = 1;

	PyList* env = new PyList;
	env->AddItem(new PyInt(shipEff.itemID));
	env->AddItem(new PyInt(m_Ship->ownerID()));
	env->AddItem(new PyInt(m_Ship->itemID()));
	env->AddItem(new PyInt(m_targetID));
	env->AddItem(new PyNone);
	env->AddItem(new PyNone);
	env->AddItem(new PyInt(shipEff.effectID));

	shipEff.environment = env;
	shipEff.startTime = shipEff.when;
	shipEff.duration = m_Item->GetAttribute(AttrSpeed).get_float();
	shipEff.repeat = new PyInt(1000);
	shipEff.randomSeed = new PyNone;
	shipEff.error = new PyNone;

	PyTuple* tmp = new PyTuple(3);
	//tmp->SetItem(1, dmgMsg.Encode());
	tmp->SetItem(2, shipEff.Encode());

	std::vector<PyTuple*> events;
	//events.push_back(dmgMsg.Encode());
	events.push_back(shipEff.Encode());

	std::vector<PyTuple*> updates;
	//updates.push_back(dmgChange.Encode());

	m_Ship->GetOperator()->GetDestiny()->SendDestinyUpdate(updates, events, false);

	// Create Special Effect:
	m_Ship->GetOperator()->GetDestiny()->SendSpecialEffect
	(
		m_Ship,
		m_Item->itemID(),
		m_Item->typeID(),
		m_targetID,
		m_chargeRef->typeID(),
		"effects.HybridFired",
		1,
		1,
		1,
		m_Item->GetAttribute(AttrSpeed).get_float(),
		1000
	);
}
开发者ID:Camwarp,项目名称:evemu_server,代码行数:57,代码来源:HybridTurret.cpp

示例10: checkAsteroidDepleted

void MiningLaser::checkAsteroidDepleted(uint32 remainingOreUnits)
{
    if (remainingOreUnits == 0)
    {
        // Asteroid is empty now, so remove it
        m_targetEntity->Bubble()->Remove(m_targetEntity);
        m_targetEntity->Item()->Delete();
        // Send client asteroid depleted message.
        PyDict *dict = new PyDict();
        dict->SetItem(new PyString("asteroidname"), new PyString(""));
        PyTuple *tuple = new PyTuple(2);
        tuple->SetItem(0, new PyInt(MOD_ACTIVATED)); //???? what is this really?
        tuple->SetItem(1, new PyInt(m_item->typeID()));
        dict->SetItem(new PyString("modulename"), tuple);
        PyTuple *error = new PyTuple(2);
        error->SetItem(0, new PyString("MiningDronesDeactivatedAsteroidEmpty"));
        error->SetItem(1, dict);
        m_error = error;
    }
}
开发者ID:comet0,项目名称:evemu_server,代码行数:20,代码来源:MiningLaser.cpp

示例11: DBRowDescriptor

/* function not used */
PyTuple *DBResultToPackedRowListTuple( DBQueryResult &result )
{
    DBRowDescriptor * header = new DBRowDescriptor( result );

    size_t row_count = result.GetRowCount();
    PyList * list = new PyList( row_count );

    DBResultRow row;
    uint32 i = 0;
    while( result.GetRow(row) )
    {
        list->SetItem( i++, CreatePackedRow( row, header ) );
        PyIncRef( header );
    }

    PyTuple * root = new PyTuple(2);
    root->SetItem( 0, header );
    root->SetItem( 1, list );

    return root;
}
开发者ID:Ahava,项目名称:evemu_server,代码行数:22,代码来源:EVEDBUtils.cpp

示例12: _Set

void ClientSession::_Set( const char* name, PyRep* value )
{
    PyTuple* v = _GetValueTuple( name );
    if( v == NULL )
    {
        v = new PyTuple( 2 );
        v->SetItem( 0, new PyNone );
        v->SetItem( 1, new PyNone );
        mSession->SetItemString( name, v );
    }

    PyRep* current = v->GetItem( 1 );
    if( value->hash() != current->hash() )
    {
        v->SetItem( 1, value );

        mDirty = true;
    }
    else
    {
        PyDecRef( value );
    }
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:23,代码来源:ClientSession.cpp

示例13: CAST

// TODO: hangarGraphicID went missing. maybe no longer in the dump?
PyRep *StationDB::GetStationItemBits(uint32 sid) {
	DBQueryResult res;

	if(!sDatabase.RunQuery(res,
		" SELECT "
		" staStations.stationID, "
		" staStations.stationTypeID, staStations.corporationID AS ownerID, "
		" staStationTypes.hangarGraphicID, "
		// damn mysql returns the result of the sum as string and so it is sent to the client as string and so it freaks out...
		" CAST(SUM(staOperationServices.serviceID) as UNSIGNED INTEGER) AS serviceMask "
		" FROM staStations "
		" LEFT JOIN staStationTypes ON staStations.stationTypeID = staStationTypes.stationTypeID "
		" LEFT JOIN staOperationServices ON staStations.operationID = staOperationServices.operationID "
		" WHERE staStations.stationID = %u "
		" GROUP BY staStations.stationID ", sid
	))
	{
		_log(SERVICE__ERROR, "Error in GetStationItemBits query: %s", res.error.c_str());
		return NULL;
	}

	DBResultRow row;
	if(!res.GetRow(row)) {
		_log(SERVICE__ERROR, "Error in GetStationItemBits query: no station for id %d", sid);
		return NULL;
	}

	PyTuple * result = new PyTuple(5);
	result->SetItem(0, new PyInt(row.GetUInt(3)));
	result->SetItem(1, new PyInt(row.GetUInt(2)));
	result->SetItem(2, new PyInt(row.GetUInt(0)));
	result->SetItem(3, new PyInt(row.GetUInt(4)));
	result->SetItem(4, new PyInt(row.GetUInt(1)));

	return result;
}
开发者ID:Bes666,项目名称:Evemu,代码行数:37,代码来源:StationDB.cpp

示例14: Add

bool AttributeMap::Add( uint32 attributeID, EvilNumber& num )
{
    mChanged = true;
    PyTuple* AttrChange = new PyTuple(7);
    AttrChange->SetItem(0, new PyString( "OnModuleAttributeChange" ));
    AttrChange->SetItem(1, new PyInt( mItem.ownerID() ));
    AttrChange->SetItem(2, new PyInt( mItem.itemID() ));
    AttrChange->SetItem(3, new PyInt( attributeID ));
    AttrChange->SetItem(4, new PyLong( Win32TimeNow() ));
    AttrChange->SetItem(5, num.GetPyObject());
    AttrChange->SetItem(6, num.GetPyObject());

    return SendAttributeChanges(AttrChange);
}
开发者ID:stschake,项目名称:evemu-incursion,代码行数:14,代码来源:EVEAttributeMgr.cpp

示例15: DoCycle

void EnergyTurret::DoCycle()
{
	if( m_ActiveModuleProc->ShouldProcessActiveCycle() )
	{
		// Check to see if our target is still in this bubble or has left or been destroyed:
		if( !(m_Ship->GetOperator()->GetSystemEntity()->Bubble()->GetEntity(m_targetID)) )
		{
			// Target has left our bubble or been destroyed, deactivate this module:
			Deactivate();
			return;
		}

		// Create Destiny Updates:
		DoDestiny_OnDamageStateChange dmgChange;
		dmgChange.entityID = m_targetEntity->GetID();

		PyList *states = new PyList;
		states->AddItem(new PyFloat(0));
		states->AddItem(new PyFloat(0));
		states->AddItem(new PyFloat(0.99));
		dmgChange.state = states;

		Notify_OnDamageMessage dmgMsg;
		dmgMsg.messageID = "";		// Can be left blank as Damage.cpp fills this in.  This can be one in this set {"AttackHit1", "AttackHit2", "AttackHit3", "AttackHit4", "AttackHit5", "AttackHit6"}
		dmgMsg.weapon = m_Item->itemID();
		dmgMsg.splash = "";
		dmgMsg.target = m_targetEntity->GetID();
		dmgMsg.damage = (m_Item->GetAttribute(AttrDamageMultiplier).get_float() * 48.0);

		Notify_OnGodmaShipEffect shipEff;
		shipEff.itemID = m_Item->itemID();
		shipEff.effectID = effectTargetAttack;		// From EVEEffectID::
		shipEff.when = Win32TimeNow();
		shipEff.start = 1;
		shipEff.active = 1;

		PyList* env = new PyList;
		env->AddItem(new PyInt(shipEff.itemID));
		env->AddItem(new PyInt(m_Ship->ownerID()));
		env->AddItem(new PyInt(m_Ship->itemID()));
		env->AddItem(new PyInt(m_targetEntity->GetID()));
		env->AddItem(new PyNone);
		env->AddItem(new PyNone);
		env->AddItem(new PyInt(10));

		shipEff.environment = env;
		shipEff.startTime = shipEff.when;
		shipEff.duration = m_Item->GetAttribute(AttrSpeed).get_float();
		shipEff.repeat = new PyInt(1000);
		shipEff.randomSeed = new PyNone;
		shipEff.error = new PyNone;

		PyTuple* tmp = new PyTuple(3);
		tmp->SetItem(1, dmgMsg.Encode());
		tmp->SetItem(2, shipEff.Encode());

		std::vector<PyTuple*> events;
		events.push_back(dmgMsg.Encode());
		events.push_back(shipEff.Encode());

		std::vector<PyTuple*> updates;
		updates.push_back(dmgChange.Encode());

		m_Ship->GetOperator()->GetDestiny()->SendDestinyUpdate(updates, events, true);

		// Create Special Effect:
		m_Ship->GetOperator()->GetDestiny()->SendSpecialEffect
		(
			m_Ship,
			m_Item->itemID(),
			m_Item->typeID(),
			m_targetID,
			m_chargeRef->itemID(),
			"effects.Laser",
			1,
			1,
			m_Item->GetAttribute(AttrSpeed).get_float(),
			1
		);

		// Create Damage action:
		//Damage( SystemEntity *_source,
        //    InventoryItemRef _weapon,
        //    double _kinetic,
        //    double _thermal,
        //    double _em,
        //    double _explosive,
        //    EVEEffectID _effect );
		double kinetic_damage = 0.0;
		double thermal_damage = 0.0;
		double em_damage = 0.0;
		double explosive_damage = 0.0;

		// This still somehow needs skill, ship, module, and implant bonuses to be applied:
		// This still somehow needs to have optimal range and falloff attributes applied as a damage modification factor:
		if( m_chargeRef->HasAttribute(AttrKineticDamage) )
			kinetic_damage = (m_Item->GetAttribute(AttrDamageMultiplier) * m_chargeRef->GetAttribute(AttrKineticDamage)).get_float();
		if( m_chargeRef->HasAttribute(AttrThermalDamage) )
			thermal_damage = (m_Item->GetAttribute(AttrDamageMultiplier) * m_chargeRef->GetAttribute(AttrThermalDamage)).get_float();
		if( m_chargeRef->HasAttribute(AttrEmDamage) )
//.........这里部分代码省略.........
开发者ID:Ikesters,项目名称:evemu_server,代码行数:101,代码来源:EnergyTurret.cpp


注:本文中的PyTuple::SetItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。