Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ovcc
Open Virtual Carcassonne Clone
Commits
a402453d
Commit
a402453d
authored
May 18, 2019
by
Jonathan Michalon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Few fixes taking into account b4n's review of last days' commits
parent
12390c2c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
11 deletions
+15
-11
clients/bot/src/main.vala
clients/bot/src/main.vala
+3
-3
libovcc/src/network/ovcc-network-signals.vala
libovcc/src/network/ovcc-network-signals.vala
+2
-0
libovcc/src/ovcc-board.vala
libovcc/src/ovcc-board.vala
+1
-1
libovcc/src/ovcc-game.vala
libovcc/src/ovcc-game.vala
+5
-3
libovccclient/src/ovccclient-client.vala
libovccclient/src/ovccclient-client.vala
+1
-1
server/src/server.vala
server/src/server.vala
+3
-3
No files found.
clients/bot/src/main.vala
View file @
a402453d
...
...
@@ -220,9 +220,9 @@ public int main (string[] args)
opt_context
.
add_main_entries
(
options
,
null
);
opt_context
.
parse
(
ref
args
);
}
catch
(
OptionError
e
)
{
print
(
"error: %s\n"
,
e
.
message
);
print
(
"Run '%s --help' to see a full list of available command line options.\n"
,
args
[
0
]);
return
0
;
print
err
(
"error: %s\n"
,
e
.
message
);
print
err
(
"Run '%s --help' to see a full list of available command line options.\n"
,
args
[
0
]);
return
1
;
}
var
loop
=
new
MainLoop
();
...
...
libovcc/src/network/ovcc-network-signals.vala
View file @
a402453d
...
...
@@ -165,6 +165,8 @@ namespace OVCC.Network
critical
(
"Got signal to start game but couldn't: %s"
,
e
.
message
);
}
break
;
case
OVCC
.
GameState
.
NEW
:
case
OVCC
.
GameState
.
PLAYER_WAITING
:
case
OVCC
.
GameState
.
FINISHED
:
break
;
/* should be automatic */
case
OVCC
.
GameState
.
ABORTED
:
...
...
libovcc/src/ovcc-board.vala
View file @
a402453d
...
...
@@ -466,7 +466,7 @@ namespace OVCC
*/
public
bool
@foreach
(
BoardForeachFunc
f
)
{
HashTableIter
<
Position
?,
Tile
>
iter
=
HashTableIter
<
Position
?,
Tile
>
(
this
.
_board
);
var
iter
=
HashTableIter
<
Position
?,
Tile
>
(
this
.
_board
);
Position
?
pos
;
Tile
tile
;
bool
went_through
=
true
;
...
...
libovcc/src/ovcc-game.vala
View file @
a402453d
...
...
@@ -57,15 +57,15 @@ namespace OVCC
public
bool
is_open
()
{
return
NEW
in
this
|
|
PLAYER_WAITING
in
this
;
return
this
in
(
NEW
|
PLAYER_WAITING
)
;
}
public
bool
is_done
()
{
return
FINISHED
in
this
|
|
ABORTED
in
this
;
return
this
in
(
FINISHED
|
ABORTED
)
;
}
public
bool
can_start
()
{
return
PLAYER_WAITING
in
this
;
return
this
in
PLAYER_WAITING
;
}
}
...
...
@@ -101,6 +101,8 @@ namespace OVCC
{
private
SList
<
Player
>
_players
=
null
;
// FIXME implement UUIDs for reference over network instead of mere list index
// public string uuid { get; construct; default = Uuid.string_random(); }
public
GameState
state
{
get
;
private
set
;
default
=
GameState
.
NEW
;
}
public
Stack
stack
{
private
get
;
construct
;
}
public
Board
board
{
get
;
construct
;
}
...
...
libovccclient/src/ovccclient-client.vala
View file @
a402453d
...
...
@@ -115,7 +115,7 @@ namespace OVCCClient
if
(
game
!=
null
)
{
game
.
abort
();
}
if
(
server
.
is_connected
())
{
if
(
server
.
is_connected
())
{
server
.
disconnect_from
();
}
/* destroy server */
...
...
server/src/server.vala
View file @
a402453d
...
...
@@ -37,7 +37,7 @@ public class Server: ThreadedSocketService
public
string
name
{
get
;
construct
;
}
public
uint
port
{
get
;
construct
;
default
=
0xdead
;
}
public
uint
max_games
{
get
;
set
;
default
=
5
;
}
public
uint
max_games
{
get
;
set
;
default
=
1
;
}
public
signal
void
stopped
();
...
...
@@ -62,7 +62,7 @@ public class Server: ThreadedSocketService
lock
(
games
)
{
foreach
(
var
game
in
games
)
{
if
(
game
.
state
.
is_open
()
&&
if
(
game
.
state
.
is_open
()
&&
(
candidate
==
null
||
candidate
.
players
.
length
()
<
game
.
players
.
length
()))
{
candidate
=
game
;
}
...
...
@@ -144,7 +144,7 @@ public class Server: ThreadedSocketService
game
=
games
.
nth_data
(
msg
.
game_index
);
}
if
(
game
==
null
||
!
game
.
state
.
is_open
())
{
if
(
game
==
null
||
!
game
.
state
.
is_open
())
{
debug
(
"Bad game %d, sending fail join message"
,
msg
.
game_index
);
var
join
=
new
JoinMessage
(
msg
.
game_index
);
join
.
status
=
JoinMessage
.
State
.
FAILED
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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