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
bf2f7d2c
Commit
bf2f7d2c
authored
6 years ago
by
GabrielTofvesson
Browse files
Options
Downloads
Patches
Plain Diff
Added search count to building placer (default is 1000: same as it was before)
parent
04e78348
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_building_placer.cpp
+1
-1
1 addition, 1 deletion
python-api-src/lib_building_placer.cpp
src/BuildingPlacer.cpp
+2
-2
2 additions, 2 deletions
src/BuildingPlacer.cpp
src/BuildingPlacer.h
+1
-1
1 addition, 1 deletion
src/BuildingPlacer.h
with
4 additions
and
4 deletions
python-api-src/lib_building_placer.cpp
+
1
−
1
View file @
bf2f7d2c
...
@@ -7,7 +7,7 @@ void define_building_placer(py::module & m)
...
@@ -7,7 +7,7 @@ void define_building_placer(py::module & m)
py
::
class_
<
BuildingPlacer
>
(
m
,
"BuildingPlacer"
)
py
::
class_
<
BuildingPlacer
>
(
m
,
"BuildingPlacer"
)
.
def
(
"can_build_here"
,
&
BuildingPlacer
::
canBuildHere
,
"x"
_a
,
"y"
_a
,
"unit_type"
_a
)
.
def
(
"can_build_here"
,
&
BuildingPlacer
::
canBuildHere
,
"x"
_a
,
"y"
_a
,
"unit_type"
_a
)
.
def
(
"can_build_here_with_spaces"
,
&
BuildingPlacer
::
canBuildHereWithSpace
,
"x"
_a
,
"y"
_a
,
"unit_type"
_a
,
"build_distance"
_a
)
.
def
(
"can_build_here_with_spaces"
,
&
BuildingPlacer
::
canBuildHereWithSpace
,
"x"
_a
,
"y"
_a
,
"unit_type"
_a
,
"build_distance"
_a
)
.
def
(
"get_build_location_near"
,
&
BuildingPlacer
::
getBuildLocationNear
,
"point2di"
_a
,
"unit_type"
_a
,
"build_distance"
_a
=
2
)
.
def
(
"get_build_location_near"
,
&
BuildingPlacer
::
getBuildLocationNear
,
"point2di"
_a
,
"unit_type"
_a
,
"build_distance"
_a
=
2
,
"search_count"
_a
=
1000
)
.
def
(
"reserve_tiles"
,
&
BuildingPlacer
::
reserveTiles
,
"x"
_a
,
"y"
_a
,
"width"
_a
,
"height"
_a
)
.
def
(
"reserve_tiles"
,
&
BuildingPlacer
::
reserveTiles
,
"x"
_a
,
"y"
_a
,
"width"
_a
,
"height"
_a
)
.
def
(
"free_tiles"
,
&
BuildingPlacer
::
freeTiles
,
"x"
_a
,
"y"
_a
,
"width"
_a
,
"height"
_a
);
.
def
(
"free_tiles"
,
&
BuildingPlacer
::
freeTiles
,
"x"
_a
,
"y"
_a
,
"width"
_a
,
"height"
_a
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/BuildingPlacer.cpp
+
2
−
2
View file @
bf2f7d2c
...
@@ -95,7 +95,7 @@ bool BuildingPlacer::canBuildHereWithSpace(int bx, int by, const UnitType & type
...
@@ -95,7 +95,7 @@ bool BuildingPlacer::canBuildHereWithSpace(int bx, int by, const UnitType & type
return
true
;
return
true
;
}
}
CCTilePosition
BuildingPlacer
::
getBuildLocationNear
(
const
CCTilePosition
&
p
,
const
UnitType
&
t
,
int
buildDist
)
const
CCTilePosition
BuildingPlacer
::
getBuildLocationNear
(
const
CCTilePosition
&
p
,
const
UnitType
&
t
,
int
buildDist
,
int
search_count
)
const
{
{
//Timer t;
//Timer t;
//t.start();
//t.start();
...
@@ -106,7 +106,7 @@ CCTilePosition BuildingPlacer::getBuildLocationNear(const CCTilePosition & p, co
...
@@ -106,7 +106,7 @@ CCTilePosition BuildingPlacer::getBuildLocationNear(const CCTilePosition & p, co
//double ms1 = t.getElapsedTimeInMilliSec();
//double ms1 = t.getElapsedTimeInMilliSec();
// iterate through the list until we've found a suitable location
// iterate through the list until we've found a suitable location
for
(
size_t
i
(
0
);
i
<
closestToBuilding
.
size
()
&&
i
<
1000
;
++
i
)
for
(
size_t
i
(
0
);
i
<
closestToBuilding
.
size
()
&&
(
i
<
0
or
i
<
search_count
)
;
++
i
)
{
{
auto
&
pos
=
closestToBuilding
[
i
];
auto
&
pos
=
closestToBuilding
[
i
];
...
...
This diff is collapsed.
Click to expand it.
src/BuildingPlacer.h
+
1
−
1
View file @
bf2f7d2c
...
@@ -29,7 +29,7 @@ public:
...
@@ -29,7 +29,7 @@ public:
bool
canBuildHereWithSpace
(
int
bx
,
int
by
,
const
UnitType
&
type
,
int
buildDist
)
const
;
bool
canBuildHereWithSpace
(
int
bx
,
int
by
,
const
UnitType
&
type
,
int
buildDist
)
const
;
// returns a build location near a building's desired location
// returns a build location near a building's desired location
CCTilePosition
getBuildLocationNear
(
const
CCTilePosition
&
p
,
const
UnitType
&
type
,
int
buildDist
)
const
;
CCTilePosition
getBuildLocationNear
(
const
CCTilePosition
&
p
,
const
UnitType
&
type
,
int
buildDist
,
int
search_count
)
const
;
void
drawReservedTiles
();
void
drawReservedTiles
();
...
...
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