rename luaVoteScreen to luaPrefix + make it static buffer
since its effectively just a prefix,
This commit is contained in:
1 parent
a8f3a8dfb0
commit
e4a4496be6
3 files changed
+7
-19
No files matched your search
+4
-16
@@ -1260,15 +1260,10 @@ extern int lib_hudadd(lua_State *L);
|
||||
|
||||
static int lib_hudsetvotebackground(lua_State *L)
|
||||
{
|
||||
memset(VoteScreen.luaPrefix, 0, sizeof(VoteScreen.luaPrefix));
|
||||
|
||||
if (lua_isnoneornil(L, 1))
|
||||
{
|
||||
if (VoteScreen.luaVoteScreen)
|
||||
{
|
||||
free(VoteScreen.luaVoteScreen);
|
||||
}
|
||||
|
||||
VoteScreen.luaVoteScreen = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1279,15 +1274,8 @@ static int lib_hudsetvotebackground(lua_State *L)
|
||||
return luaL_argerror(L, 1, "prefix should 4 characters wide");
|
||||
}
|
||||
|
||||
if (!VoteScreen.luaVoteScreen)
|
||||
{
|
||||
VoteScreen.luaVoteScreen = (char*)malloc(5);
|
||||
VoteScreen.luaVoteScreen[4] = 0;
|
||||
}
|
||||
|
||||
strncpy(VoteScreen.luaVoteScreen, prefix, 4);
|
||||
|
||||
strupr(VoteScreen.luaVoteScreen);
|
||||
strncpy(VoteScreen.luaPrefix, prefix, 4);
|
||||
strupr(VoteScreen.luaPrefix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -282,8 +282,8 @@ static void Y_VoteScreenCheck(void)
|
||||
{
|
||||
strcpy(VoteScreen.Prefix, "INTS");
|
||||
|
||||
if (VoteScreen.luaVoteScreen)
|
||||
strncpy(VoteScreen.Prefix, VoteScreen.luaVoteScreen, 4);
|
||||
if (VoteScreen.luaPrefix[0] != 0)
|
||||
strlcpy(VoteScreen.Prefix, VoteScreen.luaPrefix, sizeof(VoteScreen.Prefix));
|
||||
else if (G_BattleGametype())
|
||||
strcpy(VoteScreen.Prefix, "BTLS");
|
||||
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ extern intertype_t intertype;
|
||||
typedef struct
|
||||
{
|
||||
char Prefix[5]; // Race = INTSX, Battle = BTLSX
|
||||
char *luaVoteScreen; // lua prefix
|
||||
char luaPrefix[5]; // prefix for lua votescreens
|
||||
|
||||
INT32 currentAnimFrame; // current animated background frame
|
||||
|
||||
|
||||
Reference in new issue
Block a user