speciesgen/src/starpounds/types.cpp

54 lines
1.4 KiB
C++

/*
speciesgen
Copyright (C) 2022-2023 prisixia
This file is part of speciesgen.
speciesgen 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.
speciesgen 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 speciesgen. If not, see <https://www.gnu.org/licenses/>.
*/
#include "starpounds/types.h"
namespace Starpounds::Types {
std::string AsString(const Subs type) {
std::string type_str =
static_cast<std::string>(magic_enum::enum_name(type));
std::for_each(type_str.begin(), type_str.end(),
[](char &c) { c = ::tolower(c); });
return type_str;
}
std::string AsFriendly(const Subs type) {
std::string type_str =
(type == Subs::Milky
? "XBusty"
: static_cast<std::string>(magic_enum::enum_name(type)));
return type_str;
}
Chests AsChest(const Subs type) {
switch (type) {
case Subs::Busty:
case Subs::Milky:
return Chests::Chest;
case Subs::Hyper:
return Chests::Bust;
default:
return Chests::Belly;
}
}
} // namespace Starpounds::Types