Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete button for saveloadwindow, make this window less error prone (and some more) #5674

Commits on Jan 13, 2024

  1. Add new message box type

    Adds new message box "OK_CANCEL" with two buttons "OK" and "Cancel". Pressing "OK" will call function specified in "callback" parameter. As the side change, all types of message box will be positioned at the center of the screen.
    Max5377 committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    01eca78 View commit details
    Browse the repository at this point in the history
  2. Add three new methods to FileSystem

    1. FileSystem::IsValidFilename to check if filename doesn't have forbidden OS characters;
    2. FileSourceFS::IsChildOfRoot to check if given path is inside FileSourceFS::m_root;
    3. FileSourceFS::RemoveFile to remove file from passed relative path. During method execution, relative path will transform to m_root + relativePath. Deletion is restricted to only delete regular files.
    Max5377 committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    9de39d1 View commit details
    Browse the repository at this point in the history
  3. LuaGame little refactoring

    1. All variables that are not going to change their value are marked constant;
    2. Adds "return luaL_error", like specified in "TODO's";
    3. All instances where "return 0" was called after "luaL_error" changed simply to "return luaL_error(...)".
    Max5377 committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    2d7c8da View commit details
    Browse the repository at this point in the history
  4. Delete button for saveLoadWindow, make this window less error prone

    Adds new delete button for saveLoadWindow, which enables user to delete any save in the user\\Documents\\savefiles\\ folder.
    Makes saveLoadWindow and all functions related to saves less error prone. To name a few;
    1. Before saving, savefile name will be checked for forbidden symbols (eg. for Windows: '\', ' " ', '\0');
    2. All instances where JoinPathBelow is used is wrapped around try-catch block, because it can throw "std::invalid_argument" exception;
    3. Game.SaveGame and Game.LoadGame is pcall'ed to catch any errors that can happen in them.
    MessageBox will be shown to user to tell, what gone wrong during saving/loading the game.
    Adds new static method Game::DeleteSave and lua variation l_game_delete_save.
    Max5377 committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    3004827 View commit details
    Browse the repository at this point in the history
  5. Expose ImGui::GetTime to lua

    Allow getting time from internal ImGui timer from lua.
    Max5377 committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    07043c8 View commit details
    Browse the repository at this point in the history
  6. Add new lib ui-timer

    Adds new pigui lib "ui-timer" that allows creation of timer that checks timer from internal ImGui timer, rather then Game.time.
    Max5377 committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    98c30d2 View commit details
    Browse the repository at this point in the history
  7. Use new ui-timer lib

    Additional changes to saveloadgame.lua to use new ui-timer functionality.
    Max5377 committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    1397a91 View commit details
    Browse the repository at this point in the history
  8. Fix clang errors

    Max5377 committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    8cb8c65 View commit details
    Browse the repository at this point in the history