mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
Merge pull request #1910 from IvanSavenko/beta_fixes
Fixes for 1.2 branch
This commit is contained in:
commit
e2d0cd37e4
@ -446,15 +446,7 @@ void CMusicHandler::queueNext(std::unique_ptr<MusicEntry> queued)
|
||||
|
||||
void CMusicHandler::queueNext(CMusicHandler *owner, const std::string & setName, const std::string & musicURI, bool looped, bool fromStart)
|
||||
{
|
||||
try
|
||||
{
|
||||
queueNext(std::make_unique<MusicEntry>(owner, setName, musicURI, looped, fromStart));
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logGlobal->error("Failed to queue music. setName=%s\tmusicURI=%s", setName, musicURI);
|
||||
logGlobal->error("Exception: %s", e.what());
|
||||
}
|
||||
queueNext(std::make_unique<MusicEntry>(owner, setName, musicURI, looped, fromStart));
|
||||
}
|
||||
|
||||
void CMusicHandler::stopMusic(int fade_ms)
|
||||
@ -563,12 +555,20 @@ void MusicEntry::load(std::string musicURI)
|
||||
}
|
||||
|
||||
currentName = musicURI;
|
||||
music = nullptr;
|
||||
|
||||
logGlobal->trace("Loading music file %s", musicURI);
|
||||
|
||||
auto musicFile = MakeSDLRWops(CResourceHandler::get()->load(ResourceID(std::move(musicURI), EResType::MUSIC)));
|
||||
|
||||
music = Mix_LoadMUS_RW(musicFile, SDL_TRUE);
|
||||
try
|
||||
{
|
||||
auto musicFile = MakeSDLRWops(CResourceHandler::get()->load(ResourceID(std::move(musicURI), EResType::MUSIC)));
|
||||
music = Mix_LoadMUS_RW(musicFile, SDL_TRUE);
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
logGlobal->error("Failed to load music. setName=%s\tmusicURI=%s", setName, musicURI);
|
||||
logGlobal->error("Exception: %s", e.what());
|
||||
}
|
||||
|
||||
if(!music)
|
||||
{
|
||||
|
@ -941,7 +941,7 @@ void CPlayerInterface::battleStacksEffectsSet( const SetStackEffect & sse )
|
||||
void CPlayerInterface::battleTriggerEffect (const BattleTriggerEffect & bte)
|
||||
{
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
//TODO why is this different (no return on LOPLINT != this) ?
|
||||
BATTLE_EVENT_POSSIBLE_RETURN;
|
||||
|
||||
RETURN_IF_QUICK_COMBAT;
|
||||
battleInt->effectsController->battleTriggerEffect(bte);
|
||||
|
@ -38,6 +38,9 @@ void CInGameConsole::showAll(SDL_Surface * to)
|
||||
|
||||
void CInGameConsole::show(SDL_Surface * to)
|
||||
{
|
||||
if (LOCPLINT->cingconsole != this)
|
||||
return;
|
||||
|
||||
int number = 0;
|
||||
|
||||
boost::unique_lock<boost::mutex> lock(texts_mx);
|
||||
@ -107,7 +110,11 @@ void CInGameConsole::print(const std::string & txt)
|
||||
|
||||
void CInGameConsole::keyPressed (const SDL_Keycode & key)
|
||||
{
|
||||
if(!captureAllKeys && key != SDLK_TAB) return; //because user is not entering any text
|
||||
if (LOCPLINT->cingconsole != this)
|
||||
return;
|
||||
|
||||
if(!captureAllKeys && key != SDLK_TAB)
|
||||
return; //because user is not entering any text
|
||||
|
||||
switch(key)
|
||||
{
|
||||
@ -192,6 +199,9 @@ void CInGameConsole::keyPressed (const SDL_Keycode & key)
|
||||
|
||||
void CInGameConsole::textInputed(const std::string & inputtedText)
|
||||
{
|
||||
if (LOCPLINT->cingconsole != this)
|
||||
return;
|
||||
|
||||
if(!captureAllKeys || enteredText.empty())
|
||||
return;
|
||||
enteredText.resize(enteredText.size()-1);
|
||||
|
@ -31,6 +31,8 @@ static std::map<std::string, int> KeycodeMap{
|
||||
{"left", SDLK_LEFT},
|
||||
{"right", SDLK_RIGHT},
|
||||
{"space", SDLK_SPACE},
|
||||
{"escape", SDLK_ESCAPE},
|
||||
{"backspace", SDLK_BACKSPACE},
|
||||
{"enter", SDLK_RETURN}
|
||||
};
|
||||
|
||||
@ -220,10 +222,16 @@ int InterfaceObjectConfigurable::readKeycode(const JsonNode & config) const
|
||||
auto s = config.String();
|
||||
if(s.size() == 1) //keyboard symbol
|
||||
return s[0];
|
||||
return KeycodeMap[s];
|
||||
|
||||
if (KeycodeMap.count(s))
|
||||
return KeycodeMap[s];
|
||||
|
||||
logGlobal->error("Invalid keycode '%s' in interface configuration!", config.String());
|
||||
return SDLK_UNKNOWN;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
logGlobal->error("Invalid keycode format in interface configuration! Expected string or integer!", config.String());
|
||||
return SDLK_UNKNOWN;
|
||||
}
|
||||
|
||||
std::shared_ptr<CPicture> InterfaceObjectConfigurable::buildPicture(const JsonNode & config) const
|
||||
|
@ -153,7 +153,7 @@
|
||||
"imageOrder": [1, 0, 2, 3],
|
||||
"help": "core.help.325",
|
||||
"callback": "closeWindow",
|
||||
"hotkey": ["esc", "backspace"]
|
||||
"hotkey": ["escape", "backspace"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user