Conflicts:
	data/languages/french.txt
	src/engine/client/client.cpp
	src/engine/server/server.cpp
	src/game/server/gamecontext.cpp
This commit is contained in:
GreYFoXGTi 2010-10-11 03:56:58 +02:00
commit d8e6cfcbdd
21 changed files with 411 additions and 331 deletions

View file

@ -4,12 +4,39 @@
%d of %d servers, %d players
== %d/%d serveurs, %d joueurs
%ds left
== %ds a quitté
[N] Flip brush horizontal
== [N] Retourner horizontalement
[NumPad+] Zoom in
== [ClavierNum+] Zoomer
[NumPad-] Zoom out
== [ClavierNum-] Dézoomer
[M] Flip brush vertical
== [M] Retourner verticalement
Abort
== Annuler
Add
== Ajouter
Add group
== Ajouter un groupe
Add Image
== Ajouter une image
Address
== Adresse
Adds a new group
== Ajoute un nouveau groupe
All
== Tout le monde
@ -19,6 +46,15 @@ Alpha
Always show name plates
== Toujours afficher les pseudonymes
Anim
== Anim.
Append
== Joindre
Append map
== Joindre une carte
Are you sure that you want to quit?
== Êtes-vous sûr de vouloir quitter ?
@ -34,15 +70,27 @@ Blue team wins!
Body
== Corps
Border
== Bordure
Call vote
== Voter
Cancel
== Annuler
Chat
== Chat
Clear collision
== Nettoyer la collision
Close
== Fermer
Color+
== Couleur+
Compatible version
== Version compatible
@ -52,12 +100,21 @@ Connect
Connecting to
== Connexion à
Connection Problems...
== Problèmes de connexion...
Console
== Console
Controls
== Contrôles
Constructs collision from this layer
== Fait la collision depuis cette couche
Creates a new map
== Crée une nouvelle carte
Current
== Actuellement
@ -67,9 +124,30 @@ Current version: %s
Custom colors
== Couleurs personnalisées
Decrease
== Réduire
Decrease animation speed
== Réduire la vitesse des animations
Delete
== Supprimer
Delete group
== Supprimer le groupe
Delete layer
== Supprimer la couche
Deletes the layer
== Supprime la couche
Demos
== Démos
Detail
== Détail
Disconnect
== Partir
@ -88,17 +166,38 @@ Draw!
Dynamic Camera
== Caméra dynamique
Embed
== Intégrer
Embedded
== Intégré
Embeds the image into the map file.
== Intègre l'image dans la carte.
Emoticon
== Émoticônes
Enter
== Démarrer
Error
== Erreur
error loading demo
== erreur de chargement de la démo
Exits from the editor
== Ferme l'éditeur
External
== Externe
FSAA samples
== Échantillons FSAA
Favorite
== Favoris
== Favori
Favorites
== Favoris
@ -106,6 +205,12 @@ Favorites
Feet
== Pieds
File
== Fichier
Filename:
== Nom du fichier:
Filter
== Filtre
@ -142,12 +247,18 @@ Graphics
Grenade
== Lance-grenade
Group
== Groupe
Hammer
== Maillet
Has people playing
== Au moins un joueur
Height
== Hauteur
High Detail
== Tous les détails
@ -160,6 +271,18 @@ Host address
Hue
== Teinte
Image
== Image
Images
== Images
Increase
== Augmenter
Increase animation speed
== Augmenter la vitesse des animations
Info
== Info.
@ -187,15 +310,27 @@ LAN
Language
== Langue
Layers
== Couches
Lht.
== Lum.
Load a new image to use in the map
== Charger une image pour l'utiliser dans la carte
Loading DDRace Client
== Chargement DDRace Client
MOTD
== MOTD
Make collision
== Faire la collision
Make external
== Mettre en externe
Map
== Carte
@ -223,6 +358,9 @@ Mute when not active
Name
== Nom
New
== Nouveau
News
== Nouvelles
@ -232,6 +370,9 @@ Next weapon
Nickname
== Pseudonyme
Name:
== Nom:
No
== Non
@ -244,13 +385,34 @@ No servers found
No servers match your filter criteria
== Aucun serveur ne correspond à vos critères
None
== Aucun
Normal animation speed
== Vitesse normale des animations
Ok
== Ok
Open
== Ouvrir
Open map
== Ouvrir une carte
Opens a map and adds everything from that map to the current one
== Ouvre une carte et ajoute son contenu dans la carte actuelle
Opens a map for editing
== Ouvre une carte pour la modifier
Order
== Ordre
Password
== Mot de passe
Password Incorrect
Password incorrect
== Mot de passe incorrect
Ping
@ -268,6 +430,15 @@ Player
Players
== Joueurs
Please balance teams!
== Équilibrez les équipes !
Pos.+
== Pos.+
Press right mouse button to create a new point
== Clic-droit pour créer un nouveau point
Prev. weapon
== Arme précédente
@ -275,7 +446,7 @@ Quality Textures
== Textures haute qualité
Quick search:
== Recherche rapide:
== Recherche rapide :
Quit
== Quitter
@ -295,6 +466,27 @@ Refreshing master servers
Remote console
== Console serveur
Remove
== Enlever
Removes collision from this layer
== Enlève la collision depuis cette couche
Removes the image from the map file.
== Enlève l'image de la carte.
Removes the image from the map
== Enlève l'image de la carte
Replace
== Remplacer
Replace Image
== Remplacer l'image
Replaces the image with a new one
== Remplace l'image par une nouvelle
Reset filter
== Filtres par défaut
@ -313,6 +505,27 @@ Sample rate
Sat.
== Sat.
Save
== Enregistrer
Save As
== Enregistrer sous
Save map
== Enregistrer la carte
Saves the current map
== Enregistre la carte actuelle
Saves the current map under a new name
== Enregistre la carte actuelle sous un autre nom
Select group. Right click for properties.
== Sélectionner un groupe. Clic-droit pour voir les propriétés.
Select layer. Right click for properties.
== Sélectionner une couche. Clic-droit pour voir les propriétés.
Score
== Score
@ -320,7 +533,7 @@ Score board
== Scores
Score limit
== Score maxi
== Score limite
Scoreboard
== Scores
@ -328,11 +541,14 @@ Scoreboard
Screenshot
== Capture d'écran
Select image
== Sélectionner une image
Server details
== Détails du serveur
Server info
== Infos. serveur
== Info. serveur
Server not full
== Pas de serveurs pleins
@ -367,12 +583,18 @@ Spectate
Spectators
== Spectateurs
Square
== Carré
Standard gametype
== Types de jeu standards
Standard map
== Cartes standards
Sudden Death
== Mort Subite
Switch weapon on pickup
== Sélectionner l'arme ramassée
@ -421,12 +643,18 @@ Vote yes
Voting
== Vote
Warmup
== Échauffement
Weapon
== Arme
Welcome to Teeworlds
== Bienvenue dans Teeworlds
Width
== Largeur
Yes
== Oui
@ -436,53 +664,21 @@ You must restart the game for all settings to take effect.
Your skin
== Votre skin
ZI
== Z+
ZO
== Z-
##### needs translation ####
Password incorrect
== Password incorrect
Please balance teams!
== Please balance teams!
Connection Problems...
== Connection Problems...
Warmup
== Warmup
Sudden Death
== Sudden Death
%ds left
== %ds left
error loading demo
== error loading demo
Error
== Error
Open map
== Open map
Open
== Open
Save map
== Save map
Save
== Save
HD
== HD
[ctrl+h] Toggle High Detail
== [ctrl+h] Toggle High Detail
Anim
== Anim
[ctrl+m] Toggle animation
== [ctrl+m] Toggle animation
@ -492,36 +688,9 @@ Proof
[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
== [ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.
ZO
== ZO
[NumPad-] Zoom out
== [NumPad-] Zoom out
[NumPad*] Zoom to normal and remove editor offset
== [NumPad*] Zoom to normal and remove editor offset
ZI
== ZI
[NumPad+] Zoom in
== [NumPad+] Zoom in
Increase animation speed
== Increase animation speed
Normal animation speed
== Normal animation speed
Decrease animation speed
== Decrease animation speed
[N] Flip brush horizontal
== [N] Flip brush horizontal
[M] Flip brush vertical
== [M] Flip brush vertical
CCW
== CCW
@ -540,9 +709,6 @@ Add Quad
Adds a new quad
== Adds a new quad
Border
== Border
Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate.
== Left mouse button to move. Hold shift to move pivot. Hold ctrl to rotate.
@ -555,84 +721,9 @@ Use left mouse button to drag and create a brush.
Use left mouse button to paint with the brush. Right button clears the brush.
== Use left mouse button to paint with the brush. Right button clears the brush.
Decrease
== Decrease
Increase
== Increase
None
== None
Toggle group visibility
== Toggle group visibility
Select group. Right click for properties.
== Select group. Right click for properties.
Add group
== Add group
Adds a new group
== Adds a new group
Embed
== Embed
Embeds the image into the map file.
== Embeds the image into the map file.
Make external
== Make external
Removes the image from the map file.
== Removes the image from the map file.
Replace
== Replace
Replaces the image with a new one
== Replaces the image with a new one
Replace Image
== Replace Image
Remove
== Remove
Removes the image from the map
== Removes the image from the map
Embedded
== Embedded
External
== External
Select image
== Select image
Load a new image to use in the map
== Load a new image to use in the map
Add Image
== Add Image
Add
== Add
Filename:
== Filename:
Cancel
== Cancel
Layers
== Layers
Images
== Images
Switch between images and layers managment.
== Switch between images and layers managment.
@ -645,15 +736,9 @@ Toggles the envelope editor.
%s Right click for context menu.
== %s Right click for context menu.
Color+
== Color+
Creates a new color envelope
== Creates a new color envelope
Pos.+
== Pos.+
Creates a new pos envelope
== Creates a new pos envelope
@ -663,72 +748,12 @@ Previous Envelope
Next Envelope
== Next Envelope
Name:
== Name:
Press right mouse button to create a new point
== Press right mouse button to create a new point
Switch curve type
== Switch curve type
Left mouse to drag. Hold shift to alter time point aswell. Right click to delete.
== Left mouse to drag. Hold shift to alter time point aswell. Right click to delete.
New
== New
Creates a new map
== Creates a new map
Opens a map for editing
== Opens a map for editing
Append
== Append
Opens a map and adds everything from that map to the current one
== Opens a map and adds everything from that map to the current one
Append map
== Append map
Saves the current map
== Saves the current map
Save As
== Save As
Saves the current map under a new name
== Saves the current map under a new name
Exits from the editor
== Exits from the editor
Clear collision
== Clear collision
Removes collision from this layer
== Removes collision from this layer
Make collision
== Make collision
Constructs collision from this layer
== Constructs collision from this layer
Width
== Width
Height
== Height
Image
== Image
Delete group
== Delete group
Add quads layer
== Add quads layer
@ -741,30 +766,9 @@ Add tile layer
Creates a new tile layer
== Creates a new tile layer
Delete layer
== Delete Layer
Deletes the layer
== Deletes the layer
Group
== Group
Order
== Order
Detail
== Detail
Delete
== Delete
Deletes the current quad
== Deletes the current quad
Square
== Square
Squares the current quad
== Squares the current quad
@ -780,13 +784,7 @@ Color Env
Color TO
== Color TO
Select layer. Right click for properties.
== Select layer. Right click for properties.
Toggle layer visibility
== Toggle layer visibility
File
== File
##### old translations ####

View file

@ -1950,8 +1950,8 @@ void CClient::RegisterCommands()
{
m_pConsole = Kernel()->RequestInterface<IConsole>();
// register server dummy commands for tab completion
m_pConsole->Register("kick", "i", CFGFLAG_SERVER, 0, 0, "Kick player with specified id", 0);
m_pConsole->Register("ban", "s?i", CFGFLAG_SERVER, 0, 0, "Ban player with ip/id for x minutes", 0);
m_pConsole->Register("kick", "i?s", CFGFLAG_SERVER, 0, 0, "Kick player with specified id for any reason", 0);
m_pConsole->Register("ban", "s?is", CFGFLAG_SERVER, 0, 0, "Ban player with ip/id for x minutes for any reason", 0);
m_pConsole->Register("unban", "s", CFGFLAG_SERVER, 0, 0, "Unban ip", 0);
m_pConsole->Register("bans", "", CFGFLAG_SERVER, 0, 0, "Show banlist", 0);
m_pConsole->Register("status", "", CFGFLAG_SERVER, 0, 0, "List players", 0);

View file

@ -541,6 +541,7 @@ public:
int i;
int GotNewLine = 0;
float DrawX, DrawY;
int LineCount;
float CursorX, CursorY;
const char *pEnd;
@ -590,6 +591,7 @@ public:
const char *pEnd = pCurrent+Length;
DrawX = CursorX;
DrawY = CursorY;
LineCount = pCursor->m_LineCount;
if(pCursor->m_Flags&TEXTFLAG_RENDER)
{
@ -607,7 +609,7 @@ public:
Graphics()->SetColor(m_TextR, m_TextG, m_TextB, m_TextA);
}
while(pCurrent < pEnd)
while(pCurrent < pEnd && (pCursor->m_MaxLines < 1 || LineCount <= pCursor->m_MaxLines))
{
int NewLine = 0;
const char *pBatchEnd = pEnd;
@ -666,7 +668,9 @@ public:
DrawY += Size;
DrawX = (int)(DrawX * FakeToScreenX) / FakeToScreenX; // realign
DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY;
++pCursor->m_LineCount;
++LineCount;
if(pCursor->m_MaxLines > 0 && LineCount > pCursor->m_MaxLines)
break;
continue;
}
@ -702,7 +706,7 @@ public:
GotNewLine = 1;
DrawX = (int)(DrawX * FakeToScreenX) / FakeToScreenX; // realign
DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY;
++pCursor->m_LineCount;
++LineCount;
}
}
@ -711,6 +715,7 @@ public:
}
pCursor->m_X = DrawX;
pCursor->m_LineCount = LineCount;
if(GotNewLine)
pCursor->m_Y = DrawY;

