mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-22 23:26:14 -08:00
cleanups, games work with ISL, now we just need to clean up better when the ISL connection dies
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
#include "server_abstractuserinterface.h"
|
||||
#include "server_response_containers.h"
|
||||
#include <google/protobuf/descriptor.h>
|
||||
|
||||
void Server_AbstractUserInterface::sendProtocolItemByType(ServerMessage::MessageType type, const ::google::protobuf::Message &item)
|
||||
@@ -17,3 +20,22 @@ SessionEvent *Server_AbstractUserInterface::prepareSessionEvent(const ::google::
|
||||
event->GetReflection()->MutableMessage(event, sessionEvent.GetDescriptor()->FindExtensionByName("ext"))->CopyFrom(sessionEvent);
|
||||
return event;
|
||||
}
|
||||
|
||||
void Server_AbstractUserInterface::sendResponseContainer(const ResponseContainer &responseContainer, Response::ResponseCode responseCode)
|
||||
{
|
||||
const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *> > &preResponseQueue = responseContainer.getPreResponseQueue();
|
||||
for (int i = 0; i < preResponseQueue.size(); ++i)
|
||||
sendProtocolItemByType(preResponseQueue[i].first, *preResponseQueue[i].second);
|
||||
|
||||
Response response;
|
||||
response.set_cmd_id(responseContainer.getCmdId());
|
||||
response.set_response_code(responseCode);
|
||||
::google::protobuf::Message *responseExtension = responseContainer.getResponseExtension();
|
||||
if (responseExtension)
|
||||
response.GetReflection()->MutableMessage(&response, responseExtension->GetDescriptor()->FindExtensionByName("ext"))->CopyFrom(*responseExtension);
|
||||
sendProtocolItem(response);
|
||||
|
||||
const QList<QPair<ServerMessage::MessageType, ::google::protobuf::Message *> > &postResponseQueue = responseContainer.getPostResponseQueue();
|
||||
for (int i = 0; i < postResponseQueue.size(); ++i)
|
||||
sendProtocolItemByType(postResponseQueue[i].first, *postResponseQueue[i].second);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user