本文整理汇总了C++中PyTuple类的典型用法代码示例。如果您正苦于以下问题:C++ PyTuple类的具体用法?C++ PyTuple怎么用?C++ PyTuple使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PyTuple类的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;
}
示例2: PyTuple
PyTuple* CRowSet::_CreateArgs()
{
PyTuple* args = new PyTuple( 1 );
args->SetItem( 0, new PyToken( "dbutil.CRowset" ) );
return args;
}
示例3: _GetValueTuple
PyRep* ClientSession::_GetCurrent( const char* name ) const
{
PyTuple* v = _GetValueTuple( name );
if( v == NULL )
return NULL;
return v->GetItem( 1 );
}
示例4: PyTuple
PyTuple* GPSTransportClosed::_CreateArgs( const char* reason )
{
PyTuple* args = new PyTuple( 1 );
args->SetItem( 0, new PyString( reason ) );
return args;
}
示例5: 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;
}
示例6: PyTuple
PyTuple* PasswordString::_CreateArgs( PyWString* password )
{
PyTuple* head = new PyTuple( 2 );
head->SetItem( 0, new PyToken( "util.PasswordString" ) );
head->SetItem( 1, password );
return head;
}
示例7: PyTuple
PyTuple* DBRowDescriptor::_CreateArgs()
{
PyTuple* columnList = new PyTuple( 0 );
PyTuple* args = new PyTuple( 1 );
args->SetItem( 0, columnList );
return args;
}
示例8: Win32TimeNow
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
);
}
示例9: PyTuple
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;
}
示例10: PyTuple
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;
}
示例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;
}
示例12: 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;
}
示例13: PyTuple
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);
}
示例14: PyDict
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;
}
}
示例15: switch
void SuperWeapon::_ShowCycle()
{
std::string effectString;
switch (m_Item->typeID())
{
case 24550:
effectString = "effects.SuperWeaponAmarr";
m_effectID = effectSuperWeaponAmarr;
break;
case 24552:
effectString = "effects.SuperWeaponCaldari";
m_effectID = effectSuperWeaponCaldari;
break;
case 24554:
effectString = "effects.SuperWeaponGallente";
m_effectID = effectSuperWeaponGallente;
break;
case 23674:
effectString = "effects.SuperWeaponMinmatar";
m_effectID = effectSuperWeaponMinmatar;
break;
default:
effectString = "";
m_effectID = 0;
break;
}
// Create Destiny Updates:
Notify_OnGodmaShipEffect shipEff;
shipEff.itemID = m_Item->itemID();
shipEff.effectID = m_effectID; // 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(AttrDuration).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,
0,
effectString,
1,
1,
1,
m_Item->GetAttribute(AttrDuration).get_float(),
1000
);
}