home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: rec.games.programmer
- Path: sparky!uunet!spool.mu.edu!torn!csd.unb.ca!kinsman
- From: kinsman@jupiter.sun.csd.unb.ca (Aphoriel/Kinsman)
- Subject: Goto [variable] in C++ ?
- Message-ID: <1992Dec28.144429.1427@jupiter.sun.csd.unb.ca>
- Organization: University of New Brunswick
- Distribution: rec.games.programmer
- Date: Mon, 28 Dec 1992 14:44:29 GMT
- Lines: 19
-
- This is a question from someone new to C...
-
- How could I set up C code so that a program goes to a function where the name
- of the function is placed in a string variable? The specific use I'm thinking
- of is for an adventure game, where the function the parser calls depends on
- the verb the player used in typing in his command.. I could set it up as:
-
- -If verb_parsed is 'eat' then call eat_function
- -If verb_parsed is 'give' then call give_function
-
- and so forth, but this is awful... How could I write it in C to look like:
-
- -Go to [verb_parsed + string_holding_parameter_characters]
-
- Like that.
-
- Thanks in advance,
- -Sean Givan / Aphoriel/Kinsman
-
-