Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
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
Commits
84200fa1
Commit
84200fa1
authored
Nov 03, 2018
by
mercury233
Committed by
DailyShana
Nov 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add errorlog on startup fail (#2154)
parent
8f435ab4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
14 deletions
+30
-14
gframe/game.cpp
gframe/game.cpp
+29
-14
gframe/game.h
gframe/game.h
+1
-0
No files found.
gframe/game.cpp
View file @
84200fa1
...
...
@@ -38,8 +38,10 @@ bool Game::Initialize() {
params
.
DriverType
=
irr
::
video
::
EDT_OPENGL
;
params
.
WindowSize
=
irr
::
core
::
dimension2d
<
u32
>
(
1024
,
640
);
device
=
irr
::
createDeviceEx
(
params
);
if
(
!
device
)
if
(
!
device
)
{
ErrorLog
(
"Failed to create Irrlicht Engine device!"
);
return
false
;
}
linePatternD3D
=
0
;
linePatternGL
=
0x0f0f
;
waitFrame
=
0
;
...
...
@@ -61,13 +63,19 @@ bool Game::Initialize() {
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_CREATE_MIP_MAPS
,
false
);
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_OPTIMIZED_FOR_QUALITY
,
true
);
imageManager
.
SetDevice
(
device
);
if
(
!
imageManager
.
Initial
())
if
(
!
imageManager
.
Initial
())
{
ErrorLog
(
"Failed to load textures!"
);
return
false
;
}
LoadExpansionDB
();
if
(
!
dataManager
.
LoadDB
(
"cards.cdb"
))
if
(
!
dataManager
.
LoadDB
(
"cards.cdb"
))
{
ErrorLog
(
"Failed to load card database (cards.cdb)!"
);
return
false
;
if
(
!
dataManager
.
LoadStrings
(
"strings.conf"
))
}
if
(
!
dataManager
.
LoadStrings
(
"strings.conf"
))
{
ErrorLog
(
"Failed to load strings!"
);
return
false
;
}
dataManager
.
LoadStrings
(
"./expansions/strings.conf"
);
env
=
device
->
getGUIEnvironment
();
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
...
...
@@ -75,8 +83,10 @@ bool Game::Initialize() {
lpcFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
48
);
guiFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
textfont
,
gameConf
.
textfontsize
);
textFont
=
guiFont
;
if
(
!
numFont
||
!
textFont
)
if
(
!
numFont
||
!
textFont
)
{
ErrorLog
(
"Failed to load font(s)!"
);
return
false
;
}
smgr
=
device
->
getSceneManager
();
device
->
setWindowCaption
(
L"YGOPro"
);
device
->
setResizable
(
false
);
...
...
@@ -1369,17 +1379,22 @@ void Game::AddDebugMsg(char* msg)
AddChatMsg
(
wbuf
,
9
);
}
if
(
enable_log
&
0x2
)
{
FILE
*
fp
=
fopen
(
"error.log"
,
"at"
);
if
(
!
fp
)
return
;
time_t
nowtime
=
time
(
NULL
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
char
timebuf
[
40
];
strftime
(
timebuf
,
40
,
"%Y-%m-%d %H:%M:%S"
,
localedtime
);
fprintf
(
fp
,
"[%s][Script Error]: %s
\n
"
,
timebuf
,
msg
);
fclose
(
fp
);
char
msgbuf
[
1040
];
sprintf
(
msgbuf
,
"[Script Error]: %s"
,
msg
);
ErrorLog
(
msgbuf
);
}
}
void
Game
::
ErrorLog
(
char
*
msg
)
{
FILE
*
fp
=
fopen
(
"error.log"
,
"at"
);
if
(
!
fp
)
return
;
time_t
nowtime
=
time
(
NULL
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
char
timebuf
[
40
];
strftime
(
timebuf
,
40
,
"%Y-%m-%d %H:%M:%S"
,
localedtime
);
fprintf
(
fp
,
"[%s]%s
\n
"
,
timebuf
,
msg
);
fclose
(
fp
);
}
bool
Game
::
MakeDirectory
(
const
std
::
string
folder
)
{
std
::
string
folder_builder
;
std
::
string
sub
;
...
...
gframe/game.h
View file @
84200fa1
...
...
@@ -135,6 +135,7 @@ public:
void
AddChatMsg
(
wchar_t
*
msg
,
int
player
);
void
ClearChatMsg
();
void
AddDebugMsg
(
char
*
msgbuf
);
void
ErrorLog
(
char
*
msgbuf
);
bool
MakeDirectory
(
const
std
::
string
folder
);
void
initUtils
();
void
ClearTextures
();
...
...
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