Help With MUD Design In C
Hi, I'm a beginner coder using C. I've managed to build a single player dungeon type game that I believe could be modified into a MUD at some point, but I'd like to see if I can organize things a little better.
Here is the basic lay out/structure for the game.
int e=1;
char exit1s[100];
while (e=1) //Each room operates on a while loop//
Room5:
{printf("\n\n ROOM DESCRIPTION EXIT S \n\n");
fgets (exit1s, 100, stdin);//Waits for command from player//
exit1s[strlen(exit1s)-1] = '\0';
if (strcasecmp(exit1s, "s") == 0)//If else statements allow for multiple commands for each room//
{printf("You start walking");
Sleep(500);
goto Room4;//Goto command is used to move between rooms.//
break;}
So here is my main question. Stacking up if else statements for each room is tedious. I'd like to add a "global command" that could work for every room. Any suggestions?
|