View file

@ -661,7 +661,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
{
// OH FUCK! wrong version, drop him
char aReason[256];
str_format(aReason, sizeof(aReason), "wrong version. server is running '%s' and client '%s'.", GameServer()->NetVersion(), aVersion);
str_format(aReason, sizeof(aReason), "Wrong version. Server is running '%s' and client '%s'", GameServer()->NetVersion(), aVersion);
m_NetServer.Drop(ClientId, aReason);
return;
}
@ -673,7 +673,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
if(g_Config.m_Password[0] != 0 && str_comp(g_Config.m_Password, pPassword) != 0)
{
// wrong password
m_NetServer.Drop(ClientId, "wrong password");
m_NetServer.Drop(ClientId, "Wrong password");
return;
}
@ -881,7 +881,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
else
{
NETADDR Addr = m_NetServer.ClientAddr(ClientId);
BanAdd(Addr, g_Config.m_SvRconBantime*60);
BanAdd(Addr, g_Config.m_SvRconBantime*60, "Too many remote console authentication tries");
}
}
}
@ -1005,7 +1005,7 @@ void CServer::UpdateServerInfo()
}
}
int CServer::BanAdd(NETADDR Addr, int Seconds)
int CServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
{
Addr.port = 0;
char aAddrStr[128];
@ -1017,7 +1017,7 @@ int CServer::BanAdd(NETADDR Addr, int Seconds)
str_format(aBuf, sizeof(aBuf), "banned %s for life", aAddrStr);
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
return m_NetServer.BanAdd(Addr, Seconds);
return m_NetServer.BanAdd(Addr, Seconds, pReason);
}
int CServer::BanRemove(NETADDR Addr)
@ -1304,7 +1304,7 @@ int CServer::Run()
for(int i = 0; i < MAX_CLIENTS; ++i)
{
if(m_aClients[i].m_State != CClient::STATE_EMPTY)
m_NetServer.Drop(i, "server shutdown");
m_NetServer.Drop(i, "Server shutdown");
}
GameServer()->OnShutdown();
@ -1317,7 +1317,14 @@ int CServer::Run()
void CServer::ConKick(IConsole::IResult *pResult, void *pUser, int ClientId)
{
((CServer *)pUser)->Kick(pResult->GetInteger(0), "kicked by console");
if(pResult->NumArguments() > 1)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "Kicked by console (%s)", pResult->GetString(1));
((CServer *)pUser)->Kick(pResult->GetInteger(0), aBuf);
}
else
((CServer *)pUser)->Kick(pResult->GetInteger(0), "Kicked by console");
}
void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
@ -1326,10 +1333,14 @@ void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
CServer *pServer = (CServer *)pUser;
const char *pStr = pResult->GetString(0);
int Minutes = 30;
const char *pReason = "No reason given";
if(pResult->NumArguments() > 1)
Minutes = pResult->GetInteger(1);
if(pResult->NumArguments() > 2)
pReason = pResult->GetString(2);
if(net_addr_from_str(&Addr, pStr) == 0)
{
if(pServer->m_RconClientId >= 0 && pServer->m_RconClientId < MAX_CLIENTS && pServer->m_aClients[pServer->m_RconClientId].m_State != CClient::STATE_EMPTY)
@ -1342,7 +1353,7 @@ void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
return;
}
}
pServer->BanAdd(Addr, Minutes*60);
pServer->BanAdd(Addr, Minutes*60, pReason);
}
else if(StrAllnum(pStr))
{
@ -1360,7 +1371,7 @@ void CServer::ConBan(IConsole::IResult *pResult, void *pUser, int ClientId1)
}
Addr = pServer->m_NetServer.ClientAddr(ClientId);
pServer->BanAdd(Addr, Minutes*60);
pServer->BanAdd(Addr, Minutes*60, pReason);
}
else
{
@ -1495,8 +1506,8 @@ void CServer::RegisterCommands()
{
m_pConsole = Kernel()->RequestInterface<IConsole>();
Console()->Register("kick", "i", CFGFLAG_SERVER, ConKick, this, "", 2);
Console()->Register("ban", "s?i", CFGFLAG_SERVER|CFGFLAG_STORE, ConBan, this, "", 2);
Console()->Register("kick", "i?s", CFGFLAG_SERVER, ConKick, this, "", 2);
Console()->Register("ban", "s?is", CFGFLAG_SERVER|CFGFLAG_STORE, ConBan, this, "", 2);
Console()->Register("unban", "s", CFGFLAG_SERVER|CFGFLAG_STORE, ConUnban, this, "", 2);
Console()->Register("bans", "", CFGFLAG_SERVER|CFGFLAG_STORE, ConBans, this, "", 2);
Console()->Register("status", "", CFGFLAG_SERVER, ConStatus, this, "", 1);
@ -1707,7 +1718,7 @@ void CServer::CheckPass(int ClientId, const char *pPw)
else
{
NETADDR Addr = m_NetServer.ClientAddr(ClientId);
BanAdd(Addr, g_Config.m_SvRconBantime);
BanAdd(Addr, g_Config.m_SvRconBantime, "Too many remote console authentication tries");
}
}
}
@ -1732,6 +1743,6 @@ void CServer::CheckPass(int ClientId, const char *pPw)
ClientId,
m_aClients[ClientId].m_Addr.ip[0], m_aClients[ClientId].m_Addr.ip[1], m_aClients[ClientId].m_Addr.ip[2], m_aClients[ClientId].m_Addr.ip[3]
);
BanAdd(m_aClients[ClientId].m_Addr, 0);
BanAdd(m_aClients[ClientId].m_Addr, 0, "Being a noob");
}
}

