Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Games
KGoldrunner
Commits
7a48cb9c
Commit
7a48cb9c
authored
Sep 14, 2019
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GIT_SILENT: minor qstring optimization
parent
a8da92d3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
15 deletions
+15
-15
src/kgrdialog.cpp
src/kgrdialog.cpp
+2
-2
src/kgreditor.cpp
src/kgreditor.cpp
+2
-2
src/kgrgame.cpp
src/kgrgame.cpp
+4
-4
src/kgrgameio.cpp
src/kgrgameio.cpp
+3
-3
src/kgrlevelplayer.cpp
src/kgrlevelplayer.cpp
+1
-1
src/kgrrenderer.cpp
src/kgrrenderer.cpp
+2
-2
src/kgrselector.cpp
src/kgrselector.cpp
+1
-1
No files found.
src/kgrdialog.cpp
View file @
7a48cb9c
...
...
@@ -306,11 +306,11 @@ KGrLGDialog::KGrLGDialog (QFile * savedGames,
// Read the saved games into the list box.
while
(
!
gameText
.
atEnd
())
{
s
=
gameText
.
readLine
();
// Read in one saved game.
pr
=
s
.
left
(
s
.
indexOf
(
Q
StringLiteral
(
" "
),
0
,
pr
=
s
.
left
(
s
.
indexOf
(
Q
Latin1Char
(
' '
),
0
,
Qt
::
CaseInsensitive
));
// Get the game prefix.
for
(
i
=
0
;
i
<
imax
;
++
i
)
{
// Get the game name.
if
(
gameList
.
at
(
i
)
->
prefix
==
pr
)
{
s
=
s
.
insert
(
0
,
s
.
insert
(
0
,
gameList
.
at
(
i
)
->
name
.
leftJustified
(
20
,
QLatin1Char
(
' '
),
true
)
+
QLatin1Char
(
' '
));
break
;
}
...
...
src/kgreditor.cpp
View file @
7a48cb9c
...
...
@@ -374,7 +374,7 @@ bool KGrEditor::moveLevelFile (int pGameIndex, int level)
// Save the "fromN" file under a temporary name.
filePath1
=
getLevelFilePath
(
gameList
.
at
(
fromC
),
fromL
);
filePath2
=
filePath1
;
filePath2
=
filePath2
.
append
(
QStringLiteral
(
".tmp"
));
filePath2
.
append
(
QStringLiteral
(
".tmp"
));
if
(
!
KGrGameIO
::
safeRename
(
view
,
filePath1
,
filePath2
))
{
return
false
;
}
...
...
@@ -858,7 +858,7 @@ QString KGrEditor::getTitle()
QString
KGrEditor
::
getLevelFilePath
(
KGrGameData
*
gameData
,
int
lev
)
{
QString
filePath
=
userDataDir
+
QString
Literal
(
"levels/"
)
+
gameData
->
prefix
+
QString
filePath
=
userDataDir
+
Q
Latin1
String
(
"levels/"
)
+
gameData
->
prefix
+
QString
::
number
(
lev
).
rightJustified
(
3
,
QLatin1Char
(
'0'
))
+
QStringLiteral
(
".grl"
);
return
(
filePath
);
}
...
...
src/kgrgame.cpp
View file @
7a48cb9c
...
...
@@ -442,7 +442,7 @@ void KGrGame::initGame()
// If he/she has never played before, set it to Tutorial, level 1.
KConfigGroup
gameGroup
(
KSharedConfig
::
openConfig
(),
"KDEGame"
);
QString
prevGamePrefix
=
gameGroup
.
readEntry
(
"GamePrefix"
,
"tute"
);
int
prevLevel
=
gameGroup
.
readEntry
(
QString
Literal
(
"Level_"
)
+
prevGamePrefix
,
1
);
int
prevLevel
=
gameGroup
.
readEntry
(
Q
Latin1
String
(
"Level_"
)
+
prevGamePrefix
,
1
);
//qCDebug(KGOLDRUNNER_LOG)<< "Config() Game and Level" << prevGamePrefix << prevLevel;
...
...
@@ -519,14 +519,14 @@ void KGrGame::initGame()
bool
KGrGame
::
getRecordingName
(
const
QString
&
dir
,
const
QString
&
pPrefix
,
QString
&
filename
)
{
QString
recFile
=
dir
+
QString
Literal
(
"rec_"
)
+
pPrefix
+
QString
Literal
(
".txt"
);
QString
recFile
=
dir
+
Q
Latin1
String
(
"rec_"
)
+
pPrefix
+
Q
Latin1
String
(
".txt"
);
QFileInfo
fileInfo
(
recFile
);
bool
recOK
=
fileInfo
.
exists
()
&&
fileInfo
.
isReadable
();
filename
=
QString
();
if
(
demoType
==
SOLVE
)
{
// Look for a solution-file name in User or System area.
QString
solFile
=
dir
+
QString
Literal
(
"sol_"
)
+
pPrefix
+
QString
Literal
(
".txt"
);
QString
solFile
=
dir
+
Q
Latin1
String
(
"sol_"
)
+
pPrefix
+
Q
Latin1
String
(
".txt"
);
fileInfo
.
setFile
(
solFile
);
bool
solOK
=
fileInfo
.
exists
()
&&
fileInfo
.
isReadable
();
if
(
solOK
)
{
...
...
@@ -1569,7 +1569,7 @@ bool KGrGame::selectSavedGame (int & selectedGame, int & selectedLevel)
selectedLevel
=
0
;
if
(
!
loadedData
.
isEmpty
())
{
pr
=
loadedData
.
mid
(
21
,
7
);
// Get the game prefix.
pr
=
pr
.
left
(
pr
.
indexOf
(
Q
StringLiteral
(
" "
),
0
,
Qt
::
CaseInsensitive
));
pr
=
pr
.
left
(
pr
.
indexOf
(
Q
Latin1Char
(
' '
),
0
,
Qt
::
CaseInsensitive
));
for
(
int
i
=
0
;
i
<
gameList
.
count
();
i
++
)
{
// Find the game.
if
(
gameList
.
at
(
i
)
->
prefix
==
pr
)
{
...
...
src/kgrgameio.cpp
View file @
7a48cb9c
...
...
@@ -274,7 +274,7 @@ QString KGrGameIO::getFilePath
(
const
QString
&
dir
,
const
QString
&
prefix
,
const
int
level
)
{
QString
filePath
=
((
level
==
0
)
?
QStringLiteral
(
"ende"
)
:
prefix
);
filePath
=
dir
+
QString
Literal
(
"game_"
)
+
filePath
+
QString
Literal
(
".txt"
);
filePath
=
dir
+
Q
Latin1
String
(
"game_"
)
+
filePath
+
Q
Latin1
String
(
".txt"
);
QFile
test
(
filePath
);
// See if there is a game-file or "ENDE" screen in KGoldrunner 3 format.
...
...
@@ -289,7 +289,7 @@ QString KGrGameIO::getFilePath
}
else
{
QString
num
=
QString
::
number
(
level
).
rightJustified
(
3
,
QLatin1Char
(
'0'
));
filePath
=
dir
+
QString
Literal
(
"levels/"
)
+
prefix
+
num
+
QString
Literal
(
".grl"
);
filePath
=
dir
+
Q
Latin1
String
(
"levels/"
)
+
prefix
+
num
+
Q
Latin1
String
(
".grl"
);
}
return
(
filePath
);
...
...
@@ -300,7 +300,7 @@ char KGrGameIO::getALine (const bool kgr3, QByteArray & line)
char
c
;
line
=
""
;
while
(
openFile
.
getChar
(
&
c
))
{
line
=
line
.
append
(
c
);
line
.
append
(
c
);
if
(
c
==
'\n'
)
{
break
;
}
...
...
src/kgrlevelplayer.cpp
View file @
7a48cb9c
...
...
@@ -587,7 +587,7 @@ Direction KGrLevelPlayer::getEnemyDirection (int enemyI, int enemyJ,
bool
KGrLevelPlayer
::
heroCaught
(
const
int
heroX
,
const
int
heroY
)
{
if
(
enemies
.
count
()
==
0
)
{
if
(
enemies
.
isEmpty
()
)
{
return
false
;
}
int
enemyX
,
enemyY
,
pointsPerCell_1
;
...
...
src/kgrrenderer.cpp
View file @
7a48cb9c
...
...
@@ -213,7 +213,7 @@ bool KGrRenderer::hasBorder() const
{
QString
s
=
m_setRenderer
->
theme
()
->
customData
(
QStringLiteral
(
"DrawCanvasBorder"
),
QStringLiteral
(
"0"
));
if
(
s
==
Q
StringLiteral
(
"1"
))
if
(
s
==
Q
Latin1Char
(
'1'
))
return
true
;
else
return
false
;
...
...
@@ -308,7 +308,7 @@ int KGrRenderer::countFrames (const int index)
count
++
;
}
if
((
count
==
0
)
&&
(
QLatin1String
(
keyTable
[
index
].
picKey
)
!=
QString
Literal
(
"brick"
)))
{
if
((
count
==
0
)
&&
(
QLatin1String
(
keyTable
[
index
].
picKey
)
!=
Q
Latin1
String
(
"brick"
)))
{
return
count
;
}
...
...
src/kgrselector.cpp
View file @
7a48cb9c
...
...
@@ -448,7 +448,7 @@ void KGrSLDialog::slGame()
}
// Else use the last level played in the selected game (from KConfig).
else
{
lev
=
gameGroup
.
readEntry
(
QString
Literal
(
"Level_"
)
+
myGameList
.
at
(
n
)
->
prefix
,
1
);
lev
=
gameGroup
.
readEntry
(
Q
Latin1
String
(
"Level_"
)
+
myGameList
.
at
(
n
)
->
prefix
,
1
);
number
->
setValue
(
lev
);
// Else use level 1.
}
break
;
...
...
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