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
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
REIKAI
ygopro
Commits
55671750
Commit
55671750
authored
Nov 15, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test regex
parent
e8530165
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
3 deletions
+26
-3
gframe/client_field.cpp
gframe/client_field.cpp
+2
-2
gframe/data_manager.cpp
gframe/data_manager.cpp
+2
-1
gframe/deck_con.cpp
gframe/deck_con.cpp
+3
-0
gframe/game.cpp
gframe/game.cpp
+17
-0
gframe/game.h
gframe/game.h
+2
-0
No files found.
gframe/client_field.cpp
View file @
55671750
...
...
@@ -1477,7 +1477,7 @@ void ClientField::UpdateDeclarableCodeType(bool enter) {
return
;
}
for
(
auto
cit
=
dataManager
.
_strings
.
begin
();
cit
!=
dataManager
.
_strings
.
end
();
++
cit
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
||
mainGame
->
CheckRegEx
(
cit
->
second
.
name
,
pname
,
true
)
)
{
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
//verified by _strings
//datas.alias can be double card names or alias
if
(
is_declarable
(
cp
->
second
,
declarable_type
))
{
...
...
@@ -1524,7 +1524,7 @@ void ClientField::UpdateDeclarableCodeOpcode(bool enter) {
return
;
}
for
(
auto
cit
=
dataManager
.
_strings
.
begin
();
cit
!=
dataManager
.
_strings
.
end
();
++
cit
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
||
mainGame
->
CheckRegEx
(
cit
->
second
.
name
,
pname
)
)
{
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
//verified by _strings
//datas.alias can be double card names or alias
if
(
is_declarable
(
cp
->
second
,
opcode
))
{
...
...
gframe/data_manager.cpp
View file @
55671750
#include "data_manager.h"
#include "game.h"
#include <stdio.h>
namespace
ygo
{
...
...
@@ -189,7 +190,7 @@ const wchar_t* DataManager::GetSetName(int code) {
unsigned
int
DataManager
::
GetSetCode
(
const
wchar_t
*
setname
)
{
for
(
auto
csit
=
_setnameStrings
.
begin
();
csit
!=
_setnameStrings
.
end
();
++
csit
)
{
auto
xpos
=
csit
->
second
.
find_first_of
(
L'|'
);
//setname|extra info
if
(
csit
->
second
.
compare
(
0
,
xpos
,
setname
)
==
0
)
if
(
csit
->
second
.
compare
(
0
,
xpos
,
setname
)
==
0
||
mainGame
->
CheckRegEx
(
csit
->
second
,
setname
)
)
return
csit
->
first
;
}
return
0
;
...
...
gframe/deck_con.cpp
View file @
55671750
...
...
@@ -944,6 +944,7 @@ void DeckBuilder::FilterCards() {
int
trycode
=
BufferIO
::
GetVal
(
elements_iterator
->
c_str
());
bool
tryresult
=
dataManager
.
GetData
(
trycode
,
0
);
if
(
!
tryresult
&&
!
CardNameContains
(
text
.
name
.
c_str
(),
elements_iterator
->
c_str
())
&&
text
.
text
.
find
(
elements_iterator
->
c_str
())
==
std
::
wstring
::
npos
&&
!
mainGame
->
CheckRegEx
(
text
.
text
,
elements_iterator
->
c_str
())
&&
(
!
set_code_map
[
*
elements_iterator
]
||
!
check_set_code
(
data
,
set_code_map
[
*
elements_iterator
])))
{
is_target
=
false
;
break
;
...
...
@@ -1059,6 +1060,8 @@ bool DeckBuilder::CardNameContains(const wchar_t *haystack, const wchar_t *needl
if
(
!
haystack
)
{
return
false
;
}
if
(
mainGame
->
CheckRegEx
(
haystack
,
needle
))
return
true
;
int
i
=
0
;
int
j
=
0
;
while
(
haystack
[
i
])
{
...
...
gframe/game.cpp
View file @
55671750
...
...
@@ -10,6 +10,7 @@
#include "netserver.h"
#include "single_mode.h"
#include <sstream>
#include <regex>
unsigned
short
PRO_VERSION
=
0x1346
;
...
...
@@ -2078,6 +2079,22 @@ void Game::takeScreenshot() {
}
else
device
->
getLogger
()
->
log
(
L"Failed to take screenshot."
,
irr
::
ELL_WARNING
);
}
bool
Game
::
CheckRegEx
(
const
wchar_t
*
text
,
const
wchar_t
*
exp
,
bool
exact
)
{
//if(std::wregex(exp) == NULL)
// return false;
if
(
exact
)
return
!!
std
::
regex_match
(
text
,
std
::
wregex
(
exp
));
else
return
!!
std
::
regex_search
(
text
,
std
::
wregex
(
exp
));
}
bool
Game
::
CheckRegEx
(
std
::
wstring
text
,
const
wchar_t
*
exp
,
bool
exact
)
{
//if(std::wregex(exp) == NULL)
// return false;
if
(
exact
)
return
!!
std
::
regex_match
(
text
,
std
::
wregex
(
exp
));
else
return
!!
std
::
regex_search
(
text
,
std
::
wregex
(
exp
));
}
const
char
*
Game
::
GetLocaleDir
(
const
char
*
dir
)
{
if
(
!
gameConf
.
locale
||
!
wcscmp
(
gameConf
.
locale
,
L"default"
))
return
dir
;
...
...
gframe/game.h
View file @
55671750
...
...
@@ -170,6 +170,8 @@ public:
int
LocalPlayer
(
int
player
);
const
wchar_t
*
LocalName
(
int
local_player
);
const
char
*
GetLocaleDir
(
const
char
*
dir
);
bool
CheckRegEx
(
const
wchar_t
*
text
,
const
wchar_t
*
exp
,
bool
exact
=
false
);
bool
CheckRegEx
(
std
::
wstring
text
,
const
wchar_t
*
exp
,
bool
exact
=
false
);
bool
HasFocus
(
EGUI_ELEMENT_TYPE
type
)
const
{
irr
::
gui
::
IGUIElement
*
focus
=
env
->
getFocus
();
...
...
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