// New station list from a glob structure stations *newStationList(glob_t *glb) { stations *ss; int j, file; ss = malloc(sizeof(stations)); ss->n = 0; ss->slist = NULL; /* Prepare stations table */ for (j = 0; j < glb->gl_pathc; j++) { glob_t *glbs = filelist(glb->gl_pathv[j], "*Z.SAC"); for (file = 0; file < glbs->gl_pathc; file++) { station *s = loadStation(glbs->gl_pathv[file]); int Id = getStationId(ss, s->name, s->net); if (Id == -1) { addss(ss, s); } else { killStation(s); } } glbs = killGlob(glbs); } qsort(&ss->slist[0], ss->n, sizeof(ss->slist[0]), cmpstation); return ss; }
/** * @brief cwRegionLoadTask::loadSurveyChunk * @param protoChunk * @param chunk */ void cwRegionLoadTask::loadSurveyChunk(const CavewhereProto::SurveyChunk& protoChunk, cwSurveyChunk *chunk) { QList<cwStation> stations; stations.reserve(protoChunk.stations_size()); for(int i = 0 ; i < protoChunk.stations_size(); i++) { cwStation station = loadStation(protoChunk.stations(i)); stations.append(station); } QList<cwShot> shots; shots.reserve(protoChunk.shots_size()); for(int i = 0; i < protoChunk.shots_size(); i++) { cwShot shot = loadShot(protoChunk.shots(i)); shots.append(shot); } if(stations.count() - 1 != shots.count()) { qDebug() << "Shot, station count mismatch, survey chunk invalid:" << stations.count() << shots.count(); return; } for(int i = 0; i < stations.count() - 1; i++) { cwStation fromStation = stations[i]; cwStation toStation = stations[i + 1]; cwShot shot = shots[i]; chunk->appendShot(fromStation, toStation, shot); } }
// Called when the game starts or when spawned void AShimStation::BeginPlay() { Super::BeginPlay(); loadStation(1); }