Turn (super)patrons/githubfriends into arrays & move them to new file

So, originally, I wanted to keep them on Game, but it turns out that if
I initialize it in Game.cpp, the compiler will complain that other files
won't know what's actually inside the array. To do that, I'd have to
initialize it in Game.h. But I don't want to initialize it in Game.h
because that'd mean recompiling a lot of unnecessary files whenever
someone gets added to the credits.

So, I moved all the patrons, superpatrons, and GitHub contributors to a
new file, Credits.h, which only contains the list (and the credits max
position calculation). That way, whenever someone gets added, only the
minimal amount of files need to be recompiled.
This commit is contained in:
Misa
2020-07-03 03:13:15 -07:00
committed by Ethan Lee
parent a80502bdc9
commit fc03fca838
6 changed files with 143 additions and 137 deletions

View File

@@ -1,6 +1,7 @@
#include "Input.h"
#include "Logic.h"
#include "Script.h"
#include "Credits.h"
#include "MakeAndPlay.h"
@@ -899,7 +900,7 @@ void menuactionpress()
music.playef(11);
game.current_credits_list_index += 9;
if (game.current_credits_list_index >= (int)game.superpatrons.size())
if (game.current_credits_list_index >= (int)SDL_arraysize(Credits::superpatrons))
{
// No more super patrons. Move to the next credits section
game.current_credits_list_index = 0;
@@ -950,7 +951,7 @@ void menuactionpress()
music.playef(11);
game.current_credits_list_index += 14;
if (game.current_credits_list_index >= (int)game.patrons.size())
if (game.current_credits_list_index >= (int)SDL_arraysize(Credits::patrons))
{
// No more patrons. Move to the next credits section
game.current_credits_list_index = 0;
@@ -972,7 +973,7 @@ void menuactionpress()
if (game.current_credits_list_index < 0)
{
//No more patrons. Move to the previous credits section
game.current_credits_list_index = game.superpatrons.size() - 1 - (game.superpatrons.size()-1)%9;
game.current_credits_list_index = SDL_arraysize(Credits::superpatrons) - 1 - (SDL_arraysize(Credits::superpatrons)-1)%9;
game.createmenu(Menu::credits3, true);
}
else
@@ -1001,7 +1002,7 @@ void menuactionpress()
music.playef(11);
game.current_credits_list_index += 9;
if (game.current_credits_list_index >= (int)game.githubfriends.size())
if (game.current_credits_list_index >= (int)SDL_arraysize(Credits::githubfriends))
{
// No more GitHub contributors. Move to the next credits section
game.current_credits_list_index = 0;
@@ -1023,7 +1024,7 @@ void menuactionpress()
if (game.current_credits_list_index < 0)
{
//No more GitHub contributors. Move to the previous credits section
game.current_credits_list_index = game.patrons.size() - 1 - (game.patrons.size()-1)%14;
game.current_credits_list_index = SDL_arraysize(Credits::patrons) - 1 - (SDL_arraysize(Credits::patrons)-1)%14;
game.createmenu(Menu::credits4, true);
}
else
@@ -1056,7 +1057,7 @@ void menuactionpress()
case 1:
//previous page
music.playef(11);
game.current_credits_list_index = game.githubfriends.size() - 1 - (game.githubfriends.size()-1)%9;
game.current_credits_list_index = SDL_arraysize(Credits::githubfriends) - 1 - (SDL_arraysize(Credits::githubfriends)-1)%9;
game.createmenu(Menu::credits5, true);
game.currentmenuoption = 1;
map.nexttowercolour();
@@ -2434,13 +2435,13 @@ void gamecompleteinput()
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip))
{
game.creditposition -= 6;
if (game.creditposition <= -game.creditmaxposition)
if (game.creditposition <= -Credits::creditmaxposition)
{
if(graphics.fademode==0)
{
graphics.fademode = 2;
}
game.creditposition = -game.creditmaxposition;
game.creditposition = -Credits::creditmaxposition;
}
else
{