mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Compare commits
6 commits
b6689bc012
...
1afdf47362
Author | SHA1 | Date | |
---|---|---|---|
1afdf47362 | |||
209df982f8 | |||
de956c8db9 | |||
0b03bc7a16 | |||
117ccd7adf | |||
3656c95eca |
|
@ -56,6 +56,7 @@ enum
|
|||
CFGFLAG_COLLIGHT = 1 << 10,
|
||||
CFGFLAG_COLALPHA = 1 << 11,
|
||||
CFGFLAG_INSENSITIVE = 1 << 12,
|
||||
CMDFLAG_PRACTICE = 1 << 13,
|
||||
};
|
||||
|
||||
struct SConfigVariable
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void CFifo::Init(IConsole *pConsole, char *pFifoFile, int Flag)
|
||||
void CFifo::Init(IConsole *pConsole, const char *pFifoFile, int Flag)
|
||||
{
|
||||
m_File = -1;
|
||||
|
||||
|
@ -70,18 +70,23 @@ void CFifo::Update()
|
|||
if(aBuf[i] != '\n')
|
||||
continue;
|
||||
aBuf[i] = '\0';
|
||||
if(str_utf8_check(pCur))
|
||||
{
|
||||
m_pConsole->ExecuteLineFlag(pCur, m_Flag, -1);
|
||||
}
|
||||
pCur = aBuf + i + 1;
|
||||
}
|
||||
if(pCur < aBuf + Length) // missed the last line
|
||||
if(pCur < aBuf + Length && str_utf8_check(pCur)) // missed the last line
|
||||
{
|
||||
m_pConsole->ExecuteLineFlag(pCur, m_Flag, -1);
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(CONF_FAMILY_WINDOWS)
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
void CFifo::Init(IConsole *pConsole, char *pFifoFile, int Flag)
|
||||
void CFifo::Init(IConsole *pConsole, const char *pFifoFile, int Flag)
|
||||
{
|
||||
m_pConsole = pConsole;
|
||||
if(pFifoFile[0] == '\0')
|
||||
|
@ -187,11 +192,16 @@ void CFifo::Update()
|
|||
if(pBuf[i] != '\n')
|
||||
continue;
|
||||
pBuf[i] = '\0';
|
||||
if(str_utf8_check(pCur))
|
||||
{
|
||||
m_pConsole->ExecuteLineFlag(pCur, m_Flag, -1);
|
||||
}
|
||||
pCur = pBuf + i + 1;
|
||||
}
|
||||
if(pCur < pBuf + Length) // missed the last line
|
||||
if(pCur < pBuf + Length && str_utf8_check(pCur)) // missed the last line
|
||||
{
|
||||
m_pConsole->ExecuteLineFlag(pCur, m_Flag, -1);
|
||||
}
|
||||
|
||||
free(pBuf);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class CFifo
|
|||
#endif
|
||||
|
||||
public:
|
||||
void Init(IConsole *pConsole, char *pFifoFile, int Flag);
|
||||
void Init(IConsole *pConsole, const char *pFifoFile, int Flag);
|
||||
void Update();
|
||||
void Shutdown();
|
||||
};
|
||||
|
|
|
@ -4750,7 +4750,7 @@ void CEditor::RenderImagesList(CUIRect ToolBox)
|
|||
if(Result == 2)
|
||||
{
|
||||
const std::shared_ptr<CEditorImage> pImg = m_Map.m_vpImages[m_SelectedImage];
|
||||
const int Height = !pImg->m_External && IsVanillaImage(pImg->m_aName) ? 107 : (pImg->m_External ? 73 : 90);
|
||||
const int Height = pImg->m_External ? 73 : 107;
|
||||
static SPopupMenuId s_PopupImageId;
|
||||
Ui()->DoPopupMenu(&s_PopupImageId, Ui()->MouseX(), Ui()->MouseY(), 140, Height, this, PopupImage);
|
||||
}
|
||||
|
|
|
@ -668,13 +668,26 @@ void CGameContext::ConPractice(IConsole::IResult *pResult, void *pUserData)
|
|||
int NumRequiredVotes = TeamSize / 2 + 1;
|
||||
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' voted to %s /practice mode for your team, which means you can use /r, but you can't earn a rank. Type /practice to vote (%d/%d required votes)", pSelf->Server()->ClientName(pResult->m_ClientId), VotedForPractice ? "enable" : "disable", NumCurrentVotes, NumRequiredVotes);
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' voted to %s /practice mode for your team, which means you can use practice commands, but you can't earn a rank. Type /practice to vote (%d/%d required votes)", pSelf->Server()->ClientName(pResult->m_ClientId), VotedForPractice ? "enable" : "disable", NumCurrentVotes, NumRequiredVotes);
|
||||
pSelf->SendChatTeam(Team, aBuf);
|
||||
|
||||
if(NumCurrentVotes >= NumRequiredVotes)
|
||||
{
|
||||
Teams.SetPractice(Team, true);
|
||||
pSelf->SendChatTeam(Team, "Practice mode enabled for your team, happy practicing!");
|
||||
|
||||
char aPracticeCommands[256];
|
||||
mem_zero(aPracticeCommands, sizeof(aPracticeCommands));
|
||||
str_append(aPracticeCommands, "Available practice commands: ");
|
||||
for(const IConsole::CCommandInfo *pCmd = pSelf->Console()->FirstCommandInfo(IConsole::ACCESS_LEVEL_USER, CMDFLAG_PRACTICE);
|
||||
pCmd; pCmd = pCmd->NextCommandInfo(IConsole::ACCESS_LEVEL_USER, CMDFLAG_PRACTICE))
|
||||
{
|
||||
char aCommand[64];
|
||||
|
||||
str_format(aCommand, sizeof(aCommand), "/%s%s", pCmd->m_pName, pCmd->NextCommandInfo(IConsole::ACCESS_LEVEL_USER, CMDFLAG_PRACTICE) ? ", " : "");
|
||||
str_append(aPracticeCommands, aCommand);
|
||||
}
|
||||
pSelf->SendChatTeam(Team, aPracticeCommands);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3650,18 +3650,19 @@ void CGameContext::RegisterChatCommands()
|
|||
Console()->Register("saytimeall", "", CFGFLAG_CHAT | CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, ConSayTimeAll, this, "Publicly messages everyone your current time in this current running race");
|
||||
Console()->Register("time", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTime, this, "Privately shows you your current time in this current running race in the broadcast message");
|
||||
Console()->Register("timer", "?s['gametimer'|'broadcast'|'both'|'none'|'cycle']", CFGFLAG_CHAT | CFGFLAG_SERVER, ConSetTimerType, this, "Personal Setting of showing time in either broadcast or game/round timer, timer s, where s = broadcast for broadcast, gametimer for game/round timer, cycle for cycle, both for both, none for no timer and nothing to show current status");
|
||||
Console()->Register("r", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConRescue, this, "Teleport yourself out of freeze (use sv_rescue 1 to enable this feature)");
|
||||
Console()->Register("rescue", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConRescue, this, "Teleport yourself out of freeze (use sv_rescue 1 to enable this feature)");
|
||||
Console()->Register("tp", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTeleTo, this, "Depending on the number of supplied arguments, teleport yourself to; (0.) where you are spectating or aiming; (1.) the specified player name");
|
||||
Console()->Register("teleport", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTeleTo, this, "Depending on the number of supplied arguments, teleport yourself to; (0.) where you are spectating or aiming; (1.) the specified player name");
|
||||
Console()->Register("tpxy", "f[x] f[y]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTeleXY, this, "Teleport yourself to the specified coordinates");
|
||||
Console()->Register("lasttp", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConLastTele, this, "Teleport yourself to the last location you teleported to");
|
||||
Console()->Register("tc", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTeleCursor, this, "Teleport yourself to player or to where you are spectating/or looking if no player name is given");
|
||||
Console()->Register("telecursor", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTeleCursor, this, "Teleport yourself to player or to where you are spectating/or looking if no player name is given");
|
||||
Console()->Register("unsolo", "", CFGFLAG_CHAT, ConPracticeUnSolo, this, "Puts you out of solo part");
|
||||
Console()->Register("solo", "", CFGFLAG_CHAT, ConPracticeSolo, this, "Puts you into solo part");
|
||||
Console()->Register("undeep", "", CFGFLAG_CHAT, ConPracticeUnDeep, this, "Puts you out of deep freeze");
|
||||
Console()->Register("deep", "", CFGFLAG_CHAT, ConPracticeDeep, this, "Puts you into deep freeze");
|
||||
|
||||
Console()->Register("r", "", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConRescue, this, "Teleport yourself out of freeze (use sv_rescue 1 to enable this feature)");
|
||||
Console()->Register("rescue", "", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConRescue, this, "Teleport yourself out of freeze (use sv_rescue 1 to enable this feature)");
|
||||
Console()->Register("tp", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleTo, this, "Depending on the number of supplied arguments, teleport yourself to; (0.) where you are spectating or aiming; (1.) the specified player name");
|
||||
Console()->Register("teleport", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleTo, this, "Depending on the number of supplied arguments, teleport yourself to; (0.) where you are spectating or aiming; (1.) the specified player name");
|
||||
Console()->Register("tpxy", "f[x] f[y]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleXY, this, "Teleport yourself to the specified coordinates");
|
||||
Console()->Register("lasttp", "", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConLastTele, this, "Teleport yourself to the last location you teleported to");
|
||||
Console()->Register("tc", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleCursor, this, "Teleport yourself to player or to where you are spectating/or looking if no player name is given");
|
||||
Console()->Register("telecursor", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER | CMDFLAG_PRACTICE, ConTeleCursor, this, "Teleport yourself to player or to where you are spectating/or looking if no player name is given");
|
||||
Console()->Register("unsolo", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeUnSolo, this, "Puts you out of solo part");
|
||||
Console()->Register("solo", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeSolo, this, "Puts you into solo part");
|
||||
Console()->Register("undeep", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeUnDeep, this, "Puts you out of deep freeze");
|
||||
Console()->Register("deep", "", CFGFLAG_CHAT | CMDFLAG_PRACTICE, ConPracticeDeep, this, "Puts you into deep freeze");
|
||||
|
||||
Console()->Register("kill", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConProtectedKill, this, "Kill yourself when kill-protected during a long game (use f1, kill for regular kill)");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue