Ejemplo n.º 1
0
void
MessageReader::update(float)
{
  Mission* mission = rMain()->getMission();
  const MessageList& messages = mission->getMessages();
  if(static_cast<int>(messages.size() + 1) == mMessageList->size()) return;

  unsigned oldIndex = mMessageList->getSelected();

  mMessageList->removeAllItems();

  vector<wstring> headingLine;
  headingLine.push_back(L"Date");
  headingLine.push_back(L"From");
  headingLine.push_back(L"Subject");
  mMessageList->addItem(headingLine, false);

  for(MessageList::const_iterator iMessage = messages.begin(); iMessage != messages.end(); ++iMessage) {
    const Message& message = *iMessage;
    vector<wstring> newLine;
    // FIXME: Message times
//     newLine.push_back(message.mTime.getSimulationDateString());
    newLine.push_back(L"fix date");
    newLine.push_back(message.mFrom);
    newLine.push_back(message.mSubject);
    mMessageList->addItem(newLine);
  }

  mMessageList->setSelected(oldIndex);
  if(0 != oldIndex && (oldIndex - 1) < messages.size())
    mMessagePane->setLabel(messages[oldIndex - 1].mBody);
  else
    mMessagePane->setLabel(L"");
}
Ejemplo n.º 2
0
int
mission_is_solvent(LuaState* state)
{
  Mission* mission = rMain()->getMission();
  state->PushBoolean(mission->isSolvent());
  return 1;
}
Ejemplo n.º 3
0
void
MissionSelector::startMission(unsigned num)
{
  Entry missionEntry;
  if(mCurrentCampaign == NULL) {
    // FIXME: we should fall back to station school in case a first timer plays
    missionEntry = mMissions[0];
  }
  else {
    if(num < 0 || num >= static_cast<int>(mCurrentMissions.size())) return;
    mMissionNum = num;
    missionEntry = mCurrentMissions[num];
  }
  
  Mission* oldMission = rMain()->getMission();
  
  Orbit* orbitScreen = static_cast<Orbit*>(rMain()->getScreenManager().getState(Main::ORBIT_SCREEN));
  orbitScreen->enterReadyState();
  
  DataFile* dataFile = new DataFile();
  Mission* mission = new Mission(dataFile);
  dataFile->setRootItem(mission);
  rMain()->setMission(mission);
  mission->initScriptFile(missionEntry.script);
  
  if(oldMission != NULL) {
    if (oldMission == ConfigManager::getPlayer()->getHomeBase()) {
      ConfigManager::getSingleton().savePlayer();
    }
    else {
      delete oldMission->getDataFile();
    }
  }
}
Ejemplo n.º 4
0
Mission* Player::AcceptMission(Mission* pMission)
{
	if ( !pMission )
		return NULL;

	Mission* pMyMission = this->GetMission(pMission->GetID());;
  
  if ( !pMyMission )
  {
    pMyMission = pMission->Clone();
	
	  if ( pMyMission )
	  {
      m_missionLock.LockForWrite();
		  m_mapMissions[ pMyMission->GetID() ] = pMyMission;
		  pMyMission->SetComplete(false);
      if ( pMyMission->GetParentID() != 0 )
      {
        MissionMap::iterator it = m_mapMissions.find( pMyMission->GetParentID() );

        if ( it != m_mapMissions.end() )
        {
          it->second->AddChildMission(pMyMission);
        }
        else
        {
          DYNLOG_ADDLOG( DYNLOG_FORMAT("Player::AcceptMission(): Could not add mission id %ld as a child to mission %ld because parent does not exist in Player %ld object", pMyMission->GetID(), pMyMission->GetParentID(), m_id) );
        }
      }
      m_missionLock.Unlock();
	  }
  }

  return pMyMission;
}
Ejemplo n.º 5
0
void
MissionSelector::loadMission(string fileName)
{
  if(fileName == "") return;

  Mission* oldMission = rMain()->getMission();
  
  Orbit* orbitScreen = static_cast<Orbit*>(rMain()->getScreenManager().getState(Main::ORBIT_SCREEN));
  orbitScreen->enterReadyState();
  
  DataFile* dataFile = new DataFile(stringToWString(fileName));

  if(dataFile->getRootItem() != NULL) {
    Mission* mission = dataFile->getRootItem()->castToClass<Mission>();
    if(mission != NULL) {
      rMain()->setMission(mission);      
  
      if(oldMission != NULL) {
        if (oldMission == ConfigManager::getPlayer()->getHomeBase()) {
          ConfigManager::getSingleton().savePlayer();
        }
        else {
          delete oldMission->getDataFile();
        }
      }
    }
  }
}
void
MsnSelectDlg::OnDel(AWEvent* event)
{
	const char* cname = 0;

	if (cmb_campaigns)
	cname = cmb_campaigns->GetSelectedItem();
	else if (lst_campaigns)
	cname = lst_campaigns->GetSelectedItem();

	Campaign* c = Campaign::SelectCampaign(cname);
	if (!c) return;

	Mission* m = c->GetMission(mission_id);
	if (!m) return;

	ConfirmDlg* confirm = manager->GetConfirmDlg();
	if (confirm) {
		char msg[256];
		sprintf_s(msg, Game::GetText("MsnSelectDlg.are-you-sure").data(), m->Name());
		confirm->SetMessage(msg);
		confirm->SetTitle(Game::GetText("MsnSelectDlg.confirm-delete"));
		confirm->SetParentControl(btn_del);

		manager->ShowConfirmDlg();
	}

	else {
		OnDelConfirm(event);
	}
}
Ejemplo n.º 7
0
/*!
 * Loads a mission.
 * \param n Mission id.
 * \return NULL if Mission could not be loaded.
 */