View file

@ -183,7 +183,7 @@ public:
void SendServerInfo(NETADDR *pAddr, int Token);
void UpdateServerInfo();
int BanAdd(NETADDR Addr, int Seconds);
int BanAdd(NETADDR Addr, int Seconds, const char *pReason);
int BanRemove(NETADDR Addr);

View file

@ -272,10 +272,10 @@ public:
int Update();
//
int Drop(int ClientID, const char *Reason);
int Drop(int ClientID, const char *pReason);
// banning
int BanAdd(NETADDR Addr, int Seconds);
int BanAdd(NETADDR Addr, int Seconds, const char *pReason);
int BanRemove(NETADDR Addr);
int BanNum(); // caution, slow
int BanGet(int Index, CBanInfo *pInfo); // caution, slow

View file

@ -226,7 +226,7 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
SetError(Str);
}
else
SetError("no reason given");
SetError("No reason given");
if(g_Config.m_Debug)
dbg_msg("conn", "closed reason='%s'", ErrorString());
@ -304,7 +304,7 @@ int CNetConnection::Update()
(Now-m_LastRecvTime) > time_freq()*10)
{
m_State = NET_CONNSTATE_ERROR;
SetError("timeout");
SetError("Timeout");
}
// fix resends
@ -316,7 +316,7 @@ int CNetConnection::Update()
if(Now-pResend->m_FirstSendTime > time_freq()*10)
{
m_State = NET_CONNSTATE_ERROR;
SetError("too weak connection (not acked for 10 seconds)");
SetError("Too weak connection (not acked for 10 seconds)");
}
else
{

View file

@ -139,7 +139,7 @@ int CNetServer::BanRemove(NETADDR Addr)
return -1;
}
int CNetServer::BanAdd(NETADDR Addr, int Seconds)
int CNetServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
{
int IpHash = (Addr.ip[0]+Addr.ip[1]+Addr.ip[2]+Addr.ip[3])&0xff;
int Stamp = -1;
@ -213,9 +213,9 @@ int CNetServer::BanAdd(NETADDR Addr, int Seconds)
NETADDR BanAddr;
if(Seconds)
str_format(Buf, sizeof(Buf), "you have been banned for %d minutes", Seconds/60);
str_format(Buf, sizeof(Buf), "You have been banned for %d minutes (%s)", Seconds/60, pReason);
else
str_format(Buf, sizeof(Buf), "you have been banned for life");
str_format(Buf, sizeof(Buf), "You have been banned for life (%s)", pReason);
for(int i = 0; i < MaxClients(); i++)
{
@ -295,12 +295,12 @@ int CNetServer::Recv(CNetChunk *pChunk)
{
int Mins = ((pBan->m_Info.m_Expires - Now)+59)/60;
if(Mins == 1)
str_format(BanStr, sizeof(BanStr), "banned for %d minute", Mins);
str_format(BanStr, sizeof(BanStr), "Banned for 1 minute");
else
str_format(BanStr, sizeof(BanStr), "banned for %d minutes", Mins);
str_format(BanStr, sizeof(BanStr), "Banned for %d minutes", Mins);
}
else
str_format(BanStr, sizeof(BanStr), "banned for life");
str_format(BanStr, sizeof(BanStr), "Banned for life");
CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, BanStr, str_length(BanStr)+1);
continue;
}
@ -352,7 +352,7 @@ int CNetServer::Recv(CNetChunk *pChunk)
if(FoundAddr++ >= m_MaxClientsPerIP)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "only %i players with same ip allowed", m_MaxClientsPerIP);
str_format(aBuf, sizeof(aBuf), "Only %d players with the same IP are allowed", m_MaxClientsPerIP);
CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, aBuf, sizeof(aBuf));
return 0;
}
@ -373,7 +373,7 @@ int CNetServer::Recv(CNetChunk *pChunk)
if(!Found)
{
const char FullMsg[] = "server is full";
const char FullMsg[] = "This server is full";
CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, FullMsg, sizeof(FullMsg));
}
}
@ -429,7 +429,7 @@ int CNetServer::Send(CNetChunk *pChunk)
}
else
{
Drop(pChunk->m_ClientID, "error sending data");
Drop(pChunk->m_ClientID, "Error sending data");
}
}
return 0;

