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
2b983ec5
Commit
2b983ec5
authored
6 years ago
by
David Bergström
Browse files
Options
Downloads
Patches
Plain Diff
Add code for researching an upgrade
parent
61847563
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
python-api-src/lib_unit.cpp
+1
-0
1 addition, 0 deletions
python-api-src/lib_unit.cpp
src/Unit.cpp
+6
-0
6 additions, 0 deletions
src/Unit.cpp
src/Unit.h
+1
-0
1 addition, 0 deletions
src/Unit.h
with
8 additions
and
0 deletions
python-api-src/lib_unit.cpp
+
1
−
0
View file @
2b983ec5
...
@@ -37,6 +37,7 @@ void define_unit(py::module & m)
...
@@ -37,6 +37,7 @@ void define_unit(py::module & m)
.
def
(
"build_target"
,
&
Unit
::
buildTarget
)
.
def
(
"build_target"
,
&
Unit
::
buildTarget
)
.
def
(
"train"
,
&
Unit
::
train
)
.
def
(
"train"
,
&
Unit
::
train
)
.
def
(
"morph"
,
&
Unit
::
morph
)
.
def
(
"morph"
,
&
Unit
::
morph
)
.
def
(
"research"
,
&
Unit
::
research
)
.
def
(
"__hash__"
,
[](
const
Unit
&
unit
)
{
return
std
::
hash
<
const
sc2
::
Unit
*>
{}(
unit
.
getUnitPtr
());
})
.
def
(
"__hash__"
,
[](
const
Unit
&
unit
)
{
return
std
::
hash
<
const
sc2
::
Unit
*>
{}(
unit
.
getUnitPtr
());
})
.
def
(
py
::
self
==
py
::
self
)
.
def
(
py
::
self
==
py
::
self
)
.
def
(
"__repr__"
,
[](
const
Unit
&
unit
)
{
return
"<Unit of type: '"
+
unit
.
getType
().
getName
()
+
"'>"
;
});
.
def
(
"__repr__"
,
[](
const
Unit
&
unit
)
{
return
"<Unit of type: '"
+
unit
.
getType
().
getName
()
+
"'>"
;
});
...
...
This diff is collapsed.
Click to expand it.
src/Unit.cpp
+
6
−
0
View file @
2b983ec5
...
@@ -298,6 +298,12 @@ void Unit::morph(const UnitType & type) const
...
@@ -298,6 +298,12 @@ void Unit::morph(const UnitType & type) const
#endif
#endif
}
}
void
Unit
::
research
(
sc2
::
UpgradeID
upgrade
)
const
{
BOT_ASSERT
(
isValid
(),
"Unit is not valid"
);
m_bot
->
Actions
()
->
UnitCommand
(
m_unit
,
m_bot
->
Data
(
upgrade
).
buildAbility
);
}
bool
Unit
::
isConstructing
(
const
UnitType
&
type
)
const
bool
Unit
::
isConstructing
(
const
UnitType
&
type
)
const
{
{
sc2
::
AbilityID
buildAbility
=
m_bot
->
Data
(
type
).
buildAbility
;
sc2
::
AbilityID
buildAbility
=
m_bot
->
Data
(
type
).
buildAbility
;
...
...
This diff is collapsed.
Click to expand it.
src/Unit.h
+
1
−
0
View file @
2b983ec5
...
@@ -58,4 +58,5 @@ public:
...
@@ -58,4 +58,5 @@ public:
void
buildTarget
(
const
UnitType
&
buildingType
,
const
Unit
&
target
)
const
;
void
buildTarget
(
const
UnitType
&
buildingType
,
const
Unit
&
target
)
const
;
void
train
(
const
UnitType
&
buildingType
)
const
;
void
train
(
const
UnitType
&
buildingType
)
const
;
void
morph
(
const
UnitType
&
type
)
const
;
void
morph
(
const
UnitType
&
type
)
const
;
void
research
(
sc2
::
UpgradeID
upgrade
)
const
;
};
};
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