gcblue-commits Mailing List for Global Conflict Blue (Page 17)
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...> - 2005-11-27 22:21:39
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/src/ai Modified Files: Nav.cpp Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: Nav.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Nav.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Nav.cpp 10 Sep 2005 21:47:38 -0000 1.4 --- Nav.cpp 27 Nov 2005 22:21:29 -0000 1.5 *************** *** 106,110 **** --- 106,126 ---- waypoints.clear(); + } + + void Nav::EditWaypoint(size_t idx, double lon_rad, double lat_rad, float alt_m) + { + if (idx < waypoints.size()) + { + GeoPoint& waypoint = waypoints[idx]; + waypoint.mfLon_rad = lon_rad; + waypoint.mfLat_rad = lat_rad; + waypoint.mfAlt_m = alt_m; + platform->GetBrain()->SetNewCommand(); + } + else + { + fprintf(stderr, "Nav::EditWaypoint - bad idx\n"); + } } |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/scripts Modified Files: Menu.py UnitCommands.py Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** UnitCommands.py 10 Sep 2005 21:48:58 -0000 1.22 --- UnitCommands.py 27 Nov 2005 22:21:29 -0000 1.23 *************** *** 81,84 **** --- 81,87 ---- UI.AddNavWaypoint(deg_to_rad*lon_deg, deg_to_rad*lat_deg) + def EditWaypoint(UI, idx, lon, lat): + UI.EditNavWaypoint(idx, lon, lat) + def AddPatrolOrderGroup(GI): unit_count = GI.GetUnitCount() Index: Menu.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/Menu.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Menu.py 10 Sep 2005 21:48:58 -0000 1.16 --- Menu.py 27 Nov 2005 22:21:29 -0000 1.17 *************** *** 77,83 **** UnitMenu.AddItem('Set speed','') UnitMenu.BeginSubMenu() ! UnitMenu.AddItem('30%','Speed30 [1]') ! UnitMenu.AddItem('80%','Speed80 [2]') ! UnitMenu.AddItem('Max','Speed100 [3]') UnitMenu.EndSubMenu() --- 77,83 ---- UnitMenu.AddItem('Set speed','') UnitMenu.BeginSubMenu() ! UnitMenu.AddItem('30% [1]','Speed30') ! UnitMenu.AddItem('80% [2]','Speed80') ! UnitMenu.AddItem('Max [3]','Speed100') UnitMenu.EndSubMenu() |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/database Modified Files: database.db Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: database.db =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/database/database.db,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 Binary files /tmp/cvsNY8mVK and /tmp/cvsXhivFE differ |
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/src/sim Modified Files: Game.cpp tcAirObject.cpp tcCommandQueue.cpp tcGameObject.cpp tcLauncher.cpp tcPlatformObject.cpp tcRadar.cpp tcSimState.cpp Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tcLauncher.cpp 14 Sep 2005 01:33:24 -0000 1.30 --- tcLauncher.cpp 27 Nov 2005 22:21:29 -0000 1.31 *************** *** 560,564 **** else // sonobuoy { ! meLaunchMode = DATUM_ONLY; } } --- 560,564 ---- else // sonobuoy { ! meLaunchMode = AUTO; } } *************** *** 703,707 **** bool hasDatum = (msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0); ! if ((meLaunchMode == AUTO) && (hasDatum)) { status = LAUNCHER_READY; --- 703,707 ---- bool hasDatum = (msDatum.mfLat_rad != 0) || (msDatum.mfLon_rad != 0); ! if (meLaunchMode == AUTO) { status = LAUNCHER_READY; Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** tcPlatformObject.cpp 19 Nov 2005 19:27:47 -0000 1.55 --- tcPlatformObject.cpp 27 Nov 2005 22:21:29 -0000 1.56 *************** *** 205,208 **** --- 205,210 ---- if (mcKin.mfHeading_rad >= C_TWOPI) {mcKin.mfHeading_rad -= C_TWOPI;} if (mcKin.mfHeading_rad < 0) {mcKin.mfHeading_rad += C_TWOPI;} + + mcKin.mfYaw_rad = mcKin.mfHeading_rad; } *************** *** 439,444 **** } } - - model->AddExplosion(osg::Vec3(0, 0, 0)); } --- 441,444 ---- Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** tcGameObject.cpp 28 Jun 2005 02:51:35 -0000 1.39 --- tcGameObject.cpp 27 Nov 2005 22:21:29 -0000 1.40 *************** *** 34,37 **** --- 34,39 ---- #include "common/tcStream.h" #include "common/tcObjStream.h" + #include <osg/LineSegment> + #include <osgUtil/IntersectVisitor> #ifdef _DEBUG *************** *** 168,171 **** --- 170,272 ---- } + + /** + * Gets relative position and velocity of obj relative to this GameObject + * dx east, dy north, dz up + * + * Results are in the local world frame of reference + */ + void tcGameObject::GetRelativeStateWorld(tcGameObject *obj, osg::Vec3& position, osg::Vec3& velocity) + { + // local world coordinates, x--east, y--north, z--up + + // store relative position in local world frame + position._v[2] = obj->mcKin.mfAlt_m - mcKin.mfAlt_m; + + double delta_lat = obj->mcKin.mfLat_rad - mcKin.mfLat_rad; + double delta_lon = obj->mcKin.mfLon_rad - mcKin.mfLon_rad; + delta_lon = delta_lon*cosf((float)mcKin.mfLat_rad); // correct for latitude + position._v[1] = (float)(delta_lat*C_RADTOM); + position._v[0] = (float)(delta_lon*C_RADTOM); + + + osg::Vec3 v1 = GetWorldVelocity(); + osg::Vec3 v2 = obj->GetWorldVelocity(); + + velocity = v2 - v1; // relative velocity in local world frame + } + + + /** + * Gets relative position and velocity of obj relative to this GameObject + * dx right, dy forward, dz up + * + * Results are in the frame of reference of this object + */ + void tcGameObject::GetRelativeStateLocal(tcGameObject *obj, osg::Vec3& position, osg::Vec3& velocity) + { + // local world coordinates, x--east, y--north, z--up + GetRelativeStateWorld(obj, position, velocity); + + /* obj to world transform: + osg::Matrix m = + osg::Matrix::rotate(osg::inRadians(roll),0.0f,1.0f,0.0f)* + osg::Matrix::rotate(osg::inRadians(pitch),1.0f,0.0f,0.0f)* + osg::Matrix::rotate(-osg::inRadians(yaw),0.0f,0.0f,1.0f)*osg::Matrix::translate(x,y,z) + ; + */ + osg::Matrix world_to_obj = + osg::Matrix::rotate(osg::inRadians(mcKin.mfYaw_rad),0.0f,0.0f,1.0f)* + osg::Matrix::rotate(-osg::inRadians(mcKin.mfPitch_rad),1.0f,0.0f,0.0f)* + osg::Matrix::rotate(-osg::inRadians(mcKin.mfRoll_rad),0.0f,1.0f,0.0f); + + position = world_to_obj.preMult(position); + velocity = world_to_obj.preMult(velocity); + } + + /** + * Convert coordinates in model frame of reference to local world frame. + * Would be faster to use saved transform matrix from ObjectUpdater + * instead of recalculating it here. + * + * @return x--east, y--north, z--up + */ + osg::Vec3 tcGameObject::ConvertModelCoordinatesToWorld(const osg::Vec3& x) const + { + osg::Matrix obj_to_world = + osg::Matrix::rotate(osg::inRadians(mcKin.mfRoll_rad),0.0f,1.0f,0.0f)* + osg::Matrix::rotate(osg::inRadians(mcKin.mfPitch_rad),1.0f,0.0f,0.0f)* + osg::Matrix::rotate(-osg::inRadians(mcKin.mfYaw_rad),0.0f,0.0f,1.0f); + + return obj_to_world.preMult(x); + } + + + + /** + * @return velocity in local world coords in m/s + * x--east, y--north, z--up + */ + osg::Vec3 tcGameObject::GetWorldVelocity() const + { + float hdg = mcKin.mfHeading_rad; + float climb = mcKin.mfClimbAngle_rad; + + float speed_mps = C_KTSTOMPS * mcKin.mfSpeed_kts; + float cos_hdg = cosf(hdg); + float sin_hdg = sinf(hdg); + float cos_climb = cosf(climb); + float sin_climb = sinf(climb); + + float vxy = cos_climb * speed_mps; + + float vz = sin_climb * speed_mps; + float vy = cos_hdg * vxy; + float vx = sin_hdg * vxy; + + return osg::Vec3(vx, vy, vz); + } + + /** * @returns sonar source level of object or, if object has active sonar on, maximum of source level of *************** *** 246,249 **** --- 347,399 ---- /** + * Calculates collision point or closest point of approach in model coordinates + * @return true if collision occurs, false otherwise + */ + bool tcGameObject::CalculateCollisionPoint(tcGameObject* collider, osg::Vec3& pos, float& dt) + { + osg::Vec3 x_collider; // position of collider in model frame + osg::Vec3 v_collider; // velocity of collider in model frame + + GetRelativeStateLocal(collider, x_collider, v_collider); + + const float t12 = 0.05f; // time interval to check for collision + osg::Vec3 x2_collider = x_collider + v_collider * t12; + + + osg::LineSegment* colliderPath = new osg::LineSegment(); + colliderPath->set(x_collider, x2_collider); + + + osgUtil::IntersectVisitor collisionVisitor; + collisionVisitor.addLineSegment(colliderPath); + + + osg::Node* modelNode = model->GetModelNode(); + modelNode->accept(collisionVisitor); + + osgUtil::IntersectVisitor::HitList hitList = + collisionVisitor.getHitList(colliderPath); + + if (!hitList.empty()) + { + float speed_collider = v_collider.length(); + float inv_speed_collider = 1.0f / speed_collider; + + osgUtil::Hit firstHit = hitList.front(); + pos = firstHit.getWorldIntersectPoint(); + + osg::Vec3 hitOffset = pos - x_collider; + + dt = hitOffset.length() * inv_speed_collider; + return true; + } + else + { + return false; + } + + } + + /** * */ Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** tcSimState.cpp 10 Sep 2005 21:47:38 -0000 1.89 --- tcSimState.cpp 27 Nov 2005 22:21:29 -0000 1.90 *************** *** 405,420 **** void tcSimState::EvaluateGuidedMissileHit(tcMissileObject* missile, tcGameObject* target) { ! float range_m = 1000.0f*missile->mcKin.RangeToKmAlt(target->mcKin); ! float fFactor = 0.01f*(missile->mcKin.mfSpeed_kts + target->mcKin.mfSpeed_kts + 2000.0f); ! if (range_m >= fFactor) return; // too far away, no damage ! float dx, dy, dz, tclosest; ! tclosest = target->mcKin.CalculateCollisionPoint(missile->mcKin, dx, dy, dz); ! if (tclosest > 0.05f) return; // defer until future time step ! float trueRange2 = dx*dx + dy*dy + dz*dz; ! if (trueRange2 < 144.0f) // 12.0 m range { bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; --- 405,434 ---- void tcSimState::EvaluateGuidedMissileHit(tcMissileObject* missile, tcGameObject* target) { ! //float range_m = 1000.0f*missile->mcKin.RangeToKmAlt(target->mcKin); ! //float fFactor = 0.01f*(missile->mcKin.mfSpeed_kts + target->mcKin.mfSpeed_kts + 2000.0f); ! //if (range_m >= fFactor) return; // too far away, no damage ! float dx, dy, dz, dt; ! osg::Vec3 collisionPoint; ! float trueRange2; ! // first check for impact ! if (target->CalculateCollisionPoint(missile, collisionPoint, dt)) ! { ! collisionPoint = target->ConvertModelCoordinatesToWorld(collisionPoint); ! dx = collisionPoint.x(); ! dy = collisionPoint.y(); ! dz = collisionPoint.z(); ! trueRange2 = 0; ! } ! else // if no impact, check for sufficient proximity to target ! { ! dt = target->mcKin.CalculateCollisionPoint(missile->mcKin, dx, dy, dz); ! if (dt > 0.1) return; // defer until future time step ! trueRange2 = dx*dx + dy*dy + 0.5*dz*dz; ! } ! if (trueRange2 < 0.00001440f) // 12.0 m range { bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; *************** *** 441,444 **** --- 455,460 ---- } PlayEntitySoundEffect(missile, "Explosion2"); + + target->model->AddExplosion(osg::Vec3(dx, dy, dz)); } *************** *** 449,453 **** std::cout << s.c_str(); fprintf(stdout," collision relative time: %f, dx:%f dy:%f dz:%f\n", ! tclosest, dx, dy, dz); #endif } --- 465,469 ---- std::cout << s.c_str(); fprintf(stdout," collision relative time: %f, dx:%f dy:%f dz:%f\n", ! dt, dx, dy, dz); #endif } *************** *** 465,477 **** float range_m = 1000.0f * torp->mcKin.RangeToKmAlt(target->mcKin); ! if (range_m >= 200) return; // too far away, no damage - float dx, dy, dz, tclosest; - tclosest = target->mcKin.CalculateCollisionPoint(torp->mcKin, dx, dy, dz); ! if (tclosest > 0.3) return; // defer until future time step ! float trueRange2 = dx*dx + dy*dy + 0.5*dz*dz; ! if (trueRange2 < 144.0f) // 12.0 m range, dz not counted as heavily { bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; --- 481,512 ---- float range_m = 1000.0f * torp->mcKin.RangeToKmAlt(target->mcKin); ! if ((range_m > 200.0) || (range_m >= 0.6*target->GetSpan())) ! { ! return; // too far away, no damage ! } ! float dx, dy, dz, dt; ! osg::Vec3 collisionPoint; ! float trueRange2; ! // first check for impact ! if (target->CalculateCollisionPoint(torp, collisionPoint, dt)) ! { ! collisionPoint = target->ConvertModelCoordinatesToWorld(collisionPoint); ! dx = collisionPoint.x(); ! dy = collisionPoint.y(); ! dz = collisionPoint.z(); ! trueRange2 = 0; ! } ! else // if no impact, check for sufficient proximity to target ! { ! dt = target->mcKin.CalculateCollisionPoint(torp->mcKin, dx, dy, dz); ! if (dt > 0.1) return; // defer until future time step ! trueRange2 = dx*dx + dy*dy + 0.5*dz*dz; ! } ! ! ! if (trueRange2 < 144.0f) // 12.0 m "range", dz not counted as heavily { bool alreadyDestroyed = target->mfDamageLevel >= 1.0f; *************** *** 499,502 **** --- 534,539 ---- } + target->model->AddExplosion(osg::Vec3(dx, dy, dz)); + #ifdef _DEBUG wxString s = wxString::Format("torpedo %d hit target %d, range^2: %3.1f m, dmg: %3.1f %%, time %.1f s", *************** *** 505,509 **** std::cout << s.c_str(); fprintf(stdout," collision relative time: %f, dx:%f dy:%f dz:%f\n", ! tclosest, dx, dy, dz); #endif } --- 542,546 ---- std::cout << s.c_str(); fprintf(stdout," collision relative time: %f, dx:%f dy:%f dz:%f\n", ! dt, dx, dy, dz); #endif } *************** *** 596,599 **** --- 633,642 ---- } PlayEntitySoundEffect(weapon, "Explosion2"); + + // use a random explosion point for display purposes only + float dx = randfc(20.0f); + float dy = randfc(20.0f); + float dz = randf(10.0f); + target->model->AddExplosion(osg::Vec3(dx, dy, dz)); } else *************** *** 663,666 **** --- 706,711 ---- PlayEntitySoundEffect(weapon, "Explosion2"); } + + target->model->AddExplosion(osg::Vec3(dx, dy, dz)); } Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcAirObject.cpp 10 Sep 2005 21:47:38 -0000 1.28 --- tcAirObject.cpp 27 Nov 2005 22:21:29 -0000 1.29 *************** *** 422,425 **** --- 422,426 ---- mcKin.mfRoll_rad = dh_rps*rps_to_roll; + mcKin.mfYaw_rad = mcKin.mfHeading_rad; } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** Game.cpp 14 Sep 2005 01:33:24 -0000 1.141 --- Game.cpp 27 Nov 2005 22:21:29 -0000 1.142 *************** *** 494,497 **** --- 494,498 ---- "Error", wxICON_ERROR); tcOptions::Get()->disableSound = true; // disable sound + tcOptions::Get()->mbPlayMusic = false; // disable music tcOptions::Get()->Synchronize(); } *************** *** 693,697 **** void tcGame::InitializeSound() { ! if (tcOptions::Get()->disableSound) return; if (tcSound::Get()->Init()) --- 694,703 ---- void tcGame::InitializeSound() { ! if (tcOptions::Get()->disableSound) ! { ! tcOptions::Get()->mbPlayMusic = false; ! tcOptions::Get()->Synchronize(); ! return; ! } if (tcSound::Get()->Init()) *************** *** 2408,2459 **** tsCommandInfo cmd_info; if (commandQueue->GetCommand(cmd_info)) { ! if (cmd_info.mbUsePython) { ! if (cmd_info.mbCallback) { ! ProcessCallback(cmd_info.mzString, cmd_info.mzUserInput, ! cmd_info.platformID, cmd_info.mnData); } ! else if (cmd_info.mbGetUserInput) { ! if (cmd_info.platformID.size() == 0) cmd_info.platformID = tacticalMap->GetHookedGroup(); ! GetUserInput(cmd_info.mzString, cmd_info.mzUserInput, ! cmd_info.platformID, cmd_info.mnData); } else { ! std::string s = cmd_info.mzString; ! int param = cmd_info.mnData; ! pythonInterface->ProcessCommand(s, cmd_info.platformID, ! param, cmd_info.textParam); } ! } ! else if (cmd_info.meCmd == GC_TEXTCOMMAND) ! { ! ProcessTextCommand(cmd_info); ! } ! else if (cmd_info.meCmd == GC_DISPLAYMESSAGE) ! { ! infoConsole->Print(cmd_info.mzString); ! } ! else if (cmd_info.meCmd == GC_QUIT) ! { ! mbQuit = true; ! } ! else if (cmd_info.meCmd == GC_SHOWBRIEFING) ! { ! meScreenMode = SIMPLEBRIEF; ! } ! else if (cmd_info.meCmd == GC_SHOWMISSIONSTATUS) ! { ! meScreenMode = MESSAGES; ! messageCenter->ActivateChannel("Mission"); ! } ! else ! { ! fprintf(stderr, "Unrecognized command (%d)\n", cmd_info.meCmd); ! } } } --- 2414,2477 ---- tsCommandInfo cmd_info; + if (commandQueue->GetCommand(cmd_info)) { ! switch (cmd_info.commandType) { ! case PYTHON_CALLBACK: ! ProcessCallback(cmd_info.mzString, cmd_info.mzUserInput, ! cmd_info.platformID, cmd_info.mnData); ! break; ! case PYTHON_USERINPUT: ! if (cmd_info.platformID.size() == 0) cmd_info.platformID = tacticalMap->GetHookedGroup(); ! GetUserInput(cmd_info.mzString, cmd_info.mzUserInput, ! cmd_info.platformID, cmd_info.mnData); ! break; ! case PYTHON_COMMAND_TEXT: { ! std::string s = cmd_info.mzString; ! int param = cmd_info.mnData; ! pythonInterface->ProcessCommand(s, cmd_info.platformID, ! param, cmd_info.textParam); } ! break; ! case PYTHON_COMMAND_GENERAL: { ! std::string s = cmd_info.mzString; ! pythonInterface->ProcessCommandWithArguments(s, cmd_info.platformID, cmd_info.textParam); ! } ! break; ! case GAME_COMMAND: ! if (cmd_info.meCmd == GC_TEXTCOMMAND) ! { ! ProcessTextCommand(cmd_info); ! } ! else if (cmd_info.meCmd == GC_DISPLAYMESSAGE) ! { ! infoConsole->Print(cmd_info.mzString); ! } ! else if (cmd_info.meCmd == GC_QUIT) ! { ! mbQuit = true; ! } ! else if (cmd_info.meCmd == GC_SHOWBRIEFING) ! { ! meScreenMode = SIMPLEBRIEF; ! } ! else if (cmd_info.meCmd == GC_SHOWMISSIONSTATUS) ! { ! meScreenMode = MESSAGES; ! messageCenter->ActivateChannel("Mission"); } else { ! fprintf(stderr, "Unrecognized game command (%d)\n", cmd_info.meCmd); } ! ! break; ! default: ! fprintf(stderr, "Unrecognized command type (%d)\n", cmd_info.commandType); ! break; ! } // switch } } Index: tcCommandQueue.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCommandQueue.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcCommandQueue.cpp 10 Jan 2005 00:30:55 -0000 1.2 --- tcCommandQueue.cpp 27 Nov 2005 22:21:29 -0000 1.3 *************** *** 57,72 **** /** ! * */ void tcCommandQueue::AddCommand(teGameCommand aeCmd, float afData, long anData, int anData2) { tsCommandInfo newcmd; newcmd.meCmd = aeCmd; newcmd.mfData = afData; newcmd.mnData = anData; newcmd.mnData2 = anData2; - newcmd.mbUsePython = false; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = false; newcmd.platformID.clear(); if (mnCount < MAX_QUEUED_COMMANDS) --- 57,71 ---- /** ! * Adds game command (old style command from enumerated list) */ void tcCommandQueue::AddCommand(teGameCommand aeCmd, float afData, long anData, int anData2) { tsCommandInfo newcmd; + + newcmd.commandType = GAME_COMMAND; newcmd.meCmd = aeCmd; newcmd.mfData = afData; newcmd.mnData = anData; newcmd.mnData2 = anData2; newcmd.platformID.clear(); if (mnCount < MAX_QUEUED_COMMANDS) *************** *** 77,89 **** /** ! * For string commands */ void tcCommandQueue::AddCommand(const char *azCommand, int param) { tsCommandInfo newcmd; newcmd.meCmd = GC_TEXTCOMMAND; - newcmd.mbUsePython = false; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = false; newcmd.mnData = param; strcpy(newcmd.mzString , azCommand); --- 76,87 ---- /** ! * For old style string commands */ void tcCommandQueue::AddCommand(const char *azCommand, int param) { tsCommandInfo newcmd; + + newcmd.commandType = GAME_COMMAND; newcmd.meCmd = GC_TEXTCOMMAND; newcmd.mnData = param; strcpy(newcmd.mzString , azCommand); *************** *** 96,108 **** } /** ! * version without user input and callback */ void tcCommandQueue::AddPythonCommand(const char *azCommand, int param) { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = false; newcmd.mnData = param; // int param newcmd.textParam = ""; // text param --- 94,105 ---- } /** ! * Version without user input and callback */ void tcCommandQueue::AddPythonCommand(const char *azCommand, int param) { tsCommandInfo newcmd; + + newcmd.commandType = PYTHON_COMMAND_TEXT; newcmd.meCmd = (teGameCommand)0; newcmd.mnData = param; // int param newcmd.textParam = ""; // text param *************** *** 117,129 **** /** ! * version without user input and callback */ ! void tcCommandQueue::AddPythonCommand(const char *azCommand, std::string textParam) { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = false; newcmd.mnData = -1; // int param newcmd.textParam = textParam; --- 114,125 ---- /** ! * Version without user input and callback */ ! void tcCommandQueue::AddPythonCommand(const char *azCommand, const std::string& textParam) { tsCommandInfo newcmd; + + newcmd.commandType = PYTHON_COMMAND_TEXT; newcmd.meCmd = (teGameCommand)0; newcmd.mnData = -1; // int param newcmd.textParam = textParam; *************** *** 137,153 **** } ! /* GetUserInput is called to add a command to get user input data. ! ** Once the user input is complete, the callback function is called though ! ** AddPythonCallback. Data that describes the user input is passed to the ! ** callback function along with an optional parameter. */ void tcCommandQueue::GetUserInput(const char *azCallback, const char *azUserInput, int param) { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = true; newcmd.mnData = param; newcmd.textParam = ""; --- 133,168 ---- } + void tcCommandQueue::AddPythonCommandGeneral(const std::string& command, const std::string& args, + const std::vector<long>& platformID) + { + tsCommandInfo newcmd; ! newcmd.commandType = PYTHON_COMMAND_GENERAL; ! newcmd.meCmd = (teGameCommand)0; ! newcmd.mnData = -1; // int param ! ! strcpy(newcmd.mzString , command.c_str()); ! newcmd.textParam = args; ! strcpy(newcmd.mzUserInput, ""); ! newcmd.platformID = platformID; ! if (mnCount < MAX_QUEUED_COMMANDS) ! { ! maCommand[mnCount++] = newcmd; ! } ! } ! ! ! /** ! * GetUserInput is called to add a command to get user input data. ! * Once the user input is complete, the callback function is called though ! * AddPythonCallback. Data that describes the user input is passed to the ! * callback function along with an optional parameter. */ void tcCommandQueue::GetUserInput(const char *azCallback, const char *azUserInput, int param) { tsCommandInfo newcmd; + + newcmd.commandType = PYTHON_USERINPUT; newcmd.meCmd = (teGameCommand)0; newcmd.mnData = param; newcmd.textParam = ""; *************** *** 173,180 **** { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = true; newcmd.mnData = param; newcmd.textParam = ""; --- 188,194 ---- { tsCommandInfo newcmd; + + newcmd.commandType = PYTHON_USERINPUT; newcmd.meCmd = (teGameCommand)0; newcmd.mnData = param; newcmd.textParam = ""; *************** *** 197,204 **** { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = true; - newcmd.mbGetUserInput = false; newcmd.mnData = param; newcmd.textParam = ""; --- 211,217 ---- { tsCommandInfo newcmd; + + newcmd.commandType = PYTHON_CALLBACK; newcmd.meCmd = (teGameCommand)0; newcmd.mnData = param; newcmd.textParam = ""; *************** *** 219,226 **** { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; - newcmd.mbUsePython = true; - newcmd.mbCallback = true; - newcmd.mbGetUserInput = false; newcmd.mnData = param; newcmd.textParam = ""; --- 232,238 ---- { tsCommandInfo newcmd; + + newcmd.commandType = PYTHON_CALLBACK; newcmd.meCmd = (teGameCommand)0; newcmd.mnData = param; newcmd.textParam = ""; *************** *** 236,246 **** /** ! * for sending messages */ void tcCommandQueue::DisplayInfoMessage(const char *azString) { tsCommandInfo newcmd; newcmd.meCmd = GC_DISPLAYMESSAGE; - newcmd.mbUsePython = false; strcpy(newcmd.mzString, azString); newcmd.platformID.clear(); --- 248,259 ---- /** ! * For sending messages to info console */ void tcCommandQueue::DisplayInfoMessage(const char *azString) { tsCommandInfo newcmd; + + newcmd.commandType = GAME_COMMAND; newcmd.meCmd = GC_DISPLAYMESSAGE; strcpy(newcmd.mzString, azString); newcmd.platformID.clear(); Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcRadar.cpp 10 Sep 2005 21:47:38 -0000 1.33 --- tcRadar.cpp 27 Nov 2005 22:21:29 -0000 1.34 *************** *** 179,182 **** --- 179,184 ---- tgt_kin->mfLat_rad,tgt_kin->mfLon_rad); range_km = fTargetRange_km; + last_range_km = range_km; + if (fTargetRange_km > fRadarHorizon) { *************** *** 561,566 **** --- 563,602 ---- #endif } + + AdjustTrackForFineTargeting(target); } + /** + * If sufficiently close to target, adjust track to lock on to random feature + * of target. Intended to add more realism so that weapons do not always strike + * origin of target model. + */ + void tcRadar::AdjustTrackForFineTargeting(const tcGameObject* target) + { + if (last_range_km > 1.0f) return; + + /* if target offset has not been selected yet, randomly select + ** based on box around target model. This assumes that only one + ** target will be engaged throughout life of seeker */ + if ((target_x_offset_m == 0) && (target_y_offset_m == 0)) + { + /* since we don't have a getBoundingBox method, just use the + ** span (diameter of bounding sphere) and assume width is narrow + ** compared to length */ + float span_m = target->GetSpan(); + target_y_offset_m = randfc(0.9*span_m); + target_x_offset_m = 0*randfc(0.01f * span_m); + } + osg::Vec3 worldOffset = + target->ConvertModelCoordinatesToWorld(osg::Vec3(target_x_offset_m, target_y_offset_m, 0)); + + float lon_corr = C_MTORAD / cosf(mcTrack.mfLat_rad); + mcTrack.mfAlt_m += worldOffset.z(); + if (mcTrack.mfAlt_m < 1) mcTrack.mfAlt_m = 1; + mcTrack.mfLat_rad += C_MTORAD * worldOffset.y(); + mcTrack.mfLon_rad += lon_corr * worldOffset.x(); + } + + void tcRadar::Update(double t) { *************** *** 599,603 **** fireControlTrackCount(0), isSemiactive(mpDBObj->isSemiactive), ! isCommandReceiver(mpDBObj->isCommandReceiver) { wxASSERT(dbObj); --- 635,642 ---- fireControlTrackCount(0), isSemiactive(mpDBObj->isSemiactive), ! isCommandReceiver(mpDBObj->isCommandReceiver), ! last_range_km(0), ! target_x_offset_m(0), ! target_y_offset_m(0) { wxASSERT(dbObj); |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/include/ai Modified Files: Nav.h Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: Nav.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Nav.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Nav.h 10 Sep 2005 21:48:06 -0000 1.3 --- Nav.h 27 Nov 2005 22:21:28 -0000 1.4 *************** *** 54,57 **** --- 54,58 ---- void AddWaypoint(double lon_rad, double lat_rad, float alt_m); void ClearWaypoints(); + void EditWaypoint(size_t idx, double lon_rad, double lat_rad, float alt_m); bool GetLoopState() const; const std::vector<GeoPoint>& GetWaypoints() const; |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/docs Modified Files: CHANGES.txt Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** CHANGES.txt 23 Nov 2004 23:30:30 -0000 1.42 --- CHANGES.txt 27 Nov 2005 22:21:28 -0000 1.43 *************** *** 1,4 **** --- 1,31 ---- CHANGES + + 0.8.1 + --------------------------------------------------------------------- + + *** 2005-11-27 Dewitt Colclough *** + - Added waypoint drag edit feature to gui. User can adjust waypoints on + map screen by clicking and dragging + - Fixed sound disable to include music. Previously sound failure would disable + sound effects, but then play music leading to a crash. + - Added random feature targeting to missiles. Missiles should now lock on + to a random feature of the target instead of always hitting the center. + + *** 2005-11-19 Dewitt Colclough *** + - Added explosion effect using osgParticle::ExplosionEffect and + ::ExplosionDebrisEffect. Explosion is centered about origin of model + and does not move with model. + + + 0.7.0 - 0.8.0 + --------------------------------------------------------------------- + - New drag and drop icon gui for airbase operations and loadout mods in game + - Added Taiwan-China theater with two new scenarios + - New tutorial scenarios for air, surface, submarine, and ASW operations + - Many new 3D models and platform database entries + - Diesel-electric submarines + - Sound bug fix for working sound on all systems + 0.6.2 --------------------------------------------------------------------- |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/include/graphics Modified Files: tc3DModel.h tcMapView.h Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tc3DModel.h 19 Nov 2005 19:27:47 -0000 1.18 --- tc3DModel.h 27 Nov 2005 22:21:28 -0000 1.19 *************** *** 118,122 **** void GetLauncherInfo(unsigned int idx, osg::Vec3& pos, float& az); void GetLocationParams(LocationParams& p); ! osg::ref_ptr<osg::Node> GetNode(); unsigned int GetNumParents(); float GetRadius(); --- 118,123 ---- void GetLauncherInfo(unsigned int idx, osg::Vec3& pos, float& az); void GetLocationParams(LocationParams& p); ! osg::Node* GetModelNode(); ///< model node in model frame, no transforms ! osg::ref_ptr<osg::Node> GetNode(); ///< transformed to camera frame unsigned int GetNumParents(); float GetRadius(); Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcMapView.h 14 Jul 2005 23:41:50 -0000 1.20 --- tcMapView.h 27 Nov 2005 22:21:28 -0000 1.21 *************** *** 29,35 **** #include "wx/wx.h" ! #ifdef WIN32 ! #include "wx/msw/private.h" //for MS Windows specific definitions ! #endif #include "tc3DWindow.h" #include "simmath.h" --- 29,33 ---- #include "wx/wx.h" ! #include "tc3DWindow.h" #include "simmath.h" *************** *** 347,350 **** --- 345,350 ---- std::vector<GeoPoint> maNavPointGeo; std::vector<tcPoint> maNavPointScreen; + int editPointIdx; ///< -1 if no point being edited, otherwise idx of edit point + osg::ref_ptr<osg::Geometry> maSymbolA[4][MAX_SYMBOL]; osg::ref_ptr<osg::Geometry> maSymbolB[4][MAX_SYMBOL]; *************** *** 363,366 **** --- 363,367 ---- wxPoint buttonDownPoint; ///< start point for click-drag operations float leftMargin; ///< screen position to use for info text and symbols + void Build2525(); void BuildNTDS(); *************** *** 374,377 **** --- 375,379 ---- float xc, float yc, float width, float height, float startAngle, float stopAngle, unsigned int nPoints); + void CheckForNavPointEdit(const wxPoint& buttonDownPoint); void CreateAlternateSymbols(); osg::Geometry* CreateSymbolGeometry(); |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/src/graphics Modified Files: tc3DModel.cpp tcMapView.cpp Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcMapView.cpp 10 Sep 2005 21:47:38 -0000 1.33 --- tcMapView.cpp 27 Nov 2005 22:21:29 -0000 1.34 *************** *** 384,389 **** void tcTacticalMapView::DrawSelectionBox() { ! if (!isLButtonDown) return; ! osg::Vec4 color(1, 1, 1, 1); --- 384,388 ---- void tcTacticalMapView::DrawSelectionBox() { ! if ((!isLButtonDown)||(editPointIdx > 0)) return; osg::Vec4 color(1, 1, 1, 1); *************** *** 559,563 **** int nSize = (int)maNavPointScreen.size(); ! osg::Vec4 color(1, 1, 1, 0.5); for (int i=0; i<nSize-1; i++) --- 558,575 ---- int nSize = (int)maNavPointScreen.size(); ! /* if a waypoint is being edited, draw the edit point at the current mouse position ! ** by substituting edit point for appropriate point in navpoint array ! */ ! if ((editPointIdx > 0) && ((size_t)editPointIdx < maNavPointScreen.size())) ! { ! maNavPointScreen[editPointIdx] = tcPoint((float)mpointMouse.x, (float)mpointMouse.y); ! tcPoint editPoint = ScreenToGeo(maNavPointScreen[editPointIdx].x, ! maNavPointScreen[editPointIdx].y); ! maNavPointGeo[editPointIdx].mfLon_rad = editPoint.x; ! maNavPointGeo[editPointIdx].mfLat_rad = editPoint.y; ! } ! ! const osg::Vec4 color(1, 1, 1, 0.5); ! const osg::Vec4 editColor(1, 1, 1, 1); for (int i=0; i<nSize-1; i++) *************** *** 567,570 **** --- 579,590 ---- DrawLineR(p1.x, p1.y, p2.x, p2.y, color); + if (i != editPointIdx - 1) + { + DrawRectangleR(p2.x - 2.0, p2.y - 2.0, 4.0, 4.0, color, tc3DWindow::FILL_ON); + } + else + { + DrawRectangleR(p2.x - 3.0, p2.y - 3.0, 6.0, 6.0, editColor, tc3DWindow::FILL_ON); + } } } *************** *** 658,662 **** /*** Draw selection box ***/ ! DrawSelectionBox(); /*** Draw date and time text ***/ --- 678,682 ---- /*** Draw selection box ***/ ! DrawSelectionBox(); /*** Draw date and time text ***/ *************** *** 2346,2349 **** --- 2366,2372 ---- } + // check if button is down near a nav waypoint, if so start edit + CheckForNavPointEdit(buttonDownPoint); + isLButtonDown = true; *************** *** 2353,2356 **** --- 2376,2402 ---- /** + * Check if button is down near a nav waypoint-- if so, start edit + */ + void tcTacticalMapView::CheckForNavPointEdit(const wxPoint& buttonDownPoint) + { + tcPoint buttonDownPointFloat((float)buttonDownPoint.x, (float)buttonDownPoint.y); + const float editDistance = 4.0f; + + for (size_t n=1; n<maNavPointScreen.size(); n++) + { + const tcPoint& p = maNavPointScreen[n]; + + float distance = p.DistanceTo(buttonDownPointFloat); + if (distance < editDistance) + { + editPointIdx = (int)n; + return; + } + } + + editPointIdx = -1; // click was not near a waypoint + } + + /** * Left mouse button up event handler. */ *************** *** 2360,2363 **** --- 2406,2423 ---- wxPoint buttonUpPoint = event.GetPosition(); + + if (editPointIdx > 0) + { + tcPoint geoPoint = ScreenToGeo(buttonUpPoint); + wxString argString = wxString::Format(",%d,%f,%f", editPointIdx-1, geoPoint.x, geoPoint.y); + + mpCommandInterface->AddPythonCommandGeneral("EditWaypoint", argString.c_str(), hookedId); + + editPointIdx = -1; + isLButtonDown = false; + return; + } + + bool isAltDown = event.AltDown(); Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tc3DModel.cpp 19 Nov 2005 19:27:47 -0000 1.31 --- tc3DModel.cpp 27 Nov 2005 22:21:29 -0000 1.32 *************** *** 492,496 **** } - osg::ref_ptr<osg::Node> tc3DModel::GetNode() { --- 492,495 ---- *************** *** 499,502 **** --- 498,506 ---- } + osg::Node* tc3DModel::GetModelNode() + { + return modelNode.get(); + } + unsigned int tc3DModel::GetNumParents() { *************** *** 516,519 **** --- 520,525 ---- } + + /** * @return radius of rendered model, considering generics *************** *** 893,899 **** if (explosionQueue.size() == 0) return; ! float scale = 20.0f; float intensity = 5.0f; // get location of model in world frame LocationParams p; --- 899,909 ---- if (explosionQueue.size() == 0) return; ! float scale = 15.0f; float intensity = 5.0f; + /* set position of explosion to location where it occurred, note that + ** explosion center is fixed in world frame and will not follow along + ** with vehicle movement */ + // get location of model in world frame LocationParams p; *************** *** 908,912 **** bool& isVisible = p.isVisible; ! osg::Vec3 pos(x, y, z); --- 918,925 ---- bool& isVisible = p.isVisible; ! osg::Vec3 pos = explosionQueue.front(); ! pos._v[0] += x; ! pos._v[1] += y; ! pos._v[2] += z; |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/include/common Modified Files: simmath.h Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** simmath.h 10 Sep 2005 21:48:06 -0000 1.32 --- simmath.h 27 Nov 2005 22:21:28 -0000 1.33 *************** *** 51,55 **** float x; float y; ! float DistanceTo(const tcPoint& p) {return (sqrtf((p.x-x)*(p.x-x)+(p.y-y)*(p.y-y)));} tcPoint() : x(0), y(0) {} --- 51,55 ---- float x; float y; ! float DistanceTo(const tcPoint& p) const {return (sqrtf((p.x-x)*(p.x-x)+(p.y-y)*(p.y-y)));} tcPoint() : x(0), y(0) {} |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/include/scriptinterface Modified Files: tcPlatformInterface.h tcSimPythonInterface.h Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** tcPlatformInterface.h 10 Sep 2005 21:48:06 -0000 1.45 --- tcPlatformInterface.h 27 Nov 2005 22:21:28 -0000 1.46 *************** *** 244,247 **** --- 244,249 ---- /// adds navigation waypoint (creates nav task if necessary) void AddNavWaypoint(float afLon_rad, float afLat_rad); + /// edits existing navigation waypoint + void EditNavWaypoint(size_t idx, float afLon_rad, float afLat_rad); /// true to loop through waypoints indefinitely void SetNavLoopState(bool state); Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcSimPythonInterface.h 2 Jul 2005 16:51:09 -0000 1.28 --- tcSimPythonInterface.h 27 Nov 2005 22:21:28 -0000 1.29 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcSimPythonInterface.h ! */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 27,33 **** // Python interface to tcPlatformObject for scripting #include "wx/wx.h" ! #ifdef WIN32 ! #include "wx/msw/private.h" // for MS Windows specific definitions ! #endif // WIN32 #include "tcPythonInterface.h" #include "tcPlatformObject.h" --- 29,33 ---- // Python interface to tcPlatformObject for scripting #include "wx/wx.h" ! #include "tcPythonInterface.h" #include "tcPlatformObject.h" *************** *** 123,128 **** tcScenarioInterface* GetScenarioInterface() const; void LoadScenario(const char *filePath, const char *fileName); ///< loads scenario from Python script file ! void ProcessCommand(std::string command, const std::vector<long>& id, int param = -1, std::string textParam = ""); void ProcessCallback(std::string command, const std::vector<long>& id); void ProcessCallback(std::string command, const std::vector<long>& id, --- 123,130 ---- tcScenarioInterface* GetScenarioInterface() const; void LoadScenario(const char *filePath, const char *fileName); ///< loads scenario from Python script file ! void ProcessCommand(const std::string& command, const std::vector<long>& id, int param = -1, std::string textParam = ""); + void ProcessCommandWithArguments(const std::string& command, const std::vector<long>& id, + const std::string& argString); void ProcessCallback(std::string command, const std::vector<long>& id); void ProcessCallback(std::string command, const std::vector<long>& id, |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtensionB.cpp tcSimPythonInterface.cpp Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** tcPlatformInterface.cpp 10 Sep 2005 21:47:38 -0000 1.52 --- tcPlatformInterface.cpp 27 Nov 2005 22:21:29 -0000 1.53 *************** *** 793,796 **** --- 793,810 ---- } + void tcPlatformInterface::EditNavWaypoint(size_t idx, float afLon_rad, float afLat_rad) + { + if (mpPlatformObj->IsClientMode()) return; + + ai::Brain* brain = mpPlatformObj->GetBrain(); + wxASSERT(brain); + + ai::Nav* nav = brain->GetNavTask(); + if (!nav) return; + wxASSERT(nav); + + nav->EditWaypoint(idx, afLon_rad, afLat_rad, 0); + } + void tcPlatformInterface::SetNavLoopState(bool state) { Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** tcSimPythonInterface.cpp 10 Sep 2005 21:47:38 -0000 1.39 --- tcSimPythonInterface.cpp 27 Nov 2005 22:21:29 -0000 1.40 *************** *** 550,554 **** * */ ! void tcSimPythonInterface::ProcessCommand(std::string command, const std::vector<long>& id, int param, std::string textParam) { --- 550,554 ---- * */ ! void tcSimPythonInterface::ProcessCommand(const std::string& command, const std::vector<long>& id, int param, std::string textParam) { *************** *** 580,583 **** --- 580,611 ---- /** + * Calls python command of the form Menu.<command>(<command object><argString>) + * argString should start with a comma if it is non-empty + */ + void tcSimPythonInterface::ProcessCommandWithArguments(const std::string& command, const std::vector<long>& id, + const std::string& argString) + { + PushMode(); + SetMenuGroup(id); + + std::string s = "Menu."; + + s += command; + s += "("; + + char zObject[64]; + GetObjectStringByMode(zObject); + s += zObject; + + s += argString; + + s += ")\n"; + + CallPython(s.c_str(), "Exception occurred in ProcessCommand\n"); + + PopMode(); + } + + /** * Saves menu state. Restore with PopMode() */ Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcPlatformInterfaceExtensionB.cpp 10 Sep 2005 21:47:38 -0000 1.26 --- tcPlatformInterfaceExtensionB.cpp 27 Nov 2005 22:21:29 -0000 1.27 *************** *** 110,113 **** --- 110,114 ---- // task interface commands .def("AddNavWaypoint", &tcPlatformInterface::AddNavWaypoint) + .def("EditNavWaypoint", &tcPlatformInterface::EditNavWaypoint) .def("SetNavLoopState", &tcPlatformInterface::SetNavLoopState) .def("AddTask", &tcPlatformInterface::AddTask) |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:37
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/xml Modified Files: options.xml Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: options.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/options.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** options.xml 10 Sep 2005 21:49:21 -0000 1.21 --- options.xml 27 Nov 2005 22:21:29 -0000 1.22 *************** *** 1,6 **** <Options> <HostAddress>192.168.0.100</HostAddress> ! <LastScenarioPath>SinglePlayer.JumpingFish.py</LastScenarioPath> ! <LastScenarioName>JumpingFish</LastScenarioName> <noCopyDatabase /> <noWriteXmlDatabase /> --- 1,6 ---- <Options> <HostAddress>192.168.0.100</HostAddress> ! <LastScenarioPath>Test.SubTestII.py</LastScenarioPath> ! <LastScenarioName>SubTestII</LastScenarioName> <noCopyDatabase /> <noWriteXmlDatabase /> |
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:37
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/include/sim Modified Files: commandlist.h tcCommandQueue.h tcGameObject.h tcRadar.h Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** tcGameObject.h 28 Jun 2005 02:51:20 -0000 1.41 --- tcGameObject.h 27 Nov 2005 22:21:28 -0000 1.42 *************** *** 120,123 **** --- 120,125 ---- float BearingTo(tcGameObject& p) const; float BearingToRad(tcGameObject& p) const; + bool CalculateCollisionPoint(tcGameObject* collider, osg::Vec3& pos, float& dt); + osg::Vec3 ConvertModelCoordinatesToWorld(const osg::Vec3& x) const; void AddChild(tcGameObject *child); tcGameObject* GetChildById(long id) const; *************** *** 127,130 **** --- 129,135 ---- virtual void ClearChildren(void); void GetRelPosOf(tcGameObject *obj, tsRelativePosition& rel_pos); + void GetRelativeStateLocal(tcGameObject *obj, osg::Vec3& position, osg::Vec3& velocity); + void GetRelativeStateWorld(tcGameObject *obj, osg::Vec3& position, osg::Vec3& velocity); + osg::Vec3 GetWorldVelocity() const; virtual void RandInitNear(float afLon_deg, float afLat_deg); GeoPoint RelPosToLatLonAlt(const tsRelativePosition& rel_pos) const; Index: tcCommandQueue.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCommandQueue.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcCommandQueue.h 10 Jan 2005 00:30:21 -0000 1.2 --- tcCommandQueue.h 27 Nov 2005 22:21:28 -0000 1.3 *************** *** 50,54 **** void AddPythonCommand(const char *azCommand, int param = -1); ! void AddPythonCommand(const char *azCommand, std::string textParam); void GetUserInput(const char *azCallback, const char *azUserInput, int param = -1) ; --- 50,56 ---- void AddPythonCommand(const char *azCommand, int param = -1); ! void AddPythonCommand(const char *azCommand, const std::string& textParam); ! ! void AddPythonCommandGeneral(const std::string& command, const std::string& args, const std::vector<long>& platformID); void GetUserInput(const char *azCallback, const char *azUserInput, int param = -1) ; *************** *** 78,93 **** - - - - - - - - - - - - - #endif \ No newline at end of file --- 80,83 ---- + #endif Index: commandlist.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/commandlist.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** commandlist.h 10 Sep 2005 21:48:06 -0000 1.8 --- commandlist.h 27 Nov 2005 22:21:28 -0000 1.9 *************** *** 62,65 **** --- 62,76 ---- }; + /** + * + */ + enum CommandType + { + GAME_COMMAND = 0, + PYTHON_CALLBACK = 1, // replaces mbUsePython && mbCallback + PYTHON_USERINPUT = 2, // replaces mbUsePython && mbGetUserInput + PYTHON_COMMAND_TEXT = 3, ///< command with single text parameter + PYTHON_COMMAND_GENERAL = 4 ///< command with general parameter string + }; /** *************** *** 68,71 **** --- 79,83 ---- struct tsCommandInfo { + CommandType commandType; teGameCommand meCmd; float mfData; *************** *** 74,80 **** char mzString[256]; char mzUserInput[64]; ///< Heading, Target, Datum - bool mbUsePython; - bool mbCallback; - bool mbGetUserInput; std::string textParam; ///< string parameter for python std::vector<long> platformID; ///< -1 or empty to use current hooked --- 86,89 ---- Index: tcRadar.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcRadar.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcRadar.h 22 Jun 2005 01:21:27 -0000 1.16 --- tcRadar.h 27 Nov 2005 22:21:28 -0000 1.17 *************** *** 101,105 **** --- 101,109 ---- bool isSemiactive; bool isCommandReceiver; + float last_range_km; ///< [km] target range from last call to CanDetectTarget + float target_x_offset_m; ///< offset for seeker target point in model coords + float target_y_offset_m; ///< may want to move params like this to a seeker derived class + void AdjustTrackForFineTargeting(const tcGameObject* target); void UpdateSeeker(double t); void UpdateSensorMap(double t, const tcGameObject* target, float range_km); |
|
From: Dewitt C. <ddc...@us...> - 2005-11-19 19:27:55
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11381/src/graphics Modified Files: tc3DModel.cpp tc3DWindow.cpp Log Message: Simple explosion effect using osgParticle::ExplosionEffect Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tc3DWindow.cpp 14 Sep 2005 01:33:24 -0000 1.26 --- tc3DWindow.cpp 19 Nov 2005 19:27:47 -0000 1.27 *************** *** 84,99 **** * by wxWindows. */ ! long tc3DWindow::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) ! { ! switch (nMsg) ! { ! case WM_ERASEBKGND: ! return 0; ! break; ! default: ! return wxWindow::MSWWindowProc(nMsg, wParam, lParam); ! break; ! } ! } --- 84,99 ---- * by wxWindows. */ ! //long tc3DWindow::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) ! //{ ! // switch (nMsg) ! // { ! // case WM_ERASEBKGND: ! // return 0; ! // break; ! // default: ! // return wxWindow::MSWWindowProc(nMsg, wParam, lParam); ! // break; ! // } ! //} Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tc3DModel.cpp 26 Jul 2005 00:37:04 -0000 1.30 --- tc3DModel.cpp 19 Nov 2005 19:27:47 -0000 1.31 *************** *** 43,46 **** --- 43,48 ---- #include <osgDB/ReadFile> #include <osgUtil/SmoothingVisitor> + #include <osgParticle/ExplosionEffect> + #include <osgParticle/ExplosionDebrisEffect> //#include <osgAL/SoundNode> *************** *** 351,354 **** --- 353,366 ---- } + + /** + * Queues explosion particle effect at rel_pos relative to + * origin of model. + */ + void tc3DModel::AddExplosion(const osg::Vec3& rel_pos) + { + explosionQueue.push_back(rel_pos); + } + tc3DModel* tc3DModel::Clone() { *************** *** 868,871 **** --- 880,922 ---- } } + + UpdateExplosions(); + + } + + /** + * Create explosion effects for any queued explosions. + * Explosions are added to world frame for now + */ + void tc3DModel::UpdateExplosions() + { + if (explosionQueue.size() == 0) return; + + float scale = 20.0f; + float intensity = 5.0f; + + // get location of model in world frame + LocationParams p; + GetLocationParams(p); + + float& x = p.x; + float& y = p.y; + float& z = p.z; + float& yaw = p.yaw; + float& pitch = p.pitch; + float& roll = p.roll; + bool& isVisible = p.isVisible; + + osg::Vec3 pos(x, y, z); + + + // just add one explosion effect for now + osgParticle::ExplosionEffect* explosion = new osgParticle::ExplosionEffect(pos, scale, intensity); + osgParticle::ExplosionDebrisEffect* explosionDebris = new osgParticle::ExplosionDebrisEffect(pos, scale, intensity); + world->addChild(explosion); + world->addChild(explosionDebris); + + explosionQueue.clear(); + } |
|
From: Dewitt C. <ddc...@us...> - 2005-11-19 19:27:55
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11381/src/sim Modified Files: gcb.cpp tcPlatformObject.cpp Log Message: Simple explosion effect using osgParticle::ExplosionEffect Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** tcPlatformObject.cpp 29 Jul 2005 02:35:53 -0000 1.54 --- tcPlatformObject.cpp 19 Nov 2005 19:27:47 -0000 1.55 *************** *** 440,443 **** --- 440,444 ---- } + model->AddExplosion(osg::Vec3(0, 0, 0)); } Index: gcb.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/gcb.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** gcb.cpp 14 Sep 2005 01:33:24 -0000 1.19 --- gcb.cpp 19 Nov 2005 19:27:47 -0000 1.20 *************** *** 109,125 **** * */ ! void GcbApp::DoMessage(WXMSG *pMsg) ! { ! current_msg = pMsg; ! MSG* msg = (MSG*)pMsg; ! ! if (msg->message == WM_LBUTTONDOWN) ! { ! int i = 0; ! i++; ! } ! ! wxApp::DoMessage(pMsg); ! } /** --- 109,125 ---- * */ ! //void GcbApp::DoMessage(WXMSG *pMsg) ! //{ ! // current_msg = pMsg; ! // MSG* msg = (MSG*)pMsg; ! // ! // if (msg->message == WM_LBUTTONDOWN) ! // { ! // int i = 0; ! // i++; ! // } ! // ! // wxApp::DoMessage(pMsg); ! //} /** |
|
From: Dewitt C. <ddc...@us...> - 2005-11-19 19:27:55
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11381/include/graphics Modified Files: tc3DModel.h tc3DWindow.h Log Message: Simple explosion effect using osgParticle::ExplosionEffect Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tc3DModel.h 1 Jun 2005 00:13:26 -0000 1.17 --- tc3DModel.h 19 Nov 2005 19:27:47 -0000 1.18 *************** *** 111,114 **** --- 111,115 ---- std::vector<tcAnimationInfo> animationInfo; ///< animation transforms to update at model level void AddChild(tc3DModel *child); + void AddExplosion(const osg::Vec3& rel_pos); tc3DModel* Clone(); void DetachFromParent(); *************** *** 154,157 **** --- 155,159 ---- std::vector<osg::Vec3> engineSmokeSources; std::vector<LauncherMountInfo> launcherInfo; + std::vector<osg::Vec3> explosionQueue; int smokeMode; *************** *** 189,192 **** --- 191,195 ---- void LoadXmlSmokeInfo(TiXmlDocument* doc); void ProcessAnimations(); + void UpdateExplosions(); }; Index: tc3DWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DWindow.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tc3DWindow.h 14 Sep 2005 01:33:24 -0000 1.18 --- tc3DWindow.h 19 Nov 2005 19:27:47 -0000 1.19 *************** *** 54,62 **** } ! namespace osgText ! { ! class Font; ! class Text; ! } class tcGraphicsEngine; --- 54,62 ---- } ! //namespace osgText ! //{ ! // class Font; ! // class Text; ! //} class tcGraphicsEngine; *************** *** 65,72 **** #define IMAGE_PATH "images\\" ! using osgText::Text::LEFT_BASE_LINE; ! using osgText::Text::LEFT_CENTER; ! using osgText::Text::RIGHT_CENTER; ! using osgText::Text::CENTER_CENTER; /** --- 65,74 ---- #define IMAGE_PATH "images\\" ! ! // using directives do not work on gcc, used #defines as workaround ! #define LEFT_BASE_LINE osgText::Text::LEFT_BASE_LINE ! #define LEFT_CENTER osgText::Text::LEFT_CENTER ! #define RIGHT_CENTER osgText::Text::RIGHT_CENTER ! #define CENTER_CENTER osgText::Text::CENTER_CENTER /** *************** *** 277,281 **** virtual void OnSize(wxSizeEvent& event); void SkipMouseEvent(wxMouseEvent& event); ///< adjusts position to parent frame ! long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual void UpdatePositionAndSize(const wxPoint& pos, const wxSize& size); --- 279,283 ---- virtual void OnSize(wxSizeEvent& event); void SkipMouseEvent(wxMouseEvent& event); ///< adjusts position to parent frame ! //long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual void UpdatePositionAndSize(const wxPoint& pos, const wxSize& size); *************** *** 327,328 **** --- 329,331 ---- #endif + |
|
From: Dewitt C. <ddc...@us...> - 2005-11-19 19:27:55
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11381/include/sim Modified Files: gcb.h Log Message: Simple explosion effect using osgParticle::ExplosionEffect Index: gcb.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/gcb.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gcb.h 14 Sep 2005 01:33:24 -0000 1.9 --- gcb.h 19 Nov 2005 19:27:47 -0000 1.10 *************** *** 45,54 **** private: ! WXMSG *current_msg; tcGame *gameFrame; ///< main game frame object with game loop, holds all subwindows bool closeApp; wxEventLoop *eventLoop; ! void DoMessage(WXMSG *pMsg); int MainLoop(); int OnExit(); --- 45,54 ---- private: ! //WXMSG *current_msg; tcGame *gameFrame; ///< main game frame object with game loop, holds all subwindows bool closeApp; wxEventLoop *eventLoop; ! //void DoMessage(WXMSG *pMsg); int MainLoop(); int OnExit(); |
|
From: Dewitt C. <ddc...@us...> - 2005-11-19 19:27:54
|
Update of /cvsroot/gcblue/gcb_wx/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11381/database Modified Files: database.db Log Message: Simple explosion effect using osgParticle::ExplosionEffect Index: database.db =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/database/database.db,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 Binary files /tmp/cvsSsi3pO and /tmp/cvsezQlG3 differ |
|
From: Dewitt C. <ddc...@us...> - 2005-10-12 22:17:53
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30413/docs Modified Files: BUILDING.txt Log Message: Index: BUILDING.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/BUILDING.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BUILDING.txt 16 Sep 2005 00:16:08 -0000 1.6 --- BUILDING.txt 12 Oct 2005 22:17:42 -0000 1.7 *************** *** 1,15 **** ! Updated September 2005 --- Download information --- ! * OpenSceneGraph 0.9.8-2 (including OpenThreads) http://openscenegraph.sourceforge.net/downloads/index.html Follow links to Sourceforge download page. ! Download bundled OSG_OT_OP 0.9.8-2 package Also download latest OSG Win32 Dependencies package ! Link: (as of April 2005) ! http://prdownloads.sourceforge.net/openscenegraph/3rdParty_Win32binaries_2004-07-25a.zip?download * Demeter 3.21 --- 1,18 ---- ! --- Building GCB Windows Dependencies --- ! ! Updated October 2005 --- Download information --- ! * OpenSceneGraph 0.9.9 (including OpenThreads) http://openscenegraph.sourceforge.net/downloads/index.html Follow links to Sourceforge download page. ! Download bundled OSG_OT_OP 0.9.9 package Also download latest OSG Win32 Dependencies package ! Link: (as of 12 October 2005) ! http://openscenegraph.org/downloads/dependencies/3rdParty_Win32binaries_2005_05_10.zip ! * Demeter 3.21 *************** *** 20,25 **** http://www.wxwidgets.org ! * OpenAL (Beta) ! CVS download instructions at http://www.openal.org/#Downloads * LibOGG 1.1 and LibVorbis 1.0.1 --- 23,29 ---- http://www.wxwidgets.org ! * OpenAL 1.0 SDK ! CVS download instructions at http://www.openal.org/downloads.html ! (There is a version 1.1 beta out that hasn't been tried yet) * LibOGG 1.1 and LibVorbis 1.0.1 *************** *** 28,38 **** libvorbis 1.0.1 source * Python 2.3.3 http://www.python.org/2.3.3/ Download Python-2.3.3.tgz ! * SQLite 2.8 ! http://www.sqlite.org/sqlite-source-2_8_16.zip (sources for windows) There also might be a precompiled download on that site that has the .lib, dll, and headers. --- 32,49 ---- libvorbis 1.0.1 source + * Boost 1.31.0 + http://www.boost.org + (Latest version 1.33.0 has not been tried) + * Python 2.3.3 http://www.python.org/2.3.3/ Download Python-2.3.3.tgz + (Latest version, Python 2.4.2, has not been tried yet) ! * SQLite 3.2.5 ! http://sqlite.org/download.html ! Download sources for windows There also might be a precompiled download on that site that has the .lib, dll, and headers. + Latest 3.2.x version should be okay to use *************** *** 42,55 **** ------------------ ----------------------- wxWidgets-2.6.1 C:\wxWidgets-2.6.1 ! OpenSceneGraph-0.9.8-2 C:\OpenSceneGraph-0.9.8-2 ! OpenThreads-v1.2dev3-osg0.9.6 C:\OpenThreads-v1.2dev3-osg0.9.6 libxml, etc. (osg dependencies) C:\3rdParty Demeter 3.21 C:\demeter-3.21 ! OpenAL Beta C:\openal Lib OGG 1.1 C:\libogg-1.1 Lib Vorbis 1.0.1 C:\libvorbis-1.0.1 Python 2.3.3 C:\Python-2.3.3 Boost Python 1.31.0 C:\boost_1_31_0 ! SQLite version 2.8 C:\sqlite --- Visual Studio Project Directories --- --- 53,66 ---- ------------------ ----------------------- wxWidgets-2.6.1 C:\wxWidgets-2.6.1 ! OpenSceneGraph-0.9.9 C:\OSG_OP_OT-0.9.9\OpenSceneGraph ! OpenThreads-0.9.9 C:\OSG_OP_OT-0.9.9\OpenThreads libxml, etc. (osg dependencies) C:\3rdParty Demeter 3.21 C:\demeter-3.21 ! OpenAL 1.0 SDK C:\openal Lib OGG 1.1 C:\libogg-1.1 Lib Vorbis 1.0.1 C:\libvorbis-1.0.1 Python 2.3.3 C:\Python-2.3.3 Boost Python 1.31.0 C:\boost_1_31_0 ! SQLite version 3.2 C:\sqlite --- Visual Studio Project Directories --- *************** *** 60,65 **** C:\wxWidgets-2.6.1\include C:\wxWidgets-2.6.1\lib\msw ! C:\OSG_OP_OT-0.9.8-2\OpenSceneGraph\include ! C:\OSG_OP_OT-0.9.8-2\OpenThreads\include C:\openal\include C:\Python-2.3.3\include --- 71,76 ---- C:\wxWidgets-2.6.1\include C:\wxWidgets-2.6.1\lib\msw ! C:\OSG_OP_OT-0.9.9\OpenSceneGraph\include ! C:\OSG_OP_OT-0.9.9\OpenThreads\include C:\openal\include C:\Python-2.3.3\include *************** *** 73,79 **** C:\3rdParty\lib ! C:\OSG_OP_OT-0.9.8-2\OpenThreads\lib\win32 C:\wxWidgets-2.6.1\lib ! C:\OSG_OP_OT-0.9.8-2\OpenSceneGraph\lib C:\openal\lib C:\Python-2.3.3\libs --- 84,90 ---- C:\3rdParty\lib ! C:\OSG_OP_OT-0.9.9\OpenThreads\lib\win32 C:\wxWidgets-2.6.1\lib ! C:\OSG_OP_OT-0.9.9\OpenSceneGraph\lib C:\openal\lib C:\Python-2.3.3\libs *************** *** 162,166 **** - * Build wxWidgets 2.6.1 --- 173,176 ---- *************** *** 188,192 **** ! * Build OpenAL (Beta) - Project file is at win/OpenAL.dsw --- 198,208 ---- ! ! ! * OpenAL 1.0 SDK ! ! Everything should already be compiled. ! ! If building from CVS: - Project file is at win/OpenAL.dsw *************** *** 230,234 **** - * Build Lib Vorbis 1.0.1 --- 246,249 ---- *************** *** 259,263 **** - vorbisfile_static: 11 warnings debug, 15 warnings release ! * Build SQLite version 2 --- 274,286 ---- - vorbisfile_static: 11 warnings debug, 15 warnings release ! ! ! * Build SQLite version 3.2 ! ! ! ! ! ! |
|
From: Dewitt C. <ddc...@us...> - 2005-09-16 21:58:43
|
Update of /cvsroot/gcblue/gcb_wx/src/sqlite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27580/src/sqlite Added Files: sqlite3x_command.cpp sqlite3x_connection.cpp sqlite3x_exception.cpp sqlite3x_reader.cpp sqlite3x_transaction.cpp Log Message: --- NEW FILE: sqlite3x_exception.cpp --- /* Copyright (C) 2004-2005 Cory Nelson This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. CVS Info : $Author: ddcforge $ $Date: 2005/09/16 21:58:05 $ $Revision: 1.1 $ */ #include <sqlite3.h> #include "sqlite/sqlite3x.hpp" namespace sqlite3x { database_error::database_error(const char *msg) : runtime_error(msg) {} database_error::database_error(sqlite3_connection &con) : runtime_error(sqlite3_errmsg(con.db)) {} } --- NEW FILE: sqlite3x_transaction.cpp --- /* Copyright (C) 2004-2005 Cory Nelson This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. CVS Info : $Author: ddcforge $ $Date: 2005/09/16 21:58:05 $ $Revision: 1.1 $ */ #include <sqlite3.h> #include "sqlite/sqlite3x.hpp" namespace sqlite3x { sqlite3_transaction::sqlite3_transaction(sqlite3_connection &con, bool start) : con(con),intrans(false) { if(start) begin(); } sqlite3_transaction::~sqlite3_transaction() { if(intrans) { try { rollback(); } catch(...) { return; } } } void sqlite3_transaction::begin() { con.executenonquery("begin;"); intrans=true; } void sqlite3_transaction::commit() { con.executenonquery("commit;"); intrans=false; } void sqlite3_transaction::rollback() { con.executenonquery("rollback;"); intrans=false; } } --- NEW FILE: sqlite3x_command.cpp --- /* Copyright (C) 2004-2005 Cory Nelson This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. CVS Info : $Author: ddcforge $ $Date: 2005/09/16 21:58:05 $ $Revision: 1.1 $ */ #include <sqlite3.h> #include "sqlite/sqlite3x.hpp" namespace sqlite3x { sqlite3_command::sqlite3_command(sqlite3_connection &con, const char *sql) : con(con),refs(0) { const char *tail=NULL; if(sqlite3_prepare(con.db, sql, -1, &this->stmt, &tail)!=SQLITE_OK) throw database_error(con); this->argc=sqlite3_column_count(this->stmt); } sqlite3_command::sqlite3_command(sqlite3_connection &con, const wchar_t *sql) : con(con),refs(0) { const wchar_t *tail=NULL; if(sqlite3_prepare16(con.db, sql, -1, &this->stmt, (const void**)&tail)!=SQLITE_OK) throw database_error(con); this->argc=sqlite3_column_count(this->stmt); } sqlite3_command::sqlite3_command(sqlite3_connection &con, const std::string &sql) : con(con),refs(0) { const char *tail=NULL; if(sqlite3_prepare(con.db, sql.data(), (int)sql.length(), &this->stmt, &tail)!=SQLITE_OK) throw database_error(con); this->argc=sqlite3_column_count(this->stmt); } sqlite3_command::sqlite3_command(sqlite3_connection &con, const std::wstring &sql) : con(con),refs(0) { const wchar_t *tail=NULL; if(sqlite3_prepare16(con.db, sql.data(), (int)sql.length()*2, &this->stmt, (const void**)&tail)!=SQLITE_OK) throw database_error(con); this->argc=sqlite3_column_count(this->stmt); } sqlite3_command::~sqlite3_command() { sqlite3_finalize(this->stmt); } void sqlite3_command::bind(int index) { if(sqlite3_bind_null(this->stmt, index)!=SQLITE_OK) throw database_error(this->con); } void sqlite3_command::bind(int index, int data) { if(sqlite3_bind_int(this->stmt, index, data)!=SQLITE_OK) throw database_error(this->con); } void sqlite3_command::bind(int index, long long data) { if(sqlite3_bind_int64(this->stmt, index, data)!=SQLITE_OK) throw database_error(this->con); } void sqlite3_command::bind(int index, double data) { if(sqlite3_bind_double(this->stmt, index, data)!=SQLITE_OK) throw database_error(this->con); } void sqlite3_command::bind(int index, const char *data, int datalen) { if(sqlite3_bind_text(this->stmt, index, data, datalen, SQLITE_TRANSIENT)!=SQLITE_OK) throw database_error(this->con); } void sqlite3_command::bind(int index, const wchar_t *data, int datalen) { if(sqlite3_bind_text16(this->stmt, index, data, datalen, SQLITE_TRANSIENT)!=SQLITE_OK) throw database_error(this->con); } void sqlite3_command::bind(int index, const void *data, int datalen) { if(sqlite3_bind_blob(this->stmt, index, data, datalen, SQLITE_TRANSIENT)!=SQLITE_OK) throw database_error(this->con); } void sqlite3_command::bind(int index, const std::string &data) { if(sqlite3_bind_text(this->stmt, index, data.data(), (int)data.length(), SQLITE_TRANSIENT)!=SQLITE_OK) throw database_error(this->con); } void sqlite3_command::bind(int index, const std::wstring &data) { if(sqlite3_bind_text16(this->stmt, index, data.data(), (int)data.length()*2, SQLITE_TRANSIENT)!=SQLITE_OK) throw database_error(this->con); } sqlite3_reader sqlite3_command::executereader() { return sqlite3_reader(this); } void sqlite3_command::executenonquery() { this->executereader().read(); } int sqlite3_command::executeint() { sqlite3_reader reader=this->executereader(); if(!reader.read()) throw database_error("nothing to read"); return reader.getint(0); } long long sqlite3_command::executeint64() { sqlite3_reader reader=this->executereader(); if(!reader.read()) throw database_error("nothing to read"); return reader.getint64(0); } double sqlite3_command::executedouble() { sqlite3_reader reader=this->executereader(); if(!reader.read()) throw database_error("nothing to read"); return reader.getdouble(0); } std::string sqlite3_command::executestring() { sqlite3_reader reader=this->executereader(); if(!reader.read()) throw database_error("nothing to read"); return reader.getstring(0); } std::wstring sqlite3_command::executestring16() { sqlite3_reader reader=this->executereader(); if(!reader.read()) throw database_error("nothing to read"); return reader.getstring16(0); } std::string sqlite3_command::executeblob() { sqlite3_reader reader=this->executereader(); if(!reader.read()) throw database_error("nothing to read"); return reader.getblob(0); } } --- NEW FILE: sqlite3x_connection.cpp --- /* Copyright (C) 2004-2005 Cory Nelson This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. CVS Info : $Author: ddcforge $ $Date: 2005/09/16 21:58:05 $ $Revision: 1.1 $ */ #include <sqlite3.h> #include "sqlite/sqlite3x.hpp" namespace sqlite3x { sqlite3_connection::sqlite3_connection() : db(NULL) {} sqlite3_connection::sqlite3_connection(const char *db) : db(NULL) { this->open(db); } sqlite3_connection::sqlite3_connection(const wchar_t *db) : db(NULL) { this->open(db); } sqlite3_connection::~sqlite3_connection() { if(this->db) sqlite3_close(this->db); } void sqlite3_connection::open(const char *db) { if(sqlite3_open(db, &this->db)!=SQLITE_OK) throw database_error("unable to open database"); } void sqlite3_connection::open(const wchar_t *db) { if(sqlite3_open16(db, &this->db)!=SQLITE_OK) throw database_error("unable to open database"); } void sqlite3_connection::close() { if(this->db) { if(sqlite3_close(this->db)!=SQLITE_OK) throw database_error(*this); this->db=NULL; } } long long sqlite3_connection::insertid() { if(!this->db) throw database_error("database is not open"); return sqlite3_last_insert_rowid(this->db); } void sqlite3_connection::setbusytimeout(int ms) { if(!this->db) throw database_error("database is not open"); if(sqlite3_busy_timeout(this->db, ms)!=SQLITE_OK) throw database_error(*this); } void sqlite3_connection::executenonquery(const char *sql) { if(!this->db) throw database_error("database is not open"); sqlite3_command(*this, sql).executenonquery(); } void sqlite3_connection::executenonquery(const wchar_t *sql) { if(!this->db) throw database_error("database is not open"); sqlite3_command(*this, sql).executenonquery(); } void sqlite3_connection::executenonquery(const std::string &sql) { if(!this->db) throw database_error("database is not open"); sqlite3_command(*this, sql).executenonquery(); } void sqlite3_connection::executenonquery(const std::wstring &sql) { if(!this->db) throw database_error("database is not open"); sqlite3_command(*this, sql).executenonquery(); } int sqlite3_connection::executeint(const char *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeint(); } int sqlite3_connection::executeint(const wchar_t *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeint(); } int sqlite3_connection::executeint(const std::string &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeint(); } int sqlite3_connection::executeint(const std::wstring &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeint(); } long long sqlite3_connection::executeint64(const char *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeint64(); } long long sqlite3_connection::executeint64(const wchar_t *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeint64(); } long long sqlite3_connection::executeint64(const std::string &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeint64(); } long long sqlite3_connection::executeint64(const std::wstring &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeint64(); } double sqlite3_connection::executedouble(const char *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executedouble(); } double sqlite3_connection::executedouble(const wchar_t *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executedouble(); } double sqlite3_connection::executedouble(const std::string &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executedouble(); } double sqlite3_connection::executedouble(const std::wstring &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executedouble(); } std::string sqlite3_connection::executestring(const char *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executestring(); } std::string sqlite3_connection::executestring(const wchar_t *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executestring(); } std::string sqlite3_connection::executestring(const std::string &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executestring(); } std::string sqlite3_connection::executestring(const std::wstring &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executestring(); } std::wstring sqlite3_connection::executestring16(const char *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executestring16(); } std::wstring sqlite3_connection::executestring16(const wchar_t *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executestring16(); } std::wstring sqlite3_connection::executestring16(const std::string &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executestring16(); } std::wstring sqlite3_connection::executestring16(const std::wstring &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executestring16(); } std::string sqlite3_connection::executeblob(const char *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeblob(); } std::string sqlite3_connection::executeblob(const wchar_t *sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeblob(); } std::string sqlite3_connection::executeblob(const std::string &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeblob(); } std::string sqlite3_connection::executeblob(const std::wstring &sql) { if(!this->db) throw database_error("database is not open"); return sqlite3_command(*this, sql).executeblob(); } } --- NEW FILE: sqlite3x_reader.cpp --- /* Copyright (C) 2004-2005 Cory Nelson This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. CVS Info : $Author: ddcforge $ $Date: 2005/09/16 21:58:05 $ $Revision: 1.1 $ */ #include <sqlite3.h> #include "sqlite/sqlite3x.hpp" namespace sqlite3x { sqlite3_reader::sqlite3_reader() : cmd(NULL) {} sqlite3_reader::sqlite3_reader(const sqlite3_reader ©) : cmd(copy.cmd) { if(this->cmd) ++this->cmd->refs; } sqlite3_reader::sqlite3_reader(sqlite3_command *cmd) : cmd(cmd) { ++cmd->refs; } sqlite3_reader::~sqlite3_reader() { this->close(); } sqlite3_reader& sqlite3_reader::operator=(const sqlite3_reader ©) { this->close(); this->cmd=copy.cmd; if(this->cmd) ++this->cmd->refs; return *this; } bool sqlite3_reader::read() { if(!this->cmd) throw database_error("reader is closed"); switch(sqlite3_step(this->cmd->stmt)) { case SQLITE_ROW: return true; case SQLITE_DONE: return false; default: throw database_error(this->cmd->con); } } void sqlite3_reader::reset() { if(!this->cmd) throw database_error("reader is closed"); if(sqlite3_reset(this->cmd->stmt)!=SQLITE_OK) throw database_error(this->cmd->con); } void sqlite3_reader::close() { if(this->cmd) { if(--this->cmd->refs==0) sqlite3_reset(this->cmd->stmt); this->cmd=NULL; } } int sqlite3_reader::getint(int index) { if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); return sqlite3_column_int(this->cmd->stmt, index); } long long sqlite3_reader::getint64(int index) { if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); return sqlite3_column_int64(this->cmd->stmt, index); } /** * Modified code, using 2.x atol on string version here */ long sqlite3_reader::getlong(int index) { std::string s = this->getstring(index); return atol(s.c_str()); } double sqlite3_reader::getdouble(int index) { if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); return sqlite3_column_double(this->cmd->stmt, index); } std::string sqlite3_reader::getstring(int index) { if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); return std::string((const char*)sqlite3_column_text(this->cmd->stmt, index), sqlite3_column_bytes(this->cmd->stmt, index)); } std::wstring sqlite3_reader::getstring16(int index) { if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); return std::wstring((const wchar_t*)sqlite3_column_text16(this->cmd->stmt, index), sqlite3_column_bytes16(this->cmd->stmt, index)/2); } std::string sqlite3_reader::getblob(int index) { if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); return std::string((const char*)sqlite3_column_blob(this->cmd->stmt, index), sqlite3_column_bytes(this->cmd->stmt, index)); } std::string sqlite3_reader::getcolname(int index) { if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); return sqlite3_column_name(this->cmd->stmt, index); } std::wstring sqlite3_reader::getcolname16(int index) { if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); return (const wchar_t*)sqlite3_column_name16(this->cmd->stmt, index); } } |
|
From: Dewitt C. <ddc...@us...> - 2005-09-16 21:58:41
|
Update of /cvsroot/gcblue/gcb_wx/include/sqlite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27580/include/sqlite Added Files: sqlite3x.hpp Log Message: --- NEW FILE: sqlite3x.hpp --- /* Copyright (C) 2004-2005 Cory Nelson This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. CVS Info : $Author: ddcforge $ $Date: 2005/09/16 21:58:05 $ $Revision: 1.1 $ */ #ifndef __SQLITE3X_HPP__ #define __SQLITE3X_HPP__ #include <string> #include <boost/utility.hpp> namespace sqlite3x { class sqlite3_connection : boost::noncopyable { private: friend class sqlite3_command; friend class database_error; struct sqlite3 *db; public: sqlite3_connection(); sqlite3_connection(const char *db); sqlite3_connection(const wchar_t *db); ~sqlite3_connection(); void open(const char *db); void open(const wchar_t *db); void close(); long long insertid(); void setbusytimeout(int ms); void executenonquery(const char *sql); void executenonquery(const wchar_t *sql); void executenonquery(const std::string &sql); void executenonquery(const std::wstring &sql); int executeint(const char *sql); int executeint(const wchar_t *sql); int executeint(const std::string &sql); int executeint(const std::wstring &sql); long long executeint64(const char *sql); long long executeint64(const wchar_t *sql); long long executeint64(const std::string &sql); long long executeint64(const std::wstring &sql); double executedouble(const char *sql); double executedouble(const wchar_t *sql); double executedouble(const std::string &sql); double executedouble(const std::wstring &sql); std::string executestring(const char *sql); std::string executestring(const wchar_t *sql); std::string executestring(const std::string &sql); std::string executestring(const std::wstring &sql); std::wstring executestring16(const char *sql); std::wstring executestring16(const wchar_t *sql); std::wstring executestring16(const std::string &sql); std::wstring executestring16(const std::wstring &sql); std::string executeblob(const char *sql); std::string executeblob(const wchar_t *sql); std::string executeblob(const std::string &sql); std::string executeblob(const std::wstring &sql); }; class sqlite3_transaction : boost::noncopyable { private: sqlite3_connection &con; bool intrans; public: sqlite3_transaction(sqlite3_connection &con, bool start=true); ~sqlite3_transaction(); void begin(); void commit(); void rollback(); }; class sqlite3_command : boost::noncopyable { private: friend class sqlite3_reader; sqlite3_connection &con; struct sqlite3_stmt *stmt; unsigned int refs; int argc; public: sqlite3_command(sqlite3_connection &con, const char *sql); sqlite3_command(sqlite3_connection &con, const wchar_t *sql); sqlite3_command(sqlite3_connection &con, const std::string &sql); sqlite3_command(sqlite3_connection &con, const std::wstring &sql); ~sqlite3_command(); void bind(int index); void bind(int index, int data); void bind(int index, long long data); void bind(int index, double data); void bind(int index, const char *data, int datalen); void bind(int index, const wchar_t *data, int datalen); void bind(int index, const void *data, int datalen); void bind(int index, const std::string &data); void bind(int index, const std::wstring &data); sqlite3_reader executereader(); void executenonquery(); int executeint(); long long executeint64(); double executedouble(); std::string executestring(); std::wstring executestring16(); std::string executeblob(); }; class sqlite3_reader { private: friend class sqlite3_command; sqlite3_command *cmd; sqlite3_reader(sqlite3_command *cmd); public: sqlite3_reader(); sqlite3_reader(const sqlite3_reader ©); ~sqlite3_reader(); sqlite3_reader& operator=(const sqlite3_reader ©); bool read(); void reset(); void close(); int getint(int index); long getlong(int index); ///< modified code DDC long long getint64(int index); double getdouble(int index); std::string getstring(int index); std::wstring getstring16(int index); std::string getblob(int index); std::string getcolname(int index); std::wstring getcolname16(int index); }; class database_error : public std::runtime_error { public: database_error(const char *msg); database_error(sqlite3_connection &con); }; } #endif |
|
From: Dewitt C. <ddc...@us...> - 2005-09-16 00:16:17
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24731/src/database Modified Files: tcAccountDatabase.cpp tcDatabase.cpp tcSqlReader.cpp Log Message: Upgraded to Sqlite 3.2.5 Index: tcAccountDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcAccountDatabase.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcAccountDatabase.cpp 29 Jul 2005 02:35:52 -0000 1.2 --- tcAccountDatabase.cpp 16 Sep 2005 00:16:08 -0000 1.3 *************** *** 24,28 **** #include "tcAccountDatabase.h" ! #include "sqlite/sqlite_plus.h" #include "md5class.h" #include <sstream> --- 24,28 ---- #include "tcAccountDatabase.h" ! #include "sqlite/sqlite3x.hpp" #include "md5class.h" #include <sstream> *************** *** 33,36 **** --- 33,39 ---- + using sqlite3x::sqlite3_command; + using sqlite3x::sqlite3_connection; + using sqlite3x::sqlite3_reader; *************** *** 154,159 **** bool tcAccountDatabase::GetUserData(const std::string& user, UserData& userData) { ! sqlite::reader tableData = accountDatabase->executereader( ! "select * from %s where UserName='%s';", tableName.c_str(), user.c_str()); if (tableData.read()) --- 157,165 ---- bool tcAccountDatabase::GetUserData(const std::string& user, UserData& userData) { ! wxString command = wxString::Format("select * from %s where UserName='%s';", ! tableName.c_str(), user.c_str()); ! sqlite3_command sqlCmd(*accountDatabase, command.c_str()); ! sqlite3x::sqlite3_reader tableData = sqlCmd.executereader(); ! if (tableData.read()) *************** *** 198,207 **** try { ! accountDatabase = new sqlite::connection(databasePath.c_str()); // build column lookup columnLookup.clear(); ! sqlite::reader tableInfo = accountDatabase->executereader( ! "pragma table_info(%s);", tableName.c_str()); unsigned int fieldCount = 0; --- 204,214 ---- try { ! accountDatabase = new sqlite3x::sqlite3_connection(databasePath.c_str()); // build column lookup columnLookup.clear(); ! wxString command = wxString::Format("pragma table_info(%s);", tableName.c_str()); ! sqlite3_command sqlCmd(*accountDatabase, command.c_str()); ! sqlite3x::sqlite3_reader tableInfo = sqlCmd.executereader(); unsigned int fieldCount = 0; *************** *** 209,213 **** while (tableInfo.read()) { ! columnLookup[std::string(tableInfo[1])] = fieldCount++; } --- 216,220 ---- while (tableInfo.read()) { ! columnLookup[tableInfo.getstring(1)] = fieldCount++; } Index: tcSqlReader.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSqlReader.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcSqlReader.cpp 12 Jun 2005 20:46:58 -0000 1.5 --- tcSqlReader.cpp 16 Sep 2005 00:16:08 -0000 1.6 *************** *** 22,26 **** #include "stdwx.h" #include "tcSqlReader.h" ! #include "sqlite/sqlite_plus.h" #include <stdarg.h> --- 22,26 ---- #include "stdwx.h" #include "tcSqlReader.h" ! #include "sqlite/sqlite3x.hpp" #include <stdarg.h> *************** *** 35,39 **** * Builds column lookup std::map */ ! void tcSqlReader::BuildColumnLookup(sqlite::reader& tableInfo) { unsigned int fieldCount = 0; --- 35,39 ---- * Builds column lookup std::map */ ! void tcSqlReader::BuildColumnLookup(sqlite3x::sqlite3_reader& tableInfo) { unsigned int fieldCount = 0; *************** *** 42,46 **** while(tableInfo.read()) { ! columnLookup[std::string(tableInfo[1])] = fieldCount++; } } --- 42,46 ---- while(tableInfo.read()) { ! columnLookup[tableInfo.getstring(1)] = fieldCount++; } } *************** *** 178,182 **** ! tcSqlReader::tcSqlReader(sqlite::reader& tableInfo, sqlite::reader& _data) : data(_data) { --- 178,182 ---- ! tcSqlReader::tcSqlReader(sqlite3x::sqlite3_reader& tableInfo, sqlite3x::sqlite3_reader& _data) : data(_data) { Index: tcDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcDatabase.cpp 7 Jul 2005 01:13:43 -0000 1.31 --- tcDatabase.cpp 16 Sep 2005 00:16:08 -0000 1.32 *************** *** 55,59 **** #include "tcDatabaseIterator.h" #include "common/tinyxml.h" ! #include "sqlite/sqlite_plus.h" #ifdef _DEBUG --- 55,59 ---- #include "tcDatabaseIterator.h" #include "common/tinyxml.h" ! #include "sqlite/sqlite3x.hpp" #ifdef _DEBUG *************** *** 234,238 **** ! sqlite::connection sqlConnection(fileName.c_str()); // tcGenericDBObject --- 234,238 ---- ! sqlite3x::sqlite3_connection sqlConnection(fileName.c_str()); // tcGenericDBObject |
|
From: Dewitt C. <ddc...@us...> - 2005-09-16 00:16:17
|
Update of /cvsroot/gcblue/gcb_wx/include/sqlite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24731/include/sqlite Removed Files: sqlite_internal.h sqlite_plus.h Log Message: Upgraded to Sqlite 3.2.5 --- sqlite_plus.h DELETED --- --- sqlite_internal.h DELETED --- |
|
From: Dewitt C. <ddc...@us...> - 2005-09-16 00:16:17
|
Update of /cvsroot/gcblue/gcb_wx/src/sqlite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24731/src/sqlite Removed Files: sqlite_connection.cpp sqlite_internal.cpp sqlite_reader.cpp Log Message: Upgraded to Sqlite 3.2.5 --- sqlite_internal.cpp DELETED --- --- sqlite_reader.cpp DELETED --- --- sqlite_connection.cpp DELETED --- |
|
From: Dewitt C. <ddc...@us...> - 2005-09-16 00:16:17
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24731/include/database Modified Files: tcAccountDatabase.h tcDBObjSerializerSql.h tcSqlReader.h Log Message: Upgraded to Sqlite 3.2.5 Index: tcDBObjSerializerSql.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDBObjSerializerSql.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcDBObjSerializerSql.h 1 Jun 2005 00:13:25 -0000 1.4 --- tcDBObjSerializerSql.h 16 Sep 2005 00:16:08 -0000 1.5 *************** *** 31,35 **** #include <fstream> #include <string> ! #include "sqlite/sqlite_plus.h" #include "database/tcSqlReader.h" --- 31,35 ---- #include <fstream> #include <string> ! #include "sqlite/sqlite3x.hpp" #include "database/tcSqlReader.h" *************** *** 39,42 **** --- 39,47 ---- #endif + using sqlite3x::sqlite3_reader; + using sqlite3x::sqlite3_command; + using sqlite3x::sqlite3_connection; + + /** * Saves/loads objects of class T from database. *************** *** 54,58 **** { public: ! tcDBObjSerializerSql(tcDatabase* db, sqlite::connection& con, std::string s) : database(db), sqlConn(con), tableName(s) {} bool Load(); --- 59,63 ---- { public: ! tcDBObjSerializerSql(tcDatabase* db, sqlite3x::sqlite3_connection& con, std::string s) : database(db), sqlConn(con), tableName(s) {} bool Load(); *************** *** 61,65 **** tcDatabase* database; std::string tableName; ! sqlite::connection& sqlConn; }; --- 66,70 ---- tcDatabase* database; std::string tableName; ! sqlite3x::sqlite3_connection& sqlConn; }; *************** *** 72,78 **** { // check if the table exists, abort if it doesn't ! string countStr = ! sqlConn.executescalar("select count(*) from sqlite_master where name='%s';", tableName.c_str()); if (countStr == "0") --- 77,83 ---- { // check if the table exists, abort if it doesn't ! wxString command = wxString::Format("select count(*) from sqlite_master where name='%s';", tableName.c_str()); + string countStr = sqlConn.executestring(command.c_str()); if (countStr == "0") *************** *** 97,105 **** try { ! sqlite::reader tableInfo = sqlConn.executereader( ! "pragma table_info(%s);", tableName.c_str() ); ! sqlite::reader tableData = sqlConn.executereader( ! "select * from %s;", tableName.c_str()); tcSqlReader sqlReader(tableInfo, tableData); --- 102,114 ---- try { ! wxString command = wxString::Format("pragma table_info(%s);", tableName.c_str()); ! sqlite3_command sqlCmd(sqlConn, command.c_str()); ! sqlite3_reader tableInfo = sqlCmd.executereader(); ! ! command = wxString::Format("select * from %s;", tableName.c_str()); ! ! sqlite3_command sqlCmd2(sqlConn, command.c_str()); ! sqlite3_reader tableData = sqlCmd2.executereader(); tcSqlReader sqlReader(tableInfo, tableData); *************** *** 139,150 **** { // delete table if it exists ! string countStr = sqlConn.executescalar( ! "select count(*) from sqlite_master where name='%s';", ! tableName.c_str() ); if (countStr != "0") { ! sqlConn.executenonquery("drop table %s;", tableName.c_str()); } --- 148,160 ---- { // delete table if it exists ! wxString command = wxString::Format("select count(*) from sqlite_master where name='%s';", ! tableName.c_str()); ! string countStr = sqlConn.executestring(command.c_str()); if (countStr != "0") { ! command = wxString::Format("drop table %s;", tableName.c_str()); ! sqlConn.executenonquery(command.c_str()); } *************** *** 158,165 **** fprintf(stdout, "column str: (%s)\n", columnString.c_str()); #endif ! ! sqlConn.executenonquery( ! "create table %s (%s);", tableName.c_str(), columnString.c_str()); } catch(exception &ex) --- 168,174 ---- fprintf(stdout, "column str: (%s)\n", columnString.c_str()); #endif ! command = wxString::Format("create table %s (%s);", tableName.c_str(), columnString.c_str()); + sqlConn.executenonquery(command.c_str()); } catch(exception &ex) *************** *** 189,196 **** fprintf(stdout, "value str: (%s)\n", valueString.c_str()); #endif ! ! sqlConn.executenonquery( ! "insert into %s values (%s);", tableName.c_str(), valueString.c_str()); } catch(exception &ex) --- 198,204 ---- fprintf(stdout, "value str: (%s)\n", valueString.c_str()); #endif ! wxString command = wxString::Format("insert into %s values (%s);", tableName.c_str(), valueString.c_str()); + sqlConn.executenonquery(command.c_str()); } catch(exception &ex) Index: tcAccountDatabase.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcAccountDatabase.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcAccountDatabase.h 6 May 2005 23:57:16 -0000 1.1 --- tcAccountDatabase.h 16 Sep 2005 00:16:08 -0000 1.2 *************** *** 28,34 **** class CMD5; ! namespace sqlite { ! class connection; } --- 28,34 ---- class CMD5; ! namespace sqlite3x { ! class sqlite3_connection; } *************** *** 111,115 **** static tcAccountDatabase* Get(); ///< singleton instance accessor private: ! sqlite::connection* accountDatabase; std::map<std::string, unsigned int> columnLookup; // for faster access of data CMD5* md5; --- 111,115 ---- static tcAccountDatabase* Get(); ///< singleton instance accessor private: ! sqlite3x::sqlite3_connection* accountDatabase; std::map<std::string, unsigned int> columnLookup; // for faster access of data CMD5* md5; Index: tcSqlReader.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcSqlReader.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSqlReader.h 12 Jun 2005 20:46:27 -0000 1.4 --- tcSqlReader.h 16 Sep 2005 00:16:08 -0000 1.5 *************** *** 31,37 **** #include <map> ! namespace sqlite { ! class reader; } --- 31,37 ---- #include <map> ! namespace sqlite3x { ! class sqlite3_reader; } *************** *** 67,78 **** bool Read(); ! tcSqlReader(sqlite::reader& tableInfo, sqlite::reader& _data); ~tcSqlReader(); private: std::map<std::string, unsigned int> columnLookup; ! sqlite::reader& data; char buffer[128]; ///< internal buffer for formatting column names, watch overrun! ! void BuildColumnLookup(sqlite::reader& tableInfo); unsigned int LookupFieldIndex(const std::string& field); }; --- 67,78 ---- bool Read(); ! tcSqlReader(sqlite3x::sqlite3_reader& tableInfo, sqlite3x::sqlite3_reader& _data); ~tcSqlReader(); private: std::map<std::string, unsigned int> columnLookup; ! sqlite3x::sqlite3_reader& data; char buffer[128]; ///< internal buffer for formatting column names, watch overrun! ! void BuildColumnLookup(sqlite3x::sqlite3_reader& tableInfo); unsigned int LookupFieldIndex(const std::string& field); }; |