View file

@ -17,6 +17,7 @@ public:
int m_Flags;
int m_LineCount;
int m_CharCount;
int m_MaxLines;
float m_StartX;
float m_StartY;

View file

@ -31,6 +31,8 @@ void CChat::OnReset()
}
m_Show = false;
m_InputUpdate = false;
m_ChatStringOffset = 0;
}
void CChat::OnRelease()
@ -101,7 +103,10 @@ bool CChat::OnInput(IInput::CEvent e)
m_pClient->OnRelease();
}
else
{
m_Input.ProcessInput(e);
m_InputUpdate = true;
}
return true;
}
@ -203,6 +208,7 @@ void CChat::OnRender()
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, x, y, 8.0f, TEXTFLAG_RENDER);
Cursor.m_LineWidth = 200.0f;
Cursor.m_MaxLines = 2;
if(m_Mode == MODE_ALL)
TextRender()->TextEx(&Cursor, Localize("All"), -1);
@ -213,7 +219,23 @@ void CChat::OnRender()
TextRender()->TextEx(&Cursor, ": ", -1);
TextRender()->TextEx(&Cursor, m_Input.GetString(), m_Input.GetCursorOffset());
// check if the visible text has to be moved
if(m_InputUpdate)
{
if(m_ChatStringOffset > m_Input.GetCursorOffset())
--m_ChatStringOffset;
else
{
CTextCursor Temp = Cursor;
Temp.m_Flags = 0;
TextRender()->TextEx(&Temp, m_Input.GetString()+m_ChatStringOffset, m_Input.GetCursorOffset()-m_ChatStringOffset);
TextRender()->TextEx(&Temp, "|", -1);
if(Temp.m_LineCount > 2)
++m_ChatStringOffset;
}
}
TextRender()->TextEx(&Cursor, m_Input.GetString()+m_ChatStringOffset, m_Input.GetCursorOffset()-m_ChatStringOffset);
CTextCursor Marker = Cursor;
TextRender()->TextEx(&Marker, "|", -1);
TextRender()->TextEx(&Cursor, m_Input.GetString()+m_Input.GetCursorOffset(), -1);

