Replace hardcoded temp buffer sizes with a named constant

Constants.h will house constants like the screen size and others. But
basically only the screen size for now.

Now we don't have to type that "4 bytes per 40 chars (whole screen)"
comment everywhere...
This commit is contained in:
Misa
2021-09-12 21:39:07 -07:00
parent ffe53746bc
commit ddff461a6c
3 changed files with 27 additions and 13 deletions

View File

@@ -6,6 +6,7 @@
#include <string.h>
#include <tinyxml2.h>
#include "Constants.h"
#include "CustomLevels.h"
#include "DeferCallbacks.h"
#include "Editor.h"
@@ -658,7 +659,7 @@ void Game::remaining_textbox(void)
{
const int remaining = 6 - crewrescued();
const char* string;
char buffer[161]; /* 4 bytes per 40 chars (whole screen) plus 1 for null terminator */
char buffer[SCREEN_WIDTH_CHARS + 1];
if (remaining == 1)
{
string = " One remains ";