gcblue-commits Mailing List for Global Conflict Blue (Page 53)
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
| 2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
| 2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
|
From: Dewitt C. <ddc...@us...> - 2004-05-24 00:15:01
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26112/src/sim Modified Files: Game.cpp tcAirObject.cpp tcESMSensor.cpp tcFlightPort.cpp tcLauncherState.cpp tcObjectControl.cpp tcPlatformObject.cpp tcRadar.cpp tcSensorState.cpp tcSimState.cpp Added Files: tcChatBox.cpp tcCommandObject.cpp tcLauncher.cpp Log Message: Multiplayer changes Index: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcFlightPort.cpp 29 Jan 2004 00:05:38 -0000 1.6 --- tcFlightPort.cpp 24 May 2004 00:14:47 -0000 1.7 *************** *** 30,33 **** --- 30,34 ---- #include "tcFlightPort.h" #include "tcAirObject.h" + #include "tcAeroAirObject.h" #include "tcFlightportDBObject.h" #include "tcGenericDBObject.h" *************** *** 432,437 **** unit->mcKin.mfLon_rad += delta_lon; ! tcAirObject *air_unit = dynamic_cast<tcAirObject*>(unit); ! if (air_unit) { air_unit->SetSpeed(air_unit->mpDBObject->mfMaxSpeed_kts); --- 433,443 ---- unit->mcKin.mfLon_rad += delta_lon; ! if (tcAeroAirObject* aa_unit = dynamic_cast<tcAeroAirObject*>(unit)) ! { ! aa_unit->SetThrottleFraction(1.1); ! aa_unit->SetAltitude(unit->mcKin.mfAlt_m + 500.0f); ! aa_unit->SetLandingState(0); ! } ! else if (tcAirObject *air_unit = dynamic_cast<tcAirObject*>(unit)) { air_unit->SetSpeed(air_unit->mpDBObject->mfMaxSpeed_kts); --- NEW FILE: tcChatBox.cpp --- /** tcChatBox.cpp */ /* ** Copyright (C) 2003-2004 Dewitt "Cole" 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 */ #include "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" #endif #endif #include "tcChatBox.h" #include "tcButton.h" #include "tcEditBox.h" #include "tcConsoleBox.h" #include "common/tinyxml.h" #include "network/tcMultiplayerInterface.h" #include "wxcommands.h" #include "common/tcOptions.h" using namespace Gdiplus; BEGIN_EVENT_TABLE(tcChatBox, tcStandardWindow) EVT_COMMAND(1, wxEVT_COMMAND_TEXT_UPDATED, tcChatBox::SendChatText) END_EVENT_TABLE() #ifdef _DEBUG #define new DEBUG_NEW #endif using network::tcMultiplayerInterface; int tcChatBox::Draw() { Graphics *graphics; Erase(); if (!GetGraphics(graphics)) { return false; } DrawBackground(graphics); DrawChildren(graphics); ReleaseGraphics(graphics); return true; } void tcChatBox::OnLButtonDown(wxMouseEvent& event) { } /** * Send chat text to all connections */ void tcChatBox::SendChatText(wxCommandEvent& event) { tcMultiplayerInterface* multiplayerInterface = tcMultiplayerInterface::Get(); bool isServer = multiplayerInterface->IsServer(); std::string chatText = event.GetString().c_str(); if (isServer && (multiplayerInterface->IsCommand(chatText))) { chatHistory->Print(chatText.c_str()); multiplayerInterface->ProcessCommandServer(chatText); return; } /* prepend name tag if server, this is done for clients by server, server has ** to do tagging itself */ if (isServer) { chatText = std::string("<") + multiplayerInterface->GetName() + std::string("> ") + chatText; } unsigned nConnections = multiplayerInterface->GetNumConnections(); for (unsigned n=0;n<nConnections;n++) { int connId = tcMultiplayerInterface::Get()->GetConnectionId(n); tcMultiplayerInterface::Get()->SendChatText(connId, chatText); } // if server, print chat text locally since no echo comes back if (isServer) { chatHistory->Print(chatText.c_str()); } } /** * @param surfaceHost tcWindow to share surface of */ tcChatBox::tcChatBox(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name, const wxString& configFile) : tcStandardWindow(parent, pos, size, configFile, name, surfaceHost) { LoadBackgroundImage("background.jpg"); if (config) { AddXMLControls(); } else { std::cerr << "tcChatBox::tcChatBox - NULL xml config node\n"; return; } TiXmlNode* root = config->FirstChild("Window"); if (!root) { std::cerr << "tcChatBox::tcChatBox - Missing top level <Window> tag\n"; return; } // add chat text console TiXmlNode* current = root->FirstChild("ChatBox"); chatHistory = new tcConsoleBox(this, current); tcMultiplayerInterface::Get()->AddChatSubscriber(chatHistory); // add chat text edit box current = root->FirstChild("ChatEntry"); chatEntry = new tcEditBox(this, current); chatEntry->SetCommand(1); chatEntry->SetClearOnReturn(true); chatEntry->SetBuffer("Enter chat text here"); } tcChatBox::~tcChatBox() { tcMultiplayerInterface::Get()->RemoveChatSubscriber(chatHistory); } Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcPlatformObject.cpp 1 May 2004 21:49:06 -0000 1.22 --- tcPlatformObject.cpp 24 May 2004 00:14:47 -0000 1.23 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,5 ---- ! /** @file tcPlatformObject.cpp ! ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 30,33 **** --- 31,35 ---- #include "tcRadar.h" #include "tcESMSensor.h" + #include "tcLauncher.h" #include "tc3DModel.h" #include "common/tcStream.h" *************** *** 36,40 **** using namespace AI; ! void tcPlatformObject::DesignateDatum(tcPoint p) { float fRange_km; --- 38,43 ---- using namespace AI; ! void tcPlatformObject::DesignateDatum(tcPoint p) ! { float fRange_km; *************** *** 44,48 **** fRange_km = mcKin.RangeToKm(&msTargetDatum); tcString s; ! s.Format("datum is %3.1f km from platform",fRange_km); WTLC(s.GetBuffer()); } --- 47,51 ---- fRange_km = mcKin.RangeToKm(&msTargetDatum); tcString s; ! s.Format("datum is %3.1f km from platform", fRange_km); WTLC(s.GetBuffer()); } *************** *** 69,73 **** { mcAI.SetTarget(anID); ! unsigned nLaunchers = mcLauncherState.launchers.size(); for (size_t n=0; n<nLaunchers; n++) { --- 72,76 ---- { mcAI.SetTarget(anID); ! unsigned nLaunchers = mcLauncherState.GetLauncherCount(); for (size_t n=0; n<nLaunchers; n++) { *************** *** 77,82 **** // update guidance to maintain/achieve formation position ! void tcPlatformObject::UpdateFormationGuidance() { ! if (!msFormationParameters.mbFormation) { return; // return without modifying kgoal } --- 80,87 ---- // update guidance to maintain/achieve formation position ! void tcPlatformObject::UpdateFormationGuidance() ! { ! if (!msFormationParameters.mbFormation) ! { return; // return without modifying kgoal } *************** *** 89,111 **** mcGS.mfGoalHeading_deg = fHeading_rad; ! if (fRange_km <= 0.1f) { mcGS.mfGoalSpeed_kts = pFP->mcFormationKin.mfSpeed_kts; mcGS.mfGoalHeading_deg = pFP->mcFormationKin.mfHeading_rad; ! if (fHeading_rad > 0) { ! if (fHeading_rad < C_PIOVER2) { mcGS.mfGoalSpeed_kts += 1.5f; mcGS.mfGoalHeading_deg += 0.5f; } ! else { mcGS.mfGoalSpeed_kts -= 1.5f; mcGS.mfGoalHeading_deg += 0.5f; } } ! else { ! if (fHeading_rad > -C_PIOVER2) { mcGS.mfGoalSpeed_kts += 1.5f; mcGS.mfGoalHeading_deg -= 0.5f; } ! else { mcGS.mfGoalSpeed_kts -= 1.5f; mcGS.mfGoalHeading_deg -= 0.5f; --- 94,123 ---- mcGS.mfGoalHeading_deg = fHeading_rad; ! if (fRange_km <= 0.1f) ! { mcGS.mfGoalSpeed_kts = pFP->mcFormationKin.mfSpeed_kts; mcGS.mfGoalHeading_deg = pFP->mcFormationKin.mfHeading_rad; ! if (fHeading_rad > 0) ! { ! if (fHeading_rad < C_PIOVER2) ! { mcGS.mfGoalSpeed_kts += 1.5f; mcGS.mfGoalHeading_deg += 0.5f; } ! else ! { mcGS.mfGoalSpeed_kts -= 1.5f; mcGS.mfGoalHeading_deg += 0.5f; } } ! else ! { ! if (fHeading_rad > -C_PIOVER2) ! { mcGS.mfGoalSpeed_kts += 1.5f; mcGS.mfGoalHeading_deg -= 0.5f; } ! else ! { mcGS.mfGoalSpeed_kts -= 1.5f; mcGS.mfGoalHeading_deg -= 0.5f; *************** *** 113,128 **** } } ! else if (fRange_km <= 2.0f) { mcGS.mfGoalSpeed_kts = mpDBObject->mfMaxSpeed_kts; ! if ((mcGS.mfGoalSpeed_kts - pFP->mcFormationKin.mfSpeed_kts) > 50.0f) { mcGS.mfGoalSpeed_kts = pFP->mcFormationKin.mfSpeed_kts + 50.0f; } } ! else { mcGS.mfGoalSpeed_kts = mpDBObject->mfMaxSpeed_kts; } if (mcGS.mfGoalSpeed_kts < 0) {mcGS.mfGoalSpeed_kts = 0;} ! if (mcGS.mfGoalSpeed_kts > mpDBObject->mfMaxSpeed_kts) { mcGS.mfGoalSpeed_kts = mpDBObject->mfMaxSpeed_kts; } --- 125,144 ---- } } ! else if (fRange_km <= 2.0f) ! { mcGS.mfGoalSpeed_kts = mpDBObject->mfMaxSpeed_kts; ! if ((mcGS.mfGoalSpeed_kts - pFP->mcFormationKin.mfSpeed_kts) > 50.0f) ! { mcGS.mfGoalSpeed_kts = pFP->mcFormationKin.mfSpeed_kts + 50.0f; } } ! else ! { mcGS.mfGoalSpeed_kts = mpDBObject->mfMaxSpeed_kts; } if (mcGS.mfGoalSpeed_kts < 0) {mcGS.mfGoalSpeed_kts = 0;} ! if (mcGS.mfGoalSpeed_kts > mpDBObject->mfMaxSpeed_kts) ! { mcGS.mfGoalSpeed_kts = mpDBObject->mfMaxSpeed_kts; } *************** *** 130,135 **** } ! // turn by maximum amount toward goal heading ! void tcPlatformObject::UpdateHeading(float dt_s) { float dh_rad = mcGS.mfGoalHeading_deg - mcKin.mfHeading_rad; radtoplusminuspi(dh_rad); // map dh_deg to [-180,180] --- 146,154 ---- } ! /** ! * turn by maximum amount toward goal heading ! */ ! void tcPlatformObject::UpdateHeading(float dt_s) ! { float dh_rad = mcGS.mfGoalHeading_deg - mcKin.mfHeading_rad; radtoplusminuspi(dh_rad); // map dh_deg to [-180,180] *************** *** 169,174 **** } ! // adjust speed to goal speed, limited by max acceleration ! void tcPlatformObject::UpdateSpeed(float dt_s) { float ds_kts = mcGS.mfGoalSpeed_kts - mcKin.mfSpeed_kts; float ds_max = mpDBObject->mfAccel_ktsps*dt_s; --- 188,196 ---- } ! /** ! * adjust speed to goal speed, limited by max acceleration ! */ ! void tcPlatformObject::UpdateSpeed(float dt_s) ! { float ds_kts = mcGS.mfGoalSpeed_kts - mcKin.mfSpeed_kts; float ds_max = mpDBObject->mfAccel_ktsps*dt_s; *************** *** 197,213 **** } ! /*** update launcher state (reload time) ***/ void tcPlatformObject::UpdateLauncherState(float dt_s) { ! for(int i=0;i<mcLauncherState.mnCount;i++) ! { ! if (mcLauncherState.launchers[i].mbActive) ! { ! if (mcLauncherState.launchers[i].mfTimeToReady > 0) ! { ! mcLauncherState.launchers[i].mfTimeToReady -= dt_s; ! } ! } ! } } --- 219,228 ---- } ! /** ! * update launcher state (reload time) ! */ void tcPlatformObject::UpdateLauncherState(float dt_s) { ! mcLauncherState.Update(dt_s); } *************** *** 252,264 **** } ! //---------------------------------------------------------------------------- ! int tcPlatformObject::GetLauncherQuantity(unsigned anLauncher) { return mcLauncherState.GetLauncherQuantity(anLauncher); } ! /******************************************************************************/ ! // consider all active (mbActive) sensors ! bool tcPlatformObject::HasActivatedSensor(void) { int nSensors = (int)mapSensorState.size(); ! for (int k=0;k<nSensors;k++) { tcSensorState *pSensorState = mapSensorState[k]; if (pSensorState->GetActive()) {return true;} --- 267,294 ---- } ! /** ! * ! */ ! int tcPlatformObject::GetLauncherQuantity(unsigned anLauncher) ! { return mcLauncherState.GetLauncherQuantity(anLauncher); } ! ! /** ! * @return number of sensors on platform ! */ ! unsigned tcPlatformObject::GetSensorCount() const ! { ! return (unsigned)mapSensorState.size(); ! } ! ! /** ! * consider all active (mbActive) sensors ! */ ! bool tcPlatformObject::HasActivatedSensor() ! { int nSensors = (int)mapSensorState.size(); ! for (int k=0;k<nSensors;k++) ! { tcSensorState *pSensorState = mapSensorState[k]; if (pSensorState->GetActive()) {return true;} *************** *** 277,287 **** } ! /******************************************************************************/ ! // consider only active radars ! bool tcPlatformObject::IsRadiating() { int nSensors = (int)mapSensorState.size(); ! for (int k=0;k<nSensors;k++) { tcSensorState *pSensorState = mapSensorState[k]; ! if (dynamic_cast<tcRadar*>(pSensorState)) { if (pSensorState->GetActive()) {return true;} } --- 307,321 ---- } ! /** ! * consider only active radars ! */ ! bool tcPlatformObject::IsRadiating() ! { int nSensors = (int)mapSensorState.size(); ! for (int k=0;k<nSensors;k++) ! { tcSensorState *pSensorState = mapSensorState[k]; ! if (dynamic_cast<tcRadar*>(pSensorState)) ! { if (pSensorState->GetActive()) {return true;} } *************** *** 289,293 **** return false; } ! /******************************************************************************/ void tcPlatformObject::Clear() { --- 323,327 ---- return false; } ! void tcPlatformObject::Clear() { *************** *** 301,340 **** fuel_kg = 0; lastHeadingDelta = 0; - - newCommand = false; - commandStatus = 0; } ! tcSensorState* tcPlatformObject::GetSensor(unsigned idx) { ! if (idx >= mapSensorState.size()) return NULL; else return mapSensorState[idx]; } ! /******************************************************************************/ ! // return key of object to launch, otherwise NULL_INDEX ! void tcPlatformObject::Launch(tnPoolIndex& rnKey, unsigned& rnLauncher) { ! int nLaunchers = mcLauncherState.mnCount; ! tsLData *pLauncher; ! for (int n=0;n<nLaunchers;n++) ! { ! pLauncher = &mcLauncherState.launchers[n]; ! if ((pLauncher->mbActive)&&(pLauncher->mnPending > 0)) ! { ! bool bLaunch = (pLauncher->mnCurrent > 0)&&(pLauncher->mfTimeToReady <= 0); ! if (bLaunch) ! { ! pLauncher->mnCurrent--; ! pLauncher->mnPending--; ! rnKey = pLauncher->mnChildDBKey; ! rnLauncher = n; ! pLauncher->mfTimeToReady = 2.0f; // TODO: add db parameter for this ! return; ! } ! } ! } ! rnKey = NULL_INDEX; ! rnLauncher = 0; } --- 335,361 ---- fuel_kg = 0; lastHeadingDelta = 0; } ! const tcSensorState* tcPlatformObject::GetSensor(unsigned idx) { ! if (idx >= mapSensorState.size()) return 0; else return mapSensorState[idx]; } ! /** ! * This version is used for non-const access to the sensor ! */ ! tcSensorState* tcPlatformObject::GetSensorMutable(unsigned idx) ! { ! if (idx >= mapSensorState.size()) return 0; ! else return mapSensorState[idx]; ! } ! /** ! * @return key of object to launch, otherwise NULL_INDEX ! */ ! void tcPlatformObject::Launch(tnPoolIndex& rnKey, unsigned& rnLauncher) ! { ! mcLauncherState.Launch(rnKey, rnLauncher); } *************** *** 345,350 **** { mcGS.SetAltitude(new_altitude_m); ! commandStatus |= ALT_CMD; ! newCommand = true; } --- 366,370 ---- { mcGS.SetAltitude(new_altitude_m); ! commandObj.SetNewCommand(ALT_CMD); } *************** *** 355,360 **** { mcGS.SetHeading(afNewHeading); ! commandStatus |= HEADING_CMD; ! newCommand = true; } --- 375,389 ---- { mcGS.SetHeading(afNewHeading); ! commandObj.SetNewCommand(HEADING_CMD); ! } ! ! /** ! * Used to active/deactive sensor on platform ! */ ! void tcPlatformObject::SetSensorState(unsigned idx, bool state) ! { ! if (idx >= mapSensorState.size()) return; // error ! mapSensorState[idx]->SetActive(state); ! sensorCommandObj.SetNewCommand(0x01 << idx); } *************** *** 367,372 **** { mcGS.SetSpeed(afNewSpeed); ! commandStatus |= SPEED_CMD; ! newCommand = true; } --- 396,400 ---- { mcGS.SetSpeed(afNewSpeed); ! commandObj.SetNewCommand(SPEED_CMD); } *************** *** 378,395 **** int tcPlatformObject::SetLaunch(int anLauncher, int anQuantity) { ! int statusCode; ! ! statusCode = mcLauncherState.GetLauncherStatus(anLauncher); ! if (statusCode != tcLauncherState::LAUNCHER_READY) return statusCode; ! ! tsLData *pLauncher = &mcLauncherState.launchers[anLauncher]; ! ! pLauncher->mnPending += anQuantity; ! if (pLauncher->mnPending > pLauncher->mnCurrent) {pLauncher->mnPending=pLauncher->mnCurrent;} ! return tcLauncherState::LAUNCHER_READY; } ! /******************************************************************************/ void tcPlatformObject::RandInitNear(float afLon_deg, float afLat_deg) { --- 406,414 ---- int tcPlatformObject::SetLaunch(int anLauncher, int anQuantity) { ! return mcLauncherState.SetLaunch(anLauncher, anQuantity); } ! void tcPlatformObject::RandInitNear(float afLon_deg, float afLat_deg) { *************** *** 416,420 **** } ! /******************************************************************************/ void tcPlatformObject::PrintToFile(tcFile& file) { --- 435,439 ---- } ! void tcPlatformObject::PrintToFile(tcFile& file) { *************** *** 433,438 **** for(int i=0;i<nLaunchers;i++) { ! s.Format(" LAU%d: %s x %d\n",i,mcLauncherState.launchers[i].mpLauncherDBObj->mzChildClass.mz, ! mcLauncherState.launchers[i].mnCurrent); file.WriteString(s.GetBuffer()); } --- 452,458 ---- for(int i=0;i<nLaunchers;i++) { ! s.Format(" LAU%d: %s x %d\n",i, ! mcLauncherState.GetLauncherChildClass(i), ! mcLauncherState.GetLauncherQuantity(i)); file.WriteString(s.GetBuffer()); } *************** *** 449,453 **** } } ! /******************************************************************************/ void tcPlatformObject::SaveToFile(tcFile& file) { --- 469,473 ---- } } ! void tcPlatformObject::SaveToFile(tcFile& file) { *************** *** 468,472 **** } /******************************************************************************/ ! void tcPlatformObject::LoadFromFile(tcFile& file) { tcGameObject::LoadFromFile(file); --- 488,493 ---- } /******************************************************************************/ ! void tcPlatformObject::LoadFromFile(tcFile& file) ! { tcGameObject::LoadFromFile(file); *************** *** 475,479 **** // assumes that sensors already created by higher level serialize method int nSensors = (int)mapSensorState.size(); ! for(int i=0;i<nSensors;i++) { tcSensorState*& pss = mapSensorState[i]; pss->Serialize(file,true); --- 496,501 ---- // assumes that sensors already created by higher level serialize method int nSensors = (int)mapSensorState.size(); ! for(int i=0;i<nSensors;i++) ! { tcSensorState*& pss = mapSensorState[i]; pss->Serialize(file,true); *************** *** 487,494 **** /******************************************************************************/ void tcPlatformObject::Serialize(tcFile& file, bool mbLoad) { ! if (mbLoad) { LoadFromFile(file); } ! else { SaveToFile(file); } --- 509,518 ---- /******************************************************************************/ void tcPlatformObject::Serialize(tcFile& file, bool mbLoad) { ! if (mbLoad) ! { LoadFromFile(file); } ! else ! { SaveToFile(file); } *************** *** 497,564 **** /** - * Used with multiplayer client to load a parameter from the server that - * the client can command e.g. heading, speed, altitude. If a client command - * request is outstanding and the server update does not match, then the update - * is ignored. If the update matches, the command flag is cleared representing - * a successful acknowledge of the command. - */ - void tcPlatformObject::LoadCommandParam(tcCommandStream& stream, float& param, int& cmdStatus, int flag) - { - float temp; - stream >> temp; // read into temporary variable - - if (stream.GetAck()) - { - if ((cmdStatus & flag) && (temp == param)) - { - cmdStatus &= (~flag); // clear flag, successful ack - } - } - else // not an ack - { - if (clientMode && (cmdStatus & flag)) - { - // ignore update - } - else - { - param = temp; // apply update - cmdStatus &= (~flag); // clear flag - } - - } - } - - /** - * version that takes int param - */ - void tcPlatformObject::LoadCommandParam(tcCommandStream& stream, int& param, int& cmdStatus, int flag) - { - int temp; - stream >> temp; // read into temporary variable - - if (stream.GetAck()) - { - if ((cmdStatus & flag) && (temp == param)) - { - cmdStatus &= (~flag); // clear flag, successful ack - } - } - else // not an ack - { - if (clientMode && (cmdStatus & flag)) - { - // ignore update - } - else - { - param = temp; // apply update - cmdStatus &= (~flag); // clear flag - } - - } - } - - /** * Loads state from command stream */ --- 521,524 ---- *************** *** 572,578 **** if (updateMask & UPDATE_GUIDANCE) { ! LoadCommandParam(stream, mcGS.mfGoalHeading_deg, commandStatus, HEADING_CMD); ! LoadCommandParam(stream, mcGS.mfGoalSpeed_kts, commandStatus, SPEED_CMD); ! LoadCommandParam(stream, mcGS.mfGoalAltitude_m, commandStatus, ALT_CMD); stream >> mcGS.mbIntercept; --- 532,539 ---- if (updateMask & UPDATE_GUIDANCE) { ! ! commandObj.LoadCommandParam(stream, mcGS.mfGoalHeading_deg, HEADING_CMD); ! commandObj.LoadCommandParam(stream, mcGS.mfGoalSpeed_kts, SPEED_CMD); ! commandObj.LoadCommandParam(stream, mcGS.mfGoalAltitude_m, ALT_CMD); stream >> mcGS.mbIntercept; *************** *** 582,585 **** --- 543,560 ---- } } + + if (updateMask & UPDATE_LAUNCHERS) + { + mcLauncherState << stream; + } + + if (updateMask & UPDATE_SENSORS) + { + size_t nSensors = mapSensorState.size(); + for(size_t n=0; n < nSensors; n++) + { + sensorCommandObj.LoadCommandParam(stream, mapSensorState[n]->mbActive, (0x01) << n); + } + } return stream; *************** *** 593,602 **** tcGameObject::operator>>(stream); unsigned char updateMask = 0; ! ! updateMask = UPDATE_GUIDANCE; stream << updateMask; if (updateMask & UPDATE_GUIDANCE) { --- 568,586 ---- tcGameObject::operator>>(stream); + // form update mask unsigned char updateMask = 0; ! updateMask = UPDATE_GUIDANCE; // always update guidance for now ! if (stream.isAck || mcLauncherState.HasUnacknowledgedCommand()) ! { ! updateMask |= UPDATE_LAUNCHERS; ! } ! if (stream.isAck || sensorCommandObj.HasUnacknowledgedCommand()) ! { ! updateMask |= UPDATE_SENSORS; ! } stream << updateMask; + if (updateMask & UPDATE_GUIDANCE) { *************** *** 611,614 **** --- 595,612 ---- } } + + if (updateMask & UPDATE_LAUNCHERS) + { + mcLauncherState >> stream; + } + + if (updateMask & UPDATE_SENSORS) + { + size_t nSensors = mapSensorState.size(); + for(size_t n=0; n < nSensors; n++) + { + stream << mapSensorState[n]->mbActive; + } + } *************** *** 644,647 **** --- 642,647 ---- tcGameObject::operator<<(stream); + mcLauncherState.operator<<(stream); + return stream; } *************** *** 654,657 **** --- 654,659 ---- tcGameObject::operator>>(stream); + mcLauncherState.operator>>(stream); + return stream; } *************** *** 659,677 **** void tcPlatformObject::ClearNewCommand() { ! newCommand = false; } bool tcPlatformObject::HasNewCommand() const { ! return newCommand; } bool tcPlatformObject::HasUnacknowledgedCommand() const { ! return (commandStatus != 0); } - /******************************************************************************/ tcPlatformObject::tcPlatformObject() --- 661,682 ---- void tcPlatformObject::ClearNewCommand() { ! commandObj.ClearNewCommand(); ! mcLauncherState.ClearNewCommand(); ! sensorCommandObj.ClearNewCommand(); } bool tcPlatformObject::HasNewCommand() const { ! return commandObj.HasNewCommand() || mcLauncherState.HasNewCommand() || ! sensorCommandObj.HasNewCommand(); } bool tcPlatformObject::HasUnacknowledgedCommand() const { ! return commandObj.HasUnacknowledgedCommand() || mcLauncherState.HasNewCommand() || ! sensorCommandObj.HasUnacknowledgedCommand(); } /******************************************************************************/ tcPlatformObject::tcPlatformObject() *************** *** 696,700 **** { std::string fcSensor = ! mcLauncherState.launchers[nLauncher].mpLauncherDBObj->fireControlSensorClass; // search for sensor and add if match bool bSearching = fcSensor.length() > 1; --- 701,705 ---- { std::string fcSensor = ! mcLauncherState.GetFireControlSensorClass(nLauncher); // search for sensor and add if match bool bSearching = fcSensor.length() > 1; *************** *** 720,724 **** tcPlatformObject::tcPlatformObject(tcGenericDBObject *obj) ! : tcGameObject(obj), newCommand(false), commandStatus(0) { using namespace Database; --- 725,729 ---- tcPlatformObject::tcPlatformObject(tcGenericDBObject *obj) ! : tcGameObject(obj) { using namespace Database; *************** *** 790,794 **** } /******************************************************************************/ ! tcPlatformObject::tcPlatformObject(tcPlatformObject& o) : tcGameObject(o) { fuel_kg = o.fuel_kg; --- 795,800 ---- } /******************************************************************************/ ! tcPlatformObject::tcPlatformObject(tcPlatformObject& o) : tcGameObject(o), ! commandObj(o.commandObj) { fuel_kg = o.fuel_kg; *************** *** 802,807 **** msTargetDatum = o.msTargetDatum; ! newCommand = o.newCommand; ! commandStatus = o.commandStatus; // copy sensor state array --- 808,812 ---- msTargetDatum = o.msTargetDatum; ! // copy sensor state array Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcObjectControl.cpp 14 May 2004 23:37:08 -0000 1.15 --- tcObjectControl.cpp 24 May 2004 00:14:47 -0000 1.16 *************** *** 2,6 **** ** tcObjectControl.cpp ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcObjectControl.cpp ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. [...2911 lines suppressed...] ! } ! mpFontLarge = new Font(&ff,14,FontStyleBold,UnitPixel); ! if (mpFontLarge == NULL) ! { ! WTL("tcObjectControl - mpFontLarge creation failed\n"); ! } ! mpBrush = new SolidBrush(Color(254,100,255,100)); ! if (mpBrush == NULL) ! { ! WTL("tcObjectControl - mpBrush creation failed\n"); ! } } tcObjectControl::~tcObjectControl() { ! if (mpPen != NULL) {delete mpPen;} ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontLarge != NULL) {delete mpFontLarge;} ! if (mpBrush != NULL) {delete mpBrush;} } Index: tcESMSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcESMSensor.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcESMSensor.cpp 23 Apr 2004 00:15:17 -0000 1.4 --- tcESMSensor.cpp 24 May 2004 00:14:47 -0000 1.5 *************** *** 154,158 **** return(*this); } ! /** * Load state from stream --- 154,158 ---- return(*this); } ! #if 0 /** * Load state from stream *************** *** 174,178 **** return stream; } ! /** * --- 174,178 ---- return stream; } ! #endif /** * --- NEW FILE: tcCommandObject.cpp --- /** @file tcCommandObject.cpp ** ** Copyright (C) 2003-2004 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 */ #include "stdwx.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "tcCommandObject.h" #include "tcLauncher.h" #include "common/tcStream.h" #include "common/tcObjStream.h" bool tcCommandObject::clientMode = false; void tcCommandObject::ClearNewCommand() { newCommand = false; } bool tcCommandObject::HasNewCommand() const { return newCommand; } bool tcCommandObject::HasUnacknowledgedCommand() const { return (commandStatus != 0); } /** * Used with multiplayer client to load a parameter from the server that * the client can command e.g. heading, speed, altitude. If a client command * request is outstanding and the server update does not match, then the update * is ignored. If the update matches, the command flag is cleared representing * a successful acknowledge of the command. */ void tcCommandObject::LoadCommandParam(tcCommandStream& stream, float& param, int flag) { float temp; stream >> temp; // read into temporary variable if (stream.GetAck()) { if ((commandStatus & flag) && (temp == param)) { commandStatus &= (~flag); // clear flag, successful ack } } else // not an ack { if (clientMode && (commandStatus & flag)) { // ignore update } else { param = temp; // apply update commandStatus &= (~flag); // clear flag } } } /** * version that takes int param */ void tcCommandObject::LoadCommandParam(tcCommandStream& stream, int& param, int flag) { int temp; stream >> temp; // read into temporary variable if (stream.GetAck()) { if ((commandStatus & flag) && (temp == param)) { commandStatus &= (~flag); // clear flag, successful ack } } else // not an ack { if (clientMode && (commandStatus & flag)) { // ignore update } else { param = temp; // apply update commandStatus &= (~flag); // clear flag } } } /** * version that takes tcLauncher param */ void tcCommandObject::LoadCommandParam(tcCommandStream& stream, tcLauncher& param, int flag) { tcLauncher temp; temp << stream; // read into temporary obj if (stream.GetAck()) { if ((commandStatus & flag) && (temp.CommandInfoMatches(param))) { commandStatus &= (~flag); // clear flag, successful ack } } else // not an ack { if (clientMode && (commandStatus & flag)) { // ignore update } else { param.CopyCommandInfoFrom(temp); // apply update commandStatus &= (~flag); // clear flag } } } /** * Called on new command. Sets bit in commandStatus and * sets newCommand to true. */ void tcCommandObject::SetNewCommand(int flag) { commandStatus |= flag; newCommand = true; } tcCommandObject::tcCommandObject() : commandStatus(0), newCommand(0) { } tcCommandObject::~tcCommandObject() { } Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** tcSimState.cpp 9 May 2004 20:40:23 -0000 1.43 --- tcSimState.cpp 24 May 2004 00:14:47 -0000 1.44 *************** *** 36,42 **** --- 36,44 ---- #include "tcAirObject.h" #include "tcAeroAirObject.h" + #include "tcLauncher.h" #include "tcAirDBObject.h" #include "tc3DModel.h" #include "tcGameObjIterator.h" + #include "tcCommandObject.h" #include "common/tcStream.h" *************** *** 233,237 **** if (pLauncherState==NULL) {return false;} if (anLauncher>=(unsigned)pLauncherState->mnCount) {return false;} // invalid anLauncher ! tsLData *pLauncher = &pLauncherState->launchers[anLauncher]; if (pLauncher->mnCurrent <= 0) {return false;} // launcher empty if (pLauncher->mfTimeToReady > 0) {return false;} // launcher not ready --- 235,239 ---- if (pLauncherState==NULL) {return false;} if (anLauncher>=(unsigned)pLauncherState->mnCount) {return false;} // invalid anLauncher ! tcLauncher *pLauncher = &pLauncherState->launchers[anLauncher]; if (pLauncher->mnCurrent <= 0) {return false;} // launcher empty if (pLauncher->mfTimeToReady > 0) {return false;} // launcher not ready *************** *** 288,296 **** { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat); ! if (pPlatformObj != NULL) { ! // TODO: investigate possible problem here with off menu click ??? ! pplat->Launch(nNewKey,nLauncher); ! if (nNewKey != NULL_INDEX) {AddLaunchedPlatform(nNewKey,pplat,nLauncher);} } } --- 290,297 ---- { tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(pplat); ! if ((pPlatformObj != NULL) && (multiplayerMode != MM_CLIENT)) { ! pplat->Launch(nNewKey, nLauncher); ! if (nNewKey != NULL_INDEX) {AddLaunchedPlatform(nNewKey, pplat, nLauncher);} } } *************** *** 553,557 **** { tcLauncherState *pLauncherState; ! tsLData *pLauncher; bool bReadyForLaunch; --- 554,558 ---- { tcLauncherState *pLauncherState; ! bool bReadyForLaunch; *************** *** 560,565 **** apGameObj->GetLauncherState(pLauncherState); if (pLauncherState == NULL) {return false;} ! pLauncher = &pLauncherState->launchers[anLauncher]; ! int nLaunchCount = pLauncher->mnCurrent - pLauncher->mnPending; // determine if launcher is ready for launch --- 561,569 ---- apGameObj->GetLauncherState(pLauncherState); if (pLauncherState == NULL) {return false;} ! ! const tcLauncher* pLauncher = pLauncherState->GetLauncher(anLauncher); ! if (pLauncher == 0) return false; ! ! int nLaunchCount = pLauncher->mnUncommitted; // determine if launcher is ready for launch *************** *** 568,578 **** bool bTrackActive = (pLauncher->mnTargetID != NULL_INDEX); ! if (pLauncher->meLaunchMode == AUTO) { bReadyForLaunch = bLauncherActive; } ! else if (pLauncher->meLaunchMode == DATUM_ONLY) { bReadyForLaunch = bLauncherActive && bDatumActive; } ! else if (pLauncher->meLaunchMode == SEEKER_TRACK) { bReadyForLaunch = bLauncherActive && bTrackActive; } --- 572,585 ---- bool bTrackActive = (pLauncher->mnTargetID != NULL_INDEX); ! if (pLauncher->meLaunchMode == AUTO) ! { bReadyForLaunch = bLauncherActive; } ! else if (pLauncher->meLaunchMode == DATUM_ONLY) ! { bReadyForLaunch = bLauncherActive && bDatumActive; } ! else if (pLauncher->meLaunchMode == SEEKER_TRACK) ! { bReadyForLaunch = bLauncherActive && bTrackActive; } *************** *** 616,623 **** for(int n=0;(n<nLaunchers)&&(bSearching);n++) { ! tsLData *pLauncher = &pSurfaceObj->mcLauncherState.launchers[n]; bool bLauncherReady = (pLauncher->mbActive)&& (pLauncher->mfTimeToReady <= 0)&& ! (pLauncher->mnPending <= 0); if (bLauncherReady) { --- 623,630 ---- for(int n=0;(n<nLaunchers)&&(bSearching);n++) { ! const tcLauncher* pLauncher = pSurfaceObj->mcLauncherState.GetLauncher(n); bool bLauncherReady = (pLauncher->mbActive)&& (pLauncher->mfTimeToReady <= 0)&& ! (pLauncher->mnCurrent == pLauncher->mnUncommitted); if (bLauncherReady) { *************** *** 738,742 **** /********************************************************************/ ! bool tcSimState::IsDetectedESM(tcESMSensor *apESM, tcRadar *apEmitterRadar, float& rfAz_rad) { return apESM->IsDetected(apEmitterRadar, rfAz_rad); --- 745,749 ---- /********************************************************************/ ! bool tcSimState::IsDetectedESM(tcESMSensor *apESM, const tcRadar* apEmitterRadar, float& rfAz_rad) { return apESM->IsDetected(apEmitterRadar, rfAz_rad); *************** *** 768,776 **** { if (!pPlatformObj->IsRadiating()) {return;} ! std::vector<tcSensorState*> *pSensorArray = pPlatformObj->GetSensorStateArray(); ! int nSensors = (int)pSensorArray->size(); ! for (int n=0;n<nSensors;n++) { ! tcRadar *pRadarSS = dynamic_cast<tcRadar*>(pSensorArray->at(n)); if (pRadarSS) { --- 775,784 ---- { if (!pPlatformObj->IsRadiating()) {return;} ! ! unsigned nSensors = pPlatformObj->GetSensorCount(); ! for (unsigned n=0; n<nSensors; n++) { ! const tcSensorState* sensor = pPlatformObj->GetSensor(n); ! const tcRadar* pRadarSS = dynamic_cast<const tcRadar*>(sensor); if (pRadarSS) { *************** *** 1198,1202 **** wxASSERT(pLauncherState); ! tsLData *pLauncher = &pLauncherState->launchers[anLauncher]; pMissileObj->mfGoalHeading_rad = --- 1206,1210 ---- wxASSERT(pLauncherState); ! const tcLauncher* pLauncher = pLauncherState->GetLauncher(anLauncher); pMissileObj->mfGoalHeading_rad = *************** *** 1900,1903 **** --- 1908,1912 ---- RandInit(); tcGameObject::SetClientMode(false); + tcCommandObject::SetClientMode(false); } *************** *** 1917,1920 **** --- 1926,1930 ---- multiplayerMode = MM_CLIENT; tcGameObject::SetClientMode(true); + tcCommandObject::SetClientMode(true); } *************** *** 1928,1931 **** --- 1938,1942 ---- RandInit(); tcGameObject::SetClientMode(false); + tcCommandObject::SetClientMode(false); } --- NEW FILE: tcLauncher.cpp --- /** @file tcLauncher.cpp ** ** Copyright (C) 2003-2004 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 */ #include "tcLauncher.h" #include "tcDatabase.h" #include "tcGenericDBObject.h" #include "tcLauncherDBObject.h" #include "tcMissileDBObject.h" #include "tcRadar.h" #include "tcSimState.h" #include <iostream> #include "common/tcObjStream.h" /** * */ tcCommandStream& tcLauncher::operator<<(tcCommandStream& stream) { stream >> mnTargetID; stream >> mnUncommitted; stream >> msDatum.mfAlt_m; stream >> msDatum.mfLat_rad; stream >> msDatum.mfLon_rad; return stream; } /** * */ tcCommandStream& tcLauncher::operator>>(tcCommandStream& stream) { stream << mnTargetID; stream << mnUncommitted; stream << msDatum.mfAlt_m; stream << msDatum.mfLat_rad; stream << msDatum.mfLon_rad; return stream; } /** * @return true if multiplayer command info in launcher and this launcher match */ bool tcLauncher::CommandInfoMatches(const tcLauncher& launcher) { if ((mnTargetID != launcher.mnTargetID) || (mnUncommitted != launcher.mnUncommitted) || (msDatum.mfAlt_m != launcher.msDatum.mfAlt_m) || (msDatum.mfLat_rad != launcher.msDatum.mfLat_rad) || (msDatum.mfLon_rad != launcher.msDatum.mfLon_rad) ) { return false; } else { return true; } } /** * Copies multiplayer command parameters from source launcher to * this launcher. Could define operator= instead, but this may be * used for non-multiplayer purposes. Another way might be to derive * a container class that is only used for these multiplayer functions. */ void tcLauncher::CopyCommandInfoFrom(const tcLauncher& launcher) { mnTargetID = launcher.mnTargetID; mnUncommitted = launcher.mnUncommitted; msDatum.mfAlt_m = launcher.msDatum.mfAlt_m; msDatum.mfLat_rad = launcher.msDatum.mfLat_rad; msDatum.mfLon_rad = launcher.msDatum.mfLon_rad; } /** * */ tcCreateStream& tcLauncher::operator<<(tcCreateStream& stream) { return stream; } /** * Loads state from update stream */ tcUpdateStream& tcLauncher::operator<<(tcUpdateStream& stream) { stream >> mfTimeToReady; stream >> mnCurrent; if (mnUncommitted > mnCurrent) mnUncommitted = mnCurrent; return stream; } /** * Saves state to update stream */ tcUpdateStream& tcLauncher::operator>>(tcUpdateStream& stream) { stream << mfTimeToReady; stream << mnCurrent; return stream; } /** * */ tcCreateStream& tcLauncher::operator>>(tcCreateStream& stream) { return stream; } #if 0 /** * Load state from stream */ tcStream& tcLauncher::operator<<(tcStream& buffer) { buffer >> mbActive; buffer >> mnDBKey; buffer >> mnChildDBKey; buffer >> mfTimeToReady; buffer >> mnCurrent; buffer >> mnPending; msDatum << buffer; buffer >> mnTargetID; int temp; buffer >> temp; meLaunchMode = (Database::teWeaponLaunchMode)temp; buffer >> mnTargetFlags; buffer >> pointingAngle; buffer >> fireControlSensorIdx; return buffer; } /** * Save state to stream */ tcStream& tcLauncher::operator >>(tcStream& buffer) { buffer << mbActive; buffer << mnDBKey; buffer << mnChildDBKey; buffer << mfTimeToReady; buffer << mnCurrent; buffer << mnPending; msDatum >> buffer; buffer << mnTargetID; int temp = (int)meLaunchMode; buffer << temp; buffer << mnTargetFlags; buffer << pointingAngle; buffer << fireControlSensorIdx; return buffer; } #endif Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcAirObject.cpp 1 May 2004 21:49:06 -0000 1.8 --- tcAirObject.cpp 24 May 2004 00:14:47 -0000 1.9 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,5 ---- ! /** @file tcAirObject.cpp ! ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 36,40 **** tcPlatformObject::operator<<(stream); ! LoadCommandParam(stream, readyForLanding, commandStatus, LANDING_CMD); return stream; --- 37,41 ---- tcPlatformObject::operator<<(stream); ! commandObj.LoadCommandParam(stream, readyForLanding, LANDING_CMD); return stream; *************** *** 72,86 **** { tcPlatformObject::ClearNewCommand(); ! newCommand = false; } bool tcAirObject::HasNewCommand() const { ! return tcPlatformObject::HasNewCommand() || newCommand; } bool tcAirObject::HasUnacknowledgedCommand() const { ! return tcPlatformObject::HasUnacknowledgedCommand() || (commandStatus != 0); } --- 73,88 ---- { tcPlatformObject::ClearNewCommand(); ! commandObj.ClearNewCommand(); } bool tcAirObject::HasNewCommand() const { ! return tcPlatformObject::HasNewCommand() || commandObj.HasNewCommand(); } bool tcAirObject::HasUnacknowledgedCommand() const { ! return tcPlatformObject::HasUnacknowledgedCommand() || ! commandObj.HasUnacknowledgedCommand(); } *************** *** 119,124 **** { readyForLanding = state; ! commandStatus |= LANDING_CMD; ! newCommand = true; } --- 121,125 ---- { readyForLanding = state; ! commandObj.SetNewCommand(LANDING_CMD); } *************** *** 327,332 **** ! tcAirObject::tcAirObject(void) ! : newCommand(false), commandStatus(0) { mnModelType = MTYPE_FIXEDWING; --- 328,332 ---- ! tcAirObject::tcAirObject() { mnModelType = MTYPE_FIXEDWING; *************** *** 342,346 **** */ tcAirObject::tcAirObject(tcGenericDBObject *obj) ! : tcPlatformObject(obj), newCommand(false), commandStatus(0) { mpDBObject = obj; --- 342,346 ---- */ tcAirObject::tcAirObject(tcGenericDBObject *obj) ! : tcPlatformObject(obj) { mpDBObject = obj; *************** *** 350,354 **** } ! tcAirObject::~tcAirObject(void) { } --- 350,354 ---- } ! tcAirObject::~tcAirObject() { } Index: tcSensorState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorState.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcSensorState.cpp 23 Apr 2004 00:15:18 -0000 1.8 --- tcSensorState.cpp 24 May 2004 00:14:47 -0000 1.9 *************** *** 22,36 **** #include "tcSimState.h" #include "tcGameObject.h" ! #include "common/tcStream.h" tcSimState* tcSensorState::simState = NULL; /** * Load state from stream */ ! tcStream& tcSensorState::operator<<(tcStream& stream) { stream >> mbActive; ! stream >> mnDBKey; stream >> mfLastScan; --- 22,37 ---- #include "tcSimState.h" #include "tcGameObject.h" ! #include "common/tcObjStream.h" tcSimState* tcSensorState::simState = NULL; + /** * Load state from stream */ ! tcUpdateStream& tcSensorState::operator<<(tcUpdateStream& stream) { stream >> mbActive; ! //stream >> mnDBKey; stream >> mfLastScan; *************** *** 39,44 **** mcTrack << stream; ! stream >> mountAz_rad; ! stream >> mfSensorHeight_m; return stream; --- 40,45 ---- mcTrack << stream; ! //stream >> mountAz_rad; ! //stream >> mfSensorHeight_m; return stream; *************** *** 48,55 **** * Save state to stream */ ! tcStream& tcSensorState::operator>>(tcStream& stream) { stream << mbActive; ! stream << mnDBKey; stream << mfLastScan; --- 49,56 ---- * Save state to stream */ ! tcUpdateStream& tcSensorState::operator>>(tcUpdateStream& stream) { stream << mbActive; ! //stream << mnDBKey; stream << mfLastScan; *************** *** 58,63 **** mcTrack >> stream; ! stream << mountAz_rad; ! stream << mfSensorHeight_m; return stream; --- 59,64 ---- mcTrack >> stream; ! //stream << mountAz_rad; ! //stream << mfSensorHeight_m; return stream; Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** Game.cpp 14 May 2004 23:37:08 -0000 1.79 --- Game.cpp 24 May 2004 00:14:47 -0000 1.80 *************** *** 1417,1422 **** } ! // Draw 2D windows ! UpdateForScreenMode(); --- 1417,1429 ---- } ! // skip frames if lagging and server ! bool doRender = !isLagging || !tcMultiplayerInterface::Get()->IsServer() || ! (snFrameCount % 8 == 0); ! ! if (doRender) ! { ! // Draw 2D windows ! UpdateForScreenMode(); ! } *************** *** 1439,1444 **** viewer->Update(gameDateZulu); ! // skip frames if lagging and server ! if ((directorTime > 0.1f) && (!isLagging || !tcMultiplayerInterface::Get()->IsServer())) { mpGraphicsEngine->RenderAll(); --- 1446,1450 ---- viewer->Update(gameDateZulu); ! if ((directorTime > 0.1f) && doRender) { mpGraphicsEngine->RenderAll(); Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcLauncherState.cpp 13 Apr 2004 00:24:39 -0000 1.8 --- tcLauncherState.cpp 24 May 2004 00:14:47 -0000 1.9 *************** *** 1,22 **** ! /* ! * Copyright (C) 2003 Dewitt "Cole" 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 ! */ #include "tcLauncherState.h" #include "tcDatabase.h" #include "tcGenericDBObject.h" --- 1,24 ---- ! /** @file tcLauncherState.cpp ! ** ! ** Copyright (C) 2003-2004 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 ! */ #include "tcLauncherState.h" + #include "tcLauncher.h" #include "tcDatabase.h" #include "tcGenericDBObject.h" *************** *** 26,85 **** #include "tcSimState.h" #include <iostream> ! #include "common/tcStream.h" ! ! /** ! * Load state from stream ! */ ! tcStream& tsLData::operator <<(tcStream& buffer) ! { ! buffer >> mbActive; ! buffer >> mnDBKey; ! buffer >> mnChildDBKey; ! ! buffer >> mfTimeToReady; ! buffer >> mnCurrent; ! buffer >> mnPending; ! ! msDatum << buffer; ! ! buffer >> mnTargetID; ! ! int temp; ! buffer >> temp; ! meLaunchMode = (Database::teWeaponLaunchMode)temp; ! ! buffer >> mnTargetFlags; ! buffer >> pointingAngle; ! buffer >> fireControlSensorIdx; ! ! return buffer; ! } ! ! /** ! * Save state to stream ! */ ! tcStream& tsLData::operator >>(tcStream& buffer) ! { ! buffer << mbActive; ! buffer << mnDBKey; ! buffer << mnChildDBKey; ! ! buffer << mfTimeToReady; ! buffer << mnCurrent; ! buffer << mnPending; ! ! msDatum >> buffer; ! ! buffer << mnTargetID; ! ! int temp = (int)meLaunchMode; ! buffer << temp; ! ! buffer << mnTargetFlags; ! buffer << pointingAngle; ! buffer << fireControlSensorIdx; ! ! return buffer; ! } --- 28,32 ---- #include "tcSimState.h" #include <iostream> ! #include "common/tcObjStream.h" *************** *** 126,130 **** } ! tsLData new_launcher; new_launcher.mnChildDBKey = nChildKey; --- 73,77 ---- } ! tcLauncher new_launcher; new_launcher.mnChildDBKey = nChildKey; *************** *** 139,143 **** new_launcher.mnTargetID = NULL_INDEX; new_launcher.meLaunchMode = AUTO; ! new_launcher.mnPending = 0; new_launcher.pointingAngle = azimuth_rad; new_launcher.fireControlSensor = NULL; --- 86,90 ---- new_launcher.mnTargetID = NULL_INDEX; new_launcher.meLaunchMode = AUTO; ! new_launcher.mnUncommitted = new_launcher.mnCurrent; new_launcher.pointingAngle = azimuth_rad; new_launcher.fireControlSensor = NULL; *************** *** 158,166 **** } int tcLauncherState::GetLauncherQuantity(unsigned anLauncher) { if (anLauncher > launchers.size()) {return -1;} ! return launchers[anLauncher].mnCurrent - launchers[anLauncher].mnPending; } --- 105,142 ---- } + const char* tcLauncherState::GetFireControlSensorClass(unsigned nLauncher) const + { + wxASSERT((int)nLauncher < mnCount); + + return launchers[nLauncher].mpLauncherDBObj->fireControlSensorClass.c_str(); + } + + const tcLauncher* tcLauncherState::GetLauncher(unsigned nLauncher) const + { + if ((int)nLauncher >= mnCount) return 0; + + return &launchers[nLauncher]; + } + + const char* tcLauncherState::GetLauncherChildClass(unsigned nLauncher) const + { + wxASSERT((int)nLauncher < mnCount); + + return launchers[nLauncher].mpLauncherDBObj->mzChildClass.mz; + } + + /** + * @return number of launchers + */ + int tcLauncherState::GetLauncherCount() const + { + return mnCount; + } + int tcLauncherState::GetLauncherQuantity(unsigned anLauncher) { if (anLauncher > launchers.size()) {return -1;} ! return launchers[anLauncher].mnUncommitted; } *************** *** 183,187 **** return BAD_LAUNCHER; } ! tsLData& ldata = launchers[nLauncher]; if (ldata.mnCurrent <= 0) {return LAUNCHER_EMPTY;} // launcher empty --- 159,163 ---- return BAD_LAUNCHER; } ! tcLauncher& ldata = launchers[nLauncher]; if (ldata.mnCurrent <= 0) {return LAUNCHER_EMPTY;} // launcher empty *************** *** 282,285 **** --- 258,290 ---- /** + * sets key to database id of object to launch, otherwise NULL_INDEX + * nLauncher is set to launcher idx of launching launcher + * This only handles one launch per call (not efficient for simultaneous launches) + */ + void tcLauncherState::Launch(tnPoolIndex& key, unsigned& nLauncher) + { + for (int n=0; n<mnCount; n++) + { + tcLauncher* pLauncher = &launchers[n]; + + if ((pLauncher->mbActive)&&(pLauncher->mnCurrent > pLauncher->mnUncommitted)) + { + bool bLaunch = (pLauncher->mnCurrent > 0)&&(pLauncher->mfTimeToReady <= 0); + if (bLaunch) + { + pLauncher->mnCurrent--; + key = pLauncher->mnChildDBKey; + nLauncher = n; + pLauncher->mfTimeToReady = 2.0f; // TODO: add db parameter for this + return; + } + } + } + key = NULL_INDEX; + nLauncher = 0; + } + + + /** * @param nLauncher launcher index * @param radar pointer to tcRadar object that acts as fire control sensor *************** *** 301,304 **** --- 306,339 ---- } + + + /** + * If launcher is ready, decrement mnUncommitted of nLauncher by quantity. + * This method does not support targeting multiple targets. + * @return tcLauncherState::teLauncherStatus error code, LAUNCHER_READY = 0 for success + */ + int tcLauncherState::SetLaunch(int nLauncher, int quantity) + { + int statusCode; + + statusCode = GetLauncherStatus(nLauncher); + if (statusCode != tcLauncherState::LAUNCHER_READY) return statusCode; + + tcLauncher* pLauncher = &launchers[nLauncher]; + + pLauncher->mnUncommitted -= quantity; + if (pLauncher->mnUncommitted < 0) + { + pLauncher->mnUncommitted = 0; // don't set new cmd here since this is an error case + std::cerr << "Error - tcLauncherState::SetLaunch - negative uncommitted\n"; + } + else + { + commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); + } + + return statusCode; + } + /** * @return true if success *************** *** 312,315 **** --- 347,351 ---- } launchers[nLauncher].msDatum.Set(lon_rad, lat_rad); + commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; } *************** *** 327,330 **** --- 363,367 ---- } launchers[nLauncher].mnTargetID = targetID; + commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); return true; } *************** *** 390,393 **** --- 42... [truncated message content] |
|
From: Dewitt C. <ddc...@us...> - 2004-05-24 00:14:59
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26112/include/sim Modified Files: tcAirObject.h tcESMSensor.h tcLauncherState.h tcPlatformObject.h tcRadar.h tcSensorState.h tcSimState.h Added Files: tcChatBox.h tcCommandObject.h tcLauncher.h Log Message: Multiplayer changes --- NEW FILE: tcLauncher.h --- /** @file tcLauncher.h ** ** Copyright (C) 2003-2004 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 */ #ifndef _TCLAUNCHER_H_ #define _TCLAUNCHER_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "simmath.h" #include "AError.h" #include <vector> namespace Database { class tcDatabase; class tcLauncherDBObject; class tcDatabaseObject; enum teWeaponLaunchMode; } using namespace Database; class tcGameObject; class tcSimState; class tcRadar; class tcStream; class tcCommandStream; class tcCreateStream; class tcUpdateStream; /** * State for individual launcher. */ class tcLauncher { public: int mbActive; long mnDBKey; ///< key in launcher database tcLauncherDBObject *mpLauncherDBObj; long mnChildDBKey; tcDatabaseObject *mpChildDBObj; float mfTimeToReady; unsigned int mnCurrent; unsigned int mnUncommitted; ///< mnCurrent - mnUncommitted = # pending launch tsGeoPoint msDatum; ///< datum to pass to weapon nav guidance tnPoolIndex mnTargetID; ///< track that seeker can acquire teWeaponLaunchMode meLaunchMode; int mnTargetFlags; ///< 0x01 - surface, 0x02 - air, 0x03 - land float pointingAngle; ///< boresight azimuth angle in radians relative nose/bow tcRadar *fireControlSensor; ///< sensor for fire control guidance unsigned fireControlSensorIdx; ///< index of sensor on parent platform tcCommandStream& operator<<(tcCommandStream& stream); tcCreateStream& operator<<(tcCreateStream& stream); tcUpdateStream& operator<<(tcUpdateStream& stream); tcCommandStream& operator>>(tcCommandStream& stream); tcCreateStream& operator>>(tcCreateStream& stream); tcUpdateStream& operator>>(tcUpdateStream& stream); bool CommandInfoMatches(const tcLauncher& launcher); void CopyCommandInfoFrom(const tcLauncher& launcher); }; #endif Index: tcAirObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAirObject.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcAirObject.h 1 May 2004 21:49:24 -0000 1.7 --- tcAirObject.h 24 May 2004 00:14:46 -0000 1.8 *************** *** 23,27 **** #pragma once ! #include "tcplatformobject.h" class tcUpdateStream; --- 23,28 ---- #pragma once ! #include "tcPlatformObject.h" ! #include "tcCommandObject.h" class tcUpdateStream; *************** *** 41,51 **** int readyForLanding; ///< 1 if gear down/ready for landing, 0 otherwise - bool newCommand; ///< flag to indicate new obj command since last update - /** - * bitfield to manage acknowledgement for command updates. - * appropriate bit is set when new command update is generated, - * bit is cleared when ack update is received. - */ - int commandStatus; virtual void ApplyRestrictions(); --- 42,45 ---- *************** *** 77,80 **** --- 71,77 ---- virtual ~tcAirObject(); protected: + tcCommandObject commandObj; + + virtual void UpdateHeading(float dt_s); float maxPitch_rad; ///< user imposed restriction to pitch angle --- NEW FILE: tcCommandObject.h --- /** @file tcCommandObject.h ** ** Copyright (C) 2004 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 */ #ifndef _TCCOMMANDOBJECT_H_ #define _TCCOMMANDOBJECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class tcCommandStream; class tcLauncher; /** * Class to provide methods and variables for multiplayer command management * In some cases both the parent of a class and the class itself can derive * from this. */ class tcCommandObject { public: void ClearNewCommand(); bool HasNewCommand() const; bool HasUnacknowledgedCommand() const; /// implements rules for updating command params over multiplayer connection void LoadCommandParam(tcCommandStream& stream, float& param, int flag); void LoadCommandParam(tcCommandStream& stream, int& param, int flag); void LoadCommandParam(tcCommandStream& stream, tcLauncher& param, int flag); void SetNewCommand(int flag); static void SetClientMode(bool state) {clientMode = state;} tcCommandObject(); virtual ~tcCommandObject(); private: /// flag to indicate new obj command since last update bool newCommand; /** * bitfield to manage acknowledgement for command updates. * appropriate bit is set when new command update is generated, * bit is cleared when ack update is received. */ int commandStatus; static bool clientMode; ///< true if running as multiplayer client }; #endif Index: tcLauncherState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncherState.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcLauncherState.h 13 Apr 2004 00:24:37 -0000 1.6 --- tcLauncherState.h 24 May 2004 00:14:46 -0000 1.7 *************** *** 1,28 **** ! /* ! * Copyright (C) 2003 Dewitt "Cole" 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 ! */ ! ! #pragma once #ifndef _TCLAUNCHERSTATE_H_ #define _TCLAUNCHERSTATE_H_ #include "simmath.h" #include "AError.h" #include <vector> --- 1,33 ---- ! /** @file tcLauncherState.h ! ** ! ** Copyright (C) 2003-2004 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 ! */ #ifndef _TCLAUNCHERSTATE_H_ #define _TCLAUNCHERSTATE_H_ + #if _MSC_VER > 1000 + #pragma once + #endif // _MSC_VER > 1000 + + #include "simmath.h" #include "AError.h" + #include "tcCommandObject.h" #include <vector> *************** *** 41,73 **** class tcRadar; class tcStream; - /** - * State for individual launcher. - */ - struct tsLData - { - int mbActive; - - long mnDBKey; ///< key in launcher database - tcLauncherDBObject *mpLauncherDBObj; - long mnChildDBKey; - tcDatabaseObject *mpChildDBObj; - - float mfTimeToReady; - unsigned int mnCurrent; - unsigned int mnPending; - - tsGeoPoint msDatum; ///< datum to pass to weapon nav guidance - tnPoolIndex mnTargetID; ///< track that seeker can acquire - teWeaponLaunchMode meLaunchMode; - int mnTargetFlags; ///< 0x01 - surface, 0x02 - air, 0x03 - land - float pointingAngle; ///< boresight azimuth angle in radians relative nose/bow - - tcRadar *fireControlSensor; ///< sensor for fire control guidance - unsigned fireControlSensorIdx; ///< index of sensor on parent platform - - tcStream& operator<<(tcStream& buffer); - tcStream& operator>>(tcStream& buffer); - }; /** --- 46,54 ---- class tcRadar; class tcStream; + class tcCommandStream; + class tcCreateStream; + class tcUpdateStream; + class tcLauncher; /** *************** *** 92,98 **** NO_FIRECONTROL = 11, }; ///< launcher status codes tcGameObject *parent; int mnCount; ! std::vector<tsLData> launchers; ///< vector of launcher state info static tcDatabase *mpDatabase; --- 73,81 ---- NO_FIRECONTROL = 11, }; ///< launcher status codes + + tcGameObject *parent; int mnCount; ! static tcDatabase *mpDatabase; *************** *** 100,103 **** --- 83,90 ---- void AddFullLauncher(tnPoolIndex anKey, float azimuth_rad); + const char* GetFireControlSensorClass(unsigned nLauncher) const; + const tcLauncher* GetLauncher(unsigned nLauncher) const; + const char* GetLauncherChildClass(unsigned nLauncher) const; + int GetLauncherCount() const; int GetLauncherQuantity(unsigned anLauncher); int GetLauncherStatus(unsigned nLauncher); *************** *** 106,117 **** bool IsSeekerLaunch(unsigned anLauncher); ! tcStream& operator<<(tcStream& buffer); ! tcStream& operator>>(tcStream& buffer); void Serialize(tcFile& file, bool abLoad); void SetFireControlSensor(unsigned nLauncher, tcRadar* radar, unsigned sensorIdx); bool SetLauncherDatum(unsigned nLauncher, double lon_rad, double lat_rad); bool SetLauncherTarget(unsigned nLauncher, long targetID); void SetParent(tcGameObject *obj) {parent = obj;} static std::string TranslateLauncherStatus(int status); tcLauncherState(); tcLauncherState(tcGameObject *parentObj); --- 93,117 ---- bool IsSeekerLaunch(unsigned anLauncher); ! void Launch(long& key, unsigned& nLauncher); ///< needs to be reworked ! ! tcCommandStream& operator<<(tcCommandStream& stream); ! tcUpdateStream& operator<<(tcUpdateStream& stream); ! ! tcCommandStream& operator>>(tcCommandStream& stream); ! tcUpdateStream& operator>>(tcUpdateStream& stream); ! ! void ClearNewCommand(); ! bool HasNewCommand() const; ! bool HasUnacknowledgedCommand() const; ! void Serialize(tcFile& file, bool abLoad); void SetFireControlSensor(unsigned nLauncher, tcRadar* radar, unsigned sensorIdx); + int SetLaunch(int nLauncher, int quantity); bool SetLauncherDatum(unsigned nLauncher, double lon_rad, double lat_rad); bool SetLauncherTarget(unsigned nLauncher, long targetID); void SetParent(tcGameObject *obj) {parent = obj;} static std::string TranslateLauncherStatus(int status); + void Update(float dt_s); + tcLauncherState(); tcLauncherState(tcGameObject *parentObj); *************** *** 120,124 **** --- 120,128 ---- private: + std::vector<tcLauncher> launchers; ///< vector of launcher state info + tcCommandObject commandObj; static tcSimState *simState; + + int GetLauncherFlag(int nLauncher) const {return 0x01 << nLauncher;} }; #endif \ No newline at end of file Index: tcRadar.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcRadar.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcRadar.h 23 Apr 2004 00:14:56 -0000 1.5 --- tcRadar.h 24 May 2004 00:14:46 -0000 1.6 *************** *** 42,45 **** --- 42,46 ---- class tcGameObject; class tcStream; + class tcUpdateStream; /** *************** *** 78,83 **** tcRadar& operator=(tcRadar& ss); ! virtual tcStream& operator<<(tcStream& stream); ! virtual tcStream& operator>>(tcStream& stream); tcRadar* Clone(); tcRadar(); --- 79,86 ---- tcRadar& operator=(tcRadar& ss); ! ! virtual tcUpdateStream& operator<<(tcUpdateStream& stream); ! virtual tcUpdateStream& operator>>(tcUpdateStream& stream); ! tcRadar* Clone(); tcRadar(); Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcSimState.h 8 May 2004 21:25:25 -0000 1.23 --- tcSimState.h 24 May 2004 00:14:46 -0000 1.24 *************** *** 192,196 **** float GetFractionalDamage(float afDamage, tcGameObject *apGameObj); ! bool IsDetectedESM(tcESMSensor *apESM, tcRadar *apEmitterRadar, float& rfAz_rad); void PerformAutoEngage(tcGameObject* apGameObj, double afTime); void ProcessRadarDetection(tcGameObject *apRadarPlat,tcGameObject *apTarget, --- 192,196 ---- float GetFractionalDamage(float afDamage, tcGameObject *apGameObj); ! bool IsDetectedESM(tcESMSensor* apESM, const tcRadar* apEmitterRadar, float& rfAz_rad); void PerformAutoEngage(tcGameObject* apGameObj, double afTime); void ProcessRadarDetection(tcGameObject *apRadarPlat,tcGameObject *apTarget, Index: tcSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorState.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcSensorState.h 23 Apr 2004 00:14:56 -0000 1.9 --- tcSensorState.h 24 May 2004 00:14:46 -0000 1.10 *************** *** 1,20 **** ! /* ! * Copyright (C) 2003 Dewitt "Cole" 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 ! */ #pragma once --- 1,21 ---- ! /** @file tcSensorState.h ! ** ! ** Copyright (C) 2003-2004 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 ! */ #pragma once *************** *** 39,43 **** class tcSimState; class tcGameObject; ! class tcStream; /** --- 40,44 ---- class tcSimState; class tcGameObject; ! class tcUpdateStream; /** *************** *** 64,68 **** --- 65,73 ---- void GetTestArea(tcRect& region); virtual bool InitFromDB(tcDatabase *apDatabase, tnPoolIndex anKey, float mountAzimuth_rad); + void Serialize(tcFile& file, bool mbLoad); + virtual tcUpdateStream& operator<<(tcUpdateStream& stream); + virtual tcUpdateStream& operator>>(tcUpdateStream& stream); + virtual void SetActive(bool active); void SetMountAz(float az) {mountAz_rad = az;} *************** *** 71,77 **** int UpdateScan(double afTime); tcSensorState& operator=(tcSensorState& ss); ! virtual tcStream& operator<<(tcStream& stream); ! virtual tcStream& operator>>(tcStream& stream); ! tcSensorState* Clone(void); tcSensorState(); tcSensorState(tcGameObject *obj); --- 76,81 ---- int UpdateScan(double afTime); tcSensorState& operator=(tcSensorState& ss); ! ! tcSensorState* Clone(); tcSensorState(); tcSensorState(tcGameObject *obj); Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcPlatformObject.h 1 May 2004 21:49:24 -0000 1.16 --- tcPlatformObject.h 24 May 2004 00:14:46 -0000 1.17 *************** *** 1,3 **** ! /* * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) * All rights reserved. --- 1,3 ---- ! /** @file tcPlatformObject * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) * All rights reserved. *************** *** 18,22 **** --- 18,27 ---- */ + #ifndef _TCPLATFORMOBJECT_H_ + #define _TCPLATFORMOBJECT_H_ + + #if _MSC_VER > 1000 #pragma once + #endif // _MSC_VER > 1000 #include "tcFile.h" *************** *** 25,28 **** --- 30,34 ---- #include "tcGuidanceState.h" #include "tcGameObject.h" + #include "tcCommandObject.h" #include "tcAIData.h" *************** *** 57,61 **** enum { ! UPDATE_GUIDANCE = 0x01 }; --- 63,69 ---- enum { ! UPDATE_GUIDANCE = 0x01, ! UPDATE_LAUNCHERS = 0x02, ! UPDATE_SENSORS = 0x04 }; *************** *** 71,85 **** tsFormationParameters msFormationParameters; tcGenericDBObject *mpDBObject; ! ! bool newCommand; ///< flag to indicate new obj command since last update ! /** ! * bitfield to manage acknowledgement for command updates. ! * appropriate bit is set when new command update is generated, ! * bit is cleared when ack update is received. ! */ ! int commandStatus; ! virtual void Clear(void); virtual void DesignateDatum(tcPoint p); virtual void DesignateLauncherDatum(tcPoint p, unsigned int anLauncher); --- 79,87 ---- tsFormationParameters msFormationParameters; tcGenericDBObject *mpDBObject; ! tcCommandObject commandObj; ! tcCommandObject sensorCommandObj; ///< ugly, could fix by handling sensors like launchers ! virtual void Clear(); virtual void DesignateDatum(tcPoint p); virtual void DesignateLauncherDatum(tcPoint p, unsigned int anLauncher); *************** *** 89,103 **** virtual int GetLauncherQuantity(unsigned anLauncher); virtual void GetLauncherState(tcLauncherState*& pLauncherState) {pLauncherState=&mcLauncherState;} // virtual void GetSensorState(tcSensorState** aapSensorState, int& rnCount); // virtual void GetSensorStateRef(tcSensorState**& rapSensorState, int& rnCount); ! virtual bool HasActivatedSensor(void); virtual bool IsInterceptingTrack(long id); ! virtual bool IsRadiating(void); ! virtual std::vector<tcSensorState*>* GetSensorStateArray(void) {return &mapSensorState;} ! virtual tcSensorState* GetSensor(unsigned idx); virtual void Launch(tnPoolIndex& rnKey, unsigned& rnLauncher); virtual void RandInitNear(float afLon_deg, float afLat_deg); virtual void SetAltitude(float new_altitude_m); virtual void SetHeading(float afNewHeading); virtual void SetSpeed(float afNewSpeed); virtual int SetLaunch(int anLauncher, int anQuantity); --- 91,108 ---- virtual int GetLauncherQuantity(unsigned anLauncher); virtual void GetLauncherState(tcLauncherState*& pLauncherState) {pLauncherState=&mcLauncherState;} + unsigned GetSensorCount() const; // virtual void GetSensorState(tcSensorState** aapSensorState, int& rnCount); // virtual void GetSensorStateRef(tcSensorState**& rapSensorState, int& rnCount); ! virtual bool HasActivatedSensor(); virtual bool IsInterceptingTrack(long id); ! virtual bool IsRadiating(); ! //virtual std::vector<tcSensorState*>* GetSensorStateArray() {return &mapSensorState;} ! virtual const tcSensorState* GetSensor(unsigned idx); ! virtual tcSensorState* GetSensorMutable(unsigned idx); virtual void Launch(tnPoolIndex& rnKey, unsigned& rnLauncher); virtual void RandInitNear(float afLon_deg, float afLat_deg); virtual void SetAltitude(float new_altitude_m); virtual void SetHeading(float afNewHeading); + void SetSensorState(unsigned idx, bool state); virtual void SetSpeed(float afNewSpeed); virtual int SetLaunch(int anLauncher, int anQuantity); *************** *** 122,140 **** virtual bool HasUnacknowledgedCommand() const; ! ! tcPlatformObject(void); tcPlatformObject(tcPlatformObject&); tcPlatformObject(tcGenericDBObject *obj); ! virtual ~tcPlatformObject(void); protected: float lastHeadingDelta; // a workaround to smooth heading rate changes ! virtual void ApplyRestrictions(void); virtual void SetFireControlSensors(); - /// implements rules for updating command params over multiplayer connection - void LoadCommandParam(tcCommandStream& stream, float& param, int& cmdStatus, int flag); - void LoadCommandParam(tcCommandStream& stream, int& param, int& cmdStatus, int flag); virtual void Move(float dt_s); --- 127,141 ---- virtual bool HasUnacknowledgedCommand() const; ! tcPlatformObject(); tcPlatformObject(tcPlatformObject&); tcPlatformObject(tcGenericDBObject *obj); ! virtual ~tcPlatformObject(); protected: float lastHeadingDelta; // a workaround to smooth heading rate changes ! virtual void ApplyRestrictions(); virtual void SetFireControlSensors(); virtual void Move(float dt_s); *************** *** 145,147 **** virtual void UpdateSensors(double t); virtual void UpdateSpeed(float dt_s); ! }; \ No newline at end of file --- 146,150 ---- virtual void UpdateSensors(double t); virtual void UpdateSpeed(float dt_s); ! }; ! ! #endif --- NEW FILE: tcChatBox.h --- /** @file tcChatBox.h */ /* ** Copyright (C) 2004 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 */ #ifndef _CHATBOX_H_ #define _CHATBOX_H_ #pragma once #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" //for MS Windows specific definitions #endif #include "tcStandardWindow.h" class tcEditBox; class tcConsoleBox; /** * User interface window for multiplayer chat. The ChatBox * is a small popup window used from within the game. */ class tcChatBox : public tcStandardWindow { public: int Draw(); void OnLButtonDown(wxMouseEvent& event); void SendChatText(wxCommandEvent& event); tcChatBox(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name = "NetworkView", const wxString& configFile = "xml/chat_box.xml"); virtual ~tcChatBox(); private: tcConsoleBox *chatHistory; tcEditBox *chatEntry; DECLARE_EVENT_TABLE() }; #endif Index: tcESMSensor.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcESMSensor.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcESMSensor.h 23 Apr 2004 00:14:56 -0000 1.3 --- tcESMSensor.h 24 May 2004 00:14:46 -0000 1.4 *************** *** 47,52 **** tcESMSensor& operator=(tcESMSensor& ss); ! virtual tcStream& operator<<(tcStream& stream); ! virtual tcStream& operator>>(tcStream& stream); tcESMSensor* Clone(void); tcESMSensor(); --- 47,52 ---- tcESMSensor& operator=(tcESMSensor& ss); ! //virtual tcStream& operator<<(tcStream& stream); ! //virtual tcStream& operator>>(tcStream& stream); tcESMSensor* Clone(void); tcESMSensor(); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-24 00:14:59
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26112/src/network Modified Files: tcMessage.cpp tcUpdateMessageHandler.cpp Log Message: Multiplayer changes Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcUpdateMessageHandler.cpp 17 May 2004 00:38:53 -0000 1.10 --- tcUpdateMessageHandler.cpp 24 May 2004 00:14:46 -0000 1.11 *************** *** 335,339 **** tcGameObject* obj = simState->GetObject(id); ! // update obj if it exists, otherwise create object if (obj) { --- 335,339 ---- tcGameObject* obj = simState->GetObject(id); ! // update obj and add ack if it exists, otherwise skip if (obj) { Index: tcMessage.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMessage.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcMessage.cpp 14 May 2004 23:37:08 -0000 1.5 --- tcMessage.cpp 24 May 2004 00:14:46 -0000 1.6 *************** *** 86,89 **** --- 86,90 ---- { std::cerr << "Error - Attempted to send oversized message, truncating." << std::endl; + wxMessageBox("Error - Attempted to send oversized message, truncating."); messageSize = tcMessage::MESSAGE_SIZE; } |
|
From: Dewitt C. <ddc...@us...> - 2004-05-24 00:14:59
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26112/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Multiplayer changes Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcPlatformInterface.h 29 Apr 2004 00:05:12 -0000 1.19 --- tcPlatformInterface.h 24 May 2004 00:14:45 -0000 1.20 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,5 ---- ! /* @file tcPlatformInterface.h ! ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. |
|
From: Dewitt C. <ddc...@us...> - 2004-05-24 00:14:59
|
Update of /cvsroot/gcblue/gcb_wx/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26112/include Modified Files: stdwx.h Log Message: Multiplayer changes Index: stdwx.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/stdwx.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** stdwx.h 14 Nov 2003 22:32:40 -0000 1.3 --- stdwx.h 24 May 2004 00:14:46 -0000 1.4 *************** *** 1,5 **** // precompiled headers are only used for WIN32 #ifdef WIN32 ! #include "wx/wxprec.h" // wxwindows precompiled / standard headers, defines WX_PRECOMP #include "wx/msw/private.h" // for MS Windows specific definitions --- 1,5 ---- // precompiled headers are only used for WIN32 #ifdef WIN32 ! #pragma warning (disable:4312) #include "wx/wxprec.h" // wxwindows precompiled / standard headers, defines WX_PRECOMP #include "wx/msw/private.h" // for MS Windows specific definitions |
|
From: Dewitt C. <ddc...@us...> - 2004-05-24 00:14:58
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26112/src/scriptinterface Modified Files: tcPlatformInterface.cpp Log Message: Multiplayer changes Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcPlatformInterface.cpp 27 Apr 2004 22:18:52 -0000 1.21 --- tcPlatformInterface.cpp 24 May 2004 00:14:47 -0000 1.22 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 40,43 **** --- 40,44 ---- #include "tcGenericDBObject.h" #include "tcLauncherState.h" + #include "tcLauncher.h" *************** *** 196,200 **** ! tcGameObject* tcPlatformInterface::GetTargetObj() { wxASSERT(mpSimState != NULL); return mpSimState->GetObject(GetTarget()); --- 197,202 ---- ! tcGameObject* tcPlatformInterface::GetTargetObj() ! { wxASSERT(mpSimState != NULL); return mpSimState->GetObject(GetTarget()); *************** *** 372,396 **** int nCount = GetLauncherCount(); ! if ((anLauncher < 0)||(anLauncher >= nCount)) { return false; } ! tsLData* pLauncherData = &mpPlatformObj->mcLauncherState.launchers[anLauncher]; tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(pLauncherData->mpChildDBObj); ! if (pMissileDBObj == NULL) { return false; // only missiles supported } info.mnLauncher = anLauncher; ! info.mnQuantity = pLauncherData->mnCurrent - pLauncherData->mnPending; info.mfRange_km = pMissileDBObj->mfRange_km; info.mnTargetFlags = pLauncherData->mnTargetFlags; ! if (pLauncherData->meLaunchMode == DATUM_ONLY) { info.mnLaunchMode = 0; } ! else if (pLauncherData->meLaunchMode == SEEKER_TRACK) { info.mnLaunchMode = 1; } ! else { info.mnLaunchMode = 2; // other } --- 374,403 ---- int nCount = GetLauncherCount(); ! if ((anLauncher < 0)||(anLauncher >= nCount)) ! { return false; } ! const tcLauncher* pLauncherData = mpPlatformObj->mcLauncherState.GetLauncher(anLauncher); tcMissileDBObject *pMissileDBObj = dynamic_cast<tcMissileDBObject*>(pLauncherData->mpChildDBObj); ! if (pMissileDBObj == NULL) ! { return false; // only missiles supported } info.mnLauncher = anLauncher; ! info.mnQuantity = pLauncherData->mnUncommitted; info.mfRange_km = pMissileDBObj->mfRange_km; info.mnTargetFlags = pLauncherData->mnTargetFlags; ! if (pLauncherData->meLaunchMode == DATUM_ONLY) ! { info.mnLaunchMode = 0; } ! else if (pLauncherData->meLaunchMode == SEEKER_TRACK) ! { info.mnLaunchMode = 1; } ! else ! { info.mnLaunchMode = 2; // other } *************** *** 399,425 **** } ! int tcPlatformInterface::GetLauncherCount(void) { ! if (mpPlatformObj == NULL) { return 0; } ! else { return mpPlatformObj->mcLauncherState.mnCount; } } ! std::string tcPlatformInterface::GetLauncherWeaponName(int anLauncher) { std::string s; int nCount = GetLauncherCount(); ! if ((anLauncher < 0)||(anLauncher >= nCount)) { ! s = "Error"; ! return s; ! } ! tcDatabaseObject *pChildDBObj = mpPlatformObj->mcLauncherState.launchers[anLauncher].mpChildDBObj; ! if (pChildDBObj == NULL) { s = "Error"; return s; } ! s = pChildDBObj->mzClass.mz; return s; } --- 406,434 ---- } ! int tcPlatformInterface::GetLauncherCount() ! { ! if (mpPlatformObj == NULL) ! { return 0; } ! else ! { return mpPlatformObj->mcLauncherState.mnCount; } } ! std::string tcPlatformInterface::GetLauncherWeaponName(int anLauncher) ! { std::string s; int nCount = GetLauncherCount(); ! if ((anLauncher < 0)||(anLauncher >= nCount)) ! { s = "Error"; return s; } ! ! s = mpPlatformObj->mcLauncherState.GetLauncherChildClass(anLauncher); ! return s; } *************** *** 729,734 **** int tcPlatformInterface::GetSensorCount() { ! std::vector<tcSensorState*> *pSS = mpPlatformObj->GetSensorStateArray(); ! return (int)pSS->size(); } --- 738,742 ---- int tcPlatformInterface::GetSensorCount() { ! return (int)mpPlatformObj->GetSensorCount(); } *************** *** 738,745 **** info.type = 0xFF; ! std::vector<tcSensorState*> *pSS = mpPlatformObj->GetSensorStateArray(); ! int nSensors = (int)pSS->size(); ! if ((n < 0)||(n >= nSensors)) return info; ! tcSensorState *sensor_state = pSS->at(n); info.isActive = sensor_state->GetActive(); if (dynamic_cast<tcRadarDBObject*>(sensor_state->mpDBObj)) --- 746,754 ---- info.type = 0xFF; ! ! unsigned nSensors = mpPlatformObj->GetSensorCount(); ! if ((n < 0)||((unsigned)n >= nSensors)) return info; ! ! const tcSensorState* sensor_state = mpPlatformObj->GetSensor(n); info.isActive = sensor_state->GetActive(); if (dynamic_cast<tcRadarDBObject*>(sensor_state->mpDBObj)) *************** *** 757,767 **** * @param anState 0 - all sensors off, 1 - all sensors on */ ! void tcPlatformInterface::SetAllSensorState(int anState) { ! std::vector<tcSensorState*> *pSS = mpPlatformObj->GetSensorStateArray(); ! int nSensors = (int)pSS->size(); ! for(int n=0;n<nSensors;n++) { ! tcSensorState *pSensorState = pSS->at(n); ! pSensorState->SetActive(anState); } } --- 766,776 ---- * @param anState 0 - all sensors off, 1 - all sensors on */ ! void tcPlatformInterface::SetAllSensorState(int anState) ! { ! unsigned nSensors = mpPlatformObj->GetSensorCount(); ! for(unsigned n=0;n<nSensors;n++) ! { ! mpPlatformObj->SetSensorState(n, anState != 0); } } *************** *** 769,777 **** void tcPlatformInterface::SetSensorState(int n, int state) { ! std::vector<tcSensorState*> *pSS = mpPlatformObj->GetSensorStateArray(); ! int nSensors = (int)pSS->size(); ! if ((n < 0)||(n >= nSensors)) return; ! tcSensorState *sensor_state = pSS->at(n); ! sensor_state->SetActive(state); } --- 778,782 ---- void tcPlatformInterface::SetSensorState(int n, int state) { ! mpPlatformObj->SetSensorState((unsigned)n, state != 0); } |
|
From: Dewitt C. <ddc...@us...> - 2004-05-17 00:39:04
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3755/src/common Modified Files: tcOptions.cpp tcStream.cpp Log Message: Index: tcStream.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcStream.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcStream.cpp 9 May 2004 20:40:22 -0000 1.6 --- tcStream.cpp 17 May 2004 00:38:53 -0000 1.7 *************** *** 78,83 **** * Skips over count bytes from current read stream position */ ! void tcStream::skip_read(unsigned char count) { std::stringstream::seekg(count, ios_base::cur); } --- 78,85 ---- * Skips over count bytes from current read stream position */ ! void tcStream::skip_read(unsigned int count) { + unsigned int maxSkip = (unsigned int)size() - std::stringstream::tellg(); + if (count > maxSkip) count = maxSkip; std::stringstream::seekg(count, ios_base::cur); } Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcOptions.cpp 9 May 2004 20:40:22 -0000 1.8 --- tcOptions.cpp 17 May 2004 00:38:53 -0000 1.9 *************** *** 133,136 **** --- 133,144 ---- Serialize(true); // read option state from file (options.dat) + // work around for sound disable via text xml file, cleanup later + if (OptionStringExists("DisableSound")) + { + disableSound = true; + maOptionInfo[3].mnValue = 1; + Serialize(false); + } + return true; } |
|
From: Dewitt C. <ddc...@us...> - 2004-05-17 00:39:04
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3755/src/network Modified Files: tcUpdateMessageHandler.cpp Log Message: Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcUpdateMessageHandler.cpp 9 May 2004 20:40:23 -0000 1.9 --- tcUpdateMessageHandler.cpp 17 May 2004 00:38:53 -0000 1.10 *************** *** 321,324 **** --- 321,325 ---- unsigned nAcks = 0; + unsigned nUnknowns = 0; fprintf(stdout, "<< Received obj cmds, time %.1f: ", simState->GetTime()); *************** *** 326,330 **** long id; ! while ((stream >> id).eof() == false) { unsigned int updateSize; --- 327,331 ---- long id; ! while (((stream >> id).eof() == false) && (nUnknowns < 32)) { unsigned int updateSize; *************** *** 347,352 **** { stream.skip_read(updateSize); ! ! fprintf(stdout, "%d(X) ", id); } } --- 348,353 ---- { stream.skip_read(updateSize); ! nUnknowns++; ! fprintf(stdout, "%d(X%d) ", id, nUnknowns); } } *************** *** 517,524 **** fprintf(stdout, "<< Received obj update msg, time %.1f: ", simState->GetTime()); ! long id; ! while ((stream >> id).eof() == false) { unsigned int updateSize; --- 518,526 ---- fprintf(stdout, "<< Received obj update msg, time %.1f: ", simState->GetTime()); ! ! unsigned nUnknowns = 0; long id; ! while (((stream >> id).eof() == false) && (nUnknowns < 64)) { unsigned int updateSize; *************** *** 537,540 **** --- 539,543 ---- { missingIds.push(id); + nUnknowns++; fprintf(stdout, "%d(X) ", id); stream.skip_read(updateSize); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-17 00:39:02
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3755/include/common Modified Files: tcStream.h Log Message: Index: tcStream.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcStream.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcStream.h 9 May 2004 20:40:20 -0000 1.6 --- tcStream.h 17 May 2004 00:38:53 -0000 1.7 *************** *** 42,46 **** void read(char* buff, std::streamsize count); size_t size(); ! void skip_read(unsigned char count); int tellp(); void write(const char* buff, std::streamsize count); --- 42,46 ---- void read(char* buff, std::streamsize count); size_t size(); ! void skip_read(unsigned int count); int tellp(); void write(const char* buff, std::streamsize count); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-14 23:37:19
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1674/src/sim Modified Files: Game.cpp tc3DViewer.cpp tcCreditView.cpp tcEditControl.cpp tcObjectControl.cpp tcTime.cpp Log Message: Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCreditView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcCreditView.cpp 20 Mar 2004 18:46:46 -0000 1.10 --- tcCreditView.cpp 14 May 2004 23:37:08 -0000 1.11 *************** *** 1,6 **** /* ! ** tcCreditView.cpp ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- /* ! ** @file tcCreditView.cpp ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 33,36 **** --- 33,37 ---- #include "tcString.h" #include "wxcommands.h" + #include "tcTime.h" using namespace Gdiplus; *************** *** 38,302 **** void tcCreditView::AddCredit(tcString& s, float afTrailSpace, int effect) { ! if (mnCredits >= MAX_CREDITS) {return;} ! maCredit[mnCredits].mfTrailSpace = afTrailSpace; ! maCredit[mnCredits].mnEffect = effect; ! maCredit[mnCredits++].mzCaption = s; } /*******************************************************************************/ bool tcCreditView::Init() { ! tcString s; ! s = "------- C R E D I T S -------"; ! AddCredit(s, 40.0f, 1); ! s = "Dewitt \"Cole\" Colclough"; ! AddCredit(s, 25.0f, 1); ! s = "Project manager and lead developer\n"; ! AddCredit(s, 80.0f, 0); ! s = "Marcelo C\341ceres (op4_delta)"; ! AddCredit(s, 25.0f, 1); ! s = "3D art"; ! AddCredit(s, 60.0f, 0); ! s = "Marco Belli"; ! AddCredit(s, 25.0f, 1); ! s = "Developer - Sound, Linux port"; ! AddCredit(s, 60.0f, 0); ! s = "Jason Morris"; ! AddCredit(s, 25.0f, 1); ! s = "Developer"; ! AddCredit(s, 60.0f, 0); ! s = "Test\n"; ! AddCredit(s, 23.0f, 1); ! AddCredit(tcString("Marco Belli"), 12.0f, 2); ! AddCredit(tcString("Marcelo C\341ceres"), 12.0f, 2); ! AddCredit(tcString("Rob Carpenter"), 12.0f, 2); ! AddCredit(tcString("Paul Daly"), 12.0f, 2); ! AddCredit(tcString("Dust"), 12.0f, 2); ! AddCredit(tcString("Jason Morris"), 12.0f, 2); ! AddCredit(tcString("Andrew Platfoot"), 12.0f, 2); ! AddCredit(tcString("Justin Priestman"), 12.0f, 2); ! AddCredit(tcString("Gregg Smith"), 38.0f+12.0f, 2); ! s = "Some 2D art courtesy of U.S. Navy, www.news.navy.mil/view_galleries.asp \n"; ! AddCredit(s, 60.0f, 0); ! s = "3D sky code\n"; ! AddCredit(s, 25.0f, 0); ! s = "Combat Simulator Project, csp.sourceforge.net \n"; ! AddCredit(s, 60.0f, 1); ! s = "Map data based on GTOPO30 archive distributed by the \nLand Processes Distributed Active Archive Center (LP DAAC)\nlpdaac.usgs.gov \n"; ! AddCredit(s, 100.0f, 0); ! s = "Thanks to the developers of these software libraries:\n"; ! AddCredit(s, 30.0f, 0); ! s = "wxWindows\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.wxwindows.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Python 2.3\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.python.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Boost Python\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.boost.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "OpenSceneGraph\n"; ! AddCredit(s, 20.0f, 0); ! s = "openscenegraph.sourceforge.net\n"; ! AddCredit(s, 60.0f, 0); ! s = "Special thanks to:"; ! AddCredit(s, 30.0f, 0); ! s = "Harpoon HQ, www.harpoonhq.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Mille-Sabords, www.mille-sabords.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Seawolves Surface Division, www.seawolves.org/fc\n"; ! AddCredit(s, 30.0f, 0); ! s = "and\n"; ! AddCredit(s, 30.0f, 0); ! ! s = "To those who offered advice through e-mail and \nthe global_conflict discussion group"; ! AddCredit(s, 120.0f, 0); - s = "GLOBAL CONFLICT BLUE"; - AddCredit(s, 20.0f, 0); ! s = "An open source project"; ! AddCredit(s, 20.0f, 0); ! s = "www.gcblue.com"; ! AddCredit(s, 20.0f, 0); ! s = "Copyright (C) 2002-2004, All rights reserved.\n"; ! AddCredit(s, 60.0f, 0); - FontFamily ff(L"Arial"); - mpFont = new Font(&ff,16,FontStyleRegular,UnitPixel); - if (mpFont == NULL) { - WTL("tcCreditView - mpFont creation failed\n"); - return false; - } - mpFontLarge = new Font(&ff,20,FontStyleBold,UnitPixel); - if (mpFontLarge == NULL) { - WTL("tcCreditView - mpFontLarge creation failed\n"); - return false; - } - mpFontSmall = new Font(&ff,12,FontStyleRegular,UnitPixel); - if (mpFontSmall == NULL) { - WTL("tcCreditView - mpFontSmall creation failed\n"); - return false; - } ! mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB ! if (mpBrush == NULL) { ! WTL("tcCreditView - mpBrush creation failed\n"); ! return false; ! } ! mpPen = new Pen(Color(255,200,200,200),2); ! if (mpPen == NULL) { ! WTL("tcCreditView - mpPen creation failed\n"); ! return false; ! } ! Rewind(); ! return true; } /*******************************************************************************/ ! int tcCreditView::Draw() { ! static WCHAR szwchar[256]; ! UINT32 nDeltaTime = mcTime.snCount_30Hz - mnStartTime; ! ! Graphics *pGraphics; ! Erase(); ! if (!GetGraphics(pGraphics)) { ! return false; ! } ! DrawBackground(pGraphics); ! // Get the text rendering hint. ! TextRenderingHint oldhint = pGraphics->GetTextRenderingHint(); ! // Set the text rendering hint to TextRenderingHintAntiAlias. ! pGraphics->SetTextRenderingHint(TextRenderingHintAntiAlias); - float fY = (float)mnHeight - 2*0.5f*(float)nDeltaTime; - float fX = 0.5f*(float)mnWidth; - - const UINT32 nColorFade = 0x8E328032; - const UINT32 nColorBright = 0xFE64FF64; - mpBrush->SetColor(Color(nColorBright)); // font color - //DrawTextCentered(pGraphics, mpFont, mpBrush, crawlstring.GetBuffer(), fX,fY); - static int nFlashId = -1; - static bool bFlash = false; - static UINT32 snFocusTime; - static tcString szFocus; ! // reset static variables if rewind occured ! if (mbDrawRewind) { ! nFlashId = -1; ! bFlash = false; ! mbDrawRewind = false; ! } ! if (bFlash) ! { ! if (nFlashId >= 0) {szFocus = maCredit[nFlashId].mzCaption;} ! snFocusTime = mcTime.snCount_30Hz; ! mpBrush->SetColor(Color(255,255,255,255)); ! pGraphics->FillRectangle(mpBrush,0,0,mnWidth,mnHeight); ! tcSound::Get()->PlayEffect(SEFFECT_EXPLOSION2); ! } ! if (nFlashId >= 0) { ! UINT32 nDeltaFocusTime = (mcTime.snCount_30Hz - snFocusTime); ! } ! for (int n=0;n<(int)mnCredits;n++) { ! tcString s = maCredit[n].mzCaption; ! const float fEffectZone = 60.0f; ! float dyeffect = fY - ((float)mnHeight - fEffectZone); ! if ((dyeffect >= 0)&&(dyeffect <= fEffectZone)) { ! mpBrush->SetColor(Color(nColorFade)); // font color ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 20.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 20.0f*dyeffect,fY); ! mpBrush->SetColor(Color(nColorBright)); // font color ! } ! else if (fY <= (float)mnHeight) { ! if ((n > nFlashId)&&(maCredit[n].mnEffect == 1)) { ! nFlashId = n; ! bFlash = true; ! } ! else { ! bFlash = false; ! } ! Font *pFont = mpFont; ! if (maCredit[n].mnEffect == 1) ! { ! pFont = mpFontLarge; ! } ! else if (maCredit[n].mnEffect == 2) ! { ! pFont = mpFontSmall; ! } ! mpBrush->SetColor(Color(nColorFade)); // font color ! ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), ! fX + 1.0f,fY + 1.0f); ! mpBrush->SetColor(Color(nColorBright)); // font color ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), fX,fY); ! } ! fY += maCredit[n].mfTrailSpace; ! } ! pGraphics->SetTextRenderingHint(oldhint); ! ReleaseGraphics(pGraphics); ! DrawBorder(); ! // rewind after credits are done crawling ! if (fY < -100.0f) { ! Rewind(); ! } ! return true; } --- 39,312 ---- void tcCreditView::AddCredit(tcString& s, float afTrailSpace, int effect) { ! if (mnCredits >= MAX_CREDITS) {return;} ! maCredit[mnCredits].mfTrailSpace = afTrailSpace; ! maCredit[mnCredits].mnEffect = effect; ! maCredit[mnCredits++].mzCaption = s; } /*******************************************************************************/ bool tcCreditView::Init() { ! tcString s; ! s = "------- C R E D I T S -------"; ! AddCredit(s, 40.0f, 1); ! s = "Dewitt \"Cole\" Colclough"; ! AddCredit(s, 25.0f, 1); ! s = "Project manager and lead developer\n"; ! AddCredit(s, 80.0f, 0); ! s = "Marcelo C\341ceres (op4_delta)"; ! AddCredit(s, 25.0f, 1); ! s = "3D art"; ! AddCredit(s, 60.0f, 0); ! s = "Marco Belli"; ! AddCredit(s, 25.0f, 1); ! s = "Developer - Sound, Linux port"; ! AddCredit(s, 60.0f, 0); ! s = "Jason Morris"; ! AddCredit(s, 25.0f, 1); ! s = "Developer"; ! AddCredit(s, 60.0f, 0); ! s = "Test\n"; ! AddCredit(s, 23.0f, 1); ! AddCredit(tcString("Marco Belli"), 12.0f, 2); ! AddCredit(tcString("Marcelo C\341ceres"), 12.0f, 2); ! AddCredit(tcString("Rob Carpenter"), 12.0f, 2); ! AddCredit(tcString("Paul Daly"), 12.0f, 2); ! AddCredit(tcString("Dust"), 12.0f, 2); ! AddCredit(tcString("Jason Morris"), 12.0f, 2); ! AddCredit(tcString("Andrew Platfoot"), 12.0f, 2); ! AddCredit(tcString("Justin Priestman"), 12.0f, 2); ! AddCredit(tcString("Gregg Smith"), 38.0f+12.0f, 2); ! s = "Some 2D art courtesy of U.S. Navy, www.news.navy.mil/view_galleries.asp \n"; ! AddCredit(s, 60.0f, 0); ! s = "3D sky code\n"; ! AddCredit(s, 25.0f, 0); ! s = "Combat Simulator Project, csp.sourceforge.net \n"; ! AddCredit(s, 60.0f, 1); ! s = "Map data based on GTOPO30 archive distributed by the \nLand Processes Distributed Active Archive Center (LP DAAC)\nlpdaac.usgs.gov \n"; ! AddCredit(s, 100.0f, 0); ! s = "Thanks to the developers of these software libraries:\n"; ! AddCredit(s, 30.0f, 0); ! s = "wxWindows\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.wxwindows.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Python 2.3\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.python.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "Boost Python\n"; ! AddCredit(s, 20.0f, 0); ! s = "www.boost.org\n"; ! AddCredit(s, 30.0f, 0); ! s = "OpenSceneGraph\n"; ! AddCredit(s, 20.0f, 0); ! s = "openscenegraph.sourceforge.net\n"; ! AddCredit(s, 60.0f, 0); ! s = "Special thanks to:"; ! AddCredit(s, 30.0f, 0); ! s = "Harpoon HQ, www.harpoonhq.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Mille-Sabords, www.mille-sabords.com\n"; ! AddCredit(s, 30.0f, 0); ! s = "Seawolves Surface Division, www.seawolves.org/fc\n"; ! AddCredit(s, 30.0f, 0); ! s = "and\n"; ! AddCredit(s, 30.0f, 0); + s = "To those who offered advice through e-mail and \nthe global_conflict discussion group"; + AddCredit(s, 120.0f, 0); ! s = "GLOBAL CONFLICT BLUE"; ! AddCredit(s, 20.0f, 0); ! s = "An open source project"; ! AddCredit(s, 20.0f, 0); ! s = "www.gcblue.com"; ! AddCredit(s, 20.0f, 0); + s = "Copyright (C) 2002-2004, All rights reserved.\n"; + AddCredit(s, 60.0f, 0); ! FontFamily ff(L"Arial"); ! mpFont = new Font(&ff,16,FontStyleRegular,UnitPixel); ! if (mpFont == NULL) { ! WTL("tcCreditView - mpFont creation failed\n"); ! return false; ! } ! mpFontLarge = new Font(&ff,20,FontStyleBold,UnitPixel); ! if (mpFontLarge == NULL) { ! WTL("tcCreditView - mpFontLarge creation failed\n"); ! return false; ! } ! mpFontSmall = new Font(&ff,12,FontStyleRegular,UnitPixel); ! if (mpFontSmall == NULL) { ! WTL("tcCreditView - mpFontSmall creation failed\n"); ! return false; ! } ! mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB ! if (mpBrush == NULL) { ! WTL("tcCreditView - mpBrush creation failed\n"); ! return false; ! } ! mpPen = new Pen(Color(255,200,200,200),2); ! if (mpPen == NULL) { ! WTL("tcCreditView - mpPen creation failed\n"); ! return false; ! } ! ! Rewind(); ! return true; } /*******************************************************************************/ ! int tcCreditView::Draw() ! { ! static WCHAR szwchar[256]; ! UINT32 nDeltaTime = tcTime::Get()->Get30HzCount() - mnStartTime; ! Graphics *pGraphics; ! Erase(); ! if (!GetGraphics(pGraphics)) ! { ! return false; ! } ! DrawBackground(pGraphics); ! // Get the text rendering hint. ! TextRenderingHint oldhint = pGraphics->GetTextRenderingHint(); + // Set the text rendering hint to TextRenderingHintAntiAlias. + pGraphics->SetTextRenderingHint(TextRenderingHintAntiAlias); ! float fY = (float)mnHeight - 2*0.5f*(float)nDeltaTime; ! float fX = 0.5f*(float)mnWidth; ! const UINT32 nColorFade = 0x8E328032; ! const UINT32 nColorBright = 0xFE64FF64; ! mpBrush->SetColor(Color(nColorBright)); // font color ! //DrawTextCentered(pGraphics, mpFont, mpBrush, crawlstring.GetBuffer(), fX,fY); ! static int nFlashId = -1; ! static bool bFlash = false; ! static UINT32 snFocusTime; ! static tcString szFocus; ! // reset static variables if rewind occured ! if (mbDrawRewind) ! { ! nFlashId = -1; ! bFlash = false; ! mbDrawRewind = false; ! } ! if (bFlash) ! { ! if (nFlashId >= 0) {szFocus = maCredit[nFlashId].mzCaption;} ! snFocusTime = tcTime::Get()->Get30HzCount(); ! mpBrush->SetColor(Color(255,255,255,255)); ! pGraphics->FillRectangle(mpBrush,0,0,mnWidth,mnHeight); ! tcSound::Get()->PlayEffect(SEFFECT_EXPLOSION2); ! } ! if (nFlashId >= 0) ! { ! UINT32 nDeltaFocusTime = (tcTime::Get()->Get30HzCount() - snFocusTime); ! } ! for (int n=0;n<(int)mnCredits;n++) ! { ! tcString s = maCredit[n].mzCaption; ! const float fEffectZone = 60.0f; ! float dyeffect = fY - ((float)mnHeight - fEffectZone); ! if ((dyeffect >= 0)&&(dyeffect <= fEffectZone)) { ! mpBrush->SetColor(Color(nColorFade)); // font color ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 40.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 30.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX - 20.0f*dyeffect,fY); ! DrawTextCentered(pGraphics, mpFont, mpBrush, s.GetBuffer(), ! fX + 20.0f*dyeffect,fY); ! mpBrush->SetColor(Color(nColorBright)); // font color ! } ! else if (fY <= (float)mnHeight) ! { ! if ((n > nFlashId)&&(maCredit[n].mnEffect == 1)) ! { ! nFlashId = n; ! bFlash = true; ! } ! else ! { ! bFlash = false; ! } ! Font *pFont = mpFont; ! if (maCredit[n].mnEffect == 1) ! { ! pFont = mpFontLarge; ! } ! else if (maCredit[n].mnEffect == 2) ! { ! pFont = mpFontSmall; ! } ! mpBrush->SetColor(Color(nColorFade)); // font color ! ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), ! fX + 1.0f,fY + 1.0f); ! mpBrush->SetColor(Color(nColorBright)); // font color ! DrawTextCentered(pGraphics, pFont, mpBrush, s.GetBuffer(), fX,fY); ! } ! fY += maCredit[n].mfTrailSpace; ! } ! ! pGraphics->SetTextRenderingHint(oldhint); ! ReleaseGraphics(pGraphics); ! DrawBorder(); ! ! // rewind after credits are done crawling ! if (fY < -100.0f) ! { ! Rewind(); ! } ! return true; } *************** *** 313,318 **** void tcCreditView::Rewind() { ! mnStartTime = mcTime.snCount_30Hz; ! mbDrawRewind = true; } --- 323,328 ---- void tcCreditView::Rewind() { ! mnStartTime = tcTime::Get()->Get30HzCount(); ! mbDrawRewind = true; } *************** *** 328,346 **** : tcWindow(parent, pos, size, name, sharedSurface) { ! mpFont = NULL; ! mpFontLarge = NULL; ! mpFontSmall = NULL; ! mpBrush = NULL; ! mnCredits = 0; ! mbDrawRewind = false; } tcCreditView::~tcCreditView() { ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontLarge != NULL) {delete mpFontLarge;} ! if (mpFontSmall != NULL) {delete mpFontSmall;} ! if (mpBrush != NULL) {delete mpBrush;} ! if (mpPen != NULL) {delete mpPen;} } --- 338,356 ---- : tcWindow(parent, pos, size, name, sharedSurface) { ! mpFont = NULL; ! mpFontLarge = NULL; ! mpFontSmall = NULL; ! mpBrush = NULL; ! mnCredits = 0; ! mbDrawRewind = false; } tcCreditView::~tcCreditView() { ! if (mpFont != NULL) {delete mpFont;} ! if (mpFontLarge != NULL) {delete mpFontLarge;} ! if (mpFontSmall != NULL) {delete mpFontSmall;} ! if (mpBrush != NULL) {delete mpBrush;} ! if (mpPen != NULL) {delete mpPen;} } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** Game.cpp 9 May 2004 20:40:23 -0000 1.78 --- Game.cpp 14 May 2004 23:37:08 -0000 1.79 *************** *** 363,367 **** void tcGame::Init() { - tcTime::Init(); startTime = wxDateTime::Now(); --- 363,366 ---- *************** *** 1081,1085 **** static teScreenMode lastMode = NONE; ! tcTime::Update(); tcMultiplayerInterface::Get()->Update(); --- 1080,1084 ---- static teScreenMode lastMode = NONE; ! tcTime::Get()->Update(); tcMultiplayerInterface::Get()->Update(); *************** *** 1233,1237 **** briefingConsoleBottom->SetActive(false); optionsView->SetActive(true); ! networkView->SetActive(false); tacticalMap->SetActive(false); infoConsole->SetActive(false); --- 1232,1236 ---- briefingConsoleBottom->SetActive(false); optionsView->SetActive(true); ! //networkView->SetActive(false); tacticalMap->SetActive(false); infoConsole->SetActive(false); *************** *** 1247,1251 **** briefingConsoleLeft->SetActive(false); briefingConsoleBottom->SetActive(false); ! optionsView->SetActive(false); networkView->SetActive(true); tacticalMap->SetActive(false); --- 1246,1250 ---- briefingConsoleLeft->SetActive(false); briefingConsoleBottom->SetActive(false); ! //optionsView->SetActive(false); networkView->SetActive(true); tacticalMap->SetActive(false); *************** *** 1262,1266 **** bool tcGame::UpdateFrame() { ! tcTime::Update(); if (meGameMode == GM_START) --- 1261,1265 ---- bool tcGame::UpdateFrame() { ! tcTime::Get()->Update(); if (meGameMode == GM_START) *************** *** 1285,1288 **** --- 1284,1288 ---- const float dateZuluScale = 1.0f; // for testing sky effects static std::string dateTimeString = "---"; + bool isLagging = false; if (nLastCount == 0) *************** *** 1323,1327 **** QueryPerformanceCounter(&nPerformanceCount); ! if ((nPerformanceCount.QuadPart-nLastCount) >= ndt) { SynchTimeAcceleration(); --- 1323,1330 ---- QueryPerformanceCounter(&nPerformanceCount); ! unsigned long deltaCount = nPerformanceCount.QuadPart-nLastCount; ! isLagging = (deltaCount > 8*ndt); // true if cannot maintain real time ! ! if (deltaCount >= ndt) { SynchTimeAcceleration(); *************** *** 1361,1364 **** --- 1364,1371 ---- dateTimeString += buff; } + if (isLagging) + { + dateTimeString += "[LAG]"; + } tacticalMap->SetDateTime(dateTimeString); *************** *** 1401,1404 **** --- 1408,1413 ---- } + ProcessCommandList(); + mcGameView.Update(gameTime); *************** *** 1408,1413 **** } - ProcessCommandList(); - // Draw 2D windows UpdateForScreenMode(); --- 1417,1420 ---- *************** *** 1432,1436 **** viewer->Update(gameDateZulu); ! if (directorTime > 0.1f) { mpGraphicsEngine->RenderAll(); --- 1439,1444 ---- viewer->Update(gameDateZulu); ! // skip frames if lagging and server ! if ((directorTime > 0.1f) && (!isLagging || !tcMultiplayerInterface::Get()->IsServer())) { mpGraphicsEngine->RenderAll(); Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcObjectControl.cpp 29 Feb 2004 22:51:36 -0000 1.14 --- tcObjectControl.cpp 14 May 2004 23:37:08 -0000 1.15 *************** *** 948,952 **** } ! if (tcTime::snCount_30Hz % 30 > 15) // blink { mpBrush->SetColor(0xFFFF6464); --- 948,952 ---- } ! if (tcTime::Get()->snCount_30Hz % 30 > 15) // blink { mpBrush->SetColor(0xFFFF6464); Index: tcTime.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTime.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcTime.cpp 18 Feb 2004 23:55:51 -0000 1.5 --- tcTime.cpp 14 May 2004 23:37:08 -0000 1.6 *************** *** 27,40 **** #include "tcTime.h" ! LARGE_INTEGER tcTime::snFrequency = {0}; ! DWORD tcTime::snDeltaCount = 0; ! DWORD tcTime::snLastCount = 0; ! UINT32 tcTime::snCount_30Hz = 0; /** * Assumes tcTime::Update() is being called from main loop. * @return 30 Hz counter count value */ ! UINT32 tcTime::Get30HzCount() { return snCount_30Hz; --- 27,48 ---- #include "tcTime.h" ! ! /** ! * Accessor for singleton instance ! */ ! tcTime* tcTime::Get() ! { ! static tcTime instance; ! ! return &instance; ! } ! /** * Assumes tcTime::Update() is being called from main loop. + * Use tcTime::GetUpdate30HzCount to update before reading counter * @return 30 Hz counter count value */ ! unsigned tcTime::Get30HzCount() { return snCount_30Hz; *************** *** 42,45 **** --- 50,63 ---- /** + * Calls tcTime::Update() to update counter value + * @return 30 Hz counter count value + */ + unsigned tcTime::GetUpdated30HzCount() + { + Update(); + return snCount_30Hz; + } + + /** * Initializes the tcTime object. */ *************** *** 74,81 **** * tcTime constructor. */ ! tcTime::tcTime(void) {} /** * tcTime destructor. */ ! tcTime::~tcTime(void) {} \ No newline at end of file --- 92,108 ---- * tcTime constructor. */ ! tcTime::tcTime() : ! snDeltaCount(0), ! snLastCount(0), ! snCount_30Hz(0) ! { ! Init(); ! ! } /** * tcTime destructor. */ ! tcTime::~tcTime() ! { ! } \ No newline at end of file Index: tcEditControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcEditControl.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcEditControl.cpp 30 Nov 2003 17:23:52 -0000 1.5 --- tcEditControl.cpp 14 May 2004 23:37:08 -0000 1.6 *************** *** 24,27 **** --- 24,28 ---- #include "tcEditControl.h" + #include "tcTime.h" using namespace Gdiplus; *************** *** 34,46 **** if (!mbActive) {return true;} ! if (!GetGraphics(pGraphics)) { WTL("Failed to get Graphics in tcEditControl::Draw()\n"); return false; } ! if (IsBackgroundLoaded()) { DrawBackground(pGraphics); } ! else { // erase mpBrush->SetColor(Color(255,0,15,50)); --- 35,50 ---- if (!mbActive) {return true;} ! if (!GetGraphics(pGraphics)) ! { WTL("Failed to get Graphics in tcEditControl::Draw()\n"); return false; } ! if (IsBackgroundLoaded()) ! { DrawBackground(pGraphics); } ! else ! { // erase mpBrush->SetColor(Color(255,0,15,50)); *************** *** 63,70 **** SizeF size; MeasureText(pGraphics, mpFont, mzBuffer, size); ! if (mcTime.snCount_30Hz % 30 >= 15){ mpPen->SetColor(Color(254,0,0,0)); } ! else { mpPen->SetColor(Color(254,255,255,255)); } --- 67,75 ---- SizeF size; MeasureText(pGraphics, mpFont, mzBuffer, size); ! if (tcTime::Get()->Get30HzCount() % 30 >= 15){ mpPen->SetColor(Color(254,0,0,0)); } ! else ! { mpPen->SetColor(Color(254,255,255,255)); } Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tc3DViewer.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tc3DViewer.cpp 18 Feb 2004 18:53:55 -0000 1.29 --- tc3DViewer.cpp 14 May 2004 23:37:08 -0000 1.30 *************** *** 928,934 **** } - UpdateSky(dateZulu); frameStamp->setFrameNumber(frameStamp->getFrameNumber()+1); frameStamp->setReferenceTime(gameTime); --- 928,935 ---- } UpdateSky(dateZulu); + terrainManager->Update(); + frameStamp->setFrameNumber(frameStamp->getFrameNumber()+1); frameStamp->setReferenceTime(gameTime); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-14 23:37:17
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1674/src/network Modified Files: tcConnectionData.cpp tcMessage.cpp tcMultiplayerInterface.cpp tcNetworkInterface.cpp Log Message: Index: tcMessage.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMessage.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcMessage.cpp 4 Apr 2004 21:00:43 -0000 1.4 --- tcMessage.cpp 14 May 2004 23:37:08 -0000 1.5 *************** *** 89,93 **** } bufferIdx = 0; ! timestamp = tcTime::Get30HzCount(); data.header.messageSize = messageSize + HEADER_SIZE; --- 89,93 ---- } bufferIdx = 0; ! timestamp = tcTime::Get()->Get30HzCount(); data.header.messageSize = messageSize + HEADER_SIZE; *************** *** 117,121 **** void tcMessage::StampTime() { ! timestamp = tcTime::Get30HzCount(); } --- 117,121 ---- void tcMessage::StampTime() { ! timestamp = tcTime::Get()->Get30HzCount(); } Index: tcConnectionData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcConnectionData.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcConnectionData.cpp 2 May 2004 16:22:45 -0000 1.6 --- tcConnectionData.cpp 14 May 2004 23:37:08 -0000 1.7 *************** *** 250,254 **** { //fprintf(stdout,"Sent message, size:%d, id:%d, t:%d\n", ! // message->GetMessageSize(), message->GetMessageId(), tcTime::Get30HzCount()); writeCount += message->GetMessageSize(); writeQueueTCP.pop(); --- 250,254 ---- { //fprintf(stdout,"Sent message, size:%d, id:%d, t:%d\n", ! // message->GetMessageSize(), message->GetMessageId(), tcTime::Get()->Get30HzCount()); writeCount += message->GetMessageSize(); writeQueueTCP.pop(); *************** *** 258,262 **** { fprintf(stdout,"Sent partial message, buff_idx:%d, id:%d, t:%d\n", ! message->bufferIdx, message->GetMessageId(), tcTime::Get30HzCount()); } --- 258,262 ---- { fprintf(stdout,"Sent partial message, buff_idx:%d, id:%d, t:%d\n", ! message->bufferIdx, message->GetMessageId(), tcTime::Get()->Get30HzCount()); } *************** *** 303,307 **** writeCount += message->GetMessageSize(); //fprintf(stdout,"Sent UDP packet to %s, size:%d, id:%d, t:%d\n", ! // peerName.c_str(), message->GetMessageSize(), message->GetMessageId(), tcTime::Get30HzCount()); writeQueueUDP.pop(); --- 303,307 ---- writeCount += message->GetMessageSize(); //fprintf(stdout,"Sent UDP packet to %s, size:%d, id:%d, t:%d\n", ! // peerName.c_str(), message->GetMessageSize(), message->GetMessageId(), tcTime::Get()->Get30HzCount()); writeQueueUDP.pop(); Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcMultiplayerInterface.cpp 9 May 2004 20:40:22 -0000 1.15 --- tcMultiplayerInterface.cpp 14 May 2004 23:37:08 -0000 1.16 *************** *** 902,906 **** { static unsigned lastUpdate = 0; ! unsigned currentTime = tcTime::Get30HzCount(); if (currentTime - lastUpdate < 5) return; --- 902,906 ---- { static unsigned lastUpdate = 0; ! unsigned currentTime = tcTime::Get()->Get30HzCount(); if (currentTime - lastUpdate < 5) return; *************** *** 915,919 **** { tcPlayerStatus stat; ! stat.timestamp = tcTime::Get30HzCount(); stat.name = "anonymous"; playerInfo[connId] = stat; --- 915,919 ---- { tcPlayerStatus stat; ! stat.timestamp = tcTime::Get()->Get30HzCount(); stat.name = "anonymous"; playerInfo[connId] = stat; *************** *** 922,926 **** else { ! playerInfo[connId].timestamp = tcTime::Get30HzCount(); } } --- 922,926 ---- else { ! playerInfo[connId].timestamp = tcTime::Get()->Get30HzCount(); } } *************** *** 1022,1026 **** { static unsigned lastUpdate = 0; ! unsigned currentTime = tcTime::Get30HzCount(); if (currentTime - lastUpdate < 240) return; --- 1022,1026 ---- { static unsigned lastUpdate = 0; ! unsigned currentTime = tcTime::Get()->Get30HzCount(); if (currentTime - lastUpdate < 240) return; Index: tcNetworkInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcNetworkInterface.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcNetworkInterface.cpp 2 May 2004 16:22:45 -0000 1.11 --- tcNetworkInterface.cpp 14 May 2004 23:37:08 -0000 1.12 *************** *** 55,59 **** } ! cdata.timestamp = tcTime::Get30HzCount(); cdata.id = connectionIndex++; --- 55,59 ---- } ! cdata.timestamp = tcTime::Get()->Get30HzCount(); cdata.id = connectionIndex++; *************** *** 154,160 **** std::string tcNetworkInterface::GetConnectionStatus(unsigned connectionIdx) { if (connectState == IS_CONNECTING) { ! wxString status = wxString::Format("Connecting to %s", hostAddress.Hostname().c_str()); return status.c_str(); } --- 154,169 ---- std::string tcNetworkInterface::GetConnectionStatus(unsigned connectionIdx) { + unsigned timeCount = tcTime::Get()->Get30HzCount(); + if (connectState == IS_CONNECTING) { ! wxString status = wxString::Format("Connecting to %s ", hostAddress.IPAddress().c_str()); ! ! // display "animated" dots while connecting to indicate something is happening ! unsigned animateCount = timeCount % 40; ! if (animateCount >= 10) status += ". "; ! if (animateCount >= 20) status += ". "; ! if (animateCount >= 30) status += "."; ! return status.c_str(); } *************** *** 163,168 **** tcConnectionData& connData = connectionData[connectionIdx]; ! float dt_sec = (1.0f/30.0f)* ! (float)(tcTime::Get30HzCount() - connData.timestamp); unsigned long bytesIn = connData.GetReadCount(); unsigned long bytesOut = connData.GetWriteCount(); --- 172,176 ---- tcConnectionData& connData = connectionData[connectionIdx]; ! float dt_sec = (1.0f/30.0f)*(float)(timeCount - connData.timestamp); unsigned long bytesIn = connData.GetReadCount(); unsigned long bytesOut = connData.GetWriteCount(); *************** *** 447,451 **** connectState = IS_CONNECTING; ! connectionStartTime = tcTime::Get30HzCount(); --- 455,459 ---- connectState = IS_CONNECTING; ! connectionStartTime = tcTime::Get()->Get30HzCount(); *************** *** 647,654 **** { /* ! static unsigned lastUpdate = tcTime::Get30HzCount(); ! if ((tcTime::Get30HzCount() - lastUpdate) < 15) return; ! lastUpdate = tcTime::Get30HzCount(); */ if (isServer) --- 655,662 ---- { /* ! static unsigned lastUpdate = tcTime::Get()->Get30HzCount(); ! if ((tcTime::Get()->Get30HzCount() - lastUpdate) < 15) return; ! lastUpdate = tcTime::Get()->Get30HzCount(); */ if (isServer) *************** *** 683,687 **** { wxASSERT (connectState == IS_CONNECTING); ! bool timedOut = tcTime::Get30HzCount() - connectionStartTime > 30*5; if (timedOut) { --- 691,695 ---- { wxASSERT (connectState == IS_CONNECTING); ! bool timedOut = tcTime::Get()->GetUpdated30HzCount() - connectionStartTime > 30*5; if (timedOut) { |
|
From: Dewitt C. <ddc...@us...> - 2004-05-14 23:37:17
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1674/src/graphics Modified Files: tc3DTerrain.cpp tcConsoleBox.cpp tcEditBox.cpp tcTerrainTextureFactory.cpp Log Message: Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcConsoleBox.cpp 9 May 2004 20:40:22 -0000 1.4 --- tcConsoleBox.cpp 14 May 2004 23:37:07 -0000 1.5 *************** *** 166,169 **** --- 166,170 ---- int width; int height; + int wrap = 50; current->Attribute("X", &x); *************** *** 171,178 **** --- 172,183 ---- current->Attribute("Width", &width); current->Attribute("Height", &height); + current->Attribute("Wrap", &wrap); SetSize(x, y, width, height); // set all size params nyzero = height - 20; + if (wrap < 10) wrap = 50; + SetWrap(wrap); + double fontSize; current->Attribute("FontSize", &fontSize); Index: tc3DTerrain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DTerrain.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tc3DTerrain.cpp 11 Apr 2004 21:59:16 -0000 1.11 --- tc3DTerrain.cpp 14 May 2004 23:37:07 -0000 1.12 *************** *** 37,40 **** --- 37,41 ---- #include "tcMapData.h" #include "tcTerrainTextureFactory.h" + #include "tcTime.h" #ifdef _DEBUG *************** *** 83,90 **** } void tc3DTerrain::UpdateElevations() { wxASSERT(mapData); ! for(int i=0;i<GRID_DIM;i++) { --- 84,100 ---- } + /** + * Call every frame to support gradual terrain loading + */ + void tc3DTerrain::Update() + { + wxASSERT(texFactory); + if (texFactory) texFactory->Update(); + } + void tc3DTerrain::UpdateElevations() { wxASSERT(mapData); ! for(int i=0;i<GRID_DIM;i++) { *************** *** 100,109 **** } } texFactory->BuildTextures(); ! terrain->SetAllElevations(&elevationArray[0],GRID_DIM,GRID_DIM,gridSpacing); //terrain->SetMaximumVisibleBlockSize(64); } float tc3DTerrain::GetElevation(float x, float y) { --- 110,146 ---- } } + texFactory->BuildTextures(); ! terrain->SetAllElevations(&elevationArray[0], GRID_DIM, GRID_DIM, gridSpacing); ! unsigned t3 = tcTime::Get()->GetUpdated30HzCount(); ! //terrain->SetMaximumVisibleBlockSize(64); + } + void tc3DTerrain::UpdateElevationsSlowly() + { + wxASSERT(mapData); + /* + for(int i=0;i<GRID_DIM;i++) + { + float y = (float)i * gridSpacing + gridOffset; + float lat_deg = C_180OVERPI*YToLat(y); + for(int j=0;j<GRID_DIM;j++) + { + float x = (float)j * gridSpacing + gridOffset; + float lon_deg = C_180OVERPI*XToLon(x); + float height = mapData->GetTerrainHeight(lon_deg, lat_deg, gameTime); + long idx = i*GRID_DIM + j; + elevationArray[idx] = (height < 0) ? 0.001f*height : height; + } + } + texFactory->BuildTextures(); + terrain->SetAllElevations(&elevationArray[0],GRID_DIM,GRID_DIM,gridSpacing); + */ + //terrain->SetMaximumVisibleBlockSize(64); } + + float tc3DTerrain::GetElevation(float x, float y) { *************** *** 169,173 **** } ! tc3DTerrain::tc3DTerrain() { mapData = NULL; --- 206,213 ---- } ! tc3DTerrain::tc3DTerrain() : ! updateScheduled(false), ! updating(false), ! doGradualUpdate(true) { mapData = NULL; Index: tcTerrainTextureFactory.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcTerrainTextureFactory.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcTerrainTextureFactory.cpp 11 Apr 2004 22:18:19 -0000 1.7 --- tcTerrainTextureFactory.cpp 14 May 2004 23:37:07 -0000 1.8 *************** *** 48,62 **** #define USE_TERRAIN_TEXTURES ! //const float texelsPerMeter = 0.001f; ! //const float texelSpacing = 1.0f / texelsPerMeter; ! const float textureSize = 128.0f; ! const int textureSizeInt = 128; ! const float textureSizeMed = 64.0f; // medium resolution texture size ! const int textureSizeMedInt = 64; ! const float textureSizeLow = 32.0f; // low resolution texture size ! const int textureSizeLowInt = 32; ! void tcTerrainTextureFactory::BuildTextures() { float gridWidth = terrain->GetWidth(); float gridHeight = terrain->GetHeight(); --- 48,64 ---- #define USE_TERRAIN_TEXTURES ! /** ! * Create empty textures and update procedural texture data ! * if doGradualUpdate is true, set updateScheduled to true and ! * return instead. ! */ void tcTerrainTextureFactory::BuildTextures() { + if (doGradualUpdate) + { + updateScheduled = true; + return; + } + float gridWidth = terrain->GetWidth(); float gridHeight = terrain->GetHeight(); *************** *** 65,107 **** int nY = 0; ! const int edgeDepthLow = 2; ! const int edgeDepthMed = 3; for (float y = 0; y < gridHeight; y += gridStepY) { - bool edgeYLow = (nY < edgeDepthLow)||(nY >= gridDimension - edgeDepthLow); - bool edgeYMed = ((nY < edgeDepthMed)||(nY >= gridDimension - edgeDepthMed))&&(!edgeYLow); nY++; int nX = 0; for (float x = 0; x < gridWidth; x += gridStepX) { - bool edgeXLow = (nX < edgeDepthLow)||(nX >= gridDimension - edgeDepthLow); - bool edgeXMed = ((nX < edgeDepthMed)||(nX >= gridDimension - edgeDepthMed))&&(!edgeXLow); nX++; ! // select resolution for texture based on position of tile in grid ! int currentTextureSize; ! if (edgeXLow || edgeYLow) ! { ! currentTextureSize = textureSizeLowInt; ! } ! else if (edgeXMed || edgeYMed) ! { ! currentTextureSize = textureSizeMedInt; ! } ! else ! { ! currentTextureSize = textureSizeInt; ! } ! ! int cacheIdx = GetTextureIndex(x,y); Demeter::Texture* pTexture = m_Textures[cacheIdx]; // create a new texture if one doesn't exist ("lazy init") if (pTexture == NULL) { ! Uint8* pImage = new Uint8[currentTextureSize*currentTextureSize*3]; ! pTexture = new Demeter::Texture(pImage,currentTextureSize,currentTextureSize,currentTextureSize,0,true,false,false); ! pTexture->SetBufferPersistent(TRUE); ///< keeps tex in system memory for dynamic modification ! m_Textures[cacheIdx] = pTexture; ! delete pImage; //fprintf(stdout,"created tex:%d (x,y):(%.0f,%.0f)\n",cacheIdx,x,y); } --- 67,86 ---- int nY = 0; ! for (float y = 0; y < gridHeight; y += gridStepY) { nY++; int nX = 0; for (float x = 0; x < gridWidth; x += gridStepX) { nX++; ! int cacheIdx = GetTextureIndex(x, y); Demeter::Texture* pTexture = m_Textures[cacheIdx]; // create a new texture if one doesn't exist ("lazy init") if (pTexture == NULL) { ! m_Textures[cacheIdx] = CreateEmptyTexture(nX, nY); ! pTexture = m_Textures[cacheIdx]; //fprintf(stdout,"created tex:%d (x,y):(%.0f,%.0f)\n",cacheIdx,x,y); } *************** *** 113,116 **** --- 92,131 ---- } + + Demeter::Texture* tcTerrainTextureFactory::CreateEmptyTexture(int nX, int nY) + { + Demeter::Texture* pTexture; + + // determine position of texture tile in grid + bool edgeYLow = (nY < edgeDepthLow)||(nY >= gridDimension - edgeDepthLow); + bool edgeYMed = ((nY < edgeDepthMed)||(nY >= gridDimension - edgeDepthMed))&&(!edgeYLow); + + bool edgeXLow = (nX < edgeDepthLow)||(nX >= gridDimension - edgeDepthLow); + bool edgeXMed = ((nX < edgeDepthMed)||(nX >= gridDimension - edgeDepthMed))&&(!edgeXLow); + + // select resolution for texture based on position + int currentTextureSize; + if (edgeXLow || edgeYLow) + { + currentTextureSize = textureSizeLowInt; + } + else if (edgeXMed || edgeYMed) + { + currentTextureSize = textureSizeMedInt; + } + else + { + currentTextureSize = textureSizeInt; + } + + Uint8* pImage = new Uint8[currentTextureSize*currentTextureSize*3]; + pTexture = new Demeter::Texture(pImage,currentTextureSize,currentTextureSize,currentTextureSize,0,true,false,false); + pTexture->SetBufferPersistent(TRUE); ///< keeps tex in system memory for dynamic modification + delete pImage; + + return pTexture; + } + + void tcTerrainTextureFactory::FreeTextureCache() { *************** *** 168,172 **** // calculate alpha for each texture bool searching = true; ! int nTex = 0; for (nTex=0;(nTex<NUM_TEXTURES)&& searching;nTex++) { --- 183,187 ---- // calculate alpha for each texture bool searching = true; ! int nTex = 0; for (nTex=0;(nTex<NUM_TEXTURES)&& searching;nTex++) { *************** *** 203,207 **** blue += (int)floorf(alpha[nTex]*(float)textureInfo[nTex].texData[srcIndex+2]); } ! pImage[imageIndex] = red; pImage[imageIndex + 1] = green; --- 218,222 ---- blue += (int)floorf(alpha[nTex]*(float)textureInfo[nTex].texData[srcIndex+2]); } ! pImage[imageIndex] = red; pImage[imageIndex + 1] = green; *************** *** 365,369 **** else { ! return tex; } } --- 380,384 ---- else { ! return (updating) ? defaultTexture : tex; } } *************** *** 379,384 **** --- 394,465 ---- } + /** + * Update one grid square every time through + */ + void tcTerrainTextureFactory::Update() + { + if (updateScheduled) + { + updateX = 0; + updateY = 0; + updateScheduled = false; + updating = true; + } + + if (!updating) return; + + float gridWidth = terrain->GetWidth(); + float gridHeight = terrain->GetHeight(); + float gridStepX = gridWidth / (float)gridDimension; + float gridStepY = gridHeight / (float)gridDimension; + + if (updateY < gridHeight) + { + if (updateX < gridWidth) + { + int cacheIdx = GetTextureIndex(updateX, updateY); + Demeter::Texture* pTexture = m_Textures[cacheIdx]; + + // create a new texture if one doesn't exist ("lazy init") + if (pTexture == NULL) + { + int nX = (int)floorf((updateX / gridStepX) + 0.1f); + int nY = (int)floorf((updateY / gridStepY) + 0.1f); + + m_Textures[cacheIdx] = CreateEmptyTexture(nX, nY); + pTexture = m_Textures[cacheIdx]; + } + + UpdateTexture(pTexture, updateX, updateY, gridStepX, gridStepY); + + updateX += gridStepX; + } + else + { + updateX = 0; + updateY += gridStepY; + } + } + else + { + updating = false; + } + + + } + tcTerrainTextureFactory::tcTerrainTextureFactory(Demeter::Terrain* pTerrain, tc3DTerrain *tm, int griddimension) + : edgeDepthLow(2), + edgeDepthMed(3), + textureSize(128.0f), + textureSizeInt(128), + textureSizeMed(64.0f), + textureSizeMedInt(64), + textureSizeLow(32.0f), + textureSizeLowInt(32), + updateScheduled(false), + updating(false), + doGradualUpdate(true) { terrain = pTerrain; Index: tcEditBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcEditBox.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcEditBox.cpp 24 Mar 2004 21:09:26 -0000 1.4 --- tcEditBox.cpp 14 May 2004 23:37:07 -0000 1.5 *************** *** 88,92 **** SizeF size; MeasureText(graphics, font, mzBuffer, size); ! if (tcTime::Get30HzCount() % 30 >= 15) { pen->SetColor(Color(254,0,0,0)); --- 88,92 ---- SizeF size; MeasureText(graphics, font, mzBuffer, size); ! if (tcTime::Get()->Get30HzCount() % 30 >= 15) { pen->SetColor(Color(254,0,0,0)); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-14 23:37:16
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1674/include/sim Modified Files: tcCreditView.h tcEditControl.h tcTime.h Log Message: Index: tcEditControl.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcEditControl.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcEditControl.h 30 Nov 2003 17:23:52 -0000 1.4 --- tcEditControl.h 14 May 2004 23:37:07 -0000 1.5 *************** *** 24,28 **** #include "tcCustomControl.h" - #include "tcTime.h" #define MAX_EDITCONTROL_CHAR 96 --- 24,27 ---- *************** *** 44,48 **** virtual ~tcEditControl(void); protected: - tcTime mcTime; Gdiplus::RectF mrectTextBar; // region for text to be displayed Gdiplus::RectF mrectTextCaption; // caption region --- 43,46 ---- Index: tcTime.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcTime.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcTime.h 18 Feb 2004 23:55:48 -0000 1.4 --- tcTime.h 14 May 2004 23:37:07 -0000 1.5 *************** *** 21,37 **** #include <wx/wx.h> class tcTime { public: ! static UINT32 snCount_30Hz; // 30 Hz counter ! static LARGE_INTEGER snFrequency; ! static DWORD snDeltaCount; ! static DWORD snLastCount; ! static UINT32 Get30HzCount(); ! static void Init(void); ! static void Update(void); ! tcTime(void); ! virtual ~tcTime(void); }; \ No newline at end of file --- 21,43 ---- #include <wx/wx.h> + class tcTime { public: ! static tcTime* Get(); ///< accessor for singleton instance ! unsigned snCount_30Hz; ///< 30 Hz counter value ! LARGE_INTEGER snFrequency; ! DWORD snDeltaCount; ! DWORD snLastCount; ! unsigned Get30HzCount(); ! unsigned GetUpdated30HzCount(); ! ! void Update(); ! private: ! void Init(); ! ! tcTime(); ! ~tcTime(); }; \ No newline at end of file Index: tcCreditView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCreditView.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcCreditView.h 20 Mar 2004 18:46:46 -0000 1.7 --- tcCreditView.h 14 May 2004 23:37:07 -0000 1.8 *************** *** 30,34 **** #include "tcSound.h" #include "aerror.h" - #include "tcTime.h" #include "tcString.h" --- 30,33 ---- *************** *** 46,53 **** public: void AddCredit(tcString& s, float afTrailSpace, int effect); ! bool Init(void); ! int Draw(void); void OnLButtonDown(wxMouseEvent& event); ! void Rewind(void); tcCreditView(wxWindow *parent, const wxPoint& pos, const wxSize& size, --- 45,52 ---- public: void AddCredit(tcString& s, float afTrailSpace, int effect); ! bool Init(); ! int Draw(); void OnLButtonDown(wxMouseEvent& event); ! void Rewind(); tcCreditView(wxWindow *parent, const wxPoint& pos, const wxSize& size, *************** *** 62,66 **** Gdiplus::Font *mpFontSmall; Gdiplus::Pen *mpPen; - tcTime mcTime; UINT32 mnStartTime; // 30 Hz counter to mark start of sequence int mnXStart,mnYStart; --- 61,64 ---- |
|
From: Dewitt C. <ddc...@us...> - 2004-05-14 23:37:16
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1674/include/graphics Modified Files: tc3DTerrain.h tcTerrainTextureFactory.h Log Message: Index: tc3DTerrain.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DTerrain.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tc3DTerrain.h 11 Apr 2004 21:13:00 -0000 1.9 --- tc3DTerrain.h 14 May 2004 23:37:06 -0000 1.10 *************** *** 54,57 **** --- 54,58 ---- void SetGameTime(double t) {gameTime = t;} void SetOrigin(double lon, double lat); ///< sets origin of 3D world coordinates + void Update(); tc3DTerrain(); *************** *** 81,84 **** --- 82,91 ---- double gameTime; ///< current game time [s] + // variables for gradual update + bool updateScheduled; + bool updating; + int update_i; + bool doGradualUpdate; ///< true to update elevation over multiple frames + float LonToX(double lon); float LatToY(double lat); *************** *** 87,90 **** --- 94,98 ---- void CheckElevations(); void UpdateElevations(); + void UpdateElevationsSlowly(); }; Index: tcTerrainTextureFactory.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcTerrainTextureFactory.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcTerrainTextureFactory.h 11 Apr 2004 21:24:57 -0000 1.2 --- tcTerrainTextureFactory.h 14 May 2004 23:37:06 -0000 1.3 *************** *** 2,6 **** ** tcTerrainTextureFactory.h ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcTerrainTextureFactory.h ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 34,45 **** class tc3DTerrain; class tcTerrainTextureFactory : public Demeter::TextureFactory { public: void BuildTextures(); ///< rebuilds procedural textures, called when origin changes tcTerrainTextureFactory(Demeter::Terrain* pTerrain, tc3DTerrain *tm, int griddimension); virtual ~tcTerrainTextureFactory(); ! virtual Demeter::Texture* GetTexture(int index,float originX,float originY,float width,float height); ! virtual void UnloadTexture(int index); private: enum --- 34,51 ---- class tc3DTerrain; + /** + * Class to do procedural texture generation for Demeter terrain + * Modify this to use iterator for std::map + */ class tcTerrainTextureFactory : public Demeter::TextureFactory { public: void BuildTextures(); ///< rebuilds procedural textures, called when origin changes + void Update(); ///< called every frame to distribute texture loading over multiple frames tcTerrainTextureFactory(Demeter::Terrain* pTerrain, tc3DTerrain *tm, int griddimension); + virtual ~tcTerrainTextureFactory(); ! virtual Demeter::Texture* GetTexture(int index,float originX,float originY,float width,float height); ! virtual void UnloadTexture(int index); private: enum *************** *** 48,54 **** --- 54,76 ---- }; int gridDimension; ///< number of texture cells along one dimension of grid + const int edgeDepthLow; ///< distance from edge of grid to use low resolution + const int edgeDepthMed; ///< distance from edge of grid to use med res (if not low res) + const float textureSize; ///< high resolution texture size + const int textureSizeInt; + const float textureSizeMed ; ///< medium resolution texture size + const int textureSizeMedInt; + const float textureSizeLow; ///< low resolution texture size + const int textureSizeLowInt; + bool updateScheduled; + bool updating; + float updateX; + float updateY; + bool doGradualUpdate; ///< true to calculate procedural textures over multiple frames + + Demeter::Terrain *terrain; tc3DTerrain *terrainManager; std::map<int,Demeter::Texture*> m_Textures; + osg::ref_ptr<osg::Image> seaTexture; osg::ref_ptr<osg::Image> coastTexture; *************** *** 67,70 **** --- 89,93 ---- } textureInfo[NUM_TEXTURES]; + Demeter::Texture* CreateEmptyTexture(int nX, int nY); void FreeTextureCache(); int GetTextureIndex(float x, float y); ///< gets index of precalc tex for coord (x,y) |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:41:48
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2197/xml Added Files: chat_box.xml Log Message: --- NEW FILE: chat_box.xml --- <Window> <ChatBox X="10" Y="10" Width="280" Height="145" FontSize="9.0"/> <ChatEntry X="10" Y="160" Width="280" Height="16" BarX="0.0" BarY="1.0" BarWidth="280.0" BarHeight="14.0" Caption=""/> </Window> |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:41:01
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/include/sim Modified Files: Game.h Log Message: Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Game.h 8 May 2004 21:25:25 -0000 1.35 --- Game.h 9 May 2004 20:40:21 -0000 1.36 *************** *** 61,64 **** --- 61,65 ---- class tcDirector; class tcNetworkView; + class tcChatBox; *************** *** 142,171 **** int mnLeftMargin; // width of left auxiliary windows int mnBottomMargin; // height of bottom aux windows ! wxGLCanvas *glCanvas; ! tcSoundConsole *infoConsole; ///< console object for info messages ! tcButtonConsole *briefingConsoleLeft; ///< console object for briefing text ! tcSoundConsole *briefingConsoleBottom; ///< to fill space at bottom for now ! tcTacticalMapView *tacticalMap; ///< tactical map object ! tcEditControl *editControl; ! tcOptionsView *optionsView; ! tcHookInfo *hookInfo; ///< window displaying info on hooked object ! tcObjectControl *objectControl; ///< platform control GUI window ! tcOOBView *oobView; ! tcPopupControl *popupControl; // popup control object tcDatabase mcDatabase; ! tcSimState *simState; tcMapData mcMapData; tcCommandQueue mcCommandQueue; ! tcSimPythonInterface *pythonInterface; tcUserInfo mcUserInfo; tcGameView mcGameView; ! tcGoalTracker *goalTracker; ///< monitors simstate vs. victory goals ! tcDirector *director; ///< displays scripted graphics and controls view for dramatic mission brief ! tcNetworkView *networkView; ///< network and multiplayer setup and test // interfaces for START game mode (unloaded when game is started) ! tcStartView *startView; ! tcCreditView *creditView; ! tcScenarioSelectView *scenarioSelectView; bool mbSaveScenario; --- 143,173 ---- int mnLeftMargin; // width of left auxiliary windows int mnBottomMargin; // height of bottom aux windows ! wxGLCanvas* glCanvas; ! tcSoundConsole* infoConsole; ///< console object for info messages ! tcButtonConsole* briefingConsoleLeft; ///< console object for briefing text ! tcSoundConsole* briefingConsoleBottom; ///< to fill space at bottom for now ! tcTacticalMapView* tacticalMap; ///< tactical map object ! tcEditControl* editControl; ! tcOptionsView* optionsView; ! tcHookInfo* hookInfo; ///< window displaying info on hooked object ! tcObjectControl* objectControl; ///< platform control GUI window ! tcOOBView* oobView; ! tcPopupControl* popupControl; // popup control object tcDatabase mcDatabase; ! tcSimState* simState; tcMapData mcMapData; tcCommandQueue mcCommandQueue; ! tcSimPythonInterface* pythonInterface; tcUserInfo mcUserInfo; tcGameView mcGameView; ! tcGoalTracker* goalTracker; ///< monitors simstate vs. victory goals ! tcDirector* director; ///< displays scripted graphics and controls view for dramatic mission brief ! tcNetworkView* networkView; ///< network and multiplayer setup and test ! tcChatBox* chatBox; ///< popup for multiplayer chat // interfaces for START game mode (unloaded when game is started) ! tcStartView* startView; ! tcCreditView* creditView; ! tcScenarioSelectView* scenarioSelectView; bool mbSaveScenario; |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:41:01
|
Update of /cvsroot/gcblue/gcb_wx/include/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/include/network Modified Files: tcMultiplayerInterface.h Log Message: Index: tcMultiplayerInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/network/tcMultiplayerInterface.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcMultiplayerInterface.h 8 May 2004 21:25:25 -0000 1.14 --- tcMultiplayerInterface.h 9 May 2004 20:40:21 -0000 1.15 *************** *** 38,41 **** --- 38,42 ---- class wxEvtHandler; class tcStream; + class tcConsoleBox; BEGIN_NAMESPACE(network) *************** *** 78,84 **** static tcMultiplayerInterface* Get(); void AddMessageHandler(int messageId, tcMessageHandler* handler); void BroadcastControlMessage(int messageCode); ! std::string GetChatText(); int GetConnectionId(unsigned connectionIdx); std::string GetConnectionStatus(unsigned connectionIdx); --- 79,86 ---- static tcMultiplayerInterface* Get(); + void AddChatSubscriber(tcConsoleBox* subscriber); void AddMessageHandler(int messageId, tcMessageHandler* handler); void BroadcastControlMessage(int messageCode); ! //std::string GetChatText(); int GetConnectionId(unsigned connectionIdx); std::string GetConnectionStatus(unsigned connectionIdx); *************** *** 96,99 **** --- 98,102 ---- void ProcessCommandClient(int connectionId, std::string text); void ProcessCommandServer(std::string text); + void RemoveChatSubscriber(tcConsoleBox* subscriber); void SendChatText(int destination, std::string message); void SendControlMessage(int destination, int messageCode, int param = 0); *************** *** 108,111 **** --- 111,115 ---- tcNetworkInterface *networkInterface; std::queue<std::string> chatText; ///< chat text to display + std::vector<tcConsoleBox*> chatSubscribers; std::string myName; ///< name to identify player std::map<int, tcPlayerStatus> playerInfo; ///< map of (connection id, tcPlayerStatus) pairs *************** *** 116,121 **** void ClearMessageMap(); bool IsNewPlayer(int id); - void ProcessChatMessage(int connectionId, unsigned messageSize, const unsigned char *data); void ProcessMessage(int messageId, int connectionId, unsigned messageSize, const unsigned char *data); --- 120,125 ---- void ClearMessageMap(); + void DistributeChatText(); bool IsNewPlayer(int id); void ProcessMessage(int messageId, int connectionId, unsigned messageSize, const unsigned char *data); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:41:00
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/include/graphics Modified Files: tcConsoleBox.h Log Message: Index: tcConsoleBox.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcConsoleBox.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcConsoleBox.h 11 Apr 2004 21:18:45 -0000 1.3 --- tcConsoleBox.h 9 May 2004 20:40:20 -0000 1.4 *************** *** 1,5 **** /** @file tcConsoleBox.h */ /* ! ** Copyright (C) 2004 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,5 ---- /** @file tcConsoleBox.h */ /* ! ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 71,75 **** void UpdateCursor(); ! tcConsoleBox(tcWindow *parent, TiXmlNode *config); virtual ~tcConsoleBox(); protected: --- 71,75 ---- void UpdateCursor(); ! tcConsoleBox(tcWindow* parent, TiXmlNode* config); ///< for shared surface console box virtual ~tcConsoleBox(); protected: *************** *** 84,87 **** --- 84,88 ---- Gdiplus::Font *mpFont; + void InitFromXml(TiXmlNode* config); void InitGdi(float afFontSize, UINT32 anColor); }; |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:41:00
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/include/common Modified Files: tcOptions.h tcStream.h Log Message: Index: tcOptions.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOptions.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcOptions.h 8 May 2004 21:25:25 -0000 1.6 --- tcOptions.h 9 May 2004 20:40:20 -0000 1.7 *************** *** 67,71 **** int mbUseNTDS; int debugLevel; ! int renderSkipCount; ///< used to skip rendering of some 2D windows to improve frame rate tsOptionInfo maOptionInfo[N_OPTIONS]; int mnNumOptions; --- 67,71 ---- int mbUseNTDS; int debugLevel; ! tsOptionInfo maOptionInfo[N_OPTIONS]; int mnNumOptions; Index: tcStream.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcStream.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcStream.h 8 May 2004 22:20:27 -0000 1.5 --- tcStream.h 9 May 2004 20:40:20 -0000 1.6 *************** *** 42,46 **** void read(char* buff, std::streamsize count); size_t size(); ! void skip(unsigned char count); void write(const char* buff, std::streamsize count); --- 42,47 ---- void read(char* buff, std::streamsize count); size_t size(); ! void skip_read(unsigned char count); ! int tellp(); void write(const char* buff, std::streamsize count); *************** *** 82,84 **** ! #endif \ No newline at end of file --- 83,85 ---- ! #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:40:59
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** GCblue.vcproj 1 May 2004 21:50:35 -0000 1.51 --- GCblue.vcproj 9 May 2004 20:40:18 -0000 1.52 *************** *** 341,344 **** --- 341,347 ---- </File> <File + RelativePath=".\src\sim\tcChatBox.cpp"> + </File> + <File RelativePath="src\sim\tcCreditView.cpp"> </File> *************** *** 717,720 **** --- 720,726 ---- </File> <File + RelativePath=".\include\sim\tcChatBox.h"> + </File> + <File RelativePath="include\sim\tcCreditView.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:40:34
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/src/network Modified Files: tcMultiplayerInterface.cpp tcUpdateMessageHandler.cpp Log Message: Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcUpdateMessageHandler.cpp 8 May 2004 22:20:29 -0000 1.8 --- tcUpdateMessageHandler.cpp 9 May 2004 20:40:23 -0000 1.9 *************** *** 346,350 **** else { ! stream.skip(updateSize); fprintf(stdout, "%d(X) ", id); --- 346,350 ---- else { ! stream.skip_read(updateSize); fprintf(stdout, "%d(X) ", id); *************** *** 538,542 **** missingIds.push(id); fprintf(stdout, "%d(X) ", id); ! stream.skip(updateSize); } } --- 538,542 ---- missingIds.push(id); fprintf(stdout, "%d(X) ", id); ! stream.skip_read(updateSize); } } Index: tcMultiplayerInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcMultiplayerInterface.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcMultiplayerInterface.cpp 8 May 2004 21:25:26 -0000 1.14 --- tcMultiplayerInterface.cpp 9 May 2004 20:40:22 -0000 1.15 *************** *** 39,42 **** --- 39,43 ---- #include "tcSimState.h" #include "tcGameObjIterator.h" + #include "tcConsoleBox.h" BEGIN_NAMESPACE(network) *************** *** 105,108 **** --- 106,136 ---- /** + * Adds tcConsoleBox to chat subscriber vector. Chat text will be printed + * to the tcConsoleBox when new text arrives. + */ + void tcMultiplayerInterface::AddChatSubscriber(tcConsoleBox* subscriber) + { + chatSubscribers.push_back(subscriber); + } + + /** + * Removes tcConsoleBox from chat subscriber list + */ + void tcMultiplayerInterface::RemoveChatSubscriber(tcConsoleBox* subscriber) + { + + for(std::vector<tcConsoleBox*>::iterator iter = chatSubscribers.begin() + ; iter != chatSubscribers.end(); ++iter) + { + if ((*iter) == subscriber) + { + chatSubscribers.erase(iter); + return; + } + } + fprintf(stderr, "Error - RemoveChatSubscriber - Not found\n"); + } + + /** * Adds message handler for message with messageId. * tcMessageHandler::Handle method will be called for any matching messages received *************** *** 175,179 **** } ! std::string tcMultiplayerInterface::GetChatText() { --- 203,207 ---- } ! /* std::string tcMultiplayerInterface::GetChatText() { *************** *** 183,186 **** --- 211,215 ---- return text; } + */ int tcMultiplayerInterface::GetConnectionId(unsigned connectionIdx) *************** *** 314,331 **** } ! void tcMultiplayerInterface::ProcessChatMessage(int connectionId, ! unsigned messageSize, const unsigned char *data) { ! chatText.push(std::string((char*)data)); ! if (networkInterface->IsServer()) { ! // broadcast chat text to all clients ! unsigned nConn = networkInterface->GetNumConnections(); ! for (unsigned n=0;n<nConn;n++) { ! int connId = networkInterface->GetConnectionId(n); ! SendChatText(connId, (char*)data); } } } --- 343,365 ---- } ! ! /** ! * Send queued chat text to subscribers. This should be periodically called ! * as part of the update method ! */ ! void tcMultiplayerInterface::DistributeChatText() { ! while (!chatText.empty()) { ! std::string text = chatText.front(); ! chatText.pop(); ! ! for(std::vector<tcConsoleBox*>::iterator iter = chatSubscribers.begin() ! ; iter != chatSubscribers.end(); ++iter) { ! (*iter)->Print(text.c_str()); } } + } *************** *** 454,471 **** mm[n]->Handle(connectionId, messageSize, data); } - - /* - switch (messageId) - { - case MSG_CHATTEXT: - ProcessChatMessage(connectionId, messageSize, data); - - break; - default: - std::cerr << "Error - tcMultiplayerInterface::ProcessMessage unrecognized message" - << std::endl; - break; - } - */ } --- 488,491 ---- *************** *** 596,599 **** --- 616,622 ---- ProcessReceiveMessages(); + // distribute chat text + DistributeChatText(); + // update player information UpdatePlayerInfo(); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:40:33
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/src/sim Modified Files: Game.cpp tcNetworkView.cpp tcSimState.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tcSimState.cpp 8 May 2004 21:25:26 -0000 1.42 --- tcSimState.cpp 9 May 2004 20:40:23 -0000 1.43 *************** *** 2035,2038 **** --- 2035,2039 ---- s.Format("tcSimState size: %d kB",sizeof(tcSimState)/1024); WTL(s.GetBuffer()); + } /********************************************************************/ *************** *** 2042,2044 **** if (goalTracker) delete goalTracker; } ! /********************************************************************/ \ No newline at end of file --- 2043,2045 ---- if (goalTracker) delete goalTracker; } ! /********************************************************************/ Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcNetworkView.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcNetworkView.cpp 8 May 2004 21:25:26 -0000 1.12 --- tcNetworkView.cpp 9 May 2004 20:40:23 -0000 1.13 *************** *** 71,80 **** DrawStatusBox(pGraphics); - if (tcMultiplayerInterface::Get()->IsChatTextAvail()) - { - chatBox->Print(tcMultiplayerInterface::Get()->GetChatText().c_str()); - } - - ReleaseGraphics(pGraphics); --- 71,74 ---- *************** *** 289,292 **** --- 283,287 ---- current = root->FirstChild("ChatBox"); chatBox = new tcConsoleBox(this, current); + tcMultiplayerInterface::Get()->AddChatSubscriber(chatBox); // add chat text edit box Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** Game.cpp 8 May 2004 21:25:26 -0000 1.77 --- Game.cpp 9 May 2004 20:40:23 -0000 1.78 *************** *** 49,52 **** --- 49,53 ---- #include "tcNetworkView.h" #include "network/tcMultiplayerInterface.h" + #include "tcChatBox.h" #if defined(_MSC_VER) *************** *** 217,220 **** --- 218,222 ---- viewer->SetActive(false); popupControl->SetActive(false); + chatBox->SetActive(false); // undo initialization *************** *** 391,394 **** --- 393,400 ---- editControl->SetActive(false); + chatBox = new tcChatBox(glCanvas, NULL, wxPoint(200, 200), wxSize(300, 180)); + chatBox->SetActive(false); + chatBox->MoveToTop(); + mcDatabase.LoadDBCSV(); // uncomment the SaveDBCSV line to save copy of database to _out suffix, *************** *** 561,565 **** briefingConsoleLeft->SetWrap(48); briefingConsoleLeft->SetActive(false); - briefingConsoleLeft->SetSkipCount(tcOptions::Get()->renderSkipCount); briefingConsoleLeft->SetDelayedTextEffect(true); briefingConsoleLeft->LoadBackgroundImage("briefing_left.jpg"); --- 567,570 ---- *************** *** 581,585 **** briefingConsoleBottom->SetWrap(100); briefingConsoleBottom->SetActive(false); - briefingConsoleBottom->SetSkipCount(tcOptions::Get()->renderSkipCount); briefingConsoleBottom->LoadBackgroundImage("briefing_bottom.jpg"); briefingConsoleBottom->Print(" "); // need this to get it to display --- 586,589 ---- *************** *** 687,691 **** infoConsole->SetWrap(28); infoConsole->SetActive(false); - infoConsole->SetSkipCount(tcOptions::Get()->renderSkipCount); --- 691,694 ---- *************** *** 705,709 **** hookInfo->AttachUserInfo(&mcUserInfo); hookInfo->SetActive(false); - hookInfo->SetSkipCount(tcOptions::Get()->renderSkipCount); // objectControl init --- 708,711 ---- *************** *** 723,727 **** objectControl->AttachOptions(tcOptions::Get()); objectControl->AttachUserInfo(&mcUserInfo); - objectControl->SetSkipCount(tcOptions::Get()->renderSkipCount); /* ** tcOOBView init * **/ --- 725,728 ---- *************** *** 744,748 **** oobView->AttachSimState(simState); oobView->mnAlliance = mcUserInfo.GetOwnAlliance(); // TODO: make this configurable - oobView->SetSkipCount(tcOptions::Get()->renderSkipCount); // popupControl init --- 745,748 ---- *************** *** 1095,1098 **** --- 1095,1099 ---- scenarioSelectView->SetActive(false); networkView->SetActive(false); + chatBox->SetActive(false); } *************** *** 1195,1198 **** --- 1196,1203 ---- } if (popupControl->mbActive) popupControl->Draw(); + if (chatBox->mbActive) + { + chatBox->Draw(); + } } else if (meScreenMode == TACTICALBRIEF) *************** *** 1209,1213 **** oobView->SetActive(false); viewer->SetActive(mb3DActive); - if (drawTacticalMap) { --- 1214,1217 ---- *************** *** 1219,1222 **** --- 1223,1230 ---- briefingConsoleBottom->Draw(); } + if (chatBox->mbActive) + { + chatBox->Draw(); + } } else if (meScreenMode == OPTIONS) *************** *** 1232,1235 **** --- 1240,1244 ---- objectControl->SetActive(false); viewer->SetActive(false); + chatBox->SetActive(false); optionsView->Draw(); } *************** *** 1246,1249 **** --- 1255,1259 ---- objectControl->SetActive(false); viewer->SetActive(false); + chatBox->SetActive(false); networkView->Draw(); } *************** *** 1610,1613 **** --- 1620,1627 ---- } return; + case 'c': // toggle chat box + chatBox->SetActive(!chatBox->mbActive); + if (chatBox->mbActive) chatBox->MoveToTop(); + return; case 'A': accelerateTime--; |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:40:32
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/src/common Modified Files: tcOptions.cpp tcStream.cpp Log Message: Index: tcStream.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcStream.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcStream.cpp 8 May 2004 22:20:28 -0000 1.5 --- tcStream.cpp 9 May 2004 20:40:22 -0000 1.6 *************** *** 76,86 **** /** ! * Skips over count bytes from current stream position */ ! void tcStream::skip(unsigned char count) { ! std::stringstream::seekp(count, ios_base::cur); } void tcStream::write(const char* buff, std::streamsize count) { --- 76,96 ---- /** ! * Skips over count bytes from current read stream position */ ! void tcStream::skip_read(unsigned char count) { ! std::stringstream::seekg(count, ios_base::cur); ! } ! ! /** ! * @return write position relative to beginning of stream, -1 for error ! */ ! int tcStream::tellp() ! { ! return (int)std::stringstream::tellp(); } + + void tcStream::write(const char* buff, std::streamsize count) { Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcOptions.cpp 8 May 2004 21:25:26 -0000 1.7 --- tcOptions.cpp 9 May 2004 20:40:22 -0000 1.8 *************** *** 131,143 **** AddOption(oi); - oi.meType = tsOptionInfo::OT_RADIOBUTTON; - oi.mnStateCount = 3; - oi.mnValue = 1; - oi.mpAssociated = &renderSkipCount; - oi.mzCaption[0] = "2D skip off"; - oi.mzCaption[1] = "2D skip low"; - oi.mzCaption[2] = "2D skip high"; - AddOption(oi); - Serialize(true); // read option state from file (options.dat) --- 131,134 ---- |
|
From: Dewitt C. <ddc...@us...> - 2004-05-09 20:40:32
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1643/src/graphics Modified Files: tcConsoleBox.cpp Log Message: Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcConsoleBox.cpp 11 Apr 2004 22:05:44 -0000 1.3 --- tcConsoleBox.cpp 9 May 2004 20:40:22 -0000 1.4 *************** *** 145,148 **** --- 145,191 ---- + void tcConsoleBox::InitFromXml(TiXmlNode* config) + { + if (!config) + { + std::cerr << "Error - bad xml config file for Console Box" << std::endl; + InitGdi(9, 0xFE64FF64); + return; + } + + /* some of code below could be moved to a parent class so it isn't + * repeated so much + */ + TiXmlElement* current = config->ToElement(); + wxASSERT(current); + if (current == NULL) return; + + // read window dimensions from XML + int x; + int y; + int width; + int height; + + current->Attribute("X", &x); + current->Attribute("Y", &y); + current->Attribute("Width", &width); + current->Attribute("Height", &height); + + SetSize(x, y, width, height); // set all size params + nyzero = height - 20; + + double fontSize; + current->Attribute("FontSize", &fontSize); + + if (fontSize == 0) + { + InitGdi(9, 0xFE64FF64); + } + else + { + InitGdi(fontSize, 0xFE64FF64); + } + } + void tcConsoleBox::InitGdi(float afFontSize, UINT32 anColor) { *************** *** 237,240 **** --- 280,287 ---- ////////////////////////////////////////////////////////////////////// + /** + * Shared surface version of constructor. Use this for a console + * box that is within a GUI window + */ tcConsoleBox::tcConsoleBox(tcWindow *parent, TiXmlNode *config) : tcWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLConsoleBox", parent), *************** *** 255,297 **** mpPen = NULL; ! if (!config) ! { ! std::cerr << "Error - bad xml config file for Console Box" << std::endl; ! InitGdi(9, 0xFE64FF64); ! return; ! } ! ! /* some of code below should be moved to a parent class so it isn't ! * repeated so much ! */ ! TiXmlElement* current = config->ToElement(); ! wxASSERT(current); ! if (current == NULL) return; ! ! // read window dimensions from XML ! int x; ! int y; ! int width; ! int height; ! ! current->Attribute("X", &x); ! current->Attribute("Y", &y); ! current->Attribute("Width", &width); ! current->Attribute("Height", &height); ! ! SetSize(x, y, width, height); // set all size params ! nyzero = height - 20; ! ! double fontSize; ! current->Attribute("FontSize", &fontSize); ! ! if (fontSize == 0) ! { ! InitGdi(9, 0xFE64FF64); ! } ! else ! { ! InitGdi(fontSize, 0xFE64FF64); ! } } --- 302,306 ---- mpPen = NULL; ! InitFromXml(config); } |
|
From: Dewitt C. <ddc...@us...> - 2004-05-08 22:20:39
|
Update of /cvsroot/gcblue/gcb_wx/src/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28993/src/network Modified Files: tcUpdateMessageHandler.cpp Log Message: Index: tcUpdateMessageHandler.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/network/tcUpdateMessageHandler.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcUpdateMessageHandler.cpp 8 May 2004 21:25:26 -0000 1.7 --- tcUpdateMessageHandler.cpp 8 May 2004 22:20:29 -0000 1.8 *************** *** 57,61 **** stream << obj->mnID; // write id ! *obj >> stream; } --- 57,78 ---- stream << obj->mnID; // write id ! ! /** ! * A temporary stream is created so that the size of the ! * obj update can be written before the data to allow ! * skipping over when the client doesn't have the obj created ! * yet. There may be a way to write a temp value for ! * size, keep a reference to the pos in the stream, and update ! * the value. This would avoid copying the entire update. ! */ ! tcCommandStream temp; ! ! *obj >> temp; ! ! unsigned int updateSize = temp.size(); ! ! stream << updateSize; ! ! stream << temp; } *************** *** 104,109 **** stream << obj->mnID; // write id ! // write obj state to stream ! *obj >> stream; } --- 121,141 ---- stream << obj->mnID; // write id ! /** ! * A temporary stream is created so that the size of the ! * obj update can be written before the data to allow ! * skipping over when the client doesn't have the obj created ! * yet. There may be a way to write a temp value for ! * size, keep a reference to the pos in the stream, and update ! * the value. This would avoid copying the entire update. ! */ ! tcUpdateStream temp; ! ! *obj >> temp; ! ! unsigned int updateSize = temp.size(); ! ! stream << updateSize; ! ! stream << temp; } *************** *** 296,299 **** --- 328,334 ---- while ((stream >> id).eof() == false) { + unsigned int updateSize; + stream >> updateSize; + // lookup obj tcGameObject* obj = simState->GetObject(id); *************** *** 311,316 **** else { ! fprintf(stdout, "%d (unknown)\n", id); ! return; } } --- 346,352 ---- else { ! stream.skip(updateSize); ! ! fprintf(stdout, "%d(X) ", id); } } *************** *** 486,489 **** --- 522,528 ---- while ((stream >> id).eof() == false) { + unsigned int updateSize; + stream >> updateSize; + // lookup obj tcGameObject* obj = simState->GetObject(id); *************** *** 498,504 **** { missingIds.push(id); ! fprintf(stderr, "Error - HandleUpdate - obj %d not found\n", id); ! fprintf(stdout, "\n"); ! return; } } --- 537,542 ---- { missingIds.push(id); ! fprintf(stdout, "%d(X) ", id); ! stream.skip(updateSize); } } |