本文整理汇总了C++中Message::AttachData方法的典型用法代码示例。如果您正苦于以下问题:C++ Message::AttachData方法的具体用法?C++ Message::AttachData怎么用?C++ Message::AttachData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::AttachData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetTarget
void FileCopier::SetTarget ( UplinkObject *uo, char *uos, int uoi )
{
if ( downloading == FILECOPIER_NOTDOWNLOADING ) {
if ( uo->GetOBJECTID () == OID_DATABANK ) {
/*
DataBank selected
uo : DataBank object containing Data to be downloaded
uos : Name of button representing downloadable data
uoi : memory index of data in databank
*/
if ( ((DataBank *) uo)->GetData (uoi) ) {
source = (DataBank *) uo;
sourceindex = uoi;
Data *data = source->GetData (sourceindex);
UplinkAssert (data);
numticksrequired = (int)(TICKSREQUIRED_COPY * ((float) data->size / (float) game->GetWorld ()->GetPlayer ()->gateway.GetBandwidth ()));
progress = 0;
remotefile = strstr ( uos, "fileserverscreen" ) ? true : false;
Button *button = EclGetButton ( uos );
UplinkAssert (button);
MoveTo ( button->x, button->y, 1000 );
}
}
}
else if ( downloading == FILECOPIER_WAITINGFORTARGET ) {
UplinkAssert ( source );
// Copy the data
Data *data = source->GetData (sourceindex);
if ( !data ) {
SvbRemoveTask(this);
return;
}
Data *datacopy = new Data ( data );
if ( uo->GetOBJECTID () == OID_DATABANK ) {
// Copying the file into a memory bank
// Target memory area selected
// If memory index is -1, look for a valid placement
DataBank *db = (DataBank *) uo;
int memoryindex = uoi;
if ( memoryindex == -1 ) memoryindex = db->FindValidPlacement ( datacopy );
if ( db->IsValidPlacement ( datacopy, memoryindex ) == 0 ) {
db->PutData ( datacopy, memoryindex );
downloading = FILECOPIER_FINISHED;
}
}
else if ( uo->GetOBJECTID () == OID_MESSAGE ) {
// Attaching the file to a message
Message *m = (Message *) uo;
UplinkAssert ( m );
m->AttachData ( datacopy );
downloading = FILECOPIER_FINISHED;
}
}
}