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; } } }