This commit is contained in:
GreYFoXGTi 2010-08-26 19:57:49 +02:00
commit 181d55f125
4 changed files with 26 additions and 15 deletions

View file

@ -669,7 +669,7 @@ void CCharacter::Tick()
m_RefreshTime = Server()->Tick();
m_RaceState = RACE_STARTED;
}
int z = GameServer()->Collision()->IsTeleport(m_Pos.x, m_Pos.y);
if(((TileIndex1 == TILE_END) || (TileIndex2 == TILE_END)) && m_RaceState == RACE_STARTED)
{
char aBuf[128];
@ -699,11 +699,15 @@ void CCharacter::Tick()
}
// update server best time
if(!GameServer()->m_pController->m_CurrentRecord || time < GameServer()->m_pController->m_CurrentRecord)
if(GameServer()->m_pController->m_CurrentRecord == 0 || time < GameServer()->m_pController->m_CurrentRecord)
{
// check for nameless
if(str_comp_num(Server()->ClientName(m_pPlayer->GetCID()), "nameless tee", 12) != 0)
if(str_comp_num(Server()->ClientName(m_pPlayer->GetCID()), "nameless tee", 12) != 0) {
GameServer()->m_pController->m_CurrentRecord = time;
//dbg_msg("character", "Finish");
// GetPlayer()->SendServerRecord();
}
}
m_RaceState = RACE_NONE;
@ -720,11 +724,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 = TimeToSend;
//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);
Msg.m_Cid = m_pPlayer->GetCID();
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, i);
}
@ -887,8 +891,11 @@ void CCharacter::Tick()
m_Core.m_Vel += Direction*Force;
}
int z = GameServer()->Collision()->IsTeleport(m_Pos.x, m_Pos.y);
if(z)
{
dbg_msg("Collision", "This is teleport");
m_Core.m_HookedPlayer = -1;
m_Core.m_HookState = HOOK_RETRACTED;
m_Core.m_TriggeredEvents |= COREEVENT_HOOK_RETRACT;

View file

@ -42,6 +42,8 @@ IGameController::IGameController(class CGameContext *pGameServer)
m_aNumSpawnPoints[0] = 0;
m_aNumSpawnPoints[1] = 0;
m_aNumSpawnPoints[2] = 0;
m_CurrentRecord = 0;
}
IGameController::~IGameController()

View file

@ -92,14 +92,15 @@ void CPlayer::Tick()
// send best time
if(m_IsUsingRaceClient)
{
if(m_LastSentTime > GameServer()->m_pController->m_CurrentRecord || (!m_LastSentTime && GameServer()->m_pController->m_CurrentRecord))
if(m_LastSentTime > GameServer()->m_pController->m_CurrentRecord || (m_LastSentTime == 0 && GameServer()->m_pController->m_CurrentRecord > 0))
{
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);
//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);
CNetMsg_Sv_Record Msg;
Msg.m_Time = TimeToSend;
Msg.m_Time = static_cast<int>(GameServer()->m_pController->m_CurrentRecord*100.0f);
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_ClientID);
m_LastSentTime = GameServer()->m_pController->m_CurrentRecord;

View file

@ -22,6 +22,7 @@ public:
int GetTeam() const { return m_Team; };
int GetCID() const { return m_ClientID; };
void Tick();
void Snap(int SnappingClient);