int CraftingSessionImplementation::cancelSession() {
	ManagedReference<CraftingTool*> craftingTool = this->craftingTool.get();
	ManagedReference<CreatureObject*> crafter = this->crafter.get();
	ManagedReference<PlayerObject*> crafterGhost = this->crafterGhost.get();
	ManagedReference<CraftingStation*> craftingStation = this->craftingStation.get();

	if(craftingTool != NULL)
		craftingTool->dropActiveSession(SessionFacadeType::CRAFTING);

	if (crafter != NULL) {
		crafter->dropActiveSession(SessionFacadeType::CRAFTING);
		// DPlay9 *****************************
		PlayerObjectDeltaMessage9* dplay9 = new PlayerObjectDeltaMessage9(
				crafter->getPlayerObject());
		dplay9->setCraftingState(0);
		dplay9->close();
		crafter->sendMessage(dplay9);
		// *************************************
	}

	if(crafterGhost != NULL && crafterGhost->getDebug()) {
		crafter->sendSystemMessage("*** Canceling crafting session ***");
	}

	return clearSession();
}
int SlicingSessionImplementation::cancelSession() {
	ManagedReference<CreatureObject*> player = this->player.get();
	ManagedReference<TangibleObject*> tangibleObject = this->tangibleObject.get();
	if (player != NULL) {
		player->dropActiveSession(SessionFacadeType::SLICING);
		player->getPlayerObject()->removeSuiBoxType(SuiWindowType::SLICING_MENU);
	}
	if (tangibleObject != NULL)
		tangibleObject->dropActiveSession(SessionFacadeType::SLICING);
	clearSession();
	return 0;
}
Example #3
0
void MainWindow::saveSession()
{
    clearSession();

    QSettings settings;
    settings.beginWriteArray("Session");
    for (int i = 0; i < ui.editorTabs->count(); i++) {
        settings.setArrayIndex(i);
        settings.setValue("file",ui.editorTabs->tabToolTip(i));
    }
    settings.endArray();
}
int
main (int argc, char **argv)
{
	clearSession();
	
	register SVCXPRT *transp;
	
	pthread_t thread;
	int rc = pthread_create(&thread, NULL, threadTask, (void *) NULL);
	assert(rc == 0);
	
	pmap_unset (IM_MESSENGER, VER);

	transp = svcudp_create(RPC_ANYSOCK);
	if (transp == NULL) {
		fprintf (stderr, "%s", "cannot create udp service.");
		exit(1);
	}
	if (!svc_register(transp, IM_MESSENGER, VER, im_messenger_3, IPPROTO_UDP)) {
		fprintf (stderr, "%s", "unable to register (IM_MESSENGER, VER, udp).");
		exit(1);
	}

	transp = svctcp_create(RPC_ANYSOCK, 0, 0);
	if (transp == NULL) {
		fprintf (stderr, "%s", "cannot create tcp service.");
		exit(1);
	}
	if (!svc_register(transp, IM_MESSENGER, VER, im_messenger_3, IPPROTO_TCP)) {
		fprintf (stderr, "%s", "unable to register (IM_MESSENGER, VER, tcp).");
		exit(1);
	}

	svc_run ();
	fprintf (stderr, "%s", "svc_run returned");
	exit (1);
	/* NOTREACHED */
}
void QmlControlPanel::processAction( ControlPanelActions action,
                                     const QPointF position )
{
    switch( action )
    {
    case OPEN_CONTENT:
        emit openContentPanel( position );
        break;
    case OPEN_APPLICATION:
        emit openApplicationsPanel( position );
        break;
    case NEW_SESSION:
        emit clearSession();
        break;
    case LOAD_SESSION:
        emit openLoadSessionPanel( position );
        break;
    case SAVE_SESSION:
        emit openSaveSessionPanel( position );
        break;
    default:
        break;
    }
}
void CraftingSessionImplementation::selectDraftSchematic(int index) {
	ManagedReference<CreatureObject*> crafter = this->crafter.get();
	ManagedReference<PlayerObject*> crafterGhost = this->crafterGhost.get();
	ManagedReference<CraftingTool*> craftingTool = this->craftingTool.get();

	if (index >= currentSchematicList.size()) {
		crafter->sendSystemMessage("Invalid Schematic Index");
		closeCraftingWindow(1);
		cancelSession();
		return;
	}

	DraftSchematic* draftschematic = currentSchematicList.get(index);

	if (draftschematic == NULL) {
		crafter->sendSystemMessage("@ui_craft:err_no_draft_schematic");
		closeCraftingWindow(1);
		cancelSession();
		return;
	}

	clearSession();

	Locker slocker(_this.get());

	if(crafterGhost != NULL && crafterGhost->getDebug()) {
		crafter->sendSystemMessage("Selected DraftSchematic: " + draftschematic->getCustomName());
	}

	state = 2;

	if (craftingTool != NULL) {
		Locker locker(craftingTool);

		if (createSessionObjects(draftschematic)) {

			if (prototype == NULL) {
				crafter->sendSystemMessage("@ui_craft:err_no_prototype");
				closeCraftingWindow(1);
				cancelSession();
				return;
			}

			// Dplay9 ********************************************************
			// Sets the Crafting state to 2, which is the Resource screen
			PlayerObjectDeltaMessage9* dplay9 = new PlayerObjectDeltaMessage9(
					crafter->getPlayerObject());
			dplay9->setExperimentationPoints(0xFFFFFFFF);
			dplay9->setCraftingState(2);
			dplay9->close();

			crafter->sendMessage(dplay9);
			// End Dplay9 *****************************************************

		} else {
			crafter->sendSystemMessage("This type of object has not yet been implemented");
		}
	} else {
		crafter->sendSystemMessage("@ui_craft:err_no_crafting_tool");
		closeCraftingWindow(1);
		cancelSession();
	}
}