Browse Source

Make Victory() and Victory_bossrush() accept level as an integer

Victory() and Victory_bossrush() still expected to get a char containing
the ascii value of the current level, but main() passed to it an integer
containing directly the level number and not its ascii representation.
Matteo Zeccoli Marazzini 7 months ago
parent
commit
08320bdd0e
2 changed files with 8 additions and 8 deletions
  1. 6 6
      functions.cpp
  2. 2 2
      functions.hpp

+ 6 - 6
functions.cpp

@@ -600,8 +600,8 @@ void write_bosshp(WINDOW* BossHP,int hp,int hpmax,std::string name){
 
 
 
-void Victory(std::string name,int score,char level,int chflag){
-	score+=1500*atoi(&level);
+void Victory(std::string name,int score,int level,int chflag){
+	score+=1500*level;
 	WINDOW *victory;
 
 	victory=newwin(19,32,7,17);
@@ -609,7 +609,7 @@ void Victory(std::string name,int score,char level,int chflag){
 	wattron(victory,COLOR_PAIR(1));
 	mvwprintw(victory,2,4,"YOU DEFEATED %s!",name.c_str());
 	wattron(victory,COLOR_PAIR(3));
-	mvwprintw(victory,4,5,"+ %i pts!",atoi(&level)*1500);
+	mvwprintw(victory,4,5,"+ %i pts!",level*1500);
 	wattron(victory,COLOR_PAIR(1));
 	mvwprintw(victory,4,5,"YOU WON!");
 	wattron(victory,COLOR_PAIR(3));
@@ -1494,8 +1494,8 @@ void resetbosses(boss* Bosses,boss& boss1,player& player1){
 	player1.weaponclass=1;
 }
 
-void Victory_bossrush(std::string name,int score,char level,int chflag){
-	score+=1500*atoi(&level);
+void Victory_bossrush(std::string name,int score,int level,int chflag){
+	score+=1500*level;
 	WINDOW *victory;
 
 	victory=newwin(19,32,7,17);
@@ -1503,7 +1503,7 @@ void Victory_bossrush(std::string name,int score,char level,int chflag){
 	wattron(victory,COLOR_PAIR(1));
 	mvwprintw(victory,2,5,"YOU DEFEATED %s!",name.c_str());
 	wattron(victory,COLOR_PAIR(3));
-	mvwprintw(victory,4,5,"+ %i pts!",atoi(&level)*1500);
+	mvwprintw(victory,4,5,"+ %i pts!",level*1500);
 	wattron(victory,COLOR_PAIR(1));
 	mvwprintw(victory,4,5,"YOU WON!");
 	wattron(victory,COLOR_PAIR(3));

+ 2 - 2
functions.hpp

@@ -86,7 +86,7 @@ void write_bosshp(WINDOW*,int,int,std::string);
 
 void pause_game(int&);
 
-void Victory(std::string,int,char,int);
+void Victory(std::string,int,int,int);
 
 void Defeat(int);
 
@@ -96,7 +96,7 @@ void setup_level_bossrush(int level, double& shootr, double& poweruprate, int& w
 
 void resetbosses(boss* Bosses,boss& boss1,player& player1);
 
-void Victory_bossrush(std::string,int,char,int);
+void Victory_bossrush(std::string,int,int,int);
 
 void refreshrecords_bossrush(int,WINDOW*);