Skip to content

Commit

Permalink
LUS Cleanup: CVars functions are now consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenix3 committed Aug 4, 2022
1 parent 6d3d5e7 commit 8c9d067
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 2 additions & 4 deletions libultraship/libultraship/Cvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <functional>
#include <memory>
#include <utility>
#include <PR/ultra64/gbi.h>
#include "imgui_internal.h"

std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;

Expand Down Expand Up @@ -96,7 +94,7 @@ extern "C" void CVar_SetS32(const char* name, int32_t value) {
cvar->value.valueS32 = value;
}

void CVar_SetFloat(const char* name, float value) {
extern "C" void CVar_SetFloat(const char* name, float value) {
auto& cvar = cvars[name];
if (!cvar) {
cvar = std::make_unique<CVar>();
Expand All @@ -111,7 +109,7 @@ extern "C" void CVar_SetString(const char* name, const char* value) {
cvar = std::make_unique<CVar>();
}
cvar->type = CVarType::String;
cvar->value.valueStr = ImStrdup(value);
cvar->value.valueStr = _strdup(value);
}

extern "C" void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue) {
Expand Down
6 changes: 1 addition & 5 deletions libultraship/libultraship/Cvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ extern "C" CVar * CVar_Get(const char* name);
extern "C"
{
#endif
//#include <ultra64.h>

int32_t CVar_GetS32(const char* name, int32_t defaultValue);
float CVar_GetFloat(const char* name, float defaultValue);
void CVar_SetFloat(const char* name, float value);
const char* CVar_GetString(const char* name, const char* defaultValue);
void CVar_SetS32(const char* name, int32_t value);
void CVar_SetString(const char* name, const char* value);

Color_RGB8 CVar_GetRGB(const char* name, Color_RGB8 defaultValue);
Color_RGBA8 CVar_GetRGBA(const char* name, Color_RGBA8 defaultValue);
void CVar_SetRGBA(const char* name, Color_RGBA8 value);
Expand All @@ -56,11 +55,8 @@ void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue);
#ifdef __cplusplus
#include <map>
#include <string>
#include <functional>
#include <memory>

//extern "C" CVar * CVar_Get(const char* name);
extern std::map<std::string, std::unique_ptr<CVar>, std::less<>> cvars;
void CVar_SetFloat(const char* name, float value);
#endif
#endif

0 comments on commit 8c9d067

Please sign in to comment.