From b9c1da8cfc84db8a2b35919c80779f4e0cf65e48 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Fri, 14 Mar 2025 16:00:50 -0400 Subject: [PATCH] hello. types! --- CMakeLists.txt | 2 +- include/enemies.h | 5 ++++- include/fwddecl.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 include/fwddecl.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f9e216..1556cbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ macro(blt_add_project name source type) project(tower-defense) endmacro() -project(tower-defense VERSION 0.0.9) +project(tower-defense VERSION 0.0.10) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) diff --git a/include/enemies.h b/include/enemies.h index 1e68b82..82ebf32 100644 --- a/include/enemies.h +++ b/include/enemies.h @@ -19,7 +19,10 @@ #ifndef ENEMIES_H #define ENEMIES_H -namespace td { +#include + +namespace td +{ } diff --git a/include/fwddecl.h b/include/fwddecl.h new file mode 100644 index 0000000..cb7856a --- /dev/null +++ b/include/fwddecl.h @@ -0,0 +1,50 @@ +#pragma once +/* + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef FWDDECL_H +#define FWDDECL_H + +#include +#include + +namespace td +{ + enum class damage_type_t : blt::u8 + { + BASE = 0, + WAG_TAIL = 1, + KISSES = 2, + HUGS = 4, + CUDDLES = 8, + LUST = 16, + LOVE = 32 // if on enemy it means only love can damage, otherwise on towers love can damage all types + }; + + template + blt::u8 bitwise_or(Args&&... args) + { + return (static_cast(std::forward(args)) | ...); + } + + inline bool has_type(const blt::u8 val, damage_type_t type) + { + return (val & static_cast(type)) != 0; + } +} + +#endif //FWDDECL_H