Permalink
Browse files

AdventureSample - reduce gotos in Fight routine

  • Loading branch information...
bobbymcr committed May 6, 2018
1 parent 8d91a1c commit a35b951360114d8f045e1c015a071fd2baa6eaef
Showing with 11 additions and 14 deletions.
  1. +11 −14 projects/AdventureSample/src/Adventure/adventure.cs
@@ -1382,32 +1382,29 @@ private int Main()
if ((((noun.CompareTo("")) == (0)) ? (-1) : (0)) != (0))
{
PRINT(("") + ("WHOM DO YOU WANT TO FIGHT?"));
goto L100;
}
if ((((noun.CompareTo("GUA")) != (0)) ? (-1) : (0)) != (0))
else if ((((noun.CompareTo("GUA")) != (0)) ? (-1) : (0)) != (0))
{
PRINT(("") + ("YOU CAN'T FIGHT HIM!"));
goto L100;
}
if ((((currentRoom.CompareTo(16)) != (0)) ? (-1) : (0)) != (0))
else if ((((currentRoom.CompareTo(16)) != (0)) ? (-1) : (0)) != (0))
{
PRINT(("") + ("THERE'S NO GUARD HERE!"));
goto L100;
}
if ((((objectRooms[(int)(10)].CompareTo(-(1))) != (0)) ? (-1) : (0)) != (0))
else if ((((objectRooms[(int)(10)].CompareTo(-(1))) != (0)) ? (-1) : (0)) != (0))
{
PRINT(("") + ("YOU DON'T HAVE A WEAPON!"));
goto L100;
}
else
{
PRINT(("") + ("THE GUARD, NOTICING YOUR SWORD,"));
PRINT(("") + ("WISELY RETREATS INTO THE CASTLE."));
map[(int)(16), (int)(0)] = (17);
objectRooms[(int)(13)] = (0);
}
PRINT(("") + ("THE GUARD, NOTICING YOUR SWORD,"));
PRINT(("") + ("WISELY RETREATS INTO THE CASTLE."));
map[(int)(16), (int)(0)] = (17);
objectRooms[(int)(13)] = (0);
goto L100;
L4900:
;
if ((((verb.CompareTo("WEA")) != (0)) ? (-1) : (0)) != (0))

0 comments on commit a35b951

Please sign in to comment.