bugfixes for crashing when pausing the game or selecting engineers

This commit is contained in:
devZoGok
2024-09-27 18:16:18 +03:00
parent aced28c332
commit 2e6c54e448
7 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
ActiveStateButton::ActiveStateButton(Vector3 pos, Vector2 size, string gs, string name, int trigger, string imagePath) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath), guiScreen(gs){
ActiveStateButton::ActiveStateButton(Vector3 pos, Vector2 size, string gs, string name, string fontPath, int trigger, string imagePath) : Button(pos, size, name, fontPath, trigger, true, imagePath), guiScreen(gs){
StateManager *stateManager = GameManager::getSingleton()->getStateManager();
ActiveGameState *activeState = (ActiveGameState*)stateManager->getAppStateByType((int)AppStateType::ACTIVE_STATE);
+1 -1
View File
@@ -6,7 +6,7 @@
namespace battleship{
class ActiveStateButton : public vb01Gui::Button{
public:
ActiveStateButton(vb01::Vector3, vb01::Vector2, std::string, std::string, int = -1, std::string = "");
ActiveStateButton(vb01::Vector3, vb01::Vector2, std::string, std::string, std::string, int = -1, std::string = "");
void onClick();
private:
std::string guiScreen = "";
+1 -1
View File
@@ -243,7 +243,7 @@ namespace battleship{
break;
case ACTIVE_GAME_STATE:
guiScreen = guiTable["guiScreen"];
button = new ActiveStateButton(pos, size, guiScreen, name, (int)guiTable["trigger"], imagePath);
button = new ActiveStateButton(pos, size, guiScreen, name, fontBasePath + "batang.ttf", (int)guiTable["trigger"], imagePath);
break;
case PLAYER_TRADE:
guiScreen = guiTable["guiScreen"];
+2
View File
@@ -203,6 +203,8 @@ namespace battleship{
}
void Map::Minimap::update(){
if(!GameManager::getSingleton()->getStateManager()->getAppStateByType(AppStateType::ACTIVE_STATE)) return;
Button *mb = ConcreteGuiManager::getSingleton()->getButton("minimap");
updateImage(mb);
updateCamFrame(mb);
+3 -3
View File
@@ -1,16 +1,16 @@
#ifndef MINIMAP_BUTTON_H
#define MINIMAP_BUTTON_H
#include <button.h>
#include "activeStateButton.h"
namespace vb01{
class Node;
}
namespace battleship{
class MinimapButton : public vb01Gui::Button{
class MinimapButton : public ActiveStateButton{
public:
MinimapButton(vb01::Vector3 pos, vb01::Vector2 size, std::string ip) : vb01Gui::Button(pos, size, "minimap", "", -1, true, ip){}
MinimapButton(vb01::Vector3 pos, vb01::Vector2 size, std::string ip) : ActiveStateButton(pos, size, "", "minimap", "", -1, ip){}
~MinimapButton(){}
void onClick();
private:
+1 -1
View File
@@ -13,7 +13,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
PlayerTradeButton::PlayerTradeButton(Vector3 pos, Vector2 size, string gs, string name, int trigger, string imagePath) : ActiveStateButton(pos, size, gs, name, trigger, imagePath){}
PlayerTradeButton::PlayerTradeButton(Vector3 pos, Vector2 size, string gs, string name, int trigger, string imagePath) : ActiveStateButton(pos, size, gs, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, imagePath){}
void PlayerTradeButton::onClick(){
ActiveStateButton::onClick();
+1 -1
View File
@@ -18,7 +18,7 @@ namespace battleship{
using namespace gameBase;
TradingScreenButton::TradingScreenButton(Vector3 pos, Vector2 size, Listbox *lb, int plId, string gs, string name, int trigger, string imagePath) :
ActiveStateButton(pos, size, gs, name, trigger, imagePath),
ActiveStateButton(pos, size, gs, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, imagePath),
listbox(lb),
playerId(plId)
{}