mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-30 11:17:08 -05:00
fix build on non windows
This commit is contained in:
parent
2689320116
commit
10edd35475
1 changed files with 5 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
#include "ModListSource.hpp"
|
#include "ModListSource.hpp"
|
||||||
#include <server/Server.hpp>
|
#include <server/Server.hpp>
|
||||||
|
|
||||||
static size_t PAGE_SIZE = 10;
|
static size_t PER_PAGE = 10;
|
||||||
|
|
||||||
static size_t ceildiv(size_t a, size_t b) {
|
static size_t ceildiv(size_t a, size_t b) {
|
||||||
// https://stackoverflow.com/questions/2745074/fast-ceiling-of-an-integer-division-in-c-c
|
// https://stackoverflow.com/questions/2745074/fast-ceiling-of-an-integer-division-in-c-c
|
||||||
|
@ -38,7 +38,7 @@ typename ModListSource::PagePromise ModListSource::loadPage(size_t page, bool up
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<size_t> ModListSource::getPageCount() const {
|
std::optional<size_t> ModListSource::getPageCount() const {
|
||||||
return m_cachedItemCount ? std::optional(ceildiv(m_cachedItemCount.value(), PAGE_SIZE)) : std::nullopt;
|
return m_cachedItemCount ? std::optional(ceildiv(m_cachedItemCount.value(), PER_PAGE)) : std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<size_t> ModListSource::getItemCount() const {
|
std::optional<size_t> ModListSource::getItemCount() const {
|
||||||
|
@ -52,8 +52,8 @@ typename ModListSource::PagePromise InstalledModsList::reloadPage(size_t page) {
|
||||||
auto content = Page();
|
auto content = Page();
|
||||||
auto all = Loader::get()->getAllMods();
|
auto all = Loader::get()->getAllMods();
|
||||||
for (
|
for (
|
||||||
size_t i = page * PAGE_SIZE;
|
size_t i = page * PER_PAGE;
|
||||||
i < all.size() && i < (page + 1) * PAGE_SIZE;
|
i < all.size() && i < (page + 1) * PER_PAGE;
|
||||||
i += 1
|
i += 1
|
||||||
) {
|
) {
|
||||||
content.push_back(InstalledModItem::create(all.at(i)));
|
content.push_back(InstalledModItem::create(all.at(i)));
|
||||||
|
@ -72,7 +72,7 @@ typename ModListSource::PagePromise FeaturedModsList::reloadPage(size_t page) {
|
||||||
return PagePromise([this, page](auto resolve, auto reject, auto progress, auto cancelled) {
|
return PagePromise([this, page](auto resolve, auto reject, auto progress, auto cancelled) {
|
||||||
server::getMods(server::ModsQuery {
|
server::getMods(server::ModsQuery {
|
||||||
.page = page,
|
.page = page,
|
||||||
.pageSize = PAGE_SIZE,
|
.pageSize = PER_PAGE,
|
||||||
})
|
})
|
||||||
.then([this, resolve, reject](server::ServerModsList list) {
|
.then([this, resolve, reject](server::ServerModsList list) {
|
||||||
m_cachedItemCount = list.totalModCount;
|
m_cachedItemCount = list.totalModCount;
|
||||||
|
|
Loading…
Reference in a new issue