Mission *MissionManager::loadMission(int n)
{
    LOG(Log::k_FLG_IO, "MissionManager", "loadMission()", ("loading mission %i", n));

    char tmp[100];
    int size;
    
    sprintf(tmp, GAME_PATTERN, n);
    uint8 *data = File::loadOriginalFile(tmp, size);
    if (data == NULL) {
        return NULL;
    }

    Mission *m = new Mission();

    if (!m->loadLevel(data)) {
        delete[] data;
        delete m;
        return NULL;
    }
    delete[] data;

    Map *p_map = g_App.maps().loadMap(m->mapId());
    if (p_map == NULL) {
        delete m;
        return NULL;
    }
    m->set_map(p_map);

    return m;
}
Ejemplo n.º 8
0
int
mission_get_credits(LuaState* state)
{
  Mission* mission = rMain()->getMission();
  state->PushNumber(mission->getCredits());
  return 1;
}
Ejemplo n.º 9
0
void castingCallback_BASEVFF_Freefall(Actor* parent)
{
    Mission* mission = dynamic_cast<Mission*>( parent ); assert( mission );    

    // build forced equipment
    Virtues::Equipment equipment = selectBASEEquipment( 
        mission->getScene()->getCareer(),
        mission->getScene()->getLocation()->getWindAmbient(),
        mission->getScene()->getLocation()->getWindBlast()
    );

    // exit point
    Enclosure* exitPoint = parent->getScene()->getExitPointEnclosure( mission->getMissionInfo()->exitPointId );

    // cast player on exit point
    mission->setPlayer( new Jumper( mission, NULL, exitPoint, NULL, NULL, &equipment ) );

    // setup brief signature for player
    mission->getPlayer()->setSignatureType( stBrief );

    // cast instructor
    new instructor::BASEInstructor02( mission->getPlayer() );
    new GoalStateOfHealth( mission->getPlayer() );
    new GoalStateOfGear( mission->getPlayer() );

    // play no music for this mission
    Gameplay::iGameplay->stopSoundtrack();
}
    virtual bool Run(RobotInfo ri, NavInfo ni, EventFlag evf, RobotCmd& cmd )
	{
		posture_->Run(ri,ni,evf,cmd);
		speed_->Run(ri,ni,evf,cmd);
		cmd.Mode = mode_;
		return true;
    }
