- bugfixes for fog of war enable at game end
- Added more safety guards in threaded sockets in case this causes problems when things get very busy in the game during monster battles
This commit is contained in:
parent
a3e0ae890b
commit
da1adab808
|
@ -1818,7 +1818,13 @@ void Renderer::renderWater() {
|
||||||
SurfaceCell *tc1= map->getSurfaceCell(i, j+1);
|
SurfaceCell *tc1= map->getSurfaceCell(i, j+1);
|
||||||
|
|
||||||
int thisTeamIndex= world->getThisTeamIndex();
|
int thisTeamIndex= world->getThisTeamIndex();
|
||||||
if(tc0->getNearSubmerged() && (tc0->isExplored(thisTeamIndex) || tc1->isExplored(thisTeamIndex))){
|
|
||||||
|
bool cellExplored = world->showWorldForPlayer(world->getThisFactionIndex());
|
||||||
|
if(cellExplored == false) {
|
||||||
|
cellExplored = (tc0->isExplored(thisTeamIndex) || tc1->isExplored(thisTeamIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tc0->getNearSubmerged() && cellExplored == true) {
|
||||||
glNormal3f(0.f, 1.f, 0.f);
|
glNormal3f(0.f, 1.f, 0.f);
|
||||||
closed= false;
|
closed= false;
|
||||||
|
|
||||||
|
@ -4166,7 +4172,13 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame,
|
||||||
|
|
||||||
SurfaceCell *sc = map->getSurfaceCell(mapPos);
|
SurfaceCell *sc = map->getSurfaceCell(mapPos);
|
||||||
Object *o = sc->getObject();
|
Object *o = sc->getObject();
|
||||||
bool isExplored = (sc->isExplored(world->getThisTeamIndex()) && o != NULL);
|
|
||||||
|
bool cellExplored = world->showWorldForPlayer(world->getThisFactionIndex());
|
||||||
|
if(cellExplored == false) {
|
||||||
|
cellExplored = sc->isExplored(world->getThisTeamIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isExplored = (cellExplored == true && o != NULL);
|
||||||
//bool isVisible = (sc->isVisible(world->getThisTeamIndex()) && o != NULL);
|
//bool isVisible = (sc->isVisible(world->getThisTeamIndex()) && o != NULL);
|
||||||
bool isVisible = true;
|
bool isVisible = true;
|
||||||
|
|
||||||
|
|
|
@ -66,12 +66,10 @@ ClientInterface::ClientInterface() {
|
||||||
this->setReceivedDataSynchCheck(false);
|
this->setReceivedDataSynchCheck(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientInterface::~ClientInterface()
|
ClientInterface::~ClientInterface() {
|
||||||
{
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] destructor for %p\n",__FILE__,__FUNCTION__,__LINE__,this);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] destructor for %p\n",__FILE__,__FUNCTION__,__LINE__,this);
|
||||||
|
|
||||||
if(clientSocket != NULL && clientSocket->isConnected() == true)
|
if(clientSocket != NULL && clientSocket->isConnected() == true) {
|
||||||
{
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
string sQuitText = "has chosen to leave the game!";
|
string sQuitText = "has chosen to leave the game!";
|
||||||
|
@ -79,9 +77,7 @@ ClientInterface::~ClientInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
delete clientSocket;
|
delete clientSocket;
|
||||||
|
@ -90,11 +86,11 @@ ClientInterface::~ClientInterface()
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::connect(const Ip &ip, int port)
|
void ClientInterface::connect(const Ip &ip, int port) {
|
||||||
{
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
|
||||||
|
|
||||||
delete clientSocket;
|
delete clientSocket;
|
||||||
|
clientSocket = NULL;
|
||||||
|
|
||||||
this->ip = ip;
|
this->ip = ip;
|
||||||
this->port = port;
|
this->port = port;
|
||||||
|
@ -107,26 +103,23 @@ void ClientInterface::connect(const Ip &ip, int port)
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END - socket = %d\n",__FILE__,__FUNCTION__,clientSocket->getSocketId());
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END - socket = %d\n",__FILE__,__FUNCTION__,clientSocket->getSocketId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::reset()
|
void ClientInterface::reset() {
|
||||||
{
|
if(getSocket() != NULL) {
|
||||||
if(getSocket() != NULL)
|
|
||||||
{
|
|
||||||
string sQuitText = "has chosen to leave the game!";
|
string sQuitText = "has chosen to leave the game!";
|
||||||
sendTextMessage(sQuitText,-1);
|
sendTextMessage(sQuitText,-1);
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::update()
|
void ClientInterface::update() {
|
||||||
{
|
|
||||||
NetworkMessageCommandList networkMessageCommandList(currentFrameCount);
|
NetworkMessageCommandList networkMessageCommandList(currentFrameCount);
|
||||||
|
|
||||||
//send as many commands as we can
|
//send as many commands as we can
|
||||||
while(!requestedCommands.empty()){
|
while(requestedCommands.empty() == false) {
|
||||||
if(networkMessageCommandList.addCommand(&requestedCommands.back())){
|
if(networkMessageCommandList.addCommand(&requestedCommands.back())) {
|
||||||
requestedCommands.pop_back();
|
requestedCommands.pop_back();
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,14 +129,14 @@ void ClientInterface::update()
|
||||||
|
|
||||||
if(networkMessageCommandList.getCommandCount() > 0 ||
|
if(networkMessageCommandList.getCommandCount() > 0 ||
|
||||||
(lastNetworkCommandListSendTime > 0 && lastSendElapsed >= ClientInterface::maxNetworkCommandListSendTimeWait)) {
|
(lastNetworkCommandListSendTime > 0 && lastSendElapsed >= ClientInterface::maxNetworkCommandListSendTimeWait)) {
|
||||||
sendMessage(&networkMessageCommandList);
|
|
||||||
lastNetworkCommandListSendTime = time(NULL);
|
lastNetworkCommandListSendTime = time(NULL);
|
||||||
|
sendMessage(&networkMessageCommandList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possible cause of out of synch since we have more commands that need
|
// Possible cause of out of synch since we have more commands that need
|
||||||
// to be sent in this frame
|
// to be sent in this frame
|
||||||
if(!requestedCommands.empty()) {
|
if(requestedCommands.empty() == false) {
|
||||||
char szBuf[1024]="";
|
char szBuf[4096]="";
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING / ERROR, requestedCommands.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,requestedCommands.size());
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING / ERROR, requestedCommands.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,requestedCommands.size());
|
||||||
|
|
||||||
string sMsg = "may go out of synch: client requestedCommands.size() = " + intToStr(requestedCommands.size());
|
string sMsg = "may go out of synch: client requestedCommands.size() = " + intToStr(requestedCommands.size());
|
||||||
|
@ -514,12 +507,10 @@ void ClientInterface::updateLobby() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::updateKeyframe(int frameCount)
|
void ClientInterface::updateKeyframe(int frameCount) {
|
||||||
{
|
|
||||||
currentFrameCount = frameCount;
|
currentFrameCount = frameCount;
|
||||||
|
|
||||||
bool done= false;
|
bool done= false;
|
||||||
|
|
||||||
while(done == false) {
|
while(done == false) {
|
||||||
//wait for the next message
|
//wait for the next message
|
||||||
waitForMessage();
|
waitForMessage();
|
||||||
|
|
|
@ -35,13 +35,15 @@ namespace Glest{ namespace Game{
|
||||||
ConnectionSlotThread::ConnectionSlotThread(int slotIndex) : BaseThread() {
|
ConnectionSlotThread::ConnectionSlotThread(int slotIndex) : BaseThread() {
|
||||||
this->slotIndex = slotIndex;
|
this->slotIndex = slotIndex;
|
||||||
this->slotInterface = NULL;
|
this->slotInterface = NULL;
|
||||||
this->event = NULL;
|
//this->event = NULL;
|
||||||
|
eventList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex) : BaseThread() {
|
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex) : BaseThread() {
|
||||||
this->slotIndex = slotIndex;
|
this->slotIndex = slotIndex;
|
||||||
this->slotInterface = slotInterface;
|
this->slotInterface = slotInterface;
|
||||||
this->event = NULL;
|
//this->event = NULL;
|
||||||
|
eventList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionSlotThread::setQuitStatus(bool value) {
|
void ConnectionSlotThread::setQuitStatus(bool value) {
|
||||||
|
@ -56,38 +58,36 @@ void ConnectionSlotThread::setQuitStatus(bool value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionSlotThread::signalUpdate(ConnectionSlotEvent *event) {
|
void ConnectionSlotThread::signalUpdate(ConnectionSlotEvent *event) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] event = %p\n",__FILE__,__FUNCTION__,__LINE__,event);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] event = %p\n",__FILE__,__FUNCTION__,__LINE__,event);
|
||||||
|
|
||||||
if(event != NULL) {
|
if(event != NULL) {
|
||||||
MutexSafeWrapper safeMutex(&triggerIdMutex);
|
MutexSafeWrapper safeMutex(&triggerIdMutex);
|
||||||
this->event = event;
|
eventList.push_back(event);
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
}
|
}
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
semTaskSignalled.signal();
|
semTaskSignalled.signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionSlotThread::setTaskCompleted(ConnectionSlotEvent *event) {
|
void ConnectionSlotThread::setTaskCompleted(ConnectionSlotEvent *event) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(event != NULL) {
|
if(event != NULL) {
|
||||||
MutexSafeWrapper safeMutex(&triggerIdMutex);
|
MutexSafeWrapper safeMutex(&triggerIdMutex);
|
||||||
event->eventCompleted = true;
|
event->eventCompleted = true;
|
||||||
|
eventList.erase(eventList.begin());
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectionSlotThread::isSignalCompleted() {
|
bool ConnectionSlotThread::isSignalCompleted(ConnectionSlotEvent *event) {
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex);
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex(&triggerIdMutex);
|
MutexSafeWrapper safeMutex(&triggerIdMutex);
|
||||||
bool result = (this->event != NULL ? this->event->eventCompleted : true);
|
bool result = (event != NULL ? event->eventCompleted : true);
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
|
//if(result == false) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d, result = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex,result);
|
||||||
if(result == false) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d, result = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex,result);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,29 +104,36 @@ void ConnectionSlotThread::execute() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
semTaskSignalled.waitTillSignalled();
|
semTaskSignalled.waitTillSignalled();
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(getQuitStatus() == true) {
|
if(getQuitStatus() == true) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
this->slotInterface->slotUpdateTask(this->event);
|
MutexSafeWrapper safeMutex(&triggerIdMutex);
|
||||||
|
int eventCount = eventList.size();
|
||||||
|
safeMutex.ReleaseLock(true);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(eventCount > 0) {
|
||||||
|
safeMutex.Lock();
|
||||||
|
ConnectionSlotEvent *event = eventList[0];
|
||||||
|
safeMutex.ReleaseLock();
|
||||||
|
|
||||||
|
this->slotInterface->slotUpdateTask(event);
|
||||||
|
setTaskCompleted(event);
|
||||||
|
}
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(getQuitStatus() == true) {
|
if(getQuitStatus() == true) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
setTaskCompleted(this->event);
|
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@ -177,21 +184,18 @@ ConnectionSlot::ConnectionSlot(ServerInterface* serverInterface, int playerIndex
|
||||||
this->clearChatInfo();
|
this->clearChatInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionSlot::~ConnectionSlot()
|
ConnectionSlot::~ConnectionSlot() {
|
||||||
{
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
|
||||||
|
|
||||||
BaseThread::shutdownAndWait(slotThreadWorker);
|
if(BaseThread::shutdownAndWait(slotThreadWorker) == true) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
delete slotThreadWorker;
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
delete slotThreadWorker;
|
}
|
||||||
slotThreadWorker = NULL;
|
slotThreadWorker = NULL;
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,15 +705,15 @@ void ConnectionSlot::signalUpdate(ConnectionSlotEvent *event) {
|
||||||
slotThreadWorker->signalUpdate(event);
|
slotThreadWorker->signalUpdate(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectionSlot::updateCompleted() {
|
bool ConnectionSlot::updateCompleted(ConnectionSlotEvent *event) {
|
||||||
assert(slotThreadWorker != NULL);
|
assert(slotThreadWorker != NULL);
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
||||||
|
|
||||||
bool waitingForThread = (slotThreadWorker != NULL &&
|
bool waitingForThread = (slotThreadWorker != NULL &&
|
||||||
slotThreadWorker->isSignalCompleted() == false &&
|
slotThreadWorker->isSignalCompleted(event) == false &&
|
||||||
slotThreadWorker->getQuitStatus() == false &&
|
slotThreadWorker->getQuitStatus() == false &&
|
||||||
slotThreadWorker->getRunningStatus() == true);
|
slotThreadWorker->getRunningStatus() == true);
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d, waitingForThread = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex,waitingForThread);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d, waitingForThread = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex,waitingForThread);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ protected:
|
||||||
ConnectionSlotCallbackInterface *slotInterface;
|
ConnectionSlotCallbackInterface *slotInterface;
|
||||||
Semaphore semTaskSignalled;
|
Semaphore semTaskSignalled;
|
||||||
Mutex triggerIdMutex;
|
Mutex triggerIdMutex;
|
||||||
ConnectionSlotEvent *event;
|
vector<ConnectionSlotEvent *> eventList;
|
||||||
int slotIndex;
|
int slotIndex;
|
||||||
|
|
||||||
virtual void setQuitStatus(bool value);
|
virtual void setQuitStatus(bool value);
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex);
|
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex);
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
void signalUpdate(ConnectionSlotEvent *event);
|
void signalUpdate(ConnectionSlotEvent *event);
|
||||||
bool isSignalCompleted();
|
bool isSignalCompleted(ConnectionSlotEvent *event);
|
||||||
int getSlotIndex() const {return slotIndex; }
|
int getSlotIndex() const {return slotIndex; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ public:
|
||||||
void clearPendingNetworkCommandList();
|
void clearPendingNetworkCommandList();
|
||||||
|
|
||||||
void signalUpdate(ConnectionSlotEvent *event);
|
void signalUpdate(ConnectionSlotEvent *event);
|
||||||
bool updateCompleted();
|
bool updateCompleted(ConnectionSlotEvent *event);
|
||||||
|
|
||||||
virtual void sendMessage(const NetworkMessage* networkMessage);
|
virtual void sendMessage(const NetworkMessage* networkMessage);
|
||||||
int getCurrentFrameCount() const { return currentFrameCount; }
|
int getCurrentFrameCount() const { return currentFrameCount; }
|
||||||
|
|
|
@ -458,15 +458,15 @@ bool ServerInterface::signalClientReceiveCommands(ConnectionSlot* connectionSlot
|
||||||
event.socketTriggered = socketTriggered;
|
event.socketTriggered = socketTriggered;
|
||||||
event.triggerId = slotIndex;
|
event.triggerId = slotIndex;
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex);
|
||||||
|
|
||||||
// Step #1 tell all connection slot worker threads to receive socket data
|
// Step #1 tell all connection slot worker threads to receive socket data
|
||||||
if(connectionSlot != NULL) {
|
if(connectionSlot != NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex);
|
||||||
if(socketTriggered == true || connectionSlot->isConnected() == false) {
|
if(socketTriggered == true || connectionSlot->isConnected() == false) {
|
||||||
connectionSlot->signalUpdate(&event);
|
connectionSlot->signalUpdate(&event);
|
||||||
slotSignalled = true;
|
slotSignalled = true;
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ void ServerInterface::update() {
|
||||||
//connectionSlot = slots[i];
|
//connectionSlot = slots[i];
|
||||||
|
|
||||||
// Not done waiting for data yet
|
// Not done waiting for data yet
|
||||||
bool updateFinished = (connectionSlot != NULL ? connectionSlot->updateCompleted() : true);
|
bool updateFinished = (connectionSlot != NULL ? connectionSlot->updateCompleted(&eventList[i]) : true);
|
||||||
if(updateFinished == false) {
|
if(updateFinished == false) {
|
||||||
threadsDone = false;
|
threadsDone = false;
|
||||||
break;
|
break;
|
||||||
|
@ -618,7 +618,7 @@ void ServerInterface::update() {
|
||||||
connectionSlot = slots[i];
|
connectionSlot = slots[i];
|
||||||
|
|
||||||
// Not done waiting for data yet
|
// Not done waiting for data yet
|
||||||
bool updateFinished = (connectionSlot != NULL ? connectionSlot->updateCompleted() : true);
|
bool updateFinished = (connectionSlot != NULL ? connectionSlot->updateCompleted(&eventList[i]) : true);
|
||||||
if(updateFinished == false) {
|
if(updateFinished == false) {
|
||||||
threadsDone = false;
|
threadsDone = false;
|
||||||
//sleep(0);
|
//sleep(0);
|
||||||
|
@ -1208,7 +1208,7 @@ void ServerInterface::broadcastMessage(const NetworkMessage* networkMessage, int
|
||||||
connectionSlot->clearThreadErrorList();
|
connectionSlot->clearThreadErrorList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(connectionSlot->updateCompleted() == false) {
|
if(connectionSlot->updateCompleted(&eventList[i]) == false) {
|
||||||
threadsDone = false;
|
threadsDone = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,8 @@ public:
|
||||||
int getUpdateFps(int factionIndex) const;
|
int getUpdateFps(int factionIndex) const;
|
||||||
bool canTickWorld() const;
|
bool canTickWorld() const;
|
||||||
|
|
||||||
void exploreCells(const Vec2i &newPos, int sightRange, int teamIndex);
|
void exploreCells(const Vec2i &newPos, int sightRange, int teamIndex);
|
||||||
|
bool showWorldForPlayer(int factionIndex) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -232,7 +233,6 @@ private:
|
||||||
void updateAllFactionUnits();
|
void updateAllFactionUnits();
|
||||||
void underTakeDeadFactionUnits();
|
void underTakeDeadFactionUnits();
|
||||||
void updateAllFactionConsumableCosts();
|
void updateAllFactionConsumableCosts();
|
||||||
bool showWorldForPlayer(int factionIndex) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
Loading…
Reference in New Issue
Block a user