Original Post
I'm currently writing a cricket management simulation using C++ and eventually DirectX for the GUI.
For the match engine, I'm using a 'Commentary handler' class which is given an 'event' such as a batsman playing a shot. Here is where the problems begin. I want the 'Commentary handler' to open the "match_events.cfg" file and find the line which corresponds to the given event. So for a wicket falling in the config file I would have:
# EVENT_WICKET_LOSS
G : (p1) has bowled (p2)
R : (p1) bowled (p2)
Now ' G : ' is for in the game reporting and ' R : ' is for past tense reporting. The file will eventually have hundreds of these lines of commentary. I want the 'Commentary handler' to go through and the right one. Once it has found the correct line. I want it to read in the line of commentary and then replace (p1) and (p2) with a player's name such as "McGrath".
Any suggestions on how I can do this type of thing?