[Gcblue-commits] gcb_wx/src/sim tcSimState.cpp,1.75,1.76 tcTime.cpp,1.8,1.9
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-04-08 01:54:22
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7286/src/sim Modified Files: tcSimState.cpp tcTime.cpp Log Message: multiplayer work Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** tcSimState.cpp 6 Apr 2005 02:19:50 -0000 1.75 --- tcSimState.cpp 8 Apr 2005 01:54:12 -0000 1.76 *************** *** 2532,2536 **** { multiplayerMode = MM_OFF; ! RandInit(); tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); --- 2532,2536 ---- { multiplayerMode = MM_OFF; ! tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); *************** *** 2562,2566 **** { multiplayerMode = MM_SERVER; ! RandInit(); tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); --- 2562,2566 ---- { multiplayerMode = MM_SERVER; ! tcGameObject::SetClientMode(false); tcCommandObject::SetClientMode(false); Index: tcTime.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTime.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcTime.cpp 2 Nov 2004 04:23:57 -0000 1.8 --- tcTime.cpp 8 Apr 2005 01:54:12 -0000 1.9 *************** *** 1,20 **** /* ! * Copyright (C) 2003 Dewitt Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ #ifdef WX_PRECOMP --- 1,20 ---- /* ! * Copyright (C) 2003 Dewitt Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ #ifdef WX_PRECOMP *************** *** 36,42 **** tcTime* tcTime::Get() { ! static tcTime instance; ! return &instance; } --- 36,42 ---- tcTime* tcTime::Get() { ! static tcTime instance; ! return &instance; } *************** *** 49,53 **** unsigned tcTime::Get30HzCount() { ! return snCount_30Hz; } --- 49,53 ---- unsigned tcTime::Get30HzCount() { ! return snCount_30Hz; } *************** *** 58,110 **** unsigned tcTime::GetUpdated30HzCount() { ! Update(); ! return snCount_30Hz; } /** ! * Initializes the tcTime object. ! */ void tcTime::Init() { ! if (QueryPerformanceFrequency(&snFrequency) == false) ! { ! MessageBox(NULL, "Error - high performance counter", "Error", MB_OK); ! return; ! } ! snDeltaCount = (DWORD)snFrequency.QuadPart/30; // 30 updates per second } /** ! * Updates the tcTime object. ! */ void tcTime::Update() { ! LARGE_INTEGER nCurrentCount; ! QueryPerformanceCounter(&nCurrentCount); ! if ((nCurrentCount.QuadPart - snLastCount) >= snDeltaCount) ! { ! snCount_30Hz++; ! snLastCount = (DWORD)nCurrentCount.QuadPart; ! } } /** ! * tcTime constructor. ! */ tcTime::tcTime() : ! snDeltaCount(0), ! snLastCount(0), ! snCount_30Hz(0) { ! Init(); } /** ! * tcTime destructor. ! */ tcTime::~tcTime() { --- 58,114 ---- unsigned tcTime::GetUpdated30HzCount() { ! Update(); ! return snCount_30Hz; } /** ! * Initializes the tcTime object. ! */ void tcTime::Init() { ! LARGE_INTEGER frequency; ! if (QueryPerformanceFrequency(&frequency) == false) ! { ! MessageBox(NULL, "Error - high performance counter", "Error", MB_OK); ! return; ! } ! snFrequency = (unsigned long)frequency.QuadPart; ! snDeltaCount = (unsigned int)(snFrequency/30); // 30 updates per second } /** ! * Updates the tcTime object. ! */ void tcTime::Update() { ! LARGE_INTEGER nCurrentCount; ! QueryPerformanceCounter(&nCurrentCount); ! unsigned long currentTime = (unsigned long)nCurrentCount.QuadPart; ! ! while ((currentTime - snLastCount) >= snDeltaCount) ! { ! snCount_30Hz++; ! snLastCount += snDeltaCount; ! } } /** ! * tcTime constructor. ! */ tcTime::tcTime() : ! snDeltaCount(0), ! snLastCount(0), ! snCount_30Hz(0) { ! Init(); } /** ! * tcTime destructor. ! */ tcTime::~tcTime() { |