mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 09:35:39 +00:00
Merge pull request #226 from mooware/utf8-assert-fix
fix delete-after-use issue with temporary string
This commit is contained in:
commit
ffec737d95
|
@ -70,7 +70,7 @@ public:
|
||||||
void setEditMode(std::string collectionName);
|
void setEditMode(std::string collectionName);
|
||||||
void exitEditMode();
|
void exitEditMode();
|
||||||
inline bool isEditing() { return mIsEditingCustom; };
|
inline bool isEditing() { return mIsEditingCustom; };
|
||||||
inline std::string getEditingCollection() { std::string res = mEditingCollection; return res; };
|
inline std::string getEditingCollection() { return mEditingCollection; };
|
||||||
bool toggleGameInCollection(FileData* file);
|
bool toggleGameInCollection(FileData* file);
|
||||||
|
|
||||||
SystemData* getSystemToView(SystemData* sys);
|
SystemData* getSystemToView(SystemData* sys);
|
||||||
|
|
|
@ -144,7 +144,8 @@ std::vector<HelpPrompt> BasicGameListView::getHelpPrompts()
|
||||||
prompts.push_back(HelpPrompt("x", "random"));
|
prompts.push_back(HelpPrompt("x", "random"));
|
||||||
if(mRoot->getSystem()->isGameSystem())
|
if(mRoot->getSystem()->isGameSystem())
|
||||||
{
|
{
|
||||||
prompts.push_back(HelpPrompt("y", "toggle"));
|
std::string prompt = CollectionSystemManager::get()->getEditingCollection();
|
||||||
|
prompts.push_back(HelpPrompt("y", prompt));
|
||||||
}
|
}
|
||||||
return prompts;
|
return prompts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "InputConfig.h"
|
#include "InputConfig.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
#include <Eigen/Dense>
|
#include <Eigen/Dense>
|
||||||
#include "HelpStyle.h"
|
#include "HelpStyle.h"
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ class AnimationController;
|
||||||
class ThemeData;
|
class ThemeData;
|
||||||
class Font;
|
class Font;
|
||||||
|
|
||||||
typedef std::pair<const char*, const char*> HelpPrompt;
|
typedef std::pair<std::string, std::string> HelpPrompt;
|
||||||
|
|
||||||
class GuiComponent
|
class GuiComponent
|
||||||
{
|
{
|
||||||
|
|
|
@ -331,7 +331,7 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpSt
|
||||||
for(auto it = prompts.begin(); it != prompts.end(); it++)
|
for(auto it = prompts.begin(); it != prompts.end(); it++)
|
||||||
{
|
{
|
||||||
// only add it if the same icon hasn't already been added
|
// only add it if the same icon hasn't already been added
|
||||||
if(inputSeenMap.insert(std::make_pair<std::string, bool>(it->first, true)).second)
|
if(inputSeenMap.emplace(it->first, true).second)
|
||||||
{
|
{
|
||||||
// this symbol hasn't been seen yet, what about the action name?
|
// this symbol hasn't been seen yet, what about the action name?
|
||||||
auto mappedTo = mappedToSeenMap.find(it->second);
|
auto mappedTo = mappedToSeenMap.find(it->second);
|
||||||
|
@ -340,8 +340,8 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpSt
|
||||||
// yes, it has!
|
// yes, it has!
|
||||||
|
|
||||||
// can we combine? (dpad only)
|
// can we combine? (dpad only)
|
||||||
if((strcmp(it->first, "up/down") == 0 && strcmp(addPrompts.at(mappedTo->second).first, "left/right")) ||
|
if((it->first == "up/down" && addPrompts.at(mappedTo->second).first != "left/right") ||
|
||||||
(strcmp(it->first, "left/right") == 0 && strcmp(addPrompts.at(mappedTo->second).first, "up/down")))
|
(it->first == "left/right" && addPrompts.at(mappedTo->second).first != "up/down"))
|
||||||
{
|
{
|
||||||
// yes!
|
// yes!
|
||||||
addPrompts.at(mappedTo->second).first = "up/down/left/right";
|
addPrompts.at(mappedTo->second).first = "up/down/left/right";
|
||||||
|
@ -352,7 +352,7 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpSt
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// no, it hasn't!
|
// no, it hasn't!
|
||||||
mappedToSeenMap.insert(std::pair<std::string, int>(it->second, addPrompts.size()));
|
mappedToSeenMap.emplace(it->second, addPrompts.size());
|
||||||
addPrompts.push_back(*it);
|
addPrompts.push_back(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -430,15 +430,15 @@ std::vector<HelpPrompt> ComponentGrid::getHelpPrompts()
|
||||||
bool canScrollHoriz = mGridSize.x() > 1;
|
bool canScrollHoriz = mGridSize.x() > 1;
|
||||||
for(auto it = prompts.begin(); it != prompts.end(); it++)
|
for(auto it = prompts.begin(); it != prompts.end(); it++)
|
||||||
{
|
{
|
||||||
if(strcmp(it->first, "up/down/left/right") == 0)
|
if(it->first == "up/down/left/right")
|
||||||
{
|
{
|
||||||
canScrollHoriz = false;
|
canScrollHoriz = false;
|
||||||
canScrollVert = false;
|
canScrollVert = false;
|
||||||
break;
|
break;
|
||||||
}else if(strcmp(it->first, "up/down") == 0)
|
}else if(it->first == "up/down")
|
||||||
{
|
{
|
||||||
canScrollVert = false;
|
canScrollVert = false;
|
||||||
}else if(strcmp(it->first, "left/right") == 0)
|
}else if(it->first == "left/right")
|
||||||
{
|
{
|
||||||
canScrollHoriz = false;
|
canScrollHoriz = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,7 +319,7 @@ std::vector<HelpPrompt> ComponentList::getHelpPrompts()
|
||||||
bool addMovePrompt = true;
|
bool addMovePrompt = true;
|
||||||
for(auto it = prompts.begin(); it != prompts.end(); it++)
|
for(auto it = prompts.begin(); it != prompts.end(); it++)
|
||||||
{
|
{
|
||||||
if(strcmp(it->first, "up/down") == 0 || strcmp(it->first, "up/down/left/right") == 0)
|
if(it->first == "up/down" || it->first == "up/down/left/right")
|
||||||
{
|
{
|
||||||
addMovePrompt = false;
|
addMovePrompt = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -72,7 +72,7 @@ void HelpComponent::updateGrid()
|
||||||
for(auto it = mPrompts.begin(); it != mPrompts.end(); it++)
|
for(auto it = mPrompts.begin(); it != mPrompts.end(); it++)
|
||||||
{
|
{
|
||||||
auto icon = std::make_shared<ImageComponent>(mWindow);
|
auto icon = std::make_shared<ImageComponent>(mWindow);
|
||||||
icon->setImage(getIconTexture(it->first));
|
icon->setImage(getIconTexture(it->first.c_str()));
|
||||||
icon->setColorShift(mStyle.iconColor);
|
icon->setColorShift(mStyle.iconColor);
|
||||||
icon->setResize(0, height);
|
icon->setResize(0, height);
|
||||||
icons.push_back(icon);
|
icons.push_back(icon);
|
||||||
|
|
Loading…
Reference in a new issue