hello. types!

main
Brett 2025-03-14 16:00:50 -04:00
parent b017ad2ad0
commit b9c1da8cfc
3 changed files with 55 additions and 2 deletions

View File

@ -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)

View File

@ -19,7 +19,10 @@
#ifndef ENEMIES_H
#define ENEMIES_H
namespace td {
#include <fwddecl.h>
namespace td
{
}

50
include/fwddecl.h Normal file
View File

@ -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 <https://www.gnu.org/licenses/>.
*/
#ifndef FWDDECL_H
#define FWDDECL_H
#include <utility>
#include <blt/std/types.h>
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<typename... Args>
blt::u8 bitwise_or(Args&&... args)
{
return (static_cast<blt::u8>(std::forward<Args>(args)) | ...);
}
inline bool has_type(const blt::u8 val, damage_type_t type)
{
return (val & static_cast<blt::u8>(type)) != 0;
}
}
#endif //FWDDECL_H