Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Blackjack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pascal Engeler
Blackjack
Commits
6cea5678
Commit
6cea5678
authored
2 years ago
by
S.Klapproth
Browse files
Options
Downloads
Patches
Plain Diff
end of round status messages
parent
c3215407
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/client/panels/MainGamePanel.cpp
+43
-21
43 additions, 21 deletions
source/client/panels/MainGamePanel.cpp
with
43 additions
and
21 deletions
source/client/panels/MainGamePanel.cpp
+
43
−
21
View file @
6cea5678
...
...
@@ -131,32 +131,32 @@ void MainGamePanel::buildOthers(game_state* gameState, player* otherPlayer, doub
}
else
{
// STATUS
if
(
otherPlayer
->
get_hand
()
->
is_over_21
(
err
)){
this
->
buildStaticText
(
"Status: LOST ROUND"
,
labelPosition
+
wxSize
(
-
100
,
-
18
),
wxSize
(
200
,
18
),
textAlignment
);
}
else
if
(
gameState
->
get_current_player
()
==
otherPlayer
&&
!
gameState
->
everyone_finished
())
{
this
->
buildStaticText
(
"Status: Playing"
,
labelPosition
+
wxSize
(
-
100
,
-
18
),
wxSize
(
200
,
18
),
textAlignment
);
std
::
string
status_message
=
"Status: "
;
if
(
otherPlayer
->
get_hand
()
->
is_over_21
(
err
))
status_message
+=
"LOST ROUND"
;
else
if
(
gameState
->
everyone_finished
()){
std
::
string
err
;
int
pp
=
otherPlayer
->
get_hand
()
->
get_points
(
err
);
int
dp
=
gameState
->
get_dealers_hand
()
->
get_points
(
err
);
if
(
pp
<
dp
)
status_message
+=
"LOST ROUND"
;
else
if
(
pp
>
dp
)
status_message
+=
"WON ROUND"
;
else
status_message
+=
"DRAW WITH DEALER"
;
}
else
if
(
gameState
->
get_current_player
()
==
otherPlayer
&&
!
gameState
->
everyone_finished
())
status_message
+=
"PLAYING"
;
else
{
this
->
buildStaticText
(
"Status: Waiting"
,
status_message
+=
"WAITING"
;
this
->
buildStaticText
(
status_message
,
labelPosition
+
wxSize
(
-
100
,
-
18
),
wxSize
(
200
,
18
),
textAlignment
);
}
// MONEY
this
->
buildStaticText
(
"Money:"
+
std
::
to_string
(
otherPlayer
->
get_money
())
+
"$"
,
...
...
@@ -330,7 +330,29 @@ void MainGamePanel::buildThisPlayer(game_state* gameState, player* me) {
// if our player already played, we display that as status
// TODO from has_folded make has_played
if
(
me
->
has_finished_turn
())
{
if
(
gameState
->
everyone_finished
()){
std
::
string
err
;
std
::
string
status_message
;
int
pp
=
me
->
get_hand
()
->
get_points
(
err
);
int
dp
=
gameState
->
get_dealers_hand
()
->
get_points
(
err
);
if
(
me
->
get_hand
()
->
is_over_21
(
err
))
status_message
+=
"YOU LOST THIS ROUND"
;
else
if
(
pp
<
dp
)
status_message
+=
"YOU LOST THIS ROUND"
;
else
if
(
pp
>
dp
)
status_message
+=
"YOU WON THIS ROUND"
;
else
status_message
+=
"YOU TIED WITH THE DEALER"
;
wxStaticText
*
playerStatus
=
buildStaticText
(
status_message
,
wxDefaultPosition
,
wxSize
(
200
,
32
),
wxALIGN_CENTER
);
innerLayout
->
Add
(
playerStatus
,
0
,
wxALIGN_CENTER
|
wxBOTTOM
,
8
);
}
else
if
(
me
->
has_finished_turn
())
{
wxStaticText
*
playerStatus
=
buildStaticText
(
"You finished your turn"
,
wxDefaultPosition
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment