Merge pull request #2 from ddnet/master

Merged Master
This commit is contained in:
houseme-kyle 2021-03-09 17:39:48 +02:00 committed by GitHub
commit 25bb82c3bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 368 additions and 283 deletions

View file

@ -1900,6 +1900,10 @@ if(CLIENT)
)
target_link_libraries(${TARGET_CLIENT} ${LIBS_CLIENT})
if(MSVC)
target_link_options(${TARGET_CLIENT} PRIVATE /ENTRY:mainCRTStartup)
endif()
target_include_directories(${TARGET_CLIENT} PRIVATE
${CURL_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}

View file

@ -1237,13 +1237,7 @@ Smooth Dynamic Camera
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1275,3 +1269,9 @@ Regular Background Color
DDNet %s is available:
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -943,13 +943,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1186,6 +1180,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -1159,13 +1159,7 @@ Skin Database
Skins directory
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1237,6 +1231,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
https://wiki.ddnet.tw/
==

View file

@ -1262,15 +1262,6 @@ Use old chat style
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
== A largura da textura %s não é divisível por %d ou a altura não é divisível por %d, o que pode causar erros visuais.
45° aim
== Mirar em 45º
Deepfly on
== Ativar deepfly
Deepfly off
== Desativar deepfly
Dummy
== Dummy
@ -1294,3 +1285,12 @@ Entities Background color
Regular Background Color
== Cor de fundo comum
Chat command
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -943,13 +943,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1186,6 +1180,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -1182,13 +1182,7 @@ Skin Database
Skins directory
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1248,6 +1242,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
https://wiki.ddnet.tw/
==

View file

@ -1250,13 +1250,7 @@ Update failed! Check log...
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1282,3 +1276,9 @@ Entities Background color
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -1248,13 +1248,7 @@ Grabs
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1280,3 +1274,9 @@ Entities Background color
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -1194,13 +1194,7 @@ Skin Database
Skins directory
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1260,6 +1254,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
https://wiki.ddnet.tw/
==

View file

@ -944,13 +944,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1187,6 +1181,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -1273,13 +1273,7 @@ Replay
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1305,3 +1299,9 @@ Entities Background color
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -1262,15 +1262,6 @@ Smooth Dynamic Camera
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
== Die Breite von Textur %s ist nicht durch %d teilbar, oder die Höhe nicht durch %d teilbar, was Visuelle Fehler verursachen könnte.
45° aim
== 45°-Zielen
Deepfly on
== Deepfly an
Deepfly off
== Deepfly aus
Dummy
== Dummy
@ -1294,3 +1285,12 @@ Entities Background color
Regular Background Color
== Normale Hintergrundfarbe
Chat command
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -1246,13 +1246,7 @@ Replay
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1279,5 +1273,11 @@ Entities Background color
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==
https://wiki.ddnet.tw/
==

View file

@ -1278,13 +1278,7 @@ Markers:
Converse
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1314,5 +1308,11 @@ Entities Background color
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==
FPM
==

View file

@ -943,13 +943,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1186,6 +1180,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -942,13 +942,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1185,6 +1179,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -934,13 +934,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1177,6 +1171,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -1249,13 +1249,7 @@ Play
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1281,3 +1275,9 @@ Entities Background color
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -763,13 +763,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1060,6 +1054,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -1250,13 +1250,7 @@ Play
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1282,3 +1276,9 @@ Entities Background color
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -1076,13 +1076,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1202,6 +1196,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -949,13 +949,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1192,6 +1186,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -1253,15 +1253,6 @@ Entities
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
== Ширина текстуры %s не делится на %d или же его высота не делится на %d, что может повлиять на графику.
45° aim
== Прицел 45°
Deepfly on
== Вкл. Deepfly
Deepfly off
== Выкл. Deepfly
Dummy
== Дамми
@ -1285,3 +1276,12 @@ Entities Background color
Regular Background Color
== Станд. фоновый цвет
Chat command
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -947,13 +947,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1190,6 +1184,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
https://wiki.ddnet.tw/
==

View file

@ -1232,13 +1232,7 @@ Checking for existing player with your name
Smooth Dynamic Camera
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1279,3 +1273,9 @@ Use current map as background
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -1256,16 +1256,16 @@ Particles
Assets directory
== 材质目录
https://ddnet.tw/discord
== http://chat.teeworlds.cn/
Discord
== 开黑啦
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy

View file

@ -943,13 +943,7 @@ Show entities
Show HUD
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
UI mouse s.
@ -1186,6 +1180,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
Learn
==

View file

@ -1254,13 +1254,7 @@ Replay
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1286,3 +1280,9 @@ Entities Background color
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -1220,13 +1220,7 @@ Skin Database
Skins directory
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1282,3 +1276,9 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -1253,13 +1253,7 @@ Assets directory
The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs.
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1285,3 +1279,9 @@ Entities Background color
Regular Background Color
==
Discord
==
https://ddnet.tw/discord
==

View file

@ -1197,13 +1197,7 @@ Skin Database
Skins directory
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1260,6 +1254,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
https://wiki.ddnet.tw/
==

View file

@ -1192,13 +1192,7 @@ Skin Database
Skins directory
==
45° aim
==
Deepfly on
==
Deepfly off
Chat command
==
Dummy
@ -1255,6 +1249,12 @@ Particles
Assets directory
==
Discord
==
https://ddnet.tw/discord
==
https://wiki.ddnet.tw/
==

View file

@ -36,10 +36,10 @@ class Dmgtools(Dmg):
def _dmg(self, *args):
self._check_call((self.config.dmg,) + args)
def _create_hfs(self, hfs, volume_name, size):
def _create_hfs(self, hfs_fd, hfs, volume_name, size):
if self.config.verbose >= 1:
print("TRUNCATING {} to {} bytes".format(hfs, size))
with open(hfs, 'wb') as f:
with os.fdopen(hfs_fd, 'wb') as f:
f.truncate(size)
self._mkfs_hfs('-v', volume_name, hfs)
@ -55,8 +55,8 @@ class Dmgtools(Dmg):
def create(self, dmg, volume_name, directory, symlinks):
input_size = sum(os.stat(os.path.join(path, f)).st_size for path, dirs, files in os.walk(directory) for f in files)
output_size = max(input_size * 2, 1024**2)
hfs = tempfile.mkstemp(prefix=dmg + '.', suffix='.hfs')
self._create_hfs(hfs, volume_name, output_size)
hfs_fd, hfs = tempfile.mkstemp(prefix=dmg + '.', suffix='.hfs')
self._create_hfs(hfs_fd, hfs, volume_name, output_size)
self._add(hfs, directory)
for target, link_name in symlinks:
self._symlink(hfs, target, link_name)

View file

@ -140,6 +140,7 @@ int CRequest::RunImpl(CURL *pHandle)
curl_easy_setopt(pHandle, CURLOPT_URL, m_aUrl);
curl_easy_setopt(pHandle, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt(pHandle, CURLOPT_USERAGENT, GAME_NAME " " GAME_RELEASE_VERSION " (" CONF_PLATFORM_STRING "; " CONF_ARCH_STRING ")");
curl_easy_setopt(pHandle, CURLOPT_ACCEPT_ENCODING, ""); // Use any compression algorithm supported by libcurl.
curl_easy_setopt(pHandle, CURLOPT_WRITEDATA, this);
curl_easy_setopt(pHandle, CURLOPT_WRITEFUNCTION, WriteCallback);

View file

@ -1855,6 +1855,9 @@ void CServer::CacheServerInfo(CCache *pCache, int Type, bool SendClients)
ADD_INT(p, g_Config.m_Password[0] ? SERVER_FLAG_PASSWORD : 0);
int MaxClients = m_NetServer.MaxClients();
// How many clients the used serverinfo protocol supports, has to be tracked
// separately to make sure we don't subtract the reserved slots from it
int MaxClientsProtocol = MAX_CLIENTS;
if(Type == SERVERINFO_VANILLA || Type == SERVERINFO_INGAME)
{
if(ClientCount >= VANILLA_MAX_CLIENTS)
@ -1864,16 +1867,15 @@ void CServer::CacheServerInfo(CCache *pCache, int Type, bool SendClients)
else
ClientCount = VANILLA_MAX_CLIENTS;
}
if(MaxClients > VANILLA_MAX_CLIENTS)
MaxClients = VANILLA_MAX_CLIENTS;
MaxClientsProtocol = VANILLA_MAX_CLIENTS;
if(PlayerCount > ClientCount)
PlayerCount = ClientCount;
}
ADD_INT(p, PlayerCount); // num players
ADD_INT(p, maximum(MaxClients - maximum(g_Config.m_SvSpectatorSlots, g_Config.m_SvReservedSlots), PlayerCount)); // max players
ADD_INT(p, minimum(MaxClientsProtocol, maximum(MaxClients - maximum(g_Config.m_SvSpectatorSlots, g_Config.m_SvReservedSlots), PlayerCount))); // max players
ADD_INT(p, ClientCount); // num clients
ADD_INT(p, maximum(MaxClients - g_Config.m_SvReservedSlots, ClientCount)); // max clients
ADD_INT(p, minimum(MaxClientsProtocol, maximum(MaxClients - g_Config.m_SvReservedSlots, ClientCount))); // max clients
if(Type == SERVERINFO_EXTENDED)
p.AddString("", 0); // extra info, reserved

View file

@ -529,7 +529,7 @@ void CDemoPlayer::ScanFile()
}
// copy all the frames to an array instead for fast access
m_pKeyFrames = (CKeyFrame *)calloc(std::max(m_Info.m_SeekablePoints, 1), sizeof(CKeyFrame));
m_pKeyFrames = (CKeyFrame *)calloc(maximum(m_Info.m_SeekablePoints, 1), sizeof(CKeyFrame));
for(pCurrentKey = pFirstKey, i = 0; pCurrentKey; pCurrentKey = pCurrentKey->m_pNext, i++)
m_pKeyFrames[i] = pCurrentKey->m_Frame;

