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

Function scroll_world_internal

plugins/edgescroll.cpp:146–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144
145template<typename T>
146static void scroll_world_internal(T* screen, int xdiff, int ydiff) {
147 if constexpr(std::is_same_v<T, df::viewscreen_choose_start_sitest>) {
148 if (screen->zoomed_in) {
149 int max_x = (world->world_data->world_width * 16)-1;
150 int max_y = (world->world_data->world_height * 16)-1;
151 apply_scroll(&screen->zoom_cent_x, xdiff * world_scroll_tiles_zoomed, 0, max_x);
152 apply_scroll(&screen->zoom_cent_y, ydiff * world_scroll_tiles_zoomed, 0, max_y);
153 return;
154 }
155 }
156
157 int32_t *x, *y;
158 if constexpr(std::is_same_v<T, df::viewscreen_new_regionst>) {
159 x = &world->worldgen_status.cursor_x;
160 y = &world->worldgen_status.cursor_y;
161 } else {
162 x = &screen->region_cent_x;
163 y = &screen->region_cent_y;
164 }
165 int max_x = world->world_data->world_width-1;
166 int max_y = world->world_data->world_height-1;
167 apply_scroll(x, xdiff * world_scroll_tiles, 0, max_x);
168 apply_scroll(y, ydiff * world_scroll_tiles, 0, max_y);
169}
170
171template<typename... Ts>
172struct overloads : Ts... { using Ts::operator()...; };

Callers 1

scroll_worldFunction · 0.85

Calls 1

apply_scrollFunction · 0.85

Tested by

no test coverage detected