Test/LAB3_BRULEZ_HUGUET_SERRE/X-BOTS/XBotManufacture.cpp
2022-03-03 15:44:04 +01:00

73 lines
No EOL
1.5 KiB
C++

//
// Created by jser on 09/12/2021.
//
#include "XBotManufacture.h"
XBOT* XBotManufacture::creerXBot(string id) {
XBOT *xbot;
if (id=="X212"){xbot = creerX212();}
else if (id =="X213"){xbot = creerX213();}
else if (id =="X215"){xbot = creerX215();}
else if (id =="R234"){xbot = creerR234();}
else if (id =="G990"){xbot = creerG990();}
else if (id =="W000"){xbot = creerW000();}
return xbot;
}
X212Adapter *XBotManufacture::creerX212() {
X212Adapter* x212;
x212 = new X212Adapter();
return x212;
}
X213Adapter *XBotManufacture::creerX213() {
X213Adapter* x213;
x213 = new X213Adapter();
return x213;
}
X215Adapter *XBotManufacture::creerX215() {
X215Adapter* x215;
x215 = new X215Adapter();
return x215;
}
R234Adapter *XBotManufacture::creerR234() {
R234Adapter* r234;
r234 = new R234Adapter();
return r234;
}
G990Adapter *XBotManufacture::creerG990() {
G990Adapter* g990;
g990 = new G990Adapter();
return g990;
}
W000Adapter *XBotManufacture::creerW000() {
W000Adapter* w000;
w000 = new W000Adapter();
return w000;
}
XBOT** XBotManufacture::creerEquipeXbot() {
srand(time(NULL));
XBOT** equipe = new XBOT*[10];
string choix[6] = {"X212", "X213", "X215", "R234", "G990", "W000"};
for (int i=0; i <= 9; i++){
equipe[i] = creerXBot(choix[rand()%6]);
}
return equipe;
}
XBotManufacture::~XBotManufacture() {
Compteur::ajouterDestructeur();
}
XBotManufacture::XBotManufacture() {
Compteur::ajouterConstructeur();
}
// :)