Hi,
Say you're writing a game that needs to store a load of pre-written text comments, which can be at most a couple of sentences long. There are around 5 different types of comment, such as insult/ compliment, and each of these types has approximately 5 sub-types- such as 'angry insult', 'very angry insult' etc. There are around 5 unique pre-written lines for each sub-type. So ultimately that's approximately 125 lines total.
What would be the best way to store these lines? I'm thinking I could have them each as a string, and then store them in a vector. I don't want the container to sort them out like a map would, because I want to be able to access them by their number.
The only thing I'm wondering though is because there are different categories, would something else be better than a vector? Or could you do a vector of vectors with compliment/ insult etc. being indexed by a different number or something?
Alternately I'm thinking about just having one vector of strings, and then having some define values for where each category starts e.g. if they are 30 insults, then 22 compliments, and 27 chat lines:
So which approach do you think would be the best?Code:#define INSULTS_ST 0 #define COMP_ST 30 #define CHAT_ST 52
Thanks.