jak-project/common/versions.cpp
Tyler Wilding 00ac12094e
goalc/repl: cleanup of goalc/REPL code and some QoL improvements (#2104)
- lets you split up your `startup.gc` file into two sections
  - one that runs on initial startup / reloads
  - the other that runs when you listen to a target
- allows for customization of the keybinds added a month or so ago
- removes a useless flag (--startup-cmd) and marks others for
deprecation.
- added another help prompt that lists all the keybinds and what they do

Co-authored-by: water <awaterford111445@gmail.com>
2023-01-07 11:24:02 -05:00

36 lines
908 B
C++

#include "versions.h"
#include "common/util/Assert.h"
#include "third-party/fmt/core.h"
#include "third-party/fmt/format.h"
GameVersion game_name_to_version(const std::string& name) {
if (name == "jak1") {
return GameVersion::Jak1;
} else if (name == "jak2") {
return GameVersion::Jak2;
} else {
ASSERT_MSG(false, fmt::format("invalid game name: {}", name));
}
}
bool valid_game_version(const std::string& name) {
return name == "jak1" || name == "jak2";
}
std::string version_to_game_name(GameVersion v) {
switch (v) {
case GameVersion::Jak1:
return "jak1";
case GameVersion::Jak2:
return "jak2";
default:
ASSERT_MSG(false, fmt::format("no game_name for version: {} found", fmt::underlying(v)));
}
}
std::vector<std::string> valid_game_version_names() {
return {game_version_names[GameVersion::Jak1], game_version_names[GameVersion::Jak2]};
}