Question: Fix my errors please there are few errors i belive have in my code that im going point out and i want you to just

Fix my errors please there are few errors i belive have in my code that im going point out and i want you to just fix it and do nothing else in code. here's the code std::vector projectiles;
Mindflayer::Variant type_;
if (lineInformation[11]== "PSIONIC"){
type_= Mindflayer::PSIONIC;}
else if (lineInformation[11]== "TELEPATHIC"){
type_= Mindflayer::TELEPATHIC;}
else {
type_= Mindflayer::ILLUSIONARY;}
// Check if the string at index 11 is not "NONE"
if (lineInformation[11]!= "NONE"){
while (lineInformation[11].find(";")!= std::string::npos){
Mindflayer::Projectile a;
a.type_= lineInformation[11].substr(0, lineInformation[11].find('-'));
a.quantity_= std::stoi(
lineInformation[11].substr(
lineInformation[11].find('-')+1,
lineInformation[11].find(";")- lineInformation[11].find('-')-1
)
);
projectiles.push_back(a);
lineInformation[11]= lineInformation[11].substr(lineInformation[11].find(";")+1);
}
Mindflayer::Projectile a;
a.type_= lineInformation[11].substr(0, lineInformation[11].find('-'));
a.quantity_= std::stoi(lineInformation[11].substr(lineInformation[11].find('-')+1));
projectiles.push_back(a);
}
//0 TYPE,1 NAME, 2 CATEGORY,3 HITPOINTS,4 LEVEL,5 TAME,6 ELEMENT/FACTION,7 HEADS,8 FLIGHT/TRANSFORM/SUMMONING,9 DECAY,10 AFFINITIES,11 PROJECTILES
Creature::Category category;
if (lineInformation[2]== "ALIEN"){
category = Creature::ALIEN;}
else if (lineInformation[2]== "MYSTICAL"){
category = Creature::MYSTICAL;}
else if (lineInformation[2]== "UNDEAD"){
category = Creature::UNDEAD;}
else {
category = Creature::UNKNOWN;
}
c[size]= new Mindflayer(lineInformation[1], category,
std::stoi(lineInformation[3]), std::stoi(lineInformation[4]), std::stoi(lineInformation[5]),
projectiles,std::stoi(lineInformation[8]), affinities);
} and the errors that im having are 1. for this line a.type_= lineInformation[11].substr(0, lineInformation[11].find('-')); error is assigning to 'Variant' from incompatible type 'string'gcc
no suitable conversion function from "std::__1::basic_string, std::__1::allocator>" to "Mindflayer::Variant" existsC/C++(413)
std::__1::vector lineInformation. because this is my mindflayer class Mindflayer : public Creature{
public:
enum Variant {PSIONIC, TELEPATHIC, ILLUSIONARY};
struct Projectile{
Variant type_;
int quantity_;
}; it's type_ is in member of Variant enum function and my cavern code it's string and make it Variant enum please, make necessary changes on and the 2 error is also causing because of the same issue a.type_= lineInformation[11].substr(0, lineInformation[11].find('-')); error assigning to 'Variant' from incompatible type 'string'gcc
no suitable conversion function from "std::__1::basic_string, std::__1::allocator>" to "Mindflayer::Variant" existsC/C++(413)
std::__1::vector lineInformation so fix both of it. and also look at implementation and look out for any errors on implemntation if i made any mistakes [11] PROJECTILES: Only applicable to Mindflayers. PROJECTILES are of the form [PROJECTILE TYPE1]-[QUANTITY];[PROJECTILE TYPE 2]-[QUANTITY] where multiple types of projectiles are separated by a semicolon. The value may be NONE for a Mindflayer with no projectiles, or creatures of other subclasses.
*/

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!