[Gcblue-commits] gcb_wx/src/sim tcControllableObject.cpp,NONE,1.1 Game.cpp,1.129,1.130 tcAeroAirObje
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11225/src/sim Modified Files: Game.cpp tcAeroAirObject.cpp tcAirObject.cpp tcLauncher.cpp tcPlatformObject.cpp tcSensorMap.cpp Added Files: tcControllableObject.cpp Log Message: added player name to connection status, update rates are slower for non-controlled objects, non-controlled objects now display as green, added chat text popup Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcAirObject.cpp 29 Apr 2005 18:52:55 -0000 1.21 --- tcAirObject.cpp 6 May 2005 23:57:51 -0000 1.22 *************** *** 43,46 **** --- 43,48 ---- tcCommandStream& tcAirObject::operator<<(tcCommandStream& stream) { + ClearNewCommand(); + tcPlatformObject::operator<<(stream); Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcAeroAirObject.cpp 17 Apr 2005 22:35:32 -0000 1.13 --- tcAeroAirObject.cpp 6 May 2005 23:57:51 -0000 1.14 *************** *** 44,47 **** --- 44,49 ---- tcCommandStream& tcAeroAirObject::operator<<(tcCommandStream& stream) { + ClearNewCommand(); + tcAirObject::operator<<(stream); *************** *** 342,346 **** { throttleFraction = 1.0f; ! SetAltitude(k.mfAlt_m - 50.0f*mpDBObject->mfMaxCl); // max throttle and dive to get out of stall Cl = mpDBObject->mfMaxCl; inducedDrag_N = 0; // stall, no induced drag --- 344,349 ---- { throttleFraction = 1.0f; ! mcGS.mfGoalAltitude_m = k.mfAlt_m - 50.0f*mpDBObject->mfMaxCl; // avoid flooding connection with stall adjustments ! //SetAltitude(k.mfAlt_m - 50.0f*mpDBObject->mfMaxCl); // max throttle and dive to get out of stall Cl = mpDBObject->mfMaxCl; inducedDrag_N = 0; // stall, no induced drag *************** *** 349,353 **** { throttleFraction = 1.0f; ! SetAltitude(k.mfAlt_m - 500.0f*(Cl-0.9f*mpDBObject->mfMaxCl)); // max throttle and dive to avoid impending stall inducedDrag_N = mpDBObject->mfKdi * Cl * Cl * lift_N; } --- 352,357 ---- { throttleFraction = 1.0f; ! mcGS.mfGoalAltitude_m = k.mfAlt_m - 500.0f*(Cl-0.9f*mpDBObject->mfMaxCl); ! //SetAltitude(k.mfAlt_m - 500.0f*(Cl-0.9f*mpDBObject->mfMaxCl)); // max throttle and dive to avoid impending stall inducedDrag_N = mpDBObject->mfKdi * Cl * Cl * lift_N; } *************** *** 371,375 **** if (k.mfSpeed_kts > mpDBObject->mfMaxSpeed_kts) k.mfSpeed_kts = mpDBObject->mfMaxSpeed_kts; ! } --- 375,384 ---- if (k.mfSpeed_kts > mpDBObject->mfMaxSpeed_kts) k.mfSpeed_kts = mpDBObject->mfMaxSpeed_kts; ! else if (k.mfSpeed_kts < 40.0) ! { ! // shouldn't happen, but limit speed to 40 and slowly dive in this case ! k.mfSpeed_kts = 40.0; ! if (k.mfClimbAngle_rad > -0.1) k.mfClimbAngle_rad -= dt_s * 0.1f; ! } } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** Game.cpp 5 May 2005 02:14:53 -0000 1.129 --- Game.cpp 6 May 2005 23:57:51 -0000 1.130 *************** *** 1516,1519 **** --- 1516,1520 ---- viewer->SetActive(false); worldMap->SetActive(false); + tcMessageInterface::Get()->SetPopupChatText(false); } lastMode = meScreenMode; *************** *** 1550,1553 **** --- 1551,1559 ---- { chatBox->Draw(); + tcMessageInterface::Get()->SetPopupChatText(false); + } + else + { + tcMessageInterface::Get()->SetPopupChatText(true); } } *************** *** 1578,1581 **** --- 1584,1592 ---- { chatBox->Draw(); + tcMessageInterface::Get()->SetPopupChatText(false); + } + else + { + tcMessageInterface::Get()->SetPopupChatText(true); } } *************** *** 2391,2394 **** --- 2402,2409 ---- pythonInterface->ProcessCallback(azCallback, id, p.x, p.y, param); } + else if (strcmp(azUserInput,"Null") == 0) // necessary? or always handled in GetUserInput + { + pythonInterface->ProcessCallback(azCallback, id); + } else {} } *************** *** 2413,2416 **** --- 2428,2435 ---- tacticalMap->ActivateCmd(MC_DATUM); } + else if (strcmp(azUserInput, "Null") == 0) + { + pythonInterface->ProcessCallback(azCallback, id); + } else { Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcLauncher.cpp 5 May 2005 02:14:54 -0000 1.18 --- tcLauncher.cpp 6 May 2005 23:57:51 -0000 1.19 *************** *** 117,121 **** stream >> floor_m; stream >> runToEnable_m; ! fprintf(stdout, "Updating launcher torpedo params (%d/%d)\n", this, parent); } --- 117,121 ---- stream >> floor_m; stream >> runToEnable_m; ! //fprintf(stdout, "Updating launcher torpedo params (%d/%d)\n", this, parent); } Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** tcPlatformObject.cpp 5 May 2005 02:14:55 -0000 1.43 --- tcPlatformObject.cpp 6 May 2005 23:57:51 -0000 1.44 *************** *** 652,655 **** --- 652,657 ---- tcGameObject::operator<<(stream); + ClearNewCommand(); + unsigned char updateMask; stream >> updateMask; Index: tcSensorMap.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMap.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcSensorMap.cpp 5 May 2005 02:14:55 -0000 1.19 --- tcSensorMap.cpp 6 May 2005 23:57:52 -0000 1.20 *************** *** 670,674 **** maTrack.GetNextAssoc(pos, key, sensorMapTrack); double dt = mfPreviousStatusTime - sensorMapTrack->mfTimestamp; ! if (dt < 1.0) { stream << sensorMapTrack->mnID; --- 670,674 ---- maTrack.GetNextAssoc(pos, key, sensorMapTrack); double dt = mfPreviousStatusTime - sensorMapTrack->mfTimestamp; ! if (dt < 2.0) { stream << sensorMapTrack->mnID; --- NEW FILE: tcControllableObject.cpp --- /** ** @file tcControllableObject.cpp */ /* Copyright (C) 2005 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 "tcControllableObject.h" #include "tcUserInfo.h" #include "common/tcStream.h" #include "common/tcObjStream.h" #ifdef _DEBUG #define new DEBUG_NEW #endif tcUserInfo* tcControllableObject::userInfo = 0; void tcControllableObject::AttachUserInfo() { userInfo = tcUserInfo::Get(); } /** * Loads state from create stream */ tcCreateStream& tcControllableObject::operator<<(tcCreateStream& stream) { stream >> alliance; return stream; } /** * Saves state to create stream */ tcCreateStream& tcControllableObject::operator>>(tcCreateStream& stream) { stream << alliance; return stream; } /** * Loads state from update stream */ tcUpdateStream& tcControllableObject::operator<<(tcUpdateStream& stream) { stream >> flags; stream >> controller; return stream; } /** * Saves state to update stream */ tcUpdateStream& tcControllableObject::operator>>(tcUpdateStream& stream) { stream << flags; stream << controller; return stream; } unsigned char tcControllableObject::GetAlliance() const { return alliance; } void tcControllableObject::SetAlliance(unsigned char val) { alliance = val; } unsigned char tcControllableObject::GetAccessLevel() const { return flags & ACCESS_LEVEL_MASK; } void tcControllableObject::SetAccessLevel(unsigned char level) { flags |= level; } const std::string& tcControllableObject::GetController() const { return controller; } void tcControllableObject::SetController(const std::string& username) { controller = username; } /** * If object does not have controller, obj is available if * user rank >= access level, otherwise user rank must be > access level */ bool tcControllableObject::IsAvailable() const { return IsAvailable(userInfo->GetOwnAlliance(), userInfo->GetRank()); } bool tcControllableObject::IsAvailable(unsigned char playerAlliance, unsigned char rank) const { if (playerAlliance != alliance) return false; if (controller.size() == 0) { return rank >= GetAccessLevel(); } else { return rank > GetAccessLevel(); } } bool tcControllableObject::IsControlledBy(const std::string& playerName) const { return (controller == playerName); } bool tcControllableObject::IsControlled() const { return controller == userInfo->GetUsername(); } tcControllableObject::tcControllableObject() : controller(""), flags(0), alliance(0) { } tcControllableObject::tcControllableObject(const tcControllableObject& src) : controller(src.controller), flags(src.flags), alliance(src.alliance) { } tcControllableObject::~tcControllableObject() { } |