-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab06e1e
commit 467aafd
Showing
12 changed files
with
97 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
#include "../../pch.h" | ||
#include "JassHandle.h" | ||
|
||
|
||
JassHandle::operator bool() | ||
{ | ||
return handle; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,7 @@ struct JassHandle | |
{ | ||
HObject handle; | ||
JassHandle(HObject const &handle) : handle(handle) { } | ||
|
||
operator bool(); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include "../../pch.h" | ||
#include "JassHero.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
#include "JassUnit.h" | ||
struct JassHero : public JassUnit | ||
{ | ||
JassHero(HUnit handle) : JassUnit(handle) { } | ||
JassHero(JassUnit unit) : JassUnit(nullptr) { | ||
if (unit.IsType(UNIT_TYPE::HERO)) | ||
handle = unit.handle; | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,45 @@ | ||
#include "../../pch.h" | ||
#include "JassUnitGroup.h" | ||
#include "../func_call.h" | ||
|
||
JassUnitGroup JassUnitGroup::Create() | ||
{ | ||
return CallFn<HGroup>("CreateGroup"); | ||
} | ||
|
||
void JassUnitGroup::Destroy() | ||
{ | ||
CallFn<void>("DestroyGroup", handle); | ||
} | ||
|
||
JassUnit JassUnitGroup::FirstUnit() | ||
{ | ||
return CallFn<HUnit>("FirstOfGroup", handle); | ||
} | ||
|
||
JassUnitGroup& JassUnitGroup::ForEach(std::function<void(JassUnit)> const& action) | ||
{ | ||
CallFn<void>("ForGroup", handle, [action]() { | ||
action(JassUnit::EnumUnit()); | ||
}); | ||
return *this; | ||
} | ||
|
||
JassUnitGroup& JassUnitGroup::Clear() | ||
{ | ||
CallFn<void>("GroupClear", handle); | ||
return *this; | ||
} | ||
|
||
JassUnitGroup& JassUnitGroup::PushBack(JassUnit unit) | ||
{ | ||
CallFn<void>("GroupAddUnit", handle, unit.handle); | ||
return *this; | ||
} | ||
|
||
size_t JassUnitGroup::Size() | ||
{ | ||
size_t ret_val = 0; | ||
this->ForEach([&](JassUnit){ ret_val++; }); | ||
return ret_val; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
#pragma once | ||
#include "JassHandle.h" | ||
#include "JassUnit.h" | ||
struct JassUnitGroup : public JassHandle | ||
{ | ||
JassUnitGroup(HObject handle) : JassHandle(handle) { } | ||
|
||
JassUnitGroup Create(); | ||
void Destroy(); | ||
|
||
JassUnit FirstUnit(); | ||
JassUnitGroup& ForEach(std::function<void(JassUnit)> const& action); | ||
JassUnitGroup& Clear(); | ||
JassUnitGroup& PushBack(JassUnit unit); | ||
size_t Size(); | ||
}; | ||
|