Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
List
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
fallenstardust
YGOMobile
Commits
1cda9341
Commit
1cda9341
authored
Mar 11, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
为debugMessage添加卡名显示
对查找不到的卡名显示的卡隐藏添加的???
parent
6f00d739
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
10 deletions
+44
-10
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+44
-10
No files found.
Classes/gframe/game.cpp
View file @
1cda9341
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
#include "netserver.h"
#include "netserver.h"
#include "single_mode.h"
#include "single_mode.h"
#include <thread>
#include <thread>
#include <string>
#include <regex>
#ifdef _IRR_ANDROID_PLATFORM_
#ifdef _IRR_ANDROID_PLATFORM_
#include <android/CAndroidGUIEditBox.h>
#include <android/CAndroidGUIEditBox.h>
#include <android/CAndroidGUIComboBox.h>
#include <android/CAndroidGUIComboBox.h>
...
@@ -2064,17 +2066,49 @@ void Game::ClearChatMsg() {
...
@@ -2064,17 +2066,49 @@ void Game::ClearChatMsg() {
chatTiming
[
i
]
=
0
;
chatTiming
[
i
]
=
0
;
}
}
}
}
std
::
string
WCharToUTF8
(
const
wchar_t
*
input
)
{
std
::
string
output
;
if
(
input
==
nullptr
)
return
output
;
char
buffer
[
1024
];
wcstombs
(
buffer
,
input
,
1024
);
output
=
buffer
;
return
output
;
}
void
Game
::
AddDebugMsg
(
const
char
*
msg
)
{
void
Game
::
AddDebugMsg
(
const
char
*
msg
)
{
if
(
enable_log
&
0x1
)
{
std
::
string
message
(
msg
);
wchar_t
wbuf
[
1024
];
unsigned
int
cardID
=
0
;
BufferIO
::
DecodeUTF8
(
msg
,
wbuf
);
std
::
regex
cardIdPattern
(
R"((\d{8}))"
);
AddChatMsg
(
wbuf
,
9
);
auto
words_begin
=
std
::
sregex_iterator
(
message
.
begin
(),
message
.
end
(),
cardIdPattern
);
}
auto
words_end
=
std
::
sregex_iterator
();
if
(
enable_log
&
0x2
)
{
for
(
std
::
sregex_iterator
i
=
words_begin
;
i
!=
words_end
;
++
i
)
{
char
msgbuf
[
1040
];
std
::
smatch
match
=
*
i
;
std
::
snprintf
(
msgbuf
,
sizeof
msgbuf
,
"[Script Error]: %s"
,
msg
);
cardID
=
std
::
stoul
(
match
.
str
());
ErrorLog
(
msgbuf
);
break
;
}
}
std
::
string
cardName
=
"Unknown"
;
if
(
cardID
!=
0
)
{
cardName
=
WCharToUTF8
(
dataManager
.
GetName
(
cardID
));
}
std
::
string
fullMsg
;
if
(
cardID
!=
0
&&
cardName
!=
"???"
)
{
fullMsg
+=
cardName
;
fullMsg
+=
":"
;
}
else
{
fullMsg
+=
""
;
}
fullMsg
+=
message
;
if
(
enable_log
&
0x1
)
{
wchar_t
wbuf
[
1024
];
BufferIO
::
DecodeUTF8
(
fullMsg
.
c_str
(),
wbuf
);
AddChatMsg
(
wbuf
,
9
);
}
if
(
enable_log
&
0x2
)
{
char
msgbuf
[
1040
];
std
::
snprintf
(
msgbuf
,
sizeof
msgbuf
,
"[Script Error]: %s"
,
fullMsg
.
c_str
());
ErrorLog
(
msgbuf
);
}
}
}
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
FILE
*
fp
=
std
::
fopen
(
"error.log"
,
"at"
);
FILE
*
fp
=
std
::
fopen
(
"error.log"
,
"at"
);
...
...
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