View file

@ -469,8 +469,6 @@ void CBinds::SetDDRaceBinds(bool FreeOnly)
Bind(KEY_S, "+showhookcoll", FreeOnly);
Bind(KEY_X, "toggle cl_dummy 0 1", FreeOnly);
Bind(KEY_H, "toggle cl_dummy_hammer 0 1", FreeOnly);
Bind(KEY_UP, "bind mouse1 \"+fire; +toggle cl_dummy_hammer 1 0\"", FreeOnly);
Bind(KEY_DOWN, "bind mouse1 \"+fire\"", FreeOnly);
Bind(KEY_SLASH, "+show_chat; chat all /", FreeOnly);
Bind(KEY_PAGEDOWN, "toggle cl_show_quads 0 1", FreeOnly);
Bind(KEY_PAGEUP, "toggle cl_overlay_entities 0 100", FreeOnly);

View file

@ -760,7 +760,6 @@ static CKeyInfo gs_aKeys[] =
{"Fire", "+fire", 0, 0},
{"Hook", "+hook", 0, 0},
{"Hook collisions", "+showhookcoll", 0, 0},
{"45° aim", "+toggle cl_mouse_max_distance 2 400; +toggle inp_mousesens 1 200", 0, 0},
{"Pause", "say /pause", 0, 0},
{"Kill", "kill", 0, 0},
{"Zoom in", "zoom+", 0, 0},
@ -791,8 +790,6 @@ static CKeyInfo gs_aKeys[] =
{"Toggle dummy", "toggle cl_dummy 0 1", 0, 0},
{"Dummy copy", "toggle cl_dummy_copy_moves 0 1", 0, 0},
{"Hammerfly dummy", "toggle cl_dummy_hammer 0 1", 0, 0},
{"Deepfly on", "bind mouse1 \"+fire; +toggle cl_dummy_hammer 1 0\"", 0, 0},
{"Deepfly off", "bind mouse1 \"+fire\"", 0, 0},
{"Emoticon", "+emote", 0, 0},
{"Spectator mode", "+spectate", 0, 0},
@ -818,8 +815,7 @@ static CKeyInfo gs_aKeys[] =
Localize("Chat");Localize("Team chat");Localize("Converse");Localize("Show chat");Localize("Emoticon");
Localize("Spectator mode");Localize("Spectate next");Localize("Spectate previous");Localize("Console");
Localize("Remote console");Localize("Screenshot");Localize("Scoreboard");Localize("Statboard");
Localize("Lock team");Localize("Show entities");Localize("Show HUD");Localize("45° aim");
Localize("Chat command";Localize("Deepfly on");Localize("Deepfly off");
Localize("Lock team");Localize("Show entities");Localize("Show HUD");Localize("Chat command");
*/
void CMenus::UiDoGetButtons(int Start, int Stop, CUIRect View, CUIRect ScopeView)
@ -893,7 +889,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
// movement settings
{
MovementSettings.VMargin(5.0f, &MovementSettings);
MovementSettings.HSplitTop(510.0f, &MovementSettings, &WeaponSettings);
MovementSettings.HSplitTop(490.0f, &MovementSettings, &WeaponSettings);
RenderTools()->DrawUIRect(&MovementSettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
MovementSettings.VMargin(10.0f, &MovementSettings);
@ -927,7 +923,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
MovementSettings.HSplitTop(20.0f, 0, &MovementSettings);
}
UiDoGetButtons(0, 18, MovementSettings, MainView);
UiDoGetButtons(0, 17, MovementSettings, MainView);
}
// weapon settings
@ -940,7 +936,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
TextRender()->Text(0, WeaponSettings.x, WeaponSettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Weapon"), -1.0f);
WeaponSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &WeaponSettings);
UiDoGetButtons(18, 23, WeaponSettings, MainView);
UiDoGetButtons(17, 22, WeaponSettings, MainView);
}
// defaults
@ -966,7 +962,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
TextRender()->Text(0, VotingSettings.x, VotingSettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Voting"), -1.0f);
VotingSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &VotingSettings);
UiDoGetButtons(23, 25, VotingSettings, MainView);
UiDoGetButtons(22, 24, VotingSettings, MainView);
}
// chat settings
@ -979,20 +975,20 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
TextRender()->Text(0, ChatSettings.x, ChatSettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Chat"), -1.0f);
ChatSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &ChatSettings);
UiDoGetButtons(25, 30, ChatSettings, MainView);
UiDoGetButtons(24, 29, ChatSettings, MainView);
}
// dummy settings
{
DummySettings.HSplitTop(10.0f, 0, &DummySettings);
DummySettings.HSplitTop(145.0f, &DummySettings, &MiscSettings);
DummySettings.HSplitTop(100.0f, &DummySettings, &MiscSettings);
RenderTools()->DrawUIRect(&DummySettings, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 10.0f);
DummySettings.VMargin(10.0f, &DummySettings);
TextRender()->Text(0, DummySettings.x, DummySettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Dummy"), -1.0f);
DummySettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &DummySettings);
UiDoGetButtons(30, 35, DummySettings, MainView);
UiDoGetButtons(29, 32, DummySettings, MainView);
}
// misc settings
@ -1005,7 +1001,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
TextRender()->Text(0, MiscSettings.x, MiscSettings.y + (14.0f + 5.0f + 10.0f - 14.0f * UI()->Scale()) / 2.f, 14.0f * UI()->Scale(), Localize("Miscellaneous"), -1.0f);
MiscSettings.HSplitTop(14.0f + 5.0f + 10.0f, 0, &MiscSettings);
UiDoGetButtons(35, 47, MiscSettings, MainView);
UiDoGetButtons(32, 44, MiscSettings, MainView);
}
UiDoListboxEnd(&s_ScrollValue, 0);

