Merge branch 'master' of git://github.com/mbruker/Cockatrice
This commit is contained in:
commit
63dc0bd4a9
5 changed files with 22 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<int, Server_Player *> 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)
|
||||
|
|
|
@ -51,6 +51,7 @@ private:
|
|||
QMap<int, Server_Player *> players;
|
||||
QSet<QString> allPlayersEver, allSpectatorsEver;
|
||||
bool gameStarted;
|
||||
bool gameClosed;
|
||||
int gameId;
|
||||
QString description;
|
||||
QString password;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue