Sorry for not having replied to your post Shadow12345. I understood a bit of that what you told and I have now read about vectors. I fixed a another problem with them but I don't understand how vectors could fix the big problem. I have created the weapons with a weapons class and there I have made a constructor which I use to create all the different weapons.
And then I have made the arrays so I could go through every weapons item_location and name.
weapons(char* wname, double wweight, int w_damage, int i_pos, char* i_location)
name = wname;
weight = wweight;
weapon_damage = w_damage;
item_position = i_pos;
item_location = i_location;
//name, weight, wdamage, position, location
weapons sword ("sword", 0.9, 4, 1,"");
weapons hammer ("hammer", 1.5, 6, 1,"");
And here is the code which looks if the weapon is in the room and couts it if it is.
iloca = sword.item_location;
iloca = hammer.item_location;
iname = sword.name;
iname = hammer.name;
Is there a better way to do this?
for (int y = 1; y < 3; y++)
if (iloca[y] == room.strCurrent_room)
cout << iname[y] << endl;