MCPcopy Create free account
hub / github.com/DFHack/dfhack / GetWorldMapNew

Function GetWorldMapNew

plugins/remotefortressreader/remotefortressreader.cpp:2113–2184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2111}
2112
2113static command_result GetWorldMapNew(color_ostream &stream, const EmptyMessage *in, WorldMap *out)
2114{
2115 if (!df::global::world->world_data)
2116 {
2117 out->set_world_width(0);
2118 out->set_world_height(0);
2119 return CR_FAILURE;
2120 }
2121 df::world_data * data = df::global::world->world_data;
2122 if (!data->region_map)
2123 {
2124 out->set_world_width(0);
2125 out->set_world_height(0);
2126 return CR_FAILURE;
2127 }
2128 int width = data->world_width;
2129 int height = data->world_height;
2130 out->set_world_width(width);
2131 out->set_world_height(height);
2132 out->set_name(DF2UTF(Translation::translateName(&(data->name), false)));
2133 out->set_name_english(DF2UTF(Translation::translateName(&(data->name), true)));
2134 auto poles = data->flip_latitude;
2135 switch (poles)
2136 {
2137 case df::pole_type::None:
2138 out->set_world_poles(WorldPoles::NO_POLES);
2139 break;
2140 case df::pole_type::North:
2141 out->set_world_poles(WorldPoles::NORTH_POLE);
2142 break;
2143 case df::pole_type::South:
2144 out->set_world_poles(WorldPoles::SOUTH_POLE);
2145 break;
2146 case df::pole_type::Both:
2147 out->set_world_poles(WorldPoles::BOTH_POLES);
2148 break;
2149 default:
2150 break;
2151 }
2152 for (int yy = 0; yy < height; yy++)
2153 for (int xx = 0; xx < width; xx++)
2154 {
2155 df::region_map_entry * map_entry = &data->region_map[xx][yy];
2156 // df::world_region * region = data->regions[map_entry->region_id];
2157
2158 auto regionTile = out->add_region_tiles();
2159 regionTile->set_elevation(map_entry->elevation);
2160 SetRegionTile(regionTile, map_entry);
2161 auto clouds = out->add_clouds();
2162#if DF_VERSION_INT > 34011
2163 clouds->set_cirrus(map_entry->clouds.bits.cirrus);
2164 clouds->set_cumulus((RemoteFortressReader::CumulusType)map_entry->clouds.bits.cumulus);
2165 clouds->set_fog((RemoteFortressReader::FogType)map_entry->clouds.bits.fog);
2166 clouds->set_front((RemoteFortressReader::FrontType)map_entry->clouds.bits.front);
2167 clouds->set_stratus((RemoteFortressReader::StratusType)map_entry->clouds.bits.stratus);
2168#else
2169 clouds->set_cirrus(map_entry->clouds.bits.striped);
2170 clouds->set_cumulus((RemoteFortressReader::CumulusType)map_entry->clouds.bits.density);

Callers

nothing calls this directly

Calls 4

DF2UTFFunction · 0.85
SetRegionTileFunction · 0.85
GetMapCenterFunction · 0.85
set_nameMethod · 0.45

Tested by

no test coverage detected