Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyCommandCenter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Starcraft AI Course
PyCommandCenter
Commits
e132326a
Commit
e132326a
authored
4 years ago
by
Rojikku98
Browse files
Options
Downloads
Patches
Plain Diff
Added player info
parent
408e8926
No related branches found
No related tags found
1 merge request
!6
Replays
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
python-api-src/library.cpp
+10
-0
10 additions, 0 deletions
python-api-src/library.cpp
src/IDAReplayObserver.cpp
+11
-11
11 additions, 11 deletions
src/IDAReplayObserver.cpp
src/IDAReplayObserver.h
+3
-1
3 additions, 1 deletion
src/IDAReplayObserver.h
with
24 additions
and
12 deletions
python-api-src/library.cpp
+
10
−
0
View file @
e132326a
...
@@ -100,8 +100,18 @@ PYBIND11_MODULE(library, m)
...
@@ -100,8 +100,18 @@ PYBIND11_MODULE(library, m)
.
def
(
"on_game_end"
,
&
IDAReplayObserver
::
OnGameEnd
)
.
def
(
"on_game_end"
,
&
IDAReplayObserver
::
OnGameEnd
)
.
def
(
"get_all_units"
,
&
IDAReplayObserver
::
GetAllUnits
,
"Returns a list of all units"
)
.
def
(
"get_all_units"
,
&
IDAReplayObserver
::
GetAllUnits
,
"Returns a list of all units"
)
.
def
(
"get_player_race"
,
&
IDAReplayObserver
::
GetPlayerRace
,
"player_id"
_a
)
.
def
(
"get_player_race"
,
&
IDAReplayObserver
::
GetPlayerRace
,
"player_id"
_a
)
.
def
(
"get_replay_path"
,
&
IDAReplayObserver
::
GetReplayPath
)
.
def
(
"get_result_for_player"
,
&
IDAReplayObserver
::
GetResultForPlayer
,
"player_id"
_a
)
;
;
py
::
enum_
<
sc2
::
GameResult
>
(
m
,
"GameResult"
)
.
value
(
"Win"
,
sc2
::
GameResult
::
Win
)
.
value
(
"Loss"
,
sc2
::
GameResult
::
Loss
)
.
value
(
"Tie"
,
sc2
::
GameResult
::
Tie
)
.
value
(
"Undecided"
,
sc2
::
GameResult
::
Undecided
);
py
::
class_
<
sc2
::
PlayerSetup
>
(
m
,
"PlayerSetup"
);
py
::
class_
<
sc2
::
PlayerSetup
>
(
m
,
"PlayerSetup"
);
py
::
enum_
<
sc2
::
Difficulty
>
(
m
,
"Difficulty"
)
py
::
enum_
<
sc2
::
Difficulty
>
(
m
,
"Difficulty"
)
...
...
This diff is collapsed.
Click to expand it.
src/IDAReplayObserver.cpp
+
11
−
11
View file @
e132326a
...
@@ -57,19 +57,19 @@ const std::vector<ReplayUnit>& IDAReplayObserver::GetAllUnits() const
...
@@ -57,19 +57,19 @@ const std::vector<ReplayUnit>& IDAReplayObserver::GetAllUnits() const
return
m_allUnits
;
return
m_allUnits
;
}
}
CCRace
IDAReplayObserver
::
GetPlayerRace
(
int
player
)
const
CCRace
IDAReplayObserver
::
GetPlayerRace
(
int
player
)
{
return
ReplayControl
()
->
GetReplayInfo
().
players
[
player
].
race
;
}
std
::
string
IDAReplayObserver
::
GetReplayPath
()
{
{
auto
playerID
=
Observation
()
->
GetPlayerID
();
return
ReplayControl
()
->
GetReplayInfo
().
replay_path
;
for
(
auto
&
playerInfo
:
Observation
()
->
GetGameInfo
().
player_info
)
}
{
if
(
playerInfo
.
player_id
==
playerID
)
{
return
playerInfo
.
race_actual
;
}
}
BOT_ASSERT
(
false
,
"Failed to find the player's race!"
);
sc2
::
GameResult
IDAReplayObserver
::
GetResultForPlayer
(
int
player
)
return
sc2
::
Race
::
Random
;
{
return
ReplayControl
()
->
GetReplayInfo
().
players
[
player
].
game_result
;
}
}
This diff is collapsed.
Click to expand it.
src/IDAReplayObserver.h
+
3
−
1
View file @
e132326a
...
@@ -25,7 +25,9 @@ public:
...
@@ -25,7 +25,9 @@ public:
ReplayUnit
GetUnit
(
const
CCUnitID
tag
)
const
;
ReplayUnit
GetUnit
(
const
CCUnitID
tag
)
const
;
const
std
::
vector
<
ReplayUnit
>
&
GetAllUnits
()
const
;
const
std
::
vector
<
ReplayUnit
>
&
GetAllUnits
()
const
;
CCRace
GetPlayerRace
(
int
player
)
const
;
CCRace
GetPlayerRace
(
int
player
);
std
::
string
GetReplayPath
();
sc2
::
GameResult
GetResultForPlayer
(
int
player
);
};
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment