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
b5bae3aa
Commit
b5bae3aa
authored
Apr 07, 2017
by
mercury233
Committed by
DailyShana
Apr 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update error logging (#1950)
parent
a0ef133c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
45 deletions
+25
-45
gframe/game.cpp
gframe/game.cpp
+20
-1
gframe/game.h
gframe/game.h
+1
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+1
-11
gframe/single_duel.cpp
gframe/single_duel.cpp
+1
-11
gframe/single_mode.cpp
gframe/single_mode.cpp
+1
-11
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+1
-11
No files found.
gframe/game.cpp
View file @
b5bae3aa
...
...
@@ -1104,7 +1104,7 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L"[System]: "
);
break
;
case
9
:
//error message
chatMsg
[
0
].
append
(
L"[Script
error:]
"
);
chatMsg
[
0
].
append
(
L"[Script
Error]:
"
);
break
;
default:
//from watcher or unknown
if
(
player
<
11
||
player
>
19
)
...
...
@@ -1112,6 +1112,25 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
}
chatMsg
[
0
].
append
(
msg
);
}
void
Game
::
AddDebugMsg
(
char
*
msg
)
{
if
(
enable_log
&
0x1
)
{
wchar_t
wbuf
[
1024
];
BufferIO
::
DecodeUTF8
(
msg
,
wbuf
);
mainGame
->
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
);
}
}
void
Game
::
ClearTextures
()
{
matManager
.
mCard
.
setTexture
(
0
,
0
);
mainGame
->
imgCard
->
setImage
(
0
);
...
...
gframe/game.h
View file @
b5bae3aa
...
...
@@ -104,6 +104,7 @@ public:
void
SaveConfig
();
void
ShowCardInfo
(
int
code
);
void
AddChatMsg
(
wchar_t
*
msg
,
int
player
);
void
AddDebugMsg
(
char
*
msgbuf
);
void
ClearTextures
();
void
CloseDuelWindow
();
...
...
gframe/replay_mode.cpp
View file @
b5bae3aa
...
...
@@ -855,17 +855,7 @@ int ReplayMode::MessageHandler(long fduel, int type) {
return
0
;
char
msgbuf
[
1024
];
get_log_message
(
fduel
,
(
byte
*
)
msgbuf
);
if
(
enable_log
==
1
)
{
wchar_t
wbuf
[
1024
];
BufferIO
::
DecodeUTF8
(
msgbuf
,
wbuf
);
mainGame
->
AddChatMsg
(
wbuf
,
9
);
}
else
if
(
enable_log
==
2
)
{
FILE
*
fp
=
fopen
(
"error.log"
,
"at"
);
if
(
!
fp
)
return
0
;
fprintf
(
fp
,
"[Script error:] %s
\n
"
,
msgbuf
);
fclose
(
fp
);
}
mainGame
->
AddDebugMsg
(
msgbuf
);
return
0
;
}
...
...
gframe/single_duel.cpp
View file @
b5bae3aa
...
...
@@ -1474,17 +1474,7 @@ int SingleDuel::MessageHandler(long fduel, int type) {
return
0
;
char
msgbuf
[
1024
];
get_log_message
(
fduel
,
(
byte
*
)
msgbuf
);
if
(
enable_log
==
1
)
{
wchar_t
wbuf
[
1024
];
BufferIO
::
DecodeUTF8
(
msgbuf
,
wbuf
);
mainGame
->
AddChatMsg
(
wbuf
,
9
);
}
else
if
(
enable_log
==
2
)
{
FILE
*
fp
=
fopen
(
"error.log"
,
"at"
);
if
(
!
fp
)
return
0
;
fprintf
(
fp
,
"[Script error:] %s
\n
"
,
msgbuf
);
fclose
(
fp
);
}
mainGame
->
AddDebugMsg
(
msgbuf
);
return
0
;
}
void
SingleDuel
::
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
)
{
...
...
gframe/single_mode.cpp
View file @
b5bae3aa
...
...
@@ -828,17 +828,7 @@ int SingleMode::MessageHandler(long fduel, int type) {
return
0
;
char
msgbuf
[
1024
];
get_log_message
(
fduel
,
(
byte
*
)
msgbuf
);
if
(
enable_log
==
1
)
{
wchar_t
wbuf
[
1024
];
BufferIO
::
DecodeUTF8
(
msgbuf
,
wbuf
);
mainGame
->
AddChatMsg
(
wbuf
,
9
);
}
else
if
(
enable_log
==
2
)
{
FILE
*
fp
=
fopen
(
"error.log"
,
"at"
);
if
(
!
fp
)
return
0
;
fprintf
(
fp
,
"[Script error:] %s
\n
"
,
msgbuf
);
fclose
(
fp
);
}
mainGame
->
AddDebugMsg
(
msgbuf
);
return
0
;
}
...
...
gframe/tag_duel.cpp
View file @
b5bae3aa
...
...
@@ -1581,17 +1581,7 @@ int TagDuel::MessageHandler(long fduel, int type) {
return
0
;
char
msgbuf
[
1024
];
get_log_message
(
fduel
,
(
byte
*
)
msgbuf
);
if
(
enable_log
==
1
)
{
wchar_t
wbuf
[
1024
];
BufferIO
::
DecodeUTF8
(
msgbuf
,
wbuf
);
mainGame
->
AddChatMsg
(
wbuf
,
9
);
}
else
if
(
enable_log
==
2
)
{
FILE
*
fp
=
fopen
(
"error.log"
,
"at"
);
if
(
!
fp
)
return
0
;
fprintf
(
fp
,
"[Script error:] %s
\n
"
,
msgbuf
);
fclose
(
fp
);
}
mainGame
->
AddDebugMsg
(
msgbuf
);
return
0
;
}
void
TagDuel
::
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
)
{
...
...
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