View file

@ -37,9 +37,9 @@ void CMenus::RenderStartMenu(CUIRect MainView)
ExtMenu.HSplitBottom(20.0f, &ExtMenu, &Button);
static int s_DiscordButton;
if(DoButton_Menu(&s_DiscordButton, "Discord", 0, &Button, 0, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.0f, 0.0f, 0.0f, 0.5f), vec4(0.0f, 0.0f, 0.0f, 0.25f)))
if(DoButton_Menu(&s_DiscordButton, Localize("Discord"), 0, &Button, 0, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.0f, 0.0f, 0.0f, 0.5f), vec4(0.0f, 0.0f, 0.0f, 0.25f)))
{
if(!open_link("https://ddnet.tw/discord"))
if(!open_link(Localize("https://ddnet.tw/discord")))
{
dbg_msg("menus", "couldn't open link");
}

View file

@ -35,7 +35,8 @@ CHAT_COMMAND("teamrank", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTe
CHAT_COMMAND("rank", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConRank, this, "Shows the rank of player with name r (your rank by default)")
CHAT_COMMAND("top5team", "?s[player name] ?i[rank to start with]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTeamTop5, this, "Shows five team ranks of the ladder or of a player beginning with rank i (1 by default, -1 for worst)")
CHAT_COMMAND("teamtop5", "?s[player name] ?i[rank to start with]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTeamTop5, this, "Shows five team ranks of the ladder or of a player beginning with rank i (1 by default, -1 for worst)")
CHAT_COMMAND("top5", "?i[rank to start with]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTop5, this, "Shows five ranks of the ladder beginning with rank i (1 by default, -1 for worst)")
CHAT_COMMAND("top", "?i[rank to start with]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTop, this, "Shows five ranks of the global and regional ladder beginning with rank i (1 by default, -1 for worst)")
CHAT_COMMAND("top5", "?i[rank to start with]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTop, this, "Shows five ranks of the global and regional ladder beginning with rank i (1 by default, -1 for worst)")
CHAT_COMMAND("times", "?s[player name] ?i[number of times to skip]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTimes, this, "/times ?s?i shows last 5 times of the server or of a player beginning with name s starting with time i (i = 1 by default, -1 for first)")
CHAT_COMMAND("points", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConPoints, this, "Shows the global points of a player beginning with name r (your rank by default)")
CHAT_COMMAND("top5points", "?i[number]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTopPoints, this, "Shows five points of the global point ladder beginning with rank i (1 by default)")

View file

@ -270,7 +270,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
Size += str_length(m_lSettings[i].m_aCommand) + 1;
}
char *pSettings = (char *)malloc(std::max(Size, 1));
char *pSettings = (char *)malloc(maximum(Size, 1));
char *pNext = pSettings;
for(int i = 0; i < m_lSettings.size(); i++)
{
@ -536,7 +536,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
// save points
int TotalSize = sizeof(CEnvPoint) * PointCount;
CEnvPoint *pPoints = (CEnvPoint *)calloc(std::max(PointCount, 1), sizeof(*pPoints));
CEnvPoint *pPoints = (CEnvPoint *)calloc(maximum(PointCount, 1), sizeof(*pPoints));
PointCount = 0;
for(int e = 0; e < m_lEnvelopes.size(); e++)

View file

@ -423,7 +423,7 @@ void CGameContext::ConTeamTop5(IConsole::IResult *pResult, void *pUserData)
}
}
void CGameContext::ConTop5(IConsole::IResult *pResult, void *pUserData)
void CGameContext::ConTop(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
if(!CheckClientID(pResult->m_ClientID))
@ -431,15 +431,15 @@ void CGameContext::ConTop5(IConsole::IResult *pResult, void *pUserData)
if(g_Config.m_SvHideScore)
{
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "top5",
"Showing the top 5 is not allowed on this server.");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "top",
"Showing the top is not allowed on this server.");
return;
}
if(pResult->NumArguments() > 0)
pSelf->Score()->ShowTop5(pResult->m_ClientID, pResult->GetInteger(0));
pSelf->Score()->ShowTop(pResult->m_ClientID, pResult->GetInteger(0));
else
pSelf->Score()->ShowTop5(pResult->m_ClientID);
pSelf->Score()->ShowTop(pResult->m_ClientID);
}
void CGameContext::ConTimes(IConsole::IResult *pResult, void *pUserData)

View file

@ -346,7 +346,7 @@ private:
static void ConToggleSpecVoted(IConsole::IResult *pResult, void *pUserData);
static void ConForcePause(IConsole::IResult *pResult, void *pUserData);
static void ConTeamTop5(IConsole::IResult *pResult, void *pUserData);
static void ConTop5(IConsole::IResult *pResult, void *pUserData);
static void ConTop(IConsole::IResult *pResult, void *pUserData);
static void ConTimes(IConsole::IResult *pResult, void *pUserData);
static void ConPoints(IConsole::IResult *pResult, void *pUserData);
static void ConTopPoints(IConsole::IResult *pResult, void *pUserData);

View file

@ -933,13 +933,18 @@ void CPlayer::ProcessScoreResult(CScorePlayerResult &Result)
}
break;
case CScorePlayerResult::ALL:
{
int MessageClientId = m_ClientID;
for(auto &aMessage : Result.m_Data.m_aaMessages)
{
if(aMessage[0] == 0)
break;
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aMessage, m_ClientID);
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aMessage, MessageClientId);
MessageClientId = -1; // Prevent multi-messages being flagged as spam.
}
break;
}
case CScorePlayerResult::BROADCAST:
if(Result.m_Data.m_Broadcast[0] != 0)
GameServer()->SendBroadcast(Result.m_Data.m_Broadcast, -1);

View file

@ -126,6 +126,7 @@ void CScore::ExecPlayerThread(
auto Tmp = std::unique_ptr<CSqlPlayerRequest>(new CSqlPlayerRequest(pResult));
str_copy(Tmp->m_Name, pName, sizeof(Tmp->m_Name));
str_copy(Tmp->m_Map, g_Config.m_SvMap, sizeof(Tmp->m_Map));
str_copy(Tmp->m_Server, g_Config.m_SvSqlServerName, sizeof(Tmp->m_Server));
str_copy(Tmp->m_RequestingPlayer, Server()->ClientName(ClientID), sizeof(Tmp->m_RequestingPlayer));
Tmp->m_Offset = Offset;
@ -766,32 +767,63 @@ bool CScore::ShowRankThread(IDbConnection *pSqlServer, const ISqlData *pGameData
const CSqlPlayerRequest *pData = dynamic_cast<const CSqlPlayerRequest *>(pGameData);
CScorePlayerResult *pResult = dynamic_cast<CScorePlayerResult *>(pGameData->m_pResult.get());
char aServerLike[16];
str_format(aServerLike, sizeof(aServerLike), "%%%s%%", pData->m_Server);
// check sort method
char aBuf[600];
str_format(aBuf, sizeof(aBuf),
"SELECT Rank, Time, PercentRank "
"FROM ("
" SELECT RANK() OVER w AS Rank, PERCENT_RANK() OVER w as PercentRank, Name, MIN(Time) AS Time "
" FROM %s_race "
" WHERE Map = ? "
" AND Server LIKE ?"
" GROUP BY Name "
" WINDOW w AS (ORDER BY Time)"
") as a "
"WHERE Name = ?;",
pSqlServer->GetPrefix());
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
{
return true;
}
pSqlServer->BindString(1, pData->m_Map);
pSqlServer->BindString(2, pData->m_Name);
pSqlServer->BindString(2, aServerLike);
pSqlServer->BindString(3, pData->m_Name);
bool End;
if(pSqlServer->Step(&End, pError, ErrorSize))
{
return true;
}
char aRegionalRank[16];
if(End)
{
str_copy(aRegionalRank, "unranked", sizeof(aRegionalRank));
}
else
{
str_format(aRegionalRank, sizeof(aRegionalRank), "rank %d", pSqlServer->GetInt(1));
}
const char *pAny = "%";
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
{
return true;
}
pSqlServer->BindString(1, pData->m_Map);
pSqlServer->BindString(2, pAny);
pSqlServer->BindString(3, pData->m_Name);
if(pSqlServer->Step(&End, pError, ErrorSize))
{
return true;
}
if(!End)
{
int Rank = pSqlServer->GetInt(1);
@ -807,9 +839,23 @@ bool CScore::ShowRankThread(IDbConnection *pSqlServer, const ISqlData *pGameData
else
{
pResult->m_MessageKind = CScorePlayerResult::ALL;
str_format(pResult->m_Data.m_aaMessages[0], sizeof(pResult->m_Data.m_aaMessages[0]),
"%d. %s Time: %s, better than %d%%, requested by %s",
Rank, pData->m_Name, aBuf, BetterThanPercent, pData->m_RequestingPlayer);
if(str_comp_nocase(pData->m_RequestingPlayer, pData->m_Name) == 0)
{
str_format(pResult->m_Data.m_aaMessages[0], sizeof(pResult->m_Data.m_aaMessages[0]),
"%s Time: %s, better than %d%%",
pData->m_Name, aBuf, BetterThanPercent);
}
else
{
str_format(pResult->m_Data.m_aaMessages[0], sizeof(pResult->m_Data.m_aaMessages[0]),
"%s Time: %s, better than %d%%, requested by %s",
pData->m_Name, aBuf, BetterThanPercent, pData->m_RequestingPlayer);
}
str_format(pResult->m_Data.m_aaMessages[1], sizeof(pResult->m_Data.m_aaMessages[1]),
"Global rank %d || %s %s",
Rank, pData->m_Server, aRegionalRank);
}
}
else
@ -910,20 +956,21 @@ bool CScore::ShowTeamRankThread(IDbConnection *pSqlServer, const ISqlData *pGame
return false;
}
void CScore::ShowTop5(int ClientID, int Offset)
void CScore::ShowTop(int ClientID, int Offset)
{
if(RateLimitPlayer(ClientID))
return;
ExecPlayerThread(ShowTop5Thread, "show top5", ClientID, "", Offset);
ExecPlayerThread(ShowTopThread, "show top5", ClientID, "", Offset);
}
bool CScore::ShowTop5Thread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize)
bool CScore::ShowTopThread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize)
{
const CSqlPlayerRequest *pData = dynamic_cast<const CSqlPlayerRequest *>(pGameData);
CScorePlayerResult *pResult = dynamic_cast<CScorePlayerResult *>(pGameData->m_pResult.get());
int LimitStart = maximum(abs(pData->m_Offset) - 1, 0);
const char *pOrder = pData->m_Offset >= 0 ? "ASC" : "DESC";
const char *pAny = "%";
// check sort method
char aBuf[512];
@ -933,23 +980,27 @@ bool CScore::ShowTop5Thread(IDbConnection *pSqlServer, const ISqlData *pGameData
" SELECT RANK() OVER w AS Rank, Name, MIN(Time) AS Time "
" FROM %s_race "
" WHERE Map = ? "
" AND Server LIKE ? "
" GROUP BY Name "
" WINDOW w AS (ORDER BY Time)"
") as a "
"ORDER BY Rank %s "
"LIMIT %d, 5;",
"LIMIT %d, 3;",
pSqlServer->GetPrefix(),
pOrder,
LimitStart);
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
{
return true;
}
pSqlServer->BindString(1, pData->m_Map);
pSqlServer->BindString(2, pAny);
// show top5
str_copy(pResult->m_Data.m_aaMessages[0], "----------- Top 5 -----------", sizeof(pResult->m_Data.m_aaMessages[0]));
// show top
str_copy(pResult->m_Data.m_aaMessages[0], "-----------< Global Top 3 >-----------", sizeof(pResult->m_Data.m_aaMessages[0]));
char aTime[32];
int Line = 1;
bool End = false;
while(!pSqlServer->Step(&End, pError, ErrorSize) && !End)
@ -957,17 +1008,43 @@ bool CScore::ShowTop5Thread(IDbConnection *pSqlServer, const ISqlData *pGameData
char aName[MAX_NAME_LENGTH];
pSqlServer->GetString(1, aName, sizeof(aName));
float Time = pSqlServer->GetFloat(2);
str_time_float(Time, TIME_HOURS_CENTISECS, aBuf, sizeof(aBuf));
str_time_float(Time, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));
int Rank = pSqlServer->GetInt(3);
str_format(pResult->m_Data.m_aaMessages[Line], sizeof(pResult->m_Data.m_aaMessages[Line]),
"%d. %s Time: %s", Rank, aName, aBuf);
"%d. %s Time: %s", Rank, aName, aTime);
Line++;
}
char aServerLike[16];
str_format(aServerLike, sizeof(aServerLike), "%%%s%%", pData->m_Server);
if(pSqlServer->PrepareStatement(aBuf, pError, ErrorSize))
{
return true;
}
pSqlServer->BindString(1, pData->m_Map);
pSqlServer->BindString(2, aServerLike);
str_format(pResult->m_Data.m_aaMessages[Line], sizeof(pResult->m_Data.m_aaMessages[Line]),
"-----------< %s Top 3 >-----------", pData->m_Server);
Line++;
// show top
while(!pSqlServer->Step(&End, pError, ErrorSize) && !End)
{
char aName[MAX_NAME_LENGTH];
pSqlServer->GetString(1, aName, sizeof(aName));
float Time = pSqlServer->GetFloat(2);
str_time_float(Time, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));
int Rank = pSqlServer->GetInt(3);
str_format(pResult->m_Data.m_aaMessages[Line], sizeof(pResult->m_Data.m_aaMessages[Line]),
"%d. %s Time: %s", Rank, aName, aTime);
Line++;
}
if(!End)
{
return true;
}
str_copy(pResult->m_Data.m_aaMessages[Line], "-------------------------------", sizeof(pResult->m_Data.m_aaMessages[Line]));
return false;
}

