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
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
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
Edvin Bergström
PyCommandCenter
Commits
7f5eb81c
Commit
7f5eb81c
authored
3 years ago
by
Rojikku98
Browse files
Options
Downloads
Patches
Plain Diff
Added on_game_end and asve replay
parent
a632c71a
No related branches found
No related tags found
No related merge requests found
Pipeline
#64283
passed
3 years ago
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
python-api-src/library.cpp
+2
-0
2 additions, 0 deletions
python-api-src/library.cpp
python-api-src/library.h
+9
-0
9 additions, 0 deletions
python-api-src/library.h
src/IDABot.cpp
+4
-0
4 additions, 0 deletions
src/IDABot.cpp
src/IDABot.h
+2
-0
2 additions, 0 deletions
src/IDABot.h
with
17 additions
and
0 deletions
python-api-src/library.cpp
+
2
−
0
View file @
7f5eb81c
...
@@ -83,6 +83,7 @@ PYBIND11_MODULE(library, m)
...
@@ -83,6 +83,7 @@ PYBIND11_MODULE(library, m)
.
def
(
py
::
init
())
.
def
(
py
::
init
())
.
def
(
"on_game_start"
,
&
IDABot
::
OnGameStart
)
.
def
(
"on_game_start"
,
&
IDABot
::
OnGameStart
)
.
def
(
"on_step"
,
&
IDABot
::
OnStep
)
.
def
(
"on_step"
,
&
IDABot
::
OnStep
)
.
def
(
"on_game_end"
,
&
IDABot
::
OnGameEnd
)
.
def
(
"send_chat"
,
&
IDABot
::
SendChat
,
"Sends the string 'message' to the game chat"
,
"message"
_a
)
.
def
(
"send_chat"
,
&
IDABot
::
SendChat
,
"Sends the string 'message' to the game chat"
,
"message"
_a
)
.
def
(
"get_all_units"
,
&
IDABot
::
GetAllUnits
,
"Returns a list of all visible units, including minerals and geysers"
)
.
def
(
"get_all_units"
,
&
IDABot
::
GetAllUnits
,
"Returns a list of all visible units, including minerals and geysers"
)
.
def
(
"get_my_units"
,
&
IDABot
::
GetMyUnits
,
"Returns a list of all your units"
)
.
def
(
"get_my_units"
,
&
IDABot
::
GetMyUnits
,
"Returns a list of all your units"
)
...
@@ -113,6 +114,7 @@ PYBIND11_MODULE(library, m)
...
@@ -113,6 +114,7 @@ PYBIND11_MODULE(library, m)
.
def
(
"upgrade_gas_cost"
,
&
IDABot
::
UpgradeGasCost
,
"Vespene/gas cost of researching the upgrade"
,
"upgrade"
_a
)
.
def
(
"upgrade_gas_cost"
,
&
IDABot
::
UpgradeGasCost
,
"Vespene/gas cost of researching the upgrade"
,
"upgrade"
_a
)
.
def
(
"upgrade_research_time"
,
&
IDABot
::
UpgradeResearchTime
,
"Time in GameLoops to research this upgrade"
,
"upgrade"
_a
)
.
def
(
"upgrade_research_time"
,
&
IDABot
::
UpgradeResearchTime
,
"Time in GameLoops to research this upgrade"
,
"upgrade"
_a
)
.
def
(
"effect_radius"
,
&
IDABot
::
RadiusEffect
,
"Size of the circle the effect impacts"
,
"effect"
_a
)
.
def
(
"effect_radius"
,
&
IDABot
::
RadiusEffect
,
"Size of the circle the effect impacts"
,
"effect"
_a
)
.
def
(
"save_replay"
,
&
IDABot
::
SaveReplay
,
"Saves the game as a replay"
,
"path"
_a
)
.
def_property_readonly
(
"base_location_manager"
,
&
IDABot
::
Bases
,
"An instance of the class :class:`library.BaseLocationManager`"
)
.
def_property_readonly
(
"base_location_manager"
,
&
IDABot
::
Bases
,
"An instance of the class :class:`library.BaseLocationManager`"
)
.
def_property_readonly
(
"tech_tree"
,
&
IDABot
::
GetTechTree
,
"An instance of the class :class:`library.TechTree`"
)
.
def_property_readonly
(
"tech_tree"
,
&
IDABot
::
GetTechTree
,
"An instance of the class :class:`library.TechTree`"
)
.
def_property_readonly
(
"map_tools"
,
&
IDABot
::
Map
,
"An instance of the class :class:`library.MapTools`"
)
.
def_property_readonly
(
"map_tools"
,
&
IDABot
::
Map
,
"An instance of the class :class:`library.MapTools`"
)
...
...
This diff is collapsed.
Click to expand it.
python-api-src/library.h
+
9
−
0
View file @
7f5eb81c
...
@@ -60,6 +60,15 @@ public:
...
@@ -60,6 +60,15 @@ public:
OnStep
OnStep
);
);
}
}
void
OnGameEnd
()
override
{
PYBIND11_OVERLOAD_NAME
(
void
,
IDABot
,
"on_game_end"
,
OnGameEnd
);
}
};
};
...
...
This diff is collapsed.
Click to expand it.
src/IDABot.cpp
+
4
−
0
View file @
7f5eb81c
...
@@ -403,4 +403,8 @@ const sc2::GameResult IDABot::GetPlayerResults() const {
...
@@ -403,4 +403,8 @@ const sc2::GameResult IDABot::GetPlayerResults() const {
}
}
std
::
cout
<<
"The player can not be found"
<<
std
::
endl
;
std
::
cout
<<
"The player can not be found"
<<
std
::
endl
;
return
sc2
::
GameResult
::
Undecided
;
return
sc2
::
GameResult
::
Undecided
;
}
bool
IDABot
::
SaveReplay
(
const
std
::
string
&
path
)
{
return
this
->
Control
()
->
SaveReplay
(
path
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/IDABot.h
+
2
−
0
View file @
7f5eb81c
...
@@ -97,6 +97,8 @@ public:
...
@@ -97,6 +97,8 @@ public:
const
sc2
::
GameResult
GetPlayerResults
()
const
;
const
sc2
::
GameResult
GetPlayerResults
()
const
;
bool
SaveReplay
(
const
std
::
string
&
path
);
// Not needed, just convenience functions
// Not needed, just convenience functions
...
...
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