Ejemplo n.º 11
0
void Player::OnEvent(IEventSource* pSource, IEvent* pEvent)
{
  string sourceType = (pSource ? pSource->GetType() : "World");
  string eventCode = pEvent->GetCode();
  string eventName = eventCode.substr(eventCode.find('.')+1, eventCode.length());

  DYNLOG_ADDLOG( DYNLOG_FORMAT("Player::OnEvent(): Event [%s] received from source [%s]", eventCode.c_str(), sourceType.c_str()) );

	// check for a Player event
  if ( !sourceType.compare( Player::EVTSYS_ObjectType ) )      // player events
  {
    Player* pPlayer = (Player*)pEvent->GetParam();

    // ensure that we do not handle our own event
    if ( pSource != (IEventSource*)this )
    {
      // handle events
      if ( !eventCode.compare( Player::EVT_LoggedIn ) )
      {
      }
    }
  }
	// check for a mission event
	else if ( !sourceType.compare( Mission::EVTSYS_ObjectType ) )
  {
		Mission* pMission = static_cast<Mission*>(pSource);
    Player* pPlayer = (Player*)pEvent->GetPlayer();
		if ( !eventCode.compare( Mission::EVT_Complete ) )
		{
			DYNLOG_ADDLOG( DYNLOG_FORMAT("Player %s completed mission id %ld (earned %ld XP)", GetName().c_str(), (FCULONG)(pEvent->GetParam()), pMission->GetSuccessXP()) );
			// need to send a message to the client here
      SendMissionComplete((FCULONG) pEvent->GetParam(), pPlayer->GetRouterSocket(), pPlayer->GetClientSocket());
			// Add the xp to the player
			pPlayer->AddXP( pMission->GetSuccessXP() );
		}
	}
  else
  {
    // its not a player event, so it may be related to a mission or something else that happened to us
    bool bHandled = false;

		// check if we have any missions
		if ( m_mapMissions.size() )
		{
			// hand the event off to all the missions we have...
			MissionMap::iterator it = m_mapMissions.begin();
			MissionMap::iterator limit = m_mapMissions.end();

			for ( ; it != limit; it++ )
			{
				it->second->OnEvent(pSource, pEvent);
			}
		}

    // if we didn't handle the event, then log the incident
    if ( !bHandled )
      DYNLOG_ADDLOG( DYNLOG_FORMAT("Player::OnEvent(): Unknown event received [source:%s / event:%s]", sourceType.c_str(), pEvent->GetCode().c_str()) );
  }
}
Ejemplo n.º 12
0
void
MessageReader::itemSelected(Widget*, unsigned num)
{
  Mission* mission = rMain()->getMission();
  const MessageList& messages = mission->getMessages();
  mMessagePane->setLabel(messages[num - 1].mBody);
  mMessageList->setSelected(num);
}
Ejemplo n.º 13
0
// Check whether the NPC and waypoint conditions of the given mission have
// been satisfied.
bool MapPanel::IsSatisfied(const Mission &mission) const
{
	for(const NPC &npc : mission.NPCs())
		if(!npc.HasSucceeded(player.GetSystem()))
			return false;
	
	return mission.Waypoints().empty();
}
Ejemplo n.º 14
0
int
mission_credit_transaction(LuaState* state)
{
  Mission* mission = rMain()->getMission();
  LuaObject lCredits = state->Stack(1);
  if(lCredits.IsNumber() == false) return 0;
  float credits = lCredits.GetFloat();
  mission->creditTransaction(credits);
  return 0;
}
Ejemplo n.º 15
0
void castingCallback_TrollField_JumpFromRun(Actor* parent)
{
    Mission* mission = dynamic_cast<Mission*>( parent ); assert( mission );

    // exit point
    Enclosure* exitPoint = parent->getScene()->getExitPointEnclosure( mission->getMissionInfo()->exitPointId );

    // cast player on exit point
    mission->setPlayer( new Jumper( mission, NULL, exitPoint, NULL, NULL, NULL ) );

    // setup full signature for player
    mission->getPlayer()->setSignatureType( stFull );

    // cast instructor
    new instructor::JumpFromRunInstructor( mission->getPlayer() );

    // cast goals
    new GoalStateOfHealth( mission->getPlayer() );
    new GoalStateOfGear( mission->getPlayer() );
    new GoalLanding( mission->getPlayer() );
    new GoalExperience( mission->getPlayer() );
    
    // play original music for this mission
    Gameplay::iGameplay->playSoundtrack( "./res/sounds/music/dirty_moleculas_action.ogg" );
}
Ejemplo n.º 16
0
void SpaceportPanel::Step()
{
	if(GetUI()->IsTop(this))
	{
		Mission *mission = player.MissionToOffer(Mission::SPACEPORT);
		if(mission)
			mission->Do(Mission::OFFER, player, GetUI());
		else
			player.HandleBlockedMissions(Mission::SPACEPORT, GetUI());
	}
}
void MissionPanel::DrawMissionSystem(const Mission &mission, const Color &color) const
{
	const Color &waypointColor = *GameData::Colors().Get("waypoint back");
	
	Point pos = Zoom() * (mission.Destination()->GetSystem()->Position() + center);
	RingShader::Draw(pos, 22., 20.5, color);
	for(const System *system : mission.Waypoints())
		RingShader::Draw(Zoom() * (system->Position() + center), 22., 20.5, waypointColor);
	for(const Planet *planet : mission.Stopovers())
		RingShader::Draw(Zoom() * (planet->GetSystem()->Position() + center), 22., 20.5, waypointColor);
}
Ejemplo n.º 18
0
int
message_post(LuaState* state)
{
  wstring from = getWString(state, 1);
  wstring subject = getWString(state, 2);
  wstring body = getWString(state, 3);

  Mission* mission = rMain()->getMission();
  mission->postMessage(from, subject, body);
  return 0;
}
Ejemplo n.º 19
0
void
MessageReader::selectNewestMessage()
{
  Mission* mission = rMain()->getMission();
  const MessageList& messages = mission->getMessages();
  if(messages.size() > 0) {
    mMessagePane->setLabel(messages[messages.size() - 1].mBody);
    mMessageList->setSelected(messages.size());
  }
  update(0);
}
Ejemplo n.º 20
0
Mission *MissionManager::loadMission(int n)
{
    Mission *m = new Mission();

    printf("loading mission %i\n", n);

    char tmp[100];
    switch(g_App.menus().currLanguage()) {
        case MenuManager::ENGLISH:
            sprintf(tmp, "miss%02d.dat", n);
            break;
        case MenuManager::FRENCH:
            sprintf(tmp, "miss1%02d.dat", n);
            break;
        case MenuManager::ITALIAN:
            sprintf(tmp, "miss2%02d.dat", n);
            break;
        case MenuManager::GERMAN:
            sprintf(tmp, "miss3%02d.dat", n);
            break;
    }
    int size;
    uint8 *data = File::loadFile(tmp, size);
    if (data == NULL) {
        delete m;
        return NULL;
    }

    if (!m->loadMission(data, size)) {
        delete[] data;
        delete m;
        return NULL;
    }
    delete[] data;

    sprintf(tmp, "game%02d.dat", n);
    data = File::loadFile(tmp, size);
    if (data == NULL) {
        delete m;
        return NULL;
    }

    if (!m->loadLevel(data)) {
        delete[] data;
        delete m;
        return NULL;
    }
    delete[] data;

    missions_[n] = m;
    return m;
}
Ejemplo n.º 21
0
Mission * Mission::create(int id) {
	Mission *pRet = new(std::nothrow) Mission();
	if (pRet && pRet->init(id)) {
		pRet->autorelease();
		return pRet;
	}
	else {
		delete pRet;
		pRet = nullptr;
		return nullptr;
	}
	return nullptr;
}
Ejemplo n.º 22
0
void BriefMenu::handleAction(const int actionId, void *ctx, const int modKeys) {
    Mission *pMission = g_Session.getMission();
    if (actionId == infosButId_) {
        // Buy some informations
        if (g_Session.getSelectedBlock().infoLevel < pMission->getMaxInfoLvl()) {
            g_Session.setMoney(g_Session.getMoney() - pMission->infoCost(g_Session.getSelectedBlock().infoLevel));
            g_Session.getSelectedBlock().infoLevel += 1;
            
            getStatic(txtMoneyId_)->setTextFormated("%d", g_Session.getMoney());
            if (g_Session.getSelectedBlock().infoLevel < pMission->getMaxInfoLvl()) {
                getStatic(txtInfoId_)->setTextFormated("%d",
                    pMission->infoCost(g_Session.getSelectedBlock().infoLevel));
            } else
                getStatic(txtInfoId_)->setText("");
        }

        getOption(nextButId_)->setVisible(true);
    }

    if (actionId == enhButId_) {
        // Buy some map enhancement
        if (g_Session.getSelectedBlock().enhanceLevel < pMission->getMaxEnhanceLvl()) {
            g_Session.setMoney(g_Session.getMoney() - 
                pMission->enhanceCost(g_Session.getSelectedBlock().enhanceLevel));
            g_Session.getSelectedBlock().enhanceLevel += 1;
            
            getStatic(txtMoneyId_)->setTextFormated("%d", g_Session.getMoney());
            if (g_Session.getSelectedBlock().enhanceLevel < pMission->getMaxEnhanceLvl()) {
                getStatic(txtEnhId_)->setTextFormated("%d",
                    pMission->enhanceCost(g_Session.getSelectedBlock().enhanceLevel));
            } else
                getStatic(txtEnhId_)->setText("");
        }
    }

    if (actionId == nextButId_) {
        // Next page
        start_line_ += 14;
        getOption(prevButId_)->setVisible(true);
        needRendering();
    }

    if (actionId == prevButId_) {
        // Previous page
        start_line_ -= 14;

        if (start_line_ <= 0) {
            start_line_ = 0;
            getOption(prevButId_)->setVisible(false);
        }
        getOption(nextButId_)->setVisible(true);
        needRendering();
    }
}
Ejemplo n.º 23
0
void 
BlackBoard::updateMissionAssignments() {
    //Iterator iterator = openMissions.values().iterator();
	hash_map<std::string,vector<Mission*>>::iterator iter = openMissions.begin();

    //while(iterator.hasNext()) {
	while(iter != openMissions.end()){
        vector<Mission*> missions = (vector<Mission*>)iter->second;
        for (unsigned int c=0; c < missions.size(); c++) {
            Mission* mission = (Mission*)missions[c];
            
            //Remove the mission from the blackboard if it is complete.
            if (mission->getMissionComplete()) {
				removeMission(mission);
				//To prevent memory leak
				if(mission!=NULL)
				{
					delete mission;
				}
                continue;
            }
            //System.out.println(time + " Blackboard " + team + ": Assigning " + mission + " - priority " + mission.getPriority());
            //Start granting applications
/*			Application curApp = mission.applications;
            while(curApp!=null && !mission.isFull()) {
                curApp.agent.grantRequest();
                System.out.println("Granting mission to " + curApp.agent);
                mission.addMember(curApp.agent);
                curApp = curApp.nextApplication;
            }
            //Deny the rest.
            while(curApp!=null) {
                curApp.agent.denyRequest();
                curApp = curApp.nextApplication;
            }
*/
            //if the mission is now full, we want to remove it from the blackboard, since
            //the blackboard ONLY contains open missions.
/*            if (mission.isFull()) {
            	missions.removeElement(mission);
            	c--;
            }
            mission.applications = null;
*/        }

		iter++;
    }
}
Ejemplo n.º 24
0
void PlanetPanel::Step()
{
	// If the previous mission callback resulted in a "launch", take off now.
	if(player.ShouldLaunch())
	{
		DoKey('d');
		return;
	}
	if(GetUI()->IsTop(this))
	{
		Mission *mission = player.MissionToOffer(Mission::LANDING);
		if(mission)
			mission->Do(Mission::OFFER, player, GetUI());
		else
			player.HandleBlockedMissions(Mission::LANDING, GetUI());
	}
}
Ejemplo n.º 25
0
/*!
 * This method sets the menu cursor and shows it and
 * updates infos based on mission statistics.
 */
void DebriefMenu::handleShow() {
    g_System.useMenuCursor();
    g_System.showCursor();

    Mission *pMission = g_Session.getMission();
    MissionStats *pStats = pMission->getStatistics();

    // update time
    g_Session.researchManager().addListener(this);
    int elapsed = pStats->mission_duration;
    g_Session.updateTime(elapsed);
    g_Session.researchManager().removeListener(this);

    updateStatsFields(pMission);

    checkNewWeaponFound();
}
Ejemplo n.º 26
0
  //
  // RegisterMission
  //
  // Register the given mission
  //
  const Mission * Group::RegisterMission(const FileIdent &name)
  {
    // Is it already registered
    if (const Mission *existing = FindMission(name))
    {
      return (existing);
    }

    // Create a new mission record
    Mission *mission = new Mission(*this, name);

    // Add to the tree
    missions.Add(mission->GetName().crc, mission);

    // Return the mission
    return (mission);
  }
Ejemplo n.º 27
0
void SendMissionAcceptedResponse(Player* pPlayer, FCULONG mission_id, bool bSuccessFlag, BaseSocket* pRouter, FCSOCKET clientSocket)
{
  PEPacket* pkt = new PEPacket;
  __FCPKT_MISSION_ACCEPT_RESP* d = NULL;
  size_t pktLen = sizeof(__FCPKT_MISSION_ACCEPT_RESP);
  Mission* pMission = NULL, *pChild = NULL;

  if ( (pMission = pPlayer->GetMission(mission_id)) )
  {
    size_t numChildren = pMission->GetChildCount();

    pktLen += (numChildren-1) * sizeof(__FCPKT_MISSION_ACCEPT_RESP::_child_missions);
    if ( (d = (__FCPKT_MISSION_ACCEPT_RESP*) new FCBYTE[pktLen]) )
    {
      d->bSuccessFlag = bSuccessFlag;
      d->mission_id = mission_id;
      d->numChildMissions = (FCULONG)numChildren;
      for ( size_t i = 0; i < numChildren; i++ )
      {
        if ( (pChild = pMission->GetChildMission(i)) )
          d->child_missions[i].mission_id = pChild->GetID();
      }

      // send the packet
      PEPacketHelper::CreatePacket(*pkt, FCPKT_RESPONSE, FCMSG_MISSION_ACCEPT, ST_None);
      PEPacketHelper::SetPacketData(*pkt, 
                                    (void*)d, 
                                    pktLen);

      // send response to Client
      pkt->SetFieldValue("target", (void*)&clientSocket);
      QueuePacket(pkt, pRouter);
    }
    else
    {
      DYNLOG_ADDLOG( "SendMissionAcceptedResponse(): Failed to allocate memory for the packet" );
    }
  }
  else
  {
    DYNLOG_ADDLOG( "SendMissionAcceptedResponse(): Failed to send response because accepted mission was not found in player's mission list" );
  }
}
Ejemplo n.º 28
0
bool
BuildLayer::mouseClickEvent(int buttonID, unsigned clickCount, int x, int y)
{
  if(0 == buttonID && 1 == clickCount && NULL != mStation) {
    if(STATE_ADD == mState) {
      if(MOUSEOVER_PORT == mMouseOver && NULL != mPrototype) {
        Module* target = mPrototype->createModule();
        Matrix portAlignTransform = mPrototype->getTransformAgainstPort(mPort, mMouseOverModule->getPrototype(), mMouseOverPortIndex, mAngle);
        Matrix fullTransform = portAlignTransform * mMouseOverModule->getTransform();
        target->setTransform(fullTransform);
        mStation->addModule(target);
        Mission* mission = mStation->getMission();
        if(mission->getAspects()->isCredits()) {
          mission->creditTransaction(-mPrototype->getSimFloat(SIM_COST_HARDWARE));
        }
        mission->useActionPoint();        
        // --------------------------------------------------------------------------------
        // Profile: Update number of modules added
        //         ConfigManager::getPlayer()->mModulesAdded++;
        return true;    

      }
    }
    else if(STATE_SELECTED == mState && MOUSEOVER_PORT == mMouseOver && NULL != mSelectedModule) {
        Matrix portAlignTransform = mPrototype->getTransformAgainstPort(mPort, mMouseOverModule->getPrototype(), mMouseOverPortIndex, mAngle);
        Matrix fullTransform = portAlignTransform * mMouseOverModule->getTransform();
        mStation->disconnectModule(mSelectedModule);
        mSelectedModule->setTransform(fullTransform);
        mStation->connectModule(mSelectedModule);
        mStation->getMission()->useActionPoint();
        return true;      
    }
    if(MOUSEOVER_BACKGROUND == mMouseOver) {
      setReadyState();
    }
    else if(MOUSEOVER_MODULE == mMouseOver) {
      setSelectedState(mMouseOverModule);
    }
  }
  
  return false;
}
Ejemplo n.º 29
0
void PlanetPanel::Step()
{
	// If the previous mission callback resulted in a "launch", take off now.
	if(player.ShouldLaunch())
	{
		DoKey('d');
		return;
	}
	// If the player starts a new game, exits the shipyard without buying
	// anything, clicks to the bank, then returns to the shipyard and buys a
	// ship, make sure they are shown an intro mission.
	if(GetUI()->IsTop(this) || GetUI()->IsTop(bank.get()))
	{
		Mission *mission = player.MissionToOffer(Mission::LANDING);
		if(mission)
			mission->Do(Mission::OFFER, player, GetUI());
		else
			player.HandleBlockedMissions(Mission::LANDING, GetUI());
	}
}
void castSkybaseJump(Actor* parent, float altitude, CatToy* ghost)
{
    Mission* mission = dynamic_cast<Mission*>( parent ); assert( mission );

    // cast helicopter object
    AirplaneDesc airplaneDesc;
    airplaneDesc.templateClump = parent->getScene()->findClump( "Helicopter01" ); assert( airplaneDesc.templateClump );
    airplaneDesc.propellerFrame = "PropellerSound";
    airplaneDesc.propellerSound = "./res/sounds/aircrafts/helicopter.ogg";
    airplaneDesc.exitPointFrames.push_back( "HelicopterExit01" );
    airplaneDesc.exitPointFrames.push_back( "HelicopterExit02" );
    airplaneDesc.exitPointFrames.push_back( "HelicopterExit03" );
    airplaneDesc.animationSpeed = 0.75f;
    airplaneDesc.initAltitude  = altitude;
    airplaneDesc.lastAltitude  = altitude;
    airplaneDesc.loweringSpeed = 0.0f;
	airplaneDesc.fixedWing = false;
    Airplane* airplane = new Airplane( mission, &airplaneDesc );

    // cast player on airplane
	mission->setPlayer( new Jumper( mission, airplane, NULL, NULL, NULL, NULL ) );
	

    // setup full signature for player
    mission->getPlayer()->setSignatureType( stFull );

    // cast NPC
    if( ghost != NULL ) castSkybaserForGhost( mission, airplane, ghost );

    // cast goals
    new GoalLanding( mission->getPlayer() );
    new GoalStateOfHealth( mission->getPlayer() );
    new GoalStateOfGear( mission->getPlayer() );
    new GoalExperience( mission->getPlayer() );
	new GoalFreeFallTime( mission->getPlayer() );
	new GoalOpening( mission->getPlayer() );
	new GoalCanopyTime( mission->getPlayer() );

    // play original music for this mission
    Gameplay::iGameplay->playSoundtrack( "./res/sounds/music/dirty_moleculas_action.ogg" );
}