View file

@ -31,7 +31,7 @@ struct CScorePlayerResult : ISqlResult
enum
{
MAX_MESSAGES = 7,
MAX_MESSAGES = 8,
};
enum Variant
@ -167,6 +167,7 @@ struct CSqlPlayerRequest : ISqlData
char m_RequestingPlayer[MAX_NAME_LENGTH];
// relevant for /top5 kind of requests
int m_Offset;
char m_Server[5];
};
struct CSqlRandomMapRequest : ISqlData
@ -291,7 +292,7 @@ class CScore
static bool MapInfoThread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize);
static bool ShowRankThread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize);
static bool ShowTeamRankThread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize);
static bool ShowTop5Thread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize);
static bool ShowTopThread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize);
static bool ShowTeamTop5Thread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize);
static bool ShowPlayerTeamTop5Thread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize);
static bool ShowTimesThread(IDbConnection *pSqlServer, const ISqlData *pGameData, char *pError, int ErrorSize);
@ -340,7 +341,7 @@ public:
void SaveTeamScore(int *pClientIDs, unsigned int Size, float Time, const char *pTimestamp);
void ShowTop5(int ClientID, int Offset = 1);
void ShowTop(int ClientID, int Offset = 1);
void ShowRank(int ClientID, const char *pName);
void ShowTeamTop5(int ClientID, int Offset = 1);