mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Merge pull request #1910 from IvanSavenko/beta_fixes
Fixes for 1.2 branch
This commit is contained in:
@@ -445,17 +445,9 @@ 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)
|
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));
|
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMusicHandler::stopMusic(int fade_ms)
|
void CMusicHandler::stopMusic(int fade_ms)
|
||||||
{
|
{
|
||||||
@@ -563,12 +555,20 @@ void MusicEntry::load(std::string musicURI)
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentName = musicURI;
|
currentName = musicURI;
|
||||||
|
music = nullptr;
|
||||||
|
|
||||||
logGlobal->trace("Loading music file %s", musicURI);
|
logGlobal->trace("Loading music file %s", musicURI);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
auto musicFile = MakeSDLRWops(CResourceHandler::get()->load(ResourceID(std::move(musicURI), EResType::MUSIC)));
|
auto musicFile = MakeSDLRWops(CResourceHandler::get()->load(ResourceID(std::move(musicURI), EResType::MUSIC)));
|
||||||
|
|
||||||
music = Mix_LoadMUS_RW(musicFile, SDL_TRUE);
|
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)
|
if(!music)
|
||||||
{
|
{
|
||||||
|
@@ -941,7 +941,7 @@ void CPlayerInterface::battleStacksEffectsSet( const SetStackEffect & sse )
|
|||||||
void CPlayerInterface::battleTriggerEffect (const BattleTriggerEffect & bte)
|
void CPlayerInterface::battleTriggerEffect (const BattleTriggerEffect & bte)
|
||||||
{
|
{
|
||||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||||
//TODO why is this different (no return on LOPLINT != this) ?
|
BATTLE_EVENT_POSSIBLE_RETURN;
|
||||||
|
|
||||||
RETURN_IF_QUICK_COMBAT;
|
RETURN_IF_QUICK_COMBAT;
|
||||||
battleInt->effectsController->battleTriggerEffect(bte);
|
battleInt->effectsController->battleTriggerEffect(bte);
|
||||||
|
@@ -38,6 +38,9 @@ void CInGameConsole::showAll(SDL_Surface * to)
|
|||||||
|
|
||||||
void CInGameConsole::show(SDL_Surface * to)
|
void CInGameConsole::show(SDL_Surface * to)
|
||||||
{
|
{
|
||||||
|
if (LOCPLINT->cingconsole != this)
|
||||||
|
return;
|
||||||
|
|
||||||
int number = 0;
|
int number = 0;
|
||||||
|
|
||||||
boost::unique_lock<boost::mutex> lock(texts_mx);
|
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)
|
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)
|
switch(key)
|
||||||
{
|
{
|
||||||
@@ -192,6 +199,9 @@ void CInGameConsole::keyPressed (const SDL_Keycode & key)
|
|||||||
|
|
||||||
void CInGameConsole::textInputed(const std::string & inputtedText)
|
void CInGameConsole::textInputed(const std::string & inputtedText)
|
||||||
{
|
{
|
||||||
|
if (LOCPLINT->cingconsole != this)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!captureAllKeys || enteredText.empty())
|
if(!captureAllKeys || enteredText.empty())
|
||||||
return;
|
return;
|
||||||
enteredText.resize(enteredText.size()-1);
|
enteredText.resize(enteredText.size()-1);
|
||||||
|
@@ -31,6 +31,8 @@ static std::map<std::string, int> KeycodeMap{
|
|||||||
{"left", SDLK_LEFT},
|
{"left", SDLK_LEFT},
|
||||||
{"right", SDLK_RIGHT},
|
{"right", SDLK_RIGHT},
|
||||||
{"space", SDLK_SPACE},
|
{"space", SDLK_SPACE},
|
||||||
|
{"escape", SDLK_ESCAPE},
|
||||||
|
{"backspace", SDLK_BACKSPACE},
|
||||||
{"enter", SDLK_RETURN}
|
{"enter", SDLK_RETURN}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -220,10 +222,16 @@ int InterfaceObjectConfigurable::readKeycode(const JsonNode & config) const
|
|||||||
auto s = config.String();
|
auto s = config.String();
|
||||||
if(s.size() == 1) //keyboard symbol
|
if(s.size() == 1) //keyboard symbol
|
||||||
return s[0];
|
return s[0];
|
||||||
|
|
||||||
|
if (KeycodeMap.count(s))
|
||||||
return KeycodeMap[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
|
std::shared_ptr<CPicture> InterfaceObjectConfigurable::buildPicture(const JsonNode & config) const
|
||||||
|
@@ -153,7 +153,7 @@
|
|||||||
"imageOrder": [1, 0, 2, 3],
|
"imageOrder": [1, 0, 2, 3],
|
||||||
"help": "core.help.325",
|
"help": "core.help.325",
|
||||||
"callback": "closeWindow",
|
"callback": "closeWindow",
|
||||||
"hotkey": ["esc", "backspace"]
|
"hotkey": ["escape", "backspace"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user