Bump to C++ 20
parent
22a6c4c28f
commit
a08af1b260
|
@ -2,35 +2,5 @@
|
|||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/build/_deps/corrade-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/build/_deps/glfw-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/build/_deps/imgui-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/build/_deps/imnodes-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/build/_deps/magnum-integration-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/build/_deps/magnum-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/corrade-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/glfw-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/imgui-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/imnodes-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/magnum-integration-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/magnum-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-minsizerel/_deps/corrade-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-minsizerel/_deps/glfw-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-minsizerel/_deps/imgui-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-minsizerel/_deps/imnodes-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-minsizerel/_deps/magnum-integration-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-minsizerel/_deps/magnum-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-release/_deps/corrade-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-release/_deps/glfw-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-release/_deps/imgui-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-release/_deps/imnodes-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-release/_deps/magnum-integration-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-release/_deps/magnum-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo/_deps/corrade-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo/_deps/glfw-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo/_deps/imgui-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo/_deps/imnodes-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo/_deps/magnum-integration-src" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo/_deps/magnum-src" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.19)
|
|||
|
||||
cmake_policy(SET CMP0077 NEW) # set() overrides option()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
CallbackRef bind(const CB_TYPE& cb) {
|
||||
usize cID = next++;
|
||||
callbacks.emplace(cID, InvalidatableCB(cb));
|
||||
return CallbackRef([=]() { unbind(cID); });
|
||||
return CallbackRef([cID, this]() { unbind(cID); });
|
||||
};
|
||||
|
||||
void unbind(usize ind) {
|
||||
|
|
|
@ -153,11 +153,9 @@ void MainMenuScene::findSubgames() {
|
|||
}
|
||||
cf_dir_close(&subgame);
|
||||
|
||||
if (!hasConf)
|
||||
throw std::runtime_error(
|
||||
if (!hasConf) throw std::runtime_error(
|
||||
string("Subgame ") + string(subgameFolder.name) + " is missing a conf.json.");
|
||||
if (!hasMods)
|
||||
throw std::runtime_error(
|
||||
if (!hasMods) throw std::runtime_error(
|
||||
string("Subgame ") + string(subgameFolder.name) + " is missing a 'mods' directory.");
|
||||
|
||||
nlohmann::json j{};
|
||||
|
|
|
@ -13,7 +13,7 @@ LocalDefinitionAtlas::LocalDefinitionAtlas(TextureAtlas& atlas) {
|
|||
BlockDef* invalid = new BlockDef();
|
||||
invalid->identifier = "invalid";
|
||||
invalid->name = "INVALID";
|
||||
invalid->maxStackSize = 64;
|
||||
invalid->maxStack = 64;
|
||||
invalid->model = invalidModel;
|
||||
invalid->farModel = invalidModel;
|
||||
invalid->sBoxes = {{{ 0, 0, 0 }, { 1, 1, 1 }}};
|
||||
|
@ -28,7 +28,7 @@ LocalDefinitionAtlas::LocalDefinitionAtlas(TextureAtlas& atlas) {
|
|||
air->identifier = "air";
|
||||
air->index = 1;
|
||||
air->name = "Air";
|
||||
air->maxStackSize = 64;
|
||||
air->maxStack = 64;
|
||||
air->model = nullModel;
|
||||
air->farModel = nullModel;
|
||||
air->solid = false;
|
||||
|
|
|
@ -12,7 +12,7 @@ ServerDefinitionAtlas::ServerDefinitionAtlas() {
|
|||
BlockDef* invalid = new BlockDef();
|
||||
invalid->identifier = "invalid";
|
||||
invalid->name = "INVALID";
|
||||
invalid->maxStackSize = 64;
|
||||
invalid->maxStack = 64;
|
||||
invalid->model = invalidModel;
|
||||
invalid->farModel = invalidModel;
|
||||
invalid->sBoxes = {{{ 0, 0, 0 }, { 1, 1, 1 }}};
|
||||
|
@ -26,7 +26,7 @@ ServerDefinitionAtlas::ServerDefinitionAtlas() {
|
|||
air->identifier = "air";
|
||||
air->index = 1;
|
||||
air->name = "Air";
|
||||
air->maxStackSize = 64;
|
||||
air->maxStack = 64;
|
||||
air->model = nullModel;
|
||||
air->farModel = nullModel;
|
||||
air->solid = false;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
HIT, HIT_CLIENT
|
||||
};
|
||||
|
||||
BlockDef() : ItemDef{ "", "", 0, 0, ItemDef::Type::BLOCK } {};
|
||||
BlockDef() : ItemDef(ItemDef::Type::BLOCK) {};
|
||||
|
||||
void createModel();
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ CraftItemDef::CraftItemDef(const std::string& identifier, unsigned int index, co
|
|||
unsigned short maxStackSize, const std::vector<std::string>& textures,
|
||||
const std::vector<std::shared_ptr<AtlasRef>>& textureRefs) :
|
||||
|
||||
ItemDef{ identifier, name, index, maxStackSize, ItemDef::Type::CRAFTITEM },
|
||||
ItemDef(ItemDef::Type::CRAFTITEM, identifier, name, index, maxStackSize),
|
||||
textures(textures),
|
||||
textureRefs(textureRefs) {}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
HIT, HIT_CLIENT
|
||||
};
|
||||
|
||||
CraftItemDef() : ItemDef{ "", "", 0, 0, ItemDef::Type::CRAFTITEM } {};
|
||||
CraftItemDef(): ItemDef(ItemDef::Type::CRAFTITEM) {};
|
||||
|
||||
CraftItemDef(const std::string& identifier, const std::string& name, unsigned short maxStackSize,
|
||||
const std::vector<std::string>& textures, const std::vector<std::shared_ptr<AtlasRef>>& textureRefs);
|
||||
|
|
|
@ -11,22 +11,24 @@
|
|||
|
||||
class ItemDef {
|
||||
public:
|
||||
ItemDef(const ItemDef& o) = delete;
|
||||
|
||||
enum class Type {
|
||||
INVALID,
|
||||
BLOCK,
|
||||
CRAFTITEM
|
||||
};
|
||||
|
||||
std::string identifier = "";
|
||||
std::string name = "";
|
||||
unsigned int index = 0;
|
||||
ItemDef(const ItemDef& o) = delete;
|
||||
ItemDef(Type type): type(type) {}
|
||||
ItemDef(Type type, string identifier, string name, u16 index, u16 maxStack):
|
||||
type(type), identifier(identifier), name(name), index(index), maxStack(maxStack) {}
|
||||
|
||||
unsigned short maxStackSize;
|
||||
string identifier {};
|
||||
string name {};
|
||||
u16 index = 0;
|
||||
|
||||
u16 maxStack = 0;
|
||||
Type type = Type::INVALID;
|
||||
|
||||
std::shared_ptr<Model> entityModel = std::make_shared<Model>();
|
||||
sptr<Model> entityModel = make_shared<Model>();
|
||||
};
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ namespace RegisterBlock {
|
|||
def->health = health;
|
||||
def->defense = defense;
|
||||
|
||||
def->maxStackSize = maxStack;
|
||||
def->maxStack = maxStack;
|
||||
|
||||
def->model = models.first;
|
||||
def->farModel = models.second;
|
||||
|
|
|
@ -67,7 +67,7 @@ ItemStack InventoryList::placeStack(unsigned short i, const ItemStack& stack, bo
|
|||
else {
|
||||
if (otherStack.count) {
|
||||
if (otherStack.id == stack.id) {
|
||||
unsigned short maxStack = game->getDefs().fromId(stack.id).maxStackSize;
|
||||
unsigned short maxStack = game->getDefs().fromId(stack.id).maxStack;
|
||||
if (allowedPut >= stack.count && allowedPut + otherStack.count < maxStack) {
|
||||
setStack(i, { stack.id, static_cast<unsigned short>(otherStack.count + allowedPut) });
|
||||
// if (on_put) on_put(i+1, LuaItemStack(otherStack, defs));
|
||||
|
@ -126,7 +126,7 @@ ItemStack InventoryList::splitStack(unsigned short i, bool playerInitiated) {
|
|||
}
|
||||
|
||||
ItemStack InventoryList::addStack(ItemStack stack, bool playerInitiated) {
|
||||
unsigned short maxStack = game->getDefs().fromId(stack.id).maxStackSize;
|
||||
unsigned short maxStack = game->getDefs().fromId(stack.id).maxStack;
|
||||
|
||||
unsigned short i = 0;
|
||||
while (i < items.size() && stack.count > 0) {
|
||||
|
@ -162,7 +162,7 @@ ItemStack InventoryList::addStack(ItemStack stack, bool playerInitiated) {
|
|||
}
|
||||
|
||||
unsigned short InventoryList::stackFits(const ItemStack& stack) {
|
||||
unsigned short maxStack = game->getDefs().fromId(stack.id).maxStackSize;
|
||||
unsigned short maxStack = game->getDefs().fromId(stack.id).maxStack;
|
||||
|
||||
unsigned short i = 0;
|
||||
unsigned short fits = 0;
|
||||
|
|
Loading…
Reference in New Issue