int main(int argc, char **argv) { char datapath_buffer[PATH_BUF_SIZE] = { 0 }; parse_args(argc, argv, datapath_buffer); if( strlen(datapath_buffer) > 0 ) { if( chdir(datapath_buffer) == -1 ) { throw_error("data path does not exist"); } } roomBase rooms; objectBase objects; enemyBase enemies; playerType player; load_map_file("datafiles/map.data", &rooms); //list_room_objects(&(rooms.rooms[0])); //list_room_dependency_objects(&(rooms.rooms[1])); load_rooms_file("datafiles/rooms.data", &rooms); load_objects_file("datafiles/objects.data", &objects); load_enemies_file("datafiles/enemies.data", &enemies); load_config_file("datafiles/config.data", &player); if( debug ) { list_room_info(&rooms); list_object_info(&objects); list_enemy_info(&enemies); } start_game(&player, &rooms, &objects, &enemies); return 0; }
void MainWindow::reload() { if (!filename_.isEmpty()) { mapnik::Envelope<double> bbox = mapWidget_->getMap()->getCurrentExtent(); load_map_file(filename_); mapWidget_->zoomToBox(bbox); setWindowTitle(tr("%1 - *Reloaded*").arg(filename_)); } }
void MainWindow::open(QString const& path) { if (path.isNull()) { filename_ = QFileDialog::getOpenFileName(this,tr("Open Mapnik file"), currentPath,"*.xml"); } else { filename_ = path; } if (!filename_.isEmpty()) { load_map_file(filename_); //zoom_all(); setWindowTitle(tr("%1 - Mapnik Viewer").arg(filename_)); } }
/* Map callback * ------------ * The bpf-ELF loader (bpf_load.c) got support[1] for a callback, just * before creating the map (via bpf_create_map()). It allow assigning * another FD and skips map creation. * * Using this to load map FD from via filesystem, if possible. One * problem, cannot handle exporting the map here, as creation happens * after this step. * * [1] kernel commit 6979bcc731f9 ("samples/bpf: load_bpf.c make * callback fixup more flexible") */ void pre_load_maps_via_fs(struct bpf_map_data *map_data, int idx) { /* This callback gets invoked for every map in ELF file */ const char *file; int fd; file = map_idx_to_export_filename(idx); fd = load_map_file(file, map_data); if (fd > 0) { /* Makes bpf_load.c skip creating map */ map_data->fd = fd; } else { /* When map was NOT loaded from filesystem, then * bpf_load.c will create it. Mark map idx to get * it exported later */ maps_marked_for_export[idx] = 1; } }