Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-2pick
Commits
f98d197e
Commit
f98d197e
authored
Jun 11, 2015
by
salix5
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1400 from james-johns/crosscompatlinux
Maintain cross-platform compatibility
parents
d9bd86f1
5188fe69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
gframe/game.cpp
gframe/game.cpp
+26
-2
No files found.
gframe/game.cpp
View file @
f98d197e
...
@@ -8,9 +8,10 @@
...
@@ -8,9 +8,10 @@
#include "duelclient.h"
#include "duelclient.h"
#include "netserver.h"
#include "netserver.h"
#include "single_mode.h"
#include "single_mode.h"
#include <io.h>
#ifndef WIN32
#ifdef _WIN32
#include <io.h>
#else
#include <sys/types.h>
#include <sys/types.h>
#include <dirent.h>
#include <dirent.h>
#endif
#endif
...
@@ -22,9 +23,11 @@ namespace ygo {
...
@@ -22,9 +23,11 @@ namespace ygo {
Game
*
mainGame
;
Game
*
mainGame
;
bool
Game
::
Initialize
()
{
bool
Game
::
Initialize
()
{
#ifdef _WIN32
_finddata_t
fdata
;
_finddata_t
fdata
;
long
fhandle
;
long
fhandle
;
char
fpath
[
1000
]
=
"./expansions/"
;
char
fpath
[
1000
]
=
"./expansions/"
;
#endif
srand
(
time
(
0
));
srand
(
time
(
0
));
LoadConfig
();
LoadConfig
();
irr
::
SIrrlichtCreationParameters
params
=
irr
::
SIrrlichtCreationParameters
();
irr
::
SIrrlichtCreationParameters
params
=
irr
::
SIrrlichtCreationParameters
();
...
@@ -60,6 +63,7 @@ bool Game::Initialize() {
...
@@ -60,6 +63,7 @@ bool Game::Initialize() {
return
false
;
return
false
;
if
(
!
dataManager
.
LoadStrings
(
"strings.conf"
))
if
(
!
dataManager
.
LoadStrings
(
"strings.conf"
))
return
false
;
return
false
;
#ifdef _WIN32
fhandle
=
_findfirst
(
"./expansions/*.cdb"
,
&
fdata
);
fhandle
=
_findfirst
(
"./expansions/*.cdb"
,
&
fdata
);
if
(
fhandle
!=
-
1
)
{
if
(
fhandle
!=
-
1
)
{
strcat
(
fpath
,
fdata
.
name
);
strcat
(
fpath
,
fdata
.
name
);
...
@@ -71,6 +75,26 @@ bool Game::Initialize() {
...
@@ -71,6 +75,26 @@ bool Game::Initialize() {
}
}
_findclose
(
fhandle
);
_findclose
(
fhandle
);
}
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
const
char
*
foldername
=
"./expansions/"
;
if
((
dir
=
opendir
(
foldername
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".cdb"
)
!=
0
)
continue
;
char
*
filepath
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
len
+
strlen
(
foldername
)));
strncpy
(
filepath
,
foldername
,
strlen
(
foldername
)
+
1
);
strncat
(
filepath
,
dirp
->
d_name
,
len
);
std
::
cout
<<
"Found file "
<<
filepath
<<
std
::
endl
;
if
(
!
dataManager
.
LoadDB
(
filepath
))
std
::
cout
<<
"Error loading file"
<<
std
::
endl
;
free
(
filepath
);
}
closedir
(
dir
);
}
#endif
env
=
device
->
getGUIEnvironment
();
env
=
device
->
getGUIEnvironment
();
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
adFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
12
);
adFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
12
);
...
...
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