Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
daf1fa18
Commit
daf1fa18
authored
Sep 09, 2010
by
Max-Wilhelm Bruker
Browse files
server shouldn't update client ping in local games
parent
62bf2572
Changes
5
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/localserver.h
View file @
daf1fa18
...
...
@@ -13,6 +13,7 @@ public:
~
LocalServer
();
AuthenticationResult
checkUserPassword
(
const
QString
&
/*user*/
,
const
QString
&
/*password*/
)
{
return
UnknownUser
;
}
QString
getLoginMessage
()
const
{
return
QString
();
}
bool
getGameShouldPing
()
const
{
return
false
;
}
int
getMaxGameInactivityTime
()
const
{
return
9999999
;
}
int
getMaxPlayerInactivityTime
()
const
{
return
9999999
;
}
...
...
common/server.h
View file @
daf1fa18
...
...
@@ -34,6 +34,7 @@ public:
virtual
QString
getLoginMessage
()
const
=
0
;
Server_Game
*
createGame
(
const
QString
&
description
,
const
QString
&
password
,
int
maxPlayers
,
bool
spectatorsAllowed
,
bool
spectatorsNeedPassword
,
bool
spectatorsCanTalk
,
bool
spectatorsSeeEverything
,
Server_ProtocolHandler
*
creator
);
virtual
bool
getGameShouldPing
()
const
=
0
;
virtual
int
getMaxGameInactivityTime
()
const
=
0
;
virtual
int
getMaxPlayerInactivityTime
()
const
=
0
;
private:
...
...
common/server_game.cpp
View file @
daf1fa18
...
...
@@ -27,14 +27,16 @@
#include
<QTimer>
#include
<QDebug>
Server_Game
::
Server_Game
(
Server_ProtocolHandler
*
_creator
,
int
_gameId
,
const
QString
&
_description
,
const
QString
&
_password
,
int
_maxPlayers
,
bool
_spectatorsAllowed
,
bool
_spectatorsNeedPassword
,
bool
_spectatorsCanTalk
,
bool
_spectatorsSeeEverything
,
QObject
*
parent
)
Server_Game
::
Server_Game
(
Server_ProtocolHandler
*
_creator
,
int
_gameId
,
const
QString
&
_description
,
const
QString
&
_password
,
int
_maxPlayers
,
bool
_spectatorsAllowed
,
bool
_spectatorsNeedPassword
,
bool
_spectatorsCanTalk
,
bool
_spectatorsSeeEverything
,
Server
*
parent
)
:
QObject
(
parent
),
gameStarted
(
false
),
gameId
(
_gameId
),
description
(
_description
),
password
(
_password
),
maxPlayers
(
_maxPlayers
),
activePlayer
(
-
1
),
activePhase
(
-
1
),
spectatorsAllowed
(
_spectatorsAllowed
),
spectatorsNeedPassword
(
_spectatorsNeedPassword
),
spectatorsCanTalk
(
_spectatorsCanTalk
),
spectatorsSeeEverything
(
_spectatorsSeeEverything
),
inactivityCounter
(
0
)
{
creator
=
addPlayer
(
_creator
,
false
,
false
);
pingClock
=
new
QTimer
(
this
);
connect
(
pingClock
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
pingClockTimeout
()));
pingClock
->
start
(
1000
);
if
(
parent
->
getGameShouldPing
())
{
pingClock
=
new
QTimer
(
this
);
connect
(
pingClock
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
pingClockTimeout
()));
pingClock
->
start
(
1000
);
}
}
Server_Game
::~
Server_Game
()
...
...
common/server_game.h
View file @
daf1fa18
...
...
@@ -27,6 +27,7 @@
#include
"protocol.h"
class
QTimer
;
class
Server
;
class
Server_Game
:
public
QObject
{
Q_OBJECT
...
...
@@ -50,7 +51,7 @@ signals:
private
slots
:
void
pingClockTimeout
();
public:
Server_Game
(
Server_ProtocolHandler
*
_creator
,
int
_gameId
,
const
QString
&
_description
,
const
QString
&
_password
,
int
_maxPlayers
,
bool
_spectatorsAllowed
,
bool
_spectatorsNeedPassword
,
bool
_spectatorsCanTalk
,
bool
_spectatorsSeeEverything
,
QObject
*
parent
=
0
);
Server_Game
(
Server_ProtocolHandler
*
_creator
,
int
_gameId
,
const
QString
&
_description
,
const
QString
&
_password
,
int
_maxPlayers
,
bool
_spectatorsAllowed
,
bool
_spectatorsNeedPassword
,
bool
_spectatorsCanTalk
,
bool
_spectatorsSeeEverything
,
Server
*
parent
);
~
Server_Game
();
Server_Player
*
getCreator
()
const
{
return
creator
;
}
QString
getCreatorName
()
const
{
return
creator
?
creator
->
getPlayerName
()
:
QString
();
}
...
...
servatrice/src/servatrice.h
View file @
daf1fa18
...
...
@@ -42,6 +42,7 @@ public:
bool
execSqlQuery
(
QSqlQuery
&
query
);
AuthenticationResult
checkUserPassword
(
const
QString
&
user
,
const
QString
&
password
);
QString
getLoginMessage
()
const
{
return
loginMessage
;
}
bool
getGameShouldPing
()
const
{
return
true
;
}
int
getMaxGameInactivityTime
()
const
{
return
maxGameInactivityTime
;
}
int
getMaxPlayerInactivityTime
()
const
{
return
maxPlayerInactivityTime
;
}
private:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment