Merge branch 'next' of git://gitorious.org/fg/flightgear into next
This commit is contained in:
commit
a28c3246cb
11 changed files with 46 additions and 80 deletions
|
@ -362,6 +362,7 @@ MK_VIII::SystemHandler::update ()
|
|||
if (replay_state != last_replay_state)
|
||||
{
|
||||
mk->alert_handler.reposition();
|
||||
mk->io_handler.reposition();
|
||||
|
||||
last_replay_state = replay_state;
|
||||
state = STATE_REPOSITION;
|
||||
|
@ -1065,6 +1066,7 @@ MK_VIII::IOHandler::boot ()
|
|||
mk_doutput(glideslope_cancel) = power_saved.glideslope_cancel;
|
||||
|
||||
altitude_samples.clear();
|
||||
reset_terrain_clearance();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1364,6 +1366,12 @@ MK_VIII::IOHandler::reset_terrain_clearance ()
|
|||
update_terrain_clearance();
|
||||
}
|
||||
|
||||
void
|
||||
MK_VIII::IOHandler::reposition ()
|
||||
{
|
||||
reset_terrain_clearance();
|
||||
}
|
||||
|
||||
void
|
||||
MK_VIII::IOHandler::handle_input_fault (bool test, FaultHandler::Fault fault)
|
||||
{
|
||||
|
|
|
@ -609,6 +609,7 @@ public:
|
|||
void update_egpws_alert_discrete_2 ();
|
||||
void update_egpwc_alert_discrete_3 ();
|
||||
void update_outputs ();
|
||||
void reposition ();
|
||||
|
||||
void update_lamps ();
|
||||
void set_lamp (Lamp lamp);
|
||||
|
@ -639,7 +640,7 @@ public:
|
|||
|
||||
public:
|
||||
inline TerrainClearanceFilter ()
|
||||
: value(0) {}
|
||||
: value(0.0), last_update(-1.0) {}
|
||||
|
||||
double update (double agl);
|
||||
void reset ();
|
||||
|
|
|
@ -390,6 +390,7 @@ void FGNavRadio::clearOutputs()
|
|||
|
||||
_dmeInRange = false;
|
||||
_operable = false;
|
||||
_navaid = NULL;
|
||||
}
|
||||
|
||||
void FGNavRadio::updateReceiver(double dt)
|
||||
|
|
|
@ -1262,14 +1262,6 @@ bool fgInitGeneral() {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Initialize view parameters
|
||||
void fgInitView() {
|
||||
// force update of model so that viewer can get some data...
|
||||
globals->get_aircraft_model()->update(0);
|
||||
// run update for current view so that data is current...
|
||||
globals->get_viewmgr()->update(0);
|
||||
}
|
||||
|
||||
// This is the top level init routine which calls all the other
|
||||
// initialization routines. If you are adding a subsystem to flight
|
||||
// gear, its initialization call should located in this routine.
|
||||
|
@ -1355,12 +1347,6 @@ bool fgInitSubsystems() {
|
|||
|
||||
globals->add_subsystem( "xml-autopilot", FGXMLAutopilotGroup::createInstance(), SGSubsystemMgr::FDM );
|
||||
globals->add_subsystem( "route-manager", new FGRouteMgr );
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize the view manager subsystem.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
fgInitView();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize the Input-Output subsystem
|
||||
|
@ -1411,6 +1397,14 @@ bool fgInitSubsystems() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
globals->add_subsystem("atis", new FGAtisManager, SGSubsystemMgr::POST_FDM);
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize multiplayer subsystem
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
globals->add_subsystem("mp", new FGMultiplayMgr, SGSubsystemMgr::POST_FDM);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialise the AI Model Manager
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -1479,13 +1473,6 @@ bool fgInitSubsystems() {
|
|||
globals->get_subsystem_mgr()->bind();
|
||||
globals->get_subsystem_mgr()->init();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize multiplayer subsystem
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
globals->set_multiplayer_mgr(new FGMultiplayMgr);
|
||||
globals->get_multiplayer_mgr()->init();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Initialize the Nasal interpreter.
|
||||
// Do this last, so that the loaded scripts see initialized state
|
||||
|
@ -1542,8 +1529,6 @@ void fgReInitSubsystems()
|
|||
// reload offsets from config defaults
|
||||
globals->get_viewmgr()->reinit();
|
||||
|
||||
fgInitView();
|
||||
|
||||
globals->get_controls()->reset_all();
|
||||
|
||||
globals->get_subsystem("time")->reinit();
|
||||
|
|
|
@ -292,6 +292,10 @@ int fgOSMainLoop()
|
|||
|
||||
int fgGetKeyModifiers()
|
||||
{
|
||||
if (!globals->get_renderer()) { // happens during shutdown
|
||||
return 0;
|
||||
}
|
||||
|
||||
return globals->get_renderer()->getEventHandler()->getCurrentModifiers();
|
||||
}
|
||||
|
||||
|
|
|
@ -150,8 +150,8 @@ FGGlobals::FGGlobals() :
|
|||
tacanlist( NULL ),
|
||||
carrierlist( NULL ),
|
||||
channellist( NULL ),
|
||||
airwaynet( NULL ),
|
||||
multiplayer_mgr( NULL )
|
||||
airwaynet( NULL )
|
||||
|
||||
{
|
||||
simgear::ResourceManager::instance()->addProvider(new AircraftResourceProvider());
|
||||
}
|
||||
|
@ -161,6 +161,8 @@ FGGlobals::FGGlobals() :
|
|||
FGGlobals::~FGGlobals()
|
||||
{
|
||||
delete renderer;
|
||||
renderer = NULL;
|
||||
|
||||
// The AIModels manager performs a number of actions upon
|
||||
// Shutdown that implicitly assume that other subsystems
|
||||
// are still operational (Due to the dynamic allocation and
|
||||
|
@ -168,16 +170,11 @@ FGGlobals::~FGGlobals()
|
|||
// shut down all subsystems, make sure we take down the
|
||||
// AIModels system first.
|
||||
subsystem_mgr->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("ai_model");
|
||||
// FGInput (FGInputEvent) and FGDialog calls get_subsystem() in their destructors,
|
||||
// which is not safe since some subsystem are already deleted but can be referred.
|
||||
// So these subsystems must be deleted prior to deleting subsystem_mgr unless
|
||||
// ~SGSubsystemGroup and SGSubsystemMgr::get_subsystem are changed not to refer to
|
||||
// deleted subsystems.
|
||||
subsystem_mgr->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("input");
|
||||
subsystem_mgr->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("gui");
|
||||
|
||||
subsystem_mgr->unbind();
|
||||
delete subsystem_mgr;
|
||||
delete event_mgr;
|
||||
|
||||
delete time_params;
|
||||
delete mag;
|
||||
delete matlib;
|
||||
|
@ -189,7 +186,6 @@ FGGlobals::~FGGlobals()
|
|||
delete viewmgr;
|
||||
|
||||
// delete commands;
|
||||
delete acmodel;
|
||||
delete model_mgr;
|
||||
delete channel_options_list;
|
||||
delete initial_waypoints;
|
||||
|
@ -204,7 +200,6 @@ FGGlobals::~FGGlobals()
|
|||
delete carrierlist;
|
||||
delete channellist;
|
||||
delete airwaynet;
|
||||
delete multiplayer_mgr;
|
||||
|
||||
soundmgr->unbind();
|
||||
delete soundmgr;
|
||||
|
|
|
@ -62,11 +62,9 @@ class FGFlightPlanDispatcher;
|
|||
class FGNavList;
|
||||
class FGAirwayNetwork;
|
||||
class FGTACANList;
|
||||
class FGLight;
|
||||
class FGModelMgr;
|
||||
class FGRouteMgr;
|
||||
class FGScenery;
|
||||
class FGMultiplayMgr;
|
||||
class FGPanel;
|
||||
class FGTileMgr;
|
||||
class FGViewMgr;
|
||||
|
@ -175,9 +173,6 @@ private:
|
|||
FGTACANList *channellist;
|
||||
FGAirwayNetwork *airwaynet;
|
||||
|
||||
//Mulitplayer managers
|
||||
FGMultiplayMgr *multiplayer_mgr;
|
||||
|
||||
/// roots of Aircraft trees
|
||||
string_list fg_aircraft_dirs;
|
||||
public:
|
||||
|
@ -289,13 +284,6 @@ public:
|
|||
model_mgr = mgr;
|
||||
}
|
||||
|
||||
inline FGMultiplayMgr *get_multiplayer_mgr () { return multiplayer_mgr; }
|
||||
|
||||
inline void set_multiplayer_mgr (FGMultiplayMgr * mgr)
|
||||
{
|
||||
multiplayer_mgr = mgr;
|
||||
}
|
||||
|
||||
inline string_list *get_channel_options_list () {
|
||||
return channel_options_list;
|
||||
}
|
||||
|
|
|
@ -132,11 +132,6 @@ static void fgMainLoop( void ) {
|
|||
// compute simulated time (allowing for pause, warp, etc) and
|
||||
// real elapsed time
|
||||
timeMgr->computeTimeDeltas(sim_dt, real_dt);
|
||||
|
||||
if (globals->get_warp_delta() != 0) {
|
||||
FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
|
||||
l->update( 0.5 );
|
||||
}
|
||||
|
||||
// update magvar model
|
||||
globals->get_mag()->update( longitude->getDoubleValue()
|
||||
|
@ -146,11 +141,6 @@ static void fgMainLoop( void ) {
|
|||
altitude->getDoubleValue() * SG_FEET_TO_METER,
|
||||
globals->get_time_params()->getJD() );
|
||||
|
||||
|
||||
// Update any multiplayer's network queues, the AIMultiplayer
|
||||
// implementation is an AI model and depends on that
|
||||
globals->get_multiplayer_mgr()->Update();
|
||||
|
||||
#if ENABLE_ATCDCL
|
||||
// Run ATC subsystem
|
||||
if (fgGetBool("/sim/atc/enabled"))
|
||||
|
@ -158,7 +148,6 @@ static void fgMainLoop( void ) {
|
|||
#endif
|
||||
|
||||
globals->get_subsystem_mgr()->update(sim_dt);
|
||||
globals->get_aircraft_model()->update(sim_dt);
|
||||
|
||||
// run Nasal's settimer() loops right before the view manager
|
||||
globals->get_event_mgr()->update(sim_dt);
|
||||
|
@ -404,9 +393,7 @@ static void fgIdleFunction ( void ) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
FGAircraftModel* acm = new FGAircraftModel;
|
||||
globals->set_aircraft_model(acm);
|
||||
//globals->add_subsystem("aircraft-model", acm);
|
||||
acm->init();
|
||||
acm->bind();
|
||||
globals->add_subsystem("aircraft-model", acm, SGSubsystemMgr::DISPLAY);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Initialize the view manager subsystem.
|
||||
|
|
|
@ -366,7 +366,7 @@ FGMultiplayMgr::~FGMultiplayMgr()
|
|||
// Initialise object
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
bool
|
||||
void
|
||||
FGMultiplayMgr::init (void)
|
||||
{
|
||||
//////////////////////////////////////////////////
|
||||
|
@ -374,7 +374,7 @@ FGMultiplayMgr::init (void)
|
|||
//////////////////////////////////////////////////
|
||||
if (mInitialised) {
|
||||
SG_LOG(SG_NETWORK, SG_WARN, "FGMultiplayMgr::init - already initialised");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
//////////////////////////////////////////////////
|
||||
// Set members from property values
|
||||
|
@ -400,7 +400,7 @@ FGMultiplayMgr::init (void)
|
|||
if (rxPort <= 0) {
|
||||
SG_LOG(SG_NETWORK, SG_DEBUG,
|
||||
"FGMultiplayMgr - No receiver port, Multiplayermode disabled");
|
||||
return (false);
|
||||
return;
|
||||
}
|
||||
if (mCallsign.empty())
|
||||
mCallsign = "JohnDoe"; // FIXME: use getpwuid
|
||||
|
@ -415,17 +415,17 @@ FGMultiplayMgr::init (void)
|
|||
if (!mSocket->open(false)) {
|
||||
SG_LOG( SG_NETWORK, SG_DEBUG,
|
||||
"FGMultiplayMgr::init - Failed to create data socket" );
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
mSocket->setBlocking(false);
|
||||
if (mSocket->bind(rxAddress.c_str(), rxPort) != 0) {
|
||||
perror("bind");
|
||||
SG_LOG( SG_NETWORK, SG_DEBUG,
|
||||
"FGMultiplayMgr::Open - Failed to bind receive socket" );
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
mInitialised = true;
|
||||
return true;
|
||||
} // FGMultiplayMgr::init()
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -711,7 +711,7 @@ FGMultiplayMgr::SendTextMessage(const string &MsgText)
|
|||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
FGMultiplayMgr::Update(void)
|
||||
FGMultiplayMgr::update(double)
|
||||
{
|
||||
if (!mInitialised)
|
||||
return;
|
||||
|
|
|
@ -33,25 +33,20 @@
|
|||
|
||||
#include "mpmessages.hxx"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
using std::string;
|
||||
#include <vector>
|
||||
using std::vector;
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/props/props.hxx>
|
||||
#include <plib/netSocket.h>
|
||||
#include <Main/globals.hxx>
|
||||
#include <simgear/structure/subsystem_mgr.hxx>
|
||||
|
||||
#include <AIModel/AIMultiplayer.hxx>
|
||||
|
||||
struct FGExternalMotionInfo;
|
||||
|
||||
class FGMultiplayMgr
|
||||
class FGMultiplayMgr : public SGSubsystem
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -67,13 +62,15 @@ public:
|
|||
|
||||
FGMultiplayMgr();
|
||||
~FGMultiplayMgr();
|
||||
bool init(void);
|
||||
|
||||
virtual void init(void);
|
||||
virtual void update(double dt);
|
||||
|
||||
void Close(void);
|
||||
// transmitter
|
||||
void SendMyPosition(const FGExternalMotionData& motionInfo);
|
||||
void SendTextMessage(const string &sMsgText);
|
||||
// receiver
|
||||
void Update(void);
|
||||
|
||||
private:
|
||||
union MsgBuf;
|
||||
|
@ -93,7 +90,7 @@ private:
|
|||
netAddress mServer;
|
||||
bool mHaveServer;
|
||||
bool mInitialised;
|
||||
string mCallsign;
|
||||
std::string mCallsign;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -243,7 +243,7 @@ bool FGMultiplay::process() {
|
|||
motionInfo.properties.push_back(pData);
|
||||
}
|
||||
|
||||
FGMultiplayMgr* mpmgr = globals->get_multiplayer_mgr();
|
||||
FGMultiplayMgr* mpmgr = (FGMultiplayMgr*) globals->get_subsystem("mp");
|
||||
mpmgr->SendMyPosition(motionInfo);
|
||||
|
||||
// Now remove the data
|
||||
|
@ -272,7 +272,7 @@ bool FGMultiplay::process() {
|
|||
******************************************************************/
|
||||
bool FGMultiplay::close() {
|
||||
|
||||
FGMultiplayMgr *mgr = globals->get_multiplayer_mgr();
|
||||
FGMultiplayMgr* mgr = (FGMultiplayMgr*) globals->get_subsystem("mp");
|
||||
|
||||
if (mgr == 0) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue