-
Notifications
You must be signed in to change notification settings - Fork 3
/
render_region.cpp
43 lines (33 loc) · 939 Bytes
/
render_region.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "weblegends.h"
#include "helpers.h"
#include "modules/Translation.h"
#include "df/creature_raw.h"
#include "df/plant_raw.h"
#include "df/world.h"
#include "df/world_data.h"
#include "df/world_population.h"
#include "df/world_region.h"
REQUIRE_GLOBAL(world)
bool WebLegends::render_region(Layout & l, int32_t id, int32_t page)
{
CoreSuspender suspend;
auto region = df::world_region::find(id);
if (region == nullptr)
{
return false;
}
simple_header(l, region);
auto & s = l.content;
render_map_coords(s, region->region_coords);
s << "<p>";
categorize(s, region);
s << "</p>";
render_world_populations(s, region->name, region->population, "region", region->index);
int32_t last_page;
if (!history(s, region, page, last_page))
{
return true;
}
pagination(s, stl_sprintf("region-%d", id), "", "?page=", page, last_page);
return true;
}