Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include "Gang.h"
- Gang::Property::Property() {
- }
- Gang::Property::~Property() {
- }
- void Gang::Property::initProperty() {
- cout << "Podaj miasto w ktorym znajduje sie posiadlosc : ";
- cin >> city;
- cout << "Podaj ulice : ";
- cin >> street;
- cout << "Podaj wartosc posiadlosci : ";
- cin >> valueProperty;
- }
- void Gang::Property::show()const {
- cout << "Miast : " << this->city << endl;
- cout << "Ulica : " << this->street << endl;
- cout << "Wartosc posiadlosci : " << this->valueProperty << endl;
- }
- Gang::Money::Money() {
- }
- Gang::Money::~Money() {
- }
- void Gang::Money::initMoney() {
- cout << "Podaj ilosc pieniedzy gangu : ";
- cin >> ammountMoney;
- }
- void Gang::Money::show()const {
- cout << "Ilosc pieniedzy : " << this->ammountMoney << endl;
- }
- Gang::Gang(){
- }
- Gang::~Gang(){
- }
- void Gang::initGang() {
- ptrBoss = new Boss;
- ptrBoss->initBoss();
- cout << "Podaj ilosc underbossow : ";
- cin >> sizeUndeboss;
- ptrUnderboss = new Underboss[sizeUndeboss];
- for (int i = 0; i < sizeUndeboss; i++) {
- ptrUnderboss[i].initUnderboss();
- }
- cout << "Podaj ilosc posiadlosci : " << endl;
- cin >> sizeProperty;
- ptrProperty = new Property[sizeProperty];
- for (int i = 0; i < sizeProperty; i++) {
- ptrProperty[i].initProperty();
- }
- money.initMoney();
- }
- void remove(Assassin *&ptr, int &size, int where) {
- }
- void Gang::removeUnderboss(int where) {
- if (sizeUndeboss == 0) {
- return;
- }
- Underboss *supPtrUnderboss = new Underboss[sizeUndeboss - 1];
- for (int i = 0; i < sizeUndeboss; i++) {
- if (i < where) {
- supPtrUnderboss[i] = ptrUnderboss[i];
- }
- else if (i == where) {
- }
- else {
- supPtrUnderboss[i - 1] = ptrUnderboss[i];
- }
- }
- delete[] ptrUnderboss;
- ptrUnderboss =supPtrUnderboss ;
- --sizeUndeboss;
- }
- //void Gang::addBoss(int where) {
- // Boss *sup_ptr = new Boss[sizeBoss + 1];
- //
- // for (int i = 0; i < sizeBoss + 1; i++) {
- //
- // if (i == where) {
- //
- // sup_ptr[i].initBoss();
- // }
- // else if (i > where) {
- // sup_ptr[i] = ptrBoss[i - 1];
- // }
- // else {
- // sup_ptr[i] = ptrBoss[i];
- // }
- //
- // }
- //
- //
- // delete[] ptrBoss;
- // ptrBoss = sup_ptr;
- // ++sizeBoss;
- //}
- void Gang::show()const {
- cout << "Dane : " << endl;
- for (int i = 0; i < sizeProperty; i++) {
- ptrProperty[i].show();
- }
- money.show();
- ptrBoss->show();
- for (int i = 0; i < sizeUndeboss; i++) {
- ptrUnderboss[i].show();
- }
- }
- void Gang::killBoss() {
- Consigliere *supPtrConsigliere = ptrBoss->getPtrConsigliere();
- delete ptrBoss;
- ptrBoss =new Boss(ptrUnderboss[0], supPtrConsigliere);
- removeUnderboss(0);
- }
- int Gang::getSizeBoss()const {
- return this->sizeBoss;
- }
- Boss * Gang::getPtrBoss()const {
- return this->ptrBoss;
- }
- Gang & Gang ::operator=(const Gang & g) {
- ptrBoss = new Boss;
- ptrBoss = g.ptrBoss;
- return *this;
- }
Add Comment
Please, Sign In to add comment