Game saves when exiting to the main menu or quitting the game in general. Rings are now properly in the Accessories tab instead of the equipment tab. Fixed using == comparison instead of bitwise AND comparisons for accessory detection.

This commit is contained in:
sigonasr2 2024-01-01 08:00:14 -06:00
parent ad1e2260cf
commit cf6185bb50
5 changed files with 10 additions and 5 deletions

View File

@ -2076,6 +2076,9 @@ bool Crawler::IsReflectiveTile(TilesheetData tileSheet,int tileID){
} }
bool Crawler::OnUserDestroy(){ bool Crawler::OnUserDestroy(){
if(GameState::STATE!=GameState::states[States::MAIN_MENU]){ //If we're on the main menu, we don't have a save file loaded. So we would skip saving the game.
SaveFile::SaveGame();
}
GFX.Reset(); GFX.Reset();
for(auto&[key,value]:MAP_DATA){ for(auto&[key,value]:MAP_DATA){
if(MAP_DATA[key].optimizedTile!=nullptr){ if(MAP_DATA[key].optimizedTile!=nullptr){

View File

@ -1033,13 +1033,13 @@ const bool EnhancementInfo::CanBeEnhanced()const{
const bool ItemInfo::IsWeapon()const{ const bool ItemInfo::IsWeapon()const{
return slot==EquipSlot::WEAPON; return slot&EquipSlot::WEAPON;
} }
const bool ItemInfo::IsArmor()const{ const bool ItemInfo::IsArmor()const{
return IsEquippable()&&!IsWeapon()&&!IsAccessory(); return IsEquippable()&&!IsWeapon()&&!IsAccessory();
} }
const bool ItemInfo::IsAccessory()const{ const bool ItemInfo::IsAccessory()const{
return slot==EquipSlot::RING1||slot==EquipSlot::RING2; return slot&EquipSlot::RING1||slot&EquipSlot::RING2;
} }
const bool Item::IsWeapon()const{ const bool Item::IsWeapon()const{

View File

@ -40,6 +40,7 @@ All rights reserved.
#include "Crawler.h" #include "Crawler.h"
#include "CharacterRotatingDisplay.h" #include "CharacterRotatingDisplay.h"
#include "ClassInfo.h" #include "ClassInfo.h"
#include "SaveFile.h"
INCLUDE_game INCLUDE_game
INCLUDE_GFX INCLUDE_GFX
@ -58,6 +59,7 @@ void Menu::InitializeOverworldMenuWindow(){
overworldMenuWindow->ADD("Settings Button",MenuComponent)({{4,12+28*3},{88,24}},"Settings",[](MenuFuncData data){/*Menu::OpenMenu(SETTINGS_MENU);*/return true;})END; overworldMenuWindow->ADD("Settings Button",MenuComponent)({{4,12+28*3},{88,24}},"Settings",[](MenuFuncData data){/*Menu::OpenMenu(SETTINGS_MENU);*/return true;})END;
overworldMenuWindow->ADD("Quit Button",MenuComponent)({{4,12+28*4},{88,24}},"Quit Game",[](MenuFuncData data){ overworldMenuWindow->ADD("Quit Button",MenuComponent)({{4,12+28*4},{88,24}},"Quit Game",[](MenuFuncData data){
Menu::CloseAllMenus(); Menu::CloseAllMenus();
SaveFile::SaveGame();
game->ResetGame(); game->ResetGame();
return true; return true;
})END; })END;

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 5256 #define VERSION_BUILD 5260
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

View File

@ -3,7 +3,7 @@ Equipment
Ring of the Slime King Ring of the Slime King
{ {
Slot = Ring1,Ring2 Slot = Ring1,Ring2
ItemCategory = Equipment ItemCategory = Accessories
# See ItemStats.txt for valid stat names # See ItemStats.txt for valid stat names
StatValues = Health,Attack,Mana,Move Spd % StatValues = Health,Attack,Mana,Move Spd %
@ -15,7 +15,7 @@ Equipment
Ring of the Bear Ring of the Bear
{ {
Slot = Ring1,Ring2 Slot = Ring1,Ring2
ItemCategory = Equipment ItemCategory = Accessories
# See ItemStats.txt for valid stat names # See ItemStats.txt for valid stat names
StatValues = Health,Attack,Mana StatValues = Health,Attack,Mana