mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
made broadcast update only when needed
This commit is contained in:
parent
8df6703224
commit
602c697717
|
@ -117,7 +117,7 @@ MACRO_CONFIG_INT(SvSuicidePenalty, sv_suicide_penalty,0,0,9999,CFGFLAG_SERVER, "
|
|||
MACRO_CONFIG_INT(SvVotePercentage, sv_vote_percentage, 50, 1, 100, CFGFLAG_SERVER, "The percent of people that need to agree or deny for the vote to succeed/fail", 3)
|
||||
MACRO_CONFIG_INT(SvShotgunBulletSound, sv_shotgun_bullet_sound, 0, 0, 1, CFGFLAG_SERVER, "Crazy shotgun bullet sound on/off", 3)
|
||||
|
||||
MACRO_CONFIG_INT(SvScoreIP, sv_score_ip, 1, 0, 1, CFGFLAG_SERVER, "Wheather to save also the IP in the score file", 3)
|
||||
MACRO_CONFIG_INT(SvScoreIP, sv_score_ip, 0, 0, 0, CFGFLAG_SERVER, "Wheather to save also the IP in the score file", 3)
|
||||
MACRO_CONFIG_INT(SvCheckpointSave, sv_checkpoint_save, 1, 0, 1, CFGFLAG_SERVER, "Whether to save checkpoint times to the score file", 3)
|
||||
MACRO_CONFIG_STR(SvScoreFolder, sv_score_folder, 32, "records", CFGFLAG_SERVER, "Folder to save score files to", 3)
|
||||
|
||||
|
|
|
@ -655,14 +655,14 @@ void CCharacter::Tick()
|
|||
CGameControllerDDRace* Controller = (CGameControllerDDRace*)GameServer()->m_pController;
|
||||
std::list < int > Indices = GameServer()->Collision()->GetMapIndices(m_PrevPos, m_Pos);
|
||||
//dbg_msg("Indices","%d",Indices.size());
|
||||
if(m_pPlayer->m_ForceBalanced)
|
||||
/*if(m_pPlayer->m_ForceBalanced)
|
||||
{
|
||||
char Buf[128];
|
||||
str_format(Buf, sizeof(Buf), "You were moved to %s due to team balancing", Controller->GetTeamName(m_pPlayer->GetTeam()));
|
||||
GameServer()->SendBroadcast(Buf, m_pPlayer->GetCID());
|
||||
|
||||
m_pPlayer->m_ForceBalanced = false;
|
||||
}
|
||||
}*/
|
||||
m_Armor=(m_FreezeTime != -1)?10-(m_FreezeTime/15):0;
|
||||
if(m_Input.m_Direction != 0 || m_Input.m_Jump != 0)
|
||||
m_LastMove = Server()->Tick();
|
||||
|
@ -729,18 +729,23 @@ void CCharacter::Tick()
|
|||
str_format(aTmp, sizeof(aTmp), "\n%s\n", g_Config.m_SvBroadcast);
|
||||
strcat(aBuftime, aTmp);
|
||||
}
|
||||
GameServer()->SendBroadcast(aBuftime, m_pPlayer->GetCID());
|
||||
if(Server()->Tick() >= (m_LastBroadcast + Server()->TickSpeed()))
|
||||
{
|
||||
GameServer()->SendBroadcast(aBuftime, m_pPlayer->GetCID());
|
||||
m_LastBroadcast = Server()->Tick();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( g_Config.m_SvBroadcast[0] != 0) {
|
||||
if( g_Config.m_SvBroadcast[0] != 0 && (Server()->Tick() > (m_LastBroadcast + (Server()->TickSpeed() * 9)))) {
|
||||
char aTmp[128],aYourBest[64],aServerBest[64];
|
||||
str_format(aYourBest, sizeof(aYourBest), "Your Best:'%s%d:%s%d'", ((pData->m_BestTime / 60) < 10)?"0":"", (int)(pData->m_BestTime / 60), (((int)pData->m_BestTime % 60) < 10)?"0":"", (int)pData->m_BestTime % 60);
|
||||
CPlayerData *pData = GameServer()->Score()->PlayerData(m_pPlayer->GetCID());
|
||||
str_format(aServerBest, sizeof(aServerBest), "Server Best:'%s%d:%s%d'", ((GameServer()->m_pController->m_CurrentRecord / 60) < 10)?"0":"", (int)(GameServer()->m_pController->m_CurrentRecord / 60), (((int)GameServer()->m_pController->m_CurrentRecord % 60) < 10)?"0":"", (int)GameServer()->m_pController->m_CurrentRecord % 60);
|
||||
str_format(aTmp, sizeof(aTmp), "%s\n%s %s", g_Config.m_SvBroadcast, (GameServer()->m_pController->m_CurrentRecord)?aServerBest:"", (pData->m_BestTime)?aYourBest:"");
|
||||
GameServer()->SendBroadcast(aTmp, m_pPlayer->GetCID());
|
||||
m_LastBroadcast = Server()->Tick();
|
||||
}
|
||||
}
|
||||
m_RefreshTime = Server()->Tick();
|
||||
|
|
|
@ -28,6 +28,7 @@ class CCharacter : public CEntity
|
|||
void HandleFly();
|
||||
void HandleTiles(int Index);
|
||||
float m_Time;
|
||||
int m_LastBroadcast;
|
||||
public:
|
||||
//character's size
|
||||
static const int ms_PhysSize = 28;
|
||||
|
|
Loading…
Reference in a new issue