diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index d81bb0c4..135c888b 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -157,15 +157,9 @@ SET(cockatrice_HEADERS src/pending_command.h ) -if (UNIX) +if (UNIX AND NOT APPLE) set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/cockatrice/translations\\") -endif (UNIX) -if (WIN32) - set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"translations\\") -endif (WIN32) -if (APPLE) - set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"../../../translations\\") -endif (APPLE) +endif (UNIX AND NOT APPLE) set(cockatrice_RESOURCES cockatrice.qrc) set(cockatrice_TS diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index 6efaf5db..90c743d5 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -69,8 +69,6 @@ void installNewTranslator() qtTranslator->load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); qApp->installTranslator(qtTranslator); - if (!translationPath.startsWith("/")) - translationPath.prepend(qApp->applicationDirPath() + "/"); translator->load(translationPrefix + "_" + lang, translationPath); qApp->installTranslator(translator); } @@ -99,6 +97,17 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationDomain("cockatrice.de"); QCoreApplication::setApplicationName("Cockatrice"); + if (translationPath.isEmpty()) { +#ifdef Q_OS_MAC + QDir translationsDir = baseDir; + translationsDir.cd("translations"); + translationPath = translationsDir.absolutePath(); +#endif +#ifdef Q_OS_WIN + translationPath = app.applicationDirPath() + "/translations"; +#endif + } + rng = new RNG_SFMT; settingsCache = new SettingsCache; db = new CardDatabase; diff --git a/common/server_game.cpp b/common/server_game.cpp index 65dafed8..2cdd65ca 100644 --- a/common/server_game.cpp +++ b/common/server_game.cpp @@ -53,6 +53,7 @@ Server_Game::Server_Game(const ServerInfo_User &_creatorInfo, int _gameId, const hostId(0), creatorInfo(new ServerInfo_User(_creatorInfo)), gameStarted(false), + gameClosed(false), gameId(_gameId), description(_description), password(_password), @@ -92,6 +93,7 @@ Server_Game::~Server_Game() room->gamesMutex.lock(); gameMutex.lock(); + gameClosed = true; sendGameEventContainer(prepareGameEvent(Event_GameClosed(), -1)); QMapIterator playerIterator(players); @@ -273,7 +275,9 @@ void Server_Game::doStartGameIfReady() replayList.append(currentReplay); currentReplay = new GameReplay; currentReplay->set_replay_id(databaseInterface->getNextReplayId()); - getInfo(*currentReplay->mutable_game_info()); + ServerInfo_Game *gameInfo = currentReplay->mutable_game_info(); + getInfo(*gameInfo); + gameInfo->set_started(false); Event_GameStateChanged omniscientEvent; createGameStateChangedEvent(&omniscientEvent, 0, true, true); @@ -438,6 +442,7 @@ void Server_Game::removePlayer(Server_Player *player) player->prepareDestroy(); if (!getPlayerCount()) { + gameClosed = true; deleteLater(); return; } else if (!spectator) { @@ -666,7 +671,7 @@ void Server_Game::getInfo(ServerInfo_Game &result) const result.set_room_id(room->getId()); result.set_game_id(gameId); - if (players.isEmpty()) + if (gameClosed) result.set_closed(true); else { for (int i = 0; i < gameTypes.size(); ++i) diff --git a/common/server_game.h b/common/server_game.h index 3992d55c..829d60a8 100644 --- a/common/server_game.h +++ b/common/server_game.h @@ -51,6 +51,7 @@ private: QMap players; QSet allPlayersEver, allSpectatorsEver; bool gameStarted; + bool gameClosed; int gameId; QString description; QString password; diff --git a/prepareMacRelease.sh b/prepareMacRelease.sh index a9e33758..d1f58e26 100644 --- a/prepareMacRelease.sh +++ b/prepareMacRelease.sh @@ -5,7 +5,7 @@ DATE=`date '+%Y%m%d'` #QTDIR="/Users/brukie/QtSDK/Desktop/Qt/474/gcc" QTLIB="/Users/brukie/qt_leopard/lib" QTPLUGINS="/Users/brukie/qt_leopard/plugins" -PROTOBUF="/Users/brukie/protobuf" +PROTOBUF="/Users/brukie/protobuf_leopard" DIR=cockatrice_mac_$DATE if [ -d $DIR ]; then echo "delete old dir first"; exit 1; fi