View file

@ -35,6 +35,8 @@ class CChat : public CComponent
int m_Mode;
bool m_Show;
bool m_InputUpdate;
int m_ChatStringOffset;
static void ConSay(IConsole::IResult *pResult, void *pUserData, int ClientID);
static void ConSayTeam(IConsole::IResult *pResult, void *pUserData, int ClientID);

View file

@ -1,4 +1,3 @@
//#include "gc_console.h"
#include <math.h>
#include <time.h>
@ -38,10 +37,6 @@ enum
CGameConsole::CInstance::CInstance(int Type)
{
// init ringbuffers
//history = ringbuf_init(history_data, sizeof(history_data), RINGBUF_FLAG_RECYCLE);
//backlog = ringbuf_init(backlog_data, sizeof(backlog_data), RINGBUF_FLAG_RECYCLE);
m_pHistoryEntry = 0x0;
m_Type = Type;
@ -69,6 +64,12 @@ void CGameConsole::CInstance::ClearBacklog()
m_BacklogActPage = 0;
}
void CGameConsole::CInstance::ClearHistory()
{
m_History.Init();
m_pHistoryEntry = 0;
}
void CGameConsole::CInstance::ExecuteLine(const char *pLine)
{
if(m_Type == 0)
@ -100,8 +101,11 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
{
if(m_Input.GetString()[0])
{
char *pEntry = m_History.Allocate(m_Input.GetLength()+1);
mem_copy(pEntry, m_Input.GetString(), m_Input.GetLength()+1);
if(m_Type != 1 || m_pGameConsole->Client()->RconAuthed())
{
char *pEntry = m_History.Allocate(m_Input.GetLength()+1);
mem_copy(pEntry, m_Input.GetString(), m_Input.GetLength()+1);
}
ExecuteLine(m_Input.GetString());
m_Input.Clear();
m_pHistoryEntry = 0x0;
@ -670,34 +674,8 @@ void CGameConsole::OnConsoleInit()
Console()->Register("dump_remote_console", "", CFGFLAG_CLIENT, ConDumpRemoteConsole, this, "Dump remote console", 0);
}
/*
static void con_team(void *result, void *user_data)
void CGameConsole::OnStateChange(int NewState, int OldState)
{
send_switch_team(console_arg_int(result, 0));
if(NewState == IClient::STATE_OFFLINE)
m_RemoteConsole.ClearHistory();
}
static void con_kill(void *result, void *user_data)
{
send_kill(-1);
}
void send_kill(int client_id);
static void con_emote(void *result, void *user_data)
{
send_emoticon(console_arg_int(result, 0));
}
extern void con_chat(void *result, void *user_data);
void client_console_init()
{
//
MACRO_REGISTER_COMMAND("team", "i", con_team, 0x0);
MACRO_REGISTER_COMMAND("kill", "", con_kill, 0x0);
// chatting
MACRO_REGISTER_COMMAND("emote", "i", con_emote, 0);
MACRO_REGISTER_COMMAND("+emote", "", con_key_input_state, &emoticon_selector_active);
}
*/

View file

@ -32,6 +32,7 @@ class CGameConsole : public CComponent
void Init(CGameConsole *pGameConsole);
void ClearBacklog();
void ClearHistory();
void ExecuteLine(const char *pLine);
@ -72,6 +73,7 @@ public:
void PrintLine(int Type, const char *pLine);
virtual void OnStateChange(int NewState, int OldState);
virtual void OnConsoleInit();
virtual void OnReset();
virtual void OnRender();

View file

@ -99,6 +99,7 @@ CMenus::CMenus()
m_LastInput = time_get();
str_copy(m_aCurrentDemoFolder, "demos", sizeof(m_aCurrentDemoFolder));
m_aCallvoteReason[0] = 0;
}
vec4 CMenus::ButtonColorMul(const void *pID)
@ -219,7 +220,10 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
{
int Inside = UI()->MouseInside(pRect);
bool ReturnValue = false;
bool UpdateOffset = false;
static int s_AtIndex = 0;
static bool s_DoScroll = false;
static float s_ScrollStart = 0.0f;
if(UI()->LastActiveItem() == pID)
{
@ -229,6 +233,8 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
if(Inside && UI()->MouseButton(0))
{
s_DoScroll = true;
s_ScrollStart = UI()->MouseX();
int MxRel = (int)(UI()->MouseX() - pRect->x);
for(int i = 1; i <= Len; i++)
@ -243,6 +249,24 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
s_AtIndex = Len;
}
}
else if(!UI()->MouseButton(0))
s_DoScroll = false;
else if(s_DoScroll)
{
// do scrolling
if(UI()->MouseX() < pRect->x && s_ScrollStart-UI()->MouseX() > 10.0f)
{
s_AtIndex = max(0, s_AtIndex-1);
s_ScrollStart = UI()->MouseX();
UpdateOffset = true;
}
else if(UI()->MouseX() > pRect->x+pRect->w && UI()->MouseX()-s_ScrollStart > 10.0f)
{
s_AtIndex = min(Len, s_AtIndex+1);
s_ScrollStart = UI()->MouseX();
UpdateOffset = true;
}
}
for(int i = 0; i < m_NumInputEvents; i++)
{
@ -256,7 +280,10 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
if(UI()->ActiveItem() == pID)
{
if(!UI()->MouseButton(0))
{
s_DoScroll = false;
UI()->SetActiveItem(0);
}
}
else if(UI()->HotItem() == pID)
{
@ -291,7 +318,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
}
// check if the text has to be moved
if(UI()->LastActiveItem() == pID && !JustGotActive && m_NumInputEvents)
if(UI()->LastActiveItem() == pID && !JustGotActive && (UpdateOffset || m_NumInputEvents))
{
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex)*UI()->Scale();
if(w-*Offset > Textbox.w)

View file

@ -152,6 +152,7 @@ class CMenus : public CComponent
// for call vote
int m_CallvoteSelectedOption;
int m_CallvoteSelectedPlayer;
char m_aCallvoteReason[16];
// demo
struct CDemoItem

View file

@ -414,12 +414,28 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
{
m_pClient->m_pVoting->CallvoteKick(m_CallvoteSelectedPlayer);
m_pClient->m_pVoting->CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason);
m_aCallvoteReason[0] = 0;
SetActive(false);
}
}
}
// render kick reason
if(s_ControlPage == 1)
{
CUIRect Reason;
Bottom.VSplitRight(40.0f, &Bottom, 0);
Bottom.VSplitRight(160.0f, &Bottom, &Reason);
Reason.HSplitTop(5.0f, 0, &Reason);
const char *pLabel = Localize("Reason:");
UI()->DoLabel(&Reason, pLabel, 14.0f, -1);
float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1);
Reason.VSplitLeft(w+10.0f, 0, &Reason);
static float s_Offset = 0.0f;
DoEditBox(&m_aCallvoteReason, &Reason, m_aCallvoteReason, sizeof(m_aCallvoteReason), 14.0f, &s_Offset, false, CUI::CORNER_ALL);
}
// force vote button (only available when authed in rcon)
if(Client()->RconAuthed())
{
@ -437,7 +453,8 @@ void CMenus::RenderServerControl(CUIRect MainView)
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
{
m_pClient->m_pVoting->ForcevoteKick(m_CallvoteSelectedPlayer);
m_pClient->m_pVoting->ForcevoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason);
m_aCallvoteReason[0] = 0;
SetActive(false);
}
}

