[Gcblue-commits] gcb_wx/src/sim tcFlightPort.cpp,1.16,1.17
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-05-10 02:26:15
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1860/src/sim Modified Files: tcFlightPort.cpp Log Message: Fix for aircraft getting stuck on runway at client Index: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcFlightPort.cpp 29 Apr 2005 18:52:55 -0000 1.16 --- tcFlightPort.cpp 10 May 2005 02:26:06 -0000 1.17 *************** *** 186,189 **** --- 186,192 ---- } + + ResyncSpots(); + /* request recreate if not all updates were matched (new child) ** or if not all children were update (deleted child) *************** *** 757,760 **** --- 760,800 ---- } + /** + * Workaround for multiplayer client. + * This clears spot info and reassigns units to spots based on the info in airstate + */ + void tcFlightPort::ResyncSpots() + { + // first clear the obj_info in each ready and launch spot + for (size_t n=0; n<ready_spots.size(); n++) + { + ready_spots[n].obj_info = 0; + } + + for (size_t n=0; n<launch_spots.size(); n++) + { + launch_spots[n].obj_info = 0; + } + + for (size_t n=0; n<units.size(); n++) + { + tcAirState* airstate = units[n]; + if (airstate->current_location == READY) + { + if ((airstate->current_spot >= 0) && (airstate->current_spot < ready_spots.size())) + { + ready_spots[airstate->current_spot].obj_info = airstate; + } + } + else if (airstate->current_location == LAUNCH) + { + if ((airstate->current_spot >= 0) && (airstate->current_spot < launch_spots.size())) + { + launch_spots[airstate->current_spot].obj_info = airstate; + } + } + } + } + //---------------------------------------------------------------------------- void tcFlightPort::SetObjectDestination(unsigned n, teLocation loc) *************** *** 884,888 **** int spot_idx = FindEmptySpot(airstate->goal_location, loc_vector); airstate->goal_spot = spot_idx; ! airstate->ready_time = afStatusTime + 300.0f; // short times for test MoveObjectToGoal(airstate); } --- 924,928 ---- int spot_idx = FindEmptySpot(airstate->goal_location, loc_vector); airstate->goal_spot = spot_idx; ! airstate->ready_time = afStatusTime + 30.0f; // short times for test MoveObjectToGoal(airstate); } |