Skip to content

Commit

Permalink
Blood: Init version string explicitly at init
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendricks266 committed Aug 28, 2023
1 parent 5cefe35 commit c9db8e5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
2 changes: 2 additions & 0 deletions source/blood/src/blood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1788,6 +1788,8 @@ int app_main(int argc, char const * const * argv)
SetupMenus();
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);

InitVersionString();

OSD_Exec("autoexec.cfg");

if (!bQuickStart)
Expand Down
23 changes: 7 additions & 16 deletions source/blood/src/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ int gFrame;
int gFrameRate;
int gGamma;

char *gVersionString;
char gVersionStringBuf[16];
char gVersionString[16];

Resource gSysRes;

Expand Down Expand Up @@ -96,18 +95,10 @@ void __dassert(const char * pzExpr, const char * pzFile, int nLine)
exit(0);
}

const char *GetVersionString(void)
void InitVersionString(void)
{
if (!gVersionString)
{
gVersionString = gVersionStringBuf;
if (!gVersionString)
return NULL;

Bstrncpyz(gVersionStringBuf, s_buildRev, sizeof(gVersionStringBuf));
char * const pHyphen = strchr(gVersionStringBuf, '-');
if (pHyphen != nullptr)
pHyphen[0] = '\0';
}
return gVersionString;
}
Bstrncpyz(gVersionString, s_buildRev, sizeof(gVersionString));
char * const pHyphen = strchr(gVersionString, '-');
if (pHyphen != nullptr)
pHyphen[0] = '\0';
}
4 changes: 3 additions & 1 deletion source/blood/src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ extern int gGamma;
extern bool bVanilla;

extern Resource gSysRes;
const char *GetVersionString(void);

void InitVersionString(void);
extern char gVersionString[16];
2 changes: 1 addition & 1 deletion source/blood/src/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ void UpdateStatusBar(ClockTicks arg)
TileHGauge(2208, 44, 190, pPlayer->armor[2], 3200);
DrawStatNumber("%3d", pPlayer->armor[2]>>4, 2230, 50, 193, 0, 0);
}
viewDrawText(3, GetVersionString(), 20, 191, 32, 0, 1, 0);
viewDrawText(3, gVersionString, 20, 191, 32, 0, 1, 0);

for (int i = 0; i < 6; i++)
{
Expand Down

0 comments on commit c9db8e5

Please sign in to comment.