View file

@ -296,7 +296,7 @@ void CScoreboard::RenderRecordingNotification(float x)
Graphics()->QuadsEnd();
//draw the text
TextRender()->Text(0, x+50.0f, 8.0f, 24.0f, "REC", -1);
TextRender()->Text(0, x+50.0f, 8.0f, 24.0f, Localize("REC"), -1);
}
void CScoreboard::OnRender()

View file

@ -29,11 +29,14 @@ void CVoting::Callvote(const char *pType, const char *pValue)
Client()->SendPackMsg(&Msg, MSGFLAG_VITAL);
}
void CVoting::CallvoteKick(int ClientId)
void CVoting::CallvoteKick(int ClientId, const char *pReason)
{
char Buf[32];
str_format(Buf, sizeof(Buf), "%d", ClientId);
Callvote("kick", Buf);
char aBuf[32];
if(pReason[0])
str_format(aBuf, sizeof(aBuf), "%d %s", ClientId, pReason);
else
str_format(aBuf, sizeof(aBuf), "%d", ClientId);
Callvote("kick", aBuf);
}
void CVoting::CallvoteOption(int OptionId)
@ -52,11 +55,14 @@ void CVoting::CallvoteOption(int OptionId)
}
}
void CVoting::ForcevoteKick(int ClientId)
void CVoting::ForcevoteKick(int ClientId, const char *pReason)
{
char Buf[32];
str_format(Buf, sizeof(Buf), "kick %d", ClientId);
Client()->Rcon(Buf);
char aBuf[32];
if(pReason[0])
str_format(aBuf, sizeof(aBuf), "kick %d \"%s\"", ClientId, pReason);
else
str_format(aBuf, sizeof(aBuf), "kick %d", ClientId);
Client()->Rcon(aBuf);
}
void CVoting::ForcevoteOption(int OptionId)

