Commit 864d7a73 authored by Ilya Prokhorov's avatar Ilya Prokhorov

Code-style refactoring

parent 3b899097
......@@ -6,6 +6,7 @@
#endif
using namespace FlameSteelBattleHorn;
using namespace FlameSteelCore::Utils;
Music::Music(shared_ptr<string> path) {
......@@ -15,7 +16,7 @@ Music::Music(shared_ptr<string> path) {
if (music == nullptr) {
//cout << "Can't load music " << Mix_GetError() << endl;
FSCUtils::throwRuntimeException(string("Can't load music"));
throwRuntimeException(string("Can't load music"));
}
#else
......@@ -30,11 +31,11 @@ void Music::play() {
#ifndef __EMSCRIPTEN__
if (music) {
if (Mix_PlayMusic(music, -1) == -1) {
FSCUtils::throwRuntimeException(string("Can't play music"));
throwRuntimeException(string("Can't play music"));
}
}
else {
FSCUtils::throwRuntimeException(string("Can't play music - music is null"));
throwRuntimeException(string("Can't play music - music is null"));
}
#else
if (path.get() != nullptr) {
......
......@@ -5,13 +5,14 @@
#include <FlameSteelCore/FSCUtils.h>
using namespace std;
using namespace FlameSteelCore::Utils;
namespace FlameSteelBattleHorn {
class Playable {
public:
virtual void play() { FSCUtils::throwRuntimeException(string("Call to not overriden method play, playable abstract class")); };
virtual void stop() { FSCUtils::throwRuntimeException(string("Call to not overriden method stop, playable abstract class")); };
virtual void play() { throwRuntimeException(string("Call to not overriden method play, playable abstract class")); };
virtual void stop() { throwRuntimeException(string("Call to not overriden method stop, playable abstract class")); };
};
};
......
......@@ -5,6 +5,7 @@
#include <emscripten.h>
#endif
using namespace FlameSteelCore::Utils;
using namespace FlameSteelBattleHorn;
void Sound::initializeSoundSystem() {
......@@ -12,7 +13,7 @@ void Sound::initializeSoundSystem() {
#ifndef __EMSCRIPTEN__
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024) == -1 ) {
FSCUtils::throwRuntimeException(string("Can't initialize sound system"));
throwRuntimeException(string("Can't initialize sound system"));
}
int flags = MIX_INIT_OGG;
......@@ -24,7 +25,7 @@ void Sound::initializeSoundSystem() {
if ((initted & flags) != flags) {
printf("Mix_Init: Failed to init required ogg and mod support!\n");
printf("Mix_Init: %s\n", Mix_GetError());
FSCUtils::throwRuntimeException(string("Can't initialize SDL_Mixer properly"));
throwRuntimeException(string("Can't initialize SDL_Mixer properly"));
}
else {
//cout << "SDL_MIXER initialized correctly" << endl;
......@@ -41,7 +42,7 @@ Sound::Sound(shared_ptr<string> path) {
if (chunk == nullptr) {
//cout << "Can't load sound " << Mix_GetError() << endl;
FSCUtils::throwRuntimeException(string("Can't load sound"));
throwRuntimeException(string("Can't load sound"));
}
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment