mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
added mutex for RNG, moved game command implementation from S_PH to S_Player in preparation for forwarding of game commands via tunneling interface
This commit is contained in:
parent
671214c60e
commit
9706ecd98a
11 changed files with 1090 additions and 1092 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include "server_logger.h"
|
||||
#include "main.h"
|
||||
#include "passwordhasher.h"
|
||||
#include "decklist.h"
|
||||
#include "pb/game_replay.pb.h"
|
||||
#include "pb/event_replay_added.pb.h"
|
||||
#include "pb/event_server_message.pb.h"
|
||||
|
|
@ -815,6 +816,27 @@ void Servatrice::storeGameInformation(int secondsElapsed, const QSet<QString> &a
|
|||
query3.execBatch();
|
||||
}
|
||||
|
||||
DeckList *Servatrice::getDeckFromDatabase(int deckId, const QString &userName)
|
||||
{
|
||||
checkSql();
|
||||
|
||||
QMutexLocker locker(&dbMutex);
|
||||
QSqlQuery query;
|
||||
|
||||
query.prepare("select content from " + dbPrefix + "_decklist_files where id = :id and user = :user");
|
||||
query.bindValue(":id", deckId);
|
||||
query.bindValue(":user", userName);
|
||||
execSqlQuery(query);
|
||||
if (!query.next())
|
||||
throw Response::RespNameNotFound;
|
||||
|
||||
QXmlStreamReader deckReader(query.value(0).toString());
|
||||
DeckList *deck = new DeckList;
|
||||
deck->loadFromXml(&deckReader);
|
||||
|
||||
return deck;
|
||||
}
|
||||
|
||||
void Servatrice::scheduleShutdown(const QString &reason, int minutes)
|
||||
{
|
||||
shutdownReason = reason;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue