int init_logic(void) { prepare_map(); aloc_options(); endwin(); return 0; }
/***********************************************************************//** * @brief Set map cube * * @param[in] map Sky map. * * Set the sky map. ***************************************************************************/ inline void GModelSpatialDiffuseMap::map(const GSkymap& map) { m_map = map; prepare_map(); return; }
void start_location::setup( overmap *&cur_om, int &levx, int &levy, int &levz ) const { // We start in the (0,0,0) overmap. cur_om = &overmap_buffer.get( 0, 0 ); tripoint omtstart = cur_om->find_random_omt( target() ); if( omtstart == overmap::invalid_tripoint ) { // TODO (maybe): either regenerate the overmap (conflicts with existing characters there, // that has to be checked. Or look at the neighboring overmaps, but one has to stop // looking for it sometimes. debugmsg( "Could not find starting overmap terrain %s", target().c_str() ); omtstart = tripoint( 0, 0, 0 ); } // Now prepare the initial map (change terrain etc.) const point player_location = overmapbuffer::omt_to_sm_copy( omtstart.x, omtstart.y ); tinymap player_start; player_start.load( player_location.x, player_location.y, omtstart.z, false, cur_om ); prepare_map( player_start ); player_start.save(); // Setup game::levx/levy/levz - those are in submap coordinates! // And the player is centered in the map levx = player_location.x - ( MAPSIZE / 2 ); levy = player_location.y - ( MAPSIZE / 2 ); levz = omtstart.z; }
void start_location::prepare_map( const tripoint &omtstart ) const { // Now prepare the initial map (change terrain etc.) const point player_location = omt_to_sm_copy( omtstart.x, omtstart.y ); tinymap player_start; player_start.load( player_location.x, player_location.y, omtstart.z, false ); prepare_map( player_start ); player_start.save(); }
int main(int an, char **ac) { struct xmlnode *scene, *hypervisor, *mmu, *map, *guest; char fn[128]; uint64_t i, j; if (an != 2) { fprintf(stderr, "ERROR: need build directory argument.\n"); return 1; } sprintf(fn, "%s/scenario_p_laidout.xml", ac[1]); scene = parse_from_file(fn, STRUCT_SCENARIO); if (!scene) { fprintf(stderr, "ERROR: could not load scenario: %s.\n", xml_errormsg); return 1; } // --------------------------------------------------------------------------- hypervisor = get_child(scene, STRUCT_HYPERVISOR); mmu = get_child(hypervisor, STRUCT_MMU); iterate_over_children(i, mmu, STRUCT_MAP, map) { if (strcmp(map->attrs[MAP_ATTR_XREF].value.string, "core_rx") == 0) { globals_window[0] = get_dict_hex(map->attrs + MAP_ATTR_BASE, 0); break; } } globals_window[1] = ~0UL; prepare_map(scene, mmu); layout_map_fixmaps(scene, mmu); layout_map(scene, mmu, -1); for (i = 0; i < hypervisor->attrs[HYPERVISOR_ATTR_NCPUS].value.number; i++) { struct range *Rclone = clone_range(map_range); layout_map(scene, mmu, i); map_range = Rclone; } map_range = NULL; iterate_over_children(i, scene, STRUCT_GUEST, guest) { mmu = get_child(guest, STRUCT_MMU); iterate_over_children(j, mmu, STRUCT_MAP, map) { if (!attr_exists(map->attrs + MAP_ATTR_BASE)) { fprintf(stderr, "ERROR: no dynamic placement for guests.\n"); return 1; } } }
tripoint start_location::setup() const { // We start in the (0,0,0) overmap. overmap &initial_overmap = overmap_buffer.get( 0, 0 ); tripoint omtstart = initial_overmap.find_random_omt( target() ); if( omtstart == overmap::invalid_tripoint ) { // TODO (maybe): either regenerate the overmap (conflicts with existing characters there, // that has to be checked. Or look at the neighboring overmaps, but one has to stop // looking for it sometimes. debugmsg( "Could not find starting overmap terrain %s", target().c_str() ); omtstart = tripoint( 0, 0, 0 ); } // Now prepare the initial map (change terrain etc.) const point player_location = overmapbuffer::omt_to_sm_copy( omtstart.x, omtstart.y ); tinymap player_start; player_start.load( player_location.x, player_location.y, omtstart.z, false ); prepare_map( player_start ); player_start.save(); return omtstart; }