Revert conversion float=> char*=>int

This commit is contained in:
btd 2010-08-27 18:28:01 +04:00
parent b0bf68c3d3
commit b67de28a0c
2 changed files with 10 additions and 10 deletions

View file

@ -735,11 +735,11 @@ void CCharacter::Tick()
if(g_Config.m_SvHideScore || i == m_pPlayer->GetCID())
{
CNetMsg_Sv_PlayerTime Msg;
//char aBuf[16];
//str_format(aBuf, sizeof(aBuf), "%.0f", time*100.0f); // damn ugly but the only way i know to do it
//int TimeToSend;
//sscanf(aBuf, "%d", &TimeToSend);
Msg.m_Time = static_cast<int>(time*100.0f);
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%.0f", time*100.0f); // damn ugly but the only way i know to do it
int TimeToSend;
sscanf(aBuf, "%d", &TimeToSend);
Msg.m_Time = TimeToSend;
Msg.m_Cid = m_pPlayer->GetCID();
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, i);
}

View file

@ -95,12 +95,12 @@ void CPlayer::Tick()
if(m_LastSentTime > GameServer()->m_pController->m_CurrentRecord || (m_LastSentTime == 0 && GameServer()->m_pController->m_CurrentRecord > 0))
{
//dbg_msg("player", "Record message sended");
//char aBuf[16];
//str_format(aBuf, sizeof(aBuf), "%.0f", GameServer()->m_pController->m_CurrentRecord*100.0f); // damn ugly but the only way i know to do it
//int TimeToSend;
//sscanf(aBuf, "%d", &TimeToSend);
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%.0f", GameServer()->m_pController->m_CurrentRecord*100.0f); // damn ugly but the only way i know to do it
int TimeToSend;
sscanf(aBuf, "%d", &TimeToSend);
CNetMsg_Sv_Record Msg;
Msg.m_Time = static_cast<int>(GameServer()->m_pController->m_CurrentRecord*100.0f);
Msg.m_Time = TimeToSend;
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_ClientID);
m_LastSentTime = GameServer()->m_pController->m_CurrentRecord;