diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/YetiHack.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/YetiHack.cpp b/src/YetiHack.cpp index c7c0473..83666bd 100644 --- a/src/YetiHack.cpp +++ b/src/YetiHack.cpp @@ -14,8 +14,8 @@ void endCurses(); void startCurses(); int wait(int); int start(bool, bool, double); -void story(); -bool smessage(int, string); +void story(bool); +bool smessage(int, string, bool); vector<int> turns(int); const char* convert(int); void menu(bool); @@ -46,6 +46,7 @@ int wait(int seconds) } int start(bool immortal, bool story, double escapeturns) { + int escapeturnsold = (int)escapeturns; if (story) { escapeturns = turns((int)escapeturns)[1]; @@ -53,7 +54,7 @@ int start(bool immortal, bool story, double escapeturns) int rate; if (story) { - rate = turns((int)escapeturns)[0]; + rate = turns(escapeturnsold)[0]; } else { @@ -246,25 +247,25 @@ int start(bool immortal, bool story, double escapeturns) return 0; } -void story() +void story(bool immortal) { - if (!smessage(1, "One day, you are ambushed by yetis!\n")) + if (!smessage(1, "One day, you are ambushed by yetis!\n", immortal)) { return; } - if (!smessage(2, "You escaped, unfortunately, they attack again.\n")) + if (!smessage(2, "You escaped, unfortunately, they attack again.\n", immortal)) { return; } - if (!smessage(3, "Now, you are attacked a third time!\n")) + if (!smessage(3, "Now, you are attacked a third time!\n", immortal)) { return; } - if (!smessage(4, "There sure are a lot of yetis, because you are attacked again!\n")) + if (!smessage(4, "There sure are a lot of yetis, because you are attacked again!\n", immortal)) { return; } - if (!smessage(5, "One last fight.\n")) + if (!smessage(5, "One last fight.\n", immortal)) { return; } @@ -272,7 +273,7 @@ void story() getch(); } -bool smessage(int num, string message) +bool smessage(int num, string message, bool immortal) { char input; int x, y; @@ -286,7 +287,7 @@ bool smessage(int num, string message) refresh(); getch(); erase(); - if (start(false, true, num) == 1) + if (start(immortal, true, num) == 1) { erase(); addstr("You died!"); @@ -305,12 +306,11 @@ vector<int> turns(int num) vector<int> numbers; int x, y; getmaxyx(stdscr,y,x); - int turn = sqrt(num * 40000); - int rate = turn; - rate /= num; + double turn = 100 * sqrt(num*num*num); + double rate = 10 / num; turn = turn / 7810. * x * y; - numbers.push_back(rate); - numbers.push_back(turn); + numbers.push_back((int)rate); + numbers.push_back((int)turn); return numbers; } @@ -379,7 +379,7 @@ void menu(bool immortal) break; case '2': erase(); - story(); + story(immortal); break; case '3': erase(); |
