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
Games
KShisen
Commits
2967f512
Commit
2967f512
authored
May 26, 2019
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it compile without foreach
parent
72b1b159
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
6 deletions
+10
-6
CMakeLists.txt
CMakeLists.txt
+4
-0
src/board.cpp
src/board.cpp
+4
-4
src/possiblemove.cpp
src/possiblemove.cpp
+2
-2
No files found.
CMakeLists.txt
View file @
2967f512
...
...
@@ -44,6 +44,10 @@ include(ECMQtDeclareLoggingCategory)
find_package
(
KF5KMahjongglib REQUIRED
)
find_package
(
KF5KDEGames 4.9.0 REQUIRED
)
if
(
${
KF5Config_VERSION
}
STRGREATER
"5.56.0"
)
add_definitions
(
-DQT_NO_FOREACH
)
MESSAGE
(
STATUS
"compile without foreach"
)
endif
()
add_definitions
(
-DQT_STRICT_ITERATORS
...
...
src/board.cpp
View file @
2967f512
...
...
@@ -691,7 +691,7 @@ void Board::paintEvent(QPaintEvent * e)
if
(
m_paintPossibleMoves
)
{
p
.
setPen
(
QPen
(
QColor
(
"blue"
),
lineWidth
()));
// paint all possible moves
for
each
(
auto
const
move
,
m_possibleMoves
)
{
for
(
auto
const
&
move
:
qAsConst
(
m_possibleMoves
)
)
{
auto
pt1
=
move
.
path
().
cbegin
();
auto
pt2
=
pt1
+
1
;
while
(
pt2
!=
move
.
path
().
cend
())
{
...
...
@@ -894,7 +894,7 @@ void Board::marked(TilePos const & tilePos)
{
if
(
field
(
tilePos
)
==
EMPTY
)
{
// click on empty space on the board
if
(
m_possibleMoves
.
size
()
>
1
)
{
// if the click is on any of the current possible moves, make that move
for
each
(
auto
move
,
m_possibleMoves
)
{
for
(
auto
move
:
qAsConst
(
m_possibleMoves
)
)
{
if
(
move
.
isInPath
(
tilePos
))
{
performMove
(
move
);
emit
selectATile
();
...
...
@@ -932,7 +932,7 @@ void Board::marked(TilePos const & tilePos)
}
if
(
m_possibleMoves
.
size
()
>
1
)
{
// if the click is on any of the current possible moves, make that move
for
each
(
auto
move
,
m_possibleMoves
)
{
for
(
auto
move
:
qAsConst
(
m_possibleMoves
)
)
{
if
(
move
.
isInPath
(
tilePos
))
{
performMove
(
move
);
emit
selectATile
();
...
...
@@ -955,7 +955,7 @@ void Board::marked(TilePos const & tilePos)
if
(
findPath
(
TilePos
(
m_markX
,
m_markY
),
tilePos
,
m_possibleMoves
)
>
0
)
{
if
(
m_possibleMoves
.
size
()
>
1
)
{
auto
withSlide
=
0
;
for
each
(
auto
const
move
,
m_possibleMoves
)
{
for
(
auto
const
&
move
:
qAsConst
(
m_possibleMoves
)
)
{
move
.
Debug
();
if
(
move
.
hasSlide
())
{
++
withSlide
;
...
...
src/possiblemove.cpp
View file @
2967f512
...
...
@@ -70,13 +70,13 @@ void PossibleMove::Debug() const
{
qCDebug
(
KSHISEN_General
)
<<
"PossibleMove"
;
for
each
(
auto
const
iter
,
m_path
)
{
for
(
auto
const
&
iter
:
qAsConst
(
m_path
)
)
{
qCDebug
(
KSHISEN_General
)
<<
" Path:"
<<
iter
.
x
()
<<
","
<<
iter
.
y
();
}
if
(
m_hasSlide
)
{
qCDebug
(
KSHISEN_General
)
<<
" hasSlide"
;
for
each
(
auto
const
iter
,
m_slide
)
{
for
(
auto
const
&
iter
:
qAsConst
(
m_slide
)
)
{
qCDebug
(
KSHISEN_General
)
<<
" Slide:"
<<
iter
.
x
()
<<
","
<<
iter
.
y
();
}
}
...
...
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