Skip to content

Commit

Permalink
Some GameVersion tuning, recoilify titles/captions, simplify LuaUtils…
Browse files Browse the repository at this point in the history
…::IsEngineMinVersion(lua_State* L)
  • Loading branch information
lhog committed Dec 29, 2024
1 parent ea0aa4d commit 3b76ff3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 25 deletions.
6 changes: 3 additions & 3 deletions rts/Game/GameVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,16 @@ bool IsUnitsync()
const std::string& Get()
{
static const std::string base = IsRelease()
? GetMajor()
: (GetMajor() + "." + GetPatchSet() + ".1");
? GetMajor() + "." + GetMinor()
: GetMajor() + "." + GetMinor() + "." + GetPatchSet();

return base;
}

const std::string& GetSync()
{
static const std::string sync = IsRelease()
? GetMajor()
? GetMajor() + "." + GetMinor()
: SPRING_VERSION_ENGINE;

return sync;
Expand Down
2 changes: 1 addition & 1 deletion rts/Game/GameVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace SpringVersion
/**
* The basic part of a spring version.
* This may only be used for sync-checking if IsRelease() returns true.
* @return "Major.PatchSet" or "Major.PatchSet.1"
* @return "Major.Minor" or "Major.Minor.PatchSet"
* @see GetSync
*/
extern const std::string& Get();
Expand Down
23 changes: 4 additions & 19 deletions rts/Lua/LuaUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,26 +530,11 @@ int LuaUtils::IsEngineMinVersion(lua_State* L)
const int minMinorVer = luaL_optint(L, 2, 0);
const int minCommits = luaL_optint(L, 3, 0);

if (StringToInt(SpringVersion::GetMajor()) < minMajorVer) {
lua_pushboolean(L, false);
return 1;
}

if (StringToInt(SpringVersion::GetMajor()) == minMajorVer) {
if (StringToInt(SpringVersion::GetMinor()) < minMinorVer) {
lua_pushboolean(L, false);
return 1;
}

if (StringToInt(SpringVersion::GetCommits()) < minCommits) {
lua_pushboolean(L, false);
return 1;
}
}

lua_pushboolean(L, true);
lua_pushboolean(L,
std::tuple(StringToInt(SpringVersion::GetMajor()), StringToInt(SpringVersion::GetMinor()), StringToInt(SpringVersion::GetCommits())) >=
std::tie(minMajorVer, minMinorVer, minCommits)
);
return 1;

}

/******************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion rts/Menu/SelectMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ SelectMenu::SelectMenu(std::shared_ptr<ClientSetup> setup)
menu->SetPos(0.1, 0.5);
menu->SetSize(0.4, 0.4);
menu->SetBorder(1.2f);
/*agui::TextElement* title = */new agui::TextElement("Spring " + SpringVersion::GetFull(), menu); // will be deleted in menu
/*agui::TextElement* title = */new agui::TextElement("Recoil " + SpringVersion::GetFull(), menu); // will be deleted in menu
Button* testGame = new Button("Test Game", menu);
testGame->Clicked = std::bind(&SelectMenu::Single, this);

Expand Down
2 changes: 1 addition & 1 deletion rts/System/SpringApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ bool SpringApp::Init()
Watchdog::RegisterThread(WDT_MAIN, true);

// Create Window
if (!InitWindow(("Spring " + SpringVersion::GetSync()).c_str())) {
if (!InitWindow(("Recoil " + SpringVersion::GetFull()).c_str())) {
SDL_Quit();
return false;
}
Expand Down

0 comments on commit 3b76ff3

Please sign in to comment.