View file

@ -39,9 +39,9 @@ public:
void RenderBars(CUIRect Bars, bool Text);
void CallvoteKick(int ClientId);
void CallvoteKick(int ClientId, const char *pReason);
void CallvoteOption(int Option);
void ForcevoteKick(int ClientId);
void ForcevoteKick(int ClientId, const char *pReason);
void ForcevoteOption(int Option);
void Vote(int v); // -1 = no, 1 = yes

View file

@ -2202,7 +2202,7 @@ static void EditorListdirCallback(const char *pName, int IsDir, int StorageType,
void CEditor::AddFileDialogEntry(int Index, CUIRect *pView)
{
m_FilesCur++;
if(m_FilesCur-1 < m_FilesStartAt || m_FilesCur > m_FilesStopAt)
if(m_FilesCur-1 < m_FilesStartAt || m_FilesCur >= m_FilesStopAt)
return;
CUIRect Button;

View file

@ -853,15 +853,25 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
m_apPlayers[ClientId]->m_Last_KickVote = time_get();
return;
}
str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to kick '%s'", Server()->ClientName(ClientId), Server()->ClientName(KickId));
const char *pReason = "No reason given";
for(const char *p = pMsg->m_Value; *p; ++p)
{
if(*p == ' ')
{
pReason = p+1;
break;
}
}
str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to kick '%s' (%s)", Server()->ClientName(ClientId), Server()->ClientName(KickId), pReason);
str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickId));
if(!g_Config.m_SvVoteKickBantime)
str_format(aCmd, sizeof(aCmd), "kick %d", KickId);
str_format(aCmd, sizeof(aCmd), "kick %d \"Kicked by vote\"", KickId);
else
{
char aBuf[64] = {0};
Server()->GetClientIP(KickId, aBuf, sizeof(aBuf));
str_format(aCmd, sizeof(aCmd), "ban %s %d", aBuf, g_Config.m_SvVoteKickBantime);
str_format(aCmd, sizeof(aCmd), "ban %s %d \"Banned by vote\"", aBuf, g_Config.m_SvVoteKickBantime);
}
m_apPlayers[ClientId]->m_Last_KickVote = time_get();
m_VoteKick = true;