-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapUnit.cpp
More file actions
41 lines (41 loc) · 990 Bytes
/
MapUnit.cpp
File metadata and controls
41 lines (41 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include"MapUnit.h"
void MapUnit::Show(std::ostream &os)const
{
os<<name_<<" type="<<type_<<", id="<<id_<<", owner="<<owner_<<", cost="<<cost_;
}
std::ostream& operator <<(std::ostream &os,const MapUnit &mu)
{
mu.Show(os);
return os;
}
void Upgradable::Show(std::ostream &os)const
{
MapUnit::Show(os);
os<<", level="<<level_<<", upgradeCost="<<upgradeCost_<<", find=";
for(auto it=fineList_.begin();it!=fineList_.end();it++)
{
os<<*it<<" ";
}
os<<std::endl;
}
void Collectable::Show(std::ostream &os)const
{
MapUnit::Show(os);
os<<fine_<<std::endl;
}
void Collectable::SetOwner(int playerID)
{
MapUnit::SetOwner(playerID);
playerCollected_[playerID]+=1;
}
int Collectable::playerCollected_[maxPlayers]={};
void RandomCost::Show(std::ostream &os)const
{
MapUnit::Show(os);
os<<fine_<<std::endl;
}
void Jail::Show(std::ostream &os)const
{
MapUnit::Show(os);
os<<std::endl;
}