Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cpp-project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Maul
cpp-project
Commits
f2d23048
Commit
f2d23048
authored
6 months ago
by
Fdai7401
Browse files
Options
Downloads
Patches
Plain Diff
First iteration of buidling
parent
762f668a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/building.hpp
+59
-3
59 additions, 3 deletions
src/building.hpp
with
59 additions
and
3 deletions
src/building.hpp
+
59
−
3
View file @
f2d23048
#ifndef BUILDING_HPP
#ifndef BUILDING_HPP
#define BUILDING_HPP
#define BUILDING_HPP
#include
<vector>
#include
<string>
#include
<map>
enum
class
BuildingFaction
{
None
=
0
,
Player1
,
Player2
,
Player3
,
Player4
};
enum
class
BuildingType
{
Capital
=
0
,
City
,
Factory
,
Airport
,
Seaport
}
class
Building
{
class
Building
{
public:
public:
Building
(
int
x
,
int
y
);
Building
(
int
x
,
int
y
,
BuildingFaction
bFaction
,
int
buildingHealth
,
BuildingType
bType
);
virtual
~
Building
()
=
default
;
// Getters/Setters
int
getX
()
const
{
return
x
;
}
int
getY
()
const
{
return
y
;
}
// ...
// ...
private
:
private
:
// Position
// Position
int
x
;
int
x
;
int
y
;
int
y
;
};
int
buildingHealth
;
BuildingType
bType
;
// for capturing
bool
capturable
;
int
captureProgress
;
// Fortschritt der Eroberung (0,1,2)
int
captureThreshold
;
BuildingFaction
bFaction
;
virtual
bool
isCapturable
();
virtual
bool
getUnitType
();
// to check if the unit is inf or any other viable type
int
getCaptureProgress
()
const
{
return
captureProgress
;
}
virtual
void
capture
(
BuildingFaction
newFaction
,
int
capturePoints
);
//start capture: HP of unit is
virtual
void
resetCapture
();
//reset health and stuff
// when clicked, start Interface stuff
virtual
void
on_Click
();
virtual
void
showBuildMenu
();
virtual
void
hideBuildMenu
();
//for recruiting
//check to see if enough monies and space available
virtual
bool
canRecruitUnit
(
const
std
::
string
&
unitName
)
const
;
virtual
bool
isSpawnPositionClear
()
const
;
virtual
bool
hasEnoughResources
(
int
cost
)
const
;
virtual
int
getUnitCost
(
const
std
::
string
&
unitName
)
const
;
virtual
bool
recruit_Unit
(
const
std
::
string
&
name
);
std
::
vector
<
std
::
string
>
recruitable_units
;
// buildable Units
std
::
map
<
std
::
string
,
int
>
unit_costs
;
};
#endif
#endif
\ No newline at end of file
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