Oolite
Loading...
Searching...
No Matches
PlayerEntity Class Reference

#include <PlayerEntity.h>

+ Inheritance diagram for PlayerEntity:
+ Collaboration diagram for PlayerEntity:

Instance Methods

(void- deferredInit
 
(BOOL- setUpAndConfirmOK:
 
(BOOL- setUpAndConfirmOK:saveGame:
 
(void- completeSetUp
 
(void- completeSetUpAndSetTarget:
 
(void- startUpComplete
 
(NSString *) - commanderName
 
(void- setCommanderName:
 
(NSString *) - lastsaveName
 
(void- setLastsaveName:
 
(BOOL- isDocked
 
(void- warnAboutHostiles
 
(void- unloadCargoPods
 
(void- loadCargoPods
 
(void- unloadAllCargoPodsForType:toManifest:
 
(void- unloadCargoPodsForType:amount:
 
(void- loadCargoPodsForType:fromManifest:
 
(void- loadCargoPodsForType:amount:
 
(OOCommodityMarket *) - shipCommodityData
 
(OOCreditsQuantity- deciCredits
 
(int- random_factor
 
(void- setRandom_factor:
 
(OOGalaxyID- galaxyNumber
 
(NSPoint- galaxy_coordinates
 
(void- setGalaxyCoordinates:
 
(void- setCustomChartCentre:
 
(NSPoint- cursor_coordinates
 
(NSPoint- chart_centre_coordinates
 
(NSPoint- custom_chart_centre_coordinates
 
(OOScalar- chart_zoom
 
(OOScalar- custom_chart_zoom
 
(void- setCustomChartZoom:
 
(NSPoint- adjusted_chart_centre
 
(OORouteType- ANAMode
 
(NSString *) - jumpCause
 
(void- setJumpCause:
 
(OOSystemID- systemID
 
(void- setSystemID:
 
(OOSystemID- targetSystemID
 
(void- setTargetSystemID:
 
(OOSystemID- previousSystemID
 
(void- setPreviousSystemID:
 
(OOSystemID- nextHopTargetSystemID
 
(OOSystemID- infoSystemID
 
(void- setInfoSystemID:moveChart:
 
(void- nextInfoSystem
 
(void- previousInfoSystem
 
(void- homeInfoSystem
 
(void- targetInfoSystem
 
(BOOL- infoSystemOnRoute
 
(NSDictionary *) - commanderDataDictionary
 
(BOOL- setCommanderDataFromDictionary:
 
(void- addEquipmentWithScriptToCustomKeyArray:
 
(void- validateCustomEquipActivationArray
 
(void- doBookkeeping:
 
(BOOL- isValidTarget:
 
(void- setMassLockable:
 
(BOOL- massLockable
 
(BOOL- massLocked
 
(BOOL- atHyperspeed
 
(float- occlusionLevel
 
(void- setOcclusionLevel:
 
(void- setDockedAtMainStation
 
(StationEntity *) - dockedStation
 
(void- setDockedStation:
 
(void- performDockingRequest:
 
(void- requestDockingClearance:
 
(void- cancelDockingRequest:
 
(BOOL- engageAutopilotToStation:
 
(void- disengageAutopilot
 
(void- resetAutopilotAI
 
(void- setTargetDockStationTo:
 
(StationEntity *) - getTargetDockStation
 
(HeadUpDisplay *) - hud
 
(BOOL- switchHudTo:
 
(void- resetHud
 
(float- dialCustomFloat:
 
(NSString *) - dialCustomString:
 
(OOColor *) - dialCustomColor:
 
(void- setDialCustom:forKey:
 
(NSArray *) - multiFunctionDisplayList
 
(NSString *) - multiFunctionText:
 
(void- setMultiFunctionText:forKey:
 
(BOOL- setMultiFunctionDisplay:toKey:
 
(void- cycleNextMultiFunctionDisplay:
 
(void- cyclePreviousMultiFunctionDisplay:
 
(void- selectNextMultiFunctionDisplay
 
(void- selectPreviousMultiFunctionDisplay
 
(NSUInteger- activeMFD
 
(void- setShowDemoShips:
 
(BOOL- showDemoShips
 
(GLfloat- forwardShieldLevel
 
(GLfloat- aftShieldLevel
 
(GLfloat- baseMass
 
(void- setForwardShieldLevel:
 
(void- setAftShieldLevel:
 
(float- forwardShieldRechargeRate
 
(float- aftShieldRechargeRate
 
(void- setMaxForwardShieldLevel:
 
(void- setMaxAftShieldLevel:
 
(void- setForwardShieldRechargeRate:
 
(void- setAftShieldRechargeRate:
 
(NSDictionary *) - keyConfig
 
(BOOL- isMouseControlOn
 
(GLfloat- dialRoll
 
(GLfloat- dialPitch
 
(GLfloat- dialYaw
 
(GLfloat- dialSpeed
 
(GLfloat- dialHyperSpeed
 
(void- currentWeaponStats
 
(GLfloat- dialForwardShield
 
(GLfloat- dialAftShield
 
(GLfloat- dialEnergy
 
(GLfloat- dialMaxEnergy
 
(GLfloat- dialFuel
 
(GLfloat- dialHyperRange
 
(GLfloat- dialAltitude
 
(unsigned- countMissiles
 
(OOMissileStatus- dialMissileStatus
 
(OOFuelScoopStatus- dialFuelScoopStatus
 
(float- fuelLeakRate
 
(void- setFuelLeakRate:
 
(GLfloat- hyperspeedFactor
 
(BOOL- injectorsEngaged
 
(BOOL- hyperspeedEngaged
 
(NSMutableArray *) - customEquipmentActivation
 
(double- clockTime
 
(double- clockTimeAdjusted
 
(BOOL- clockAdjusting
 
(void- addToAdjustTime:
 
(double- escapePodRescueTime
 
(void- setEscapePodRescueTime:
 
(NSString *) - dial_clock
 
(NSString *) - dial_clock_adjusted
 
(NSString *) - dial_fpsinfo
 
(NSString *) - dial_objinfo
 
(NSMutableArray *) - commLog
 
(Entity *) - compassTarget
 
(void- setCompassTarget:
 
(void- validateCompassTarget
 
(NSString *) - compassTargetLabel
 
(OOCompassMode- compassMode
 
(void- setCompassMode:
 
(void- setPrevCompassMode
 
(void- setNextCompassMode
 
(NSUInteger- activeMissile
 
(void- setActiveMissile:
 
(NSUInteger- dialMaxMissiles
 
(BOOL- dialIdentEngaged
 
(void- setDialIdentEngaged:
 
(NSString *) - specialCargo
 
(NSString *) - dialTargetName
 
(ShipEntity *) - missileForPylon:
 
(void- safeAllMissiles
 
(void- selectNextMissile
 
(void- tidyMissilePylons
 
(BOOL- removeFromPylon:
 
(BOOL- assignToActivePylon:
 
(void- clearAlertFlags
 
(int- alertFlags
 
(void- setAlertFlag:to:
 
(OOAlertCondition- alertCondition
 
(OOPlayerFleeingStatus- fleeingStatus
 
(BOOL- mountMissile:
 
(BOOL- mountMissileWithRole:
 
(OOEnergyUnitType- installedEnergyUnitType
 
(OOEnergyUnitType- energyUnitType
 
(ShipEntity *) - launchMine:
 
(BOOL- activateCloakingDevice
 
(void- deactivateCloakingDevice
 
(double- scannerFuzziness
 
(BOOL- weaponsOnline
 
(void- setWeaponsOnline:
 
(BOOL- fireMainWeapon
 
(OOWeaponType- weaponForFacing:
 
(OOWeaponType- currentWeapon
 
(NSArray *) - currentLaserOffset
 
(void- rotateCargo
 
(BOOL- hasSufficientFuelForJump
 
(BOOL- witchJumpChecklist:
 
(void- enterGalacticWitchspace
 
(void- setJumpType:
 
(BOOL- takeInternalDamage
 
(BOOL- endScenario:
 
(NSMutableArray *) - roleWeights
 
(void- addRoleForAggression:
 
(void- addRoleForMining
 
(void- addRoleToPlayer:
 
(void- addRoleToPlayer:inSlot:
 
(void- clearRoleFromPlayer:
 
(void- clearRolesFromPlayer:
 
(NSUInteger- maxPlayerRoles
 
(void- updateSystemMemory
 
(void- loseTargetStatus
 
(void- docked
 
(void- setGuiToStatusScreen
 
(NSArray *) - equipmentList
 
(BOOL- setPrimedEquipment:showMessage:
 
(NSString *) - primedEquipmentName:
 
(NSString *) - currentPrimedEquipment
 
(NSUInteger- primedEquipmentCount
 
(void- activatePrimableEquipment:withMode:
 
(NSString *) - fastEquipmentA
 
(NSString *) - fastEquipmentB
 
(void- setFastEquipmentA:
 
(void- setFastEquipmentB:
 
(OOCreditsQuantity- adjustPriceByScriptForEqKey:withCurrent:
 
(NSArray *) - cargoList
 
(unsigned- legalStatusOfCargoList
 
(void- setGuiToSystemDataScreen
 
(void- setGuiToSystemDataScreenRefreshBackground:
 
(NSDictionary *) - markedDestinations
 
(void- setGuiToLongRangeChartScreen
 
(void- setGuiToShortRangeChartScreen
 
(void- setGuiToChartScreenFrom:
 
(void- setGuiToLoadSaveScreen
 
(void- setGuiToGameOptionsScreen
 
(OOWeaponFacingSet- availableFacings
 
(void- setGuiToEquipShipScreen:selectingFacingFor:
 
(void- setGuiToEquipShipScreen:
 
(void- setGuiToInterfacesScreen:
 
(void- showInformationForSelectedInterface
 
(void- activateSelectedInterface
 
(void- highlightEquipShipScreenKey:
 
(void- showInformationForSelectedUpgrade
 
(void- showInformationForSelectedUpgradeWithFormatString:
 
(BOOL- setWeaponMount:toWeapon:
 
(BOOL- setWeaponMount:toWeapon:inContext:
 
(BOOL- changePassengerBerths:
 
(OOCargoQuantity- cargoQuantityForType:
 
(OOCargoQuantity- setCargoQuantityForType:amount:
 
(void- calculateCurrentCargo
 
(void- setGuiToMarketScreen
 
(void- setGuiToMarketInfoScreen
 
(NSArray *) - applyMarketFilter:onMarket:
 
(NSArray *) - applyMarketSorter:onMarket:
 
(OOCommodityMarket *) - localMarket
 
(void- setupStartScreenGui
 
(void- setGuiToIntroFirstGo:
 
(void- setGuiToOXZManager
 
(void- noteGUIWillChangeTo:
 
(void- noteGUIDidChangeFrom:to:refresh:
 
(void- noteGUIDidChangeFrom:to:
 
(void- noteViewDidChangeFrom:toView:
 
(OOGUIScreenID- guiScreen
 
(void- buySelectedItem
 
(BOOL- tryBuyingCommodity:all:
 
(BOOL- trySellingCommodity:all:
 
(OOSpeechSettings- isSpeechOn
 
(void- addEquipmentFromCollection:
 
(void- getFined
 
(void- adjustTradeInFactorBy:
 
(int- tradeInFactor
 
(double- renovationCosts
 
(double- renovationFactor
 
(void- setDefaultViewOffsets
 
(void- setDefaultCustomViews
 
(Vector- weaponViewOffset
 
(void- setUpTrumbles
 
(void- addTrumble:
 
(void- removeTrumble:
 
(OOTrumble **) - trumbleArray
 
(NSUInteger- trumbleCount
 
(id- trumbleValue
 
(void- setTrumbleValueFrom:
 
(float- trumbleAppetiteAccumulator
 
(void- setTrumbleAppetiteAccumulator:
 
(void- mungChecksumWithNSString:
 
(NSString *) - screenModeStringForWidth:height:refreshRate:
 
(void- suppressTargetLost
 
(void- setScoopsActive
 
(void- clearTargetMemory
 
(NSMutableArray *) - targetMemory
 
(BOOL- moveTargetMemoryBy:
 
(void- printIdentLockedOnForMissile:
 
(void- applyYaw:
 
(Quaternion- customViewQuaternion
 
(void- setCustomViewQuaternion:
 
(OOMatrix- customViewMatrix
 
(Vector- customViewOffset
 
(void- setCustomViewOffset:
 
(Vector- customViewRotationCenter
 
(void- setCustomViewRotationCenter:
 
(void- customViewZoomOut:
 
(void- customViewZoomIn:
 
(void- customViewRotateLeft:
 
(void- customViewRotateRight:
 
(void- customViewRotateUp:
 
(void- customViewRotateDown:
 
(void- customViewRollLeft:
 
(void- customViewRollRight:
 
(void- customViewPanUp:
 
(void- customViewPanDown:
 
(void- customViewPanLeft:
 
(void- customViewPanRight:
 
(Vector- customViewForwardVector
 
(Vector- customViewUpVector
 
(Vector- customViewRightVector
 
(NSString *) - customViewDescription
 
(void- resetCustomView
 
(void- setCustomViewData
 
(void- setCustomViewDataFromDictionary:withScaling:
 
(HPVector- viewpointPosition
 
(HPVector- breakPatternPosition
 
(Vector- viewpointOffset
 
(Vector- viewpointOffsetAft
 
(Vector- viewpointOffsetForward
 
(Vector- viewpointOffsetPort
 
(Vector- viewpointOffsetStarboard
 
(NSDictionary *) - missionOverlayDescriptor
 
(NSDictionary *) - missionOverlayDescriptorOrDefault
 
(void- setMissionOverlayDescriptor:
 
(NSDictionary *) - missionBackgroundDescriptor
 
(NSDictionary *) - missionBackgroundDescriptorOrDefault
 
(void- setMissionBackgroundDescriptor:
 
(OOGUIBackgroundSpecial- missionBackgroundSpecial
 
(void- setMissionBackgroundSpecial:
 
(void- setMissionExitScreen:
 
(OOGUIScreenID- missionExitScreen
 
(void- clearExtraMissionKeys
 
(void- setExtraMissionKeys:
 
(void- clearExtraGuiScreenKeys:key:
 
(BOOL- setExtraGuiScreenKeys:definition:
 
(NSDictionary *) - equipScreenBackgroundDescriptor
 
(void- setEquipScreenBackgroundDescriptor:
 
(BOOL- scriptsLoaded
 
(NSArray *) - worldScriptNames
 
(NSDictionary *) - worldScriptsByName
 
(OOScript *) - commodityScriptNamed:
 
(BOOL- doWorldEventUntilMissionScreen:
 
(void- doWorldScriptEvent:inContext:withArguments:count:timeLimit:
 
(BOOL- showInfoFlag
 
(void- setGalacticHyperspaceBehaviour:
 
(OOGalacticHyperspaceBehaviour- galacticHyperspaceBehaviour
 
(void- setGalacticHyperspaceFixedCoords:
 
(void- setGalacticHyperspaceFixedCoordsX:y:
 
(NSPoint- galacticHyperspaceFixedCoords
 
(void- setWitchspaceCountdown:
 
(OOLongRangeChartMode- longRangeChartMode
 
(void- setLongRangeChartMode:
 
(BOOL- scoopOverride
 
(void- setScoopOverride:
 
(void- setDockTarget:
 
(BOOL- clearedToDock
 
(void- setDockingClearanceStatus:
 
(OODockingClearanceStatus- getDockingClearanceStatus
 
(void- penaltyForUnauthorizedDocking
 
(NSArray *) - scannedWormholes
 
(WormholeEntity *) - wormhole
 
(void- setWormhole:
 
(void- addScannedWormhole:
 
(void- initialiseMissionDestinations:andLegacy:
 
(NSString *) - markerKey:
 
(void- addMissionDestinationMarker:
 
(BOOL- removeMissionDestinationMarker:
 
(NSMutableDictionary *) - getMissionDestinations
 
(NSMutableDictionary *) - shipyardRecord
 
(void- setLastShot:
 
(void- showShipModelWithKey:shipData:personality:factorX:factorY:factorZ:inContext:
 
(void- doGuiScreenResizeUpdates
 
(GLfloat- insideAtmosphereFraction
 
(void- setName: [implementation]
 
(void- createCargoPodWithType:andAmount: [implementation]
 
(id- init [implementation]
 
(BOOL- setUpShipFromDictionary: [implementation]
 
(void- dealloc [implementation]
 
(NSUInteger- sessionID [implementation]
 
(BOOL- canCollide [implementation]
 
(NSComparisonResult- compareZeroDistance: [implementation]
 
(BOOL- validForAddToUniverse [implementation]
 
(GLfloat- lookingAtSunWithThresholdAngleCos: [implementation]
 
(void- update: [implementation]
 
(void- updateMovementFlags [implementation]
 
(void- updateAlertConditionForNearbyEntities [implementation]
 
(void- setMaxFlightPitch: [implementation]
 
(void- setMaxFlightRoll: [implementation]
 
(void- setMaxFlightYaw: [implementation]
 
(BOOL- checkEntityForMassLock:withScanClass: [implementation]
 
(void- updateAlertCondition [implementation]
 
(void- updateFuelScoops: [implementation]
 
(void- updateClocks: [implementation]
 
(void- checkScriptsIfAppropriate [implementation]
 
(void- updateTrumbles: [implementation]
 
(void- performAutopilotUpdates: [implementation]
 
(void- performInFlightUpdates: [implementation]
 
(void- performWitchspaceCountdownUpdates: [implementation]
 
(void- performWitchspaceExitUpdates: [implementation]
 
(void- performLaunchingUpdates: [implementation]
 
(void- performDockingUpdates: [implementation]
 
(void- performDeadUpdates: [implementation]
 
(void- gameOverFadeToBW [implementation]
 
(void- showGameOver [implementation]
 
(void- updateTargeting [implementation]
 
(void- orientationChanged [implementation]
 
(void- applyAttitudeChanges: [implementation]
 
(void- applyRoll:andClimb: [implementation]
 
(OOMatrix- drawRotationMatrix [implementation]
 
(OOMatrix- drawTransformationMatrix [implementation]
 
(Quaternion- normalOrientation [implementation]
 
(void- setNormalOrientation: [implementation]
 
(void- moveForward: [implementation]
 
(void- drawImmediate:translucent: [implementation]
 
(float- maxForwardShieldLevel [implementation]
 
(float- maxAftShieldLevel [implementation]
 
(GLfloat- laserHeatLevel [implementation]
 
(GLfloat- laserHeatLevelAft [implementation]
 
(GLfloat- laserHeatLevelForward [implementation]
 
(GLfloat- laserHeatLevelPort [implementation]
 
(GLfloat- laserHeatLevelStarboard [implementation]
 
(BOOL- canScoop: [implementation]
 
(OOAlertCondition- realAlertCondition [implementation]
 
(void- interpretAIMessage: [implementation]
 
(ShipEntity *) - fireMissile [implementation]
 
(void- noticeECM [implementation]
 
(BOOL- fireECM [implementation]
 
(GLfloat- doesHitLine:v0:v1: [implementation]
 
(void- takeEnergyDamage:from:becauseOf:weaponIdentifier: [implementation]
 
(void- takeScrapeDamage:from: [implementation]
 
(void- takeHeatDamage: [implementation]
 
(ProxyPlayerEntity *) - createDoppelganger [implementation]
 
(ShipEntity *) - launchEscapeCapsule [implementation]
 
(OOCommodityType- dumpCargo [implementation]
 
(void- setBounty: [implementation]
 
(void- setBounty:withReason: [implementation]
 
(void- setBounty:withReasonAsString: [implementation]
 
(OOCreditsQuantity- bounty [implementation]
 
(void- markAsOffender: [implementation]
 
(void- markAsOffender:withReason: [implementation]
 
(void- collectBountyFor: [implementation]
 
(void- getDestroyedBy:damageType: [implementation]
 
(void- enterDock: [implementation]
 
(void- leaveDock: [implementation]
 
(void- witchStart [implementation]
 
(void- witchEnd [implementation]
 
(double- hyperspaceJumpDistance [implementation]
 
(OOFuelQuantity- fuelRequiredForJump [implementation]
 
(void- noteCompassLostTarget [implementation]
 
(void- enterWormhole: [implementation]
 
(void- enterWitchspace [implementation]
 
(void- witchJumpTo:misjump: [implementation]
 
(void- leaveWitchspace [implementation]
 
(OOEquipmentType *) - weaponTypeForFacing:strict: [implementation]
 
(NSArray *) - missilesList [implementation]
 
(NSArray *) - cargoListForScripting [implementation]
 
(NSArray *) - contractsListForScriptingFromArray:forCargo: [implementation]
 
(NSArray *) - passengerListForScripting [implementation]
 
(NSArray *) - parcelListForScripting [implementation]
 
(NSArray *) - contractListForScripting [implementation]
 
(void- prepareMarkedDestination:markers: [implementation]
 
(BOOL- tryBuyingItem: [implementation]
 
(OOCreditsQuantity- removeMissiles [implementation]
 
(void- doTradeIn:forPriceFactor: [implementation]
 
(OOCargoQuantity- cargoQuantityOnBoard [implementation]
 
(void- showMarketScreenHeaders [implementation]
 
(void- showMarketScreenDataLine:forGood:inMarket:holdQuantity: [implementation]
 
(NSString *) - marketScreenTitle [implementation]
 
(void- showMarketCashAndLoadLine [implementation]
 
(BOOL- isMining [implementation]
 
(BOOL- canAddEquipment:inContext: [implementation]
 
(BOOL- addEquipmentItem:inContext: [implementation]
 
(BOOL- addEquipmentItem:withValidation:inContext: [implementation]
 
(void- removeEquipmentItem: [implementation]
 
(BOOL- hasOneEquipmentItem:includeMissiles: [implementation]
 
(BOOL- hasPrimaryWeapon: [implementation]
 
(BOOL- removeExternalStore: [implementation]
 
(NSUInteger- parcelCount [implementation]
 
(NSUInteger- passengerCount [implementation]
 
(NSUInteger- passengerCapacity [implementation]
 
(BOOL- hasHostileTarget [implementation]
 
(void- receiveCommsMessage:from: [implementation]
 
(void- setFoundTarget: [implementation]
 
(void- addTarget: [implementation]
 
(void- doScriptEvent:inContext:withArguments:count: [implementation]
 
(void- updateWormholes [implementation]
 
(void- dumpSelfState [implementation]
 
(BOOL- suppressClangStuff [implementation]
 
(NSString *) - processEscapePods
 
(NSString *) - checkPassengerContracts
 
(int- passengerReputation
 
(void- increasePassengerReputation:
 
(void- decreasePassengerReputation:
 
(int- parcelReputation
 
(void- increaseParcelReputation:
 
(void- decreaseParcelReputation:
 
(int- contractReputation
 
(void- increaseContractReputation:
 
(void- decreaseContractReputation:
 
(OOCargoQuantity- contractedVolumeForGood:
 
(void- erodeReputation
 
(void- normaliseReputation
 
(void- addMessageToReport:
 
(BOOL- addPassenger:start:destination:eta:fee:advance:risk:
 
(BOOL- removePassenger:
 
(BOOL- addParcel:start:destination:eta:fee:premium:risk:
 
(BOOL- removeParcel:
 
(BOOL- awardContract:commodity:start:destination:eta:fee:premium:
 
(BOOL- removeContract:destination:
 
(NSArray *) - passengerList
 
(NSArray *) - parcelList
 
(NSArray *) - contractList
 
(void- setGuiToManifestScreen
 
(void- setManifestScreenRow:inColor:forRow:ofRows:andOffset:inMultipage:
 
(void- setGuiToDockingReportScreen
 
(void- setGuiToShipyardScreen:
 
(void- showShipyardModel:shipData:personality:
 
(void- showShipyardInfoForSelection
 
(NSInteger- missingSubEntitiesAdjustment
 
(void- showTradeInInformationFooter
 
(OOCreditsQuantity- priceForShipKey:
 
(BOOL- buySelectedShip
 
(BOOL- replaceShipWithNamedShip:
 
(void- newShipCommonSetup:yardInfo:baseInfo:
 
(NSArray *) - contractsListFromArray:forCargo:forParcels: [implementation]
 
(OOCreditsQuantity- tradeInValue [implementation]
 
(void- initControls
 
(void- initKeyConfigSettings
 
(void- pollControls:
 
(BOOL- handleGUIUpDownArrowKeys
 
(void- clearPlanetSearchString
 
(void- targetNewSystem:
 
(void- switchToMainView
 
(void- noteSwitchToView:fromView:
 
(void- beginWitchspaceCountdown:
 
(void- beginWitchspaceCountdown
 
(void- cancelWitchspaceCountdown
 
(NSArray *) - processKeyCode:
 
(BOOL- checkNavKeyPress:
 
(BOOL- checkKeyPress:
 
(BOOL- checkKeyPress:fKey_only:
 
(BOOL- checkKeyPress:ignore_ctrl:
 
(BOOL- checkKeyPress:fKey_only:ignore_ctrl:
 
(int- getFirstKeyCode:
 
(void- targetNewSystem:whileTyping: [implementation]
 
(void- resetKeyFunctions
 
(void- initCheckingDictionary
 
(void- setGuiToKeyMapperScreen:resetCurrentRow:
 
(void- setGuiToKeyMapperScreen:
 
(void- keyMapperInputHandler:view:
 
(void- setGuiToKeyConfigScreen
 
(void- setGuiToKeyConfigScreen:
 
(void- handleKeyConfigKeys:view:
 
(void- outputKeyDefinition:shift:mod1:mod2:skiprows:
 
(void- setGuiToKeyConfigEntryScreen
 
(void- handleKeyConfigEntryKeys:view:
 
(void- setGuiToConfirmClearScreen
 
(void- handleKeyMapperConfirmClearKeys:view:
 
(void- setGuiToKeyboardLayoutScreen:
 
(void- setGuiToKeyboardLayoutScreen:resetCurrentRow:
 
(void- handleKeyboardLayoutEntryKeys:view:
 
(NSString *) - validateKey:checkKeys:
 
(NSDictionary *) - makeKeyGuiDict:keyDef:
 
(NSDictionary *) - makeKeyGuiDictHeader:
 
(BOOL- entryIsIndexCustomEquip: [implementation]
 
(BOOL- entryIsDictCustomEquip: [implementation]
 
(BOOL- entryIsCustomEquip: [implementation]
 
(NSArray *) - getCustomEquipArray: [implementation]
 
(NSUInteger- getCustomEquipIndex: [implementation]
 
(NSString *) - getCustomEquipKeyDefType: [implementation]
 
(void- updateKeyDefinition:index: [implementation]
 
(void- updateShiftKeyDefinition:index: [implementation]
 
(void- displayKeyFunctionList:skip: [implementation]
 
(NSArray *) - keyFunctionList [implementation]
 
(NSString *) - keyboardDescription: [implementation]
 
(NSArray *) - keyboardLayoutList [implementation]
 
(void- displayKeyboardLayoutList:skip: [implementation]
 
(NSArray *) - validateAllKeys [implementation]
 
(NSString *) - searchArrayForMatch:key:checkKeys: [implementation]
 
(BOOL- entryIsEqualToDefault: [implementation]
 
(BOOL- compareKeyEntries:second: [implementation]
 
(void- saveKeySetting: [implementation]
 
(void- unsetKeySetting: [implementation]
 
(void- deleteKeySetting: [implementation]
 
(void- deleteAllKeySettings [implementation]
 
(NSDictionary *) - loadKeySettings [implementation]
 
(void- reloadPage [implementation]
 
(BOOL- loadPlayer
 
(void- savePlayer
 
(void- quicksavePlayer
 
(void- autosavePlayer
 
(void- setGuiToScenarioScreen:
 
(void- addScenarioModel:
 
(void- showScenarioDetails
 
(BOOL- startScenario
 
(NSString *) - commanderSelector
 
(void- saveCommanderInputHandler
 
(void- overwriteCommanderInputHandler
 
(BOOL- loadPlayerFromFile:asNew:
 
(void- pollFlightControls: [implementation]
 
(void- pollFlightArrowKeyControls: [implementation]
 
(void- pollGuiArrowKeyControls: [implementation]
 
(void- handleGameOptionsScreenKeys [implementation]
 
(void- handleKeyMapperScreenKeys [implementation]
 
(void- handleKeyboardLayoutKeys [implementation]
 
(void- handleStickMapperScreenKeys [implementation]
 
(void- pollApplicationControls [implementation]
 
(void- pollCustomViewControls [implementation]
 
(void- pollViewControls [implementation]
 
(void- pollGuiScreenControls [implementation]
 
(void- pollGuiScreenControlsWithFKeyAlias: [implementation]
 
(void- pollMarketScreenControls [implementation]
 
(void- handleUndockControl [implementation]
 
(void- pollGameOverControls: [implementation]
 
(void- pollAutopilotControls: [implementation]
 
(void- pollDockedControls: [implementation]
 
(void- pollDemoControls: [implementation]
 
(void- pollMissionInterruptControls [implementation]
 
(void- handleMissionCallback [implementation]
 
(void- setGuiToMissionEndScreen [implementation]
 
(void- switchToThisView: [implementation]
 
(void- switchToThisView:andProcessWeaponFacing: [implementation]
 
(void- switchToThisView:fromView:andProcessWeaponFacing:justNotify: [implementation]
 
(void- handleAutopilotOn: [implementation]
 
(void- handleButtonIdent [implementation]
 
(void- handleButtonTargetMissile [implementation]
 
(void- setJSSelf:context:
 
(NSString *) - oo_jsClassName [implementation]
 
(void- javaScriptEngineWillReset: [implementation]
 
(void- setGuiToLoadCommanderScreen [implementation]
 
(void- setGuiToSaveCommanderScreen: [implementation]
 
(void- setGuiToOverwriteScreen: [implementation]
 
(void- lsCommanders:directory:pageNumber:highlightName: [implementation]
 
(void- showCommanderShip: [implementation]
 
(int- findIndexOfCommander: [implementation]
 
(void- nativeSavePlayer: [implementation]
 
(BOOL- existingNativeSave: [implementation]
 
(void- writePlayerToPath: [implementation]
 
(NSComparisonResult- sortCommanders [implementation]
 
(void- setExtraEquipmentFromFlags [implementation]
 
(BOOL- isPlayerLikeShip [implementation]
 
(void- checkScript
 
(void- setScriptTarget:
 
(ShipEntity *) - scriptTarget
 
(void- runScriptActions:withContextName:forTarget:
 
(void- runUnsanitizedScriptActions:allowingAIMethods:withContextName:forTarget:
 
(BOOL- scriptTestConditions:
 
(NSDictionary *) - missionVariables
 
(NSString *) - missionVariableForKey:
 
(void- setMissionVariable:forKey:
 
(NSMutableDictionary *) - localVariablesForMission:
 
(NSString *) - localVariableForKey:andMission:
 
(void- setLocalVariable:forKey:andMission:
 
(NSString *) - mission_string
 
(NSString *) - status_string
 
(NSString *) - gui_screen_string
 
(NSNumber *) - planet_number
 
(NSNumber *) - score_number
 
(NSNumber *) - credits_number
 
(NSNumber *) - scriptTimer_number
 
(NSNumber *) - shipsFound_number
 
(NSNumber *) - d100_number
 
(NSNumber *) - pseudoFixedD100_number
 
(NSNumber *) - d256_number
 
(NSNumber *) - pseudoFixedD256_number
 
(NSNumber *) - clock_number
 
(NSNumber *) - clock_secs_number
 
(NSNumber *) - clock_mins_number
 
(NSNumber *) - clock_hours_number
 
(NSNumber *) - clock_days_number
 
(NSNumber *) - fuelLevel_number
 
(NSString *) - dockedAtMainStation_bool
 
(NSString *) - foundEquipment_bool
 
(NSString *) - sunWillGoNova_bool
 
(NSString *) - sunGoneNova_bool
 
(NSString *) - missionChoice_string
 
(NSString *) - missionKeyPress_string
 
(NSNumber *) - dockedTechLevel_number
 
(NSString *) - dockedStationName_string
 
(NSNumber *) - systemGovernment_number
 
(NSString *) - systemGovernment_string
 
(NSNumber *) - systemEconomy_number
 
(NSString *) - systemEconomy_string
 
(NSNumber *) - systemTechLevel_number
 
(NSNumber *) - systemPopulation_number
 
(NSNumber *) - systemProductivity_number
 
(NSString *) - commanderName_string
 
(NSString *) - commanderRank_string
 
(NSString *) - commanderShip_string
 
(NSString *) - commanderShipDisplayName_string
 
(NSString *) - commanderLegalStatus_string
 
(NSNumber *) - commanderLegalStatus_number
 
(NSArray *) - missionsList
 
(void- setMissionDescription:
 
(void- clearMissionDescription
 
(void- setMissionInstructions:forMission:
 
(void- setMissionInstructionsList:forMission:
 
(void- setMissionDescription:forMission:
 
(void- clearMissionDescriptionForMission:
 
(void- commsMessage:
 
(void- commsMessageByUnpiloted:
 
(void- consoleMessage3s:
 
(void- consoleMessage6s:
 
(void- setLegalStatus:
 
(void- awardCredits:
 
(void- awardShipKills:
 
(void- awardEquipment:
 
(void- removeEquipment:
 
(void- setPlanetinfo:
 
(void- setSpecificPlanetInfo:
 
(void- awardCargo:
 
(void- removeAllCargo
 
(void- removeAllCargo:
 
(void- useSpecialCargo:
 
(void- testForEquipment:
 
(void- awardFuel:
 
(void- messageShipAIs:
 
(void- ejectItem:
 
(void- addShips:
 
(void- addSystemShips:
 
(void- addShipsAt:
 
(void- addShipsAtPrecisely:
 
(void- addShipsWithinRadius:
 
(void- spawnShip:
 
(void- set:
 
(void- reset:
 
(void- increment:
 
(void- decrement:
 
(void- add:
 
(void- subtract:
 
(void- checkForShips:
 
(void- resetScriptTimer
 
(void- addMissionText:
 
(void- addLiteralMissionText:
 
(void- setMissionChoiceByTextEntry:
 
(void- setMissionChoices:
 
(void- setMissionChoicesDictionary:
 
(void- resetMissionChoice
 
(void- clearMissionScreen
 
(void- addMissionDestination:
 
(void- removeMissionDestination:
 
(void- showShipModel:
 
(void- setMissionMusic:
 
(NSString *) - missionTitle
 
(void- setMissionTitle:
 
(void- setFuelLeak:
 
(NSNumber *) - fuelLeakRate_number
 
(void- setSunNovaIn:
 
(void- launchFromStation
 
(void- blowUpStation
 
(void- sendAllShipsAway
 
(OOPlanetEntity *) - addPlanet:
 
(OOPlanetEntity *) - addMoon:
 
(void- debugOn
 
(void- debugOff
 
(void- debugMessage:
 
(NSString *) - replaceVariablesInString:
 
(void- playSound:
 
(BOOL- addEqScriptForKey:
 
(void- removeEqScriptForKey:
 
(NSUInteger- eqScriptIndexForKey:
 
(void- targetNearestHostile
 
(void- targetNearestIncomingMissile
 
(void- setGalacticHyperspaceBehaviourTo:
 
(void- setGalacticHyperspaceFixedCoordsTo:
 
(void- clearMissionScreenID
 
(void- setMissionScreenID:
 
(NSString *) - missionScreenID
 
(void- setGuiToMissionScreen
 
(void- refreshMissionScreenTextEntry
 
(void- setGuiToMissionScreenWithCallback:
 
(void- doMissionCallback
 
(void- endMissionScreenAndNoteOpportunity
 
(void- setBackgroundFromDescriptionsKey:
 
(void- addScene:atOffset:
 
(BOOL- processSceneDictionary:atOffset:
 
(BOOL- processSceneString:atOffset:
 
(OOINLINE NSString *) - CurrentScriptDesc(void) [implementation]
 
(OOINLINE OOEntityStatus- RecursiveRemapStatus [implementation]
 
(BOOL- scriptTestCondition: [implementation]
 
(NSString *) - expandScriptRightHandSide: [implementation]
 
(NSString *) - expandMessage: [implementation]
 
(void- setMissionImage: [implementation]
 
(void- setMissionBackground: [implementation]
 
(void- scriptActions:forTarget:missionKey: [implementation]
 
(unsigned- score
 
(void- setScore:
 
(double- creditBalance
 
(void- setCreditBalance:
 
(NSString *) - dockedStationName
 
(NSString *) - dockedStationDisplayName
 
(BOOL- dockedAtMainStation
 
(void- awardCommodityType:amount:
 
(void- resetScannerZoom
 
(OOGalaxyID- currentGalaxyID
 
(OOSystemID- currentSystemID
 
(void- setMissionChoice:
 
(void- setMissionChoice:withEvent:
 
(void- setMissionChoice:keyPress:
 
(void- setMissionChoice:keyPress:withEvent:
 
(void- allowMissionInterrupt
 
(OOTimeDelta- scriptTimer
 
(unsigned- systemPseudoRandom100
 
(unsigned- systemPseudoRandom256
 
(double- systemPseudoRandomFloat
 
(NSDictionary *) - passengerContractMarker:
 
(NSDictionary *) - parcelContractMarker:
 
(NSDictionary *) - cargoContractMarker:
 
(NSDictionary *) - defaultMarker:
 
(NSDictionary *) - validatedMarker:
 
(NSString *) - keyBindingDescription2:
 
(NSString *) - getKeyBindingDescription:
 
(NSString *) - keyCodeDescription:
 
(NSString *) - keyCodeDescriptionShort:
 
(NSString *) - commanderKillsAsString
 
(NSString *) - commanderBountyAsString
 
(NSString *) - creditsFormattedForSubstitution
 
(NSString *) - creditsFormattedForLegacySubstitution
 
(void- setUpSound
 
(void- setUpWeaponSounds
 
(void- destroySound
 
(BOOL- isBeeping
 
(void- playIdentOn
 
(void- playIdentOff
 
(void- playIdentLockedOn
 
(void- playMissileArmed
 
(void- playMineArmed
 
(void- playMissileSafe
 
(void- playMissileLockedOn
 
(void- playWeaponsOnline
 
(void- playWeaponsOffline
 
(void- playNextEquipmentSelected
 
(void- playNextMissileSelected
 
(void- playCargoJettisioned
 
(void- playAutopilotOn
 
(void- playAutopilotOff
 
(void- playAutopilotOutOfRange
 
(void- playAutopilotCannotDockWithTarget
 
(void- playSaveOverwriteYes
 
(void- playSaveOverwriteNo
 
(void- playHoldFull
 
(void- playJumpMassLocked
 
(void- playTargetLost
 
(void- playNoTargetInMemory
 
(void- playTargetSwitched
 
(void- playCloakingDeviceOn
 
(void- playCloakingDeviceOff
 
(void- playCloakingDeviceInsufficientEnergy
 
(void- playMenuNavigationUp
 
(void- playMenuNavigationDown
 
(void- playMenuNavigationNot
 
(void- playMenuPagePrevious
 
(void- playMenuPageNext
 
(void- playDismissedReportScreen
 
(void- playDismissedMissionScreen
 
(void- playChangedOption
 
(void- updateFuelScoopSoundWithInterval:
 
(void- startAfterburnerSound
 
(void- stopAfterburnerSound
 
(void- playBuyCommodity
 
(void- playBuyShip
 
(void- playSellCommodity
 
(void- playCantBuyCommodity
 
(void- playCantSellCommodity
 
(void- playCantBuyShip
 
(void- playHyperspaceNoTarget
 
(void- playHyperspaceNoFuel
 
(void- playHyperspaceBlocked
 
(void- playHyperspaceDistanceTooGreat
 
(void- playStandardHyperspace
 
(void- playGalacticHyperspace
 
(void- playHyperspaceAborted
 
(void- playHitByECMSound
 
(void- playFiredECMSound
 
(void- playLaunchFromStation
 
(void- playDockWithStation
 
(void- playExitWitchspace
 
(void- playHostileWarning
 
(void- playAlertConditionRed
 
(void- playIncomingMissile:
 
(void- playEnergyLow
 
(void- playDockingDenied
 
(void- playWitchjumpFailure
 
(void- playWitchjumpMisjump
 
(void- playWitchjumpBlocked
 
(void- playWitchjumpDistanceTooGreat
 
(void- playWitchjumpInsufficientFuel
 
(void- playFuelLeak
 
(void- playShieldHit:weaponIdentifier:
 
(void- playDirectHit:weaponIdentifier:
 
(void- playScrapeDamage:
 
(void- playLaserHit:offset:weaponIdentifier:
 
(void- playWeaponOverheated:
 
(void- playMissileLaunched:weaponIdentifier:
 
(void- playMineLaunched:weaponIdentifier:
 
(void- playEscapePodScooped
 
(void- playAegisCloseToPlanet
 
(void- playAegisCloseToStation
 
(void- playGameOver
 
(void- playLegacyScriptSound:
 
(void- playInterfaceBeep: [implementation]
 
(void- boop [implementation]
 
(void- updateAfterburnerSound [implementation]
 
(void- resetStickFunctions
 
(void- setGuiToStickMapperScreen:resetCurrentRow:
 
(void- setGuiToStickMapperScreen:
 
(void- stickMapperInputHandler:view:
 
(void- updateFunction:
 
(NSDictionary *) - makeStickGuiDictHeader:
 
(NSDictionary *) - makeStickGuiDict:allowable:axisfn:butfn:
 
(void- checkCustomEquipButtons:ignore: [implementation]
 
(void- removeFunction: [implementation]
 
(void- displayFunctionList:skip: [implementation]
 
(NSString *) - describeStickDict: [implementation]
 
(NSString *) - hwToString: [implementation]
 
(NSArray *) - stickFunctionList [implementation]
 
(void- setGuiToStickProfileScreen:
 
(void- stickProfileInputHandler:view:
 
(void- stickProfileGraphAxisProfile:screenAt:screenSize:
 
- Instance Methods inherited from ShipEntity
(void) - setStateMachine:
 
(void) - setAI:
 
(AI *) - getAI
 
(BOOL) - hasAutoAI
 
(BOOL) - hasNewAI
 
(void) - setShipScript:
 
(void) - removeScript
 
(OOScript *) - shipScript
 
(OOScript *) - shipAIScript
 
(OOTimeAbsolute- shipAIScriptWakeTime
 
(void) - setAIScriptWakeTime:
 
(double) - frustration
 
(void) - setLaunchDelay:
 
(GLfloat) - accuracy
 
(void) - setAccuracy:
 
(OOMesh *) - mesh
 
(void) - setMesh:
 
(BoundingBox) - totalBoundingBox
 
(Vector) - forwardVector
 
(Vector) - upVector
 
(Vector) - rightVector
 
(NSArray *) - subEntities
 
(NSUInteger) - subEntityCount
 
(BOOL) - hasSubEntity:
 
(NSEnumerator *) - subEntityEnumerator
 
(NSEnumerator *) - shipSubEntityEnumerator
 
(NSEnumerator *) - flasherEnumerator
 
(NSEnumerator *) - exhaustEnumerator
 
(ShipEntity *) - subEntityTakingDamage
 
(void) - setSubEntityTakingDamage:
 
(void) - clearSubEntities
 
(Quaternion) - subEntityRotationalVelocity
 
(void) - setSubEntityRotationalVelocity:
 
(NSString *) - serializeShipSubEntities
 
(void) - deserializeShipSubEntitiesFrom:
 
(NSUInteger) - maxShipSubEntities
 
(void) - setSubIdx:
 
(NSUInteger) - subIdx
 
(Octree *) - octree
 
(float) - volume
 
(GLfloat) - doesHitLine:v0:
 
(GLfloat) - doesHitLine:v0:withPosition:andIJK:i:j:
 
(BoundingBox) - findBoundingBoxRelativeToPosition:InVectors:i:j:
 
(HPVector) - absoluteTractorPosition
 
(void) - setIsBoulder:
 
(BOOL) - isBoulder
 
(BOOL) - isMinable
 
(BOOL) - countsAsKill
 
(void) - setUpEscorts
 
(void) - updateEscortFormation
 
(id) - initWithKey:definition:
 
(BOOL) - setUpFromDictionary:
 
(BOOL) - setUpSubEntities
 
(BOOL) - setUpOneStandardSubentity:asTurret:
 
(GLfloat) - frustumRadius
 
(NSString *) - shipDataKey
 
(NSString *) - shipDataKeyAutoRole
 
(void) - setShipDataKey:
 
(NSDictionary *) - shipInfoDictionary
 
(NSArray *) - getWeaponOffsetFrom:withKey:inMode:
 
(NSArray *) - aftWeaponOffset
 
(NSArray *) - forwardWeaponOffset
 
(NSArray *) - portWeaponOffset
 
(NSArray *) - starboardWeaponOffset
 
(BOOL) - hasAutoWeapons
 
(BOOL) - isFrangible
 
(BOOL) - suppressFlightNotifications
 
(void) - respondToAttackFrom:becauseOf:
 
(OOWeaponFacingSet- weaponFacings
 
(BOOL) - hasEquipmentItem:includeWeapons:whileLoading:
 
(BOOL) - hasEquipmentItem:
 
(NSUInteger) - countEquipmentItem:
 
(NSString *) - equipmentItemProviding:
 
(BOOL) - hasEquipmentItemProviding:
 
(BOOL) - hasAllEquipment:includeWeapons:whileLoading:
 
(BOOL) - hasAllEquipment:
 
(BOOL) - equipmentValidToAdd:inContext:
 
(BOOL) - equipmentValidToAdd:whileLoading:inContext:
 
(BOOL) - hasHyperspaceMotor
 
(float) - hyperspaceSpinTime
 
(void) - setHyperspaceSpinTime:
 
(NSEnumerator *) - equipmentEnumerator
 
(NSUInteger) - equipmentCount
 
(void) - removeAllEquipment
 
(OOEquipmentType *) - selectMissile
 
(BOOL) - hasOneEquipmentItem:includeWeapons:whileLoading:
 
(BOOL) - hasOneEquipmentItem:includeMissiles:whileLoading:
 
(NSUInteger) - missileCount
 
(NSUInteger) - missileCapacity
 
(NSUInteger) - extraCargo
 
(BOOL) - hasScoop
 
(BOOL) - hasFuelScoop
 
(BOOL) - hasCargoScoop
 
(BOOL) - hasECM
 
(BOOL) - hasCloakingDevice
 
(BOOL) - hasMilitaryScannerFilter
 
(BOOL) - hasMilitaryJammer
 
(BOOL) - hasExpandedCargoBay
 
(BOOL) - hasShieldBooster
 
(BOOL) - hasMilitaryShieldEnhancer
 
(BOOL) - hasHeatShield
 
(BOOL) - hasFuelInjection
 
(BOOL) - hasCascadeMine
 
(BOOL) - hasEscapePod
 
(BOOL) - hasDockingComputer
 
(BOOL) - hasGalacticHyperdrive
 
(float) - shieldBoostFactor
 
(float) - shieldRechargeRate
 
(double) - maxHyperspaceDistance
 
(float) - afterburnerFactor
 
(float) - afterburnerRate
 
(void) - setAfterburnerFactor:
 
(void) - setAfterburnerRate:
 
(float) - maxThrust
 
(float) - thrust
 
(void) - setMaxThrust:
 
(void) - setMaxFlightSpeed:
 
(void) - setEnergyRechargeRate:
 
(void) - processBehaviour:
 
(void) - behaviour_stop_still:
 
(void) - behaviour_idle:
 
(void) - behaviour_tumble:
 
(void) - behaviour_tractored:
 
(void) - behaviour_track_target:
 
(void) - behaviour_intercept_target:
 
(void) - behaviour_attack_target:
 
(void) - behaviour_attack_slow_dogfight:
 
(void) - behaviour_evasive_action:
 
(void) - behaviour_attack_break_off_target:
 
(void) - behaviour_fly_to_target_six:
 
(void) - behaviour_attack_mining_target:
 
(void) - behaviour_attack_fly_to_target:
 
(void) - behaviour_attack_fly_from_target:
 
(void) - behaviour_running_defense:
 
(void) - behaviour_flee_target:
 
(void) - behaviour_attack_broadside:
 
(void) - behaviour_attack_broadside_left:
 
(void) - behaviour_attack_broadside_right:
 
(void) - behaviour_close_to_broadside_range:
 
(void) - behaviour_close_with_target:
 
(void) - behaviour_attack_broadside_target:leftside:
 
(void) - behaviour_attack_sniper:
 
(void) - behaviour_fly_range_from_destination:
 
(void) - behaviour_face_destination:
 
(void) - behaviour_land_on_planet:
 
(void) - behaviour_formation_form_up:
 
(void) - behaviour_fly_to_destination:
 
(void) - behaviour_fly_from_destination:
 
(void) - behaviour_avoid_collision:
 
(void) - behaviour_track_as_turret:
 
(void) - behaviour_fly_thru_navpoints:
 
(void) - behaviour_scripted_ai:
 
(float) - reactionTime
 
(void) - setReactionTime:
 
(HPVector) - calculateTargetPosition
 
(void) - startTrackingCurve
 
(void) - updateTrackingCurve
 
(void) - calculateTrackingCurve
 
(GLfloat *) - scannerDisplayColorForShip:otherShip:isHostile:flash:scannerDisplayColor1:scannerDisplayColor2:scannerDisplayColorH1:
 
(void) - setScannerDisplayColor1:
 
(void) - setScannerDisplayColor2:
 
(OOColor *) - scannerDisplayColor1
 
(OOColor *) - scannerDisplayColor2
 
(void) - setScannerDisplayColorHostile1:
 
(void) - setScannerDisplayColorHostile2:
 
(OOColor *) - scannerDisplayColorHostile1
 
(OOColor *) - scannerDisplayColorHostile2
 
(BOOL) - isCloaked
 
(void) - setCloaked:
 
(BOOL) - hasAutoCloak
 
(void) - setAutoCloak:
 
(void) - applyThrust:
 
(void) - avoidCollision
 
(void) - resumePostProximityAlert
 
(double) - messageTime
 
(void) - setMessageTime:
 
(OOShipGroup *) - group
 
(void) - setGroup:
 
(OOShipGroup *) - escortGroup
 
(void) - setEscortGroup:
 
(OOShipGroup *) - stationGroup
 
(BOOL) - hasEscorts
 
(NSEnumerator *) - escortEnumerator
 
(NSArray *) - escortArray
 
(uint8_t) - escortCount
 
(uint8_t) - pendingEscortCount
 
(void) - setPendingEscortCount:
 
(uint8_t) - maxEscortCount
 
(void) - setMaxEscortCount:
 
(NSUInteger) - turretCount
 
(NSString *) - name
 
(NSString *) - shipUniqueName
 
(NSString *) - shipClassName
 
(NSString *) - displayName
 
(NSString *) - scanDescription
 
(NSString *) - scanDescriptionForScripting
 
(void) - setShipUniqueName:
 
(void) - setShipClassName:
 
(void) - setDisplayName:
 
(void) - setScanDescription:
 
(NSString *) - identFromShip:
 
(BOOL) - hasRole:
 
(OORoleSet *) - roleSet
 
(void) - addRole:
 
(void) - addRole:withProbability:
 
(void) - removeRole:
 
(NSString *) - primaryRole
 
(void) - setPrimaryRole:
 
(BOOL) - hasPrimaryRole:
 
(BOOL) - isPolice
 
(BOOL) - isThargoid
 
(BOOL) - isTrader
 
(BOOL) - isPirate
 
(BOOL) - isMissile
 
(BOOL) - isMine
 
(BOOL) - isWeapon
 
(BOOL) - isEscort
 
(BOOL) - isShuttle
 
(BOOL) - isTurret
 
(BOOL) - isPirateVictim
 
(BOOL) - isExplicitlyUnpiloted
 
(BOOL) - isUnpiloted
 
(BOOL) - isHostileTo:
 
(NSUInteger) - defenseTargetCount
 
(NSArray *) - allDefenseTargets
 
(NSEnumerator *) - defenseTargetEnumerator
 
(void) - validateDefenseTargets
 
(BOOL) - addDefenseTarget:
 
(BOOL) - isDefenseTarget:
 
(void) - removeDefenseTarget:
 
(void) - removeAllDefenseTargets
 
(NSArray *) - collisionExceptions
 
(void) - addCollisionException:
 
(void) - removeCollisionException:
 
(BOOL) - collisionExceptedFor:
 
(GLfloat) - weaponRange
 
(void) - setWeaponRange:
 
(void) - setWeaponDataFromType:
 
(float) - energyRechargeRate
 
(float) - weaponRechargeRate
 
(void) - setWeaponRechargeRate:
 
(void) - setWeaponEnergy:
 
(OOWeaponFacing- currentWeaponFacing
 
(GLfloat) - scannerRange
 
(void) - setScannerRange:
 
(Vector) - reference
 
(void) - setReference:
 
(BOOL) - reportAIMessages
 
(void) - setReportAIMessages:
 
(void) - transitionToAegisNone
 
(OOPlanetEntity *) - findNearestPlanet
 
(Entity< OOStellarBody > *) - findNearestStellarBody
 
(OOPlanetEntity *) - findNearestPlanetExcludingMoons
 
(OOAegisStatus- checkForAegis
 
(void) - forceAegisCheck
 
(BOOL) - withinStationAegis
 
(void) - setLastAegisLock:
 
(OOSystemID- homeSystem
 
(OOSystemID- destinationSystem
 
(void) - setHomeSystem:
 
(void) - setDestinationSystem:
 
(NSArray *) - crew
 
(NSArray *) - crewForScripting
 
(void) - setCrew:
 
(void) - setSingleCrewWithRole:
 
(OOFuelQuantity- fuel
 
(void) - setFuel:
 
(OOFuelQuantity- fuelCapacity
 
(GLfloat) - fuelChargeRate
 
(void) - setRoll:
 
(void) - setRawRoll:
 
(void) - setPitch:
 
(void) - setYaw:
 
(void) - setThrust:
 
(void) - applySticks:
 
(void) - setThrustForDemo:
 
(int- legalStatus
 
(BOOL) - isTemplateCargoPod
 
(void) - setUpCargoType:
 
(void) - setCommodity:andAmount:
 
(void) - setCommodityForPod:andAmount:
 
(OOCommodityType- commodityType
 
(OOCargoQuantity- commodityAmount
 
(OOCargoQuantity- maxAvailableCargoSpace
 
(void) - setMaxAvailableCargoSpace:
 
(OOCargoQuantity- availableCargoSpace
 
(OOCargoType- cargoType
 
(NSMutableArray *) - cargo
 
(void) - setCargo:
 
(BOOL) - addCargo:
 
(BOOL) - removeCargo:amount:
 
(BOOL) - showScoopMessage
 
(NSArray *) - equipmentListForScripting
 
(OOWeaponType- weaponTypeIDForFacing:strict:
 
(OOCargoFlag- cargoFlag
 
(void) - setCargoFlag:
 
(void) - setSpeed:
 
(double) - desiredSpeed
 
(void) - setDesiredSpeed:
 
(double) - desiredRange
 
(void) - setDesiredRange:
 
(double) - cruiseSpeed
 
(Vector) - thrustVector
 
(void) - setTotalVelocity:
 
(void) - increase_flight_speed:
 
(void) - decrease_flight_speed:
 
(void) - increase_flight_roll:
 
(void) - decrease_flight_roll:
 
(void) - increase_flight_pitch:
 
(void) - decrease_flight_pitch:
 
(void) - increase_flight_yaw:
 
(void) - decrease_flight_yaw:
 
(GLfloat) - flightRoll
 
(GLfloat) - flightPitch
 
(GLfloat) - flightYaw
 
(GLfloat) - flightSpeed
 
(GLfloat) - maxFlightPitch
 
(GLfloat) - maxFlightSpeed
 
(GLfloat) - maxFlightRoll
 
(GLfloat) - maxFlightYaw
 
(GLfloat) - speedFactor
 
(GLfloat) - temperature
 
(void) - setTemperature:
 
(GLfloat) - heatInsulation
 
(void) - setHeatInsulation:
 
(float) - randomEjectaTemperature
 
(float) - randomEjectaTemperatureWithMaxFactor:
 
(int- damage
 
(void) - dealEnergyDamage:atRange:withBias:
 
(void) - dealEnergyDamageWithinDesiredRange
 
(void) - dealMomentumWithinDesiredRange:
 
(void) - noteTakingDamage:from:type:
 
(void) - noteKilledBy:damageType:
 
(void) - becomeExplosion
 
(void) - becomeLargeExplosion:
 
(void) - becomeEnergyBlast
 
(void) - broadcastEnergyBlastImminent
 
(void) - setIsWreckage:
 
(BOOL) - showDamage
 
(Vector) - positionOffsetForAlignment:
 
(Vector) - positionOffsetForShipInRotationToAlignment
 
(BoundingBox) - findSubentityBoundingBox
 
(Triangle) - absoluteIJKForSubentity
 
(GLfloat) - weaponRecoveryTime
 
(GLfloat) - hullHeatLevel
 
(GLfloat) - entityPersonality
 
(GLint) - entityPersonalityInt
 
(void) - setEntityPersonalityInt:
 
(void) - setSuppressExplosion:
 
(void) - resetExhaustPlumes
 
(void) - removeExhaust:
 
(void) - removeFlasher:
 
(void) - checkScanner
 
(void) - checkScannerIgnoringUnpowered
 
(ShipEntity **) - scannedShips
 
(int- numberOfScannedShips
 
(Entity *) - foundTarget
 
(Entity *) - primaryAggressor
 
(Entity *) - lastEscortTarget
 
(Entity *) - thankedShip
 
(Entity *) - rememberedShip
 
(Entity *) - proximityAlert
 
(void) - setPrimaryAggressor:
 
(void) - setLastEscortTarget:
 
(void) - setThankedShip:
 
(void) - setRememberedShip:
 
(void) - setProximityAlert:
 
(void) - setTargetStation:
 
(void) - removeTarget:
 
(BOOL) - canStillTrackPrimaryTarget
 
(id) - primaryTarget
 
(id) - primaryTargetWithoutValidityCheck
 
(StationEntity *) - targetStation
 
(BOOL) - isFriendlyTo:
 
(ShipEntity *) - shipHitByLaser
 
(void) - noteLostTarget
 
(void) - noteLostTargetAndGoIdle
 
(void) - noteTargetDestroyed:
 
(OOBehaviour- behaviour
 
(void) - setBehaviour:
 
(void) - trackOntoTarget:withDForward:
 
(double) - ballTrackLeadingTarget:atTarget:
 
(GLfloat) - rollToMatchUp:rotating:
 
(GLfloat) - rangeToDestination
 
(double) - trackDestination:delta_t:
 
(void) - setCoordinate:
 
(HPVector) - coordinates
 
(HPVector) - destination
 
(HPVector) - distance_six:
 
(HPVector) - distance_twelve:withOffset:
 
(void) - setEvasiveJink:
 
(void) - evasiveAction:
 
(double) - trackPrimaryTarget:delta_t:
 
(double) - trackSideTarget:delta_t:
 
(double) - missileTrackPrimaryTarget:
 
(double) - rangeToPrimaryTarget
 
(double) - approachAspectToPrimaryTarget
 
(double) - rangeToSecondaryTarget:
 
(BOOL) - hasProximityAlertIgnoringTarget:
 
(GLfloat) - currentAimTolerance
 
(BOOL) - onTarget:withWeapon:
 
(OOTimeDelta- shotTime
 
(void) - resetShotTime
 
(BOOL) - fireMainWeapon:
 
(BOOL) - fireAftWeapon:
 
(BOOL) - firePortWeapon:
 
(BOOL) - fireStarboardWeapon:
 
(BOOL) - fireTurretCannon:
 
(void) - setLaserColor:
 
(void) - setExhaustEmissiveColor:
 
(OOColor *) - laserColor
 
(OOColor *) - exhaustEmissiveColor
 
(BOOL) - fireSubentityLaserShot:
 
(BOOL) - fireDirectLaserShot:
 
(BOOL) - fireDirectLaserDefensiveShot
 
(BOOL) - fireDirectLaserShotAt:
 
(NSArray *) - laserPortOffset:
 
(BOOL) - fireLaserShotInDirection:weaponIdentifier:
 
(void) - adjustMissedShots:
 
(int- missedShots
 
(void) - considerFiringMissile:
 
(Vector) - missileLaunchPosition
 
(ShipEntity *) - fireMissileWithIdentifier:andTarget:
 
(BOOL) - isMissileFlagSet
 
(void) - setIsMissileFlag:
 
(OOTimeDelta- missileLoadTime
 
(void) - setMissileLoadTime:
 
(BOOL) - cascadeIfAppropriateWithDamageAmount:cascadeOwner:
 
(BOOL) - launchCascadeMine
 
(ShipEntity *) - dumpCargoItem:
 
(OOCargoType- dumpItem:
 
(void) - manageCollisions
 
(BOOL) - collideWithShip:
 
(void) - adjustVelocity:
 
(void) - addImpactMoment:fraction:
 
(void) - getTractoredBy:
 
(void) - scoopIn:
 
(void) - scoopUp:
 
(void) - scoopUpProcess:processEvents:processMessages:
 
(BOOL) - abandonShip
 
(void) - enterWormhole:replacing:
 
(BOOL) - witchspaceLeavingEffects
 
(void) - switchLightsOn
 
(void) - switchLightsOff
 
(BOOL) - lightsActive
 
(void) - setDestination:
 
(void) - setEscortDestination:
 
(BOOL) - canAcceptEscort:
 
(BOOL) - acceptAsEscort:
 
(void) - deployEscorts
 
(void) - dockEscorts
 
(void) - setTargetToNearestFriendlyStation
 
(void) - setTargetToNearestStation
 
(void) - setTargetToSystemStation
 
(void) - landOnPlanet:
 
(void) - abortDocking
 
(NSDictionary *) - dockingInstructions
 
(void) - broadcastThargoidDestroyed
 
(void) - broadcastHitByLaserFrom:
 
(GLfloat) - sunGlareFilter
 
(void) - setSunGlareFilter:
 
(void) - sendExpandedMessage:toShip:
 
(void) - sendMessage:toShip:withUnpilotedOverride:
 
(void) - broadcastAIMessage:
 
(void) - broadcastMessage:withUnpilotedOverride:
 
(void) - setCommsMessageColor
 
(void) - commsMessage:withUnpilotedOverride:
 
(BOOL) - markedForFines
 
(BOOL) - markForFines
 
(void) - spawn:
 
(int- checkShipsInVicinityForWitchJumpExit
 
(BOOL) - trackCloseContacts
 
(void) - setTrackCloseContacts:
 
(void) - setHulk:
 
(BOOL) - isHulk
 
(OOJSScript *) - script
 
(NSDictionary *) - scriptInfo
 
(void) - overrideScriptInfo:
 
(BOOL) - scriptedMisjump
 
(void) - setScriptedMisjump:
 
(GLfloat) - scriptedMisjumpRange
 
(void) - setScriptedMisjumpRange:
 
(Entity *) - entityForShaderProperties
 
(void) - setDemoShip:
 
(BOOL) - isDemoShip
 
(void) - setDemoStartTime:
 
(void) - doScriptEvent:
 
(void) - doScriptEvent:withArgument:
 
(void) - doScriptEvent:withArgument:andArgument:
 
(void) - doScriptEvent:withArguments:
 
(void) - doScriptEvent:withArguments:count:
 
(void) - reactToAIMessage:context:
 
(void) - sendAIMessage:
 
(void) - doScriptEvent:andReactToAIMessage:
 
(void) - doScriptEvent:withArgument:andReactToAIMessage:
 
(id) - initBypassForPlayer [implementation]
 
(NSString *) - repeatString:times: [implementation]
 
(BOOL) - setUpOneSubentity: [implementation]
 
(BOOL) - setUpOneFlasher: [implementation]
 
(NSString *) - descriptionComponents [implementation]
 
(NSString *) - shortDescriptionComponents [implementation]
 
(BoundingBox) - findBoundingBoxRelativeToPosition:InVectors:_i:_j: [implementation]
 
(void) - wasAddedToUniverse [implementation]
 
(void) - wasRemovedFromUniverse [implementation]
 
(NSString *) - beaconCode [implementation]
 
(void) - setBeaconCode: [implementation]
 
(NSString *) - beaconLabel [implementation]
 
(void) - setBeaconLabel: [implementation]
 
(BOOL) - isVisible [implementation]
 
(BOOL) - isBeacon [implementation]
 
(id< OOHUDBeaconIcon >) - beaconDrawable [implementation]
 
(Entity< OOBeaconEntity > *) - prevBeacon [implementation]
 
(Entity< OOBeaconEntity > *) - nextBeacon [implementation]
 
(void) - setPrevBeacon: [implementation]
 
(void) - setNextBeacon: [implementation]
 
(void) - setUpMixedEscorts [implementation]
 
(void) - setUpOneEscort:inGroup:withRole:atPosition:andCount: [implementation]
 
(OOScanClass- scanClass [implementation]
 
(ShipEntity *) - doOctreesCollide [implementation]
 
(BOOL) - checkCloseCollisionWith: [implementation]
 
(void) - addSubentityToCollisionRadius: [implementation]
 
(ShipEntity *) - launchPodWithCrew: [implementation]
 
(void) - noteFrustration: [implementation]
 
(OOEquipmentType *) - generateMissileEquipmentTypeFrom: [implementation]
 
(OOEquipmentType *) - verifiedMissileTypeFromRole: [implementation]
 
(void) - drawDebugStuff [implementation]
 
(void) - drawSubEntityImmediate:translucent: [implementation]
 
(BOOL) - isJammingScanning [implementation]
 
(void) - addSubEntity: [implementation]
 
(void) - setOwner: [implementation]
 
(void) - applyRoll:climb:andYaw: [implementation]
 
(OOShipGroup *) - rawEscortGroup [implementation]
 
(NSComparisonResult) - ComparePlanetsBySurfaceDistance [implementation]
 
(Entity< OOStellarBody > *) - lastAegisLock [implementation]
 
(void) - setStatus: [implementation]
 
(void) - rescaleBy: [implementation]
 
(void) - rescaleBy:writeToCache: [implementation]
 
(void) - releaseCargoPodsDebris [implementation]
 
(void) - subEntityDied: [implementation]
 
(void) - subEntityReallyDied: [implementation]
 
(NSComparisonResult) - compareBeaconCodeWith: [implementation]
 
(uint32_t) - randomSeedForShaders [implementation]
 
(void) - setShipHitByLaser: [implementation]
 
(BOOL) - fireWeapon:direction:range: [implementation]
 
(void) - throwSparks [implementation]
 
(Vector) - velocity [implementation]
 
(void) - refreshEscortPositions [implementation]
 
(HPVector) - coordinatesForEscortPosition: [implementation]
 
(void) - setTargetToNearestStationIncludingHostiles: [implementation]
 
(BoundingBox) - findBoundingBoxRelativeTo:InVectors:_i:_j: [implementation]
 
(OOTimeAbsolute- getDemoStartTime [implementation]
 
(void) - doNothing [implementation]
 
(NSString *) - descriptionForObjDump [implementation]
 
(void) - setAITo:
 
(void) - setAIScript:
 
(void) - switchAITo:
 
(void) - scanForHostiles
 
(BOOL) - performHyperSpaceToSpecificSystem:
 
(void) - scanForNearestIncomingMissile
 
(void) - enterTargetWormhole
 
(void) - enterPlayerWormhole
 
(void) - wormholeEscorts
 
(void) - wormholeEntireGroup
 
(BOOL) - suggestEscortTo:
 
(void) - groupAttackTarget
 
(void) - performAttack
 
(void) - performCollect
 
(void) - performEscort
 
(void) - performFaceDestination
 
(void) - performFlee
 
(void) - performFlyToRangeFromDestination
 
(void) - performHold
 
(void) - performIdle
 
(void) - performIntercept
 
(void) - performLandOnPlanet
 
(void) - performMining
 
(void) - performScriptedAI
 
(void) - performScriptedAttackAI
 
(void) - performStop
 
(void) - performTumble
 
(void) - broadcastDistressMessage
 
(void) - broadcastDistressMessageWithDumping:
 
(void) - requestDockingCoordinates
 
(void) - recallDockingInstructions
 
(void) - performBuoyTumble [implementation]
 
(NSDictionary *) - savedShipDictionaryWithContext:
 
(void) - simplifyShipdata:andGetDeletes: [implementation]
 
(void) - checkFoundTarget [implementation]
 
(BOOL) - performHyperSpaceExitReplace: [implementation]
 
(BOOL) - performHyperSpaceExitReplace:toSystem: [implementation]
 
(void) - scanForNearestShipWithPredicate:parameter: [implementation]
 
(void) - scanForNearestShipWithNegatedPredicate:parameter: [implementation]
 
(void) - acceptDistressMessageFrom: [implementation]
 
(BOOL) - launchPatrol [implementation]
 
(NSArray *) - subEntitiesForScript
 
(void) - setTargetForScript:
 
(BOOL) - isVisibleToScripts [implementation]
 
(void) - getJSClass:andPrototype: [implementation]
 
(void) - setStateTo: [implementation]
 
(void) - pauseAI: [implementation]
 
(void) - randomPauseAI: [implementation]
 
(void) - dropMessages: [implementation]
 
(void) - debugDumpPendingMessages [implementation]
 
(void) - setDestinationToCurrentLocation [implementation]
 
(void) - setDesiredRangeTo: [implementation]
 
(void) - setDesiredRangeForWaypoint [implementation]
 
(void) - setSpeedTo: [implementation]
 
(void) - setSpeedFactorTo: [implementation]
 
(void) - setSpeedToCruiseSpeed [implementation]
 
(void) - setThrustFactorTo: [implementation]
 
(void) - setTargetToPrimaryAggressor [implementation]
 
(void) - scanForNearestMerchantman [implementation]
 
(void) - scanForRandomMerchantman [implementation]
 
(void) - scanForLoot [implementation]
 
(void) - scanForRandomLoot [implementation]
 
(void) - setTargetToFoundTarget [implementation]
 
(void) - checkForFullHold [implementation]
 
(void) - getWitchspaceEntryCoordinates [implementation]
 
(void) - setDestinationFromCoordinates [implementation]
 
(void) - setCoordinatesFromPosition [implementation]
 
(void) - fightOrFleeMissile [implementation]
 
(void) - setCourseToPlanet [implementation]
 
(void) - setTakeOffFromPlanet [implementation]
 
(void) - landOnPlanet [implementation]
 
(void) - checkTargetLegalStatus [implementation]
 
(void) - checkOwnLegalStatus [implementation]
 
(void) - exitAIWithMessage: [implementation]
 
(void) - setDestinationToTarget [implementation]
 
(void) - setDestinationWithinTarget [implementation]
 
(void) - checkCourseToDestination [implementation]
 
(void) - checkAegis [implementation]
 
(void) - checkEnergy [implementation]
 
(void) - checkHeatInsulation [implementation]
 
(void) - scanForOffenders [implementation]
 
(void) - setCourseToWitchpoint [implementation]
 
(void) - setDestinationToWitchpoint [implementation]
 
(void) - setDestinationToStationBeacon [implementation]
 
(void) - performHyperSpaceExit [implementation]
 
(void) - performHyperSpaceExitWithoutReplacing [implementation]
 
(void) - wormholeGroup [implementation]
 
(void) - ejectCargo [implementation]
 
(void) - scanForThargoid [implementation]
 
(void) - scanForNonThargoid [implementation]
 
(void) - thargonCheckMother [implementation]
 
(void) - becomeUncontrolledThargon [implementation]
 
(void) - checkDistanceTravelled [implementation]
 
(void) - fightOrFleeHostiles [implementation]
 
(void) - suggestEscort [implementation]
 
(void) - escortCheckMother [implementation]
 
(void) - checkGroupOddsVersusTarget [implementation]
 
(void) - scanForFormationLeader [implementation]
 
(void) - messageMother: [implementation]
 
(void) - setPlanetPatrolCoordinates [implementation]
 
(void) - setSunSkimStartCoordinates [implementation]
 
(void) - setSunSkimEndCoordinates [implementation]
 
(void) - setSunSkimExitCoordinates [implementation]
 
(void) - patrolReportIn [implementation]
 
(void) - checkForMotherStation [implementation]
 
(void) - sendTargetCommsMessage: [implementation]
 
(void) - markTargetForFines [implementation]
 
(void) - markTargetForOffence: [implementation]
 
(void) - storeTarget [implementation]
 
(void) - recallStoredTarget [implementation]
 
(void) - scanForRocks [implementation]
 
(void) - setDestinationToDockingAbort [implementation]
 
(void) - requestNewTarget [implementation]
 
(void) - rollD: [implementation]
 
(void) - scanForNearestShipWithPrimaryRole: [implementation]
 
(void) - scanForNearestShipHavingRole: [implementation]
 
(void) - scanForNearestShipWithAnyPrimaryRole: [implementation]
 
(void) - scanForNearestShipHavingAnyRole: [implementation]
 
(void) - scanForNearestShipWithScanClass: [implementation]
 
(void) - scanForNearestShipWithoutPrimaryRole: [implementation]
 
(void) - scanForNearestShipNotHavingRole: [implementation]
 
(void) - scanForNearestShipWithoutAnyPrimaryRole: [implementation]
 
(void) - scanForNearestShipNotHavingAnyRole: [implementation]
 
(void) - scanForNearestShipWithoutScanClass: [implementation]
 
(void) - setCoordinates: [implementation]
 
(void) - checkForNormalSpace [implementation]
 
(void) - setTargetToRandomStation [implementation]
 
(void) - setTargetToLastStation [implementation]
 
(void) - addFuel: [implementation]
 
(void) - scriptActionOnTarget: [implementation]
 
(void) - sendScriptMessage: [implementation]
 
(void) - ai_throwSparks [implementation]
 
(void) - explodeSelf [implementation]
 
(void) - ai_debugMessage: [implementation]
 
(void) - targetFirstBeaconWithCode: [implementation]
 
(void) - targetNextBeaconWithCode: [implementation]
 
(void) - setRacepointsFromTarget [implementation]
 
(void) - performFlyRacepoints [implementation]
 
(void) - addPrimaryAggressorAsDefenseTarget [implementation]
 
(void) - addFoundTargetAsDefenseTarget [implementation]
 
(void) - findNewDefenseTarget [implementation]
 
(void) - setDestinationToJinkPosition [implementation]
 
(void) - messageSelf: [implementation]
 
(void) - scanForNearestShipMatchingPredicate: [implementation]
 
(void) - safeScriptActionOnTarget: [implementation]
 
(ShipEntity *) - ejectShipOfType:
 
(ShipEntity *) - ejectShipOfRole:
 
(NSArray *) - spawnShipsWithRole:count:
 
(BOOL) - isShipWithSubEntityShip: [implementation]
 
- Instance Methods inherited from OOEntityWithDrawable
(OODrawable *) - drawable
 
(void) - setDrawable:
 
(double) - findCollisionRadius [implementation]
 
(NSSet *) - allTextures [implementation]
 
- Instance Methods inherited from Entity
(BOOL) - isShip
 
(BOOL) - isDock
 
(BOOL) - isStation
 
(BOOL) - isSubEntity
 
(BOOL) - isPlayer
 
(BOOL) - isPlanet
 
(BOOL) - isSun
 
(BOOL) - isSunlit
 
(BOOL) - isStellarObject
 
(BOOL) - isSky
 
(BOOL) - isWormhole
 
(BOOL) - isEffect
 
(BOOL) - isVisualEffect
 
(BOOL) - isWaypoint
 
(void) - addToLinkedLists
 
(void) - removeFromLinkedLists
 
(void) - updateLinkedLists
 
(CollisionRegion *) - collisionRegion
 
(void) - setCollisionRegion:
 
(void) - setUniversalID:
 
(OOUniversalID- universalID
 
(BOOL) - throwingSparks
 
(void) - setThrowSparks:
 
(id) - owner
 
(ShipEntity *) - parentEntity
 
(ShipEntity *) - rootShipEntity
 
(void) - setPosition:
 
(void) - setPositionX:y:z:
 
(HPVector) - position
 
(Vector) - cameraRelativePosition
 
(GLfloat) - cameraRangeFront
 
(GLfloat) - cameraRangeBack
 
(void) - updateCameraRelativePosition
 
(Vector) - vectorTo:
 
(HPVector) - absolutePositionForSubentity
 
(HPVector) - absolutePositionForSubentityOffset:
 
(double) - zeroDistance
 
(double) - camZeroDistance
 
(BoundingBox) - boundingBox
 
(GLfloat) - mass
 
(Quaternion) - orientation
 
(void) - setOrientation:
 
(void) - setVelocity:
 
(double) - speed
 
(GLfloat) - distanceTravelled
 
(void) - setDistanceTravelled:
 
(OOEntityStatus- status
 
(void) - setScanClass:
 
(void) - setEnergy:
 
(GLfloat) - energy
 
(void) - setMaxEnergy:
 
(GLfloat) - maxEnergy
 
(OOMatrix) - rotationMatrix
 
(OOMatrix) - transformationMatrix
 
(GLfloat) - collisionRadius
 
(void) - setCollisionRadius:
 
(NSMutableArray *) - collisionArray
 
(void) - applyVelocity:
 
(void) - dumpState
 
(NSUInteger) - lastDrawCounter
 
(void) - setLastDrawCounter:
 
(BOOL) - isInSpace
 
(BOOL) - isImmuneToBreakPatternHide
 
(GLfloat) - universalTime
 
(GLfloat) - spawnTime
 
(GLfloat) - timeElapsedSinceSpawn
 
(void) - setAtmosphereFogging:
 
(OOColor *) - fogUniform
 
(NSString *) - descriptionForObjDumpBasic
 
(BOOL) - checkLinkedLists [implementation]
 
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
 
(Vector) - relativePosition [implementation]
 
(BOOL) - isBreakPattern
 
(void) - inspect [implementation]
 
(BOOL) - isECMBlast
 
(BOOL) - isExhaust
 
(BOOL) - isFlasher
 
(void) - deleteJSSelf
 
(jsval) - oo_jsValueInContext: [implementation]
 
(BOOL) - isCascadeWeapon
 
(GLfloat) - clock [implementation]
 
(unsigned) - pseudoFixedD100 [implementation]
 
(unsigned) - pseudoFixedD256 [implementation]
 
(unsigned) - systemGovernment [implementation]
 
(unsigned) - systemEconomy [implementation]
 
(unsigned) - systemTechLevel [implementation]
 
(unsigned) - systemPopulation [implementation]
 
(unsigned) - systemProductivity [implementation]
 
- Instance Methods inherited from OOWeakRefObject
(id) - weakSelf
 
(id) - weakRetain [implementation]
 
(void) - weakRefDied: [implementation]
 
- Instance Methods inherited from <OOWeakReferenceSupport>
(id) - OO_RETURNS_RETAINED
 

Class Methods

(PlayerEntity *) + sharedPlayer
 
(static NSString *) + SliderString [implementation]
 
(static NSString *) + CurrentScriptNameOr [implementation]
 
(static void+ PerformScriptActions [implementation]
 
(static void+ PerformConditionalStatment [implementation]
 
(static void+ PerformActionStatment [implementation]
 
(static BOOL+ TestScriptConditions [implementation]
 
- Class Methods inherited from ShipEntity
(static BOOL) + IsBehaviourHostile [implementation]
 
(static float) + SurfaceDistanceSqaredV [implementation]
 
(static float) + SurfaceDistanceSqared [implementation]
 
(static BOOL) + AuthorityPredicate [implementation]
 
(id) + shipRestoredFromDictionary:useFallback:context:
 

Private Attributes

OOSystemID system_id
 
OOSystemID target_system_id
 
OOSystemID info_system_id
 
OOSystemID previous_system_id
 
float occlusion_dial
 
OOSystemID found_system_id
 
int ship_trade_in_factor
 
NSDictionaryworldScripts
 
NSDictionaryworldScriptsRequiringTickle
 
NSMutableDictionarycommodityScripts
 
NSMutableDictionarymission_variables
 
NSMutableDictionarylocalVariables
 
NSString_missionTitle
 
NSInteger missionTextRow
 
NSStringmissionChoice
 
NSStringmissionKeyPress
 
BOOL _missionWithCallback
 
BOOL _missionAllowInterrupt
 
BOOL _missionTextEntry
 
OOGUIScreenID _missionExitScreen
 
NSStringspecialCargo
 
NSMutableArraycommLog
 
NSMutableArrayeqScripts
 
NSDictionary_missionOverlayDescriptor
 
NSDictionary_missionBackgroundDescriptor
 
OOGUIBackgroundSpecial _missionBackgroundSpecial
 
NSDictionary_equipScreenBackgroundDescriptor
 
NSString_missionScreenID
 
BOOL found_equipment
 
NSMutableDictionaryreputation
 
unsigned max_passengers
 
NSMutableArraypassengers
 
NSMutableDictionarypassenger_record
 
NSMutableArrayparcels
 
NSMutableDictionaryparcel_record
 
NSMutableArraycontracts
 
NSMutableDictionarycontract_record
 
NSMutableDictionaryshipyard_record
 
NSMutableDictionarymissionDestinations
 
NSMutableArrayroleWeights
 
NSMutableDictionaryroleWeightFlags
 
NSMutableArrayroleSystemList
 
double script_time
 
double script_time_check
 
double script_time_interval
 
NSStringlastTextKey
 
double ship_clock
 
double ship_clock_adjust
 
double escape_pod_rescue_time
 
double fps_check_time
 
int fps_counter
 
double last_fps_check_time
 
NSStringplanetSearchString
 
OOMatrix playerRotMatrix
 
BOOL showingLongRangeChart
 
NSStringcommanderNameString
 
NSMutableArraycdrDetailArray
 
int currentPage
 
BOOL pollControls
 
NSInteger marketOffset
 
OOCommodityType marketSelectedCommodity
 
OOMarketFilterMode marketFilterMode
 
OOMarketSorterMode marketSorterMode
 
OOWeakReference_dockedStation
 
StationEntitytargetDockStation
 
HeadUpDisplayhud
 
NSMutableDictionarymultiFunctionDisplayText
 
NSMutableArraymultiFunctionDisplaySettings
 
NSUInteger activeMFD
 
NSMutableDictionarycustomDialSettings
 
GLfloat roll_delta
 
GLfloat pitch_delta
 
GLfloat yaw_delta
 
GLfloat launchRoll
 
GLfloat forward_shield
 
GLfloat aft_shield
 
GLfloat max_forward_shield
 
GLfloat max_aft_shield
 
GLfloat forward_shield_recharge_rate
 
GLfloat aft_shield_recharge_rate
 
OOTimeDelta forward_shot_time
 
OOTimeDelta aft_shot_time
 
OOTimeDelta port_shot_time
 
OOTimeDelta starboard_shot_time
 
OOWeaponFacing chosen_weapon_facing
 
double ecm_start_time
 
double last_ecm_time
 
OOGUIScreenID gui_screen
 
OOAlertFlags alertFlags
 
OOAlertCondition alertCondition
 
OOAlertCondition lastScriptAlertCondition
 
OOPlayerFleeingStatus fleeing_status
 
OOMissileStatus missile_status
 
NSUInteger activeMissile
 
NSUInteger primedEquipment
 
NSString_fastEquipmentA
 
NSString_fastEquipmentB
 
OOCargoQuantity current_cargo
 
NSPoint cursor_coordinates
 
NSPoint chart_focus_coordinates
 
NSPoint chart_centre_coordinates
 
NSPoint custom_chart_centre_coordinates
 
NSPoint target_chart_centre
 
NSPoint target_chart_focus
 
OOScalar chart_zoom
 
OOScalar custom_chart_zoom
 
OOScalar target_chart_zoom
 
OOScalar saved_chart_zoom
 
OORouteType ANA_mode
 
OOTimeDelta witchspaceCountdown
 
NSString_jumpCause
 
NSString_commanderName
 
NSString_lastsaveName
 
NSPoint galaxy_coordinates
 
OOCreditsQuantity credits
 
OOGalaxyID galaxy_number
 
OOCommodityMarketshipCommodityData
 
ShipEntitymissile_entity [PLAYER_MAX_MISSILES]
 
OOUniversalID _dockTarget
 
int legalStatus
 
int market_rnd
 
unsigned ship_kills
 
OOCompassMode compassMode
 
OOWeakReferencecompassTarget
 
GLfloat fuel_leak_rate
 
GLfloat hyperspeedFactor
 
NSDictionarykeyconfig2_settings
 
NSDictionarykeyCodeLookups
 
NSArrayn_key_roll_left
 
NSArrayn_key_roll_right
 
NSArrayn_key_pitch_forward
 
NSArrayn_key_pitch_back
 
NSArrayn_key_yaw_left
 
NSArrayn_key_yaw_right
 
NSArrayn_key_view_forward
 
NSArrayn_key_view_aft
 
NSArrayn_key_view_port
 
NSArrayn_key_view_starboard
 
NSArrayn_key_launch_ship
 
NSArrayn_key_gui_screen_options
 
NSArrayn_key_gui_screen_equipship
 
NSArrayn_key_gui_screen_interfaces
 
NSArrayn_key_gui_screen_status
 
NSArrayn_key_gui_chart_screens
 
NSArrayn_key_gui_system_data
 
NSArrayn_key_gui_market
 
NSArrayn_key_gui_arrow_left
 
NSArrayn_key_gui_arrow_right
 
NSArrayn_key_gui_arrow_up
 
NSArrayn_key_gui_arrow_down
 
NSArrayn_key_gui_page_up
 
NSArrayn_key_gui_page_down
 
NSArrayn_key_gui_select
 
NSArrayn_key_increase_speed
 
NSArrayn_key_decrease_speed
 
NSArrayn_key_inject_fuel
 
NSArrayn_key_fire_lasers
 
NSArrayn_key_launch_missile
 
NSArrayn_key_next_missile
 
NSArrayn_key_ecm
 
NSArrayn_key_prime_next_equipment
 
NSArrayn_key_prime_previous_equipment
 
NSArrayn_key_activate_equipment
 
NSArrayn_key_mode_equipment
 
NSArrayn_key_fastactivate_equipment_a
 
NSArrayn_key_fastactivate_equipment_b
 
NSArrayn_key_target_missile
 
NSArrayn_key_untarget_missile
 
NSArrayn_key_target_incoming_missile
 
NSArrayn_key_ident_system
 
NSArrayn_key_scanner_zoom
 
NSArrayn_key_scanner_unzoom
 
NSArrayn_key_launch_escapepod
 
NSArrayn_key_galactic_hyperspace
 
NSArrayn_key_hyperspace
 
NSArrayn_key_jumpdrive
 
NSArrayn_key_dump_cargo
 
NSArrayn_key_rotate_cargo
 
NSArrayn_key_autopilot
 
NSArrayn_key_autodock
 
NSArrayn_key_snapshot
 
NSArrayn_key_docking_music
 
NSArrayn_key_advanced_nav_array_next
 
NSArrayn_key_advanced_nav_array_previous
 
NSArrayn_key_info_next_system
 
NSArrayn_key_info_previous_system
 
NSArrayn_key_map_home
 
NSArrayn_key_map_end
 
NSArrayn_key_map_next_system
 
NSArrayn_key_map_previous_system
 
NSArrayn_key_map_info
 
NSArrayn_key_map_zoom_in
 
NSArrayn_key_map_zoom_out
 
NSArrayn_key_system_home
 
NSArrayn_key_system_end
 
NSArrayn_key_system_next_system
 
NSArrayn_key_system_previous_system
 
NSArrayn_key_pausebutton
 
NSArrayn_key_show_fps
 
NSArrayn_key_bloom_toggle
 
NSArrayn_key_mouse_control_roll
 
NSArrayn_key_mouse_control_yaw
 
NSArrayn_key_hud_toggle
 
NSArrayn_key_comms_log
 
NSArrayn_key_prev_compass_mode
 
NSArrayn_key_next_compass_mode
 
NSArrayn_key_chart_highlight
 
NSArrayn_key_market_filter_cycle
 
NSArrayn_key_market_sorter_cycle
 
NSArrayn_key_market_buy_one
 
NSArrayn_key_market_sell_one
 
NSArrayn_key_market_buy_max
 
NSArrayn_key_market_sell_max
 
NSArrayn_key_next_target
 
NSArrayn_key_previous_target
 
NSArrayn_key_custom_view
 
NSArrayn_key_custom_view_zoom_out
 
NSArrayn_key_custom_view_zoom_in
 
NSArrayn_key_custom_view_roll_left
 
NSArrayn_key_custom_view_pan_left
 
NSArrayn_key_custom_view_roll_right
 
NSArrayn_key_custom_view_pan_right
 
NSArrayn_key_custom_view_rotate_up
 
NSArrayn_key_custom_view_pan_up
 
NSArrayn_key_custom_view_rotate_down
 
NSArrayn_key_custom_view_pan_down
 
NSArrayn_key_custom_view_rotate_left
 
NSArrayn_key_custom_view_rotate_right
 
NSArrayn_key_docking_clearance_request
 
NSArrayn_key_weapons_online_toggle
 
NSArrayn_key_cycle_next_mfd
 
NSArrayn_key_cycle_previous_mfd
 
NSArrayn_key_switch_next_mfd
 
NSArrayn_key_switch_previous_mfd
 
NSArrayn_key_oxzmanager_setfilter
 
NSArrayn_key_oxzmanager_showinfo
 
NSArrayn_key_oxzmanager_extract
 
NSArrayn_key_dump_target_state
 
NSArrayn_key_dump_entity_list
 
NSArrayn_key_debug_full
 
NSArrayn_key_debug_collision
 
NSArrayn_key_debug_console_connect
 
NSArrayn_key_debug_bounding_boxes
 
NSArrayn_key_debug_shaders
 
NSArrayn_key_debug_off
 
NSMutableArraycustomEquipActivation
 
NSMutableArraycustomActivatePressed
 
NSMutableArraycustomModePressed
 
NSDictionaryextraMissionKeys
 
NSMutableDictionaryextraGuiScreenKeys
 
NSStringsave_path
 
NSStringscenarioKey
 
Vector forwardViewOffset
 
Vector aftViewOffset
 
Vector portViewOffset
 
Vector starboardViewOffset
 
Vector _sysInfoLight
 
NSUInteger trumbleCount
 
OOTrumbletrumble [PLAYER_MAX_TRUMBLES]
 
float _trumbleAppetiteAccumulator
 
GLfloat scanner_zoom_rate
 
NSMutableArraytarget_memory
 
NSUInteger target_memory_index
 
Quaternion customViewQuaternion
 
OOMatrix customViewMatrix
 
Vector customViewOffset
 
Vector customViewForwardVector
 
Vector customViewUpVector
 
Vector customViewRightVector
 
Vector customViewRotationCenter
 
NSStringcustomViewDescription
 
NSMutableStringdockingReport
 
unsigned suppressTargetLost: 1
 
unsigned scoopsActive: 1
 
unsigned scoopOverride: 1
 
unsigned game_over: 1
 
unsigned finished: 1
 
unsigned bomb_detonated: 1
 
unsigned autopilot_engaged: 1
 
unsigned afterburner_engaged: 1
 
unsigned afterburnerSoundLooping: 1
 
unsigned hyperspeed_engaged: 1
 
unsigned travelling_at_hyperspeed: 1
 
unsigned hyperspeed_locked: 1
 
unsigned ident_engaged: 1
 
unsigned galactic_witchjump: 1
 
unsigned ecm_in_operation: 1
 
unsigned show_info_flag: 1
 
unsigned showDemoShips: 1
 
unsigned rolling
 
unsigned pitching
 
unsigned yawing: 1
 
unsigned using_mining_laser: 1
 
unsigned mouse_control_on: 1
 
unsigned keyboardRollOverride: 1
 
unsigned keyboardPitchOverride: 1
 
unsigned keyboardYawOverride: 1
 
unsigned waitingForStickCallback: 1
 
unsigned weapons_online: 1
 
unsigned launchingMissile: 1
 
unsigned replacingMissile: 1
 
unsigned massLockable: 1
 
OOSpeechSettings isSpeechOn
 
int selFunctionIdx
 
NSArraystickFunctions
 
NSArraykeyFunctions
 
NSArraykbdLayouts
 
NSStringkeyShiftText
 
NSStringkeyMod1Text
 
NSStringkeyMod2Text
 
OOGalacticHyperspaceBehaviour galacticHyperspaceBehaviour
 
NSPoint galacticHyperspaceFixedCoords
 
OOLongRangeChartMode longRangeChartMode
 
NSArray_customViews
 
NSUInteger _customViewIndex
 
OODockingClearanceStatus dockingClearanceStatus
 
NSMutableArrayscannedWormholes
 
WormholeEntitywormhole
 
ShipEntitydemoShip
 
NSArraylastShot
 
StickProfileScreenstickProfileScreen
 
double maxFieldOfView
 
double fieldOfView
 

Additional Inherited Members

- Public Attributes inherited from ShipEntity
OOTimeDelta shot_time
 
Vector v_forward
 
Vector v_up
 
Vector v_right
 
HPVector _destination
 
GLfloat desired_range
 
GLfloat desired_speed
 
GLfloat stick_roll
 
GLfloat stick_pitch
 
GLfloat stick_yaw
 
OOBehaviour behaviour
 
BoundingBox totalBoundingBox
 
- Public Attributes inherited from Entity
OOUniversalID universalID
 
unsigned isShip: 1
 
unsigned isStation: 1
 
unsigned isPlayer: 1
 
unsigned isWormhole: 1
 
unsigned isSubEntity: 1
 
unsigned hasMoved: 1
 
unsigned hasRotated: 1
 
unsigned hasCollided: 1
 
unsigned isSunlit: 1
 
unsigned collisionTestFilter: 2
 
unsigned throw_sparks: 1
 
unsigned isImmuneToBreakPatternHide: 1
 
unsigned isExplicitlyNotMainStation: 1
 
unsigned isVisualEffect: 1
 
OOScanClass scanClass
 
GLfloat zero_distance
 
GLfloat cam_zero_distance
 
GLfloat no_draw_distance
 
GLfloat collision_radius
 
HPVector position
 
Vector cameraRelativePosition
 
Quaternion orientation
 
OOColoratmosphereFogging
 
int zero_index
 
Entityx_previous
 
Entityx_next
 
Entityy_previous
 
Entityy_next
 
Entityz_previous
 
Entityz_next
 
Entitycollision_chain
 
OOUniversalID shadingEntityID
 
Entitycollider
 
CollisionRegioncollisionRegion
 
- Protected Attributes inherited from ShipEntity
NSDictionary * shipinfoDictionary
 
Quaternion subentityRotationalVelocity
 
OOJSScriptscript
 
OOJSScriptaiScript
 
OOTimeAbsolute aiScriptWakeTime
 
NSDictionary * dockingInstructions
 
OOColorlaser_color
 
OOColordefault_laser_color
 
OOColorexhaust_emissive_color
 
OOColorscanner_display_color1
 
OOColorscanner_display_color2
 
OOColorscanner_display_color_hostile1
 
OOColorscanner_display_color_hostile2
 
GLfloat maxFlightSpeed
 
GLfloat max_flight_roll
 
GLfloat max_flight_pitch
 
GLfloat max_flight_yaw
 
GLfloat cruiseSpeed
 
GLfloat max_thrust
 
GLfloat thrust
 
float hyperspaceMotorSpinTime
 
unsigned military_jammer_active: 1
 
unsigned docking_match_rotation: 1
 
unsigned pitching_over: 1
 
unsigned rolling_over: 1
 
unsigned reportAIMessages: 1
 
unsigned being_mined: 1
 
unsigned being_fined: 1
 
unsigned isHulk: 1
 
unsigned trackCloseContacts: 1
 
unsigned isNearPlanetSurface: 1
 
unsigned isFrangible: 1
 
unsigned cloaking_device_active: 1
 
unsigned cloakPassive: 1
 
unsigned cloakAutomatic: 1
 
unsigned canFragment: 1
 
unsigned isWreckage: 1
 
unsigned _showDamage: 1
 
unsigned suppressExplosion: 1
 
unsigned suppressAegisMessages: 1
 
unsigned isMissile: 1
 
unsigned _explicitlyUnpiloted: 1
 
unsigned hasScoopMessage: 1
 
unsigned scripted_misjump: 1
 
unsigned haveExecutedSpawnAction: 1
 
unsigned haveStartedJSAI: 1
 
unsigned noRocks: 1
 
unsigned _lightsActive: 1
 
GLfloat _scriptedMisjumpRange
 
GLfloat sunGlareFilter
 
OOFuelQuantity fuel
 
GLfloat fuel_accumulator
 
GLfloat afterburner_rate
 
GLfloat afterburner_speed_factor
 
OOCargoQuantity likely_cargo
 
OOCargoQuantity max_cargo
 
OOCargoQuantity extra_cargo
 
OOCargoQuantity equipment_weight
 
OOCargoType cargo_type
 
OOCargoFlag cargo_flag
 
OOCreditsQuantity bounty
 
GLfloat energy_recharge_rate
 
OOWeaponFacingSet weapon_facings
 
OOWeaponType forward_weapon_type
 
OOWeaponType aft_weapon_type
 
OOWeaponType port_weapon_type
 
OOWeaponType starboard_weapon_type
 
GLfloat weapon_damage
 
GLfloat weapon_damage_override
 
GLfloat weaponRange
 
OOWeaponFacing currentWeaponFacing
 
GLfloat weapon_energy_use
 
GLfloat weapon_temp
 
GLfloat weapon_shot_temperature
 
GLfloat forward_weapon_temp
 
GLfloat aft_weapon_temp
 
GLfloat port_weapon_temp
 
GLfloat starboard_weapon_temp
 
GLfloat scannerRange
 
unsigned missiles
 
unsigned max_missiles
 
NSString * _missileRole
 
OOTimeDelta missile_load_time
 
OOTimeAbsolute missile_launch_time
 
AIshipAI
 
NSString * name
 
NSString * shipUniqueName
 
NSString * shipClassName
 
NSString * displayName
 
NSString * scan_description
 
OORoleSetroleSet
 
NSString * primaryRole
 
NSArray * explosionType
 
Vector jink
 
HPVector coordinates
 
Vector reference
 
NSUInteger _subIdx
 
NSUInteger _maxShipSubIdx
 
double launch_time
 
double launch_delay
 
OOUniversalID planetForLanding
 
GLfloat frustration
 
GLfloat success_factor
 
int patrol_counter
 
NSMutableDictionary * previousCondition
 
float weapon_recharge_rate
 
int shot_counter
 
OOTimeAbsolute cargo_dump_time
 
OOTimeAbsolute last_shot_time
 
NSMutableArray * cargo
 
OOCommodityType commodity_type
 
OOCargoQuantity commodity_amount
 
GLfloat flightSpeed
 
GLfloat flightRoll
 
GLfloat flightPitch
 
GLfloat flightYaw
 
GLfloat accuracy
 
GLfloat pitch_tolerance
 
GLfloat aim_tolerance
 
int _missed_shots
 
OOAegisStatus aegis_status
 
OOSystemID home_system
 
OOSystemID destination_system
 
double messageTime
 
double next_spark_time
 
Vector collision_vector
 
GLfloat _scaleFactor
 
BOOL _multiplyWeapons
 
NSArray * forwardWeaponOffset
 
NSArray * aftWeaponOffset
 
NSArray * portWeaponOffset
 
NSArray * starboardWeaponOffset
 
NSArray * crew
 
NSMutableDictionary * closeContactsInfo
 
NSString * lastRadioMessage
 
Vector tractor_position
 
float ship_temperature
 
ShipEntityscanned_ships [MAX_SCAN_NUMBER+1]
 
GLfloat distance2_scanned_ships [MAX_SCAN_NUMBER+1]
 
unsigned n_scanned_ships
 
HPVector navpoints [32]
 
unsigned next_navpoint_index
 
unsigned number_of_navpoints
 
Octreeoctree
 
OOBehaviour debugLastBehaviour
 
uint16_t entity_personality
 
NSDictionary * scriptInfo
 
NSMutableArray * subEntities
 
OOEquipmentTypemissile_list [SHIPENTITY_MAX_MISSILES]
 
OOWeakReference_primaryTarget
 
OOWeakReference_primaryAggressor
 
OOWeakReference_targetStation
 
OOWeakReference_foundTarget
 
OOWeakReference_lastEscortTarget
 
OOWeakReference_thankedShip
 
OOWeakReference_rememberedShip
 
OOWeakReference_proximityAlert
 
float reactionTime
 
HPVector trackingCurvePositions [4]
 
OOTimeAbsolute trackingCurveTimes [4]
 
HPVector trackingCurveCoeffs [3]
 
- Protected Attributes inherited from Entity
HPVector lastPosition
 
Quaternion lastOrientation
 
GLfloat distanceTravelled
 
OOMatrix rotMatrix
 
Vector velocity
 
GLfloat energy
 
GLfloat maxEnergy
 
BoundingBox boundingBox
 
GLfloat mass
 
NSMutableArray * collidingEntities
 
OOTimeAbsolute spawnTime
 
struct JSObject * _jsSelf
 
NSUInteger lastDrawCounter
 
- Protected Attributes inherited from OOWeakRefObject
OOWeakReferenceweakSelf
 

Detailed Description

Definition at line 364 of file PlayerEntity.h.

Method Documentation

◆ activateCloakingDevice

- (BOOL) activateCloakingDevice

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6071{
6072 if (![self hasCloakingDevice]) return NO;
6073
6075 {
6076 [UNIVERSE setCurrentPostFX:OO_POSTFX_CLOAK];
6077 [UNIVERSE addMessage:DESC(@"cloak-on") forCount:2];
6078 [self playCloakingDeviceOn];
6079 return YES;
6080 }
6081 else
6082 {
6083 [UNIVERSE addMessage:DESC(@"cloak-low-juice") forCount:3];
6084 [self playCloakingDeviceInsufficientEnergy];
6085 return NO;
6086 }
6087}
OOSystemID system_id
BOOL activateCloakingDevice()
BOOL hasCloakingDevice()

References int(), and OOCommodityMarket::massUnitForGood:.

+ Here is the call graph for this function:

◆ activatePrimableEquipment:withMode:

Definition at line 13727 of file PlayerEntity.m.

8265{
8266 // index == [eqScripts count] means we don't want to activate any equipment.
8267 if(index < [eqScripts count])
8268 {
8269 OOJSScript *eqScript = [[eqScripts oo_arrayAtIndex:index] objectAtIndex:1];
8270 JSContext *context = OOJSAcquireContext();
8271 NSAssert1(mode <= OOPRIMEDEQUIP_MODE, @"Primable equipment mode %i out of range", (int)mode);
8272
8273 switch (mode)
8274 {
8275 case OOPRIMEDEQUIP_MODE:
8276 [eqScript callMethod:OOJSID("mode") inContext:context withArguments:NULL count:0 result:NULL];
8277 break;
8279 [eqScript callMethod:OOJSID("activated") inContext:context withArguments:NULL count:0 result:NULL];
8280 break;
8281 }
8282 OOJSRelinquishContext(context);
8283 }
8284
8285}
OOINLINE JSContext * OOJSAcquireContext(void)
OOINLINE void OOJSRelinquishContext(JSContext *context)
unsigned count
OOPrimedEquipmentMode
@ OOPRIMEDEQUIP_ACTIVATED
@ OOPRIMEDEQUIP_MODE
BOOL callMethod:inContext:withArguments:count:result:(jsid methodID,[inContext] JSContext *context,[withArguments] jsval *argv,[count] intN argc,[result] jsval *outResult)
Definition OOJSScript.m:394
NSMutableArray * eqScripts
const char int mode
Definition ioapi.h:133

◆ activateSelectedInterface

- (void) activateSelectedInterface

Definition at line 9242 of file PlayerEntity.m.

9888{
9889 GuiDisplayGen* gui = [UNIVERSE gui];
9890 NSString* key = [gui selectedRowKey];
9891
9892 if ([key hasPrefix:@"More:"])
9893 {
9894 int from_item = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
9895 [self setGuiToInterfacesScreen:from_item];
9896
9897 if ([gui selectedRow] < 0)
9898 [gui setSelectedRow:GUI_ROW_INTERFACES_START];
9899 if (from_item == 0)
9900 [gui setSelectedRow:GUI_ROW_INTERFACES_START + GUI_MAX_ROWS_INTERFACES - 1];
9901 [self showInformationForSelectedInterface];
9902
9903
9904 return;
9905 }
9906
9907 NSDictionary *interfaces = [[self dockedStation] localInterfaces];
9908 OOJSInterfaceDefinition *definition = [interfaces objectForKey:key];
9909 if (definition)
9910 {
9911 [[UNIVERSE gameView] clearKeys];
9912 [definition runCallback:key];
9913 }
9914 else
9915 {
9916 OOLog(@"interface.missingCallback", @"Unable to find callback definition for key %@", key);
9917 }
9918}
#define OOLog(class, format,...)
Definition OOLogging.h:88
BOOL setSelectedRow:(OOGUIRow row)
NSString * selectedRowKey()

References GUI_MAX_ROWS_EQUIPMENT, GUI_ROW_EQUIPMENT_START, GuiDisplayGen::keyForRow:, last_outfitting_key, setGuiToEquipShipScreen:, GuiDisplayGen::setSelectedRow:, and showInformationForSelectedUpgrade.

+ Here is the call graph for this function:

◆ activeMFD

- (NSUInteger) activeMFD

◆ activeMissile

- (NSUInteger) activeMissile

◆ add:

- (void) add: (NSString *)  missionVariableString_value

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1806 :(NSString *)missionVariableString_value
1807{
1808 NSString* missionVariableString = nil;
1809 NSString* valueString;
1810 double value;
1811 NSMutableArray* tokens = ScanTokensFromString(missionVariableString_value);
1812 BOOL hasMissionPrefix, hasLocalPrefix;
1813
1814 if ([tokens count] < 2)
1815 {
1816 OOLog(kOOLogSyntaxAdd, @"***** SCRIPT ERROR: in %@, CANNOT ADD: '%@'", CurrentScriptDesc(), missionVariableString_value);
1817 return;
1818 }
1819
1820 missionVariableString = [tokens objectAtIndex:0];
1821 [tokens removeObjectAtIndex:0];
1822 valueString = [tokens componentsJoinedByString:@" "];
1823
1824 hasMissionPrefix = [missionVariableString hasPrefix:@"mission_"];
1825 hasLocalPrefix = [missionVariableString hasPrefix:@"local_"];
1826
1827 if (hasMissionPrefix)
1828 {
1829 value = [[self missionVariableForKey:missionVariableString] doubleValue];
1830 value += [valueString doubleValue];
1831 [self setMissionVariable:[NSString stringWithFormat:@"%f", value] forKey:missionVariableString];
1832 }
1833 else if (hasLocalPrefix)
1834 {
1835 value = [[self localVariableForKey:missionVariableString andMission:sCurrentMissionKey] doubleValue];
1836 value += [valueString doubleValue];
1837 [self setLocalVariable:[NSString stringWithFormat:@"%f", value] forKey:missionVariableString andMission:sCurrentMissionKey];
1838 }
1839 else
1840 {
1841 OOLog(kOOLogSyntaxAdd, @"***** SCRIPT ERROR: in %@, CANNOT ADD: '%@' -- IDENTIFIER '%@' DOES NOT BEGIN WITH 'mission_' or 'local_'", CurrentScriptDesc(), missionVariableString_value, missionVariableString_value);
1842 }
1843}
return nil
NSMutableArray * ScanTokensFromString(NSString *values)
static NSString *const kOOLogSyntaxAdd

◆ addEqScriptForKey:

- (BOOL) addEqScriptForKey: (NSString *)  eq_key

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2851 :(NSString *)eq_key
2852{
2853 if (eq_key == nil) return NO;
2854
2855 NSString *scriptName = [[OOEquipmentType equipmentTypeWithIdentifier:eq_key] scriptName];
2856
2857 OOLog(@"player.equipmentScript", @"Added equipment %@, with the following script property: '%@'.", eq_key, scriptName);
2858
2859 if (scriptName == nil) return NO;
2860
2861 NSMutableDictionary *properties = [NSMutableDictionary dictionary];
2862
2863 // no duplicates!
2864 NSArray *eqScript = nil;
2865 foreach (eqScript, eqScripts)
2866 {
2867 NSString *key = [eqScript oo_stringAtIndex:0];
2868 if ([key isEqualToString: eq_key]) return NO;
2869 }
2870
2871 [properties setObject:self forKey:@"ship"];
2872 [properties setObject:eq_key forKey:@"equipmentKey"];
2873 OOScript *s = [OOScript jsScriptFromFileNamed:scriptName properties:properties];
2874 if (s == nil) return NO;
2875
2876 OOLog(@"player.equipmentScript", @"Script '%@': installation %@successful.", scriptName,(s == nil ? @"un" : @""));
2877
2878 [eqScripts addObject:[NSArray arrayWithObjects:eq_key,s,nil]];
2879 if (primedEquipment == [eqScripts count] - 1) primedEquipment++; // if primed-none, keep it as primed-none.
2880 OOLog(@"player.equipmentScript", @"Scriptable equipment available: %llu.", [eqScripts count]);
2881 return YES;
2882}
NSString * scriptName()
OOEquipmentType * equipmentTypeWithIdentifier:(NSString *identifier)
id jsScriptFromFileNamed:properties:(NSString *fileName,[properties] NSDictionary *properties)
Definition OOScript.m:191

◆ addEquipmentFromCollection:

- (void) addEquipmentFromCollection: (id equipment

Definition at line 9242 of file PlayerEntity.m.

11669 :(id)equipment
11670{
11672 NSEnumerator *eqEnum = nil;
11673 NSString *eqDesc = nil;
11675
11676 // Pass 1: Load the entire collection.
11677 if ([equipment isKindOfClass:[NSDictionary class]])
11678 {
11679 dict = equipment;
11680 eqEnum = [equipment keyEnumerator];
11681 }
11682 else if ([equipment isKindOfClass:[NSArray class]] || [equipment isKindOfClass:[NSSet class]])
11683 {
11684 eqEnum = [equipment objectEnumerator];
11685 }
11686 else if ([equipment isKindOfClass:[NSString class]])
11687 {
11688 eqEnum = [[NSArray arrayWithObject:equipment] objectEnumerator];
11689 }
11690 else
11691 {
11692 return;
11693 }
11694
11695 while ((eqDesc = [eqEnum nextObject]))
11696 {
11697 /* Bug workaround: extra_equipment should never contain EQ_TRUMBLE,
11698 which is basically a magic flag passed to awardEquipment: to infect
11699 the player. However, prior to Oolite 1.70.1, if the player had a
11700 trumble infection and awardEquipment:EQ_TRUMBLE was called, an
11701 EQ_TRUMBLE would be added to the equipment list. Subsequent calls
11702 to awardEquipment:EQ_TRUMBLE would exit early because there was an
11703 EQ_TRUMBLE in the equipment list. as a result, it would no longer
11704 be possible to infect the player after the current infection ended.
11705
11706 The bug is fixed in 1.70.1. The following line is to fix old saved
11707 games which had been "corrupted" by the bug.
11708 -- Ahruman 2007-12-04
11709 */
11710 if ([eqDesc isEqualToString:@"EQ_TRUMBLE"]) continue;
11711
11712 // Traditional form is a dictionary of booleans; we only accept those where the value is true.
11713 if (dict != nil && ![dict oo_boolForKey:eqDesc]) continue;
11714
11715 // We need to add the entire collection without validation first and then remove the items that are
11716 // not compliant (like items that do not satisfy the requiresEquipment criterion). This is to avoid
11717 // unintentionally excluding valid equipment, just because the required equipment existed but had
11718 // not been yet added to the equipment list at the time of the canAddEquipment validation check.
11719 // Nikos, 20080817.
11720 count = [dict oo_unsignedIntegerForKey:eqDesc];
11721 for (i=0;i<count;i++)
11722 {
11723 [self addEquipmentItem:eqDesc withValidation:NO inContext:@"loading"];
11724 }
11725 }
11726
11727 // Pass 2: Remove items that do not satisfy validation criteria (like requires_equipment etc.).
11728 if ([equipment isKindOfClass:[NSDictionary class]])
11729 {
11730 eqEnum = [equipment keyEnumerator];
11731 }
11732 else if ([equipment isKindOfClass:[NSArray class]] || [equipment isKindOfClass:[NSSet class]])
11733 {
11734 eqEnum = [equipment objectEnumerator];
11735 }
11736 else if ([equipment isKindOfClass:[NSString class]])
11737 {
11738 eqEnum = [[NSArray arrayWithObject:equipment] objectEnumerator];
11739 }
11740 // Now remove items that should not be in the equipment list.
11741 while ((eqDesc = [eqEnum nextObject]))
11742 {
11743 if (![self equipmentValidToAdd:eqDesc whileLoading:YES inContext:@"loading"])
11744 {
11745 [self removeEquipmentItem:eqDesc];
11746 }
11747 }
11748}

◆ addEquipmentItem:inContext:

- (BOOL) addEquipmentItem: (NSString *)  equipmentKey
inContext: (NSString *)  context 
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11541{
11542 return [self addEquipmentItem:equipmentKey withValidation:YES inContext:context];
11543}

◆ addEquipmentItem:withValidation:inContext:

- (BOOL) addEquipmentItem: (NSString *)  equipmentKey
withValidation: (BOOL validateAddition
inContext: (NSString *)  context 
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11547{
11548 // deal with trumbles..
11549 if ([equipmentKey isEqualToString:@"EQ_TRUMBLE"])
11550 {
11551 /* Bug fix: must return here if eqKey == @"EQ_TRUMBLE", even if
11552 trumbleCount >= 1. Otherwise, the player becomes immune to
11553 trumbles. See comment in -setCommanderDataFromDictionary: for more
11554 details.
11555 -- Ahruman 2008-12-04
11556 */
11557 // the old trumbles will kill the new one if there are enough of them.
11559 {
11560 [self addTrumble:trumble[ranrot_rand() % PLAYER_MAX_TRUMBLES]]; // randomise its looks.
11561 return YES;
11562 }
11563 return NO;
11564 }
11565
11566 BOOL OK = [super addEquipmentItem:equipmentKey withValidation:validateAddition inContext:context];
11567
11568 if (OK)
11569 {
11570 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_COMPASS"] && [self compassMode] == COMPASS_MODE_BASIC)
11571 {
11572 [self setCompassMode:COMPASS_MODE_PLANET];
11573 }
11574
11575 [self addEqScriptForKey:equipmentKey];
11576 [self addEquipmentWithScriptToCustomKeyArray:equipmentKey];
11577 }
11578 return OK;
11579}
return self
#define PLAYER_MAX_TRUMBLES
NSUInteger trumbleCount
OOCompassMode compassMode
#define ranrot_rand()

Referenced by ShipAwardEquipment().

+ Here is the caller graph for this function:

◆ addEquipmentWithScriptToCustomKeyArray:

- (void) addEquipmentWithScriptToCustomKeyArray: (NSString *)  equipmentKey

Definition at line 9242 of file PlayerEntity.m.

11589{
11591 NSUInteger i, j;
11592 NSArray *object;
11593
11594 for (i = 0; i < [eqScripts count]; i++)
11595 {
11597 {
11598 //check if this equipment item is already in the array
11599 for (j = 0; j < [customEquipActivation count]; j++) {
11600 item = [customEquipActivation objectAtIndex:j];
11602 }
11603 // if we get here, this item is new
11604 // add the basic info at this point (equipkey and name only)
11606 NSMutableDictionary *customKey = [[NSMutableDictionary alloc] initWithObjectsAndKeys:equipmentKey, CUSTOMEQUIP_EQUIPKEY, [eq name], CUSTOMEQUIP_EQUIPNAME, nil];
11607
11608 // grab any default keys from the equipment item
11609 // default activate
11610 object = [eq defaultActivateKey];
11611 if ((object != nil && [object count] > 0))
11612 [customKey setObject:object forKey:CUSTOMEQUIP_KEYACTIVATE];
11613 // default mode
11614 object = [eq defaultModeKey];
11615 if ((object != nil && [object count] > 0))
11616 [customKey setObject:object forKey:CUSTOMEQUIP_KEYMODE];
11617
11618 [customEquipActivation addObject:customKey];
11619 [customKey release];
11620 // keep the keypress arrays in sync
11621 [customActivatePressed addObject:[NSNumber numberWithBool:NO]];
11622 [customModePressed addObject:[NSNumber numberWithBool:NO]];
11623
11624 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
11625 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
11626 return;
11627 }
11628 }
11629}
#define CUSTOMEQUIP_EQUIPKEY
NSArray * defaultActivateKey()
NSArray * defaultModeKey()

◆ addLiteralMissionText:

- (void) addLiteralMissionText: (NSString *)  text

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1918 :(NSString *)text
1919{
1920 if (text != nil)
1921 {
1922 GuiDisplayGen *gui = [UNIVERSE gui];
1923
1924 NSString *para = nil;
1925 foreach (para, [text componentsSeparatedByString:@"\n"])
1926 {
1927 missionTextRow = [gui addLongText:para startingAtRow:missionTextRow align:GUI_ALIGN_LEFT];
1928 }
1929 }
1930}
OOGUIRow addLongText:startingAtRow:align:(NSString *str,[startingAtRow] OOGUIRow row,[align] OOGUIAlignment alignment)

Referenced by MissionAddMessageText(), and MissionRunScreen().

+ Here is the caller graph for this function:

◆ addMessageToReport:

- (void) addMessageToReport: (NSString*)  report

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

513 :(NSString*) report
514{
515 if ([report length] != 0)
516 {
517 if ([dockingReport length] == 0)
518 [dockingReport appendString:report];
519 else
520 [dockingReport appendFormat:@"\n\n%@", report];
521 }
522}

Referenced by PlayerAddMessageToArrivalReport().

+ Here is the caller graph for this function:

◆ addMissionDestination:

- (void) addMissionDestination: (NSString *)  destinations

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2115 :(NSString *)destinations
2116{
2117 unsigned j;
2118 int dest;
2119 NSMutableArray *tokens = ScanTokensFromString(destinations);
2120
2121 for (j = 0; j < [tokens count]; j++)
2122 {
2123 dest = [tokens oo_intAtIndex:j];
2124 if (dest < 0 || dest > 255)
2125 continue;
2126
2127 [self addMissionDestinationMarker:[self defaultMarker:dest]];
2128 }
2129}

◆ addMissionDestinationMarker:

- (void) addMissionDestinationMarker: (NSDictionary *)  marker

Definition at line 9242 of file PlayerEntity.m.

13320{
13321 NSDictionary *validated = [self validatedMarker:marker];
13322 if (validated == nil)
13323 {
13324 return;
13325 }
13326
13327 [missionDestinations setObject:validated forKey:[self markerKey:validated]];
13328}

Referenced by MissionMarkSystem().

+ Here is the caller graph for this function:

◆ addMissionText:

- (void) addMissionText: (NSString *)  textKey

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1900 : (NSString *)textKey
1901{
1902 NSString *text = nil;
1903
1904 if ([textKey isEqualToString:lastTextKey]) return; // don't repeatedly add the same text
1905 [lastTextKey release];
1906 lastTextKey = [textKey copy];
1907
1908 // Replace literal \n in strings with line breaks and perform expansions.
1909 text = [[UNIVERSE missiontext] oo_stringForKey:textKey];
1910 if (text == nil) return;
1912 text = [self replaceVariablesInString:text];
1913
1914 [self addLiteralMissionText:text];
1915}
@ kOOExpandBackslashN
Convert literal "\\n"s to line breaks (used for missiontext.plist for historical reasons).
Random_Seed OOStringExpanderDefaultRandomSeed(void)
#define OOExpandWithOptions(seed, options, string,...)

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ addMoon:

- (OOPlanetEntity *) addMoon: (NSString *)  moonKey

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2359 : (NSString *)moonKey
2360{
2361 OOLog(kOOLogNoteAddPlanet, @"DEBUG: addMoon '%@'", moonKey);
2362
2363 if (!UNIVERSE)
2364 return nil;
2365 NSDictionary* dict = [[UNIVERSE systemManager] getPropertiesForSystemKey:moonKey];
2366 if (!dict)
2367 {
2368 OOLog(@"script.error.addPlanet.keyNotFound", @"***** ERROR: could not find an entry in planetinfo.plist for '%@'", moonKey);
2369 return nil;
2370 }
2371
2372 OOLog(kOOLogDebugAddPlanet, @"DEBUG: initMoonFromDictionary: %@", dict);
2373 OOPlanetEntity *planet = [[[OOPlanetEntity alloc] initFromDictionary:dict withAtmosphere:NO andSeed:[[UNIVERSE systemManager] getRandomSeedForCurrentSystem] forSystem:system_id] autorelease];
2374
2375 Quaternion planetOrientation;
2376 if (ScanQuaternionFromString([dict objectForKey:@"orientation"], &planetOrientation))
2377 {
2378 [planet setOrientation:planetOrientation];
2379 }
2380
2381 if (![dict objectForKey:@"position"])
2382 {
2383 OOLog(@"script.error.addPlanet.noPosition", @"***** ERROR: you must specify a position for scripted moon '%@' before it can be created", moonKey);
2384 return nil;
2385 }
2386
2387 NSString *positionString = [dict objectForKey:@"position"];
2388 if([positionString hasPrefix:@"abs "] && ([UNIVERSE planet] != nil || [UNIVERSE sun] !=nil))
2389 {
2390 OOLogWARN(@"script.deprecated", @"setting %@ for %@ '%@' in 'abs' inside .plists can cause compatibility issues across Oolite versions. Use coordinates relative to main system objects instead.",@"position",@"moon",moonKey);
2391 }
2392 HPVector posn = [UNIVERSE coordinatesFromCoordinateSystemString:positionString];
2393 if (posn.x || posn.y || posn.z)
2394 {
2395 OOLog(kOOLogDebugAddPlanet, @"moon position (%.2f %.2f %.2f) derived from %@", posn.x, posn.y, posn.z, positionString);
2396 }
2397 else
2398 {
2399 ScanHPVectorFromString(positionString, &posn);
2400 OOLog(kOOLogDebugAddPlanet, @"moon position (%.2f %.2f %.2f) derived from %@", posn.x, posn.y, posn.z, positionString);
2401 }
2402 [planet setPosition: posn];
2403
2404 [UNIVERSE addEntity:planet];
2405 return planet;
2406}
#define OOLogWARN(class, format,...)
Definition OOLogging.h:113
BOOL ScanHPVectorFromString(NSString *xyzString, HPVector *outVector)
BOOL ScanQuaternionFromString(NSString *wxyzString, Quaternion *outQuaternion)
static NSString *const kOOLogDebugAddPlanet
static NSString *const kOOLogNoteAddPlanet
#define UNIVERSE
Definition Universe.h:842
void setPosition:(HPVector posn)
Definition Entity.m:648
void setOrientation:(Quaternion quat)

Referenced by SystemAddMoon().

+ Here is the caller graph for this function:

◆ addParcel:start:destination:eta:fee:premium:risk:

- (BOOL) addParcel: (NSString*)  Name
start: (unsigned start
destination: (unsigned destination
eta: (double eta
fee: (double fee
premium: (double premium
risk: (unsigned risk 

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

933 :(NSString*)Name start:(unsigned)start destination:(unsigned)Destination eta:(double)eta fee:(double)fee premium:(double)premium risk:(unsigned)risk
934{
935 NSDictionary* parcel_info = [NSDictionary dictionaryWithObjectsAndKeys:
936 Name, PASSENGER_KEY_NAME,
937 [NSNumber numberWithInt:start], CONTRACT_KEY_START,
938 [NSNumber numberWithInt:Destination], CONTRACT_KEY_DESTINATION,
939 [NSNumber numberWithDouble:[PLAYER clockTime]], CONTRACT_KEY_DEPARTURE_TIME,
940 [NSNumber numberWithDouble:eta], CONTRACT_KEY_ARRIVAL_TIME,
941 [NSNumber numberWithDouble:fee], CONTRACT_KEY_FEE,
942 [NSNumber numberWithDouble:premium], CONTRACT_KEY_PREMIUM,
943 [NSNumber numberWithUnsignedInt:risk], CONTRACT_KEY_RISK,
944 NULL];
945
946 // extra checks, just in case.
947 // FIXME: do we absolutely need this check? can we live
948 // with parcels of senders who happen to have the same
949 // name? - Nikos 20160527
950 //if ([parcel_record objectForKey:Name] != nil) return NO;
951
952 if (risk > 1)
953 {
954 [self addRoleToPlayer:@"trader-courier+"];
955 }
956
957 [parcels addObject:parcel_info];
958 [parcel_record setObject:[NSNumber numberWithDouble:eta] forKey:Name];
959
960 [self doScriptEvent:OOJSID("playerEnteredContract") withArguments:[NSArray arrayWithObjects:@"parcel",parcel_info,nil]];
961
962 return YES;
963}

Referenced by PlayerShipAddParcel().

+ Here is the caller graph for this function:

◆ addPassenger:start:destination:eta:fee:advance:risk:

- (BOOL) addPassenger: (NSString*)  Name
start: (unsigned start
destination: (unsigned destination
eta: (double eta
fee: (double fee
advance: (double advance
risk: (unsigned risk 

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

879 :(NSString*)Name start:(unsigned)start destination:(unsigned)Destination eta:(double)eta fee:(double)fee advance:(double)advance risk:(unsigned)risk
880{
881 NSDictionary* passenger_info = [NSDictionary dictionaryWithObjectsAndKeys:
882 Name, PASSENGER_KEY_NAME,
883 [NSNumber numberWithInt:start], CONTRACT_KEY_START,
884 [NSNumber numberWithInt:Destination], CONTRACT_KEY_DESTINATION,
885 [NSNumber numberWithDouble:[PLAYER clockTime]], CONTRACT_KEY_DEPARTURE_TIME,
886 [NSNumber numberWithDouble:eta], CONTRACT_KEY_ARRIVAL_TIME,
887 [NSNumber numberWithDouble:fee], CONTRACT_KEY_FEE,
888 [NSNumber numberWithDouble:advance], CONTRACT_KEY_PREMIUM,
889 [NSNumber numberWithUnsignedInt:risk], CONTRACT_KEY_RISK,
890
891 NULL];
892
893 // extra checks, just in case.
894 if ([passengers count] >= max_passengers || [passenger_record objectForKey:Name] != nil) return NO;
895
896 if (risk > 1)
897 {
898 [self addRoleToPlayer:@"trader-courier+"];
899 }
900
901 [passengers addObject:passenger_info];
902 [passenger_record setObject:[NSNumber numberWithDouble:eta] forKey:Name];
903
904 [self doScriptEvent:OOJSID("playerEnteredContract") withArguments:[NSArray arrayWithObjects:@"passenger",passenger_info,nil]];
905
906 return YES;
907}

Referenced by PlayerShipAddPassenger().

+ Here is the caller graph for this function:

◆ addPlanet:

- (OOPlanetEntity *) addPlanet: (NSString *)  planetKey

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2307 : (NSString *)planetKey
2308{
2309 OOLog(kOOLogNoteAddPlanet, @"addPlanet: %@", planetKey);
2310
2311 if (!UNIVERSE)
2312 return nil;
2313 NSDictionary* dict = [[UNIVERSE systemManager] getPropertiesForSystemKey:planetKey];
2314 if (!dict)
2315 {
2316 OOLog(@"script.error.addPlanet.keyNotFound", @"***** ERROR: could not find an entry in planetinfo.plist for '%@'", planetKey);
2317 return nil;
2318 }
2319
2320 /*- add planet -*/
2321 OOLog(kOOLogDebugAddPlanet, @"DEBUG: initPlanetFromDictionary: %@", dict);
2322 OOPlanetEntity *planet = [[[OOPlanetEntity alloc] initFromDictionary:dict withAtmosphere:YES andSeed:[[UNIVERSE systemManager] getRandomSeedForCurrentSystem] forSystem:system_id] autorelease];
2323
2324 Quaternion planetOrientation;
2325 if (ScanQuaternionFromString([dict objectForKey:@"orientation"], &planetOrientation))
2326 {
2327 [planet setOrientation:planetOrientation];
2328 }
2329
2330 if (![dict objectForKey:@"position"])
2331 {
2332 OOLog(@"script.error.addPlanet.noPosition", @"***** ERROR: you must specify a position for scripted planet '%@' before it can be created", planetKey);
2333 return nil;
2334 }
2335
2336 NSString *positionString = [dict objectForKey:@"position"];
2337 if([positionString hasPrefix:@"abs "] && ([UNIVERSE planet] != nil || [UNIVERSE sun] !=nil))
2338 {
2339 OOLogWARN(@"script.deprecated", @"setting %@ for %@ '%@' in 'abs' inside .plists can cause compatibility issues across Oolite versions. Use coordinates relative to main system objects instead.",@"position",@"planet",planetKey);
2340 }
2341
2342 HPVector posn = [UNIVERSE coordinatesFromCoordinateSystemString:positionString];
2343 if (posn.x || posn.y || posn.z)
2344 {
2345 OOLog(kOOLogDebugAddPlanet, @"planet position (%.2f %.2f %.2f) derived from %@", posn.x, posn.y, posn.z, positionString);
2346 }
2347 else
2348 {
2349 ScanHPVectorFromString(positionString, &posn);
2350 OOLog(kOOLogDebugAddPlanet, @"planet position (%.2f %.2f %.2f) derived from %@", posn.x, posn.y, posn.z, positionString);
2351 }
2352 [planet setPosition: posn];
2353
2354 [UNIVERSE addEntity:planet];
2355 return planet;
2356}

Referenced by SystemAddPlanet().

+ Here is the caller graph for this function:

◆ addRoleForAggression:

- (void) addRoleForAggression: (ShipEntity *)  victim

Definition at line 13727 of file PlayerEntity.m.

5048 :(ShipEntity *)victim
5049{
5051 {
5052 return;
5053 }
5054 NSString *role = nil;
5055 if ([[victim primaryRole] isEqualToString:@"escape-capsule"])
5056 {
5057 role = @"assassin-player";
5058 }
5059 else if ([victim bounty] > 0)
5060 {
5061 role = @"hunter";
5062 }
5063 else if ([victim isPirateVictim])
5064 {
5065 role = @"pirate";
5066 }
5067 else if ([UNIVERSE role:[self primaryRole] isInCategory:@"oolite-hunter"] || [victim scanClass] == CLASS_POLICE)
5068 {
5069 role = @"pirate-interceptor";
5070 }
5071 if (role == nil)
5072 {
5073 return;
5074 }
5075 NSUInteger times = [roleWeightFlags oo_intForKey:role defaultValue:0];
5076 times++;
5077 [roleWeightFlags setObject:[NSNumber numberWithUnsignedInteger:times] forKey:role];
5078 if ((times & (times-1)) == 0) // is power of 2
5079 {
5080 [self addRoleToPlayer:role];
5081 }
5082}
unsigned isPlayer
Definition Entity.h:93
OOCreditsQuantity bounty()
BOOL isExplicitlyUnpiloted()
NSString * primaryRole
Definition ShipEntity.h:333
Entity * primaryAggressor()
BOOL isPirateVictim()
OOScanClass scanClass()
unsigned isHulk
Definition ShipEntity.h:261

◆ addRoleForMining

- (void) addRoleForMining

Definition at line 13727 of file PlayerEntity.m.

5086{
5087 NSString *role = @"miner";
5088 NSUInteger times = [roleWeightFlags oo_intForKey:role defaultValue:0];
5089 times++;
5090 [roleWeightFlags setObject:[NSNumber numberWithUnsignedInteger:times] forKey:role];
5091 if ((times & (times-1)) == 0) // is power of 2
5092 {
5093 [self addRoleToPlayer:role];
5094 }
5095}

◆ addRoleToPlayer:

- (void) addRoleToPlayer: (NSString *)  role

Definition at line 13727 of file PlayerEntity.m.

5098 :(NSString *)role
5099{
5100 NSUInteger slot = Ranrot() & ([self maxPlayerRoles]-1);
5101 [self addRoleToPlayer:role inSlot:slot];
5102}
unsigned Ranrot(void)

Referenced by PlayerSetPlayerRole().

+ Here is the caller graph for this function:

◆ addRoleToPlayer:inSlot:

- (void) addRoleToPlayer: (NSString *)  role
inSlot: (NSUInteger slot 

Definition at line 13727 of file PlayerEntity.m.

5106{
5107 if (slot >= [self maxPlayerRoles])
5108 {
5109 slot = [self maxPlayerRoles]-1;
5110 }
5111 if (slot >= [roleWeights count])
5112 {
5113 [roleWeights addObject:role];
5114 }
5115 else
5116 {
5117 [roleWeights replaceObjectAtIndex:slot withObject:role];
5118 }
5119}
NSMutableArray * roleWeights
NSUInteger maxPlayerRoles()

Referenced by PlayerSetPlayerRole().

+ Here is the caller graph for this function:

◆ addScannedWormhole:

- (void) addScannedWormhole: (WormholeEntity*)  wormhole

Definition at line 9242 of file PlayerEntity.m.

13216{
13218 assert(whole != nil);
13219
13220 // Only add if we don't have it already!
13222 foreach (wh, scannedWormholes)
13223 {
13224 if (wh == whole) return;
13225 }
13226 [whole setScannedAt:[self clockTimeAdjusted]];
13227 [scannedWormholes addObject:whole];
13228}
NSMutableArray * scannedWormholes

◆ addScenarioModel:

- (void) addScenarioModel: (NSString *)  shipKey

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

278 :(NSString *)shipKey
279{
280 [self showShipModelWithKey:shipKey shipData:nil personality:0 factorX:1.2 factorY:0.8 factorZ:6.4 inContext:@"scenario"];
281}

◆ addScene:atOffset:

- (void) addScene: (NSArray *)  items
atOffset: (Vector off 

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2583 :(NSArray *)items atOffset:(Vector)off
2584{
2585 unsigned i;
2586
2587 if (items == nil) return;
2588
2589 for (i = 0; i < [items count]; i++)
2590 {
2591 id item = [items objectAtIndex:i];
2592 if ([item isKindOfClass:[NSString class]])
2593 {
2594 [self processSceneString:item atOffset: off];
2595 }
2596 else if ([item isKindOfClass:[NSArray class]])
2597 {
2598 [self addScene:item atOffset: off];
2599 }
2600 else if ([item isKindOfClass:[NSDictionary class]])
2601 {
2602 [self processSceneDictionary:item atOffset: off];
2603 }
2604 }
2605}

◆ addShips:

- (void) addShips: (NSString *)  roles_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1498 :(NSString *)roles_number
1499{
1500 NSMutableArray* tokens = ScanTokensFromString(roles_number);
1501 NSString* roleString = nil;
1502 NSString* numberString = nil;
1503
1504 if ([tokens count] != 2)
1505 {
1506 OOLog(kOOLogSyntaxAddShips, @"***** SCRIPT ERROR: in %@, CANNOT addShips: '%@' (expected <role> <count>)", CurrentScriptDesc(), roles_number);
1507 return;
1508 }
1509
1510 roleString = [tokens objectAtIndex:0];
1511 numberString = [tokens objectAtIndex:1];
1512
1513 int number = [numberString intValue];
1514 if (number < 0)
1515 {
1516 OOLog(kOOLogSyntaxAddShips, @"***** SCRIPT ERROR: in %@, can't add %i ships -- that's less than zero, y'know..", CurrentScriptDesc(), number);
1517 return;
1518 }
1519
1520 OOLog(kOOLogNoteAddShips, @"DEBUG: Going to add %d ships with role '%@'", number, roleString);
1521
1522 while (number--)
1523 [UNIVERSE witchspaceShipWithPrimaryRole:roleString];
1524}
static NSString *const kOOLogNoteAddShips
static NSString *const kOOLogSyntaxAddShips

◆ addShipsAt:

- (void) addShipsAt: (NSString *)  roles_number_system_x_y_z

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1559 :(NSString *)roles_number_system_x_y_z
1560{
1561 NSMutableArray* tokens = ScanTokensFromString(roles_number_system_x_y_z);
1562
1563 NSString* roleString = nil;
1564 NSString* numberString = nil;
1565 NSString* systemString = nil;
1566 NSString* xString = nil;
1567 NSString* yString = nil;
1568 NSString* zString = nil;
1569
1570 if ([tokens count] != 6)
1571 {
1572 OOLog(kOOLogSyntaxAddShips, @"***** SCRIPT ERROR: in %@, CANNOT addShipsAt: '%@' (expected <role> <count> <coordinate-system> <x> <y> <z>)", CurrentScriptDesc(), roles_number_system_x_y_z);
1573 return;
1574 }
1575
1576 roleString = [tokens objectAtIndex:0];
1577 numberString = [tokens objectAtIndex:1];
1578 systemString = [tokens objectAtIndex:2];
1579 xString = [tokens objectAtIndex:3];
1580 yString = [tokens objectAtIndex:4];
1581 zString = [tokens objectAtIndex:5];
1582
1583 HPVector posn = make_HPvector([xString doubleValue], [yString doubleValue], [zString doubleValue]);
1584
1585 int number = [numberString intValue];
1586 if (number < 1)
1587 {
1588 OOLog(kOOLogSyntaxAddShips, @"----- WARNING in %@ Tried to add %i ships -- no ship added.", CurrentScriptDesc(), number);
1589 return;
1590 }
1591
1592 OOLog(kOOLogNoteAddShips, @"DEBUG: Going to add %d ship(s) with role '%@' at point (%.3f, %.3f, %.3f) using system %@", number, roleString, posn.x, posn.y, posn.z, systemString);
1593
1594 if (![UNIVERSE addShips: number withRole:roleString nearPosition: posn withCoordinateSystem: systemString])
1595 {
1596 OOLog(kOOLogScriptAddShipsFailed, @"***** SCRIPT ERROR: in %@, %@ could not add %u ships with role \"%@\"", CurrentScriptDesc(), @"addShipsAt:", number, roleString);
1597 }
1598}
static NSString *const kOOLogScriptAddShipsFailed

Referenced by SystemLegacyAddShipsAt().

+ Here is the caller graph for this function:

◆ addShipsAtPrecisely:

- (void) addShipsAtPrecisely: (NSString *)  roles_number_system_x_y_z

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1601 :(NSString *)roles_number_system_x_y_z
1602{
1603 NSMutableArray* tokens = ScanTokensFromString(roles_number_system_x_y_z);
1604
1605 NSString* roleString = nil;
1606 NSString* numberString = nil;
1607 NSString* systemString = nil;
1608 NSString* xString = nil;
1609 NSString* yString = nil;
1610 NSString* zString = nil;
1611
1612 if ([tokens count] != 6)
1613 {
1614 OOLog(kOOLogSyntaxAddShips, @"***** SCRIPT ERROR: in %@,* CANNOT addShipsAtPrecisely: '%@' (expected <role> <count> <coordinate-system> <x> <y> <z>)", CurrentScriptDesc(), roles_number_system_x_y_z);
1615 return;
1616 }
1617
1618 roleString = [tokens objectAtIndex:0];
1619 numberString = [tokens objectAtIndex:1];
1620 systemString = [tokens objectAtIndex:2];
1621 xString = [tokens objectAtIndex:3];
1622 yString = [tokens objectAtIndex:4];
1623 zString = [tokens objectAtIndex:5];
1624
1625 HPVector posn = make_HPvector([xString doubleValue], [yString doubleValue], [zString doubleValue]);
1626
1627 int number = [numberString intValue];
1628 if (number < 1)
1629 {
1630 OOLog(kOOLogSyntaxAddShips, @"----- WARNING: in %@, Can't add %i ships -- no ship added.", CurrentScriptDesc(), number);
1631 return;
1632 }
1633
1634 OOLog(kOOLogNoteAddShips, @"DEBUG: Going to add %d ship(s) with role '%@' precisely at point (%.3f, %.3f, %.3f) using system %@", number, roleString, posn.x, posn.y, posn.z, systemString);
1635
1636 if (![UNIVERSE addShips: number withRole:roleString atPosition: posn withCoordinateSystem: systemString])
1637 {
1638 OOLog(kOOLogScriptAddShipsFailed, @"***** SCRIPT ERROR: in %@, %@ could not add %u ships with role '%@'", CurrentScriptDesc(), @"addShipsAtPrecisely:", number, roleString);
1639 }
1640}

Referenced by SystemLegacyAddShipsAtPrecisely().

+ Here is the caller graph for this function:

◆ addShipsWithinRadius:

- (void) addShipsWithinRadius: (NSString *)  roles_number_system_x_y_z_r

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1643 :(NSString *)roles_number_system_x_y_z_r
1644{
1645 NSMutableArray* tokens = ScanTokensFromString(roles_number_system_x_y_z_r);
1646
1647 if ([tokens count] != 7)
1648 {
1649 OOLog(kOOLogSyntaxAddShips, @"***** SCRIPT ERROR: in %@, CANNOT 'addShipsWithinRadius: %@' (expected <role> <count> <coordinate-system> <x> <y> <z> <radius>))", CurrentScriptDesc(), roles_number_system_x_y_z_r);
1650 return;
1651 }
1652
1653 NSString* roleString = [tokens objectAtIndex:0];
1654 int number = [[tokens objectAtIndex:1] intValue];
1655 NSString* systemString = [tokens objectAtIndex:2];
1656 double x = [[tokens objectAtIndex:3] doubleValue];
1657 double y = [[tokens objectAtIndex:4] doubleValue];
1658 double z = [[tokens objectAtIndex:5] doubleValue];
1659 GLfloat r = [[tokens objectAtIndex:6] floatValue];
1660 HPVector posn = make_HPvector(x, y, z);
1661
1662 if (number < 1)
1663 {
1664 OOLog(kOOLogSyntaxAddShips, @"----- WARNING: in %@, can't add %i ships -- no ship added.", CurrentScriptDesc(), number);
1665 return;
1666 }
1667
1668 OOLog(kOOLogNoteAddShips, @"DEBUG: Going to add %d ship(s) with role '%@' within %.2f radius about point (%.3f, %.3f, %.3f) using system %@", number, roleString, r, x, y, z, systemString);
1669
1670 if (![UNIVERSE addShips:number withRole: roleString nearPosition: posn withCoordinateSystem: systemString withinRadius: r])
1671 {
1672 OOLog(kOOLogScriptAddShipsFailed, @"***** SCRIPT ERROR :in %@, %@ could not add %u ships with role \"%@\"", CurrentScriptDesc(), @"addShipsWithinRadius:", number, roleString);
1673 }
1674}
float y
float x

Referenced by SystemLegacyAddShipsWithinRadius().

+ Here is the caller graph for this function:

◆ addSystemShips:

- (void) addSystemShips: (NSString *)  roles_number_position

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1527 :(NSString *)roles_number_position
1528{
1529 NSMutableArray* tokens = ScanTokensFromString(roles_number_position);
1530 NSString* roleString = nil;
1531 NSString* numberString = nil;
1532 NSString* positionString = nil;
1533
1534 if ([tokens count] != 3)
1535 {
1536 OOLog(kOOLogSyntaxAddShips, @"***** SCRIPT ERROR: in %@, CANNOT addSystemShips: '%@' (expected <role> <count> <position>)", CurrentScriptDesc(), roles_number_position);
1537 return;
1538 }
1539
1540 roleString = [tokens objectAtIndex:0];
1541 numberString = [tokens objectAtIndex:1];
1542 positionString = [tokens objectAtIndex:2];
1543
1544 int number = [numberString intValue];
1545 double posn = [positionString doubleValue];
1546 if (number < 0)
1547 {
1548 OOLog(kOOLogSyntaxAddShips, @"***** SCRIPT ERROR: in %@, can't add %i ships -- that's less than zero, y'know..", CurrentScriptDesc(), number);
1549 return;
1550 }
1551
1552 OOLog(kOOLogNoteAddShips, @"DEBUG: Going to add %d ships with role '%@' at a point %.3f along route1", number, roleString, posn);
1553
1554 while (number--)
1555 [UNIVERSE addShipWithRole:roleString nearRouteOneAt:posn];
1556}

◆ addTarget:

- (void) addTarget: (Entity *)  targetEntity
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

12269 :(Entity *) targetEntity
12270{
12271 if ([self status] != STATUS_IN_FLIGHT && [self status] != STATUS_WITCHSPACE_COUNTDOWN) return;
12272 if (targetEntity == self) return;
12273
12274 [super addTarget:targetEntity];
12275
12277 {
12278 assert ([self hasEquipmentItemProviding:@"EQ_WORMHOLE_SCANNER"]);
12279 [self addScannedWormhole:(WormholeEntity*)targetEntity];
12280 }
12281 // wormholes don't go in target memory
12282 else if ([self hasEquipmentItemProviding:@"EQ_TARGET_MEMORY"] && targetEntity != nil)
12283 {
12284 OOWeakReference *targetRef = [targetEntity weakSelf];
12285 NSUInteger i = [target_memory indexOfObject:targetRef];
12286 // if already in target memory, preserve that and just change the index
12287 if (i != NSNotFound)
12288 {
12290 }
12291 else
12292 {
12293 i = [target_memory indexOfObject:[NSNull null]];
12294 // find and use a blank space in memory
12295 if (i != NSNotFound)
12296 {
12297 [target_memory replaceObjectAtIndex:i withObject:targetRef];
12299 }
12300 else
12301 {
12302 // use the next memory space
12304 [target_memory replaceObjectAtIndex:target_memory_index withObject:targetRef];
12305 }
12306 }
12307 }
12308
12309 if (ident_engaged)
12310 {
12311 [self playIdentLockedOn];
12312 [self printIdentLockedOnForMissile:NO];
12313 }
12314 else if ([targetEntity isShip] && [self weaponsOnline]) // Only let missiles target-lock onto ships
12315 {
12317 {
12319 [missile_entity[activeMissile] addTarget:targetEntity];
12320 [self playMissileLockedOn];
12321 [self printIdentLockedOnForMissile:YES];
12322 }
12323 else // It's a mine or something
12324 {
12326 [self playIdentLockedOn];
12327 [self printIdentLockedOnForMissile:NO];
12328 }
12329 }
12330}
@ MISSILE_STATUS_TARGET_LOCKED
@ MISSILE_STATUS_ARMED
#define PLAYER_TARGET_MEMORY_SIZE
unsigned isShip
Definition Entity.h:91
OOEntityStatus status()
Definition Entity.m:794
unsigned isWormhole
Definition Entity.h:94
OOWeakReference * weakSelf
unsigned ident_engaged
NSUInteger target_memory_index
ShipEntity * missile_entity[PLAYER_MAX_MISSILES]
NSUInteger activeMissile
OOMissileStatus missile_status
unsigned isMissile
Definition ShipEntity.h:273

◆ addToAdjustTime:

- (void) addToAdjustTime: (double seconds

Definition at line 13727 of file PlayerEntity.m.

4904 :(double)seconds
4905{
4907}
double ship_clock_adjust

Referenced by PlayerSetEscapePodDestination().

+ Here is the caller graph for this function:

◆ addTrumble:

- (void) addTrumble: (OOTrumble *)  papaTrumble

Definition at line 9242 of file PlayerEntity.m.

12024{
12026 {
12027 return;
12028 }
12029 OOTrumble *trumblePup = trumble[trumbleCount];
12030 [trumblePup spawnFrom:papaTrumble];
12031 trumbleCount++;
12032}
void spawnFrom:(OOTrumble *parentTrumble)
Definition OOTrumble.m:219
OOTrumble * trumble[PLAYER_MAX_TRUMBLES]

◆ adjusted_chart_centre

- (NSPoint) adjusted_chart_centre

Definition at line 13727 of file PlayerEntity.m.

591{
592 NSPoint acc; // adjusted chart centre
593 double scroll_pos; // cursor coordinate at which we'd want to scoll chart in the direction we're currently considering
594 double ecc; // chart centre coordinate we'd want if the cursor was on the edge of the galaxy in the current direction
595
599 {
600 return galaxy_coordinates;
601 }
605 {
606 return NSMakePoint(128.0, 128.0);
607 }
611 {
613 }
614 // When fully zoomed in we want to centre chart on chart_centre_coordinates. When zoomed out we want the chart centred on
615 // (128.0, 128.0) so the galaxy fits the screen width. For intermediate zoom we interpolate.
618
619 // If the cursor is out of the centre non-scrolling part of the screen adjust the chart centre. If the cursor is just at scroll_pos
620 // we want to return the chart centre as it is, but if it's at the edge of the galaxy we want the centre positioned so the cursor is
621 // at the edge of the screen
623 {
626 if (scroll_pos <= 0)
627 {
628 acc.x = ecc;
629 }
630 else
631 {
633 }
634 }
636 {
638 ecc = 256.0 - CHART_WIDTH_AT_MAX_ZOOM*chart_zoom / 2.0;
639 if (scroll_pos >= 256.0)
640 {
641 acc.x = ecc;
642 }
643 else
644 {
646 }
647 }
649 {
652 if (scroll_pos <= 0)
653 {
654 acc.y = ecc;
655 }
656 else
657 {
659 }
660 }
662 {
665 if (scroll_pos >= 256.0)
666 {
667 acc.y = ecc;
668 }
669 else
670 {
672 }
673 }
674 return acc;
675}
@ GUI_BACKGROUND_SPECIAL_CUSTOM_ANA_QUICKEST
@ GUI_BACKGROUND_SPECIAL_SHORT_ANA_SHORTEST
@ GUI_BACKGROUND_SPECIAL_LONG
@ GUI_BACKGROUND_SPECIAL_LONG_ANA_SHORTEST
@ GUI_BACKGROUND_SPECIAL_SHORT
@ GUI_BACKGROUND_SPECIAL_SHORT_ANA_QUICKEST
@ GUI_BACKGROUND_SPECIAL_LONG_ANA_QUICKEST
@ GUI_BACKGROUND_SPECIAL_CUSTOM
@ GUI_BACKGROUND_SPECIAL_CUSTOM_ANA_SHORTEST
#define CHART_WIDTH_AT_MAX_ZOOM
#define CHART_MAX_ZOOM
#define CHART_HEIGHT_AT_MAX_ZOOM
#define CHART_SCROLL_AT_Y
#define CHART_SCROLL_AT_X
NSPoint custom_chart_centre_coordinates
NSPoint galaxy_coordinates
OOScalar chart_zoom
NSPoint chart_focus_coordinates
OOGUIBackgroundSpecial _missionBackgroundSpecial
NSPoint chart_centre_coordinates

◆ adjustPriceByScriptForEqKey:withCurrent:

Definition at line 9242 of file PlayerEntity.m.

10299{
10301 if (condition_script != nil)
10302 {
10303 OOJSScript *condScript = [UNIVERSE getConditionScript:condition_script];
10304 if (condScript != nil) // should always be non-nil, but just in case
10305 {
10307 BOOL OK;
10308 jsval result;
10311 OK = JS_NewNumberValue(JScontext, price, &args[1]);
10312
10313 if (OK)
10314 {
10315 OK = [condScript callMethod:OOJSID("updateEquipmentPrice")
10316 inContext:JScontext
10317 withArguments:args count:sizeof args / sizeof *args
10318 result:&result];
10319 }
10320
10321 if (OK)
10322 {
10323 OK = JS_ValueToInt32(JScontext, result, &newPrice);
10324 if (OK && newPrice >= 0)
10325 {
10326 price = (OOCreditsQuantity)newPrice;
10327 }
10328 }
10330 }
10331 }
10332 return price;
10333}
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
uint64_t OOCreditsQuantity
Definition OOTypes.h:182
NSString * conditionScript()

◆ adjustTradeInFactorBy:

- (void) adjustTradeInFactorBy: (int value

Definition at line 9242 of file PlayerEntity.m.

11906 :(int)value
11907{
11908 ship_trade_in_factor += value;
11911}
int ship_trade_in_factor
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ aftShieldLevel

- (GLfloat) aftShieldLevel

Definition at line 13727 of file PlayerEntity.m.

4702{
4703 return aft_shield;
4704}
GLfloat aft_shield

◆ aftShieldRechargeRate

- (float) aftShieldRechargeRate

Definition at line 13727 of file PlayerEntity.m.

4666{
4668}
GLfloat aft_shield_recharge_rate

◆ alertCondition

- (OOAlertCondition) alertCondition

Reimplemented from ShipEntity.

◆ alertFlags

- (int) alertFlags

◆ allowMissionInterrupt

- (void) allowMissionInterrupt

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

237{
238 _missionAllowInterrupt = YES;
239}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ ANAMode

- (OORouteType) ANAMode

Definition at line 13727 of file PlayerEntity.m.

679{
680 return ANA_mode;
681}
OORouteType ANA_mode

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ applyAttitudeChanges:

- (void) applyAttitudeChanges: (double delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4283 :(double) delta_t
4284{
4285 [self applyRoll:flightRoll*delta_t andClimb:flightPitch*delta_t];
4286 [self applyYaw:flightYaw*delta_t];
4287}

◆ applyMarketFilter:onMarket:

- (NSArray *) applyMarketFilter: (NSArray *)  goods
onMarket: (OOCommodityMarket *)  market 

Definition at line 9242 of file PlayerEntity.m.

10857{
10859 {
10860 return goods;
10861 }
10862 NSMutableArray *filteredGoods = [NSMutableArray arrayWithCapacity:[goods count]];
10864 foreach (good, goods)
10865 {
10866 switch (marketFilterMode)
10867 {
10869 // never reached, but keeps compiler happy
10870 [filteredGoods addObject:good];
10871 break;
10874 {
10875 [filteredGoods addObject:good];
10876 }
10877 break;
10879 if ([self cargoQuantityForType:good] > 0)
10880 {
10881 [filteredGoods addObject:good];
10882 }
10883 break;
10885 if ([market quantityForGood:good] > 0)
10886 {
10887 [filteredGoods addObject:good];
10888 }
10889 break;
10892 {
10893 [filteredGoods addObject:good];
10894 }
10895 break;
10898 {
10899 [filteredGoods addObject:good];
10900 }
10901 break;
10902 }
10903 }
10904 return [[filteredGoods copy] autorelease];
10905}
NSString * OOCommodityType
Definition OOTypes.h:106
@ MARKET_FILTER_MODE_HOLD
@ MARKET_FILTER_MODE_RESTRICTED
@ MARKET_FILTER_MODE_STOCK
@ MARKET_FILTER_MODE_TRADE
@ MARKET_FILTER_MODE_OFF
@ MARKET_FILTER_MODE_LEGAL
OOMarketFilterMode marketFilterMode

◆ applyMarketSorter:onMarket:

- (NSArray *) applyMarketSorter: (NSArray *)  goods
onMarket: (OOCommodityMarket *)  market 

Definition at line 9242 of file PlayerEntity.m.

10909{
10910 switch (marketSorterMode)
10911 {
10913 return [goods sortedArrayUsingFunction:marketSorterByName context:market];
10915 return [goods sortedArrayUsingFunction:marketSorterByPrice context:market];
10917 return [goods sortedArrayUsingFunction:marketSorterByQuantity context:market];
10919 return [goods sortedArrayUsingFunction:marketSorterByQuantity context:shipCommodityData];
10921 return [goods sortedArrayUsingFunction:marketSorterByMassUnit context:market];
10923 // keep default sort order
10924 break;
10925 }
10926 return goods;
10927}
@ MARKET_SORTER_MODE_PRICE
@ MARKET_SORTER_MODE_OFF
@ MARKET_SORTER_MODE_STOCK
@ MARKET_SORTER_MODE_ALPHA
@ MARKET_SORTER_MODE_UNIT
@ MARKET_SORTER_MODE_HOLD
OOMarketSorterMode marketSorterMode

◆ applyRoll:andClimb:

- (void) applyRoll: (GLfloat roll1
andClimb: (GLfloat climb1 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4291{
4292 if (roll1 == 0.0 && climb1 == 0.0 && hasRotated == NO)
4293 return;
4294
4295 if (roll1)
4297 if (climb1)
4299
4300 /* Bugginess may put us in a state where the orientation quat is all
4301 zeros, at which point it’s impossible to move.
4302 */
4304 {
4306 {
4308 }
4309 else
4310 {
4312 }
4313 }
4314
4315 [self orientationChanged];
4316}
#define EXPECT_NOT(x)
void quaternion_rotate_about_x(Quaternion *quat, OOScalar angle)
void quaternion_rotate_about_z(Quaternion *quat, OOScalar angle)
const Quaternion kIdentityQuaternion
const Quaternion kZeroQuaternion
unsigned hasRotated
Definition Entity.h:97
Quaternion orientation
Definition Entity.h:114
Quaternion lastOrientation
Definition Entity.h:134

◆ applyYaw:

- (void) applyYaw: (GLfloat yaw

Definition at line 13727 of file PlayerEntity.m.

4323 :(GLfloat) yaw
4324{
4326
4327 [self orientationChanged];
4328}
void quaternion_rotate_about_y(Quaternion *quat, OOScalar angle)

◆ assignToActivePylon:

- (BOOL) assignToActivePylon: (NSString *)  identifierKey

Definition at line 13727 of file PlayerEntity.m.

6030{
6031 if (!launchingMissile) return NO;
6032
6034
6035 if ([equipmentKey hasSuffix:@"_DAMAGED"])
6036 {
6037 return NO;
6038 }
6039 else
6040 {
6042 }
6043
6044 // missiles with techlevel above 99 (kOOVariableTechLevel) are never available to the player
6045 if (![eqType isMissileOrMine] || [eqType effectiveTechLevel] > kOOVariableTechLevel)
6046 {
6047 return NO;
6048 }
6049
6050 ShipEntity *amiss = [UNIVERSE newShipWithRole:equipmentKey];
6051
6052 if (!amiss) return NO;
6053
6054 // replace the missile now.
6055 [missile_entity[activeMissile] release];
6056 missile_entity[activeMissile] = amiss;
6057 missile_list[activeMissile] = eqType;
6058
6059 // make sure the new missile is properly activated.
6060 if (activeMissile > 0) activeMissile--;
6061 else activeMissile = max_missiles - 1;
6062 [self selectNextMissile];
6063
6065
6066 return YES;
6067}
@ kOOVariableTechLevel
Definition OOTypes.h:202
unsigned launchingMissile
unsigned replacingMissile
unsigned max_missiles
Definition ShipEntity.h:320
OOEquipmentType * missile_list[SHIPENTITY_MAX_MISSILES]
Definition ShipEntity.h:434

◆ atHyperspeed

- (BOOL) atHyperspeed

Definition at line 13727 of file PlayerEntity.m.

4480{
4482}
unsigned travelling_at_hyperspeed

◆ autosavePlayer

- (void) autosavePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

146{
147 NSString *tmp_path = nil;
148 NSString *tmp_name = nil;
149 NSString *dir = [[UNIVERSE gameController] playerFileDirectory];
150
151 tmp_name = [self lastsaveName];
152 tmp_path = save_path;
153
154 ShipScriptEventNoCx(self, "playerWillSaveGame", OOJSSTR("AUTO_SAVE"));
155
156 NSString *saveName = [self lastsaveName];
157 NSString *autosaveSuffix = DESC(@"autosave-commander-suffix");
158
159 if (![saveName hasSuffix:autosaveSuffix])
160 {
161 saveName = [saveName stringByAppendingString:autosaveSuffix];
162 }
163 NSString *savePath = [dir stringByAppendingPathComponent:[saveName stringByAppendingString:@".oolite-save"]];
164
165 [self setLastsaveName:saveName];
166
167 @try
168 {
169 [self writePlayerToPath:savePath];
170 }
171 @catch (id exception)
172 {
173 // Suppress exceptions silently. Warning the user about failed autosaves would be pretty unhelpful.
174 }
175
176 if (tmp_path != nil)
177 {
178 [save_path autorelease];
179 save_path = [tmp_path copy];
180 }
181 [self setLastsaveName:tmp_name];
182}
#define OOJSSTR(str)
#define ShipScriptEventNoCx(ship, event,...)
#define DESC(key)
Definition Universe.h:848

◆ availableFacings

- (OOWeaponFacingSet) availableFacings

Definition at line 9242 of file PlayerEntity.m.

9294{
9296 NSDictionary *shipyardInfo = [registry shipyardInfoForKey:[self shipDataKey]];
9297 unsigned available_facings = [shipyardInfo oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:[self weaponFacings]]; // use defaults explicitly
9298
9300}
#define VALID_WEAPON_FACINGS
Definition OOTypes.h:239
NSDictionary * shipyardInfoForKey:(NSString *key)
OOShipRegistry * sharedRegistry()

◆ awardCargo:

- (void) awardCargo: (NSString *)  amount_typeString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1345 :(NSString *)amount_typeString
1346{
1347 if (scriptTarget != self) return;
1348
1349 NSArray *tokens = ScanTokensFromString(amount_typeString);
1350 OOCargoQuantityDelta amount;
1351 OOCommodityType type;
1352 OOMassUnit unit;
1353
1354 if ([tokens count] != 2)
1355 {
1356 OOLog(kOOLogSyntaxAwardCargo, @"***** SCRIPT ERROR: in %@, CANNOT awardCargo: '%@' (%@)", CurrentScriptDesc(), amount_typeString, @"bad parameter count");
1357 return;
1358 }
1359
1360
1361 type = [tokens oo_stringAtIndex:1];
1362 if (![[UNIVERSE commodities] goodDefined:type])
1363 {
1364 OOLog(kOOLogSyntaxAwardCargo, @"***** SCRIPT ERROR: in %@, CANNOT awardCargo: '%@' (%@)", CurrentScriptDesc(), amount_typeString, @"unknown type");
1365 return;
1366 }
1367
1368 amount = [tokens oo_intAtIndex:0];
1369 if (amount < 0)
1370 {
1371 OOLog(kOOLogSyntaxAwardCargo, @"***** SCRIPT ERROR: in %@, CANNOT awardCargo: '%@' (%@)", CurrentScriptDesc(), amount_typeString, @"negative quantity");
1372 return;
1373 }
1374
1375 unit = [shipCommodityData massUnitForGood:type];
1376 if (specialCargo && unit == UNITS_TONS)
1377 {
1378 OOLog(kOOLogSyntaxAwardCargo, @"***** SCRIPT ERROR: in %@, CANNOT awardCargo: '%@' (%@)", CurrentScriptDesc(), amount_typeString, @"cargo hold full with special cargo");
1379 return;
1380 }
1381
1382 [self awardCommodityType:type amount:amount];
1383}
int32_t OOCargoQuantityDelta
Definition OOTypes.h:177
OOMassUnit
Definition OOTypes.h:123
@ UNITS_TONS
Definition OOTypes.h:124
static NSString *const kOOLogSyntaxAwardCargo

◆ awardCommodityType:amount:

- (void) awardCommodityType: (NSString *)  type
amount: (OOCargoQuantity amount 

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

82 :(OOCommodityType)type amount:(OOCargoQuantity)amount
83{
84 OOMassUnit unit;
85
86 if (![[UNIVERSE commodities] goodDefined:type])
87 {
88 return;
89 }
90
91 OOLog(@"script.debug.note.awardCargo", @"Going to award cargo: %d x '%@'", amount, type);
92
93 unit = [shipCommodityData massUnitForGood:type];
94
95 if ([self status] != STATUS_DOCKED)
96 {
97 // in-flight
98 while (amount)
99 {
100 if (unit != UNITS_TONS)
101 {
102 if (specialCargo)
103 {
104 // is this correct behaviour?
105 [shipCommodityData addQuantity:amount forGood:type];
106 }
107 else
108 {
109 int amount_per_container = (unit == UNITS_KILOGRAMS)? 1000 : 1000000;
110 while (amount > 0)
111 {
112 int smaller_quantity = 1 + ((amount - 1) % amount_per_container);
113 if ([cargo count] < [self maxAvailableCargoSpace])
114 {
115 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
116 if (container)
117 {
118 // the cargopod ship is just being set up. If ejected, will call UNIVERSE addEntity
119 // [container wasAddedToUniverse]; // seems to be not needed anymore for pods
120 [container setScanClass: CLASS_CARGO];
121 [container setStatus:STATUS_IN_HOLD];
122 [container setCommodity:type andAmount:smaller_quantity];
123 [cargo addObject:container];
124 [container release];
125 }
126 }
127 amount -= smaller_quantity;
128 }
129 }
130 }
131 else if (!specialCargo)
132 // no adding TCs while special cargo in hold
133 {
134 // put each ton in a separate container
135 while (amount)
136 {
137 if ([cargo count] < [self maxAvailableCargoSpace])
138 {
139 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
140 if (container)
141 {
142 // the cargopod ship is just being set up. If ejected, will call UNIVERSE addEntity
143 // [container wasAddedToUniverse]; // seems to be not needed anymore for pods
144 [container setScanClass: CLASS_CARGO];
145 [container setStatus:STATUS_IN_HOLD];
146 [container setCommodity:type andAmount:1];
147 [cargo addObject:container];
148 [container release];
149 }
150 }
151 amount--;
152 }
153 }
154 }
155 }
156 else
157 { // docked
158 // like purchasing a commodity
159 int manifest_quantity = [shipCommodityData quantityForGood:type];
160 while ((amount)&&(current_cargo < [self maxAvailableCargoSpace]))
161 {
162 manifest_quantity++;
163 amount--;
164 if (unit == UNITS_TONS) current_cargo++;
165 }
166 [shipCommodityData setQuantity:manifest_quantity forGood:type];
167 }
168 [self calculateCurrentCargo];
169}
uint32_t OOCargoQuantity
Definition OOTypes.h:176
@ UNITS_KILOGRAMS
Definition OOTypes.h:125
void setScanClass:(OOScanClass sClass)
Definition Entity.m:800
void setStatus:(OOEntityStatus stat)
void setCommodity:andAmount:(OOCommodityType co_type,[andAmount] OOCargoQuantity co_amount)

◆ awardContract:commodity:start:destination:eta:fee:premium:

- (BOOL) awardContract: (unsigned qty
commodity: (NSString*)  commodity
start: (unsigned start
destination: (unsigned destination
eta: (double eta
fee: (double fee
premium: (double premium 

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

989 :(unsigned)qty commodity:(OOCommodityType)type start:(unsigned)start
990 destination:(unsigned)Destination eta:(double)eta fee:(double)fee premium:(double)premium
991{
992
993 unsigned sr1 = Ranrot()&0x111111;
994 int sr2 = Ranrot()&0x111111;
995
996 NSString *cargo_ID =[NSString stringWithFormat:@"%06x-%06x", sr1, sr2];
997
998 if (![[UNIVERSE commodities] goodDefined:type]) return NO;
999 if (qty < 1) return NO;
1000
1001 // avoid duplicate cargo_IDs
1002 while ([contract_record objectForKey:cargo_ID] != nil)
1003 {
1004 sr2++;
1005 cargo_ID =[NSString stringWithFormat:@"%06x-%06x", sr1, sr2];
1006 }
1007
1008 NSDictionary* cargo_info = [NSDictionary dictionaryWithObjectsAndKeys:
1009 cargo_ID, CARGO_KEY_ID,
1010 type, CARGO_KEY_TYPE,
1011 [NSNumber numberWithInt:qty], CARGO_KEY_AMOUNT,
1012 [UNIVERSE describeCommodity:type amount:qty], CARGO_KEY_DESCRIPTION,
1013 [NSNumber numberWithInt:start], CONTRACT_KEY_START,
1014 [NSNumber numberWithInt:Destination], CONTRACT_KEY_DESTINATION,
1015 [NSNumber numberWithDouble:[PLAYER clockTime]], CONTRACT_KEY_DEPARTURE_TIME,
1016 [NSNumber numberWithDouble:eta], CONTRACT_KEY_ARRIVAL_TIME,
1017 [NSNumber numberWithDouble:fee], CONTRACT_KEY_FEE,
1018 [NSNumber numberWithDouble:premium], CONTRACT_KEY_PREMIUM,
1019 NULL];
1020
1021 // check available space
1022
1023 OOCargoQuantity cargoSpaceRequired = qty;
1024 OOMassUnit contractCargoUnits = [shipCommodityData massUnitForGood:type];
1025
1026 if (contractCargoUnits == UNITS_KILOGRAMS) cargoSpaceRequired /= 1000;
1027 if (contractCargoUnits == UNITS_GRAMS) cargoSpaceRequired /= 1000000;
1028
1029 if (cargoSpaceRequired > [self availableCargoSpace]) return NO;
1030
1031 [shipCommodityData addQuantity:qty forGood:type];
1032
1033 current_cargo = [self cargoQuantityOnBoard];
1034
1035 if ([shipCommodityData exportLegalityForGood:type] > 0)
1036 {
1037 [self addRoleToPlayer:@"trader-smuggler"];
1038 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-illegal"];
1039 }
1040 else
1041 {
1042 [self addRoleToPlayer:@"trader"];
1043 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-legal"];
1044 }
1045
1046 [contracts addObject:cargo_info];
1047 [contract_record setObject:[NSNumber numberWithDouble:eta] forKey:cargo_ID];
1048
1049 [self doScriptEvent:OOJSID("playerEnteredContract") withArguments:[NSArray arrayWithObjects:@"cargo",cargo_info,nil]];
1050
1051 return YES;
1052}
@ UNITS_GRAMS
Definition OOTypes.h:126

Referenced by PlayerShipAwardContract().

+ Here is the caller graph for this function:

◆ awardCredits:

- (void) awardCredits: (NSString *)  valueString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1222 :(NSString *)valueString
1223{
1224 if (scriptTarget != self) return;
1225
1226 /* We can't use -longLongValue here for Mac OS X 10.4 compatibility, but
1227 we don't need to since larger values have never been supported for
1228 legacy scripts.
1229 */
1230 int64_t award = [valueString intValue];
1231 award *= 10;
1232 if (award < 0 && credits < (OOCreditsQuantity)-award) credits = 0;
1233 else credits += award;
1234}

◆ awardEquipment:

- (void) awardEquipment: (NSString *)  equipString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1246 :(NSString *)equipString //eg. EQ_NAVAL_ENERGY_UNIT
1247{
1248 if (scriptTarget != self) return;
1249
1250 if ([equipString isEqualToString:@"EQ_FUEL"])
1251 {
1252 [self setFuel:[self fuelCapacity]];
1253 }
1254
1256
1257 if ([eqType isMissileOrMine])
1258 {
1259 [self mountMissileWithRole:equipString];
1260 }
1261 else if([equipString hasPrefix:@"EQ_WEAPON"] && ![equipString hasSuffix:@"_DAMAGED"])
1262 {
1263 OOLog(kOOLogSyntaxAwardEquipment, @"***** SCRIPT ERROR: in %@, CANNOT award undamaged weapon:'%@'. Damaged weapons can be awarded instead.", CurrentScriptDesc(), equipString);
1264 }
1265 else if ([equipString hasSuffix:@"_DAMAGED"] && [self hasEquipmentItem:[equipString substringToIndex:[equipString length] - [@"_DAMAGED" length]]])
1266 {
1267 OOLog(kOOLogSyntaxAwardEquipment, @"***** SCRIPT ERROR: in %@, CANNOT award damaged equipment:'%@'. Undamaged version already equipped.", CurrentScriptDesc(), equipString);
1268 }
1269 else if ([eqType canCarryMultiple] || ![self hasEquipmentItem:equipString])
1270 {
1271 [self addEquipmentItem:equipString withValidation:YES inContext:@"scripted"];
1272 }
1273}
static NSString *const kOOLogSyntaxAwardEquipment

◆ awardFuel:

- (void) awardFuel: (NSString *)  valueString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1450 :(NSString *)valueString // add to fuel up to 7.0 LY
1451{
1452 int delta = 10 * [valueString floatValue];
1453 OOFuelQuantity scriptTargetFuelBeforeAward = [scriptTarget fuel];
1454
1455 if (delta < 0 && scriptTargetFuelBeforeAward < (unsigned)-delta) [scriptTarget setFuel:0];
1456 else
1457 {
1458 [scriptTarget setFuel:(scriptTargetFuelBeforeAward + delta)];
1459 }
1460}
uint16_t OOFuelQuantity
Definition OOTypes.h:179

◆ awardShipKills:

- (void) awardShipKills: (NSString *)  valueString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1237 :(NSString *)valueString
1238{
1239 if (scriptTarget != self) return;
1240
1241 int value = [valueString intValue];
1242 if (0 < value) ship_kills += value;
1243}

◆ baseMass

- (GLfloat) baseMass

Definition at line 13727 of file PlayerEntity.m.

196{
197 if (sBaseMass <= 0.0)
198 {
199 // First call with initialised mass (in [UNIVERSE setUpInitialUniverse]) is always to the cobra 3, even when starting with a savegame.
200 if ([self mass] > 0.0) // bootstrap the base mass.
201 {
202 OOLog(@"fuelPrices", @"Setting Cobra3 base mass to: %.2f ", [self mass]);
203 sBaseMass = [self mass];
204 }
205 else
206 {
207 // This happened on startup when [UNIVERSE setUpSpace] was called before player init, inside [UNIVERSE setUpInitialUniverse].
208 OOLog(@"fuelPrices", @"%@", @"Player ship not initialised properly yet, using precalculated base mass.");
209 return 185580.0;
210 }
211 }
212
213 return sBaseMass;
214}
static GLfloat sBaseMass
GLfloat mass
Definition Entity.h:146

◆ beginWitchspaceCountdown

- (void) beginWitchspaceCountdown

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

889{
890 if ([self hasHyperspaceMotor]) {
891 [self beginWitchspaceCountdown:hyperspaceMotorSpinTime];
892 }
893}

◆ beginWitchspaceCountdown:

- (void) beginWitchspaceCountdown: (int spin_time

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

853 :(int)spin_time
854{
855 if ([self hasHyperspaceMotor])
856 {
857 if (spin_time == 0)
858 {
859 witchspaceCountdown = hyperspaceMotorSpinTime;
860 }
861 else
862 {
863#ifndef OO_DUMP_PLANETINFO
864 if (spin_time < 5)
865 {
866 witchspaceCountdown = 5;
867 }
868 else
869#endif
870 {
871 witchspaceCountdown = spin_time;
872 }
873 }
874 [self setStatus:STATUS_WITCHSPACE_COUNTDOWN];
875 [self playStandardHyperspace];
876 // say it!
877 [UNIVERSE clearPreviousMessage];
878 int seconds = round(witchspaceCountdown);
879 NSString *destination = [UNIVERSE getSystemName:[self nextHopTargetSystemID]];
880 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-to-x-in-y-seconds", seconds, destination) forCount:1.0];
881 [self doScriptEvent:OOJSID("playerStartedJumpCountdown")
882 withArguments:[NSArray arrayWithObjects:@"standard", [NSNumber numberWithFloat:witchspaceCountdown], nil]];
883 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
884 }
885}

Referenced by PlayerShipBeginHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ blowUpStation

- (void) blowUpStation

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2255{
2256 StationEntity *mainStation = nil;
2257
2258 mainStation = [UNIVERSE station];
2259 if (mainStation != nil)
2260 {
2261 [UNIVERSE unMagicMainStation];
2262 [mainStation takeEnergyDamage:500000000.0 from:nil becauseOf:nil weaponIdentifier:@""]; // 500 million should do it!
2263 }
2264}
void takeEnergyDamage:from:becauseOf:weaponIdentifier:(double amount, [from] Entity *ent, [becauseOf] Entity *other, [weaponIdentifier] NSString *weaponIdentifier)

◆ boop

- (void) boop
implementation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

200{
201 [self playInterfaceBeep:@"[general-boop]"];
202}

◆ bounty

- (OOCreditsQuantity) bounty
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6827{
6828 return legalStatus;
6829}

◆ breakPatternPosition

- (HPVector) breakPatternPosition

Definition at line 13727 of file PlayerEntity.m.

4365{
4367}
Vector quaternion_rotate_vector(Quaternion q, Vector v)
HPVector position
Definition Entity.h:112
Vector forwardViewOffset

◆ buySelectedItem

- (void) buySelectedItem

Definition at line 9242 of file PlayerEntity.m.

10202{
10203 GuiDisplayGen* gui = [UNIVERSE gui];
10204 NSString* key = [gui selectedRowKey];
10205
10206 if ([key hasPrefix:@"More:"])
10207 {
10208 int from_item = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
10209 NSString *weaponKey = [[key componentsSeparatedByString:@":"] oo_stringAtIndex:2];
10210
10211 [self setGuiToEquipShipScreen:from_item];
10212 if (weaponKey != nil)
10213 {
10214 [self highlightEquipShipScreenKey:weaponKey];
10215 }
10216 else
10217 {
10218 if ([gui selectedRow] < 0)
10219 [gui setSelectedRow:GUI_ROW_EQUIPMENT_START];
10220 if (from_item == 0)
10221 [gui setSelectedRow:GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT - 1];
10222 [self showInformationForSelectedUpgrade];
10223 }
10224
10225 return;
10226 }
10227
10229
10230 // FIXME: this is nuts, should be associating lines with keys in some sensible way. --Ahruman 20080311
10239
10242 BOOL isRepair = [self hasEquipmentItem:[eqInfo damagedIdentifier]];
10243 if ([self tryBuyingItem:key])
10244 {
10245 if (credits == old_credits)
10246 {
10247 // laser pre-purchase, or free equipment
10248 [self playMenuNavigationDown];
10249 }
10250 else
10251 {
10252 [self playBuyCommodity];
10253 }
10254
10255 if(credits != old_credits || ![key hasPrefix:@"EQ_WEAPON_"])
10256 {
10257 // adjust time before playerBoughtEquipment gets to change credits dynamically
10258 // wind the clock forward by 10 minutes plus 10 minutes for every 60 credits spent
10259 NSUInteger adjust = 0;
10260 if (isRepair)
10261 {
10262 adjust = [eqInfo repairTime];
10263 }
10264 else
10265 {
10266 adjust = [eqInfo installTime];
10267 }
10268 double time_adjust = (old_credits > credits) ? (old_credits - credits) : 0.0;
10269 [UNIVERSE forceWitchspaceEntries];
10270 if (adjust == 0)
10271 {
10272 ship_clock_adjust += time_adjust + 600.0;
10273 }
10274 else
10275 {
10277 }
10278
10279 [self doScriptEvent:OOJSID("playerBoughtEquipment") withArguments:[NSArray arrayWithObjects:key, [NSNumber numberWithLongLong:(old_credits - credits)], nil]];
10280 if (gui_screen == GUI_SCREEN_EQUIP_SHIP) //if we haven't changed gui screen inside playerBoughtEquipment
10281 {
10282 // show any change due to playerBoughtEquipment
10283 [self setGuiToEquipShipScreen:0];
10284 // then try to go back where we were
10285 [self highlightEquipShipScreenKey:key];
10286 }
10287
10288 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
10289 }
10290 }
10291 else
10292 {
10293 [self playCantBuyCommodity];
10294 }
10295}
@ WEAPON_FACING_FORWARD
Definition OOTypes.h:229
@ WEAPON_FACING_AFT
Definition OOTypes.h:230
@ WEAPON_FACING_PORT
Definition OOTypes.h:231
@ WEAPON_FACING_STARBOARD
Definition OOTypes.h:232
#define PORT_FACING_STRING
#define FORWARD_FACING_STRING
#define AFT_FACING_STRING
#define STARBOARD_FACING_STRING
NSString * selectedRowText()
NSUInteger repairTime()
NSString * damagedIdentifier()
NSUInteger installTime()
OOCreditsQuantity credits
OOGUIScreenID gui_screen
OOWeaponFacing chosen_weapon_facing

◆ buySelectedShip

- (BOOL) buySelectedShip

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1727{
1728 GuiDisplayGen *gui = [UNIVERSE gui];
1729 OOGUIRow selectedRow = [gui selectedRow];
1730
1731 if (selectedRow <= 0) return NO;
1732
1733 NSString *key = [gui keyForRow:selectedRow];
1734
1735 if ([key hasPrefix:@"More:"])
1736 {
1737 NSInteger fromShip = [[key componentsSeparatedByString:@":"] oo_integerAtIndex:1];
1738 if (fromShip < 0) fromShip = 0;
1739
1740 [self setGuiToShipyardScreen:fromShip];
1741 if ([[UNIVERSE gui] selectedRow] < 0)
1742 {
1743 [[UNIVERSE gui] setSelectedRow:GUI_ROW_SHIPYARD_START];
1744 }
1745 if (fromShip == 0)
1746 {
1747 [[UNIVERSE gui] setSelectedRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1];
1748 }
1749 // next bit or the first ship on the list gets wrongly previewed
1750 // clean up the display
1751 NSMutableArray *row_info = [NSMutableArray arrayWithArray:(NSArray*)[gui objectForRow:GUI_ROW_SHIPYARD_LABELS]];
1752 while ([row_info count] < 4)
1753 {
1754 [row_info addObject:@""];
1755 }
1756 [row_info replaceObjectAtIndex:2 withObject:@""];
1757 [row_info replaceObjectAtIndex:3 withObject:@""];
1758 NSUInteger i;
1759 for (i = GUI_ROW_SHIPYARD_INFO_START; i < GUI_ROW_MARKET_CASH - 1; i++)
1760 {
1761 [gui setText:@"" forRow:i];
1762 [gui setColor:[gui colorFromSetting:kGuiShipyardDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
1763 }
1764 [gui setArray:[NSArray arrayWithArray:row_info] forRow:GUI_ROW_SHIPYARD_LABELS];
1765 [UNIVERSE removeDemoShips];
1766 return YES;
1767 }
1768
1769 // first check you can afford it!
1770 NSDictionary *shipInfo = [currentShipyard oo_dictionaryForKey:key];
1771 OOCreditsQuantity price = [shipInfo oo_unsignedLongLongForKey:SHIPYARD_KEY_PRICE];
1772 OOCreditsQuantity tradeIn = [self tradeInValue];
1773
1774 if (credits + tradeIn < price * 10)
1775 return NO; // you can't afford it!
1776
1777 // from this point, the player is committed to buying - raise a pre-buy script event
1778 [self doScriptEvent:OOJSID("playerWillBuyNewShip")
1779 withArguments:[NSArray arrayWithObjects:[shipInfo oo_stringForKey:SHIPYARD_KEY_SHIPDATA_KEY],
1780 [[[self dockedStation] localShipyard] objectAtIndex:selectedRow - GUI_ROW_SHIPYARD_START],
1781 [NSNumber numberWithUnsignedLongLong:price],
1782 [NSNumber numberWithUnsignedLongLong:(tradeIn / 10)], nil]];
1783
1784 // sell all the commodities carried
1785 NSString *good = nil;
1786 foreach (good, [shipCommodityData goods])
1787 {
1788 [self trySellingCommodity:good all:YES];
1789 }
1790 // We tried to sell everything. If there are still items present in our inventory, it
1791 // means that the market got saturated (quantity in station > 127 t) before we could sell
1792 // it all. Everything that could not be sold will be lost. -- Nikos 20083012
1793
1794 // pay over the mazoolah
1795 credits -= 10 * price - tradeIn;
1796
1797 NSDictionary *shipDict = [shipInfo oo_dictionaryForKey:SHIPYARD_KEY_SHIP];
1798 [self newShipCommonSetup:[shipInfo oo_stringForKey:SHIPYARD_KEY_SHIPDATA_KEY] yardInfo:shipInfo baseInfo:shipDict];
1799
1800 // this ship has a clean record
1801 legalStatus = 0;
1802
1803 NSArray *extras = [shipInfo oo_arrayForKey:KEY_EQUIPMENT_EXTRAS];
1804 for (NSUInteger i = 0; i < [extras count]; i++)
1805 {
1806 NSString *eq_key = [extras oo_stringAtIndex:i];
1807 if ([eq_key isEqualToString:@"EQ_PASSENGER_BERTH"])
1808 {
1809 max_passengers++;
1810 max_cargo -= PASSENGER_BERTH_SPACE;
1811 }
1812 else
1813 {
1814 [self addEquipmentItem:eq_key withValidation:YES inContext:@"newShip"];
1815 }
1816 }
1817
1818 // add bought ship to shipyard_record
1819 [shipyard_record setObject:[self shipDataKey] forKey:[shipInfo objectForKey:SHIPYARD_KEY_ID]];
1820
1821 // remove the ship from the localShipyard
1822 [[[self dockedStation] localShipyard] removeObjectAtIndex:selectedRow - GUI_ROW_SHIPYARD_START];
1823
1824 // perform the transformation
1825 NSDictionary* cmdr_dict = [self commanderDataDictionary]; // gather up all the info
1826 if (![self setCommanderDataFromDictionary:cmdr_dict]) return NO;
1827
1828 [self setStatus:STATUS_DOCKED];
1829 [self setEntityPersonalityInt:[shipInfo oo_unsignedShortForKey:SHIPYARD_KEY_PERSONALITY]];
1830
1831 // adjust the clock forward by an hour
1832 ship_clock_adjust += 3600.0;
1833
1834 // finally we can get full hock if we sell it back
1835 ship_trade_in_factor = 100;
1836
1837 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
1838
1839 return YES;
1840}
NSInteger OOGUIRow
#define GUI_ROW_SHIPYARD_INFO_START
@ GUI_ROW_MARKET_CASH
#define PASSENGER_BERTH_SPACE
Definition Universe.h:152
OOColor * colorFromSetting:defaultValue:(NSString *setting,[defaultValue] OOColor *def)
void setText:forRow:(NSString *str,[forRow] OOGUIRow row)
OOGUIRow selectedRow
void setColor:forRow:(OOColor *color,[forRow] OOGUIRow row)
id objectForRow:(OOGUIRow row)
NSString * keyForRow:(OOGUIRow row)
void setArray:forRow:(NSArray *arr,[forRow] OOGUIRow row)
OOColor * greenColor()
Definition OOColor.m:274

◆ calculateCurrentCargo

- (void) calculateCurrentCargo

Definition at line 9242 of file PlayerEntity.m.

10781{
10782 current_cargo = [self cargoQuantityOnBoard];
10783}
OOCargoQuantity current_cargo

◆ canAddEquipment:inContext:

- (BOOL) canAddEquipment: (NSString *)  equipmentKey
inContext: (NSString *)  context 
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11529{
11530 if ([equipmentKey isEqualToString:@"EQ_RENOVATION"] && !(ship_trade_in_factor < 85 || [[[self shipSubEntityEnumerator] allObjects] count] < [self maxShipSubEntities])) return NO;
11532
11533 NSArray *conditions = [[OOEquipmentType equipmentTypeWithIdentifier:equipmentKey] conditions];
11534 if (conditions != nil && ![self scriptTestConditions:conditions]) return NO;
11535
11536 return YES;
11537}
NSEnumerator * shipSubEntityEnumerator()
NSUInteger maxShipSubEntities()
Definition ShipEntity.m:792

◆ cancelDockingRequest:

- (void) cancelDockingRequest: (StationEntity *)  stationForDocking

Definition at line 13727 of file PlayerEntity.m.

3651{
3652 if (stationForDocking == nil) return;
3654 if ([self isDocked]) return;
3655 if (autopilot_engaged && [self targetStation] == stationForDocking) return;
3657 {
3658 [self disengageAutopilot];
3659 }
3661 {
3663 if (stationDockingClearanceStatus != nil && [stationDockingClearanceStatus isEqualToString:@"DOCKING_CLEARANCE_CANCELLED"])
3664 {
3665 [self doScriptEvent:OOJSID("playerDockingClearanceCancelled")];
3666 }
3667 }
3668}
@ DOCKING_CLEARANCE_STATUS_GRANTED
Definition OOTypes.h:171
@ DOCKING_CLEARANCE_STATUS_REQUESTED
Definition OOTypes.h:170
unsigned isStation
Definition Entity.h:92
unsigned autopilot_engaged
OODockingClearanceStatus dockingClearanceStatus
StationEntity * targetStation()
NSString * acceptDockingClearanceRequestFrom:(ShipEntity *other)

Referenced by PlayerShipCancelDockingRequest().

+ Here is the caller graph for this function:

◆ cancelWitchspaceCountdown

- (void) cancelWitchspaceCountdown

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

897{
898 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN) {
899 [self setStatus:STATUS_IN_FLIGHT];
900 [self playHyperspaceAborted];
901 }
902 // say it!
903 [UNIVERSE clearPreviousMessage];
904 [self doScriptEvent:OOJSID("playerCancelledJumpCountdown")];
905}

Referenced by PlayerShipCancelHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

2480{
2481 switch ([self status])
2482 {
2483 case STATUS_START_GAME:
2484 case STATUS_DOCKING:
2485 case STATUS_DOCKED:
2486 case STATUS_DEAD:
2488 return NO;
2489
2490 default:
2491 return YES;
2492 }
2493}

◆ canScoop:

- (BOOL) canScoop: (ShipEntity *)  other
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4983 :(ShipEntity *)other
4984{
4985 if (specialCargo) return NO;
4986 return [super canScoop:other];
4987}
NSString * specialCargo

◆ cargoContractMarker:

- (NSDictionary *) cargoContractMarker: (OOSystemID system

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

300 :(OOSystemID)system
301{
302 return [[[NSDictionary dictionaryWithObjectsAndKeys:
303 [NSNumber numberWithInt:system], @"system",
304 MISSION_DEST_LEGACY, @"name",
305 @"orangeColor", @"markerColor",
306 @"MARKER_SQUARE", @"markerShape",
307 nil] retain] autorelease];
308}
int16_t OOSystemID
Definition OOTypes.h:211

◆ cargoList

- (NSArray *) cargoList

Definition at line 13727 of file PlayerEntity.m.

8352{
8353 NSMutableArray *manifest = [NSMutableArray array];
8354 NSArray *list = [self cargoListForScripting];
8356
8357 if (specialCargo) [manifest addObject:specialCargo];
8358
8359 foreach (commodity, list)
8360 {
8361 NSInteger quantity = [commodity oo_integerForKey:@"quantity"];
8362 NSString *units = [commodity oo_stringForKey:@"unit"];
8363 NSString *commodityName = [commodity oo_stringForKey:@"displayName"];
8364 NSInteger containers = [commodity oo_intForKey:@"containers"];
8365 BOOL extended = ![units isEqualToString:DESC(@"cargo-tons-symbol")] && containers > 0;
8366
8367 if (extended) {
8368 [manifest addObject:OOExpandKey(@"manifest-cargo-quantity-extended", quantity, units, commodityName, containers)];
8369 } else {
8370 [manifest addObject:OOExpandKey(@"manifest-cargo-quantity", quantity, units, commodityName)];
8371 }
8372 }
8373
8374 return manifest;
8375}

◆ cargoListForScripting

- (NSArray *) cargoListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

8379{
8380 NSMutableArray *list = [NSMutableArray array];
8381
8382 NSUInteger i, j, commodityCount = [shipCommodityData count];
8383 OOCargoQuantity quantityInHold[commodityCount];
8384 OOCargoQuantity containersInHold[commodityCount];
8385 NSArray *goods = [shipCommodityData goods];
8386
8387 // following changed to work whether docked or not
8388 for (i = 0; i < commodityCount; i++)
8389 {
8390 quantityInHold[i] = [shipCommodityData quantityForGood:[goods oo_stringAtIndex:i]];
8391 containersInHold[i] = 0;
8392 }
8393 for (i = 0; i < [cargo count]; i++)
8394 {
8395 ShipEntity *container = [cargo objectAtIndex:i];
8396 j = [goods indexOfObject:[container commodityType]];
8399 }
8400
8401 for (i = 0; i < commodityCount; i++)
8402 {
8403 if (quantityInHold[i] > 0)
8404 {
8405 NSMutableDictionary *commodity = [NSMutableDictionary dictionaryWithCapacity:4];
8406 NSString *symName = [goods oo_stringAtIndex:i];
8407 // commodity, quantity - keep consistency between .manifest and .contracts
8408 [commodity setObject:symName forKey:@"commodity"];
8409 [commodity setObject:[NSNumber numberWithUnsignedInt:quantityInHold[i]] forKey:@"quantity"];
8410 [commodity setObject:[NSNumber numberWithUnsignedInt:containersInHold[i]] forKey:@"containers"];
8411 [commodity setObject:[shipCommodityData nameForGood:symName] forKey:@"displayName"];
8412 [commodity setObject:DisplayStringForMassUnitForCommodity(symName) forKey:@"unit"];
8413 [list addObject:commodity];
8414 }
8415 }
8416
8417 return [[list copy] autorelease]; // return an immutable copy
8418}
OOCargoQuantity commodityAmount()
OOCommodityType commodityType()

Referenced by ManifestGetProperty().

+ Here is the caller graph for this function:

◆ cargoQuantityForType:

- (OOCargoQuantity) cargoQuantityForType: (OOCommodityType type

Definition at line 9242 of file PlayerEntity.m.

10706 :(OOCommodityType)type
10707{
10708 OOCargoQuantity amount = [shipCommodityData quantityForGood:type];
10709
10710 if ([self status] != STATUS_DOCKED)
10711 {
10712 NSInteger i;
10715
10716 for (i = [cargo count] - 1; i >= 0 ; i--)
10717 {
10718 cargoItem = [cargo objectAtIndex:i];
10719 co_type = [cargoItem commodityType];
10720 if ([co_type isEqualToString:type])
10721 {
10723 }
10724 }
10725 }
10726
10727 return amount;
10728}
NSMutableArray * cargo
Definition ShipEntity.h:361

◆ cargoQuantityOnBoard

- (OOCargoQuantity) cargoQuantityOnBoard
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

10787{
10788 if ([self specialCargo] != nil)
10789 {
10790 return [self maxAvailableCargoSpace];
10791 }
10792
10793 /*
10794 The cargo array is nil when the player ship is docked, due to action in unloadCargopods. For
10795 this reason, we must use a slightly more complex method to determine the quantity of cargo
10796 carried in this case - Nikos 20090830
10797
10798 Optimised this method, to compensate for increased usage - Kaks 20091002
10799 */
10801 NSString *good = nil;
10802
10803 foreach (good, [shipCommodityData goods])
10804 {
10805 OOCargoQuantity quantity = [shipCommodityData quantityForGood:good];
10806
10807 OOMassUnit commodityUnits = [shipCommodityData massUnitForGood:good];
10808
10810 {
10811 // calculate the number of pods that would be used
10812 // we're using integer math, so 99/100 = 0 , 100/100 = 1, etc...
10813
10814 assert(KILOGRAMS_PER_POD > MAX_KILOGRAMS_IN_SAFE && GRAMS_PER_POD > MAX_GRAMS_IN_SAFE); // otherwise we're in trouble!
10815
10818 }
10820 }
10822
10823 return cargoQtyOnBoard;
10824}
#define MAX_KILOGRAMS_IN_SAFE
#define MAX_GRAMS_IN_SAFE
#define KILOGRAMS_PER_POD
#define GRAMS_PER_POD
OOCommodityMarket * shipCommodityData

◆ changePassengerBerths:

- (BOOL) changePassengerBerths: (int addRemove

Definition at line 9242 of file PlayerEntity.m.

10658 :(int) addRemove
10659{
10660 if (addRemove == 0) return NO;
10661 addRemove = (addRemove > 0) ? 1 : -1; // change only by one berth at a time!
10662 // NSFO!
10663 //unsigned passenger_space = [[OOEquipmentType equipmentTypeWithIdentifier:@"EQ_PASSENGER_BERTH"] requiredCargoSpace];
10664 //if (passenger_space == 0) passenger_space = PASSENGER_BERTH_SPACE;
10665 if ((max_passengers < 1 && addRemove == -1) || ([self maxAvailableCargoSpace] - current_cargo < PASSENGER_BERTH_SPACE && addRemove == 1)) return NO;
10668 return YES;
10669}
unsigned max_passengers
OOCargoQuantity maxAvailableCargoSpace()
OOCargoQuantity max_cargo
Definition ShipEntity.h:295

Referenced by ShipAwardEquipment().

+ Here is the caller graph for this function:

◆ chart_centre_coordinates

- (NSPoint) chart_centre_coordinates

◆ chart_zoom

- (OOScalar) chart_zoom

◆ checkCustomEquipButtons:ignore:

- (void) checkCustomEquipButtons: (NSDictionary *)  stickFn
ignore: (int idx 
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

317 :(NSDictionary *)stickFn ignore:(int)idx
318{
319 int i;
320 for (i = 0; i < [customEquipActivation count]; i++)
321 {
322 if (i != idx) {
323 NSMutableDictionary *custEquip = [[customEquipActivation objectAtIndex:i] mutableCopy];
324 NSDictionary *bf = [[customEquipActivation objectAtIndex:i] objectForKey:CUSTOMEQUIP_BUTTONACTIVATE];
325 if ([bf oo_integerForKey:STICK_NUMBER] == [stickFn oo_integerForKey:STICK_NUMBER] &&
326 [bf oo_integerForKey:STICK_AXBUT] == [stickFn oo_integerForKey:STICK_AXBUT] &&
327 [custEquip objectForKey:CUSTOMEQUIP_BUTTONACTIVATE])
328 {
329 [custEquip removeObjectForKey:CUSTOMEQUIP_BUTTONACTIVATE];
330 }
331 bf = [[customEquipActivation objectAtIndex:i] objectForKey:CUSTOMEQUIP_BUTTONMODE];
332 if ([bf oo_integerForKey:STICK_NUMBER] == [stickFn oo_integerForKey:STICK_NUMBER] &&
333 [bf oo_integerForKey:STICK_AXBUT] == [stickFn oo_integerForKey:STICK_AXBUT] &&
334 [custEquip objectForKey:CUSTOMEQUIP_BUTTONMODE])
335 {
336 [custEquip removeObjectForKey:CUSTOMEQUIP_BUTTONMODE];
337 }
338 [customEquipActivation replaceObjectAtIndex:i withObject:custEquip];
339 [custEquip release];
340 }
341 }
342}
#define STICK_NUMBER
#define STICK_AXBUT
#define CUSTOMEQUIP_BUTTONACTIVATE
#define CUSTOMEQUIP_BUTTONMODE

◆ checkEntityForMassLock:withScanClass:

- (BOOL) checkEntityForMassLock: (Entity *)  ent
withScanClass: (int theirClass 
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3365{
3366 BOOL massLocked = NO;
3367 BOOL entIsCloakedShip = [ent isShip] && [(ShipEntity *)ent isCloaked];
3368
3370 {
3372 if (EXPECT([stellar planetType] != STELLAR_TYPE_MINIATURE))
3373 {
3374 double dist = stellar->zero_distance;
3375 double rad = stellar->collision_radius;
3376 double factor = ([stellar isSun]) ? 2.0 : 4.0;
3377 // plus ensure mass lock when 25 km or less from the surface of small stellar bodies
3378 // dist is a square distance so it needs to be compared to (rad+25000) * (rad+25000)!
3379 if (dist < rad*rad*factor || dist < rad*rad + 50000*rad + 625000000 )
3380 {
3381 massLocked = YES;
3382 }
3383 }
3384 }
3385 else if (theirClass != CLASS_NO_DRAW)
3386 {
3388 {
3390 }
3391 }
3392
3393 if (!massLocked && ent->zero_distance <= SCANNER_MAX_RANGE2)
3394 {
3395 switch (theirClass)
3396 {
3397 case CLASS_NO_DRAW:
3398 // cloaked ships do mass lock! - Nikos 20200718
3399 if (entIsCloakedShip && ![ent isPlayer])
3400 {
3401 massLocked = YES;
3402 }
3403 break;
3404 case CLASS_PLAYER:
3405 case CLASS_BUOY:
3406 case CLASS_ROCK:
3407 case CLASS_CARGO:
3408 case CLASS_MINE:
3410 break;
3411
3412 case CLASS_THARGOID:
3413 case CLASS_MISSILE:
3414 case CLASS_STATION:
3415 case CLASS_POLICE:
3416 case CLASS_MILITARY:
3417 case CLASS_WORMHOLE:
3418 default:
3419 massLocked = YES;
3420 break;
3421 }
3422 }
3423
3424 return massLocked;
3425}
#define SCANNER_MAX_RANGE2
Definition Entity.h:52
#define EXPECT(x)
@ STELLAR_TYPE_MINIATURE
BOOL isSun()
Definition Entity.m:168
GLfloat zero_distance
Definition Entity.h:108
BOOL isStellarObject()
Definition Entity.m:180

◆ checkForShips:

- (void) checkForShips: (NSString *)  roleString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1886 :(NSString *)roleString
1887{
1888 shipsFound = [UNIVERSE countShipsWithPrimaryRole:roleString];
1889}
static int shipsFound

◆ checkKeyPress:

- (BOOL) checkKeyPress: (NSArray*)  key_def

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

610 :(NSArray*)key_def
611{
612 return [self checkKeyPress:key_def fKey_only:NO ignore_ctrl:NO];
613}

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ checkKeyPress:fKey_only:

- (BOOL) checkKeyPress: (NSArray*)  key_def
fKey_only: (BOOL fKey_only 

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

616 :(NSArray*)key_def fKey_only:(BOOL)fKey_only
617{
618 return [self checkKeyPress:key_def fKey_only:fKey_only ignore_ctrl:NO];
619}

◆ checkKeyPress:fKey_only:ignore_ctrl:

- (BOOL) checkKeyPress: (NSArray*)  key_def
fKey_only: (BOOL fKey_only
ignore_ctrl: (BOOL ignore_ctrl 

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

628 :(NSArray*)key_def fKey_only:(BOOL)fKey_only ignore_ctrl:(BOOL)ignore_ctrl
629{
630 MyOpenGLView *gameView = [UNIVERSE gameView];
631 int i;
632 for (i = 0; i < [key_def count]; i++)
633 {
634 NSDictionary *def = [key_def objectAtIndex:i];
635 int keycode = [[def objectForKey:@"key"] intValue];
636 // skip normal keys if the fKey_only flag is set
637 // note: if the player has remapped the gui screen keys to not include function keys, they will not be able to
638 // switch screens directly (they would need to finish the task - ie press enter, or use the escape key to cancel the function)
639 // note: the logic below now means that the state of the modifiers must match the requirements for the key binding, including
640 // when all settings are off. This means, if the player presses two functions at once, one that requires a modifier and
641 // one that doesn't, the one that doesn't will not be triggered.
642 if (fKey_only == YES && (keycode < gvFunctionKey1 || keycode > gvFunctionKey11)) continue;
643 if ([gameView isDown:keycode]
644 && ([[def objectForKey:@"shift"] boolValue] == [gameView isShiftDown])
645 && (ignore_ctrl || ([[def objectForKey:@"mod1"] boolValue] == [gameView isCtrlDown]))
646 && ([[def objectForKey:@"mod2"] boolValue] == [gameView isOptDown])
647 ) return YES;
648 }
649 return NO;
650}
@ gvFunctionKey11

◆ checkKeyPress:ignore_ctrl:

- (BOOL) checkKeyPress: (NSArray*)  key_def
ignore_ctrl: (BOOL ignore_ctrl 

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

622 :(NSArray*)key_def ignore_ctrl:(BOOL)ignore_ctrl
623{
624 return [self checkKeyPress:key_def fKey_only:NO ignore_ctrl:ignore_ctrl];
625}

◆ checkNavKeyPress:

- (BOOL) checkNavKeyPress: (NSArray*)  key_def

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

597 :(NSArray*)key_def
598{
599 MyOpenGLView *gameView = [UNIVERSE gameView];
600 int i;
601 for (i = 0; i < [key_def count]; i++)
602 {
603 NSDictionary *def = [key_def objectAtIndex:i];
604 if ([gameView isDown:[[def objectForKey:@"key"] intValue]]) return YES;
605 }
606 return NO;
607}

◆ checkPassengerContracts

- (NSString *) checkPassengerContracts

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

168{
169 if ([self dockedStation] != [UNIVERSE station]) // only drop off passengers or fulfil contracts at main station
170 return nil;
171
172 // check escape pods...
173 // TODO
174
175 NSMutableString *result = [NSMutableString string];
176 unsigned i;
177
178 // check passenger contracts
179 for (i = 0; i < [passengers count]; i++)
180 {
181 NSDictionary* passenger_info = [[passengers oo_dictionaryAtIndex:i] retain];
182 NSString* passenger_name = [passenger_info oo_stringForKey:PASSENGER_KEY_NAME];
183 int dest = [passenger_info oo_intForKey:CONTRACT_KEY_DESTINATION];
184 // the system name can change via script
185 NSString* passenger_dest_name = [UNIVERSE getSystemName: dest];
186 int dest_eta = [passenger_info oo_doubleForKey:CONTRACT_KEY_ARRIVAL_TIME] - ship_clock;
187
188 if (system_id == dest)
189 {
190 // we've arrived in system!
191 if (dest_eta > 0)
192 {
193 // and in good time
194 long long fee = [passenger_info oo_longLongForKey:CONTRACT_KEY_FEE];
195 while ((randf() < 0.75)&&(dest_eta > 3600)) // delivered with more than an hour to spare and a decent customer?
196 {
197 fee *= 110; // tip + 10%
198 fee /= 100;
199 dest_eta *= 0.5;
200 }
201 credits += 10 * fee;
202
203 [result appendFormatLine:DESC(@"passenger-delivered-okay-@-@-@"), passenger_name, OOIntCredits(fee), passenger_dest_name];
204 if ([passenger_info oo_unsignedIntForKey:CONTRACT_KEY_RISK defaultValue:0] > 0)
205 {
206 [self addRoleToPlayer:@"trader-courier+"];
207 }
208
209 [self increasePassengerReputation:RepForRisk([passenger_info oo_unsignedIntForKey:CONTRACT_KEY_RISK defaultValue:0])];
210 [passengers removeObjectAtIndex:i--];
211 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"passenger",@"success",[NSNumber numberWithUnsignedInteger:(10*fee)],passenger_info,nil]];
212 }
213 else
214 {
215 // but we're late!
216 long long fee = [passenger_info oo_longLongForKey:CONTRACT_KEY_FEE] / 2; // halve fare
217 while (randf() < 0.5) // maybe halve fare a few times!
218 fee /= 2;
219 credits += 10 * fee;
220
221 [result appendFormatLine:DESC(@"passenger-delivered-late-@-@-@"), passenger_name, OOIntCredits(fee), passenger_dest_name];
222 if ([passenger_info oo_unsignedIntForKey:CONTRACT_KEY_RISK defaultValue:0] > 0)
223 {
224 [self addRoleToPlayer:@"trader-courier+"];
225 }
226
227 [passengers removeObjectAtIndex:i--];
228 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"passenger",@"late",[NSNumber numberWithUnsignedInteger:10*fee],passenger_info,nil]];
229
230 }
231 }
232 else
233 {
234 if (dest_eta < 0)
235 {
236 // we've run out of time!
237 [result appendFormatLine:DESC(@"passenger-failed-@"), passenger_name];
238
239 [self decreasePassengerReputation:RepForRisk([passenger_info oo_unsignedIntForKey:CONTRACT_KEY_RISK defaultValue:0])];
240 [passengers removeObjectAtIndex:i--];
241 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"passenger",@"failed",[NSNumber numberWithUnsignedInteger:0],passenger_info,nil]];
242 }
243 }
244 [passenger_info release];
245 }
246
247 // check parcel contracts
248 for (i = 0; i < [parcels count]; i++)
249 {
250 NSDictionary* parcel_info = [[parcels oo_dictionaryAtIndex:i] retain];
251 NSString* parcel_name = [parcel_info oo_stringForKey:PASSENGER_KEY_NAME];
252 int dest = [parcel_info oo_intForKey:CONTRACT_KEY_DESTINATION];
253 int dest_eta = [parcel_info oo_doubleForKey:CONTRACT_KEY_ARRIVAL_TIME] - ship_clock;
254
255 if (system_id == dest)
256 {
257 // we've arrived in system!
258 if (dest_eta > 0)
259 {
260 // and in good time
261 long long fee = [parcel_info oo_longLongForKey:CONTRACT_KEY_FEE];
262 while ((randf() < 0.75)&&(dest_eta > 86400)) // delivered with more than a day to spare and a decent customer?
263 {
264 // lower tips than passengers
265 fee *= 110; // tip + 10%
266 fee /= 100;
267 dest_eta *= 0.5;
268 }
269 credits += 10 * fee;
270
271 [result appendFormatLine:DESC(@"parcel-delivered-okay-@-@"), parcel_name, OOIntCredits(fee)];
272
273 [self increaseParcelReputation:RepForRisk([parcel_info oo_unsignedIntForKey:CONTRACT_KEY_RISK defaultValue:0])];
274
275 [parcels removeObjectAtIndex:i--];
276 if ([parcel_info oo_unsignedIntForKey:CONTRACT_KEY_RISK defaultValue:0] > 0)
277 {
278 [self addRoleToPlayer:@"trader-courier+"];
279 }
280 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"parcel",@"success",[NSNumber numberWithUnsignedInteger:10*fee],parcel_info,nil]];
281
282 }
283 else
284 {
285 // but we're late!
286 long long fee = [parcel_info oo_longLongForKey:CONTRACT_KEY_FEE] / 2; // halve fare
287 while (randf() < 0.5) // maybe halve fare a few times!
288 fee /= 2;
289 credits += 10 * fee;
290
291 [result appendFormatLine:DESC(@"parcel-delivered-late-@-@"), parcel_name, OOIntCredits(fee)];
292 if ([parcel_info oo_unsignedIntForKey:CONTRACT_KEY_RISK defaultValue:0] > 0)
293 {
294 [self addRoleToPlayer:@"trader-courier+"];
295 }
296 [parcels removeObjectAtIndex:i--];
297 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"parcel",@"late",[NSNumber numberWithUnsignedInteger:10*fee],parcel_info,nil]];
298 }
299 }
300 else
301 {
302 if (dest_eta < 0)
303 {
304 // we've run out of time!
305 [result appendFormatLine:DESC(@"parcel-failed-@"), parcel_name];
306
307 [self decreaseParcelReputation:RepForRisk([parcel_info oo_unsignedIntForKey:CONTRACT_KEY_RISK defaultValue:0])];
308 [parcels removeObjectAtIndex:i--];
309 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"parcel",@"failed",[NSNumber numberWithUnsignedInteger:0],parcel_info,nil]];
310 }
311 }
312 [parcel_info release];
313 }
314
315
316 // check cargo contracts
317 for (i = 0; i < [contracts count]; i++)
318 {
319 NSDictionary* contract_info = [[contracts oo_dictionaryAtIndex:i] retain];
320 NSString* contract_cargo_desc = [contract_info oo_stringForKey:CARGO_KEY_DESCRIPTION];
321 int dest = [contract_info oo_intForKey:CONTRACT_KEY_DESTINATION];
322 int dest_eta = [contract_info oo_doubleForKey:CONTRACT_KEY_ARRIVAL_TIME] - ship_clock;
323
324 if (system_id == dest)
325 {
326 // no longer needed
327 // int premium = 10 * [contract_info oo_floatForKey:CONTRACT_KEY_PREMIUM];
328 int fee = 10 * [contract_info oo_floatForKey:CONTRACT_KEY_FEE];
329
330 OOCommodityType contract_cargo_type = [contract_info oo_stringForKey:CARGO_KEY_TYPE];
331 int contract_amount = [contract_info oo_intForKey:CARGO_KEY_AMOUNT];
332
333 int quantity_on_hand = [shipCommodityData quantityForGood:contract_cargo_type];
334
335 // we've arrived in system!
336 if (dest_eta > 0)
337 {
338 // and in good time
339 if (quantity_on_hand >= contract_amount)
340 {
341 // with the goods too!
342
343 // remove the goods...
344 [shipCommodityData removeQuantity:contract_amount forGood:contract_cargo_type];
345
346 // pay the premium and fee
347 // credits += fee + premium;
348 // not any more: all contracts initially awarded by JS, so fee
349 // is now all that needs to be paid - CIM
350
351 if ([shipCommodityData exportLegalityForGood:contract_cargo_type] > 0)
352 {
353 [self addRoleToPlayer:@"trader-smuggler"];
354 }
355 else
356 {
357 [self addRoleToPlayer:@"trader"];
358 }
359
360 credits += fee;
361 [result appendFormatLine:DESC(@"cargo-delivered-okay-@-@"), contract_cargo_desc, OOCredits(fee)];
362
363 [contracts removeObjectAtIndex:i--];
364 // repute++
365 // +10 as cargo contracts don't have risk modifiers
366 [self increaseContractReputation:10];
367 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"cargo",@"success",[NSNumber numberWithUnsignedInteger:fee],contract_info,nil]];
368
369 }
370 else
371 {
372 // see if the amount of goods delivered is acceptable
373
374 float percent_delivered = 100.0 * (float)quantity_on_hand/(float)contract_amount;
375 float acceptable_ratio = 100.0 - 10.0 * system_id / 256.0; // down to 90%
376
377 if (percent_delivered >= acceptable_ratio)
378 {
379 // remove the goods...
380 [shipCommodityData setQuantity:0 forGood:contract_cargo_type];
381
382 // pay the fee
383 int shortfall = 100 - percent_delivered;
384 int payment = percent_delivered * (fee) / 100.0;
385 credits += payment;
386
387 if ([shipCommodityData exportLegalityForGood:contract_cargo_type] > 0)
388 {
389 [self addRoleToPlayer:@"trader-smuggler"];
390 }
391 else
392 {
393 [self addRoleToPlayer:@"trader"];
394 }
395
396 [result appendFormatLine:DESC(@"cargo-delivered-short-@-@-d"), contract_cargo_desc, OOCredits(payment), shortfall];
397
398 [contracts removeObjectAtIndex:i--];
399 // repute unchanged
400 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"cargo",@"short",[NSNumber numberWithUnsignedInteger:payment],contract_info,nil]];
401
402 }
403 else
404 {
405 [result appendFormatLine:DESC(@"cargo-refused-short-%@"), contract_cargo_desc];
406 // The player has still time to buy the missing goods elsewhere and fulfil the contract.
407 }
408 }
409 }
410 else
411 {
412 // but we're late!
413 [result appendFormatLine:DESC(@"cargo-delivered-late-@"), contract_cargo_desc];
414
415 [contracts removeObjectAtIndex:i--];
416 // repute--
417 [self decreaseContractReputation:10];
418 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"cargo",@"late",[NSNumber numberWithUnsignedInteger:0],contract_info,nil]];
419 }
420 }
421 else
422 {
423 if (dest_eta < 0)
424 {
425 // we've run out of time!
426 [result appendFormatLine:DESC(@"cargo-failed-@"), contract_cargo_desc];
427
428 [contracts removeObjectAtIndex:i--];
429 // repute--
430 [self decreaseContractReputation:10];
431 [self doScriptEvent:OOJSID("playerCompletedContract") withArguments:[NSArray arrayWithObjects:@"cargo",@"failed",[NSNumber numberWithUnsignedInteger:0],contract_info,nil]];
432 }
433 }
434 [contract_info release];
435 }
436
437 // check passenger_record for expired contracts
438 NSArray* names = [passenger_record allKeys];
439 for (i = 0; i < [names count]; i++)
440 {
441 double dest_eta = [passenger_record oo_doubleForKey:[names objectAtIndex:i]] - ship_clock;
442 if (dest_eta < 0)
443 {
444 // check they're not STILL on board
445 BOOL on_board = NO;
446 unsigned j;
447 for (j = 0; j < [passengers count]; j++)
448 {
449 NSDictionary* passenger_info = [passengers oo_dictionaryAtIndex:j];
450 if ([[passenger_info objectForKey:PASSENGER_KEY_NAME] isEqual:[names objectAtIndex:i]])
451 on_board = YES;
452 }
453 if (!on_board)
454 {
455 [passenger_record removeObjectForKey:[names objectAtIndex:i]];
456 }
457 }
458 }
459
460 // check contract_record for expired contracts
461 NSArray* ids = [contract_record allKeys];
462 for (i = 0; i < [ids count]; i++)
463 {
464 double dest_eta = [(NSNumber*)[contract_record objectForKey:[ids objectAtIndex:i]] doubleValue] - ship_clock;
465 if (dest_eta < 0)
466 {
467 [contract_record removeObjectForKey:[ids objectAtIndex:i]];
468 }
469 }
470
471 // check parcel_record for expired deliveries
472 ids = [parcel_record allKeys];
473 for (i = 0; i < [ids count]; i++)
474 {
475 double dest_eta = [(NSNumber*)[parcel_record objectForKey:[ids objectAtIndex:i]] doubleValue] - ship_clock;
476 if (dest_eta < 0)
477 {
478 [parcel_record removeObjectForKey:[ids objectAtIndex:i]];
479 }
480 }
481
482
483 if ([result length] == 0)
484 {
485 result = nil;
486 }
487 else
488 {
489 // Should have a trailing \n
490 [result deleteCharacterAtIndex:[result length] - 1];
491 }
492
493 return result;
494}
#define CONTRACT_KEY_RISK
#define PASSENGER_KEY_NAME
float randf(void)

◆ checkScript

- (void) checkScript

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

303{
304 BOOL wasRunningScript = sRunningScript;
305 OOEntityStatus status, restoreStatus;
306
307 NSDictionary *tickleScripts = [self worldScriptsRequiringTickle];
308 if ([tickleScripts count] == 0)
309 {
310 // Quick exit if we only have JS scripts.
311 return;
312 }
313
314 [self setScriptTarget:self];
315
316 /* World scripts can potentially be invoked recursively, through
317 scriptActionOnTarget: and possibly other mechanisms. This is bad, but
318 that's the way it is. Legacy world scripts rely on only seeing certain
319 player statuses once per "event". To ensure this, we must lie about
320 the player's status when invoked recursively.
321
322 Of course, there are also methods in the game that rely on status not
323 lying. However, I don't believe any that rely on these particular
324 statuses can be legitimately invoked by scripts. The alternative would
325 be to track the "status-as-seen-by-scripts" separately from the "real"
326 status, which'd risk synchronization problems.
327
328 In summary, scriptActionOnTarget: is bad, and calling it from scripts
329 rather than AIs is very bad.
330 -- Ahruman, 20080302
331
332 Addendum: scriptActionOnTarget: is currently not in the whitelist for
333 script methods. Let's hope this doesn't turn out to be a problem.
334 -- Ahruman, 20090208
335 */
336 status = [self status];
337 restoreStatus = status;
338 @try
339 {
340 if (sRunningScript)
341 {
342 status = RecursiveRemapStatus(status);
343 [self setStatus:status];
344 }
345 sRunningScript = YES;
346
347 // After all that, actually running the scripts is trivial.
348 [[tickleScripts allValues] makeObjectsPerformSelector:@selector(runWithTarget:) withObject:self];
349 }
350 @catch (NSException *exception)
351 {
352 OOLog(kOOLogException, @"***** Exception running world scripts: %@ : %@", [exception name], [exception reason]);
353 }
354
355 // Restore anti-recursion measures.
356 sRunningScript = wasRunningScript;
357 if (status != restoreStatus) [self setStatus:restoreStatus];
358}
OOEntityStatus
Definition Entity.h:60
NSString *const kOOLogException
Definition OOLogging.m:651
static BOOL sRunningScript
OOINLINE OOEntityStatus RecursiveRemapStatus(OOEntityStatus status)

◆ checkScriptsIfAppropriate

- (void) checkScriptsIfAppropriate
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3549{
3550 if (script_time <= script_time_check) return;
3551
3552 if ([self status] != STATUS_IN_FLIGHT)
3553 {
3554 switch (gui_screen)
3555 {
3556 // Screens where no world script tickles are performed
3557 case GUI_SCREEN_MAIN:
3558 case GUI_SCREEN_INTRO1:
3561 case GUI_SCREEN_NEWGAME:
3563 case GUI_SCREEN_MARKET:
3565 case GUI_SCREEN_OPTIONS:
3567 case GUI_SCREEN_LOAD:
3568 case GUI_SCREEN_SAVE:
3572 case GUI_SCREEN_MISSION:
3573 case GUI_SCREEN_REPORT:
3578 return;
3579
3580 // Screens from which it's safe to jump to the mission screen
3581// case GUI_SCREEN_CONTRACTS:
3588 case GUI_SCREEN_STATUS:
3590 // Test passed, we can run scripts. Nothing to do here.
3591 break;
3592 }
3593 }
3594
3595 // Test either passed or never ran, run scripts.
3596 [self checkScript];
3598}
double script_time_check
double script_time
double script_time_interval

◆ clearAlertFlags

- (void) clearAlertFlags

Definition at line 13727 of file PlayerEntity.m.

5796{
5797 alertFlags = 0;
5798}
OOAlertFlags alertFlags

◆ clearedToDock

- (BOOL) clearedToDock

Definition at line 9242 of file PlayerEntity.m.

◆ clearExtraGuiScreenKeys:key:

- (void) clearExtraGuiScreenKeys: (OOGUIScreenID gui
key: (NSString *)  key 

Definition at line 9242 of file PlayerEntity.m.

13385 :(OOGUIScreenID)gui key:(NSString *)key
13386{
13387 NSMutableArray *keydefs = [extraGuiScreenKeys objectForKey:[NSString stringWithFormat:@"%d",gui]];
13388 NSInteger i = [keydefs count];
13389 NSDictionary *def = nil;
13390 while (i--)
13391 {
13392 def = [keydefs objectAtIndex:i];
13393 if (def && [[def oo_stringForKey:@"name"] isEqualToString:key])
13394 {
13395 [keydefs removeObjectAtIndex:i];
13396 break;
13397 }
13398 }
13399 // do we have to put the array back, or does the reference update the source?
13400}
OOGUIScreenID

Referenced by GlobalClearExtraGuiScreenKeys().

+ Here is the caller graph for this function:

◆ clearExtraMissionKeys

- (void) clearExtraMissionKeys

Definition at line 9242 of file PlayerEntity.m.

13366{
13367 [extraMissionKeys release];
13369}
NSDictionary * extraMissionKeys

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ clearMissionDescription

- (void) clearMissionDescription

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

887{
888 [self clearMissionDescriptionForMission:sCurrentMissionKey];
889}

◆ clearMissionDescriptionForMission:

- (void) clearMissionDescriptionForMission: (NSString *)  key

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

892 :(NSString *)key
893{
894 if (!key)
895 {
896 OOLogERR(kOOLogScriptMissionDescNoKey, @"in %@, mission key not set", CurrentScriptDesc());
897 return;
898 }
899
900 if (![mission_variables objectForKey:key]) return;
901
902 [mission_variables removeObjectForKey:key];
903}
#define OOLogERR(class, format,...)
Definition OOLogging.h:112
static NSString *const kOOLogScriptMissionDescNoKey

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ clearMissionScreen

- (void) clearMissionScreen

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2105{
2106 [self setMissionOverlayDescriptor:nil];
2107 [self setMissionBackgroundDescriptor:nil];
2108 [self setMissionBackgroundSpecial:nil];
2109 [self setMissionTitle:nil];
2110 [self setMissionMusic:nil];
2111 [self showShipModel:nil];
2112}

◆ clearMissionScreenID

- (void) clearMissionScreenID

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2446{
2447 [_missionScreenID release];
2448 _missionScreenID = nil;
2449}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ clearPlanetSearchString

- (void) clearPlanetSearchString

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

817{
818 [[UNIVERSE gameView] resetTypedString];
819 if (planetSearchString) [planetSearchString release];
820 planetSearchString = nil;
821}

◆ clearRoleFromPlayer:

- (void) clearRoleFromPlayer: (BOOL includingLongRange

Definition at line 13727 of file PlayerEntity.m.

5123{
5124 NSUInteger slot = Ranrot() % [roleWeights count];
5125 if (!includingLongRange)
5126 {
5127 NSString *role = [roleWeights objectAtIndex:slot];
5128 // long range roles cleared at 1/2 normal rate
5129 if ([role hasSuffix:@"+"] && randf() > 0.5)
5130 {
5131 return;
5132 }
5133 }
5134 [roleWeights replaceObjectAtIndex:slot withObject:@"player-unknown"];
5135}

◆ clearRolesFromPlayer:

- (void) clearRolesFromPlayer: (float chance

Definition at line 13727 of file PlayerEntity.m.

5138 :(float)chance
5139{
5140 NSUInteger i, count=[roleWeights count];
5141 for (i = 0; i < count; i++)
5142 {
5143 if (randf() < chance)
5144 {
5145 [roleWeights replaceObjectAtIndex:i withObject:@"player-unknown"];
5146 }
5147 }
5148}

◆ clearTargetMemory

- (void) clearTargetMemory

Definition at line 9242 of file PlayerEntity.m.

12334{
12335 NSUInteger memoryCount = [target_memory count];
12336 for (NSUInteger i = 0; i < PLAYER_TARGET_MEMORY_SIZE; i++)
12337 {
12338 if (i < memoryCount)
12339 {
12340 [target_memory replaceObjectAtIndex:i withObject:[NSNull null]];
12341 }
12342 else
12343 {
12344 [target_memory addObject:[NSNull null]];
12345 }
12346 }
12348}

◆ clock_days_number

- (NSNumber *) clock_days_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1030{
1031 return [NSNumber numberWithUnsignedLongLong:ship_clock / 86400.0];
1032}

◆ clock_hours_number

- (NSNumber *) clock_hours_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1024{
1025 return [NSNumber numberWithUnsignedLongLong:ship_clock / 3600.0];
1026}

◆ clock_mins_number

- (NSNumber *) clock_mins_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1018{
1019 return [NSNumber numberWithUnsignedLongLong:ship_clock / 60.0];
1020}

◆ clock_number

- (NSNumber *) clock_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1006{
1007 return [NSNumber numberWithDouble:ship_clock];
1008}

◆ clock_secs_number

- (NSNumber *) clock_secs_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1012{
1013 return [NSNumber numberWithUnsignedLongLong:ship_clock];
1014}

◆ clockAdjusting

- (BOOL) clockAdjusting

Definition at line 13727 of file PlayerEntity.m.

4899{
4900 return ship_clock_adjust > 0;
4901}

◆ clockTime

- (double) clockTime

Definition at line 13727 of file PlayerEntity.m.

4887{
4888 return ship_clock;
4889}
double ship_clock

Referenced by ClockGetProperty().

+ Here is the caller graph for this function:

◆ clockTimeAdjusted

- (double) clockTimeAdjusted

Definition at line 13727 of file PlayerEntity.m.

4893{
4895}

Referenced by HeadUpDisplay::hudDrawReticleOnTarget.

+ Here is the caller graph for this function:

◆ collectBountyFor:

- (void) collectBountyFor: (ShipEntity *)  other
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6866 :(ShipEntity *)other
6867{
6868 if ([self status] == STATUS_DEAD) return; // no bounty if we died while trying
6869
6870 if (other == nil || [other isSubEntity]) return;
6871
6872 if (other == [UNIVERSE station])
6873 {
6874 // there is no way the player can destroy the main station
6875 // and so the explosion will be cancelled, so there shouldn't
6876 // be a kill award
6877 return;
6878 }
6879
6880 if ([self isCloaked])
6881 {
6882 // no-one knows about it; no award
6883 return;
6884 }
6885
6886 OOCreditsQuantity score = 10 * [other bounty];
6887 OOScanClass killClass = [other scanClass]; // **tgape** change (+line)
6888 BOOL killAward = [other countsAsKill];
6889
6890 if ([other isPolice]) // oops, we shot a copper!
6891 {
6892 [self markAsOffender:64 withReason:kOOLegalStatusReasonAttackedPolice];
6893 }
6894
6895 BOOL killIsCargo = ((killClass == CLASS_CARGO) && ([other commodityAmount] > 0) && ![other isHulk]);
6896 if ((killIsCargo) || (killClass == CLASS_BUOY) || (killClass == CLASS_ROCK))
6897 {
6898 // EMMSTRAN: no killaward (but full bounty) for tharglets?
6899 if (![other hasRole:@"tharglet"]) // okay, we'll count tharglets as proper kills
6900 {
6901 score /= 10; // reduce bounty awarded
6902 killAward = NO; // don't award a kill
6903 }
6904 }
6905
6906 credits += score;
6907
6908 if (score > 9)
6909 {
6910 NSString *bonusMessage = OOExpandKey(@"bounty-awarded", score, credits);
6911 [UNIVERSE addDelayedMessage:bonusMessage forCount:6 afterDelay:0.15];
6912 }
6913
6914 if (killAward)
6915 {
6916 ship_kills++;
6917 if ((ship_kills % 256) == 0)
6918 {
6919 // congratulations method needs to be delayed a fraction of a second
6920 [UNIVERSE addDelayedMessage:DESC(@"right-on-commander") forCount:4 afterDelay:0.2];
6921 }
6922 }
6923}
OOScanClass
Definition Entity.h:71
#define OOExpandKey(key,...)
unsigned isSubEntity
Definition Entity.h:95
unsigned ship_kills
BOOL isPolice()
BOOL countsAsKill()
OOCreditsQuantity bounty
Definition ShipEntity.h:300
BOOL isCloaked()

◆ commanderBountyAsString

- (NSString *) commanderBountyAsString

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

368{
369 return [NSString stringWithFormat:@"%i", [self legalStatus]];
370}

◆ commanderDataDictionary

- (NSDictionary *) commanderDataDictionary

Definition at line 13727 of file PlayerEntity.m.

914{
915 int i;
916
917 NSMutableDictionary *result = [NSMutableDictionary dictionary];
918
919 [result setObject:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] forKey:@"written_by_version"];
920
921 NSString *gal_id = [NSString stringWithFormat:@"%u", galaxy_number];
922 NSString *sys_id = [NSString stringWithFormat:@"%d", system_id];
923 NSString *tgt_id = [NSString stringWithFormat:@"%d", target_system_id];
924 NSString *prv_id = [NSString stringWithFormat:@"%d", previous_system_id];
925
926 // Variable requiredCargoSpace not suitable for Oolite as it currently stands: it retroactively changes a savegame cargo space.
927 //unsigned passenger_space = [[OOEquipmentType equipmentTypeWithIdentifier:@"EQ_PASSENGER_BERTH"] requiredCargoSpace];
928 //if (passenger_space == 0) passenger_space = PASSENGER_BERTH_SPACE;
929
930 [result setObject:gal_id forKey:@"galaxy_id"];
931 [result setObject:sys_id forKey:@"system_id"];
932 [result setObject:tgt_id forKey:@"target_id"];
933 [result setObject:prv_id forKey:@"previous_system_id"];
934 [result setObject:[NSNumber numberWithFloat:saved_chart_zoom] forKey:@"chart_zoom"];
935 [result setObject:[NSNumber numberWithInt:ANA_mode] forKey:@"chart_ana_mode"];
936 [result setObject:[NSNumber numberWithInt:longRangeChartMode] forKey:@"chart_colour_mode"];
937
938
939 if (found_system_id >= 0)
940 {
941 NSString *found_id = [NSString stringWithFormat:@"%d", found_system_id];
942 [result setObject:found_id forKey:@"found_system_id"];
943 }
944
945 // Write the name of the current system. Useful for looking up saved game information and for overlapping systems.
946 if (![UNIVERSE inInterstellarSpace])
947 {
948 [result setObject:[UNIVERSE getSystemName:[self currentSystemID]] forKey:@"current_system_name"];
949 OOGovernmentID government = [[UNIVERSE currentSystemData] oo_intForKey:KEY_GOVERNMENT];
950 OOTechLevelID techlevel = [[UNIVERSE currentSystemData] oo_intForKey:KEY_TECHLEVEL];
951 OOEconomyID economy = [[UNIVERSE currentSystemData] oo_intForKey:KEY_ECONOMY];
952 [result setObject:[NSNumber numberWithUnsignedShort:government] forKey:@"current_system_government"];
953 [result setObject:[NSNumber numberWithUnsignedInteger:techlevel] forKey:@"current_system_techlevel"];
954 [result setObject:[NSNumber numberWithUnsignedShort:economy] forKey:@"current_system_economy"];
955 }
956
957 [result setObject:[self commanderName] forKey:@"player_name"];
958 [result setObject:[self lastsaveName] forKey:@"player_save_name"];
959 [result setObject:[self shipUniqueName] forKey:@"ship_unique_name"];
960 [result setObject:[self shipClassName] forKey:@"ship_class_name"];
961
962 /*
963 BUG: GNUstep truncates integer values to 32 bits when loading XML plists.
964 Workaround: store credits as a double. 53 bits of precision ought to
965 be good enough for anybody. Besides, we display credits with double
966 precision anyway.
967 -- Ahruman 2011-02-15
968 */
969 [result oo_setFloat:credits forKey:@"credits"];
970 [result oo_setUnsignedInteger:fuel forKey:@"fuel"];
971
972 [result oo_setInteger:galaxy_number forKey:@"galaxy_number"];
973
974 [result oo_setBool:[self weaponsOnline] forKey:@"weapons_online"];
975
977 {
978 [result setObject:[forward_weapon_type identifier] forKey:@"forward_weapon"];
979 }
980 if (aft_weapon_type != nil)
981 {
982 [result setObject:[aft_weapon_type identifier] forKey:@"aft_weapon"];
983 }
984 if (port_weapon_type != nil)
985 {
986 [result setObject:[port_weapon_type identifier] forKey:@"port_weapon"];
987 }
989 {
990 [result setObject:[starboard_weapon_type identifier] forKey:@"starboard_weapon"];
991 }
992 [result setObject:[self serializeShipSubEntities] forKey:@"subentities_status"];
993 if (hud != nil && [hud nonlinearScanner])
994 {
995 [result oo_setFloat: [hud scannerZoom] forKey:@"ship_scanner_zoom"];
996 }
997
998 [result oo_setInteger:max_cargo + PASSENGER_BERTH_SPACE * max_passengers forKey:@"max_cargo"];
999
1000 [result setObject:[shipCommodityData savePlayerAmounts] forKey:@"shipCommodityData"];
1001
1002
1003 NSMutableArray *missileRoles = [NSMutableArray arrayWithCapacity:max_missiles];
1004
1005 for (i = 0; i < (int)max_missiles; i++)
1006 {
1007 if (missile_entity[i])
1008 {
1009 [missileRoles addObject:[missile_entity[i] primaryRole]];
1010 }
1011 else
1012 {
1013 [missileRoles addObject:@"NONE"];
1014 }
1015 }
1016 [result setObject:missileRoles forKey:@"missile_roles"];
1017
1018 [result oo_setInteger:missiles forKey:@"missiles"];
1019
1020 [result oo_setInteger:legalStatus forKey:@"legal_status"];
1021 [result oo_setInteger:market_rnd forKey:@"market_rnd"];
1022 [result oo_setInteger:ship_kills forKey:@"ship_kills"];
1023
1024 // ship depreciation
1025 [result oo_setInteger:ship_trade_in_factor forKey:@"ship_trade_in_factor"];
1026
1027 // mission variables
1028 if (mission_variables != nil)
1029 {
1030 [result setObject:[NSDictionary dictionaryWithDictionary:mission_variables] forKey:@"mission_variables"];
1031 }
1032
1033 // communications log
1034 NSArray *log = [self commLog];
1035 if (log != nil) [result setObject:log forKey:@"comm_log"];
1036
1037 [result oo_setUnsignedInteger:entity_personality forKey:@"entity_personality"];
1038
1039 // extra equipment flags
1040 NSMutableDictionary *equipment = [NSMutableDictionary dictionary];
1041 NSEnumerator *eqEnum = nil;
1042 NSString *eqDesc = nil;
1043 for (eqEnum = [self equipmentEnumerator]; (eqDesc = [eqEnum nextObject]); )
1044 {
1045 [equipment oo_setInteger:[self countEquipmentItem:eqDesc] forKey:eqDesc];
1046 }
1047 if ([equipment count] != 0)
1048 {
1049 [result setObject:equipment forKey:@"extra_equipment"];
1050 }
1051 if (primedEquipment < [eqScripts count]) [result setObject:[[eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0] forKey:@"primed_equipment"];
1052
1053 [result setObject:[self fastEquipmentA] forKey:@"primed_equipment_a"];
1054 [result setObject:[self fastEquipmentB] forKey:@"primed_equipment_b"];
1055
1056 // roles
1057 [result setObject:roleWeights forKey:@"role_weights"];
1058
1059 // role information
1060 [result setObject:roleWeightFlags forKey:@"role_weight_flags"];
1061
1062 // role information
1063 [result setObject:roleSystemList forKey:@"role_system_memory"];
1064
1065 // reputation
1066 [result setObject:reputation forKey:@"reputation"];
1067
1068 // initialise parcel reputations in dictionary if not set
1069 int pGood = [reputation oo_intForKey:PARCEL_GOOD_KEY];
1070 int pBad = [reputation oo_intForKey:PARCEL_BAD_KEY];
1071 int pUnknown = [reputation oo_intForKey:PARCEL_UNKNOWN_KEY];
1073 {
1074 [reputation oo_setInteger:0 forKey:PARCEL_GOOD_KEY];
1075 [reputation oo_setInteger:0 forKey:PARCEL_BAD_KEY];
1076 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:PARCEL_UNKNOWN_KEY];
1077 }
1078
1079 // passengers
1080 [result oo_setInteger:max_passengers forKey:@"max_passengers"];
1081 [result setObject:passengers forKey:@"passengers"];
1082 [result setObject:passenger_record forKey:@"passenger_record"];
1083
1084 // parcels
1085 [result setObject:parcels forKey:@"parcels"];
1086 [result setObject:parcel_record forKey:@"parcel_record"];
1087
1088 //specialCargo
1089 if (specialCargo) [result setObject:specialCargo forKey:@"special_cargo"];
1090
1091 // contracts
1092 [result setObject:contracts forKey:@"contracts"];
1093 [result setObject:contract_record forKey:@"contract_record"];
1094
1095 [result setObject:missionDestinations forKey:@"mission_destinations"];
1096
1097 //shipyard
1098 [result setObject:shipyard_record forKey:@"shipyard_record"];
1099
1100 //ship's clock
1101 [result setObject:[NSNumber numberWithDouble:ship_clock] forKey:@"ship_clock"];
1102
1103 //speech
1104 [result setObject:[NSNumber numberWithInt:isSpeechOn] forKey:@"speech_on"];
1105#if OOLITE_ESPEAK
1106 [result setObject:[UNIVERSE voiceName:voice_no] forKey:@"speech_voice"];
1107 [result setObject:[NSNumber numberWithBool:voice_gender_m] forKey:@"speech_gender"];
1108#endif
1109
1110 // docking clearance
1111 [result setObject:[NSNumber numberWithBool:[UNIVERSE dockingClearanceProtocolActive]] forKey:@"docking_clearance_protocol"];
1112
1113 //base ship description
1114 [result setObject:[self shipDataKey] forKey:@"ship_desc"];
1115 [result setObject:[[self shipInfoDictionary] oo_stringForKey:KEY_NAME] forKey:@"ship_name"];
1116
1117 //custom view no.
1118 [result oo_setUnsignedInteger:_customViewIndex forKey:@"custom_view_index"];
1119
1120 // escape pod rescue time
1121 [result oo_setFloat:[self escapePodRescueTime] forKey:@"escape_pod_rescue_time"];
1122
1123 //local market for main station
1124 if ([[UNIVERSE station] localMarket]) [result setObject:[[[UNIVERSE station] localMarket] saveStationAmounts] forKey:@"localMarket"];
1125
1126 // Scenario restriction on OXZs
1127 [result setObject:[UNIVERSE useAddOns] forKey:@"scenario_restriction"];
1128
1129 [result setObject:[[UNIVERSE systemManager] exportScriptedChanges] forKey:@"scripted_planetinfo_overrides"];
1130
1131 // trumble information
1132 [result setObject:[self trumbleValue] forKey:@"trumbles"];
1133
1134 // wormhole information
1135 NSMutableArray *wormholeDicts = [NSMutableArray arrayWithCapacity:[scannedWormholes count]];
1137 foreach (wh, scannedWormholes)
1138 {
1139 [wormholeDicts addObject:[wh getDict]];
1140 }
1141 [result setObject:wormholeDicts forKey:@"wormholes"];
1142
1143 // docked station
1144 StationEntity *dockedStation = [self dockedStation];
1145 [result setObject:dockedStation != nil ? [dockedStation primaryRole]:(NSString *)@"" forKey:@"docked_station_role"];
1146 if (dockedStation)
1147 {
1148 HPVector dpos = [dockedStation position];
1149 [result setObject:ArrayFromHPVector(dpos) forKey:@"docked_station_position"];
1150 }
1151 else
1152 {
1153 [result setObject:[NSArray array] forKey:@"docked_station_position"];
1154 }
1155 [result setObject:[UNIVERSE getStationMarkets] forKey:@"station_markets"];
1156
1157 // scenario information
1158 if (scenarioKey != nil)
1159 {
1160 [result setObject:scenarioKey forKey:@"scenario"];
1161 }
1162
1163 // create checksum
1165// TODO: should checksum checks be removed?
1166// munge_checksum(galaxy_seed.a); munge_checksum(galaxy_seed.b); munge_checksum(galaxy_seed.c);
1167// munge_checksum(galaxy_seed.d); munge_checksum(galaxy_seed.e); munge_checksum(galaxy_seed.f);
1172
1173 if (mission_variables != nil)
1174 {
1175 munge_checksum([[mission_variables description] length]);
1176 }
1177 if (equipment != nil)
1178 {
1179 munge_checksum([[equipment description] length]);
1180 }
1181
1182 int final_checksum = munge_checksum([[self shipDataKey] length]);
1183
1184 //set checksum
1185 [result oo_setInteger:final_checksum forKey:@"checksum"];
1186
1187 return result;
1188}
NSUInteger OOTechLevelID
Definition OOTypes.h:204
uint8_t OOGovernmentID
Definition OOTypes.h:206
uint8_t OOEconomyID
Definition OOTypes.h:207
#define MAX_CONTRACT_REP
StationEntity * dockedStation()
NSString * scenarioKey
NSMutableDictionary * mission_variables
HeadUpDisplay * hud
OOSystemID found_system_id
NSUInteger primedEquipment
OOCommodityMarket * localMarket()
NSString * shipDataKey()
unsigned missiles
Definition ShipEntity.h:319
OOWeaponType aft_weapon_type
Definition ShipEntity.h:306
NSEnumerator * equipmentEnumerator()
OOFuelQuantity fuel
Definition ShipEntity.h:288
OOWeaponType starboard_weapon_type
Definition ShipEntity.h:308
OOWeaponType port_weapon_type
Definition ShipEntity.h:307
OOWeaponType forward_weapon_type
Definition ShipEntity.h:305
NSDictionary * getDict()
void clear_checksum()
int16_t munge_checksum(long long value_)

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ commanderKillsAsString

- (NSString *) commanderKillsAsString

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

375{
376 return [NSString stringWithFormat:@"%i", [self score]];
377}

◆ commanderLegalStatus_number

- (NSNumber *) commanderLegalStatus_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

962{
963 return [NSNumber numberWithInt:[self legalStatus]];
964}

◆ commanderLegalStatus_string

- (NSString *) commanderLegalStatus_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

974{
975 return OODisplayStringFromLegalStatus(legalStatus);
976}
NSString * OODisplayStringFromLegalStatus(int legalStatus)

◆ commanderName

- (NSString *) commanderName

Definition at line 9242 of file PlayerEntity.m.

13075{
13076 return _commanderName;
13077}
NSString * _commanderName

Referenced by PlayerGetProperty().

+ Here is the caller graph for this function:

◆ commanderName_string

- (NSString *) commanderName_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1155{
1156 return [self commanderName];
1157}

◆ commanderRank_string

- (NSString *) commanderRank_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1161{
1162 return OODisplayRatingStringFromKillCount([self score]);
1163}
NSString * OODisplayRatingStringFromKillCount(unsigned kills)

◆ commanderSelector

- (NSString *) commanderSelector

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

363{
364 MyOpenGLView *gameView = [UNIVERSE gameView];
365 GuiDisplayGen *gui = [UNIVERSE gui];
366 NSString *dir = [[UNIVERSE gameController] playerFileDirectory];
367
368 int idx;
369 if([self handleGUIUpDownArrowKeys])
370 {
371 int guiSelectedRow=[gui selectedRow];
372 idx=(guiSelectedRow - STARTROW) + (currentPage * NUMROWS);
373 if (guiSelectedRow != MOREROW && guiSelectedRow != BACKROW && guiSelectedRow != EXITROW)
374 {
375 [self showCommanderShip: idx];
376 }
377 else
378 {
379 [UNIVERSE removeDemoShips];
380 [gui setText:@"" forRow:CDRDESCROW align:GUI_ALIGN_LEFT];
381 [gui setText:@"" forRow:CDRDESCROW + 1 align:GUI_ALIGN_LEFT];
382 [gui setText:@"" forRow:CDRDESCROW + 2 align:GUI_ALIGN_LEFT];
383 }
384
385 }
386 else
387 {
388 idx=([gui selectedRow] - STARTROW) + (currentPage * NUMROWS);
389 }
390
391 // handle page <-- and page --> keys
392 if (([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up]) && [[gui keyForRow:BACKROW] isEqual: GUI_KEY_OK])
393 {
394 currentPage--;
395 [self playMenuPagePrevious];
396 [self lsCommanders: gui directory: dir pageNumber: currentPage highlightName: nil];
397 [gameView suppressKeysUntilKeyUp];
398 }
399 if (([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down]) && [[gui keyForRow:MOREROW] isEqual: GUI_KEY_OK])
400 {
401 currentPage++;
402 [self playMenuPageNext];
403 [self lsCommanders: gui directory: dir pageNumber: currentPage highlightName: nil];
404 [gameView suppressKeysUntilKeyUp];
405 }
406
407 // Enter pressed - find the commander name underneath.
408 // ignore Ctrl for the moment - we check for it explicitly later
409 if ([self checkKeyPress:n_key_gui_select ignore_ctrl:YES]||[gameView isDown:gvMouseDoubleClick])
410 {
411 NSDictionary *cdr;
412 switch ([gui selectedRow])
413 {
414 case EXITROW:
415 if ([self status] == STATUS_START_GAME)
416 {
417 [self setGuiToIntroFirstGo:YES];
418 return nil;
419 }
420 break;
421 case BACKROW:
422 currentPage--;
423 [self lsCommanders: gui directory: dir pageNumber: currentPage highlightName: nil];
424 [gameView suppressKeysUntilKeyUp];
425 break;
426 case MOREROW:
427 currentPage++;
428 [self lsCommanders: gui directory: dir pageNumber: currentPage highlightName: nil];
429 [gameView suppressKeysUntilKeyUp];
430 break;
431 default:
432 cdr=[cdrDetailArray objectAtIndex: idx];
433 if ([cdr oo_boolForKey:@"isSavedGame"])
434 return [cdr oo_stringForKey:@"saved_game_path"];
435 else
436 {
437 if ([gameView isCommandModifierKeyDown]||[gameView isDown:gvMouseDoubleClick])
438 {
439 // change directory to the selected path
440 NSString* newDir = [cdr oo_stringForKey:@"saved_game_path"];
441 [[UNIVERSE gameController] setPlayerFileDirectory: newDir];
442 dir = newDir;
443 currentPage = 0;
444 [self lsCommanders: gui directory: dir pageNumber: currentPage highlightName: nil];
445 [gameView suppressKeysUntilKeyUp];
446 }
447 }
448 }
449 }
450
451 if([gameView isDown: 27]) // escape key
452 {
453 [self setGuiToStatusScreen];
454 }
455 return nil;
456}
@ gvMouseDoubleClick
#define GUI_KEY_OK
#define EXITROW
#define MOREROW
#define NUMROWS
#define STARTROW
#define BACKROW
void setText:forRow:align:(NSString *str,[forRow] OOGUIRow row,[align] OOGUIAlignment alignment)
void suppressKeysUntilKeyUp()

◆ commanderShip_string

- (NSString *) commanderShip_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1167{
1168 return [self name];
1169}

◆ commanderShipDisplayName_string

- (NSString *) commanderShipDisplayName_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1173{
1174 return [self displayName];
1175}

◆ commLog

- (NSMutableArray *) commLog

◆ commodityScriptNamed:

- (OOScript *) commodityScriptNamed: (NSString *)  script

Definition at line 9242 of file PlayerEntity.m.

12891 :(NSString *)scriptName
12892{
12893 if (scriptName == nil)
12894 {
12895 return nil;
12896 }
12897 OOScript *cscript = nil;
12898 if ((cscript = [commodityScripts objectForKey:scriptName]))
12899 {
12900 return cscript;
12901 }
12903 if (cscript != nil)
12904 {
12905 // storing it in here retains it
12906 [commodityScripts setObject:cscript forKey:scriptName];
12907 }
12908 else
12909 {
12910 OOLog(@"script.commodityScript.load",@"Could not load script %@",scriptName);
12911 }
12912 return cscript;
12913}
NSMutableDictionary * commodityScripts

◆ commsMessage:

- (void) commsMessage: (NSString *)  valueString

Reimplemented from ShipEntity.

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1195 :(NSString *)valueString
1196{
1197 [UNIVERSE addCommsMessage:[self expandMessage:valueString] forCount:4.5];
1198}

◆ commsMessageByUnpiloted:

- (void) commsMessageByUnpiloted: (NSString *)  valueString

Reimplemented from ShipEntity.

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1204 :(NSString *)valueString
1205{
1206 [self commsMessage:valueString];
1207}

◆ compareKeyEntries:second:

- (BOOL) compareKeyEntries: (NSDictionary*)  first
second: (NSDictionary*)  second 
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1583 :(NSDictionary*)first second:(NSDictionary*)second
1584{
1585 if ([(NSString *)[first objectForKey:@"key"] integerValue] == [(NSString *)[second objectForKey:@"key"] integerValue])
1586 {
1587 if ([[first objectForKey:@"shift"] boolValue] == [[second objectForKey:@"shift"] boolValue] &&
1588 [[first objectForKey:@"mod1"] boolValue] == [[second objectForKey:@"mod1"] boolValue] &&
1589 [[first objectForKey:@"mod2"] boolValue] == [[second objectForKey:@"mod2"] boolValue])
1590 return YES;
1591 }
1592 return NO;
1593}

◆ compareZeroDistance:

- (NSComparisonResult) compareZeroDistance: (Entity *)  otherEntity
implementation

Reimplemented from Entity.

Definition at line 13727 of file PlayerEntity.m.

2497{
2498 return NSOrderedDescending; // always the most near
2499}

◆ compassMode

- (OOCompassMode) compassMode

◆ compassTarget

- (Entity *) compassTarget

◆ compassTargetLabel

- (NSString *) compassTargetLabel

Definition at line 13727 of file PlayerEntity.m.

5281{
5282 switch (compassMode)
5283 {
5285 return @"";
5286 case COMPASS_MODE_BASIC:
5287 return @"";
5289 {
5290 Entity *target = [self compassTarget];
5291 if (target)
5292 {
5293 return [(Entity <OOBeaconEntity> *)target beaconLabel];
5294 }
5295 return @"";
5296 }
5298 return [[UNIVERSE planet] name];
5299 case COMPASS_MODE_SUN:
5300 return [[UNIVERSE sun] name];
5302 return [[UNIVERSE station] displayName];
5304 return DESC(@"oolite-beacon-label-target");
5305 }
5306 return @"";
5307}

◆ completeSetUp

- (void) completeSetUp

Definition at line 13727 of file PlayerEntity.m.

2251{
2252 [self completeSetUpAndSetTarget:YES];
2253}

◆ completeSetUpAndSetTarget:

- (void) completeSetUpAndSetTarget: (BOOL setTarget

Definition at line 13727 of file PlayerEntity.m.

2256 :(BOOL)setTarget
2257{
2259
2260 [self setDockedStation:[UNIVERSE station]];
2261 [self setLastAegisLock:[UNIVERSE planet]];
2262 // only do this if we're not in strict mode, otherwise all previously saved OXP key/joystick defs will be wiped.
2264 {
2265 [self validateCustomEquipActivationArray];
2266 }
2267
2268 JSContext *context = OOJSAcquireContext();
2269 [self doWorldScriptEvent:OOJSID("startUp") inContext:context withArguments:NULL count:0 timeLimit:MAX(0.0, [[NSUserDefaults standardUserDefaults] oo_floatForKey:@"start-script-limit-value" defaultValue:kOOJSLongTimeLimit])];
2270 OOJSRelinquishContext(context);
2271}
#define SCENARIO_OXP_DEFINITION_NONE

◆ consoleMessage3s:

- (void) consoleMessage3s: (NSString *)  valueString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1210 :(NSString *)valueString
1211{
1212 [UNIVERSE addMessage:[self expandMessage:valueString] forCount: 3];
1213}

◆ consoleMessage6s:

- (void) consoleMessage6s: (NSString *)  valueString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1216 :(NSString *)valueString
1217{
1218 [UNIVERSE addMessage:[self expandMessage:valueString] forCount: 6];
1219}

◆ contractedVolumeForGood:

- (OOCargoQuantity) contractedVolumeForGood: (OOCommodityType good

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

497 :(OOCommodityType) good
498{
499 OOCargoQuantity total = 0;
500 for (unsigned i = 0; i < [contracts count]; i++)
501 {
502 NSDictionary* contract_info = [contracts oo_dictionaryAtIndex:i];
503 OOCommodityType contract_cargo_type = [contract_info oo_stringForKey:CARGO_KEY_TYPE];
504 if ([good isEqualToString:contract_cargo_type])
505 {
506 total += [contract_info oo_unsignedIntegerForKey:CARGO_KEY_AMOUNT];
507 }
508 }
509 return total;
510}

◆ contractList

- (NSArray *) contractList

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

1096{
1097 return [self contractsListFromArray:contracts forCargo:YES forParcels:NO];
1098}

◆ contractListForScripting

- (NSArray *) contractListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

8493{
8494 return [self contractsListForScriptingFromArray:contracts forCargo:YES];
8495}

◆ contractReputation

- (int) contractReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

682{
683 int good = [reputation oo_intForKey:CONTRACTS_GOOD_KEY];
684 int bad = [reputation oo_intForKey:CONTRACTS_BAD_KEY];
685 int unknown = [reputation oo_intForKey:CONTRACTS_UNKNOWN_KEY];
686
687 if (unknown > 0)
688 unknown = MAX_CONTRACT_REP - (((2*unknown)+(market_rnd % unknown))/3);
689 else
690 unknown = MAX_CONTRACT_REP;
691
692 return (good + unknown - 3 * bad) / 2; // return a number from -MAX_CONTRACT_REP to +MAX_CONTRACT_REP
693}

◆ contractsListForScriptingFromArray:forCargo:

- (NSArray *) contractsListForScriptingFromArray: (NSArray *)  contracts_array
forCargo: (BOOL forCargo 
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

8438{
8439 NSMutableArray *result = [NSMutableArray array];
8440 NSUInteger i;
8441
8442 for (i = 0; i < [contracts_array count]; i++)
8443 {
8444 NSMutableDictionary *contract = [NSMutableDictionary dictionaryWithCapacity:10];
8445 NSDictionary *dict = [contracts_array oo_dictionaryAtIndex:i];
8446 if (forCargo)
8447 {
8448 // commodity, quantity - keep consistency between .manifest and .contracts
8449 [contract setObject:[dict oo_stringForKey:CARGO_KEY_TYPE] forKey:@"commodity"];
8450 [contract setObject:[NSNumber numberWithUnsignedInt:[dict oo_intForKey:CARGO_KEY_AMOUNT]] forKey:@"quantity"];
8451 [contract setObject:[dict oo_stringForKey:CARGO_KEY_DESCRIPTION] forKey:@"description"];
8452 }
8453 else
8454 {
8455 [contract setObject:[dict oo_stringForKey:PASSENGER_KEY_NAME] forKey:PASSENGER_KEY_NAME];
8456 [contract setObject:[NSNumber numberWithUnsignedInt:[dict oo_unsignedIntForKey:CONTRACT_KEY_RISK]] forKey:CONTRACT_KEY_RISK];
8457 }
8458
8459 OOSystemID planet = [dict oo_intForKey:CONTRACT_KEY_DESTINATION];
8460 NSString *planetName = [UNIVERSE getSystemName:planet];
8461 [contract setObject:[NSNumber numberWithUnsignedInt:planet] forKey:CONTRACT_KEY_DESTINATION];
8462 [contract setObject:planetName forKey:@"destinationName"];
8463 planet = [dict oo_intForKey:CONTRACT_KEY_START];
8464 planetName = [UNIVERSE getSystemName: planet];
8465 [contract setObject:[NSNumber numberWithUnsignedInt:planet] forKey:CONTRACT_KEY_START];
8466 [contract setObject:planetName forKey:@"startName"];
8467
8468 int dest_eta = [dict oo_doubleForKey:CONTRACT_KEY_ARRIVAL_TIME] - ship_clock;
8469 [contract setObject:[NSNumber numberWithInt:dest_eta] forKey:@"eta"];
8470 [contract setObject:[UNIVERSE shortTimeDescription:dest_eta] forKey:@"etaDescription"];
8471 [contract setObject:[NSNumber numberWithInt:[dict oo_intForKey:CONTRACT_KEY_PREMIUM]] forKey:CONTRACT_KEY_PREMIUM];
8472 [contract setObject:[NSNumber numberWithInt:[dict oo_intForKey:CONTRACT_KEY_FEE]] forKey:CONTRACT_KEY_FEE];
8473 [result addObject:contract];
8474 }
8475
8476 return [[result copy] autorelease]; // return an immutable copy
8477}

◆ contractsListFromArray:forCargo:forParcels:

- (NSArray *) contractsListFromArray: (NSArray *)  contracts_array
forCargo: (BOOL forCargo
forParcels: (BOOL forParcels 
implementation

Provided by category PlayerEntity(ContractsPrivate).

Definition at line 1998 of file PlayerEntityContracts.m.

1101 :(NSArray *) contracts_array forCargo:(BOOL) forCargo forParcels:(BOOL)forParcels
1102{
1103 // check contracts
1104 NSMutableArray *result = [NSMutableArray arrayWithCapacity:5];
1105 NSString *formatString = (forCargo||forParcels) ? @"oolite-manifest-item-delivery" : @"oolite-manifest-person-travelling";
1106 unsigned i;
1107 for (i = 0; i < [contracts_array count]; i++)
1108 {
1109 NSDictionary* contract_info = (NSDictionary *)[contracts_array objectAtIndex:i];
1110 NSString* label = [contract_info oo_stringForKey:forCargo ? CARGO_KEY_DESCRIPTION : PASSENGER_KEY_NAME];
1111 // the system name can change via script. The following PASSENGER_KEYs are identical to the corresponding CONTRACT_KEYs
1112 NSString* destination = [UNIVERSE getSystemName: [contract_info oo_intForKey:CONTRACT_KEY_DESTINATION]];
1113 int dest_eta = [contract_info oo_doubleForKey:CONTRACT_KEY_ARRIVAL_TIME] - ship_clock;
1114 NSString *deadline = [UNIVERSE shortTimeDescription:dest_eta];
1115
1116 OOCreditsQuantity fee = [contract_info oo_intForKey:CONTRACT_KEY_FEE];
1117 NSString *feeDesc = OOIntCredits(fee);
1118
1119 [result addObject:OOExpandKey(formatString, label, destination, deadline, feeDesc)];
1120
1121 }
1122
1123 return result;
1124}
OOINLINE NSString * OOIntCredits(OOCreditsQuantity integerCredits)

◆ countMissiles

- (unsigned) countMissiles

Definition at line 13727 of file PlayerEntity.m.

4952{
4953 unsigned n_missiles = 0;
4954 unsigned i;
4955 for (i = 0; i < max_missiles; i++)
4956 {
4957 if (missile_entity[i])
4958 n_missiles++;
4959 }
4960 return n_missiles;
4961}

◆ createCargoPodWithType:andAmount:

- (void) createCargoPodWithType: (OOCommodityType type
andAmount: (OOCargoQuantity amount 
implementation

Definition at line 13727 of file PlayerEntity.m.

317{
318 ShipEntity *container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
319 if (container)
320 {
321 [container setScanClass: CLASS_CARGO];
322 [container setStatus:STATUS_IN_HOLD];
323 [container setCommodity:type andAmount:amount];
324 [cargo addObject:container];
325 [container release];
326 }
327 else
328 {
329 OOLogERR(@"player.loadCargoPods.noContainer", @"%@", @"couldn't create a container in [PlayerEntity loadCargoPods]");
330 // throw an exception here...
331 [NSException raise:OOLITE_EXCEPTION_FATAL
332 format:@"[PlayerEntity loadCargoPods] failed to create a container for cargo with role 'cargopod'"];
333 }
334}

◆ createDoppelganger

- (ProxyPlayerEntity *) createDoppelganger
implementation

Definition at line 13727 of file PlayerEntity.m.

6578{
6580
6581 if (result != nil)
6582 {
6583 [result setPosition:[self position]];
6584 [result setScanClass:CLASS_NEUTRAL];
6585 [result setOrientation:[self normalOrientation]];
6586 [result setVelocity:[self velocity]];
6587 [result setSpeed:[self flightSpeed]];
6588 [result setDesiredSpeed:[self flightSpeed]];
6589 [result setRoll:flightRoll];
6590 [result setBehaviour:BEHAVIOUR_IDLE];
6591 [result switchAITo:@"nullAI.plist"]; // fly straight on
6592 [result setTemperature:[self temperature]];
6593 [result copyValuesFromPlayer:self];
6594 }
6595
6596 return result;
6597}
void setVelocity:(Vector vel)
Definition Entity.m:758
void setOrientation:(Quaternion quat)
Definition Entity.m:726
void copyValuesFromPlayer:(PlayerEntity *player)
void setDesiredSpeed:(double amount)
void setRoll:(double amount)
void setSpeed:(double amount)
void setTemperature:(GLfloat value)
void setBehaviour:(OOBehaviour cond)
void switchAITo:(NSString *aiString)

◆ creditBalance

- (double) creditBalance

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

53{
54 return 0.1 * credits;
55}

◆ credits_number

- (NSNumber *) credits_number

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

943{
944 return [NSNumber numberWithDouble:[self creditBalance]];
945}

◆ creditsFormattedForLegacySubstitution

- (NSString *) creditsFormattedForLegacySubstitution

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

357{
358 OOCreditsQuantity tenthsOfCredits = [self deciCredits];
359 unsigned long long integerCredits = tenthsOfCredits / 10;
360 unsigned long long tenths = tenthsOfCredits % 10;
361
362 return [NSString stringWithFormat:@"%llu.%llu", integerCredits, tenths];
363}

◆ creditsFormattedForSubstitution

- (NSString *) creditsFormattedForSubstitution

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

345{
346 return OOStringFromDeciCredits([self deciCredits], YES, NO);
347}
NSString * OOStringFromDeciCredits(OOCreditsQuantity tenthsOfCredits, BOOL includeDecimal, BOOL includeSymbol)

◆ currentGalaxyID

- (OOGalaxyID) currentGalaxyID

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

179{
180 return galaxy_number;
181}

Referenced by SystemSetProperty(), and SystemToString().

+ Here is the caller graph for this function:

◆ currentLaserOffset

- (NSArray *) currentLaserOffset

Definition at line 13727 of file PlayerEntity.m.

6185{
6186 return [self laserPortOffset:currentWeaponFacing];
6187}

◆ currentPrimedEquipment

- (NSString *) currentPrimedEquipment

Definition at line 13727 of file PlayerEntity.m.

8228{
8229 NSString *result = @"";
8230 NSUInteger c = [eqScripts count];
8231 if (primedEquipment != c)
8232 {
8233 result = [[eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0];
8234 }
8235 return result;
8236}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ CurrentScriptDesc(void)

- (OOINLINE NSString * CurrentScriptDesc(void)) (void
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 129 of file PlayerEntityLegacyScriptEngine.m.

130{
131 return CurrentScriptNameOr(@"<anonymous actions>");
132}
static NSString * CurrentScriptNameOr(NSString *alternative)

◆ CurrentScriptNameOr

+ (static NSString *) CurrentScriptNameOr (NSString *)  alternative
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 119 of file PlayerEntityLegacyScriptEngine.m.

120{
122 {
123 return [NSString stringWithFormat:@"\"%@\"", sCurrentMissionKey];
124 }
125 return alternative;
126}
static NSString * sCurrentMissionKey
static NSString *const kActionTempPrefix

◆ currentSystemID

- (OOSystemID) currentSystemID

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

185{
186 if ([UNIVERSE sun] == nil) return -1; // Interstellar space
187 return [UNIVERSE currentSystemID];
188}

Referenced by SystemSetProperty(), and SystemToString().

+ Here is the caller graph for this function:

◆ currentWeapon

- (OOWeaponType) currentWeapon

Definition at line 13727 of file PlayerEntity.m.

6303{
6304 return [self weaponForFacing:currentWeaponFacing];
6305}

◆ currentWeaponStats

- (void) currentWeaponStats

Definition at line 13727 of file PlayerEntity.m.

6162{
6163 OOWeaponType currentWeapon = [self currentWeapon];
6164 // Did find & correct a minor mismatch between player and NPC weapon stats. This is the resulting code - Kaks 20101027
6165
6166 // Basic stats: weapon_damage & weaponRange (weapon_recharge_rate is not used by the player)
6167 [self setWeaponDataFromType:currentWeapon];
6168}
OOWeaponType currentWeapon()

◆ cursor_coordinates

- (NSPoint) cursor_coordinates

◆ custom_chart_centre_coordinates

- (NSPoint) custom_chart_centre_coordinates

◆ custom_chart_zoom

- (OOScalar) custom_chart_zoom

◆ customEquipmentActivation

- (NSMutableArray *) customEquipmentActivation

Definition at line 9242 of file PlayerEntity.m.

11583{
11584 return customEquipActivation;
11585}
NSMutableArray * customEquipActivation

◆ customViewDescription

- (NSString *) customViewDescription

◆ customViewForwardVector

- (Vector) customViewForwardVector

◆ customViewMatrix

- (OOMatrix) customViewMatrix

◆ customViewOffset

- (Vector) customViewOffset

◆ customViewPanDown:

- (void) customViewPanDown: (OOScalar angle

Definition at line 9242 of file PlayerEntity.m.

12571 :(OOScalar) angle
12572{
12574 [self setCustomViewData];
12576}
GLfloat OOScalar
Definition OOMaths.h:64
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle)
Quaternion customViewQuaternion
Vector customViewRightVector
Vector customViewOffset
Vector customViewForwardVector
Vector customViewRotationCenter

◆ customViewPanLeft:

◆ customViewPanRight:

◆ customViewPanUp:

◆ customViewQuaternion

- (Quaternion) customViewQuaternion

◆ customViewRightVector

- (Vector) customViewRightVector

◆ customViewRollLeft:

◆ customViewRollRight:

◆ customViewRotateDown:

◆ customViewRotateLeft:

◆ customViewRotateRight:

◆ customViewRotateUp:

◆ customViewRotationCenter

- (Vector) customViewRotationCenter

◆ customViewUpVector

- (Vector) customViewUpVector

◆ customViewZoomIn:

◆ customViewZoomOut:

◆ cycleNextMultiFunctionDisplay:

- (void) cycleNextMultiFunctionDisplay: (NSUInteger index

Definition at line 13727 of file PlayerEntity.m.

5578 :(NSUInteger) index
5579{
5580 if ([[self hud] mfdCount] == 0) return;
5581 NSArray *keys = [multiFunctionDisplayText allKeys];
5582 NSString *key = nil;
5583 if ([keys count] == 0)
5584 {
5585 [self setMultiFunctionDisplay:index toKey:nil];
5586 return;
5587 }
5588 id current = [multiFunctionDisplaySettings objectAtIndex:index];
5589 if (current == [NSNull null])
5590 {
5591 key = [keys objectAtIndex:0];
5592 [self setMultiFunctionDisplay:index toKey:key];
5593 }
5594 else
5595 {
5596 NSUInteger cIndex = [keys indexOfObject:current];
5597 if (cIndex == NSNotFound || cIndex + 1 >= [keys count])
5598 {
5599 key = nil;
5600 [self setMultiFunctionDisplay:index toKey:nil];
5601 }
5602 else
5603 {
5604 key = [keys objectAtIndex:(cIndex+1)];
5605 [self setMultiFunctionDisplay:index toKey:key];
5606 }
5607 }
5608 JSContext *context = OOJSAcquireContext();
5609 jsval keyVal = OOJSValueFromNativeObject(context,key);
5610 ShipScriptEvent(context, self, "mfdKeyChanged", INT_TO_JSVAL(activeMFD), keyVal);
5611 OOJSRelinquishContext(context);
5612}
#define ShipScriptEvent(context, ship, event,...)
NSUInteger activeMFD

◆ cyclePreviousMultiFunctionDisplay:

- (void) cyclePreviousMultiFunctionDisplay: (NSUInteger index

Definition at line 13727 of file PlayerEntity.m.

5615 :(NSUInteger) index
5616{
5617 if ([[self hud] mfdCount] == 0) return;
5618 NSArray *keys = [multiFunctionDisplayText allKeys];
5619 NSString *key = nil;
5620 if ([keys count] == 0)
5621 {
5622 [self setMultiFunctionDisplay:index toKey:nil];
5623 return;
5624 }
5625 id current = [multiFunctionDisplaySettings objectAtIndex:index];
5626 if (current == [NSNull null])
5627 {
5628 key = [keys objectAtIndex:([keys count]-1)];
5629 [self setMultiFunctionDisplay:index toKey:key];
5630 }
5631 else
5632 {
5633 NSUInteger cIndex = [keys indexOfObject:current];
5634 if (cIndex == NSNotFound || cIndex == 0)
5635 {
5636 key = nil;
5637 [self setMultiFunctionDisplay:index toKey:nil];
5638 }
5639 else
5640 {
5641 key = [keys objectAtIndex:(cIndex-1)];
5642 [self setMultiFunctionDisplay:index toKey:key];
5643 }
5644 }
5645 JSContext *context = OOJSAcquireContext();
5646 jsval keyVal = OOJSValueFromNativeObject(context,key);
5647 ShipScriptEvent(context, self, "mfdKeyChanged", INT_TO_JSVAL(activeMFD), keyVal);
5648 OOJSRelinquishContext(context);
5649}

◆ d100_number

- (NSNumber *) d100_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

980{
981 int d100 = ranrot_rand() % 100;
982 return [NSNumber numberWithInt:d100];
983}

◆ d256_number

- (NSNumber *) d256_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

993{
994 int d256 = ranrot_rand() % 256;
995 return [NSNumber numberWithInt:d256];
996}

◆ deactivateCloakingDevice

- (void) deactivateCloakingDevice

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6091{
6092 if (![self hasCloakingDevice]) return;
6093
6094 [super deactivateCloakingDevice];
6095 [UNIVERSE terminatePostFX:OO_POSTFX_CLOAK];
6096 [UNIVERSE addMessage:DESC(@"cloak-off") forCount:2];
6097 [self playCloakingDeviceOff];
6098}

◆ dealloc

- (void) dealloc
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

2382{
2384 DESTROY(hud);
2388
2392
2395
2401
2403
2405
2419
2423
2427
2429
2432
2435
2437
2439
2440 [self destroySound];
2441
2444
2445 int i;
2446 for (i = 0; i < PLAYER_MAX_MISSILES; i++) DESTROY(missile_entity[i]);
2447 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++) DESTROY(trumble[i]);
2448
2455
2459
2461
2462 [super dealloc];
2463}
#define DESTROY(x)
Definition OOCocoa.h:75
#define PLAYER_MAX_MISSILES
NSMutableDictionary * roleWeightFlags
NSMutableDictionary * passenger_record
NSString * _jumpCause
NSDictionary * keyconfig2_settings
NSMutableDictionary * missionDestinations
NSMutableArray * parcels
NSArray * kbdLayouts
NSMutableArray * contracts
NSArray * _customViews
NSMutableDictionary * localVariables
NSString * keyShiftText
NSMutableDictionary * customDialSettings
OOWeakReference * compassTarget
NSDictionary * _missionOverlayDescriptor
NSString * _fastEquipmentB
NSMutableArray * roleSystemList
NSMutableDictionary * contract_record
NSMutableString * dockingReport
NSString * _lastsaveName
NSMutableArray * target_memory
NSMutableArray * passengers
NSMutableDictionary * reputation
NSArray * lastShot
NSDictionary * _equipScreenBackgroundDescriptor
NSMutableArray * commLog
NSString * lastTextKey
NSString * keyMod1Text
NSString * keyMod2Text
NSArray * stickFunctions
NSDictionary * worldScriptsRequiringTickle
NSMutableDictionary * parcel_record
NSDictionary * _missionBackgroundDescriptor
NSArray * keyFunctions
NSMutableDictionary * multiFunctionDisplayText
NSMutableArray * multiFunctionDisplaySettings
NSString * _fastEquipmentA
NSMutableDictionary * shipyard_record
NSMutableArray * customModePressed
NSDictionary * worldScripts
WormholeEntity * wormhole
NSMutableArray * customActivatePressed
OOCommodityType marketSelectedCommodity
NSString * save_path
NSMutableDictionary * extraGuiScreenKeys

◆ debugMessage:

- (void) debugMessage: (NSString *)  args

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2423 :(NSString *)args
2424{
2425 OOLog(kOOLogDebugMessage, @"SCRIPT debugMessage: %@", args);
2426}
static NSString *const kOOLogDebugMessage

◆ debugOff

- (void) debugOff

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2417{
2418 OOLog(kOOLogDebugOnOff, @"%@", @"SCRIPT debug messages OFF");
2420}
void OOLogSetDisplayMessagesInClass(NSString *inClass, BOOL inFlag)
Definition OOLogging.m:182
static NSString *const kOOLogDebugOnOff
static NSString *const kOOLogDebugOnMetaClass

◆ debugOn

- (void) debugOn

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2410{
2412 OOLog(kOOLogDebugOnOff, @"%@", @"SCRIPT debug messages ON");
2413}

◆ deciCredits

- (OOCreditsQuantity) deciCredits

Definition at line 13727 of file PlayerEntity.m.

495{
496 return credits;
497}

◆ decreaseContractReputation:

- (void) decreaseContractReputation: (unsigned amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

726 :(unsigned)amount
727{
728 int good = [reputation oo_intForKey:CONTRACTS_GOOD_KEY];
729 int bad = [reputation oo_intForKey:CONTRACTS_BAD_KEY];
730 int unknown = [reputation oo_intForKey:CONTRACTS_UNKNOWN_KEY];
731
732 for (unsigned i=0;i<amount;i++)
733 {
734 if (good > 0)
735 {
736 // shift a bean from good to bad
737 good--;
738 if (bad < MAX_CONTRACT_REP)
739 bad++;
740 }
741 else
742 {
743 // shift a bean from unknown to bad
744 if (unknown > 0)
745 unknown--;
746 if (bad < MAX_CONTRACT_REP)
747 bad++;
748 }
749 }
750 [reputation oo_setInteger:good forKey:CONTRACTS_GOOD_KEY];
751 [reputation oo_setInteger:bad forKey:CONTRACTS_BAD_KEY];
752 [reputation oo_setInteger:unknown forKey:CONTRACTS_UNKNOWN_KEY];
753}

◆ decreaseParcelReputation:

- (void) decreaseParcelReputation: (unsigned amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

651 :(unsigned)amount
652{
653 int good = [reputation oo_intForKey:PARCEL_GOOD_KEY];
654 int bad = [reputation oo_intForKey:PARCEL_BAD_KEY];
655 int unknown = [reputation oo_intForKey:PARCEL_UNKNOWN_KEY];
656
657 for (unsigned i=0;i<amount;i++)
658 {
659 if (good > 0)
660 {
661 // shift a bean from good to bad
662 good--;
663 if (bad < MAX_CONTRACT_REP)
664 bad++;
665 }
666 else
667 {
668 // shift a bean from unknown to bad
669 if (unknown > 0)
670 unknown--;
671 if (bad < MAX_CONTRACT_REP)
672 bad++;
673 }
674 }
675 [reputation oo_setInteger:good forKey:PARCEL_GOOD_KEY];
676 [reputation oo_setInteger:bad forKey:PARCEL_BAD_KEY];
677 [reputation oo_setInteger:unknown forKey:PARCEL_UNKNOWN_KEY];
678}

◆ decreasePassengerReputation:

- (void) decreasePassengerReputation: (unsigned amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

576 :(unsigned)amount
577{
578 int good = [reputation oo_intForKey:PASSAGE_GOOD_KEY];
579 int bad = [reputation oo_intForKey:PASSAGE_BAD_KEY];
580 int unknown = [reputation oo_intForKey:PASSAGE_UNKNOWN_KEY];
581
582for (unsigned i=0;i<amount;i++)
583 {
584 if (good > 0)
585 {
586 // shift a bean from good to bad
587 good--;
588 if (bad < MAX_CONTRACT_REP)
589 bad++;
590 }
591 else
592 {
593 // shift a bean from unknown to bad
594 if (unknown > 0)
595 unknown--;
596 if (bad < MAX_CONTRACT_REP)
597 bad++;
598 }
599 }
600 [reputation oo_setInteger:good forKey:PASSAGE_GOOD_KEY];
601 [reputation oo_setInteger:bad forKey:PASSAGE_BAD_KEY];
602 [reputation oo_setInteger:unknown forKey:PASSAGE_UNKNOWN_KEY];
603}

◆ decrement:

- (void) decrement: (NSString *)  missionVariableString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1779 :(NSString *)missionVariableString
1780{
1781 BOOL hasMissionPrefix, hasLocalPrefix;
1782 int value = 0;
1783
1784 hasMissionPrefix = [missionVariableString hasPrefix:@"mission_"];
1785 hasLocalPrefix = [missionVariableString hasPrefix:@"local_"];
1786
1787 if (hasMissionPrefix)
1788 {
1789 value = [[self missionVariableForKey:missionVariableString] intValue];
1790 value--;
1791 [self setMissionVariable:[NSString stringWithFormat:@"%d", value] forKey:missionVariableString];
1792 }
1793 else if (hasLocalPrefix)
1794 {
1795 value = [[self localVariableForKey:missionVariableString andMission:sCurrentMissionKey] intValue];
1796 value--;
1797 [self setLocalVariable:[NSString stringWithFormat:@"%d", value] forKey:missionVariableString andMission:sCurrentMissionKey];
1798 }
1799 else
1800 {
1801 OOLog(kOOLogSyntaxDecrement, @"***** SCRIPT ERROR: in %@, IDENTIFIER '%@' DOES NOT BEGIN WITH 'mission_' or 'local_'", CurrentScriptDesc(), missionVariableString);
1802 }
1803}
static NSString *const kOOLogSyntaxDecrement

◆ defaultMarker:

- (NSDictionary *) defaultMarker: (OOSystemID system

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

311 :(OOSystemID)system
312{
313 return [[[NSDictionary dictionaryWithObjectsAndKeys:
314 [NSNumber numberWithInt:system], @"system",
315 MISSION_DEST_LEGACY, @"name",
316 @"redColor", @"markerColor",
317 @"MARKER_X", @"markerShape",
318 nil] retain] autorelease];
319}

Referenced by MissionMarkSystem(), and MissionUnmarkSystem().

+ Here is the caller graph for this function:

◆ deferredInit

- (void) deferredInit

Definition at line 13727 of file PlayerEntity.m.

1827{
1828 NSAssert(gOOPlayer == self, @"Expected only one PlayerEntity to exist at a time.");
1829 NSAssert([super initWithKey:PLAYER_SHIP_DESC definition:[NSDictionary dictionary]] == self, @"PlayerEntity requires -[ShipEntity initWithKey:definition:] to return unmodified self.");
1830
1832#if OO_FOV_INFLIGHT_CONTROL_ENABLED
1833 fov_delta = 2.0; // multiply by 2 each second
1834#endif
1835
1837
1839
1840 isPlayer = YES;
1841
1842 [self setStatus:STATUS_START_GAME];
1843
1844 int i;
1845 for (i = 0; i < PLAYER_MAX_MISSILES; i++)
1846 {
1847 missile_entity[i] = nil;
1848 }
1849 [self setUpAndConfirmOK:NO];
1850
1851 save_path = nil;
1852
1853 scoopsActive = NO;
1854
1856
1858 dockingReport = [[NSMutableString alloc] init];
1859 [hud resetGuis:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionary], @"message_gui",
1860 [NSDictionary dictionary], @"comm_log_gui", nil]];
1861
1862 [self initControls];
1863}
#define MAX_FOV
#define PLAYER_SHIP_DESC
PlayerEntity * gOOPlayer
unsigned afterburnerSoundLooping
unsigned scoopsActive
double maxFieldOfView

◆ deleteAllKeySettings

- (void) deleteAllKeySettings
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1704{
1705 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1706 [defaults removeObjectForKey:KEYCONFIG_OVERRIDES];
1707 if ([customEquipActivation count] > 0)
1708 {
1709 NSUInteger i;
1710 for (i = 0; i < [customEquipActivation count]; i++)
1711 {
1712 NSString *eq = [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY];
1714 if ([item defaultActivateKey])
1715 [[customEquipActivation objectAtIndex:i] setObject:[item defaultActivateKey] forKey:CUSTOMEQUIP_KEYACTIVATE];
1716 else
1717 [[customEquipActivation objectAtIndex:i] removeObjectForKey:CUSTOMEQUIP_KEYACTIVATE];
1718
1719 if ([item defaultModeKey])
1720 [[customEquipActivation objectAtIndex:i] setObject:[item defaultModeKey] forKey:CUSTOMEQUIP_KEYMODE];
1721 else
1722 [[customEquipActivation objectAtIndex:i] removeObjectForKey:CUSTOMEQUIP_KEYMODE];
1723 }
1724 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1725 }
1726 // reload settings
1727 [self initKeyConfigSettings];
1728}
#define CUSTOMEQUIP_KEYACTIVATE

◆ deleteKeySetting:

- (void) deleteKeySetting: (NSString*)  key
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1682 :(NSString*)key
1683{
1684 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1685 if (![self entryIsCustomEquip:key])
1686 {
1687 NSMutableDictionary *keyconf = [NSMutableDictionary dictionaryWithDictionary:[defaults objectForKey:KEYCONFIG_OVERRIDES]];
1688 [keyconf removeObjectForKey:key];
1689 [defaults setObject:keyconf forKey:KEYCONFIG_OVERRIDES];
1690 }
1691 else
1692 {
1693 NSString *custkey = [self getCustomEquipKeyDefType:key];
1694 [[customEquipActivation objectAtIndex:[self getCustomEquipIndex:key]] removeObjectForKey:custkey];
1695 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1696 }
1697 // reload settings
1698 [self initKeyConfigSettings];
1699}

◆ describeStickDict:

- (NSString *) describeStickDict: (NSDictionary *)  stickDict
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

539 : (NSDictionary *)stickDict
540{
541 NSString *desc=nil;
542 if(stickDict)
543 {
544 int thingNumber=[(NSNumber *)[stickDict objectForKey: STICK_AXBUT]
545 intValue];
546 int stickNumber=[(NSNumber *)[stickDict objectForKey: STICK_NUMBER]
547 intValue];
548 // Button or axis?
549 if([(NSNumber *)[stickDict objectForKey: STICK_ISAXIS] boolValue])
550 {
551 desc=[NSString stringWithFormat: @"Stick %d axis %d",
552 stickNumber+1, thingNumber+1];
553 }
554 else if(thingNumber >= MAX_REAL_BUTTONS)
555 {
556 static const char dir[][6] = { "up", "right", "down", "left" };
557 desc=[NSString stringWithFormat: @"Stick %d hat %d %s",
558 stickNumber+1, (thingNumber - MAX_REAL_BUTTONS) / 4 + 1,
559 dir[thingNumber & 3]];
560 }
561 else
562 {
563 desc=[NSString stringWithFormat: @"Stick %d button %d",
564 stickNumber+1, thingNumber+1];
565 }
566 }
567 return desc;
568}
#define MAX_REAL_BUTTONS

◆ destroySound

- (void) destroySound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

161{
166
169
175
181}
static OOSoundSourcePool * sDamageSoundPool
static OOSoundSource * sEcmSource
static NSDictionary * weaponUnshieldedHit
static OOSoundSourcePool * sWeaponSoundPool
static OOSoundSource * sHyperspaceSoundSource
static OOSoundSourcePool * sBuySellSourcePool
static NSDictionary * weaponShotHit
static OOSoundSource * sBreakPatternSource
static OOSoundSource * sAfterburnerSources[2]
static NSDictionary * weaponLaunched
static OOSoundSource * sInterfaceBeepSource
static OOSoundSourcePool * sMiscSoundPool
static OOSoundSourcePool * sWarningSoundPool
static NSDictionary * weaponShieldHit
static NSDictionary * weaponShotMiss

◆ dial_clock

- (NSString *) dial_clock

Definition at line 13727 of file PlayerEntity.m.

4922{
4924}
NSString * ClockToString(double clock, BOOL adjusting)

◆ dial_clock_adjusted

- (NSString *) dial_clock_adjusted

Definition at line 13727 of file PlayerEntity.m.

4928{
4930}

◆ dial_fpsinfo

- (NSString *) dial_fpsinfo

Definition at line 13727 of file PlayerEntity.m.

4934{
4935 unsigned fpsVal = fps_counter;
4936 return [NSString stringWithFormat:@"FPS: %3d", fpsVal];
4937}

◆ dial_objinfo

- (NSString *) dial_objinfo

Definition at line 13727 of file PlayerEntity.m.

4941{
4942 NSString *result = [NSString stringWithFormat:@"Entities: %3llu", [UNIVERSE entityCount]];
4943#ifndef NDEBUG
4944 result = [NSString stringWithFormat:@"%@ (%d, %zu KiB, avg %zu bytes)", result, gLiveEntityCount, gTotalEntityMemory >> 10, gTotalEntityMemory / gLiveEntityCount];
4945#endif
4946
4947 return result;
4948}

◆ dialAftShield

- (GLfloat) dialAftShield

Definition at line 13727 of file PlayerEntity.m.

4790{
4791 if (EXPECT_NOT([self maxAftShieldLevel] <= 0))
4792 {
4793 return 0.0;
4794 }
4795 GLfloat result = aft_shield / [self maxAftShieldLevel];
4796 return OOClamp_0_1_f(result);
4797}
float maxAftShieldLevel()

◆ dialAltitude

- (GLfloat) dialAltitude

Definition at line 13727 of file PlayerEntity.m.

4869{
4870 if ([self isDocked]) return 0.0f;
4871
4872 // find nearest planet type entity...
4873 assert(UNIVERSE != nil);
4874
4875 Entity *nearestPlanet = [self findNearestStellarBody];
4876 if (nearestPlanet == nil) return 1.0f;
4877
4879 GLfloat cr = nearestPlanet->collision_radius;
4880 GLfloat alt = sqrt(zd) - cr;
4881
4883}
#define PLAYER_DIAL_MAX_ALTITUDE

◆ dialCustomColor:

- (OOColor *) dialCustomColor: (NSString *)  dialKey

Definition at line 13727 of file PlayerEntity.m.

4623 :(NSString *)dialKey
4624{
4625 return [OOColor colorWithDescription:[customDialSettings objectForKey:dialKey]];
4626}
OOColor * colorWithDescription:(id description)
Definition OOColor.m:127

◆ dialCustomFloat:

- (float) dialCustomFloat: (NSString *)  dialKey

Definition at line 13727 of file PlayerEntity.m.

4611 :(NSString *)dialKey
4612{
4613 return [customDialSettings oo_floatForKey:dialKey defaultValue:0.0];
4614}

◆ dialCustomString:

- (NSString *) dialCustomString: (NSString *)  dialKey

Definition at line 13727 of file PlayerEntity.m.

4617 :(NSString *)dialKey
4618{
4619 return [customDialSettings oo_stringForKey:dialKey defaultValue:@""];
4620}

◆ dialEnergy

- (GLfloat) dialEnergy

Definition at line 13727 of file PlayerEntity.m.

4801{
4802 GLfloat result = energy / maxEnergy;
4803 return OOClamp_0_1_f(result);
4804}
GLfloat maxEnergy
Definition Entity.h:143
GLfloat energy
Definition Entity.h:142

◆ dialForwardShield

- (GLfloat) dialForwardShield

Definition at line 13727 of file PlayerEntity.m.

4779{
4780 if (EXPECT_NOT([self maxForwardShieldLevel] <= 0))
4781 {
4782 return 0.0;
4783 }
4784 GLfloat result = forward_shield / [self maxForwardShieldLevel];
4785 return OOClamp_0_1_f(result);
4786}
float maxForwardShieldLevel()
GLfloat forward_shield

◆ dialFuel

- (GLfloat) dialFuel

Definition at line 13727 of file PlayerEntity.m.

4814{
4815 if (fuel <= 0.0f)
4816 return 0.0f;
4817 if (fuel > [self fuelCapacity])
4818 return 1.0f;
4819 return (GLfloat)fuel / (GLfloat)[self fuelCapacity];
4820}
OOFuelQuantity fuelCapacity()

◆ dialFuelScoopStatus

- (OOFuelScoopStatus) dialFuelScoopStatus

Definition at line 13727 of file PlayerEntity.m.

4991{
4992 // need to account for the different ways of calculating cargo on board when docked/in-flight
4994 if ([self hasScoop])
4995 {
4996 if (scoopsActive)
4997 return SCOOP_STATUS_ACTIVE;
5000 return SCOOP_STATUS_OKAY;
5001 }
5002 else
5003 {
5005 }
5006}
@ SCOOP_STATUS_FULL_HOLD
@ SCOOP_STATUS_NOT_INSTALLED
@ SCOOP_STATUS_ACTIVE
@ SCOOP_STATUS_OKAY
BOOL hasScoop()

◆ dialHyperRange

- (GLfloat) dialHyperRange

Definition at line 13727 of file PlayerEntity.m.

4824{
4825 if (target_system_id == system_id && ![UNIVERSE inInterstellarSpace]) return 0.0f;
4826 return [self fuelRequiredForJump] / (GLfloat)PLAYER_MAX_FUEL;
4827}
#define PLAYER_MAX_FUEL
OOSystemID target_system_id

◆ dialHyperSpeed

- (GLfloat) dialHyperSpeed

Definition at line 13727 of file PlayerEntity.m.

4773{
4774 return flightSpeed / maxFlightSpeed;
4775}
GLfloat flightSpeed
Definition ShipEntity.h:368
GLfloat maxFlightSpeed
Definition ShipEntity.h:239

◆ dialIdentEngaged

- (BOOL) dialIdentEngaged

Definition at line 13727 of file PlayerEntity.m.

5472{
5473 return ident_engaged;
5474}

◆ dialMaxEnergy

- (GLfloat) dialMaxEnergy

Definition at line 13727 of file PlayerEntity.m.

4808{
4809 return maxEnergy;
4810}

◆ dialMaxMissiles

- (NSUInteger) dialMaxMissiles

Definition at line 13727 of file PlayerEntity.m.

5466{
5467 return max_missiles;
5468}

◆ dialMissileStatus

- (OOMissileStatus) dialMissileStatus

Definition at line 13727 of file PlayerEntity.m.

4965{
4966 if ([self weaponsOnline])
4967 {
4968 return missile_status;
4969 }
4970 else
4971 {
4972 // Invariant/safety interlock: weapons offline implies missiles safe. -- Ahruman 2012-07-21
4974 {
4975 OOLogERR(@"player.missilesUnsafe", @"%@", @"Missile state is not SAFE when weapons are offline. This is a bug, please report it.");
4976 [self safeAllMissiles];
4977 }
4978 return MISSILE_STATUS_SAFE;
4979 }
4980}
@ MISSILE_STATUS_SAFE

◆ dialPitch

- (GLfloat) dialPitch

Definition at line 13727 of file PlayerEntity.m.

4744{
4746 if ((result < 1.0f)&&(result > -1.0f))
4747 return result;
4748 if (result > 0.0f)
4749 return 1.0f;
4750 return -1.0f;
4751}
GLfloat max_flight_pitch
Definition ShipEntity.h:241
GLfloat flightPitch
Definition ShipEntity.h:370

◆ dialRoll

- (GLfloat) dialRoll

Definition at line 13727 of file PlayerEntity.m.

4733{
4735 if ((result < 1.0f)&&(result > -1.0f))
4736 return result;
4737 if (result > 0.0f)
4738 return 1.0f;
4739 return -1.0f;
4740}
GLfloat max_flight_roll
Definition ShipEntity.h:240
GLfloat flightRoll
Definition ShipEntity.h:369

◆ dialSpeed

- (GLfloat) dialSpeed

Definition at line 13727 of file PlayerEntity.m.

4766{
4768 return OOClamp_0_1_f(result);
4769}

◆ dialTargetName

- (NSString *) dialTargetName

Definition at line 13727 of file PlayerEntity.m.

5490{
5491 Entity *target_entity = [self primaryTarget];
5492 NSString *result = nil;
5493
5494 if (target_entity == nil)
5495 {
5496 result = DESC(@"no-target-string");
5497 }
5498
5500 {
5501 result = [(ShipEntity*)target_entity identFromShip:self];
5502 }
5503
5504 if (result == nil) result = DESC(@"unknown-target");
5505
5506 return result;
5507}

◆ dialYaw

- (GLfloat) dialYaw

Definition at line 13727 of file PlayerEntity.m.

4755{
4756 GLfloat result = -flightYaw / max_flight_yaw;
4757 if ((result < 1.0f)&&(result > -1.0f))
4758 return result;
4759 if (result > 0.0f)
4760 return 1.0f;
4761 return -1.0f;
4762}
GLfloat max_flight_yaw
Definition ShipEntity.h:242
GLfloat flightYaw
Definition ShipEntity.h:371

◆ disengageAutopilot

- (void) disengageAutopilot

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

3706{
3708 {
3709 [self abortDocking]; // let the station know that you are no longer on approach
3711 frustration = 0.0;
3714 [self setTargetStation:nil];
3715 [self setStatus:STATUS_IN_FLIGHT];
3716 [self playAutopilotOff];
3717 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
3719 [self doScriptEvent:OOJSID("playerCancelledAutoPilot")];
3720
3721 [self resetAutopilotAI];
3722 }
3723}
OOMusicController * sharedController()
GLfloat frustration
Definition ShipEntity.h:348
OOWeakReference * _primaryTarget
Definition ShipEntity.h:437
OOBehaviour behaviour
Definition ShipEntity.h:211

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ displayFunctionList:skip:

- (void) displayFunctionList: (GuiDisplayGen *)  gui
skip: (NSUInteger skip 
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

404 :(GuiDisplayGen *)gui
405 skip:(NSUInteger)skip
406{
408
409 [gui setColor:[OOColor greenColor] forRow: GUI_ROW_HEADING];
410 [gui setArray:[NSArray arrayWithObjects:
411 @"Function", @"Assigned to", @"Type", nil]
412 forRow:GUI_ROW_HEADING];
413
414 if(!stickFunctions)
415 {
416 stickFunctions = [[self stickFunctionList] retain];
417 }
418 NSDictionary *assignedAxes = [stickHandler axisFunctions];
419 NSDictionary *assignedButs = [stickHandler buttonFunctions];
420
421 NSUInteger i, n_functions = [stickFunctions count];
422 NSInteger n_rows, start_row, previous = 0;
423
424 if (skip >= n_functions)
425 skip = n_functions - 1;
426
427 if (n_functions < MAX_ROWS_FUNCTIONS)
428 {
429 skip = 0;
430 previous = 0;
431 n_rows = MAX_ROWS_FUNCTIONS;
432 start_row = GUI_ROW_FUNCSTART;
433 }
434 else
435 {
436 n_rows = MAX_ROWS_FUNCTIONS - 1;
437 start_row = GUI_ROW_FUNCSTART;
438 if (skip > 0)
439 {
440 n_rows -= 1;
441 start_row += 1;
442 if (skip > MAX_ROWS_FUNCTIONS)
443 previous = skip - (MAX_ROWS_FUNCTIONS - 2);
444 else
445 previous = 0;
446 }
447 }
448
449 if (n_functions > 0)
450 {
451 if (skip > 0)
452 {
453 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_FUNCSTART];
454 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:GUI_ROW_FUNCSTART];
455 [gui setKey:[NSString stringWithFormat:@"More:%lld", previous] forRow:GUI_ROW_FUNCSTART];
456 }
457
458 for(i=0; i < (n_functions - skip) && (int)i < n_rows; i++)
459 {
460 NSDictionary *entry = [stickFunctions objectAtIndex: i + skip];
461 if ([entry objectForKey:KEY_HEADER]) {
462 NSString *header = [entry objectForKey:KEY_HEADER];
463 [gui setArray:[NSArray arrayWithObjects:header, @"", @"", nil] forRow:i + start_row];
464 [gui setColor:[OOColor cyanColor] forRow:i + start_row];
465 }
466 else
467 {
468 NSString *allowedThings;
469 NSString *assignment;
470 NSString *axFuncKey = [entry oo_stringForKey:KEY_AXISFN];
471 NSString *butFuncKey = [entry oo_stringForKey:KEY_BUTTONFN];
472 int allowable = [entry oo_intForKey:KEY_ALLOWABLE];
473 switch(allowable)
474 {
475 case HW_AXIS:
476 allowedThings=@"Axis";
477 assignment=[self describeStickDict:
478 [assignedAxes objectForKey: axFuncKey]];
479 break;
480 case HW_BUTTON:
481 allowedThings=@"Button";
482 int bf = [butFuncKey integerValue];
483 if (bf < 10000)
484 {
485 assignment=[self describeStickDict:
486 [assignedButs objectForKey: butFuncKey]];
487 }
488 else
489 {
490 NSString *key = CUSTOMEQUIP_BUTTONACTIVATE;
491 bf -= 10000;
492 if (bf >= 10000)
493 {
494 bf -= 10000;
496 }
497 assignment=[self describeStickDict:
498 [[customEquipActivation objectAtIndex:bf] objectForKey:key]];
499 }
500 break;
501 default:
502 allowedThings=@"Axis/Button";
503
504 // axis has priority
505 assignment=[self describeStickDict:
506 [assignedAxes objectForKey: axFuncKey]];
507 if(!assignment)
508 assignment=[self describeStickDict:
509 [assignedButs objectForKey: butFuncKey]];
510 }
511
512 // Find out what's assigned for this function currently.
513 if (assignment == nil)
514 {
515 assignment = @" - ";
516 }
517
518 [gui setArray: [NSArray arrayWithObjects:
519 [entry objectForKey: KEY_GUIDESC], assignment, allowedThings, nil]
520 forRow: i + start_row];
521 //[gui setKey: GUI_KEY_OK forRow: i + start_row];
522 [gui setKey: [NSString stringWithFormat: @"Index:%llu", i + skip] forRow: i + start_row];
523 }
524 }
525 if (i < n_functions - skip)
526 {
527 [gui setColor: [OOColor greenColor] forRow: start_row + i];
528 [gui setArray: [NSArray arrayWithObjects: DESC(@"gui-more"), @" --> ", nil] forRow: start_row + i];
529 [gui setKey: [NSString stringWithFormat: @"More:%llu", n_rows + skip] forRow: start_row + i];
530 i++;
531 }
532
533 [gui setSelectableRange: NSMakeRange(GUI_ROW_STICKPROFILE, i + start_row - GUI_ROW_STICKPROFILE)];
534 }
535
536}
#define HW_BUTTON
#define HW_AXIS
#define KEY_HEADER
#define MAX_ROWS_FUNCTIONS
#define GUI_ROW_FUNCSTART
void setSelectableRange:(NSRange range)
void setKey:forRow:(NSString *str,[forRow] OOGUIRow row)
OOColor * cyanColor()
Definition OOColor.m:286
NSDictionary * buttonFunctions()
NSDictionary * axisFunctions()

◆ displayKeyboardLayoutList:skip:

- (void) displayKeyboardLayoutList: (GuiDisplayGen *)  gui
skip: (NSUInteger skip 
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1300 :(GuiDisplayGen *)gui skip:(NSUInteger)skip
1301{
1302 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_KC_HEADING];
1303 [gui setArray:[NSArray arrayWithObjects:@"Keyboard layout", nil] forRow:GUI_ROW_KC_HEADING];
1304
1305 if (!kbdLayouts) kbdLayouts = [[self keyboardLayoutList] retain];
1306
1307 NSUInteger i, n_functions = [kbdLayouts count];
1308 NSInteger n_rows, start_row, previous = 0;
1309
1310 if (skip >= n_functions)
1311 skip = n_functions - 1;
1312
1313 if (n_functions < MAX_ROWS_KC_FUNCTIONS)
1314 {
1315 skip = 0;
1316 previous = 0;
1317 n_rows = MAX_ROWS_KC_FUNCTIONS;
1318 start_row = GUI_ROW_KC_FUNCSTART;
1319 }
1320 else
1321 {
1322 n_rows = MAX_ROWS_KC_FUNCTIONS - 1;
1323 start_row = GUI_ROW_KC_FUNCSTART;
1324 if (skip > 0)
1325 {
1326 n_rows -= 1;
1327 start_row += 1;
1328 if (skip > MAX_ROWS_KC_FUNCTIONS)
1329 previous = skip - (MAX_ROWS_KC_FUNCTIONS - 2);
1330 else
1331 previous = 0;
1332 }
1333 }
1334
1335 if (n_functions > 0)
1336 {
1337 if (skip > 0)
1338 {
1339 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_KC_FUNCSTART];
1340 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:GUI_ROW_KC_FUNCSTART];
1341 [gui setKey:[NSString stringWithFormat:@"More:%lld", previous] forRow:GUI_ROW_KC_FUNCSTART];
1342 }
1343
1344 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1345 NSString *kbd = [defaults oo_stringForKey:@"keyboard-code" defaultValue:@"default"];
1346
1347 for(i = 0; i < (n_functions - skip) && (int)i < n_rows; i++)
1348 {
1349 NSDictionary *entry = [kbdLayouts objectAtIndex:i + skip];
1350 NSString *desc = [entry objectForKey:@"description"];
1351 NSString *selected = @"";
1352 if ([[entry objectForKey:@"key"] isEqualToString:kbd]) selected = @"Current";
1353 [gui setArray:[NSArray arrayWithObjects:desc, selected, nil] forRow:i + start_row];
1354 [gui setKey:[NSString stringWithFormat:@"Index:%llu", i + skip] forRow:i + start_row];
1355 }
1356 if (i < n_functions - skip)
1357 {
1358 [gui setColor:[OOColor greenColor] forRow:start_row + i];
1359 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil] forRow:start_row + i];
1360 [gui setKey:[NSString stringWithFormat:@"More:%llu", n_rows + skip] forRow:start_row + i];
1361 i++;
1362 }
1363
1364 [gui setSelectableRange:NSMakeRange(GUI_ROW_KC_FUNCSTART, i + start_row - GUI_ROW_KC_FUNCSTART)];
1365 }
1366}
#define MAX_ROWS_KC_FUNCTIONS
#define GUI_ROW_KC_FUNCSTART

◆ displayKeyFunctionList:skip:

- (void) displayKeyFunctionList: (GuiDisplayGen *)  gui
skip: (NSUInteger skip 
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

827 :(GuiDisplayGen *)gui skip:(NSUInteger)skip
828{
829 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_KC_HEADING];
830 [gui setArray:[NSArray arrayWithObjects:
831 @"Function", @"Assigned to", @"Overrides", nil]
832 forRow:GUI_ROW_KC_HEADING];
833
834 NSDictionary *overrides = [self loadKeySettings];
835
836 if(!keyFunctions)
837 {
838 keyFunctions = [[self keyFunctionList] retain];
839 }
840
841 NSUInteger i, n_functions = [keyFunctions count];
842 NSInteger n_rows, start_row, previous = 0;
843 NSString *validate = nil;
844
845 if (skip >= n_functions)
846 skip = n_functions - 1;
847
848 if (n_functions < MAX_ROWS_KC_FUNCTIONS)
849 {
850 skip = 0;
851 previous = 0;
852 n_rows = MAX_ROWS_KC_FUNCTIONS;
853 start_row = GUI_ROW_KC_FUNCSTART;
854 }
855 else
856 {
857 n_rows = MAX_ROWS_KC_FUNCTIONS - 1;
858 start_row = GUI_ROW_KC_FUNCSTART;
859 if (skip > 0)
860 {
861 n_rows -= 1;
862 start_row += 1;
863 if (skip > MAX_ROWS_KC_FUNCTIONS)
864 previous = skip - (MAX_ROWS_KC_FUNCTIONS - 2);
865 else
866 previous = 0;
867 }
868 }
869
870 if (n_functions > 0)
871 {
872 if (skip > 0)
873 {
874 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_KC_FUNCSTART];
875 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:GUI_ROW_KC_FUNCSTART];
876 [gui setKey:[NSString stringWithFormat:@"More:%lld", previous] forRow:GUI_ROW_KC_FUNCSTART];
877 }
878
879 for(i = 0; i < (n_functions - skip) && (int)i < n_rows; i++)
880 {
881 NSDictionary *entry = [keyFunctions objectAtIndex:i + skip];
882 if ([entry objectForKey:KEY_KC_HEADER]) {
883 NSString *header = [entry objectForKey:KEY_KC_HEADER];
884 [gui setArray:[NSArray arrayWithObjects:header, @"", @"", nil] forRow:i + start_row];
885 [gui setColor:[OOColor cyanColor] forRow:i + start_row];
886 }
887 else
888 {
889 NSString *assignment = nil;
890 NSString *override = nil;
891 if (![self entryIsDictCustomEquip:entry])
892 {
893 // Find out what's assigned for this function currently.
894 assignment = [PLAYER keyBindingDescription2:[entry objectForKey:KEY_KC_DEFINITION]];
895 override = ([overrides objectForKey:[entry objectForKey:KEY_KC_DEFINITION]] ? @"Yes" : @""); // work out whether this assignment is overriding the setting in keyconfig2.plist
896 validate = [self validateKey:[entry objectForKey:KEY_KC_DEFINITION] checkKeys:(NSArray *)[keyconfig2_settings objectForKey:[entry objectForKey:KEY_KC_DEFINITION]]];
897 }
898 else
899 {
900 NSString *custom_keytype = [self getCustomEquipKeyDefType:[entry oo_stringForKey:KEY_KC_DEFINITION]];
901 NSUInteger idx = [self getCustomEquipIndex:[entry oo_stringForKey:KEY_KC_DEFINITION]];
902 assignment = [PLAYER getKeyBindingDescription:[[customEquipActivation objectAtIndex:idx] oo_arrayForKey:custom_keytype]];
903 OOEquipmentType *item = [OOEquipmentType equipmentTypeWithIdentifier:[[customEquipActivation objectAtIndex:idx] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]];
904 bool result = true;
905 int j, k;
906 NSArray *defArray = nil;
907 NSArray *compArray = nil;
908
909 if ([custom_keytype isEqualToString:CUSTOMEQUIP_KEYACTIVATE])
910 {
911 defArray = [item defaultActivateKey];
912 compArray = [[customEquipActivation objectAtIndex:idx] oo_arrayForKey:custom_keytype];
913 }
914 if ([custom_keytype isEqualToString:CUSTOMEQUIP_KEYMODE])
915 {
916 defArray = [item defaultModeKey];
917 compArray = [[customEquipActivation objectAtIndex:idx] oo_arrayForKey:custom_keytype];
918 }
919 for (j = 0; j < [defArray count]; j++)
920 {
921 for (k = 0; k < [compArray count]; k++)
922 {
923 if (![self compareKeyEntries:[defArray objectAtIndex:j] second:[compArray objectAtIndex:k]])
924 {
925 result = false;
926 break;
927 }
928 }
929 if (result == false) break;
930 }
931
932 override = (!result ? @"Yes" : @"");
933 validate = [self validateKey:[entry objectForKey:KEY_KC_DEFINITION] checkKeys:(NSArray *)[[customEquipActivation objectAtIndex:idx] oo_arrayForKey:custom_keytype]];
934 }
935 if (assignment == nil)
936 {
937 assignment = @" - ";
938 }
939
940 [gui setArray:[NSArray arrayWithObjects:
941 [entry objectForKey:KEY_KC_GUIDESC], assignment, override, nil]
942 forRow:i + start_row];
943 [gui setKey:[NSString stringWithFormat:@"Index:%llu", i + skip] forRow:i + start_row];
944 if (validate)
945 {
946 [gui setColor:[OOColor orangeColor] forRow:i + start_row];
947 }
948 }
949 }
950 if (i < n_functions - skip)
951 {
952 [gui setColor:[OOColor greenColor] forRow:start_row + i];
953 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil] forRow:start_row + i];
954 [gui setKey:[NSString stringWithFormat:@"More:%llu", n_rows + skip] forRow:start_row + i];
955 i++;
956 }
957
958 [gui setSelectableRange:NSMakeRange(GUI_ROW_KC_SELECTKBD, (i + start_row - GUI_ROW_KC_FUNCSTART) + (GUI_ROW_KC_FUNCSTART - GUI_ROW_KC_SELECTKBD))];
959 }
960}
#define KEY_KC_HEADER
#define CUSTOMEQUIP_KEYMODE
OOColor * orangeColor()
Definition OOColor.m:304

◆ doBookkeeping:

- (void) doBookkeeping: (double delta_t

This code branch doesn't seem to be used any more - see ~line 6000 Should we remove it? - CIM

Definition at line 13727 of file PlayerEntity.m.

2728 :(double) delta_t
2729{
2731
2733
2734 static BOOL gettingInterference = NO;
2735
2736 OOSunEntity *sun = [UNIVERSE sun];
2737 double external_temp = 0;
2738 GLfloat air_friction = 0.0f;
2739 air_friction = 0.5f * [UNIVERSE airResistanceFactor];
2740 if (air_friction < 0.005f) // aRF < 0.01
2741 {
2742 // stops mysteriously overheating and exploding in the middle of empty space
2743 air_friction = 0;
2744 }
2745
2746 UPDATE_STAGE(@"updating weapon temperatures and shot times");
2747 // cool all weapons.
2748 float coolAmount = WEAPON_COOLING_FACTOR * delta_t;
2753
2754 // update shot times.
2755 forward_shot_time += delta_t;
2756 aft_shot_time += delta_t;
2757 port_shot_time += delta_t;
2758 starboard_shot_time += delta_t;
2759
2760 // copy new temp & shot time to main temp & shot time
2761 switch (currentWeaponFacing)
2762 {
2766 break;
2767 case WEAPON_FACING_AFT:
2770 break;
2771 case WEAPON_FACING_PORT:
2774 break;
2778 break;
2779
2780 case WEAPON_FACING_NONE:
2781 break;
2782 }
2783
2784 // cloaking device
2786 {
2787 UPDATE_STAGE(@"updating cloaking device");
2788
2791 [self deactivateCloakingDevice];
2792 }
2793
2794 // military_jammer
2795 if ([self hasMilitaryJammer])
2796 {
2797 UPDATE_STAGE(@"updating military jammer");
2798
2800 {
2804 }
2805 else
2806 {
2809 }
2810 }
2811
2812 // ecm
2813 if (ecm_in_operation)
2814 {
2815 UPDATE_STAGE(@"updating ECM");
2816
2817 if (energy > 0.0)
2818 energy -= (float)(ECM_ENERGY_DRAIN_FACTOR * delta_t); // drain energy because of the ECM
2819 else
2820 {
2822 [UNIVERSE addMessage:DESC(@"ecm-out-of-juice") forCount:3.0];
2823 }
2824 if ([UNIVERSE getTime] > ecm_start_time + ECM_DURATION)
2825 {
2827 }
2828 }
2829
2830 // ecm interference visual effect
2831 if ([UNIVERSE useShaders] && [UNIVERSE ECMVisualFXEnabled])
2832 {
2833 // we want to start and stop the effect exactly once, not start it
2834 // or stop it on every frame
2835 if ([self scannerFuzziness] > 0.0)
2836 {
2838 {
2839 [UNIVERSE setCurrentPostFX:OO_POSTFX_CRTBADSIGNAL];
2841 }
2842 }
2843 else
2844 {
2846 {
2847 [UNIVERSE terminatePostFX:OO_POSTFX_CRTBADSIGNAL];
2849 }
2850 }
2851 }
2852
2853 // Energy Banks and Shields
2854
2855 /* Shield-charging behaviour, as per Eric's proposal:
2856 1. If shields are less than a threshold, recharge with all available energy
2857 2. If energy banks are below threshold, recharge with generated energy
2858 3. Charge shields with any surplus energy
2859 */
2860 UPDATE_STAGE(@"updating energy and shield charges");
2861
2862 // 1. (Over)charge energy banks (will get normalised later)
2863 energy += [self energyRechargeRate] * delta_t;
2864
2865 // 2. Calculate shield recharge rates
2866 float fwdMax = [self maxForwardShieldLevel];
2867 float aftMax = [self maxAftShieldLevel];
2868 float shieldRechargeFwd = [self forwardShieldRechargeRate] * delta_t;
2869 float shieldRechargeAft = [self aftShieldRechargeRate] * delta_t;
2870 /* there is potential for negative rechargeFwd and rechargeAFt values here
2871 (e.g. getting shield boosters damaged while shields are full). This may
2872 lead to energy being gained rather than consumed when recharging. Leaving
2873 as-is for now, as there might be OXPs that rely in such behaviour.
2874 Boosters case example mentioned above is the only known core equipment
2875 occurrence at this time and it has been fixed inside the
2876 oolite-equipment-control.js script. - Nikos 20160104.
2877 */
2880
2881 // Note: we've simplified this a little, so if either shield is below
2882 // the critical threshold, we allocate all energy. Ideally we
2883 // would only allocate the full recharge to the critical shield,
2884 // but doing so would add another few levels of if-then below.
2885 float energyForShields = energy;
2886 if( (forward_shield > fwdMax * 0.25) && (aft_shield > aftMax * 0.25) )
2887 {
2888 // TODO: Can this be cached anywhere sensibly (without adding another member variable)?
2889 float minEnergyBankLevel = [[UNIVERSE globalSettings] oo_floatForKey:@"shield_charge_energybank_threshold" defaultValue:0.25];
2890 energyForShields = MAX(0.0, energy -0.1 - (maxEnergy * minEnergyBankLevel)); // NB: The - 0.1 ensures the energy value does not 'bounce' across the critical energy message and causes spurious energy-low warnings
2891 }
2892
2894 {
2897 }
2898 else
2899 {
2902 }
2903
2904 // 3. Recharge shields, drain banks, and clamp values
2908
2912
2913 if (sun)
2914 {
2915 UPDATE_STAGE(@"updating sun effects");
2916
2917 // set the ambient temperature here
2918 double sun_zd = sun->zero_distance; // square of distance
2919 double sun_cr = sun->collision_radius;
2920 double alt1 = sun_cr * sun_cr / sun_zd;
2922
2923 if ([sun goneNova])
2924 external_temp *= 100;
2925 // fuel scooping during the nova mission very unlikely
2926 if ([sun willGoNova])
2927 external_temp *= 3;
2928
2929 // do Revised sun-skimming check here...
2930 if ([self hasFuelScoop] && alt1 > 0.75 && [self fuel] < [self fuelCapacity])
2931 {
2932 fuel_accumulator += (float)(delta_t * flightSpeed * 0.010 / [self fuelChargeRate]);
2933 // are we fast enough to collect any fuel?
2934 scoopsActive = YES && flightSpeed > 0.1f;
2935 while (fuel_accumulator > 1.0f)
2936 {
2937 [self setFuel:[self fuel] + 1];
2938 fuel_accumulator -= 1.0f;
2939 [self doScriptEvent:OOJSID("shipScoopedFuel")];
2940 }
2941 [UNIVERSE displayCountdownMessage:DESC(@"fuel-scoop-active") forCount:1.0];
2942 }
2943 }
2944
2945 //Bug #11692 CmdrJames added Status entering witchspace
2946 OOEntityStatus status = [self status];
2948 {
2949 UPDATE_STAGE(@"updating cabin temperature");
2950
2951 // work on the cabin temperature
2952 float heatInsulation = [self heatInsulation]; // Optimisation, suggested by EricW
2953 float deltaInsulation = delta_t/heatInsulation;
2954 float heatThreshold = heatInsulation * 100.0f;
2956
2959 else
2960 {
2963 }
2964
2966 [self takeHeatDamage: delta_t * ship_temperature];
2967 }
2968
2970 {
2971 UPDATE_STAGE(@"resetting after escape");
2973 // reset legal status again! Could have changed if a previously launched missile hit a clean NPC while in the escape pod.
2974 [self setBounty:0 withReason:kOOLegalStatusReasonEscapePod];
2975 bounty = 0;
2976 thrust = max_thrust; // re-enable inertialess drives
2977 // no access to all player.ship properties while inside the escape pod,
2978 // we're not supposed to be inside our ship anymore!
2979 [self doScriptEvent:OOJSID("escapePodSequenceOver")]; // allow oxps to override the escape pod target
2984 if (EXPECT_NOT(target_system_id != system_id)) // overridden: we're going to a nearby system!
2985 {
2988 [UNIVERSE setSystemTo:system_id];
2990
2991 [UNIVERSE setUpSpace];
2992 // run initial system population
2993 [UNIVERSE populateNormalSpace];
2994
2995 [self setDockTarget:[UNIVERSE station]];
2996 // send world script events to let oxps know we're in a new system.
2997 // all player.ship properties are still disabled at this stage.
2998 [UNIVERSE setWitchspaceBreakPattern:YES];
2999 [self doScriptEvent:OOJSID("shipWillExitWitchspace")];
3000 [self doScriptEvent:OOJSID("shipExitedWitchspace")];
3001
3002 [[UNIVERSE planet] update: 2.34375 * market_rnd]; // from 0..10 minutes
3003 [[UNIVERSE station] update: 2.34375 * market_rnd]; // from 0..10 minutes
3004 }
3005
3006 Entity *dockTargetEntity = [UNIVERSE entityForUniversalID:_dockTarget]; // main station in the original system, unless overridden.
3007 if ([dockTargetEntity isStation]) // fails if _dockTarget is NO_TARGET
3008 {
3009 [doppelganger becomeExplosion]; // blow up the doppelganger
3010 // restore player ship
3011 ShipEntity *player_ship = [UNIVERSE newShipWithName:[self shipDataKey]]; // retained
3012 if (player_ship)
3013 {
3014 // FIXME: this should use OOShipType, which should exist. -- Ahruman
3015 [self setMesh:[player_ship mesh]];
3016 [player_ship release]; // we only wanted it for its polygons!
3017 }
3018 [UNIVERSE setViewDirection:VIEW_FORWARD];
3019 [UNIVERSE setBlockJSPlayerShipProps:NO]; // re-enable player.ship!
3020 [self enterDock:(StationEntity *)dockTargetEntity];
3021 }
3022 else // no dock target? dock target is not a station? game over!
3023 {
3024 [self setStatus:STATUS_DEAD];
3025 //[self playGameOver]; // no death explosion sounds for player pods
3026 // no shipDied events for player pods, either
3027 [UNIVERSE displayMessage:DESC(@"gameoverscreen-escape-pod") forCount:kDeadResetTime];
3028 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
3029 [self showGameOver];
3030 }
3031 }
3032
3033
3034 // MOVED THE FOLLOWING FROM PLAYERENTITY POLLFLIGHTCONTROLS:
3037 {
3038 UPDATE_STAGE(@"updating hyperspeed");
3039
3040 // increase speed up to maximum hyperspeed
3045
3046 // check for mass lock
3047 hyperspeed_locked = [self massLocked];
3048 // check for mass lock & external temperature?
3049 //hyperspeed_locked = flightSpeed * air_friction > 40.0f+(ship_temperature - external_temp ) * SHIP_COOLING_FACTOR || [self massLocked];
3050
3052 {
3053 [self playJumpMassLocked];
3054 [UNIVERSE addMessage:DESC(@"jump-mass-locked") forCount:4.5];
3056 }
3057 }
3058 else
3059 {
3061 {
3062 UPDATE_STAGE(@"updating afterburner");
3063
3064 float abFactor = [self afterburnerFactor];
3067 {
3068 // decellerate to maxInjectionSpeed but slower than without afterburner.
3069 flightSpeed -= (float)(speed_delta * delta_t * abFactor);
3070 }
3071 else
3072 {
3074 flightSpeed += (float)(speed_delta * delta_t * abFactor);
3077 }
3078 fuel_accumulator -= (float)(delta_t * afterburner_rate);
3079 while ((fuel_accumulator < 0)&&(fuel > 0))
3080 {
3081 fuel_accumulator += 1.0f;
3082 if (--fuel <= MIN_FUEL)
3084 }
3085 }
3086 else
3087 {
3088 UPDATE_STAGE(@"slowing from hyperspeed");
3089
3090 // slow back down...
3092 {
3093 // decrease speed to maximum normal speed
3094 float deceleration = (speed_delta * delta_t * HYPERSPEED_FACTOR);
3096 {
3097 // decelerate much quicker in masslocks
3098 // this does also apply to injector deceleration
3099 // but it's not very noticeable
3100 deceleration *= 3;
3101 }
3105 }
3106 }
3107 }
3108
3109
3110
3111 // fuel leakage
3112 if ((fuel_leak_rate > 0.0)&&(fuel > 0))
3113 {
3114 UPDATE_STAGE(@"updating fuel leakage");
3115
3116 fuel_accumulator -= (float)(fuel_leak_rate * delta_t);
3117 while ((fuel_accumulator < 0)&&(fuel > 0))
3118 {
3119 fuel_accumulator += 1.0f;
3120 fuel--;
3121 }
3122 if (fuel == 0)
3123 fuel_leak_rate = 0;
3124 }
3125
3126 // smart_zoom
3127 UPDATE_STAGE(@"updating scanner zoom");
3129 {
3130 double z = [hud scannerZoom];
3131 double z1 = z + scanner_zoom_rate * delta_t;
3132 if (scanner_zoom_rate > 0.0)
3133 {
3134 if (floor(z1) > floor(z))
3135 {
3136 z1 = floor(z1);
3137 scanner_zoom_rate = 0.0f;
3138 }
3139 }
3140 else
3141 {
3142 if (z1 < 1.0)
3143 {
3144 z1 = 1.0;
3145 scanner_zoom_rate = 0.0f;
3146 }
3147 }
3148 [hud setScannerZoom:z1];
3149 }
3150
3151 [[UNIVERSE gameView] setFov:fieldOfView fromFraction:YES];
3152
3153 // scanner sanity check - lose any targets further than maximum scanner range
3154 ShipEntity *primeTarget = [self primaryTarget];
3156 {
3157 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
3158 [self removeTarget:primeTarget];
3159 }
3160 // compass sanity check and update target for changed mode
3161 [self validateCompassTarget];
3162
3163 // update subentities
3164 UPDATE_STAGE(@"updating subentities");
3165 totalBoundingBox = boundingBox; // reset totalBoundingBox
3166 ShipEntity *se = nil;
3167 foreach (se, [self subEntities])
3168 {
3169 [se update:delta_t];
3170 if ([se isShip])
3171 {
3175 }
3176 }
3177 // and one thing which isn't a subentity. Fixes bug with
3178 // mispositioned laser beams particularly noticeable on side view.
3179 if (lastShot != nil)
3180 {
3182 foreach (lse, lastShot)
3183 {
3184 [lse update:0.0];
3185 }
3187 }
3188
3189 // update mousewheel status
3190 UPDATE_STAGE(@"updating mousewheel delta");
3191 MyOpenGLView *gView = [UNIVERSE gameView];
3192 float mouseWheelDelta = [gView mouseWheelDelta];
3193 if (mouseWheelDelta > 0.0f)
3194 {
3195 if (mouseWheelDelta < delta_t) [gView setMouseWheelDelta:0.0f];
3196 else [gView setMouseWheelDelta:mouseWheelDelta - delta_t];
3197 }
3198 else if (mouseWheelDelta < 0.0f)
3199 {
3200 if (mouseWheelDelta > -delta_t) [gView setMouseWheelDelta:0.0f];
3201 else [gView setMouseWheelDelta:mouseWheelDelta + delta_t];
3202 }
3203
3205}
#define MAX(A, B)
Definition OOMaths.h:114
#define MIN(A, B)
Definition OOMaths.h:111
NSPoint PointFromString(NSString *xyString)
@ WEAPON_FACING_NONE
Definition OOTypes.h:234
#define ESCAPE_SEQUENCE_TIME
#define HYPERSPEED_FACTOR
@ ALERT_FLAG_MASS_LOCK
#define ECM_DURATION
#define ECM_ENERGY_DRAIN_FACTOR
#define STAGE_TRACKING_END
#define UPDATE_STAGE(x)
#define STAGE_TRACKING_BEGIN
#define MIN_FUEL
Definition ShipEntity.h:102
#define SHIP_COOLING_FACTOR
Definition ShipEntity.h:61
#define CLOAKING_DEVICE_MIN_ENERGY
Definition ShipEntity.h:48
#define SHIP_MIN_CABIN_TEMP
Definition ShipEntity.h:68
#define MILITARY_JAMMER_ENERGY_RATE
Definition ShipEntity.h:51
#define CLOAKING_DEVICE_ENERGY_RATE
Definition ShipEntity.h:47
#define WEAPON_COOLING_FACTOR
Definition ShipEntity.h:114
#define SHIP_MAX_CABIN_TEMP
Definition ShipEntity.h:67
#define MILITARY_JAMMER_MIN_ENERGY
Definition ShipEntity.h:52
#define SUN_TEMPERATURE
Definition ShipEntity.h:72
#define SHIP_THRUST_FACTOR
Definition ShipEntity.h:44
#define SHIP_INSULATION_FACTOR
Definition ShipEntity.h:66
BoundingBox boundingBox
Definition Entity.h:145
float mouseWheelDelta()
void setMouseWheelDelta:(float newWheelDelta)
void update:(OOTimeDelta delta_t)
OOTimeDelta forward_shot_time
OOSystemID info_system_id
OOGalaxyID galaxy_number
double scannerFuzziness()
double ecm_start_time
unsigned hyperspeed_engaged
unsigned afterburner_engaged
GLfloat fuel_leak_rate
OOTimeDelta aft_shot_time
GLfloat scanner_zoom_rate
unsigned hyperspeed_locked
OOTimeDelta starboard_shot_time
OOTimeDelta port_shot_time
unsigned ecm_in_operation
BOOL hasMilitaryJammer()
OOWeaponFacing currentWeaponFacing
Definition ShipEntity.h:312
GLfloat aft_weapon_temp
Definition ShipEntity.h:315
BOOL hasFuelScoop()
GLfloat port_weapon_temp
Definition ShipEntity.h:315
BoundingBox totalBoundingBox
Definition ShipEntity.h:213
GLfloat forward_weapon_temp
Definition ShipEntity.h:315
GLfloat thrust
Definition ShipEntity.h:246
GLfloat starboard_weapon_temp
Definition ShipEntity.h:315
OOTimeDelta shot_time
Definition ShipEntity.h:197
float energyRechargeRate()
GLfloat weapon_temp
Definition ShipEntity.h:314
float ship_temperature
Definition ShipEntity.h:410
GLfloat heatInsulation()
unsigned military_jammer_active
Definition ShipEntity.h:249
void update:(OOTimeDelta delta_t)
GLfloat max_thrust
Definition ShipEntity.h:245
GLfloat afterburner_rate
Definition ShipEntity.h:291
OOMesh * mesh()
GLfloat fuelChargeRate()
void becomeExplosion()
GLfloat fuel_accumulator
Definition ShipEntity.h:289
unsigned cloaking_device_active
Definition ShipEntity.h:265
NSMutableArray * subEntities
Definition ShipEntity.h:433
BoundingBox findSubentityBoundingBox()
Entity * foundTarget()

◆ docked

- (void) docked

Definition at line 13727 of file PlayerEntity.m.

7148{
7149 StationEntity *dockedStation = [self dockedStation];
7150 if (dockedStation == nil)
7151 {
7152 [self setStatus:STATUS_IN_FLIGHT];
7153 return;
7154 }
7155
7156 [self setStatus:STATUS_DOCKED];
7157 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
7158
7159 [self loseTargetStatus];
7160
7161 [self setPosition:[dockedStation position]];
7162 [self setOrientation:kIdentityQuaternion]; // reset orientation to dock
7163
7164 flightRoll = 0.0f;
7165 flightPitch = 0.0f;
7166 flightYaw = 0.0f;
7167 flightSpeed = 0.0f;
7168
7171
7172 forward_shield = [self maxForwardShieldLevel];
7173 aft_shield = [self maxAftShieldLevel];
7174 energy = maxEnergy;
7175 weapon_temp = 0.0f;
7176 ship_temperature = 60.0f;
7177
7178 [self setAlertFlag:ALERT_FLAG_DOCKED to:YES];
7179
7180 if ([dockedStation localMarket] == nil)
7181 {
7182 [dockedStation initialiseLocalMarket];
7183 }
7184
7185 NSString *escapepodReport = [self processEscapePods];
7186 [self addMessageToReport:escapepodReport];
7187
7188 [self unloadCargoPods]; // fill up the on-ship commodities before...
7189
7190 // check import status of station
7191 // escape pods must be cleared before this happens
7192 if ([dockedStation marketMonitored])
7193 {
7194 OOCreditsQuantity oldbounty = [self bounty];
7195 [self markAsOffender:[dockedStation legalStatusOfManifest:shipCommodityData export:NO] withReason:kOOLegalStatusReasonIllegalImports];
7196 if ([self bounty] > oldbounty)
7197 {
7198 [self addRoleToPlayer:@"trader-smuggler"];
7199 }
7200 }
7201
7202 // check contracts
7203 NSString *passengerAndCargoReport = [self checkPassengerContracts]; // Is also processing cargo and parcel contracts.
7204 [self addMessageToReport:passengerAndCargoReport];
7205
7206 [UNIVERSE setDisplayText:YES];
7207
7210
7211 // Did we fail to observe traffic control regulations? However, due to the state of emergency,
7212 // apply no unauthorized docking penalties if a nova is ongoing.
7213 if ([dockedStation requiresDockingClearance] &&
7214 ![self clearedToDock] && ![[UNIVERSE sun] willGoNova])
7215 {
7216 [self penaltyForUnauthorizedDocking];
7217 }
7218
7219 // apply any pending fines. (No need to check gui_screen as fines is no longer an on-screen message).
7220 if (dockedStation == [UNIVERSE station])
7221 {
7222 // TODO: A proper system to allow some OXP stations to have a
7223 // galcop presence for fines. - CIM 18/11/2012
7224 if (being_fined && ![[UNIVERSE sun] willGoNova] && ![dockedStation suppressArrivalReports]) [self getFined];
7225 }
7226
7227 // it's time to check the script - can trigger legacy missions
7228 if (gui_screen != GUI_SCREEN_MISSION) [self checkScript]; // a scripted pilot could have created a mission screen.
7229
7231 [self doScriptEvent:OOJSID("shipDockedWithStation") withArgument:dockedStation];
7233 if ([self status] == STATUS_LAUNCHING) return;
7234
7235 // if we've not switched to the mission screen yet then proceed normally..
7237 {
7238 [self setGuiToStatusScreen];
7239 }
7242
7243 // When a mission screen is started, any on-screen message is removed immediately.
7244 [self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")]; // also displays docking reports first.
7245}
#define OOJSStopTimeLimiter()
#define kOOJSLongTimeLimit
#define OOJSStartTimeLimiterWithTimeLimit(limit)
OOCacheManager * sharedCache()
OOJavaScriptEngine * sharedEngine()
void garbageCollectionOpportunity:(BOOL force)
unsigned being_fined
Definition ShipEntity.h:259
OOCommodityMarket * initialiseLocalMarket()
OOCreditsQuantity legalStatusOfManifest:export:(OOCommodityMarket *manifest,[export] BOOL export)

◆ dockedAtMainStation

- (BOOL) dockedAtMainStation

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

77{
78 return [self status] == STATUS_DOCKED && [self dockedStation] == [UNIVERSE station];
79}

◆ dockedAtMainStation_bool

- (NSString *) dockedAtMainStation_bool

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1042{
1043 if ([self dockedAtMainStation]) return @"YES";
1044 else return @"NO";
1045}

◆ dockedStation

- (StationEntity *) dockedStation

Definition at line 13727 of file PlayerEntity.m.

4505{
4506 return [_dockedStation weakRefUnderlyingObject];
4507}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ dockedStationDisplayName

- (NSString *) dockedStationDisplayName

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

71{
72 return [[self dockedStation] displayName];
73}

◆ dockedStationName

- (NSString *) dockedStationName

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

65{
66 return [[self dockedStation] name];
67}

◆ dockedStationName_string

- (NSString *) dockedStationName_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1089{
1090 NSString *result = nil;
1091 if ([self status] != STATUS_DOCKED) return @"NONE";
1092
1093 result = [self dockedStationName];
1094 if (result == nil) result = @"UNKNOWN";
1095 return result;
1096}

◆ dockedTechLevel_number

- (NSNumber *) dockedTechLevel_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1079{
1080 StationEntity *dockedStation = [self dockedStation];
1081 if (!dockedStation)
1082 {
1083 return [self systemTechLevel_number];
1084 }
1085 return [NSNumber numberWithUnsignedInteger:[dockedStation equivalentTechLevel]];
1086}
OOTechLevelID equivalentTechLevel

◆ doesHitLine:v0:v1:

- (GLfloat) doesHitLine: (HPVector
v0: (HPVector
v1: (ShipEntity **)  hitEntity 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6312{
6313 if (hitEntity)
6314 hitEntity[0] = (ShipEntity*)nil;
6315 Vector u0 = HPVectorToVector(HPvector_between(position, v0)); // relative to origin of model / octree
6319 GLfloat hit_distance = [octree isHitByLine:w0 :w1];
6320 if (hit_distance)
6321 {
6322 if (hitEntity)
6323 hitEntity[0] = self;
6324 }
6325
6326 bool shields = false;
6327 if ((w0.z >= 0 && forward_shield > 1) || (w0.z <= 0 && aft_shield > 1))
6328 {
6329 shields = true;
6330 }
6331
6332 NSEnumerator *subEnum = nil;
6333 ShipEntity *se = nil;
6334 for (subEnum = [self shipSubEntityEnumerator]; (se = [subEnum nextObject]); )
6335 {
6342
6343 GLfloat hitSub = [se->octree isHitByLine:w0 :w1];
6344 if (hitSub && (hit_distance == 0 || hit_distance > hitSub))
6345 {
6347 if (hitEntity && !shields)
6348 {
6349 *hitEntity = se;
6350 }
6351 }
6352 }
6353
6354 return hit_distance;
6355}
HPVector absolutePositionForSubentity()
Definition Entity.m:670
Vector v_forward
Definition ShipEntity.h:200
Vector v_up
Definition ShipEntity.h:200
Triangle absoluteIJKForSubentity()
Vector v_right
Definition ShipEntity.h:200

◆ doGuiScreenResizeUpdates

- (void) doGuiScreenResizeUpdates

Definition at line 13727 of file PlayerEntity.m.

4121{
4122 switch ([self guiScreen])
4123 {
4125 //refresh play windowed / full screen
4126 [self setGuiToGameOptionsScreen];
4127 break;
4128 case GUI_SCREEN_STATUS:
4129 // status screen must be redone in order to possibly
4130 // refresh displayed model's draw position
4131 [self setGuiToStatusScreen];
4132 break;
4133 default:
4134 break;
4135 }
4136
4137
4138 [hud resetGuiPositions];
4139}
OOGUIScreenID guiScreen()

◆ doMissionCallback

- (void) doMissionCallback

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2438{
2439 // make sure we don't call the same callback twice
2440 _missionWithCallback = NO;
2442}

◆ doScriptEvent:inContext:withArguments:count:

- (void) doScriptEvent: (jsid message
inContext: (JSContext *)  context
withArguments: (jsval *)  argv
count: (uintN argc 
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

12916 :(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc
12917{
12918 [super doScriptEvent:message inContext:context withArguments:argv count:argc];
12919 [self doWorldScriptEvent:message inContext:context withArguments:argv count:argc timeLimit:0.0];
12920}

◆ doTradeIn:forPriceFactor:

- (void) doTradeIn: (OOCreditsQuantity tradeInValue
forPriceFactor: (double priceFactor 
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9242 of file PlayerEntity.m.

10697{
10698 if (tradeInValue != 0)
10699 {
10700 if (priceFactor < 1.0) tradeInValue *= priceFactor;
10702 }
10703}
OOCreditsQuantity tradeInValue()

◆ doWorldEventUntilMissionScreen:

- (BOOL) doWorldEventUntilMissionScreen: (jsid message

Definition at line 9242 of file PlayerEntity.m.

12923 :(jsid)message
12924{
12925 NSEnumerator *scriptEnum = [worldScripts objectEnumerator];
12927
12928 // Check for the presence of report messages first.
12929 if (gui_screen != GUI_SCREEN_MISSION && [dockingReport length] > 0 && [self isDocked] && ![[self dockedStation] suppressArrivalReports])
12930 {
12931 [self setGuiToDockingReportScreen]; // go here instead!
12932 [[UNIVERSE messageGUI] clear];
12933 return YES;
12934 }
12935
12936 JSContext *context = OOJSAcquireContext();
12937 while ((theScript = [scriptEnum nextObject]) && gui_screen != GUI_SCREEN_MISSION && [self isDocked])
12938 {
12939 [theScript callMethod:message inContext:context withArguments:NULL count:0 result:NULL];
12940 }
12941 OOJSRelinquishContext(context);
12942
12944 {
12945 // remove any comms/console messages from the screen!
12946 [[UNIVERSE messageGUI] clear];
12947 return YES;
12948 }
12949
12950 return NO;
12951}
BOOL callMethod:inContext:withArguments:count:result:(jsid methodID,[inContext] JSContext *context,[withArguments] jsval *argv,[count] intN argc,[result] jsval *outResult)
Definition OOJSScript.m:651

◆ doWorldScriptEvent:inContext:withArguments:count:timeLimit:

- (void) doWorldScriptEvent: (jsid message
inContext: (JSContext *)  context
withArguments: (jsval *)  argv
count: (uintN argc
timeLimit: (OOTimeDelta limit 

Definition at line 9242 of file PlayerEntity.m.

12955{
12956 NSParameterAssert(context != NULL && JS_IsInRequest(context));
12957
12959
12960 foreach (theScript, [worldScripts allValues])
12961 {
12963 [theScript callMethod:message inContext:context withArguments:argv count:argc result:NULL];
12965 }
12966}
#define JS_IsInRequest(context)
double OOTimeDelta
Definition OOTypes.h:224

◆ drawImmediate:translucent:

- (void) drawImmediate: (bool immediate
translucent: (bool translucent 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4443{
4444 switch ([self status])
4445 {
4446 case STATUS_DEAD:
4448 case STATUS_DOCKED:
4449 case STATUS_START_GAME:
4450 return;
4451
4452 default:
4453 if ([UNIVERSE breakPatternHide]) return;
4454 }
4455
4456 [super drawImmediate:immediate translucent:translucent];
4457}

◆ drawRotationMatrix

- (OOMatrix) drawRotationMatrix
implementation

Reimplemented from Entity.

Definition at line 13727 of file PlayerEntity.m.

4332{
4333 return playerRotMatrix;
4334}
OOMatrix playerRotMatrix

◆ drawTransformationMatrix

- (OOMatrix) drawTransformationMatrix
implementation

Reimplemented from Entity.

Definition at line 13727 of file PlayerEntity.m.

4338{
4339 OOMatrix result = playerRotMatrix;
4340 // HPVect: modify to use camera-relative positioning
4342}

◆ dumpCargo

- (OOCommodityType) dumpCargo
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6736{
6737 if (flightSpeed > 4.0 * maxFlightSpeed)
6738 {
6739 [UNIVERSE addMessage:OOExpandKey(@"hold-locked") forCount:3.0];
6740 return nil;
6741 }
6742
6743 OOCommodityType result = [super dumpCargo];
6744 if (result != nil)
6745 {
6746 NSString *commodity = [UNIVERSE displayNameForCommodity:result];
6747 [UNIVERSE addMessage:OOExpandKey(@"commodity-ejected", commodity) forCount:3.0 forceDisplay:YES];
6748 [self playCargoJettisioned];
6749 }
6750 return result;
6751}

◆ dumpSelfState

- (void) dumpSelfState
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

13477{
13478 NSMutableArray *flags = nil;
13480
13481 [super dumpSelfState];
13482
13483 OOLog(@"dumpState.playerEntity", @"Script time: %g", script_time);
13484 OOLog(@"dumpState.playerEntity", @"Script time check: %g", script_time_check);
13485 OOLog(@"dumpState.playerEntity", @"Script time interval: %g", script_time_interval);
13486 OOLog(@"dumpState.playerEntity", @"Roll/pitch/yaw delta: %g, %g, %g", roll_delta, pitch_delta, yaw_delta);
13487 OOLog(@"dumpState.playerEntity", @"Shield: %g fore, %g aft", forward_shield, aft_shield);
13488 OOLog(@"dumpState.playerEntity", @"Alert level: %u, flags: %#x", alertFlags, alertCondition);
13489 OOLog(@"dumpState.playerEntity", @"Missile status: %i", missile_status);
13490 OOLog(@"dumpState.playerEntity", @"Energy unit: %@", EnergyUnitTypeToString([self installedEnergyUnitType]));
13491 OOLog(@"dumpState.playerEntity", @"Fuel leak rate: %g", fuel_leak_rate);
13492 OOLog(@"dumpState.playerEntity", @"Trumble count: %llu", trumbleCount);
13493
13494 flags = [NSMutableArray array];
13495 #define ADD_FLAG_IF_SET(x) if (x) { [flags addObject:@#x]; }
13519// ADD_FLAG_IF_SET(isSpeechOn);
13520 ADD_FLAG_IF_SET(keyboardRollOverride); // Handle keyboard roll...
13521 ADD_FLAG_IF_SET(keyboardPitchOverride); // ...and pitch override separately - (fix for BUG #17490)
13524 flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
13525 OOLog(@"dumpState.playerEntity", @"Flags: %@", flagsString);
13526}
#define ADD_FLAG_IF_SET(x)
NSString * EnergyUnitTypeToString(OOEnergyUnitType unit) CONST_FUNC
unsigned bomb_detonated
unsigned mouse_control_on
OOEnergyUnitType installedEnergyUnitType()
GLfloat roll_delta
GLfloat pitch_delta
unsigned keyboardPitchOverride
unsigned waitingForStickCallback
unsigned keyboardYawOverride
unsigned showDemoShips
unsigned rolling
unsigned pitching
unsigned keyboardRollOverride
unsigned show_info_flag
unsigned using_mining_laser
OOAlertCondition alertCondition
unsigned galactic_witchjump
unsigned game_over
unsigned yawing
GLfloat yaw_delta
unsigned suppressTargetLost
unsigned finished

◆ ejectItem:

- (void) ejectItem: (NSString *)  item_key

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1491 :(NSString *)itemKey
1492{
1493 if (scriptTarget == nil) scriptTarget = self;
1494 [scriptTarget ejectShipOfType:itemKey];
1495}

◆ endMissionScreenAndNoteOpportunity

- (void) endMissionScreenAndNoteOpportunity

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2465{
2466 _missionAllowInterrupt = NO;
2467 [self clearMissionScreenID];
2468 // Older scripts might intercept missionScreenEnded first, and call secondary mission screens.
2469 if(![self doWorldEventUntilMissionScreen:OOJSID("missionScreenEnded")])
2470 {
2471 // if we're here, no mission screen is running. Opportunity! :)
2472 [self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")];
2473 }
2474}
#define OOJSID(str)
Definition OOJSPropID.h:38

◆ endScenario:

- (BOOL) endScenario: (NSString *)  key

Definition at line 13727 of file PlayerEntity.m.

7097 :(NSString *)key
7098{
7100 {
7101 [self setStatus:STATUS_RESTART_GAME];
7102 return YES;
7103 }
7104 return NO;
7105}

◆ energyUnitType

- (OOEnergyUnitType) energyUnitType

Definition at line 13727 of file PlayerEntity.m.

6152{
6153 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"]) return ENERGY_UNIT_NAVAL;
6154 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"]) return ENERGY_UNIT_NORMAL;
6155 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NAVAL_DAMAGED;
6156 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NORMAL_DAMAGED;
6157 return ENERGY_UNIT_NONE;
6158}
@ ENERGY_UNIT_NORMAL
Definition OOTypes.h:137
@ ENERGY_UNIT_NAVAL_DAMAGED
Definition OOTypes.h:134
@ ENERGY_UNIT_NAVAL
Definition OOTypes.h:138
@ ENERGY_UNIT_NONE
Definition OOTypes.h:132
@ ENERGY_UNIT_NORMAL_DAMAGED
Definition OOTypes.h:133

◆ engageAutopilotToStation:

- (BOOL) engageAutopilotToStation: (StationEntity *)  stationForDocking

Definition at line 13727 of file PlayerEntity.m.

3671{
3672 if (stationForDocking == nil) return NO;
3673 if ([self isDocked]) return NO;
3674
3676 {
3677 return YES;
3678 }
3679
3680 [self setTargetStation:stationForDocking];
3683 ident_engaged = NO;
3684 [self safeAllMissiles];
3686 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN) [self cancelWitchspaceCountdown]; // cancel witchspace countdown properly
3687 [self setStatus:STATUS_AUTOPILOT_ENGAGED];
3688 [self resetAutopilotAI];
3689 [shipAI setState:@"BEGIN_DOCKING"]; // reboot the AI
3690 [self playAutopilotOn];
3692 [self doScriptEvent:OOJSID("playerStartedAutoPilot") withArgument:stationForDocking];
3693 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_GRANTED];
3694
3696 {
3698 if (afterburnerSoundLooping) [self stopAfterburnerSound];
3699 }
3700 return YES;
3701}
const Vector kZeroVector
Definition OOVector.m:28
Vector velocity()

◆ enterDock:

- (void) enterDock: (StationEntity *)  station
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

7108 :(StationEntity *)station
7109{
7110 NSParameterAssert(station != nil);
7111 if ([self status] == STATUS_DEAD) return;
7112
7113 [self setStatus:STATUS_DOCKING];
7114 [self setDockedStation:station];
7115 [self doScriptEvent:OOJSID("shipWillDockWithStation") withArgument:station];
7116
7117 if (![hud nonlinearScanner])
7118 {
7119 [hud setScannerZoom: 1.0];
7120 }
7121 ident_engaged = NO;
7124 [self resetAutopilotAI];
7125
7129 [self safeAllMissiles];
7130 DESTROY(_primaryTarget); // must happen before showing break_pattern to suppress active reticule.
7131 [self clearTargetMemory];
7132
7133 scanner_zoom_rate = 0.0f;
7134 [UNIVERSE setDisplayText:NO];
7135 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
7136 if ([self status] == STATUS_LAUNCHING) return; // a JS script has aborted the docking.
7137
7138 [self setOrientation: kIdentityQuaternion]; // reset orientation to dock
7139 [UNIVERSE setUpBreakPattern:[self breakPatternPosition] orientation:orientation forDocking:YES];
7140 [self playDockWithStation];
7141 [station noteDockedShip:self];
7142
7143 [[UNIVERSE gameView] clearKeys]; // try to stop key bounces
7144}
void noteDockedShip:(ShipEntity *ship)

Referenced by StationDockPlayer().

+ Here is the caller graph for this function:

◆ enterGalacticWitchspace

- (void) enterGalacticWitchspace

Definition at line 13727 of file PlayerEntity.m.

7538{
7539 if (![self witchJumpChecklist:true])
7540 return;
7541
7542
7545 {
7546 destGalaxy = 0;
7547 }
7548
7549
7550 [self setStatus:STATUS_ENTERING_WITCHSPACE];
7551 JSContext *context = OOJSAcquireContext();
7552 [self setJumpCause:@"galactic jump"];
7553 [self setPreviousSystemID:[self currentSystemID]];
7554 ShipScriptEvent(context, self, "shipWillEnterWitchspace", STRING_TO_JSVAL(JS_InternString(context, [[self jumpCause] UTF8String])), INT_TO_JSVAL(destGalaxy));
7555 OOJSRelinquishContext(context);
7556
7557 [self noteCompassLostTarget];
7558
7559 [self witchStart];
7560
7561 [UNIVERSE removeAllEntitiesExceptPlayer];
7562
7563 // remove any contracts and parcels for the old galaxy
7564 if (contracts)
7565 [contracts removeAllObjects];
7566
7567 if (parcels)
7568 [parcels removeAllObjects];
7569
7570 // remove any mission destinations for the old galaxy
7572 [missionDestinations removeAllObjects];
7573
7574 // expire passenger contracts for the old galaxy
7575 if (passengers)
7576 {
7577 unsigned i;
7578 for (i = 0; i < [passengers count]; i++)
7579 {
7580 // set the expected arrival time to now, so they storm off the ship at the first port
7581 NSMutableDictionary* passenger_info = [NSMutableDictionary dictionaryWithDictionary:[passengers oo_dictionaryAtIndex:i]];
7582 [passenger_info setObject:[NSNumber numberWithDouble:ship_clock] forKey:CONTRACT_KEY_ARRIVAL_TIME];
7583 [passengers replaceObjectAtIndex:i withObject:passenger_info];
7584 }
7585 }
7586
7587 // clear a lot of memory of player actions
7588 if (ship_kills >= 6400)
7589 {
7590 [self clearRolesFromPlayer:0.25];
7591 }
7592 else if (ship_kills >= 2560)
7593 {
7594 [self clearRolesFromPlayer:0.5];
7595 }
7596 else
7597 {
7598 [self clearRolesFromPlayer:0.9];
7599 }
7600 [roleWeightFlags removeAllObjects];
7601 [roleSystemList removeAllObjects];
7602
7603 // may be more than one item providing this
7604 [self removeEquipmentItem:[self equipmentItemProviding:@"EQ_GAL_DRIVE"]];
7605
7607
7608 [UNIVERSE setGalaxyTo:galaxy_number];
7609
7610 // Choose the galactic hyperspace behaviour. Refers to where we may actually end up after an intergalactic jump.
7611 // The default behaviour is that the player cannot arrive on unreachable or isolated systems. The options
7612 // in planetinfo.plist, galactic_hyperspace_behaviour key can be used to allow arrival even at unreachable systems,
7613 // or at fixed coordinates on the galactic chart. The key galactic_hyperspace_fixed_coords in planetinfo.plist is
7614 // used in the fixed coordinates case and specifies the exact coordinates for the intergalactic jump.
7616 {
7618 system_id = [UNIVERSE findSystemNumberAtCoords:galacticHyperspaceFixedCoords withGalaxy:galaxy_number includingHidden:YES];
7619 break;
7621 system_id = [UNIVERSE findSystemNumberAtCoords:galaxy_coordinates withGalaxy:galaxy_number includingHidden:YES];
7622 break;
7624 default:
7625 // instead find a system connected to system 0 near the current coordinates...
7626 system_id = [UNIVERSE findConnectedSystemAtCoords:galaxy_coordinates withGalaxy:galaxy_number];
7627 break;
7628 }
7631
7632 [self setBounty:0 withReason:kOOLegalStatusReasonNewGalaxy]; // let's make a fresh start!
7634
7635 [self witchEnd]; // sets coordinates, calls exiting witchspace JS events
7636}
#define OO_GALAXIES_AVAILABLE
uint8_t OOGalaxyID
Definition OOTypes.h:210
OOGalacticHyperspaceBehaviour galacticHyperspaceBehaviour
NSPoint cursor_coordinates
NSString * jumpCause()

◆ enterWitchspace

- (void) enterWitchspace
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

7673{
7674 if (![self witchJumpChecklist:false]) return;
7675
7676 OOSystemID jumpTarget = [self nextHopTargetSystemID];
7677
7678 // perform any check here for forced witchspace encounters
7679 unsigned malfunc_chance = 253;
7680 if (ship_trade_in_factor < 80)
7681 {
7682 malfunc_chance -= (1 + ranrot_rand() % (81-ship_trade_in_factor)) / 2; // increase chance of misjump in worn-out craft
7683 }
7684 else if (ship_trade_in_factor >= 100)
7685 {
7686 malfunc_chance = 256; // force no misjumps on first jump
7687 }
7688
7689#ifdef OO_DUMP_PLANETINFO
7690 BOOL misjump = NO; // debugging
7691#else
7692 BOOL malfunc = ((ranrot_rand() & 0xff) > malfunc_chance);
7693 // 75% of the time a malfunction means a misjump
7694 BOOL misjump = [self scriptedMisjump] || (flightPitch == max_flight_pitch) || (malfunc && (randf() > 0.75));
7695
7696 if (malfunc && !misjump)
7697 {
7698 // some malfunctions will start fuel leaks, some will result in no witchjump at all.
7699 if ([self takeInternalDamage]) // Depending on ship type and loaded cargo, this will be true for 20 - 50% of the time.
7700 {
7701 [self playWitchjumpFailure];
7702 [self setStatus:STATUS_IN_FLIGHT];
7703 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("malfunction"));
7704 return;
7705 }
7706 else
7707 {
7708 [self setFuelLeak:[NSString stringWithFormat:@"%f", (randf() + randf()) * 5.0]];
7709 }
7710 }
7711#endif
7712
7713 // From this point forward we are -definitely- witchjumping
7714
7715 // burn the full fuel amount to create the wormhole
7717
7718 // Create the players' wormhole
7719 wormhole = [[WormholeEntity alloc] initWormholeTo:jumpTarget fromShip:self];
7720 [UNIVERSE addEntity:wormhole]; // Add new wormhole to Universe to let other ships target it. Required for ships following the player.
7721 [self addScannedWormhole:wormhole];
7722
7723 [self setStatus:STATUS_ENTERING_WITCHSPACE];
7724 JSContext *context = OOJSAcquireContext();
7725 [self setJumpCause:@"standard jump"];
7726 [self setPreviousSystemID:[self currentSystemID]];
7727 ShipScriptEvent(context, self, "shipWillEnterWitchspace", STRING_TO_JSVAL(JS_InternString(context, [[self jumpCause] UTF8String])), INT_TO_JSVAL(jumpTarget));
7728 OOJSRelinquishContext(context);
7729
7730 [self updateSystemMemory];
7731 NSUInteger legality = [self legalStatusOfCargoList];
7732 OOCargoQuantity maxSpace = [self maxAvailableCargoSpace];
7733 OOCargoQuantity availSpace = [self availableCargoSpace];
7734 if ([roleWeightFlags objectForKey:@"bought-legal"])
7735 {
7736 if (maxSpace != availSpace)
7737 {
7738 [self addRoleToPlayer:@"trader"];
7739 if (maxSpace - availSpace > 20 || availSpace == 0)
7740 {
7741 if (legality == 0)
7742 {
7743 [self addRoleToPlayer:@"trader"];
7744 }
7745 }
7746 }
7747 }
7748 if ([roleWeightFlags objectForKey:@"bought-illegal"])
7749 {
7750 if (maxSpace != availSpace && legality > 0)
7751 {
7752 [self addRoleToPlayer:@"trader-smuggler"];
7753 if (maxSpace - availSpace > 20 || availSpace == 0)
7754 {
7755 if (legality >= 20 || legality >= maxSpace)
7756 {
7757 [self addRoleToPlayer:@"trader-smuggler"];
7758 }
7759 }
7760 }
7761 }
7762 [roleWeightFlags removeAllObjects];
7763
7764 [self noteCompassLostTarget];
7765 if ([self scriptedMisjump])
7766 {
7767 misjump = YES; // a script could just have changed this to true;
7768 }
7769 if (misjump)
7770 {
7771 [wormhole setMisjumpWithRange:[self scriptedMisjumpRange]];
7772 }
7773 [self witchJumpTo:jumpTarget misjump:misjump];
7774}
BOOL takeInternalDamage()
OOFuelQuantity fuelRequiredForJump()
BOOL scriptedMisjump()

◆ enterWormhole:

- (void) enterWormhole: (WormholeEntity *)  w_hole
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

7642{
7644 || [self status] == STATUS_EXITING_WITCHSPACE)
7645 {
7646 return; // has already entered a different wormhole
7647 }
7648 BOOL misjump = [self scriptedMisjump] || [w_hole withMisjump] || flightPitch == max_flight_pitch || randf() > 0.995;
7649 wormhole = [w_hole retain];
7650 [self addScannedWormhole:wormhole];
7651 [self setStatus:STATUS_ENTERING_WITCHSPACE];
7652 JSContext *context = OOJSAcquireContext();
7653 [self setJumpCause:@"wormhole"];
7654 [self setPreviousSystemID:[self currentSystemID]];
7655 ShipScriptEvent(context, self, "shipWillEnterWitchspace", STRING_TO_JSVAL(JS_InternString(context, [[self jumpCause] UTF8String])), INT_TO_JSVAL([w_hole destination]));
7656 OOJSRelinquishContext(context);
7657 if ([self scriptedMisjump])
7658 {
7659 misjump = YES; // a script could just have changed this to true;
7660 }
7661#ifdef OO_DUMP_PLANETINFO
7662 misjump = NO;
7663#endif
7664 if (misjump && [self scriptedMisjumpRange] != 0.5)
7665 {
7666 [w_hole setMisjumpWithRange:[self scriptedMisjumpRange]]; // overrides wormholes, if player also had non-default scriptedMisjumpRange
7667 }
7668 [self witchJumpTo:[w_hole destination] misjump:misjump];
7669}
GLfloat scriptedMisjumpRange()
HPVector destination()
OOSystemID destination
void setMisjumpWithRange:(GLfloat range)

◆ entryIsCustomEquip:

- (BOOL) entryIsCustomEquip: (NSString *)  entry
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

327 :(NSString *)entry
328{
329 BOOL result = NO;
330 if ([entry hasPrefix:@"activate_"] || [entry hasPrefix:@"mode_"])
331 result = YES;
332 return result;
333}

◆ entryIsDictCustomEquip:

- (BOOL) entryIsDictCustomEquip: (NSDictionary *)  dict
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

322 :(NSDictionary *)dict
323{
324 return [self entryIsCustomEquip:[dict oo_stringForKey:KEY_KC_DEFINITION]];
325}

◆ entryIsEqualToDefault:

- (BOOL) entryIsEqualToDefault: (NSString*)  key
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1566 :(NSString*)key
1567{
1568 NSArray *def = (NSArray *)[kdic_check objectForKey:key];
1569 NSUInteger i;
1570
1571 if ([def count] != [key_list count]) return NO;
1572 for (i = 0; i < [key_list count]; i++)
1573 {
1574 NSDictionary *orig = (NSDictionary *)[def objectAtIndex:i];
1575 NSDictionary *entrd = (NSDictionary *)[key_list objectAtIndex:i];
1576 if (![self compareKeyEntries:orig second:entrd]) return NO;
1577 }
1578 return YES;
1579}
static NSDictionary * kdic_check
static NSMutableArray * key_list

◆ entryIsIndexCustomEquip:

- (BOOL) entryIsIndexCustomEquip: (NSUInteger idx
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

316 :(NSUInteger)idx
317{
318 return [self entryIsCustomEquip:[[keyFunctions objectAtIndex:idx] oo_stringForKey:KEY_KC_DEFINITION]];
319}

◆ eqScriptIndexForKey:

- (NSUInteger) eqScriptIndexForKey: (NSString *)  eq_key

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2909 :(NSString *)eq_key
2910{
2911 NSUInteger i, count = [eqScripts count];
2912
2913 if (eq_key != nil)
2914 {
2915 for (i = 0; i < count; i++)
2916 {
2917 NSString *key = [[eqScripts oo_arrayAtIndex:i] oo_stringAtIndex:0];
2918 if ([key isEqualToString: eq_key]) return i;
2919 }
2920 }
2921
2922 return count;
2923}

◆ equipmentList

- (NSArray *) equipmentList

Definition at line 13727 of file PlayerEntity.m.

8079{
8080 GuiDisplayGen *gui = [UNIVERSE gui];
8081 NSMutableArray *quip1 = [NSMutableArray array]; // damaged
8082 NSMutableArray *quip2 = [NSMutableArray array]; // working
8083 NSEnumerator *eqTypeEnum = nil;
8085 NSString *desc = nil;
8086 NSString *alldesc = nil;
8087
8088 BOOL prioritiseDamaged = [[gui userSettings] oo_boolForKey:kGuiStatusPrioritiseDamaged defaultValue:YES];
8089
8090 for (eqTypeEnum = [OOEquipmentType reverseEquipmentEnumerator]; (eqType = [eqTypeEnum nextObject]); )
8091 {
8092 if ([eqType isVisible])
8093 {
8094 if ([eqType canCarryMultiple] && ![eqType isMissileOrMine])
8095 {
8096 NSString *damagedIdentifier = [[eqType identifier] stringByAppendingString:@"_DAMAGED"];
8097 NSUInteger count = 0, okcount = 0;
8098 okcount = [self countEquipmentItem:[eqType identifier]];
8099 count = okcount + [self countEquipmentItem:damagedIdentifier];
8100 if (count == 0)
8101 {
8102 // do nothing
8103 }
8104 // all items okay
8105 else if (count == okcount)
8106 {
8107 // only one installed display normally
8108 if (count == 1)
8109 {
8110 [quip2 addObject:[NSArray arrayWithObjects:[eqType name], [NSNumber numberWithBool:YES], [eqType displayColor], nil]];
8111 }
8112 // display plural form
8113 else
8114 {
8115 NSString *equipmentName = [eqType name];
8116 alldesc = OOExpandKey(@"equipment-plural", count, equipmentName);
8117 [quip2 addObject:[NSArray arrayWithObjects:alldesc, [NSNumber numberWithBool:YES], [eqType displayColor], nil]];
8118 }
8119 }
8120 // all broken, only one installed
8121 else if (count == 1 && okcount == 0)
8122 {
8123 desc = [NSString stringWithFormat:DESC(@"equipment-@-not-available"), [eqType name]];
8125 {
8126 [quip1 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8127 }
8128 else
8129 {
8130 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8131 }
8132 }
8133 // some broken, multiple installed
8134 else
8135 {
8136 NSString *equipmentName = [eqType name];
8137 alldesc = OOExpandKey(@"equipment-plural-some-na", okcount, count, equipmentName);
8139 {
8140 [quip1 addObject:[NSArray arrayWithObjects:alldesc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8141 }
8142 else
8143 {
8144 [quip2 addObject:[NSArray arrayWithObjects:alldesc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8145 }
8146 }
8147 }
8148 else if ([self hasEquipmentItem:[eqType identifier]])
8149 {
8150 [quip2 addObject:[NSArray arrayWithObjects:[eqType name], [NSNumber numberWithBool:YES], [eqType displayColor], nil]];
8151 }
8152 else
8153 {
8154 // Check for damaged version
8155 if ([self hasEquipmentItem:[[eqType identifier] stringByAppendingString:@"_DAMAGED"]])
8156 {
8157 desc = [NSString stringWithFormat:DESC(@"equipment-@-not-available"), [eqType name]];
8158
8159 if (prioritiseDamaged)
8160 {
8161 [quip1 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8162 }
8163 else
8164 {
8165 // just add in to the normal array
8166 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8167 }
8168 }
8169 }
8170 }
8171 }
8172
8173 if (max_passengers > 0)
8174 {
8175 desc = [NSString stringWithFormat:DESC_PLURAL(@"equipment-pass-berth-@", max_passengers), max_passengers];
8176 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [[OOEquipmentType equipmentTypeWithIdentifier:@"EQ_PASSENGER_BERTH"] displayColor], nil]];
8177 }
8178
8180 {
8181 desc = [NSString stringWithFormat:DESC(@"equipment-fwd-weapon-@"),[forward_weapon_type name]];
8182 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [forward_weapon_type displayColor], nil]];
8183 }
8185 {
8186 desc = [NSString stringWithFormat:DESC(@"equipment-aft-weapon-@"),[aft_weapon_type name]];
8187 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [aft_weapon_type displayColor], nil]];
8188 }
8190 {
8191 desc = [NSString stringWithFormat:DESC(@"equipment-port-weapon-@"),[port_weapon_type name]];
8192 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [port_weapon_type displayColor], nil]];
8193 }
8195 {
8196 desc = [NSString stringWithFormat:DESC(@"equipment-stb-weapon-@"),[starboard_weapon_type name]];
8197 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [starboard_weapon_type displayColor], nil]];
8198 }
8199
8200 // list damaged first, then working
8201 [quip1 addObjectsFromArray:quip2];
8202 return quip1;
8203}
BOOL isWeaponNone(OOWeaponType weapon)
NSDictionary * userSettings()
OOColor * displayColor()
NSString * identifier()
BOOL isVisible()

◆ equipScreenBackgroundDescriptor

- (NSDictionary *) equipScreenBackgroundDescriptor

Definition at line 9242 of file PlayerEntity.m.

12858{
12860}

◆ erodeReputation

- (void) erodeReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

757{
758 int c_good = [reputation oo_intForKey:CONTRACTS_GOOD_KEY];
759 int c_bad = [reputation oo_intForKey:CONTRACTS_BAD_KEY];
760 int c_unknown = [reputation oo_intForKey:CONTRACTS_UNKNOWN_KEY];
761 int p_good = [reputation oo_intForKey:PASSAGE_GOOD_KEY];
762 int p_bad = [reputation oo_intForKey:PASSAGE_BAD_KEY];
763 int p_unknown = [reputation oo_intForKey:PASSAGE_UNKNOWN_KEY];
764 int pl_good = [reputation oo_intForKey:PARCEL_GOOD_KEY];
765 int pl_bad = [reputation oo_intForKey:PARCEL_BAD_KEY];
766 int pl_unknown = [reputation oo_intForKey:PARCEL_UNKNOWN_KEY];
767
768 if (c_unknown < MAX_CONTRACT_REP)
769 {
770 if (c_bad > 0)
771 c_bad--;
772 else
773 {
774 if (c_good > 0)
775 c_good--;
776 }
777 c_unknown++;
778 }
779
780 if (p_unknown < MAX_CONTRACT_REP)
781 {
782 if (p_bad > 0)
783 p_bad--;
784 else
785 {
786 if (p_good > 0)
787 p_good--;
788 }
789 p_unknown++;
790 }
791
792 if (pl_unknown < MAX_CONTRACT_REP)
793 {
794 if (pl_bad > 0)
795 pl_bad--;
796 else
797 {
798 if (pl_good > 0)
799 pl_good--;
800 }
801 pl_unknown++;
802 }
803
804 [reputation setObject:[NSNumber numberWithInt:c_good] forKey:CONTRACTS_GOOD_KEY];
805 [reputation setObject:[NSNumber numberWithInt:c_bad] forKey:CONTRACTS_BAD_KEY];
806 [reputation setObject:[NSNumber numberWithInt:c_unknown] forKey:CONTRACTS_UNKNOWN_KEY];
807 [reputation setObject:[NSNumber numberWithInt:p_good] forKey:PASSAGE_GOOD_KEY];
808 [reputation setObject:[NSNumber numberWithInt:p_bad] forKey:PASSAGE_BAD_KEY];
809 [reputation setObject:[NSNumber numberWithInt:p_unknown] forKey:PASSAGE_UNKNOWN_KEY];
810 [reputation setObject:[NSNumber numberWithInt:pl_good] forKey:PARCEL_GOOD_KEY];
811 [reputation setObject:[NSNumber numberWithInt:pl_bad] forKey:PARCEL_BAD_KEY];
812 [reputation setObject:[NSNumber numberWithInt:pl_unknown] forKey:PARCEL_UNKNOWN_KEY];
813
814}

◆ escapePodRescueTime

- (double) escapePodRescueTime

Definition at line 13727 of file PlayerEntity.m.

4911{
4913}
double escape_pod_rescue_time

◆ existingNativeSave:

- (BOOL) existingNativeSave: (NSString *)  cdrName
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1011 of file PlayerEntityLoadSave.m.

1201 : (NSString *)cdrName
1202{
1203 NSString* dir = [[UNIVERSE gameController] playerFileDirectory];
1204
1205 NSString *savePath=[dir stringByAppendingPathComponent:[cdrName stringByAppendingPathExtension:@"oolite-save"]];
1206 return [[NSFileManager defaultManager] fileExistsAtPath:savePath];
1207}

◆ expandMessage:

- (NSString *) expandMessage: (NSString *)  valueString
implementation

Provided by category PlayerEntity(ScriptingPrivate).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1180 :(NSString *)valueString
1181{
1182 Random_Seed very_random_seed;
1183 very_random_seed.a = rand() & 255;
1184 very_random_seed.b = rand() & 255;
1185 very_random_seed.c = rand() & 255;
1186 very_random_seed.d = rand() & 255;
1187 very_random_seed.e = rand() & 255;
1188 very_random_seed.f = rand() & 255;
1189 seed_RNG_only_for_planet_description(very_random_seed);
1190 NSString* expandedMessage = OOExpand(valueString);
1191 return [self replaceVariablesInString: expandedMessage];
1192}
#define OOExpand(string,...)
void seed_RNG_only_for_planet_description(Random_Seed s_seed)

◆ expandScriptRightHandSide:

- (NSString *) expandScriptRightHandSide: (NSArray *)  rhsComponents
implementation

Provided by category PlayerEntity(ScriptingPrivate).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

610 :(NSArray *)rhsComponents
611{
612 NSMutableArray *result = nil;
613 NSArray *component = nil;
614 NSString *value = nil;
615
616 result = [NSMutableArray arrayWithCapacity:[rhsComponents count]];
617
618 foreach (component, rhsComponents)
619 {
620 /* Each component is a two-element array. The second element is a
621 string. The first element is a boolean indicating whether the
622 string is a selector (true) or a literal (false).
623
624 All valid selectors return a string or an NSNumber; in either
625 case, -description gives us a useful value to substitute into
626 the expanded string.
627 */
628
629 value = [component oo_stringAtIndex:1];
630
631 if ([[component objectAtIndex:0] boolValue])
632 {
633 value = [[self performSelector:NSSelectorFromString(value)] description];
634 if (value == nil) value = @"(null)"; // for backwards compatibility
635 }
636
637 [result addObject:value];
638 }
639
640 return [result componentsJoinedByString:@" "];
641}

◆ fastEquipmentA

- (NSString *) fastEquipmentA

Definition at line 13727 of file PlayerEntity.m.

8289{
8290 return _fastEquipmentA;
8291}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ fastEquipmentB

- (NSString *) fastEquipmentB

Definition at line 13727 of file PlayerEntity.m.

8295{
8296 return _fastEquipmentB;
8297}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ findIndexOfCommander:

- (int) findIndexOfCommander: (NSString *)  cdrName
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1011 of file PlayerEntityLoadSave.m.

1337 : (NSString *)cdrName
1338{
1339 unsigned i;
1340 for (i=0; i < [cdrDetailArray count]; i++)
1341 {
1342 NSString *currentName = [[cdrDetailArray oo_dictionaryAtIndex: i] oo_stringForKey:@"player_save_name" defaultValue:[[cdrDetailArray oo_dictionaryAtIndex: i] oo_stringForKey:@"player_name"]];
1343 if([cdrName compare: currentName] == NSOrderedSame)
1344 {
1345 return i;
1346 }
1347 }
1348
1349 // not found!
1350 return -1;
1351}

◆ fireECM

- (BOOL) fireECM
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6129{
6130 if ([super fireECM])
6131 {
6133 ecm_start_time = [UNIVERSE getTime];
6134 return YES;
6135 }
6136 else
6137 {
6138 return NO;
6139 }
6140}

◆ fireMainWeapon

- (BOOL) fireMainWeapon

Definition at line 13727 of file PlayerEntity.m.

6191{
6192 OOWeaponType weapon_to_be_fired = [self currentWeapon];
6193
6194 if (![self weaponsOnline])
6195 {
6196 return NO;
6197 }
6198
6200 {
6201 [self playWeaponOverheated:[[self currentLaserOffset] oo_vectorAtIndex:0]];
6202 [UNIVERSE addMessage:DESC(@"weapon-overheat") forCount:3.0];
6203 return NO;
6204 }
6205
6207 {
6208 return NO;
6209 }
6210
6211 [self currentWeaponStats];
6212
6214 if (_multiplyWeapons)
6215 {
6216 // multiple fitted
6217 multiplier = [[self laserPortOffset:currentWeaponFacing] count];
6218 }
6219
6221 {
6222 [UNIVERSE addMessage:DESC(@"weapon-out-of-juice") forCount:3.0];
6223 return NO;
6224 }
6225
6226 using_mining_laser = [weapon_to_be_fired isMiningLaser];
6227
6229
6230 switch (currentWeaponFacing)
6231 {
6234 forward_shot_time = 0.0;
6235 break;
6236
6237 case WEAPON_FACING_AFT:
6239 aft_shot_time = 0.0;
6240 break;
6241
6242 case WEAPON_FACING_PORT:
6244 port_shot_time = 0.0;
6245 break;
6246
6249 starboard_shot_time = 0.0;
6250 break;
6251
6252 case WEAPON_FACING_NONE:
6253 break;
6254 }
6255
6258 {
6259 if (![weapon_to_be_fired isTurretLaser])
6260 {
6261 [self fireLaserShotInDirection:currentWeaponFacing weaponIdentifier:[[self currentWeapon] identifier]];
6262 weaponFired = YES;
6263 }
6264 else
6265 {
6266 // nothing: compatible with previous versions
6267 }
6268 }
6269
6271 {
6272 [self deactivateCloakingDevice];
6273 }
6274
6275 return weaponFired;
6276}
#define PLAYER_MAX_WEAPON_TEMP
#define WEAPON_COOLING_CUTOUT
Definition ShipEntity.h:116
GLfloat weapon_energy_use
Definition ShipEntity.h:314
unsigned cloakPassive
Definition ShipEntity.h:266
GLfloat weapon_shot_temperature
Definition ShipEntity.h:314
BOOL _multiplyWeapons
Definition ShipEntity.h:391

◆ fireMissile

- (ShipEntity *) fireMissile
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

5957{
5958 ShipEntity *missile = missile_entity[activeMissile]; // retain count is 1
5959 NSString *identifier = [missile primaryRole];
5961
5962 if (missile == nil) return nil;
5963
5964 if (![self weaponsOnline]) return nil;
5965
5966 // check if we were cloaked before firing the missile - can't use
5967 // cloaking_device_active directly because fireMissilewithIdentifier: andTarget:
5968 // will reset it in case passive cloak is set - Nikos 20130313
5970
5973
5975 {
5976 firedMissile = [self launchMine:missile];
5977 if (!replacingMissile) [self removeFromPylon:activeMissile];
5978 if (firedMissile != nil) [self playMineLaunched:[self missileLaunchPosition] weaponIdentifier:identifier];
5979 }
5980 else
5981 {
5983 // release this before creating it anew in fireMissileWithIdentifier
5984 firedMissile = [self fireMissileWithIdentifier:identifier andTarget:[missile primaryTarget]];
5985
5986 if (firedMissile != nil)
5987 {
5988 if (!replacingMissile) [self removeFromPylon:activeMissile];
5989 [self playMissileLaunched:[self missileLaunchPosition] weaponIdentifier:identifier];
5990 }
5991 }
5992
5994 {
5995 // fireMissilewithIdentifier: andTarget: has already taken care of deactivating
5996 // the cloak in the case of missiles by the time we get here, but explicitly
5997 // calling deactivateCloakingDevice is needed in order to be covered fully with mines too
5998 [self deactivateCloakingDevice];
5999 }
6000
6003
6004 return firedMissile;
6005}

◆ fleeingStatus

- (OOPlayerFleeingStatus) fleeingStatus

Definition at line 13727 of file PlayerEntity.m.

5860{
5861 return fleeing_status;
5862}
OOPlayerFleeingStatus fleeing_status

◆ forwardShieldLevel

- (GLfloat) forwardShieldLevel

Definition at line 13727 of file PlayerEntity.m.

4696{
4697 return forward_shield;
4698}

◆ forwardShieldRechargeRate

- (float) forwardShieldRechargeRate

Definition at line 13727 of file PlayerEntity.m.

4660{
4662}
GLfloat forward_shield_recharge_rate

◆ foundEquipment_bool

- (NSString *) foundEquipment_bool

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1049{
1050 return (found_equipment)? @"YES" : @"NO";
1051}

◆ fuelLeakRate

- (float) fuelLeakRate

Definition at line 13727 of file PlayerEntity.m.

5010{
5011 return fuel_leak_rate;
5012}

◆ fuelLeakRate_number

- (NSNumber *) fuelLeakRate_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2233{
2234 return [NSNumber numberWithFloat:[self fuelLeakRate]];
2235}

◆ fuelLevel_number

- (NSNumber *) fuelLevel_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1036{
1037 return [NSNumber numberWithFloat:floor(0.1 * fuel)];
1038}

◆ fuelRequiredForJump

- (OOFuelQuantity) fuelRequiredForJump
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

7511{
7512 return 10.0 * MAX(0.1, [self hyperspaceJumpDistance]);
7513}
double hyperspaceJumpDistance()

◆ galacticHyperspaceBehaviour

- (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour

◆ galacticHyperspaceFixedCoords

- (NSPoint) galacticHyperspaceFixedCoords

◆ galaxy_coordinates

- (NSPoint) galaxy_coordinates

◆ galaxyNumber

- (OOGalaxyID) galaxyNumber

Definition at line 13727 of file PlayerEntity.m.

513{
514 return galaxy_number;
515}

◆ gameOverFadeToBW

- (void) gameOverFadeToBW
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3987{
3988 float secondsToBWFadeOut = [[NSUserDefaults standardUserDefaults] oo_floatForKey:@"gameover-seconds-to-bw-fadeout" defaultValue:5.0f];
3989 if ([UNIVERSE detailLevel] >= DETAIL_LEVEL_SHADERS && secondsToBWFadeOut > 0.0f)
3990 {
3991 MyOpenGLView *gameView = [UNIVERSE gameView];
3992 static float originalColorSaturation = -1.0f;
3994 if ([self shotTime] < secondsToBWFadeOut)
3995 {
3996 // fade to black & white within secondsToBWFadeOut, independently of
3997 // frame rate and original color saturation
3998 if (fps_counter != 0)
3999 {
4000 [gameView adjustColorSaturation:-(originalColorSaturation * (1.0f / secondsToBWFadeOut) * [UNIVERSE timeAccelerationFactor] / fps_counter)];
4001 }
4002 }
4003
4004 if ([self shotTime] > kDeadResetTime)
4005 {
4006 // make sure to subtract the current saturation because if the user presses space to skip
4007 // the game over screen before the transition to b/w has been completed, whatever is left
4008 // will be added to the original saturation, resulting in an oversaturated image
4009 [gameView adjustColorSaturation:originalColorSaturation - [gameView colorSaturation]];
4011 }
4012 }
4013}
@ DETAIL_LEVEL_SHADERS
Definition OOTypes.h:246
static float const kDeadResetTime
void adjustColorSaturation:(float colorSaturationAdjustment)
float colorSaturation()
OOTimeDelta shotTime()

◆ getCustomEquipArray:

- (NSArray *) getCustomEquipArray: (NSString *)  key_def
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

335 :(NSString *)key_def
336{
337 NSString *eq = nil;
338 NSUInteger i;
339 NSString *key;
340 if ([key_def hasPrefix:@"activate_"])
341 {
342 eq = [key_def stringByReplacingOccurrencesOfString:@"activate_" withString:@""];
344 }
345 if ([key_def hasPrefix:@"mode_"])
346 {
347 eq = [key_def stringByReplacingOccurrencesOfString:@"mode_" withString:@""];
349 }
350 if (eq == nil) return nil;
351 for (i = 0; i < [customEquipActivation count]; i++)
352 {
353 if ([[[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY] isEqualToString:eq])
354 {
355 return [[customEquipActivation objectAtIndex:i] oo_arrayForKey:key];
356 }
357 }
358 return nil;
359}

◆ getCustomEquipIndex:

- (NSUInteger) getCustomEquipIndex: (NSString *)  key_def
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

362 :(NSString *)key_def
363{
364 NSString *eq = nil;
365 NSUInteger i;
366 if ([key_def hasPrefix:@"activate_"])
367 {
368 eq = [key_def stringByReplacingOccurrencesOfString:@"activate_" withString:@""];
369 }
370 if ([key_def hasPrefix:@"mode_"])
371 {
372 eq = [key_def stringByReplacingOccurrencesOfString:@"mode_" withString:@""];
373 }
374 if (eq == nil) return -1;
375 for (i = 0; i < [customEquipActivation count]; i++)
376 {
377 if ([[[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY] isEqualToString:eq])
378 {
379 return i;
380 }
381 }
382 return -1;
383}

◆ getCustomEquipKeyDefType:

- (NSString *) getCustomEquipKeyDefType: (NSString *)  key_def
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

386 :(NSString *)key_def
387{
388 if ([key_def hasPrefix:@"activate_"])
389 {
391 }
392 if ([key_def hasPrefix:@"mode_"])
393 {
394 return CUSTOMEQUIP_KEYMODE;
395 }
396 return @"";
397}

◆ getDestroyedBy:damageType:

- (void) getDestroyedBy: (Entity *)  whom
damageType: (OOShipDamageType type 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

7030{
7031 if ([self isDocked]) return; // Can't die while docked. (Doing so would cause breakage elsewhere.)
7032
7033 OOLog(@"player.ship.damage", @"Player destroyed by %@ due to %@", whom, OOStringFromShipDamageType(type));
7034
7035 if (![[UNIVERSE gameController] playerFileToLoad])
7036 {
7037 [[UNIVERSE gameController] setPlayerFileToLoad: save_path]; // make sure we load the correct game
7038 }
7039
7040 energy = 0.0f;
7042 [self disengageAutopilot];
7043
7044 [UNIVERSE setDisplayText:NO];
7045 [UNIVERSE setViewDirection:VIEW_AFT];
7046
7047 // Let scripts know the player died.
7048 [self noteKilledBy:whom damageType:type]; // called before exploding, consistant with npc ships.
7049
7050 [self becomeLargeExplosion:4.0]; // also sets STATUS_DEAD
7051 [self moveForward:100.0];
7052
7053 flightSpeed = 160.0f;
7055 flightRoll = 0.0;
7056 flightPitch = 0.0;
7057 flightYaw = 0.0;
7058 [[UNIVERSE messageGUI] clear]; // No messages for the dead.
7059 [self suppressTargetLost]; // No target lost messages when dead.
7060 [self playGameOver];
7061 [UNIVERSE setBlockJSPlayerShipProps:YES]; // Treat JS player as stale entity.
7062 [self removeAllEquipment]; // No scooping / equipment damage when dead.
7063 [self loseTargetStatus];
7064 [self showGameOver];
7065}
NSString * OOStringFromShipDamageType(OOShipDamageType type) CONST_FUNC
OOShipDamageType
Definition ShipEntity.h:183

◆ getDockingClearanceStatus

- (OODockingClearanceStatus) getDockingClearanceStatus

Definition at line 9242 of file PlayerEntity.m.

13192{
13194}

◆ getFined

- (void) getFined

Definition at line 9242 of file PlayerEntity.m.

11879{
11880 if (legalStatus == 0) return; // nothing to pay for
11881
11882 OOGovernmentID local_gov = [[UNIVERSE currentSystemData] oo_intForKey:KEY_GOVERNMENT];
11883 if ([UNIVERSE inInterstellarSpace]) local_gov = 1; // equivalent to Feudal. I'm assuming any station in interstellar space is military. -- Ahruman 2008-05-29
11884 OOCreditsQuantity fine = 500 + ((local_gov < 2 || local_gov > 5) ? 500 : 0);
11885 fine *= legalStatus;
11886 if (fine > credits)
11887 {
11888 int payback = (int)(legalStatus * credits / fine);
11889 [self setBounty:(legalStatus-payback) withReason:kOOLegalStatusReasonPaidFine];
11890 credits = 0;
11891 }
11892 else
11893 {
11894 [self setBounty:0 withReason:kOOLegalStatusReasonPaidFine];
11895 credits -= fine;
11896 }
11897
11898 // one of the fined-@-credits strings includes expansion tokens
11899 NSString *fined_message = [NSString stringWithFormat:OOExpandKey(@"fined-@-credits"), OOCredits(fine)];
11900 [self addMessageToReport:fined_message];
11901 [UNIVERSE forceWitchspaceEntries];
11902 ship_clock_adjust += 24 * 3600; // take up a day
11903}

◆ getFirstKeyCode:

- (int) getFirstKeyCode: (NSArray*)  key_def

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

653 :(NSArray*)key_def
654{
655 NSDictionary *def = [key_def objectAtIndex:0];
656 return [[def objectForKey:@"key"] intValue];
657}

◆ getKeyBindingDescription:

- (NSString *) getKeyBindingDescription: (NSArray *)  keyList

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

393 :(NSArray *) keyList
394{
395 NSUInteger i = 0;
396 NSMutableString *final = [NSMutableString string];
397 for (i = 0; i < [keyList count]; i++) {
398 if (i != 0) final = [NSMutableString stringWithFormat:@"%@ or ", final];
399 NSDictionary *def = [keyList objectAtIndex:i];
400 NSString *key = [def objectForKey:@"key"];
401 OOKeyCode k_int = (OOKeyCode)[key integerValue];
402 NSString *desc = [self keyCodeDescription:k_int];
403 // 0 = key not set
404 if (k_int != 0) {
405 if ([[def objectForKey:@"mod2"] boolValue] == YES) final = [NSMutableString stringWithFormat:@"%@%@+", final, keyMod2Text];
406 if ([[def objectForKey:@"mod1"] boolValue] == YES) final = [NSMutableString stringWithFormat:@"%@%@+", final, keyMod1Text];
407 if ([[def objectForKey:@"shift"] boolValue] == YES) final = [NSMutableString stringWithFormat:@"%@%@+", final, keyShiftText];
408 final = [NSMutableString stringWithFormat:@"%@%@", final, desc];
409 }
410 }
411 return final;
412}
uint16_t OOKeyCode
Definition OOTypes.h:186

◆ getMissionDestinations

- (NSMutableDictionary *) getMissionDestinations

Definition at line 9242 of file PlayerEntity.m.

13348{
13349 return missionDestinations;
13350}

Referenced by MissionGetProperty().

+ Here is the caller graph for this function:

◆ getTargetDockStation

- (StationEntity *) getTargetDockStation

Definition at line 13727 of file PlayerEntity.m.

4524{
4525 return targetDockStation;
4526}
StationEntity * targetDockStation

◆ gui_screen_string

- (NSString *) gui_screen_string

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

919{
920 return OOStringFromGUIScreenID(gui_screen);
921}
NSString * OOStringFromGUIScreenID(OOGUIScreenID screen) CONST_FUNC

◆ guiScreen

- (OOGUIScreenID) guiScreen

Definition at line 9242 of file PlayerEntity.m.

11356{
11357 return gui_screen;
11358}

Referenced by GlobalPauseGame().

+ Here is the caller graph for this function:

◆ handleAutopilotOn:

- (void) handleAutopilotOn: (BOOL fastDocking
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

5499 :(BOOL)fastDocking
5500{
5501 NSString *message = nil;
5502
5503 // Check alert condition - on red alert, abort
5504 // -- but only for fast docking
5505 if (fastDocking && ([self alertCondition] == ALERT_CONDITION_RED))
5506 {
5507 [self playAutopilotCannotDockWithTarget];
5508 message = OOExpandKey(@"autopilot-red-alert");
5509 goto abort;
5510 }
5511
5512 Entity *target = [self primaryTarget];
5513 // If target isn't dockable, check for nearby stations
5514 if (![target isStation])
5515 {
5516 Universe *uni = UNIVERSE;
5517 Entity **entities = uni->sortedEntities; // grab the public sorted list
5518 int nStations = 0;
5519 unsigned i;
5520
5521 for (i = 0; i < uni->n_entities && nStations < 2; i++)
5522 {
5523 if (entities[i]->isStation && [entities[i] isKindOfClass:[StationEntity class]] &&
5524 entities[i]->zero_distance <= SCANNER_MAX_RANGE2)
5525 {
5526 nStations++;
5527 target = entities[i];
5528 }
5529 }
5530 // If inside the Aegis, dock with the main station.
5531 // If we found one target, dock with it.
5532 // If outside the Aegis and we found multiple targets, abort.
5533
5534 if ([self withinStationAegis] && legalStatus <= 50)
5535 {
5536 target = [UNIVERSE station];
5537 }
5538 else if (nStations != 1)
5539 {
5540 if (nStations == 0)
5541 {
5542 [self playAutopilotOutOfRange];
5543 message = OOExpandKey(@"autopilot-out-of-range");
5544 }
5545 else
5546 {
5547 [self playAutopilotCannotDockWithTarget];
5548 message = OOExpandKey(@"autopilot-multiple-targets");
5549 }
5550 goto abort;
5551 }
5552 }
5553
5554 // We found a dockable, check whether we can dock with it
5555 // NSAssert([target isKindOfClass:[StationEntity class]], @"Expected entity with isStation flag set to be a station."); // no need for asserts. Tested enough already.
5556 StationEntity *ts = (StationEntity *)target;
5557 NSString *stationName = [ts displayName];
5558
5559 // If station is not transmitting docking instructions, we cannot use autopilot.
5560 if (![ts allowsAutoDocking])
5561 {
5562 [self playAutopilotCannotDockWithTarget];
5563 message = OOExpandKey(@"autopilot-station-does-not-allow-autodocking", stationName);
5564 }
5565 // Deny if station is hostile or player is a fugitive trying to dock at the main station.
5566 else if ((legalStatus > 50 && ts == [UNIVERSE station]) || [ts isHostileTo:self])
5567 {
5568 [self playAutopilotCannotDockWithTarget];
5569 message = OOExpandKey((ts == [UNIVERSE station]) ? @"autopilot-denied" : @"autopilot-target-docking-instructions-denied", stationName);
5570 }
5571 // If we're fast-docking, perform the docking logic
5572 else if (fastDocking && [ts allowsFastDocking])
5573 {
5574 // check whether there are docks that do not accept docking - even one such dock will result in rejection
5575 NSEnumerator *subEnum = nil;
5576 DockEntity* sub = nil;
5577 for (subEnum = [ts dockSubEntityEnumerator]; (sub = [subEnum nextObject]); )
5578 {
5579 // TOO_BIG_TO_DOCK issued when docks are scripted to reject docking
5580 if([[sub canAcceptShipForDocking:self] isEqualToString:@"TOO_BIG_TO_DOCK"])
5581 {
5582 message = OOExpandKey((ts == [UNIVERSE station]) ? @"autopilot-denied" : @"autopilot-target-docking-instructions-denied", stationName);
5583 goto abort;
5584 }
5585 }
5586
5587 if (legalStatus > 0)
5588 {
5589 // there's a slight chance you'll be fined for your past offences when autodocking
5590 int fine_chance = ranrot_rand() & 0x03ff; // 0..1023
5591 int government = 1 + [[UNIVERSE currentSystemData] oo_intForKey:KEY_GOVERNMENT]; // 1..8
5592 if ([UNIVERSE inInterstellarSpace]) government = 2; // equivalent to Feudal. I'm assuming any station in interstellar space is military. -- Ahruman 2008-05-29
5593 fine_chance /= government;
5594 if (fine_chance < legalStatus)
5595 {
5596 [self markForFines];
5597 }
5598 }
5599
5600 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_GRANTED];
5601
5602 [UNIVERSE forceWitchspaceEntries];
5603 ship_clock_adjust += 1200.0; // 20 minutes penalty to enter dock
5604 ident_engaged = NO;
5605 [self safeAllMissiles];
5606 [UNIVERSE setViewDirection:VIEW_FORWARD];
5607 [self enterDock:ts];
5608 }
5609 else
5610 {
5611 // Standard docking - engage autopilot
5612 [self engageAutopilotToStation:ts];
5613 message = OOExpandKey(@"autopilot-on");
5614 }
5615
5616abort:
5617 // Clean-up code
5618 if (message != nil) [UNIVERSE addMessage:message forCount:4.5];
5619 return;
5620}
@ ALERT_CONDITION_RED
Definition ShipEntity.h:178
NSString * displayName
Definition ShipEntity.h:330
unsigned n_entities
Definition Universe.h:192
Entity * sortedEntities[UNIVERSE_MAX_ENTITIES+1]
Definition Universe.h:191

◆ handleButtonIdent

- (void) handleButtonIdent
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

5624{
5625 // Clear current target if we're already in Ident mode
5626 if (ident_engaged) [self noteLostTarget];
5627
5628 [self safeAllMissiles];
5629 ident_engaged = YES;
5630 if ([self primaryTarget] == nil)
5631 {
5632 [self playIdentOn];
5633 [UNIVERSE addMessage:OOExpandKey(@"ident-on") forCount:2.0];
5634 }
5635 else
5636 {
5637 [self playIdentLockedOn];
5638 [self printIdentLockedOnForMissile:NO];
5639 }
5640}

◆ handleButtonTargetMissile

- (void) handleButtonTargetMissile
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

5644{
5645 if (![self weaponsOnline])
5646 {
5647 [self handleButtonIdent];
5648 return;
5649 }
5650
5651 // Clear current target if we're already in Missile Targeting mode
5652 if (missile_status != MISSILE_STATUS_SAFE)
5653 {
5654 [self noteLostTarget];
5655 }
5656
5657 // Arm missile and check for missile lock
5658 missile_status = MISSILE_STATUS_ARMED;
5659 if ([missile_entity[activeMissile] isMissile])
5660 {
5661 if ([[self primaryTarget] isShip])
5662 {
5663 missile_status = MISSILE_STATUS_TARGET_LOCKED;
5664 [missile_entity[activeMissile] addTarget:[self primaryTarget]];
5665 [self printIdentLockedOnForMissile:YES];
5666 [self playMissileLockedOn];
5667 }
5668 else
5669 {
5670 // if it's nil, that means it was lost earlier
5671 if ([self primaryTarget] != nil)
5672 {
5673 [self noteLostTarget];
5674 }
5675 [missile_entity[activeMissile] noteLostTarget];
5676 NSString *weaponName = [missile_entity[activeMissile] name];
5677 [UNIVERSE addMessage:OOExpandKey(@"missile-armed", weaponName) forCount:2.0];
5678 [self playMissileArmed];
5679 }
5680 }
5681 else if ([missile_entity[activeMissile] isMine])
5682 {
5683 NSString *weaponName = [missile_entity[activeMissile] name];
5684 [UNIVERSE addMessage:OOExpandKey(@"mine-armed", weaponName) forCount:2.0];
5685 [self playMineArmed];
5686 }
5687 ident_engaged = NO;
5688}

◆ handleGameOptionsScreenKeys

- (void) handleGameOptionsScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

3398{
3399 MyOpenGLView *gameView = [UNIVERSE gameView];
3400 GuiDisplayGen *gui = [UNIVERSE gui];
3401 GUI_ROW_INIT(gui);
3402
3403 [self handleGUIUpDownArrowKeys];
3404 OOGUIRow guiSelectedRow = [gui selectedRow];
3405 BOOL selectKeyPress = ([self checkKeyPress:n_key_gui_select]||[gameView isDown:gvMouseDoubleClick]);
3406 if ([gameView isDown:gvMouseDoubleClick]) [gameView clearMouse];
3407
3408 if ((guiSelectedRow == GUI_ROW(GAME,STICKMAPPER)) && selectKeyPress)
3409 {
3410 selFunctionIdx = 0;
3411 [self resetStickFunctions]; // reset the list of stick functions, so changes in oxp equipment are reflected
3412 [self setGuiToStickMapperScreen: 0 resetCurrentRow: YES];
3413 }
3414 if ((guiSelectedRow == GUI_ROW(GAME,KEYMAPPER)) && selectKeyPress)
3415 {
3416 selFunctionIdx = 0;
3417 [self resetKeyFunctions]; // reset the list of key functions, so changes in oxp equipment are reflected
3418 [self setGuiToKeyMapperScreen: 0 resetCurrentRow: YES];
3419 }
3420
3421
3422#if OOLITE_WINDOWS
3423 if ([gameView hdrOutput])
3424 {
3425 if ((guiSelectedRow == GUI_ROW(GAME,HDRMAXBRIGHTNESS))&&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3426 {
3428 {
3429 int direction = ([self checkKeyPress:n_key_gui_arrow_right]) ? 1 : -1;
3430 NSArray *brightnesses = [[UNIVERSE descriptions] oo_arrayForKey: @"hdr_maxBrightness_array"];
3431 int brightnessIdx = [brightnesses indexOfObject:[NSString stringWithFormat:@"%d", (int)[gameView hdrMaxBrightness]]];
3432
3433 if (brightnessIdx == NSNotFound)
3434 {
3435 OOLogWARN(@"hdr.maxBrightness.notFound", @"%@", @"couldn't find current max brightness setting, switching to lowest.");
3436 brightnessIdx = 0;
3437 }
3438
3439 brightnessIdx += direction;
3440 int count = [brightnesses count];
3441 if (brightnessIdx < 0)
3442 brightnessIdx = count - 1;
3443 if (brightnessIdx >= count)
3444 brightnessIdx = 0;
3445
3446 int brightnessValue = [brightnesses oo_intAtIndex:brightnessIdx];
3447
3448 // warp if the value we got is out of expected limits; can be the case if user has
3449 // manually modified the hdr_maxBrightness_array in descriptions.plist
3450 if (brightnessValue < MIN_HDR_MAXBRIGHTNESS) brightnessValue = direction == -1 ? MAX_HDR_MAXBRIGHTNESS : MIN_HDR_MAXBRIGHTNESS;
3451 if (brightnessValue > MAX_HDR_MAXBRIGHTNESS) brightnessValue = direction == 1 ? MIN_HDR_MAXBRIGHTNESS : MAX_HDR_MAXBRIGHTNESS;
3452
3453 [gameView setHDRMaxBrightness:(float)brightnessValue];
3454 NSString *maxBrightnessString = OOExpandKey(@"gameoptions-hdr-maxbrightness", brightnessValue);
3455
3456 [gui setText:maxBrightnessString forRow:GUI_ROW(GAME,HDRMAXBRIGHTNESS) align:GUI_ALIGN_CENTER];
3457
3459 }
3460 }
3461 else
3463 }
3464#endif
3465
3466
3467#if OO_RESOLUTION_OPTION
3468 if (!switching_resolution &&
3469 guiSelectedRow == GUI_ROW(GAME,DISPLAY) &&
3470 ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_arrow_left]))
3471 {
3472 GameController *controller = [UNIVERSE gameController];
3473 int direction = ([self checkKeyPress:n_key_gui_arrow_right]) ? 1 : -1;
3474 NSInteger displayModeIndex = [controller indexOfCurrentDisplayMode];
3475 NSArray *modes = [controller displayModes];
3476
3477 if (displayModeIndex == (NSInteger)NSNotFound)
3478 {
3479 OOLogWARN(@"graphics.mode.notFound", @"%@", @"couldn't find current fullscreen setting, switching to default.");
3480 displayModeIndex = 0;
3481 }
3482
3483 displayModeIndex = displayModeIndex + direction;
3484 int count = [modes count];
3485 if (displayModeIndex < 0)
3486 displayModeIndex = count - 1;
3487 if (displayModeIndex >= count)
3488 displayModeIndex = 0;
3489
3490 NSDictionary *mode = [modes objectAtIndex:displayModeIndex];
3491 int modeWidth = [mode oo_intForKey:kOODisplayWidth];
3492 int modeHeight = [mode oo_intForKey:kOODisplayHeight];
3493 int modeRefresh = [mode oo_intForKey:kOODisplayRefreshRate];
3494 [controller setDisplayWidth:modeWidth Height:modeHeight Refresh:modeRefresh];
3495
3496 NSString *displayModeString = [self screenModeStringForWidth:modeWidth height:modeHeight refreshRate:modeRefresh];
3497
3498 [self playChangedOption];
3499 [gui setText:displayModeString forRow:GUI_ROW(GAME,DISPLAY) align:GUI_ALIGN_CENTER];
3501
3502#if OOLITE_SDL
3503 /* TODO: The gameView for the SDL game currently holds and
3504 sets the actual screen resolution (controller just stores
3505 it). This probably ought to change. */
3506 [gameView setScreenSize: displayModeIndex]; // changes fullscreen mode immediately
3507#endif
3508 }
3509 if (switching_resolution && ![self checkKeyPress:n_key_gui_arrow_right] && ![self checkKeyPress:n_key_gui_arrow_left] && !selectKeyPress)
3510 {
3512 }
3513#endif // OO_RESOLUTION_OPTION
3514
3515#if OOLITE_SPEECH_SYNTH
3516
3517 if ((guiSelectedRow == GUI_ROW(GAME,SPEECH))&&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3518 {
3519 if (!speech_settings_pressed)
3520 {
3521 if ([self checkKeyPress:n_key_gui_arrow_right] && isSpeechOn < OOSPEECHSETTINGS_ALL)
3522 {
3523 ++isSpeechOn;
3524 [self playChangedOption];
3525 speech_settings_pressed = YES;
3526 }
3527 else if ([self checkKeyPress:n_key_gui_arrow_left] && isSpeechOn > OOSPEECHSETTINGS_OFF)
3528 {
3529 speech_settings_pressed = YES;
3530 --isSpeechOn;
3531 [self playChangedOption];
3532 }
3533 if (speech_settings_pressed)
3534 {
3535 NSString *message = nil;
3536 switch (isSpeechOn)
3537 {
3539 message = DESC(@"gameoptions-spoken-messages-no");
3540 break;
3542 message = DESC(@"gameoptions-spoken-messages-comms");
3543 break;
3545 message = DESC(@"gameoptions-spoken-messages-yes");
3546 break;
3547 }
3548 [gui setText:message forRow:GUI_ROW(GAME,SPEECH) align:GUI_ALIGN_CENTER];
3549
3550 if (isSpeechOn == OOSPEECHSETTINGS_ALL)
3551 {
3552 [UNIVERSE stopSpeaking];
3553 [UNIVERSE startSpeakingString:message];
3554 }
3555 }
3556 }
3557 }
3558 else
3559 {
3560 speech_settings_pressed = NO;
3561 }
3562#if OOLITE_ESPEAK
3563 if (guiSelectedRow == GUI_ROW(GAME,SPEECH_LANGUAGE))
3564 {
3565 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_arrow_left])
3566 {
3567 if (!speechVoiceSelectKeyPressed || script_time > timeLastKeyPress + KEY_REPEAT_INTERVAL)
3568 {
3569 [self playChangedOption];
3570 if ([self checkKeyPress:n_key_gui_arrow_right])
3571 voice_no = [UNIVERSE nextVoice: voice_no];
3572 else
3573 voice_no = [UNIVERSE prevVoice: voice_no];
3574 [UNIVERSE setVoice: voice_no withGenderM:voice_gender_m];
3575 NSString *voiceName = [UNIVERSE voiceName:voice_no];
3576 NSString *message = OOExpandKey(@"gameoptions-voice-name", voiceName);
3577 [gui setText:message forRow:GUI_ROW(GAME,SPEECH_LANGUAGE) align:GUI_ALIGN_CENTER];
3578 if (isSpeechOn == OOSPEECHSETTINGS_ALL)
3579 {
3580 [UNIVERSE stopSpeaking];
3581 [UNIVERSE startSpeakingString:[UNIVERSE voiceName: voice_no]];
3582 }
3583 timeLastKeyPress = script_time;
3584 }
3585 speechVoiceSelectKeyPressed = YES;
3586 }
3587 else
3588 speechVoiceSelectKeyPressed = NO;
3589 }
3590
3591 if (guiSelectedRow == GUI_ROW(GAME,SPEECH_GENDER))
3592 {
3593 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_arrow_left])
3594 {
3595 if (!speechGenderSelectKeyPressed)
3596 {
3597 [self playChangedOption];
3598 BOOL m = [self checkKeyPress:n_key_gui_arrow_right];
3599 if (m != voice_gender_m)
3600 {
3601 voice_gender_m = m;
3602 [UNIVERSE setVoice:voice_no withGenderM:voice_gender_m];
3603 NSString *message = [NSString stringWithFormat:@"%@", DESC(voice_gender_m ? @"gameoptions-voice-M" : @"gameoptions-voice-F")];
3604 [gui setText:message forRow:GUI_ROW(GAME,SPEECH_GENDER) align:GUI_ALIGN_CENTER];
3605 if (isSpeechOn == OOSPEECHSETTINGS_ALL)
3606 {
3607 [UNIVERSE stopSpeaking];
3608 [UNIVERSE startSpeakingString:[UNIVERSE voiceName: voice_no]];
3609 }
3610 }
3611 }
3612 speechGenderSelectKeyPressed = YES;
3613 }
3614 else
3615 speechGenderSelectKeyPressed = NO;
3616 }
3617#endif
3618#endif
3619
3620 if ((guiSelectedRow == GUI_ROW(GAME,MUSIC))&&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3621 {
3623 {
3625 int initialMode = [musicController mode];
3626 int mode = initialMode;
3627
3628 if ([self checkKeyPress:n_key_gui_arrow_right]) mode++;
3629 if ([self checkKeyPress:n_key_gui_arrow_left]) mode--;
3630
3631 [musicController setMode:MAX(mode, 0)];
3632
3633 if ((int)[musicController mode] != initialMode)
3634 {
3635 [self playChangedOption];
3636 NSString *musicMode = [UNIVERSE descriptionForArrayKey:@"music-mode" index:[[OOMusicController sharedController] mode]];
3637 NSString *message = OOExpandKey(@"gameoptions-music-mode", musicMode);
3638 [gui setText:message forRow:GUI_ROW(GAME,MUSIC) align:GUI_ALIGN_CENTER];
3639 }
3640 }
3641 musicModeKeyPressed = YES;
3642 }
3643 else musicModeKeyPressed = NO;
3644
3645 if ((guiSelectedRow == GUI_ROW(GAME,AUTOSAVE))&&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3646 {
3647 if ([self checkKeyPress:n_key_gui_arrow_right] != [UNIVERSE autoSave])
3648 [self playChangedOption];
3649 [UNIVERSE setAutoSave:[self checkKeyPress:n_key_gui_arrow_right]];
3650 if ([UNIVERSE autoSave])
3651 {
3652 // if just enabled, we want to autosave immediately
3653 [UNIVERSE setAutoSaveNow:YES];
3654 [gui setText:DESC(@"gameoptions-autosave-yes") forRow:GUI_ROW(GAME,AUTOSAVE) align:GUI_ALIGN_CENTER];
3655 }
3656 else
3657 {
3658 [UNIVERSE setAutoSaveNow:NO];
3659 [gui setText:DESC(@"gameoptions-autosave-no") forRow:GUI_ROW(GAME,AUTOSAVE) align:GUI_ALIGN_CENTER];
3660 }
3661 }
3662
3663 if ((guiSelectedRow == GUI_ROW(GAME,VOLUME))
3664 &&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left]))
3665 &&[OOSound respondsToSelector:@selector(masterVolume)])
3666 {
3668 {
3669 BOOL rightKeyDown = [self checkKeyPress:n_key_gui_arrow_right];
3670 BOOL leftKeyDown = [self checkKeyPress:n_key_gui_arrow_left];
3671 double volume = 100.0 * [OOSound masterVolume];
3672 int vol = (volume / 5.0 + 0.5);
3673 if (rightKeyDown) vol++;
3674 if (leftKeyDown) vol--;
3675 vol = (int)OOClampInteger(vol, 0, 20);
3676 [OOSound setMasterVolume: 0.05 * vol];
3677 [self playChangedOption];
3678#if OOLITE_ESPEAK
3679 espeak_SetParameter(espeakVOLUME, vol * 5, 0);
3680#endif
3681 if (vol > 0)
3682 {
3683 NSString* soundVolumeWordDesc = DESC(@"gameoptions-sound-volume");
3684 NSString* v1_string = @"|||||||||||||||||||||||||";
3685 NSString* v0_string = @".........................";
3686 v1_string = [v1_string substringToIndex:vol];
3687 v0_string = [v0_string substringToIndex:20 - vol];
3688 [gui setText:[NSString stringWithFormat:@"%@%@%@ ", soundVolumeWordDesc, v1_string, v0_string]
3689 forRow:GUI_ROW(GAME,VOLUME)
3690 align:GUI_ALIGN_CENTER];
3691 }
3692 else
3693 [gui setText:DESC(@"gameoptions-sound-volume-mute") forRow:GUI_ROW(GAME,VOLUME) align:GUI_ALIGN_CENTER];
3694 timeLastKeyPress = script_time;
3695 }
3697 }
3698 else
3700
3701 if ((guiSelectedRow == GUI_ROW(GAME,FOV))
3702 &&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3703 {
3705 {
3706 BOOL rightKeyDown = [self checkKeyPress:n_key_gui_arrow_right];
3707 BOOL leftKeyDown = [self checkKeyPress:n_key_gui_arrow_left];
3708 float fov = [gameView fov:NO];
3709 float fovStep = (MAX_FOV_DEG - MIN_FOV_DEG) / 20.0f;
3710 fov += (((rightKeyDown && (fov < MAX_FOV_DEG)) ?
3711 fovStep : 0.0f) - ((leftKeyDown && (fov > MIN_FOV_DEG)) ? fovStep : 0.0f));
3712 if (fov > MAX_FOV_DEG) fov = MAX_FOV_DEG;
3713 if (fov < MIN_FOV_DEG) fov = MIN_FOV_DEG;
3714 [gameView setFov:fov fromFraction:NO];
3715 fieldOfView = [gameView fov:YES];
3716 int fovTicks = (int)((fov - MIN_FOV_DEG) / fovStep);
3717 NSString* fovWordDesc = DESC(@"gameoptions-fov-value");
3718 NSString* v1_string = @"|||||||||||||||||||||||||";
3719 NSString* v0_string = @".........................";
3720 v1_string = [v1_string substringToIndex:fovTicks];
3721 v0_string = [v0_string substringToIndex:20 - fovTicks];
3722 [gui setText:[NSString stringWithFormat:@"%@%@%@ (%d%c) ", fovWordDesc, v1_string, v0_string, (int)fov, 176 /*176 is the degrees symbol ASCII code*/] forRow:GUI_ROW(GAME,FOV) align:GUI_ALIGN_CENTER];
3723 [[NSUserDefaults standardUserDefaults] setFloat:[gameView fov:NO] forKey:@"fov-value"];
3724 timeLastKeyPress = script_time;
3725 }
3726 fovControlPressed = YES;
3727 }
3728 else
3729 fovControlPressed = NO;
3730
3731
3732 // color blind mode
3733 if ((guiSelectedRow == GUI_ROW(GAME,COLORBLINDMODE))&&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3734 {
3736 {
3737 int colorblindMode = [UNIVERSE colorblindMode];
3738 if ([self checkKeyPress:n_key_gui_arrow_right])
3739 {
3740 [UNIVERSE setCurrentPostFX:[UNIVERSE nextColorblindMode:colorblindMode]];
3741 }
3742 else
3743 {
3744 [UNIVERSE setCurrentPostFX:[UNIVERSE prevColorblindMode:colorblindMode]];
3745 }
3746 colorblindMode = [UNIVERSE colorblindMode]; // get the updated value
3747 NSString *colorblindModeDesc = [[[UNIVERSE descriptions] oo_arrayForKey: @"colorblind_mode"] oo_stringAtIndex:[UNIVERSE useShaders] ? colorblindMode : 0];
3748 NSString *colorblindModeMsg = OOExpandKey(@"gameoptions-colorblind-mode", colorblindModeDesc);
3749 [gui setText:colorblindModeMsg forRow:GUI_ROW(GAME,COLORBLINDMODE) align:GUI_ALIGN_CENTER];
3750 }
3752 }
3753 else
3755
3756
3757 if (![gameView hdrOutput])
3758 {
3759 if ((guiSelectedRow == GUI_ROW(GAME,WIREFRAMEGRAPHICS))&&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3760 {
3761 if ([self checkKeyPress:n_key_gui_arrow_right] != [UNIVERSE wireframeGraphics])
3762 [self playChangedOption];
3763 [UNIVERSE setWireframeGraphics:[self checkKeyPress:n_key_gui_arrow_right]];
3764 if ([UNIVERSE wireframeGraphics])
3765 [gui setText:DESC(@"gameoptions-wireframe-graphics-yes") forRow:GUI_ROW(GAME,WIREFRAMEGRAPHICS) align:GUI_ALIGN_CENTER];
3766 else
3767 [gui setText:DESC(@"gameoptions-wireframe-graphics-no") forRow:GUI_ROW(GAME,WIREFRAMEGRAPHICS) align:GUI_ALIGN_CENTER];
3768 }
3769 }
3770#if OOLITE_WINDOWS
3771 else
3772 {
3773 if ((guiSelectedRow == GUI_ROW(GAME,HDRPAPERWHITE))
3774 &&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3775 {
3777 {
3778 BOOL rightKeyDown = [self checkKeyPress:n_key_gui_arrow_right];
3779 BOOL leftKeyDown = [self checkKeyPress:n_key_gui_arrow_left];
3780 float paperWhite = [gameView hdrPaperWhiteBrightness];
3781 paperWhite += (((rightKeyDown && (paperWhite < MAX_HDR_PAPERWHITE)) ? 10.0f : 0.0f) - ((leftKeyDown && (paperWhite > MIN_HDR_PAPERWHITE)) ? 10.0f : 0.0f));
3782 if (paperWhite > MAX_HDR_PAPERWHITE) paperWhite = MAX_HDR_PAPERWHITE;
3783 if (paperWhite < MIN_HDR_PAPERWHITE) paperWhite = MIN_HDR_PAPERWHITE;
3784 [gameView setHDRPaperWhiteBrightness:paperWhite];
3785 int paperWhiteNorm = (int)((paperWhite - MIN_HDR_PAPERWHITE) * 20 / (MAX_HDR_PAPERWHITE - MIN_HDR_PAPERWHITE));
3786 NSString* paperWhiteWordDesc = DESC(@"gameoptions-hdr-paperwhite");
3787 NSString* v1_string = @"|||||||||||||||||||||||||";
3788 NSString* v0_string = @".........................";
3789 v1_string = [v1_string substringToIndex:paperWhiteNorm];
3790 v0_string = [v0_string substringToIndex:20 - paperWhiteNorm];
3791 [gui setText:[NSString stringWithFormat:@"%@%@%@ (%d) ", paperWhiteWordDesc, v1_string, v0_string, (int)paperWhite] forRow:GUI_ROW(GAME,HDRPAPERWHITE) align:GUI_ALIGN_CENTER];
3792 }
3794 }
3795 else
3797 }
3798#endif
3799
3800#if !NEW_PLANETS
3801 if ((guiSelectedRow == GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS))&&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3802 {
3803 if ([self checkKeyPress:n_key_gui_arrow_right] != [UNIVERSE doProcedurallyTexturedPlanets])
3804 {
3805 [UNIVERSE setDoProcedurallyTexturedPlanets:[self checkKeyPress:n_key_gui_arrow_right]];
3806 [self playChangedOption];
3807 if ([UNIVERSE planet])
3808 {
3809 [UNIVERSE setUpPlanet];
3810 }
3811 }
3812 if ([UNIVERSE doProcedurallyTexturedPlanets])
3813 [gui setText:DESC(@"gameoptions-procedurally-textured-planets-yes") forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS) align:GUI_ALIGN_CENTER];
3814 else
3815 [gui setText:DESC(@"gameoptions-procedurally-textured-planets-no") forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS) align:GUI_ALIGN_CENTER];
3816 }
3817#endif
3818
3819 if (guiSelectedRow == GUI_ROW(GAME,SHADEREFFECTS) && ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_arrow_left]))
3820 {
3822 {
3823 int direction = ([self checkKeyPress:n_key_gui_arrow_right]) ? 1 : -1;
3824
3825 /* (Getafix - 2015/05/07)
3826 Fix bug coincidentally resulting in Graphics Detail value cycling
3827 when left arrow is pressed.
3828
3829 OOGraphicsDetail is an enum type and as such it will never go
3830 negative. The following code adjusts "direction" to avoid illegal
3831 detailLevel values.
3832
3833 Perhaps a more elegant solution could be set in place, restructuring
3834 in Universe.m the logic behing setDetailLevelDirectly and
3835 setDetailLevel, not forgetting to consider Graphic Detail assigned
3836 from various sources (i.e. menu, user prefs file, javascript, etc.).
3837 This is postponed in order not to risk the recently announced
3838 plans for v1.82 release.
3839
3840 Generally we should decide whether the menu values should cycle or
3841 not and apply it for all menu entries.
3842 */
3843 if ((([UNIVERSE detailLevel] == DETAIL_LEVEL_MINIMUM) && (direction == -1)) ||
3844 (([UNIVERSE detailLevel] == DETAIL_LEVEL_MAXIMUM) && (direction == 1)))
3845 direction = 0;
3846
3847 OOGraphicsDetail detailLevel = [UNIVERSE detailLevel] + direction;
3848 [UNIVERSE setDetailLevel:detailLevel];
3849 detailLevel = [UNIVERSE detailLevel];
3850
3851 NSString *shaderEffectsOptionsString = OOExpand(@"gameoptions-detaillevel-[detailLevel]", detailLevel);
3852 [gui setText:OOExpandKey(shaderEffectsOptionsString) forRow:GUI_ROW(GAME,SHADEREFFECTS) align:GUI_ALIGN_CENTER];
3853 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,SHADEREFFECTS)];
3854
3855 timeLastKeyPress = script_time;
3856
3857 // changing detail level may result in changes to other settings too
3858 // (e.g. colorblind mode status), so refresh the page
3859 [self setGuiToGameOptionsScreen];
3860 [gui setSelectedRow:GUI_ROW(GAME,SHADEREFFECTS)];
3861 }
3863 }
3864 else shaderSelectKeyPressed = NO;
3865
3866#if OOLITE_SDL
3867 if ((guiSelectedRow == GUI_ROW(GAME,DISPLAYSTYLE)) && selectKeyPress)
3868 {
3869 [gameView toggleScreenMode];
3870 // redraw GUI
3871 [self setGuiToGameOptionsScreen];
3872 }
3873#endif
3874
3875 if ((guiSelectedRow == GUI_ROW(GAME,DOCKINGCLEARANCE))&&(([self checkKeyPress:n_key_gui_arrow_right])||([self checkKeyPress:n_key_gui_arrow_left])))
3876 {
3877 if ([self checkKeyPress:n_key_gui_arrow_right] != [UNIVERSE dockingClearanceProtocolActive])
3878 [self playChangedOption];
3879 [UNIVERSE setDockingClearanceProtocolActive:[self checkKeyPress:n_key_gui_arrow_right]];
3880 if ([UNIVERSE dockingClearanceProtocolActive])
3881 [gui setText:DESC(@"gameoptions-docking-clearance-yes") forRow:GUI_ROW(GAME,DOCKINGCLEARANCE) align:GUI_ALIGN_CENTER];
3882 else
3883 [gui setText:DESC(@"gameoptions-docking-clearance-no") forRow:GUI_ROW(GAME,DOCKINGCLEARANCE) align:GUI_ALIGN_CENTER];
3884 }
3885
3886 if ((guiSelectedRow == GUI_ROW(GAME,BACK)) && selectKeyPress)
3887 {
3888 [gameView clearKeys];
3889 [self setGuiToLoadSaveScreen];
3890 }
3891}
#define MIN_FOV_DEG
#define MAX_FOV_DEG
OOINLINE long long OOClampInteger(long long value, long long minValue, long long maxValue) ALWAYS_INLINE_FUNC
OOGraphicsDetail
Definition OOTypes.h:243
@ DETAIL_LEVEL_MAXIMUM
Definition OOTypes.h:251
@ DETAIL_LEVEL_MINIMUM
Definition OOTypes.h:244
static BOOL musicModeKeyPressed
static BOOL shaderSelectKeyPressed
static BOOL volumeControlPressed
static BOOL hdrPaperWhiteControlPressed
static BOOL fovControlPressed
static BOOL colorblindModeControlPressed
static BOOL switching_resolution
static double timeLastKeyPress
static BOOL hdrMaxBrightnessControlPressed
@ OOSPEECHSETTINGS_ALL
@ OOSPEECHSETTINGS_OFF
@ OOSPEECHSETTINGS_COMMS
#define KEY_REPEAT_INTERVAL
#define GUI_ROW_INIT(GUI)
#define GUI_ROW(GROUP, ITEM)
#define MIN_HDR_MAXBRIGHTNESS
#define MIN_HDR_PAPERWHITE
#define MAX_HDR_MAXBRIGHTNESS
#define MAX_HDR_PAPERWHITE
BOOL setDisplayWidth:Height:Refresh:(unsigned int d_width,[Height] unsigned int d_height,[Refresh] unsigned int d_refresh)
void setFov:fromFraction:(float value,[fromFraction] BOOL fromFraction)
BOOL isDown:(int key)
void toggleScreenMode()
void setScreenSize:(int sizeIndex)
float fov:(BOOL inFraction)
void setMode:(OOMusicMode mode)
void setMasterVolume:(float fraction)
Definition OOALSound.m:64
float masterVolume()
Definition OOALSound.m:80

◆ handleGUIUpDownArrowKeys

- (BOOL) handleGUIUpDownArrowKeys

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

714{
715 MyOpenGLView *gameView = [UNIVERSE gameView];
716 GuiDisplayGen *gui = [UNIVERSE gui];
717 BOOL result = NO;
718 BOOL arrow_up = [self checkKeyPress:n_key_gui_arrow_up];
719 BOOL arrow_down = [self checkKeyPress:n_key_gui_arrow_down];
720 BOOL mouse_click = [gameView isDown:gvMouseLeftButton];
721 BOOL mouse_dbl_click = [gameView isDown:gvMouseDoubleClick];
722
723 if (arrow_down)
724 {
725 if ((!upDownKeyPressed) || (script_time > timeLastKeyPress + KEY_REPEAT_INTERVAL))
726 {
727 if ([gui setNextRow: +1])
728 {
729 result = YES;
730 }
731 else
732 {
733 if ([gui setFirstSelectableRow]) result = YES;
734 }
735
736 if (result && [gui selectableRange].length > 1) [self playMenuNavigationDown];
737 else [self playMenuNavigationNot];
738
739 timeLastKeyPress = script_time;
740 }
741 }
742
743 if (arrow_up)
744 {
745 if ((!upDownKeyPressed) || (script_time > timeLastKeyPress + KEY_REPEAT_INTERVAL))
746 {
747 if ([gui setNextRow: -1])
748 {
749 result = YES;
750 }
751 else
752 {
753 if ([gui setLastSelectableRow]) result = YES;
754 }
755
756 if (result && [gui selectableRange].length > 1) [self playMenuNavigationUp];
757 else [self playMenuNavigationNot];
758
759 timeLastKeyPress = script_time;
760 }
761 }
762
763 if (mouse_click)
764 {
765 if (!upDownKeyPressed)
766 {
767 int click_row = 0;
768 if (UNIVERSE)
769 click_row = UNIVERSE->cursor_row;
770 if ([gui setSelectedRow:click_row])
771 {
772 result = YES;
773 }
774 }
775 }
776 if (mouse_dbl_click)
777 {
778 int click_row = 0;
779 if (UNIVERSE)
780 click_row = UNIVERSE->cursor_row;
781 if ([gui setSelectedRow:click_row])
782 {
783 result = YES;
784 }
785 else
786 {
787 // if double-clicked on an unselectable row, clear the
788 // state so it doesn't activate whatever was last
789 // selected
790 [gameView clearMouse];
791 }
792 }
793
794
795 upDownKeyPressed = (arrow_up || arrow_down || mouse_click);
796
797 return result;
798}
static BOOL upDownKeyPressed

◆ handleKeyboardLayoutEntryKeys:view:

- (void) handleKeyboardLayoutEntryKeys: (GuiDisplayGen *)  gui
view: (MyOpenGLView *)  gameView 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1194 :(GuiDisplayGen *)gui view:(MyOpenGLView *)gameView
1195{
1196 [self handleGUIUpDownArrowKeys];
1197 BOOL selectKeyPress = ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick]);
1198 if ([gameView isDown:gvMouseDoubleClick]) [gameView clearMouse];
1199
1200 NSString *key = [gui keyForRow: [gui selectedRow]];
1201 if (selectKeyPress)
1202 {
1203 if ([key hasPrefix:@"More:"])
1204 {
1205 int from_function = [[[key componentsSeparatedByString:@":"] objectAtIndex:1] intValue];
1206 if (from_function < 0) from_function = 0;
1207
1209 if (from_function == 0) current_row = GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1;
1210 [self setGuiToKeyboardLayoutScreen:from_function];
1211 if ([gameView isDown:gvMouseDoubleClick]) [gameView clearMouse];
1212 return;
1213 }
1214
1215 // update the keyboard code
1216 NSUInteger idx =[[[key componentsSeparatedByString:@":"] objectAtIndex:1] intValue];
1217 NSString *kbd = [[kbdLayouts objectAtIndex:idx] objectForKey:@"key"];
1218 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1219 [defaults setObject:kbd forKey:@"keyboard-code"];
1220 [self initKeyConfigSettings];
1221 [self initCheckingDictionary];
1222
1223 [gameView clearKeys]; // try to stop key bounces
1224 [self setGuiToKeyMapperScreen:0 resetCurrentRow:YES];
1225 }
1226 if ([gameView isDown:27]) // escape - return without change
1227 {
1228 [gameView clearKeys]; // try to stop key bounces
1229 [self setGuiToKeyMapperScreen:0 resetCurrentRow:YES];
1230 }
1231}
static long current_row

◆ handleKeyboardLayoutKeys

- (void) handleKeyboardLayoutKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

3934{
3935 MyOpenGLView *gameView = [UNIVERSE gameView];
3936 GuiDisplayGen *gui = [UNIVERSE gui];
3937
3938 [self handleKeyboardLayoutEntryKeys: gui view: gameView];
3939 leftRightKeyPressed = [self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up] || [self checkKeyPress:n_key_gui_page_down];
3941 {
3942 NSString *key = [gui keyForRow: [gui selectedRow]];
3943 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
3944 {
3945 key = [gui keyForRow:GUI_ROW_KC_FUNCEND];
3946 }
3947 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
3948 {
3949 key = [gui keyForRow:GUI_ROW_KC_FUNCSTART];
3950 }
3951 int from_function = 0;
3952 NSArray *keyComponents = [key componentsSeparatedByString:@":"];
3953 if ([keyComponents count] > 1)
3954 {
3955 from_function = [keyComponents oo_intAtIndex:1];
3956 if (from_function < 0) from_function = 0;
3957
3958 [self setGuiToKeyboardLayoutScreen:from_function resetCurrentRow:YES];
3959 if ([[UNIVERSE gui] selectedRow] < GUI_ROW_KC_FUNCSTART)
3960 {
3961 [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART];
3962 }
3963 if (from_function == 0)
3964 {
3965 [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1];
3966 }
3967 }
3968 }
3969}
static BOOL leftRightKeyPressed

◆ handleKeyConfigEntryKeys:view:

- (void) handleKeyConfigEntryKeys: (GuiDisplayGen *)  gui
view: (MyOpenGLView *)  gameView 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

645 :(GuiDisplayGen *)gui view:(MyOpenGLView *)gameView
646{
647 NSUInteger end_row = 21;
648 if ([[self hud] allowBigGui])
649 {
650 end_row = 27;
651 }
652
653 [self handleGUIUpDownArrowKeys];
654 if ([gameView lastKeyWasShifted]) last_shift = YES;
655
656 [gui setText:
657 [NSString stringWithFormat:DESC(@"Key: %@"), [gameView typedString]]
658 forRow: end_row];
659 [gui setColor:[OOColor cyanColor] forRow:end_row];
660
661 if ([self checkKeyPress:n_key_gui_select])
662 {
663 [gameView suppressKeysUntilKeyUp];
664 // update function key
665 [self updateKeyDefinition:[gameView typedString] index:key_index];
666 [gameView clearKeys]; // try to stop key bounces
667 [self setGuiToKeyConfigScreen:YES];
668 }
669 if ([gameView isDown:27]) // escape
670 {
671 [gameView suppressKeysUntilKeyUp];
672 // don't update function key
673 [self setGuiToKeyConfigScreen:YES];
674 }
675}
static BOOL last_shift
NSMutableString * typedString

◆ handleKeyConfigKeys:view:

- (void) handleKeyConfigKeys: (GuiDisplayGen *)  gui
view: (MyOpenGLView *)  gameView 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

551 :(GuiDisplayGen *)gui view:(MyOpenGLView *)gameView
552{
553 [self handleGUIUpDownArrowKeys];
554 BOOL selectKeyPress = ([self checkKeyPress:n_key_gui_select]||[gameView isDown:gvMouseDoubleClick]);
555 if ([gameView isDown:gvMouseDoubleClick]) [gameView clearMouse];
556
557 if (selectKeyPress && ([gui selectedRow] == GUI_ROW_KC_KEY || [gui selectedRow] == (GUI_ROW_KC_KEY + 5)))
558 {
559 key_index = ([gui selectedRow] == GUI_ROW_KC_KEY ? 0 : 1);
560 [self setGuiToKeyConfigEntryScreen];
561 }
562
563 if (selectKeyPress && ([gui selectedRow] == GUI_ROW_KC_SHIFT || [gui selectedRow] == (GUI_ROW_KC_SHIFT + 5)))
564 {
565 [self updateShiftKeyDefinition:@"shift" index:([gui selectedRow] == GUI_ROW_KC_SHIFT ? 0 : 1)];
566 [self setGuiToKeyConfigScreen];
567 }
568 if (selectKeyPress && ([gui selectedRow] == GUI_ROW_KC_MOD1 || [gui selectedRow] == (GUI_ROW_KC_MOD1 + 5)))
569 {
570 [self updateShiftKeyDefinition:@"mod1" index:([gui selectedRow] == GUI_ROW_KC_MOD1 ? 0 : 1)];
571 [self setGuiToKeyConfigScreen];
572 }
573 if (selectKeyPress && ([gui selectedRow] == GUI_ROW_KC_MOD2 || [gui selectedRow] == (GUI_ROW_KC_MOD2 + 5)))
574 {
575 [self updateShiftKeyDefinition:@"mod2" index:([gui selectedRow] == GUI_ROW_KC_MOD2 ? 0 : 1)];
576 [self setGuiToKeyConfigScreen];
577 }
578
579 if (selectKeyPress && [gui selectedRow] == GUI_ROW_KC_SAVE)
580 {
581 [self saveKeySetting:[selected_entry objectForKey: KEY_KC_DEFINITION]];
582 [self reloadPage];
583 }
584
585 if ((selectKeyPress && [gui selectedRow] == GUI_ROW_KC_CANCEL) || [gameView isDown:27])
586 {
587 // esc or Cancel was pressed - get out of here
588 [self reloadPage];
589 }
590}
#define GUI_ROW_KC_MOD2
#define GUI_ROW_KC_SAVE
#define GUI_ROW_KC_SHIFT
#define GUI_ROW_KC_MOD1
#define GUI_ROW_KC_CANCEL
#define GUI_ROW_KC_KEY
static NSUInteger key_index

◆ handleKeyMapperConfirmClearKeys:view:

- (void) handleKeyMapperConfirmClearKeys: (GuiDisplayGen *)  gui
view: (MyOpenGLView *)  gameView 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

796 :(GuiDisplayGen *)gui view:(MyOpenGLView *)gameView
797{
798 [self handleGUIUpDownArrowKeys];
799
800 BOOL selectKeyPress = ([self checkKeyPress:n_key_gui_select]||[gameView isDown:gvMouseDoubleClick]);
801 if ([gameView isDown:gvMouseDoubleClick]) [gameView clearMouse];
802
803 // Translation issue: we can't confidently use raw Y and N ascii as shortcuts. It's better to use the load-previous-commander keys.
804 id valueYes = [[[UNIVERSE descriptions] oo_stringForKey:@"load-previous-commander-yes" defaultValue:@"y"] lowercaseString];
805 id valueNo = [[[UNIVERSE descriptions] oo_stringForKey:@"load-previous-commander-no" defaultValue:@"n"] lowercaseString];
806 unsigned char cYes, cNo;
807
808 cYes = [valueYes characterAtIndex: 0] & 0x00ff; // Use lower byte of unichar.
809 cNo = [valueNo characterAtIndex: 0] & 0x00ff; // Use lower byte of unichar.
810
811 if ((selectKeyPress && ([gui selectedRow] == GUI_ROW_KC_CONFIRMCLEAR_YES))||[gameView isDown:cYes]||[gameView isDown:cYes - 32])
812 {
813 [self deleteAllKeySettings];
814 [gameView suppressKeysUntilKeyUp];
815 [self setGuiToKeyMapperScreen:0 resetCurrentRow:YES];
816 }
817
818 if ((selectKeyPress && ([gui selectedRow] == GUI_ROW_KC_CONFIRMCLEAR_NO))||[gameView isDown:27]||[gameView isDown:cNo]||[gameView isDown:cNo - 32])
819 {
820 // esc or NO was pressed - get out of here
821 [gameView suppressKeysUntilKeyUp];
822 [self setGuiToKeyMapperScreen:0 resetCurrentRow:YES];
823 }
824}
#define GUI_ROW_KC_CONFIRMCLEAR_YES
#define GUI_ROW_KC_CONFIRMCLEAR_NO

◆ handleKeyMapperScreenKeys

- (void) handleKeyMapperScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

3895{
3896 MyOpenGLView *gameView = [UNIVERSE gameView];
3897 GuiDisplayGen *gui = [UNIVERSE gui];
3898
3899 [self keyMapperInputHandler: gui view: gameView];
3900 leftRightKeyPressed = [self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up] || [self checkKeyPress:n_key_gui_page_down];
3902 {
3903 NSString *key = [gui keyForRow: [gui selectedRow]];
3904 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
3905 {
3906 key = [gui keyForRow:GUI_ROW_KC_FUNCEND];
3907 }
3908 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
3909 {
3910 key = [gui keyForRow:GUI_ROW_KC_FUNCSTART];
3911 }
3912 int from_function = 0;
3913 NSArray *keyComponents = [key componentsSeparatedByString:@":"];
3914 if ([keyComponents count] > 1)
3915 {
3916 from_function = [keyComponents oo_intAtIndex:1];
3917 if (from_function < 0) from_function = 0;
3918
3919 [self setGuiToKeyMapperScreen:from_function resetCurrentRow: YES];
3920 if ([[UNIVERSE gui] selectedRow] < GUI_ROW_KC_FUNCSTART)
3921 {
3922 [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART];
3923 }
3924 if (from_function == 0)
3925 {
3926 [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1];
3927 }
3928 }
3929 }
3930}

◆ handleMissionCallback

- (void) handleMissionCallback
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

5343{
5344 [UNIVERSE removeDemoShips];
5345 [[UNIVERSE gui] clearBackground];
5346
5347 [self setGuiToMissionEndScreen]; // need this to find out if we call a new mission screen inside callback.
5348
5349 if ([self status] != STATUS_DOCKED) [self switchToThisView:VIEW_FORWARD];
5350
5351 if (_missionWithCallback)
5352 {
5353 [self doMissionCallback];
5354 }
5355
5356 if ([self status] != STATUS_DOCKED) // did we launch inside callback? / are we in flight?
5357 {
5358 // TODO: This is no longer doing anything because of an 'isDocked' check inside the function. ***** Probably remove it for 1.76
5359 [self doWorldEventUntilMissionScreen:OOJSID("missionScreenEnded")]; // no opportunity events.
5360 }
5361 else
5362 {
5363 if (gui_screen != GUI_SCREEN_MISSION) // did we call a new mission screen inside callback?
5364 {
5365 // note that this might not be the same end screen as last time...
5366 [self setGuiToMissionEndScreen]; // if not, update status screen with callback changes, if any.
5367 [self endMissionScreenAndNoteOpportunity]; // missionScreenEnded, plus opportunity events.
5368 }
5369 }
5370}

◆ handleStickMapperScreenKeys

- (void) handleStickMapperScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

3973{
3974 MyOpenGLView *gameView = [UNIVERSE gameView];
3975 GuiDisplayGen *gui = [UNIVERSE gui];
3976
3977 [self stickMapperInputHandler: gui view: gameView];
3978 leftRightKeyPressed = [self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up] || [self checkKeyPress:n_key_gui_page_down];
3980 {
3981 NSString *key = [gui keyForRow: [gui selectedRow]];
3982 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
3983 {
3984 key = [gui keyForRow:GUI_ROW_FUNCEND];
3985 }
3986 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
3987 {
3988 key = [gui keyForRow:GUI_ROW_FUNCSTART];
3989 }
3990 int from_function = 0;
3991 NSArray *keyComponents = [key componentsSeparatedByString:@":"];
3992 if ([keyComponents count] > 1)
3993 {
3994 from_function = [keyComponents oo_intAtIndex:1];
3995 if (from_function < 0) from_function = 0;
3996
3997 [self setGuiToStickMapperScreen:from_function resetCurrentRow: YES];
3998 if ([[UNIVERSE gui] selectedRow] < GUI_ROW_FUNCSTART)
3999 {
4000 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART];
4001 }
4002 if (from_function == 0)
4003 {
4004 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART + MAX_ROWS_FUNCTIONS - 1];
4005 }
4006 }
4007 }
4008 if([gameView isDown:' ']) [self setGuiToGameOptionsScreen];
4009}

◆ handleUndockControl

- (void) handleUndockControl
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

4917{
4918 // FIXME: should this not be in leaveDock:? (Note: leaveDock: is also called from script method launchFromStation and -[StationEntity becomeExplosion]) -- Ahruman 20080308
4919 [UNIVERSE setUpUniverseFromStation]; // player pre-launch
4920 if ([self dockedStation] == nil) [self setDockedAtMainStation];
4921
4922 StationEntity *dockedStation = [self dockedStation];
4923 if (dockedStation == [UNIVERSE station] && [UNIVERSE autoSaveNow] && !([[UNIVERSE sun] goneNova] || [[UNIVERSE sun] willGoNova]))
4924 {
4925 [self autosavePlayer];
4926 }
4927 [self launchFromStation];
4928}

◆ hasHostileTarget

- (BOOL) hasHostileTarget
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11860{
11861 ShipEntity *playersTarget = [self primaryTarget];
11863}

◆ hasOneEquipmentItem:includeMissiles:

- (BOOL) hasOneEquipmentItem: (NSString *)  itemKey
includeMissiles: (BOOL includeMissiles 
implementation

Definition at line 9242 of file PlayerEntity.m.

11752{
11753 // Check basic equipment the normal way.
11755
11756 // Custom handling for player missiles.
11757 if (includeMissiles)
11758 {
11759 unsigned i;
11760 for (i = 0; i < max_missiles; i++)
11761 {
11763 }
11764 }
11765
11766 if ([itemKey isEqualToString:@"EQ_TRUMBLE"])
11767 {
11768 return [self trumbleCount] > 0;
11769 }
11770
11771 return NO;
11772}

◆ hasPrimaryWeapon:

- (BOOL) hasPrimaryWeapon: (OOWeaponType weaponType
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11776{
11777 if ([[forward_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11778 [[aft_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11779 [[port_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11780 [[starboard_weapon_type identifier] isEqualToString:[weaponType identifier]])
11781 {
11782 return YES;
11783 }
11784
11785 return [super hasPrimaryWeapon:weaponType];
11786}
OOEquipmentType * OOWeaponType
Definition ShipEntity.h:168

◆ hasSufficientFuelForJump

- (BOOL) hasSufficientFuelForJump

Definition at line 13727 of file PlayerEntity.m.

7517{
7518 return fuel >= [self fuelRequiredForJump];
7519}

◆ highlightEquipShipScreenKey:

- (void) highlightEquipShipScreenKey: (NSString *)  key

Definition at line 9242 of file PlayerEntity.m.

9245 :(NSString *)key
9246{
9247 int i=0;
9248 OOGUIRow row;
9249 NSString *otherKey = @"";
9250 GuiDisplayGen *gui = [UNIVERSE gui];
9251 [last_outfitting_key release];
9252 last_outfitting_key = [key copy];
9253 [self setGuiToEquipShipScreen:-1];
9254 key = last_outfitting_key;
9255 // TODO: redo the equipShipScreen in a way that isn't broken. this whole method 'works'
9256 // based on the way setGuiToEquipShipScreen 'worked' on 20090913 - Kaks
9257
9258 // setGuiToEquipShipScreen doesn't take a page number, it takes an offset from the beginning
9259 // of the dictionary, the first line will show the key at that offset...
9260
9261 // try the last page first - 10 pages max.
9262 while (otherKey)
9263 {
9264 [self setGuiToEquipShipScreen:i];
9266 {
9267 otherKey = [gui keyForRow:row];
9268 if (!otherKey)
9269 {
9270 [self setGuiToEquipShipScreen:0];
9271 return;
9272 }
9273 if ([otherKey isEqualToString:key])
9274 {
9275 [gui setSelectedRow:row];
9276 [self showInformationForSelectedUpgrade];
9277 return;
9278 }
9279 }
9280 if ([otherKey hasPrefix:@"More:"])
9281 {
9282 i = [[otherKey componentsSeparatedByString:@":"] oo_intAtIndex:1];
9283 }
9284 else
9285 {
9286 [self setGuiToEquipShipScreen:0];
9287 return;
9288 }
9289 }
9290}
@ GUI_MAX_ROWS_EQUIPMENT
@ GUI_ROW_EQUIPMENT_START
static NSString * last_outfitting_key

◆ homeInfoSystem

- (void) homeInfoSystem

Definition at line 13727 of file PlayerEntity.m.

861{
862 [self setInfoSystemID: system_id moveChart: YES];
863 return;
864}

◆ hud

- (HeadUpDisplay *) hud

◆ hwToString:

- (NSString *) hwToString: (int hwFlags
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

571 : (int)hwFlags
572{
573 NSString *hwString;
574 switch(hwFlags)
575 {
576 case HW_AXIS:
577 hwString = @"axis";
578 break;
579 case HW_BUTTON:
580 hwString = @"button";
581 break;
582 default:
583 hwString = @"axis/button";
584 }
585 return hwString;
586}

◆ hyperspaceJumpDistance

- (double) hyperspaceJumpDistance
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

7504{
7507}
OOSystemID nextHopTargetSystemID()
OOINLINE double distanceBetweenPlanetPositions(int x1, int y1, int x2, int y2) INLINE_CONST_FUNC

◆ hyperspeedEngaged

- (BOOL) hyperspeedEngaged

Definition at line 13727 of file PlayerEntity.m.

3761{
3762 return hyperspeed_engaged;
3763}

◆ hyperspeedFactor

- (GLfloat) hyperspeedFactor

◆ increaseContractReputation:

- (void) increaseContractReputation: (unsigned amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

696 :(unsigned)amount
697{
698 int good = [reputation oo_intForKey:CONTRACTS_GOOD_KEY];
699 int bad = [reputation oo_intForKey:CONTRACTS_BAD_KEY];
700 int unknown = [reputation oo_intForKey:CONTRACTS_UNKNOWN_KEY];
701
702 for (unsigned i=0;i<amount;i++)
703 {
704 if (bad > 0)
705 {
706 // shift a bean from bad to unknown
707 bad--;
708 if (unknown < MAX_CONTRACT_REP)
709 unknown++;
710 }
711 else
712 {
713 // shift a bean from unknown to good
714 if (unknown > 0)
715 unknown--;
716 if (good < MAX_CONTRACT_REP)
717 good++;
718 }
719 }
720 [reputation oo_setInteger:good forKey:CONTRACTS_GOOD_KEY];
721 [reputation oo_setInteger:bad forKey:CONTRACTS_BAD_KEY];
722 [reputation oo_setInteger:unknown forKey:CONTRACTS_UNKNOWN_KEY];
723}

◆ increaseParcelReputation:

- (void) increaseParcelReputation: (unsigned amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

621 :(unsigned)amount
622{
623 int good = [reputation oo_intForKey:PARCEL_GOOD_KEY];
624 int bad = [reputation oo_intForKey:PARCEL_BAD_KEY];
625 int unknown = [reputation oo_intForKey:PARCEL_UNKNOWN_KEY];
626
627 for (unsigned i=0;i<amount;i++)
628 {
629 if (bad > 0)
630 {
631 // shift a bean from bad to unknown
632 bad--;
633 if (unknown < MAX_CONTRACT_REP)
634 unknown++;
635 }
636 else
637 {
638 // shift a bean from unknown to good
639 if (unknown > 0)
640 unknown--;
641 if (good < MAX_CONTRACT_REP)
642 good++;
643 }
644 }
645 [reputation oo_setInteger:good forKey:PARCEL_GOOD_KEY];
646 [reputation oo_setInteger:bad forKey:PARCEL_BAD_KEY];
647 [reputation oo_setInteger:unknown forKey:PARCEL_UNKNOWN_KEY];
648}

◆ increasePassengerReputation:

- (void) increasePassengerReputation: (unsigned amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

546 :(unsigned)amount
547{
548 int good = [reputation oo_intForKey:PASSAGE_GOOD_KEY];
549 int bad = [reputation oo_intForKey:PASSAGE_BAD_KEY];
550 int unknown = [reputation oo_intForKey:PASSAGE_UNKNOWN_KEY];
551
552 for (unsigned i=0;i<amount;i++)
553 {
554 if (bad > 0)
555 {
556 // shift a bean from bad to unknown
557 bad--;
558 if (unknown < MAX_CONTRACT_REP)
559 unknown++;
560 }
561 else
562 {
563 // shift a bean from unknown to good
564 if (unknown > 0)
565 unknown--;
566 if (good < MAX_CONTRACT_REP)
567 good++;
568 }
569 }
570 [reputation oo_setInteger:good forKey:PASSAGE_GOOD_KEY];
571 [reputation oo_setInteger:bad forKey:PASSAGE_BAD_KEY];
572 [reputation oo_setInteger:unknown forKey:PASSAGE_UNKNOWN_KEY];
573}

◆ increment:

- (void) increment: (NSString *)  missionVariableString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1752 :(NSString *)missionVariableString
1753{
1754 BOOL hasMissionPrefix, hasLocalPrefix;
1755 int value = 0;
1756
1757 hasMissionPrefix = [missionVariableString hasPrefix:@"mission_"];
1758 hasLocalPrefix = [missionVariableString hasPrefix:@"local_"];
1759
1760 if (hasMissionPrefix)
1761 {
1762 value = [[self missionVariableForKey:missionVariableString] intValue];
1763 value++;
1764 [self setMissionVariable:[NSString stringWithFormat:@"%d", value] forKey:missionVariableString];
1765 }
1766 else if (hasLocalPrefix)
1767 {
1768 value = [[self localVariableForKey:missionVariableString andMission:sCurrentMissionKey] intValue];
1769 value++;
1770 [self setLocalVariable:[NSString stringWithFormat:@"%d", value] forKey:missionVariableString andMission:sCurrentMissionKey];
1771 }
1772 else
1773 {
1774 OOLog(kOOLogSyntaxIncrement, @"***** SCRIPT ERROR: in %@, IDENTIFIER '%@' DOES NOT BEGIN WITH 'mission_' or 'local_'", CurrentScriptDesc(), missionVariableString);
1775 }
1776}
static NSString *const kOOLogSyntaxIncrement

◆ infoSystemID

- (OOSystemID) infoSystemID

Definition at line 13727 of file PlayerEntity.m.

754{
755 return info_system_id;
756}

◆ infoSystemOnRoute

- (BOOL) infoSystemOnRoute

Definition at line 13727 of file PlayerEntity.m.

875{
876 NSArray *route = [[UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode] oo_arrayForKey: @"route"];
878 if (route == nil)
879 {
880 return NO;
881 }
882 for (i = 0; i < [route count]; i++)
883 {
885 {
886 return YES;
887 }
888 }
889 return NO;
890}

◆ init

- (id) init
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

1820{
1821 NSAssert(gOOPlayer == nil, @"Expected only one PlayerEntity to exist at a time.");
1822 return [super initBypassForPlayer];
1823}

◆ initCheckingDictionary

- (void) initCheckingDictionary

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

78{
79 NSMutableDictionary *kdicmaster = [NSMutableDictionary dictionaryWithDictionary:[ResourceManager dictionaryFromFilesNamed:@"keyconfig2.plist" inFolder:@"Config" mergeMode:MERGE_BASIC cache:NO]];
80 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
81 NSString *kbd = [defaults oo_stringForKey:@"keyboard-code" defaultValue:@"default"];
82 NSMutableDictionary *kdic = [NSMutableDictionary dictionaryWithDictionary:[kdicmaster objectForKey:kbd]];
83
84 NSUInteger i;
85 NSArray *keys = nil;
86 id key = nil;
87 NSArray *def_list = nil;
88
89 keys = [kdic allKeys];
90 for (i = 0; i < [keys count]; i++)
91 {
92 key = [keys objectAtIndex:i];
93
94 if ([[kdic objectForKey: key] isKindOfClass:[NSArray class]])
95 {
96 def_list = (NSArray*)[kdic objectForKey: key];
97 [kdic setObject:[self processKeyCode:def_list] forKey:key];
98 }
99 }
100 [kdic_check release];
101 kdic_check = [[NSDictionary alloc] initWithDictionary:kdic];
102
103 // these keys can't be used with mod keys
104 [nav_keys release];
105 nav_keys = [[NSArray alloc] initWithObjects:@"key_roll_left", @"key_roll_right", @"key_pitch_forward", @"key_pitch_back", @"key_yaw_left", @"key_yaw_right",
106 @"key_fire_lasers", @"key_gui_arrow_up", @"key_gui_arrow_down", @"key_gui_arrow_right", @"key_gui_arrow_left", nil];
107 // these keys can't be used with ctrl
108 [camera_keys release];
109 camera_keys = [[NSArray alloc] initWithObjects:@"key_custom_view_zoom_out", @"key_custom_view_zoom_in", @"key_custom_view_roll_left", @"key_custom_view_roll_right",
110 @"key_custom_view_pan_left", @"key_custom_view_pan_right", @"key_custom_view_rotate_up", @"key_custom_view_rotate_down", @"key_custom_view_pan_down",
111 @"key_custom_view_pan_up", @"key_custom_view_rotate_left", @"key_custom_view_rotate_right", nil];
112}
static NSArray * nav_keys
static NSArray * camera_keys
NSDictionary * dictionaryFromFilesNamed:inFolder:mergeMode:cache:(NSString *fileName,[inFolder] NSString *folderName,[mergeMode] OOResourceMergeMode mergeMode,[cache] BOOL useCache)

◆ initControls

- (void) initControls

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

205{
206 [keyCodeLookups release];
207 // all entries in this dict must be in lowercase
208 keyCodeLookups = [[NSDictionary alloc] initWithObjectsAndKeys:
209 [NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"arrowleft",
210 [NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"leftarrow",
211 [NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"left",
212 [NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"arrowright",
213 [NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"rightarrow",
214 [NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"right",
215 [NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"arrowup",
216 [NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"uparrow",
217 [NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"up",
218 [NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"arrowdown",
219 [NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"downarrow",
220 [NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"down",
221 [NSNumber numberWithUnsignedShort:gvPageUpKey], @"pageup",
222 [NSNumber numberWithUnsignedShort:gvPageDownKey], @"pagedown",
223 [NSNumber numberWithUnsignedShort:13], @"enter",
224 [NSNumber numberWithUnsignedShort:13], @"return",
225 [NSNumber numberWithUnsignedShort:27], @"escape",
226 [NSNumber numberWithUnsignedShort:27], @"esc",
227 [NSNumber numberWithUnsignedShort:9], @"tab",
228 [NSNumber numberWithUnsignedShort:32], @"space",
229 [NSNumber numberWithUnsignedShort:32], @"spc",
230 [NSNumber numberWithUnsignedShort:gvHomeKey], @"home",
231 [NSNumber numberWithUnsignedShort:gvEndKey], @"end",
232 [NSNumber numberWithUnsignedShort:gvDeleteKey], @"delete",
233 [NSNumber numberWithUnsignedShort:gvDeleteKey], @"del",
234 [NSNumber numberWithUnsignedShort:gvBackspaceKey], @"backspace",
235 [NSNumber numberWithUnsignedShort:gvBackspaceKey], @"backspc",
236 [NSNumber numberWithUnsignedShort:gvBackspaceKey], @"bkspace",
237 [NSNumber numberWithUnsignedShort:gvBackspaceKey], @"bkspc",
238 [NSNumber numberWithUnsignedShort:gvInsertKey], @"insert",
239 [NSNumber numberWithUnsignedShort:gvInsertKey], @"ins",
240 [NSNumber numberWithUnsignedShort:gvFunctionKey1], @"f1",
241 [NSNumber numberWithUnsignedShort:gvFunctionKey2], @"f2",
242 [NSNumber numberWithUnsignedShort:gvFunctionKey3], @"f3",
243 [NSNumber numberWithUnsignedShort:gvFunctionKey4], @"f4",
244 [NSNumber numberWithUnsignedShort:gvFunctionKey5], @"f5",
245 [NSNumber numberWithUnsignedShort:gvFunctionKey6], @"f6",
246 [NSNumber numberWithUnsignedShort:gvFunctionKey7], @"f7",
247 [NSNumber numberWithUnsignedShort:gvFunctionKey8], @"f8",
248 [NSNumber numberWithUnsignedShort:gvFunctionKey9], @"f9",
249 [NSNumber numberWithUnsignedShort:gvFunctionKey10], @"f10",
250 [NSNumber numberWithUnsignedShort:gvFunctionKey11], @"f11",
251 [NSNumber numberWithUnsignedShort:gvPauseKey], @"pause",
252 [NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"printscreen",
253 [NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prtscrn",
254 [NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prntscrn",
255 [NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prtscn",
256 [NSNumber numberWithUnsignedShort:gvNumberPadKey0], @"numpad0",
257 [NSNumber numberWithUnsignedShort:gvNumberPadKey1], @"numpad1",
258 [NSNumber numberWithUnsignedShort:gvNumberPadKey2], @"numpad2",
259 [NSNumber numberWithUnsignedShort:gvNumberPadKey3], @"numpad3",
260 [NSNumber numberWithUnsignedShort:gvNumberPadKey4], @"numpad4",
261 [NSNumber numberWithUnsignedShort:gvNumberPadKey5], @"numpad5",
262 [NSNumber numberWithUnsignedShort:gvNumberPadKey6], @"numpad6",
263 [NSNumber numberWithUnsignedShort:gvNumberPadKey7], @"numpad7",
264 [NSNumber numberWithUnsignedShort:gvNumberPadKey8], @"numpad8",
265 [NSNumber numberWithUnsignedShort:gvNumberPadKey9], @"numpad9",
266 [NSNumber numberWithUnsignedShort:gvNumberPadKeyDivide], @"numpad/",
267 [NSNumber numberWithUnsignedShort:gvNumberPadKeyDivide], @"numpaddivide",
268 [NSNumber numberWithUnsignedShort:gvNumberPadKeyMultiply], @"numpad*",
269 [NSNumber numberWithUnsignedShort:gvNumberPadKeyMultiply], @"numpadmultiply",
270 [NSNumber numberWithUnsignedShort:gvNumberPadKeyMinus], @"numpad-",
271 [NSNumber numberWithUnsignedShort:gvNumberPadKeyMinus], @"numpadminus",
272 [NSNumber numberWithUnsignedShort:gvNumberPadKeyPlus], @"numpad+",
273 [NSNumber numberWithUnsignedShort:gvNumberPadKeyPlus], @"numpadplus",
274 [NSNumber numberWithUnsignedShort:gvNumberPadKeyPeriod], @"numpad.",
275 [NSNumber numberWithUnsignedShort:gvNumberPadKeyPeriod], @"numpadperiod",
276 [NSNumber numberWithUnsignedShort:gvNumberPadKeyEquals], @"numpad=",
277 [NSNumber numberWithUnsignedShort:gvNumberPadKeyEquals], @"numpadequals",
278 [NSNumber numberWithUnsignedShort:gvNumberPadKeyEnter], @"numpadenter", nil];
279
280 keyShiftText = [DESC(@"oolite-keyconfig-shift") retain];
281 keyMod1Text = [DESC(@"oolite-keyconfig-mod1") retain];
282#if OOLITE_MAC_OS_X
283 keyMod2Text = [DESC(@"oolite-keyconfig-mod2-mac") retain];
284#else
285 keyMod2Text = [DESC(@"oolite-keyconfig-mod2-pc") retain];
286#endif
287
288 [self initKeyConfigSettings];
289
290 // Enable polling
291 pollControls=YES;
292}

◆ initialiseMissionDestinations:andLegacy:

- (void) initialiseMissionDestinations: (NSDictionary *)  destinations
andLegacy: (NSArray *)  legacy 

Definition at line 9242 of file PlayerEntity.m.

13276{
13277 NSString *key = nil;
13278 id value = nil;
13279
13280 /* same need to make inner objects mutable as in localPlanetInfoOverrides */
13281
13282 [missionDestinations release];
13283 missionDestinations = [[NSMutableDictionary alloc] init];
13284
13286 {
13287 value = [destinations objectForKey:key];
13288 if (value != nil)
13289 {
13290 if ([value isKindOfClass:[NSDictionary class]])
13291 {
13292 value = [value mutableCopy];
13293 [missionDestinations setObject:value forKey:key];
13294 [value release];
13295 }
13296 }
13297 }
13298
13299 if (legacy != nil)
13300 {
13303 foreach (legacyMarker, legacy)
13304 {
13305 dest = [legacyMarker intValue];
13306 [self addMissionDestinationMarker:[self defaultMarker:dest]];
13307 }
13308 }
13309
13310}
#define foreachkey(VAR, DICT)
Definition OOCocoa.h:353

◆ initKeyConfigSettings

- (void) initKeyConfigSettings

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

295{
296 NSMutableDictionary *kdicmaster = [NSMutableDictionary dictionaryWithDictionary:[ResourceManager dictionaryFromFilesNamed:@"keyconfig2.plist" inFolder:@"Config" mergeMode:MERGE_BASIC cache:NO]];
297 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
298 NSString *kbd = [defaults oo_stringForKey:@"keyboard-code" defaultValue:@"default"];
299 NSMutableDictionary *kdic2 = [NSMutableDictionary dictionaryWithDictionary:[kdicmaster objectForKey:kbd]];
300
301 unsigned i;
302 NSArray *keys = nil;
303 id key = nil;
304 NSArray *def_list = nil;
305
306 keys = [kdic2 allKeys];
307 for (i = 0; i < [keys count]; i++)
308 {
309 key = [keys objectAtIndex:i];
310 if ([[kdic2 objectForKey:key] isKindOfClass:[NSArray class]])
311 {
312 def_list = (NSArray*)[kdic2 objectForKey: key];
313 [kdic2 setObject:[self processKeyCode:def_list] forKey:key];
314 }
315 }
316
317 // load custom equipment keys/buttons
318 [customEquipActivation release];
319 if ([defaults objectForKey:KEYCONFIG_CUSTOMEQUIP])
320 {
321 NSArray *temp = [defaults arrayForKey:KEYCONFIG_CUSTOMEQUIP];
322 customEquipActivation = [[NSMutableArray arrayWithArray:temp] retain];
323 }
324 else
325 {
326 customEquipActivation = [[NSMutableArray alloc] init];
327 }
328 [customActivatePressed release];
329 [customModePressed release];
330 customActivatePressed = [[NSMutableArray alloc] init];
331 customModePressed = [[NSMutableArray alloc] init];
332 for (i = 0; i < [customEquipActivation count]; i++)
333 {
334 [customActivatePressed addObject:[NSNumber numberWithBool:NO]];
335 [customModePressed addObject:[NSNumber numberWithBool:NO]];
336 }
337
338 NSMutableArray *keyDef = nil;
339 NSString *lookup = nil;
340 NSArray *curr = nil;
341 NSDictionary *key1 = nil;
342 NSDictionary *key2 = nil;
343
344 // update with overrides from defaults file
345 NSDictionary *dict = [defaults objectForKey:KEYCONFIG_OVERRIDES];
346
347 keys = [dict allKeys];
348 for (i = 0; i < [keys count]; i++)
349 {
350 key = [keys objectAtIndex:i];
351 [kdic2 setObject:[dict objectForKey:key] forKey:key];
352 }
353
354// by default none of the standard key functions require more than 2 entries, so our macro will limit itself to 2
355// also, none of the standard key functions utilise "Alt" (mod2), so we're defaulting that setting
356#define LOAD_KEY_SETTING2(name, default_1, shift_1, mod1_1, default_2, shift_2, mod1_2) \
357 lookup = [@#name substringFromIndex:2]; \
358 curr = (NSArray*)[[kdic2 objectForKey:lookup] copy]; \
359 key1 = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:default_1], @"key", [NSNumber numberWithBool:shift_1], @"shift", [NSNumber numberWithBool:mod1_1], @"mod1", [NSNumber numberWithBool:NO], @"mod2", nil]; \
360 [keyDef addObject:key1]; \
361 if (default_2 > 0) \
362 { \
363 key2 = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:default_2], @"key", [NSNumber numberWithBool:shift_2], @"shift", [NSNumber numberWithBool:mod1_2], @"mod1", [NSNumber numberWithBool:NO], @"mod2", nil]; \
364 [keyDef addObject:key2]; \
365 } \
366 name = curr?:keyDef; \
367 [kdic2 setObject:curr?:keyDef forKey:lookup]; \
368 [keyDef release];
369
370 LOAD_KEY_SETTING2(n_key_roll_left, gvArrowKeyLeft, NO, NO, 0, NO, NO);
371 LOAD_KEY_SETTING2(n_key_roll_right, gvArrowKeyRight, NO, NO, 0, NO, NO);
372 LOAD_KEY_SETTING2(n_key_pitch_forward, gvArrowKeyUp, NO, NO, 0, NO, NO);
373 LOAD_KEY_SETTING2(n_key_pitch_back, gvArrowKeyDown, NO, NO, 0, NO, NO);
374 LOAD_KEY_SETTING2(n_key_yaw_left, ',', NO, NO, 0, NO, NO);
375 LOAD_KEY_SETTING2(n_key_yaw_right, '.', NO, NO, 0, NO, NO);
376
377 LOAD_KEY_SETTING2(n_key_view_forward, '1', NO, NO, gvFunctionKey1, NO, NO);
378 LOAD_KEY_SETTING2(n_key_view_aft, '2', NO, NO, gvFunctionKey2, NO, NO);
379 LOAD_KEY_SETTING2(n_key_view_port, '3', NO, NO, gvFunctionKey3, NO, NO);
380 LOAD_KEY_SETTING2(n_key_view_starboard, '4', NO, NO, gvFunctionKey4, NO, NO);
381
382 LOAD_KEY_SETTING2(n_key_launch_ship, '1', NO, NO, gvFunctionKey1, NO, NO);
383 LOAD_KEY_SETTING2(n_key_gui_screen_options, '2', NO, NO, gvFunctionKey2, NO, NO);
384 LOAD_KEY_SETTING2(n_key_gui_screen_equipship, '3', NO, NO, gvFunctionKey3, NO, NO);
385 LOAD_KEY_SETTING2(n_key_gui_screen_interfaces, '4', NO, NO, gvFunctionKey4, NO, NO);
386 LOAD_KEY_SETTING2(n_key_gui_screen_status, '5', NO, NO, gvFunctionKey5, NO, NO);
387 LOAD_KEY_SETTING2(n_key_gui_chart_screens, '6', NO, NO, gvFunctionKey6, NO, NO);
388 LOAD_KEY_SETTING2(n_key_gui_system_data, '7', NO, NO, gvFunctionKey7, NO, NO);
389 LOAD_KEY_SETTING2(n_key_gui_market, '8', NO, NO, gvFunctionKey8, NO, NO);
390
391 LOAD_KEY_SETTING2(n_key_gui_arrow_left, gvArrowKeyLeft, NO, NO, 0, NO, NO);
392 LOAD_KEY_SETTING2(n_key_gui_arrow_right, gvArrowKeyRight, NO, NO, 0, NO, NO);
393 LOAD_KEY_SETTING2(n_key_gui_arrow_up, gvArrowKeyUp, NO, NO, 0, NO, NO);
394 LOAD_KEY_SETTING2(n_key_gui_arrow_down, gvArrowKeyDown, NO, NO, 0, NO, NO);
395 LOAD_KEY_SETTING2(n_key_gui_page_up, gvPageUpKey, NO, NO, 0, NO, NO);
396 LOAD_KEY_SETTING2(n_key_gui_page_down, gvPageDownKey, NO, NO, 0, NO, NO);
397 LOAD_KEY_SETTING2(n_key_gui_select, 13, NO, NO, gvNumberPadKeyEnter, NO, NO);
398
399 LOAD_KEY_SETTING2(n_key_increase_speed, 'w', NO, NO, 0, NO, NO);
400 LOAD_KEY_SETTING2(n_key_decrease_speed, 's', NO, NO, 0, NO, NO);
401 LOAD_KEY_SETTING2(n_key_inject_fuel, 'i', NO, NO, 0, NO, NO);
402
403 LOAD_KEY_SETTING2(n_key_fire_lasers, 'a', NO, NO, 0, NO, NO);
404 LOAD_KEY_SETTING2(n_key_weapons_online_toggle, '_', YES, NO, 0, NO, NO);
405 LOAD_KEY_SETTING2(n_key_launch_missile, 'm', NO, NO, 0, NO, NO);
406 LOAD_KEY_SETTING2(n_key_next_missile, 'y', NO, NO, 0, NO, NO);
407 LOAD_KEY_SETTING2(n_key_ecm, 'e', NO, NO, 0, NO, NO);
408
409 LOAD_KEY_SETTING2(n_key_prime_next_equipment, 'N', YES, NO, 0, NO, NO);
410 LOAD_KEY_SETTING2(n_key_prime_previous_equipment, 'N', YES, YES, 0, NO, NO);
411 LOAD_KEY_SETTING2(n_key_activate_equipment, 'n', NO, NO, 0, NO, NO);
412 LOAD_KEY_SETTING2(n_key_mode_equipment, 'b', NO, NO, 0, NO, NO);
413 LOAD_KEY_SETTING2(n_key_fastactivate_equipment_a, '0', NO, NO, 0, NO, NO);
414 LOAD_KEY_SETTING2(n_key_fastactivate_equipment_b, 9, NO, NO, 0, NO, NO);
415
416 LOAD_KEY_SETTING2(n_key_target_missile, 't', NO, NO, 0, NO, NO);
417 LOAD_KEY_SETTING2(n_key_untarget_missile, 'u', NO, NO, 0, NO, NO);
418 LOAD_KEY_SETTING2(n_key_target_incoming_missile, 'T', YES, NO, 0, NO, NO);
419 LOAD_KEY_SETTING2(n_key_ident_system, 'r', NO, NO, 0, NO, NO);
420
421 LOAD_KEY_SETTING2(n_key_scanner_zoom, 'z', NO, NO, 0, NO, NO);
422 LOAD_KEY_SETTING2(n_key_scanner_unzoom, 'Z', YES, NO, 0, NO, NO);
423
424 LOAD_KEY_SETTING2(n_key_launch_escapepod, 27, NO, NO, 0, NO, NO);
425
426 LOAD_KEY_SETTING2(n_key_galactic_hyperspace, 'g', NO, NO, 0, NO, NO);
427 LOAD_KEY_SETTING2(n_key_hyperspace, 'h', NO, NO, 0, NO, NO);
428 LOAD_KEY_SETTING2(n_key_jumpdrive, 'j', NO, NO, 0, NO, NO);
429
430 LOAD_KEY_SETTING2(n_key_dump_cargo, 'D', YES, NO, 0, NO, NO);
431 LOAD_KEY_SETTING2(n_key_rotate_cargo, 'R', YES, NO, 0, NO, NO);
432
433 LOAD_KEY_SETTING2(n_key_autopilot, 'c', NO, NO, 0, NO, NO);
434 LOAD_KEY_SETTING2(n_key_autodock, 'C', YES, NO, 0, NO, NO);
435 LOAD_KEY_SETTING2(n_key_docking_clearance_request, 'L', YES, NO, 0, NO, NO);
436
437 LOAD_KEY_SETTING2(n_key_snapshot, '*', YES, NO, gvNumberPadKeyMultiply, NO, NO);
438 LOAD_KEY_SETTING2(n_key_docking_music, 's', NO, NO, 0, NO, NO);
439
440 LOAD_KEY_SETTING2(n_key_advanced_nav_array_next, '^', YES, NO, 0, NO, NO);
441 LOAD_KEY_SETTING2(n_key_advanced_nav_array_previous, '^', YES, YES, 0, NO, NO);
442 LOAD_KEY_SETTING2(n_key_map_home, gvHomeKey, NO, NO, 0, NO, NO);
443 LOAD_KEY_SETTING2(n_key_map_end, gvEndKey, NO, NO, 0, NO, NO);
444 LOAD_KEY_SETTING2(n_key_map_next_system, gvArrowKeyRight, NO, NO, gvArrowKeyDown, NO, NO);
445 LOAD_KEY_SETTING2(n_key_map_previous_system, gvArrowKeyLeft, NO, NO, gvArrowKeyUp, NO, NO);
446 LOAD_KEY_SETTING2(n_key_map_zoom_in, gvPageDownKey, NO, NO, 0, NO, NO);
447 LOAD_KEY_SETTING2(n_key_map_zoom_out, gvPageUpKey, NO, NO, 0, NO, NO);
448 LOAD_KEY_SETTING2(n_key_map_info, 'i', NO, NO, 0, NO, NO);
449 LOAD_KEY_SETTING2(n_key_chart_highlight, '?', YES, NO, 0, NO, NO);
450
451 LOAD_KEY_SETTING2(n_key_system_home, gvHomeKey, NO, NO, 0, NO, NO);
452 LOAD_KEY_SETTING2(n_key_system_end, gvEndKey, NO, NO, 0, NO, NO);
453 LOAD_KEY_SETTING2(n_key_system_next_system, gvArrowKeyRight, NO, NO, gvArrowKeyDown, NO, NO);
454 LOAD_KEY_SETTING2(n_key_system_previous_system, gvArrowKeyLeft, NO, NO, gvArrowKeyUp, NO, NO);
455
456 LOAD_KEY_SETTING2(n_key_pausebutton, 'p', NO, NO, 0, NO, NO);
457 LOAD_KEY_SETTING2(n_key_show_fps, 'F', YES, NO, 0, NO, NO);
458 LOAD_KEY_SETTING2(n_key_bloom_toggle, gvFunctionKey9, YES, NO, 0, NO, NO);
459 LOAD_KEY_SETTING2(n_key_mouse_control_roll, 'M', YES, NO, 0, NO, NO);
460 LOAD_KEY_SETTING2(n_key_mouse_control_yaw, 'M', YES, YES, 0, NO, NO);
461 LOAD_KEY_SETTING2(n_key_hud_toggle, 'o', NO, NO, 0, NO, NO);
462
463 LOAD_KEY_SETTING2(n_key_comms_log, '`', YES, NO, 0, NO, NO);
464 LOAD_KEY_SETTING2(n_key_prev_compass_mode, '|', YES, NO, 0, NO, NO);
465 LOAD_KEY_SETTING2(n_key_next_compass_mode, '\\', NO, NO, 0, NO, NO);
466
467 LOAD_KEY_SETTING2(n_key_market_filter_cycle, '?', YES, NO, 0, NO, NO);
468 LOAD_KEY_SETTING2(n_key_market_sorter_cycle, '/', NO, NO, gvNumberPadKeyDivide, NO, NO);
469 LOAD_KEY_SETTING2(n_key_market_buy_one, gvArrowKeyRight, NO, NO, 0, NO, NO);
470 LOAD_KEY_SETTING2(n_key_market_sell_one, gvArrowKeyLeft, NO, NO, 0, NO, NO);
471 LOAD_KEY_SETTING2(n_key_market_buy_max, gvArrowKeyRight, YES, NO, 0, NO, NO);
472 LOAD_KEY_SETTING2(n_key_market_sell_max, gvArrowKeyLeft, YES, NO, 0, NO, NO);
473
474 LOAD_KEY_SETTING2(n_key_cycle_next_mfd, ';', NO, NO, 0, NO, NO);
475 LOAD_KEY_SETTING2(n_key_cycle_previous_mfd, ';', NO, YES, 0, NO, NO);
476 LOAD_KEY_SETTING2(n_key_switch_next_mfd, ':', YES, NO, 0, NO, NO);
477 LOAD_KEY_SETTING2(n_key_switch_previous_mfd, ':', YES, YES, 0, NO, NO);
478
479 LOAD_KEY_SETTING2(n_key_next_target, '+', YES, NO, gvNumberPadKeyPlus, NO, NO);
480 LOAD_KEY_SETTING2(n_key_previous_target, '-', NO, NO, gvNumberPadKeyMinus, NO, NO);
481
482 LOAD_KEY_SETTING2(n_key_custom_view, 'v', NO, NO, 0, NO, NO);
483 LOAD_KEY_SETTING2(n_key_custom_view_zoom_out, gvPageDownKey, NO, NO, 0, NO, NO);
484 LOAD_KEY_SETTING2(n_key_custom_view_zoom_in, gvPageUpKey, NO, NO, 0, NO, NO);
485 LOAD_KEY_SETTING2(n_key_custom_view_roll_left, gvArrowKeyLeft, NO, NO, 0, NO, NO);
486 LOAD_KEY_SETTING2(n_key_custom_view_pan_left, gvArrowKeyLeft, YES, NO, 0, NO, NO);
487 LOAD_KEY_SETTING2(n_key_custom_view_roll_right, gvArrowKeyRight, NO, NO, 0, NO, NO);
488 LOAD_KEY_SETTING2(n_key_custom_view_pan_right, gvArrowKeyRight, YES, NO, 0, NO, NO);
489 LOAD_KEY_SETTING2(n_key_custom_view_rotate_up, gvArrowKeyUp, NO, NO, 0, NO, NO);
490 LOAD_KEY_SETTING2(n_key_custom_view_pan_up, gvArrowKeyUp, YES, NO, 0, NO, NO);
491 LOAD_KEY_SETTING2(n_key_custom_view_rotate_down, gvArrowKeyDown, NO, NO, 0, NO, NO);
492 LOAD_KEY_SETTING2(n_key_custom_view_pan_down, gvArrowKeyDown, YES, NO, 0, NO, NO);
493 LOAD_KEY_SETTING2(n_key_custom_view_rotate_left, ',', NO, NO, 0, NO, NO);
494 LOAD_KEY_SETTING2(n_key_custom_view_rotate_right, '.', NO, NO, 0, NO, NO);
495
496 LOAD_KEY_SETTING2(n_key_oxzmanager_setfilter, 'f', NO, NO, 0, NO, NO);
497 LOAD_KEY_SETTING2(n_key_oxzmanager_showinfo, 'i', NO, NO, 0, NO, NO);
498 LOAD_KEY_SETTING2(n_key_oxzmanager_extract, 'x', NO, NO, 0, NO, NO);
499
500#if OO_FOV_INFLIGHT_CONTROL_ENABLED
501 LOAD_KEY_SETTING2(n_key_inc_field_of_view, 'l', NO, NO, 0, NO, NO);
502 LOAD_KEY_SETTING2(n_key_dec_field_of_view, 'k', NO, NO, 0, NO, NO);
503#endif
504
505#ifndef NDEBUG
506 LOAD_KEY_SETTING2(n_key_dump_target_state, 'H', YES, NO, 0, NO, NO);
507 LOAD_KEY_SETTING2(n_key_dump_entity_list, '0', NO, NO, 0, NO, NO);
508 LOAD_KEY_SETTING2(n_key_debug_full, 'd', NO, NO, 0, NO, NO);
509 LOAD_KEY_SETTING2(n_key_debug_collision, 'b', NO, NO, 0, NO, NO);
510 LOAD_KEY_SETTING2(n_key_debug_console_connect, 'c', NO, NO, 0, NO, NO);
511 LOAD_KEY_SETTING2(n_key_debug_bounding_boxes, 'x', NO, NO, 0, NO, NO);
512 LOAD_KEY_SETTING2(n_key_debug_shaders, 's', NO, NO, 0, NO, NO);
513 LOAD_KEY_SETTING2(n_key_debug_off, 'n', NO, NO, 0, NO, NO);
514#endif
515
516 [keyconfig2_settings release];
517 keyconfig2_settings = [[NSDictionary alloc] initWithDictionary:kdic2 copyItems:YES];
518}
@ gvNumberPadKeyDivide
@ gvNumberPadKeyMultiply
@ gvFunctionKey2
@ gvNumberPadKeyPlus
@ gvFunctionKey5
@ gvArrowKeyDown
@ gvFunctionKey9
@ gvFunctionKey4
@ gvEndKey
@ gvHomeKey
@ gvNumberPadKeyEnter
@ gvNumberPadKeyMinus
@ gvFunctionKey8
@ gvPageDownKey
@ gvFunctionKey3
@ gvArrowKeyUp
@ gvArrowKeyRight
@ gvFunctionKey6
@ gvArrowKeyLeft
@ gvFunctionKey7
@ gvPageUpKey
@ gvFunctionKey1
#define LOAD_KEY_SETTING2(name, default_1, shift_1, mod1_1, default_2, shift_2, mod1_2)
#define KEYCONFIG_CUSTOMEQUIP

◆ injectorsEngaged

- (BOOL) injectorsEngaged

Definition at line 13727 of file PlayerEntity.m.

3755{
3756 return afterburner_engaged;
3757}

◆ insideAtmosphereFraction

- (GLfloat) insideAtmosphereFraction

Definition at line 13727 of file PlayerEntity.m.

2592{
2593 GLfloat insideAtmoFrac = 0.0f;
2594
2595 if ([UNIVERSE airResistanceFactor] > 0.01) // player is inside planetary atmosphere
2596 {
2598 }
2599
2600 return insideAtmoFrac;
2601}
#define ATMOSPHERE_DEPTH
GLfloat dialAltitude()

◆ installedEnergyUnitType

- (OOEnergyUnitType) installedEnergyUnitType

Definition at line 13727 of file PlayerEntity.m.

6144{
6145 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"]) return ENERGY_UNIT_NAVAL;
6146 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"]) return ENERGY_UNIT_NORMAL;
6147 return ENERGY_UNIT_NONE;
6148}

◆ interpretAIMessage:

- (void) interpretAIMessage: (NSString *)  ms
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

5867 :(NSString *)ms
5868{
5869 if ([ms isEqual:@"HOLD_FULL"])
5870 {
5871 [self playHoldFull];
5872 [UNIVERSE addMessage:DESC(@"hold-full") forCount:4.5];
5873 }
5874
5875 if ([ms isEqual:@"INCOMING_MISSILE"])
5876 {
5877 if ([self primaryAggressor] != nil)
5878 {
5879 [self playIncomingMissile:HPVectorToVector([[self primaryAggressor] position])];
5880 }
5881 else
5882 {
5883 [self playIncomingMissile:kZeroVector];
5884 }
5885 [UNIVERSE addMessage:DESC(@"incoming-missile") forCount:4.5];
5886 }
5887
5888 if ([ms isEqual:@"ENERGY_LOW"])
5889 {
5890 [UNIVERSE addMessage:DESC(@"energy-low") forCount:6.0];
5891 }
5892
5893 if ([ms isEqual:@"ECM"] && ![self isDocked]) [self playHitByECMSound];
5894
5895 if ([ms isEqual:@"DOCKING_REFUSED"] && [self status] == STATUS_AUTOPILOT_ENGAGED)
5896 {
5897 [self playDockingDenied];
5898 [UNIVERSE addMessage:DESC(@"autopilot-denied") forCount:4.5];
5900 [self resetAutopilotAI];
5902 [self setStatus:STATUS_IN_FLIGHT];
5904 [self doScriptEvent:OOJSID("playerDockingRefused")];
5905 }
5906
5907 // aegis messages to advanced compass so in planet mode it behaves like the old compass
5909 {
5910 if ([ms isEqual:@"AEGIS_CLOSE_TO_MAIN_PLANET"]&&(compassMode == COMPASS_MODE_PLANET))
5911 {
5912 [self playAegisCloseToPlanet];
5913 [self setCompassMode:COMPASS_MODE_STATION];
5914 }
5915 if ([ms isEqual:@"AEGIS_IN_DOCKING_RANGE"]&&(compassMode == COMPASS_MODE_PLANET))
5916 {
5917 [self playAegisCloseToStation];
5918 [self setCompassMode:COMPASS_MODE_STATION];
5919 }
5920 if ([ms isEqual:@"AEGIS_NONE"]&&(compassMode == COMPASS_MODE_STATION))
5921 {
5922 [self setCompassMode:COMPASS_MODE_PLANET];
5923 }
5924 }
5925}

◆ isBeeping

- (BOOL) isBeeping

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

194{
195 return [sInterfaceBeepSource isPlaying];
196}

◆ isDocked

- (BOOL) isDocked

Definition at line 9242 of file PlayerEntity.m.

13103{
13105
13106 switch ([self status])
13107 {
13108 case STATUS_DOCKED:
13109 case STATUS_DOCKING:
13110 case STATUS_START_GAME:
13112 break;
13113 // special case - can be either docked or not, so avoid safety check below
13115 return NO;
13116 case STATUS_EFFECT:
13117 case STATUS_ACTIVE:
13119 case STATUS_TEST:
13120 case STATUS_INACTIVE:
13121 case STATUS_DEAD:
13122 case STATUS_IN_FLIGHT:
13124 case STATUS_LAUNCHING:
13129 case STATUS_IN_HOLD:
13132 break;
13133 //no default, so that we get notified by the compiler if something is missing
13134 }
13135
13136#ifndef NDEBUG
13137 // Sanity check
13138 if (isDockedStatus)
13139 {
13140 if ([self dockedStation] == nil)
13141 {
13142 //there are a number of possible current statuses, not just STATUS_DOCKED
13143 OOLogERR(kOOLogInconsistentState, @"status is %@, but dockedStation is nil; treating as not docked. %@", OOStringFromEntityStatus([self status]), @"This is an internal error, please report it.");
13144 [self setStatus:STATUS_IN_FLIGHT];
13146 }
13147 }
13148 else
13149 {
13150 if ([self dockedStation] != nil && [self status] != STATUS_LAUNCHING)
13151 {
13152 OOLogERR(kOOLogInconsistentState, @"status is %@, but dockedStation is not nil; treating as docked. %@", OOStringFromEntityStatus([self status]), @"This is an internal error, please report it.");
13153 [self setStatus:STATUS_DOCKED];
13155 }
13156 }
13157#endif
13158
13159 return isDockedStatus;
13160}
NSString * OOStringFromEntityStatus(OOEntityStatus status) CONST_FUNC
NSString *const kOOLogInconsistentState
Definition OOLogging.m:650

◆ isMining

- (BOOL) isMining
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11517{
11518 return using_mining_laser;
11519}

◆ isMouseControlOn

- (BOOL) isMouseControlOn

Definition at line 13727 of file PlayerEntity.m.

4727{
4728 return mouse_control_on;
4729}

◆ isPlayerLikeShip

- (BOOL) isPlayerLikeShip
implementation

Reimplemented from Entity.

Provided by category PlayerEntity(ProxyPlayer).

Definition at line 1 of file ProxyPlayerEntity.m.

226{
227 return YES;
228}

◆ isSpeechOn

- (OOSpeechSettings) isSpeechOn

◆ isValidTarget:

- (BOOL) isValidTarget: (Entity*)  target

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4019 :(Entity*)target
4020{
4021 // Just in case we got called with a bad target.
4022 if (!target)
4023 return NO;
4024
4025 // If target is beyond scanner range, it's lost
4026 if(target->zero_distance > SCANNER_MAX_RANGE2)
4027 return NO;
4028
4029 // If target is a ship, check whether it's cloaked or is actively jamming our scanner
4030 if ([target isShip])
4031 {
4033 if ([targetShip isCloaked] || // checks for cloaked ships
4034 ([targetShip isJammingScanning] && ![self hasMilitaryScannerFilter])) // checks for activated jammer
4035 {
4036 return NO;
4037 }
4038 OOEntityStatus tstatus = [targetShip status];
4040 { // checks for ships entering wormholes, docking, or been scooped
4041 return NO;
4042 }
4043 return YES;
4044 }
4045
4046 // If target is an unexpired wormhole and the player has bought the Wormhole Scanner and we're in ID mode
4048 [self hasEquipmentItemProviding:@"EQ_WORMHOLE_SCANNER"] && ident_engaged)
4049 {
4050 return YES;
4051 }
4052
4053 // Target is neither a wormhole nor a ship
4054 return NO;
4055}
BOOL isJammingScanning()
BOOL hasMilitaryScannerFilter()

◆ javaScriptEngineWillReset:

- (void) javaScriptEngineWillReset: (NSNotification *)  notification
implementation

Provided by category PlayerEntity(OOJavaScriptExtensions).

Definition at line 1860 of file OOJSPlayerShip.m.

335 :(NSNotification *)notification
336{
337 [[NSNotificationCenter defaultCenter] removeObserver:self
338 name:kOOJavaScriptEngineWillResetNotification
340
341 if (_jsSelf != NULL)
342 {
343
344 JSContext *context = OOJSAcquireContext();
345 JS_RemoveObjectRoot(context, &_jsSelf);
346 _jsSelf = NULL;
347 OOJSRelinquishContext(context);
348 }
349}

◆ jumpCause

- (NSString *) jumpCause

Definition at line 9242 of file PlayerEntity.m.

13061{
13062 return _jumpCause;
13063}

◆ keyBindingDescription2:

- (NSString *) keyBindingDescription2: (NSString *)  binding

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

381 :(NSString *)binding
382{
383 if ([keyconfig2_settings objectForKey:binding] == nil)
384 {
385 // no such setting
386 return nil;
387 }
388 NSArray *keyList = (NSArray*)[keyconfig2_settings objectForKey:binding];
389 return [self getKeyBindingDescription:keyList];
390}

Referenced by GlobalKeyBindingDescription().

+ Here is the caller graph for this function:

◆ keyboardDescription:

- (NSString *) keyboardDescription: (NSString *)  kbd
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1234 :(NSString *)kbd
1235{
1236 NSString *map = @"";
1237#if OOLITE_WINDOWS
1238 map = @"keymappings_windows.plist";
1239#endif
1240#if OOLITE_LINUX
1241 map = @"keymappings_linux.plist";
1242#endif
1243#if OOLITE_MAC_OS_X
1244 map = @"keymappings_mac.plist";
1245#endif
1246 NSDictionary *kmap = [NSDictionary dictionaryWithDictionary:[ResourceManager dictionaryFromFilesNamed:map inFolder:@"Config" mergeMode:MERGE_BASIC cache:NO]];
1247 NSDictionary *sect = [kmap objectForKey:kbd];
1248 return [sect objectForKey:@"description"];
1249}

◆ keyboardLayoutList

- (NSArray *) keyboardLayoutList
implementation

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1253{
1254 NSString *map = @"";
1255#if OOLITE_WINDOWS
1256 map = @"keymappings_windows.plist";
1257#endif
1258#if OOLITE_LINUX
1259 map = @"keymappings_linux.plist";
1260#endif
1261#if OOLITE_MAC_OS_X
1262 map = @"keymappings_mac.plist";
1263#endif
1264 NSDictionary *kmap = [NSDictionary dictionaryWithDictionary:[ResourceManager dictionaryFromFilesNamed:map inFolder:@"Config" mergeMode:MERGE_BASIC cache:NO]];
1265 NSMutableArray *kbdList = [NSMutableArray array];
1266 NSArray *keys = [kmap allKeys];
1267 NSUInteger i;
1268 NSDictionary *def = nil;
1269
1270 for (i = 0; i < [keys count]; i++)
1271 {
1272 if (![[keys objectAtIndex:i] isEqualToString:@"default"])
1273 {
1274 [kbdList addObject:[[NSDictionary alloc] initWithObjectsAndKeys:[keys objectAtIndex:i], @"key",
1275 [self keyboardDescription:[keys objectAtIndex:i]], @"description",
1276 //([[keys objectAtIndex:i] isEqualToString:kbd] ? @"Current" : @""), @"selected",
1277 nil]];
1278 }
1279 else
1280 {
1281 // key the "default" item separate, so we can add it at the top of the list, rather than getting it sorted
1282 def = [[NSDictionary alloc] initWithObjectsAndKeys:[keys objectAtIndex:i], @"key",
1283 [self keyboardDescription:[keys objectAtIndex:i]], @"description",
1284 //([[keys objectAtIndex:i] isEqualToString:kbd] ? @"Current" : @""), @"selected",
1285 nil];
1286 }
1287 }
1288
1289 NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"description" ascending:YES];
1290 NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
1291 NSMutableArray *sorted = [NSMutableArray arrayWithArray:[kbdList sortedArrayUsingDescriptors:sortDescriptors]];
1292 [sorted insertObject:def atIndex:0];
1293
1294 [sortDescriptor release];
1295
1296 return sorted;
1297}

◆ keyCodeDescription:

- (NSString *) keyCodeDescription: (OOKeyCode code

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

415 :(OOKeyCode)code
416{
417 switch (code)
418 {
419 case 0:
420 return DESC(@"oolite-keycode-unset");
421 case 9:
422 return DESC(@"oolite-keycode-tab");
423 case 13:
424 return DESC(@"oolite-keycode-enter");
425 case 27:
426 return DESC(@"oolite-keycode-esc");
427 case 32:
428 return DESC(@"oolite-keycode-space");
429 case gvFunctionKey1:
430 return DESC(@"oolite-keycode-f1");
431 case gvFunctionKey2:
432 return DESC(@"oolite-keycode-f2");
433 case gvFunctionKey3:
434 return DESC(@"oolite-keycode-f3");
435 case gvFunctionKey4:
436 return DESC(@"oolite-keycode-f4");
437 case gvFunctionKey5:
438 return DESC(@"oolite-keycode-f5");
439 case gvFunctionKey6:
440 return DESC(@"oolite-keycode-f6");
441 case gvFunctionKey7:
442 return DESC(@"oolite-keycode-f7");
443 case gvFunctionKey8:
444 return DESC(@"oolite-keycode-f8");
445 case gvFunctionKey9:
446 return DESC(@"oolite-keycode-f9");
447 case gvFunctionKey10:
448 return DESC(@"oolite-keycode-f10");
449 case gvFunctionKey11:
450 return DESC(@"oolite-keycode-f11");
451 case gvArrowKeyRight:
452 return DESC(@"oolite-keycode-right");
453 case gvArrowKeyLeft:
454 return DESC(@"oolite-keycode-left");
455 case gvArrowKeyDown:
456 return DESC(@"oolite-keycode-down");
457 case gvArrowKeyUp:
458 return DESC(@"oolite-keycode-up");
459 case gvHomeKey:
460 return DESC(@"oolite-keycode-home");
461 case gvEndKey:
462 return DESC(@"oolite-keycode-end");
463 case gvInsertKey:
464 return DESC(@"oolite-keycode-insert");
465 case gvDeleteKey:
466 return DESC(@"oolite-keycode-delete");
467 case gvPageUpKey:
468 return DESC(@"oolite-keycode-pageup");
469 case gvPageDownKey:
470 return DESC(@"oolite-keycode-pagedown");
471 case gvNumberPadKey0:
472 return DESC(@"oolite-keycode-numpad0");
473 case gvNumberPadKey1:
474 return DESC(@"oolite-keycode-numpad1");
475 case gvNumberPadKey2:
476 return DESC(@"oolite-keycode-numpad2");
477 case gvNumberPadKey3:
478 return DESC(@"oolite-keycode-numpad3");
479 case gvNumberPadKey4:
480 return DESC(@"oolite-keycode-numpad4");
481 case gvNumberPadKey5:
482 return DESC(@"oolite-keycode-numpad5");
483 case gvNumberPadKey6:
484 return DESC(@"oolite-keycode-numpad6");
485 case gvNumberPadKey7:
486 return DESC(@"oolite-keycode-numpad7");
487 case gvNumberPadKey8:
488 return DESC(@"oolite-keycode-numpad8");
489 case gvNumberPadKey9:
490 return DESC(@"oolite-keycode-numpad9");
491 case gvPrintScreenKey:
492 return DESC(@"oolite-keycode-printscreen");
493 case gvPauseKey:
494 return DESC(@"oolite-keycode-pause");
496 return DESC(@"oolite-keycode-numpad/");
498 return DESC(@"oolite-keycode-numpad=");
500 return DESC(@"oolite-keycode-numpad-");
502 return DESC(@"oolite-keycode-numpad*");
504 return DESC(@"oolite-keycode-numpad.");
506 return DESC(@"oolite-keycode-numpad+");
508 return DESC(@"oolite-keycode-numpadenter");
509
510 default:
511 return [NSString stringWithFormat:@"%C",code];
512 }
513}
@ gvNumberPadKeyPeriod
@ gvInsertKey
@ gvNumberPadKey9
@ gvNumberPadKey1
@ gvFunctionKey10
@ gvDeleteKey
@ gvNumberPadKey2
@ gvNumberPadKey3
@ gvNumberPadKeyEquals
@ gvNumberPadKey6
@ gvNumberPadKey5
@ gvNumberPadKey4
@ gvPauseKey
@ gvNumberPadKey7
@ gvPrintScreenKey
@ gvNumberPadKey8
@ gvNumberPadKey0

◆ keyCodeDescriptionShort:

- (NSString *) keyCodeDescriptionShort: (OOKeyCode code

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

515 :(OOKeyCode)code
516{
517 switch (code)
518 {
519 case 0:
520 return DESC(@"oolite-keycode-short-unset");
521 case 9:
522 return DESC(@"oolite-keycode-short-tab");
523 case 13:
524 return DESC(@"oolite-keycode-short-enter");
525 case 27:
526 return DESC(@"oolite-keycode-short-esc");
527 case 32:
528 return DESC(@"oolite-keycode-short-space");
529 case gvFunctionKey1:
530 return DESC(@"oolite-keycode-short-f1");
531 case gvFunctionKey2:
532 return DESC(@"oolite-keycode-short-f2");
533 case gvFunctionKey3:
534 return DESC(@"oolite-keycode-short-f3");
535 case gvFunctionKey4:
536 return DESC(@"oolite-keycode-short-f4");
537 case gvFunctionKey5:
538 return DESC(@"oolite-keycode-short-f5");
539 case gvFunctionKey6:
540 return DESC(@"oolite-keycode-short-f6");
541 case gvFunctionKey7:
542 return DESC(@"oolite-keycode-short-f7");
543 case gvFunctionKey8:
544 return DESC(@"oolite-keycode-short-f8");
545 case gvFunctionKey9:
546 return DESC(@"oolite-keycode-short-f9");
547 case gvFunctionKey10:
548 return DESC(@"oolite-keycode-short-f10");
549 case gvFunctionKey11:
550 return DESC(@"oolite-keycode-short-f11");
551 case gvArrowKeyRight:
552 return DESC(@"oolite-keycode-short-right");
553 case gvArrowKeyLeft:
554 return DESC(@"oolite-keycode-short-left");
555 case gvArrowKeyDown:
556 return DESC(@"oolite-keycode-short-down");
557 case gvArrowKeyUp:
558 return DESC(@"oolite-keycode-short-up");
559 case gvHomeKey:
560 return DESC(@"oolite-keycode-short-home");
561 case gvEndKey:
562 return DESC(@"oolite-keycode-short-end");
563 case gvInsertKey:
564 return DESC(@"oolite-keycode-short-insert");
565 case gvDeleteKey:
566 return DESC(@"oolite-keycode-short-delete");
567 case gvPageUpKey:
568 return DESC(@"oolite-keycode-short-pageup");
569 case gvPageDownKey:
570 return DESC(@"oolite-keycode-short-pagedown");
571 case gvNumberPadKey0:
572 return DESC(@"oolite-keycode-short-numpad0");
573 case gvNumberPadKey1:
574 return DESC(@"oolite-keycode-short-numpad1");
575 case gvNumberPadKey2:
576 return DESC(@"oolite-keycode-short-numpad2");
577 case gvNumberPadKey3:
578 return DESC(@"oolite-keycode-short-numpad3");
579 case gvNumberPadKey4:
580 return DESC(@"oolite-keycode-short-numpad4");
581 case gvNumberPadKey5:
582 return DESC(@"oolite-keycode-short-numpad5");
583 case gvNumberPadKey6:
584 return DESC(@"oolite-keycode-short-numpad6");
585 case gvNumberPadKey7:
586 return DESC(@"oolite-keycode-short-numpad7");
587 case gvNumberPadKey8:
588 return DESC(@"oolite-keycode-short-numpad8");
589 case gvNumberPadKey9:
590 return DESC(@"oolite-keycode-short-numpad9");
591 case gvPrintScreenKey:
592 return DESC(@"oolite-keycode-short-printscreen");
593 case gvPauseKey:
594 return DESC(@"oolite-keycode-short-pause");
596 return DESC(@"oolite-keycode-short-numpad/");
598 return DESC(@"oolite-keycode-short-numpad=");
600 return DESC(@"oolite-keycode-short-numpad-");
602 return DESC(@"oolite-keycode-short-numpad*");
604 return DESC(@"oolite-keycode-short-numpad.");
606 return DESC(@"oolite-keycode-short-numpad+");
608 return DESC(@"oolite-keycode-short-numpadenter");
609 default:
610 return [NSString stringWithFormat:@"%C",code];
611 }
612}

◆ keyConfig

- (NSDictionary *) keyConfig

Definition at line 13727 of file PlayerEntity.m.

4720{
4721 //return keyconfig_settings;
4722 return keyconfig2_settings;
4723}

◆ keyFunctionList

- (NSArray *) keyFunctionList
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

964{
965 NSMutableArray *funcList = [NSMutableArray array];
966
967 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-screen-access")]];
968 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_launch_ship") keyDef:@"key_launch_ship"]];
969 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_screen_options") keyDef:@"key_gui_screen_options"]];
970 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_screen_equipship") keyDef:@"key_gui_screen_equipship"]];
971 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_screen_interfaces") keyDef:@"key_gui_screen_interfaces"]];
972 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_screen_status") keyDef:@"key_gui_screen_status"]];
973 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_chart_screens") keyDef:@"key_gui_chart_screens"]];
974 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_system_data") keyDef:@"key_gui_system_data"]];
975 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_market") keyDef:@"key_gui_market"]];
976
977 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-propulsion")]];
978 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_roll_left") keyDef:@"key_roll_left"]];
979 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_roll_right") keyDef:@"key_roll_right"]];
980 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_pitch_forward") keyDef:@"key_pitch_forward"]];
981 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_pitch_back") keyDef:@"key_pitch_back"]];
982 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_yaw_left") keyDef:@"key_yaw_left"]];
983 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_yaw_right") keyDef:@"key_yaw_right"]];
984
985 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_increase_speed") keyDef:@"key_increase_speed"]];
986 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_decrease_speed") keyDef:@"key_decrease_speed"]];
987 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_inject_fuel") keyDef:@"key_inject_fuel"]];
988 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_jumpdrive") keyDef:@"key_jumpdrive"]];
989 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_hyperspace") keyDef:@"key_hyperspace"]];
990 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_galactic_hyperspace") keyDef:@"key_galactic_hyperspace"]];
991
992 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-navigation")]];
993 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_next_compass_mode") keyDef:@"key_next_compass_mode"]];
994 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_prev_compass_mode") keyDef:@"key_prev_compass_mode"]];
995 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_scanner_zoom") keyDef:@"key_scanner_zoom"]];
996 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_scanner_unzoom") keyDef:@"key_scanner_unzoom"]];
997 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_view_forward") keyDef:@"key_view_forward"]];
998 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_view_aft") keyDef:@"key_view_aft"]];
999 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_view_port") keyDef:@"key_view_port"]];
1000 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_view_starboard") keyDef:@"key_view_starboard"]];
1001 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_ident_system") keyDef:@"key_ident_system"]];
1002
1003 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_docking_clearance_request") keyDef:@"key_docking_clearance_request"]];
1004 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_autopilot") keyDef:@"key_autopilot"]];
1005 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_autodock") keyDef:@"key_autodock"]];
1006 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_docking_music") keyDef:@"key_docking_music"]];
1007
1008 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-offensive")]];
1009 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_weapons_online_toggle") keyDef:@"key_weapons_online_toggle"]];
1010 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_fire_lasers") keyDef:@"key_fire_lasers"]];
1011 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_launch_missile") keyDef:@"key_launch_missile"]];
1012 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_target_missile") keyDef:@"key_target_missile"]];
1013 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_untarget_missile") keyDef:@"key_untarget_missile"]];
1014 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_target_incoming_missile") keyDef:@"key_target_incoming_missile"]];
1015 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_next_missile") keyDef:@"key_next_missile"]];
1016 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_next_target") keyDef:@"key_next_target"]];
1017 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_previous_target") keyDef:@"key_previous_target"]];
1018
1019 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-defensive")]];
1020 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_ecm") keyDef:@"key_ecm"]];
1021 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_dump_cargo") keyDef:@"key_dump_cargo"]];
1022 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_rotate_cargo") keyDef:@"key_rotate_cargo"]];
1023 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_launch_escapepod") keyDef:@"key_launch_escapepod"]];
1024
1025 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-special-equip")]];
1026 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_cycle_next_mfd") keyDef:@"key_cycle_next_mfd"]];
1027 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_cycle_previous_mfd") keyDef:@"key_cycle_previous_mfd"]];
1028 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_switch_next_mfd") keyDef:@"key_switch_next_mfd"]];
1029 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_switch_previous_mfd") keyDef:@"key_switch_previous_mfd"]];
1030
1031 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_prime_next_equipment") keyDef:@"key_prime_next_equipment"]];
1032 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_prime_previous_equipment") keyDef:@"key_prime_previous_equipment"]];
1033 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_activate_equipment") keyDef:@"key_activate_equipment"]];
1034 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_mode_equipment") keyDef:@"key_mode_equipment"]];
1035 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_fastactivate_equipment_a") keyDef:@"key_fastactivate_equipment_a"]];
1036 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_fastactivate_equipment_b") keyDef:@"key_fastactivate_equipment_b"]];
1037
1038 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-chart-screen")]];
1039 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_advanced_nav_array_next") keyDef:@"key_advanced_nav_array_next"]];
1040 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_advanced_nav_array_previous") keyDef:@"key_advanced_nav_array_previous"]];
1041 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_home") keyDef:@"key_map_home"]];
1042 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_end") keyDef:@"key_map_end"]];
1043 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_info") keyDef:@"key_map_info"]];
1044 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_zoom_in") keyDef:@"key_map_zoom_in"]];
1045 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_zoom_out") keyDef:@"key_map_zoom_out"]];
1046 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_next_system") keyDef:@"key_map_next_system"]];
1047 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_previous_system") keyDef:@"key_map_previous_system"]];
1048 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_chart_highlight") keyDef:@"key_chart_highlight"]];
1049
1050 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-planet-info-screen")]];
1051 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_system_home") keyDef:@"key_system_home"]];
1052 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_system_end") keyDef:@"key_system_end"]];
1053 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_system_next_system") keyDef:@"key_system_next_system"]];
1054 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_system_previous_system") keyDef:@"key_system_previous_system"]];
1055
1056 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-market-screen")]];
1057 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_filter_cycle") keyDef:@"key_market_filter_cycle"]];
1058 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_sorter_cycle") keyDef:@"key_market_sorter_cycle"]];
1059 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_buy_one") keyDef:@"key_market_buy_one"]];
1060 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_sell_one") keyDef:@"key_market_sell_one"]];
1061 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_buy_max") keyDef:@"key_market_buy_max"]];
1062 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_sell_max") keyDef:@"key_market_sell_max"]];
1063
1064 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-misc")]];
1065 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_snapshot") keyDef:@"key_snapshot"]];
1066 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_pausebutton") keyDef:@"key_pausebutton"]];
1067 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_show_fps") keyDef:@"key_show_fps"]];
1068 //[funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_bloom_toggle") keyDef:@"key_bloom_toggle"]];
1069 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_mouse_control_roll") keyDef:@"key_mouse_control_roll"]];
1070 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_mouse_control_yaw") keyDef:@"key_mouse_control_yaw"]];
1071 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_hud_toggle") keyDef:@"key_hud_toggle"]];
1072#if OO_FOV_INFLIGHT_CONTROL_ENABLED
1073 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_inc_field_of_view") keyDef:@"key_inc_field_of_view"]];
1074 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_dec_field_of_view") keyDef:@"key_dec_field_of_view"]];
1075#endif
1076 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_comms_log") keyDef:@"key_comms_log"]];
1077
1078 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-custom-view")]];
1079 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view") keyDef:@"key_custom_view"]];
1080 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_zoom_in") keyDef:@"key_custom_view_zoom_in"]];
1081 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_zoom_out") keyDef:@"key_custom_view_zoom_out"]];
1082 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_roll_left") keyDef:@"key_custom_view_roll_left"]];
1083 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_roll_right") keyDef:@"key_custom_view_roll_right"]];
1084 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_pan_left") keyDef:@"key_custom_view_pan_left"]];
1085 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_pan_right") keyDef:@"key_custom_view_pan_right"]];
1086 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_pan_up") keyDef:@"key_custom_view_pan_up"]];
1087 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_pan_down") keyDef:@"key_custom_view_pan_down"]];
1088 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_rotate_left") keyDef:@"key_custom_view_rotate_left"]];
1089 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_rotate_right") keyDef:@"key_custom_view_rotate_right"]];
1090 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_rotate_up") keyDef:@"key_custom_view_rotate_up"]];
1091 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_rotate_down") keyDef:@"key_custom_view_rotate_down"]];
1092
1093 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-oxz-manager")]];
1094 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_oxzmanager_setfilter") keyDef:@"key_oxzmanager_setfilter"]];
1095 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_oxzmanager_showinfo") keyDef:@"key_oxzmanager_showinfo"]];
1096 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_oxzmanager_extract") keyDef:@"key_oxzmanager_extract"]];
1097
1098 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-gui")]];
1099 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_arrow_left") keyDef:@"key_gui_arrow_left"]];
1100 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_arrow_right") keyDef:@"key_gui_arrow_right"]];
1101 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_arrow_up") keyDef:@"key_gui_arrow_up"]];
1102 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_arrow_down") keyDef:@"key_gui_arrow_down"]];
1103 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_page_down") keyDef:@"key_gui_page_down"]];
1104 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_page_up") keyDef:@"key_gui_page_up"]];
1105 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_select") keyDef:@"key_gui_select"]];
1106
1107 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-debug")]];
1108 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_dump_target_state") keyDef:@"key_dump_target_state"]];
1109 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_dump_entity_list") keyDef:@"key_dump_entity_list"]];
1110 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_full") keyDef:@"key_debug_full"]];
1111 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_collision") keyDef:@"key_debug_collision"]];
1112 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_console_connect") keyDef:@"key_debug_console_connect"]];
1113 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_bounding_boxes") keyDef:@"key_debug_bounding_boxes"]];
1114 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_shaders") keyDef:@"key_debug_shaders"]];
1115 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_off") keyDef:@"key_debug_off"]];
1116
1117 if ([customEquipActivation count] > 0)
1118 {
1119 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-oxp-equip")]];
1120 int i;
1121 for (i = 0; i < [customEquipActivation count]; i++)
1122 {
1123 [funcList addObject:[self makeKeyGuiDict:[NSString stringWithFormat: @"Activate '%@'", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPNAME]]
1124 keyDef:[NSString stringWithFormat:@"activate_%@", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]]]];
1125 [funcList addObject:[self makeKeyGuiDict:[NSString stringWithFormat: @"Mode '%@'", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPNAME]]
1126 keyDef:[NSString stringWithFormat:@"mode_%@", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]]]];
1127 }
1128 }
1129 return funcList;
1130}

◆ keyMapperInputHandler:view:

- (void) keyMapperInputHandler: (GuiDisplayGen *)  gui
view: (MyOpenGLView *)  gameView 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

198 :(GuiDisplayGen *)gui view:(MyOpenGLView *)gameView
199{
200 [self handleGUIUpDownArrowKeys];
201 BOOL selectKeyPress = ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick]);
202 if ([gameView isDown:gvMouseDoubleClick]) [gameView clearMouse];
203
204 NSString *key = [gui keyForRow: [gui selectedRow]];
205 if ([key hasPrefix:@"Index:"])
206 selFunctionIdx=[[[key componentsSeparatedByString:@":"] objectAtIndex:1] intValue];
207 else
208 selFunctionIdx=-1;
209
210 if (selectKeyPress)
211 {
212 if ([key hasPrefix:@"More:"])
213 {
214 int from_function = [[[key componentsSeparatedByString:@":"] objectAtIndex:1] intValue];
215 if (from_function < 0) from_function = 0;
216
218 if (from_function == 0) current_row = GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1;
219 [self setGuiToKeyMapperScreen:from_function];
220 if ([gameView isDown:gvMouseDoubleClick]) [gameView clearMouse];
221 return;
222 }
223 if ([key hasPrefix:@"kbd:"])
224 {
225 [self setGuiToKeyboardLayoutScreen:0];
226 if ([gameView isDown:gvMouseDoubleClick]) [gameView clearMouse];
227 return;
228 }
229 current_row = [gui selectedRow];
230 selected_entry = [keyFunctions objectAtIndex:selFunctionIdx];
231 [key_list release];
232 if (![self entryIsDictCustomEquip:selected_entry])
233 {
234 key_list = [[NSMutableArray alloc] initWithArray:(NSArray *)[keyconfig2_settings objectForKey:[selected_entry objectForKey:KEY_KC_DEFINITION]] copyItems:YES];
235 }
236 else
237 {
238 key_list = [[NSMutableArray alloc] initWithArray:[self getCustomEquipArray:[selected_entry oo_stringForKey:KEY_KC_DEFINITION]]];
239 }
240 [gameView clearKeys]; // try to stop key bounces
241 [self setGuiToKeyConfigScreen:YES];
242 }
243
244 if ([gameView isDown:'u'])
245 {
246 // pressed 'u' on an "more" line
247 if ([key hasPrefix:@"More:"]) return;
248
249 current_row = [gui selectedRow];
250 [self unsetKeySetting:[[keyFunctions objectAtIndex:selFunctionIdx] objectForKey:KEY_KC_DEFINITION]];
251 [self reloadPage];
252 }
253
254 if ([gameView isDown:'r'])
255 {
256 // reset single entry or all
257 if (![gameView isCtrlDown])
258 {
259 // pressed 'r' on an "more" line
260 if ([key hasPrefix:@"More:"]) return;
261
262 current_row = [gui selectedRow];
263
264 NSString *delkey = [[keyFunctions objectAtIndex:selFunctionIdx] objectForKey:KEY_KC_DEFINITION];
265 [self deleteKeySetting:delkey];
266 // special case - when default activate/mode key set in custom equipment
267 if ([self entryIsCustomEquip:delkey])
268 {
269 int idx = [self getCustomEquipIndex:delkey];
270 NSString *eq = nil;
271 NSString *lookupKey = nil;
272 bool update = false;
273
274 if ([delkey hasPrefix:@"activate_"])
275 {
276 eq = [delkey stringByReplacingOccurrencesOfString:@"activate_" withString:@""];
277 lookupKey = CUSTOMEQUIP_KEYACTIVATE;
278 }
279 if ([delkey hasPrefix:@"mode_"])
280 {
281 eq = [delkey stringByReplacingOccurrencesOfString:@"mode_" withString:@""];
282 lookupKey = CUSTOMEQUIP_KEYMODE;
283 }
284
286
287 if ([item defaultActivateKey] && [lookupKey isEqualToString:CUSTOMEQUIP_KEYACTIVATE])
288 {
289 [[customEquipActivation objectAtIndex:idx] setObject:[item defaultActivateKey] forKey:lookupKey];
290 update = true;
291 }
292 if ([item defaultModeKey] && [lookupKey isEqualToString:CUSTOMEQUIP_KEYMODE])
293 {
294 [[customEquipActivation objectAtIndex:idx] setObject:[item defaultModeKey] forKey:lookupKey];
295 update = true;
296 }
297
298 if (update)
299 {
300 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
301 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
302 }
303 }
304
305 [self reloadPage];
306 }
307 else
308 {
309 [self setGuiToConfirmClearScreen];
310 }
311 }
312 if ([gameView isDown:' '] && !has_error) [self setGuiToGameOptionsScreen];
313}
static NSDictionary * selected_entry
static BOOL has_error

◆ laserHeatLevel

- (GLfloat) laserHeatLevel
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4831{
4833 return OOClamp_0_1_f(result);
4834}

◆ laserHeatLevelAft

- (GLfloat) laserHeatLevelAft
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4838{
4840 return OOClamp_0_1_f(result);
4841}

◆ laserHeatLevelForward

- (GLfloat) laserHeatLevelForward
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4845{
4847// no need to check subents here
4848 return OOClamp_0_1_f(result);
4849}

◆ laserHeatLevelPort

- (GLfloat) laserHeatLevelPort
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4853{
4855 return OOClamp_0_1_f(result);
4856}

◆ laserHeatLevelStarboard

- (GLfloat) laserHeatLevelStarboard
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4860{
4862 return OOClamp_0_1_f(result);
4863}

◆ lastsaveName

- (NSString *) lastsaveName

Definition at line 9242 of file PlayerEntity.m.

13081{
13082 return _lastsaveName;
13083}

◆ launchEscapeCapsule

- (ShipEntity *) launchEscapeCapsule
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6601{
6604
6605 if ([UNIVERSE displayGUI]) [self switchToMainView]; // Clear the F7 screen!
6606 [UNIVERSE setViewDirection:VIEW_FORWARD];
6607
6608 if ([self status] == STATUS_DEAD) return nil;
6609
6610 /*
6611 While inside the escape pod, we need to block access to all player.ship properties,
6612 since we're not supposed to be inside our ship anymore! -- Kaks 20101114
6613 */
6614
6615 [UNIVERSE setBlockJSPlayerShipProps:YES]; // no player.ship properties while inside the pod!
6616 // if a specific amount of time has been provided for the rescue, use it now
6617 if (escape_pod_rescue_time > 0)
6618 {
6620 escape_pod_rescue_time = 0; // reset value
6621 }
6622 else
6623 {
6624 // otherwise, use the default time calc
6625 ship_clock_adjust += 43200 + 5400 * (ranrot_rand() & 127); // add up to 8 days until rescue!
6626 }
6629
6630 doppelganger = [self createDoppelganger];
6631 if (doppelganger)
6632 {
6633 [doppelganger setVelocity:vector_multiply_scalar(v_forward, flightSpeed)];
6634 [doppelganger setSpeed:0.0];
6635 [doppelganger setDesiredSpeed:0.0];
6636 [doppelganger setRoll:0.2 * (randf() - 0.5)];
6637 [doppelganger setOwner:self];
6638 [doppelganger setThrust:0]; // drifts
6639 [UNIVERSE addEntity:doppelganger];
6640 }
6641
6642 [self setFoundTarget:doppelganger]; // must do this before setting status
6643 [self setStatus:STATUS_ESCAPE_SEQUENCE]; // now set up the escape sequence.
6644
6645
6646 // must do this before next step or uses BBox of pod, not old ship!
6647 float sheight = (float)(boundingBox.max.y - boundingBox.min.y);
6649 float sdepth = (float)(boundingBox.max.z - boundingBox.min.z);
6651
6652 // set up you
6653 escapePod = [UNIVERSE newShipWithName:@"escape-capsule"]; // retained
6654 if (escapePod != nil)
6655 {
6656 // FIXME: this should use OOShipType, which should exist. -- Ahruman
6657 [self setMesh:[escapePod mesh]];
6658 }
6659
6660 /* These used to be non-zero, but BEHAVIOUR_IDLE levels off flight
6661 * anyway, and inertial velocity is used instead of inertialess
6662 * thrust - CIM */
6663 flightSpeed = 0.0f;
6664 flightPitch = 0.0f;
6665 flightRoll = 0.0f;
6666 flightYaw = 0.0f;
6667 // and turn off inertialess drive
6668 thrust = 0.0f;
6669
6670
6671 /* Add an impulse upwards and backwards to the escape pod. This avoids
6672 flying straight through the doppelganger in interstellar space or when
6673 facing the main station/escape target, and generally looks cool.
6674 -- Ahruman 2011-04-02
6675 */
6679 [self setVelocity:launchVector];
6680
6681
6682
6683 // if multiple items providing escape pod, remove the first one
6684 [self removeEquipmentItem:[self equipmentItemProviding:@"EQ_ESCAPE_POD"]];
6685
6686
6687 // set up the standard location where the escape pod will dock.
6688 target_system_id = system_id; // we're staying in this system
6690 [self setDockTarget:[UNIVERSE station]]; // we're docking at the main station, if there is one
6691
6692 [self doScriptEvent:OOJSID("shipLaunchedEscapePod") withArgument:escapePod]; // no player.ship properties should be available to script
6693
6694 // reset legal status
6695 [self setBounty:0 withReason:kOOLegalStatusReasonEscapePod];
6696 bounty = 0;
6697
6698 // new ship, so lose some memory of player actions
6699 if (ship_kills >= 6400)
6700 {
6701 [self clearRolesFromPlayer:0.1];
6702 }
6703 else if (ship_kills >= 2560)
6704 {
6705 [self clearRolesFromPlayer:0.25];
6706 }
6707 else
6708 {
6709 [self clearRolesFromPlayer:0.5];
6710 }
6711
6712 // reset trumbles
6713 if (trumbleCount != 0) trumbleCount = 1;
6714
6715 // remove cargo
6716 [cargo removeAllObjects];
6717
6718 energy = 25;
6719 [UNIVERSE addMessage:DESC(@"escape-sequence") forCount:4.5];
6720 [self resetShotTime];
6721
6722 // need to zero out all facings shot_times too, otherwise we may end up
6723 // with a broken escape pod sequence - Nikos 20100909
6724 forward_shot_time = 0.0;
6725 aft_shot_time = 0.0;
6726 port_shot_time = 0.0;
6727 starboard_shot_time = 0.0;
6728
6729 [escapePod release];
6730
6731 return doppelganger;
6732}
void setThrust:(double amount)
void setOwner:(Entity *who_owns_entity)

◆ launchFromStation

- (void) launchFromStation

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2246{
2247 // ensure autosave is ready for the next unscripted launch
2248 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
2249 if ([self status] == STATUS_DOCKING) [self setStatus:STATUS_DOCKED]; // needed here to prevent the normal update from continuing with docking.
2250 [self leaveDock:[self dockedStation]];
2251}

◆ launchMine:

- (ShipEntity *) launchMine: (ShipEntity *)  mine

Definition at line 13727 of file PlayerEntity.m.

6008 :(ShipEntity*) mine
6009{
6010 if (!mine)
6011 return nil;
6012
6013 if (![self weaponsOnline])
6014 return nil;
6015
6016 [mine setOwner: self];
6017 [mine setBehaviour: BEHAVIOUR_IDLE];
6018 [self dumpItem: mine]; // includes UNIVERSE addEntity: CLASS_CARGO, STATUS_IN_FLIGHT, AI state GLOBAL ( the last one starts the timer !)
6019 [mine setScanClass: CLASS_MINE];
6020
6021 float mine_speed = 500.0f;
6023 [mine setVelocity: mvel];
6024 [self doScriptEvent:OOJSID("shipReleasedEquipment") withArgument:mine];
6025 return mine;
6026}

◆ leaveDock:

- (void) leaveDock: (StationEntity *)  station
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

7248 :(StationEntity *)station
7249{
7250 if (station == nil) return;
7251 NSParameterAssert(station == [self dockedStation]);
7252
7253 // ensure we've not left keyboard entry on
7254 [[UNIVERSE gameView] allowStringInput: NO];
7255
7257 {
7258 [[UNIVERSE gui] clearBackground];
7260 {
7261 [self doMissionCallback];
7262 }
7263 // notify older scripts, but do not trigger missionScreenOpportunity.
7264 [self doWorldEventUntilMissionScreen:OOJSID("missionScreenEnded")];
7265 }
7266
7267 if ([station marketMonitored])
7268 {
7269 // 'leaving with those guns were you sir?'
7270 OOCreditsQuantity oldbounty = [self bounty];
7271 [self markAsOffender:[station legalStatusOfManifest:shipCommodityData export:YES] withReason:kOOLegalStatusReasonIllegalExports];
7272 if ([self bounty] > oldbounty)
7273 {
7274 [self addRoleToPlayer:@"trader-smuggler"];
7275 }
7276 }
7279 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
7280
7281 if (![hud nonlinearScanner])
7282 {
7283 [hud setScannerZoom: 1.0];
7284 }
7285 [self loadCargoPods];
7286 // do not do anything that calls JS handlers between now and calling
7287 // [station launchShip] below, or the cargo returned by JS may be off
7288 // CIM - 3.2.2012
7289
7290 // clear the way
7291 [station autoDockShipsOnApproach];
7292 [station clearDockingCorridor];
7293
7294// [self setAlertFlag:ALERT_FLAG_DOCKED to:NO];
7295 [self clearAlertFlags];
7296 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
7297
7298 scanner_zoom_rate = 0.0f;
7300 [self currentWeaponStats];
7301
7302 forward_weapon_temp = 0.0f;
7303 aft_weapon_temp = 0.0f;
7304 port_weapon_temp = 0.0f;
7305 starboard_weapon_temp = 0.0f;
7306
7307 forward_shield = [self maxForwardShieldLevel];
7308 aft_shield = [self maxAftShieldLevel];
7309
7310 [self clearTargetMemory];
7311 [self setShowDemoShips:NO];
7312 [UNIVERSE setDisplayText:NO];
7313 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
7314
7315 [[UNIVERSE gameView] clearKeys]; // try to stop keybounces
7316
7317 if ([self isMouseControlOn])
7318 {
7319 [[UNIVERSE gameView] resetMouse];
7320 }
7321
7323
7324 [UNIVERSE forceWitchspaceEntries];
7325 ship_clock_adjust += 600.0; // 10 minutes to leave dock
7326 velocity = kZeroVector; // just in case
7327
7328 [station launchShip:self];
7329
7330 launchRoll = -flightRoll; // save the station's spin. (inverted for player)
7331 flightRoll = 0; // don't spin when showing the break pattern.
7332 [UNIVERSE setUpBreakPattern:[self breakPatternPosition] orientation:orientation forDocking:YES];
7333
7334 [self setDockedStation:nil];
7335
7337 [self checkForAegis];
7339 ident_engaged = NO;
7340
7341 [UNIVERSE removeDemoShips];
7342 // MKW - ensure GUI Screen ship is removed
7343 [demoShip release];
7344 demoShip = nil;
7345
7346 [self playLaunchFromStation];
7347}
GLfloat launchRoll
ShipEntity * demoShip
BOOL isMouseControlOn()
BOOL _missionWithCallback
unsigned suppressAegisMessages
Definition ShipEntity.h:272
void autoDockShipsOnApproach()
void launchShip:(ShipEntity *ship)
void clearDockingCorridor()

◆ leaveWitchspace

- (void) leaveWitchspace
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

7835{
7836 double d1 = SCANNER_MAX_RANGE * ((Ranrot() & 255)/256.0 - 0.5);
7837 HPVector pos = [UNIVERSE getWitchspaceExitPosition]; // no need to reset the PRNG
7838 Quaternion q1;
7840
7841 double min_d1 = [UNIVERSE safeWitchspaceExitDistance];
7843 if (abs((int)d1) < min_d1)
7844 {
7845 d1 += ((d1 > 0.0)? min_d1: -min_d1); // not too close to the buoy.
7846 }
7848 exitpos = HPvector_add(pos, HPvector_multiply_scalar(v1, d1)); // randomise exit position
7849 position = exitpos;
7850 [self setOrientation:[UNIVERSE getWitchspaceExitRotation]];
7851
7852 // While setting the wormhole position to the player position looks very nice for ships following the player,
7853 // the more common case of the player following other ships, the player tends to
7854 // ram the back of the ships, or even jump on top of is when the ship jumped without initial speed, which is messy.
7855 // To avoid this problem, a small wormhole displacement is added.
7856 if (wormhole) // will be nil for galactic jump
7857 {
7858 if ([[wormhole shipsInTransit] count] > 0)
7859 {
7860 // player is not allone in his wormhole, synchronise player and wormhole position.
7861 double wh_arrival_time = ([PLAYER clockTimeAdjusted] - [wormhole arrivalTime]);
7862 if (wh_arrival_time > 0)
7863 {
7864 // Player is following other ship
7866 [wormhole setContainsPlayer:YES];
7867 }
7868 else
7869 {
7870 // Player is the leadship
7872 // so it won't contain the player by the time they exit
7873 [wormhole setExitSpeed:maxFlightSpeed*WORMHOLE_LEADER_SPEED_FACTOR];
7874 }
7875
7876 HPVector distance = HPvector_subtract(whpos, pos);
7877 if (HPmagnitude2(distance) < min_d1*min_d1 ) // within safety distance from the buoy?
7878 {
7879 // the wormhole is to close to the buoy. Move both player and wormhole away from it in the x-y plane.
7880 distance.z = 0;
7881 distance = HPvector_multiply_scalar(HPvector_normal(distance), min_d1);
7882 whpos = HPvector_add(whpos, distance);
7883 position = HPvector_add(position, distance);
7884 }
7885 [wormhole setExitPosition: whpos];
7886 }
7887 else
7888 {
7889 // no-one else in the wormhole
7890 [wormhole setExitSpeed:maxFlightSpeed*WORMHOLE_LEADER_SPEED_FACTOR];
7891 }
7892 }
7893 /* there's going to be a slight pause at this stage anyway;
7894 * there's also going to be a lot of stale ship scripts. Force a
7895 * garbage collection while we have chance. - CIM */
7897 flightSpeed = wormhole ? [wormhole exitSpeed] : fmin(maxFlightSpeed,50.0f);
7898 [wormhole release]; // OK even if nil
7899 wormhole = nil;
7900
7901 flightRoll = 0.0f;
7902 flightPitch = 0.0f;
7903 flightYaw = 0.0f;
7904
7906 [self setStatus:STATUS_EXITING_WITCHSPACE];
7908 being_fined = NO; // until you're scanned by a copper!
7909 [self clearTargetMemory];
7910 [self setShowDemoShips:NO];
7911 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
7912 [UNIVERSE setDisplayText:NO];
7913 [UNIVERSE setWitchspaceBreakPattern:YES];
7914 [self playExitWitchspace];
7915 if ([self currentSystemID] >= 0)
7916 {
7918 {
7919 // going somewhere new?
7920 [self clearRoleFromPlayer:NO];
7921 }
7922 }
7923
7925 {
7926 [self doScriptEvent:OOJSID("playerEnteredNewGalaxy") withArgument:[NSNumber numberWithUnsignedInt:galaxy_number]];
7927 }
7928
7929 [self doScriptEvent:OOJSID("shipWillExitWitchspace") withArgument:[self jumpCause]];
7930 [UNIVERSE setUpBreakPattern:[self breakPatternPosition] orientation:orientation forDocking:NO];
7931}
#define SCANNER_MAX_RANGE
Definition Entity.h:51
HPVector HPvector_forward_from_quaternion(Quaternion quat)
void quaternion_set_random(Quaternion *quat)
Vector forwardVector()

◆ legalStatusOfCargoList

- (unsigned) legalStatusOfCargoList

Definition at line 13727 of file PlayerEntity.m.

8423{
8424 NSString *good = nil;
8426 unsigned penalty = 0;
8427
8428 foreach (good, [shipCommodityData goods])
8429 {
8430 amount = [shipCommodityData quantityForGood:good];
8432 }
8433 return penalty;
8434}

◆ loadCargoPods

- (void) loadCargoPods

Definition at line 13727 of file PlayerEntity.m.

476{
477 /* loads commodities from the ships manifest into individual cargo pods */
478 NSString *good = nil;
479 foreach (good, [shipCommodityData goods])
480 {
481 [self loadCargoPodsForType:good fromManifest:shipCommodityData];
482 }
483 [self calculateCurrentCargo]; // work out the correct value for current_cargo
484 cargo_dump_time = 0;
485}
OOTimeAbsolute cargo_dump_time
Definition ShipEntity.h:358

◆ loadCargoPodsForType:amount:

- (void) loadCargoPodsForType: (OOCommodityType type
amount: (OOCargoQuantity quantity 

Definition at line 13727 of file PlayerEntity.m.

414{
415 OOMassUnit unit = [shipCommodityData massUnitForGood:type];
416
417 while (quantity)
418 {
419 if (unit != UNITS_TONS)
420 {
422 while (quantity > 0)
423 {
425 if ([cargo count] < [self maxAvailableCargoSpace])
426 {
427 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
428 if (container)
429 {
430 // the cargopod ship is just being set up. If ejected, will call UNIVERSE addEntity
431 [container setStatus:STATUS_IN_HOLD];
432 [container setScanClass: CLASS_CARGO];
433 [container setCommodity:type andAmount:smaller_quantity];
434 [cargo addObject:container];
435 [container release];
436 }
437 }
438 else
439 {
440 // try to squeeze any surplus, up to half a ton, in the manifest.
441 int amount = [shipCommodityData quantityForGood:type] + smaller_quantity;
444
445 [shipCommodityData setQuantity:amount forGood:type];
446 }
448 }
449 }
450 else
451 {
452 // put each ton in a separate container
453 while (quantity)
454 {
455 if ([cargo count] < [self maxAvailableCargoSpace])
456 {
457 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
458 if (container)
459 {
460 // the cargopod ship is just being set up. If ejected, will call UNIVERSE addEntity
461 [container setScanClass: CLASS_CARGO];
462 [container setStatus:STATUS_IN_HOLD];
463 [container setCommodity:type andAmount:1];
464 [cargo addObject:container];
465 [container release];
466 }
467 }
468 quantity--;
469 }
470 }
471 }
472}

◆ loadCargoPodsForType:fromManifest:

- (void) loadCargoPodsForType: (OOCommodityType type
fromManifest: (OOCommodityMarket *)  manifest 

Definition at line 13727 of file PlayerEntity.m.

338{
339 // load commodities from the ships manifest into individual cargo pods
340 unsigned j;
341
342 OOCargoQuantity quantity = [manifest quantityForGood:type];
343 OOMassUnit units = [manifest massUnitForGood:type];
344
345 if (quantity > 0)
346 {
347 if (units == UNITS_TONS)
348 {
349 // easy case
350 for (j = 0; j < quantity; j++)
351 {
352 [self createCargoPodWithType:type andAmount:1]; // or CTD if unsuccesful (!)
353 }
354 [manifest setQuantity:0 forGood:type];
355 }
356 else
357 {
359 // reserve up to 1/2 ton of each commodity for the safe
360 if (units == UNITS_KILOGRAMS)
361 {
363 {
365 quantity = 0;
366 }
367 else
368 {
371 }
373 }
374 else
375 {
378 quantity = 0;
379 }
380 else
381 {
384 }
386 }
387 if (quantity > 0)
388 {
390 // this check is needed so that initial quantities like 1499kg or 1499999g
391 // do not result in generation of an empty cargopod
393
394 // put each ton or part-ton beyond that in a separate container
395 for (j = 0; j < podsRequiredForQuantity; j++)
396 {
398 {
399 // last pod gets the dregs. :)
401 }
402 [self createCargoPodWithType:type andAmount:amountToLoadInCargopod]; // or CTD if unsuccesful (!)
404 }
405 // adjust manifest for this commodity
406 [manifest setQuantity:tmpQuantity forGood:type];
407 }
408 }
409 }
410}
OOMassUnit massUnitForGood:(OOCommodityType good)
BOOL setQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)
OOCargoQuantity quantityForGood:(OOCommodityType good)

◆ loadKeySettings

- (NSDictionary *) loadKeySettings
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1733{
1734 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1735 return [defaults objectForKey:KEYCONFIG_OVERRIDES];
1736}

◆ loadPlayer

- (BOOL) loadPlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

102{
103 BOOL OK = YES;
104
105#if OO_USE_APPKIT_LOAD_SAVE_ALWAYS
106 OK = [self loadPlayerWithPanel];
107#elif OOLITE_USE_APPKIT_LOAD_SAVE
108 // OS X: use system open/save dialogs in windowed mode, custom interface in full-screen.
109 if ([[UNIVERSE gameController] inFullScreenMode])
110 {
111 [self setGuiToLoadCommanderScreen];
112 }
113 else
114 {
115 OK = [self loadPlayerWithPanel];
116 }
117#else
118 // Other platforms: use custom interface all the time.
119 [self setGuiToLoadCommanderScreen];
120#endif
121 return OK;
122}

◆ loadPlayerFromFile:asNew:

- (BOOL) loadPlayerFromFile: (NSString *)  fileToOpen
asNew: (BOOL asNew 

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

597 :(NSString *)fileToOpen asNew:(BOOL)asNew
598{
599 /* TODO: it would probably be better to load by creating a new
600 PlayerEntity, verifying that's OK, then replacing the global player.
601
602 Actually, it'd be better to separate PlayerEntity into OOPlayer and
603 OOPlayerShipEntity. And then move most of OOPlayerShipEntity into
604 ShipEntity, and make NPC ships behave more like player ships.
605 -- Ahruman
606 */
607
608 BOOL loadedOK = YES;
609 NSDictionary *fileDic = nil;
610 NSString *fail_reason = nil;
611
612 if (fileToOpen == nil)
613 {
614 fail_reason = DESC(@"loadfailed-no-file-specified");
615 loadedOK = NO;
616 }
617
618 if (loadedOK)
619 {
620 OOLog(@"load.progress", @"%@", @"Reading file");
621 fileDic = OODictionaryFromFile(fileToOpen);
622 if (fileDic == nil)
623 {
624 fail_reason = DESC(@"loadfailed-could-not-load-file");
625 loadedOK = NO;
626 }
627 }
628
629 if (loadedOK)
630 {
631 OOLog(@"load.progress", @"%@", @"Restricting scenario");
632 NSString *scenarioRestrict = [fileDic oo_stringForKey:@"scenario_restriction" defaultValue:nil];
633 if (scenarioRestrict == nil)
634 {
635 // older save game - use the 'strict' key instead
636 BOOL strict = [fileDic oo_boolForKey:@"strict" defaultValue:NO];
637 if (strict)
638 {
639 scenarioRestrict = SCENARIO_OXP_DEFINITION_NONE;
640 }
641 else
642 {
643 scenarioRestrict = SCENARIO_OXP_DEFINITION_ALL;
644 }
645 }
646
647 if (![UNIVERSE setUseAddOns:scenarioRestrict fromSaveGame:YES forceReinit:YES])
648 {
649 fail_reason = DESC(@"loadfailed-saved-game-failed-to-load");
650 loadedOK = NO;
651 }
652 }
653
654
655 if (loadedOK)
656 {
657 OOLog(@"load.progress", @"%@", @"Creating player ship");
658 // Check that player ship exists
659 NSString *shipKey = nil;
660 NSDictionary *shipDict = nil;
661
662 shipKey = [fileDic oo_stringForKey:@"ship_desc"];
663 shipDict = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipKey];
664
665 if (shipDict == nil)
666 {
667 loadedOK = NO;
668 if (shipKey != nil) fail_reason = [NSString stringWithFormat:DESC(@"loadfailed-could-not-find-ship-type-@-please-reinstall-the-appropriate-OXP"), shipKey];
669 else fail_reason = DESC(@"loadfailed-invalid-saved-game-no-ship-specified");
670 }
671 }
672
673 if (loadedOK)
674 {
675 OOLog(@"load.progress", @"%@", @"Initialising player entity");
676 if (![self setUpAndConfirmOK:YES saveGame:YES])
677 {
678 fail_reason = DESC(@"loadfailed-could-not-reset-javascript");
679 loadedOK = NO;
680 }
681 }
682
683 if (loadedOK)
684 {
685 OOLog(@"load.progress", @"%@", @"Loading commander data");
686 if (![self setCommanderDataFromDictionary:fileDic])
687 {
688 // this could still be a reset js issue, if switching from strict / unrestricted
689 // TODO: use "could not reset js message" if that's the case.
690 fail_reason = DESC(@"loadfailed-could-not-set-up-player-ship");
691 loadedOK = NO;
692 }
693 }
694
695 if (loadedOK)
696 {
697 OOLog(@"load.progress", @"%@", @"Recording save path");
698 if (!asNew)
699 {
700 [save_path autorelease];
701 save_path = [fileToOpen retain];
702
703 [[[UNIVERSE gameView] gameController] setPlayerFileToLoad:fileToOpen];
704 [[[UNIVERSE gameView] gameController] setPlayerFileDirectory:fileToOpen];
705 }
706 }
707 else
708 {
709 OOLog(@"load.failed", @"***** Failed to load saved game \"%@\": %@", [fileToOpen lastPathComponent], fail_reason ? fail_reason : (NSString *)@"unknown error");
710 [[UNIVERSE gameController] setPlayerFileToLoad:nil];
711 [UNIVERSE handleGameOver];
712 [UNIVERSE clearPreviousMessage];
713 [UNIVERSE addMessage:DESC(@"loadfailed-saved-game-failed-to-load") forCount: 9.0];
714 if (fail_reason != nil) [UNIVERSE addMessage: fail_reason forCount: 9.0];
715 return NO;
716 }
717
718 OOLog(@"load.progress", @"%@", @"Creating system");
719 [UNIVERSE setTimeAccelerationFactor:TIME_ACCELERATION_FACTOR_DEFAULT];
720 [UNIVERSE setSystemTo:system_id];
721 [UNIVERSE removeAllEntitiesExceptPlayer];
722 [UNIVERSE setGalaxyTo: galaxy_number andReinit:YES]; // set overridden planet names on long range map
723 [UNIVERSE setUpSpace];
724 [UNIVERSE setAutoSaveNow:NO];
725
726 OOLog(@"load.progress", @"%@", @"Resetting player flight variables");
727 [self setDockedAtMainStation];
728 StationEntity *dockedStation = [self dockedStation];
729
730 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
731
732 if (dockedStation)
733 {
734 position = [dockedStation position];
735 [self setOrientation: kIdentityQuaternion];
736 v_forward = vector_forward_from_quaternion(orientation);
737 v_right = vector_right_from_quaternion(orientation);
738 v_up = vector_up_from_quaternion(orientation);
739 }
740
741 flightRoll = 0.0;
742 flightPitch = 0.0;
743 flightYaw = 0.0;
744 flightSpeed = 0.0;
745
746 [self setEntityPersonalityInt:PersonalityForCommanderDict(fileDic)];
747
748 OOLog(@"load.progress", @"%@", @"Loading system market");
749 // dockedStation is always the main station at this point;
750 // "localMarket" save key always refers to the main station (system) market
751 NSArray *market = [fileDic oo_arrayForKey:@"localMarket"];
752 if (market != nil)
753 {
754 [dockedStation setLocalMarket:market];
755 }
756 else
757 {
758 [dockedStation initialiseLocalMarket];
759 }
760
761 [self calculateCurrentCargo];
762
763 OOLog(@"load.progress", @"%@", @"Setting scenario key");
764 // set scenario key if the scenario allows saving and has one
765 NSString *scenario = [fileDic oo_stringForKey:@"scenario_key" defaultValue:nil];
766 DESTROY(scenarioKey);
767 if (scenario != nil)
768 {
769 scenarioKey = [scenario retain];
770 }
771
772 OOLog(@"load.progress", @"%@", @"Starting JS engine");
773 // Remember the savegame target, run js startUp.
774 [self completeSetUpAndSetTarget:NO];
775 // run initial system population
776 OOLog(@"load.progress", @"%@", @"Populating initial system");
777 [UNIVERSE populateNormalSpace];
778
779 // might as well start off with a collected JS environment
781
782 // read saved position vector and primary role, check for an
783 // appropriate station at those coordinates, if found, switch
784 // docked station to that one.
785 HPVector dockedPos = [fileDic oo_hpvectorForKey:@"docked_station_position"];
786 NSString *dockedRole = [fileDic oo_stringForKey:@"docked_station_role" defaultValue:@""];
787 StationEntity *saveStation = [UNIVERSE stationWithRole:dockedRole andPosition:dockedPos];
788 if (saveStation != nil && [saveStation allowsSaving])
789 {
790 [self setDockedStation:saveStation];
791 position = [saveStation position];
792 }
793 // and initialise markets for the secondary stations
794 [UNIVERSE loadStationMarkets:[fileDic oo_arrayForKey:@"station_markets"]];
795
796 OOLog(@"load.progress", @"%@", @"Completing JS startup");
797 [self startUpComplete];
798
799 // if the file was specified in the command line at startup, DO NOT suppress the keys!
800 if ([[UNIVERSE gameController] finishedLaunching]) [[UNIVERSE gameView] suppressKeysUntilKeyUp];
801 if (asNew)
802 {
803 gui_screen = GUI_SCREEN_NEWGAME;
804 }
805 else
806 {
807 gui_screen = GUI_SCREEN_LOAD; // force evaluation of new gui screen on startup
808 }
809 [self setGuiToStatusScreen];
810 if (loadedOK) [self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")]; // trigger missionScreenOpportunity immediately after loading
811 OOLog(@"load.progress", @"%@", @"Loading complete");
812 return loadedOK;
813}
NSDictionary * OODictionaryFromFile(NSString *path)
Vector vector_up_from_quaternion(Quaternion quat)
Vector vector_right_from_quaternion(Quaternion quat)
Vector vector_forward_from_quaternion(Quaternion quat)
#define SCENARIO_OXP_DEFINITION_ALL
NSDictionary * shipInfoForKey:(NSString *key)

◆ localMarket

- (OOCommodityMarket *) localMarket

Definition at line 9242 of file PlayerEntity.m.

10828{
10829 StationEntity *station = [self dockedStation];
10830 if (station == nil)
10831 {
10832 if ([[self primaryTarget] isStation] && [(StationEntity *)[self primaryTarget] marketBroadcast])
10833 {
10834 station = [self primaryTarget];
10835 }
10836 else
10837 {
10838 station = [UNIVERSE station];
10839 }
10840 if (station == nil)
10841 {
10842 // interstellar space or similar
10843 return nil;
10844 }
10845 }
10847 if (localMarket == nil)
10848 {
10850 }
10851
10852 return localMarket;
10853}
OOCommodityMarket * localMarket

◆ localVariableForKey:andMission:

- (NSString *) localVariableForKey: (NSString *)  variableName
andMission: (NSString *)  missionKey 

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

685 :(NSString *)variableName andMission:(NSString *)missionKey
686{
687 return [[localVariables oo_dictionaryForKey:missionKey] objectForKey:variableName];
688}

◆ localVariablesForMission:

- (NSMutableDictionary *) localVariablesForMission: (NSString *)  missionKey

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

668 :(NSString *)missionKey
669{
670 NSMutableDictionary *result = nil;
671
672 if (missionKey == nil) return nil;
673
674 result = [localVariables objectForKey:missionKey];
675 if (result == nil)
676 {
677 result = [NSMutableDictionary dictionary];
678 [localVariables setObject:result forKey:missionKey];
679 }
680
681 return result;
682}

Referenced by PlayerEntity(Scripting)::PerformActionStatment.

+ Here is the caller graph for this function:

◆ longRangeChartMode

- (OOLongRangeChartMode) longRangeChartMode

◆ lookingAtSunWithThresholdAngleCos:

- (GLfloat) lookingAtSunWithThresholdAngleCos: (GLfloat thresholdAngleCos
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

2509{
2510 OOSunEntity *sun = [UNIVERSE sun];
2512 GLfloat sunBrightness = 0.0f;
2514
2515 if (EXPECT_NOT(!sun)) return 0.0f;
2516
2517 // check if camera position is shadowed
2518 OOViewID vdir = [UNIVERSE viewDirection];
2519 unsigned i;
2520 unsigned ent_count = UNIVERSE->n_entities;
2521 Entity **uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
2522 for (i = 0; i < ent_count; i++)
2523 {
2524 if (uni_entities[i]->isSunlit)
2525 {
2526 if ([uni_entities[i] isPlanet] ||
2527 ([uni_entities[i] isShip] &&
2529 {
2530 // the player ship can't shadow internal views
2532 {
2533 float shadow = 1.5f;
2535 /* BUG: if the shadowing entity is not spherical, this gives over-shadowing. True elsewhere as well, but not so obvious there. */
2536 if (shadow < 1) {
2537 return 0.0f;
2538 }
2539 }
2540 }
2541 }
2542 }
2543
2544
2547 switch (vdir)
2548 {
2549 case VIEW_FORWARD:
2551 break;
2552 case VIEW_AFT:
2554 break;
2555 case VIEW_PORT:
2557 break;
2558 case VIEW_STARBOARD:
2560 break;
2561 case VIEW_CUSTOM:
2562 {
2563 Vector relativeView = [self customViewForwardVector];
2566 }
2567 break;
2568
2569 default:
2570 break;
2571 }
2573 /*
2574 Bugfix: 1.1f - floating point errors can mean the dot product of two
2575 normalised vectors can be very slightly more than 1, which can
2576 cause extreme flickering of the glare at certain ranges to the
2577 sun. The real test is just that it's not still 999 - CIM
2578 */
2579 if (thresholdAngleCos <= measuredCosAbs && measuredCosAbs <= 1.1f) // angle from viewpoint to sun <= desired threshold
2580 {
2582// OOLog(@"glare.debug",@"raw brightness = %f",sunBrightness);
2583 if (sunBrightness < 0.0f) sunBrightness = 0.0f;
2584 else if (sunBrightness > 1.0f) sunBrightness = 1.0f;
2585 }
2586// OOLog(@"glare.debug",@"cos=%f, threshold = %f, brightness = %f",measuredCosAbs,thresholdAngleCos,sunBrightness);
2588}
BOOL shadowAtPointOcclusionToValue(HPVector e1pos, GLfloat e1rad, Entity *e2, OOSunEntity *the_sun, float *outValue)
OOViewID
Definition OOTypes.h:43
BOOL isPlanet()
Definition Entity.m:162
Vector relativePosition()
Definition Entity.m:637
unsigned isSunlit
Definition Entity.h:99
HPVector viewpointPosition()

◆ loseTargetStatus

- (void) loseTargetStatus

Definition at line 13727 of file PlayerEntity.m.

7069{
7070 if (!UNIVERSE)
7071 return;
7072 int ent_count = UNIVERSE->n_entities;
7073 Entity** uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
7074 Entity* my_entities[ent_count];
7075 int i;
7076 for (i = 0; i < ent_count; i++)
7077 my_entities[i] = [uni_entities[i] retain]; // retained
7078 for (i = 0; i < ent_count ; i++)
7079 {
7080 Entity* thing = my_entities[i];
7081 if (thing->isShip)
7082 {
7083 ShipEntity* ship = (ShipEntity *)thing;
7084 if (self == [ship primaryTarget])
7085 {
7086 [ship noteLostTarget];
7087 }
7088 }
7089 }
7090 for (i = 0; i < ent_count; i++)
7091 {
7092 [my_entities[i] release]; // released
7093 }
7094}

◆ lsCommanders:directory:pageNumber:highlightName:

- (void) lsCommanders: (GuiDisplayGen *)  gui
directory: (NSString*)  directory
pageNumber: (int page
highlightName: (NSString *)  highlightName 
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1011 of file PlayerEntityLoadSave.m.

1016 : (GuiDisplayGen *)gui
1017 directory: (NSString*) directory
1018 pageNumber: (int)page
1019 highlightName: (NSString *)highlightName
1020{
1021 NSFileManager *cdrFileManager=[NSFileManager defaultManager];
1022 int rangeStart=STARTROW;
1023 unsigned lastIndex;
1024 unsigned i;
1025 int row=STARTROW;
1026
1027 // cdrArray defined in PlayerEntity.h
1028 NSArray *cdrArray=[cdrFileManager commanderContentsOfPath: directory];
1029
1030 // get commander details so a brief rundown of the commander's details may
1031 // be displayed.
1032 if (!cdrDetailArray)
1033 cdrDetailArray=[[NSMutableArray alloc] init]; // alloc retains this so the retain further on in the code was unnecessary
1034 else
1035 [cdrDetailArray removeAllObjects];
1036
1037 [cdrDetailArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:
1038 @"YES", @"isParentFolder",
1039 [directory stringByDeletingLastPathComponent], @"saved_game_path", nil]];
1040
1041 for(i = 0; i < [cdrArray count]; i++)
1042 {
1043 NSString* path = [cdrArray objectAtIndex:i];
1044 BOOL exists, isDirectory = NO;
1045
1046 exists = [cdrFileManager fileExistsAtPath:path isDirectory:&isDirectory];
1047
1048 if (exists)
1049 {
1050 if (!isDirectory && [[[path pathExtension] lowercaseString] isEqualToString:@"oolite-save"])
1051 {
1052 NSDictionary *cdr = OODictionaryFromFile(path);
1053 if(cdr)
1054 {
1055 // okay use the same dictionary but add a 'saved_game_path' attribute
1056 NSMutableDictionary* cdr1 = [NSMutableDictionary dictionaryWithDictionary:cdr];
1057 [cdr1 setObject: @"YES" forKey:@"isSavedGame"];
1058 [cdr1 setObject: path forKey:@"saved_game_path"];
1059 [cdrDetailArray addObject: cdr1];
1060 }
1061 }
1062 if (isDirectory && ![[path lastPathComponent] hasPrefix:@"."])
1063 {
1064 [cdrDetailArray addObject: [NSDictionary dictionaryWithObjectsAndKeys: @"YES", @"isFolder", path, @"saved_game_path", nil]];
1065 }
1066 }
1067 }
1068
1069 if(![cdrDetailArray count])
1070 {
1071 // Empty directory; tell the user and exit immediately.
1072 [gui setText:DESC(@"loadsavescreen-no-commanders-found") forRow:STARTROW align:GUI_ALIGN_CENTER];
1073 return;
1074 }
1075
1076 [cdrDetailArray sortUsingFunction:sortCommanders context:NULL];
1077
1078 // Do we need to highlight a name?
1079 int highlightRowOnPage=STARTROW;
1080 int highlightIdx=0;
1081 if(highlightName)
1082 {
1083 highlightIdx=[self findIndexOfCommander: highlightName];
1084 if(highlightIdx < 0)
1085 {
1086 OOLog(@"save.list.commanders.commanderNotFound", @"Commander %@ doesn't exist, very bad", highlightName);
1087 highlightIdx=0;
1088 }
1089
1090 // figure out what page we need to be on
1091 page=highlightIdx/NUMROWS;
1092 highlightRowOnPage=highlightIdx % NUMROWS + STARTROW;
1093 }
1094
1095 // We now know for certain what page we're on -
1096 // set the first index of the first commander on this page.
1097 unsigned firstIndex=page * NUMROWS;
1098
1099 // Set up the GUI.
1100 OOGUITabSettings tabStop;
1101 tabStop[0]=0;
1102 tabStop[1]=160;
1103 tabStop[2]=270;
1104 [gui setTabStops: tabStop];
1105
1106 // clear text lines here
1107 for (i = EXITROW ; i < ENDROW + 1; i++)
1108 {
1109 [gui setText:@"" forRow:i align:GUI_ALIGN_LEFT];
1110 [gui setColor: [OOColor yellowColor] forRow: i];
1111 [gui setKey:GUI_KEY_SKIP forRow:i];
1112 }
1113
1114 [gui setColor: [OOColor greenColor] forRow: LABELROW];
1115 [gui setArray: [NSArray arrayWithObjects: DESC(@"loadsavescreen-commander-name"), DESC(@"loadsavescreen-rating"), nil]
1116 forRow:LABELROW];
1117
1118 if (page)
1119 {
1120 [gui setColor:[OOColor greenColor] forRow:STARTROW-1];
1121 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil]
1122 forRow:STARTROW-1];
1123 [gui setKey:GUI_KEY_OK forRow:STARTROW-1];
1124 rangeStart=STARTROW-1;
1125 }
1126
1127 if ([self status] == STATUS_START_GAME)
1128 {
1129 [gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-loadsave-exit"), @" <----- ", nil] forRow:EXITROW];
1130 [gui setColor:[OOColor redColor] forRow:EXITROW];
1131 [gui setKey:GUI_KEY_OK forRow:EXITROW];
1132 rangeStart = EXITROW;
1133 }
1134
1135
1136 if (firstIndex + NUMROWS >= [cdrDetailArray count])
1137 {
1138 lastIndex=[cdrDetailArray count];
1139 [gui setSelectableRange: NSMakeRange(rangeStart, rangeStart + NUMROWS + 2)];
1140 }
1141 else
1142 {
1143 lastIndex=(page * NUMROWS) + NUMROWS;
1144 [gui setColor:[OOColor greenColor] forRow:ENDROW];
1145 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil]
1146 forRow:ENDROW];
1147 [gui setKey:GUI_KEY_OK forRow:ENDROW];
1148 [gui setSelectableRange: NSMakeRange(rangeStart, MOREROW)];
1149 }
1150
1151 for (i=firstIndex; i < lastIndex; i++)
1152 {
1153 NSDictionary *cdr=[cdrDetailArray objectAtIndex: i];
1154 if ([cdr oo_boolForKey:@"isSavedGame"])
1155 {
1156 NSString *ratingDesc = OODisplayRatingStringFromKillCount([cdr oo_unsignedIntForKey:@"ship_kills"]);
1157 [gui setArray:[NSArray arrayWithObjects:
1158 [NSString stringWithFormat:@" %@ ",[cdr oo_stringForKey:@"player_save_name" defaultValue:[cdr oo_stringForKey:@"player_name"]]],
1159 [NSString stringWithFormat:@" %@ ",ratingDesc],
1160 nil]
1161 forRow:row];
1162 if ([[self lastsaveName] isEqualToString:[cdr oo_stringForKey:@"player_save_name" defaultValue:[cdr oo_stringForKey:@"player_name"]]])
1163 {
1164 highlightRowOnPage = row;
1165 }
1166
1167 [gui setKey:GUI_KEY_OK forRow:row];
1168 row++;
1169 }
1170 if ([cdr oo_boolForKey:@"isParentFolder"])
1171 {
1172 [gui setArray:[NSArray arrayWithObjects:
1173 [NSString stringWithFormat:@" (..) %@ ", [[cdr oo_stringForKey:@"saved_game_path"] lastPathComponent]],
1174 @"",
1175 nil]
1176 forRow:row];
1177 [gui setColor: [OOColor orangeColor] forRow: row];
1178 [gui setKey:GUI_KEY_OK forRow:row];
1179 row++;
1180 }
1181 if ([cdr oo_boolForKey:@"isFolder"])
1182 {
1183 [gui setArray:[NSArray arrayWithObjects:
1184 [NSString stringWithFormat:@" >> %@ ", [[cdr oo_stringForKey:@"saved_game_path"] lastPathComponent]],
1185 @"",
1186 nil]
1187 forRow:row];
1188 [gui setColor: [OOColor orangeColor] forRow: row];
1189 [gui setKey:GUI_KEY_OK forRow:row];
1190 row++;
1191 }
1192 }
1193 [gui setSelectedRow: highlightRowOnPage];
1194 highlightIdx = (highlightRowOnPage - STARTROW) + (currentPage * NUMROWS);
1195 // show the first ship, this will be the selected row
1196 [self showCommanderShip: highlightIdx];
1197}
OOGUITabStop OOGUITabSettings[GUI_MAX_COLUMNS]
#define ENDROW
void setTabStops:(OOGUITabSettings stops)
OOColor * redColor()
Definition OOColor.m:268
OOColor * yellowColor()
Definition OOColor.m:292

◆ makeKeyGuiDict:keyDef:

- (NSDictionary *) makeKeyGuiDict: (NSString *)  what
keyDef: (NSString *)  keyDef 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1133 :(NSString *)what keyDef:(NSString*)key_def
1134{
1135 NSMutableDictionary *guiDict = [NSMutableDictionary dictionary];
1136 if ([what length] > 50) what = [[what substringToIndex:48] stringByAppendingString:@"..."];
1137 [guiDict setObject:what forKey:KEY_KC_GUIDESC];
1138 [guiDict setObject:key_def forKey:KEY_KC_DEFINITION];
1139 return guiDict;
1140}

◆ makeKeyGuiDictHeader:

- (NSDictionary *) makeKeyGuiDictHeader: (NSString *)  header

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1143 :(NSString *)header
1144{
1145 NSMutableDictionary *guiDict = [NSMutableDictionary dictionary];
1146 [guiDict setObject:header forKey:KEY_KC_HEADER];
1147 [guiDict setObject:@"" forKey:KEY_KC_GUIDESC];
1148 [guiDict setObject:@"" forKey:KEY_KC_DEFINITION];
1149 return guiDict;
1150}

◆ makeStickGuiDict:allowable:axisfn:butfn:

- (NSDictionary *) makeStickGuiDict: (NSString *)  what
allowable: (int allowable
axisfn: (int axisfn
butfn: (int butfn 

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

903 :(NSString *)what
904 allowable:(int)allowable
905 axisfn:(int)axisfn
906 butfn:(int)butfn
907{
908 NSMutableDictionary *guiDict = [NSMutableDictionary dictionary];
909
910 if ([what length] > 50) what = [[what substringToIndex:28] stringByAppendingString:@"..."];
911 [guiDict setObject: what forKey: KEY_GUIDESC];
912 [guiDict setObject: [NSNumber numberWithInt: allowable]
913 forKey: KEY_ALLOWABLE];
914 if(axisfn >= 0)
915 [guiDict setObject: [NSNumber numberWithInt: axisfn]
916 forKey: KEY_AXISFN];
917 if(butfn >= 0)
918 [guiDict setObject: [NSNumber numberWithInt: butfn]
919 forKey: KEY_BUTTONFN];
920 return guiDict;
921}

◆ makeStickGuiDictHeader:

- (NSDictionary *) makeStickGuiDictHeader: (NSString *)  header

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

923 :(NSString *)header
924{
925 NSMutableDictionary *guiDict = [NSMutableDictionary dictionary];
926 [guiDict setObject:header forKey:KEY_HEADER];
927 [guiDict setObject:@"" forKey:KEY_ALLOWABLE];
928 [guiDict setObject:@"" forKey:KEY_AXISFN];
929 [guiDict setObject:@"" forKey:KEY_BUTTONFN];
930 return guiDict;
931}

◆ markAsOffender:

- (void) markAsOffender: (int offence_value
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6839{
6840 [self markAsOffender:offence_value withReason:kOOLegalStatusReasonUnknown];
6841}

◆ markAsOffender:withReason:

- (void) markAsOffender: (int offence_value
withReason: (OOLegalStatusReason reason 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6845{
6846 if (![self isCloaked])
6847 {
6848 JSContext *context = OOJSAcquireContext();
6849
6853
6854 legalStatus |= offence_value; // can't set the new bounty until the size of the change is known
6855
6857
6858 ShipScriptEvent(context, self, "shipBountyChanged", amountVal, reasonVal);
6859
6860 OOJSRelinquishContext(context);
6861
6862 }
6863}
OOINLINE jsval OOJSValueFromLegalStatusReason(JSContext *context, OOLegalStatusReason value)
OOLegalStatusReason
Definition OOTypes.h:157

◆ markedDestinations

- (NSDictionary *) markedDestinations

Definition at line 13727 of file PlayerEntity.m.

8745{
8746 // get a list of systems marked as contract destinations
8747 NSMutableDictionary *destinations = [NSMutableDictionary dictionaryWithCapacity:256];
8748 unsigned i;
8751
8752 for (i = 0; i < [passengers count]; i++)
8753 {
8754 sysid = [[passengers oo_dictionaryAtIndex:i] oo_unsignedCharForKey:CONTRACT_KEY_DESTINATION];
8755 marker = [self passengerContractMarker:sysid];
8756 [self prepareMarkedDestination:destinations:marker];
8757 }
8758 for (i = 0; i < [parcels count]; i++)
8759 {
8760 sysid = [[parcels oo_dictionaryAtIndex:i] oo_unsignedCharForKey:CONTRACT_KEY_DESTINATION];
8761 marker = [self parcelContractMarker:sysid];
8762 [self prepareMarkedDestination:destinations:marker];
8763 }
8764 for (i = 0; i < [contracts count]; i++)
8765 {
8766 sysid = [[contracts oo_dictionaryAtIndex:i] oo_unsignedCharForKey:CONTRACT_KEY_DESTINATION];
8767 marker = [self cargoContractMarker:sysid];
8768 [self prepareMarkedDestination:destinations:marker];
8769 }
8770
8771 NSString *key = nil;
8772
8774 {
8775 marker = [missionDestinations objectForKey:key];
8776 [self prepareMarkedDestination:destinations:marker];
8777 }
8778
8779 return destinations;
8780}

◆ markerKey:

- (NSString *) markerKey: (NSDictionary*)  marker

Definition at line 9242 of file PlayerEntity.m.

13314{
13315 return [NSString stringWithFormat:@"%d-%@",[marker oo_intForKey:@"system"], [marker oo_stringForKey:@"name"]];
13316}

◆ marketScreenTitle

- (NSString *) marketScreenTitle
implementation

Definition at line 9242 of file PlayerEntity.m.

11010{
11011 StationEntity *dockedStation = [self dockedStation];
11012
11013 /* Override normal behaviour if station broadcasts market */
11014 if (dockedStation == nil)
11015 {
11016 if ([[self primaryTarget] isStation] && [(StationEntity *)[self primaryTarget] marketBroadcast])
11017 {
11018 dockedStation = [self primaryTarget];
11019 }
11020 }
11021
11022 NSString *system = nil;
11023 if ([UNIVERSE sun] != nil) system = [UNIVERSE getSystemName:system_id];
11024
11025 if (dockedStation == nil || dockedStation == [UNIVERSE station])
11026 {
11027 if ([UNIVERSE sun] != nil)
11028 {
11029 return OOExpandKey(@"system-commodity-market", system);
11030 }
11031 else
11032 {
11033 // Witchspace
11034 return OOExpandKey(@"commodity-market");
11035 }
11036 }
11037 else
11038 {
11039 NSString *station = [dockedStation displayName];
11040 return OOExpandKey(@"station-commodity-market", station);
11041 }
11042}

◆ massLockable

- (BOOL) massLockable

◆ massLocked

- (BOOL) massLocked

Definition at line 13727 of file PlayerEntity.m.

4474{
4475 return ((alertFlags & ALERT_FLAG_MASS_LOCK) != 0);
4476}

◆ maxAftShieldLevel

- (float) maxAftShieldLevel
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4654{
4655 return max_aft_shield;
4656}
GLfloat max_aft_shield

◆ maxForwardShieldLevel

- (float) maxForwardShieldLevel
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4648{
4649 return max_forward_shield;
4650}
GLfloat max_forward_shield

◆ maxPlayerRoles

- (NSUInteger) maxPlayerRoles

Definition at line 13727 of file PlayerEntity.m.

5152{
5153 if (ship_kills >= 6400)
5154 {
5155 return 32;
5156 }
5157 else if (ship_kills >= 128)
5158 {
5159 return 16;
5160 }
5161 else
5162 {
5163 return 8;
5164 }
5165}

◆ messageShipAIs:

- (void) messageShipAIs: (NSString *)  roles_message

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1463 :(NSString *)roles_message
1464{
1465 NSMutableArray* tokens = ScanTokensFromString(roles_message);
1466 NSString* roleString = nil;
1467 NSString* messageString = nil;
1468
1469 if ([tokens count] < 2)
1470 {
1471 OOLog(kOOLogSyntaxMessageShipAIs, @"***** SCRIPT ERROR: in %@, CANNOT messageShipAIs: '%@' (bad parameter count)", CurrentScriptDesc(), roles_message);
1472 return;
1473 }
1474
1475 roleString = [tokens objectAtIndex:0];
1476 [tokens removeObjectAtIndex:0];
1477 messageString = [tokens componentsJoinedByString:@" "];
1478
1479 NSArray *targets = [UNIVERSE findShipsMatchingPredicate:HasPrimaryRolePredicate
1480 parameter:roleString
1481 inRange:-1
1482 ofEntity:nil];
1483
1484 ShipEntity *target;
1485 foreach(target, targets) {
1486 [[target getAI] reactToMessage:messageString context:@"messageShipAIs:"];
1487 }
1488}
static NSString *const kOOLogSyntaxMessageShipAIs
void reactToMessage:context:(NSString *message,[context] NSString *debugContext)
Definition AI.m:404

◆ missileForPylon:

- (ShipEntity *) missileForPylon: (NSUInteger value

Definition at line 13727 of file PlayerEntity.m.

5689 :(NSUInteger)value
5690{
5691 if (value < max_missiles) return missile_entity[value];
5692 return nil;
5693}

◆ missilesList

- (NSArray *) missilesList
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

8345{
8346 [self tidyMissilePylons]; // just in case.
8347 return [super missilesList];
8348}

◆ missingSubEntitiesAdjustment

- (NSInteger) missingSubEntitiesAdjustment

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1698{
1699 // each missing subentity depreciates the ship by 5%, up to a maximum of 35% depreciation.
1700 NSUInteger percent = 5 * ([self maxShipSubEntities] - [[[self shipSubEntityEnumerator] allObjects] count]);
1701 return (percent > 35 ? 35 : percent);
1702}

◆ mission_string

- (NSString *) mission_string

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

907{
908 return sMissionStringValue;
909}
static NSString * sMissionStringValue

◆ missionBackgroundDescriptor

- (NSDictionary *) missionBackgroundDescriptor

Definition at line 9242 of file PlayerEntity.m.

12722{
12724}

◆ missionBackgroundDescriptorOrDefault

- (NSDictionary *) missionBackgroundDescriptorOrDefault

Definition at line 9242 of file PlayerEntity.m.

12728{
12729 NSDictionary *result = [self missionBackgroundDescriptor];
12730 if (result == nil)
12731 {
12732 result = [UNIVERSE screenTextureDescriptorForKey:@"mission"];
12733 }
12734
12735 return result;
12736}

◆ missionBackgroundSpecial

- (OOGUIBackgroundSpecial) missionBackgroundSpecial

Definition at line 9242 of file PlayerEntity.m.

12750{
12752}

◆ missionChoice_string

- (NSString *) missionChoice_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1067{
1068 return missionChoice;
1069}

◆ missionExitScreen

- (OOGUIScreenID) missionExitScreen

Definition at line 9242 of file PlayerEntity.m.

12852{
12853 return _missionExitScreen;
12854}
OOGUIScreenID _missionExitScreen

◆ missionKeyPress_string

- (NSString *) missionKeyPress_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1073{
1074 return missionKeyPress;
1075}

◆ missionOverlayDescriptor

- (NSDictionary *) missionOverlayDescriptor

Definition at line 9242 of file PlayerEntity.m.

12687{
12689}

◆ missionOverlayDescriptorOrDefault

- (NSDictionary *) missionOverlayDescriptorOrDefault

Definition at line 9242 of file PlayerEntity.m.

12693{
12694 NSDictionary *result = [self missionOverlayDescriptor];
12695 if (result == nil)
12696 {
12697 if ([[self missionTitle] length] == 0)
12698 {
12699 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_no_title"];
12700 }
12701 else
12702 {
12703 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_with_title"];
12704 }
12705 }
12706
12707 return result;
12708}

◆ missionScreenID

- (NSString *) missionScreenID

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2459{
2460 return _missionScreenID;
2461}

Referenced by MissionGetProperty().

+ Here is the caller graph for this function:

◆ missionsList

- (NSArray *) missionsList

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

711{
712 NSEnumerator *scriptEnum = nil;
713 NSString *scriptName = nil;
714 NSString *vars = nil;
715 NSMutableArray *result1 = nil;
716 NSMutableArray *result2 = nil;
717
718 result1 = [NSMutableArray array];
719 result2 = [NSMutableArray array];
720
721 NSArray* passengerManifest = [self passengerList];
722 NSArray* contractManifest = [self contractList];
723 NSArray* parcelManifest = [self parcelList];
724
725 if ([passengerManifest count] > 0)
726 {
727 [result2 addObject:[[NSArray arrayWithObject:DESC(@"manifest-passengers")] arrayByAddingObjectsFromArray:passengerManifest]];
728 }
729
730 if ([parcelManifest count] > 0)
731 {
732 [result2 addObject:[[NSArray arrayWithObject:DESC(@"manifest-parcels")] arrayByAddingObjectsFromArray:parcelManifest]];
733 }
734
735 if ([contractManifest count] > 0)
736 {
737 [result2 addObject:[[NSArray arrayWithObject:DESC(@"manifest-contracts")] arrayByAddingObjectsFromArray:contractManifest]];
738 }
739
740 /* For proper display, array entries need to all be after string
741 * entries, so sort them now */
742 for (scriptEnum = [worldScripts keyEnumerator]; (scriptName = [scriptEnum nextObject]); )
743 {
744 vars = [mission_variables objectForKey:scriptName];
745
746 if (vars != nil)
747 {
748 if ([vars isKindOfClass:[NSString class]])
749 {
750 [result1 addObject:vars];
751 }
752 else if ([vars isKindOfClass:[NSArray class]])
753 {
754 BOOL found = NO;
755 NSArray *element = nil;
756 foreach (element, result2)
757 {
758 if ([[element oo_stringAtIndex:0] isEqualToString:[(NSArray*)vars oo_stringAtIndex:0]])
759 {
760
761 [result2 removeObject:element];
762 NSRange notTheHeader;
763 notTheHeader.location = 1;
764 notTheHeader.length = [(NSArray*)vars count]-1;
765 [result2 addObject:[element arrayByAddingObjectsFromArray:[(NSArray*)vars subarrayWithRange:notTheHeader]]];
766 found = YES;
767 break;
768 }
769 }
770 if (!found)
771 {
772 [result2 addObject:vars];
773 }
774 }
775 }
776 }
777 return [result1 arrayByAddingObjectsFromArray:result2];
778}

◆ missionTitle

- (NSString *) missionTitle

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2172{
2173 return _missionTitle;
2174}

◆ missionVariableForKey:

- (NSString *) missionVariableForKey: (NSString *)  key

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

650 :(NSString *)key
651{
652 NSString *result = nil;
653 if (key != nil) result = [mission_variables objectForKey:key];
654 return result;
655}

Referenced by MissionVariablesGetProperty().

+ Here is the caller graph for this function:

◆ missionVariables

- (NSDictionary *) missionVariables

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

645{
646 return mission_variables;
647}

◆ mountMissile:

- (BOOL) mountMissile: (ShipEntity *)  missile

Definition at line 13727 of file PlayerEntity.m.

5929{
5930 if (missile == nil) return NO;
5931
5932 unsigned i;
5933 for (i = 0; i < max_missiles; i++)
5934 {
5935 if (missile_entity[i] == nil)
5936 {
5937 missile_entity[i] = [missile retain];
5939 missiles++;
5940 if (missiles == 1) [self setActiveMissile:0]; // auto select the first purchased missile
5941 return YES;
5942 }
5943 }
5944
5945 return NO;
5946}

◆ mountMissileWithRole:

- (BOOL) mountMissileWithRole: (NSString *)  role

Definition at line 13727 of file PlayerEntity.m.

5949 :(NSString *)role
5950{
5951 if ([self missileCount] >= [self missileCapacity]) return NO;
5952 return [self mountMissile:[[UNIVERSE newShipWithRole:role] autorelease]];
5953}
NSUInteger missileCount()
NSUInteger missileCapacity()

Referenced by ShipAwardEquipment().

+ Here is the caller graph for this function:

◆ moveForward:

- (void) moveForward: (double amount
implementation

Reimplemented from Entity.

Definition at line 13727 of file PlayerEntity.m.

4357 :(double) amount
4358{
4360 [self setPosition:HPvector_add(position, vectorToHPVector(vector_multiply_scalar(v_forward, (float)amount)))];
4361}
GLfloat distanceTravelled
Definition Entity.h:136

◆ moveTargetMemoryBy:

- (BOOL) moveTargetMemoryBy: (NSInteger delta

Definition at line 9242 of file PlayerEntity.m.

12357{
12358 unsigned i = 0;
12359 while (i++ < PLAYER_TARGET_MEMORY_SIZE) // limit loops
12360 {
12362 while (idx < 0) idx += PLAYER_TARGET_MEMORY_SIZE;
12365
12366 id targ_id = [target_memory objectAtIndex:target_memory_index];
12367 if ([targ_id isProxy])
12368 {
12369 ShipEntity *potential_target = [(OOWeakReference *)targ_id weakRefUnderlyingObject];
12370
12372 {
12374 {
12375 [super addTarget:potential_target];
12377 {
12379 {
12380 [missile_entity[activeMissile] addTarget:potential_target];
12382 [self printIdentLockedOnForMissile:YES];
12383 }
12384 else
12385 {
12387 [self playIdentLockedOn];
12388 [self printIdentLockedOnForMissile:NO];
12389 }
12390 }
12391 else
12392 {
12394 [self printIdentLockedOnForMissile:NO];
12395 }
12396 [self playTargetSwitched];
12397 return YES;
12398 }
12399 }
12400 else
12401 {
12402 [target_memory replaceObjectAtIndex:target_memory_index withObject:[NSNull null]];
12403 }
12404 }
12405 }
12406
12407 [self playNoTargetInMemory];
12408 return NO;
12409}
BOOL isInSpace()
Definition Entity.m:1134

◆ multiFunctionDisplayList

- (NSArray *) multiFunctionDisplayList

Definition at line 13727 of file PlayerEntity.m.

5511{
5513}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ multiFunctionText:

- (NSString *) multiFunctionText: (NSUInteger index

Definition at line 13727 of file PlayerEntity.m.

5516 :(NSUInteger)i
5517{
5518 NSString *key = [multiFunctionDisplaySettings oo_stringAtIndex:i defaultValue:nil];
5519 if (key == nil)
5520 {
5521 return nil;
5522 }
5523 NSString *text = [multiFunctionDisplayText oo_stringForKey:key defaultValue:nil];
5524 return text;
5525}

◆ mungChecksumWithNSString:

- (void) mungChecksumWithNSString: (NSString *)  str

Definition at line 9242 of file PlayerEntity.m.

12217 :(NSString *)str
12218{
12219 if (str == nil) return;
12220
12221 NSUInteger i, length = [str length];
12222 for (i = 0; i < length; i++)
12223 {
12225 }
12226}

◆ nativeSavePlayer:

- (void) nativeSavePlayer: (NSString *)  cdrName
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1420 of file PlayerEntityLoadSave.m.

907 :(NSString *)cdrName
908{
909 NSString* dir = [[UNIVERSE gameController] playerFileDirectory];
910 NSString *savePath = [dir stringByAppendingPathComponent:[cdrName stringByAppendingPathExtension:@"oolite-save"]];
911
912 ShipScriptEventNoCx(self, "playerWillSaveGame", OOJSSTR("STANDARD_SAVE"));
913
914 [self setLastsaveName:cdrName];
915
916 [self writePlayerToPath:savePath];
917}

◆ newShipCommonSetup:yardInfo:baseInfo:

- (void) newShipCommonSetup: (NSString *)  shipKey
yardInfo: (NSDictionary *)  ship_info
baseInfo: (NSDictionary *)  ship_base_dict 

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1883 :(NSString *)shipKey yardInfo:(NSDictionary *)ship_info baseInfo:(NSDictionary *)ship_base_dict
1884{
1885 // Zero out our manifest.
1886 [shipCommodityData removeAllGoods];
1887 current_cargo = 0;
1888
1889 // drop all passengers
1890 [passengers removeAllObjects];
1891 [passenger_record removeAllObjects];
1892
1893 // parcels stay the same; easy to transfer between ships
1894 // contracts stay the same, so if you default - tough!
1895 // okay we need to switch the model used, lots of the stats, and add all the extras
1896
1897 [self clearSubEntities];
1898
1899 [self setShipDataKey:shipKey];
1900
1901 NSDictionary *shipDict = ship_base_dict;
1902
1903
1904 // get a full tank for free
1905 [self setFuel:[self fuelCapacity]];
1906
1907 // get forward_weapon aft_weapon port_weapon starboard_weapon from ship_info
1908 int base_facings = [shipDict oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:15];
1909 int available_facings = [ship_info oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:base_facings];
1910
1911 // not retained - weapon types are references to the objects in OOEquipmentType's cache
1912 if (available_facings & WEAPON_FACING_AFT)
1913 aft_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy([shipDict oo_stringForKey:@"aft_weapon_type"]);
1914 else
1915 aft_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy(@"EQ_WEAPON_NONE");
1916
1917 if (available_facings & WEAPON_FACING_PORT)
1918 port_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy([shipDict oo_stringForKey:@"port_weapon_type"]);
1919 else
1920 port_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy(@"EQ_WEAPON_NONE");
1921
1922 if (available_facings & WEAPON_FACING_STARBOARD)
1923 starboard_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy([shipDict oo_stringForKey:@"starboard_weapon_type"]);
1924 else
1925 starboard_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy(@"EQ_WEAPON_NONE");
1926
1927 if (available_facings & WEAPON_FACING_FORWARD)
1928 forward_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy([shipDict oo_stringForKey:@"forward_weapon_type"]);
1929 else
1930 forward_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy(@"EQ_WEAPON_NONE");
1931
1932 // new ships start with weapons online
1933 weapons_online = 1;
1934
1935 // get basic max_cargo
1936 max_cargo = [UNIVERSE maxCargoForShip:[self shipDataKey]];
1937
1938 // ensure all missiles are tidied up and start at pylon 0
1939 [self tidyMissilePylons];
1940
1941 // get missiles from ship_info
1942 missiles = [shipDict oo_unsignedIntForKey:@"missiles"];
1943
1944 // reset max_passengers
1945 max_passengers = 0;
1946
1947 // reset and refill extra_equipment then set flags from it
1948
1949 // keep track of portable equipment..
1950
1951 NSMutableSet *portable_equipment = [NSMutableSet set];
1952 NSEnumerator *eqEnum = nil;
1953 NSString *eq_desc = nil;
1954 OOEquipmentType *item = nil;
1955
1956 for (eqEnum = [self equipmentEnumerator]; (eq_desc = [eqEnum nextObject]);)
1957 {
1959 if ([item isPortableBetweenShips]) [portable_equipment addObject:eq_desc];
1960 }
1961
1962 // remove ALL
1963 [self removeAllEquipment];
1964
1965 // restore portable equipment
1966 for (eqEnum = [portable_equipment objectEnumerator]; (eq_desc = [eqEnum nextObject]); )
1967 {
1968 [self addEquipmentItem:eq_desc withValidation:NO inContext:@"portable"];
1969 }
1970
1971
1972 // set up subentities from scratch; new ship could carry more or fewer than the old one
1973 [self setUpSubEntities];
1974
1975 // clear old ship names
1976 [self setShipClassName:[shipDict oo_stringForKey:@"name"]];
1977 [self setShipUniqueName:@""];
1978
1979 // new ship, so lose some memory of actions
1980 // new ship, so lose some memory of player actions
1981 if (ship_kills >= 6400)
1982 {
1983 [self clearRolesFromPlayer:0.1];
1984 }
1985 else if (ship_kills >= 2560)
1986 {
1987 [self clearRolesFromPlayer:0.25];
1988 }
1989 else
1990 {
1991 [self clearRolesFromPlayer:0.5];
1992 }
1993
1994}
OOWeaponType OOWeaponTypeFromEquipmentIdentifierSloppy(NSString *string) PURE_FUNC

◆ nextHopTargetSystemID

- (OOSystemID) nextHopTargetSystemID

Definition at line 13727 of file PlayerEntity.m.

726{
727 // not available if no ANA
728 if (![self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
729 {
730 return target_system_id;
731 }
732 // not available if ANA is turned off
734 {
735 return target_system_id;
736 }
737 // easy case
739 {
740 return system_id; // no need to calculate
741 }
743 routeInfo = [UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode];
744 // no route to destination
745 if (routeInfo == nil)
746 {
747 return target_system_id;
748 }
749 return [[routeInfo oo_arrayForKey:@"route"] oo_intAtIndex:1];
750}
@ OPTIMIZED_BY_NONE
Definition OOTypes.h:34

◆ nextInfoSystem

- (void) nextInfoSystem

Definition at line 13727 of file PlayerEntity.m.

795{
797 {
798 [self setInfoSystemID: target_system_id moveChart: YES];
799 return;
800 }
801 NSArray *route = [[[UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode] oo_arrayForKey: @"route"] retain];
803 if (route == nil)
804 {
805 [self setInfoSystemID: target_system_id moveChart: YES];
806 return;
807 }
808 for (i = 0; i < [route count]; i++)
809 {
811 {
812 if (i + 1 < [route count])
813 {
814 [self setInfoSystemID:[[route objectAtIndex:i + 1] unsignedIntValue] moveChart: YES];
815 [route release];
816 return;
817 }
818 break;
819 }
820 }
821 [route release];
822 [self setInfoSystemID: target_system_id moveChart: YES];
823 return;
824}

◆ normaliseReputation

- (void) normaliseReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

819{
820 int c_good = [reputation oo_intForKey:CONTRACTS_GOOD_KEY];
821 int c_bad = [reputation oo_intForKey:CONTRACTS_BAD_KEY];
822 int c_unknown = [reputation oo_intForKey:CONTRACTS_UNKNOWN_KEY];
823 int p_good = [reputation oo_intForKey:PASSAGE_GOOD_KEY];
824 int p_bad = [reputation oo_intForKey:PASSAGE_BAD_KEY];
825 int p_unknown = [reputation oo_intForKey:PASSAGE_UNKNOWN_KEY];
826 int pl_good = [reputation oo_intForKey:PARCEL_GOOD_KEY];
827 int pl_bad = [reputation oo_intForKey:PARCEL_BAD_KEY];
828 int pl_unknown = [reputation oo_intForKey:PARCEL_UNKNOWN_KEY];
829
830 int c = c_good + c_bad + c_unknown;
831 if (c == 0)
832 {
833 c_unknown = MAX_CONTRACT_REP;
834 }
835 else if (c != MAX_CONTRACT_REP)
836 {
837 c_good = c_good * MAX_CONTRACT_REP / c;
838 c_bad = c_bad * MAX_CONTRACT_REP / c;
839 c_unknown = MAX_CONTRACT_REP - c_good - c_bad;
840 }
841
842 int p = p_good + p_bad + p_unknown;
843 if (p == 0)
844 {
845 p_unknown = MAX_CONTRACT_REP;
846 }
847 else if (p != MAX_CONTRACT_REP)
848 {
849 p_good = p_good * MAX_CONTRACT_REP / p;
850 p_bad = p_bad * MAX_CONTRACT_REP / p;
851 p_unknown = MAX_CONTRACT_REP - p_good - p_bad;
852 }
853
854 int pl = pl_good + pl_bad + pl_unknown;
855 if (pl == 0)
856 {
857 pl_unknown = MAX_CONTRACT_REP;
858 }
859 else if (pl != MAX_CONTRACT_REP)
860 {
861 pl_good = pl_good * MAX_CONTRACT_REP / pl;
862 pl_bad = pl_bad * MAX_CONTRACT_REP / pl;
863 pl_unknown = MAX_CONTRACT_REP - pl_good - pl_bad;
864 }
865
866 [reputation setObject:[NSNumber numberWithInt:c_good] forKey:CONTRACTS_GOOD_KEY];
867 [reputation setObject:[NSNumber numberWithInt:c_bad] forKey:CONTRACTS_BAD_KEY];
868 [reputation setObject:[NSNumber numberWithInt:c_unknown] forKey:CONTRACTS_UNKNOWN_KEY];
869 [reputation setObject:[NSNumber numberWithInt:p_good] forKey:PASSAGE_GOOD_KEY];
870 [reputation setObject:[NSNumber numberWithInt:p_bad] forKey:PASSAGE_BAD_KEY];
871 [reputation setObject:[NSNumber numberWithInt:p_unknown] forKey:PASSAGE_UNKNOWN_KEY];
872 [reputation setObject:[NSNumber numberWithInt:pl_good] forKey:PARCEL_GOOD_KEY];
873 [reputation setObject:[NSNumber numberWithInt:pl_bad] forKey:PARCEL_BAD_KEY];
874 [reputation setObject:[NSNumber numberWithInt:pl_unknown] forKey:PARCEL_UNKNOWN_KEY];
875
876}

◆ normalOrientation

- (Quaternion) normalOrientation
implementation

Reimplemented from Entity.

Definition at line 13727 of file PlayerEntity.m.

4346{
4348}

◆ noteCompassLostTarget

- (void) noteCompassLostTarget
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

7523{
7524 if ([[self hud] isCompassActive])
7525 {
7526 // "the compass, it says we're lost!" :)
7527 JSContext *context = OOJSAcquireContext();
7529 ShipScriptEvent(context, self, "compassTargetChanged", JSVAL_VOID, jsmode);
7530 OOJSRelinquishContext(context);
7531
7532 [[self hud] setCompassActive:NO]; // ensure a target change when returning to normal space.
7533 }
7534}
OOINLINE jsval OOJSValueFromCompassMode(JSContext *context, OOCompassMode value)

◆ noteGUIDidChangeFrom:to:

- (void) noteGUIDidChangeFrom: (OOGUIScreenID fromScreen
to: (OOGUIScreenID toScreen 

Definition at line 9242 of file PlayerEntity.m.

10149{
10150 [self noteGUIDidChangeFrom: fromScreen to: toScreen refresh: NO];
10151}

◆ noteGUIDidChangeFrom:to:refresh:

- (void) noteGUIDidChangeFrom: (OOGUIScreenID fromScreen
to: (OOGUIScreenID toScreen
refresh: (BOOL refresh 

Definition at line 9242 of file PlayerEntity.m.

10155{
10156 // No events triggered if we're changing screens while paused, or if screen never actually changed.
10157 if (fromScreen != toScreen || refresh)
10158 {
10159 // MKW - release GUI Screen ship, if we have one
10160 switch (fromScreen)
10161 {
10163 case GUI_SCREEN_LOAD:
10164 case GUI_SCREEN_SAVE:
10165 [demoShip release];
10166 demoShip = nil;
10167 break;
10168 default:
10169 // Nothing
10170 break;
10171
10172 }
10173
10175 {
10176 // system data screen: ensure correct sun light color is used on miniature planet
10177 [[UNIVERSE sun] setSunColor:[OOColor colorWithDescription:[[UNIVERSE systemManager] getProperty:@"sun_color" forSystem:info_system_id inGalaxy:[self galaxyNumber]]]];
10178 }
10179 else
10180 {
10181 // any other screen: reset local sun light color
10182 [[UNIVERSE sun] setSunColor:[OOColor colorWithDescription:[[UNIVERSE systemManager] getProperty:@"sun_color" forSystem:system_id inGalaxy:[self galaxyNumber]]]];
10183 }
10184
10185 if (![[UNIVERSE gameController] isGamePaused])
10186 {
10187 JSContext *context = OOJSAcquireContext();
10188 ShipScriptEvent(context, self, "guiScreenChanged", OOJSValueFromGUIScreenID(context, toScreen), OOJSValueFromGUIScreenID(context, fromScreen));
10189 OOJSRelinquishContext(context);
10190 }
10191 }
10192}
OOINLINE jsval OOJSValueFromGUIScreenID(JSContext *context, OOGUIScreenID value)

◆ noteGUIWillChangeTo:

- (void) noteGUIWillChangeTo: (OOGUIScreenID toScreen

Definition at line 9242 of file PlayerEntity.m.

10141{
10142 JSContext *context = OOJSAcquireContext();
10143 ShipScriptEvent(context, self, "guiScreenWillChange", OOJSValueFromGUIScreenID(context, toScreen), OOJSValueFromGUIScreenID(context, gui_screen));
10144 OOJSRelinquishContext(context);
10145}

◆ noteSwitchToView:fromView:

- (void) noteSwitchToView: (OOViewID toView
fromView: (OOViewID fromView 

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

846 :(OOViewID)toView fromView:(OOViewID)fromView
847{
848 [self switchToThisView:toView fromView:fromView andProcessWeaponFacing:NO justNotify:YES]; // no extra processing needed!
849}

Referenced by PlayerShipResetCustomView(), and PlayerShipSetCustomView().

+ Here is the caller graph for this function:

◆ noteViewDidChangeFrom:toView:

- (void) noteViewDidChangeFrom: (OOViewID fromView
toView: (OOViewID toView 

Definition at line 9242 of file PlayerEntity.m.

10196{
10197 [self noteSwitchToView:toView fromView:fromView];
10198}

◆ noticeECM

- (void) noticeECM
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6123{
6124 last_ecm_time = [UNIVERSE getTime];
6125}
double last_ecm_time

◆ occlusionLevel

- (float) occlusionLevel

Definition at line 13727 of file PlayerEntity.m.

4486{
4487 return occlusion_dial;
4488}
float occlusion_dial

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOJavaScriptExtensions).

Definition at line 1860 of file OOJSPlayerShip.m.

318{
319 return @"PlayerShip";
320}

◆ orientationChanged

- (void) orientationChanged
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

4272{
4276
4278 playerRotMatrix = OOMatrixForQuaternionRotation(orientation); // this is the rotation similar to ordinary ships
4280}
OOMatrix OOMatrixForQuaternionRotation(Quaternion orientation)
Definition OOMatrix.m:65
OOMatrix rotMatrix
Definition Entity.h:138

◆ outputKeyDefinition:shift:mod1:mod2:skiprows:

- (void) outputKeyDefinition: (NSString *)  key
shift: (NSString *)  shift
mod1: (NSString *)  mod1
mod2: (NSString *)  mod2
skiprows: (NSUInteger skiprows 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

505 :(NSString *)key shift:(NSString *)shift mod1:(NSString *)mod1 mod2:(NSString *)mod2 skiprows:(NSUInteger)skiprows
506{
507 GuiDisplayGen *gui=[UNIVERSE gui];
508
509 [gui setArray:[NSArray arrayWithObjects:
510 (skiprows == 0 ? DESC(@"oolite-keyconfig-update-key") : DESC(@"oolite-keyconfig-update-alternate")), key, nil]
511 forRow:GUI_ROW_KC_KEY + skiprows];
512 [gui setKey:GUI_KEY_OK forRow:GUI_ROW_KC_KEY + skiprows];
513
514 if (![nav_keys containsObject:[selected_entry objectForKey: KEY_KC_DEFINITION]]) {
515 if (![key isEqualToString:DESC(@"oolite-keycode-unset")])
516 {
517 [gui setArray:[NSArray arrayWithObjects:
518 DESC(@"oolite-keyconfig-update-shift"), shift, nil]
519 forRow:GUI_ROW_KC_SHIFT + skiprows];
520 [gui setKey:GUI_KEY_OK forRow:GUI_ROW_KC_SHIFT + skiprows];
521
522 // camera movement keys can't use ctrl
523 if (![camera_keys containsObject:[selected_entry objectForKey: KEY_KC_DEFINITION]]) {
524 [gui setArray:[NSArray arrayWithObjects:
525 DESC(@"oolite-keyconfig-update-mod1"), mod1, nil]
526 forRow:GUI_ROW_KC_MOD1 + skiprows];
527 [gui setKey:GUI_KEY_OK forRow:GUI_ROW_KC_MOD1 + skiprows];
528 }
529 else
530 {
531 [gui setArray:[NSArray arrayWithObjects:
532 DESC(@"oolite-keyconfig-update-mod1"), DESC(@"not-applicable"), nil]
533 forRow:GUI_ROW_KC_MOD1 + skiprows];
534 }
535
536#if OOLITE_MAC_OS_X
537 [gui setArray:[NSArray arrayWithObjects:
538 DESC(@"oolite-keyconfig-update-mod2-mac"), mod2, nil]
539 forRow:GUI_ROW_KC_MOD2 + skiprows];
540#else
541 [gui setArray:[NSArray arrayWithObjects:
542 DESC(@"oolite-keyconfig-update-mod2-pc"), mod2, nil]
543 forRow: GUI_ROW_KC_MOD2 + skiprows];
544#endif
545 [gui setKey:GUI_KEY_OK forRow:GUI_ROW_KC_MOD2 + skiprows];
546 }
547 }
548}
#define KEY_KC_DEFINITION

◆ overwriteCommanderInputHandler

- (void) overwriteCommanderInputHandler

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

562{
563 MyOpenGLView *gameView = [UNIVERSE gameView];
564 GuiDisplayGen *gui = [UNIVERSE gui];
565
566 [self handleGUIUpDownArrowKeys];
567
568 // Translation issue: we can't confidently use raw Y and N ascii as shortcuts. It's better to use the load-previous-commander keys.
569 id valueYes = [[[UNIVERSE descriptions] oo_stringForKey:@"load-previous-commander-yes" defaultValue:@"y"] lowercaseString];
570 id valueNo = [[[UNIVERSE descriptions] oo_stringForKey:@"load-previous-commander-no" defaultValue:@"n"] lowercaseString];
571 unsigned char cYes, cNo;
572
573 cYes = [valueYes characterAtIndex: 0] & 0x00ff; // Use lower byte of unichar.
574 cNo = [valueNo characterAtIndex: 0] & 0x00ff; // Use lower byte of unichar.
575
576 if (([self checkKeyPress:n_key_gui_select] && ([gui selectedRow] == SAVE_OVERWRITE_YES_ROW))||[gameView isDown:cYes]||[gameView isDown:cYes - 32])
577 {
578 pollControls=YES;
579 [self nativeSavePlayer: commanderNameString];
580 [self playSaveOverwriteYes];
581 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
582 [self setGuiToStatusScreen];
583 }
584
585 if (([self checkKeyPress:n_key_gui_select] && ([gui selectedRow] == SAVE_OVERWRITE_NO_ROW))||[gameView isDown:27]||[gameView isDown:cNo]||[gameView isDown:cNo - 32])
586 {
587 // esc or NO was pressed - get out of here
588 pollControls=YES;
589 [self playSaveOverwriteNo];
590 [self setGuiToSaveCommanderScreen:@""];
591 }
592}
#define SAVE_OVERWRITE_NO_ROW
#define SAVE_OVERWRITE_YES_ROW

◆ parcelContractMarker:

- (NSDictionary *) parcelContractMarker: (OOSystemID system

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

289 :(OOSystemID)system
290{
291 return [[[NSDictionary dictionaryWithObjectsAndKeys:
292 [NSNumber numberWithInt:system], @"system",
293 MISSION_DEST_LEGACY, @"name",
294 @"orangeColor", @"markerColor",
295 @"MARKER_PLUS", @"markerShape",
296 nil] retain] autorelease];
297}

◆ parcelCount

- (NSUInteger) parcelCount
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11842{
11843 return [parcels count];
11844}

Referenced by PlayerShipRemoveParcel().

+ Here is the caller graph for this function:

◆ parcelList

- (NSArray *) parcelList

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

1090{
1091 return [self contractsListFromArray:parcels forCargo:NO forParcels:YES];
1092}

◆ parcelListForScripting

- (NSArray *) parcelListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

8487{
8488 return [self contractsListForScriptingFromArray:parcels forCargo:NO];
8489}

◆ parcelReputation

- (int) parcelReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

607{
608 int good = [reputation oo_intForKey:PARCEL_GOOD_KEY];
609 int bad = [reputation oo_intForKey:PARCEL_BAD_KEY];
610 int unknown = [reputation oo_intForKey:PARCEL_UNKNOWN_KEY];
611
612 if (unknown > 0)
613 unknown = MAX_CONTRACT_REP - (((2*unknown)+(market_rnd % unknown))/3);
614 else
615 unknown = MAX_CONTRACT_REP;
616
617 return (good + unknown - 3 * bad) / 2; // return a number from -MAX_CONTRACT_REP to +MAX_CONTRACT_REP
618}

◆ passengerCapacity

- (NSUInteger) passengerCapacity
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11854{
11855 return max_passengers;
11856}

◆ passengerContractMarker:

- (NSDictionary *) passengerContractMarker: (OOSystemID system

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

278 :(OOSystemID)system
279{
280 return [[[NSDictionary dictionaryWithObjectsAndKeys:
281 [NSNumber numberWithInt:system], @"system",
282 MISSION_DEST_LEGACY, @"name",
283 @"orangeColor", @"markerColor",
284 @"MARKER_DIAMOND", @"markerShape",
285 nil] retain] autorelease];
286}

◆ passengerCount

- (NSUInteger) passengerCount
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11848{
11849 return [passengers count];
11850}

Referenced by PlayerShipRemovePassenger().

+ Here is the caller graph for this function:

◆ passengerList

- (NSArray *) passengerList

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

1084{
1085 return [self contractsListFromArray:passengers forCargo:NO forParcels:NO];
1086}

◆ passengerListForScripting

- (NSArray *) passengerListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

8481{
8482 return [self contractsListForScriptingFromArray:passengers forCargo:NO];
8483}

◆ passengerReputation

- (int) passengerReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

532{
533 int good = [reputation oo_intForKey:PASSAGE_GOOD_KEY];
534 int bad = [reputation oo_intForKey:PASSAGE_BAD_KEY];
535 int unknown = [reputation oo_intForKey:PASSAGE_UNKNOWN_KEY];
536
537 if (unknown > 0)
538 unknown = MAX_CONTRACT_REP - (((2*unknown)+(market_rnd % unknown))/3);
539 else
540 unknown = MAX_CONTRACT_REP;
541
542 return (good + unknown - 3 * bad) / 2; // return a number from -MAX_CONTRACT_REP to +MAX_CONTRACT_REP
543}

◆ penaltyForUnauthorizedDocking

- (void) penaltyForUnauthorizedDocking

Definition at line 9242 of file PlayerEntity.m.

13198{
13202
13203 if ([self clearedToDock])
13204 return;
13205
13208 [self addMessageToReport:[NSString stringWithFormat:DESC(@"station-docking-clearance-fined-@-cr"), OOCredits(amountToPay)]];
13209}

◆ PerformActionStatment

+ (static void) PerformActionStatment (NSArray *)  statement
(Entity *)  target 
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 185 of file PlayerEntityLegacyScriptEngine.m.

186{
187 /* A sanitized action statement takes the form of an array:
188 (false, selector [, argument])
189 The first element is always false. The second is the method selector
190 (as a string). If the method takes an argument, the third argument is
191 the argument string.
192
193 The sanitizer is responsible for ensuring that there is an argument,
194 even if it's the empty string, for any selector with a colon at the
195 end, and no arguments for selectors without colons. The runner can
196 therefore use the list's element count as a flag without examining the
197 selector.
198 */
199
200 NSString *selectorString = nil;
201 NSString *argumentString = nil;
202 NSString *expandedString = nil;
203 SEL selector = NULL;
204 NSMutableDictionary *locals = nil;
205 PlayerEntity *player = PLAYER;
206
207 selectorString = [statement objectAtIndex:1];
208 if ([statement count] > 2) argumentString = [statement objectAtIndex:2];
209
210 selector = NSSelectorFromString(selectorString);
211
212 if (target == nil || ![target respondsToSelector:selector])
213 {
214 target = player;
215 }
216
217 if (argumentString != nil)
218 {
219 // Method with argument; substitute [description] expressions.
220 locals = [player localVariablesForMission:sCurrentMissionKey];
221 expandedString = OOExpandDescriptionString(OOStringExpanderDefaultRandomSeed(), argumentString, nil, locals, nil, kOOExpandNoOptions);
222
223 [target performSelector:selector withObject:expandedString];
224 }
225 else
226 {
227 // Method without argument.
228 [target performSelector:selector];
229 }
230}
@ kOOExpandNoOptions
NSString * OOExpandDescriptionString(Random_Seed seed, NSString *string, NSDictionary *overrides, NSDictionary *legacyLocals, NSString *systemName, OOExpandOptions options)
#define PLAYER
NSMutableDictionary * localVariablesForMission:(NSString *missionKey)

◆ performAutopilotUpdates:

- (void) performAutopilotUpdates: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3614 :(OOTimeDelta)delta_t
3615{
3616 [self processBehaviour:delta_t];
3617 [self applyVelocity:delta_t];
3618 [self doBookkeeping:delta_t];
3619}

◆ PerformConditionalStatment

+ (static void) PerformConditionalStatment (NSArray *)  actions
(Entity *)  target 
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 158 of file PlayerEntityLegacyScriptEngine.m.

159{
160 /* A sanitized conditional statement takes the form of an array:
161 (true, conditions, trueActions, falseActions)
162 The first element is always true. The second is an array of conditions.
163 The third and four elements are actions to perform if the conditions
164 evaluate to true or false, respectively.
165 */
166
167 NSArray *conditions = nil;
168 NSArray *actions = nil;
169
170 conditions = [statement objectAtIndex:1];
171
172 if (TestScriptConditions(conditions))
173 {
174 actions = [statement objectAtIndex:2];
175 }
176 else
177 {
178 actions = [statement objectAtIndex:3];
179 }
180
181 PerformScriptActions(actions, target);
182}
static BOOL TestScriptConditions(NSArray *conditions)
static void PerformScriptActions(NSArray *actions, Entity *target)

◆ performDeadUpdates:

- (void) performDeadUpdates: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3970 :(OOTimeDelta)delta_t
3971{
3972 [UNIVERSE terminatePostFX:OO_POSTFX_CLOAK];
3973 if ([UNIVERSE ECMVisualFXEnabled]) [UNIVERSE terminatePostFX:OO_POSTFX_CRTBADSIGNAL];
3974
3975 [self gameOverFadeToBW];
3976
3977 if ([self shotTime] > kDeadResetTime)
3978 {
3980 [UNIVERSE handleGameOver]; // we restart the UNIVERSE
3982 }
3983}

◆ performDockingRequest:

- (void) performDockingRequest: (StationEntity *)  stationForDocking

Definition at line 13727 of file PlayerEntity.m.

3622{
3623 if (stationForDocking == nil) return;
3625 if ([self isDocked]) return;
3626 if (autopilot_engaged && [self targetStation] == stationForDocking) return;
3628 {
3629 [self disengageAutopilot];
3630 }
3633 {
3634 [self doScriptEvent:OOJSID("playerRequestedDockingClearance") withArgument:stationDockingClearanceStatus];
3635 if ([stationDockingClearanceStatus isEqualToString:@"DOCKING_CLEARANCE_GRANTED"])
3636 {
3637 [self doScriptEvent:OOJSID("playerDockingClearanceGranted")];
3638 }
3639 }
3640}

◆ performDockingUpdates:

- (void) performDockingUpdates: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3957 :(OOTimeDelta)delta_t
3958{
3959 if ([UNIVERSE breakPatternOver])
3960 {
3961 [self docked]; // bookkeeping for docking
3962 }
3963
3964 // if cloak or ecm visual effects are playing while docking, terminate them
3965 [UNIVERSE terminatePostFX:OO_POSTFX_CLOAK];
3966 if ([UNIVERSE ECMVisualFXEnabled]) [UNIVERSE terminatePostFX:OO_POSTFX_CRTBADSIGNAL];
3967}

◆ performInFlightUpdates:

- (void) performInFlightUpdates: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3766 :(OOTimeDelta)delta_t
3767{
3769
3770 // do flight routines
3772 UPDATE_STAGE(@"applying newtonian drift");
3774
3775 [self applyVelocity:delta_t];
3776
3777 GLfloat thrust_factor = 1.0;
3779 {
3781 {
3782 thrust_factor = [self afterburnerFactor];
3783 }
3784 else
3785 {
3787 }
3788 }
3789
3790
3793 if (velmag > 0)
3794 {
3795 UPDATE_STAGE(@"applying power braking");
3796
3798 {
3799 GLfloat rate;
3800 // Fix up extremely ridiculous speeds that can happen in collisions or explosions
3803 velmag2 -= velmag * rate;
3804 }
3805 if (velmag2 < 0.0f) velocity = kZeroVector;
3807
3808 }
3809
3810 UPDATE_STAGE(@"updating joystick");
3811 [self applyRoll:(float)delta_t*flightRoll andClimb:(float)delta_t*flightPitch];
3812 if (flightYaw != 0.0)
3813 {
3814 [self applyYaw:(float)delta_t*flightYaw];
3815 }
3816
3817 UPDATE_STAGE(@"applying para-newtonian thrust");
3818 [self moveForward:delta_t*flightSpeed];
3819
3820 UPDATE_STAGE(@"updating targeting");
3821 [self updateTargeting];
3822
3824}
#define VELOCITY_CLEANUP_MIN
#define VELOCITY_CLEANUP_RATE
#define VELOCITY_CLEANUP_FULL

◆ performLaunchingUpdates:

- (void) performLaunchingUpdates: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3934 :(OOTimeDelta)delta_t
3935{
3936 if (![UNIVERSE breakPatternHide])
3937 {
3938 flightRoll = launchRoll; // synchronise player's & launching station's spins.
3939 [self doBookkeeping:delta_t]; // don't show ghost exhaust plumes from previous docking!
3940 }
3941
3942 if ([UNIVERSE breakPatternOver])
3943 {
3944 // time to check the legacy scripts!
3945 [self checkScript];
3946 // next check in 10s
3947
3948 [self setStatus:STATUS_IN_FLIGHT];
3949
3950 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
3951 StationEntity *stationLaunchedFrom = [UNIVERSE nearestEntityMatchingPredicate:IsStationPredicate parameter:NULL relativeToEntity:self];
3952 [self doScriptEvent:OOJSID("shipLaunchedFromStation") withArgument:stationLaunchedFrom];
3953 }
3954}

◆ PerformScriptActions

+ (static void) PerformScriptActions (NSArray *)  actions
(Entity *)  target 
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 141 of file PlayerEntityLegacyScriptEngine.m.

142{
143 NSArray *statement = nil;
144 foreach (statement, actions)
145 {
146 if ([[statement objectAtIndex:0] boolValue])
147 {
148 PerformConditionalStatment(statement, target);
149 }
150 else
151 {
152 PerformActionStatment(statement, target);
153 }
154 }
155}
static void PerformConditionalStatment(NSArray *actions, Entity *target)
static void PerformActionStatment(NSArray *statement, Entity *target)

◆ performWitchspaceCountdownUpdates:

- (void) performWitchspaceCountdownUpdates: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3827 :(OOTimeDelta)delta_t
3828{
3830
3831 UPDATE_STAGE(@"doing bookkeeping");
3832 [self doBookkeeping:delta_t];
3833
3834 UPDATE_STAGE(@"updating countdown timer");
3836
3837 // damaged gal drive? abort!
3838 /* TODO: this check should possibly be hasEquipmentItemProviding:,
3839 * but if it was we'd need to know which item was actually doing
3840 * the providing so it could be removed. */
3841 if (EXPECT_NOT(galactic_witchjump && ![self hasEquipmentItem:@"EQ_GAL_DRIVE"]))
3842 {
3844 [self setStatus:STATUS_IN_FLIGHT];
3845 [self playHyperspaceAborted];
3846 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("malfunction"));
3847 return;
3848 }
3849
3852 {
3853 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-galactic-in-x-seconds", seconds) forCount:1.0];
3854 }
3855 else
3856 {
3857 NSString *destination = [UNIVERSE getSystemName:[self nextHopTargetSystemID]];
3858 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-to-x-in-y-seconds", seconds, destination) forCount:1.0];
3859 }
3860
3861 if (witchspaceCountdown == 0.0)
3862 {
3863 UPDATE_STAGE(@"preloading planet textures");
3864 if (!galactic_witchjump)
3865 {
3866 /* Note: planet texture preloading is done twice for hyperspace jumps:
3867 once when starting the countdown and once at the beginning of the
3868 jump. The reason is that the preloading may have been skipped the
3869 first time because of rate limiting (see notes at
3870 -preloadPlanetTexturesForSystem:). There is no significant overhead
3871 from doing it twice thanks to the texture cache.
3872 -- Ahruman 2009-12-19
3873 */
3874 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
3875 }
3876 else
3877 {
3878 // FIXME: preload target system for galactic jump?
3879 }
3880
3881 UPDATE_STAGE(@"JUMP!");
3882 if (galactic_witchjump) [self enterGalacticWitchspace];
3883 else [self enterWitchspace];
3885 }
3886
3888}
OOTimeDelta witchspaceCountdown

◆ performWitchspaceExitUpdates:

- (void) performWitchspaceExitUpdates: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3891 :(OOTimeDelta)delta_t
3892{
3893 if ([UNIVERSE breakPatternOver])
3894 {
3895 [self resetExhaustPlumes];
3896 // time to check the script!
3897 [self checkScript];
3898 // next check in 10s
3899 [self resetScriptTimer]; // reset the in-system timer
3900
3901 // announce arrival
3902 if ([UNIVERSE planet])
3903 {
3904 [UNIVERSE addMessage:[NSString stringWithFormat:@" %@. ",[UNIVERSE getSystemName:system_id]] forCount:3.0];
3905 // and reset the compass
3906 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_COMPASS"])
3908 else
3910 }
3911 else
3912 {
3913 if ([UNIVERSE inInterstellarSpace]) [UNIVERSE addMessage:DESC(@"witch-engine-malfunction") forCount:3.0]; // if sun gone nova, print nothing
3914 }
3915
3916 [self setStatus:STATUS_IN_FLIGHT];
3917
3918 // If we are exiting witchspace after a scripted misjump. then make sure it gets reset now.
3919 // Scripted misjump situations should have a lifespan of one jump only, to keep things
3920 // simple - Nikos 20090728
3921 if ([self scriptedMisjump]) [self setScriptedMisjump:NO];
3922 // similarly reset the misjump range to the traditional 0.5
3923 [self setScriptedMisjumpRange:0.5];
3924
3925 [self doScriptEvent:OOJSID("shipExitedWitchspace") withArgument:[self jumpCause]];
3926
3927 [self doBookkeeping:delta_t]; // arrival frame updates
3928
3930 }
3931}

◆ planet_number

- (NSNumber *) planet_number

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

931{
932 return [NSNumber numberWithInt:[self currentSystemID]];
933}

◆ playAegisCloseToPlanet

- (void) playAegisCloseToPlanet

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

717{
718 [sMiscSoundPool playSoundWithKey:@"[aegis-planet]" position:kInterfaceBeepPosition];
719}

◆ playAegisCloseToStation

- (void) playAegisCloseToStation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

723{
724 [sMiscSoundPool playSoundWithKey:@"[aegis-station]" position:kInterfaceBeepPosition];
725}

◆ playAlertConditionRed

- (void) playAlertConditionRed

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

588{
589 [sWarningSoundPool playSoundWithKey:@"[alert-condition-red]" priority:2 position:kInterfaceWarningPosition];
590}

◆ playAutopilotCannotDockWithTarget

- (void) playAutopilotCannotDockWithTarget

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

300{
301 [self playInterfaceBeep:@"[autopilot-cannot-dock-with-target]"];
302}

◆ playAutopilotOff

- (void) playAutopilotOff

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

284{
285 // only if still alive
286 if (energy > 0.0)
287 {
288 [self playInterfaceBeep:@"[autopilot-off]"];
289 }
290}

◆ playAutopilotOn

- (void) playAutopilotOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

278{
279 [self playInterfaceBeep:@"[autopilot-on]"];
280}

◆ playAutopilotOutOfRange

- (void) playAutopilotOutOfRange

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

294{
295 [self playInterfaceBeep:@"[autopilot-out-of-range]"];
296}

◆ playBuyCommodity

- (void) playBuyCommodity

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

498{
499 [sBuySellSourcePool playSoundWithKey:@"[buy-commodity]"];
500}

◆ playBuyShip

- (void) playBuyShip

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

504{
505 [sBuySellSourcePool playSoundWithKey:@"[buy-ship]"];
506}

◆ playCantBuyCommodity

- (void) playCantBuyCommodity

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

516{
517 [sBuySellSourcePool playSoundWithKey:@"[could-not-buy-commodity]"];
518}

◆ playCantBuyShip

- (void) playCantBuyShip

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

528{
529 [sBuySellSourcePool playSoundWithKey:@"[could-not-buy-ship]"];
530}

◆ playCantSellCommodity

- (void) playCantSellCommodity

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

522{
523 [sBuySellSourcePool playSoundWithKey:@"[could-not-sell-commodity]"];
524}

◆ playCargoJettisioned

- (void) playCargoJettisioned

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

272{
273 [self playInterfaceBeep:@"[cargo-jettisoned]"];
274}

◆ playChangedOption

- (void) playChangedOption

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

424{
425 [self playInterfaceBeep:@"[changed-option]"];
426}

◆ playCloakingDeviceInsufficientEnergy

- (void) playCloakingDeviceInsufficientEnergy

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

492{
493 [self playInterfaceBeep:@"[cloaking-device-insufficent-energy]"];
494}

◆ playCloakingDeviceOff

- (void) playCloakingDeviceOff

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

376{
377 [self playInterfaceBeep:@"[cloaking-device-off]"];
378}

◆ playCloakingDeviceOn

- (void) playCloakingDeviceOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

370{
371 [self playInterfaceBeep:@"[cloaking-device-on]"];
372}

◆ playDirectHit:weaponIdentifier:

- (void) playDirectHit: (Vector attackVector
weaponIdentifier: (NSString *)  weaponIdentifier 

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

655 :(Vector)attackVector weaponIdentifier:(NSString *) weaponIdentifier
656{
657 NSString *identifier = [weaponUnshieldedHit objectForKey:weaponIdentifier];
658 if (!identifier) identifier = @"[player-direct-hit]";
659 [sDamageSoundPool playSoundWithKey:identifier position:attackVector];
660}

◆ playDismissedMissionScreen

- (void) playDismissedMissionScreen

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

418{
419 [self playInterfaceBeep:@"[dismissed-mission-screen]"];
420}

◆ playDismissedReportScreen

- (void) playDismissedReportScreen

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

412{
413 [self playInterfaceBeep:@"[dismissed-report-screen]"];
414}

◆ playDockingDenied

- (void) playDockingDenied

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

606{
607 [sWarningSoundPool playSoundWithKey:@"[autopilot-denied]" priority:1 position:kInterfaceWarningPosition];
608}

◆ playDockWithStation

- (void) playDockWithStation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

570{
571 [sBreakPatternSource playCustomSoundWithKey:@"[player-dock-with-station]"];
572}

◆ playEnergyLow

- (void) playEnergyLow

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

600{
601 [sWarningSoundPool playSoundWithKey:@"[energy-low]" priority:0.5 position:kInterfaceWarningPosition];
602}

◆ playEscapePodScooped

- (void) playEscapePodScooped

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

711{
712 [sMiscSoundPool playSoundWithKey:@"[escape-pod-scooped]" position:kInterfaceBeepPosition];
713}

◆ playExitWitchspace

- (void) playExitWitchspace

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

576{
577 [sBreakPatternSource playCustomSoundWithKey:@"[player-exit-witchspace]"];
578}

◆ playFiredECMSound

- (void) playFiredECMSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

558{
559 if (![sEcmSource isPlaying]) [sEcmSource playCustomSoundWithKey:@"[player-fired-ecm]"];
560}

◆ playFuelLeak

- (void) playFuelLeak

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

642{
643 [sWarningSoundPool playSoundWithKey:@"[fuel-leak]" priority:0.5 position:kWitchspacePosition];
644}

◆ playGalacticHyperspace

- (void) playGalacticHyperspace

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

540{
541 [sHyperspaceSoundSource playCustomSoundWithKey:@"[galactic-hyperspace-countdown-begun]"];
542}

Referenced by PlayerShipBeginGalacticHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ playGameOver

- (void) playGameOver

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

729{
730 [sMiscSoundPool playSoundWithKey:@"[game-over]"];
731}

◆ playHitByECMSound

- (void) playHitByECMSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

552{
553 if (![sEcmSource isPlaying]) [sEcmSource playCustomSoundWithKey:@"[player-hit-by-ecm]"];
554}

◆ playHoldFull

- (void) playHoldFull

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

318{
319 [self playInterfaceBeep:@"[hold-full]"];
320}

◆ playHostileWarning

- (void) playHostileWarning

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

582{
583 [sWarningSoundPool playSoundWithKey:@"[hostile-warning]" priority:1 position:kInterfaceWarningPosition];
584}

◆ playHyperspaceAborted

- (void) playHyperspaceAborted

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

546{
547 [sHyperspaceSoundSource playCustomSoundWithKey:@"[hyperspace-countdown-aborted]"];
548}

◆ playHyperspaceBlocked

- (void) playHyperspaceBlocked

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

360{
361 [self playInterfaceBeep:@"[hyperspace-blocked]"];
362}

◆ playHyperspaceDistanceTooGreat

- (void) playHyperspaceDistanceTooGreat

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

365{
366 [self playInterfaceBeep:@"[witch-too-far]"];
367}

◆ playHyperspaceNoFuel

- (void) playHyperspaceNoFuel

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

354{
355 [self playInterfaceBeep:@"[witch-no-fuel]"];
356}

◆ playHyperspaceNoTarget

- (void) playHyperspaceNoTarget

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

348{
349 [self playInterfaceBeep:@"[witch-no-target]"];
350}

◆ playIdentLockedOn

- (void) playIdentLockedOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

218{
219 [self playInterfaceBeep:@"[ident-locked-on]"];
220}

◆ playIdentOff

- (void) playIdentOff

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

212{
213 [self playInterfaceBeep:@"[ident-off]"];
214}

◆ playIdentOn

- (void) playIdentOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

206{
207 [self playInterfaceBeep:@"[ident-on]"];
208}

◆ playIncomingMissile:

- (void) playIncomingMissile: (Vector missileVector

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

593 :(Vector)missileVector
594{
595 [sWarningSoundPool playSoundWithKey:@"[incoming-missile]" priority:3 position:missileVector];
596}

◆ playInterfaceBeep:

- (void) playInterfaceBeep: (NSString *)  beepKey
implementation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

184 :(NSString *)beepKey
185{
186#if OOLITE_WINDOWS
187 if ([self status] == STATUS_START_GAME) { return; }
188#endif
189 [sInterfaceBeepSource playSound:[OOSound soundWithCustomSoundKey:beepKey]];
190}
id soundWithCustomSoundKey:(NSString *key)
Definition Universe.m:11087

◆ playJumpMassLocked

- (void) playJumpMassLocked

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

324{
325 [self playInterfaceBeep:@"[jump-mass-locked]"];
326}

◆ playLaserHit:offset:weaponIdentifier:

- (void) playLaserHit: (BOOL hit
offset: (Vector weaponOffset
weaponIdentifier: (NSString *)  weaponIdentifier 

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

669 :(BOOL)hit offset:(Vector)weaponOffset weaponIdentifier:(NSString *)weaponIdentifier
670{
671 NSString *identifier = nil;
672 if (hit)
673 {
674 identifier = [weaponShotHit objectForKey:weaponIdentifier];
675 if (!identifier) identifier = @"[player-laser-hit]";
676 [sWeaponSoundPool playSoundWithKey:identifier priority:1.0 expiryTime:0.05 overlap:YES position:weaponOffset];
677 }
678 else
679 {
680 identifier = [weaponShotMiss objectForKey:weaponIdentifier];
681 if (!identifier) identifier = @"[player-laser-miss]";
682 [sWeaponSoundPool playSoundWithKey:identifier priority:1.0 expiryTime:0.05 overlap:YES position:weaponOffset];
683
684 }
685}
voidpf uLong offset
Definition ioapi.h:140

◆ playLaunchFromStation

- (void) playLaunchFromStation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

564{
565 [sBreakPatternSource playCustomSoundWithKey:@"[player-launch-from-station]"];
566}

◆ playLegacyScriptSound:

- (void) playLegacyScriptSound: (NSString *)  key

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

734 :(NSString *)key
735{
736 [sMiscSoundPool playSoundWithKey:key priority:1.1];
737}

◆ playMenuNavigationDown

- (void) playMenuNavigationDown

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

388{
389 [self playInterfaceBeep:@"[menu-navigation-down]"];
390}

◆ playMenuNavigationNot

- (void) playMenuNavigationNot

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

394{
395 [self playInterfaceBeep:@"[menu-navigation-not]"];
396}

◆ playMenuNavigationUp

- (void) playMenuNavigationUp

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

382{
383 [self playInterfaceBeep:@"[menu-navigation-up]"];
384}

◆ playMenuPageNext

- (void) playMenuPageNext

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

406{
407 [self playInterfaceBeep:@"[menu-previous-page]"];
408}

◆ playMenuPagePrevious

- (void) playMenuPagePrevious

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

400{
401 [self playInterfaceBeep:@"[menu-next-page]"];
402}

◆ playMineArmed

- (void) playMineArmed

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

230{
231 [self playInterfaceBeep:@"[mine-armed]"];
232}

◆ playMineLaunched:weaponIdentifier:

- (void) playMineLaunched: (Vector weaponOffset
weaponIdentifier: (NSString *)  weaponIdentifier 

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

702 :(Vector)weaponOffset weaponIdentifier:(NSString *)weaponIdentifier
703{
704 NSString *identifier = [weaponLaunched objectForKey:weaponIdentifier];
705 if (!identifier) identifier = @"[mine_launched]";
706 [sWeaponSoundPool playSoundWithKey:identifier position:weaponOffset];
707}

◆ playMissileArmed

- (void) playMissileArmed

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

224{
225 [self playInterfaceBeep:@"[missile-armed]"];
226}

◆ playMissileLaunched:weaponIdentifier:

- (void) playMissileLaunched: (Vector weaponOffset
weaponIdentifier: (NSString *)  weaponIdentifier 

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

694 :(Vector)weaponOffset weaponIdentifier:(NSString *)weaponIdentifier
695{
696 NSString *identifier = [weaponLaunched objectForKey:weaponIdentifier];
697 if (!identifier) identifier = @"[missile_launched]";
698 [sWeaponSoundPool playSoundWithKey:identifier position:weaponOffset];
699}

◆ playMissileLockedOn

- (void) playMissileLockedOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

242{
243 [self playInterfaceBeep:@"[missile-locked-on]"];
244}

◆ playMissileSafe

- (void) playMissileSafe

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

236{
237 [self playInterfaceBeep:@"[missile-safe]"];
238}

◆ playNextEquipmentSelected

- (void) playNextEquipmentSelected

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

248{
249 [self playInterfaceBeep:@"[next-equipment-selected]"];
250}

◆ playNextMissileSelected

- (void) playNextMissileSelected

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

254{
255 [self playInterfaceBeep:@"[next-missile-selected]"];
256}

◆ playNoTargetInMemory

- (void) playNoTargetInMemory

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

336{
337 [self playInterfaceBeep:@"[no-target-in-memory]"];
338}

◆ playSaveOverwriteNo

- (void) playSaveOverwriteNo

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

312{
313 [self playInterfaceBeep:@"[save-overwrite-no]"];
314}

◆ playSaveOverwriteYes

- (void) playSaveOverwriteYes

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

306{
307 [self playInterfaceBeep:@"[save-overwrite-yes]"];
308}

◆ playScrapeDamage:

- (void) playScrapeDamage: (Vector attackVector

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

663 :(Vector)attackVector
664{
665 [sDamageSoundPool playSoundWithKey:@"[player-scrape-damage]" position:attackVector];
666}

◆ playSellCommodity

- (void) playSellCommodity

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

510{
511 [sBuySellSourcePool playSoundWithKey:@"[sell-commodity]"];
512}

◆ playShieldHit:weaponIdentifier:

- (void) playShieldHit: (Vector attackVector
weaponIdentifier: (NSString *)  weaponIdentifier 

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

647 :(Vector)attackVector weaponIdentifier:(NSString *)weaponIdentifier
648{
649 NSString *identifier = [weaponShieldHit objectForKey:weaponIdentifier];
650 if (!identifier) identifier = @"[player-hit-by-weapon]";
651 [sDamageSoundPool playSoundWithKey:identifier position:attackVector];
652}

◆ playSound:

- (void) playSound: (NSString *)  soundName

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2429 :(NSString *) soundName
2430{
2431 [self playLegacyScriptSound:soundName];
2432}

◆ playStandardHyperspace

- (void) playStandardHyperspace

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

534{
535 [sHyperspaceSoundSource playCustomSoundWithKey:@"[hyperspace-countdown-begun]"];
536}

◆ playTargetLost

- (void) playTargetLost

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

330{
331 [self playInterfaceBeep:@"[target-lost]"];
332}

◆ playTargetSwitched

- (void) playTargetSwitched

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

342{
343 [self playInterfaceBeep:@"[target-switched]"];
344}

◆ playWeaponOverheated:

- (void) playWeaponOverheated: (Vector weaponOffset

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

688 :(Vector)weaponOffset
689{
690 [sWeaponSoundPool playSoundWithKey:@"[weapon-overheat]" overlap:NO position:weaponOffset];
691}

◆ playWeaponsOffline

- (void) playWeaponsOffline

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

266{
267 [self playInterfaceBeep:@"[weapons-offline]"];
268}

◆ playWeaponsOnline

- (void) playWeaponsOnline

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

260{
261 [self playInterfaceBeep:@"[weapons-online]"];
262}

◆ playWitchjumpBlocked

- (void) playWitchjumpBlocked

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

624{
625 [sWarningSoundPool playSoundWithKey:@"[witch-blocked-by-@]" priority:1.3 position:kWitchspacePosition];
626}

◆ playWitchjumpDistanceTooGreat

- (void) playWitchjumpDistanceTooGreat

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

630{
631 [sWarningSoundPool playSoundWithKey:@"[witch-too-far]" priority:1.3 position:kWitchspacePosition];
632}

◆ playWitchjumpFailure

- (void) playWitchjumpFailure

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

612{
613 [sWarningSoundPool playSoundWithKey:@"[witchdrive-failure]" priority:1.5 position:kWitchspacePosition];
614}

◆ playWitchjumpInsufficientFuel

- (void) playWitchjumpInsufficientFuel

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

636{
637 [sWarningSoundPool playSoundWithKey:@"[witch-no-fuel]" priority:1.3 position:kWitchspacePosition];
638}

◆ playWitchjumpMisjump

- (void) playWitchjumpMisjump

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

618{
619 [sWarningSoundPool playSoundWithKey:@"[witchdrive-malfunction]" priority:1.5 position:kWitchspacePosition];
620}

◆ pollApplicationControls

- (void) pollApplicationControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

913{
914 if (!pollControls) return;
915
916 NSString *exceptionContext = @"setup";
917
918 // does fullscreen / quit / snapshot
919 MyOpenGLView *gameView = [UNIVERSE gameView];
920 GameController *gameController = [UNIVERSE gameController];
921
922 BOOL onTextEntryScreen = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART) || (gui_screen == GUI_SCREEN_MISSION) ||
923 (gui_screen == GUI_SCREEN_SAVE) || (gui_screen == GUI_SCREEN_OXZMANAGER || (gui_screen == GUI_SCREEN_KEYBOARD_ENTRY));
924
925 @try
926 {
927 // command-key controls
928 #if !OOLITE_MAC_OS_X || !OOLITE_64_BIT // On 64-bit Macs, these are handled by normal menu shortcuts.
929 if ([gameController inFullScreenMode])
930 {
931 exceptionContext = @"command key controls";
932 if ([gameView isCommandFDown])
933 {
934 [gameView clearCommandF];
935 [gameController exitFullScreenMode];
936 if (mouse_control_on)
937 {
938 [UNIVERSE addMessage:DESC(@"mouse-off") forCount:3.0];
939 mouse_control_on = NO;
940 }
941 }
942
943 if ([gameView isCommandQDown])
944 {
945 [gameController pauseFullScreenModeToPerform:@selector(exitAppCommandQ) onTarget:gameController];
946 }
947 }
948 #endif
949
950 // handle pressing Q or [esc] in error-handling mode
951 if ([self status] == STATUS_HANDLING_ERROR)
952 {
953 exceptionContext = @"error handling mode";
954 if ([gameView isDown:113]||[gameView isDown:81]||[gameView isDown:27]) // 'q' | 'Q' | esc
955 {
956 [gameController exitAppWithContext:@"Q or escape pressed in error handling mode"];
957 }
958 }
959
960 if ([gameController isGamePaused])
961 {
962 // What's the status?
963 switch ([self status])
964 {
965 case STATUS_WITCHSPACE_COUNTDOWN:
966 case STATUS_IN_FLIGHT:
967 case STATUS_AUTOPILOT_ENGAGED:
968 case STATUS_DOCKED:
969 // Pause is handled inside their pollControls, no need to unpause.
970 break;
971
972 default:
973 {
974 // In all other cases we can't handle pause. Unpause immediately.
975 script_time = saved_script_time;
976 [gameView allowStringInput:NO];
977 if ([UNIVERSE pauseMessageVisible])
978 {
979 [UNIVERSE clearPreviousMessage]; // remove the 'paused' message.
980 }
981 [gameController setGamePaused:NO];
982 }
983 break;
984 }
985
986 }
987
988 // snapshot
989 const BOOL *joyButtonState = [[OOJoystickManager sharedStickHandler] getAllButtonStates];
990
991 if (([self checkKeyPress:n_key_snapshot] || joyButtonState[BUTTON_SNAPSHOT]) &&
992 ([gameView allowingStringInput] <= gvStringInputAlpha) && // not while entering text on the keyboard config screens
993 ![[OOOXZManager sharedManager] isAcceptingTextInput]) // '*' key but not while filtering inside OXZ Manager
994 {
995 exceptionContext = @"snapshot";
996 if (!taking_snapshot)
997 {
998 taking_snapshot = YES;
999 [gameView snapShot:nil]; // nil filename so that the program auto-names the snapshot
1000 }
1001 }
1002 else
1003 {
1004 taking_snapshot = NO;
1005 }
1006
1007 // FPS display
1008 if (!onTextEntryScreen && [self checkKeyPress:n_key_show_fps]) // 'F' key
1009 {
1010 exceptionContext = @"toggle FPS";
1011 if (!f_key_pressed) [UNIVERSE setDisplayFPS:![UNIVERSE displayFPS]];
1012 f_key_pressed = YES;
1013 }
1014 else
1015 {
1016 f_key_pressed = NO;
1017 }
1018
1019 // bloom toggle
1020 if ([self checkKeyPress:n_key_bloom_toggle])
1021 {
1022 if (!f9_key_pressed)
1023 {
1024 BOOL oldBloom = [UNIVERSE bloom];
1025 [UNIVERSE setBloom:!oldBloom];
1026 }
1027 f9_key_pressed = YES;
1028 }
1029 else
1030 {
1031 f9_key_pressed = NO;
1032 }
1033
1034 // Mouse control
1035 BOOL allowMouseControl;
1036 #if OO_DEBUG
1037 allowMouseControl = YES;
1038 #else
1039 allowMouseControl = [gameController inFullScreenMode] ||
1040 [[NSUserDefaults standardUserDefaults] boolForKey:@"mouse-control-in-windowed-mode"];
1041 #endif
1042
1043 if (allowMouseControl)
1044 {
1045 exceptionContext = @"mouse control";
1046 if (!onTextEntryScreen && ([self checkKeyPress:n_key_mouse_control_roll] || [self checkKeyPress:n_key_mouse_control_yaw])) // 'M' key
1047 {
1048 if (!m_key_pressed)
1049 {
1050 mouse_control_on = !mouse_control_on;
1051 if (mouse_control_on)
1052 {
1053 [UNIVERSE addMessage:DESC(@"mouse-on") forCount:3.0];
1054 /* Ensure the keyboard pitch override (intended to lock
1055 out the joystick if the player runs to the keyboard)
1056 is reset */
1057 #if OOLITE_GNUSTEP
1058 [gameView resetMouse];
1059 if ([[NSUserDefaults standardUserDefaults] boolForKey:@"grab-mouse-on-mouse-control"])
1060 {
1061 [gameView grabMouseInsideGameWindow:YES];
1062 }
1063 #endif
1064 mouse_x_axis_map_to_yaw = [self checkKeyPress:n_key_mouse_control_yaw];
1065 keyboardRollOverride = mouse_x_axis_map_to_yaw; // Getafix: set keyboardRollOverride to TRUE only if yaw is mapped to mouse x-axis
1066 keyboardPitchOverride = NO;
1067 keyboardYawOverride = !keyboardRollOverride;
1068 }
1069 else
1070 {
1071 [UNIVERSE addMessage:DESC(@"mouse-off") forCount:3.0];
1072 #if OOLITE_GNUSTEP
1073 [gameView grabMouseInsideGameWindow:NO];
1074 #endif
1075 }
1076 }
1077 if (OOMouseInteractionModeIsFlightMode([gameController mouseInteractionMode]))
1078 {
1079 [gameController setMouseInteractionModeForFlight];
1080 }
1081 m_key_pressed = YES;
1082 }
1083 else
1084 {
1085 m_key_pressed = NO;
1086 }
1087 }
1088 else
1089 {
1090 if (mouse_control_on)
1091 {
1092 mouse_control_on = NO;
1093 [UNIVERSE addMessage:DESC(@"mouse-off") forCount:3.0];
1094 #if OOLITE_GNUSTEP
1095 [gameView grabMouseInsideGameWindow:NO];
1096 #endif
1097
1098 if (OOMouseInteractionModeIsFlightMode([gameController mouseInteractionMode]))
1099 {
1100 [gameController setMouseInteractionModeForFlight];
1101 }
1102 }
1103 }
1104
1105 // HUD toggle
1106 if (([self checkKeyPress:n_key_hud_toggle] || joyButtonState[BUTTON_TOGGLEHUD]) && [gameController isGamePaused] && !onTextEntryScreen) // 'o' key while paused
1107 {
1108 exceptionContext = @"toggle HUD";
1109 if (!hide_hud_pressed)
1110 {
1111 HeadUpDisplay *theHUD = [self hud];
1112 [theHUD setHidden:![theHUD isHidden]];
1113 if (gui_screen == GUI_SCREEN_STATUS)
1114 {
1115 // ensure refresh of status page screen if looking at it
1116 [self setGuiToStatusScreen];
1117 }
1118 }
1119 hide_hud_pressed = YES;
1120 }
1121 else
1122 {
1123 hide_hud_pressed = NO;
1124 }
1125 }
1126 @catch (NSException *exception)
1127 {
1128 OOLog(kOOLogException, @"***** Exception in pollApplicationControls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
1129 }
1130}
@ gvStringInputAlpha
@ BUTTON_SNAPSHOT
@ BUTTON_TOGGLEHUD
BOOL OOMouseInteractionModeIsFlightMode(OOMouseInteractionMode mode)
static BOOL taking_snapshot
static BOOL m_key_pressed
static BOOL f_key_pressed
static BOOL hide_hud_pressed
static BOOL f9_key_pressed
static double saved_script_time
static BOOL mouse_x_axis_map_to_yaw
void setGamePaused:(BOOL value)
void exitAppWithContext:(NSString *context)
void setMouseInteractionModeForFlight()
void pauseFullScreenModeToPerform:onTarget:(SEL selector,[onTarget] id target)
void setHidden:(BOOL newValue)
void grabMouseInsideGameWindow:(BOOL value)
void allowStringInput:(BOOL value)
BOOL snapShot:(NSString *filename)
const BOOL * getAllButtonStates()

◆ pollAutopilotControls:

- (void) pollAutopilotControls: (double delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

4741 :(double)delta_t
4742{
4743 // don't do anything if we're configuring the keyboard
4744 if (gui_screen == GUI_SCREEN_KEYBOARD_ENTRY || gui_screen == GUI_SCREEN_KEYBOARD_CONFIG || gui_screen == GUI_SCREEN_KEYBOARD_LAYOUT || gui_screen == GUI_SCREEN_KEYBOARD || gui_screen == GUI_SCREEN_KEYBOARD_CONFIRMCLEAR) return;
4745
4746 const BOOL *joyButtonState = [[OOJoystickManager sharedStickHandler] getAllButtonStates];
4747
4748 // controls polled while the autopilot is active
4749 if (![[UNIVERSE gameController] isGamePaused])
4750 {
4751 // view keys
4752 [self pollViewControls];
4753
4754 // text displays
4755 [self pollGuiScreenControls];
4756
4757 if ([UNIVERSE displayGUI])
4758 [self pollGuiArrowKeyControls:delta_t];
4759
4760 if ([self checkKeyPress:n_key_autopilot] || joyButtonState[BUTTON_DOCKCPU]
4761 || [self checkKeyPress:n_key_autodock] || joyButtonState[BUTTON_DOCKCPUFAST]) // look for the 'c' and 'C' key
4762 {
4763 if ([self hasDockingComputer] && !autopilot_key_pressed && !fast_autopilot_key_pressed)
4764 {
4765 [self disengageAutopilot];
4766 [UNIVERSE addMessage:DESC(@"autopilot-off") forCount:4.5];
4767 }
4769 if ([self checkKeyPress:n_key_autodock] || joyButtonState[BUTTON_DOCKCPUFAST])
4770 {
4772 }
4773 }
4774 else
4775 {
4778 }
4779
4780 if (([self checkKeyPress:n_key_docking_music] || joyButtonState[BUTTON_DOCKINGMUSIC])) // look for the 's' key
4781 {
4782 if (!toggling_music)
4783 {
4785 }
4786 toggling_music = YES;
4787 }
4788 else
4789 {
4790 toggling_music = NO;
4791 }
4792 // look for the pause game, 'p' key
4793 if (([self checkKeyPress:n_key_pausebutton] || joyButtonState[BUTTON_PAUSE]) && gui_screen != GUI_SCREEN_SHORT_RANGE_CHART && gui_screen != GUI_SCREEN_MISSION && gui_screen != GUI_SCREEN_KEYBOARD_ENTRY)
4794 {
4795 if (!autopilot_pause)
4796 {
4799 // normal flight controls can handle the rest.
4800 pause_pressed = NO; // pause button flag must be NO for pollflightControls to react!
4801 [self pollFlightControls:delta_t];
4802 }
4803 autopilot_pause = YES;
4804 }
4805 else
4806 {
4807 autopilot_pause = NO;
4808 }
4809 }
4810 else
4811 {
4812 // paused
4813 if ([self checkKeyPress:n_key_pausebutton] || joyButtonState[BUTTON_PAUSE])
4814 {
4815 if (!autopilot_pause)
4816 {
4818 }
4819 autopilot_pause = YES;
4820 }
4821 else
4822 {
4823 autopilot_pause = NO;
4824 }
4825 // let the normal flight controls handle paused commands.
4826 [self pollFlightControls:delta_t];
4827 }
4828}
@ BUTTON_DOCKINGMUSIC
@ BUTTON_DOCKCPU
@ BUTTON_DOCKCPUFAST
@ BUTTON_PAUSE
static BOOL autopilot_pause
static BOOL fast_autopilot_key_pressed
static BOOL pause_pressed
static BOOL toggling_music
static BOOL playing_music
static BOOL autopilot_key_pressed

◆ pollControls:

- (void) pollControls: (double delta_t

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

660 :(double)delta_t
661{
662 MyOpenGLView *gameView = [UNIVERSE gameView];
663 NSString *exceptionContext = @"setup";
664
665 @try
666 {
667 if (gameView)
668 {
669 // poll the gameView keyboard things
670 exceptionContext = @"pollApplicationControls";
671 [self pollApplicationControls]; // quit command-f etc.
672 switch ([self status])
673 {
674 case STATUS_WITCHSPACE_COUNTDOWN:
675 case STATUS_IN_FLIGHT:
676 exceptionContext = @"pollFlightControls";
677 [self pollFlightControls:delta_t];
678 break;
679
680 case STATUS_DEAD:
681 exceptionContext = @"pollGameOverControls";
682 [self pollGameOverControls:delta_t];
683 break;
684
685 case STATUS_AUTOPILOT_ENGAGED:
686 exceptionContext = @"pollAutopilotControls";
687 [self pollAutopilotControls:delta_t];
688 break;
689
690 case STATUS_DOCKED:
691 exceptionContext = @"pollDockedControls";
692 [self pollDockedControls:delta_t];
693 break;
694
695 case STATUS_START_GAME:
696 exceptionContext = @"pollDemoControls";
697 [self pollDemoControls:delta_t];
698 break;
699
700 default:
701 // don't poll extra controls at any other times.
702 break;
703 }
704 }
705 }
706 @catch (NSException *exception)
707 {
708 OOLog(kOOLogException, @"***** Exception checking controls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
709 }
710}

◆ pollCustomViewControls

- (void) pollCustomViewControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

4013{
4014 static Quaternion viewQuaternion;
4015 static Vector viewOffset;
4016 static Vector rotationCenter;
4017 static Vector up;
4018 static Vector right;
4019 static BOOL mouse_clicked = NO;
4020 static NSPoint mouse_clicked_position;
4021 static BOOL shift_down;
4022 static BOOL caps_on = NO;
4023 static NSTimeInterval last_time = 0.0;
4024 MyOpenGLView *gameView = [UNIVERSE gameView];
4025 const BOOL *joyButtonState = [[OOJoystickManager sharedStickHandler] getAllButtonStates];
4026
4027 if ([self checkKeyPress:n_key_custom_view] || joyButtonState[BUTTON_EXTVIEWCYCLE])
4028 {
4029 if (!customView_pressed && [_customViews count] != 0 && gui_screen != GUI_SCREEN_LONG_RANGE_CHART && ![gameView allowingStringInput])
4030 {
4031 if ([UNIVERSE viewDirection] == VIEW_CUSTOM) // already in custom view mode
4032 {
4033 // rotate the custom views
4034 _customViewIndex = (_customViewIndex + 1) % [_customViews count];
4035 }
4036
4037 [self setCustomViewDataFromDictionary:[_customViews oo_dictionaryAtIndex:_customViewIndex] withScaling:YES];
4038
4039 [self switchToThisView:VIEW_CUSTOM andProcessWeaponFacing:NO]; // weapon facing must not change, we just want an external view
4040 }
4041 customView_pressed = YES;
4042 }
4043 else
4044 customView_pressed = NO;
4045 NSTimeInterval this_time = [NSDate timeIntervalSinceReferenceDate];
4046 if ([UNIVERSE viewDirection] > VIEW_STARBOARD && [gameView isCapsLockOn])
4047 {
4048 BOOL ctrl_down = [gameView isCtrlDown];
4049 float customViewZoomSpeed = ctrl_down ? CUSTOM_VIEW_ZOOM_SPEED * CUSTOM_VIEW_SPEED_REDUCTION_FACTOR: CUSTOM_VIEW_ZOOM_SPEED;
4051
4052 if (!caps_on) caps_on = YES;
4053
4054 OOTimeDelta delta_t = this_time - last_time;
4055 if (([self checkKeyPress:n_key_custom_view_zoom_out ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_zoom_in ignore_ctrl:YES]) || [gameView mouseWheelState] == gvMouseWheelDown)
4056 {
4057 [self customViewZoomOut: pow(customViewZoomSpeed, delta_t)];
4058 }
4059 if (([self checkKeyPress:n_key_custom_view_zoom_in ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_zoom_out ignore_ctrl:YES]) || [gameView mouseWheelState] == gvMouseWheelUp)
4060 {
4061 [self customViewZoomIn: pow(customViewZoomSpeed, delta_t)];
4062 }
4063 if ([self checkKeyPress:n_key_custom_view_roll_left ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_roll_right ignore_ctrl:YES])
4064 {
4065 [self customViewRollLeft:customViewRotateSpeed * delta_t];
4066 }
4067 if ([self checkKeyPress:n_key_custom_view_pan_left ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_pan_right ignore_ctrl:YES])
4068 {
4069 [self customViewPanLeft:customViewRotateSpeed * delta_t];
4070 }
4071 if ([self checkKeyPress:n_key_custom_view_roll_right ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_roll_left ignore_ctrl:YES])
4072 {
4073 [self customViewRollRight:customViewRotateSpeed * delta_t];
4074 }
4075 if ([self checkKeyPress:n_key_custom_view_pan_right ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_pan_left ignore_ctrl:YES])
4076 {
4077 [self customViewPanRight:customViewRotateSpeed * delta_t];
4078 }
4079 if ([self checkKeyPress:n_key_custom_view_rotate_up ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_rotate_down ignore_ctrl:YES])
4080 {
4081 [self customViewRotateUp:customViewRotateSpeed * delta_t];
4082 }
4083 if ([self checkKeyPress:n_key_custom_view_pan_down ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_pan_up ignore_ctrl:YES])
4084 {
4085 [self customViewPanDown:customViewRotateSpeed * delta_t];
4086 }
4087 if ([self checkKeyPress:n_key_custom_view_rotate_down ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_rotate_up ignore_ctrl:YES])
4088 {
4089 [self customViewRotateDown:customViewRotateSpeed * delta_t];
4090 }
4091 if ([self checkKeyPress:n_key_custom_view_pan_up ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_pan_down ignore_ctrl:YES])
4092 {
4093 [self customViewPanUp:customViewRotateSpeed * delta_t];
4094 }
4095 if ([self checkKeyPress:n_key_custom_view_rotate_left ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_rotate_right ignore_ctrl:YES])
4096 {
4097 [self customViewRotateLeft:customViewRotateSpeed * delta_t];
4098 }
4099 if ([self checkKeyPress:n_key_custom_view_rotate_right ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_rotate_left ignore_ctrl:YES])
4100 {
4101 [self customViewRotateRight:customViewRotateSpeed * delta_t];
4102 }
4103 if ([gameView isDown:gvMouseLeftButton])
4104 {
4105 if(!mouse_clicked || shift_down != [gameView isShiftDown])
4106 {
4107 mouse_clicked = YES;
4108 viewQuaternion = [PLAYER customViewQuaternion];
4109 viewOffset = [PLAYER customViewOffset];
4110 rotationCenter = [PLAYER customViewRotationCenter];
4111 up = [PLAYER customViewUpVector];
4112 right = [PLAYER customViewRightVector];
4113 mouse_clicked_position = [gameView virtualJoystickPosition];
4114 shift_down = [gameView isShiftDown];
4115 }
4116 NSPoint mouse_position = [gameView virtualJoystickPosition];
4117 Vector axis = vector_add(vector_multiply_scalar(up, mouse_position.x - mouse_clicked_position.x),
4118 vector_multiply_scalar(right, mouse_position.y - mouse_clicked_position.y));
4119 float angle = magnitude(axis);
4120 axis = vector_normal(axis);
4121 Quaternion newViewQuaternion = viewQuaternion;
4122 if ([gameView isShiftDown])
4123 {
4124 quaternion_rotate_about_axis(&newViewQuaternion, axis, angle);
4125 [PLAYER setCustomViewQuaternion: newViewQuaternion];
4126 [PLAYER setCustomViewRotationCenter: vector_subtract(viewOffset,
4127 vector_multiply_scalar([PLAYER customViewForwardVector],
4128 dot_product([PLAYER customViewForwardVector], viewOffset)))];
4129 }
4130 else
4131 {
4132 quaternion_rotate_about_axis(&newViewQuaternion, axis, -angle);
4133 OOScalar m = magnitude(vector_subtract(viewOffset, rotationCenter));
4134 [PLAYER setCustomViewQuaternion: newViewQuaternion];
4135 Vector offset = vector_flip([PLAYER customViewForwardVector]);
4136 scale_vector(&offset, m / magnitude(offset));
4137 [PLAYER setCustomViewOffset:vector_add(offset, rotationCenter)];
4138 }
4139 }
4140 else
4141 {
4142 mouse_clicked = NO;
4143 }
4144 }
4145 else
4146 {
4147 mouse_clicked = NO;
4148 if (caps_on)
4149 {
4150 caps_on = NO;
4151 if ([self isMouseControlOn]) [gameView resetMouse];
4152 }
4153 }
4154 last_time = this_time;
4155}
@ gvMouseWheelDown
@ gvMouseWheelUp
@ gvMouseLeftButton
@ BUTTON_EXTVIEWCYCLE
#define CUSTOM_VIEW_SPEED_REDUCTION_FACTOR
#define CUSTOM_VIEW_ZOOM_SPEED
#define CUSTOM_VIEW_ROTATE_SPEED
static BOOL customView_pressed
NSPoint virtualJoystickPosition

◆ pollDemoControls:

- (void) pollDemoControls: (double delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

4931 :(double)delta_t
4932{
4933 MyOpenGLView *gameView = [UNIVERSE gameView];
4934 GuiDisplayGen *gui = [UNIVERSE gui];
4935 NSUInteger end_row = 21;
4936 OOOXZManager *oxzmanager = [OOOXZManager sharedManager];
4937
4938 switch (gui_screen)
4939 {
4940 case GUI_SCREEN_INTRO1:
4941 [self handleGUIUpDownArrowKeys];
4942
4943 int row_zero = 21;
4944 if (!selectPressed)
4945 {
4947 {
4948 if (([gameView isDown:gvMouseDoubleClick] || [self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 2+row_zero)
4949 {
4951 [UNIVERSE removeDemoShips];
4952 [gui clearBackground];
4953 if (![self loadPlayer])
4954 {
4955 [self setGuiToIntroFirstGo:YES];
4956 }
4957 break;
4958 }
4959 }
4960 if (([gameView isDown:gvMouseDoubleClick] || [self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 1+row_zero)
4961 {
4962 missionTextRow = 0;
4963 [self setGuiToScenarioScreen:0];
4964 }
4965 else if (([gameView isDown:gvMouseDoubleClick] || [self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 3+row_zero)
4966 {
4967 [self setGuiToIntroFirstGo:NO];
4968 }
4969 else if (([gameView isDown:gvMouseDoubleClick] || [self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 4+row_zero)
4970 {
4971 [self setGuiToGameOptionsScreen];
4972 }
4973 else if (([gameView isDown:gvMouseDoubleClick] || [self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 5+row_zero)
4974 {
4975 [self setGuiToOXZManager];
4976 }
4977 else if (([gameView isDown:gvMouseDoubleClick] || [self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 6+row_zero)
4978 {
4979 [[UNIVERSE gameController] exitAppWithContext:@"Exit Game selected on start screen"];
4980 }
4981 else
4982 {
4984 }
4985 }
4986 selectPressed = [self checkKeyPress:n_key_gui_select];
4987 if ([gameView isDown:gvMouseDoubleClick])
4988 {
4989 [gameView clearMouse];
4990 }
4991 break;
4992
4993 case GUI_SCREEN_GAMEOPTIONS:
4994 [self handleGameOptionsScreenKeys];
4995 break;
4996
4997 case GUI_SCREEN_KEYBOARD:
4998 //if ([gameView isDown:' ']) // '<space>'
4999 //{
5000 // [self setGuiToIntroFirstGo:YES];
5001 //}
5002 [self handleKeyMapperScreenKeys];
5003 break;
5004
5005 case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
5006 [self handleKeyMapperConfirmClearKeys:gui view:gameView];
5007 break;
5008
5009 case GUI_SCREEN_KEYBOARD_CONFIG:
5010 [self handleKeyConfigKeys:gui view:gameView];
5011 break;
5012
5013 case GUI_SCREEN_KEYBOARD_ENTRY:
5014 [self handleKeyConfigEntryKeys:gui view:gameView];
5015 break;
5016
5017 case GUI_SCREEN_KEYBOARD_LAYOUT:
5018 [self handleKeyboardLayoutKeys];
5019 break;
5020
5021 case GUI_SCREEN_STICKMAPPER:
5022 [self handleStickMapperScreenKeys];
5023 break;
5024
5025 case GUI_SCREEN_STICKPROFILE:
5026 [self stickProfileInputHandler:gui view:gameView];
5027 break;
5028
5029 case GUI_SCREEN_SHIPLIBRARY:
5030 if ([gameView isDown:' ']) // '<space>'
5031 {
5032 // viewed from start screen, return to it
5033 [self setGuiToIntroFirstGo:YES];
5034 }
5035 if ([self checkKeyPress:n_key_gui_arrow_up]) // '<--'
5036 {
5037 if (!upDownKeyPressed)
5038 [UNIVERSE selectIntro2Previous];
5039 }
5040 if ([self checkKeyPress:n_key_gui_arrow_down]) // '-->'
5041 {
5042 if (!upDownKeyPressed)
5043 [UNIVERSE selectIntro2Next];
5044 }
5045 upDownKeyPressed = (([self checkKeyPress:n_key_gui_arrow_up])||([self checkKeyPress:n_key_gui_arrow_down]));
5046
5047 if ([self checkKeyPress:n_key_gui_arrow_left]) // '<--'
5048 {
5050 [UNIVERSE selectIntro2PreviousCategory];
5051 }
5052 if ([self checkKeyPress:n_key_gui_arrow_right]) // '-->'
5053 {
5055 [UNIVERSE selectIntro2NextCategory];
5056 }
5057 leftRightKeyPressed = (([self checkKeyPress:n_key_gui_arrow_left])||([self checkKeyPress:n_key_gui_arrow_right]));
5058
5059
5060 break;
5061
5062 case GUI_SCREEN_NEWGAME:
5063 if ([self handleGUIUpDownArrowKeys])
5064 {
5065 [self showScenarioDetails];
5066 }
5067
5069 {
5070 if ([self checkKeyPress:n_key_gui_page_up])
5071 {
5072 // find the Back <<< line, select it and press it
5073 if ([[gui keyForRow:GUI_ROW_SCENARIOS_START - 1] hasPrefix:@"__page"])
5074 {
5075 if ([gui setSelectedRow:GUI_ROW_SCENARIOS_START - 1])
5076 {
5077 [self startScenario];
5078 }
5079 }
5080
5081 }
5082 else if ([self checkKeyPress:n_key_gui_page_down])
5083 {
5084 // find the Next >>> line, select it and press it
5085 if ([[gui keyForRow:GUI_ROW_SCENARIOS_START + GUI_MAX_ROWS_SCENARIOS] hasPrefix:@"__page"])
5086 {
5087 if ([gui setSelectedRow:GUI_ROW_SCENARIOS_START + GUI_MAX_ROWS_SCENARIOS])
5088 {
5089 [self startScenario];
5090 }
5091 }
5092 }
5093 }
5094 pageUpDownKeyPressed = [self checkKeyPress:n_key_gui_page_down]|[self checkKeyPress:n_key_gui_page_up];
5095
5096 if (!selectPressed)
5097 {
5098 if ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick]) // enter
5099 {
5100 if (![self startScenario])
5101 {
5102 [UNIVERSE removeDemoShips];
5103 [self setGuiToIntroFirstGo:YES];
5104 }
5105 }
5106 }
5107 selectPressed = [self checkKeyPress:n_key_gui_select];
5108 if ([gameView isDown:gvMouseDoubleClick] || [gameView isDown:gvMouseLeftButton])
5109 {
5110 [gameView clearMouse];
5111 }
5112 break;
5113
5114 case GUI_SCREEN_OXZMANAGER:
5115 // release locks on music on this screen
5117 if (EXPECT(![oxzmanager isRestarting]))
5118 {
5119 if ([oxzmanager isAcceptingGUIInput])
5120 {
5121 if ([oxzmanager isAcceptingTextInput])
5122 {
5123 [gameView setStringInput: gvStringInputAll];
5124 [oxzmanager refreshTextInput:[gameView typedString]];
5125 }
5126 else
5127 {
5128 [gameView allowStringInput: NO];
5129 }
5130 if ([self handleGUIUpDownArrowKeys])
5131 {
5132 // only has an effect on install/remove selection screens
5133 [oxzmanager showOptionsUpdate];
5134 }
5135 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
5136 {
5137 if ((!leftRightKeyPressed))
5138 {
5139 [oxzmanager processOptionsPrev];
5140 }
5141 }
5142 else if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
5143 {
5144 if ((!leftRightKeyPressed))
5145 {
5146 [oxzmanager processOptionsNext];
5147 }
5148 }
5149 leftRightKeyPressed = [self checkKeyPress:n_key_gui_arrow_right]|[self checkKeyPress:n_key_gui_arrow_left]|[self checkKeyPress:n_key_gui_page_down]|[self checkKeyPress:n_key_gui_page_up];
5150
5151 if (!selectPressed)
5152 {
5153 if ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick]) // enter
5154 {
5155 if ([oxzmanager isAcceptingTextInput])
5156 {
5157 [oxzmanager processTextInput:[gameView typedString]];
5158 }
5159 else
5160 {
5161 [oxzmanager processSelection];
5162 }
5163 }
5164 }
5165 selectPressed = [self checkKeyPress:n_key_gui_select];
5166 if ([gameView isDown:gvMouseDoubleClick] || [gameView isDown:gvMouseLeftButton])
5167 {
5168 [gameView clearMouse];
5169 }
5170 } // endif isAcceptingGUIInput
5171 if ([self checkKeyPress:n_key_oxzmanager_setfilter] ||
5172 [self checkKeyPress:n_key_oxzmanager_showinfo] ||
5173 [self checkKeyPress:n_key_oxzmanager_extract])
5174 {
5176 {
5177 oxz_manager_pressed = YES;
5178 if ([self checkKeyPress:n_key_oxzmanager_setfilter])
5179 {
5180 [oxzmanager processFilterKey];
5181 }
5182 else if ([self checkKeyPress:n_key_oxzmanager_showinfo])
5183 {
5184 [oxzmanager processShowInfoKey];
5185 }
5186 else if ([self checkKeyPress:n_key_oxzmanager_extract])
5187 {
5188 [oxzmanager processExtractKey];
5189 }
5190
5191 }
5192 }
5193 else
5194 {
5196 }
5197 }
5198 break;
5199
5200
5201
5202 case GUI_SCREEN_MISSION:
5203 if ([[self hud] allowBigGui])
5204 {
5205 end_row = 27;
5206 }
5207 if (_missionTextEntry)
5208 {
5209 [self refreshMissionScreenTextEntry];
5210 if ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick]) // '<enter/return>' or double click
5211 {
5212 [self setMissionChoice:[gameView typedString] keyPress:@"enter"];
5214 [self playDismissedMissionScreen];
5215
5216 [self handleMissionCallback];
5217
5218 [self checkScript];
5219 selectPressed = YES;
5220 pollControls = YES;
5221 }
5222 else
5223 {
5224 pollControls = NO;
5225 selectPressed = NO;
5226 [self pollMissionInterruptControls];
5227 }
5228 }
5229 else if ([[gui keyForRow:end_row] isEqual:@"spacebar"])
5230 {
5231 if ([gameView isDown:32]) // '<space>'
5232 {
5233 if (!spacePressed)
5234 {
5236 [self handleMissionCallback];
5237
5238 }
5239 spacePressed = YES;
5240 }
5241 else
5242 {
5243 spacePressed = NO;
5244 [self pollMissionInterruptControls];
5245 }
5246 }
5247 else
5248 {
5249 [self handleGUIUpDownArrowKeys];
5250 NSString *extraKey = @"";
5251 if (extraMissionKeys)
5252 {
5253 NSString *key = nil;
5254 foreach (key, [extraMissionKeys allKeys])
5255 {
5256 if ([self checkKeyPress:[extraMissionKeys oo_arrayForKey:key]]) {
5257 if (!extra_key_pressed)
5258 {
5259 extraKey = [key copy];
5260 }
5261 extra_key_pressed = YES;
5262 }
5263 else
5264 extra_key_pressed = NO;
5265 }
5266 }
5267 if ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick] || [extraKey length] > 0) // '<enter/return>' or double click
5268 {
5269 if ([gameView isDown:gvMouseDoubleClick])
5270 {
5271 selectPressed = NO;
5272 [gameView clearMouse];
5273 }
5274 if (!selectPressed)
5275 {
5276 if ([extraKey length] == 0) extraKey = @"enter";
5277 [self setMissionChoice:[gui selectedRowKey] keyPress:extraKey];
5279 [self playDismissedMissionScreen];
5280
5281 [self handleMissionCallback];
5282
5283 [self checkScript];
5284 }
5285 selectPressed = YES;
5286 }
5287 else
5288 {
5289 selectPressed = NO;
5290 [self pollMissionInterruptControls];
5291 }
5292 [extraKey release];
5293 }
5294 break;
5295
5296#if OO_USE_CUSTOM_LOAD_SAVE
5297 // DJS: Farm off load/save screen options to LoadSave.m
5298 case GUI_SCREEN_LOAD:
5299 {
5300 NSString *commanderFile = [self commanderSelector];
5301 if(commanderFile)
5302 {
5303 // also release the demo ship here (see showShipyardModel and noteGUIDidChangeFrom)
5304 [demoShip release];
5305 demoShip = nil;
5306
5307 [self loadPlayerFromFile:commanderFile asNew:NO];
5308 }
5309 break;
5310 }
5311#endif
5312
5313 default:
5314 break;
5315 }
5316}
static BOOL selectPressed
static BOOL pageUpDownKeyPressed
static BOOL spacePressed
static BOOL extra_key_pressed
static BOOL disc_operation_in_progress
static BOOL oxz_manager_pressed
@ GUI_ROW_SCENARIOS_START
@ GUI_MAX_ROWS_SCENARIOS
void setStringInput:(enum StringInput value)
void processOptionsNext()
void processFilterKey()
void processSelection()
void showOptionsUpdate()
void processTextInput:(NSString *input)
void processOptionsPrev()
void processExtractKey()
OOOXZManager * sharedManager()
void refreshTextInput:(NSString *input)
void processShowInfoKey()

◆ pollDockedControls:

- (void) pollDockedControls: (double delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

4831 :(double)delta_t
4832{
4833 MyOpenGLView *gameView = [UNIVERSE gameView];
4834 GameController *gameController = [UNIVERSE gameController];
4835 const BOOL *joyButtonState = [[OOJoystickManager sharedStickHandler] getAllButtonStates];
4836 NSString *exceptionContext = @"setup";
4837
4838 @try
4839 {
4840 // Pause game, 'p' key
4841 exceptionContext = @"pause key";
4842 if (([self checkKeyPress:n_key_pausebutton] || joyButtonState[BUTTON_PAUSE]) && (gui_screen != GUI_SCREEN_LONG_RANGE_CHART &&
4843 gui_screen != GUI_SCREEN_REPORT &&
4844 gui_screen != GUI_SCREEN_SAVE && gui_screen != GUI_SCREEN_KEYBOARD_ENTRY) )
4845 {
4846 BOOL isMissionScreenWithTextEntry = gui_screen == GUI_SCREEN_MISSION && _missionTextEntry;
4847 if (!pause_pressed)
4848 {
4849 if ([gameController isGamePaused])
4850 {
4851 script_time = saved_script_time;
4852 [gameView allowStringInput:NO];
4853 if ([UNIVERSE pauseMessageVisible])
4854 {
4855 [UNIVERSE clearPreviousMessage]; // remove the 'paused' message.
4856 }
4857 [[UNIVERSE gui] setForegroundTextureKey:@"docked_overlay"];
4858 [gameController setGamePaused:NO];
4859 }
4860 else
4861 {
4862 if (!isMissionScreenWithTextEntry)
4863 {
4864 saved_script_time = script_time;
4865 [[UNIVERSE messageGUI] clear];
4866
4867 [UNIVERSE pauseGame]; // 'paused' handler
4868 }
4869 }
4870 }
4871 if (!isMissionScreenWithTextEntry)
4872 {
4873 pause_pressed = YES;
4874 }
4875 }
4876 else
4877 {
4878 pause_pressed = NO;
4879 }
4880
4881 if ([gameController isGamePaused]) return;
4882
4883 if(pollControls)
4884 {
4885 exceptionContext = @"undock";
4886 if ([self checkKeyPress:n_key_launch_ship])
4887 {
4888 if (EXPECT((gui_screen != GUI_SCREEN_MISSION || _missionAllowInterrupt) && gui_screen != GUI_SCREEN_KEYBOARD_ENTRY))
4889 {
4890 [self handleUndockControl];
4891 }
4892 }
4893 }
4894
4895 // text displays
4896 // mission screens
4897 exceptionContext = @"GUI keys";
4898 if (gui_screen == GUI_SCREEN_MISSION || gui_screen == GUI_SCREEN_KEYBOARD_ENTRY)
4899 {
4900 [self pollDemoControls: delta_t]; // don't switch away from mission screens
4901 }
4902 else
4903 {
4904 if (gui_screen != GUI_SCREEN_REPORT)[self pollGuiScreenControls]; // don't switch away from report screens
4905 }
4906
4907 [self pollGuiArrowKeyControls:delta_t];
4908 }
4909 @catch (NSException *exception)
4910 {
4911 OOLog(kOOLogException, @"***** Exception in pollDockedControls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
4912 }
4913}

◆ pollFlightArrowKeyControls:

- (void) pollFlightArrowKeyControls: (double delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

4315 :(double)delta_t
4316{
4317 MyOpenGLView *gameView = [UNIVERSE gameView];
4319 NSUInteger numSticks = [stickHandler joystickCount];
4320 NSPoint virtualStick = NSZeroPoint;
4321 double reqYaw = 0.0;
4322
4323 /* DJS: Handle inputs on the joy roll/pitch axis.
4324 Mouse control on takes precedence over joysticks.
4325 We have to assume the player has a reason for switching mouse
4326 control on if they have a joystick - let them do it. */
4327 if (mouse_control_on)
4328 {
4329 virtualStick=[gameView virtualJoystickPosition];
4330 double sensitivity = 2.0;
4331 virtualStick.x *= sensitivity;
4332 virtualStick.y *= sensitivity;
4333 reqYaw = virtualStick.x;
4334 }
4335 else if (numSticks > 0)
4336 {
4337 virtualStick = [stickHandler rollPitchAxis];
4338 // handle roll separately (fix for BUG #17490)
4339 if(virtualStick.x == STICK_AXISUNASSIGNED)
4340 {
4341 // Not assigned - set to zero.
4342 virtualStick.x=0;
4343 }
4344 else if(virtualStick.x != 0)
4345 {
4346 // cancel keyboard override, stick has been waggled
4347 keyboardRollOverride=NO;
4348 }
4349 // handle pitch separately (fix for BUG #17490)
4350 if(virtualStick.y == STICK_AXISUNASSIGNED)
4351 {
4352 // Not assigned - set to zero.
4353 virtualStick.y=0;
4354 }
4355 else if(virtualStick.y != 0)
4356 {
4357 // cancel keyboard override, stick has been waggled
4358 keyboardPitchOverride=NO;
4359 }
4360 // handle yaw separately from pitch/roll
4361 reqYaw = [stickHandler getAxisState: AXIS_YAW];
4362 if(reqYaw == STICK_AXISUNASSIGNED)
4363 {
4364 // Not assigned or deadzoned - set to zero.
4365 reqYaw=0;
4366 }
4367 else if(reqYaw != 0)
4368 {
4369 // cancel keyboard override, stick has been waggled
4370 keyboardYawOverride=NO;
4371 }
4372 }
4373
4374 double roll_dampner = ROLL_DAMPING_FACTOR * delta_t;
4375 double pitch_dampner = PITCH_DAMPING_FACTOR * delta_t;
4376 double yaw_dampner = YAW_DAMPING_FACTOR * delta_t;
4377 BOOL capsLockCustomView = [UNIVERSE viewDirection] == VIEW_CUSTOM && [gameView isCapsLockOn];
4378
4379 BOOL isCtrlDown = [gameView isCtrlDown];
4380
4381 double flightArrowKeyPrecisionFactor = [[NSUserDefaults standardUserDefaults] oo_doubleForKey:@"flight-arrow-key-precision-factor" defaultValue:0.5];
4382 if (flightArrowKeyPrecisionFactor < 0.05) flightArrowKeyPrecisionFactor = 0.05;
4383 if (flightArrowKeyPrecisionFactor > 1.0) flightArrowKeyPrecisionFactor = 1.0;
4384
4385 rolling = NO;
4386 // if we have yaw on the mouse x-axis, then allow using the keyboard roll keys
4387 if (!mouse_control_on || (mouse_control_on && mouse_x_axis_map_to_yaw))
4388 {
4389 if ([self checkNavKeyPress:n_key_roll_left] && [self checkNavKeyPress:n_key_roll_right])
4390 {
4391 keyboardRollOverride = YES;
4392 flightRoll = 0.0;
4393 }
4394 else if ([self checkNavKeyPress:n_key_roll_left] && !capsLockCustomView)
4395 {
4396 keyboardRollOverride=YES;
4397 if (flightRoll > 0.0) flightRoll = 0.0;
4398 [self decrease_flight_roll:isCtrlDown ? flightArrowKeyPrecisionFactor*roll_dampner*roll_delta : delta_t*roll_delta];
4399 rolling = YES;
4400 }
4401 else if ([self checkNavKeyPress:n_key_roll_right] && !capsLockCustomView)
4402 {
4403 keyboardRollOverride=YES;
4404 if (flightRoll < 0.0) flightRoll = 0.0;
4405 [self increase_flight_roll:isCtrlDown ? flightArrowKeyPrecisionFactor*roll_dampner*roll_delta : delta_t*roll_delta];
4406 rolling = YES;
4407 }
4408 }
4409 if(((mouse_control_on && !mouse_x_axis_map_to_yaw) || numSticks) && !keyboardRollOverride && !capsLockCustomView)
4410 {
4411 stick_roll = max_flight_roll * virtualStick.x;
4412 if (flightRoll < stick_roll)
4413 {
4414 [self increase_flight_roll:delta_t*roll_delta];
4415 if (flightRoll > stick_roll)
4416 flightRoll = stick_roll;
4417 }
4418 if (flightRoll > stick_roll)
4419 {
4420 [self decrease_flight_roll:delta_t*roll_delta];
4421 if (flightRoll < stick_roll)
4422 flightRoll = stick_roll;
4423 }
4424 rolling = (fabs(virtualStick.x) > 0.0);
4425 }
4426 if (!rolling)
4427 {
4428 if (flightRoll > 0.0)
4429 {
4430 if (flightRoll > roll_dampner) [self decrease_flight_roll:roll_dampner];
4431 else flightRoll = 0.0;
4432 }
4433 if (flightRoll < 0.0)
4434 {
4435 if (flightRoll < -roll_dampner) [self increase_flight_roll:roll_dampner];
4436 else flightRoll = 0.0;
4437 }
4438 }
4439
4440 pitching = NO;
4441 // we don't care about pitch keyboard overrides when mouse control is on, only when using joystick
4442 if (!mouse_control_on)
4443 {
4444 if ([self checkNavKeyPress:n_key_pitch_back] && [self checkNavKeyPress:n_key_pitch_forward])
4445 {
4446 keyboardPitchOverride=YES;
4447 flightPitch = 0.0;
4448 }
4449 else if ([self checkNavKeyPress:n_key_pitch_back] && !capsLockCustomView)
4450 {
4451 keyboardPitchOverride=YES;
4452 if (flightPitch < 0.0) flightPitch = 0.0;
4453 [self increase_flight_pitch:isCtrlDown ? flightArrowKeyPrecisionFactor*pitch_dampner*pitch_delta : delta_t*pitch_delta];
4454 pitching = YES;
4455 }
4456 else if ([self checkNavKeyPress:n_key_pitch_forward] && !capsLockCustomView)
4457 {
4458 keyboardPitchOverride=YES;
4459 if (flightPitch > 0.0) flightPitch = 0.0;
4460 [self decrease_flight_pitch:isCtrlDown ? flightArrowKeyPrecisionFactor*pitch_dampner*pitch_delta : delta_t*pitch_delta];
4461 pitching = YES;
4462 }
4463 }
4464 if((mouse_control_on || (numSticks && !keyboardPitchOverride)) && !capsLockCustomView)
4465 {
4466 stick_pitch = max_flight_pitch * virtualStick.y;
4467 if (flightPitch < stick_pitch)
4468 {
4469 [self increase_flight_pitch:delta_t*pitch_delta];
4470 if (flightPitch > stick_pitch)
4471 flightPitch = stick_pitch;
4472 }
4473 if (flightPitch > stick_pitch)
4474 {
4475 [self decrease_flight_pitch:delta_t*pitch_delta];
4476 if (flightPitch < stick_pitch)
4477 flightPitch = stick_pitch;
4478 }
4479 pitching = (fabs(virtualStick.y) > 0.0);
4480 }
4481 if (!pitching)
4482 {
4483 if (flightPitch > 0.0)
4484 {
4485 if (flightPitch > pitch_dampner) [self decrease_flight_pitch:pitch_dampner];
4486 else flightPitch = 0.0;
4487 }
4488 if (flightPitch < 0.0)
4489 {
4490 if (flightPitch < -pitch_dampner) [self increase_flight_pitch:pitch_dampner];
4491 else flightPitch = 0.0;
4492 }
4493 }
4494
4495 yawing = NO;
4496 // if we have roll on the mouse x-axis, then allow using the keyboard yaw keys
4497 if (!mouse_control_on || (mouse_control_on && !mouse_x_axis_map_to_yaw))
4498 {
4499 if ([self checkNavKeyPress:n_key_yaw_left] && [self checkNavKeyPress:n_key_yaw_right])
4500 {
4501 keyboardYawOverride=YES;
4502 flightYaw = 0.0;
4503 }
4504 else if ([self checkNavKeyPress:n_key_yaw_left] && !capsLockCustomView)
4505 {
4506 keyboardYawOverride=YES;
4507 if (flightYaw < 0.0) flightYaw = 0.0;
4508 [self increase_flight_yaw:isCtrlDown ? flightArrowKeyPrecisionFactor*yaw_dampner*yaw_delta : delta_t*yaw_delta];
4509 yawing = YES;
4510 }
4511 else if ([self checkNavKeyPress:n_key_yaw_right] && !capsLockCustomView)
4512 {
4513 keyboardYawOverride=YES;
4514 if (flightYaw > 0.0) flightYaw = 0.0;
4515 [self decrease_flight_yaw:isCtrlDown ? flightArrowKeyPrecisionFactor*yaw_dampner*yaw_delta : delta_t*yaw_delta];
4516 yawing = YES;
4517 }
4518 }
4519 if(((mouse_control_on && mouse_x_axis_map_to_yaw) || numSticks) && !keyboardYawOverride && !capsLockCustomView)
4520 {
4521 // I think yaw is handled backwards in the code,
4522 // which is why the negative sign is here.
4523 stick_yaw = max_flight_yaw * (-reqYaw);
4524 if (flightYaw < stick_yaw)
4525 {
4526 [self increase_flight_yaw:delta_t*yaw_delta];
4527 if (flightYaw > stick_yaw)
4528 flightYaw = stick_yaw;
4529 }
4530 if (flightYaw > stick_yaw)
4531 {
4532 [self decrease_flight_yaw:delta_t*yaw_delta];
4533 if (flightYaw < stick_yaw)
4534 flightYaw = stick_yaw;
4535 }
4536 yawing = (fabs(reqYaw) > 0.0);
4537 }
4538 if (!yawing)
4539 {
4540 if (flightYaw > 0.0)
4541 {
4542 if (flightYaw > yaw_dampner) [self decrease_flight_yaw:yaw_dampner];
4543 else flightYaw = 0.0;
4544 }
4545 if (flightYaw < 0.0)
4546 {
4547 if (flightYaw < -yaw_dampner) [self increase_flight_yaw:yaw_dampner];
4548 else flightYaw = 0.0;
4549 }
4550 }
4551
4552}
#define STICK_AXISUNASSIGNED
#define YAW_DAMPING_FACTOR
#define ROLL_DAMPING_FACTOR
#define PITCH_DAMPING_FACTOR

◆ pollFlightControls:

- (void) pollFlightControls: (double delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

1133 :(double)delta_t
1134{
1135 MyOpenGLView *gameView = [UNIVERSE gameView];
1137 NSString *exceptionContext = @"setup";
1138
1139 @try
1140 {
1141 exceptionContext = @"joystick handling";
1142 const BOOL *joyButtonState = [[OOJoystickManager sharedStickHandler] getAllButtonStates];
1143
1144 BOOL paused = [[UNIVERSE gameController] isGamePaused];
1145 double speed_delta = SHIP_THRUST_FACTOR * thrust;
1146
1147 if (!paused && gui_screen == GUI_SCREEN_MISSION)
1148 {
1149 exceptionContext = @"mission screen";
1150 OOViewID view = VIEW_NONE;
1151
1152 NSPoint virtualView = NSZeroPoint;
1153 double view_threshold = 0.5;
1154
1155 if ([stickHandler joystickCount])
1156 {
1157 virtualView = [stickHandler viewAxis];
1158 if (virtualView.y == STICK_AXISUNASSIGNED)
1159 virtualView.y = 0.0;
1160 if (virtualView.x == STICK_AXISUNASSIGNED)
1161 virtualView.x = 0.0;
1162 if (fabs(virtualView.y) >= fabs(virtualView.x))
1163 virtualView.x = 0.0; // forward/aft takes precedence
1164 else
1165 virtualView.y = 0.0;
1166 }
1167
1168 if ([self checkKeyPress:n_key_view_forward] || (virtualView.y < -view_threshold) || joyButtonState[BUTTON_VIEWFORWARD])
1169 {
1170 view = VIEW_FORWARD;
1171 }
1172 if ([self checkKeyPress:n_key_view_aft]|(virtualView.y > view_threshold)||joyButtonState[BUTTON_VIEWAFT])
1173 {
1174 view = VIEW_AFT;
1175 }
1176 if ([self checkKeyPress:n_key_view_port]||(virtualView.x < -view_threshold)||joyButtonState[BUTTON_VIEWPORT])
1177 {
1178 view = VIEW_PORT;
1179 }
1180 if ([self checkKeyPress:n_key_view_starboard]||(virtualView.x > view_threshold)||joyButtonState[BUTTON_VIEWSTARBOARD])
1181 {
1182 view = VIEW_STARBOARD;
1183 }
1184 if (view == VIEW_NONE)
1185 {
1186 // still in mission screen, process the input.
1187 [self pollDemoControls: delta_t];
1188 }
1189 else
1190 {
1191 [[UNIVERSE gui] clearBackground];
1192 [self switchToThisView:view];
1193 if (_missionWithCallback)
1194 {
1195 [self doMissionCallback];
1196 }
1197 // notify older scripts, but do not trigger missionScreenOpportunity.
1198 [self doWorldEventUntilMissionScreen:OOJSID("missionScreenEnded")];
1199 }
1200 }
1201 else if (!paused)
1202 {
1203 exceptionContext = @"arrow keys";
1204 // arrow keys
1205 if ([UNIVERSE displayGUI])
1206 [self pollGuiArrowKeyControls:delta_t];
1207 else
1208 [self pollFlightArrowKeyControls:delta_t];
1209
1210 // view keys
1211 [self pollViewControls];
1212
1213 if (OOMouseInteractionModeIsFlightMode([[UNIVERSE gameController] mouseInteractionMode]))
1214 {
1215 exceptionContext = @"afterburner";
1216 if ((joyButtonState[BUTTON_FUELINJECT] || [self checkKeyPress:n_key_inject_fuel]) &&
1217 [self hasFuelInjection] &&
1218 !hyperspeed_engaged)
1219 {
1220 if (fuel > 0 && !afterburner_engaged)
1221 {
1222 [UNIVERSE addMessage:DESC(@"fuel-inject-on") forCount:1.5];
1223 afterburner_engaged = YES;
1224 [self startAfterburnerSound];
1225 }
1226 else
1227 {
1228 if (fuel <= 0.0)
1229 [UNIVERSE addMessage:DESC(@"fuel-out") forCount:1.5];
1230 }
1231 afterburner_engaged = (fuel > 0);
1232 }
1233 else
1234 afterburner_engaged = NO;
1235
1236 if ((!afterburner_engaged)&&(afterburnerSoundLooping))
1237 [self stopAfterburnerSound];
1238
1239 exceptionContext = @"thrust";
1240 // DJS: Thrust can be an axis or a button. Axis takes precidence.
1241 double reqSpeed=[stickHandler getAxisState: AXIS_THRUST];
1242 float mouseWheelDeltaFactor = mouse_control_on ? fabs([gameView mouseWheelDelta]) : 1.0f;
1243 if (mouseWheelDeltaFactor == 0.0f) mouseWheelDeltaFactor = 1.0f;
1244 // Updated DJS original code to fix BUG #17482 - (Getafix 2010/09/13)
1245 if (([self checkKeyPress:n_key_increase_speed] ||
1246 joyButtonState[BUTTON_INCTHRUST] ||
1247 ((mouse_control_on)&&([gameView mouseWheelState] == gvMouseWheelUp) && ([UNIVERSE viewDirection] <= VIEW_STARBOARD || ![gameView isCapsLockOn])))
1248 && (flightSpeed < maxFlightSpeed) && (!afterburner_engaged))
1249 {
1250 flightSpeed += speed_delta * delta_t * mouseWheelDeltaFactor;
1251 }
1252
1253 if (([self checkKeyPress:n_key_decrease_speed] ||
1254 joyButtonState[BUTTON_DECTHRUST] ||
1255 ((mouse_control_on)&&([gameView mouseWheelState] == gvMouseWheelDown) && ([UNIVERSE viewDirection] <= VIEW_STARBOARD || ![gameView isCapsLockOn])))
1256 && (!afterburner_engaged))
1257 {
1258 flightSpeed -= speed_delta * delta_t * mouseWheelDeltaFactor;
1259 // ** tgape ** - decrease obviously means no hyperspeed
1260 hyperspeed_engaged = NO;
1261 }
1262
1263 NSDictionary *functionForThrustAxis = [[stickHandler axisFunctions] oo_dictionaryForKey:[[NSNumber numberWithInt:AXIS_THRUST] stringValue]];
1264 if([stickHandler joystickCount] != 0 && functionForThrustAxis != nil)
1265 {
1266 if (flightSpeed < maxFlightSpeed * reqSpeed)
1267 {
1268 flightSpeed += speed_delta * delta_t;
1269 }
1270 if (flightSpeed > maxFlightSpeed * reqSpeed)
1271 {
1272 flightSpeed -= speed_delta * delta_t;
1273 }
1274 } // DJS: end joystick thrust axis (Getafix - End code update for fixing BUG #17482)
1275
1276 if (!afterburner_engaged && ![self atHyperspeed] && !hyperspeed_engaged)
1277 {
1278 flightSpeed = OOClamp_0_max_f(flightSpeed, maxFlightSpeed);
1279 }
1280
1281 exceptionContext = @"hyperspeed";
1282 // hyperspeed controls
1283 if ([self checkKeyPress:n_key_jumpdrive] || joyButtonState[BUTTON_HYPERSPEED]) // 'j'
1284 {
1285 if (!jump_pressed)
1286 {
1287 if (!hyperspeed_engaged)
1288 {
1289 hyperspeed_locked = [self massLocked];
1290 hyperspeed_engaged = !hyperspeed_locked;
1291 if (hyperspeed_locked)
1292 {
1293 [self playJumpMassLocked];
1294 [UNIVERSE addMessage:DESC(@"jump-mass-locked") forCount:1.5];
1295 }
1296 }
1297 else
1298 {
1299 hyperspeed_engaged = NO;
1300 }
1301 }
1302 jump_pressed = YES;
1303 }
1304 else
1305 {
1306 jump_pressed = NO;
1307 }
1308
1309 exceptionContext = @"shoot";
1310 // shoot 'a'
1311 if ((([self checkNavKeyPress:n_key_fire_lasers])||((mouse_control_on)&&([gameView isDown:gvMouseLeftButton]) && ([UNIVERSE viewDirection] <= VIEW_STARBOARD || ![gameView isCapsLockOn]))||joyButtonState[BUTTON_FIRE])&&(shot_time > weapon_recharge_rate))
1312 {
1313 if ([self fireMainWeapon])
1314 {
1315 [self playLaserHit:([self shipHitByLaser] != nil) offset:[[self currentLaserOffset] oo_vectorAtIndex:0] weaponIdentifier:[[self currentWeapon] identifier]];
1316 }
1317 }
1318
1319 exceptionContext = @"weapons online toggle";
1320 // weapons online / offline toggle '_'
1321 if (([self checkKeyPress:n_key_weapons_online_toggle] || joyButtonState[BUTTON_WEAPONSONLINETOGGLE]))
1322 {
1324 {
1325 NSString* weaponsOnlineToggleMsg;
1326
1327 [self setWeaponsOnline:![self weaponsOnline]];
1328 weaponsOnlineToggleMsg = [self weaponsOnline] ? DESC(@"weapons-systems-online") : DESC(@"weapons-systems-offline");
1329 if ([self weaponsOnline])
1330 {
1331 [self playWeaponsOnline];
1332 }
1333 else
1334 {
1335 [self playWeaponsOffline];
1336 }
1337 [UNIVERSE addMessage:weaponsOnlineToggleMsg forCount:2.0];
1338 [self doScriptEvent:OOJSID("weaponsSystemsToggled") withArgument:[NSNumber numberWithBool:[self weaponsOnline]]];
1340 }
1341 }
1343
1344 exceptionContext = @"missile fire";
1345 // shoot 'm' // launch missile
1346 if ([self checkKeyPress:n_key_launch_missile] || joyButtonState[BUTTON_LAUNCHMISSILE])
1347 {
1348 // launch here
1350 {
1351 [self fireMissile];
1353 }
1354 }
1355 else fire_missile_pressed = NO;
1356
1357 exceptionContext = @"next missile";
1358 // shoot 'y' // next missile
1359 if ([self checkKeyPress:n_key_next_missile] || joyButtonState[BUTTON_CYCLEMISSILE])
1360 {
1361 if (!ident_engaged && !next_missile_pressed && [self weaponsOnline])
1362 {
1363 [self playNextMissileSelected];
1364 [self selectNextMissile];
1365 }
1367 }
1368 else next_missile_pressed = NO;
1369
1370 exceptionContext = @"next target";
1371 // '+' // next target
1372 if ([self checkKeyPress:n_key_next_target] || joyButtonState[BUTTON_NEXTTARGET])
1373 {
1374 if ((!next_target_pressed)&&([self hasEquipmentItemProviding:@"EQ_TARGET_MEMORY"]))
1375 {
1376 [self moveTargetMemoryBy:+1];
1377 }
1378 next_target_pressed = YES;
1379 }
1380 else next_target_pressed = NO;
1381
1382 exceptionContext = @"previous target";
1383 // '-' // previous target
1384 if ([self checkKeyPress:n_key_previous_target] || joyButtonState[BUTTON_PREVTARGET])
1385 {
1386 if ((!previous_target_pressed)&&([self hasEquipmentItemProviding:@"EQ_TARGET_MEMORY"]))
1387 {
1388 [self moveTargetMemoryBy:-1];
1389 }
1391 }
1392 else previous_target_pressed = NO;
1393
1394 exceptionContext = @"ident R";
1395 // shoot 'r' // switch on ident system
1396 if ([self checkKeyPress:n_key_ident_system] || joyButtonState[BUTTON_ID])
1397 {
1398 // ident 'on' here
1399 if (!ident_pressed)
1400 {
1401 [self handleButtonIdent];
1402 }
1403 ident_pressed = YES;
1404 }
1405 else ident_pressed = NO;
1406
1407 exceptionContext = @"prime equipment";
1408 // prime equipment 'N' - selects equipment to use with keypress
1409 if ([self checkKeyPress:n_key_prime_next_equipment] || [self checkKeyPress:n_key_prime_previous_equipment] || joyButtonState[BUTTON_PRIMEEQUIPMENT] || joyButtonState[BUTTON_PRIMEEQUIPMENT_PREV])
1410 {
1411
1413 {
1414
1415 // cycle through all the relevant equipment.
1416 NSUInteger c = [eqScripts count];
1417
1418 // if Ctrl is held down at the same time as the prime equipment key,
1419 // cycle relevant equipment in reverse
1420 //if (![gameView isCtrlDown])
1421 if (![self checkKeyPress:n_key_prime_previous_equipment] || joyButtonState[BUTTON_PRIMEEQUIPMENT_PREV])
1422 {
1423 primedEquipment++;
1424 if (primedEquipment > c) primedEquipment = 0;
1425 }
1426 else
1427 {
1428 if (primedEquipment > 0) primedEquipment--;
1429 else primedEquipment = c;
1430 }
1431
1432 NSString *eqKey = @"";
1433
1434 if (primedEquipment == c)
1435 {
1436 if (c > 0)
1437 {
1438 [self playNextEquipmentSelected];
1439 [UNIVERSE addMessage:DESC(@"equipment-primed-none") forCount:2.0];
1440 }
1441 else [UNIVERSE addMessage:DESC(@"equipment-primed-none-available") forCount:2.0];
1442 }
1443 else
1444 {
1445 [self playNextEquipmentSelected];
1446 NSString *equipmentName = [[OOEquipmentType equipmentTypeWithIdentifier:[[eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0]] name];
1447 eqKey = [[eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0];
1448 [UNIVERSE addMessage:OOExpandKey(@"equipment-primed", equipmentName) forCount:2.0];
1449 }
1450 [self doScriptEvent:OOJSID("playerChangedPrimedEquipment") withArgument:eqKey];
1451 }
1453
1454 }
1455 else prime_equipment_pressed = NO;
1456
1457 exceptionContext = @"activate equipment";
1458 // activate equipment 'n' - runs the activated() function inside the equipment's script.
1459 if ([self checkKeyPress:n_key_activate_equipment] || joyButtonState[BUTTON_ACTIVATEEQUIPMENT])
1460 {
1462 {
1463 [self activatePrimableEquipment:primedEquipment withMode:OOPRIMEDEQUIP_ACTIVATED];
1464 }
1466 }
1468
1469 exceptionContext = @"mode equipment";
1470 // mode equipment 'b' - runs the mode() function inside the equipment's script.
1471 if ([self checkKeyPress:n_key_mode_equipment] || joyButtonState[BUTTON_MODEEQUIPMENT])
1472 {
1474 {
1475 [self activatePrimableEquipment:primedEquipment withMode:OOPRIMEDEQUIP_MODE];
1476 }
1478 }
1479 else mode_equipment_pressed = NO;
1480
1481 exceptionContext = @"fast equipment A";
1482 if ([self checkKeyPress:n_key_fastactivate_equipment_a] || joyButtonState[BUTTON_CLOAK])
1483 {
1485 {
1486 [self activatePrimableEquipment:[self eqScriptIndexForKey:[self fastEquipmentA]] withMode:OOPRIMEDEQUIP_ACTIVATED];
1487 }
1489 }
1490 else fastactivate_a_pressed = NO;
1491
1492 exceptionContext = @"fast equipment B";
1493 if ([self checkKeyPress:n_key_fastactivate_equipment_b] || joyButtonState[BUTTON_ENERGYBOMB])
1494 {
1496 {
1497 [self activatePrimableEquipment:[self eqScriptIndexForKey:[self fastEquipmentB]] withMode:OOPRIMEDEQUIP_ACTIVATED];
1498 }
1500 }
1501 else fastactivate_b_pressed = NO;
1502
1503 exceptionContext = @"custom equipment";
1504 // loop through all the objects in the customEquipActivation array
1505 NSDictionary *item;
1506 NSUInteger i;
1507 for (i = 0; i < [customEquipActivation count]; i++)
1508 {
1509 item = [customEquipActivation objectAtIndex:i];
1510 // check if the player has the equip item installed
1511 if ([self hasOneEquipmentItem:[item oo_stringForKey:CUSTOMEQUIP_EQUIPKEY] includeWeapons:NO whileLoading:NO])
1512 {
1513 NSArray *key_act = [item oo_arrayForKey:CUSTOMEQUIP_KEYACTIVATE];
1514 NSArray *key_mod = [item oo_arrayForKey:CUSTOMEQUIP_KEYMODE];
1515 NSDictionary *but_act = [item oo_dictionaryForKey:CUSTOMEQUIP_BUTTONACTIVATE];
1516 NSDictionary *but_mod = [item oo_dictionaryForKey:CUSTOMEQUIP_BUTTONMODE];
1517 // if so,
1518 // check to see if the key or button was pressed for activate
1519 if ((key_act && [self checkKeyPress:key_act]) || (but_act && [[OOJoystickManager sharedStickHandler] isButtonDown:[but_act oo_intForKey:STICK_AXBUT] stick:[but_act oo_intForKey:STICK_NUMBER]]))
1520 {
1521 if (![[customActivatePressed objectAtIndex:i] boolValue])
1522 {
1523 // initate the activate JS code
1524 [self activatePrimableEquipment:[self eqScriptIndexForKey:[item oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]] withMode:OOPRIMEDEQUIP_ACTIVATED];
1525 }
1526 [customActivatePressed replaceObjectAtIndex:i withObject:[NSNumber numberWithBool:YES]];
1527 }
1528 else [customActivatePressed replaceObjectAtIndex:i withObject:[NSNumber numberWithBool:NO]];
1529
1530 // check to see if the key or button was pressed for mode
1531 if ((key_mod && [self checkKeyPress:key_mod]) || (but_mod && [[OOJoystickManager sharedStickHandler] isButtonDown:[but_mod oo_intForKey:STICK_AXBUT] stick:[but_mod oo_intForKey:STICK_NUMBER]]))
1532 {
1533 if (![[customModePressed objectAtIndex:i] boolValue])
1534 {
1535 // initiate the activate JS code
1536 [self activatePrimableEquipment:[self eqScriptIndexForKey:[item oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]] withMode:OOPRIMEDEQUIP_MODE];
1537 }
1538 [customModePressed replaceObjectAtIndex:i withObject:[NSNumber numberWithBool:YES]];
1539 }
1540 else [customModePressed replaceObjectAtIndex:i withObject:[NSNumber numberWithBool:NO]];
1541 }
1542 }
1543
1544 exceptionContext = @"incoming missile T";
1545 // target nearest incoming missile 'T' - useful for quickly giving a missile target to turrets
1546 if ([self checkKeyPress:n_key_target_incoming_missile] || joyButtonState[BUTTON_TARGETINCOMINGMISSILE])
1547 {
1549 {
1550 [self targetNearestIncomingMissile];
1551 }
1553 }
1555
1556 exceptionContext = @"missile T";
1557 // shoot 't' // switch on missile targeting
1558 if (([self checkKeyPress:n_key_target_missile] || joyButtonState[BUTTON_ARMMISSILE])&&(missile_entity[activeMissile]))
1559 {
1560 // targeting 'on' here
1562 {
1563 [self handleButtonTargetMissile];
1564 }
1566 }
1567 else target_missile_pressed = NO;
1568
1569 exceptionContext = @"missile U";
1570 // shoot 'u' // disarm missile targeting
1571 if ([self checkKeyPress:n_key_untarget_missile] || joyButtonState[BUTTON_UNARM])
1572 {
1573 if (!safety_pressed)
1574 {
1575 //targeting off in both cases!
1576 if ([self primaryTarget] != nil) [self noteLostTarget];
1577 DESTROY(_primaryTarget);
1578 [self safeAllMissiles];
1579 if (!ident_engaged && [self weaponsOnline])
1580 {
1581 [UNIVERSE addMessage:DESC(@"missile-safe") forCount:2.0];
1582 [self playMissileSafe];
1583 }
1584 else
1585 {
1586 [UNIVERSE addMessage:DESC(@"ident-off") forCount:2.0];
1587 [self playIdentOff];
1588 }
1589 ident_engaged = NO;
1590 }
1591 safety_pressed = YES;
1592 }
1593 else safety_pressed = NO;
1594
1595 exceptionContext = @"ECM";
1596 // shoot 'e' // ECM
1597 if (([self checkKeyPress:n_key_ecm] || joyButtonState[BUTTON_ECM]) && [self hasECM])
1598 {
1599 if (!ecm_in_operation)
1600 {
1601 if ([self weaponsOnline] && [self fireECM])
1602 {
1603 [self playFiredECMSound];
1604 [UNIVERSE addMessage:DESC(@"ecm-on") forCount:3.0];
1605 }
1606 }
1607 }
1608
1609
1610 exceptionContext = @"escape pod";
1611 // shoot 'escape' // Escape pod launch - NOTE: Allowed at all times, but requires double press within a specific time interval.
1612 // Double press not available in strict mode or when the "escape-pod-activation-immediate" override is in the
1613 // user defaults file.
1614 if (([self checkKeyPress:n_key_launch_escapepod] || joyButtonState[BUTTON_ESCAPE]) && [self hasEscapePod])
1615 {
1616 BOOL goodToLaunch = [[NSUserDefaults standardUserDefaults] boolForKey:@"escape-pod-activation-immediate"];
1617 static OOTimeDelta escapePodKeyResetTime;
1618
1619 if (!goodToLaunch)
1620 {
1622 {
1624 // first keypress will unregister in KEY_REPEAT_INTERVAL seconds
1625 escapePodKeyResetTime = [NSDate timeIntervalSinceReferenceDate] + KEY_REPEAT_INTERVAL;
1626 //[gameView clearKey:key_launch_escapepod];
1627 [gameView clearKey:[self getFirstKeyCode:n_key_launch_escapepod]];
1628 if ([stickHandler joystickCount])
1629 {
1630 [stickHandler clearStickButtonState:BUTTON_ESCAPE];
1631 }
1632 }
1633 else
1634 {
1635 OOTimeDelta timeNow = [NSDate timeIntervalSinceReferenceDate];
1637 if (timeNow < escapePodKeyResetTime) goodToLaunch = YES;
1638 }
1639 }
1640 if (goodToLaunch)
1641 {
1642 [self launchEscapeCapsule];
1643 }
1644 }
1645
1646 exceptionContext = @"dump cargo";
1647 // shoot 'd' // Dump Cargo
1648 if (([self checkKeyPress:n_key_dump_cargo] || joyButtonState[BUTTON_JETTISON]) && [cargo count] > 0)
1649 {
1650 [self dumpCargo];
1651 }
1652
1653 exceptionContext = @"rotate cargo";
1654 // shoot 'R' // Rotate Cargo
1655 if ([self checkKeyPress:n_key_rotate_cargo] || joyButtonState[BUTTON_ROTATECARGO])
1656 {
1657 if ((!rotateCargo_pressed)&&([cargo count] > 0))
1658 [self rotateCargo];
1659 rotateCargo_pressed = YES;
1660 }
1661 else
1663
1664 exceptionContext = @"autopilot C";
1665 // autopilot 'c'
1666 if ([self checkKeyPress:n_key_autopilot] || joyButtonState[BUTTON_DOCKCPU]) // look for the 'c' key
1667 {
1668 if ([self hasDockingComputer] && (!autopilot_key_pressed))
1669 {
1670 [self handleAutopilotOn:false];
1671 }
1673 }
1674 else
1676
1677 exceptionContext = @"autopilot shift-C";
1678 // autopilot 'C' - fast-autopilot
1679 if ([self checkKeyPress:n_key_autodock] || joyButtonState[BUTTON_DOCKCPUFAST]) // look for the 'C' key
1680 {
1681 if ([self hasDockingComputer] && (!fast_autopilot_key_pressed))
1682 {
1683 [self handleAutopilotOn:true];
1684 }
1686 }
1687 else
1688 {
1690 }
1691
1692 exceptionContext = @"docking clearance request";
1693
1694 if ([self checkKeyPress:n_key_docking_clearance_request] || joyButtonState[BUTTON_DOCKINGCLEARANCE])
1695 {
1697 {
1698 Entity *primeTarget = [self primaryTarget];
1699 [self performDockingRequest:(StationEntity*)primeTarget];
1700 }
1702 }
1703 else
1704 {
1706 }
1707
1708 exceptionContext = @"hyperspace";
1709 // hyperspace 'h'
1710 if ( ([self checkKeyPress:n_key_hyperspace] || joyButtonState[BUTTON_HYPERDRIVE]) &&
1711 [self hasHyperspaceMotor] ) // look for the 'h' key
1712 {
1713 if (!hyperspace_pressed)
1714 {
1715 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
1716 {
1717 [self cancelWitchspaceCountdown];
1718 if (galactic_witchjump)
1719 {
1720 galactic_witchjump = NO;
1721 [UNIVERSE addMessage:DESC(@"witch-user-galactic-abort") forCount:3.0];
1722 }
1723 else
1724 {
1725 [UNIVERSE addMessage:DESC(@"witch-user-abort") forCount:3.0];
1726 }
1727 }
1728 else if ([self witchJumpChecklist:false])
1729 {
1730 [self beginWitchspaceCountdown:hyperspaceMotorSpinTime];
1731 }
1732 }
1733 hyperspace_pressed = YES;
1734 }
1735 else
1736 hyperspace_pressed = NO;
1737
1738 exceptionContext = @"galactic hyperspace";
1739 // Galactic hyperspace 'g'
1740 if (([self checkKeyPress:n_key_galactic_hyperspace] || joyButtonState[BUTTON_GALACTICDRIVE]) &&
1741 ([self hasEquipmentItemProviding:@"EQ_GAL_DRIVE"]))// look for the 'g' key
1742 {
1744 {
1745 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
1746 {
1747 [self cancelWitchspaceCountdown];
1748 if (galactic_witchjump)
1749 {
1750 galactic_witchjump = NO;
1751 [UNIVERSE addMessage:DESC(@"witch-user-galactic-abort") forCount:3.0];
1752 }
1753 else
1754 {
1755 [UNIVERSE addMessage:DESC(@"witch-user-abort") forCount:3.0];
1756 }
1757 }
1758 else
1759 {
1760 galactic_witchjump = YES;
1761
1762 // even if we don't have a witchspace motor, we can still do a default galactic jump (!)
1763 if(EXPECT([self hasHyperspaceMotor])) witchspaceCountdown = hyperspaceMotorSpinTime;
1764 else witchspaceCountdown = DEFAULT_HYPERSPACE_SPIN_TIME;
1765
1766 [self setStatus:STATUS_WITCHSPACE_COUNTDOWN];
1767 [self playGalacticHyperspace];
1768 // say it!
1769 [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"witch-galactic-in-f-seconds"), witchspaceCountdown] forCount:1.0];
1770 // FIXME: how to preload target system for hyperspace jump?
1771
1772 [self doScriptEvent:OOJSID("playerStartedJumpCountdown")
1773 withArguments:[NSArray arrayWithObjects:@"galactic", [NSNumber numberWithFloat:witchspaceCountdown], nil]];
1774 }
1775 }
1777 }
1778 else
1780
1781 }
1782
1783#if OO_FOV_INFLIGHT_CONTROL_ENABLED
1784 // Field of view controls
1785 if (![UNIVERSE displayGUI])
1786 {
1787 if (([self checkKeyPress:n_key_inc_field_of_view] || joyButtonState[BUTTON_INC_FIELD_OF_VIEW]) && (fieldOfView < MAX_FOV))
1788 {
1789 fieldOfView *= pow(fov_delta, delta_t);
1790 if (fieldOfView > MAX_FOV) fieldOfView = MAX_FOV;
1791 }
1792
1793 if (([self checkKeyPress:n_key_dec_field_of_view] || joyButtonState[BUTTON_DEC_FIELD_OF_VIEW]) && (fieldOfView > MIN_FOV))
1794 {
1795 fieldOfView /= pow(fov_delta, delta_t);
1796 if (fieldOfView < MIN_FOV) fieldOfView = MIN_FOV;
1797 }
1798
1799 NSDictionary *functionForFovAxis = [[stickHandler axisFunctions] oo_dictionaryForKey:[[NSNumber numberWithInt:AXIS_FIELD_OF_VIEW] stringValue]];
1800 if ([stickHandler joystickCount] != 0 && functionForFovAxis != nil)
1801 {
1802 // TODO think reqFov through
1803 double reqFov = [stickHandler getAxisState: AXIS_FIELD_OF_VIEW];
1804 if (fieldOfView < maxFieldOfView * reqFov)
1805 {
1806 fieldOfView *= pow(fov_delta, delta_t);
1807 if (fieldOfView > MAX_FOV) fieldOfView = MAX_FOV;
1808 }
1809 if (fieldOfView > maxFieldOfView * reqFov)
1810 {
1811 fieldOfView /= pow(fov_delta, delta_t);
1812 if (fieldOfView < MIN_FOV) fieldOfView = MIN_FOV;
1813 }
1814 }
1815 }
1816#endif
1817
1818 #ifndef NDEBUG
1819 exceptionContext = @"dump target state";
1820 if ([self checkKeyPress:n_key_dump_target_state])
1821 {
1823 {
1825 id target = [self primaryTarget];
1826 if (target == nil) target = self;
1827 [target dumpState];
1828 }
1829 }
1830 else dump_target_state_pressed = NO;
1831 #endif
1832
1833 // text displays
1834 exceptionContext = @"pollGuiScreenControls";
1835 [self pollGuiScreenControls];
1836 }
1837 else
1838 {
1839 // game is paused
1840 // check options menu request
1841 exceptionContext = @"options menu";
1842 if (([self checkKeyPress:n_key_gui_screen_options]) && (gui_screen != GUI_SCREEN_OPTIONS) && ![gameView allowingStringInput])
1843 {
1844 [gameView clearKeys];
1845 [self setGuiToLoadSaveScreen];
1846 }
1847
1848 #if (ALLOW_CUSTOM_VIEWS_WHILE_PAUSED)
1849 [self pollCustomViewControls]; // allow custom views during pause
1850 #endif
1851
1852 if (gui_screen == GUI_SCREEN_OPTIONS || gui_screen == GUI_SCREEN_GAMEOPTIONS || gui_screen == GUI_SCREEN_STICKMAPPER ||
1853 gui_screen == GUI_SCREEN_STICKPROFILE || gui_screen == GUI_SCREEN_KEYBOARD || gui_screen == GUI_SCREEN_KEYBOARD_CONFIRMCLEAR ||
1854 gui_screen == GUI_SCREEN_KEYBOARD_CONFIG || gui_screen == GUI_SCREEN_KEYBOARD_ENTRY || gui_screen == GUI_SCREEN_KEYBOARD_LAYOUT)
1855 {
1856 if ([UNIVERSE pauseMessageVisible]) [[UNIVERSE messageGUI] leaveLastLine];
1857 else [[UNIVERSE messageGUI] clear];
1858 NSTimeInterval time_this_frame = [NSDate timeIntervalSinceReferenceDate];
1859 OOTimeDelta time_delta;
1860 if (![[GameController sharedController] isGamePaused])
1861 {
1862 time_delta = time_this_frame - time_last_frame;
1863 time_last_frame = time_this_frame;
1864 time_delta = OOClamp_0_max_d(time_delta, MINIMUM_GAME_TICK);
1865 }
1866 else
1867 {
1868 time_delta = 0.0;
1869 }
1870
1871 script_time += time_delta;
1872 [self pollGuiArrowKeyControls:time_delta];
1873 }
1874
1875 exceptionContext = @"debug keys";
1876 #ifndef NDEBUG
1877 // look for debugging keys
1878 if ([self checkKeyPress:n_key_dump_entity_list] && ![gameView allowingStringInput])// look for the '0' key
1879 {
1881 {
1882 [UNIVERSE debugDumpEntities];
1883 gDebugFlags = 0;
1884 [UNIVERSE addMessage:@"Entity List dumped. Debugging OFF" forCount:3];
1885 }
1887 }
1888 else
1890
1891 // look for debugging keys
1892 if ([self checkKeyPress:n_key_debug_full] && ![gameView allowingStringInput])// look for the 'd' key
1893 {
1895 [UNIVERSE addMessage:@"Full debug ON" forCount:3];
1896 }
1897
1898 if ([self checkKeyPress:n_key_debug_collision] && ![gameView allowingStringInput])// look for the 'b' key
1899 {
1901 [UNIVERSE addMessage:@"Collision debug ON" forCount:3];
1902 }
1903
1904 if ([self checkKeyPress:n_key_debug_console_connect] && ![[OODebugMonitor sharedDebugMonitor] usingPlugInController] && ![gameView allowingStringInput]) // look for the 'c' key
1905 {
1906 // This code is executed only if we're not using the integrated plugin controller
1908 {
1909 if (![[OODebugMonitor sharedDebugMonitor] debuggerConnected])
1910 {
1912 if ([[OODebugMonitor sharedDebugMonitor] debuggerConnected])
1913 [UNIVERSE addMessage:@"Connected to debug console." forCount:3];
1914 }
1915 else
1916 {
1918 [UNIVERSE addMessage:@"Disconnected from debug console." forCount:3];
1919 }
1920 }
1922 }
1923 else
1925
1926 if ([self checkKeyPress:n_key_debug_bounding_boxes] && ![gameView allowingStringInput])// look for the 'x' key
1927 {
1929 [UNIVERSE addMessage:@"Bounding box debug ON" forCount:3];
1930 }
1931
1932 if ([self checkKeyPress:n_key_debug_shaders] && ![gameView allowingStringInput])// look for the 's' key
1933 {
1934 OOLogSetDisplayMessagesInClass(@"$shaderDebugOn", YES);
1935 [UNIVERSE addMessage:@"Shader debug ON" forCount:3];
1936 }
1937
1938 if (([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_arrow_right]) && gui_screen != GUI_SCREEN_GAMEOPTIONS && [UNIVERSE displayFPS] && ![gameView allowingStringInput])
1939 {
1941 {
1942 float newTimeAccelerationFactor = [self checkKeyPress:n_key_gui_arrow_left] ?
1943 fmax([UNIVERSE timeAccelerationFactor] / 2.0f, TIME_ACCELERATION_FACTOR_MIN) :
1944 fmin([UNIVERSE timeAccelerationFactor] * 2.0f, TIME_ACCELERATION_FACTOR_MAX);
1945 [UNIVERSE setTimeAccelerationFactor:newTimeAccelerationFactor];
1946 }
1947 leftRightKeyPressed = YES;
1948 }
1949 else
1951
1952
1953 if ([self checkKeyPress:n_key_debug_off] && ![gameView allowingStringInput])// look for the 'n' key
1954 {
1955 gDebugFlags = 0;
1956 [UNIVERSE addMessage:@"All debug flags OFF" forCount:3];
1957 OOLogSetDisplayMessagesInClass(@"$shaderDebugOn", NO);
1958 }
1959 #endif
1960 }
1961
1962 exceptionContext = @"pause";
1963 // Pause game 'p'
1964 if (([self checkKeyPress:n_key_pausebutton] || joyButtonState[BUTTON_PAUSE]) && gui_screen != GUI_SCREEN_LONG_RANGE_CHART && gui_screen != GUI_SCREEN_MISSION && ![gameView allowingStringInput])// look for the 'p' key
1965 {
1966 if (!pause_pressed)
1967 {
1968 if (paused)
1969 {
1970 script_time = saved_script_time;
1971 // Reset to correct GUI screen, if we are unpausing from one.
1972 // Don't set gui_screen here, use setGuis - they also switch backgrounds.
1973 // No gui switching events will be triggered while still paused.
1974 switch (saved_gui_screen)
1975 {
1976 case GUI_SCREEN_STATUS:
1977 [self setGuiToStatusScreen];
1978 break;
1979 case GUI_SCREEN_LONG_RANGE_CHART:
1980 [self setGuiToLongRangeChartScreen];
1981 break;
1982 case GUI_SCREEN_SHORT_RANGE_CHART:
1983 [self setGuiToShortRangeChartScreen];
1984 break;
1985 case GUI_SCREEN_MANIFEST:
1986 [self setGuiToManifestScreen];
1987 break;
1988 case GUI_SCREEN_MARKET:
1989 [self setGuiToMarketScreen];
1990 break;
1991 case GUI_SCREEN_MARKETINFO:
1992 [self setGuiToMarketInfoScreen];
1993 break;
1994 case GUI_SCREEN_SYSTEM_DATA:
1995 // Do not reset planet rotation if we are already in the system info screen!
1996 if (gui_screen != GUI_SCREEN_SYSTEM_DATA)
1997 [self setGuiToSystemDataScreen];
1998 break;
1999 default:
2000 gui_screen = saved_gui_screen; // make sure we're back to the right screen
2001 break;
2002 }
2003 [gameView allowStringInput:NO];
2004 [UNIVERSE clearPreviousMessage];
2005 [UNIVERSE setViewDirection:saved_view_direction];
2006 currentWeaponFacing = saved_weapon_facing;
2007 // make sure the light comes from the right direction after resuming from pause!
2008 if (saved_gui_screen == GUI_SCREEN_SYSTEM_DATA) [UNIVERSE setMainLightPosition:_sysInfoLight];
2009 [[UNIVERSE gui] setForegroundTextureKey:@"overlay"];
2010 [[UNIVERSE gameController] setGamePaused:NO];
2011 }
2012 else
2013 {
2014 saved_view_direction = [UNIVERSE viewDirection];
2015 saved_script_time = script_time;
2016 saved_gui_screen = gui_screen;
2017 saved_weapon_facing = currentWeaponFacing;
2018 [UNIVERSE pauseGame]; // pause handler
2019 }
2020 }
2021 pause_pressed = YES;
2022 }
2023 else
2024 {
2025 pause_pressed = NO;
2026 }
2027 }
2028 @catch (NSException *exception)
2029 {
2030 OOLog(kOOLogException, @"***** Exception in pollFlightControls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
2031 }
2032}
#define MIN_FOV
NSUInteger gDebugFlags
Definition main.m:7
#define MINIMUM_GAME_TICK
#define DEBUG_ALL
@ DEBUG_COLLISIONS
Definition OODebugFlags.h:7
@ DEBUG_BOUNDING_BOXES
void OOInitDebugSupport(void)
@ BUTTON_DOCKINGCLEARANCE
@ BUTTON_LAUNCHMISSILE
@ BUTTON_FUELINJECT
@ BUTTON_ENERGYBOMB
@ BUTTON_TARGETINCOMINGMISSILE
@ BUTTON_PRIMEEQUIPMENT
@ BUTTON_ROTATECARGO
@ BUTTON_VIEWSTARBOARD
@ BUTTON_VIEWAFT
@ BUTTON_GALACTICDRIVE
@ BUTTON_ARMMISSILE
@ BUTTON_HYPERDRIVE
@ BUTTON_ACTIVATEEQUIPMENT
@ BUTTON_CLOAK
@ BUTTON_NEXTTARGET
@ BUTTON_FIRE
@ BUTTON_UNARM
@ BUTTON_CYCLEMISSILE
@ BUTTON_VIEWPORT
@ BUTTON_HYPERSPEED
@ BUTTON_ESCAPE
@ BUTTON_JETTISON
@ BUTTON_MODEEQUIPMENT
@ BUTTON_VIEWFORWARD
@ BUTTON_WEAPONSONLINETOGGLE
@ BUTTON_INCTHRUST
@ BUTTON_ID
@ BUTTON_ECM
@ BUTTON_PREVTARGET
@ BUTTON_DECTHRUST
@ BUTTON_PRIMEEQUIPMENT_PREV
static BOOL prime_equipment_pressed
static BOOL ident_pressed
static BOOL dump_target_state_pressed
static BOOL next_target_pressed
static BOOL rotateCargo_pressed
static BOOL previous_target_pressed
static NSTimeInterval time_last_frame
static OOWeaponFacing saved_weapon_facing
static BOOL mode_equipment_pressed
static BOOL jump_pressed
static BOOL fire_missile_pressed
static BOOL safety_pressed
static BOOL target_incoming_missile_pressed
static BOOL galhyperspace_pressed
static int saved_gui_screen
static BOOL next_missile_pressed
static BOOL weaponsOnlineToggle_pressed
static BOOL hyperspace_pressed
static BOOL fastactivate_a_pressed
static int saved_view_direction
static BOOL escapePodKey_pressed
static BOOL activate_equipment_pressed
static BOOL dump_entity_list_pressed
static BOOL fastactivate_b_pressed
static BOOL target_missile_pressed
static BOOL docking_clearance_request_key_pressed
#define DEFAULT_HYPERSPACE_SPIN_TIME
Definition ShipEntity.h:70
#define TIME_ACCELERATION_FACTOR_MAX
Definition Universe.h:167
#define TIME_ACCELERATION_FACTOR_MIN
Definition Universe.h:165
void clearKey:(int theKey)
BOOL setDebugger:(id< OODebuggerInterface > debugger)
OODebugMonitor * sharedDebugMonitor()
double getAxisState:(int function)
void clearStickButtonState:(int stickButton)

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ pollGameOverControls:

- (void) pollGameOverControls: (double delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

4720 :(double)delta_t
4721{
4722 MyOpenGLView *gameView = [UNIVERSE gameView];
4723 if ([gameView isDown:32]) // look for the spacebar
4724 {
4725 if (!spacePressed)
4726 {
4727 [UNIVERSE displayMessage:@"" forCount:1.0];
4728 shot_time = INITIAL_SHOT_TIME; // forces immediate restart
4729 }
4730 spacePressed = YES;
4731 }
4732 else
4733 spacePressed = NO;
4734}
#define INITIAL_SHOT_TIME
Definition ShipEntity.h:100

◆ pollGuiArrowKeyControls:

- (void) pollGuiArrowKeyControls: (double delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

2035 :(double) delta_t
2036{
2037 MyOpenGLView *gameView = [UNIVERSE gameView];
2038 BOOL moving = NO;
2039 BOOL dragging = NO;
2040 double cursor_speed = ([gameView isCtrlDown] ? 20.0 : 10.0)* chart_zoom;
2041 GameController *controller = [UNIVERSE gameController];
2042 GuiDisplayGen *gui = [UNIVERSE gui];
2043 GUI_ROW_INIT(gui);
2044
2045 // deal with string inputs as necessary
2046 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
2047 {
2048 [gameView setStringInput: gvStringInputAlpha];
2049 }
2050 else if (gui_screen == GUI_SCREEN_SAVE)
2051 {
2052 [gameView setStringInput: gvStringInputLoadSave];
2053 }
2054 else if (gui_screen == GUI_SCREEN_MISSION && _missionTextEntry)
2055 {
2056 [gameView setStringInput: gvStringInputAll];
2057 }
2058 else if (gui_screen == GUI_SCREEN_KEYBOARD_ENTRY)
2059 {
2060 [gameView setStringInput: gvStringInputAll];
2061 }
2062#if 0
2063 // at the moment this function is never called for GUI_SCREEN_OXZMANAGER
2064 // but putting this here in case we do later
2065 else if (gui_screen == GUI_SCREEN_OXZMANAGER && [[OOOXZManager sharedManager] isAcceptingTextInput])
2066 {
2067 [gameView setStringInput: gvStringInputAll];
2068 }
2069#endif
2070 else
2071 {
2072 [gameView allowStringInput: NO];
2073 // If we have entered this screen with the injectors key pressed, make sure
2074 // that injectors switch off when we release it - Nikos.
2075 if (afterburner_engaged && ![self checkKeyPress:n_key_inject_fuel])
2076 {
2077 afterburner_engaged = NO;
2078 }
2079
2080 }
2081
2082 switch (gui_screen)
2083 {
2084 case GUI_SCREEN_LONG_RANGE_CHART:
2085
2086 if ([self status] != STATUS_WITCHSPACE_COUNTDOWN)
2087 {
2088 if ([[gameView typedString] length] > 0)
2089 {
2090 planetSearchString = [[[gameView typedString] lowercaseString] retain];
2091 NSPoint search_coords = [UNIVERSE findSystemCoordinatesWithPrefix:planetSearchString];
2092 if ((search_coords.x >= 0.0)&&(search_coords.y >= 0.0))
2093 {
2094 // always reset the found system index at the beginning of a new search
2095 if ([planetSearchString length] == 1) [[UNIVERSE gui] targetNextFoundSystem:0];
2096
2097 // Always select the right one out of 2 overlapping systems.
2098 [self targetNewSystem:0 whileTyping:YES];
2099 }
2100 else
2101 {
2102 found_system_id = -1;
2103 [self clearPlanetSearchString];
2104 }
2105 }
2106 else
2107 {
2108 if ([gameView isDown:gvDeleteKey]) // did we just delete the string ?
2109 {
2110 found_system_id = -1;
2111 [UNIVERSE findSystemCoordinatesWithPrefix:@""];
2112 }
2113 if (planetSearchString) [planetSearchString release];
2114 planetSearchString = nil;
2115 }
2116
2117 moving |= (searchStringLength != [[gameView typedString] length]);
2118 searchStringLength = [[gameView typedString] length];
2119 }
2120
2121 case GUI_SCREEN_SHORT_RANGE_CHART:
2122
2123 if ([self checkKeyPress:n_key_chart_highlight])
2124 {
2125 if (!queryPressed)
2126 {
2127 OOLongRangeChartMode mode = [self longRangeChartMode];
2128 if (mode != OOLRC_MODE_TECHLEVEL)
2129 {
2130 [self setLongRangeChartMode:mode+1];
2131 }
2132 else
2133 {
2134 [self setLongRangeChartMode:OOLRC_MODE_SUNCOLOR];
2135 }
2136 [self doScriptEvent:OOJSID("chartHighlightModeChanged") withArgument:OOStringFromLongRangeChartMode([self longRangeChartMode])];
2137 }
2138 queryPressed = YES;
2139 }
2140 else
2141 {
2142 queryPressed = NO;
2143 }
2144
2145 if ([self checkKeyPress:n_key_map_info] && chart_zoom <= CHART_ZOOM_SHOW_LABELS)
2146 {
2147 if (!chartInfoPressed)
2148 {
2149 show_info_flag = !show_info_flag;
2150 chartInfoPressed = YES;
2151 }
2152 }
2153 else
2154 {
2155 chartInfoPressed = NO;
2156 }
2157
2158 if ([self status] != STATUS_WITCHSPACE_COUNTDOWN)
2159 {
2160 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
2161 {
2162 if ([self checkKeyPress:n_key_advanced_nav_array_next] || [self checkKeyPress:n_key_advanced_nav_array_previous])
2163 {
2164 if (!pling_pressed)
2165 {
2166 if ([self checkKeyPress:n_key_advanced_nav_array_previous])
2167 {
2168 switch (ANA_mode)
2169 {
2170 case OPTIMIZED_BY_NONE: ANA_mode = OPTIMIZED_BY_TIME; break;
2171 case OPTIMIZED_BY_TIME: ANA_mode = OPTIMIZED_BY_JUMPS; break;
2172 default: ANA_mode = OPTIMIZED_BY_NONE; break;
2173 }
2174 }
2175 else
2176 {
2177 switch (ANA_mode)
2178 {
2179 case OPTIMIZED_BY_NONE: ANA_mode = OPTIMIZED_BY_JUMPS; break;
2180 case OPTIMIZED_BY_JUMPS:ANA_mode = OPTIMIZED_BY_TIME; break;
2181 default: ANA_mode = OPTIMIZED_BY_NONE; break;
2182 }
2183 }
2184 if (ANA_mode == OPTIMIZED_BY_NONE || ![self infoSystemOnRoute])
2185 {
2186 [self setInfoSystemID: target_system_id moveChart: NO];
2187 }
2188 }
2189 pling_pressed = YES;
2190 }
2191 else
2192 {
2193 pling_pressed = NO;
2194 }
2195 }
2196 else
2197 {
2198 ANA_mode = OPTIMIZED_BY_NONE;
2199 }
2200
2201 if ([gameView isDown:gvMouseDoubleClick])
2202 {
2203 [gameView clearMouse];
2204 mouse_left_down = NO;
2205 [self noteGUIWillChangeTo:GUI_SCREEN_SYSTEM_DATA];
2206 showingLongRangeChart = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART);
2207 [self setGuiToSystemDataScreen];
2208 break;
2209 }
2210 if ([gameView isDown:gvMouseLeftButton])
2211 {
2212 NSPoint maus = [gameView virtualJoystickPosition];
2214 double hscale = MAIN_GUI_PIXEL_WIDTH / (64.0 * chart_zoom);
2215 double vscale = MAIN_GUI_PIXEL_HEIGHT / (128.0 * chart_zoom);
2216 if (mouse_left_down == NO)
2217 {
2218 NSPoint centre = [self adjusted_chart_centre];
2219 centre_at_mouse_click = chart_centre_coordinates;
2220 mouse_click_position = maus;
2221 chart_focus_coordinates.x = OOClamp_0_max_f(centre.x + (maus.x * MAIN_GUI_PIXEL_WIDTH) / hscale, 256.0);
2222 chart_focus_coordinates.y = OOClamp_0_max_f(centre.y + (maus.y * MAIN_GUI_PIXEL_HEIGHT + vadjust) / vscale, 256.0);
2223 target_chart_focus = chart_focus_coordinates;
2224 }
2225 if (fabs(maus.x - mouse_click_position.x)*MAIN_GUI_PIXEL_WIDTH > 2 ||
2226 fabs(maus.y - mouse_click_position.y)*MAIN_GUI_PIXEL_HEIGHT > 2)
2227 {
2228 chart_centre_coordinates.x = OOClamp_0_max_f(centre_at_mouse_click.x - (maus.x - mouse_click_position.x)*MAIN_GUI_PIXEL_WIDTH/hscale, 256.0);
2229 chart_centre_coordinates.y = OOClamp_0_max_f(centre_at_mouse_click.y - (maus.y - mouse_click_position.y)*MAIN_GUI_PIXEL_HEIGHT/vscale, 256.0);
2230 target_chart_centre = chart_centre_coordinates;
2231 dragging = YES;
2232 }
2233 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
2234 [gameView resetTypedString];
2235 mouse_left_down = YES;
2236 }
2237 else if (mouse_left_down == YES)
2238 {
2239 NSPoint maus = [gameView virtualJoystickPosition];
2240 if (fabs(maus.x - mouse_click_position.x)*MAIN_GUI_PIXEL_WIDTH <= 2 &&
2241 fabs(maus.y - mouse_click_position.y)*MAIN_GUI_PIXEL_HEIGHT <= 2)
2242 {
2243 cursor_coordinates = chart_focus_coordinates;
2244 moving = YES;
2245 }
2246 else
2247 {
2248 dragging = YES;
2249 }
2250 mouse_left_down = NO;
2251 }
2252 if ([self checkKeyPress:n_key_map_home])
2253 {
2254 if ([gameView isOptDown])
2255 {
2256 [self homeInfoSystem];
2257 target_chart_focus = galaxy_coordinates;
2258 }
2259 else
2260 {
2261 [gameView resetTypedString];
2262 cursor_coordinates = galaxy_coordinates;
2263 target_chart_focus = cursor_coordinates;
2264 target_chart_centre = galaxy_coordinates;
2265 found_system_id = -1;
2266 [UNIVERSE findSystemCoordinatesWithPrefix:@""];
2267 moving = YES;
2268 }
2269 }
2270 if ([self checkKeyPress:n_key_map_end])
2271 {
2272 [self targetInfoSystem];
2273 target_chart_focus = cursor_coordinates;
2274 }
2275 if ([self checkKeyPress:n_key_map_zoom_in] || [gameView mouseWheelState] == gvMouseWheelDown)
2276 {
2277 target_chart_zoom *= CHART_ZOOM_SPEED_FACTOR;
2278 if (target_chart_zoom > CHART_MAX_ZOOM) target_chart_zoom = CHART_MAX_ZOOM;
2279 saved_chart_zoom = target_chart_zoom;
2280 }
2281 if ([self checkKeyPress:n_key_map_zoom_out] || [gameView mouseWheelState] == gvMouseWheelUp)
2282 {
2283 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
2284 {
2285 target_chart_zoom = CHART_MAX_ZOOM;
2286 [self setGuiToShortRangeChartScreen];
2287 }
2288 target_chart_zoom /= CHART_ZOOM_SPEED_FACTOR;
2289 if (target_chart_zoom < 1.0) target_chart_zoom = 1.0;
2290 saved_chart_zoom = target_chart_zoom;
2291 //target_chart_centre = cursor_coordinates;
2292 target_chart_focus = target_chart_centre;
2293 }
2294
2295 BOOL nextSystem = [gameView isShiftDown];
2296 BOOL nextSystemOnRoute = [gameView isOptDown];
2297
2298 if ([self checkNavKeyPress:n_key_gui_arrow_left])
2299 {
2300 if ((nextSystem || nextSystemOnRoute) && pressedArrow != 1)
2301 {
2302 if (nextSystem)
2303 {
2304 [self targetNewSystem:-1];
2305 target_chart_focus = cursor_coordinates;
2306 }
2307 else
2308 {
2309 [self clearPlanetSearchString];
2310 [self previousInfoSystem];
2311 target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
2312 }
2313 pressedArrow = 1;
2314 }
2315 else if (!nextSystem && !nextSystemOnRoute)
2316 {
2317 [gameView resetTypedString];
2318 cursor_coordinates.x -= cursor_speed*delta_t;
2319 if (cursor_coordinates.x < 0.0) cursor_coordinates.x = 0.0;
2320 moving = YES;
2321 target_chart_focus = cursor_coordinates;
2322 }
2323 }
2324 else
2326
2327 if ([self checkNavKeyPress:n_key_gui_arrow_right])
2328 {
2329 if ((nextSystem || nextSystemOnRoute) && pressedArrow != 2)
2330 {
2331 if (nextSystem)
2332 {
2333 [self targetNewSystem:+1];
2334 target_chart_focus = cursor_coordinates;
2335 }
2336 else
2337 {
2338 [self clearPlanetSearchString];
2339 [self nextInfoSystem];
2340 target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
2341 }
2342 pressedArrow = 2;
2343 }
2344 else if (!nextSystem && !nextSystemOnRoute)
2345 {
2346 [gameView resetTypedString];
2347 cursor_coordinates.x += cursor_speed*delta_t;
2348 if (cursor_coordinates.x > 256.0) cursor_coordinates.x = 256.0;
2349 moving = YES;
2350 target_chart_focus = cursor_coordinates;
2351 }
2352 }
2353 else
2355
2356 if ([self checkNavKeyPress:n_key_gui_arrow_down])
2357 {
2358 if (nextSystem && pressedArrow != 3)
2359 {
2360 [self targetNewSystem:+1];
2361 pressedArrow = 3;
2362 }
2363 else if (!nextSystem)
2364 {
2365 [gameView resetTypedString];
2366 cursor_coordinates.y += cursor_speed*delta_t*2.0;
2367 if (cursor_coordinates.y > 256.0) cursor_coordinates.y = 256.0;
2368 moving = YES;
2369 }
2370 target_chart_focus = cursor_coordinates;
2371 }
2372 else
2374
2375 if ([self checkNavKeyPress:n_key_gui_arrow_up])
2376 {
2377 if (nextSystem && pressedArrow != 4)
2378 {
2379 [self targetNewSystem:-1];
2380 pressedArrow = 4;
2381 }
2382 else if (!nextSystem)
2383 {
2384 [gameView resetTypedString];
2385 cursor_coordinates.y -= cursor_speed*delta_t*2.0;
2386 if (cursor_coordinates.y < 0.0) cursor_coordinates.y = 0.0;
2387 moving = YES;
2388 }
2389 target_chart_focus = cursor_coordinates;
2390 }
2391 else
2393 if ((cursor_moving)&&(!moving))
2394 {
2395 if (found_system_id == -1)
2396 {
2397 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
2398 [self setInfoSystemID: target_system_id moveChart: YES];
2399 }
2400 else
2401 {
2402 // if found with a search string, don't recalculate! Required for overlapping systems, like Divees & Tezabi in galaxy 5
2403 NSPoint fpos = [[UNIVERSE systemManager] getCoordinatesForSystem:found_system_id inGalaxy:galaxy_number];
2404 if (fpos.x != cursor_coordinates.x && fpos.y != cursor_coordinates.y)
2405 {
2406 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
2407 [self setInfoSystemID: target_system_id moveChart: YES];
2408 }
2409 }
2410 cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
2411 }
2412 if (chart_focus_coordinates.x - target_chart_centre.x <= -CHART_SCROLL_AT_X*chart_zoom)
2413 {
2414 target_chart_centre.x = chart_focus_coordinates.x + CHART_SCROLL_AT_X*chart_zoom;
2415 }
2416 else if (chart_focus_coordinates.x - target_chart_centre.x >= CHART_SCROLL_AT_X*chart_zoom)
2417 {
2418 target_chart_centre.x = chart_focus_coordinates.x - CHART_SCROLL_AT_X*chart_zoom;
2419 }
2420 if (chart_focus_coordinates.y - target_chart_centre.y <= -CHART_SCROLL_AT_Y*chart_zoom)
2421 {
2422 target_chart_centre.y = chart_focus_coordinates.y + CHART_SCROLL_AT_Y*chart_zoom;
2423 }
2424 else if (chart_focus_coordinates.y - target_chart_centre.y >= CHART_SCROLL_AT_Y*chart_zoom)
2425 {
2426 target_chart_centre.y = chart_focus_coordinates.y - CHART_SCROLL_AT_Y*chart_zoom;
2427 }
2428 chart_centre_coordinates.x = (3.0*chart_centre_coordinates.x + target_chart_centre.x)/4.0;
2429 chart_centre_coordinates.y = (3.0*chart_centre_coordinates.y + target_chart_centre.y)/4.0;
2430 chart_zoom = (3.0*chart_zoom + target_chart_zoom)/4.0;
2431 chart_focus_coordinates.x = (3.0*chart_focus_coordinates.x + target_chart_focus.x)/4.0;
2432 chart_focus_coordinates.y = (3.0*chart_focus_coordinates.y + target_chart_focus.y)/4.0;
2433 if (cursor_moving || dragging) [self setGuiToChartScreenFrom: gui_screen]; // update graphics
2434 cursor_moving = moving;
2435 }
2436 break;
2437
2438 case GUI_SCREEN_SYSTEM_DATA:
2439 if ([self checkKeyPress:n_key_system_next_system])
2440 {
2442 {
2443 [self nextInfoSystem];
2445 }
2446 }
2447 else
2448 {
2450 }
2451 if ([self checkKeyPress:n_key_system_previous_system])
2452 {
2454 {
2455 [self previousInfoSystem];
2457 }
2458 }
2459 else
2460 {
2462 }
2463 if ([self checkKeyPress:n_key_system_home])
2464 {
2465 if (!home_info_pressed)
2466 {
2467 [self homeInfoSystem];
2468 home_info_pressed = YES;
2469 }
2470 }
2471 else
2472 {
2473 home_info_pressed = NO;
2474 }
2475 if ([self checkKeyPress:n_key_system_end])
2476 {
2478 {
2479 [self targetInfoSystem];
2480 target_info_pressed = YES;
2481 }
2482 }
2483 else
2484 {
2486 }
2487 break;
2488
2489#if OO_USE_CUSTOM_LOAD_SAVE
2490 // DJS: Farm off load/save screen options to LoadSave.m
2491 case GUI_SCREEN_LOAD:
2492 {
2493 NSString *commanderFile = [self commanderSelector];
2494 if(commanderFile)
2495 {
2496 // also release the demo ship here (see showShipyardModel and noteGUIDidChangeFrom)
2497 [demoShip release];
2498 demoShip = nil;
2499
2500 [self loadPlayerFromFile:commanderFile asNew:NO];
2501 }
2502 break;
2503 }
2504
2505 case GUI_SCREEN_SAVE:
2506 [self pollGuiScreenControlsWithFKeyAlias:NO];
2507 /* Only F1 works for launch on this screen, not '1' or
2508 * whatever it has been bound to */
2509 if ([self checkKeyPress:n_key_launch_ship fKey_only:YES]) [self handleUndockControl];
2510 if (gui_screen == GUI_SCREEN_SAVE)
2511 {
2512 [self saveCommanderInputHandler];
2513 }
2514 else pollControls = YES;
2515 break;
2516
2517 case GUI_SCREEN_SAVE_OVERWRITE:
2518 [self overwriteCommanderInputHandler];
2519 break;
2520#endif
2521
2522 case GUI_SCREEN_STICKMAPPER:
2523 [self handleStickMapperScreenKeys];
2524 break;
2525
2526 case GUI_SCREEN_STICKPROFILE:
2527 [self stickProfileInputHandler: gui view: gameView];
2528 break;
2529
2530 case GUI_SCREEN_GAMEOPTIONS:
2531 [self handleGameOptionsScreenKeys];
2532 break;
2533
2534 case GUI_SCREEN_KEYBOARD:
2535 [self handleKeyMapperScreenKeys];
2536 //if ([gameView isDown:' '])
2537 //{
2538 // [self setGuiToGameOptionsScreen];
2539 //}
2540 break;
2541
2542 case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
2543 [self handleKeyMapperConfirmClearKeys:gui view:gameView];
2544 break;
2545
2546 case GUI_SCREEN_KEYBOARD_CONFIG:
2547 [self handleKeyConfigKeys:gui view:gameView];
2548 break;
2549
2550 case GUI_SCREEN_KEYBOARD_ENTRY:
2551 [self handleKeyConfigEntryKeys:gui view:gameView];
2552 break;
2553
2554 case GUI_SCREEN_KEYBOARD_LAYOUT:
2555 [self handleKeyboardLayoutKeys];
2556 break;
2557
2558 case GUI_SCREEN_SHIPLIBRARY:
2559 if ([gameView isDown:' ']) // '<space>'
2560 {
2561 // viewed in game, return to interfaces as that's where it's accessed from
2562 [self setGuiToInterfacesScreen:0];
2563 }
2564 if ([self checkKeyPress:n_key_gui_arrow_up]) // '<--'
2565 {
2566 if (!upDownKeyPressed)
2567 [UNIVERSE selectIntro2Previous];
2568 }
2569 if ([self checkKeyPress:n_key_gui_arrow_down]) // '-->'
2570 {
2571 if (!upDownKeyPressed)
2572 [UNIVERSE selectIntro2Next];
2573 }
2574 upDownKeyPressed = (([self checkKeyPress:n_key_gui_arrow_up])||([self checkKeyPress:n_key_gui_arrow_down]));
2575
2576 if ([self checkKeyPress:n_key_gui_arrow_left]) // '<--'
2577 {
2579 [UNIVERSE selectIntro2PreviousCategory];
2580 }
2581 if ([self checkKeyPress:n_key_gui_arrow_right]) // '-->'
2582 {
2584 [UNIVERSE selectIntro2NextCategory];
2585 }
2586 leftRightKeyPressed = (([self checkKeyPress:n_key_gui_arrow_left])||([self checkKeyPress:n_key_gui_arrow_right]));
2587
2588 break;
2589 case GUI_SCREEN_OPTIONS:
2590 [self handleGUIUpDownArrowKeys];
2591 OOGUIRow guiSelectedRow = [gui selectedRow];
2592 BOOL selectKeyPress = ([self checkKeyPress:n_key_gui_select]||[gameView isDown:gvMouseDoubleClick]);
2593
2594 if (selectKeyPress) // 'enter'
2595 {
2596 if ((guiSelectedRow == GUI_ROW(,QUICKSAVE))&&(!disc_operation_in_progress))
2597 {
2598 @try
2599 {
2601 [self quicksavePlayer];
2602 }
2603 @catch (NSException *exception)
2604 {
2605 OOLog(kOOLogException, @"\n\n***** Handling exception: %@ : %@ *****\n\n",[exception name], [exception reason]);
2606 if ([[exception name] isEqual:@"GameNotSavedException"]) // try saving game instead
2607 {
2608 OOLog(kOOLogException, @"%@", @"\n\n***** Trying a normal save instead *****\n\n");
2609 if ([controller inFullScreenMode])
2610 [controller pauseFullScreenModeToPerform:@selector(savePlayer) onTarget:self];
2611 else
2612 [self savePlayer];
2613 }
2614 else
2615 {
2616 @throw exception;
2617 }
2618 }
2619 }
2620 if ((guiSelectedRow == GUI_ROW(,SAVE))&&(!disc_operation_in_progress))
2621 {
2623 [self savePlayer];
2624 }
2625 if ((guiSelectedRow == GUI_ROW(,LOAD))&&(!disc_operation_in_progress))
2626 {
2628 if (![self loadPlayer])
2629 {
2631 [self setGuiToStatusScreen];
2632 }
2633 }
2634
2635
2636 if ((guiSelectedRow == GUI_ROW(,BEGIN_NEW))&&(!disc_operation_in_progress))
2637 {
2639 [UNIVERSE setUseAddOns:SCENARIO_OXP_DEFINITION_ALL fromSaveGame:NO forceReinit:YES]; // calls reinitAndShowDemo
2640 }
2641
2642 if ([gameView isDown:gvMouseDoubleClick])
2643 [gameView clearMouse];
2644 }
2645 else
2646 {
2648 }
2649
2650#if OOLITE_SDL
2651 // quit only appears in GNUstep as users aren't
2652 // used to Cmd-Q equivs. Same goes for window
2653 // vs fullscreen.
2654 if ((guiSelectedRow == GUI_ROW(,QUIT)) && selectKeyPress)
2655 {
2656 [[UNIVERSE gameController] exitAppWithContext:@"Exit Game selected on options screen"];
2657 }
2658#endif
2659
2660 if ((guiSelectedRow == GUI_ROW(,GAMEOPTIONS)) && selectKeyPress)
2661 {
2662 [gameView clearKeys];
2663 [self setGuiToGameOptionsScreen];
2664 }
2665
2666 break;
2667
2668 case GUI_SCREEN_EQUIP_SHIP:
2669 if ([self handleGUIUpDownArrowKeys])
2670 {
2671 NSString *itemText = [gui selectedRowText];
2672 OOWeaponType weaponType = nil;
2673
2674 if ([itemText isEqual:FORWARD_FACING_STRING]) weaponType = forward_weapon_type;
2675 if ([itemText isEqual:AFT_FACING_STRING]) weaponType = aft_weapon_type;
2676 if ([itemText isEqual:PORT_FACING_STRING]) weaponType = port_weapon_type;
2677 if ([itemText isEqual:STARBOARD_FACING_STRING]) weaponType = starboard_weapon_type;
2678
2679 if (weaponType != nil)
2680 {
2681 BOOL sameAs = OOWeaponTypeFromEquipmentIdentifierSloppy([gui selectedRowKey]) == weaponType;
2682 // override showInformation _completely_ with itemText
2683 if ([[weaponType identifier] isEqualToString:@"EQ_WEAPON_NONE"]) itemText = DESC(@"no-weapon-enter-to-install");
2684 else
2685 {
2686 NSString *weaponName = [[OOEquipmentType equipmentTypeWithIdentifier:OOEquipmentIdentifierFromWeaponType(weaponType)] name];
2687 if (sameAs) itemText = [NSString stringWithFormat:DESC(@"weapon-installed-@"), weaponName];
2688 else itemText = [NSString stringWithFormat:DESC(@"weapon-@-enter-to-replace"), weaponName];
2689 }
2690
2691 [self showInformationForSelectedUpgradeWithFormatString:itemText];
2692 }
2693 else
2694 [self showInformationForSelectedUpgrade];
2695 }
2696
2697 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
2698 {
2700 {
2701 if ([[gui keyForRow:GUI_ROW_EQUIPMENT_START] hasPrefix:@"More:"])
2702 {
2703 [self playMenuPagePrevious];
2704 [gui setSelectedRow:GUI_ROW_EQUIPMENT_START];
2705 [self buySelectedItem];
2706 }
2707 timeLastKeyPress = script_time;
2708 }
2709 }
2710 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
2711 {
2713 {
2714 if ([[gui keyForRow:GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT - 1] hasPrefix:@"More:"])
2715 {
2716 [self playMenuPageNext];
2717 [gui setSelectedRow:GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT - 1];
2718 [self buySelectedItem];
2719 }
2720 timeLastKeyPress = script_time;
2721 }
2722 }
2723 leftRightKeyPressed = [self checkKeyPress:n_key_gui_arrow_right]|[self checkKeyPress:n_key_gui_arrow_left]|[self checkKeyPress:n_key_gui_page_down]|[self checkKeyPress:n_key_gui_page_up];
2724
2725 if ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick])
2726 {
2727 if ([gameView isDown:gvMouseDoubleClick])
2728 {
2729 selectPressed = NO;
2730 [gameView clearMouse];
2731 }
2732 if ((!selectPressed)&&([gui selectedRow] > -1))
2733 {
2734 [self buySelectedItem];
2735 selectPressed = YES;
2736 }
2737 }
2738 else
2739 {
2740 selectPressed = NO;
2741 }
2742 break;
2743
2744 case GUI_SCREEN_INTERFACES:
2745 if ([self handleGUIUpDownArrowKeys])
2746 {
2747 [self showInformationForSelectedInterface];
2748 }
2749 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
2750 {
2752 {
2753 if ([[gui keyForRow:GUI_ROW_INTERFACES_START] hasPrefix:@"More:"])
2754 {
2755 [self playMenuPagePrevious];
2756 [gui setSelectedRow:GUI_ROW_INTERFACES_START];
2757 [self activateSelectedInterface];
2758 }
2759 timeLastKeyPress = script_time;
2760 }
2761 }
2762 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
2763 {
2765 {
2766 if ([[gui keyForRow:GUI_ROW_INTERFACES_START + GUI_MAX_ROWS_INTERFACES - 1] hasPrefix:@"More:"])
2767 {
2768 [self playMenuPageNext];
2769 [gui setSelectedRow:GUI_ROW_INTERFACES_START + GUI_MAX_ROWS_INTERFACES - 1];
2770 [self activateSelectedInterface];
2771 }
2772 timeLastKeyPress = script_time;
2773 }
2774 }
2775 leftRightKeyPressed = [self checkKeyPress:n_key_gui_arrow_right]|[self checkKeyPress:n_key_gui_arrow_left]|[self checkKeyPress:n_key_gui_page_down]|[self checkKeyPress:n_key_gui_page_up];
2776 if ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick]) // 'enter'
2777 {
2778 if ([gameView isDown:gvMouseDoubleClick])
2779 {
2780 selectPressed = NO;
2781 [gameView clearMouse];
2782 }
2783 if ((!selectPressed)&&([gui selectedRow] > -1))
2784 {
2785 [self activateSelectedInterface];
2786 selectPressed = YES;
2787 }
2788 }
2789 else
2790 {
2791 selectPressed = NO;
2792 }
2793 break;
2794
2795
2796 case GUI_SCREEN_MARKETINFO:
2797 [self pollMarketScreenControls];
2798 break;
2799
2800 case GUI_SCREEN_MARKET:
2801 [self pollMarketScreenControls];
2802
2803 if ([self checkKeyPress:n_key_market_filter_cycle] || [self checkKeyPress:n_key_market_sorter_cycle])
2804 {
2805 if (!queryPressed)
2806 {
2807 queryPressed = YES;
2808 if ([self checkKeyPress:n_key_market_filter_cycle])
2809 {
2810 if (marketFilterMode >= MARKET_FILTER_MODE_MAX)
2811 {
2812 marketFilterMode = MARKET_FILTER_MODE_OFF;
2813 }
2814 else
2815 {
2816 marketFilterMode++;
2817 }
2818 }
2819 else
2820 {
2821 if (marketSorterMode >= MARKET_SORTER_MODE_MAX)
2822 {
2823 marketSorterMode = MARKET_SORTER_MODE_OFF;
2824 }
2825 else
2826 {
2827 marketSorterMode++;
2828 }
2829 }
2830 [self playChangedOption];
2831 [self setGuiToMarketScreen];
2832 }
2833 }
2834 else
2835 {
2836 queryPressed = NO;
2837 }
2838
2839 break;
2840
2841 case GUI_SCREEN_REPORT:
2842 if ([gameView isDown:32]) // spacebar
2843 {
2844 if (!spacePressed)
2845 {
2846 BOOL reportEnded = ([dockingReport length] == 0);
2847 [self playDismissedReportScreen];
2848 if(reportEnded)
2849 {
2850 [self setGuiToStatusScreen];
2851 [self doScriptEvent:OOJSID("reportScreenEnded")]; // last report given. Screen is now free for missionscreens.
2852 [self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")];
2853 }
2854 else
2855 {
2856 [self setGuiToDockingReportScreen];
2857 }
2858
2859 }
2860 spacePressed = YES;
2861 }
2862 else
2863 spacePressed = NO;
2864 break;
2865 case GUI_SCREEN_STATUS:
2866 [self handleGUIUpDownArrowKeys];
2867 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
2868 {
2869
2871 {
2872 if ([[gui keyForRow:STATUS_EQUIPMENT_FIRST_ROW] isEqual:GUI_KEY_OK])
2873 {
2874 [gui setSelectedRow:STATUS_EQUIPMENT_FIRST_ROW];
2875 [self playMenuPagePrevious];
2876 [gui setStatusPage:-1];
2877 [self setGuiToStatusScreen];
2878 }
2879 timeLastKeyPress = script_time;
2880 }
2881 }
2882 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
2883 {
2884
2886 {
2887 NSUInteger maxRows = [[self hud] allowBigGui] ? STATUS_EQUIPMENT_MAX_ROWS + STATUS_EQUIPMENT_BIGGUI_EXTRA_ROWS : STATUS_EQUIPMENT_MAX_ROWS;
2888 if ([[gui keyForRow:STATUS_EQUIPMENT_FIRST_ROW + maxRows] isEqual:GUI_KEY_OK])
2889 {
2890 [gui setSelectedRow:STATUS_EQUIPMENT_FIRST_ROW + maxRows];
2891 [self playMenuPageNext];
2892 [gui setStatusPage:+1];
2893 [self setGuiToStatusScreen];
2894 }
2895 timeLastKeyPress = script_time;
2896 }
2897 }
2898 leftRightKeyPressed = [self checkKeyPress:n_key_gui_arrow_right]|[self checkKeyPress:n_key_gui_arrow_left]|[self checkKeyPress:n_key_gui_page_down]|[self checkKeyPress:n_key_gui_page_up];
2899
2900 if ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick])
2901 {
2902 if ([gameView isDown:gvMouseDoubleClick])
2903 {
2904 selectPressed = NO;
2905 [gameView clearMouse];
2906 }
2907 if ((!selectPressed)&&([gui selectedRow] > -1))
2908 {
2909 [gui setStatusPage:([gui selectedRow] == STATUS_EQUIPMENT_FIRST_ROW ? -1 : +1)];
2910 [self setGuiToStatusScreen];
2911
2912 selectPressed = YES;
2913 }
2914 }
2915 else
2916 {
2917 selectPressed = NO;
2918 }
2919
2920 break;
2921 case GUI_SCREEN_MANIFEST:
2922 [self handleGUIUpDownArrowKeys];
2923 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
2924 {
2925
2927 {
2928 if ([[gui keyForRow:MANIFEST_SCREEN_ROW_BACK] isEqual:GUI_KEY_OK])
2929 {
2930 [gui setSelectedRow:MANIFEST_SCREEN_ROW_BACK];
2931 [self playMenuPagePrevious];
2932 [gui setStatusPage:-1];
2933 [self setGuiToManifestScreen];
2934 }
2935 timeLastKeyPress = script_time;
2936 }
2937 }
2938 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
2939 {
2941 if ([[self hud] isHidden] || [[self hud] allowBigGui])
2942 {
2943 nextRow += 7;
2944 }
2946 {
2947 if ([[gui keyForRow:nextRow] isEqual:GUI_KEY_OK])
2948 {
2949 [gui setSelectedRow:nextRow];
2950 [self playMenuPageNext];
2951 [gui setStatusPage:+1];
2952 [self setGuiToManifestScreen];
2953 }
2954 timeLastKeyPress = script_time;
2955 }
2956 }
2957 leftRightKeyPressed = [self checkKeyPress:n_key_gui_arrow_right]|[self checkKeyPress:n_key_gui_arrow_left]|[self checkKeyPress:n_key_gui_page_down]|[self checkKeyPress:n_key_gui_page_up];
2958
2959 if ([self checkKeyPress:n_key_gui_select] || [gameView isDown:gvMouseDoubleClick])
2960 {
2961 if ([gameView isDown:gvMouseDoubleClick])
2962 {
2963 selectPressed = NO;
2964 [gameView clearMouse];
2965 }
2966 if ((!selectPressed)&&([gui selectedRow] > -1))
2967 {
2968 [gui setStatusPage:([gui selectedRow] == MANIFEST_SCREEN_ROW_BACK ? -1 : +1)];
2969 [self setGuiToManifestScreen];
2970
2971 selectPressed = YES;
2972 }
2973 }
2974 else
2975 {
2976 selectPressed = NO;
2977 }
2978
2979 break;
2980
2981 case GUI_SCREEN_SHIPYARD:
2982 if ([self handleGUIUpDownArrowKeys])
2983 {
2984 [self showShipyardInfoForSelection];
2985 }
2986
2987 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
2988 {
2990 {
2991 if ([[gui keyForRow:GUI_ROW_SHIPYARD_START] hasPrefix:@"More:"])
2992 {
2993 [self playMenuPagePrevious];
2994 [gui setSelectedRow:GUI_ROW_SHIPYARD_START];
2995 [self buySelectedShip];
2996 }
2997 timeLastKeyPress = script_time;
2998 }
2999 }
3000 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
3001 {
3003 {
3004 if ([[gui keyForRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1] hasPrefix:@"More:"])
3005 {
3006 [self playMenuPageNext];
3007 [gui setSelectedRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1];
3008 [self buySelectedShip];
3009 }
3010 timeLastKeyPress = script_time;
3011 }
3012 }
3013 leftRightKeyPressed = [self checkKeyPress:n_key_gui_arrow_right]|[self checkKeyPress:n_key_gui_arrow_left]|[self checkKeyPress:n_key_gui_page_down]|[self checkKeyPress:n_key_gui_page_up];
3014
3015 if ([self checkKeyPress:n_key_gui_select]) // 'enter' NOT double-click
3016 {
3017 if (!selectPressed)
3018 {
3019 // try to buy the ship!
3020 NSString *key = [gui keyForRow:[gui selectedRow]];
3021 OOCreditsQuantity shipprice = 0;
3022 if (![key hasPrefix:@"More:"])
3023 {
3024 shipprice = [self priceForShipKey:key];
3025 }
3026
3027 if ([self buySelectedShip])
3028 {
3029 if (![key hasPrefix:@"More:"]) // don't do anything if we clicked/selected a "More:" line
3030 {
3031 [UNIVERSE removeDemoShips];
3032 [self setGuiToStatusScreen];
3033 [self playBuyShip];
3034 [self doScriptEvent:OOJSID("playerBoughtNewShip") withArgument:self andArgument:[NSNumber numberWithUnsignedLongLong:shipprice]]; // some equipment.oxp might want to know everything has changed.
3035 }
3036 }
3037 else
3038 {
3039 [self playCantBuyShip];
3040 }
3041 }
3042 selectPressed = YES;
3043 }
3044 else
3045 {
3046 selectPressed = NO;
3047 }
3048 if ([gameView isDown:gvMouseDoubleClick])
3049 {
3050 if (([gui selectedRow] == GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1) && [[gui keyForRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1] hasPrefix:@"More:"])
3051 {
3052 [self playMenuPageNext];
3053 [gui setSelectedRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1];
3054 [self buySelectedShip];
3055 }
3056 else if (([gui selectedRow] == GUI_ROW_SHIPYARD_START) && [[gui keyForRow:GUI_ROW_SHIPYARD_START] hasPrefix:@"More:"])
3057 {
3058 [self playMenuPagePrevious];
3059 [gui setSelectedRow:GUI_ROW_SHIPYARD_START];
3060 [self buySelectedShip];
3061 }
3062 [gameView clearMouse];
3063 }
3064
3065 break;
3066
3067 default:
3068 break;
3069 }
3070
3071 // check for any extra keys added by scripting
3072 NSArray *keys = [extraGuiScreenKeys objectForKey:[NSString stringWithFormat:@"%d", gui_screen]];
3073 if (keys) {
3074 NSInteger kc = [keys count];
3075 OOJSGuiScreenKeyDefinition *definition = nil;
3076 NSDictionary *keydefs = nil;
3077 NSString *key = nil;
3078 while (kc--) {
3079 definition = [keys objectAtIndex:kc];
3080 keydefs = [definition registerKeys];
3081 foreach (key, [keydefs allKeys])
3082 {
3083 if ([self checkKeyPress:[keydefs objectForKey:key]])
3084 {
3086 {
3087 // do callback
3088 if (definition)
3089 {
3090 [[UNIVERSE gameView] clearKeys];
3091 [definition runCallback:key];
3092 }
3093 else
3094 {
3095 OOLog(@"interface.missingCallback", @"Unable to find callback definition for %@ using key %@", [definition name], key);
3096 }
3097 }
3099 }
3100 else
3102 }
3103 }
3104 }
3105
3106 // damp any rotations we entered with
3107 if (flightRoll > 0.0)
3108 {
3109 if (flightRoll > delta_t) [self decrease_flight_roll:delta_t];
3110 else flightRoll = 0.0;
3111 }
3112 if (flightRoll < 0.0)
3113 {
3114 if (flightRoll < -delta_t) [self increase_flight_roll:delta_t];
3115 else flightRoll = 0.0;
3116 }
3117 if (flightPitch > 0.0)
3118 {
3119 if (flightPitch > delta_t) [self decrease_flight_pitch:delta_t];
3120 else flightPitch = 0.0;
3121 }
3122 if (flightPitch < 0.0)
3123 {
3124 if (flightPitch < -delta_t) [self increase_flight_pitch:delta_t];
3125 else flightPitch = 0.0;
3126 }
3127 if (flightYaw > 0.0)
3128 {
3129 if (flightYaw > delta_t) [self decrease_flight_yaw:delta_t];
3130 else flightYaw = 0.0;
3131 }
3132 if (flightYaw < 0.0)
3133 {
3134 if (flightYaw < -delta_t) [self increase_flight_yaw:delta_t];
3135 else flightYaw = 0.0;
3136 }
3137}
#define MAIN_GUI_PIXEL_WIDTH
#define MAIN_GUI_PIXEL_HEIGHT
OOLongRangeChartMode
Definition OOTypes.h:50
@ OPTIMIZED_BY_JUMPS
Definition OOTypes.h:35
@ OPTIMIZED_BY_TIME
Definition OOTypes.h:36
#define MAX_ROWS_SHIPS_FOR_SALE
#define GUI_ROW_SHIPYARD_START
static BOOL extra_gui_key_pressed
static NSPoint centre_at_mouse_click
static BOOL chartInfoPressed
static BOOL next_planet_info_pressed
static int pressedArrow
static BOOL target_info_pressed
static BOOL home_info_pressed
static BOOL previous_planet_info_pressed
static BOOL mouse_left_down
static BOOL queryPressed
static BOOL pling_pressed
static NSUInteger searchStringLength
static NSPoint mouse_click_position
static BOOL cursor_moving
#define CHART_SCREEN_VERTICAL_CENTRE
@ STATUS_EQUIPMENT_FIRST_ROW
@ STATUS_EQUIPMENT_MAX_ROWS
@ STATUS_EQUIPMENT_BIGGUI_EXTRA_ROWS
@ GUI_ROW_INTERFACES_START
@ GUI_MAX_ROWS_INTERFACES
@ MARKET_FILTER_MODE_MAX
#define CHART_ZOOM_SHOW_LABELS
#define MANIFEST_SCREEN_ROW_BACK
#define CHART_ZOOM_SPEED_FACTOR
#define MANIFEST_SCREEN_ROW_NEXT
@ MARKET_SORTER_MODE_MAX
void setStatusPage:(NSInteger pageNum)
void resetTypedString()

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ pollGuiScreenControls

- (void) pollGuiScreenControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

4556{
4557 [self pollGuiScreenControlsWithFKeyAlias:YES];
4558}

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ pollGuiScreenControlsWithFKeyAlias:

- (void) pollGuiScreenControlsWithFKeyAlias: (BOOL fKeyAlias
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

4561 :(BOOL)fKeyAlias
4562{
4563 if(!pollControls && fKeyAlias) // Still OK to run, if we don't use number keys.
4564 return;
4565
4566 GuiDisplayGen *gui = [UNIVERSE gui];
4567 MyOpenGLView *gameView = [UNIVERSE gameView];
4568 BOOL docked_okay = ([self status] == STATUS_DOCKED);
4569
4570 // text displays
4571 if ([self checkKeyPress:n_key_gui_screen_status fKey_only:!fKeyAlias])
4572 {
4574 {
4576 if (gui_screen == GUI_SCREEN_STATUS)
4577 {
4578 [self noteGUIWillChangeTo:GUI_SCREEN_MANIFEST];
4579 [self setGuiToManifestScreen];
4580 }
4581 else
4582 [self setGuiToStatusScreen];
4583 [self checkScript];
4584 }
4585 }
4586 else
4587 {
4589 }
4590
4591 if ([self checkKeyPress:n_key_gui_chart_screens fKey_only:!fKeyAlias])
4592 {
4593 mouse_left_down = NO;
4594 [gameView clearMouse];
4596 {
4598 // handles http://aegidian.org/bb/viewtopic.php?p=233189#p233189
4599 if (EXPECT_NOT([self status] == STATUS_WITCHSPACE_COUNTDOWN && gui_screen == GUI_SCREEN_SHORT_RANGE_CHART))
4600 {
4601 // don't switch to LRC if countdown in progress
4603 }
4604 else if (gui_screen == GUI_SCREEN_SHORT_RANGE_CHART || (gui_screen == GUI_SCREEN_SYSTEM_DATA && showingLongRangeChart))
4605 {
4606 if (target_chart_zoom != CHART_MAX_ZOOM)
4607 {
4608 saved_chart_zoom = target_chart_zoom;
4609 }
4610 target_chart_zoom = CHART_MAX_ZOOM;
4611 [self noteGUIWillChangeTo:GUI_SCREEN_LONG_RANGE_CHART];
4612 [self setGuiToLongRangeChartScreen];
4613 }
4614 else
4615 {
4616 if (target_chart_zoom == CHART_MAX_ZOOM)
4617 {
4618 target_chart_zoom = saved_chart_zoom;
4619 }
4620 //target_chart_centre = cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
4621 [self noteGUIWillChangeTo:GUI_SCREEN_SHORT_RANGE_CHART];
4622 [self setGuiToShortRangeChartScreen];
4623 }
4624 }
4625 }
4626 else
4627 {
4629 }
4630
4631 if ([self checkKeyPress:n_key_gui_system_data fKey_only:!fKeyAlias])
4632 {
4633 if (gui_screen != GUI_SCREEN_SYSTEM_DATA)
4634 {
4635 showingLongRangeChart = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART);
4636 [self noteGUIWillChangeTo:GUI_SCREEN_SYSTEM_DATA];
4637 [self setGuiToSystemDataScreen];
4638 }
4639 }
4640
4641 if ([self checkKeyPress:n_key_gui_market fKey_only:!fKeyAlias])
4642 {
4643 if (gui_screen != GUI_SCREEN_MARKET)
4644 {
4645 [gameView clearKeys];
4646 [gui setNoSelectedRow];
4647 [self noteGUIWillChangeTo:GUI_SCREEN_MARKET];
4648 [self setGuiToMarketScreen];
4649 }
4650 else
4651 {
4652 [gameView clearKeys];
4653 [gui setNoSelectedRow];
4654 [self noteGUIWillChangeTo:GUI_SCREEN_MARKETINFO];
4655 [self setGuiToMarketInfoScreen];
4656 }
4657 }
4658
4659
4660 if (docked_okay)
4661 {
4662 if (([self checkKeyPress:n_key_gui_screen_options fKey_only:!fKeyAlias]) && (gui_screen != GUI_SCREEN_OPTIONS))
4663 {
4664 [gameView clearKeys];
4665 [self setGuiToLoadSaveScreen];
4666 }
4667
4668 if ([self checkKeyPress:n_key_gui_screen_equipship fKey_only:!fKeyAlias])
4669 {
4671 {
4672 if ([self dockedStation] == nil) [self setDockedAtMainStation];
4673 OOGUIScreenID oldScreen = gui_screen;
4674
4675 if ((gui_screen == GUI_SCREEN_EQUIP_SHIP) && [[self dockedStation] hasShipyard])
4676 {
4677 [gameView clearKeys];
4678 [self noteGUIWillChangeTo:GUI_SCREEN_SHIPYARD];
4679 [gui setNoSelectedRow];
4680 [self setGuiToShipyardScreen:0];
4681 [gui setSelectedRow:GUI_ROW_SHIPYARD_START];
4682 [self showShipyardInfoForSelection];
4683 }
4684 else
4685 {
4686 [gameView clearKeys];
4687 [self noteGUIWillChangeTo:GUI_SCREEN_EQUIP_SHIP];
4688 [gui setNoSelectedRow];
4689 [self setGuiToEquipShipScreen:0];
4690 [gui setSelectedRow:GUI_ROW_EQUIPMENT_START];
4691 }
4692
4693 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
4694 }
4696 }
4697 else
4698 {
4700 }
4701
4702 if ([self checkKeyPress:n_key_gui_screen_interfaces fKey_only:!fKeyAlias])
4703 {
4705 [gui setNoSelectedRow];
4706 [self setGuiToInterfacesScreen:0];
4707 [gui setSelectedRow:GUI_ROW_INTERFACES_START];
4708 }
4710 }
4711 else
4712 {
4714 }
4715
4716 }
4717}
static BOOL switching_interface_screens
static BOOL switching_chart_screens
static BOOL switching_equipship_screens
static BOOL switching_status_screens

◆ pollMarketScreenControls

- (void) pollMarketScreenControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

3141{
3142 MyOpenGLView *gameView = [UNIVERSE gameView];
3143 GuiDisplayGen *gui = [UNIVERSE gui];
3144
3145 if (gui_screen == GUI_SCREEN_MARKET)
3146 {
3147 [self handleGUIUpDownArrowKeys];
3148 DESTROY(marketSelectedCommodity);
3149 marketSelectedCommodity = [[gui selectedRowKey] retain];
3150
3151 BOOL page_up = [self checkKeyPress:n_key_gui_page_up];
3152 BOOL page_down = [self checkKeyPress:n_key_gui_page_down];
3153 if (page_up || page_down)
3154 {
3155 if ((!pageUpDownKeyPressed) || (script_time > timeLastKeyPress + KEY_REPEAT_INTERVAL))
3156 {
3157 OOCommodityMarket *localMarket = [self localMarket];
3158 NSArray *goods = [self applyMarketSorter:[self applyMarketFilter:[localMarket goods] onMarket:localMarket] onMarket:localMarket];
3159 if ([goods count] > 0)
3160 {
3161 NSInteger goodsIndex = [goods indexOfObject:marketSelectedCommodity];
3162 NSInteger offset1 = 0;
3163 NSInteger offset2 = 0;
3164 if ([[gui keyForRow:GUI_ROW_MARKET_START] isEqualToString:@"<<<"] == true) offset1 += 1;
3165 if ([[gui keyForRow:GUI_ROW_MARKET_LAST] isEqualToString:@">>>"] == true) offset2 += 1;
3166 if (page_up)
3167 {
3168 [self playMenuPagePrevious];
3169 // some edge cases
3170 if (goodsIndex - 16 <= 0)
3171 {
3172 offset1 = 0;
3173 offset2 = 0;
3174 }
3175 if (offset1 == 1 && offset2 == 0 && goodsIndex < (NSInteger)[goods count] - 1 && goodsIndex - 15 > 0) offset2 = 1;
3176 goodsIndex -= (16 - (offset1 + offset2));
3177 if (goodsIndex < 0) goodsIndex = 0;
3178 if ([goods count] <= 17) goodsIndex = 0;
3179 }
3180 if (page_down)
3181 {
3182 [self playMenuPageNext];
3183 // some edge cases
3184 if (offset1 == 0 && offset2 == 1 && goodsIndex > 1) offset1 = 1;
3185 if (offset2 == 1 && goodsIndex + 15 == (NSInteger)[goods count] - 1) offset2 = 0;
3186 goodsIndex += (16 - (offset1 + offset2));
3187 if (goodsIndex > ((NSInteger)[goods count] - 1) || [goods count] <= 17) goodsIndex = (NSInteger)[goods count] - 1;
3188 }
3189 DESTROY(marketSelectedCommodity);
3190 marketSelectedCommodity = [[goods oo_stringAtIndex:goodsIndex] retain];
3191 [self setGuiToMarketScreen];
3192 }
3193 }
3195 timeLastKeyPress = script_time;
3196 }
3197 else {
3199 }
3200 }
3201 else
3202 {
3203 // handle up and down slightly differently
3204 BOOL arrow_up = [self checkKeyPress:n_key_gui_arrow_up];
3205 BOOL arrow_down = [self checkKeyPress:n_key_gui_arrow_down];
3206 if (arrow_up || arrow_down)
3207 {
3208 if ((!upDownKeyPressed) || (script_time > timeLastKeyPress + KEY_REPEAT_INTERVAL))
3209 {
3210 OOCommodityMarket *localMarket = [self localMarket];
3211 NSArray *goods = [self applyMarketSorter:[self applyMarketFilter:[localMarket goods] onMarket:localMarket] onMarket:localMarket];
3212 if ([goods count] > 0)
3213 {
3214 NSInteger goodsIndex = [goods indexOfObject:marketSelectedCommodity];
3215 if (arrow_down)
3216 {
3217 ++goodsIndex;
3218 }
3219 else
3220 {
3221 --goodsIndex;
3222 }
3223 if (goodsIndex < 0)
3224 {
3225 goodsIndex = [goods count]-1;
3226 }
3227 else if (goodsIndex >= (NSInteger)[goods count])
3228 {
3229 goodsIndex = 0;
3230 }
3231 DESTROY(marketSelectedCommodity);
3232 marketSelectedCommodity = [[goods oo_stringAtIndex:goodsIndex] retain];
3233 [self setGuiToMarketInfoScreen];
3234 }
3235 }
3236 upDownKeyPressed = YES;
3237 timeLastKeyPress = script_time;
3238 }
3239 else
3240 {
3241 upDownKeyPressed = NO;
3242 }
3243 }
3244
3245 BOOL isdocked = [self isDocked];
3246
3247 if (([self checkNavKeyPress:n_key_gui_arrow_right])||([self checkNavKeyPress:n_key_gui_arrow_left])||([self checkKeyPress:n_key_gui_select]||[gameView isDown:gvMouseDoubleClick]))
3248 {
3249 if ([self checkNavKeyPress:n_key_gui_arrow_right]) // -->
3250 {
3251 if (!wait_for_key_up)
3252 {
3253 if (isdocked && [self tryBuyingCommodity:marketSelectedCommodity all:[gameView isShiftDown]])
3254 {
3255 [self playBuyCommodity];
3256 if (gui_screen == GUI_SCREEN_MARKET)
3257 {
3258 [self setGuiToMarketScreen];
3259 }
3260 else
3261 {
3262 [self setGuiToMarketInfoScreen];
3263 }
3264 }
3265 else
3266 {
3267 if ([[gui selectedRowKey] isEqualToString:@">>>"])
3268 {
3269 [self playMenuNavigationDown];
3270 [self setGuiToMarketScreen];
3271 }
3272 else if ([[gui selectedRowKey] isEqualToString:@"<<<"])
3273 {
3274 [self playMenuNavigationUp];
3275 [self setGuiToMarketScreen];
3276 }
3277 else
3278 {
3279 [self playCantBuyCommodity];
3280 }
3281 }
3282 wait_for_key_up = YES;
3283 }
3284 }
3285 if ([self checkNavKeyPress:n_key_gui_arrow_left]) // <--
3286 {
3287 if (!wait_for_key_up)
3288 {
3289 if (isdocked && [self trySellingCommodity:marketSelectedCommodity all:[gameView isShiftDown]])
3290 {
3291 [self playSellCommodity];
3292 if (gui_screen == GUI_SCREEN_MARKET)
3293 {
3294 [self setGuiToMarketScreen];
3295 }
3296 else
3297 {
3298 [self setGuiToMarketInfoScreen];
3299 }
3300 }
3301 else
3302 {
3303 if ([[gui selectedRowKey] isEqualToString:@">>>"])
3304 {
3305 [self playMenuNavigationDown];
3306 [self setGuiToMarketScreen];
3307 }
3308 else if ([[gui selectedRowKey] isEqualToString:@"<<<"])
3309 {
3310 [self playMenuNavigationUp];
3311 [self setGuiToMarketScreen];
3312 }
3313 else
3314 {
3315 [self playCantSellCommodity];
3316 }
3317
3318 }
3319 wait_for_key_up = YES;
3320 }
3321 }
3322 if ((gui_screen == GUI_SCREEN_MARKET && [gameView isDown:gvMouseDoubleClick]) || [self checkKeyPress:n_key_gui_select]) // 'enter'
3323 {
3324 if ([gameView isDown:gvMouseDoubleClick])
3325 {
3326 wait_for_key_up = NO;
3327 [gameView clearMouse];
3328 }
3329 if (!wait_for_key_up)
3330 {
3331 OOCommodityType item = marketSelectedCommodity;
3332 OOCargoQuantity yours = [shipCommodityData quantityForGood:item];
3333 if ([item isEqualToString:@">>>"])
3334 {
3335 [self tryBuyingCommodity:item all:YES];
3336 [self setGuiToMarketScreen];
3337 }
3338 else if ([item isEqualToString:@"<<<"])
3339 {
3340 [self trySellingCommodity:item all:YES];
3341 [self setGuiToMarketScreen];
3342 }
3343 else if (isdocked && [gameView isShiftDown] && [self tryBuyingCommodity:item all:YES]) // buy as much as possible (with Shift)
3344 {
3345 [self playBuyCommodity];
3346 if (gui_screen == GUI_SCREEN_MARKET)
3347 {
3348 [self setGuiToMarketScreen];
3349 }
3350 else
3351 {
3352 [self setGuiToMarketInfoScreen];
3353 }
3354 }
3355 else if (isdocked && (yours > 0) && [self trySellingCommodity:item all:YES]) // sell all you can
3356 {
3357 [self playSellCommodity];
3358 if (gui_screen == GUI_SCREEN_MARKET)
3359 {
3360 [self setGuiToMarketScreen];
3361 }
3362 else
3363 {
3364 [self setGuiToMarketInfoScreen];
3365 }
3366 }
3367 else if (isdocked && [self tryBuyingCommodity:item all:YES]) // buy as much as possible
3368 {
3369 [self playBuyCommodity];
3370 if (gui_screen == GUI_SCREEN_MARKET)
3371 {
3372 [self setGuiToMarketScreen];
3373 }
3374 else
3375 {
3376 [self setGuiToMarketInfoScreen];
3377 }
3378 }
3379 else if (isdocked)
3380 {
3381 [self playCantBuyCommodity];
3382 }
3383 wait_for_key_up = YES;
3384 }
3385 }
3386 }
3387 else
3388 {
3389 wait_for_key_up = NO;
3390 }
3391
3392
3393
3394
3395}
static BOOL wait_for_key_up
@ GUI_ROW_MARKET_START
@ GUI_ROW_MARKET_LAST

◆ pollMissionInterruptControls

- (void) pollMissionInterruptControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

5320{
5321 if (_missionAllowInterrupt)
5322 {
5323 if (gui_screen == GUI_SCREEN_MISSION && _missionTextEntry)
5324 {
5325 [self pollGuiScreenControlsWithFKeyAlias:NO];
5326 }
5327 else {
5328 [self pollGuiScreenControls];
5329 }
5330 if (gui_screen != GUI_SCREEN_MISSION)
5331 {
5332 if (gui_screen != GUI_SCREEN_SYSTEM_DATA)
5333 {
5334 [UNIVERSE removeDemoShips];
5335 }
5336 [self endMissionScreenAndNoteOpportunity];
5337 }
5338 }
5339}

◆ pollViewControls

- (void) pollViewControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 164 of file PlayerEntityControls.m.

4159{
4160 if(!pollControls)
4161 return;
4162
4163 MyOpenGLView *gameView = [UNIVERSE gameView];
4165
4166 NSPoint virtualView = NSZeroPoint;
4167 double view_threshold = 0.5;
4168
4169 if ([stickHandler joystickCount])
4170 {
4171 virtualView = [stickHandler viewAxis];
4172 if (virtualView.y == STICK_AXISUNASSIGNED)
4173 virtualView.y = 0.0;
4174 if (virtualView.x == STICK_AXISUNASSIGNED)
4175 virtualView.x = 0.0;
4176 if (fabs(virtualView.y) >= fabs(virtualView.x))
4177 virtualView.x = 0.0; // forward/aft takes precedence
4178 else
4179 virtualView.y = 0.0;
4180 }
4181
4182 const BOOL *joyButtonState = [stickHandler getAllButtonStates];
4183
4184 // view keys
4185 if (([self checkKeyPress:n_key_view_forward]) || (virtualView.y < -view_threshold)||joyButtonState[BUTTON_VIEWFORWARD] || ((([self checkKeyPress:n_key_hyperspace] && gui_screen != GUI_SCREEN_LONG_RANGE_CHART) || joyButtonState[BUTTON_HYPERDRIVE]) && [UNIVERSE displayGUI]))
4186 {
4187 [self switchToThisView:VIEW_FORWARD];
4188 }
4189 if (([self checkKeyPress:n_key_view_aft])||(virtualView.y > view_threshold)||joyButtonState[BUTTON_VIEWAFT])
4190 {
4191 [self switchToThisView:VIEW_AFT];
4192 }
4193 if (([self checkKeyPress:n_key_view_port])||(virtualView.x < -view_threshold)||joyButtonState[BUTTON_VIEWPORT])
4194 {
4195 [self switchToThisView:VIEW_PORT];
4196 }
4197 if (([self checkKeyPress:n_key_view_starboard])||(virtualView.x > view_threshold)||joyButtonState[BUTTON_VIEWSTARBOARD])
4198 {
4199 [self switchToThisView:VIEW_STARBOARD];
4200 }
4201
4202 [self pollCustomViewControls];
4203
4204 // Zoom scanner 'z'
4205 if (([self checkKeyPress:n_key_scanner_zoom] && ([gameView allowingStringInput] == gvStringInputNo)) || joyButtonState[BUTTON_SCANNERZOOM]) // look for the 'z' key
4206 {
4207 if (!scanner_zoom_rate)
4208 {
4209 if ([hud scannerZoom] < 5.0)
4210 {
4211 if (([hud scannerZoom] > 1.0)||(!zoom_pressed))
4212 scanner_zoom_rate = SCANNER_ZOOM_RATE_UP;
4213 }
4214 else
4215 {
4216 if (!zoom_pressed) // must release and re-press zoom to zoom back down..
4217 scanner_zoom_rate = SCANNER_ZOOM_RATE_DOWN;
4218 }
4219 }
4220 zoom_pressed = YES;
4221 }
4222 else
4223 zoom_pressed = NO;
4224
4225 // Unzoom scanner 'Z'
4226 if (([self checkKeyPress:n_key_scanner_unzoom] && ([gameView allowingStringInput] == gvStringInputNo)) || joyButtonState[BUTTON_SCANNERUNZOOM]) // look for the 'Z' key
4227 {
4228 if ((!scanner_zoom_rate)&&([hud scannerZoom] > 1.0))
4229 scanner_zoom_rate = SCANNER_ZOOM_RATE_DOWN;
4230 }
4231
4232 if (EXPECT([[self hud] isCompassActive])) // only switch compass modes if there is a compass
4233 {
4234 // Compass mode '|'
4235 if ([self checkKeyPress:n_key_prev_compass_mode] || joyButtonState[BUTTON_COMPASSMODE_PREV]) // look for the '|' key
4236 {
4237 if ((!prev_compass_mode_pressed)&&(compassMode != COMPASS_MODE_BASIC))
4238 [self setPrevCompassMode];
4240 }
4241 else
4242 {
4244 }
4245 // Compass mode '\'
4246 if ([self checkKeyPress:n_key_next_compass_mode] || joyButtonState[BUTTON_COMPASSMODE]) // look for the '\' key
4247 {
4248 if ((!next_compass_mode_pressed)&&(compassMode != COMPASS_MODE_BASIC))
4249 [self setNextCompassMode];
4251 }
4252 else
4253 {
4255 }
4256 }
4257
4258 // ';' // Cycle active MFD
4259 if ([self checkKeyPress:n_key_cycle_next_mfd] || [self checkKeyPress:n_key_cycle_previous_mfd] || joyButtonState[BUTTON_MFDCYCLENEXT] || joyButtonState[BUTTON_MFDCYCLEPREV])
4260 {
4261 if (!cycleMFD_pressed)
4262 {
4263 //if (![gameView isCtrlDown])
4264 if (![self checkKeyPress:n_key_cycle_previous_mfd] || joyButtonState[BUTTON_MFDCYCLEPREV])
4265 {
4266 [self cycleNextMultiFunctionDisplay:activeMFD];
4267 }
4268 else
4269 {
4270 [self cyclePreviousMultiFunctionDisplay:activeMFD];
4271 }
4272 }
4273 cycleMFD_pressed = YES;
4274 }
4275 else
4276 {
4277 cycleMFD_pressed = NO;
4278 }
4279
4280 // ':' // Select next MFD
4281 if ([self checkKeyPress:n_key_switch_next_mfd] || [self checkKeyPress:n_key_switch_previous_mfd] || joyButtonState[BUTTON_MFDSELECTNEXT] || joyButtonState[BUTTON_MFDSELECTPREV])
4282 {
4283 if ([[self hud] mfdCount] > 1)
4284 {
4285 if (!switchMFD_pressed)
4286 {
4287 //if (![gameView isCtrlDown])
4288 if (![self checkKeyPress:n_key_switch_previous_mfd] || joyButtonState[BUTTON_MFDSELECTPREV])
4289 {
4290 [self selectNextMultiFunctionDisplay];
4291 }
4292 else
4293 {
4294 [self selectPreviousMultiFunctionDisplay];
4295 }
4296 }
4297 }
4298 switchMFD_pressed = YES;
4299 }
4300 else
4301 {
4302 switchMFD_pressed = NO;
4303 }
4304
4305
4306 // show comms log '`'
4307 if ([self checkKeyPress:n_key_comms_log])
4308 {
4309 [UNIVERSE showCommsLog: 1.5];
4310 [hud refreshLastTransmitter];
4311 }
4312}
@ gvStringInputNo
@ BUTTON_MFDSELECTNEXT
@ BUTTON_COMPASSMODE
@ BUTTON_MFDCYCLENEXT
@ BUTTON_MFDCYCLEPREV
@ BUTTON_SCANNERUNZOOM
@ BUTTON_SCANNERZOOM
@ BUTTON_COMPASSMODE_PREV
@ BUTTON_MFDSELECTPREV
static BOOL cycleMFD_pressed
static BOOL zoom_pressed
static BOOL switchMFD_pressed
static BOOL next_compass_mode_pressed
static BOOL prev_compass_mode_pressed
#define SCANNER_ZOOM_RATE_DOWN
#define SCANNER_ZOOM_RATE_UP

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ prepareMarkedDestination:markers:

- (void) prepareMarkedDestination: (NSMutableDictionary *) 
markers: (NSDictionary *)  marker 
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

8729{
8730 NSNumber *key = [NSNumber numberWithInt:[marker oo_intForKey:@"system"]];
8731 NSMutableArray *list = [markers objectForKey:key];
8732 if (list == nil)
8733 {
8734 list = [NSMutableArray arrayWithObject:marker];
8735 }
8736 else
8737 {
8738 [list addObject:marker];
8739 }
8740 [markers setObject:list forKey:key];
8741}

◆ previousInfoSystem

- (void) previousInfoSystem

Definition at line 13727 of file PlayerEntity.m.

828{
830 {
831 [self setInfoSystemID: system_id moveChart: YES];
832 return;
833 }
834 NSArray *route = [[[UNIVERSE routeFromSystem:system_id toSystem:target_system_id optimizedBy:ANA_mode] oo_arrayForKey: @"route"] retain];
836 if (route == nil)
837 {
838 [self setInfoSystemID: system_id moveChart: YES];
839 return;
840 }
841 for (i = 0; i < [route count]; i++)
842 {
844 {
845 if (i > 0)
846 {
847 [self setInfoSystemID: [[route objectAtIndex: i - 1] unsignedIntValue] moveChart: YES];
848 [route release];
849 return;
850 }
851 break;
852 }
853 }
854 [route release];
855 [self setInfoSystemID: system_id moveChart: YES];
856 return;
857}

◆ previousSystemID

- (OOSystemID) previousSystemID

Definition at line 13727 of file PlayerEntity.m.

700{
701 return previous_system_id;
702}
OOSystemID previous_system_id

◆ priceForShipKey:

- (OOCreditsQuantity) priceForShipKey: (NSString *)  key

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1446 :(NSString *)key
1447{
1448 NSDictionary *shipInfo = [currentShipyard oo_dictionaryForKey:key];
1449 return [shipInfo oo_unsignedLongLongForKey:SHIPYARD_KEY_PRICE];
1450}

◆ primedEquipmentCount

- (NSUInteger) primedEquipmentCount

Definition at line 13727 of file PlayerEntity.m.

8207{
8208 return [eqScripts count];
8209}

◆ primedEquipmentName:

- (NSString *) primedEquipmentName: (NSInteger offset

Definition at line 13727 of file PlayerEntity.m.

8213{
8214 NSUInteger c = [self primedEquipmentCount];
8215 NSUInteger idx = (primedEquipment+(c+1)+offset)%(c+1);
8216 if (idx == c)
8217 {
8218 return DESC(@"equipment-primed-none-hud-label");
8219 }
8220 else
8221 {
8222 return [[OOEquipmentType equipmentTypeWithIdentifier:[[eqScripts oo_arrayAtIndex:idx] oo_stringAtIndex:0]] name];
8223 }
8224}

◆ printIdentLockedOnForMissile:

- (void) printIdentLockedOnForMissile: (BOOL missile

Definition at line 9242 of file PlayerEntity.m.

12412 :(BOOL)missile
12413{
12414 if ([self primaryTarget] == nil) return;
12415
12416 NSString *fmt = missile ? @"missile-locked-onto-target" : @"ident-locked-onto-target";
12417 NSString *target = [[self primaryTarget] identFromShip:self];
12418 [UNIVERSE addMessage:OOExpandKey(fmt, target) forCount:4.5];
12419}

◆ processEscapePods

- (NSString *) processEscapePods

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

64{
65 unsigned i;
66 BOOL added_entry = NO; // to prevent empty lines for slaves and the rare empty report.
67 NSMutableString *result = [NSMutableString string];
68 NSMutableArray *rescuees = [NSMutableArray array];
69 OOGovernmentID government = [[[UNIVERSE currentSystemData] objectForKey:KEY_GOVERNMENT] intValue];
70 if ([UNIVERSE inInterstellarSpace]) government = 1; // equivalent to Feudal. I'm assuming any station in interstellar space is military. -- Ahruman 2008-05-29
71
72 // step through the cargo removing crew from any escape pods
73 // No enumerator because we're mutating the array -- Ahruman
74 for (i = 0; i < [cargo count]; i++)
75 {
76 ShipEntity *cargoItem = [cargo objectAtIndex:i];
77 NSArray *podCrew = [cargoItem crew];
78
79 if (podCrew != nil)
80 {
81 // Has crew -> is escape pod.
82 [rescuees addObjectsFromArray:podCrew];
83 [cargoItem setCrew:nil];
84 [cargo removeObjectAtIndex:i];
85 i--;
86 }
87 }
88
89 // step through the rescuees awarding insurance or bounty or adding to slaves
90 for (i = 0; i < [rescuees count]; i++)
91 {
92 OOCharacter *rescuee = [rescuees objectAtIndex:i];
93
94 if ([rescuee script])
95 {
96 [rescuee doScriptEvent:OOJSID("unloadCharacter")];
97 }
98 else if ([rescuee legacyScript])
99 {
100 [self runUnsanitizedScriptActions:[rescuee legacyScript]
101 allowingAIMethods:YES
102 withContextName:[NSString stringWithFormat:@"<character \"%@\" script>", [rescuee name]]
103 forTarget:nil];
104 }
105 else if ([rescuee insuranceCredits] && [rescuee legalStatus])
106 {
107 float reward = (5.0 + government) * [rescuee legalStatus];
108 float insurance = 10 * [rescuee insuranceCredits];
109 if (government > (Ranrot() & 7) || reward >= insurance)
110 {
111 // claim bounty for capture, ignore insurance
112 [result appendFormat:DESC(@"capture-reward-for-@@-@-credits-@-alt"),
113 [rescuee name], [rescuee shortDescription], OOStringFromDeciCredits(reward, YES, NO),
114 OOStringFromDeciCredits(insurance, YES, NO)];
115 [self doScriptEvent:OOJSID("playerRescuedEscapePod") withArguments:[NSArray arrayWithObjects:[NSNumber numberWithUnsignedInteger:reward],@"bounty",[rescuee infoForScripting],nil]];
116 }
117 else
118 {
119 // claim insurance reward with reduction of bounty
120 [result appendFormat:DESC(@"rescue-reward-for-@@-@-credits-@-alt"),
121 [rescuee name], [rescuee shortDescription], OOStringFromDeciCredits(insurance - reward, YES, NO),
122 OOStringFromDeciCredits(reward, YES, NO)];
123 reward = insurance - reward;
124 [self doScriptEvent:OOJSID("playerRescuedEscapePod") withArguments:[NSArray arrayWithObjects:[NSNumber numberWithUnsignedInteger:reward],@"insurance",[rescuee infoForScripting],nil]];
125 }
126 credits += reward;
127 added_entry = YES;
128 }
129 else if ([rescuee insuranceCredits])
130 {
131 // claim insurance reward
132 [result appendFormat:DESC(@"rescue-reward-for-@@-@-credits"),
133 [rescuee name], [rescuee shortDescription], OOStringFromDeciCredits([rescuee insuranceCredits] * 10, YES, NO)];
134 credits += 10 * [rescuee insuranceCredits];
135 [self doScriptEvent:OOJSID("playerRescuedEscapePod") withArguments:[NSArray arrayWithObjects:[NSNumber numberWithUnsignedInteger:(10 * [rescuee insuranceCredits])],@"insurance",[rescuee infoForScripting],nil]];
136
137 added_entry = YES;
138 }
139 else if ([rescuee legalStatus])
140 {
141 // claim bounty for capture
142 float reward = (5.0 + government) * [rescuee legalStatus];
143 [result appendFormat:DESC(@"capture-reward-for-@@-@-credits"),
144 [rescuee name], [rescuee shortDescription], OOStringFromDeciCredits(reward, YES, NO)];
145 credits += reward;
146 [self doScriptEvent:OOJSID("playerRescuedEscapePod") withArguments:[NSArray arrayWithObjects:[NSNumber numberWithUnsignedInteger:reward],@"bounty",[rescuee infoForScripting],nil]];
147 added_entry = YES;
148 }
149 else
150 {
151 // sell as slave - increase no. of slaves in manifest
152 [shipCommodityData addQuantity:1 forGood:@"slaves"];
153 [self doScriptEvent:OOJSID("playerRescuedEscapePod") withArguments:[NSArray arrayWithObjects:[NSNumber numberWithUnsignedInteger:0],@"slave",[rescuee infoForScripting],nil]];
154
155 }
156 if ((i < [rescuees count] - 1) && added_entry)
157 [result appendString:@"\n"];
158 added_entry = NO;
159 }
160
161 [self calculateCurrentCargo];
162
163 return result;
164}
OOCreditsQuantity insuranceCredits()
NSString * name()
void doScriptEvent:(jsid message)
NSDictionary * infoForScripting()
NSString * shortDescription()
NSArray * legacyScript()
void setCrew:(NSArray *crewArray)
NSArray * crew
Definition ShipEntity.h:399

◆ processKeyCode:

- (NSArray *) processKeyCode: (NSArray*)  key_def

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

521 :(NSArray*)key_def
522{
523 int i;
524 id key = nil, value = nil;
525 int iValue;
526 unsigned char keychar;
527 NSString *keystring = nil;
528 NSDictionary *def = nil;
529 NSMutableArray *newList = [[NSMutableArray alloc] init];
530
531 for (i = 0; i < [key_def count]; i++)
532 {
533 def = [key_def objectAtIndex:i];
534 if ([def count] == 0) continue; // skip this if the definition is empty
535 value = [def objectForKey:@"key"];
536 iValue = [value intValue];
537
538 // we're going to fully expand all the shift/mod1/mod2 properties for all the key setting with defaults
539 // to avoid the need to check for the presence of a property during game loops
540 NSMutableDictionary *defNew = [[NSMutableDictionary alloc] init];
541 if ([def objectForKey:@"shift"]) [defNew setObject:[def objectForKey:@"shift"] forKey:@"shift"]; else [defNew setObject:[NSNumber numberWithBool:NO] forKey:@"shift"];
542 if ([def objectForKey:@"mod1"]) [defNew setObject:[def objectForKey:@"mod1"] forKey:@"mod1"]; else [defNew setObject:[NSNumber numberWithBool:NO] forKey:@"mod1"];
543 if ([def objectForKey:@"mod2"]) [defNew setObject:[def objectForKey:@"mod2"] forKey:@"mod2"]; else [defNew setObject:[NSNumber numberWithBool:NO] forKey:@"mod2"];
544
545 // for '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' - we want to interpret those as strings - not numbers
546 // alphabetical characters and symbols will return an intValue of 0.
547
548 if ([value isKindOfClass:[NSString class]] && (iValue < 10))
549 {
550 keystring = value;
551
552 // check for a named lookup
553 if ([keystring length] != 0)
554 {
555 int checkVal;
556 checkVal = [[keyCodeLookups objectForKey:[keystring lowercaseString]] intValue];
557 if (checkVal > 0) {
558 iValue = checkVal;
559
560 [defNew setObject:[NSNumber numberWithUnsignedShort:iValue] forKey:@"key"];
561 [newList addObject:defNew];
562 [defNew release];
563 continue;
564 }
565 }
566
567 if ([keystring length] == 1 || (iValue == 0 && [keystring length] != 0))
568 {
569 keychar = [keystring characterAtIndex:0] & 0x00ff; // uses lower byte of unichar
570 }
571 else if (iValue <= 0xFF) keychar = iValue;
572 else {
573 OOLogWARN(@"testing", @"continue hit for key %@.", key);
574 [defNew setObject:[def objectForKey:@"key"] forKey:@"key"];
575 [newList addObject:defNew];
576 [defNew release];
577 continue;
578 }
579
580 [defNew setObject:[NSNumber numberWithUnsignedShort:keychar] forKey:@"key"];
581 [newList addObject:defNew];
582 [defNew release];
583 }
584 else
585 {
586 [defNew setObject:[def objectForKey:@"key"] forKey:@"key"];
587 [newList addObject:defNew];
588 [defNew release];
589 }
590 }
591
592 return newList;
593}

◆ processSceneDictionary:atOffset:

- (BOOL) processSceneDictionary: (NSDictionary *)  couplet
atOffset: (Vector off 

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2608 :(NSDictionary *) couplet atOffset:(Vector) off
2609{
2610 NSArray *conditions = [couplet objectForKey:@"conditions"];
2611 NSArray *actions = nil;
2612 if ([couplet objectForKey:@"do"])
2613 actions = [NSArray arrayWithObject: [couplet objectForKey:@"do"]];
2614 NSArray *else_actions = nil;
2615 if ([couplet objectForKey:@"else"])
2616 else_actions = [NSArray arrayWithObject: [couplet objectForKey:@"else"]];
2617 BOOL success = YES;
2618 if (conditions == nil)
2619 {
2620 OOLog(@"script.scene.couplet.badConditions", @"***** SCENE ERROR: %@ - conditions not %@, returning %@.", [couplet description], @" found",@"YES and performing 'do' actions");
2621 }
2622 else
2623 {
2624 if (![conditions isKindOfClass:[NSArray class]])
2625 {
2626 OOLog(@"script.scene.couplet.badConditions", @"***** SCENE ERROR: %@ - conditions not %@, returning %@.", [conditions description], @"an array",@"NO");
2627 return NO;
2628 }
2629 }
2630
2631 // check conditions..
2632 success = TestScriptConditions(OOSanitizeLegacyScriptConditions(conditions, @"<scene dictionary conditions>"));
2633
2634 // perform successful actions...
2635 if ((success) && (actions) && [actions count])
2636 [self addScene: actions atOffset: off];
2637
2638 // perform unsuccessful actions
2639 if ((!success) && (else_actions) && [else_actions count])
2640 [self addScene: else_actions atOffset: off];
2641
2642 return success;
2643}
NSArray * OOSanitizeLegacyScriptConditions(NSArray *conditions, NSString *context)

◆ processSceneString:atOffset:

- (BOOL) processSceneString: (NSString*)  item
atOffset: (Vector off 

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2646 :(NSString*) item atOffset:(Vector) off
2647{
2648 Vector model_p0;
2649 Quaternion model_q;
2650
2651 if (!item)
2652 return NO;
2653 NSArray * i_info = ScanTokensFromString(item);
2654 if (!i_info)
2655 return NO;
2656 NSString* i_key = [(NSString*)[i_info objectAtIndex:0] lowercaseString];
2657
2658 OOLog(kOOLogNoteProcessSceneString, @"..... processing %@ (%@)", i_info, i_key);
2659
2660 //
2661 // recursively add further scenes:
2662 //
2663 if ([i_key isEqualToString:@"scene"])
2664 {
2665 if ([i_info count] != 5) // must be scene_key_x_y_z
2666 return NO; // 0.... 1.. 2 3 4
2667 NSString* scene_key = (NSString*)[i_info objectAtIndex: 1];
2668 Vector scene_offset = {0};
2669 ScanVectorFromString([[i_info subarrayWithRange:NSMakeRange(2, 3)] componentsJoinedByString:@" "], &scene_offset);
2670 scene_offset.x += off.x; scene_offset.y += off.y; scene_offset.z += off.z;
2671 NSArray * scene_items = (NSArray *)[[UNIVERSE descriptions] objectForKey:scene_key];
2672 OOLog(kOOLogDebugProcessSceneStringAddScene, @"::::: adding scene: '%@'", scene_key);
2673 //
2674 if (scene_items)
2675 {
2676 [self addScene: scene_items atOffset: scene_offset];
2677 return YES;
2678 }
2679 else
2680 return NO;
2681 }
2682 //
2683 // Add ship models:
2684 //
2685 if ([i_key isEqualToString:@"ship"]||[i_key isEqualToString:@"model"]||[i_key isEqualToString:@"role"])
2686 {
2687 if ([i_info count] != 10) // must be item_name_x_y_z_W_X_Y_Z_align
2688 {
2689 return NO; // 0... 1... 2 3 4 5 6 7 8 9....
2690 }
2691
2692 ShipEntity* ship = nil;
2693
2694 if ([i_key isEqualToString:@"ship"]||[i_key isEqualToString:@"model"])
2695 {
2696 ship = [UNIVERSE newShipWithName:[i_info oo_stringAtIndex: 1]];
2697 }
2698 else if ([i_key isEqualToString:@"role"])
2699 {
2700 ship = [UNIVERSE newShipWithRole:[i_info oo_stringAtIndex: 1]];
2701 }
2702 if (!ship)
2703 return NO;
2704
2705 ScanVectorAndQuaternionFromString([[i_info subarrayWithRange:NSMakeRange(2, 7)] componentsJoinedByString:@" "], &model_p0, &model_q);
2706
2707 Vector model_offset = positionOffsetForShipInRotationToAlignment(ship, model_q, [i_info oo_stringAtIndex:9]);
2708 model_p0 = vector_add(model_p0, vector_subtract(off, model_offset));
2709
2710 OOLog(kOOLogDebugProcessSceneStringAddModel, @"::::: adding model to scene:'%@'", ship);
2711 [ship setOrientation: model_q];
2712 [ship setPosition: vectorToHPVector(model_p0)];
2713 [UNIVERSE setMainLightPosition:(Vector){ DEMO_LIGHT_POSITION }]; // set light origin
2714 [ship setScanClass: CLASS_NO_DRAW];
2715 [ship switchAITo: @"nullAI.plist"];
2716 [UNIVERSE addEntity: ship]; // STATUS_IN_FLIGHT, AI state GLOBAL
2717 [ship setStatus: STATUS_COCKPIT_DISPLAY];
2718 [ship setRoll: 0.0];
2719 [ship setPitch: 0.0];
2720 [ship setVelocity: kZeroVector];
2721 [ship setBehaviour: BEHAVIOUR_STOP_STILL];
2722
2723 [ship release];
2724 return YES;
2725 }
2726 //
2727 // Add player ship model:
2728 //
2729 if ([i_key isEqualToString:@"player"])
2730 {
2731 if ([i_info count] != 9) // must be player_x_y_z_W_X_Y_Z_align
2732 return NO; // 0..... 1 2 3 4 5 6 7 8....
2733
2734 ShipEntity* doppelganger = [UNIVERSE newShipWithName:[self shipDataKey]]; // retain count = 1
2735 if (!doppelganger)
2736 return NO;
2737
2738 ScanVectorAndQuaternionFromString([[i_info subarrayWithRange:NSMakeRange( 1, 7)] componentsJoinedByString:@" "], &model_p0, &model_q);
2739
2740 Vector model_offset = positionOffsetForShipInRotationToAlignment( doppelganger, model_q, (NSString*)[i_info objectAtIndex:8]);
2741 model_p0.x += off.x - model_offset.x;
2742 model_p0.y += off.y - model_offset.y;
2743 model_p0.z += off.z - model_offset.z;
2744
2745 OOLog(kOOLogDebugProcessSceneStringAddModel, @"::::: adding model to scene:'%@'", doppelganger);
2746 [doppelganger setOrientation: model_q];
2747 [doppelganger setPosition: vectorToHPVector(model_p0)];
2748 [UNIVERSE setMainLightPosition:(Vector){ DEMO_LIGHT_POSITION }]; // set light origin
2749 [doppelganger setScanClass: CLASS_NO_DRAW];
2750 [doppelganger switchAITo: @"nullAI.plist"];
2751 [UNIVERSE addEntity: doppelganger];
2752 [doppelganger setStatus: STATUS_COCKPIT_DISPLAY];
2753 [doppelganger setRoll: 0.0];
2754 [doppelganger setPitch: 0.0];
2755 [doppelganger setVelocity: kZeroVector];
2756 [doppelganger setBehaviour: BEHAVIOUR_STOP_STILL];
2757
2758 [doppelganger release];
2759 return YES;
2760 }
2761 //
2762 // Add planet model: selected via gui-scene-show-planet/-local-planet
2763 //
2764 if ([i_key isEqualToString:@"local-planet"] || [i_key isEqualToString:@"target-planet"])
2765 {
2766 if ([i_info count] != 4) // must be xxxxx-planet_x_y_z
2767 return NO; // 0........... 1 2 3
2768
2769 // sunlight position for F7 screen is chosen pseudo randomly from 4 different positions.
2770 if (info_system_id & 8)
2771 {
2772 _sysInfoLight = (info_system_id & 2) ? (Vector){ -10000.0, 4000.0, -10000.0 } : (Vector){ -12000.0, -5000.0, -10000.0 };
2773 }
2774 else
2775 {
2776 _sysInfoLight = (info_system_id & 2) ? (Vector){ 6000.0, -5000.0, -10000.0 } : (Vector){ 6000.0, 4000.0, -10000.0 };
2777 }
2778
2779 [UNIVERSE setMainLightPosition:_sysInfoLight]; // set light origin
2780
2781#if NEW_PLANETS
2782 OOPlanetEntity *originalPlanet = nil;
2783 if ([i_key isEqualToString:@"local-planet"] && [UNIVERSE sun])
2784 {
2785 originalPlanet = [UNIVERSE planet];
2786 }
2787 else
2788 {
2789 originalPlanet = [[[OOPlanetEntity alloc] initAsMainPlanetForSystem:info_system_id] autorelease];
2790 }
2791 OOPlanetEntity *doppelganger = [originalPlanet miniatureVersion];
2792 if (doppelganger == nil) return NO;
2793
2794#else
2795 OOPlanetEntity* doppelganger = nil;
2796 NSMutableDictionary *planetInfo = [NSMutableDictionary dictionaryWithDictionary:[UNIVERSE generateSystemData:target_system_seed]];
2797
2798 if ([i_key isEqualToString:@"local-planet"] && [UNIVERSE sun])
2799 {
2800 OOPlanetEntity *mainPlanet = [UNIVERSE planet];
2801 OOTexture *texture = [mainPlanet texture];
2802 if (texture != nil)
2803 {
2804 [planetInfo setObject:texture forKey:@"_oo_textureObject"];
2805 [planetInfo oo_setBool:[mainPlanet isExplicitlyTextured] forKey:@"_oo_isExplicitlyTextured"];
2806 [planetInfo oo_setBool:YES forKey:@"mainForLocalSystem"];
2807 //[planetInfo oo_setQuaternion:[mainPlanet orientation] forKey:@"orientation"]; // the orientation is overwritten later on, without regard for the real planet's orientation.
2808 }
2809 }
2810
2811 doppelganger = [[OOPlanetEntity alloc] initFromDictionary:planetInfo withAtmosphere:YES andSeed:target_system_seed];
2812 [doppelganger miniaturize];
2813 [doppelganger autorelease];
2814
2815 if (doppelganger == nil) return NO;
2816#endif
2817
2818 ScanVectorFromString([[i_info subarrayWithRange:NSMakeRange(1, 3)] componentsJoinedByString:@" "], &model_p0);
2819
2820 // miniature radii are roughly between 60 and 120. Place miniatures with a radius bigger than 60 a bit futher away.
2821 model_p0 = vector_multiply_scalar(model_p0, 1 - 0.5 * ((60 - [doppelganger radius]) / 60));
2822
2823 model_p0 = vector_add(model_p0, off);
2824
2825 // TODO: find better quaternion values.
2826#if NEW_PLANETS
2827 //Quaternion model_q = { 0.83, 0.365148, 0.182574, 0.0 }; // shows new planets' north pole.
2828 //Quaternion model_q = { 0.83, -0.365148, 0.182574, 0.0 }; // shows new planets' south pole.
2829 Quaternion model_q = { 0.83, 0.12, 0.44, 0.0 }; // new planets - default orientation.
2830#else
2831 //model_q = make_quaternion( M_SQRT1_2, 0.314, M_SQRT1_2, 0.0 );
2832 Quaternion model_q = { 0.833492, 0.333396, 0.440611, 0.0 };
2833#endif
2834 OOLog(kOOLogDebugProcessSceneStringAddMiniPlanet, @"::::: adding %@ to scene:'%@'", i_key, doppelganger);
2835 [doppelganger setOrientation: model_q];
2836 // HPVect: mission screen coordinates are small enough that we don't need high-precision for calculations
2837 [doppelganger setPosition: vectorToHPVector(model_p0)];
2838 /* MKW - add rotation based on current time
2839 * - necessary to duplicate the rotation already performed in PlanetEntity.m since we reset the orientation above. */
2840 int deltaT = floor(fmod([self clockTimeAdjusted], 86400));
2841 [doppelganger update: deltaT];
2842 [UNIVERSE addEntity:doppelganger];
2843
2844 return YES;
2845 }
2846
2847 return NO;
2848}
BOOL ScanVectorAndQuaternionFromString(NSString *xyzwxyzString, Vector *outVector, Quaternion *outQuaternion)
BOOL ScanVectorFromString(NSString *xyzString, Vector *outVector)
static NSString *const kOOLogDebugProcessSceneStringAddMiniPlanet
static NSString *const kOOLogDebugProcessSceneStringAddModel
static NSString *const kOOLogDebugProcessSceneStringAddScene
static NSString *const kOOLogNoteProcessSceneString
instancetype miniatureVersion()
void update:(OOTimeDelta delta_t)
void setPitch:(double amount)

◆ pseudoFixedD100_number

- (NSNumber *) pseudoFixedD100_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

987{
988 return [NSNumber numberWithInt:[self systemPseudoRandom100]];
989}

◆ pseudoFixedD256_number

- (NSNumber *) pseudoFixedD256_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1000{
1001 return [NSNumber numberWithInt:[self systemPseudoRandom256]];
1002}

◆ quicksavePlayer

- (void) quicksavePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

186{
187 MyOpenGLView *gameView = [UNIVERSE gameView];
188 NSString *path = nil;
189
190 path = save_path;
191 if (!path) path = [[gameView gameController] playerFileToLoad];
192 if (!path)
193 {
194 OOLog(@"quickSave.failed.noName", @"%@", @"ERROR no file name returned by [[gameView gameController] playerFileToLoad]");
195 [NSException raise:@"OoliteGameNotSavedException"
196 format:@"ERROR no file name returned by [[gameView gameController] playerFileToLoad]"];
197 }
198
199 ShipScriptEventNoCx(self, "playerWillSaveGame", OOJSSTR("QUICK_SAVE"));
200
201 [self writePlayerToPath:path];
202 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
203 [self setGuiToStatusScreen];
204}
NSString * playerFileToLoad
GameController * gameController

◆ random_factor

- (int) random_factor

Definition at line 13727 of file PlayerEntity.m.

501{
502 return market_rnd;
503}

◆ realAlertCondition

- (OOAlertCondition) realAlertCondition
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

5823{
5824 return [self alertCondition];
5825}

◆ receiveCommsMessage:from:

- (void) receiveCommsMessage: (NSString *)  message_text
from: (ShipEntity *)  other 
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11867{
11868 if ([self status] == STATUS_DEAD || [self status] == STATUS_DOCKED)
11869 {
11870 // only when in flight
11871 return;
11872 }
11873 [UNIVERSE addCommsMessage:[NSString stringWithFormat:@"%@:\n %@", [other displayName], message_text] forCount:4.5];
11874 [super receiveCommsMessage:message_text from:other];
11875}

◆ RecursiveRemapStatus

- (OOINLINE OOEntityStatus) RecursiveRemapStatus (OOEntityStatus status
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 260 of file PlayerEntityLegacyScriptEngine.m.

261{
262 // Some player stutuses should only be seen once per "event".
263 // This remaps them to something innocuous in case of recursion.
264 if (status == STATUS_DOCKING ||
265 status == STATUS_LAUNCHING ||
266 status == STATUS_ENTERING_WITCHSPACE ||
267 status == STATUS_EXITING_WITCHSPACE)
268 {
269 return STATUS_IN_FLIGHT;
270 }
271 else
272 {
273 return status;
274 }
275}

◆ refreshMissionScreenTextEntry

- (void) refreshMissionScreenTextEntry

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2490{
2491 MyOpenGLView *gameView = [UNIVERSE gameView];
2492 GuiDisplayGen *gui = [UNIVERSE gui];
2493 NSUInteger end_row = 21;
2494 if ([[self hud] allowBigGui])
2495 {
2496 end_row = 27;
2497 }
2498
2499 [gui setText:[NSString stringWithFormat:DESC(@"mission-screen-text-prompt-@"), [gameView typedString]] forRow:end_row align:GUI_ALIGN_LEFT];
2500 [gui setColor:[OOColor cyanColor] forRow:end_row];
2501
2502 [gui setShowTextCursor:YES];
2503 [gui setCurrentRow:end_row];
2504
2505}
void setShowTextCursor:(BOOL yesno)
void setCurrentRow:(OOGUIRow value)

◆ reloadPage

- (void) reloadPage
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1741{
1742 // Update the GUI (this will refresh the function list).
1743 unsigned skip;
1744 if (selFunctionIdx < MAX_ROWS_KC_FUNCTIONS - 1)
1745 {
1746 skip = 0;
1747 }
1748 else
1749 {
1750 skip = ((selFunctionIdx - 1) / (MAX_ROWS_KC_FUNCTIONS - 2)) * (MAX_ROWS_KC_FUNCTIONS - 2) + 1;
1751 }
1752
1753 [self setGuiToKeyMapperScreen:skip];
1754}

◆ removeAllCargo

- (void) removeAllCargo

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1387{
1388 [self removeAllCargo:NO];
1389}

Referenced by PlayerShipRemoveAllCargo().

+ Here is the caller graph for this function:

◆ removeAllCargo:

- (void) removeAllCargo: (BOOL forceRemoval

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1391 :(BOOL)forceRemoval
1392{
1393 // Misnamed method. It only removes cargo measured in TONS, g & Kg items are not removed. --Kaks 20091004
1394 OOCommodityType type;
1395
1396 if (scriptTarget != self) return;
1397
1398 if ([self status] != STATUS_DOCKED && !forceRemoval)
1399 {
1400 OOLogWARN(kOOLogRemoveAllCargoNotDocked, @"%@removeAllCargo only works when docked.", [NSString stringWithFormat:@" in %@, ", CurrentScriptDesc()]);
1401 return;
1402 }
1403
1404 OOLog(kOOLogNoteRemoveAllCargo, @"%@ removeAllCargo", forceRemoval ? @"Forcing" : @"Going to");
1405
1406 foreach (type, [shipCommodityData goods])
1407 {
1408 if ([shipCommodityData massUnitForGood:type] == UNITS_TONS)
1409 {
1410 [shipCommodityData setQuantity:0 forGood:type];
1411 }
1412 }
1413
1414
1415 if (forceRemoval && [self status] != STATUS_DOCKED)
1416 {
1417 NSInteger i;
1418 for (i = [cargo count] - 1; i >= 0; i--)
1419 {
1420 ShipEntity* canister = [cargo objectAtIndex:i];
1421 if (!canister) break;
1422 // Since we are forcing cargo removal, we don't really care about the unit of measurement. Any
1423 // commodity at more than 1000kg or 1000000gr will be inside cargopods, so remove those too.
1424 [cargo removeObjectAtIndex:i];
1425 }
1426 }
1427
1428 DESTROY(specialCargo);
1429
1430 [self calculateCurrentCargo];
1431}
static NSString *const kOOLogRemoveAllCargoNotDocked
static NSString *const kOOLogNoteRemoveAllCargo

◆ removeContract:destination:

- (BOOL) removeContract: (NSString*)  commodity
destination: (unsigned destination 

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

1055 :(OOCommodityType)type destination:(unsigned)dest // removes the first match found, returns NO if none found
1056{
1057 if ([contracts count] == 0 || dest > 255) return NO;
1058
1059 if (![[UNIVERSE commodities] goodDefined:type]) return NO;
1060
1061 unsigned i;
1062
1063 for (i = 0; i < [contracts count]; i++)
1064 {
1065 NSDictionary *contractInfo = [contracts oo_dictionaryAtIndex:i];
1066 unsigned cargoDest = [contractInfo oo_intForKey:CONTRACT_KEY_DESTINATION];
1067 OOCommodityType cargoType = [contractInfo oo_stringForKey:CARGO_KEY_TYPE];
1068
1069 if ([cargoType isEqualToString:type] && cargoDest == dest)
1070 {
1071 [contract_record removeObjectForKey:[contractInfo oo_stringForKey:CARGO_KEY_ID]];
1072 [contracts removeObjectAtIndex:i];
1073 return YES;
1074 }
1075 }
1076
1077 return NO;
1078}

Referenced by PlayerShipRemoveContract().

+ Here is the caller graph for this function:

◆ removeEqScriptForKey:

- (void) removeEqScriptForKey: (NSString *)  eq_key

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2885 :(NSString *)eq_key
2886{
2887 if (eq_key == nil) return;
2888
2889 NSString *key = nil;
2890 NSUInteger i, count = [eqScripts count];
2891
2892 for (i = 0; i < count; i++)
2893 {
2894 key = [[eqScripts oo_arrayAtIndex:i] oo_stringAtIndex:0];
2895 if ([key isEqualToString: eq_key])
2896 {
2897 [eqScripts removeObjectAtIndex:i];
2898
2899 if (i == primedEquipment) primedEquipment = count; // primed-none
2900 else if (i < primedEquipment) primedEquipment--; // track the primed equipment
2901 if (count == primedEquipment) primedEquipment--; // the array has shrunk by one!
2902
2903 OOLog(@"player.equipmentScript", @"Removed equipment %@, with the following script property: '%@'.", eq_key, [[OOEquipmentType equipmentTypeWithIdentifier:eq_key] scriptName]);
2904 }
2905 }
2906}

◆ removeEquipment:

- (void) removeEquipment: (NSString *)  equipString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1276 :(NSString *)equipKey //eg. EQ_NAVAL_ENERGY_UNIT
1277{
1278 if (scriptTarget != self) return;
1279
1280 if ([equipKey isEqualToString:@"EQ_FUEL"])
1281 {
1282 fuel = 0;
1283 return;
1284 }
1285
1286 if ([equipKey isEqualToString:@"EQ_CARGO_BAY"] && [self hasEquipmentItem:equipKey]
1287 && ([self extraCargo] > [self availableCargoSpace]))
1288 {
1289 OOLog(kOOLogSyntaxRemoveEquipment, @"***** SCRIPT ERROR: in %@, CANNOT remove cargo bay. Too much cargo.", CurrentScriptDesc());
1290 return;
1291 }
1292 if ([self hasEquipmentItem:equipKey] || [self hasEquipmentItem:[equipKey stringByAppendingString:@"_DAMAGED"]])
1293 {
1294 [self removeEquipmentItem:equipKey];
1295 }
1296
1297}
static NSString *const kOOLogSyntaxRemoveEquipment

◆ removeEquipmentItem:

- (void) removeEquipmentItem: (NSString *)  equipmentKey
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11656{
11657 if(![self hasEquipmentItemProviding:@"EQ_ADVANCED_COMPASS"] && [self compassMode] != COMPASS_MODE_BASIC)
11658 {
11659 [self setCompassMode:COMPASS_MODE_BASIC];
11660 }
11661 [super removeEquipmentItem:equipmentKey];
11662 if(![self hasEquipmentItem:equipmentKey]) {
11663 // removed the last one
11664 [self removeEqScriptForKey:equipmentKey];
11665 }
11666}

◆ removeExternalStore:

- (BOOL) removeExternalStore: (OOEquipmentType *)  eqType
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

11790{
11791 NSString *identifier = [eqType identifier];
11792
11793 // Look for matching missile.
11794 unsigned i;
11795 for (i = 0; i < max_missiles; i++)
11796 {
11797 if ([[self missileForPylon:i] hasPrimaryRole:identifier])
11798 {
11799 [self removeFromPylon:i];
11800
11801 // Just remove one at a time.
11802 return YES;
11803 }
11804 }
11805 return NO;
11806}

◆ removeFromPylon:

- (BOOL) removeFromPylon: (NSUInteger pylon

Definition at line 9242 of file PlayerEntity.m.

11810{
11811 if (pylon >= max_missiles) return NO;
11812
11813 if (missile_entity[pylon] != nil)
11814 {
11815 NSString *identifier = [missile_entity[pylon] primaryRole];
11816 [super removeExternalStore:[OOEquipmentType equipmentTypeWithIdentifier:identifier]];
11817
11818 // Remove the missile (must wait until we've finished with its identifier string!)
11819 [missile_entity[pylon] release];
11820 missile_entity[pylon] = nil;
11821
11822 [self tidyMissilePylons];
11823
11824 // This should be the currently selected missile, deselect it.
11825 if (pylon <= activeMissile)
11826 {
11828 if (activeMissile > 0) activeMissile--;
11829 else activeMissile = max_missiles - 1;
11830
11831 [self selectNextMissile];
11832 }
11833
11834 return YES;
11835 }
11836
11837 return NO;
11838}

◆ removeFunction:

- (void) removeFunction: (int idx
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

345 :(int)idx
346{
348 NSDictionary *entry = [stickFunctions objectAtIndex:idx];
349 NSNumber *butfunc = [entry objectForKey:KEY_BUTTONFN];
350 NSNumber *axfunc = [entry objectForKey:KEY_AXISFN];
351 BOOL custom = NO;
352 selFunctionIdx = idx;
353
354 // Some things can have either axis or buttons - make sure we clear
355 // both!
356 if(butfunc)
357 {
358 // special case for OXP equipment buttons
359 if ([butfunc intValue] >= 10000)
360 {
361 int bf = [butfunc intValue];
362 custom = YES;
363 NSString *key = CUSTOMEQUIP_BUTTONACTIVATE;
364 bf -= 10000;
365 if (bf >= 10000)
366 {
367 bf -= 10000;
369 }
370 NSMutableDictionary *custEquip = [[customEquipActivation objectAtIndex:bf] mutableCopy];
371 if ([key isEqualToString:CUSTOMEQUIP_BUTTONACTIVATE] && [custEquip objectForKey:CUSTOMEQUIP_BUTTONACTIVATE]) [custEquip removeObjectForKey:key];
372 if ([key isEqualToString:CUSTOMEQUIP_BUTTONMODE] && [custEquip objectForKey:CUSTOMEQUIP_BUTTONMODE]) [custEquip removeObjectForKey:key];
373 [customEquipActivation replaceObjectAtIndex:bf withObject:custEquip];
374 [custEquip release];
375 }
376 else
377 {
378 [stickHandler unsetButtonFunction:[butfunc intValue]];
379 }
380 }
381 if(axfunc)
382 {
383 [stickHandler unsetAxisFunction:[axfunc intValue]];
384 }
385 if (!custom)
386 {
387 [stickHandler saveStickSettings];
388 }
389 else
390 {
391 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
392 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
393 }
394
395 unsigned skip;
396 if (selFunctionIdx < MAX_ROWS_FUNCTIONS - 1)
397 skip = 0;
398 else
399 skip = ((selFunctionIdx - 1) / (MAX_ROWS_FUNCTIONS - 2)) * (MAX_ROWS_FUNCTIONS - 2) + 1;
400 [self setGuiToStickMapperScreen: skip];
401}
void unsetButtonFunction:(int function)
void unsetAxisFunction:(int function)

◆ removeMissiles

- (OOCreditsQuantity) removeMissiles
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

10673{
10674 [self safeAllMissiles];
10676 unsigned i;
10677 for (i = 0; i < missiles; i++)
10678 {
10679 NSString *weapon_key = [missile_list[i] identifier];
10680
10681 if (weapon_key != nil)
10683 }
10684
10685 for (i = 0; i < max_missiles; i++)
10686 {
10687 [missile_entity[i] release];
10688 missile_entity[i] = nil;
10689 }
10690
10691 missiles = 0;
10692 return tradeIn;
10693}

Referenced by ShipAwardEquipment().

+ Here is the caller graph for this function:

◆ removeMissionDestination:

- (void) removeMissionDestination: (NSString *)  destinations

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2132 :(NSString *)destinations
2133{
2134 unsigned j;
2135 int dest;
2136 NSMutableArray *tokens = ScanTokensFromString(destinations);
2137
2138 for (j = 0; j < [tokens count]; j++)
2139 {
2140 dest = [[tokens objectAtIndex:j] intValue];
2141 if (dest < 0 || dest > 255) continue;
2142
2143 [self removeMissionDestinationMarker:[self defaultMarker:dest]];
2144 }
2145}

◆ removeMissionDestinationMarker:

- (BOOL) removeMissionDestinationMarker: (NSDictionary *)  marker

Definition at line 9242 of file PlayerEntity.m.

13332{
13333 NSDictionary *validated = [self validatedMarker:marker];
13334 if (validated == nil)
13335 {
13336 return NO;
13337 }
13338 BOOL result = NO;
13340 result = YES;
13341 }
13342 [missionDestinations removeObjectForKey:[self markerKey:validated]];
13343 return result;
13344}

◆ removeParcel:

- (BOOL) removeParcel: (NSString*)  Name

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

966 :(NSString*)Name // removes the first parcel that answers to Name, returns NO if none found
967{
968 // extra check, just in case.
969 if ([parcels count] == 0) return NO;
970
971 unsigned i;
972
973 for (i = 0; i < [parcels count]; i++)
974 {
975 NSString *this_name = [[parcels oo_dictionaryAtIndex:i] oo_stringForKey:PASSENGER_KEY_NAME];
976
977 if ([Name isEqualToString:this_name])
978 {
979 [parcels removeObjectAtIndex:i];
980 [parcel_record removeObjectForKey:Name];
981 return YES;
982 }
983 }
984
985 return NO;
986}

Referenced by PlayerShipRemoveParcel().

+ Here is the caller graph for this function:

◆ removePassenger:

- (BOOL) removePassenger: (NSString*)  Name

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

910 :(NSString*)Name // removes the first passenger that answers to Name, returns NO if none found
911{
912 // extra check, just in case.
913 if ([passengers count] == 0) return NO;
914
915 unsigned i;
916
917 for (i = 0; i < [passengers count]; i++)
918 {
919 NSString *this_name = [[passengers oo_dictionaryAtIndex:i] oo_stringForKey:PASSENGER_KEY_NAME];
920
921 if ([Name isEqualToString:this_name])
922 {
923 [passengers removeObjectAtIndex:i];
924 [passenger_record removeObjectForKey:Name];
925 return YES;
926 }
927 }
928
929 return NO;
930}

Referenced by PlayerShipRemovePassenger().

+ Here is the caller graph for this function:

◆ removeTrumble:

- (void) removeTrumble: (OOTrumble *)  deadTrumble

Definition at line 9242 of file PlayerEntity.m.

12036{
12037 if (trumbleCount <= 0)
12038 {
12039 return;
12040 }
12042 NSUInteger i;
12043
12044 for (i = 0; (trumble_index == NSNotFound)&&(i < trumbleCount); i++)
12045 {
12046 if (trumble[i] == deadTrumble)
12047 trumble_index = i;
12048 }
12050 {
12051 OOLog(@"trumble.zombie", @"DEBUG can't get rid of inactive trumble %@", deadTrumble);
12052 return;
12053 }
12054 trumbleCount--; // reduce number of trumbles
12055 trumble[trumble_index] = trumble[trumbleCount]; // swap with the current last trumble
12056 trumble[trumbleCount] = deadTrumble; // swap with the current last trumble
12057}

◆ renovationCosts

- (double) renovationCosts

Definition at line 9242 of file PlayerEntity.m.

11921{
11922 // 5% of value of ships wear + correction for missing subentities.
11923 OOCreditsQuantity shipValue = [UNIVERSE tradeInValueForCommanderDictionary:[self commanderDataDictionary]];
11924
11925 double costs = 0.005 * (100 - ship_trade_in_factor) * shipValue;
11927 costs *= [self renovationFactor];
11928 return cunningFee(costs, 0.05);
11929}
NSInteger missingSubEntitiesAdjustment()
double cunningFee(double value, double precision)

◆ renovationFactor

- (double) renovationFactor

Definition at line 9242 of file PlayerEntity.m.

11933{
11935 NSDictionary *shipyardInfo = [registry shipyardInfoForKey:[self shipDataKey]];
11936 return [shipyardInfo oo_doubleForKey:KEY_RENOVATION_MULTIPLIER defaultValue:1.0];
11937}

◆ replaceShipWithNamedShip:

- (BOOL) replaceShipWithNamedShip: (NSString *)  shipName

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1842 :(NSString *)shipKey
1843{
1844
1845 NSDictionary *ship_info = [[OOShipRegistry sharedRegistry] shipyardInfoForKey:shipKey];
1846
1847 NSDictionary *ship_base_dict = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipKey];
1848
1849 if (ship_info == nil || ship_base_dict == nil) {
1850 return NO;
1851 }
1852
1853 // from this point, the player is committed to replacing - raise a pre-replace script event
1854 [self doScriptEvent:OOJSID("playerWillReplaceShip") withArgument:shipKey];
1855
1856 [self newShipCommonSetup:shipKey yardInfo:ship_info baseInfo:ship_base_dict];
1857
1858 // perform the transformation
1859 NSDictionary* cmdr_dict = [self commanderDataDictionary]; // gather up all the info
1860 if (![self setCommanderDataFromDictionary:cmdr_dict]) return NO;
1861
1862 // refill from ship_info
1863 NSArray* extras = [NSMutableArray arrayWithArray:[[ship_info oo_dictionaryForKey:KEY_STANDARD_EQUIPMENT] oo_arrayForKey:KEY_EQUIPMENT_EXTRAS]];
1864 for (unsigned i = 0; i < [extras count]; i++)
1865 {
1866 NSString* eq_key = [extras oo_stringAtIndex:i];
1867 if ([eq_key isEqualToString:@"EQ_PASSENGER_BERTH"])
1868 {
1869 max_passengers++;
1870 max_cargo -= PASSENGER_BERTH_SPACE;
1871 }
1872 else
1873 {
1874 [self addEquipmentItem:eq_key withValidation:YES inContext:@"newShip"];
1875 }
1876 }
1877
1878 [self setEntityPersonalityInt:[ship_info oo_unsignedShortForKey:SHIPYARD_KEY_PERSONALITY]];
1879
1880 return YES;
1881}

Referenced by PlayerReplaceShip().

+ Here is the caller graph for this function:

◆ replaceVariablesInString:

- (NSString *) replaceVariablesInString: (NSString*)  args

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

781 :(NSString*) args
782{
783 NSMutableDictionary *locals = [self localVariablesForMission:sCurrentMissionKey];
784 NSMutableString *resultString = [NSMutableString stringWithString: args];
785 NSString *valueString;
786 unsigned i;
787 NSMutableArray *tokens = ScanTokensFromString(args);
788
789 for (i = 0; i < [tokens count]; i++)
790 {
791 valueString = [tokens objectAtIndex:i];
792
793 if ([valueString hasPrefix:@"mission_"] && [mission_variables objectForKey:valueString])
794 {
795 [resultString replaceOccurrencesOfString:valueString withString:[mission_variables objectForKey:valueString] options:NSLiteralSearch range:NSMakeRange(0, [resultString length])];
796 }
797 else if ([locals objectForKey:valueString])
798 {
799 [resultString replaceOccurrencesOfString:valueString withString:[locals objectForKey:valueString] options:NSLiteralSearch range:NSMakeRange(0, [resultString length])];
800 }
801 else if (([valueString hasSuffix:@"_number"])||([valueString hasSuffix:@"_bool"])||([valueString hasSuffix:@"_string"]))
802 {
803 SEL valueselector = NSSelectorFromString(valueString);
804 if ([self respondsToSelector:valueselector])
805 {
806 [resultString replaceOccurrencesOfString:valueString withString:[NSString stringWithFormat:@"%@", [self performSelector:valueselector]] options:NSLiteralSearch range:NSMakeRange(0, [resultString length])];
807 }
808 }
809 else if ([valueString hasPrefix:@"["]&&[valueString hasSuffix:@"]"])
810 {
811 NSString* replaceString = OOExpand(valueString);
812 [resultString replaceOccurrencesOfString:valueString withString:replaceString options:NSLiteralSearch range:NSMakeRange(0, [resultString length])];
813 }
814 }
815
816 OOLog(kOOLogDebugReplaceVariablesInString, @"EXPANSION: \"%@\" becomes \"%@\"", args, resultString);
817
818 return [NSString stringWithString: resultString];
819}
static NSString *const kOOLogDebugReplaceVariablesInString

◆ requestDockingClearance:

- (void) requestDockingClearance: (StationEntity *)  stationForDocking

Definition at line 13727 of file PlayerEntity.m.

3643{
3645 {
3646 [self performDockingRequest:stationForDocking];
3647 }
3648}

Referenced by PlayerShipRequestDockingClearance().

+ Here is the caller graph for this function:

◆ reset:

- (void) reset: (NSString *)  missionvariable

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1729 :(NSString *)missionvariable
1730{
1731 NSString* missionVariableString = [missionvariable stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
1732 BOOL hasMissionPrefix, hasLocalPrefix;
1733
1734 hasMissionPrefix = [missionVariableString hasPrefix:@"mission_"];
1735 hasLocalPrefix = [missionVariableString hasPrefix:@"local_"];
1736
1737 if (hasMissionPrefix)
1738 {
1739 [self setMissionVariable:nil forKey:missionVariableString];
1740 }
1741 else if (hasLocalPrefix)
1742 {
1743 [self setLocalVariable:nil forKey:missionVariableString andMission:sCurrentMissionKey];
1744 }
1745 else
1746 {
1747 OOLog(kOOLogSyntaxReset, @"***** SCRIPT ERROR: in %@, IDENTIFIER '%@' DOES NOT BEGIN WITH 'mission_' or 'local_'", CurrentScriptDesc(), missionVariableString);
1748 }
1749}
static NSString *const kOOLogSyntaxReset

◆ resetAutopilotAI

- (void) resetAutopilotAI

Definition at line 13727 of file PlayerEntity.m.

3727{
3728 AI *myAI = [self getAI];
3729 // JSAI: will need changing if oolite-dockingAI.js written
3731 {
3732 [self setAITo:PLAYER_DOCKING_AI_NAME ];
3733 }
3734 [myAI clearAllData];
3735 [myAI setState:@"GLOBAL"];
3736 [myAI setNextThinkTime:[UNIVERSE getTime] + 2];
3737 [myAI setOwner:self];
3738}
#define PLAYER_DOCKING_AI_NAME
Definition AI.h:38
void setNextThinkTime:(OOTimeAbsolute ntt)
Definition AI.m:658
void setOwner:(ShipEntity *ship)
Definition AI.m:197
void clearAllData()
Definition AI.m:691
void setState:(NSString *stateName)
Definition AI.m:334
NSString * name
Definition ShipEntity.h:327

◆ resetCustomView

- (void) resetCustomView

Definition at line 9242 of file PlayerEntity.m.

12620{
12621 [self setCustomViewDataFromDictionary:[_customViews oo_dictionaryAtIndex:_customViewIndex] withScaling:NO];
12622}

Referenced by PlayerShipResetCustomView().

+ Here is the caller graph for this function:

◆ resetHud

- (void) resetHud

Definition at line 13727 of file PlayerEntity.m.

4536{
4537 // set up defauld HUD for the ship
4539 NSString *hud_desc = [shipDict oo_stringForKey:@"hud" defaultValue:@"hud.plist"];
4540 if (![self switchHudTo:hud_desc]) [self switchHudTo:@"hud.plist"]; // ensure we have a HUD to fall back to
4541}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ resetKeyFunctions

- (void) resetKeyFunctions

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

116{
117 [keyFunctions release];
118 keyFunctions = nil;
119}

◆ resetMissionChoice

- (void) resetMissionChoice

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2099{
2100 [self setMissionChoice:nil];
2101}

◆ resetScannerZoom

- (void) resetScannerZoom

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

173{
174 scanner_zoom_rate = SCANNER_ZOOM_RATE_DOWN;
175}

Referenced by PlayerShipResetScannerZoom().

+ Here is the caller graph for this function:

◆ resetScriptTimer

- (void) resetScriptTimer

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1893{
1894 script_time = 0.0;
1895 script_time_check = SCRIPT_TIMER_INTERVAL;
1896 script_time_interval = SCRIPT_TIMER_INTERVAL;
1897}
#define SCRIPT_TIMER_INTERVAL

◆ resetStickFunctions

- (void) resetStickFunctions

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

50{
51 [stickFunctions release];
52 stickFunctions = nil;
53}

◆ roleWeights

- (NSMutableArray *) roleWeights

◆ rotateCargo

- (void) rotateCargo

Definition at line 13727 of file PlayerEntity.m.

6755{
6756 NSInteger i, n_cargo = [cargo count];
6757 if (n_cargo == 0) return;
6758
6759 ShipEntity *pod = (ShipEntity *)[[cargo objectAtIndex:0] retain];
6762 NSInteger rotates = 0;
6763
6764 do
6765 {
6766 [cargo removeObjectAtIndex:0]; // take it from the eject position
6767 [cargo addObject:pod]; // move it to the last position
6768 [pod release];
6769 pod = (ShipEntity*)[[cargo objectAtIndex:0] retain];
6770 contents = [pod commodityType];
6771 rotates++;
6773 [pod release];
6774
6775 NSString *commodity = [UNIVERSE displayNameForCommodity:contents];
6776 [UNIVERSE addMessage:OOExpandKey(@"ready-to-eject-commodity", commodity) forCount:3.0];
6777
6778 // now scan through the remaining 1..(n_cargo - rotates) places moving similar cargo to the last place
6779 // this means the cargo gets to be sorted as it is rotated through
6780 for (i = 1; i < (n_cargo - rotates); i++)
6781 {
6782 pod = [cargo objectAtIndex:i];
6784 {
6785 [pod retain];
6786 [cargo removeObjectAtIndex:i--];
6787 [cargo addObject:pod];
6788 [pod release];
6789 rotates++;
6790 }
6791 }
6792}

◆ runScriptActions:withContextName:forTarget:

- (void) runScriptActions: (NSArray *)  sanitizedActions
withContextName: (NSString *)  contextName
forTarget: (ShipEntity *)  target 

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

361 :(NSArray *)actions withContextName:(NSString *)contextName forTarget:(ShipEntity *)target
362{
363 NSAutoreleasePool *pool = nil;
364 NSString *oldMissionKey = nil;
365 NSString * volatile theMissionKey = contextName; // Work-around for silly exception macros
366
367 pool = [[NSAutoreleasePool alloc] init];
368
369 // FIXME: does this actually make sense in the context of non-missions?
370 oldMissionKey = sCurrentMissionKey;
371 sCurrentMissionKey = theMissionKey;
372
373 @try
374 {
375 PerformScriptActions(actions, target);
376 }
377 @catch (NSException *exception)
378 {
379 OOLog(@"script.error.exception",
380 @"***** EXCEPTION %@: %@ while handling legacy script actions for %@",
381 [exception name],
382 [exception reason],
383 [theMissionKey hasPrefix:kActionTempPrefix] ? [target shortDescription] : theMissionKey);
384 // Suppress exception
385 }
386
387 sCurrentMissionKey = oldMissionKey;
388 [pool release];
389}

◆ runUnsanitizedScriptActions:allowingAIMethods:withContextName:forTarget:

- (void) runUnsanitizedScriptActions: (NSArray *)  unsanitizedActions
allowingAIMethods: (BOOL allowAIMethods
withContextName: (NSString *)  contextName
forTarget: (ShipEntity *)  target 

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

392 :(NSArray *)actions allowingAIMethods:(BOOL)allowAIMethods withContextName:(NSString *)contextName forTarget:(ShipEntity *)target
393{
394 [self runScriptActions:OOSanitizeLegacyScript(actions, contextName, allowAIMethods)
395 withContextName:contextName
396 forTarget:target];
397}

Referenced by ShipRunLegacyScriptActions().

+ Here is the caller graph for this function:

◆ safeAllMissiles

- (void) safeAllMissiles

Definition at line 13727 of file PlayerEntity.m.

5698{
5699 // sets all missile targets to NO_TARGET
5700
5701 unsigned i;
5702 for (i = 0; i < max_missiles; i++)
5703 {
5706 }
5708}

Referenced by StationDockPlayer().

+ Here is the caller graph for this function:

◆ saveCommanderInputHandler

- (void) saveCommanderInputHandler

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

460{
461 MyOpenGLView *gameView = [UNIVERSE gameView];
462 GuiDisplayGen *gui = [UNIVERSE gui];
463 NSString *dir = [[UNIVERSE gameController] playerFileDirectory];
464
465 if ([self handleGUIUpDownArrowKeys])
466 {
467 int guiSelectedRow=[gui selectedRow];
468 int idx = (guiSelectedRow - STARTROW) + (currentPage * NUMROWS);
469 if (guiSelectedRow != MOREROW && guiSelectedRow != BACKROW)
470 {
471 [self showCommanderShip: idx];
472 if ([(NSDictionary *)[cdrDetailArray objectAtIndex:idx] oo_boolForKey:@"isSavedGame"]) // don't show things that aren't saved games
473 commanderNameString = [[cdrDetailArray oo_dictionaryAtIndex:idx] oo_stringForKey:@"player_save_name" defaultValue:[[cdrDetailArray oo_dictionaryAtIndex:idx] oo_stringForKey:@"player_name"]];
474 else
475 commanderNameString = [gameView typedString];
476 }
477 else
478 {
479 [UNIVERSE removeDemoShips];
480 [gui setText:@"" forRow:CDRDESCROW align:GUI_ALIGN_LEFT];
481 [gui setText:@"" forRow:CDRDESCROW + 1 align:GUI_ALIGN_LEFT];
482 [gui setText:@"" forRow:CDRDESCROW + 2 align:GUI_ALIGN_LEFT];
483 }
484 }
485 else
486 {
487 commanderNameString = [gameView typedString];
488 }
489
490 [gameView setTypedString: commanderNameString];
491
492 [gui setText:
493 [NSString stringWithFormat:DESC(@"savescreen-commander-name-@"), commanderNameString]
494 forRow: INPUTROW];
495 [gui setColor:[OOColor cyanColor] forRow:INPUTROW];
496
497 // handle page <-- and page --> keys, and on-screen buttons
498 if (((([gameView isDown:gvMouseDoubleClick] || [self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == BACKROW) || ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up]))
499 && [[gui keyForRow:BACKROW] isEqual: GUI_KEY_OK])
500 {
501 currentPage--;
502 [self lsCommanders: gui directory: dir pageNumber: currentPage highlightName: nil];
503 [gameView suppressKeysUntilKeyUp];
504 }
505 //
506 if (((([gameView isDown:gvMouseDoubleClick] || [self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == MOREROW) || ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down]))
507 && [[gui keyForRow:MOREROW] isEqual: GUI_KEY_OK])
508 {
509 currentPage++;
510 [self lsCommanders: gui directory: dir pageNumber: currentPage highlightName: nil];
511 [gameView suppressKeysUntilKeyUp];
512 }
513
514 // ignore Ctrl if pressed together with Enter for the moment - we check for it explicitly immediately after
515 if(([self checkKeyPress:n_key_gui_select ignore_ctrl:YES]||[gameView isDown:gvMouseDoubleClick]) && [commanderNameString length])
516 {
517 if ([gameView isCommandModifierKeyDown]||[gameView isDown:gvMouseDoubleClick])
518 {
519 int guiSelectedRow=[gui selectedRow];
520 int idx = (guiSelectedRow - STARTROW) + (currentPage * NUMROWS);
521 NSDictionary* cdr = [cdrDetailArray objectAtIndex:idx];
522
523 if (![cdr oo_boolForKey:@"isSavedGame"]) // don't open saved games
524 {
525 // change directory to the selected path
526 NSString* newDir = [cdr oo_stringForKey:@"saved_game_path"];
527 [[UNIVERSE gameController] setPlayerFileDirectory: newDir];
528 dir = newDir;
529 currentPage = 0;
530 [self lsCommanders: gui directory: dir pageNumber: currentPage highlightName: nil];
531 [gameView suppressKeysUntilKeyUp];
532 }
533 }
534 else
535 {
536 pollControls = YES;
537 if ([self existingNativeSave: commanderNameString])
538 {
539 [gameView suppressKeysUntilKeyUp];
540 [self setGuiToOverwriteScreen: commanderNameString];
541 }
542 else
543 {
544 [self nativeSavePlayer: commanderNameString];
545 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
546 [self setGuiToStatusScreen];
547 }
548 }
549 }
550
551 if([gameView isDown: 27]) // escape key
552 {
553 // get out of here
554 pollControls = YES;
555 [[UNIVERSE gameView] resetTypedString];
556 [self setGuiToStatusScreen];
557 }
558}
void setTypedString:(NSString *value)

◆ saveKeySetting:

- (void) saveKeySetting: (NSString*)  key
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1597 :(NSString*)key
1598{
1599 // check for a blank entry
1600 if ([key_list count] > 1 && [[(NSDictionary*)[key_list objectAtIndex:1] objectForKey:@"key"] integerValue] == 0)
1601 {
1602 [key_list removeObjectAtIndex:1];
1603 }
1604 // make sure the primary and alternate keys are different
1605 if ([key_list count] > 1) {
1606 if ([self compareKeyEntries:[key_list objectAtIndex:0] second:[key_list objectAtIndex:1]])
1607 {
1608 [key_list removeObjectAtIndex:1];
1609 }
1610 }
1611 // see if we've set the key settings to blank - in which case, delete the override
1612 if ([[(NSDictionary*)[key_list objectAtIndex:0] objectForKey:@"key"] integerValue] == 0)
1613 {
1614 if ([key_list count] == 1 || ([key_list count] > 1 && [[(NSDictionary*)[key_list objectAtIndex:1] objectForKey:@"key"] isEqualToString:@""]))
1615 {
1616 [self deleteKeySetting:key];
1617 // reload settings
1618 [self initKeyConfigSettings];
1619 [self reloadPage];
1620 return;
1621 }
1622 }
1623
1624 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1625
1626 if (![self entryIsCustomEquip:key])
1627 {
1628 // if we've got the same settings as the default, revert to the default
1629 if ([self entryIsEqualToDefault:key])
1630 {
1631 [self deleteKeySetting:key];
1632 // reload settings
1633 [self initKeyConfigSettings];
1634 [self reloadPage];
1635 return;
1636 }
1637 NSMutableDictionary *keyconf = [NSMutableDictionary dictionaryWithDictionary:[defaults objectForKey:KEYCONFIG_OVERRIDES]];
1638 [keyconf setObject:key_list forKey:key];
1639 [defaults setObject:keyconf forKey:KEYCONFIG_OVERRIDES];
1640 }
1641 else
1642 {
1643 NSUInteger idx = [self getCustomEquipIndex:key];
1644 NSString *custkey = [self getCustomEquipKeyDefType:key];
1645 NSMutableDictionary *custEquip = [[customEquipActivation objectAtIndex:idx] mutableCopy];
1646 [custEquip setObject:key_list forKey:custkey];
1647 [customEquipActivation replaceObjectAtIndex:idx withObject:custEquip];
1648 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1649 }
1650 // reload settings
1651 [self initKeyConfigSettings];
1652 [self reloadPage];
1653}

◆ savePlayer

- (void) savePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

126{
127#if OO_USE_APPKIT_LOAD_SAVE_ALWAYS
128 [self savePlayerWithPanel];
129#elif OOLITE_USE_APPKIT_LOAD_SAVE
130 // OS X: use system open/save dialogs in windowed mode, custom interface in full-screen.
131 if ([[UNIVERSE gameController] inFullScreenMode])
132 {
133 [self setGuiToSaveCommanderScreen:self.lastsaveName];
134 }
135 else
136 {
137 [self savePlayerWithPanel];
138 }
139#else
140 // Other platforms: use custom interface all the time.
141 [self setGuiToSaveCommanderScreen:[self lastsaveName]];
142#endif
143}

◆ scannedWormholes

- (NSArray *) scannedWormholes

◆ scannerFuzziness

- (double) scannerFuzziness

Definition at line 13727 of file PlayerEntity.m.

6104{
6105 double fuzz = 0.0;
6106
6107 /* Fuzziness from ECM bursts */
6108 if (last_ecm_time > 0.0)
6109 {
6110 double since = [UNIVERSE getTime] - last_ecm_time;
6112 {
6114 }
6115 }
6116 /* Other causes could go here */
6117
6118 return fuzz;
6119}
#define SCANNER_ECM_FUZZINESS

◆ scoopOverride

- (BOOL) scoopOverride

◆ score

- (unsigned) score

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

41{
42 return ship_kills;
43}

◆ score_number

- (NSNumber *) score_number

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

937{
938 return [NSNumber numberWithUnsignedInt:[self score]];
939}

◆ screenModeStringForWidth:height:refreshRate:

- (NSString *) screenModeStringForWidth: (unsigned inWidth
height: (unsigned inHeight
refreshRate: (float inRate 

Definition at line 9242 of file PlayerEntity.m.

12229 :(unsigned)width height:(unsigned)height refreshRate:(float)refreshRate
12230{
12231 if (0.0f != refreshRate)
12232 {
12233 return OOExpandKey(@"gameoptions-fullscreen-with-refresh-rate", width, height, refreshRate);
12234 }
12235 else
12236 {
12237 return OOExpandKey(@"gameoptions-fullscreen", width, height);
12238 }
12239}

◆ scriptActions:forTarget:missionKey:

- (void) scriptActions: (NSArray *)  actions
forTarget: (ShipEntity *)  target
missionKey: (NSString *)  missionKey 
implementation

Provided by category PlayerEntity(ScriptingPrivate).

◆ scriptsLoaded

- (BOOL) scriptsLoaded

Definition at line 9242 of file PlayerEntity.m.

12874{
12875 return worldScripts != nil && [worldScripts count] > 0;
12876}

◆ scriptTarget

- (ShipEntity *) scriptTarget

Provided by category PlayerEntity(Scripting).

Definition at line 233 of file PlayerEntityLegacyScriptEngine.m.

255{
256 return scriptTarget;
257}

◆ scriptTestCondition:

- (BOOL) scriptTestCondition: (NSArray *)  scriptCondition
implementation

Provided by category PlayerEntity(ScriptingPrivate).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

421 :(NSArray *)scriptCondition
422{
423 /* Test a script condition sanitized by OOLegacyScriptWhitelist.
424
425 A sanitized condition is an array of the form:
426 (opType, rawString, selector, comparisonType, operandArray).
427
428 opType and comparisonType are NSNumbers containing OOOperationType and
429 OOComparisonType enumerators, respectively.
430
431 rawString is the original textual representation of the condition for
432 display purposes.
433
434 selector is a string, either a method selector or a mission/local
435 variable name.
436
437 operandArray is an array of operands. Each operand is itself an array
438 of two items: a boolean indicating whether it's a method selector
439 (true) or a literal string (false), and a string.
440
441 The special opType OP_FALSE doesn't require any other elements in the
442 array. All other valid opTypes require the array to have five elements.
443
444 For performance reasons, this method assumes the script condition will
445 have been generated by OOSanitizeLegacyScriptConditions() and doesn't
446 perform extensive validity checks.
447 */
448
449 OOOperationType opType;
450 NSString *selectorString = nil;
451 SEL selector = NULL;
452 OOComparisonType comparator;
453 NSArray *operandArray = nil;
454 NSString *lhsString = nil;
455 NSString *expandedRHS = nil;
456 NSArray *rhsComponents = nil;
457 NSString *rhsItem = nil;
458 NSUInteger i, count;
459 NSCharacterSet *whitespace = nil;
460 double lhsValue, rhsValue;
461 BOOL lhsFlag, rhsFlag;
462
463 opType = [scriptCondition oo_unsignedIntAtIndex:0];
464 if (opType == OP_FALSE) return NO;
465
466 selectorString = [scriptCondition oo_stringAtIndex:2];
467 comparator = [scriptCondition oo_unsignedIntAtIndex:3];
468 operandArray = [scriptCondition oo_arrayAtIndex:4];
469
470 // Transform mission/local var ops into string ops.
471 if (opType == OP_MISSION_VAR)
472 {
473 sMissionStringValue = [mission_variables objectForKey:selectorString];
474 selector = @selector(mission_string);
475 opType = OP_STRING;
476 }
477 else if (opType == OP_LOCAL_VAR)
478 {
479 sMissionStringValue = [[self localVariablesForMission:sCurrentMissionKey] objectForKey:selectorString];
480 selector = @selector(mission_string);
481 opType = OP_STRING;
482 }
483 else
484 {
485 selector = NSSelectorFromString(selectorString);
486 }
487
488 expandedRHS = [self expandScriptRightHandSide:operandArray];
489
490 if (opType == OP_STRING)
491 {
492 lhsString = [self performSelector:selector];
493
494 #define DOUBLEVAL(x) ((x != nil) ? [x doubleValue] : 0.0)
495
496 switch (comparator)
497 {
499 return lhsString == nil;
500
501 case COMPARISON_EQUAL:
502 return [lhsString isEqualToString:expandedRHS];
503
505 return ![lhsString isEqualToString:expandedRHS];
506
508 return DOUBLEVAL(lhsString) < DOUBLEVAL(expandedRHS);
509
511 return DOUBLEVAL(lhsString) > DOUBLEVAL(expandedRHS);
512
513 case COMPARISON_ONEOF:
514 {
515 rhsComponents = [expandedRHS componentsSeparatedByString:@","];
516 count = [rhsComponents count];
517
518 whitespace = [NSCharacterSet whitespaceCharacterSet];
519 lhsString = [lhsString stringByTrimmingCharactersInSet:whitespace];
520
521 for (i = 0; i < count; i++)
522 {
523 rhsItem = [[rhsComponents objectAtIndex:i] stringByTrimmingCharactersInSet:whitespace];
524 if ([lhsString isEqualToString:rhsItem])
525 {
526 return YES;
527 }
528 }
529 }
530 return NO;
531 }
532 }
533 else if (opType == OP_NUMBER)
534 {
535 lhsValue = [[self performSelector:selector] doubleValue];
536
537 if (comparator == COMPARISON_ONEOF)
538 {
539 rhsComponents = [expandedRHS componentsSeparatedByString:@","];
540 count = [rhsComponents count];
541
542 for (i = 0; i < count; i++)
543 {
544 rhsItem = [rhsComponents objectAtIndex:i];
545 rhsValue = [rhsItem doubleValue];
546
547 if (lhsValue == rhsValue)
548 {
549 return YES;
550 }
551 }
552
553 return NO;
554 }
555 else
556 {
557 rhsValue = [expandedRHS doubleValue];
558
559 switch (comparator)
560 {
561 case COMPARISON_EQUAL:
562 return lhsValue == rhsValue;
563
565 return lhsValue != rhsValue;
566
568 return lhsValue < rhsValue;
569
571 return lhsValue > rhsValue;
572
574 case COMPARISON_ONEOF:
575 // "Can't happen" - undefined should have been caught by the sanitizer, oneof is handled above.
576 OOLog(@"script.error.unexpectedOperator", @"***** SCRIPT ERROR: in %@, operator %@ is not valid for numbers, evaluating to false.", CurrentScriptDesc(), OOComparisonTypeToString(comparator));
577 return NO;
578 }
579 }
580 }
581 else if (opType == OP_BOOL)
582 {
583 lhsFlag = [[self performSelector:selector] isEqualToString:@"YES"];
584 rhsFlag = [expandedRHS isEqualToString:@"YES"];
585
586 switch (comparator)
587 {
588 case COMPARISON_EQUAL:
589 return lhsFlag == rhsFlag;
590
592 return lhsFlag != rhsFlag;
593
597 case COMPARISON_ONEOF:
598 // "Can't happen" - should have been caught by the sanitizer.
599 OOLog(@"script.error.unexpectedOperator", @"***** SCRIPT ERROR: in %@, operator %@ is not valid for booleans, evaluating to false.", CurrentScriptDesc(), OOComparisonTypeToString(comparator));
600 return NO;
601 }
602 }
603
604 // What are we doing here?
605 OOLog(@"script.error.fallthrough", @"***** SCRIPT ERROR: in %@, unhandled condition '%@' (%@). %@", CurrentScriptDesc(), [scriptCondition objectAtIndex:1], scriptCondition, @"This is an internal error, please report it.");
606 return NO;
607}
NSString * OOComparisonTypeToString(OOComparisonType type) CONST_FUNC
#define DOUBLEVAL(x)

◆ scriptTestConditions:

- (BOOL) scriptTestConditions: (NSArray *)  array

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

400 :(NSArray *)array
401{
402 BOOL result = NO;
403
404 @try
405 {
406 result = TestScriptConditions(array);
407 }
408 @catch (NSException *exception)
409 {
410 OOLog(@"script.error.exception",
411 @"***** EXCEPTION %@: %@ while testing legacy script conditions.",
412 [exception name],
413 [exception reason]);
414 // Suppress exception
415 }
416
417 return result;
418}

◆ scriptTimer

- (OOTimeDelta) scriptTimer

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

243{
244 return script_time;
245}

◆ scriptTimer_number

- (NSNumber *) scriptTimer_number

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

949{
950 return [NSNumber numberWithDouble:[self scriptTimer]];
951}

◆ searchArrayForMatch:key:checkKeys:

- (NSString *) searchArrayForMatch: (NSArray *)  search_list
key: (NSString *)  key
checkKeys: (NSArray *)  check_keys 
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1529 :(NSArray *)search_list key:(NSString *)key checkKeys:(NSArray *)check_keys
1530{
1531 NSString *search = nil;
1532 NSUInteger i, j, k;
1533 for (i = 0; i < [search_list count]; i++)
1534 {
1535 search = (NSString*)[search_list objectAtIndex:i];
1536 // only check other key settings, not the one we've been passed
1537 if (![search isEqualToString:key])
1538 {
1539 // get the array from keyconfig2_settings
1540 // we need to compare all entries to each other to look for any match, as any match would indicate a conflict
1541 NSArray *current = nil;
1542 if (![self entryIsCustomEquip:search])
1543 {
1544 current = (NSArray *)[keyconfig2_settings objectForKey:search];
1545 }
1546 else
1547 {
1548 NSUInteger idx = [self getCustomEquipIndex:search];
1549 NSString *keytype = [self getCustomEquipKeyDefType:search];
1550 current = (NSArray *)[[customEquipActivation objectAtIndex:idx] objectForKey:keytype];
1551 }
1552 for (j = 0; j < [current count]; j++)
1553 {
1554 for (k = 0; k < [check_keys count]; k++)
1555 {
1556 if ([self compareKeyEntries:[current objectAtIndex:j] second:[check_keys objectAtIndex:k]]) return search;
1557 }
1558 }
1559 }
1560 }
1561 return nil;
1562}

◆ selectNextMissile

- (void) selectNextMissile

Definition at line 13727 of file PlayerEntity.m.

5738{
5739 if (![self weaponsOnline]) return;
5740
5741 unsigned i;
5742 for (i = 1; i < max_missiles; i++)
5743 {
5746 {
5747 // If we don't have the multi-targeting module installed, clear the active missiles' target
5748 if( ![self hasEquipmentItemProviding:@"EQ_MULTI_TARGET"] && [missile_entity[activeMissile] isMissile] )
5749 {
5750 [missile_entity[activeMissile] removeTarget:nil];
5751 }
5752
5753 // Set next missile to active
5754 [self setActiveMissile:next_missile];
5755
5757 {
5759
5760 // If the newly active pylon contains a missile then work out its target, if any
5762 {
5763 if( [self hasEquipmentItemProviding:@"EQ_MULTI_TARGET"] &&
5765 {
5766 // copy the missile's target
5767 [self addTarget:[missile_entity[next_missile] primaryTarget]];
5769 }
5770 else if ([self primaryTarget] != nil)
5771 {
5772 // never inherit target if we have EQ_MULTI_TARGET installed! [ Bug #16221 : Targeting enhancement regression ]
5773 /* CIM: seems okay to do this when launching a
5774 * missile to stop multi-target being a bit
5775 * irritating in a fight - 20/8/2014 */
5776 if([self hasEquipmentItemProviding:@"EQ_MULTI_TARGET"] && !launchingMissile)
5777 {
5778 [self noteLostTarget];
5780 }
5781 else
5782 {
5783 [missile_entity[activeMissile] addTarget:[self primaryTarget]];
5785 }
5786 }
5787 }
5788 }
5789 return;
5790 }
5791 }
5792}

◆ selectNextMultiFunctionDisplay

- (void) selectNextMultiFunctionDisplay

Definition at line 13727 of file PlayerEntity.m.

5653{
5654 if ([[self hud] mfdCount] == 0) return;
5655 activeMFD = (activeMFD + 1) % [[self hud] mfdCount];
5657 [UNIVERSE addMessage:OOExpandKey(@"mfd-N-selected", mfdID) forCount:3.0 ];
5658 JSContext *context = OOJSAcquireContext();
5659 ShipScriptEvent(context, self, "selectedMFDChanged", INT_TO_JSVAL(activeMFD));
5660 OOJSRelinquishContext(context);
5661}

◆ selectPreviousMultiFunctionDisplay

- (void) selectPreviousMultiFunctionDisplay

Definition at line 13727 of file PlayerEntity.m.

5665{
5666 if ([[self hud] mfdCount] == 0) return;
5667 if (activeMFD == 0)
5668 {
5669 activeMFD = ([[self hud] mfdCount] - 1);
5670 }
5671 else
5672 {
5673 activeMFD = (activeMFD - 1);
5674 }
5676 [UNIVERSE addMessage:OOExpandKey(@"mfd-N-selected", mfdID) forCount:3.0 ];
5677 JSContext *context = OOJSAcquireContext();
5678 ShipScriptEvent(context, self, "selectedMFDChanged", INT_TO_JSVAL(activeMFD));
5679 OOJSRelinquishContext(context);
5680}

◆ sendAllShipsAway

- (void) sendAllShipsAway

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2268{
2269 if (!UNIVERSE)
2270 return;
2271 int ent_count = UNIVERSE->n_entities;
2272 Entity** uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
2273 Entity* my_entities[ent_count];
2274 int i;
2275 for (i = 0; i < ent_count; i++)
2276 my_entities[i] = [uni_entities[i] retain]; // retained
2277
2278 for (i = 1; i < ent_count; i++)
2279 {
2280 Entity* e1 = my_entities[i];
2281 if ([e1 isShip])
2282 {
2283 ShipEntity* se1 = (ShipEntity*)e1;
2284 int e_class = [e1 scanClass];
2285 if (((e_class == CLASS_NEUTRAL)||(e_class == CLASS_POLICE)||(e_class == CLASS_MILITARY)||(e_class == CLASS_THARGOID)) &&
2286 ! ([se1 isStation] && [se1 maxFlightSpeed] == 0) && // exclude only stations, not carriers.
2287 [se1 hasHyperspaceMotor]) // exclude non jumping ships. Escorts will still be able to follow a mother.
2288 {
2289 AI* se1AI = [se1 getAI];
2290 [se1 setFuel:MAX(PLAYER_MAX_FUEL, [se1 fuelCapacity])];
2291 [se1 setAITo:@"exitingTraderAI.plist"]; // lets them return to their previous state after the jump
2292 [se1AI setState:@"EXIT_SYSTEM"];
2293 // The following should prevent all ships leaving at once (freezes oolite on slower machines)
2294 [se1AI setNextThinkTime:[UNIVERSE getTime] + 3 + (ranrot_rand() & 15)];
2295 [se1 setPrimaryRole:@"oolite-none"]; // prevents new ship from appearing at witchpoint when this one leaves!
2296 }
2297 }
2298 }
2299
2300 for (i = 0; i < ent_count; i++)
2301 {
2302 [my_entities[i] release]; // released
2303 }
2304}
OOScanClass scanClass
Definition Entity.h:106
void setFuel:(OOFuelQuantity amount)
void setPrimaryRole:(NSString *role)
void setAITo:(NSString *aiString)

Referenced by SystemSendAllShipsAway().

+ Here is the caller graph for this function:

◆ sessionID

- (NSUInteger) sessionID
implementation

Reimplemented from Entity.

Definition at line 13727 of file PlayerEntity.m.

2467{
2468 // The player ship always belongs to the current session.
2469 return [UNIVERSE sessionID];
2470}

◆ set:

- (void) set: (NSString *)  missionvariable_value

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1690 :(NSString *)missionvariable_value
1691{
1692 NSMutableArray *tokens = ScanTokensFromString(missionvariable_value);
1693 NSString *missionVariableString = nil;
1694 NSString *valueString = nil;
1695 BOOL hasMissionPrefix, hasLocalPrefix;
1696
1697 if ([tokens count] < 2)
1698 {
1699 OOLog(kOOLogSyntaxSet, @"***** SCRIPT ERROR: in %@, CANNOT SET '%@' (expected mission_variable or local_variable followed by value expression)", CurrentScriptDesc(), missionvariable_value);
1700 return;
1701 }
1702
1703 missionVariableString = [tokens objectAtIndex:0];
1704 [tokens removeObjectAtIndex:0];
1705 valueString = [tokens componentsJoinedByString:@" "];
1706
1707 hasMissionPrefix = [missionVariableString hasPrefix:@"mission_"];
1708 hasLocalPrefix = [missionVariableString hasPrefix:@"local_"];
1709
1710 if (!hasMissionPrefix && !hasLocalPrefix)
1711 {
1712 OOLog(kOOLogSyntaxSet, @"***** SCRIPT ERROR: in %@, IDENTIFIER '%@' DOES NOT BEGIN WITH 'mission_' or 'local_'", CurrentScriptDesc(), missionVariableString);
1713 return;
1714 }
1715
1716 OOLog(kOOLogNoteSet, @"DEBUG: script %@ is set to %@", missionVariableString, valueString);
1717
1718 if (hasMissionPrefix)
1719 {
1720 [self setMissionVariable:valueString forKey:missionVariableString];
1721 }
1722 else
1723 {
1724 [self setLocalVariable:valueString forKey:missionVariableString andMission:sCurrentMissionKey];
1725 }
1726}
static NSString *const kOOLogSyntaxSet
static NSString *const kOOLogNoteSet

◆ setActiveMissile:

- (void) setActiveMissile: (NSUInteger value

Definition at line 13727 of file PlayerEntity.m.

5459 :(NSUInteger)value
5460{
5461 activeMissile = value;
5462}

◆ setAftShieldLevel:

- (void) setAftShieldLevel: (GLfloat level

Definition at line 13727 of file PlayerEntity.m.

4713 :(GLfloat)level
4714{
4716}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setAftShieldRechargeRate:

- (void) setAftShieldRechargeRate: (float new

Definition at line 13727 of file PlayerEntity.m.

4689 :(float)new
4690{
4692}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setAlertFlag:to:

- (void) setAlertFlag: (int flag
to: (BOOL value 

Definition at line 13727 of file PlayerEntity.m.

5807 :(int)flag to:(BOOL)value
5808{
5809 if (value)
5810 {
5811 alertFlags |= flag;
5812 }
5813 else
5814 {
5815 int comp = ~flag;
5816 alertFlags &= comp;
5817 }
5818}

◆ setBackgroundFromDescriptionsKey:

- (void) setBackgroundFromDescriptionsKey: (NSString*)  d_key

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2570 :(NSString*) d_key
2571{
2572 NSArray * items = (NSArray *)[[UNIVERSE descriptions] objectForKey:d_key];
2573 //
2574 if (!items)
2575 return;
2576 //
2577 [self addScene: items atOffset: kZeroVector];
2578 //
2579 [self setShowDemoShips: YES];
2580}

◆ setBounty:

- (void) setBounty: (OOCreditsQuantity amount
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6796{
6797 [self setBounty:amount withReason:kOOLegalStatusReasonUnknown];
6798}

◆ setBounty:withReason:

- (void) setBounty: (OOCreditsQuantity amount
withReason: (OOLegalStatusReason reason 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6802{
6804 [self setBounty:amount withReasonAsString:nReason];
6805}
NSString * OOStringFromLegalStatusReason(OOLegalStatusReason reason)

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setBounty:withReasonAsString:

- (void) setBounty: (OOCreditsQuantity amount
withReasonAsString: (NSString *)  reason 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6809{
6810 JSContext *context = OOJSAcquireContext();
6811
6813 int amountVal2 = (int)amount-(int)legalStatus;
6815
6816 legalStatus = (int)amount; // can't set the new bounty until the size of the change is known
6817
6819
6820 ShipScriptEvent(context, self, "shipBountyChanged", amountVal, reasonVal);
6821
6822 OOJSRelinquishContext(context);
6823}

◆ setCargoQuantityForType:amount:

Definition at line 9242 of file PlayerEntity.m.

10732{
10733 OOMassUnit unit = [shipCommodityData massUnitForGood:type];
10734 if([self specialCargo] && unit == UNITS_TONS) return 0; // don't do anything if we've got a special cargo...
10735
10736 OOCargoQuantity oldAmount = [self cargoQuantityForType:type];
10737 OOCargoQuantity available = [self availableCargoSpace];
10738 BOOL inPods = ([self status] != STATUS_DOCKED);
10739
10740 // check it against the max amount.
10741 if (unit == UNITS_TONS && (available + oldAmount) < amount)
10742 {
10744 }
10745 // if we have 1499 kg the ship registers only 1 ton, so it's possible to exceed the max cargo:
10746 // eg: with maxAvailableCargoSpace 2 & gold 1499kg, you can still add 1 ton alloy.
10747 else if (unit == UNITS_KILOGRAMS && amount > oldAmount)
10748 {
10749 // Allow up to 0.5 ton of kg (& g) goods above the cargo capacity but respect existing quantities.
10752 }
10753 else if (unit == UNITS_GRAMS && amount > oldAmount)
10754 {
10757 }
10758
10759 if (inPods)
10760 {
10761 if (amount > oldAmount) // increase
10762 {
10763 [self loadCargoPodsForType:type amount:(amount - oldAmount)];
10764 }
10765 else
10766 {
10767 [self unloadCargoPodsForType:type amount:(oldAmount - amount)];
10768 }
10769 }
10770 else
10771 {
10772 [shipCommodityData setQuantity:amount forGood:type];
10773 }
10774
10775 [self calculateCurrentCargo];
10776 return [shipCommodityData quantityForGood:type];
10777}

Referenced by ManifestSetProperty().

+ Here is the caller graph for this function:

◆ setCommanderDataFromDictionary:

- (BOOL) setCommanderDataFromDictionary: (NSDictionary *)  dict

Definition at line 13727 of file PlayerEntity.m.

1191 :(NSDictionary *) dict
1192{
1193 // multi-function displays
1194 // must be reset before ship setup
1195 [multiFunctionDisplayText release];
1196 multiFunctionDisplayText = [[NSMutableDictionary alloc] init];
1197
1198 [multiFunctionDisplaySettings release];
1199 multiFunctionDisplaySettings = [[NSMutableArray alloc] init];
1200
1201 [customDialSettings release];
1202 customDialSettings = [[NSMutableDictionary alloc] init];
1203
1204 [[UNIVERSE gameView] resetTypedString];
1205
1206 // Required keys
1207 if ([dict oo_stringForKey:@"ship_desc"] == nil) return NO;
1208 // galaxy_seed is used is 1.80 or earlier
1209 if ([dict oo_stringForKey:@"galaxy_seed"] == nil && [dict oo_stringForKey:@"galaxy_id"] == nil) return NO;
1210 // galaxy_coordinates is used is 1.80 or earlier
1211 if ([dict oo_stringForKey:@"galaxy_coordinates"] == nil && [dict oo_stringForKey:@"system_id"] == nil) return NO;
1212
1213 NSString *scenarioRestrict = [dict oo_stringForKey:@"scenario_restriction" defaultValue:nil];
1214 if (scenarioRestrict == nil)
1215 {
1216 // older save game - use the 'strict' key instead
1217 BOOL strict = [dict oo_boolForKey:@"strict" defaultValue:NO];
1218 if (strict)
1219 {
1221 }
1222 else
1223 {
1225 }
1226 }
1227
1229 {
1230 return NO;
1231 }
1232
1233
1234 //base ship description
1235 [self setShipDataKey:[dict oo_stringForKey:@"ship_desc"]];
1236
1238 if (shipDict == nil) return NO;
1240 OOLog(@"fuelPrices", @"Got \"%@\", fuel charge rate: %.2f", [self shipDataKey],[self fuelChargeRate]);
1241
1242 // ship depreciation
1243 ship_trade_in_factor = [dict oo_intForKey:@"ship_trade_in_factor" defaultValue:95];
1244
1245 // newer savegames use galaxy_id
1246 if ([dict oo_stringForKey:@"galaxy_id"] != nil)
1247 {
1248 galaxy_number = [dict oo_unsignedIntegerForKey:@"galaxy_id"];
1250 {
1251 return NO;
1252 }
1253 [UNIVERSE setGalaxyTo:galaxy_number andReinit:YES];
1254
1255 system_id = [dict oo_intForKey:@"system_id"];
1257 {
1258 return NO;
1259 }
1260
1261 [UNIVERSE setSystemTo:system_id];
1262
1264 galaxy_coordinates.x = [coord_vals oo_unsignedCharAtIndex:0];
1265 galaxy_coordinates.y = [coord_vals oo_unsignedCharAtIndex:1];
1269 chart_zoom = [dict oo_floatForKey:@"chart_zoom" defaultValue:1.0];
1272 ANA_mode = [dict oo_intForKey:@"chart_ana_mode" defaultValue:OPTIMIZED_BY_NONE];
1273 longRangeChartMode = [dict oo_intForKey:@"chart_colour_mode" defaultValue:OOLRC_MODE_SUNCOLOR];
1275
1276 target_system_id = [dict oo_intForKey:@"target_id" defaultValue:system_id];
1277 previous_system_id = [dict oo_intForKey:@"previous_system_id" defaultValue:system_id];
1280 cursor_coordinates.x = [coord_vals oo_unsignedCharAtIndex:0];
1281 cursor_coordinates.y = [coord_vals oo_unsignedCharAtIndex:1];
1282
1285
1286 found_system_id = [dict oo_intForKey:@"found_system_id" defaultValue:-1];
1287 }
1288 else
1289 // compatibility for loading 1.80 savegames
1290 {
1291 galaxy_number = [dict oo_unsignedIntegerForKey:@"galaxy_number"];
1292
1293 [UNIVERSE setGalaxyTo: galaxy_number andReinit:YES];
1294
1295 NSArray *coord_vals = ScanTokensFromString([dict oo_stringForKey:@"galaxy_coordinates"]);
1296 galaxy_coordinates.x = [coord_vals oo_unsignedCharAtIndex:0];
1297 galaxy_coordinates.y = [coord_vals oo_unsignedCharAtIndex:1];
1301 chart_zoom = 1.0;
1302 target_chart_zoom = 1.0;
1303 saved_chart_zoom = 1.0;
1305
1306 NSString *keyStringValue = [dict oo_stringForKey:@"target_coordinates"];
1307
1308 if (keyStringValue != nil)
1309 {
1311 cursor_coordinates.x = [coord_vals oo_unsignedCharAtIndex:0];
1312 cursor_coordinates.y = [coord_vals oo_unsignedCharAtIndex:1];
1313 }
1316
1317 // calculate system ID, target ID
1318 if ([dict objectForKey:@"current_system_name"])
1319 {
1320 system_id = [UNIVERSE findSystemFromName:[dict oo_stringForKey:@"current_system_name"]];
1321 if (system_id == -1) system_id = [UNIVERSE findSystemNumberAtCoords:galaxy_coordinates withGalaxy:galaxy_number includingHidden:YES];
1322 }
1323 else
1324 {
1325 // really old save games don't have system name saved
1326 // use coordinates instead - unreliable in zero-distance pairs.
1327 system_id = [UNIVERSE findSystemNumberAtCoords:galaxy_coordinates withGalaxy:galaxy_number includingHidden:YES];
1328 }
1329 // and current_system_name and target_system_name
1330 // were introduced at different times, too
1331 if ([dict objectForKey:@"target_system_name"])
1332 {
1333 target_system_id = [UNIVERSE findSystemFromName:[dict oo_stringForKey:@"target_system_name"]];
1334 if (target_system_id == -1) target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:YES];
1335 }
1336 else
1337 {
1338 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:YES];
1339 }
1341 found_system_id = -1;
1342 }
1343
1344 NSString *cname = [dict oo_stringForKey:@"player_name" defaultValue:PLAYER_DEFAULT_NAME];
1345 [self setCommanderName:cname];
1346 [self setLastsaveName:[dict oo_stringForKey:@"player_save_name" defaultValue:cname]];
1347
1348 [self setShipUniqueName:[dict oo_stringForKey:@"ship_unique_name" defaultValue:@""]];
1349 [self setShipClassName:[dict oo_stringForKey:@"ship_class_name" defaultValue:[shipDict oo_stringForKey:@"name"]]];
1350
1351 [shipCommodityData loadPlayerAmounts:[dict oo_arrayForKey:@"shipCommodityData"]];
1352
1353 // extra equipment flags
1354 [self removeAllEquipment];
1355 NSMutableDictionary *equipment = [NSMutableDictionary dictionaryWithDictionary:[dict oo_dictionaryForKey:@"extra_equipment"]];
1356
1357 // Equipment flags (deprecated in favour of equipment dictionary, keep for compatibility)
1358 if ([dict oo_boolForKey:@"has_docking_computer"]) [equipment oo_setInteger:1 forKey:@"EQ_DOCK_COMP"];
1359 if ([dict oo_boolForKey:@"has_galactic_hyperdrive"]) [equipment oo_setInteger:1 forKey:@"EQ_GAL_DRIVE"];
1360 if ([dict oo_boolForKey:@"has_escape_pod"]) [equipment oo_setInteger:1 forKey:@"EQ_ESCAPE_POD"];
1361 if ([dict oo_boolForKey:@"has_ecm"]) [equipment oo_setInteger:1 forKey:@"EQ_ECM"];
1362 if ([dict oo_boolForKey:@"has_scoop"]) [equipment oo_setInteger:1 forKey:@"EQ_FUEL_SCOOPS"];
1363 if ([dict oo_boolForKey:@"has_energy_bomb"]) [equipment oo_setInteger:1 forKey:@"EQ_ENERGY_BOMB"];
1364 if ([dict oo_boolForKey:@"has_fuel_injection"]) [equipment oo_setInteger:1 forKey:@"EQ_FUEL_INJECTION"];
1365
1366
1367 // Legacy energy unit type -> energy unit equipment item
1368 if ([dict oo_boolForKey:@"has_energy_unit"] && [self installedEnergyUnitType] == ENERGY_UNIT_NONE)
1369 {
1370 OOEnergyUnitType eType = [dict oo_intForKey:@"energy_unit" defaultValue:ENERGY_UNIT_NORMAL];
1371 switch (eType)
1372 {
1373 // look for NEU first!
1375 [equipment oo_setInteger:1 forKey:@"EQ_NAVAL_ENERGY_UNIT"];
1376 break;
1377
1379 [equipment oo_setInteger:1 forKey:@"EQ_ENERGY_UNIT"];
1380 break;
1381
1382 default:
1383 break;
1384 }
1385 }
1386
1387 custom_chart_zoom = 1.0;
1389
1390 /* Energy bombs are no longer supported without OXPs. As compensation,
1391 we'll award either a Q-mine or some cash. We can't determine what to
1392 award until we've handled missiles later on, though.
1393 */
1395 if ([equipment oo_boolForKey:@"EQ_ENERGY_BOMB"] && [OOEquipmentType equipmentTypeWithIdentifier:@"EQ_ENERGY_BOMB"] == nil)
1396 {
1398 [equipment removeObjectForKey:@"EQ_ENERGY_BOMB"];
1399 }
1400
1401 eqScripts = [[NSMutableArray alloc] init];
1402 [self addEquipmentFromCollection:equipment];
1403 primedEquipment = [self eqScriptIndexForKey:[dict oo_stringForKey:@"primed_equipment"]]; // if key not found primedEquipment is set to primed-none
1404
1405 [self setFastEquipmentA:[dict oo_stringForKey:@"primed_equipment_a" defaultValue:@"EQ_CLOAKING_DEVICE"]];
1406 [self setFastEquipmentB:[dict oo_stringForKey:@"primed_equipment_b" defaultValue:@"EQ_ENERGY_BOMB"]]; // even though there isn't one, for compatibility.
1407
1408 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_COMPASS"]) compassMode = COMPASS_MODE_PLANET;
1411
1412 // speech
1413 isSpeechOn = [dict oo_intForKey:@"speech_on"];
1414#if OOLITE_ESPEAK
1415 voice_gender_m = [dict oo_boolForKey:@"speech_gender" defaultValue:YES];
1416 voice_no = [UNIVERSE setVoice:[UNIVERSE voiceNumber:[dict oo_stringForKey:@"speech_voice" defaultValue:nil]] withGenderM:voice_gender_m];
1417#endif
1418
1419 // reputation
1420 [reputation release];
1421 reputation = [[dict oo_dictionaryForKey:@"reputation"] mutableCopy];
1422 if (reputation == nil) reputation = [[NSMutableDictionary alloc] init];
1423 [self normaliseReputation];
1424
1425 // passengers and contracts
1426 [parcels release];
1427 [parcel_record release];
1428 [passengers release];
1429 [passenger_record release];
1430 [contracts release];
1431 [contract_record release];
1432
1433 max_passengers = [dict oo_intForKey:@"max_passengers" defaultValue:0];
1434 passengers = [[dict oo_arrayForKey:@"passengers"] mutableCopy];
1435 passenger_record = [[dict oo_dictionaryForKey:@"passenger_record"] mutableCopy];
1436 /* Note: contracts from older savegames will have ints in the commodity.
1437 * Need to fix this up */
1438 contracts = [[dict oo_arrayForKey:@"contracts"] mutableCopy];
1440
1441 // iterate downwards; lets us remove invalid ones as we go
1442 for (NSInteger i = (NSInteger)[contracts count] - 1; i >= 0; i--)
1443 {
1444 contractInfo = [[[contracts oo_dictionaryAtIndex:i] mutableCopy] autorelease];
1445 // if the trade good ID is an int
1447 {
1448 // look it up, and replace with a string
1449 NSUInteger legacy_type = [contractInfo oo_unsignedIntegerForKey:CARGO_KEY_TYPE];
1450 [contractInfo setObject:[OOCommodities legacyCommodityType:legacy_type] forKey:CARGO_KEY_TYPE];
1451 [contracts replaceObjectAtIndex:i withObject:[[contractInfo copy] autorelease]];
1452 }
1453 else
1454 {
1455 OOCommodityType new_type = [contractInfo oo_stringForKey:CARGO_KEY_TYPE];
1456 // check that that the type still exists
1457 if (![[UNIVERSE commodities] goodDefined:new_type])
1458 {
1459 OOLog(@"setCommanderDataFromDictionary.warning.contract",@"Cargo contract to deliver %@ could not be loaded from the saved game, as the commodity is no longer defined",new_type);
1460 [contracts removeObjectAtIndex:i];
1461 }
1462 }
1463 }
1464
1465 contract_record = [[dict oo_dictionaryForKey:@"contract_record"] mutableCopy];
1466 parcels = [[dict oo_arrayForKey:@"parcels"] mutableCopy];
1467 parcel_record = [[dict oo_dictionaryForKey:@"parcel_record"] mutableCopy];
1468
1469
1470
1471 if (passengers == nil) passengers = [[NSMutableArray alloc] init];
1472 if (passenger_record == nil) passenger_record = [[NSMutableDictionary alloc] init];
1473 if (contracts == nil) contracts = [[NSMutableArray alloc] init];
1474 if (contract_record == nil) contract_record = [[NSMutableDictionary alloc] init];
1475 if (parcels == nil) parcels = [[NSMutableArray alloc] init];
1476 if (parcel_record == nil) parcel_record = [[NSMutableDictionary alloc] init];
1477
1478 //specialCargo
1479 [specialCargo release];
1480 specialCargo = [[dict oo_stringForKey:@"special_cargo"] copy];
1481
1482 // mission destinations
1483 NSArray *legacyDestinations = [dict oo_arrayForKey:@"missionDestinations"];
1484
1485 NSDictionary *newDestinations = [dict oo_dictionaryForKey:@"mission_destinations"];
1486 [self initialiseMissionDestinations:newDestinations andLegacy:legacyDestinations];
1487
1488 // shipyard
1490 shipyard_record = [[dict oo_dictionaryForKey:@"shipyard_record"] mutableCopy];
1491 if (shipyard_record == nil) shipyard_record = [[NSMutableDictionary alloc] init];
1492
1493 // Normalize cargo capacity
1494 unsigned original_hold_size = [UNIVERSE maxCargoForShip:[self shipDataKey]];
1495 // Not Suitable For Oolite
1496 //unsigned passenger_space = [[OOEquipmentType equipmentTypeWithIdentifier:@"EQ_PASSENGER_BERTH"] requiredCargoSpace];
1497 //if (passenger_space == 0) passenger_space = PASSENGER_BERTH_SPACE;
1498
1499 max_cargo = [dict oo_unsignedIntForKey:@"max_cargo" defaultValue:max_cargo];
1500 if (max_cargo > original_hold_size) [self addEquipmentItem:@"EQ_CARGO_BAY" inContext:@"loading"];
1503 {
1504 // Something went wrong. Possibly the save file was hacked to contain more passenger cabins than the available cargo space would allow - Nikos 20110731
1507 OOLogWARN(@"setCommanderDataFromDictionary.inconsistency.max_passengers", @"player ship %@ had max_passengers set to a value requiring more cargo space than currently available (%u). Setting max_passengers to maximum possible value (%u).", [self name], originalMaxPassengers, max_passengers);
1508 }
1510
1511 // Do we have extra passengers?
1513 {
1514 OOLogWARN(@"setCommanderDataFromDictionary.inconsistency.passengers", @"player ship %@ had more passengers (%llu) than passenger berths (%u). Removing extra passengers.", [self name], [passengers count], max_passengers);
1515 for (NSInteger i = (NSInteger)[passengers count] - 1; i >= max_passengers; i--)
1516 {
1517 [passenger_record removeObjectForKey:[[passengers oo_dictionaryAtIndex:i] oo_stringForKey:PASSENGER_KEY_NAME]];
1518 [passengers removeObjectAtIndex:i];
1519 }
1520 }
1521
1522 // too much cargo?
1523 NSInteger excessCargo = (NSInteger)[self cargoQuantityOnBoard] - (NSInteger)[self maxAvailableCargoSpace];
1524 if (excessCargo > 0)
1525 {
1526 OOLogWARN(@"setCommanderDataFromDictionary.inconsistency.cargo", @"player ship %@ had more cargo (%i) than it can hold (%u). Removing extra cargo.", [self name], [self cargoQuantityOnBoard], [self maxAvailableCargoSpace]);
1527
1528 OOCommodityType type;
1531
1533
1534 // manifest always contains entries for all 17 commodities, even if their quantity is 0.
1535 foreach (type, [shipCommodityData goods])
1536 {
1537 units = [shipCommodityData massUnitForGood:type];
1538
1539 oldAmount = [shipCommodityData quantityForGood:type];
1541 if (roundedTon || (units == UNITS_TONS && oldAmount > 0))
1542 {
1543 // let's remove stuff
1545 toRemove = 0;
1546 while (remainingExcess > 0 && partAmount > 0)
1547 {
1549 {
1550 toRemove += (units == UNITS_KILOGRAMS) ? (partAmount > (KILOGRAMS_PER_POD + MAX_KILOGRAMS_IN_SAFE) ? KILOGRAMS_PER_POD : partAmount - MAX_KILOGRAMS_IN_SAFE)
1551 : (partAmount > (GRAMS_PER_POD + MAX_GRAMS_IN_SAFE) ? GRAMS_PER_POD : partAmount - MAX_GRAMS_IN_SAFE);
1554 }
1555 else if (!roundedTon)
1556 {
1557 toRemove++;
1558 partAmount--;
1560 }
1561 else
1562 {
1563 partAmount = 0;
1564 }
1565 }
1566 [shipCommodityData removeQuantity:toRemove forGood:type];
1567 }
1568 }
1569 }
1570
1572
1573 fuel = [dict oo_unsignedIntForKey:@"fuel" defaultValue:fuel];
1574 galaxy_number = [dict oo_intForKey:@"galaxy_number"];
1575//
1577 OOWeaponFacingSet available_facings = [shipyard_info oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:[self weaponFacings]];
1578
1581 else
1583
1586 else
1588
1591 else
1593
1596 else
1598
1599 [self setWeaponDataFromType:forward_weapon_type];
1600
1601 if (hud != nil && [hud nonlinearScanner])
1602 {
1603 [hud setScannerZoom: [dict oo_floatForKey:@"ship_scanner_zoom" defaultValue: 1.0]];
1604 }
1605
1606 weapons_online = [dict oo_boolForKey:@"weapons_online" defaultValue:YES];
1607
1608 legalStatus = [dict oo_intForKey:@"legal_status"];
1609 market_rnd = [dict oo_intForKey:@"market_rnd"];
1610 ship_kills = [dict oo_intForKey:@"ship_kills"];
1611
1612 ship_clock = [dict oo_doubleForKey:@"ship_clock" defaultValue:PLAYER_SHIP_CLOCK_START];
1614
1615 escape_pod_rescue_time = [dict oo_doubleForKey:@"escape_pod_rescue_time" defaultValue:0.0];
1616
1617 // role weights
1618 [roleWeights release];
1619 roleWeights = [[dict oo_arrayForKey:@"role_weights"] mutableCopy];
1620 NSUInteger rc = [self maxPlayerRoles];
1621 if (roleWeights == nil)
1622 {
1623 roleWeights = [[NSMutableArray alloc] initWithCapacity:rc];
1624 while (rc-- > 0)
1625 {
1626 [roleWeights addObject:@"player-unknown"];
1627 }
1628 }
1629 else
1630 {
1631 if ([roleWeights count] > rc)
1632 {
1633 [roleWeights removeObjectsInRange:(NSRange) {rc,[roleWeights count]-rc}];
1634 }
1635 }
1636
1637 roleWeightFlags = [[dict oo_dictionaryForKey:@"role_weight_flags"] mutableCopy];
1638 if (roleWeightFlags == nil)
1639 {
1640 roleWeightFlags = [[NSMutableDictionary alloc] init];
1641 }
1642
1643 roleSystemList = [[dict oo_arrayForKey:@"role_system_memory"] mutableCopy];
1644 if (roleSystemList == nil)
1645 {
1646 roleSystemList = [[NSMutableArray alloc] initWithCapacity:32];
1647 }
1648
1649
1650 // mission_variables
1651 [mission_variables release];
1652 mission_variables = [[dict oo_dictionaryForKey:@"mission_variables"] mutableCopy];
1653 if (mission_variables == nil) mission_variables = [[NSMutableDictionary alloc] init];
1654
1655 // persistant UNIVERSE info
1656 NSDictionary *planetInfoOverrides = [dict oo_dictionaryForKey:@"scripted_planetinfo_overrides"];
1657 if (planetInfoOverrides != nil)
1658 {
1659 [[UNIVERSE systemManager] importScriptedChanges:planetInfoOverrides];
1660 }
1661 else
1662 {
1663 // no scripted overrides? What about 1.80-style local overrides?
1664 planetInfoOverrides = [dict oo_dictionaryForKey:@"local_planetinfo_overrides"];
1665 if (planetInfoOverrides != nil)
1666 {
1667 [[UNIVERSE systemManager] importLegacyScriptedChanges:planetInfoOverrides];
1668 }
1669 }
1670
1671 // communications log
1672 [commLog release];
1673 commLog = [[NSMutableArray alloc] initWithCapacity:kCommLogTrimThreshold];
1674
1675 NSArray *savedCommLog = [dict oo_arrayForKey:@"comm_log"];
1676 NSUInteger commCount = [savedCommLog count];
1677 for (NSUInteger i = 0; i < commCount; i++)
1678 {
1679 [UNIVERSE addCommsMessage:[savedCommLog objectAtIndex:i] forCount:0 andShowComms:NO logOnly:YES];
1680 }
1681
1682 /* entity_personality for scripts and shaders. If undefined, we fall back
1683 to old behaviour of using a random value each time game is loaded (set
1684 up in -setUp). Saving of entity_personality was added in 1.74.
1685 -- Ahruman 2009-09-13
1686 */
1687 entity_personality = [dict oo_unsignedShortForKey:@"entity_personality" defaultValue:entity_personality];
1688
1689 // set up missiles
1690 [self setActiveMissile:0];
1691 for (NSUInteger i = 0; i < PLAYER_MAX_MISSILES; i++)
1692 {
1693 [missile_entity[i] release];
1694 missile_entity[i] = nil;
1695 }
1696 NSArray *missileRoles = [dict oo_arrayForKey:@"missile_roles"];
1697 if (missileRoles != nil)
1698 {
1699 unsigned missileCount = 0;
1700 for (NSUInteger roleIndex = 0; roleIndex < [missileRoles count] && missileCount < max_missiles; roleIndex++)
1701 {
1702 NSString *missile_desc = [missileRoles oo_stringAtIndex:roleIndex];
1703 if (missile_desc != nil && ![missile_desc isEqualToString:@"NONE"])
1704 {
1705 ShipEntity *amiss = [UNIVERSE newShipWithRole:missile_desc];
1706 if (amiss)
1707 {
1708 missile_list[missileCount] = [OOEquipmentType equipmentTypeWithIdentifier:missile_desc];
1709 missile_entity[missileCount] = amiss; // retain count = 1
1710 missileCount++;
1711 }
1712 else
1713 {
1714 OOLogWARN(@"load.failed.missileNotFound", @"couldn't find missile with role '%@' in [PlayerEntity setCommanderDataFromDictionary:], missile entry discarded.", missile_desc);
1715 }
1716 }
1718 }
1719 }
1720 else // no missile_roles
1721 {
1722 for (NSUInteger i = 0; i < missiles; i++)
1723 {
1725 missile_entity[i] = [UNIVERSE newShipWithRole:@"EQ_MISSILE"]; // retain count = 1 - should be okay as long as we keep a missile with this role
1726 // in the base package.
1727 }
1728 }
1729
1731 {
1732 /*
1733 Compensate energy bomb with either a QC mine or the cost of an
1734 energy bomb (900 credits). This must be done after missiles are
1735 set up.
1736 */
1737 if ([self mountMissileWithRole:@"EQ_QC_MINE"])
1738 {
1739 OOLog(@"load.upgrade.replacedEnergyBomb", @"%@", @"Replaced legacy energy bomb with Quirium cascade mine.");
1740 }
1741 else
1742 {
1743 credits += 9000;
1744 OOLog(@"load.upgrade.replacedEnergyBomb", @"%@", @"Compensated legacy energy bomb with 900 credits.");
1745 }
1746 }
1747
1748 [self setActiveMissile:0];
1749
1750 [self setHeatInsulation:1.0];
1751
1754
1757
1758 forward_shield = [self maxForwardShieldLevel];
1759 aft_shield = [self maxAftShieldLevel];
1760
1761 // used to get current_system and target_system here,
1762 // but stores the ID in the save file instead
1763
1764 // restore subentities status
1765 [self deserializeShipSubEntitiesFrom:[dict oo_stringForKey:@"subentities_status"]];
1766
1767 // wormholes
1768 NSArray * whArray;
1769 whArray = [dict objectForKey:@"wormholes"];
1771 [scannedWormholes release];
1772 scannedWormholes = [[NSMutableArray alloc] initWithCapacity:[whArray count]];
1773 foreach (whCurrDict, whArray)
1774 {
1775 WormholeEntity * wh = [[WormholeEntity alloc] initWithDict:whCurrDict];
1776 [scannedWormholes addObject:wh];
1777 /* TODO - add to Universe if the wormhole hasn't expired yet; but in this case
1778 * we need to save/load position and mass as well, which we currently
1779 * don't
1780 if (equal_seeds([wh origin], system_seed))
1781 {
1782 [UNIVERSE addEntity:wh];
1783 }
1784 */
1785 }
1786
1787 // custom view no.
1788 if (_customViews != nil)
1789 _customViewIndex = [dict oo_unsignedIntForKey:@"custom_view_index"] % [_customViews count];
1790
1791
1792 // docking clearance protocol
1793 [UNIVERSE setDockingClearanceProtocolActive:[dict oo_boolForKey:@"docking_clearance_protocol" defaultValue:NO]];
1794
1795 // trumble information
1796 [self setUpTrumbles];
1797 [self setTrumbleValueFrom:[dict objectForKey:@"trumbles"]]; // if it doesn't exist we'll check user-defaults
1798
1799 return YES;
1800}
#define OO_SYSTEMS_PER_GALAXY
uint8_t OOWeaponFacingSet
Definition OOTypes.h:237
OOEnergyUnitType
Definition OOTypes.h:131
@ OLD_ENERGY_UNIT_NORMAL
Definition OOTypes.h:135
@ OLD_ENERGY_UNIT_NAVAL
Definition OOTypes.h:136
#define CARGO_KEY_TYPE
OOCreditsQuantity OODeciCreditsFromObject(id object)
OOWeaponType OOWeaponTypeFromEquipmentIdentifierLegacy(NSString *string)
#define BASELINE_SHIELD_LEVEL
Definition ShipEntity.h:99
OOCommodityType legacyCommodityType:(NSUInteger i)
OOScalar saved_chart_zoom
double fps_check_time
OOLongRangeChartMode longRangeChartMode
NSPoint target_chart_focus
OOScalar target_chart_zoom
unsigned weapons_online
OOCargoQuantity cargoQuantityOnBoard()
NSUInteger _customViewIndex
OOSpeechSettings isSpeechOn
OOScalar custom_chart_zoom
NSPoint target_chart_centre
uint16_t entity_personality
Definition ShipEntity.h:430
OOCargoQuantity extra_cargo
Definition ShipEntity.h:296
BOOL hasExpandedCargoBay()

◆ setCommanderName:

- (void) setCommanderName: (NSString *)  value

Definition at line 9242 of file PlayerEntity.m.

13086 :(NSString *)value
13087{
13088 NSParameterAssert(value != nil);
13089 [_commanderName autorelease];
13090 _commanderName = [value copy];
13091}

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setCompassMode:

- (void) setCompassMode: (OOCompassMode value

Definition at line 13727 of file PlayerEntity.m.

5316 :(OOCompassMode) value
5317{
5318 compassMode = value;
5319}
OOCompassMode
Definition OOTypes.h:145

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setCompassTarget:

- (void) setCompassTarget: (Entity *)  value

Definition at line 13727 of file PlayerEntity.m.

5208 :(Entity *)value
5209{
5210 [compassTarget release];
5211 compassTarget = [value weakRetain];
5212}

◆ setCreditBalance:

- (void) setCreditBalance: (double value

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

58 :(double)value
59{
60 credits = OODeciCreditsFromDouble(value * 10.0);
61}
OOCreditsQuantity OODeciCreditsFromDouble(double doubleDeciCredits)

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setCustomChartCentre:

- (void) setCustomChartCentre: (NSPoint coords

Definition at line 13727 of file PlayerEntity.m.

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setCustomChartZoom:

- (void) setCustomChartZoom: (OOScalar zoom

Definition at line 13727 of file PlayerEntity.m.

571 :(OOScalar)zoom
572{
574}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setCustomViewData

◆ setCustomViewDataFromDictionary:withScaling:

- (void) setCustomViewDataFromDictionary: (NSDictionary*)  viewDict
withScaling: (BOOL withScaling 

Definition at line 9242 of file PlayerEntity.m.

12637{
12640 if (viewDict == nil) return;
12641
12642 customViewQuaternion = [viewDict oo_quaternionForKey:@"view_orientation"];
12643 [self setCustomViewData];
12644
12645 // easier to do the multiplication at this point than at load time
12646 if (withScaling)
12647 {
12649 }
12650 else
12651 {
12652 // but don't do this when the custom view is set through JS
12653 customViewOffset = [viewDict oo_vectorForKey:@"view_position"];
12654 }
12656 customViewDescription = [viewDict oo_stringForKey:@"view_description"];
12657
12658 NSString *facing = [[viewDict oo_stringForKey:@"weapon_facing"] lowercaseString];
12659 if ([facing isEqual:@"aft"])
12660 {
12662 }
12663 else if ([facing isEqual:@"port"])
12664 {
12666 }
12667 else if ([facing isEqual:@"starboard"])
12668 {
12670 }
12671 else if ([facing isEqual:@"forward"])
12672 {
12674 }
12675 // if the weapon facing is unset / unknown,
12676 // don't change current weapon facing!
12677}
const OOMatrix kIdentityMatrix
Definition OOMatrix.m:31
NSString * customViewDescription
GLfloat _scaleFactor
Definition ShipEntity.h:388

Referenced by PlayerShipSetCustomView().

+ Here is the caller graph for this function:

◆ setCustomViewOffset:

- (void) setCustomViewOffset: (Vector offset

Definition at line 9242 of file PlayerEntity.m.

12447 :(Vector) offset
12448{
12450}

◆ setCustomViewQuaternion:

- (void) setCustomViewQuaternion: (Quaternion q1

Definition at line 9242 of file PlayerEntity.m.

12428 :(Quaternion)q
12429{
12431 [self setCustomViewData];
12432}

◆ setCustomViewRotationCenter:

- (void) setCustomViewRotationCenter: (Vector center

Definition at line 9242 of file PlayerEntity.m.

12459 :(Vector) center
12460{
12462}

◆ setDefaultCustomViews

- (void) setDefaultCustomViews

Definition at line 9242 of file PlayerEntity.m.

11954{
11955 NSArray *customViews = [[[OOShipRegistry sharedRegistry] shipInfoForKey:PLAYER_SHIP_DESC] oo_arrayForKey:@"custom_views"];
11956
11957 [_customViews release];
11958 _customViews = nil;
11959 _customViewIndex = 0;
11960 if (customViews != nil)
11961 {
11962 _customViews = [customViews retain];
11963 }
11964}

◆ setDefaultViewOffsets

- (void) setDefaultViewOffsets

Definition at line 9242 of file PlayerEntity.m.

11941{
11942 float halfLength = 0.5f * (boundingBox.max.z - boundingBox.min.z);
11943 float halfWidth = 0.5f * (boundingBox.max.x - boundingBox.min.x);
11944
11945 forwardViewOffset = make_vector(0.0f, 0.0f, boundingBox.max.z - halfLength);
11946 aftViewOffset = make_vector(0.0f, 0.0f, boundingBox.min.z + halfLength);
11947 portViewOffset = make_vector(boundingBox.min.x + halfWidth, 0.0f, 0.0f);
11950}
Vector starboardViewOffset
Vector portViewOffset
Vector aftViewOffset

◆ setDialCustom:forKey:

- (void) setDialCustom: (id value
forKey: (NSString *)  key 

Definition at line 13727 of file PlayerEntity.m.

4629 :(id)value forKey:(NSString *)dialKey
4630{
4631 [customDialSettings setObject:value forKey:dialKey];
4632}

Referenced by PlayerShipSetCustomHUDDial().

+ Here is the caller graph for this function:

◆ setDialIdentEngaged:

- (void) setDialIdentEngaged: (BOOL newValue

Definition at line 13727 of file PlayerEntity.m.

5477 :(BOOL)newValue
5478{
5480}

◆ setDockedAtMainStation

- (void) setDockedAtMainStation

Definition at line 13727 of file PlayerEntity.m.

4498{
4499 [self setDockedStation:[UNIVERSE station]];
4500 if (_dockedStation != nil) [self setStatus:STATUS_DOCKED];
4501}
OOWeakReference * _dockedStation

◆ setDockedStation:

- (void) setDockedStation: (StationEntity *)  station

Definition at line 13727 of file PlayerEntity.m.

4510 :(StationEntity *)station
4511{
4512 [_dockedStation release];
4513 _dockedStation = [station weakRetain];
4514}

◆ setDockingClearanceStatus:

- (void) setDockingClearanceStatus: (OODockingClearanceStatus newValue

Definition at line 9242 of file PlayerEntity.m.

13170{
13173 {
13175 }
13177 {
13178 if ([[self primaryTarget] isStation])
13179 {
13180 targetDockStation = [self primaryTarget];
13181 }
13182 else
13183 {
13184 OOLog(@"player.badDockingTarget", @"Attempt to dock at %@.", [self primaryTarget]);
13187 }
13188 }
13189}
OODockingClearanceStatus
Definition OOTypes.h:167
@ DOCKING_CLEARANCE_STATUS_NONE
Definition OOTypes.h:168

Referenced by StationDockPlayer().

+ Here is the caller graph for this function:

◆ setDockTarget:

- (void) setDockTarget: (ShipEntity *)  entity

Definition at line 9242 of file PlayerEntity.m.

13052 :(ShipEntity *)entity
13053{
13054if ([entity isStation]) _dockTarget = [entity universalID];
13055else _dockTarget = NO_TARGET;
13056 //_dockTarget = [entity isStation] ? [entity universalID]: NO_TARGET;
13057}
@ NO_TARGET
Definition OOTypes.h:194
OOUniversalID universalID
Definition Entity.h:89
OOUniversalID _dockTarget

Referenced by PlayerSetEscapePodDestination().

+ Here is the caller graph for this function:

◆ setEquipScreenBackgroundDescriptor:

- (void) setEquipScreenBackgroundDescriptor: (NSDictionary *)  descriptor

Definition at line 9242 of file PlayerEntity.m.

12864{
12866 {
12867 [_equipScreenBackgroundDescriptor autorelease];
12868 _equipScreenBackgroundDescriptor = [descriptor copy];
12869 }
12870}

◆ setEscapePodRescueTime:

- (void) setEscapePodRescueTime: (double seconds

Definition at line 13727 of file PlayerEntity.m.

4916 :(double)seconds
4917{
4919}

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setExtraEquipmentFromFlags

- (void) setExtraEquipmentFromFlags
implementation

Provided by category PlayerEntity(OOPrivate).

◆ setExtraGuiScreenKeys:definition:

- (BOOL) setExtraGuiScreenKeys: (OOGUIScreenID gui
definition: (OOJSGuiScreenKeyDefinition *)  definition 

create the dictionary, if it doesn't already exist

Definition at line 9242 of file PlayerEntity.m.

13404{
13405 // process all the keys in the definition
13406 BOOL result = YES;
13408 NSString *key = nil;
13409 NSMutableDictionary *final = [[NSMutableDictionary alloc] init];
13410 NSDictionary *keys = [definition registerKeys];
13411 NSMutableArray *checklist = [[NSMutableArray alloc] init];
13412
13413 foreach (key, [keys allKeys])
13414 {
13415 NSArray *item = [self processKeyCode:[keys oo_arrayForKey:key]];
13416 [checklist addObject:item];
13417 [final setObject:item forKey:key];
13418 }
13419 [definition setRegisterKeys:[final copy]];
13420 [final release];
13421
13423 if (!extraGuiScreenKeys)
13424 {
13425 extraGuiScreenKeys = [[NSMutableDictionary alloc] init];
13426 }
13427
13429 {
13430 // brand new - just add
13431 newarray = [[NSMutableArray alloc] init];
13432 }
13433 else
13434 {
13435 newarray = [[extraGuiScreenKeys objectForKey:[NSString stringWithFormat:@"%d",gui]] mutableCopy];
13436 NSInteger i = [newarray count];
13437 NSInteger j = 0;
13439 while (i--)
13440 {
13441 def_existing = [newarray objectAtIndex:i];
13442 // if we find this name already in the array, remove it
13444 {
13445 [newarray removeObjectAtIndex:i];
13446 }
13447 else
13448 {
13449 // check whether any of those keycodes is already in use on this screen
13450 NSDictionary *keydefs = [def_existing registerKeys];
13451
13452 foreach (key, [keydefs allKeys])
13453 {
13454 j = [checklist count];
13455 while (j--)
13456 {
13458 {
13459 result = NO;
13460 OOLog(kOOLogException, @"***** Exception in setExtraGuiScreenKeys: %@ : %@ (%@)", @"invalid key settings", @"key already in use", key);
13461 }
13462 }
13463 }
13464 }
13465 }
13466 }
13467 [newarray addObject:definition];
13468 // only add the item if there were no errors
13469 if (result) [extraGuiScreenKeys setObject:[newarray mutableCopy] forKey:[NSString stringWithFormat:@"%d",gui]];
13470 [newarray release];
13471 return result;
13472}
void setRegisterKeys:(NSDictionary *registerKeys)

Referenced by GlobalSetExtraGuiScreenKeys().

+ Here is the caller graph for this function:

◆ setExtraMissionKeys:

- (void) setExtraMissionKeys: (NSDictionary *)  keys

Definition at line 9242 of file PlayerEntity.m.

13372 :(NSDictionary *)keys
13373{
13374 NSString *key = nil;
13375 NSMutableDictionary *final = [[NSMutableDictionary alloc] init];
13376 foreach (key, [keys allKeys])
13377 {
13378 [final setObject:[self processKeyCode:[keys oo_arrayForKey:key]] forKey:key];
13379 }
13380 extraMissionKeys = [final copy];
13381 [final release];
13382}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setFastEquipmentA:

- (void) setFastEquipmentA: (NSString *)  eqKey

Definition at line 13727 of file PlayerEntity.m.

8300 :(NSString *)eqKey
8301{
8302 [_fastEquipmentA release];
8303 _fastEquipmentA = [eqKey copy];
8304}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setFastEquipmentB:

- (void) setFastEquipmentB: (NSString *)  eqKey

Definition at line 13727 of file PlayerEntity.m.

8307 :(NSString *)eqKey
8308{
8309 [_fastEquipmentB release];
8310 _fastEquipmentB = [eqKey copy];
8311}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setForwardShieldLevel:

- (void) setForwardShieldLevel: (GLfloat level

Definition at line 13727 of file PlayerEntity.m.

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setForwardShieldRechargeRate:

- (void) setForwardShieldRechargeRate: (float new

Definition at line 13727 of file PlayerEntity.m.

4683 :(float)new
4684{
4686}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setFoundTarget:

- (void) setFoundTarget: (Entity *)  targetEntity
implementation

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

12255 :(Entity *) targetEntity
12256{
12257 /* Rare, but can happen, e.g. if a Q-mine goes off nearby during
12258 * the sequence */
12259 if ([self status] == STATUS_ESCAPE_SEQUENCE)
12260 {
12261 return;
12262 }
12263 [_foundTarget release];
12264 _foundTarget = [targetEntity weakRetain];
12265}
OOWeakReference * _foundTarget
Definition ShipEntity.h:440

◆ setFuelLeak:

- (void) setFuelLeak: (NSString *)  value

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2214 :(NSString *)value
2215{
2216 if (scriptTarget != self)
2217 {
2218 [scriptTarget setFuel:0];
2219 return;
2220 }
2221
2222 fuel_leak_rate = [value doubleValue];
2223 if (fuel_leak_rate > 0)
2224 {
2225 [self playFuelLeak];
2226 [UNIVERSE addMessage:DESC(@"danger-fuel-leak") forCount:6];
2227 OOLog(kOOLogNoteFuelLeak, @"%@", @"FUEL LEAK activated!");
2228 }
2229}
static NSString *const kOOLogNoteFuelLeak

◆ setFuelLeakRate:

- (void) setFuelLeakRate: (float value

Definition at line 13727 of file PlayerEntity.m.

5015 :(float)value
5016{
5017 fuel_leak_rate = fmax(value, 0.0f);
5018}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceBehaviour:

- (void) setGalacticHyperspaceBehaviour: (OOGalacticHyperspaceBehaviour galacticHyperspaceBehaviour

Definition at line 9242 of file PlayerEntity.m.

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceBehaviourTo:

- (void) setGalacticHyperspaceBehaviourTo: (NSString *)  galacticHyperspaceBehaviourString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2952 :(NSString *)galacticHyperspaceBehaviourString
2953{
2954 OOGalacticHyperspaceBehaviour ghBehaviour = OOGalacticHyperspaceBehaviourFromString(galacticHyperspaceBehaviourString);
2955 if (ghBehaviour == GALACTIC_HYPERSPACE_BEHAVIOUR_UNKNOWN)
2956 {
2957 OOLog(@"player.setGalacticHyperspaceBehaviour.invalidInput",
2958 @"setGalacticHyperspaceBehaviourTo: called with unknown behaviour %@.", galacticHyperspaceBehaviourString);
2959 }
2960 [self setGalacticHyperspaceBehaviour:ghBehaviour];
2961}
OOGalacticHyperspaceBehaviour OOGalacticHyperspaceBehaviourFromString(NSString *string) PURE_FUNC

◆ setGalacticHyperspaceFixedCoords:

- (void) setGalacticHyperspaceFixedCoords: (NSPoint point

Definition at line 9242 of file PlayerEntity.m.

12984 :(NSPoint)point
12985{
12986 return [self setGalacticHyperspaceFixedCoordsX:OOClamp_0_max_f(round(point.x), 255.0f) y:OOClamp_0_max_f(round(point.y), 255.0f)];
12987}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceFixedCoordsTo:

- (void) setGalacticHyperspaceFixedCoordsTo: (NSString *)  galacticHyperspaceFixedCoordsString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2964 :(NSString *)galacticHyperspaceFixedCoordsString
2965{
2966 NSArray *coord_vals = ScanTokensFromString(galacticHyperspaceFixedCoordsString);
2967 if ([coord_vals count] < 2) // Will be 0 if string is nil
2968 {
2969 OOLog(@"player.setGalacticHyperspaceFixedCoords.invalidInput", @"%@",
2970 @"setGalacticHyperspaceFixedCoords: called with bad specifier. Defaulting to Oolite standard.");
2971 galacticHyperspaceFixedCoords.x = galacticHyperspaceFixedCoords.y = 0x60;
2972 }
2973
2974 [self setGalacticHyperspaceFixedCoordsX:[coord_vals oo_unsignedCharAtIndex:0]
2975 y:[coord_vals oo_unsignedCharAtIndex:1]];
2976}

◆ setGalacticHyperspaceFixedCoordsX:y:

Definition at line 9242 of file PlayerEntity.m.

12990 :(unsigned char)x y:(unsigned char)y
12991{
12994}
NSPoint galacticHyperspaceFixedCoords

◆ setGalaxyCoordinates:

- (void) setGalaxyCoordinates: (NSPoint newPosition

Definition at line 13727 of file PlayerEntity.m.

◆ setGuiToChartScreenFrom:

- (void) setGuiToChartScreenFrom: (OOGUIScreenID oldScreen

Definition at line 13727 of file PlayerEntity.m.

8806{
8807 GuiDisplayGen *gui = [UNIVERSE gui];
8808
8810
8811 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
8812
8813 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
8814
8815 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
8816
8817 // GUI stuff
8818 {
8819 //[gui clearAndKeepBackground:!guiChanged];
8820 [gui setStarChartTitle];
8821 // refresh the short range chart cache, in case we've just loaded a save game with different local overrides, etc.
8822 [gui refreshStarChart];
8823 //[gui setText:targetSystemName forRow:19];
8824 // distance-f & est-travel-time-f are identical between short & long range charts in standard Oolite, however can be alterered separately via OXPs
8825 //[gui setText:OOExpandKey(@"short-range-chart-distance", distance) forRow:20];
8826 //NSString *travelTimeRow = @"";
8827 //if ([self hasHyperspaceMotor] && distance > 0.0 && distance * 10.0 <= fuel)
8828 //{
8829 // double time = estimatedTravelTime;
8830 // travelTimeRow = OOExpandKey(@"short-range-chart-est-travel-time", time);
8831 //}
8832 //[gui setText:travelTimeRow forRow:21];
8834 {
8835 NSString *displaySearchString = planetSearchString ? [planetSearchString capitalizedString] : (NSString *)@"";
8836 [gui setText:[NSString stringWithFormat:DESC(@"long-range-chart-find-planet-@"), displaySearchString] forRow:GUI_ROW_PLANET_FINDER];
8837 [gui setColor:[OOColor cyanColor] forRow:GUI_ROW_PLANET_FINDER];
8838 [gui setShowTextCursor:YES];
8839 [gui setCurrentRow:GUI_ROW_PLANET_FINDER];
8840 }
8841 else
8842 {
8843 [gui setShowTextCursor:NO];
8844 }
8845 }
8846 /* ends */
8847
8848 [self setShowDemoShips:NO];
8849 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
8850
8851 if (guiChanged)
8852 {
8853 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"overlay"];
8854
8855 [gui setBackgroundTextureKey:@"short_range_chart"];
8856 if (found_system_id >= 0)
8857 {
8858 [UNIVERSE findSystemCoordinatesWithPrefix:[[UNIVERSE getSystemName:found_system_id] lowercaseString] exactMatch:YES];
8859 }
8860 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
8861 }
8862}
BOOL setBackgroundTextureKey:(NSString *key)
BOOL setForegroundTextureKey:(NSString *key)
NSString * planetSearchString

◆ setGuiToConfirmClearScreen

- (void) setGuiToConfirmClearScreen

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

765{
766 GuiDisplayGen *gui=[UNIVERSE gui];
767 OOGUIScreenID oldScreen = gui_screen;
768
769 gui_screen = GUI_SCREEN_KEYBOARD_CONFIRMCLEAR;
770 BOOL guiChanged = (oldScreen != gui_screen);
771
772 [gui clear];
773 [gui setTitle:[NSString stringWithFormat:@"%@", DESC(@"oolite-keyconfig-clear-overrides-title")]];
774
775 [gui addLongText:[NSString stringWithFormat:@"%@", DESC(@"oolite-keyconfig-clear-overrides")]
776 startingAtRow:GUI_ROW_KC_CONFIRMCLEAR align:GUI_ALIGN_LEFT];
777
778 [gui setText:DESC(@"oolite-keyconfig-clear-yes") forRow: GUI_ROW_KC_CONFIRMCLEAR_YES align:GUI_ALIGN_CENTER];
779 [gui setKey:GUI_KEY_OK forRow:GUI_ROW_KC_CONFIRMCLEAR_YES];
780
781 [gui setText:DESC(@"oolite-keyconfig-clear-no") forRow:GUI_ROW_KC_CONFIRMCLEAR_NO align:GUI_ALIGN_CENTER];
782 [gui setKey:GUI_KEY_OK forRow:GUI_ROW_KC_CONFIRMCLEAR_NO];
783
784 [gui setSelectableRange:NSMakeRange(GUI_ROW_KC_CONFIRMCLEAR_YES, 2)];
785 [gui setSelectedRow:GUI_ROW_KC_CONFIRMCLEAR_NO];
786
787 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"paused_overlay"];
788 [gui setBackgroundTextureKey:@"keyboardsettings"];
789
790 [[UNIVERSE gameView] clearMouse];
791 [[UNIVERSE gameView] clearKeys];
792 if (guiChanged) [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
793}
void setTitle:(NSString *str)

◆ setGuiToDockingReportScreen

- (void) setGuiToDockingReportScreen

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

1369{
1370 GuiDisplayGen *gui = [UNIVERSE gui];
1371
1372 OOGUIScreenID oldScreen = gui_screen;
1373 gui_screen = GUI_SCREEN_REPORT;
1374 BOOL guiChanged = (oldScreen != gui_screen);
1375
1376 OOGUIRow i, text_row = 1;
1377
1378 [dockingReport setString:[dockingReport stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
1379
1380 // GUI stuff
1381 {
1382 [gui clearAndKeepBackground:!guiChanged];
1383 [gui setTitle:OOExpandKey(@"arrival-report-title")];
1384
1385 for (i=1;i<=18;i++) {
1386 [gui setColor:[gui colorFromSetting:kGuiDockingReportColor defaultValue:nil] forRow:21];
1387 }
1388
1389 // dockingReport might be a multi-line message
1390
1391 while (([dockingReport length] > 0)&&(text_row < 18))
1392 {
1393 if ([dockingReport rangeOfString:@"\n"].location != NSNotFound)
1394 {
1395 while (([dockingReport rangeOfString:@"\n"].location != NSNotFound)&&(text_row < 18))
1396 {
1397 NSUInteger line_break = [dockingReport rangeOfString:@"\n"].location;
1398 NSString* line = [dockingReport substringToIndex:line_break];
1399 [dockingReport deleteCharactersInRange: NSMakeRange( 0, line_break + 1)];
1400 text_row = [gui addLongText:line startingAtRow:text_row align:GUI_ALIGN_LEFT];
1401 }
1402 [dockingReport setString:[dockingReport stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
1403 }
1404 else
1405 {
1406 text_row = [gui addLongText:[NSString stringWithString:dockingReport] startingAtRow:text_row align:GUI_ALIGN_LEFT];
1407 [dockingReport setString:@""];
1408 }
1409 }
1410
1411 [gui setText:[NSString stringWithFormat:DESC_PLURAL(@"contracts-cash-@-load-d-of-d-passengers-d-of-d-berths", max_passengers), OOCredits(credits), current_cargo, [self maxAvailableCargoSpace], [passengers count], max_passengers] forRow: GUI_ROW_MARKET_CASH];
1412 [gui setColor:[gui colorFromSetting:kGuiDockingSummaryColor defaultValue:nil] forRow:GUI_ROW_MARKET_CASH];
1413
1414 [gui setText:DESC(@"press-space-commander") forRow:21 align:GUI_ALIGN_CENTER];
1415 [gui setColor:[gui colorFromSetting:kGuiDockingContinueColor defaultValue:nil] forRow:21];
1416 [gui setShowTextCursor:NO];
1417 }
1418 /* ends */
1419
1420 if (lastTextKey)
1421 {
1422 [lastTextKey release];
1423 lastTextKey = nil;
1424 }
1425
1426 [self setShowDemoShips:NO];
1427 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
1428
1429 if (guiChanged)
1430 {
1431 [gui setForegroundTextureKey:@"docked_overlay"]; // has to be docked!
1432
1433 NSDictionary *bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"report"];
1434 if (bgDescriptor == nil) bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status_docked"];
1435 if (bgDescriptor == nil) bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status"];
1436 [gui setBackgroundTextureDescriptor:bgDescriptor];
1437 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
1438 }
1439}
void clearAndKeepBackground:(BOOL keepBackground)
BOOL setBackgroundTextureDescriptor:(NSDictionary *descriptor)

◆ setGuiToEquipShipScreen:

- (void) setGuiToEquipShipScreen: (int skip

Definition at line 9242 of file PlayerEntity.m.

9687 :(int)skip
9688{
9689 [self setGuiToEquipShipScreen:skip selectingFacingFor:nil];
9690}

Referenced by activateSelectedInterface.

+ Here is the caller graph for this function:

◆ setGuiToEquipShipScreen:selectingFacingFor:

- (void) setGuiToEquipShipScreen: (int skip
selectingFacingFor: (NSString *)  eqKeyForSelectFacing 

Definition at line 9242 of file PlayerEntity.m.

9304{
9305 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9306
9307 missiles = [self countMissiles];
9308 OOEntityStatus searchStatus; // use STATUS_TEST, STATUS_DEAD & STATUS_ACTIVE
9309 NSString *showKey = nil;
9310 unsigned skip;
9311
9312 if (skipParam < 0)
9313 {
9314 skip = 0;
9316 }
9317 else
9318 {
9319 skip = skipParam;
9321 }
9322
9323 // don't show a "Back" item if we're only skipping one item - just show the item
9324 if (skip == 1)
9325 skip = 0;
9326
9327 double priceFactor = 1.0;
9328 OOTechLevelID techlevel = [[UNIVERSE currentSystemData] oo_intForKey:KEY_TECHLEVEL];
9329
9330 StationEntity *dockedStation = [self dockedStation];
9331 if (dockedStation)
9332 {
9333 priceFactor = [dockedStation equipmentPriceFactor];
9334 if ([dockedStation equivalentTechLevel] != NSNotFound)
9335 techlevel = [dockedStation equivalentTechLevel];
9336 }
9337
9338 // build an array of all equipment - and take away that which has been bought (or is not permitted)
9339 NSMutableArray *equipmentAllowed = [NSMutableArray array];
9340
9341 // find options that agree with this ship
9343 NSDictionary *shipyardInfo = [registry shipyardInfoForKey:[self shipDataKey]];
9344 NSMutableSet *options = [NSMutableSet setWithArray:[shipyardInfo oo_arrayForKey:KEY_OPTIONAL_EQUIPMENT]];
9345
9346 // add standard items too!
9347 [options addObjectsFromArray:[[shipyardInfo oo_dictionaryForKey:KEY_STANDARD_EQUIPMENT] oo_arrayForKey:KEY_EQUIPMENT_EXTRAS]];
9348
9349 unsigned i = 0;
9350 NSEnumerator *eqEnum = nil;
9352 unsigned available_facings = [shipyardInfo oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:[self weaponFacings]]; // use defaults explicitly
9353
9354
9355 if (eqKeyForSelectFacing != nil) // Weapons purchase subscreen.
9356 {
9357 skip = 1; // show the back button
9358 // The 3 lines below are needed by the present GUI. TODO:create a sane GUI. Kaks - 20090915 & 201005
9359 [equipmentAllowed addObject:eqKeyForSelectFacing];
9360 [equipmentAllowed addObject:eqKeyForSelectFacing];
9361 [equipmentAllowed addObject:eqKeyForSelectFacing];
9362 }
9363 else for (eqEnum = [OOEquipmentType equipmentEnumeratorOutfitting]; (eqType = [eqEnum nextObject]); i++)
9364 {
9365 NSString *eqKey = [eqType identifier];
9367
9368 // set initial availability to NO
9369 BOOL isOK = NO;
9370
9371 // check special availability
9372 if ([eqType isAvailableToAll]) [options addObject:eqKey];
9373
9374 // if you have a damaged system you can get it repaired at a tech level one less than that required to buy it
9375 if (minTechLevel != 0 && [self hasEquipmentItem:[eqType damagedIdentifier]]) minTechLevel--;
9376
9377 // reduce the minimum techlevel occasionally as a bonus..
9379 {
9380 unsigned day = i * 13 + (unsigned)floor([UNIVERSE getTime] / 86400.0);
9381 unsigned char dayRnd = (day & 0xff) ^ (unsigned char)system_id;
9383
9384 while (minTechLevel > 0 && minTechLevel > originalMinTechLevel - 3 && !(dayRnd & 7)) // bargain tech days every 1/8 days
9385 {
9386 dayRnd = dayRnd >> 2;
9387 minTechLevel--; // occasional bonus items according to TL
9388 }
9389 }
9390
9391 // check initial availability against options AND standard extras
9393 {
9394 isOK = YES;
9395 [options removeObject:eqKey];
9396 }
9397
9398 if (isOK)
9399 {
9400 if (techlevel < minTechLevel) isOK = NO;
9401 if (![self canAddEquipment:eqKey inContext:@"purchase"]) isOK = NO;
9402 if (available_facings == 0 && [eqType isPrimaryWeapon]) isOK = NO;
9403 if (isOK) [equipmentAllowed addObject:eqKey];
9404 }
9405
9406 if (searchStatus == STATUS_DEAD && isOK)
9407 {
9408 showKey = eqKey;
9410 }
9412 {
9413 if (isOK) showKey = eqKey;
9416 }
9417 }
9418 if (searchStatus != STATUS_TEST && showKey != nil)
9419 {
9420 [last_outfitting_key release];
9421 last_outfitting_key = [showKey copy];
9422 }
9423
9424 // GUI stuff
9425 {
9426 GuiDisplayGen *gui = [UNIVERSE gui];
9429 unsigned facing_count = 0;
9433
9435
9436 [gui clearAndKeepBackground:!guiChanged];
9437 [gui setTitle:DESC(@"equip-title")];
9438
9439 [gui setColor:[gui colorFromSetting:kGuiEquipmentCashColor defaultValue:nil] forRow: GUI_ROW_EQUIPMENT_CASH];
9440 [gui setText:OOExpandKey(@"equip-cash-value", credits) forRow:GUI_ROW_EQUIPMENT_CASH];
9441
9443 tab_stops[0] = 0;
9444 tab_stops[1] = -360;
9445 tab_stops[2] = -480;
9446 [gui overrideTabs:tab_stops from:kGuiEquipmentTabs length:3];
9447 [gui setTabStops:tab_stops];
9448
9449 unsigned n_rows = GUI_MAX_ROWS_EQUIPMENT;
9450 NSUInteger count = [equipmentAllowed count];
9451
9452 if (count > 0)
9453 {
9454 if (skip > 0) // lose the first row to Back <--
9455 {
9456 unsigned previous;
9457
9458 if (count <= n_rows || skip < n_rows)
9459 previous = 0; // single page
9460 else
9461 {
9462 previous = skip - (n_rows - 2); // multi-page.
9463 if (previous < 2)
9464 previous = 0; // if only one previous item, just show it
9465 }
9466
9468 {
9469 previous = 0;
9470 // keep weapon selected if we go back.
9471 [gui setKey:[NSString stringWithFormat:@"More:%d:%@", previous, eqKeyForSelectFacing] forRow:row];
9472 }
9473 else
9474 {
9475 [gui setKey:[NSString stringWithFormat:@"More:%d", previous] forRow:row];
9476 }
9477 [gui setColor:[gui colorFromSetting:kGuiEquipmentScrollColor defaultValue:[OOColor greenColor]] forRow:row];
9478 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @"", @" <-- ", nil] forRow:row];
9479 row++;
9480 }
9481
9482 for (i = skip; i < count && (row - start_row < (OOGUIRow)n_rows); i++)
9483 {
9484 NSString *eqKey = [equipmentAllowed oo_stringAtIndex:i];
9487 NSString *desc = [NSString stringWithFormat:@" %@ ", [eqInfo name]];
9489 double price;
9490
9491 OOColor *dispCol = [eqInfo displayColor];
9492 if (dispCol == nil) dispCol = [gui colorFromSetting:kGuiEquipmentOptionColor defaultValue:nil];
9493 [gui setColor:dispCol forRow:row];
9494
9495 if ([eqKey isEqual:@"EQ_FUEL"])
9496 {
9498 }
9499 else if ([eqKey isEqualToString:@"EQ_RENOVATION"])
9500 {
9501 price = [self renovationCosts];
9502 [gui setColor:[gui colorFromSetting:kGuiEquipmentRepairColor defaultValue:[OOColor orangeColor]] forRow:row];
9503 }
9504 else
9505 {
9506 price = pricePerUnit;
9507 }
9508
9509 price = [self adjustPriceByScriptForEqKey:eqKey withCurrent:price];
9510
9511 price *= priceFactor; // increased prices at some stations
9512
9513 NSUInteger installTime = [eqInfo installTime];
9514 if (installTime == 0)
9515 {
9516 installTime = 600 + price;
9517 }
9518 // is this item damaged?
9520 {
9521 desc = [NSString stringWithFormat:DESC(@"equip-repair-@"), desc];
9522 price /= 2.0;
9523 installTime = [eqInfo repairTime];
9524 if (installTime == 0)
9525 {
9526 installTime = 600 + price;
9527 }
9528 [gui setColor:[gui colorFromSetting:kGuiEquipmentRepairColor defaultValue:[OOColor orangeColor]] forRow:row];
9529
9530 }
9531
9532 NSString *timeString = [UNIVERSE shortTimeDescription:installTime];
9533 NSString *priceString = [NSString stringWithFormat:@" %@ ", OOCredits(price)];
9534
9536 {
9537 // Weapons purchase subscreen.
9538 while (facing_count < 5)
9539 {
9541 switch (facing_count)
9542 {
9543 case 0:
9544 break;
9545
9546 case 1:
9550 if (_multiplyWeapons)
9551 {
9552 multiplier = [forwardWeaponOffset count];
9553 }
9554 break;
9555
9556 case 2:
9560 if (_multiplyWeapons)
9561 {
9562 multiplier = [aftWeaponOffset count];
9563 }
9564 break;
9565
9566 case 3:
9570 if (_multiplyWeapons)
9571 {
9572 multiplier = [portWeaponOffset count];
9573 }
9574 break;
9575
9576 case 4:
9580 if (_multiplyWeapons)
9581 {
9582 multiplier = [starboardWeaponOffset count];
9583 }
9584 break;
9585 }
9586
9587 if(weaponMounted)
9588 {
9589 [gui setColor:[gui colorFromSetting:kGuiEquipmentLaserFittedColor defaultValue:[OOColor colorWithRed:0.0f green:0.6f blue:0.0f alpha:1.0f]] forRow:row];
9590 }
9591 else
9592 {
9593 [gui setColor:[gui colorFromSetting:kGuiEquipmentLaserColor defaultValue:[OOColor greenColor]] forRow:row];
9594 }
9595 if (displayRow) // Always true for the first pass. The first pass is used to display the name of the weapon being purchased.
9596 {
9597
9598 priceString = [NSString stringWithFormat:@" %@ ", OOCredits(price*multiplier)];
9599
9600 [gui setKey:eqKey forRow:row];
9601 [gui setArray:[NSArray arrayWithObjects:desc, (facing_count > 0 ? priceString : (NSString *)@""), timeString, nil] forRow:row];
9602 row++;
9603 }
9604 facing_count++;
9605 }
9606 }
9607 else
9608 {
9609 // Normal equipment list.
9610 [gui setKey:eqKey forRow:row];
9611 // check if the hidevalues property has been set
9612 if (![eqInfo hideValues])
9613 {
9614 [gui setArray:[NSArray arrayWithObjects:desc, priceString, timeString, nil] forRow:row];
9615 }
9616 else
9617 {
9618 // if so, only output the description
9619 [gui setArray:[NSArray arrayWithObjects:desc, nil] forRow:row];
9620 }
9621 row++;
9622 }
9623 }
9624
9625 if (i < count)
9626 {
9627 // just overwrite the last item :-)
9628 [gui setColor:[gui colorFromSetting:kGuiEquipmentScrollColor defaultValue:[OOColor greenColor]] forRow:row-1];
9629 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @"", @" --> ", nil] forRow:row - 1];
9630 [gui setKey:[NSString stringWithFormat:@"More:%d", i - 1] forRow:row - 1];
9631 }
9632
9633 [gui setSelectableRange:NSMakeRange(start_row,row - start_row)];
9634
9635 if ([gui selectedRow] != start_row)
9636 [gui setSelectedRow:start_row];
9637
9639 {
9640 [gui setSelectedRow:start_row + 1];
9641 [self showInformationForSelectedUpgradeWithFormatString:DESC(@"@-select-where-to-install")];
9642 }
9643 else
9644 {
9645 [self showInformationForSelectedUpgrade];
9646 }
9647 }
9648 else
9649 {
9650 [gui setText:DESC(@"equip-no-equipment-available-for-purchase") forRow:GUI_ROW_NO_SHIPS align:GUI_ALIGN_CENTER];
9651 [gui setColor:[gui colorFromSetting:kGuiEquipmentUnavailableColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_NO_SHIPS];
9652
9653 [gui setSelectableRange:NSMakeRange(0,0)];
9654 [gui setNoSelectedRow];
9655 [self showInformationForSelectedUpgrade];
9656 }
9657
9658 [gui setShowTextCursor:NO];
9659
9660 // TODO: split the mount_weapon sub-screen into a separate screen, and use it for pylon mounted wepons as well?
9661 if (guiChanged)
9662 {
9663 [gui setForegroundTextureKey:@"docked_overlay"];
9664 NSDictionary *background = [UNIVERSE screenTextureDescriptorForKey:@"equip_ship"];
9665 [self setEquipScreenBackgroundDescriptor:background];
9666 [gui setBackgroundTextureDescriptor:background];
9667 }
9668 else if (eqKeyForSelectFacing != nil) // weapon purchase
9669 {
9670 NSDictionary *bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"mount_weapon"];
9671 if (bgDescriptor != nil) [gui setBackgroundTextureDescriptor:bgDescriptor];
9672 }
9673 else // Returning from a weapon purchase. (Also called, redundantly, when paging)
9674 {
9675 [gui setBackgroundTextureDescriptor:[self equipScreenBackgroundDescriptor]];
9676 }
9677 }
9678 /* ends */
9679
9681
9682 [self setShowDemoShips:NO];
9683 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9684}
void overrideTabs:from:length:(OOGUITabSettings stops,[from] NSString *setting,[length] NSUInteger len)
OOColor * colorWithRed:green:blue:alpha:(float red,[green] float green,[blue] float blue,[alpha] float alpha)
Definition OOColor.m:95
OOTechLevelID effectiveTechLevel()
OOCreditsQuantity price()
float equipmentPriceFactor

◆ setGuiToGameOptionsScreen

- (void) setGuiToGameOptionsScreen

Definition at line 8865 of file PlayerEntity.m.

8874{
8875 MyOpenGLView *gameView = [UNIVERSE gameView];
8876
8877 [[UNIVERSE gameView] clearMouse];
8878 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
8879
8881
8882 // GUI stuff
8883 {
8884 #define OO_SETACCESSCONDITIONFORROW(condition, row) \
8885 do { \
8886 if ((condition)) \
8887 { \
8888 [gui setKey:GUI_KEY_OK forRow:(row)]; \
8889 } \
8890 else \
8891 { \
8892 [gui setColor:[OOColor grayColor] forRow:(row)]; \
8893 } \
8894 } while(0)
8895 BOOL startingGame = [self status] == STATUS_START_GAME;
8896 GuiDisplayGen* gui = [UNIVERSE gui];
8897 GUI_ROW_INIT(gui);
8898
8899 int first_sel_row = GUI_FIRST_ROW(GAME)-4; // repositioned menu
8900
8901 [gui clear];
8902 [gui setTitle:[NSString stringWithFormat:DESC(@"status-commander-@"), [self commanderName]]]; // Same title as status screen.
8903
8904#if OO_RESOLUTION_OPTION
8905 GameController *controller = [UNIVERSE gameController];
8906
8909 {
8910 OOLogWARN(@"display.currentMode.notFound", @"%@", @"couldn't find current fullscreen setting, switching to default.");
8911 displayModeIndex = 0;
8912 }
8913
8914 NSArray *modeList = [controller displayModes];
8916 if ([modeList count])
8917 {
8918 mode = [modeList objectAtIndex:displayModeIndex];
8919 }
8920 if (mode == nil) return; // Got a better idea?
8921
8922 unsigned modeWidth = [mode oo_unsignedIntForKey:kOODisplayWidth];
8923 unsigned modeHeight = [mode oo_unsignedIntForKey:kOODisplayHeight];
8924 float modeRefresh = [mode oo_floatForKey:kOODisplayRefreshRate];
8925
8927#if OOLITE_WINDOWS
8929 {
8930 MONITORINFOEX mInfo = [gameView currentMonitorInfo];
8931 modeWidth = mInfo.rcMonitor.right - mInfo.rcMonitor.left;
8932 modeHeight = mInfo.rcMonitor.bottom - mInfo.rcMonitor.top;
8933 }
8934#endif
8935
8936 NSString *displayModeString = [self screenModeStringForWidth:modeWidth height:modeHeight refreshRate:modeRefresh];
8937
8938 [gui setText:displayModeString forRow:GUI_ROW(GAME,DISPLAY) align:GUI_ALIGN_CENTER];
8940 {
8941 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,DISPLAY)];
8942 }
8943 else
8944 {
8945 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(GAME,DISPLAY)];
8946 }
8947#endif // OO_RESOLUTIOM_OPTION
8948
8949
8950#if OOLITE_WINDOWS
8951 if ([gameView hdrOutput])
8952 {
8953 NSArray *brightnesses = [[UNIVERSE descriptions] oo_arrayForKey: @"hdr_maxBrightness_array"];
8954 int brightnessIdx = [brightnesses indexOfObject:[NSString stringWithFormat:@"%d", (int)[gameView hdrMaxBrightness]]];
8955
8957 {
8958 OOLogWARN(@"hdr.maxBrightness.notFound", @"%@", @"couldn't find current max brightness setting, switching to 400 nits.");
8959 brightnessIdx = 0;
8960 }
8961
8962 int brightnessValue = [brightnesses oo_intAtIndex:brightnessIdx];
8963 NSString *maxBrightnessString = OOExpandKey(@"gameoptions-hdr-maxbrightness", brightnessValue);
8964
8965 [gui setText:maxBrightnessString forRow:GUI_ROW(GAME,HDRMAXBRIGHTNESS) align:GUI_ALIGN_CENTER];
8966 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,HDRMAXBRIGHTNESS)];
8967 }
8968#endif
8969
8970
8971 if ([UNIVERSE autoSave])
8972 [gui setText:DESC(@"gameoptions-autosave-yes") forRow:GUI_ROW(GAME,AUTOSAVE) align:GUI_ALIGN_CENTER];
8973 else
8974 [gui setText:DESC(@"gameoptions-autosave-no") forRow:GUI_ROW(GAME,AUTOSAVE) align:GUI_ALIGN_CENTER];
8975 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,AUTOSAVE)];
8976
8977 // volume control
8978 if ([OOSound respondsToSelector:@selector(masterVolume)] && [OOSound isSoundOK])
8979 {
8980 double volume = 100.0 * [OOSound masterVolume];
8981 int vol = (volume / 5.0 + 0.5); // avoid rounding errors
8982 NSString* soundVolumeWordDesc = DESC(@"gameoptions-sound-volume");
8983 if (vol > 0)
8984 [gui setText:[NSString stringWithFormat:@"%@%@ ", soundVolumeWordDesc, SliderString(vol)] forRow:GUI_ROW(GAME,VOLUME) align:GUI_ALIGN_CENTER];
8985 else
8986 [gui setText:DESC(@"gameoptions-sound-volume-mute") forRow:GUI_ROW(GAME,VOLUME) align:GUI_ALIGN_CENTER];
8987 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,VOLUME)];
8988 }
8989 else
8990 {
8991 [gui setText:DESC(@"gameoptions-volume-external-only") forRow:GUI_ROW(GAME,VOLUME) align:GUI_ALIGN_CENTER];
8992 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(GAME,VOLUME)];
8993 }
8994
8995
8996 // field of view control
8997 float fov = [gameView fov:NO];
8998 int fovTicks = (int)((fov - MIN_FOV_DEG) * 20 / (MAX_FOV_DEG - MIN_FOV_DEG));
8999 NSString* fovWordDesc = DESC(@"gameoptions-fov-value");
9000 [gui setText:[NSString stringWithFormat:@"%@%@ (%d%c) ", fovWordDesc, SliderString(fovTicks), (int)fov, 176 /*176 is the degrees symbol Unicode code point*/] forRow:GUI_ROW(GAME,FOV) align:GUI_ALIGN_CENTER];
9001 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,FOV)];
9002
9003 // color blind mode
9004 int colorblindMode = [UNIVERSE colorblindMode];
9005 NSString *colorblindModeDesc = [[[UNIVERSE descriptions] oo_arrayForKey: @"colorblind_mode"] oo_stringAtIndex:[UNIVERSE useShaders] ? colorblindMode : 0];
9006 NSString *colorblindModeMsg = OOExpandKey(@"gameoptions-colorblind-mode", colorblindModeDesc);
9007 [gui setText:colorblindModeMsg forRow:GUI_ROW(GAME,COLORBLINDMODE) align:GUI_ALIGN_CENTER];
9008 if ([UNIVERSE useShaders])
9009 {
9010 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,COLORBLINDMODE)];
9011 }
9012 else
9013 {
9014 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(GAME,COLORBLINDMODE)];
9015 }
9016
9017#if OOLITE_SPEECH_SYNTH
9018 // Speech control
9019 switch (isSpeechOn)
9020 {
9022 [gui setText:DESC(@"gameoptions-spoken-messages-no") forRow:GUI_ROW(GAME,SPEECH) align:GUI_ALIGN_CENTER];
9023 break;
9025 [gui setText:DESC(@"gameoptions-spoken-messages-comms") forRow:GUI_ROW(GAME,SPEECH) align:GUI_ALIGN_CENTER];
9026 break;
9028 [gui setText:DESC(@"gameoptions-spoken-messages-yes") forRow:GUI_ROW(GAME,SPEECH) align:GUI_ALIGN_CENTER];
9029 break;
9030 }
9032
9033#if OOLITE_ESPEAK
9034 {
9035 NSString *voiceName = [UNIVERSE voiceName:voice_no];
9036 NSString *message = OOExpandKey(@"gameoptions-voice-name", voiceName);
9037 [gui setText:message forRow:GUI_ROW(GAME,SPEECH_LANGUAGE) align:GUI_ALIGN_CENTER];
9039
9040 message = [NSString stringWithFormat:@"%@", DESC(voice_gender_m ? @"gameoptions-voice-M" : @"gameoptions-voice-F")];
9041 [gui setText:message forRow:GUI_ROW(GAME,SPEECH_GENDER) align:GUI_ALIGN_CENTER];
9043 }
9044#endif
9045#endif
9046#if !OOLITE_MAC_OS_X
9047 // window/fullscreen
9048 if([gameView inFullScreenMode])
9049 {
9050 [gui setText:DESC(@"gameoptions-play-in-window") forRow:GUI_ROW(GAME,DISPLAYSTYLE) align:GUI_ALIGN_CENTER];
9051 }
9052 else
9053 {
9054 [gui setText:DESC(@"gameoptions-play-in-fullscreen") forRow:GUI_ROW(GAME,DISPLAYSTYLE) align:GUI_ALIGN_CENTER];
9055 }
9056 [gui setKey: GUI_KEY_OK forRow: GUI_ROW(GAME,DISPLAYSTYLE)];
9057#endif
9058
9059 [gui setText:DESC(@"gameoptions-joystick-configuration") forRow: GUI_ROW(GAME,STICKMAPPER) align: GUI_ALIGN_CENTER];
9060 OO_SETACCESSCONDITIONFORROW([[OOJoystickManager sharedStickHandler] joystickCount], GUI_ROW(GAME,STICKMAPPER));
9061
9062 [gui setText:DESC(@"gameoptions-keyboard-configuration") forRow: GUI_ROW(GAME,KEYMAPPER) align: GUI_ALIGN_CENTER];
9063 [gui setKey: GUI_KEY_OK forRow: GUI_ROW(GAME,KEYMAPPER)];
9064
9065
9066 NSString *musicMode = [UNIVERSE descriptionForArrayKey:@"music-mode" index:[[OOMusicController sharedController] mode]];
9067 NSString *message = OOExpandKey(@"gameoptions-music-mode", musicMode);
9068 [gui setText:message forRow:GUI_ROW(GAME,MUSIC) align:GUI_ALIGN_CENTER];
9069 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,MUSIC)];
9070
9071 if (![gameView hdrOutput])
9072 {
9073 if ([UNIVERSE wireframeGraphics])
9074 [gui setText:DESC(@"gameoptions-wireframe-graphics-yes") forRow:GUI_ROW(GAME,WIREFRAMEGRAPHICS) align:GUI_ALIGN_CENTER];
9075 else
9076 [gui setText:DESC(@"gameoptions-wireframe-graphics-no") forRow:GUI_ROW(GAME,WIREFRAMEGRAPHICS) align:GUI_ALIGN_CENTER];
9077 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,WIREFRAMEGRAPHICS)];
9078 }
9079#if OOLITE_WINDOWS
9080 else
9081 {
9082 float paperWhite = [gameView hdrPaperWhiteBrightness];
9084 NSString* paperWhiteWordDesc = DESC(@"gameoptions-hdr-paperwhite");
9085 [gui setText:[NSString stringWithFormat:@"%@%@ (%d) ", paperWhiteWordDesc, SliderString(paperWhiteTicks), (int)paperWhite] forRow:GUI_ROW(GAME,HDRPAPERWHITE) align:GUI_ALIGN_CENTER];
9086 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,HDRPAPERWHITE)];
9087 }
9088#endif
9089
9090#if !NEW_PLANETS
9091 if ([UNIVERSE doProcedurallyTexturedPlanets])
9092 [gui setText:DESC(@"gameoptions-procedurally-textured-planets-yes") forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS) align:GUI_ALIGN_CENTER];
9093 else
9094 [gui setText:DESC(@"gameoptions-procedurally-textured-planets-no") forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS) align:GUI_ALIGN_CENTER];
9095 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS)];
9096#endif
9097
9098 OOGraphicsDetail detailLevel = [UNIVERSE detailLevel];
9099 NSString *shaderEffectsOptionsString = OOExpand(@"gameoptions-detaillevel-[detailLevel]", detailLevel);
9100 [gui setText:OOExpandKey(shaderEffectsOptionsString) forRow:GUI_ROW(GAME,SHADEREFFECTS) align:GUI_ALIGN_CENTER];
9101 if (![[OOOpenGLExtensionManager sharedManager] shadersForceDisabled])
9102 {
9103 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,SHADEREFFECTS)];
9104 }
9105 else
9106 {
9107 // deactivate this option if shaders have been disabled from the commend line
9108 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(GAME,SHADEREFFECTS)];
9109 }
9110
9111
9112 if ([UNIVERSE dockingClearanceProtocolActive])
9113 {
9114 [gui setText:DESC(@"gameoptions-docking-clearance-yes") forRow:GUI_ROW(GAME,DOCKINGCLEARANCE) align:GUI_ALIGN_CENTER];
9115 }
9116 else
9117 {
9118 [gui setText:DESC(@"gameoptions-docking-clearance-no") forRow:GUI_ROW(GAME,DOCKINGCLEARANCE) align:GUI_ALIGN_CENTER];
9119 }
9121
9122 // Back menu option
9123 [gui setText:DESC(@"gui-back") forRow:GUI_ROW(GAME,BACK) align:GUI_ALIGN_CENTER];
9124 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(GAME,BACK)];
9125
9126 [gui setSelectableRange:NSMakeRange(first_sel_row, GUI_ROW_GAMEOPTIONS_END_OF_LIST)];
9127 [gui setSelectedRow: first_sel_row];
9128
9129 [gui setShowTextCursor:NO];
9130 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"paused_overlay"];
9131 [gui setBackgroundTextureKey:@"settings"];
9132 }
9133 /* ends */
9134
9135 [self setShowDemoShips:NO];
9136 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9137}
#define GUI_FIRST_ROW(GROUP)
#define OO_SETACCESSCONDITIONFORROW(condition, row)
BOOL isRunningOnPrimaryDisplayDevice()
OOColor * grayColor()
Definition OOColor.m:262
float volume()

◆ setGuiToInterfacesScreen:

- (void) setGuiToInterfacesScreen: (int skip

Definition at line 9242 of file PlayerEntity.m.

9735 :(int)skip
9736{
9737 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9739 {
9740 [self noteGUIWillChangeTo:GUI_SCREEN_INTERFACES];
9741 }
9742
9743 // build an array of available interfaces
9744 NSDictionary *interfaces = [[self dockedStation] localInterfaces];
9745 NSArray *interfaceKeys = [interfaces keysSortedByValueUsingSelector:@selector(interfaceCompare:)]; // sorts by category, then title
9746 int i;
9747
9749
9750 // GUI stuff
9751 {
9752 GuiDisplayGen *gui = [UNIVERSE gui];
9756
9757 [gui clearAndKeepBackground:!guiChanged];
9758 [gui setTitle:DESC(@"interfaces-title")];
9759
9761
9763 tab_stops[0] = 0;
9764 tab_stops[1] = -480;
9765 [gui overrideTabs:tab_stops from:kGuiInterfaceTabs length:2];
9766 [gui setTabStops:tab_stops];
9767
9768 unsigned n_rows = GUI_MAX_ROWS_INTERFACES;
9769 NSUInteger count = [interfaceKeys count];
9770
9771 if (count > 0)
9772 {
9773 if (skip > 0) // lose the first row to Back <--
9774 {
9775 unsigned previous;
9776
9777 if (count <= n_rows || skip < (NSInteger)n_rows)
9778 {
9779 previous = 0; // single page
9780 }
9781 else
9782 {
9783 previous = skip - (n_rows - 2); // multi-page.
9784 if (previous < 2)
9785 {
9786 previous = 0; // if only one previous item, just show it
9787 }
9788 }
9789
9790 [gui setKey:[NSString stringWithFormat:@"More:%d", previous] forRow:row];
9791 [gui setColor:[gui colorFromSetting:kGuiInterfaceScrollColor defaultValue:[OOColor greenColor]] forRow:row];
9792 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:row];
9793 row++;
9794 }
9795
9796 for (i = skip; i < (NSInteger)count && (row - start_row < (OOGUIRow)n_rows); i++)
9797 {
9798 NSString *interfaceKey = [interfaceKeys objectAtIndex:i];
9799 OOJSInterfaceDefinition *definition = [interfaces objectForKey:interfaceKey];
9800
9801 [gui setColor:[gui colorFromSetting:kGuiInterfaceEntryColor defaultValue:nil] forRow:row];
9802 [gui setKey:interfaceKey forRow:row];
9803 [gui setArray:[NSArray arrayWithObjects:[definition title],[definition category], nil] forRow:row];
9804
9805 row++;
9806 }
9807
9808 if (i < (NSInteger)count)
9809 {
9810 // just overwrite the last item :-)
9811 [gui setColor:[gui colorFromSetting:kGuiInterfaceScrollColor defaultValue:[OOColor greenColor]] forRow:row - 1];
9812 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil] forRow:row - 1];
9813 [gui setKey:[NSString stringWithFormat:@"More:%d", i - 1] forRow:row - 1];
9814 }
9815
9816 [gui setSelectableRange:NSMakeRange(start_row,row - start_row)];
9817
9818 if ([gui selectedRow] != start_row)
9819 {
9820 [gui setSelectedRow:start_row];
9821 }
9822
9823 [self showInformationForSelectedInterface];
9824 }
9825 else
9826 {
9827 [gui setText:DESC(@"interfaces-no-interfaces-available-for-use") forRow:GUI_ROW_NO_INTERFACES align:GUI_ALIGN_LEFT];
9828 [gui setColor:[gui colorFromSetting:kGuiInterfaceNoneColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_NO_INTERFACES];
9829
9830 [gui setSelectableRange:NSMakeRange(0,0)];
9831 [gui setNoSelectedRow];
9832
9833 }
9834
9835 [gui setShowTextCursor:NO];
9836
9837 NSString *desc = [NSString stringWithFormat:DESC(@"interfaces-for-ship-@-and-station-@"), [self displayName], [[self dockedStation] displayName]];
9838 [gui setColor:[gui colorFromSetting:kGuiInterfaceHeadingColor defaultValue:nil] forRow:GUI_ROW_INTERFACES_HEADING];
9839 [gui setText:desc forRow:GUI_ROW_INTERFACES_HEADING];
9840
9841
9842 if (guiChanged)
9843 {
9844 [gui setForegroundTextureKey:@"docked_overlay"];
9845 NSDictionary *background = [UNIVERSE screenTextureDescriptorForKey:@"interfaces"];
9846 [gui setBackgroundTextureDescriptor:background];
9847 }
9848 }
9849 /* ends */
9850
9851 [self setShowDemoShips:NO];
9852
9853 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
9854
9855 [self setShowDemoShips:NO];
9856 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9857
9858}

◆ setGuiToKeyboardLayoutScreen:

- (void) setGuiToKeyboardLayoutScreen: (unsigned skip

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1153 :(unsigned)skip
1154{
1155 [self setGuiToKeyboardLayoutScreen:skip resetCurrentRow:NO];
1156}

◆ setGuiToKeyboardLayoutScreen:resetCurrentRow:

- (void) setGuiToKeyboardLayoutScreen: (unsigned skip
resetCurrentRow: (BOOL resetCurrentRow 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1159 :(unsigned)skip resetCurrentRow:(BOOL)resetCurrentRow
1160{
1161 GuiDisplayGen *gui = [UNIVERSE gui];
1162 MyOpenGLView *gameView = [UNIVERSE gameView];
1163 OOGUIScreenID oldScreen = gui_screen;
1164 OOGUITabStop tabStop[GUI_MAX_COLUMNS];
1165 tabStop[0] = 10;
1166 tabStop[1] = 290;
1167 [gui setTabStops:tabStop];
1168
1169 gui_screen = GUI_SCREEN_KEYBOARD_LAYOUT;
1170 BOOL guiChanged = (oldScreen != gui_screen);
1171
1172 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
1173
1174 [gui clear];
1175 [gui setTitle:[NSString stringWithFormat:@"Select Keyboard Layout"]];
1176
1177 [self displayKeyboardLayoutList:gui skip:skip];
1178
1179 [gui setArray:[NSArray arrayWithObject:DESC(@"oolite-keyconfig-keyboard-info")] forRow:GUI_ROW_KC_INSTRUCT];
1180
1181 [gui setSelectedRow:kbd_row];
1182
1183 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"paused_overlay"];
1184 [gui setBackgroundTextureKey:@"keyboardsettings"];
1185
1186 [gameView clearMouse];
1187 [gameView clearKeys];
1188 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
1189
1190 if (guiChanged) [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
1191}
NSInteger OOGUITabStop

◆ setGuiToKeyConfigEntryScreen

- (void) setGuiToKeyConfigEntryScreen

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

594{
595 GuiDisplayGen *gui = [UNIVERSE gui];
596 MyOpenGLView *gameView = [UNIVERSE gameView];
597 OOGUIScreenID oldScreen = gui_screen;
598 gui_screen = GUI_SCREEN_KEYBOARD_ENTRY;
599 BOOL guiChanged = (oldScreen != gui_screen);
600
601 // make sure the index we're looking for exists
602 if ([key_list count] < (key_index + 1))
603 {
604 // add the missing element to the array
605 NSMutableDictionary *key1 = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"", @"key", [NSNumber numberWithBool:NO], @"shift", [NSNumber numberWithBool:NO], @"mod1", [NSNumber numberWithBool:NO], @"mod2", nil];
606 [key_list addObject:key1];
607 [key1 release];
608 }
609 NSDictionary *def = [key_list objectAtIndex:key_index];
610 NSString *key = [def objectForKey:@"key"];
611 //if ([key isEqualToString:@"(not set)"]) key = @"";
612 OOKeyCode k_int = (OOKeyCode)[key integerValue];
613 [gameView resetTypedString];
614 [gameView setTypedString:(k_int != 0 ? [self keyCodeDescriptionShort:k_int] : @"")];
615 [gameView setStringInput:gvStringInputAll];
616
617 [gui clear];
618 [gui setTitle:[NSString stringWithFormat:@"%@", DESC(@"oolite-keyconfig-update-entry-title")]];
619
620 NSUInteger end_row = 21;
621 if ([[self hud] allowBigGui])
622 {
623 end_row = 27;
624 }
625
626 [gui addLongText:DESC(@"oolite-keyconfig-update-entry-info") startingAtRow:GUI_ROW_KC_ENTRY_INFO align:GUI_ALIGN_LEFT];
627
628 [gui setText:[NSString stringWithFormat:DESC(@"Key: %@"), [gameView typedString]] forRow:end_row align:GUI_ALIGN_LEFT];
629 [gui setColor:[OOColor cyanColor] forRow:end_row];
630 [gui setSelectableRange:NSMakeRange(0,0)];
631
632 [gui setShowTextCursor:YES];
633 [gui setCurrentRow:end_row];
634
635 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"paused_overlay"];
636 [gui setBackgroundTextureKey:@"keyboardsettings"];
637 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
638
639 [gameView clearMouse];
640 [gameView clearKeys];
641 if (guiChanged) [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
642}

◆ setGuiToKeyConfigScreen

- (void) setGuiToKeyConfigScreen

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

401{
402 [self setGuiToKeyConfigScreen:NO];
403}

◆ setGuiToKeyConfigScreen:

- (void) setGuiToKeyConfigScreen: (BOOL resetSelectedRow

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

406 :(BOOL)resetSelectedRow
407{
408 NSUInteger i = 0;
409 GuiDisplayGen *gui=[UNIVERSE gui];
410 OOGUIScreenID oldScreen = gui_screen;
411 OOGUITabStop tabStop[GUI_MAX_COLUMNS];
412 tabStop[0] = 10;
413 tabStop[1] = 290;
414 [gui setTabStops:tabStop];
415
416 gui_screen = GUI_SCREEN_KEYBOARD_CONFIG;
417 BOOL guiChanged = (oldScreen != gui_screen);
418 [gui clear];
419 [gui setTitle:[NSString stringWithFormat:@"%@", DESC(@"oolite-keyconfig-update-title")]];
420
421 [gui setArray: [NSArray arrayWithObjects:
422 DESC(@"oolite-keyconfig-update-function"), [selected_entry objectForKey: KEY_KC_GUIDESC], nil]
423 forRow: GUI_ROW_KC_UPDATE_FUNCNAME];
424 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_KC_UPDATE_FUNCNAME];
425
426 NSString *keystring = nil;
427 NSString *keyshift = nil;
428 NSString *keymod1 = nil;
429 NSString *keymod2 = nil;
430
431 NSDictionary *def = nil;
432 NSString *key = nil;
433 OOKeyCode k_int;
434
435 // get each key for the first two item in the selected entry
436 for (i = 0; i <= 1; i++)
437 {
438 keystring = DESC(@"oolite-keycode-unset");
439 keyshift = DESC(@"oolite-keyconfig-modkey-off");
440 keymod1 = DESC(@"oolite-keyconfig-modkey-off");
441 keymod2 = DESC(@"oolite-keyconfig-modkey-off");
442
443 if ([key_list count] > i)
444 {
445 def = [key_list objectAtIndex:i];
446 key = [def objectForKey:@"key"];
447 k_int = (OOKeyCode)[key integerValue];
448 if (k_int > 0)
449 {
450 keystring = [self keyCodeDescription:k_int];
451 if ([[def objectForKey:@"shift"] boolValue] == YES) keyshift = DESC(@"oolite-keyconfig-modkey-on");
452 if ([[def objectForKey:@"mod1"] boolValue] == YES) keymod1 = DESC(@"oolite-keyconfig-modkey-on");
453 if ([[def objectForKey:@"mod2"] boolValue] == YES) keymod2 = DESC(@"oolite-keyconfig-modkey-on");
454 }
455 }
456
457 [self outputKeyDefinition:keystring shift:keyshift mod1:keymod1 mod2:keymod2 skiprows:(i * 5)];
458 }
459
460 NSString *helper = DESC(@"oolite-keyconfig-update-helper");
461 if ([nav_keys containsObject:[selected_entry objectForKey: KEY_KC_DEFINITION]])
462 helper = [NSString stringWithFormat:@"%@ %@", helper, DESC(@"oolite-keyconfig-update-navkeys")];
463 if ([camera_keys containsObject:[selected_entry objectForKey: KEY_KC_DEFINITION]])
464 helper = [NSString stringWithFormat:@"%@ %@", helper, DESC(@"oolite-keyconfig-update-camkeys")];
465 [gui addLongText:helper startingAtRow:GUI_ROW_KC_UPDATE_INFO align:GUI_ALIGN_LEFT];
466
467 [gui setText:@"" forRow:GUI_ROW_KC_VALIDATION];
468
469 [gui setText:DESC(@"oolite-keyconfig-update-save") forRow:GUI_ROW_KC_SAVE align:GUI_ALIGN_CENTER];
470 [gui setKey:GUI_KEY_OK forRow:GUI_ROW_KC_SAVE];
471
472 [gui setText:DESC(@"oolite-keyconfig-update-cancel") forRow:GUI_ROW_KC_CANCEL align:GUI_ALIGN_CENTER];
473 [gui setKey:GUI_KEY_OK forRow:GUI_ROW_KC_CANCEL];
474
475 [gui setSelectableRange: NSMakeRange(GUI_ROW_KC_KEY, (GUI_ROW_KC_CANCEL - GUI_ROW_KC_KEY) + 1)];
476
477 NSString *validate = [self validateKey:[selected_entry objectForKey:KEY_KC_DEFINITION] checkKeys:key_list];
478 if (validate)
479 {
480 for (i = 0; i < [keyFunctions count]; i++)
481 {
482 if ([[[keyFunctions objectAtIndex:i] objectForKey:KEY_KC_DEFINITION] isEqualToString:validate])
483 {
484 [gui setText:[NSString stringWithFormat:DESC(@"oolite-keyconfig-update-validation-@"), (NSString *)[[keyFunctions objectAtIndex:i] objectForKey:KEY_KC_GUIDESC]]
485 forRow:GUI_ROW_KC_VALIDATION align:GUI_ALIGN_CENTER];
486 [gui setColor:[OOColor orangeColor] forRow:GUI_ROW_KC_VALIDATION];
487 break;
488 }
489 }
490 }
491
492 if (resetSelectedRow)
493 {
494 [gui setSelectedRow: GUI_ROW_KC_KEY];
495 }
496
497 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"paused_overlay"];
498 [gui setBackgroundTextureKey:@"keyboardsettings"];
499 [[UNIVERSE gameView] clearMouse];
500 [[UNIVERSE gameView] clearKeys];
501 if (guiChanged) [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
502}

◆ setGuiToKeyMapperScreen:

- (void) setGuiToKeyMapperScreen: (unsigned skip

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

122 :(unsigned)skip
123{
124 [self setGuiToKeyMapperScreen:skip resetCurrentRow:NO];
125}

◆ setGuiToKeyMapperScreen:resetCurrentRow:

- (void) setGuiToKeyMapperScreen: (unsigned skip
resetCurrentRow: (BOOL resetCurrentRow 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

127 :(unsigned)skip resetCurrentRow:(BOOL)resetCurrentRow
128{
129 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
130 NSString *kbd = [defaults oo_stringForKey:@"keyboard-code" defaultValue:@"default"];
131
132 GuiDisplayGen *gui = [UNIVERSE gui];
133 MyOpenGLView *gameView = [UNIVERSE gameView];
134 OOGUIScreenID oldScreen = gui_screen;
135 OOGUITabStop tabStop[GUI_MAX_COLUMNS];
136 tabStop[0] = 10;
137 tabStop[1] = 290;
138 tabStop[2] = 400;
139 [gui setTabStops:tabStop];
140
141 if (!kdic_check) [self initCheckingDictionary];
142
143 gui_screen = GUI_SCREEN_KEYBOARD;
144 BOOL guiChanged = (oldScreen != gui_screen);
145 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
146
147 [gui clear];
148 [gui setTitle:[NSString stringWithFormat:@"Configure Keyboard"]];
149
150 // show keyboard layout
151 [gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-keyconfig-keyboard"), [self keyboardDescription:kbd], nil] forRow:GUI_ROW_KC_SELECTKBD];
152 [gui setKey:[NSString stringWithFormat:@"kbd:%@", kbd] forRow:GUI_ROW_KC_SELECTKBD];
153 [gui setColor:[OOColor yellowColor] forRow:GUI_ROW_KC_SELECTKBD];
154
155 [self displayKeyFunctionList:gui skip:skip];
156
157 has_error = NO;
158 if ([[self validateAllKeys] count] > 0)
159 {
160 has_error = YES;
161 [gui setText:DESC(@"oolite-keyconfig-validation-error") forRow:GUI_ROW_KC_ERROR align:GUI_ALIGN_CENTER];
162 [gui setColor:[OOColor redColor] forRow:GUI_ROW_KC_ERROR];
163
164 }
165 [gui setArray:[NSArray arrayWithObject:DESC(@"oolite-keyconfig-initial-info-1")] forRow:GUI_ROW_KC_INSTRUCT];
166 [gui setText:DESC(@"oolite-keyconfig-initial-info-2") forRow:GUI_ROW_KC_INSTRUCT+1 align:GUI_ALIGN_CENTER];
167 if (has_error)
168 {
169 [gui setText:DESC(@"oolite-keyconfig-initial-error") forRow:GUI_ROW_KC_INSTRUCT+2 align:GUI_ALIGN_CENTER];
170 }
171 else
172 {
173 [gui setText:DESC(@"oolite-keyconfig-initial-info-3") forRow:GUI_ROW_KC_INSTRUCT+2 align:GUI_ALIGN_CENTER];
174 }
175
176 if (resetCurrentRow)
177 {
178 int offset = 0;
179 if ([[keyFunctions objectAtIndex:skip] objectForKey:KEY_KC_HEADER]) offset = 1;
180 [gui setSelectedRow:GUI_ROW_KC_FUNCSTART + offset];
181 }
182 else
183 {
184 [gui setSelectedRow:current_row];
185 }
186
187 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"paused_overlay"];
188 [gui setBackgroundTextureKey:@"keyboardsettings"];
189
190 [gameView clearMouse];
191 [gameView clearKeys];
192 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
193
194 if (guiChanged) [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
195}

◆ setGuiToLoadCommanderScreen

- (void) setGuiToLoadCommanderScreen
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1420 of file PlayerEntityLoadSave.m.

923{
924 GuiDisplayGen *gui=[UNIVERSE gui];
925 NSString* dir = [[UNIVERSE gameController] playerFileDirectory];
926
927 gui_screen = GUI_SCREEN_LOAD;
928
929 [gui clear];
930 [gui setTitle:DESC(@"loadscreen-title")];
931
932 currentPage = 0;
933 [self lsCommanders:gui directory:dir pageNumber: currentPage highlightName:nil];
934
935 [gui setForegroundTextureKey:@"docked_overlay"];
936 [gui setBackgroundTextureKey:@"load_save"];
937
938 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
939
940 [self setShowDemoShips:YES];
941 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
942}

◆ setGuiToLoadSaveScreen

- (void) setGuiToLoadSaveScreen

Definition at line 8865 of file PlayerEntity.m.

9141{
9142 BOOL gamePaused = [[UNIVERSE gameController] isGamePaused];
9144 MyOpenGLView *gameView = [UNIVERSE gameView];
9146
9147 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9148
9150
9151 if ([self status] == STATUS_DOCKED)
9152 {
9153 if ([self dockedStation] == nil) [self setDockedAtMainStation];
9154 canLoadOrSave = (([self dockedStation] == [UNIVERSE station] || [[self dockedStation] allowsSaving]) && !([[UNIVERSE sun] goneNova] || [[UNIVERSE sun] willGoNova]));
9155 }
9156
9158
9159 // GUI stuff
9160 {
9161 GuiDisplayGen* gui = [UNIVERSE gui];
9162 GUI_ROW_INIT(gui);
9163
9165 if (canQuickSave)
9167
9168 [gui clear];
9169 [gui setTitle:[NSString stringWithFormat:DESC(@"status-commander-@"), [self commanderName]]]; //Same title as status screen.
9170
9171 [gui setText:DESC(@"options-quick-save") forRow:GUI_ROW(,QUICKSAVE) align:GUI_ALIGN_CENTER];
9172 if (canQuickSave)
9173 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,QUICKSAVE)];
9174 else
9175 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(,QUICKSAVE)];
9176
9177 [gui setText:DESC(@"options-save-commander") forRow:GUI_ROW(,SAVE) align:GUI_ALIGN_CENTER];
9178 [gui setText:DESC(@"options-load-commander") forRow:GUI_ROW(,LOAD) align:GUI_ALIGN_CENTER];
9179 if (canLoadOrSave)
9180 {
9181 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,SAVE)];
9182 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,LOAD)];
9183 }
9184 else
9185 {
9186 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(,SAVE)];
9187 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(,LOAD)];
9188 }
9189
9190 [gui setText:DESC(@"options-return-to-menu") forRow:GUI_ROW(,BEGIN_NEW) align:GUI_ALIGN_CENTER];
9191 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,BEGIN_NEW)];
9192
9193 [gui setText:DESC(@"options-game-options") forRow:GUI_ROW(,GAMEOPTIONS) align:GUI_ALIGN_CENTER];
9194 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,GAMEOPTIONS)];
9195
9196#if OOLITE_SDL
9197 // GNUstep needs a quit option at present (no Cmd-Q) but
9198 // doesn't need speech.
9199
9200 // quit menu option
9201 [gui setText:DESC(@"options-exit-game") forRow:GUI_ROW(,QUIT) align:GUI_ALIGN_CENTER];
9202 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,QUIT)];
9203#endif
9204
9205 [gui setSelectableRange:NSMakeRange(first_sel_row, GUI_ROW_OPTIONS_END_OF_LIST)];
9206
9207 if (gamePaused || (!canLoadOrSave && [self status] == STATUS_DOCKED))
9208 {
9209 [gui setSelectedRow: GUI_ROW(,GAMEOPTIONS)];
9210 }
9211 else
9212 {
9213 [gui setSelectedRow: first_sel_row];
9214 }
9215
9216 [gui setShowTextCursor:NO];
9217
9218 if ([gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"paused_overlay"] && [UNIVERSE pauseMessageVisible])
9219 [[UNIVERSE messageGUI] clear];
9220 // Graphically, this screen is analogous to the various settings screens
9221 [gui setBackgroundTextureKey:@"settings"];
9222 }
9223 /* ends */
9224
9225 [[UNIVERSE gameView] clearMouse];
9226
9227 [self setShowDemoShips:NO];
9228
9229 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9230
9231 if (gamePaused)
9232 {
9233 [[UNIVERSE messageGUI] clear];
9234 NSString *pauseKey = [PLAYER keyBindingDescription2:@"key_pausebutton"];
9235 [UNIVERSE addMessage:OOExpandKey(@"game-paused-docked", pauseKey) forCount:1.0 forceDisplay:YES];
9236 }
9237
9238 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
9239}

◆ setGuiToLongRangeChartScreen

- (void) setGuiToLongRangeChartScreen

Definition at line 13727 of file PlayerEntity.m.

8783{
8785 GuiDisplayGen *gui = [UNIVERSE gui];
8786 [gui clearAndKeepBackground:NO];
8787 [gui setBackgroundTextureKey:@"short_range_chart"];
8788 [self setMissionBackgroundSpecial: nil];
8791 [self setGuiToChartScreenFrom: oldScreen];
8792}

◆ setGuiToManifestScreen

- (void) setGuiToManifestScreen

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

1131{
1132 OOGUIScreenID oldScreen = gui_screen;
1133
1134 GuiDisplayGen *gui = [UNIVERSE gui];
1135 gui_screen = GUI_SCREEN_MANIFEST;
1136 BOOL guiChanged = (oldScreen != gui_screen);
1137 if (guiChanged)
1138 {
1139 [gui setStatusPage:0]; // need to do this earlier than the rest
1140 }
1141
1142 // GUI stuff
1143 {
1144 NSInteger current, max;
1145 OOColor *subheadColor = [gui colorFromSetting:kGuiManifestSubheadColor defaultValue:[OOColor greenColor]];
1146 OOColor *entryColor = [gui colorFromSetting:kGuiManifestEntryColor defaultValue:nil];
1147 OOColor *scrollColor = [gui colorFromSetting:kGuiManifestScrollColor defaultValue:[OOColor greenColor]];
1148 OOColor *noScrollColor = [gui colorFromSetting:kGuiManifestNoScrollColor defaultValue:[OOColor darkGrayColor]];
1149
1150 NSArray* cargoManifest = [self cargoList];
1151 NSArray* missionsManifest = [self missionsList];
1152
1153 NSUInteger i = 0;
1154 NSUInteger max_rows = 20;
1155 NSUInteger manifestCount = [cargoManifest count];
1156 NSUInteger cargoRowCount = (manifestCount + 1)/2;
1157 OOGUIRow cargoRow = 2;
1158 OOGUIRow missionsRow = 2;
1159
1160 OOGUIRow nextPageRow = MANIFEST_SCREEN_ROW_NEXT;
1161 // show extra lines if no HUD is displayed.
1162 if ([[self hud] isHidden] || [[self hud] allowBigGui])
1163 {
1164 max_rows += 7;
1165 nextPageRow += 7;
1166 }
1167
1168 NSUInteger mmRows = 0;
1169 id mmEntry = nil;
1170 foreach (mmEntry, missionsManifest)
1171 {
1172 if ([mmEntry isKindOfClass:[NSString class]])
1173 {
1174 ++mmRows;
1175 }
1176 else if ([mmEntry isKindOfClass:[NSArray class]])
1177 {
1178 mmRows += [(NSArray *)mmEntry count];
1179 }
1180 }
1181
1182 NSInteger page_offset = 0;
1183 BOOL multi_page = NO;
1184// NSUInteger total_rows = cargoRowCount + MAX(1U,[passengerManifest count]) + MAX(1U,[contractManifest count]) + mmRows + MAX(1U,[parcelManifest count]) + 5;
1185 NSUInteger total_rows = cargoRowCount + mmRows + 5;
1186 if (total_rows > max_rows)
1187 {
1188 max_rows -= 2;
1189 page_offset = ([gui statusPage]-1) * max_rows;
1190 if (page_offset < 0 || (NSUInteger)page_offset >= total_rows)
1191 {
1192 [gui setStatusPage:0];
1193 page_offset = 0;
1194 }
1195 multi_page = YES;
1196 }
1197
1198
1199 OOGUITabSettings tab_stops;
1200 tab_stops[0] = 0;
1201 tab_stops[1] = 256;
1202 [gui overrideTabs:tab_stops from:kGuiManifestTabs length:3];
1203 [gui setTabStops:tab_stops];
1204
1205 // Cargo Manifest
1206 current_cargo = [self cargoQuantityOnBoard];
1207
1208 [gui clearAndKeepBackground:!guiChanged];
1209 [gui setTitle:DESC(@"manifest-title")];
1210
1211 current = current_cargo;
1212 max = [self maxAvailableCargoSpace];
1213 NSString *cargoString = OOExpandKey(@"oolite-manifest-cargo", current, max);
1214 current = [[self passengerList] count];
1215 max = max_passengers;
1216 NSString *cabinString = OOExpandKey(@"oolite-manifest-cabins", current, max);
1217 NSArray *manifestHeader = [NSArray arrayWithObjects:cargoString,cabinString,nil];
1218
1219 SET_MANIFEST_ROW( manifestHeader , entryColor, cargoRow - 1);
1220
1221 if (manifestCount > 0)
1222 {
1223 for (i = 0; i < cargoRowCount; i++)
1224 {
1225 NSMutableArray* row_info = [NSMutableArray arrayWithCapacity:3];
1226 // i is always smaller than manifest_count, no need to test.
1227 [row_info addObject:[cargoManifest objectAtIndex:i]];
1228 if (i + cargoRowCount < manifestCount)
1229 {
1230 [row_info addObject:[cargoManifest objectAtIndex:i + cargoRowCount]];
1231 }
1232 else
1233 {
1234 [row_info addObject:@""];
1235 }
1236 SET_MANIFEST_ROW( (NSArray *)row_info, subheadColor, cargoRow + i);
1237 }
1238 }
1239 else
1240 {
1241 SET_MANIFEST_ROW( (DESC(@"manifest-none")), subheadColor, cargoRow);
1242 cargoRowCount=1;
1243 }
1244
1245 missionsRow = cargoRow + cargoRowCount + 1;
1246
1247 // Missions Manifest
1248 manifestCount = [missionsManifest count];
1249
1250 if (manifestCount > 0)
1251 {
1252 if ([[missionsManifest objectAtIndex:0] isKindOfClass:[NSString class]])
1253 {
1254 // then there's at least one without its own heading
1255 // to go under the generic 'missions' heading
1256 SET_MANIFEST_ROW( (DESC(@"manifest-missions")) , entryColor, missionsRow - 1);
1257 }
1258 else
1259 {
1260 missionsRow--;
1261 }
1262
1263 NSUInteger mmRow = 0;
1264 for (i = 0; i < manifestCount; i++)
1265 {
1266 NSString *mmItem = nil;
1267 mmEntry = [missionsManifest objectAtIndex:i];
1268 if ([mmEntry isKindOfClass:[NSString class]])
1269 {
1270 mmItem = [NSString stringWithFormat:@"\t%@",(NSString *)mmEntry];
1271 SET_MANIFEST_ROW( (mmItem) , subheadColor, missionsRow + mmRow);
1272 ++mmRow;
1273 }
1274 else if ([mmEntry isKindOfClass:[NSArray class]])
1275 {
1276 BOOL isHeading = YES;
1277 foreach (mmItem, mmEntry)
1278 {
1279 if (isHeading)
1280 {
1281 SET_MANIFEST_ROW( ((NSString *)mmItem) , entryColor , missionsRow + mmRow);
1282 }
1283 else
1284 {
1285 mmItem = [NSString stringWithFormat:@"\t%@",(NSString *)mmItem];
1286 SET_MANIFEST_ROW( ((NSString *)mmItem) , subheadColor , missionsRow + mmRow);
1287 }
1288 isHeading = NO;
1289 ++mmRow;
1290 }
1291 }
1292 }
1293 }
1294
1295 if (multi_page)
1296 {
1298 OOGUIRow r_end = nextPageRow;
1299 if (page_offset > 0)
1300 {
1301 [gui setColor:scrollColor forRow:MANIFEST_SCREEN_ROW_BACK];
1302 [gui setKey:GUI_KEY_OK forRow:MANIFEST_SCREEN_ROW_BACK];
1303 }
1304 else
1305 {
1306 [gui setColor:noScrollColor forRow:MANIFEST_SCREEN_ROW_BACK];
1307 r_start = nextPageRow;
1308 }
1309 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ",nil] forRow:MANIFEST_SCREEN_ROW_BACK];
1310
1311 if (total_rows > max_rows + page_offset)
1312 {
1313 [gui setColor:scrollColor forRow:nextPageRow];
1314 [gui setKey:GUI_KEY_OK forRow:nextPageRow];
1315 }
1316 else
1317 {
1318 [gui setColor:noScrollColor forRow:nextPageRow];
1320 }
1321 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ",nil] forRow:nextPageRow];
1322
1323 [gui setSelectableRange:NSMakeRange(r_start,r_end+1-r_start)];
1324 [gui setSelectedRow:r_start];
1325
1326 }
1327
1328 [gui setShowTextCursor:NO];
1329 }
1330 /* ends */
1331
1332 if (lastTextKey)
1333 {
1334 [lastTextKey release];
1335 lastTextKey = nil;
1336 }
1337
1338 [self setShowDemoShips:NO];
1339 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
1340
1341 if (guiChanged)
1342 {
1343 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"overlay"];
1344 [gui setBackgroundTextureKey:@"manifest"];
1345 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
1346 }
1347}
#define SET_MANIFEST_ROW(obj, color, row)
NSUInteger statusPage
OOColor * darkGrayColor()
Definition OOColor.m:244

◆ setGuiToMarketInfoScreen

- (void) setGuiToMarketInfoScreen

Definition at line 9242 of file PlayerEntity.m.

11247{
11248 OOCommodityMarket *localMarket = [self localMarket];
11249 GuiDisplayGen *gui = [UNIVERSE gui];
11251
11254
11255
11256 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
11257
11258 // fix problems with economies in witchspace
11259 if (localMarket == nil)
11260 {
11261 localMarket = [[UNIVERSE commodities] generateBlankMarket];
11262 }
11263
11264 // following changed to work whether docked or not
11265 NSArray *goods = [self applyMarketSorter:[self applyMarketFilter:[localMarket goods] onMarket:localMarket] onMarket:localMarket];
11266
11267 NSUInteger i, j, commodityCount = [shipCommodityData count];
11268 OOCargoQuantity quantityInHold[commodityCount];
11269
11270 for (i = 0; i < commodityCount; i++)
11271 {
11272 quantityInHold[i] = [shipCommodityData quantityForGood:[goods oo_stringAtIndex:i]];
11273 }
11274 for (i = 0; i < [cargo count]; i++)
11275 {
11276 ShipEntity *container = [cargo objectAtIndex:i];
11277 j = [goods indexOfObject:[container commodityType]];
11279 }
11280
11281
11282 // GUI stuff
11283 {
11285 {
11286 j = NSNotFound;
11287 }
11288 else
11289 {
11290 j = [goods indexOfObject:marketSelectedCommodity];
11291 }
11292 if (j == NSNotFound)
11293 {
11295 [self setGuiToMarketScreen];
11296 return;
11297 }
11298
11299 [gui clearAndKeepBackground:!guiChanged];
11300
11301 [gui setTitle:[NSString stringWithFormat:DESC(@"oolite-commodity-information-@"), [shipCommodityData nameForGood:marketSelectedCommodity]]];
11302
11303 [self showMarketScreenHeaders];
11304 [self showMarketScreenDataLine:GUI_ROW_MARKET_START forGood:marketSelectedCommodity inMarket:localMarket holdQuantity:quantityInHold[j]];
11305
11306 OOCargoQuantity contracted = [self contractedVolumeForGood:marketSelectedCommodity];
11307 if (contracted > 0)
11308 {
11309 OOMassUnit unit = [shipCommodityData massUnitForGood:marketSelectedCommodity];
11310 [gui setColor:[gui colorFromSetting:kGuiMarketContractedColor defaultValue:nil] forRow:GUI_ROW_MARKET_START+1];
11311 [gui setText:[NSString stringWithFormat:DESC(@"oolite-commodity-contracted-d-@"), contracted, DisplayStringForMassUnit(unit)] forRow:GUI_ROW_MARKET_START+1];
11312 }
11313
11314 NSString *info = [shipCommodityData commentForGood:marketSelectedCommodity];
11315 OOGUIRow i = 0;
11316 if (info == nil || [info length] == 0)
11317 {
11318 i = [gui addLongText:DESC(@"oolite-commodity-no-comment") startingAtRow:GUI_ROW_MARKET_START+2 align:GUI_ALIGN_LEFT];
11319 }
11320 else
11321 {
11322 i = [gui addLongText:info startingAtRow:GUI_ROW_MARKET_START+2 align:GUI_ALIGN_LEFT];
11323 }
11324 for (i-- ; i > GUI_ROW_MARKET_START+2 ; --i)
11325 {
11326 [gui setColor:[gui colorFromSetting:kGuiMarketDescriptionColor defaultValue:nil] forRow:i];
11327 }
11328
11329 [self showMarketCashAndLoadLine];
11330
11331 }
11332
11333 [[UNIVERSE gameView] clearMouse];
11334
11335 [self setShowDemoShips:NO];
11336 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
11337
11338 if (guiChanged)
11339 {
11340 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"overlay"];
11341 [gui setBackgroundTextureKey:@"marketinfo"];
11342 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
11343 }
11344}

◆ setGuiToMarketScreen

- (void) setGuiToMarketScreen

Definition at line 9242 of file PlayerEntity.m.

11046{
11047 OOCommodityMarket *localMarket = [self localMarket];
11048 GuiDisplayGen *gui = [UNIVERSE gui];
11050
11053
11054
11055 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
11056
11057 // fix problems with economies in witchspace
11058 if (localMarket == nil)
11059 {
11060 localMarket = [[UNIVERSE commodities] generateBlankMarket];
11061 }
11062
11063 // following changed to work whether docked or not
11064 NSArray *goods = [self applyMarketSorter:[self applyMarketFilter:[localMarket goods] onMarket:localMarket] onMarket:localMarket];
11065 NSInteger maxOffset = 0;
11067 {
11069 }
11070
11071 NSUInteger commodityCount = [shipCommodityData count];
11072 OOCargoQuantity quantityInHold[commodityCount];
11073
11074 for (NSUInteger i = 0; i < commodityCount; i++)
11075 {
11076 quantityInHold[i] = [shipCommodityData quantityForGood:[goods oo_stringAtIndex:i]];
11077 }
11078 for (NSUInteger i = 0; i < [cargo count]; i++)
11079 {
11080 ShipEntity *container = [cargo objectAtIndex:i];
11081 NSUInteger goodsIndex = [goods indexOfObject:[container commodityType]];
11082 // can happen with filters
11083 if (goodsIndex != NSNotFound)
11084 {
11085 quantityInHold[goodsIndex] += [container commodityAmount];
11086 }
11087 }
11088
11090 {
11091 // nothing?
11092 }
11093 else
11094 {
11096 {
11098 if ([goods count] > 0)
11099 {
11100 marketSelectedCommodity = [[goods oo_stringAtIndex:0] retain];
11101 }
11102 }
11103 if (maxOffset > 0)
11104 {
11105 NSInteger goodsIndex = [goods indexOfObject:marketSelectedCommodity];
11106 // validate marketOffset when returning from infoscreen
11107 if (goodsIndex <= marketOffset)
11108 {
11109 // is off top of list, move list upwards
11110 if (goodsIndex == 0) {
11111 marketOffset = 0;
11112 } else {
11114 }
11115 }
11117 {
11118 // is off bottom of list, move list downwards
11120 if (marketOffset > maxOffset)
11121 {
11123 }
11124 }
11125 }
11126 }
11127
11128 // GUI stuff
11129 {
11133
11134 [gui clearAndKeepBackground:!guiChanged];
11135
11136
11137 StationEntity *dockedStation = [self dockedStation];
11138 if (dockedStation == nil && [[self primaryTarget] isStation] && [(StationEntity *)[self primaryTarget] marketBroadcast])
11139 {
11140 dockedStation = [self primaryTarget];
11141 }
11142
11143 [gui setTitle:[self marketScreenTitle]];
11144
11145 [self showMarketScreenHeaders];
11146
11147 if (marketOffset > maxOffset)
11148 {
11149 marketOffset = 0;
11150 }
11151 else if (marketOffset < 0)
11152 {
11154 }
11155
11156 if ([goods count] > 0)
11157 {
11159 NSInteger i = 0;
11160 foreach (good, goods)
11161 {
11162 if (i < marketOffset)
11163 {
11164 ++i;
11165 continue;
11166 }
11167 [self showMarketScreenDataLine:row forGood:good inMarket:localMarket holdQuantity:quantityInHold[i++]];
11169 {
11170 active_row = row;
11171 }
11172
11173 ++row;
11174 if (row >= GUI_ROW_MARKET_END)
11175 {
11176 break;
11177 }
11178 }
11179
11180 if (marketOffset < maxOffset)
11181 {
11183 {
11185 }
11186 [gui setKey:@">>>" forRow:GUI_ROW_MARKET_LAST];
11187 [gui setColor:[gui colorFromSetting:kGuiMarketScrollColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_LAST];
11188 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @"", @"", @"", @" --> ", nil] forRow:GUI_ROW_MARKET_LAST];
11189 }
11190 if (marketOffset > 0)
11191 {
11193 {
11195 }
11196 [gui setKey:@"<<<" forRow:GUI_ROW_MARKET_START];
11197 [gui setColor:[gui colorFromSetting:kGuiMarketScrollColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_START];
11198 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @"", @"", @"", @" <-- ", nil] forRow:GUI_ROW_MARKET_START];
11199 }
11200 }
11201 else
11202 {
11203 // filter is excluding everything
11204 [gui setColor:[gui colorFromSetting:kGuiMarketFilteredAllColor defaultValue:[OOColor yellowColor]] forRow:GUI_ROW_MARKET_START];
11205 [gui setText:DESC(@"oolite-market-filtered-all") forRow:GUI_ROW_MARKET_START];
11206 active_row = -1;
11207 }
11208
11209 // actually count the containers and valuables (may be > max_cargo)
11210 current_cargo = [self cargoQuantityOnBoard];
11211 if (current_cargo > [self maxAvailableCargoSpace]) current_cargo = [self maxAvailableCargoSpace];
11212
11213 // filter sort info
11214 {
11215 NSString *filterMode = OOExpandKey(OOExpand(@"oolite-market-filter-[marketFilterMode]", marketFilterMode));
11216 NSString *filterText = OOExpandKey(@"oolite-market-filter-line", filterMode);
11217 NSString *sortMode = OOExpandKey(OOExpand(@"oolite-market-sorter-[marketSorterMode]", marketSorterMode));
11218 NSString *sorterText = OOExpandKey(@"oolite-market-sorter-line", sortMode);
11219 [gui setArray:[NSArray arrayWithObjects:filterText, @"", sorterText, nil] forRow:GUI_ROW_MARKET_END];
11220 }
11221 [gui setColor:[gui colorFromSetting:kGuiMarketFilterInfoColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_END];
11222
11223 [self showMarketCashAndLoadLine];
11224
11225 [gui setSelectableRange:NSMakeRange(start_row,row - start_row)];
11226 [gui setSelectedRow:active_row];
11227
11228 [gui setShowTextCursor:NO];
11229 }
11230
11231
11232 [[UNIVERSE gameView] clearMouse];
11233
11234 [self setShowDemoShips:NO];
11235 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
11236
11237 if (guiChanged)
11238 {
11239 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"overlay"];
11240 [gui setBackgroundTextureKey:@"market"];
11241 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
11242 }
11243}
@ GUI_ROW_MARKET_END
NSInteger marketOffset

◆ setGuiToMissionEndScreen

- (void) setGuiToMissionEndScreen
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

5374{
5375 MyOpenGLView *gameView = [UNIVERSE gameView];
5376 [gameView clearKeys];
5377 if ([self status] != STATUS_DOCKED)
5378 {
5379 // this setting is only applied when not docked
5380 [self setGuiToStatusScreen];
5381 return;
5382 }
5383 switch (_missionExitScreen)
5384 {
5385 case GUI_SCREEN_MANIFEST:
5386 [self noteGUIWillChangeTo:GUI_SCREEN_MANIFEST];
5387 [self setGuiToManifestScreen];
5388 break;
5389 case GUI_SCREEN_EQUIP_SHIP:
5390 [self noteGUIWillChangeTo:GUI_SCREEN_EQUIP_SHIP];
5391 [self setGuiToEquipShipScreen:0];
5392 break;
5393 case GUI_SCREEN_SHIPYARD:
5394 if ([[self dockedStation] hasShipyard])
5395 {
5396 [self noteGUIWillChangeTo:GUI_SCREEN_SHIPYARD];
5397 [self setGuiToShipyardScreen:0];
5398 [[UNIVERSE gui] setSelectedRow:GUI_ROW_SHIPYARD_START];
5399 [self showShipyardInfoForSelection];
5400 }
5401 else
5402 {
5403 // that doesn't work here
5404 [self setGuiToStatusScreen];
5405 }
5406 break;
5407 case GUI_SCREEN_LONG_RANGE_CHART:
5408 [self setGuiToLongRangeChartScreen];
5409 break;
5410 case GUI_SCREEN_SHORT_RANGE_CHART:
5411 [self setGuiToShortRangeChartScreen];
5412 break;
5413 case GUI_SCREEN_SYSTEM_DATA:
5414 [self noteGUIWillChangeTo:GUI_SCREEN_SYSTEM_DATA];
5415 [self setGuiToSystemDataScreen];
5416 break;
5417 case GUI_SCREEN_MARKET:
5418 [self noteGUIWillChangeTo:GUI_SCREEN_MARKET];
5419 [self setGuiToMarketScreen];
5420 break;
5421 case GUI_SCREEN_MARKETINFO:
5422 [self noteGUIWillChangeTo:GUI_SCREEN_MARKETINFO];
5423 [self setGuiToMarketInfoScreen];
5424 break;
5425 case GUI_SCREEN_INTERFACES:
5426 [self setGuiToInterfacesScreen:0];
5427 break;
5428 case GUI_SCREEN_STATUS:
5429 default: // invalid screen specifications
5430 [self setGuiToStatusScreen];
5431 }
5432}

◆ setGuiToMissionScreen

- (void) setGuiToMissionScreen

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2478{
2479 // reset special background as legacy scripts can't use it, and this
2480 // is only called by legacy scripts
2481 [self setMissionBackgroundSpecial:nil];
2482 // likewise exit screen target
2483 [self setMissionExitScreen:GUI_SCREEN_STATUS];
2484
2485 [self setGuiToMissionScreenWithCallback:NO];
2486}

◆ setGuiToMissionScreenWithCallback:

- (void) setGuiToMissionScreenWithCallback: (BOOL callback

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2508 :(BOOL) callback
2509{
2510 GuiDisplayGen *gui = [UNIVERSE gui];
2511 OOGUIScreenID oldScreen = gui_screen;
2512 NSUInteger end_row = 21;
2513 if ([[self hud] allowBigGui])
2514 {
2515 end_row = 27;
2516 }
2517
2518 // GUI stuff
2519 {
2520 [gui clear];
2521 [gui setTitle:[self missionTitle] ?: DESC(@"mission-information")];
2522
2523 if (!_missionTextEntry)
2524 {
2525 [gui setText:DESC(@"press-space-commander") forRow:end_row align:GUI_ALIGN_CENTER];
2526 [gui setColor:[OOColor yellowColor] forRow:end_row];
2527 [gui setKey:@"spacebar" forRow:end_row];
2528 [gui setShowTextCursor:NO];
2529 }
2530 else
2531 {
2532 [self refreshMissionScreenTextEntry];
2533 }
2534 [gui setSelectableRange:NSMakeRange(0,0)];
2535
2536 [gui setForegroundTextureDescriptor:[self missionOverlayDescriptorOrDefault]];
2537 NSDictionary *background_desc = [self missionBackgroundDescriptorOrDefault];
2538 [gui setBackgroundTextureDescriptor:background_desc];
2539 // must set special second as setting the descriptor resets it
2540 BOOL overridden = ([self missionBackgroundDescriptor] != nil);
2541 [gui setBackgroundTextureSpecial:[self missionBackgroundSpecial] withBackground:!overridden];
2542
2543
2544 }
2545 /* ends */
2546
2547 missionTextRow = 1;
2548
2549
2550 if (gui)
2551 gui_screen = GUI_SCREEN_MISSION;
2552
2553 if (lastTextKey)
2554 {
2555 [lastTextKey release];
2556 lastTextKey = nil;
2557 }
2558
2560
2561 // the following are necessary...
2562 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
2563 _missionWithCallback = callback;
2564 _missionAllowInterrupt = NO;
2565 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
2566
2567}
BOOL setForegroundTextureDescriptor:(NSDictionary *descriptor)
void setBackgroundTextureSpecial:withBackground:(OOGUIBackgroundSpecial spec,[withBackground] BOOL withBackground)

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setGuiToOverwriteScreen:

- (void) setGuiToOverwriteScreen: (NSString *)  cdrName
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1420 of file PlayerEntityLoadSave.m.

976 :(NSString *)cdrName
977{
978 GuiDisplayGen *gui=[UNIVERSE gui];
979 MyOpenGLView* gameView = [UNIVERSE gameView];
980
981 // Don't poll controls
982 pollControls=NO;
983
984 gui_screen = GUI_SCREEN_SAVE_OVERWRITE;
985
986 [gui clear];
987 [gui setTitle:[NSString stringWithFormat:DESC(@"overwrite-save-commander-@"), cdrName]];
988
989 [gui setText:[NSString stringWithFormat:DESC(@"overwritescreen-commander-@-already-exists-overwrite-query"), cdrName]
990 forRow:SAVE_OVERWRITE_WARN_ROW align: GUI_ALIGN_CENTER];
991
992 [gui setText:DESC(@"overwritescreen-yes") forRow: SAVE_OVERWRITE_YES_ROW align: GUI_ALIGN_CENTER];
993 [gui setKey:GUI_KEY_OK forRow: SAVE_OVERWRITE_YES_ROW];
994
995 [gui setText:DESC(@"overwritescreen-no") forRow: SAVE_OVERWRITE_NO_ROW align: GUI_ALIGN_CENTER];
996 [gui setKey:GUI_KEY_OK forRow: SAVE_OVERWRITE_NO_ROW];
997
998 [gui setSelectableRange: NSMakeRange(SAVE_OVERWRITE_YES_ROW, 2)];
999 [gui setSelectedRow: SAVE_OVERWRITE_NO_ROW];
1000
1001 // We can only leave this screen by answering yes or no, or esc. Therefore
1002 // use a specific overlay, to allow visual reminders of the available options.
1003 [gui setForegroundTextureKey:@"overwrite_overlay"];
1004 [gui setBackgroundTextureKey:@"load_save"];
1005
1006 [self setShowDemoShips:NO];
1007 [gameView setStringInput:gvStringInputNo];
1008 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO]; // FIXME: should be YES, but was NO before introducing new mouse mode stuff. If set to YES, choices can be selected but not activated.
1009}

◆ setGuiToOXZManager

- (void) setGuiToOXZManager

Definition at line 9242 of file PlayerEntity.m.

10119{
10120
10121 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
10122 [[UNIVERSE gameView] clearMouse];
10123 [UNIVERSE removeDemoShips];
10124
10126
10127 [[UNIVERSE gui] clearAndKeepBackground:NO];
10128
10130
10132 [[UNIVERSE gui] setBackgroundTextureKey:@"oxz-manager"];
10133 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
10134}

◆ setGuiToSaveCommanderScreen:

- (void) setGuiToSaveCommanderScreen: (NSString *)  cdrName
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1420 of file PlayerEntityLoadSave.m.

945 :(NSString *)cdrName
946{
947 GuiDisplayGen *gui=[UNIVERSE gui];
948 MyOpenGLView *gameView = [UNIVERSE gameView];
949 NSString *dir = [[UNIVERSE gameController] playerFileDirectory];
950
951 pollControls = NO;
952 gui_screen = GUI_SCREEN_SAVE;
953
954 [gui clear];
955 [gui setTitle:DESC(@"savescreen-title")];
956
957 currentPage = 0;
958 [self lsCommanders:gui directory:dir pageNumber: currentPage highlightName:nil];
959
960 [gui setText:DESC(@"savescreen-commander-name") forRow: INPUTROW];
961 [gui setColor:[OOColor cyanColor] forRow:INPUTROW];
962 [gui setShowTextCursor: YES];
963 [gui setCurrentRow: INPUTROW];
964
965 [gui setForegroundTextureKey:@"docked_overlay"];
966 [gui setBackgroundTextureKey:@"load_save"];
967
968 [gameView setTypedString:cdrName];
969 [gameView suppressKeysUntilKeyUp];
970
971 [self setShowDemoShips:YES];
972 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
973}

◆ setGuiToScenarioScreen:

- (void) setGuiToScenarioScreen: (int page

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

207 :(int)page
208{
209 NSArray *scenarios = [UNIVERSE scenarios];
210 [UNIVERSE removeDemoShips];
211 // GUI stuff
212 {
213 GuiDisplayGen *gui = [UNIVERSE gui];
215 OOGUIRow row = start_row;
216 BOOL guiChanged = (gui_screen != GUI_SCREEN_NEWGAME);
217
218 [gui clearAndKeepBackground:!guiChanged];
219 [gui setTitle:DESC(@"oolite-newgame-title")];
220
221 OOGUITabSettings tab_stops;
222 tab_stops[0] = 0;
223 tab_stops[1] = -480;
224 [gui setTabStops:tab_stops];
225
226 unsigned n_rows = GUI_MAX_ROWS_SCENARIOS;
227 NSUInteger i, count = [scenarios count];
228
229 NSDictionary *scenario = nil;
230
231 [gui setArray:[NSArray arrayWithObjects:DESC(@"oolite-scenario-exit"), @" <----- ", nil] forRow:start_row - 2];
232 [gui setColor:[OOColor redColor] forRow:start_row - 2];
233 [gui setKey:@"exit" forRow:start_row - 2];
234
235
236 if (page > 0)
237 {
238 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:start_row - 1];
239 [gui setColor:[OOColor greenColor] forRow:start_row - 1];
240 [gui setKey:[NSString stringWithFormat:@"__page:%i",page-1] forRow:start_row - 1];
241 }
242
243 [self setShowDemoShips:NO];
244
245 for (i = page*n_rows ; i < count && row < start_row + n_rows ; i++)
246 {
247 scenario = [[UNIVERSE scenarios] objectAtIndex:i];
248 NSString *scenarioName = [NSString stringWithFormat:@" %@ ",[scenario oo_stringForKey:@"name"]];
249 [gui setText:OOExpand(scenarioName) forRow:row];
250 [gui setKey:[NSString stringWithFormat:@"Scenario:%lu", (unsigned long)i] forRow:row];
251 ++row;
252 }
253
254 if ((page+1) * n_rows < count)
255 {
256 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil] forRow:row];
257 [gui setColor:[OOColor greenColor] forRow:row];
258 [gui setKey:[NSString stringWithFormat:@"__page:%i",page+1] forRow:row];
259 ++row;
260 }
261
262 gui_screen = GUI_SCREEN_NEWGAME;
263
264 [gui setSelectableRange:NSMakeRange(start_row - 2,3 + row - start_row)];
265 [gui setSelectedRow:start_row];
266 [self showScenarioDetails];
267
268 if (guiChanged)
269 {
270 [gui setBackgroundTextureKey:@"newgame"];
271 [gui setForegroundTextureKey:@"newgame_overlay"];
272 }
273 }
274
275 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
276}

◆ setGuiToShipyardScreen:

- (void) setGuiToShipyardScreen: (NSUInteger skip

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1453 :(NSUInteger)skip
1454{
1455 OOGUIScreenID oldScreen = gui_screen;
1456
1457 GuiDisplayGen *gui = [UNIVERSE gui];
1458 gui_screen = GUI_SCREEN_SHIPYARD;
1459 BOOL guiChanged = (oldScreen != gui_screen);
1460
1461 unsigned i;
1462
1463 // set up initial market if there is none
1464 OOTechLevelID stationTechLevel;
1465 StationEntity *station = [self dockedStation];
1466
1467 if (station != nil)
1468 {
1469 stationTechLevel = [station equivalentTechLevel];
1470 }
1471 else
1472 {
1473 station = [UNIVERSE station];
1474 stationTechLevel = NSNotFound;
1475 }
1476 if ([station localShipyard] == nil)
1477 {
1478 [station generateShipyard:stationTechLevel];
1479 }
1480
1481 NSMutableArray *shipyard = [station localShipyard];
1482
1483 [currentShipyard release];
1484 currentShipyard = [[NSMutableDictionary alloc] initWithCapacity:[shipyard count]];
1485
1486 for (i = 0; i < [shipyard count]; i++)
1487 {
1488 [currentShipyard setObject:[shipyard objectAtIndex:i]
1489 forKey:[[shipyard oo_dictionaryAtIndex:i] oo_stringForKey:SHIPYARD_KEY_ID]];
1490 }
1491
1492 NSUInteger shipCount = [shipyard count];
1493
1494 //error check
1495 if (skip >= shipCount) skip = shipCount - 1;
1496 if (skip < 2) skip = 0;
1497
1498 // GUI stuff
1499 {
1500 [gui clearAndKeepBackground:!guiChanged];
1501 NSString *system = [UNIVERSE getSystemName:system_id];
1502 [gui setTitle:OOExpandKey(@"shipyard-title", system)];
1503
1504 OOGUITabSettings tab_stops;
1505 tab_stops[0] = 0;
1506 tab_stops[1] = -258;
1507 tab_stops[2] = 270;
1508 tab_stops[3] = 370;
1509 tab_stops[4] = 450;
1510 [gui overrideTabs:tab_stops from:kGuiShipyardTabs length:5];
1511 [gui setTabStops:tab_stops];
1512
1513 int rowCount = MAX_ROWS_SHIPS_FOR_SALE;
1514 int startRow = GUI_ROW_SHIPYARD_START;
1515 NSInteger previous = 0;
1516
1517 if (shipCount <= MAX_ROWS_SHIPS_FOR_SALE)
1518 skip = 0;
1519 else
1520 {
1521 if (skip > 0)
1522 {
1523 rowCount -= 1;
1524 startRow += 1;
1525 previous = skip - MAX_ROWS_SHIPS_FOR_SALE + 2;
1526 if (previous < 2)
1527 previous = 0;
1528 }
1529 if (skip + rowCount < shipCount)
1530 rowCount -= 1;
1531 }
1532
1533 if (shipCount > 0)
1534 {
1535 [gui setColor:[gui colorFromSetting:kGuiShipyardHeadingColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_SHIPYARD_LABELS];
1536 [gui setArray:[NSArray arrayWithObjects:DESC(@"shipyard-shiptype"), DESC(@"shipyard-price-label"),
1537 DESC(@"shipyard-cargo-label"), DESC(@"shipyard-speed-label"), nil] forRow:GUI_ROW_SHIPYARD_LABELS];
1538
1539 if (skip > 0)
1540 {
1541 [gui setColor:[gui colorFromSetting:kGuiShipyardScrollColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_SHIPYARD_START];
1542 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:GUI_ROW_SHIPYARD_START];
1543 [gui setKey:[NSString stringWithFormat:@"More:%lld", previous] forRow:GUI_ROW_SHIPYARD_START];
1544 }
1545 for (i = 0; i < (shipCount - skip) && (int)i < rowCount; i++)
1546 {
1547 NSDictionary* ship_info = [shipyard oo_dictionaryAtIndex:i + skip];
1548 OOCreditsQuantity ship_price = [ship_info oo_unsignedLongLongForKey:SHIPYARD_KEY_PRICE];
1549 [gui setColor:[gui colorFromSetting:kGuiShipyardEntryColor defaultValue:nil] forRow:startRow + i];
1550 [gui setArray:[NSArray arrayWithObjects:
1551 [NSString stringWithFormat:@" %@ ",[[ship_info oo_dictionaryForKey:SHIPYARD_KEY_SHIP] oo_stringForKey:@"display_name" defaultValue:[[ship_info oo_dictionaryForKey:SHIPYARD_KEY_SHIP] oo_stringForKey:KEY_NAME]]],
1552 OOIntCredits(ship_price),
1553 nil]
1554 forRow:startRow + i];
1555 [gui setKey:(NSString*)[ship_info objectForKey:SHIPYARD_KEY_ID] forRow:startRow + i];
1556 }
1557 if (i < shipCount - skip)
1558 {
1559 [gui setColor:[gui colorFromSetting:kGuiShipyardScrollColor defaultValue:[OOColor greenColor]] forRow:startRow + i];
1560 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil] forRow:startRow + i];
1561 [gui setKey:[NSString stringWithFormat:@"More:%llu", rowCount + skip] forRow:startRow + i];
1562 i++;
1563 }
1564
1565 [gui setSelectableRange:NSMakeRange( GUI_ROW_SHIPYARD_START, i + startRow - GUI_ROW_SHIPYARD_START)];
1566 // ensure that at least one row is selected at all times
1567 if(shipCount == 1) [gui setFirstSelectableRow];
1568 [self showShipyardInfoForSelection];
1569 }
1570 else
1571 {
1572 [gui setText:DESC(@"shipyard-no-ships-available-for-purchase") forRow:GUI_ROW_NO_SHIPS align:GUI_ALIGN_CENTER];
1573 [gui setColor:[gui colorFromSetting:kGuiShipyardNoshipColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_NO_SHIPS];
1574
1575 [gui setNoSelectedRow];
1576 }
1577
1578 [self showTradeInInformationFooter];
1579
1580 [gui setShowTextCursor:NO];
1581 }
1582
1583 // the following are necessary...
1584
1585 [self setShowDemoShips:(shipCount > 0)];
1586 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
1587
1588 if (guiChanged)
1589 {
1590 [gui setForegroundTextureKey:@"docked_overlay"];
1591 [gui setBackgroundTextureKey:@"shipyard"];
1592 }
1593}
static NSMutableDictionary * currentShipyard
BOOL setFirstSelectableRow()
NSMutableArray * localShipyard
void generateShipyard:(OOTechLevelID stationTechLevel)

◆ setGuiToShortRangeChartScreen

- (void) setGuiToShortRangeChartScreen

Definition at line 13727 of file PlayerEntity.m.

8795{
8797 GuiDisplayGen *gui = [UNIVERSE gui];
8798 [gui clearAndKeepBackground:NO];
8799 [gui setBackgroundTextureKey:@"short_range_chart"];
8800 [self setMissionBackgroundSpecial: nil];
8802 [self setGuiToChartScreenFrom: oldScreen];
8803}

◆ setGuiToStatusScreen

- (void) setGuiToStatusScreen

Definition at line 13727 of file PlayerEntity.m.

7937{
7938 NSString *systemName = nil;
7940 NSString *text = nil;
7941
7942 GuiDisplayGen *gui = [UNIVERSE gui];
7945 {
7946 [self noteGUIWillChangeTo:GUI_SCREEN_STATUS];
7947 }
7948
7951
7952 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
7953
7954 // Both system_seed & target_system_seed are != nil at all times when this function is called.
7955
7956 systemName = [UNIVERSE inInterstellarSpace] ? DESC(@"interstellar-space") : [UNIVERSE getSystemName:system_id];
7957 if ([self isDocked] && [self dockedStation] != [UNIVERSE station])
7958 {
7959 systemName = [NSString stringWithFormat:@"%@ : %@", systemName, [[self dockedStation] displayName]];
7960 }
7961
7962 targetSystemName = [UNIVERSE getSystemName:target_system_id];
7963 NSDictionary *systemInfo = [[UNIVERSE systemManager] getPropertiesForSystem:target_system_id inGalaxy:galaxy_number];
7964 NSInteger concealment = [systemInfo oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
7965 if (concealment >= OO_SYSTEMCONCEALMENT_NONAME) targetSystemName = DESC(@"status-unknown-system");
7966
7967 OOSystemID nextHop = [self nextHopTargetSystemID];
7968 if (nextHop != target_system_id) {
7969 NSString *nextHopSystemName = [UNIVERSE getSystemName:nextHop];
7970 systemInfo = [[UNIVERSE systemManager] getPropertiesForSystem:nextHop inGalaxy:galaxy_number];
7971 concealment = [systemInfo oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
7972 if (concealment >= OO_SYSTEMCONCEALMENT_NONAME) nextHopSystemName = DESC(@"status-unknown-system");
7973 targetSystemName = OOExpandKey(@"status-hyperspace-system-multi", targetSystemName, nextHopSystemName);
7974 }
7975
7976 // GUI stuff
7977 {
7978 NSString *shipName = [self displayName];
7980 *alert_desc = nil, *fuel_desc = nil,
7981 *credits_desc = nil;
7982
7983 OOGUIRow i;
7985 tab_stops[0] = 20;
7986 tab_stops[1] = 160;
7987 tab_stops[2] = 290;
7988 [gui overrideTabs:tab_stops from:kGuiStatusTabs length:3];
7989 [gui setTabStops:tab_stops];
7990
7991 NSString *lightYearsDesc = DESC(@"status-light-years-desc");
7992
7996 fuel_desc = [NSString stringWithFormat:@"%.1f %@", fuel/10.0, lightYearsDesc];
7998
7999 [gui clearAndKeepBackground:!guiChanged];
8000 text = DESC(@"status-commander-@");
8001 [gui setTitle:[NSString stringWithFormat:text, [self commanderName]]];
8002
8003 [gui setText:shipName forRow:0 align:GUI_ALIGN_CENTER];
8004
8005 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-present-system"), systemName, nil] forRow:1];
8006 if ([self hasHyperspaceMotor]) [gui setArray:[NSArray arrayWithObjects:DESC(@"status-hyperspace-system"), targetSystemName, nil] forRow:2];
8007 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-condition"), alert_desc, nil] forRow:3];
8008 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-fuel"), fuel_desc, nil] forRow:4];
8009 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-cash"), credits_desc, nil] forRow:5];
8010 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-legal-status"), legal_desc, nil] forRow:6];
8011 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-rating"), rating_desc, nil] forRow:7];
8012
8013
8014 [gui setColor:[gui colorFromSetting:kGuiStatusShipnameColor defaultValue:nil] forRow:0];
8015 for (i = 1 ; i <= 7 ; ++i)
8016 {
8017 // nil default = fall back to global default colour
8018 [gui setColor:[gui colorFromSetting:kGuiStatusDataColor defaultValue:nil] forRow:i];
8019 }
8020
8021 [gui setText:DESC(@"status-equipment") forRow:9];
8022
8023 [gui setColor:[gui colorFromSetting:kGuiStatusEquipmentHeadingColor defaultValue:nil] forRow:9];
8024
8025 [gui setShowTextCursor:NO];
8026 }
8027 /* ends */
8028
8029 if (lastTextKey)
8030 {
8031 [lastTextKey release];
8032 lastTextKey = nil;
8033 }
8034
8035 [[UNIVERSE gameView] clearMouse];
8036
8037 // Contributed by Pleb - show ship model if the appropriate user default key has been set - Nikos 20140127
8038 if (EXPECT_NOT([[NSUserDefaults standardUserDefaults] boolForKey:@"show-ship-model-in-status-screen"]))
8039 {
8040 [UNIVERSE removeDemoShips];
8041 [self showShipModelWithKey:[self shipDataKey] shipData:nil personality:[self entityPersonalityInt]
8042 factorX:2.5 factorY:1.7 factorZ:8.0 inContext:@"GUI_SCREEN_STATUS"];
8043 [self setShowDemoShips:YES];
8044 }
8045 else
8046 {
8047 [self setShowDemoShips:NO];
8048 }
8049
8050 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
8051
8052 if (guiChanged)
8053 {
8055 if ([self status] == STATUS_DOCKED)
8056 {
8057 fgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"docked_overlay"];
8058 bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status_docked"];
8059 }
8060 else
8061 {
8062 fgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"overlay"];
8063 if (alertCondition == ALERT_CONDITION_RED) bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status_red_alert"];
8064 else bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status_in_flight"];
8065 }
8066
8067 [gui setForegroundTextureDescriptor:fgDescriptor];
8068
8069 if (bgDescriptor == nil) bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status"];
8070 [gui setBackgroundTextureDescriptor:bgDescriptor];
8071
8072 [gui setStatusPage:0];
8073 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
8074 }
8075}
OOINLINE NSString * OOCredits(OOCreditsQuantity tenthsOfCredits)
@ OO_SYSTEMCONCEALMENT_NONAME
NSString * KillCountToRatingAndKillString(unsigned kills)
NSString * OODisplayStringFromAlertCondition(OOAlertCondition alertCondition)
BOOL hasHyperspaceMotor()

◆ setGuiToStickMapperScreen:

- (void) setGuiToStickMapperScreen: (unsigned skip

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

56 :(unsigned)skip
57{
58 [self setGuiToStickMapperScreen: skip resetCurrentRow: NO];
59}

◆ setGuiToStickMapperScreen:resetCurrentRow:

- (void) setGuiToStickMapperScreen: (unsigned skip
resetCurrentRow: (BOOL resetCurrentRow 

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

61 :(unsigned)skip resetCurrentRow: (BOOL) resetCurrentRow
62{
63 GuiDisplayGen *gui = [UNIVERSE gui];
65 NSArray *stickList = [stickHandler listSticks];
66 unsigned stickCount = [stickList count];
67 unsigned i;
68
69 OOGUITabStop tabStop[GUI_MAX_COLUMNS];
70 tabStop[0] = 10;
71 tabStop[1] = 290;
72 tabStop[2] = 400;
73 [gui setTabStops:tabStop];
74
75 gui_screen = GUI_SCREEN_STICKMAPPER;
76 [gui clear];
77 [gui setTitle:[NSString stringWithFormat:@"Configure Joysticks"]];
78
79 for(i=0; i < stickCount; i++)
80 {
81 NSString *stickNameForThisRow = [NSString stringWithFormat: @"Stick %d %@", i+1, [stickList objectAtIndex: i]];
82 // for more than 2 sticks, the stick name rows are populated by more than one name if needed
83 NSString *stickNameAdditional = nil;
84 if (stickCount > 2 && OOStringWidthInEm(stickNameForThisRow) > 18.0)
85 {
86 // string is too long, truncate it until its length gets below threshold
87 do {
88 stickNameForThisRow = [[stickNameForThisRow substringToIndex:[stickNameForThisRow length] - 5]
89 stringByAppendingString:@"..."];
90 } while (OOStringWidthInEm(stickNameForThisRow) > 18.0);
91 }
92 unsigned j = i + 2;
93 if (j < stickCount)
94 {
95 stickNameAdditional = [NSString stringWithFormat: @"Stick %d %@", j+1, [stickList objectAtIndex: j]];
96 if (OOStringWidthInEm(stickNameAdditional) > 11.0)
97 {
98 // string is too long, truncate it until its length gets below threshold
99 do {
100 stickNameAdditional = [[stickNameAdditional substringToIndex:[stickNameAdditional length] - 5]
101 stringByAppendingString:@"..."];
102 } while (OOStringWidthInEm(stickNameAdditional) > 11.0);
103 }
104 }
105 [gui setArray:[NSArray arrayWithObjects:
106 stickNameForThisRow,
107 @"", // skip one column
108 stickNameAdditional,
109 nil]
110 forRow:i + GUI_ROW_STICKNAME];
111 }
112
113 [gui setArray: [NSArray arrayWithObjects: DESC(@"stickmapper-profile"), nil] forRow: GUI_ROW_STICKPROFILE];
114 [gui setKey: GUI_KEY_OK forRow: GUI_ROW_STICKPROFILE];
115 [self displayFunctionList:gui skip:skip];
116
117 [gui setArray:[NSArray arrayWithObject:@"Select a function and press Enter to modify or 'u' to unset."]
118 forRow:GUI_ROW_INSTRUCT];
119
120 [gui setText:@"Space to return to previous screen." forRow:GUI_ROW_INSTRUCT+1 align:GUI_ALIGN_CENTER];
121
122 if (resetCurrentRow)
123 {
124 [gui setSelectedRow: GUI_ROW_STICKPROFILE];
125 }
126 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
127 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"paused_overlay"];
128 [gui setBackgroundTextureKey:@"settings"];
129}
CGFloat OOStringWidthInEm(NSString *text)

◆ setGuiToStickProfileScreen:

- (void) setGuiToStickProfileScreen: (GuiDisplayGen *)  gui

Provided by category PlayerEntity(StickProfile).

Definition at line 43 of file PlayerEntityStickProfile.m.

69 : (GuiDisplayGen *) gui
70{
71 gui_screen = GUI_SCREEN_STICKPROFILE;
72 [stickProfileScreen startGui: gui];
73 return;
74}

◆ setGuiToSystemDataScreen

- (void) setGuiToSystemDataScreen

Definition at line 13727 of file PlayerEntity.m.

8498{
8499 [self setGuiToSystemDataScreenRefreshBackground: NO];
8500}

◆ setGuiToSystemDataScreenRefreshBackground:

- (void) setGuiToSystemDataScreenRefreshBackground: (BOOL refreshBackground

Definition at line 13727 of file PlayerEntity.m.

8503{
8506
8507 infoSystemData = [[UNIVERSE generateSystemData:info_system_id] retain]; // retained
8508 NSInteger concealment = [infoSystemData oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
8509 infoSystemName = [infoSystemData oo_stringForKey:KEY_NAME];
8510
8511 BOOL sunGoneNova = ([infoSystemData oo_boolForKey:@"sun_gone_nova"]);
8513
8514 GuiDisplayGen *gui = [UNIVERSE gui];
8517
8518 Random_Seed infoSystemRandomSeed = [[UNIVERSE systemManager] getRandomSeedForSystem:info_system_id
8519 inGalaxy:[self galaxyNumber]];
8520
8521 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
8522
8523 // GUI stuff
8524 {
8526 tab_stops[0] = 0;
8527 tab_stops[1] = 96;
8528 tab_stops[2] = 144;
8529 [gui overrideTabs:tab_stops from:kGuiSystemdataTabs length:3];
8530 [gui setTabStops:tab_stops];
8531
8532 NSUInteger techLevel = [infoSystemData oo_intForKey:KEY_TECHLEVEL] + 1;
8533 int population = [infoSystemData oo_intForKey:KEY_POPULATION];
8534 int productivity = [infoSystemData oo_intForKey:KEY_PRODUCTIVITY];
8535 int radius = [infoSystemData oo_intForKey:KEY_RADIUS];
8536
8537 NSString *government_desc = [infoSystemData oo_stringForKey:KEY_GOVERNMENT_DESC
8538 defaultValue:OODisplayStringFromGovernmentID([infoSystemData oo_intForKey:KEY_GOVERNMENT])];
8539 NSString *economy_desc = [infoSystemData oo_stringForKey:KEY_ECONOMY_DESC
8540 defaultValue:OODisplayStringFromEconomyID([infoSystemData oo_intForKey:KEY_ECONOMY])];
8541 NSString *inhabitants = [infoSystemData oo_stringForKey:KEY_INHABITANTS];
8542 NSString *system_desc = [infoSystemData oo_stringForKey:KEY_DESCRIPTION];
8543
8544 NSString *populationDesc = [infoSystemData oo_stringForKey:KEY_POPULATION_DESC
8545 defaultValue:OOExpandKeyWithSeed(kNilRandomSeed, @"sysdata-pop-value", population)];
8546
8547 if (sunGoneNova)
8548 {
8549 population = 0;
8550 productivity = 0;
8551 radius = 0;
8552 techLevel = 0;
8553
8554 government_desc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-government");
8555 economy_desc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-economy");
8556 inhabitants = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-inhabitants");
8557 {
8558 NSString *system = infoSystemName;
8559 system_desc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-description", system);
8560 }
8562 }
8563
8564
8565 [gui clearAndKeepBackground:!refreshBackground && !guiChanged];
8566 [UNIVERSE removeDemoShips];
8567
8569 {
8570 NSString *system = infoSystemName;
8571 [gui setTitle:OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-data-on-system", system)];
8572 }
8573 else
8574 {
8575 [gui setTitle:OOExpandKey(@"sysdata-data-on-system-no-name")];
8576 }
8577
8579 {
8580 OOGUIRow i = [gui addLongText:OOExpandKey(@"sysdata-data-on-system-no-data") startingAtRow:15 align:GUI_ALIGN_LEFT];
8581 missionTextRow = i;
8582 for (i-- ; i > 14 ; --i)
8583 {
8584 [gui setColor:[gui colorFromSetting:kGuiSystemdataDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
8585 }
8586 }
8587 else
8588 {
8589 NSPoint infoSystemCoordinates = [[UNIVERSE systemManager] getCoordinatesForSystem: info_system_id inGalaxy: galaxy_number];
8591 if(distance == 0.0 && info_system_id != system_id)
8592 {
8593 distance = 0.1;
8594 }
8595 NSString *distanceInfo = [NSString stringWithFormat: @"%.1f ly", distance];
8597 {
8599 routeInfo = [UNIVERSE routeFromSystem: system_id toSystem: info_system_id optimizedBy: ANA_mode];
8600 if (routeInfo != nil)
8601 {
8602 double routeDistance = [[routeInfo objectForKey: @"distance"] doubleValue];
8603 double routeTime = [[routeInfo objectForKey: @"time"] doubleValue];
8604 int routeJumps = [[routeInfo objectForKey: @"jumps"] intValue];
8605 if(routeDistance == 0.0 && info_system_id != system_id) {
8606 routeDistance = 0.1;
8607 routeTime = 0.01;
8608 routeJumps = 0;
8609 }
8610 distanceInfo = [NSString stringWithFormat: @"%.1f ly / %.1f %@ / %d %@",
8611 routeDistance,
8612 routeTime,
8613 // don't rely on DESC_PLURAL for routeTime since it is of type double
8614 routeTime > 1.05 || routeTime < 0.95 ? DESC(@"sysdata-route-hours%1") : DESC(@"sysdata-route-hours%0"),
8615 routeJumps,
8616 DESC_PLURAL(@"sysdata-route-jumps", routeJumps)];
8617 }
8618 }
8619
8620 OOGUIRow i;
8621
8622 for (i = 1; i <= 16; i++) {
8623 NSString *ln = [NSString stringWithFormat:@"sysdata-line-%ld", (long)i];
8625 if (![line isEqualToString:@""])
8626 {
8627 NSArray *lines = [line componentsSeparatedByString:@"\t"];
8628 if ([lines count] == 1)
8629 {
8630 [gui setArray:[NSArray arrayWithObjects:[lines objectAtIndex:0],
8631 nil]
8632 forRow:i];
8633 }
8634 if ([lines count] == 2)
8635 {
8636 [gui setArray:[NSArray arrayWithObjects:[lines objectAtIndex:0],
8637 [lines objectAtIndex:1],
8638 nil]
8639 forRow:i];
8640 }
8641 if ([lines count] == 3)
8642 {
8643 if ([[lines objectAtIndex:2] isEqualToString:@""])
8644 {
8645 [gui setArray:[NSArray arrayWithObjects:[lines objectAtIndex:0],
8646 [lines objectAtIndex:1],
8647 nil]
8648 forRow:i];
8649 }
8650 else
8651 {
8652 [gui setArray:[NSArray arrayWithObjects:[lines objectAtIndex:0],
8653 [lines objectAtIndex:1],
8654 [lines objectAtIndex:2],
8655 nil]
8656 forRow:i];
8657 }
8658 }
8659 }
8660 else
8661 {
8662 [gui setArray:[NSArray arrayWithObjects:@"",
8663 nil]
8664 forRow:i];
8665 }
8666 }
8667
8668
8669 i = [gui addLongText:system_desc startingAtRow:17 align:GUI_ALIGN_LEFT];
8670 missionTextRow = i;
8671 for (i-- ; i > 16 ; --i)
8672 {
8673 [gui setColor:[gui colorFromSetting:kGuiSystemdataDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
8674 }
8675 for (i = 1 ; i <= 14 ; ++i)
8676 {
8677 // nil default = fall back to global default colour
8678 [gui setColor:[gui colorFromSetting:kGuiSystemdataFactsColor defaultValue:nil] forRow:i];
8679 }
8680 }
8681
8682 [gui setShowTextCursor:NO];
8683 }
8684 /* ends */
8685
8686 [lastTextKey release];
8687 lastTextKey = nil;
8688
8689 [[UNIVERSE gameView] clearMouse];
8690
8691 [infoSystemData release];
8692
8693 [self setShowDemoShips:NO];
8694 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
8695
8696 // if the system has gone nova, there's no planet to display
8698 {
8699 // The next code is generating the miniature planets.
8700 // When normal planets are displayed, the PRNG is reset. This happens not with procedural planet display.
8703
8705 {
8706 [self setBackgroundFromDescriptionsKey:@"gui-scene-show-local-planet"];
8707 }
8708 else
8709 {
8710 [self setBackgroundFromDescriptionsKey:@"gui-scene-show-planet"];
8711 }
8712
8715 }
8716
8718 {
8719 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"overlay"];
8720 [gui setBackgroundTextureKey:sunGoneNova ? @"system_data_nova" : @"system_data"];
8721
8722 [self noteGUIDidChangeFrom:oldScreen to:gui_screen refresh: refreshBackground];
8723 [self checkScript]; // Still needed by some OXPs?
8724 }
8725}
#define OOExpandKeyWithSeed(seed, key,...)
@ OO_SYSTEMCONCEALMENT_NODATA
NSInteger missionTextRow
RANROTSeed RANROTGetFullSeed(void)
void setRandomSeed(RNG_Seed a_seed)
RNG_Seed currentRandomSeed(void)
void RANROTSetFullSeed(RANROTSeed seed)

◆ setInfoSystemID:moveChart:

- (void) setInfoSystemID: (OOSystemID sid
moveChart: (BOOL moveChart 

Definition at line 13727 of file PlayerEntity.m.

760{
761 if (sid != info_system_id)
762 {
765 JSContext *context = OOJSAcquireContext();
766 ShipScriptEvent(context, self, "infoSystemWillChange", INT_TO_JSVAL(info_system_id), INT_TO_JSVAL(old));
768 {
769 if(moveChart)
770 {
771 target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
772 }
773 }
774 else
775 {
777 {
778 [self setGuiToSystemDataScreenRefreshBackground: YES];
779 }
780 if(moveChart)
781 {
782 chart_centre_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
786 }
787 }
788 ShipScriptEvent(context, self, "infoSystemChanged", INT_TO_JSVAL(info_system_id), INT_TO_JSVAL(old));
789 OOJSRelinquishContext(context);
790 }
791}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setJSSelf:context:

- (void) setJSSelf: (JSObject *)  val
context: (JSContext *)  context 

Provided by category PlayerEntity(OOJavaScriptExtensions).

Definition at line 1860 of file OOJSPlayerShip.m.

323 :(JSObject *)val context:(JSContext *)context
324{
325 _jsSelf = val;
326 OOJSAddGCObjectRoot(context, &_jsSelf, "Player jsSelf");
327
328 [[NSNotificationCenter defaultCenter] addObserver:self
329 selector:@selector(javaScriptEngineWillReset:)
330 name:kOOJavaScriptEngineWillResetNotification
332}
#define OOJSAddGCObjectRoot(context, root, name)

Referenced by InitOOJSPlayerShip().

+ Here is the caller graph for this function:

◆ setJumpCause:

- (void) setJumpCause: (NSString *)  value

Definition at line 9242 of file PlayerEntity.m.

13066 :(NSString *)value
13067{
13068 NSParameterAssert(value != nil);
13069 [_jumpCause autorelease];
13070 _jumpCause = [value copy];
13071}

◆ setJumpType:

- (void) setJumpType: (BOOL isGalacticJump

Definition at line 13727 of file PlayerEntity.m.

7490{
7491 if (isGalacticJump)
7492 {
7494 }
7495 else
7496 {
7498 }
7499}

Referenced by PlayerShipBeginGalacticHyperspaceCountdown(), and PlayerShipCancelHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ setLastsaveName:

- (void) setLastsaveName: (NSString *)  value

Definition at line 9242 of file PlayerEntity.m.

13094 :(NSString *)value
13095{
13096 NSParameterAssert(value != nil);
13097 [_lastsaveName autorelease];
13098 _lastsaveName = [value copy];
13099}

◆ setLastShot:

- (void) setLastShot: (NSArray *)  shot

Definition at line 9242 of file PlayerEntity.m.

13359 :(NSArray *)shot
13360{
13361 lastShot = [shot retain];
13362}

◆ setLegalStatus:

- (void) setLegalStatus: (NSString *)  valueString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

967 :(NSString *)valueString
968{
969 legalStatus = [valueString intValue];
970}

◆ setLocalVariable:forKey:andMission:

- (void) setLocalVariable: (NSString *)  value
forKey: (NSString *)  variableName
andMission: (NSString *)  missionKey 

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

691 :(NSString *)value forKey:(NSString *)variableName andMission:(NSString *)missionKey
692{
693 NSMutableDictionary *locals = nil;
694
695 if (variableName != nil && missionKey != nil)
696 {
697 locals = [self localVariablesForMission:missionKey];
698 if (value != nil)
699 {
700 [locals setObject:value forKey:variableName];
701 }
702 else
703 {
704 [locals removeObjectForKey:variableName];
705 }
706 }
707}

◆ setLongRangeChartMode:

- (void) setLongRangeChartMode: (OOLongRangeChartMode mode

Definition at line 9242 of file PlayerEntity.m.

13015{
13017}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setManifestScreenRow:inColor:forRow:ofRows:andOffset:inMultipage:

- (void) setManifestScreenRow: (id object
inColor: (OOColor*)  color
forRow: (OOGUIRow row
ofRows: (OOGUIRow max_rows
andOffset: (OOGUIRow offset
inMultipage: (BOOL multi 

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

1350 :(id)object inColor:(OOColor*)color forRow:(OOGUIRow)row ofRows:(OOGUIRow)max_rows andOffset:(OOGUIRow)offset inMultipage:(BOOL)multi
1351{
1352 OOGUIRow disp_row = row - offset;
1353 if (disp_row < 1 || disp_row > max_rows) return;
1354 if (multi) disp_row++;
1355 GuiDisplayGen *gui = [UNIVERSE gui];
1356 if ([object isKindOfClass:[NSString class]])
1357 {
1358 [gui setText:(NSString*)object forRow:disp_row];
1359 }
1360 else if ([object isKindOfClass:[NSArray class]])
1361 {
1362 [gui setArray:(NSArray*)object forRow:disp_row];
1363 }
1364 [gui setColor:color forRow:disp_row];
1365}

◆ setMassLockable:

- (void) setMassLockable: (BOOL newValue

Definition at line 13727 of file PlayerEntity.m.

4460 :(BOOL)newValue
4461{
4463 [self updateAlertCondition];
4464}
unsigned massLockable

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setMaxAftShieldLevel:

- (void) setMaxAftShieldLevel: (float new

Definition at line 13727 of file PlayerEntity.m.

4677 :(float)new
4678{
4679 max_aft_shield = new;
4680}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setMaxFlightPitch:

- (void) setMaxFlightPitch: (GLfloat new
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

3343 :(GLfloat)new
3344{
3345 max_flight_pitch = new;
3346 pitch_delta = 2.0 * new;
3347}

◆ setMaxFlightRoll:

- (void) setMaxFlightRoll: (GLfloat new
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

3350 :(GLfloat)new
3351{
3352 max_flight_roll = new;
3353 roll_delta = 2.0 * new;
3354}

◆ setMaxFlightYaw:

- (void) setMaxFlightYaw: (GLfloat new
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

3357 :(GLfloat)new
3358{
3359 max_flight_yaw = new;
3360 yaw_delta = 2.0 * new;
3361}

◆ setMaxForwardShieldLevel:

- (void) setMaxForwardShieldLevel: (float new

Definition at line 13727 of file PlayerEntity.m.

4671 :(float)new
4672{
4673 max_forward_shield = new;
4674}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setMissionBackground:

- (void) setMissionBackground: (NSString *)  value
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2201 :(NSString *)value
2202{
2203 if ([value length] != 0 && ![[value lowercaseString] isEqualToString:@"none"])
2204 {
2205 [self setMissionBackgroundDescriptor:[NSDictionary dictionaryWithObject:value forKey:@"name"]];
2206 }
2207 else
2208 {
2209 [self setMissionBackgroundDescriptor:nil];
2210 }
2211}

◆ setMissionBackgroundDescriptor:

- (void) setMissionBackgroundDescriptor: (NSDictionary *)  descriptor

Definition at line 9242 of file PlayerEntity.m.

12740{
12742 {
12743 [_missionBackgroundDescriptor autorelease];
12744 _missionBackgroundDescriptor = [descriptor copy];
12745 }
12746}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionBackgroundSpecial:

- (void) setMissionBackgroundSpecial: (NSString *)  special

Definition at line 9242 of file PlayerEntity.m.

12755 :(NSString *)special
12756{
12757 if (special == nil) {
12759 }
12760 else if ([special isEqualToString:@"SHORT_RANGE_CHART"])
12761 {
12763 }
12764 else if ([special isEqualToString:@"SHORT_RANGE_CHART_SHORTEST"])
12765 {
12766 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12767 {
12769 }
12770 else
12771 {
12773 }
12774 }
12775 else if ([special isEqualToString:@"SHORT_RANGE_CHART_QUICKEST"])
12776 {
12777 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12778 {
12780 }
12781 else
12782 {
12784 }
12785 }
12786 else if ([special isEqualToString:@"CUSTOM_CHART"])
12787 {
12789 }
12790 else if ([special isEqualToString:@"CUSTOM_CHART_SHORTEST"])
12791 {
12792 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12793 {
12795 }
12796 else
12797 {
12799 }
12800 }
12801 else if ([special isEqualToString:@"CUSTOM_CHART_QUICKEST"])
12802 {
12803 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12804 {
12806 }
12807 else
12808 {
12810 }
12811 }
12812 else if ([special isEqualToString:@"LONG_RANGE_CHART"])
12813 {
12815 }
12816 else if ([special isEqualToString:@"LONG_RANGE_CHART_SHORTEST"])
12817 {
12818 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12819 {
12821 }
12822 else
12823 {
12825 }
12826 }
12827 else if ([special isEqualToString:@"LONG_RANGE_CHART_QUICKEST"])
12828 {
12829 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12830 {
12832 }
12833 else
12834 {
12836 }
12837 }
12838 else
12839 {
12841 }
12842}
@ GUI_BACKGROUND_SPECIAL_NONE

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionChoice:

- (void) setMissionChoice: (NSString *)  newChoice

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

191 :(NSString *)newChoice
192{
193 [self setMissionChoice:newChoice keyPress:@"" withEvent:YES];
194}

◆ setMissionChoice:keyPress:

- (void) setMissionChoice: (NSString *)  newChoice
keyPress: (NSString *)  keyPress 

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

203 :(NSString *)newChoice keyPress:(NSString *)keyPress
204{
205 [self setMissionChoice:newChoice keyPress:keyPress withEvent:YES];
206}

◆ setMissionChoice:keyPress:withEvent:

- (void) setMissionChoice: (NSString *)  newChoice
keyPress: (NSString *)  keyPress
withEvent: (BOOL withEvent 

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

209 :(NSString *)newChoice keyPress:(NSString *)keyPress withEvent:(BOOL)withEvent
210{
211 BOOL equal = [newChoice isEqualToString:missionChoice] || (newChoice == missionChoice); // Catch both being nil as well
212 if (!equal)
213 {
214 if (newChoice == nil)
215 {
216 NSString *oldChoice = missionChoice;
217 [missionChoice autorelease];
218 missionChoice = nil;
219 if (withEvent) [self doScriptEvent:OOJSID("missionChoiceWasReset") withArgument:oldChoice];
220 }
221 else
222 {
223 [missionChoice autorelease];
224 missionChoice = [newChoice copy];
225 }
226 }
227 equal = [keyPress isEqualToString:missionKeyPress] || (keyPress == missionKeyPress);
228 if (!equal)
229 {
230 [missionKeyPress autorelease];
231 missionKeyPress = [keyPress copy];
232 }
233}

Referenced by MissionRunCallback().

+ Here is the caller graph for this function:

◆ setMissionChoice:withEvent:

- (void) setMissionChoice: (NSString *)  newChoice
withEvent: (BOOL withEvent 

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

197 :(NSString *)newChoice withEvent:(BOOL)withEvent
198{
199 [self setMissionChoice:newChoice keyPress:@"" withEvent:withEvent];
200}

◆ setMissionChoiceByTextEntry:

- (void) setMissionChoiceByTextEntry: (BOOL enable

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1933 :(BOOL)enable
1934{
1935 MyOpenGLView *gameView = [UNIVERSE gameView];
1936 _missionTextEntry = enable;
1937 [gameView resetTypedString];
1938}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionChoices:

- (void) setMissionChoices: (NSString *)  choicesKey

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1941 :(NSString *)choicesKey // choicesKey is a key for a dictionary of
1942{ // choices/choice phrases in missiontext.plist and also..
1943 NSDictionary *choicesDict = [[UNIVERSE missiontext] oo_dictionaryForKey:choicesKey];
1944 if ([choicesDict count] == 0)
1945 {
1946 return;
1947 }
1948 [self setMissionChoicesDictionary:choicesDict];
1949}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionChoicesDictionary:

- (void) setMissionChoicesDictionary: (NSDictionary *)  choicesDict

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1952 :(NSDictionary *)choicesDict
1953{
1954 unsigned i;
1955 bool keysOK = true;
1956 GuiDisplayGen* gui = [UNIVERSE gui];
1957 // TODO: MORE STUFF HERE
1958 //
1959 // What it does now:
1960 // find list of choices in missiontext.plist
1961 // add them to gui setting the key for each line to the key in the dict of choices
1962 // and the text of the line to the value in the dict of choices
1963 // and also set the selectable range
1964 // ++ change the mission screen's response to wait for a choice
1965 // and only if the selectable range is not present ask:
1966 // Press Space Commander...
1967 //
1968
1969 NSUInteger end_row = 21;
1970 if ([[self hud] allowBigGui])
1971 {
1972 end_row = 27;
1973 }
1974
1975 NSArray *choiceKeys = [choicesDict allKeys];
1976 /* Guard against potential for numeric keys in dictionary, which
1977 * would cause an unhandled exception in the sorter. See
1978 * OOJavaScriptEngine::OOJSDictionaryFromJSObject for further
1979 * thoughts. - CIM 15/2/13 */
1980 for (i=0; i < [choiceKeys count]; i++)
1981 {
1982 if (![[choiceKeys objectAtIndex:i] isKindOfClass:[NSString class]])
1983 {
1984 OOLog(@"test.script.error",@"Choices list in mission screen has non-string value %@",[choiceKeys objectAtIndex:i]);
1985 keysOK = false;
1986 }
1987 }
1988 if (keysOK)
1989 {
1990 // only try this if they're all strings
1991 choiceKeys = [choiceKeys sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
1992 }
1993
1994 NSInteger keysCount = [choiceKeys count];
1995 if ((end_row + 1) < [choiceKeys count]) {
1996 OOLogERR(kOOLogException, @"in mission.runScreen choices: number of choices defined (%llu) is greater than available lines (%llu). Check HUD settings for allowBigGui.", [choiceKeys count], (end_row + 1));
1997 keysCount = end_row + 1;
1998 }
1999
2000 [gui setText:@"" forRow:end_row]; // clears out the 'Press spacebar' message
2001 [gui setKey:@"" forRow:end_row]; // clears the key to enable pollDemoControls to check for a selection
2002 [gui setSelectableRange:NSMakeRange(0,0)]; // clears the selectable range
2003 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES]; // enables mouse selection of the choices list items
2004
2005 OOGUIRow choicesRow = (end_row+1) - keysCount;
2006 NSString *choiceKey = nil;
2007 id choiceValue = nil;
2008 NSString *choiceText = nil;
2009
2010 BOOL selectableRowExists = NO;
2011 NSUInteger firstSelectableRow = end_row;
2012
2013 foreach (choiceKey, choiceKeys)
2014 {
2015 choiceValue = [choicesDict objectForKey:choiceKey];
2016 OOGUIAlignment alignment = GUI_ALIGN_CENTER;
2017 OOColor *rowColor = [OOColor yellowColor];
2018 BOOL selectable = YES;
2019 if ([choiceValue isKindOfClass:[NSString class]])
2020 {
2021 choiceText = [NSString stringWithFormat:@" %@ ",(NSString*)choiceValue];
2022 }
2023 else if ([choiceValue isKindOfClass:[NSDictionary class]])
2024 {
2025 NSDictionary *choiceOpts = (NSDictionary*)choiceValue;
2026 choiceText = [NSString stringWithFormat:@" %@ ",[choiceOpts oo_stringForKey:@"text"]];
2027 NSString *alignmentChoice = [choiceOpts oo_stringForKey:@"alignment" defaultValue:@"CENTER"];
2028 if ([alignmentChoice isEqualToString:@"LEFT"])
2029 {
2030 alignment = GUI_ALIGN_LEFT;
2031 }
2032 else if ([alignmentChoice isEqualToString:@"RIGHT"])
2033 {
2034 alignment = GUI_ALIGN_RIGHT;
2035 }
2036 id colorDesc = [choiceOpts objectForKey:@"color"];
2037 if ([choiceOpts oo_boolForKey:@"unselectable"])
2038 {
2039 selectable = NO;
2040 }
2041 if (colorDesc != nil)
2042 {
2043 rowColor = [OOColor colorWithDescription:colorDesc];
2044 }
2045 else if (!selectable) // different default
2046 {
2047 rowColor = [OOColor darkGrayColor];
2048 }
2049 }
2050 else
2051 {
2052 continue; // invalid type
2053 }
2054 choiceText = OOExpand(choiceText);
2055 choiceText = [self replaceVariablesInString:choiceText];
2056 // allow blank rows
2057 if (![choiceText isEqualToString:@" "])
2058 {
2059 [gui setText:choiceText forRow:choicesRow align: alignment];
2060 if (selectable)
2061 {
2062 [gui setKey:choiceKey forRow:choicesRow];
2063 }
2064 else
2065 {
2066 [gui setKey:GUI_KEY_SKIP forRow:choicesRow];
2067 }
2068 [gui setColor:rowColor forRow:choicesRow];
2069 if (selectable && !selectableRowExists)
2070 {
2071 selectableRowExists = YES;
2072 firstSelectableRow = choicesRow;
2073 }
2074 }
2075 else
2076 {
2077 [gui setKey:GUI_KEY_SKIP forRow:choicesRow];
2078 }
2079 choicesRow++;
2080 if (choicesRow > (end_row + 1)) break;
2081 }
2082
2083 if (!selectableRowExists)
2084 {
2085 // just in case choices are set but they're all blank.
2086 [gui setText:@" " forRow:end_row align: GUI_ALIGN_CENTER];
2087 [gui setKey:@"" forRow:end_row];
2088 [gui setColor:[OOColor yellowColor] forRow:end_row];
2089 }
2090
2091 [gui setSelectableRange:NSMakeRange((end_row+1) - keysCount, keysCount)];
2092 [gui setSelectedRow: firstSelectableRow];
2093
2094 [self resetMissionChoice];
2095}
OOGUIAlignment
@ GUI_ALIGN_RIGHT
@ GUI_ALIGN_LEFT
@ GUI_ALIGN_CENTER

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionDescription:

- (void) setMissionDescription: (NSString *)  textKey

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

824 :(NSString *)textKey
825{
826 [self setMissionDescription:textKey forMission:sCurrentMissionKey];
827}

◆ setMissionDescription:forMission:

- (void) setMissionDescription: (NSString *)  textKey
forMission: (NSString *)  key 

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

830 :(NSString *)textKey forMission:(NSString *)key
831{
832 NSString *text = [[UNIVERSE missiontext] oo_stringForKey:textKey];
833
834 if (!text)
835 {
836 OOLogERR(kOOLogScriptMissionDescNoText, @"in %@, no mission text set for key '%@' [UNIVERSE missiontext] is:\n%@ ", CurrentScriptDesc(), textKey, [UNIVERSE missiontext]);
837 return;
838 }
839
840 [self setMissionInstructions:text forMission:key];
841}
static NSString *const kOOLogScriptMissionDescNoText

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ setMissionExitScreen:

- (void) setMissionExitScreen: (OOGUIScreenID screen

Definition at line 9242 of file PlayerEntity.m.

12846{
12848}

Referenced by MissionRunScreen(), and MissionSetProperty().

+ Here is the caller graph for this function:

◆ setMissionImage:

- (void) setMissionImage: (NSString *)  value
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2187 :(NSString *)value
2188{
2189 if ([value length] != 0 && ![[value lowercaseString] isEqualToString:@"none"])
2190 {
2191 [self setMissionOverlayDescriptor:[NSDictionary dictionaryWithObject:value forKey:@"name"]];
2192 }
2193 else
2194 {
2195 [self setMissionOverlayDescriptor:nil];
2196 }
2197
2198}

◆ setMissionInstructions:forMission:

- (void) setMissionInstructions: (NSString *)  text
forMission: (NSString *)  key 

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

845 :(NSString *)text forMission:(NSString *)key
846{
847 if (!key)
848 {
849 OOLogERR(kOOLogScriptMissionDescNoKey, @"in %@, mission key not set", CurrentScriptDesc());
850 return;
851 }
852
853 text = OOExpand(text);
854 text = [self replaceVariablesInString: text];
855
856 [mission_variables setObject:text forKey:key];
857}

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ setMissionInstructionsList:forMission:

- (void) setMissionInstructionsList: (NSArray *)  list
forMission: (NSString *)  key 

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

860 :(NSArray *)list forMission:(NSString *)key
861{
862 if (!key)
863 {
864 OOLogERR(kOOLogScriptMissionDescNoKey, @"in %@, mission key not set", CurrentScriptDesc());
865 return;
866 }
867
868 NSString *text = nil;
869 NSUInteger i,ct = [list count];
870 NSMutableArray *expandedList = [NSMutableArray arrayWithCapacity:ct];
871 for (i=0 ; i<ct ; i++)
872 {
873 text = [list oo_stringAtIndex:i defaultValue:nil];
874 if (text != nil)
875 {
876 text = OOExpand(text);
877 text = [self replaceVariablesInString: text];
878 [expandedList addObject:text];
879 }
880 }
881
882 [mission_variables setObject:expandedList forKey:key];
883}

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ setMissionMusic:

- (void) setMissionMusic: (NSString *)  value

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2161 :(NSString *)value
2162{
2163 if ([value length] == 0 || [[value lowercaseString] isEqualToString:@"none"])
2164 {
2165 value = nil;
2166 }
2168}
void setMissionMusic:(NSString *missionMusicName)

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionOverlayDescriptor:

- (void) setMissionOverlayDescriptor: (NSDictionary *)  descriptor

Definition at line 9242 of file PlayerEntity.m.

12712{
12714 {
12715 [_missionOverlayDescriptor autorelease];
12716 _missionOverlayDescriptor = [descriptor copy];
12717 }
12718}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionScreenID:

- (void) setMissionScreenID: (NSString *)  msid

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2452 :(NSString *)msid
2453{
2454 _missionScreenID = [msid retain];
2455}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionTitle:

- (void) setMissionTitle: (NSString *)  value

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2177 :(NSString *)value
2178{
2179 if (_missionTitle != value)
2180 {
2181 [_missionTitle release];
2182 _missionTitle = [value copy];
2183 }
2184}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionVariable:forKey:

- (void) setMissionVariable: (NSString *)  value
forKey: (NSString *)  key 

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

658 :(NSString *)value forKey:(NSString *)key
659{
660 if (key != nil)
661 {
662 if (value != nil) [mission_variables setObject:value forKey:key];
663 else [mission_variables removeObjectForKey:key];
664 }
665}

Referenced by MissionVariablesDeleteProperty(), and MissionVariablesSetProperty().

+ Here is the caller graph for this function:

◆ setMultiFunctionDisplay:toKey:

- (BOOL) setMultiFunctionDisplay: (NSUInteger index
toKey: (NSString *)  key 

Definition at line 13727 of file PlayerEntity.m.

5547 :(NSUInteger)index toKey:(NSString *)key
5548{
5549 if (index >= [hud mfdCount])
5550 {
5551 // is first inactive display
5552 index = [multiFunctionDisplaySettings indexOfObject:[NSNull null]];
5553 if (index == NSNotFound)
5554 {
5555 return NO;
5556 }
5557 }
5558
5559 if (index < [hud mfdCount])
5560 {
5561 if (key == nil)
5562 {
5563 [multiFunctionDisplaySettings replaceObjectAtIndex:index withObject:[NSNull null]];
5564 }
5565 else
5566 {
5567 [multiFunctionDisplaySettings replaceObjectAtIndex:index withObject:key];
5568 }
5569 return YES;
5570 }
5571 else
5572 {
5573 return NO;
5574 }
5575}

Referenced by PlayerShipSetMultiFunctionDisplay().

+ Here is the caller graph for this function:

◆ setMultiFunctionText:forKey:

- (void) setMultiFunctionText: (NSString *)  text
forKey: (NSString *)  key 

Definition at line 13727 of file PlayerEntity.m.

5528 :(NSString *)text forKey:(NSString *)key
5529{
5530 if (text != nil)
5531 {
5532 [multiFunctionDisplayText setObject:text forKey:key];
5533 }
5534 else if (key != nil)
5535 {
5536 [multiFunctionDisplayText removeObjectForKey:key];
5537 // and blank any MFDs currently using it
5538 NSUInteger index;
5539 while ((index = [multiFunctionDisplaySettings indexOfObject:key]) != NSNotFound)
5540 {
5541 [multiFunctionDisplaySettings replaceObjectAtIndex:index withObject:[NSNull null]];
5542 }
5543 }
5544}

Referenced by PlayerShipSetMultiFunctionText().

+ Here is the caller graph for this function:

◆ setName:

- (void) setName: (NSString *)  inName
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

189 :(NSString *)inName
190{
191 // Block super method; player ship can't be renamed.
192}

◆ setNextCompassMode

- (void) setNextCompassMode

Definition at line 13727 of file PlayerEntity.m.

5392{
5395
5396 switch (compassMode)
5397 {
5399 case COMPASS_MODE_BASIC:
5401 aegis = [self checkForAegis];
5403 {
5404 [self setCompassMode:COMPASS_MODE_STATION];
5405 }
5406 else
5407 {
5408 [self setCompassMode:COMPASS_MODE_SUN];
5409 }
5410 break;
5411
5413 [self setCompassMode:COMPASS_MODE_SUN];
5414 break;
5415
5416 case COMPASS_MODE_SUN:
5417 if ([self primaryTarget])
5418 {
5419 [self setCompassMode:COMPASS_MODE_TARGET];
5420 break;
5421 }
5422 // else fall through to switch to beacon mode.
5423
5425 beacon = [UNIVERSE firstBeacon];
5426 while (beacon != nil && [beacon isJammingScanning])
5427 {
5428 beacon = [beacon nextBeacon];
5429 }
5430 [self setNextBeacon:beacon];
5431
5432 if (beacon != nil) [self setCompassMode:COMPASS_MODE_BEACONS];
5433 else [self setCompassMode:COMPASS_MODE_PLANET];
5434 break;
5435
5437 beacon = [self nextBeacon];
5438 do
5439 {
5440 beacon = [beacon nextBeacon];
5441 } while (beacon != nil && [beacon isJammingScanning]);
5442 [self setNextBeacon:beacon];
5443
5444 if (beacon == nil)
5445 {
5446 [self setCompassMode:COMPASS_MODE_PLANET];
5447 }
5448 break;
5449 }
5450}
OOAegisStatus
Definition OOTypes.h:60
@ AEGIS_IN_DOCKING_RANGE
Definition OOTypes.h:64
@ AEGIS_CLOSE_TO_MAIN_PLANET
Definition OOTypes.h:63
@ AEGIS_NONE
Definition OOTypes.h:61

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setNormalOrientation:

- (void) setNormalOrientation: (Quaternion quat
implementation

Reimplemented from Entity.

Definition at line 13727 of file PlayerEntity.m.

4351 :(Quaternion) quat
4352{
4353 [self setOrientation:make_quaternion(-quat.w, quat.x, quat.y, quat.z)];
4354}

◆ setOcclusionLevel:

- (void) setOcclusionLevel: (float level

Definition at line 13727 of file PlayerEntity.m.

4491 :(float)level
4492{
4494}

◆ setPlanetinfo:

- (void) setPlanetinfo: (NSString *)  key_valueString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1300 :(NSString *)key_valueString // uses key=value format
1301{
1302 NSArray * tokens = [key_valueString componentsSeparatedByString:@"="];
1303 NSString* keyString = nil;
1304 NSString* valueString = nil;
1305
1306 if ([tokens count] != 2)
1307 {
1308 OOLog(kOOLogSyntaxSetPlanetInfo, @"***** SCRIPT ERROR: in %@, CANNOT setPlanetinfo: '%@' (bad parameter count)", CurrentScriptDesc(), key_valueString);
1309 return;
1310 }
1311
1312 keyString = [[tokens objectAtIndex:0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
1313 valueString = [[tokens objectAtIndex:1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
1314
1315 /* Legacy script planetinfo settings are now non-persistent over save/load
1316 * Virtually nothing uses them any more, and expecting them to have a
1317 * manifest and identifying what it is if so seems unnecessary */
1318 [UNIVERSE setSystemDataKey:keyString value:valueString fromManifest:@""];
1319
1320}
static NSString *const kOOLogSyntaxSetPlanetInfo

◆ setPrevCompassMode

- (void) setPrevCompassMode

Definition at line 13727 of file PlayerEntity.m.

5323{
5326
5327 switch (compassMode)
5328 {
5330 case COMPASS_MODE_BASIC:
5332 beacon = [UNIVERSE lastBeacon];
5333 while (beacon != nil && [beacon isJammingScanning])
5334 {
5335 beacon = [beacon prevBeacon];
5336 }
5337 [self setNextBeacon:beacon];
5338
5339 if (beacon != nil)
5340 {
5341 [self setCompassMode:COMPASS_MODE_BEACONS];
5342 break;
5343 }
5344 // else fall through to switch to target mode.
5345
5347 beacon = [self nextBeacon];
5348 do
5349 {
5350 beacon = [beacon prevBeacon];
5351 } while (beacon != nil && [beacon isJammingScanning]);
5352 [self setNextBeacon:beacon];
5353
5354 if (beacon == nil)
5355 {
5356 if ([self primaryTarget])
5357 {
5358 [self setCompassMode:COMPASS_MODE_TARGET];
5359 }
5360 else
5361 {
5362 [self setCompassMode:COMPASS_MODE_SUN];
5363 }
5364 break;
5365 }
5366 break;
5367
5369 [self setCompassMode:COMPASS_MODE_SUN];
5370 break;
5371
5372 case COMPASS_MODE_SUN:
5373 aegis = [self checkForAegis];
5375 {
5376 [self setCompassMode:COMPASS_MODE_STATION];
5377 }
5378 else
5379 {
5380 [self setCompassMode:COMPASS_MODE_PLANET];
5381 }
5382 break;
5383
5385 [self setCompassMode:COMPASS_MODE_PLANET];
5386 break;
5387 }
5388}

◆ setPreviousSystemID:

- (void) setPreviousSystemID: (OOSystemID sid

Definition at line 13727 of file PlayerEntity.m.

705 :(OOSystemID) sid
706{
708}

◆ setPrimedEquipment:showMessage:

- (BOOL) setPrimedEquipment: (NSString *)  eqKey
showMessage: (BOOL showMsg 

Definition at line 13727 of file PlayerEntity.m.

8240{
8241 NSUInteger c = [eqScripts count];
8242 NSUInteger current = primedEquipment;
8243 primedEquipment = [self eqScriptIndexForKey:eqKey]; // if key not found primedEquipment is set to primed-none
8244 BOOL unprimeEq = [eqKey isEqualToString:@""];
8245 BOOL result = YES;
8246
8247 if (primedEquipment == c && !unprimeEq)
8248 {
8249 primedEquipment = current;
8250 result = NO;
8251 }
8252 else
8253 {
8254 if (primedEquipment != current && showMsg == YES)
8255 {
8256 NSString *equipmentName = [[OOEquipmentType equipmentTypeWithIdentifier:[[eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0]] name];
8257 [UNIVERSE addMessage:unprimeEq ? OOExpandKey(@"equipment-primed-none") : OOExpandKey(@"equipment-primed", equipmentName) forCount:2.0];
8258 }
8259 }
8260 return result;
8261}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setRandom_factor:

- (void) setRandom_factor: (int rf

Definition at line 13727 of file PlayerEntity.m.

506 :(int)rf
507{
508 market_rnd = rf;
509}

◆ setScoopOverride:

- (void) setScoopOverride: (BOOL newValue

Definition at line 9242 of file PlayerEntity.m.

13026 :(BOOL)newValue
13027{
13029 if (scoopOverride) [self setScoopsActive];
13030}
unsigned scoopOverride

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setScoopsActive

- (void) setScoopsActive

Definition at line 9242 of file PlayerEntity.m.

12249{
12250 scoopsActive = YES;
12251}

◆ setScore:

- (void) setScore: (unsigned value

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

46 :(unsigned)value
47{
48 ship_kills = value;
49}

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setScriptTarget:

- (void) setScriptTarget: (ShipEntity *)  ship

Provided by category PlayerEntity(Scripting).

Definition at line 233 of file PlayerEntityLegacyScriptEngine.m.

248 :(ShipEntity *)ship
249{
250 scriptTarget = ship;
251}

Referenced by OOPlayerForScripting(), and ShipRunLegacyScriptActions().

+ Here is the caller graph for this function:

◆ setShowDemoShips:

- (void) setShowDemoShips: (BOOL value

Definition at line 13727 of file PlayerEntity.m.

4635 :(BOOL)value
4636{
4637 showDemoShips = value;
4638}

◆ setSpecificPlanetInfo:

- (void) setSpecificPlanetInfo: (NSString *)  key_valueString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1323 :(NSString *)key_valueString // uses galaxy#=planet#=key=value
1324{
1325 NSArray * tokens = [key_valueString componentsSeparatedByString:@"="];
1326 NSString* keyString = nil;
1327 NSString* valueString = nil;
1328 int gnum, pnum;
1329
1330 if ([tokens count] != 4)
1331 {
1332 OOLog(kOOLogSyntaxSetPlanetInfo, @"***** SCRIPT ERROR: in %@, CANNOT setSpecificPlanetInfo: '%@' (bad parameter count)", CurrentScriptDesc(), key_valueString);
1333 return;
1334 }
1335
1336 gnum = [tokens oo_intAtIndex:0];
1337 pnum = [tokens oo_intAtIndex:1];
1338 keyString = [[tokens objectAtIndex:2] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
1339 valueString = [[tokens objectAtIndex:3] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
1340
1341 [UNIVERSE setSystemDataForGalaxy:gnum planet:pnum key:keyString value:valueString fromManifest:@"" forLayer:OO_LAYER_OXP_DYNAMIC];
1342}

◆ setSunNovaIn:

- (void) setSunNovaIn: (NSString *)  time_value

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2238 :(NSString *)time_value
2239{
2240 double time_until_nova = [time_value doubleValue];
2241 [[UNIVERSE sun] setGoingNova:YES inTime: time_until_nova];
2242}

◆ setSystemID:

- (void) setSystemID: (OOSystemID sid

◆ setTargetDockStationTo:

- (void) setTargetDockStationTo: (StationEntity *)  value

Definition at line 13727 of file PlayerEntity.m.

4517 :(StationEntity *) value
4518{
4519 targetDockStation = value;
4520}

◆ setTargetSystemID:

- (void) setTargetSystemID: (OOSystemID sid

Definition at line 13727 of file PlayerEntity.m.

Referenced by PlayerSetEscapePodDestination(), and PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setTrumbleAppetiteAccumulator:

- (void) setTrumbleAppetiteAccumulator: (float value

Definition at line 9242 of file PlayerEntity.m.

12211 :(float)value
12212{
12214}
float _trumbleAppetiteAccumulator

◆ setTrumbleValueFrom:

- (void) setTrumbleValueFrom: (NSObject *)  trumbleValue

Definition at line 9242 of file PlayerEntity.m.

12096 :(NSObject*) trumbleValue
12097{
12099 int trumbleHash;
12100 int putativeHash = 0;
12101 int putativeNTrumbles = 0;
12103 int i;
12104 NSString *namekey = [NSString stringWithFormat:@"%@-humbletrash", [self commanderName]];
12105
12106 [self setUpTrumbles];
12107
12108 if (trumbleValue)
12109 {
12111 if (![trumbleValue isKindOfClass:[NSArray class]])
12112 info_failed = YES;
12113 else
12114 {
12116 if ([values count] >= 1)
12117 putativeNTrumbles = [values oo_intAtIndex:0];
12118 if ([values count] >= 2)
12119 putativeHash = [values oo_intAtIndex:1];
12120 if ([values count] >= 3)
12121 putativeTrumbleArray = [values oo_arrayAtIndex:2];
12122 }
12123 // calculate a hash for the putative values
12125 [self mungChecksumWithNSString:[self commanderName]];
12129
12131 info_failed = YES;
12132
12133 if (info_failed)
12134 {
12135 OOLog(@"cheat.tentative", @"%@", @"POSSIBLE CHEAT DETECTED");
12137 }
12138
12139 for (i = 1; (info_failed)&&(i < PLAYER_MAX_TRUMBLES); i++)
12140 {
12141 // try to determine trumbleCount from the key in the saved game
12143 [self mungChecksumWithNSString:[self commanderName]];
12148 {
12149 info_failed = NO;
12151 }
12152 }
12153
12155 OOLog(@"cheat.verified", @"%@", @"CHEAT DEFEATED - that's not the way to get rid of trumbles!");
12156 }
12157 else
12158 // if trumbleValue comes in as nil, then probably someone has toyed with the save file
12159 // by removing the entire trumbles array
12160 {
12161 OOLog(@"cheat.tentative", @"%@", @"POSSIBLE CHEAT DETECTED");
12162 info_failed = YES;
12163 }
12164
12166 {
12167 // try to determine trumbleCount from the key in user defaults
12169 for (i = 1; (info_failed)&&(i < PLAYER_MAX_TRUMBLES); i++)
12170 {
12172 [self mungChecksumWithNSString:[self commanderName]];
12177 {
12178 info_failed = NO;
12180 }
12181 }
12182
12183 if (!info_failed)
12184 OOLog(@"cheat.verified", @"%@", @"CHEAT DEFEATED - that's not the way to get rid of trumbles!");
12185 }
12186 // at this stage we've done the best we can to stop cheaters
12188
12190 {
12191 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12192 [trumble[i] setFromDictionary:[putativeTrumbleArray oo_dictionaryAtIndex:i]];
12193 }
12194
12196 [self mungChecksumWithNSString:[self commanderName]];
12200
12201 [[NSUserDefaults standardUserDefaults] setInteger:trumbleHash forKey:namekey];
12202}

◆ setUpAndConfirmOK:

- (BOOL) setUpAndConfirmOK: (BOOL stopOnError

Definition at line 13727 of file PlayerEntity.m.

1867{
1868 return [self setUpAndConfirmOK:stopOnError saveGame:NO];
1869}

◆ setUpAndConfirmOK:saveGame:

- (BOOL) setUpAndConfirmOK: (BOOL stopOnError
saveGame: (BOOL loadingGame 

Definition at line 13727 of file PlayerEntity.m.

1873{
1874 fieldOfView = [[UNIVERSE gameView] fov:YES];
1875 unsigned i;
1876
1877 showDemoShips = NO;
1880
1881 // Reset JavaScript.
1884
1885 GameController *gc = [[UNIVERSE gameView] gameController];
1886
1887 if (![gc inFullScreenMode] && stopOnError) [gc stopAnimationTimer]; // start of critical section
1888
1889 if (EXPECT_NOT(![[OOJavaScriptEngine sharedEngine] reset] && stopOnError)) // always (try to) reset the engine, then find out if we need to stop.
1890 {
1891 /*
1892 Occasionally there's a racing condition between timers being deleted
1893 and the js engine needing to be reset: the engine reset stops the timers
1894 from being deleted, and undeleted timers don't allow the engine to reset
1895 itself properly.
1896
1897 If the engine can't reset, let's give ourselves an extra 20ms to allow the
1898 timers to delete themselves.
1899
1900 We'll piggyback performDeadUpdates: when STATUS_DEAD, the engine waits until
1901 kDeadResetTime then restarts Oolite via [UNIVERSE updateGameOver]
1902 The variable shot_time is used to keep track of how long ago we were
1903 shot.
1904
1905 If we're loading a savegame the code will try a new JS reset immediately
1906 after failing this reset...
1907 */
1908
1909 // set up STATUS_DEAD
1910 [self setDockedStation:nil]; // needed for STATUS_DEAD
1911 [self setStatus:STATUS_DEAD];
1912 OOLog(@"script.javascript.init.error", @"%@", @"Scheduling new JavaScript reset.");
1913 shot_time = kDeadResetTime - 0.02f; // schedule reinit 20 milliseconds from now.
1914
1915 if (![gc inFullScreenMode]) [gc startAnimationTimer]; // keep the game ticking over.
1916 return NO;
1917 }
1918
1919 // end of critical section
1920 if (![gc inFullScreenMode] && stopOnError) [gc startAnimationTimer];
1921
1922 // Load locale script before any regular scripts.
1923 [OOJSScript jsScriptFromFileNamed:@"oolite-locale-functions.js"
1924 properties:nil];
1925
1926 [[GameController sharedController] logProgress:DESC(@"loading-scripts")];
1927
1928 [UNIVERSE setBlockJSPlayerShipProps:NO]; // full access to player.ship properties!
1932
1933#if OOLITE_WINDOWS
1934 if (saveGame)
1935 {
1936 [UNIVERSE preloadSounds];
1937 [self setUpSound];
1939 [UNIVERSE loadConditionScripts];
1940 commodityScripts = [[NSMutableDictionary alloc] init];
1941 }
1942#else
1943 /* on OSes that allow safe deletion of open files, can use sounds
1944 * on the OXZ screen and other start screens */
1945 [UNIVERSE preloadSounds];
1946 [self setUpSound];
1947 if (saveGame)
1948 {
1950 [UNIVERSE loadConditionScripts];
1951 commodityScripts = [[NSMutableDictionary alloc] init];
1952 }
1953#endif
1954
1955 // make sure extraGuiScreenKeys is clear
1957
1958 [[GameController sharedController] logProgress:OOExpandKeyRandomized(@"loading-miscellany")];
1959
1960 // if there is cargo remaining from previously (e.g. a game restart), remove it
1961 if ([self cargoList] != nil)
1962 {
1963 [self removeAllCargo:YES]; // force removal of cargo
1964 }
1965
1966 [self setShipDataKey:PLAYER_SHIP_DESC];
1968
1969 // reset HUD & default commlog behaviour
1970 [UNIVERSE setAutoCommLog:YES];
1971 [UNIVERSE setPermanentCommLog:NO];
1972
1973 [multiFunctionDisplayText release];
1974 multiFunctionDisplayText = [[NSMutableDictionary alloc] init];
1975
1976 [multiFunctionDisplaySettings release];
1977 multiFunctionDisplaySettings = [[NSMutableArray alloc] init];
1978
1979 [customDialSettings release];
1980 customDialSettings = [[NSMutableDictionary alloc] init];
1981
1982 [self switchHudTo:@"hud.plist"];
1983 scanner_zoom_rate = 0.0f;
1985
1986 [mission_variables release];
1987 mission_variables = [[NSMutableDictionary alloc] init];
1988
1989 [localVariables release];
1990 localVariables = [[NSMutableDictionary alloc] init];
1991
1992 [self setScriptTarget:nil];
1993 [self resetMissionChoice];
1994 [[UNIVERSE gameView] resetTypedString];
1995 found_system_id = -1;
1996
1997 [reputation release];
1998 reputation = [[NSMutableDictionary alloc] initWithCapacity:6];
1999 [reputation oo_setInteger:0 forKey:CONTRACTS_GOOD_KEY];
2000 [reputation oo_setInteger:0 forKey:CONTRACTS_BAD_KEY];
2001 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:CONTRACTS_UNKNOWN_KEY];
2002 [reputation oo_setInteger:0 forKey:PASSAGE_GOOD_KEY];
2003 [reputation oo_setInteger:0 forKey:PASSAGE_BAD_KEY];
2004 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:PASSAGE_UNKNOWN_KEY];
2005 [reputation oo_setInteger:0 forKey:PARCEL_GOOD_KEY];
2006 [reputation oo_setInteger:0 forKey:PARCEL_BAD_KEY];
2007 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:PARCEL_UNKNOWN_KEY];
2008
2010 roleWeights = [[NSMutableArray alloc] initWithCapacity:8];
2011 for (i = 0 ; i < 8 ; i++)
2012 {
2013 [roleWeights addObject:@"player-unknown"];
2014 }
2016 roleWeightFlags = [[NSMutableDictionary alloc] init];
2017
2019 roleSystemList = [[NSMutableArray alloc] initWithCapacity:32];
2020
2021 energy = 256;
2022 weapon_temp = 0.0f;
2023 forward_weapon_temp = 0.0f;
2024 aft_weapon_temp = 0.0f;
2025 port_weapon_temp = 0.0f;
2026 starboard_weapon_temp = 0.0f;
2027 lastShot = nil;
2032 ship_temperature = 60.0f;
2033 alertFlags = 0;
2037
2038 flightRoll = 0.0f;
2039 flightPitch = 0.0f;
2040 flightYaw = 0.0f;
2041
2042 max_passengers = 0;
2043 [passengers release];
2044 passengers = [[NSMutableArray alloc] init];
2045 [passenger_record release];
2046 passenger_record = [[NSMutableDictionary alloc] init];
2047
2048 [contracts release];
2049 contracts = [[NSMutableArray alloc] init];
2050 [contract_record release];
2051 contract_record = [[NSMutableDictionary alloc] init];
2052
2053 [parcels release];
2054 parcels = [[NSMutableArray alloc] init];
2055 [parcel_record release];
2056 parcel_record = [[NSMutableDictionary alloc] init];
2057
2058 [missionDestinations release];
2059 missionDestinations = [[NSMutableDictionary alloc] init];
2060
2061 [shipyard_record release];
2062 shipyard_record = [[NSMutableDictionary alloc] init];
2063
2064 [target_memory release];
2065 target_memory = [[NSMutableArray alloc] initWithCapacity:PLAYER_TARGET_MEMORY_SIZE];
2066 [self clearTargetMemory]; // also does first-time initialisation
2067
2068 [self setMissionOverlayDescriptor:nil];
2069 [self setMissionBackgroundDescriptor:nil];
2070 [self setMissionBackgroundSpecial:nil];
2071 [self setEquipScreenBackgroundDescriptor:nil];
2072 marketOffset = 0;
2074
2075 script_time = 0.0;
2078
2079 NSCalendarDate *nowDate = [NSCalendarDate calendarDate];
2081 ship_clock += [nowDate hourOfDay] * 3600.0;
2082 ship_clock += [nowDate minuteOfHour] * 60.0;
2085 ship_clock_adjust = 0.0;
2087
2089#if OOLITE_ESPEAK
2091 voice_no = [UNIVERSE setVoice:-1 withGenderM:voice_gender_m];
2092#endif
2093
2094 [_customViews release];
2095 _customViews = nil;
2096 _customViewIndex = 0;
2097
2099
2100 // player commander data
2101 // Most of this is probably also set more than once
2102
2103 [self setCommanderName:PLAYER_DEFAULT_NAME];
2104 [self setLastsaveName:PLAYER_DEFAULT_NAME];
2105
2106 galaxy_coordinates = NSMakePoint(0x14,0xAD); // 20,173
2107
2108 credits = 1000;
2110 fuel_accumulator = 0.0f;
2111 fuel_leak_rate = 0.0f;
2112
2113 galaxy_number = 0;
2114 // will load real weapon data later
2120
2122
2124 last_ecm_time = [UNIVERSE getTime];
2126 ident_engaged = NO;
2127
2128 max_cargo = 20; // will be reset later
2130
2132 shipCommodityData = [[[UNIVERSE commodities] generateManifestForPlayer] retain];
2133
2134 // set up missiles
2137
2138 [eqScripts release];
2139 eqScripts = [[NSMutableArray alloc] init];
2140 primedEquipment = 0;
2141 [self setFastEquipmentA:@"EQ_CLOAKING_DEVICE"];
2142 [self setFastEquipmentB:@"EQ_ENERGY_BOMB"]; // for compatibility purposes
2143
2144 [self setActiveMissile:0];
2145 for (i = 0; i < missiles; i++)
2146 {
2147 [missile_entity[i] release];
2148 missile_entity[i] = nil;
2149 }
2150 [self safeAllMissiles];
2151
2152 [self clearSubEntities];
2153
2154 legalStatus = 0;
2155
2156 market_rnd = 0;
2157 ship_kills = 0;
2163 chart_zoom = 1.0;
2164 target_chart_zoom = 1.0;
2165 saved_chart_zoom = 1.0;
2167
2168
2171 scoopOverride = NO;
2172
2175
2178
2179 forward_shield = [self maxForwardShieldLevel];
2180 aft_shield = [self maxAftShieldLevel];
2181
2183
2184 [UNIVERSE clearGUIs];
2185
2188
2189 [self setDockedStation:[UNIVERSE station]];
2190
2191 [commLog release];
2192 commLog = nil;
2193
2194 [specialCargo release];
2195 specialCargo = nil;
2196
2197 // views
2203
2205 [self currentWeaponStats];
2206
2207 [save_path autorelease];
2208 save_path = nil;
2209
2210 [scannedWormholes release];
2211 scannedWormholes = [[NSMutableArray alloc] init];
2212
2213 [self setUpTrumbles];
2214
2216
2217 scoopsActive = NO;
2218
2219 [dockingReport release];
2220 dockingReport = [[NSMutableString alloc] init];
2221
2222 [shipAI release];
2223 shipAI = [[AI alloc] initWithStateMachine:PLAYER_DOCKING_AI_NAME andState:@"GLOBAL"];
2224 [self resetAutopilotAI];
2225
2226 lastScriptAlertCondition = [self alertCondition];
2227
2228 entity_personality = ranrot_rand() & 0x7FFF;
2229
2230 [self setSystemID:[UNIVERSE findSystemNumberAtCoords:[self galaxy_coordinates] withGalaxy:galaxy_number includingHidden:YES]];
2231 [UNIVERSE setGalaxyTo:galaxy_number];
2232 [UNIVERSE setSystemTo:system_id];
2233
2234 [self setUpWeaponSounds];
2235
2236 [self setGalacticHyperspaceBehaviourTo:[[UNIVERSE globalSettings] oo_stringForKey:@"galactic_hyperspace_behaviour" defaultValue:@"BEHAVIOUR_STANDARD"]];
2237 [self setGalacticHyperspaceFixedCoordsTo:[[UNIVERSE globalSettings] oo_stringForKey:@"galactic_hyperspace_fixed_coords" defaultValue:@"96 96"]];
2238
2240
2241 demoShip = nil;
2242
2244 [stickProfileScreen release];
2245 stickProfileScreen = [[StickProfileScreen alloc] init];
2246 return YES;
2247}
#define PLAYER_STARTING_MISSILES
#define PLAYER_SHIP_CLOCK_START
#define PLAYER_STARTING_MAX_MISSILES
GameController * sharedController()
void logProgress:(NSString *message)
NSArray * cargoList()
StickProfileScreen * stickProfileScreen
double fieldOfView
OOAlertCondition lastScriptAlertCondition
NSDictionary * loadScripts()
GLfloat _scriptedMisjumpRange
Definition ShipEntity.h:284
unsigned scripted_misjump
Definition ShipEntity.h:278
GLfloat scannerRange
Definition ShipEntity.h:317

◆ setUpShipFromDictionary:

- (BOOL) setUpShipFromDictionary: (NSDictionary *)  shipDict
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

2283{
2285 [UNIVERSE setBlockJSPlayerShipProps:NO]; // full access to player.ship properties!
2286
2288
2289 DESTROY(cargo);
2290 cargo = [[NSMutableArray alloc] initWithCapacity:max_cargo];
2291
2292 // Player-only settings.
2293 //
2294 // set control factors..
2295 roll_delta = 2.0f * max_flight_roll;
2297 yaw_delta = 2.0f * max_flight_yaw;
2298
2299 energy = maxEnergy;
2300 //if (forward_weapon_type == WEAPON_NONE) [self setWeaponDataFromType:forward_weapon_type];
2302
2303 [roleSet release];
2304 roleSet = nil;
2305 [self setPrimaryRole:@"player"];
2306
2307 [self removeAllEquipment];
2308 [self addEquipmentFromCollection:[shipDict objectForKey:@"extra_equipment"]];
2309
2310 [self resetHud];
2311 [hud setHidden:NO];
2312
2313 // set up missiles
2314 // sanity check the number of missiles...
2317 // end sanity check
2318
2319 unsigned i;
2320 for (i = 0; i < PLAYER_MAX_MISSILES; i++)
2321 {
2322 [missile_entity[i] release];
2323 missile_entity[i] = nil;
2324 }
2325 for (i = 0; i < missiles; i++)
2326 {
2328 missile_entity[i] = [UNIVERSE newShipWithRole:@"EQ_MISSILE"]; // retain count = 1
2329 }
2330
2332 [self safeAllMissiles];
2333 [self setActiveMissile:0];
2334
2335 // set view offsets
2336 [self setDefaultViewOffsets];
2337
2338 if (EXPECT(_scaleFactor == 1.0f))
2339 {
2340 forwardViewOffset = [shipDict oo_vectorForKey:@"view_position_forward" defaultValue:forwardViewOffset];
2341 aftViewOffset = [shipDict oo_vectorForKey:@"view_position_aft" defaultValue:aftViewOffset];
2342 portViewOffset = [shipDict oo_vectorForKey:@"view_position_port" defaultValue:portViewOffset];
2343 starboardViewOffset = [shipDict oo_vectorForKey:@"view_position_starboard" defaultValue:starboardViewOffset];
2344 }
2345 else
2346 {
2351 }
2352
2353 [self setDefaultCustomViews];
2354
2355 NSArray *customViews = [shipDict oo_arrayForKey:@"custom_views"];
2356 if (customViews != nil)
2357 {
2358 [_customViews release];
2359 _customViews = [customViews retain];
2360 _customViewIndex = 0;
2361 }
2362
2363 massLockable = [shipDict oo_boolForKey:@"mass_lockable" defaultValue:YES];
2364
2365 // Load js script
2366 [script autorelease];
2367 NSDictionary *scriptProperties = [NSDictionary dictionaryWithObject:self forKey:@"ship"];
2368 script = [OOScript jsScriptFromFileNamed:[shipDict oo_stringForKey:@"script"]
2369 properties:scriptProperties];
2370 if (script == nil)
2371 {
2372 // Do not switch to using a default value above; we want to use the default script if loading fails.
2373 script = [OOScript jsScriptFromFileNamed:@"oolite-default-player-script.js"
2374 properties:scriptProperties];
2375 }
2376 [script retain];
2377
2378 return YES;
2379}
OORoleSet * roleSet
Definition ShipEntity.h:332
OOJSScript * script
Definition ShipEntity.h:222

◆ setUpSound

- (void) setUpSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

74{
75 [self destroySound];
76
77 sInterfaceBeepSource = [[OOSoundSource alloc] init];
78 [sInterfaceBeepSource setPosition:kInterfaceBeepPosition];
79
80 sBreakPatternSource = [[OOSoundSource alloc] init];
81 [sBreakPatternSource setPosition:kBreakPatternPosition];
82
83 sEcmSource = [[OOSoundSource alloc] init];
84 [sEcmSource setPosition:kEcmPosition];
85
87 [sHyperspaceSoundSource setPosition:kWitchspacePosition];
88
89 sBuySellSourcePool = [[OOSoundSourcePool alloc] initWithCount:kBuySellSourcePoolSize minRepeatTime:0.0];
90 sWarningSoundPool = [[OOSoundSourcePool alloc] initWithCount:kWarningPoolSize minRepeatTime:0.0];
91 sWeaponSoundPool = [[OOSoundSourcePool alloc] initWithCount:kWeaponPoolSize minRepeatTime:0.0];
92 sDamageSoundPool = [[OOSoundSourcePool alloc] initWithCount:kDamagePoolSize minRepeatTime:0.1]; // Repeat time limit is to avoid playing a scrape sound every frame on glancing scrapes. This does limit the number of laser hits that can be played in a furrball, though; maybe lasers and scrapes should use different pools.
93 sMiscSoundPool = [[OOSoundSourcePool alloc] initWithCount:kMiscPoolSize minRepeatTime:0.0];
94
95 // Two sources with the same sound are used to simulate looping.
96 OOSound *afterburnerSound = [ResourceManager ooSoundNamed:@"afterburner1.ogg" inFolder:@"Sounds"];
97 sAfterburnerSources[0] = [[OOSoundSource alloc] initWithSound:afterburnerSound];
98 [sAfterburnerSources[0] setPosition:kAfterburner1Position];
99 sAfterburnerSources[1] = [[OOSoundSource alloc] initWithSound:afterburnerSound];
100 [sAfterburnerSources[1] setPosition:kAfterburner2Position];
101}
OOSound * ooSoundNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)

◆ setupStartScreenGui

- (void) setupStartScreenGui

Definition at line 9242 of file PlayerEntity.m.

9922{
9923 GuiDisplayGen *gui = [UNIVERSE gui];
9924 NSString *text = nil;
9925
9926 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9927
9928 [gui clear];
9929
9930 [gui setTitle:@"Oolite"];
9931
9932 text = DESC(@"game-copyright");
9933 [gui setText:text forRow:15 align:GUI_ALIGN_CENTER];
9934 [gui setColor:[OOColor whiteColor] forRow:15];
9935
9936 text = DESC(@"theme-music-credit");
9937 [gui setText:text forRow:17 align:GUI_ALIGN_CENTER];
9938 [gui setColor:[OOColor grayColor] forRow:17];
9939
9940 int initialRow = 22;
9941 int row = initialRow;
9942
9943 text = DESC(@"oolite-start-option-1");
9944 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9945 [gui setColor:[OOColor yellowColor] forRow:row];
9946 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9947
9948 ++row;
9949
9950 text = DESC(@"oolite-start-option-2");
9951 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9952 [gui setColor:[OOColor yellowColor] forRow:row];
9953 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9954
9955 ++row;
9956
9957 text = DESC(@"oolite-start-option-3");
9958 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9959 [gui setColor:[OOColor yellowColor] forRow:row];
9960 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9961
9962 ++row;
9963
9964 text = DESC(@"oolite-start-option-4");
9965 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9966 [gui setColor:[OOColor yellowColor] forRow:row];
9967 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9968
9969 ++row;
9970
9971 text = DESC(@"oolite-start-option-5");
9972 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9973 [gui setColor:[OOColor yellowColor] forRow:row];
9974 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9975
9976 ++row;
9977
9978 text = DESC(@"oolite-start-option-6");
9979 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9980 [gui setColor:[OOColor yellowColor] forRow:row];
9981 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9982
9983
9984 [gui setSelectableRange:NSMakeRange(initialRow, row - initialRow + 1)];
9985 [gui setSelectedRow:initialRow];
9986
9987 [gui setBackgroundTextureKey:@"intro"];
9988
9989}
OOColor * whiteColor()
Definition OOColor.m:256

◆ setUpTrumbles

- (void) setUpTrumbles

Definition at line 9242 of file PlayerEntity.m.

11989{
11990 NSMutableString *trumbleDigrams = [NSMutableString stringWithCapacity:256];
11991 unichar xchar = (unichar)0;
11993
11994 while ([trumbleDigrams length] < PLAYER_MAX_TRUMBLES + 2)
11995 {
11996 NSString *commanderName = [self commanderName];
11997 if ([commanderName length] > 0)
11998 {
11999 [trumbleDigrams appendFormat:@"%@%@", commanderName, [[self mesh] modelName]];
12000 }
12001 else
12002 {
12003 [trumbleDigrams appendString:@"Some Random Text!"];
12004 }
12005 }
12006 int i;
12007 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12008 {
12009 digramchars[0] = ([trumbleDigrams characterAtIndex:i] & 0x007f) | 0x0020;
12010 digramchars[1] = (([trumbleDigrams characterAtIndex:i + 1] ^ xchar) & 0x007f) | 0x0020;
12011 xchar = digramchars[0];
12012 NSString *digramstring = [NSString stringWithCharacters:digramchars length:2];
12013 [trumble[i] release];
12014 trumble[i] = [[OOTrumble alloc] initForPlayer:self digram:digramstring];
12015 }
12016
12017 trumbleCount = 0;
12018
12019 [self setTrumbleAppetiteAccumulator:0.0f];
12020}
NSString * commanderName()

◆ setUpWeaponSounds

- (void) setUpWeaponSounds

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

106{
107 NSArray *eqTypes = [OOEquipmentType allEquipmentTypes];
108 NSMutableDictionary *shotMissSounds = [NSMutableDictionary dictionary];
109 NSMutableDictionary *shotHitSounds = [NSMutableDictionary dictionary];
110 NSMutableDictionary *shieldHitSounds = [NSMutableDictionary dictionary];
111 NSMutableDictionary *unshieldedHitSounds = [NSMutableDictionary dictionary];
112 NSMutableDictionary *weaponLaunchedSounds = [NSMutableDictionary dictionary];
113 NSEnumerator *eqTypeEnum = nil;
114 OOEquipmentType *eqType = nil;
115
116 // special case: turrets aren't defined with a "EQ_WEAPON" prefix, and plasma shots don't have a matching equipment item,
117 // so add a unique entry here. this could be overridden if an OXP creates an equipment item with this key.
118 // plasma shots don't make a sound when fired, so we only need to provide for the hit player sound keys.
119 [shieldHitSounds setObject:@"[player-hit-by-weapon]" forKey:@"EQ_WEAPON_PLASMA_SHOT"];
120 [unshieldedHitSounds setObject:@"[player-direct-hit]" forKey:@"EQ_WEAPON_PLASMA_SHOT"];
121 // grab a local copy of the sound identifiers for weapons to make the process of looking up a sound ref as fast as possible
122 // but we must ensure that no nil values are used for setObject
123 #define OO_ASSIGN_SOUNDSTR_TO_SOUNDS(soundStr, sounds) do { \
124 fxString = [eqType soundStr]; \
125 if (!fxString) fxString = @""; \
126 [sounds setObject:fxString forKey:[eqType identifier]]; \
127 } while(0)
128
129 for (eqTypeEnum = [eqTypes objectEnumerator]; (eqType = [eqTypeEnum nextObject]); )
130 {
131 NSString *fxString = nil;
132 if ([[eqType identifier] hasPrefix:@"EQ_WEAPON"])
133 {
134 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxShotMissName, shotMissSounds);
135 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxShotHitName, shotHitSounds);
136 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxShieldHitName, shieldHitSounds);
137 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxUnshieldedHitName, unshieldedHitSounds);
138 }
139 if ([eqType isMissileOrMine])
140 {
141 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxWeaponLaunchedName, weaponLaunchedSounds);
142 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxShieldHitName, shieldHitSounds);
143 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxUnshieldedHitName, unshieldedHitSounds);
144 }
145 }
146
152
153 weaponShotMiss = [[NSDictionary alloc] initWithDictionary:shotMissSounds];
154 weaponShotHit = [[NSDictionary alloc] initWithDictionary:shotHitSounds];
155 weaponShieldHit = [[NSDictionary alloc] initWithDictionary:shieldHitSounds];
156 weaponUnshieldedHit = [[NSDictionary alloc] initWithDictionary:unshieldedHitSounds];
157 weaponLaunched = [[NSDictionary alloc] initWithDictionary:weaponLaunchedSounds];
158}
#define OO_ASSIGN_SOUNDSTR_TO_SOUNDS(soundStr, sounds)
NSArray * allEquipmentTypes()

◆ setWeaponMount:toWeapon:

- (BOOL) setWeaponMount: (OOWeaponFacing chosen_weapon_facing
toWeapon: (NSString *)  eqKey 

Reimplemented from ShipEntity.

Definition at line 9242 of file PlayerEntity.m.

10603{
10604 return [self setWeaponMount:facing toWeapon:eqKey inContext:@"purchase"];
10605}
OOWeaponFacing
Definition OOTypes.h:228

◆ setWeaponMount:toWeapon:inContext:

- (BOOL) setWeaponMount: (OOWeaponFacing facing
toWeapon: (NSString *)  eqKey
inContext: (NSString *)  context 

Definition at line 9242 of file PlayerEntity.m.

10609{
10610
10612 unsigned available_facings = [shipyardInfo oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:[self weaponFacings]]; // use defaults explicitly
10613
10614 // facing exists?
10615 if (!(available_facings & facing))
10616 {
10617 return NO;
10618 }
10619
10620 // weapon allowed (or NONE)?
10621 if (![eqKey isEqualToString:@"EQ_WEAPON_NONE"])
10622 {
10623 if (![self canAddEquipment:eqKey inContext:context])
10624 {
10625 return NO;
10626 }
10627 }
10628
10629 // sets WEAPON_NONE if not recognised
10631
10632 switch (facing)
10633 {
10636 break;
10637
10638 case WEAPON_FACING_AFT:
10640 break;
10641
10642 case WEAPON_FACING_PORT:
10644 break;
10645
10648 break;
10649
10650 case WEAPON_FACING_NONE:
10651 break;
10652 }
10653
10654 return YES;
10655}
OOWeaponType OOWeaponTypeFromEquipmentIdentifierStrict(NSString *string) PURE_FUNC

Referenced by PlayerShipSetProperty(), and ShipSetProperty().

+ Here is the caller graph for this function:

◆ setWeaponsOnline:

- (void) setWeaponsOnline: (BOOL newValue

Definition at line 13727 of file PlayerEntity.m.

6177 :(BOOL)newValue
6178{
6180 if (!weapons_online) [self safeAllMissiles];
6181}

◆ setWitchspaceCountdown:

- (void) setWitchspaceCountdown: (int spin_time

Definition at line 9242 of file PlayerEntity.m.

13003 :(int)spin_time
13004{
13006}

Referenced by PlayerShipBeginGalacticHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ setWormhole:

- (void) setWormhole: (WormholeEntity *)  newWormhole

Definition at line 13727 of file PlayerEntity.m.

900{
901 [wormhole release];
902 if (newWormhole != nil)
903 {
904 wormhole = [newWormhole retain];
905 }
906 else
907 {
908 wormhole = nil;
909 }
910}

◆ sharedPlayer

+ (PlayerEntity *) sharedPlayer

Definition at line 13727 of file PlayerEntity.m.

180{
181 if (EXPECT_NOT(gOOPlayer == nil))
182 {
183 gOOPlayer = [[PlayerEntity alloc] init];
184 }
185 return gOOPlayer;
186}

Referenced by InitOOJSPlayerShip().

+ Here is the caller graph for this function:

◆ shipCommodityData

- (OOCommodityMarket *) shipCommodityData

◆ shipsFound_number

- (NSNumber *) shipsFound_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

956{
957 return [NSNumber numberWithInt:shipsFound];
958}

◆ shipyardRecord

- (NSMutableDictionary *) shipyardRecord

Definition at line 9242 of file PlayerEntity.m.

13354{
13355 return shipyard_record;
13356}

◆ showCommanderShip:

- (void) showCommanderShip: (int cdrArrayIndex
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1011 of file PlayerEntityLoadSave.m.

1211 :(int)cdrArrayIndex
1212{
1213 GuiDisplayGen *gui=[UNIVERSE gui];
1214 [UNIVERSE removeDemoShips];
1215 NSDictionary *cdr=[cdrDetailArray objectAtIndex: cdrArrayIndex];
1216
1217 [gui setText:@"" forRow:CDRDESCROW align:GUI_ALIGN_LEFT];
1218 [gui setText:@"" forRow:CDRDESCROW + 1 align:GUI_ALIGN_LEFT];
1219 [gui setText:@"" forRow:CDRDESCROW + 2 align:GUI_ALIGN_LEFT];
1220
1221 if ([cdr oo_boolForKey:@"isFolder"])
1222 {
1223 NSString *folderDesc=[NSString stringWithFormat: DESC(@"loadsavescreen-hold-@-and-press-return-to-open-folder-@"), @COMMAND_MODIFIER_KEY, [[cdr oo_stringForKey:@"saved_game_path"] lastPathComponent]];
1224 [gui setColor: [OOColor orangeColor] forRow: CDRDESCROW];
1225 [gui addLongText: folderDesc startingAtRow: CDRDESCROW align: GUI_ALIGN_LEFT];
1226 return;
1227 }
1228
1229 if ([cdr oo_boolForKey:@"isParentFolder"])
1230 {
1231 NSString *folderDesc=[NSString stringWithFormat: DESC(@"loadsavescreen-hold-@-and-press-return-to-open-parent-folder-@"), @COMMAND_MODIFIER_KEY, [[cdr oo_stringForKey:@"saved_game_path"] lastPathComponent]];
1232 [gui setColor: [OOColor orangeColor] forRow: CDRDESCROW];
1233 [gui addLongText: folderDesc startingAtRow: CDRDESCROW align: GUI_ALIGN_LEFT];
1234 return;
1235 }
1236 [gui setColor:[gui colorFromSetting:nil defaultValue:nil] forRow: CDRDESCROW];
1237
1238 if (![cdr oo_boolForKey:@"isSavedGame"]) return; // don't show things that aren't saved games
1239
1240 if ([self dockedStation] == nil) [self setDockedAtMainStation];
1241
1242 // Display the commander's ship.
1243 NSString *shipDesc = [cdr oo_stringForKey:@"ship_desc"];
1244 NSString *shipName = nil;
1245 NSDictionary *shipDict = nil;
1246 NSString *rating = nil;
1247 uint16_t personality = PersonalityForCommanderDict(cdr);
1248
1249 shipDict = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipDesc];
1250 if(shipDict != nil)
1251 {
1252 NSMutableDictionary * dict = [[NSMutableDictionary alloc] initWithCapacity:[shipDict count] + 1];
1253 [dict setDictionary:shipDict];
1254 id subEntStatus = [cdr objectForKey:@"subentities_status"];
1255 // don't add it to the dictionary if there's no subentities_status key
1256 if (subEntStatus != nil) [dict setObject:subEntStatus forKey:@"subentities_status"];
1257 [self showShipyardModel:shipDesc shipData:dict personality:personality];
1258 [dict release];
1259 shipName = [shipDict oo_stringForKey:@"display_name"];
1260 if (shipName == nil) shipName = [shipDict oo_stringForKey:KEY_NAME];
1261 }
1262 else
1263 {
1264 [self showShipyardModel:@"oolite-unknown-ship" shipData:nil personality:personality];
1265 shipName = [cdr oo_stringForKey:@"ship_name" defaultValue:@"unknown"];
1266 if (![[UNIVERSE useAddOns] isEqualToString:SCENARIO_OXP_DEFINITION_ALL])
1267 {
1268 shipName = [shipName stringByAppendingString:@" - OXPs disabled or not installed"];
1269 }
1270 else
1271 {
1272 shipName = [shipName stringByAppendingString:@" - OXP not installed"];
1273 }
1274 }
1275
1276 // Make a short description of the commander
1277 NSString *legalDesc = OODisplayStringFromLegalStatus([cdr oo_intForKey:@"legal_status"]);
1278
1279 rating = KillCountToRatingAndKillString([cdr oo_unsignedIntForKey:@"ship_kills"]);
1280 OOCreditsQuantity money = OODeciCreditsFromObject([cdr objectForKey:@"credits"]);
1281
1282 // Nikos - Add some more information in the load game screen (current location, galaxy number and timestamp).
1283 //-------------------------------------------------------------------------------------------------------------------------
1284
1285 int galNumber;
1286 NSString *timeStamp = nil;
1287 NSString *locationName = [cdr oo_stringForKey:@"current_system_name"];
1288
1289 // If there is no key containing the name of the current system in
1290 // the savefile, calculating what it should have been is going to
1291 // be tricky now that system generation isn't seed based - but
1292 // this implies a save game well over 5 years old.
1293 if (locationName == nil)
1294 {
1295 // Leaving the location blank in this case is probably okay
1296 locationName = @"";
1297 }
1298
1299 galNumber = [cdr oo_intForKey:@"galaxy_number"] + 1; // Galaxy numbering starts at 0.
1300
1301 NSString *locationGov = @"";
1302 NSString *locationEco = @"";
1303 NSString *locationTL = [cdr objectForKey:@"current_system_techlevel"] ? [NSString stringWithFormat:@"%u", [cdr oo_unsignedIntForKey:@"current_system_techlevel"] + 1] : nil;
1304 if (locationTL)
1305 {
1306 locationGov = [NSString stringWithFormat:@"%c", [cdr oo_unsignedCharForKey:@"current_system_government"]];
1307 locationEco = [NSString stringWithFormat:@" %c", (7 - [cdr oo_unsignedCharForKey:@"current_system_economy"]) + 16];
1308 }
1309 else locationTL = @"";
1310
1311 timeStamp = ClockToString([cdr oo_doubleForKey:@"ship_clock" defaultValue:PLAYER_SHIP_CLOCK_START], NO);
1312
1313 //-------------------------------------------------------------------------------------------------------------------------
1314
1315 NSString *cdrDesc = nil;
1316
1317 cdrDesc = [NSString stringWithFormat:DESC(@"loadsavescreen-commander-@-rated-@-has-@-legal-status-@-ship-@-location-@-g-@-eco-@-gov-@-tl-@-timestamp-@"),
1318 [cdr oo_stringForKey:@"player_name"],
1319 rating,
1320 OOCredits(money),
1321 legalDesc,
1322 shipName,
1323 locationName,
1324 galNumber,
1325 locationEco,
1326 locationGov,
1327 locationTL,
1328 timeStamp];
1329
1330 //-------------------------------------------------------------------------------------------------------------------------
1331
1332 [gui addLongText:cdrDesc startingAtRow:CDRDESCROW align:GUI_ALIGN_LEFT];
1333
1334}
OOCreditsQuantity OODeciCreditsFromObject(id object)
static uint16_t PersonalityForCommanderDict(NSDictionary *dict)

◆ showDemoShips

- (BOOL) showDemoShips

◆ showGameOver

- (void) showGameOver
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

4059{
4060 [hud resetGuis:[NSDictionary dictionaryWithObject:[NSDictionary dictionary] forKey:@"message_gui"]];
4061 NSString *scoreMS = [NSString stringWithFormat:OOExpandKey(@"gameoverscreen-score-@"),
4062 KillCountToRatingAndKillString(ship_kills)];
4063
4064 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-game-over") forCount:kDeadResetTime];
4065 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4066 [UNIVERSE displayMessage:scoreMS forCount:kDeadResetTime];
4067 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4068 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-press-space") forCount:kDeadResetTime];
4069 [UNIVERSE displayMessage:@" " forCount:kDeadResetTime];
4070 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4071 [self resetShotTime];
4072}

◆ showInfoFlag

- (BOOL) showInfoFlag

Definition at line 9242 of file PlayerEntity.m.

12681{
12682 return show_info_flag;
12683}

◆ showInformationForSelectedInterface

- (void) showInformationForSelectedInterface

Definition at line 9242 of file PlayerEntity.m.

9862{
9863 GuiDisplayGen* gui = [UNIVERSE gui];
9865
9866 int i;
9867
9869 {
9870 [gui setText:@"" forRow:i];
9871 [gui setColor:[gui colorFromSetting:kGuiInterfaceDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
9872 }
9873
9874 if (interfaceKey && ![interfaceKey hasPrefix:@"More:"])
9875 {
9876 NSDictionary *interfaces = [[self dockedStation] localInterfaces];
9877 OOJSInterfaceDefinition *definition = [interfaces objectForKey:interfaceKey];
9878 if (definition)
9879 {
9880 [gui addLongText:[definition summary] startingAtRow:GUI_ROW_INTERFACES_DETAIL align:GUI_ALIGN_LEFT];
9881 }
9882 }
9883
9884}
#define GUI_MAX_ROWS
@ GUI_ROW_EQUIPMENT_DETAIL

◆ showInformationForSelectedUpgrade

- (void) showInformationForSelectedUpgrade

Definition at line 9242 of file PlayerEntity.m.

9694{
9695 [self showInformationForSelectedUpgradeWithFormatString:nil];
9696}

Referenced by activateSelectedInterface.

+ Here is the caller graph for this function:

◆ showInformationForSelectedUpgradeWithFormatString:

- (void) showInformationForSelectedUpgradeWithFormatString: (NSString *)  extraString

Definition at line 9242 of file PlayerEntity.m.

9700{
9701 GuiDisplayGen* gui = [UNIVERSE gui];
9702 NSString* eqKey = [gui selectedRowKey];
9703 int i;
9704
9705 OOColor *descColor = [gui colorFromSetting:kGuiEquipmentDescriptionColor defaultValue:[OOColor greenColor]];
9707 {
9708 [gui setText:@"" forRow:i];
9709 [gui setColor:descColor forRow:i];
9710 }
9711 if (eqKey)
9712 {
9713 if (![eqKey hasPrefix:@"More:"])
9714 {
9716 NSString* eq_key_damaged = [NSString stringWithFormat:@"%@_DAMAGED", eqKey];
9719 {
9720 desc = [NSString stringWithFormat:DESC(@"upgradeinfo-@-price-is-for-repairing"), desc];
9721 }
9722 else
9723 {
9724 if([eqKey hasSuffix:@"ENERGY_UNIT"] && ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"] || [self hasEquipmentItem:@"EQ_ENERGY_UNIT"] || [self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]))
9725 desc = [NSString stringWithFormat:DESC(@"@-will-replace-other-energy"), desc];
9726 if (weight > 0) desc = [NSString stringWithFormat:DESC(@"upgradeinfo-@-weight-d-of-equipment"), desc, weight];
9727 }
9728 if (formatString) desc = [NSString stringWithFormat:formatString, desc];
9729 [gui addLongText:desc startingAtRow:GUI_ROW_EQUIPMENT_DETAIL align:GUI_ALIGN_LEFT];
9730 }
9731 }
9732}
OOCargoQuantity requiredCargoSpace()
NSString * descriptiveText()

◆ showMarketCashAndLoadLine

- (void) showMarketCashAndLoadLine
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9242 of file PlayerEntity.m.

11347{
11348 GuiDisplayGen *gui = [UNIVERSE gui];
11350 OOCargoQuantity cargoCapacity = [self maxAvailableCargoSpace];
11351 [gui setText:OOExpandKey(@"market-cash-and-load", credits, currentCargo, cargoCapacity) forRow:GUI_ROW_MARKET_CASH];
11352 [gui setColor:[gui colorFromSetting:kGuiMarketCashColor defaultValue:[OOColor yellowColor]] forRow:GUI_ROW_MARKET_CASH];
11353}

◆ showMarketScreenDataLine:forGood:inMarket:holdQuantity:

- (void) showMarketScreenDataLine: (OOGUIRow row
forGood: (OOCommodityType good
inMarket: (OOCommodityMarket *)  localMarket
holdQuantity: (OOCargoQuantity quantity 
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9242 of file PlayerEntity.m.

10953{
10954 GuiDisplayGen *gui = [UNIVERSE gui];
10955 NSString* desc = [NSString stringWithFormat:@" %@ ", [shipCommodityData nameForGood:good]];
10956 OOCargoQuantity available_units = [localMarket quantityForGood:good];
10958 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:good];
10959 OOMassUnit unit = [shipCommodityData massUnitForGood:good];
10960
10961 NSString *available = OOPadStringToEms(((available_units > 0) ? (NSString *)[NSString stringWithFormat:@"%d",available_units] : DESC(@"commodity-quantity-none")), 2.5);
10962
10964 NSString *price = [NSString stringWithFormat:@" %@.%llu ",OOPadStringToEms([NSString stringWithFormat:@"%lu",(unsigned long)(pricePerUnit/10)],2.5),priceDecimal];
10965
10966 // this works with up to 9999 tons of gemstones. Any more than that, they deserve the formatting they get! :)
10967
10968 NSString *owned = OOPadStringToEms((units_in_hold > 0) ? (NSString *)[NSString stringWithFormat:@"%d",units_in_hold] : DESC(@"commodity-quantity-none"), 4.5);
10970 NSString *units_available = [NSString stringWithFormat:@" %@ %@ ",available, units];
10971 NSString *units_owned = [NSString stringWithFormat:@" %@ %@ ",owned, units];
10972
10976 if (import_legality == 0)
10977 {
10978 if (export_legality == 0)
10979 {
10980 legaldesc = DESC(@"oolite-legality-clear");
10981 }
10982 else
10983 {
10984 legaldesc = DESC(@"oolite-legality-import");
10985 }
10986 }
10987 else
10988 {
10989 if (export_legality == 0)
10990 {
10991 legaldesc = DESC(@"oolite-legality-export");
10992 }
10993 else
10994 {
10995 legaldesc = DESC(@"oolite-legality-neither");
10996 }
10997 }
10998 legaldesc = [NSString stringWithFormat:@" %@ ",legaldesc];
10999
11000 NSString *extradesc = [shipCommodityData shortCommentForGood:good];
11001
11002 [gui setKey:good forRow:row];
11003 [gui setColor:[gui colorFromSetting:kGuiMarketCommodityColor defaultValue:nil] forRow:row];
11004 [gui setArray:[NSArray arrayWithObjects: desc, extradesc, price, units_available, units_owned, legaldesc, nil] forRow:row++];
11005
11006}
NSString * DisplayStringForMassUnit(OOMassUnit unit)
NSString * OOPadStringToEms(NSString *string, float numEms)
NSUInteger exportLegalityForGood:(OOCommodityType good)
NSUInteger importLegalityForGood:(OOCommodityType good)
OOCreditsQuantity priceForGood:(OOCommodityType good)

◆ showMarketScreenHeaders

- (void) showMarketScreenHeaders
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9242 of file PlayerEntity.m.

10931{
10932 GuiDisplayGen *gui = [UNIVERSE gui];
10934 tab_stops[0] = 0;
10935 tab_stops[1] = 137;
10936 tab_stops[2] = 187;
10937 tab_stops[3] = 267;
10938 tab_stops[4] = 321;
10939 tab_stops[5] = 431;
10940 [gui overrideTabs:tab_stops from:kGuiMarketTabs length:6];
10941 [gui setTabStops:tab_stops];
10942
10943 [gui setColor:[gui colorFromSetting:kGuiMarketHeadingColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_KEY];
10944 [gui setArray:[NSArray arrayWithObjects: DESC(@"commodity-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10945 OOPadStringToEms(DESC(@"for-sale-column-title"),3.75), OOPadStringToEms(DESC(@"in-hold-column-title"),5.75), DESC(@"oolite-legality-column-title"), DESC(@"oolite-extras-column-title"), nil] forRow:GUI_ROW_MARKET_KEY];
10946 [gui setArray:[NSArray arrayWithObjects: DESC(@"commodity-column-title"), DESC(@"oolite-extras-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10947 OOPadStringToEms(DESC(@"for-sale-column-title"),3.75), OOPadStringToEms(DESC(@"in-hold-column-title"),5.75), DESC(@"oolite-legality-column-title"), nil] forRow:GUI_ROW_MARKET_KEY];
10948
10949}

◆ showScenarioDetails

- (void) showScenarioDetails

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

285{
286 GuiDisplayGen* gui = [UNIVERSE gui];
287 NSString* key = [gui selectedRowKey];
288 [UNIVERSE removeDemoShips];
289
290 if ([key hasPrefix:@"Scenario"])
291 {
292 int item = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
293 NSDictionary *scenario = [[UNIVERSE scenarios] objectAtIndex:item];
294 [self setShowDemoShips:NO];
295 for (NSUInteger i=GUI_ROW_SCENARIOS_DETAIL;i<=27;i++)
296 {
297 [gui setText:@"" forRow:i];
298 }
299 if (scenario)
300 {
301 [gui addLongText:OOExpand([scenario oo_stringForKey:@"description"]) startingAtRow:GUI_ROW_SCENARIOS_DETAIL align:GUI_ALIGN_LEFT];
302 NSString *shipKey = [scenario oo_stringForKey:@"model"];
303 if (shipKey != nil)
304 {
305 [self addScenarioModel:shipKey];
306 [self setShowDemoShips:YES];
307 }
308 }
309
310 }
311}
@ GUI_ROW_SCENARIOS_DETAIL

◆ showShipModel:

- (void) showShipModel: (NSString *)  shipKey

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2148 :(NSString *)role
2149{
2150 if ([role isEqualToString:@"none"] || [role length] == 0)
2151 {
2152 [UNIVERSE removeDemoShips];
2153 return;
2154 }
2155
2156 ShipEntity *ship = [UNIVERSE makeDemoShipWithRole:role spinning:YES];
2157 OOLog(kOOLogNoteShowShipModel, @"::::: showShipModel:'%@' (%@) (%@)", role, ship, [ship name]);
2158}
static NSString *const kOOLogNoteShowShipModel

◆ showShipModelWithKey:shipData:personality:factorX:factorY:factorZ:inContext:

- (void) showShipModelWithKey: (NSString *)  shipKey
shipData: (NSDictionary *)  shipData
personality: (uint16_t personality
factorX: (GLfloat factorX
factorY: (GLfloat factorY
factorZ: (GLfloat factorZ
inContext: (NSString *)  context 

Definition at line 13727 of file PlayerEntity.m.

4076{
4077 if (shipKey == nil) return;
4079 if (shipData == nil) return;
4080
4082 // MKW - retrieve last demo ships' orientation and release it
4083 if( demoShip != nil )
4084 {
4085 q2 = [demoShip orientation];
4086 [demoShip release];
4087 }
4088
4089 ShipEntity *ship = [[ProxyPlayerEntity alloc] initWithKey:shipKey definition:shipData];
4091
4092 [ship wasAddedToUniverse];
4093
4094 if (context) OOLog(@"script.debug.note.showShipModel", @"::::: showShipModel:'%@' in context: %@.", [ship name], context);
4095
4096 GLfloat cr = [ship collisionRadius];
4097 [ship setOrientation: q2];
4098 [ship setPositionX:factorX * cr y:factorY * cr z:factorZ * cr];
4099 [ship setScanClass: CLASS_NO_DRAW];
4100 [ship setDemoShip: 0.6];
4101 [ship setDemoStartTime: [UNIVERSE getTime]];
4103 [ship setAITo: @"nullAI.plist"];
4104 id subEntStatus = [shipData objectForKey:@"subentities_status"];
4105 // show missing subentities if there's a subentities_status key
4106 if (subEntStatus != nil) [ship deserializeShipSubEntitiesFrom:(NSString *)subEntStatus];
4107 [UNIVERSE addEntity: ship];
4108 // MKW - save demo ship for its rotation
4109 demoShip = [ship retain];
4110
4111 [ship setStatus: STATUS_COCKPIT_DISPLAY];
4112
4113 [ship release];
4114}
#define M_SQRT1_2
Definition OOMaths.h:94
#define ENTITY_PERSONALITY_INVALID
Definition ShipEntity.h:111
GLfloat collisionRadius()
Definition Entity.m:906
void setPositionX:y:z:(OOHPScalar x,[y] OOHPScalar y,[z] OOHPScalar z)
Definition Entity.m:655
void setDemoStartTime:(OOTimeAbsolute time)
void deserializeShipSubEntitiesFrom:(NSString *string)
Definition ShipEntity.m:833
void wasAddedToUniverse()
void setPendingEscortCount:(uint8_t count)
void setEntityPersonalityInt:(uint16_t value)
uint8_t pendingEscortCount()
void setDemoShip:(OOScalar demoRate)

◆ showShipyardInfoForSelection

- (void) showShipyardInfoForSelection

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1597{
1598 NSUInteger i;
1599 GuiDisplayGen *gui = [UNIVERSE gui];
1600 OOGUIRow sel_row = [gui selectedRow];
1601
1602 if (sel_row <= 0) return;
1603
1604 NSMutableArray *row_info = [NSMutableArray arrayWithArray:(NSArray*)[gui objectForRow:GUI_ROW_SHIPYARD_LABELS]];
1605 while ([row_info count] < 4)
1606 {
1607 [row_info addObject:@""];
1608 }
1609
1610 NSString *key = [gui keyForRow:sel_row];
1611
1612 NSDictionary *info = [currentShipyard oo_dictionaryForKey:key];
1613
1614 // clean up the display ready for the newly-selected ship (if there is one)
1615 [row_info replaceObjectAtIndex:2 withObject:@""];
1616 [row_info replaceObjectAtIndex:3 withObject:@""];
1617 for (i = GUI_ROW_SHIPYARD_INFO_START; i < GUI_ROW_MARKET_CASH - 1; i++)
1618 {
1619 [gui setText:@"" forRow:i];
1620 [gui setColor:[gui colorFromSetting:kGuiShipyardDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
1621 }
1622 [UNIVERSE removeDemoShips];
1623
1624 if (info)
1625 {
1626 // the key is a particular ship - show the details
1627 NSString *salesPitch = [info oo_stringForKey:KEY_SHORT_DESCRIPTION];
1628 NSDictionary *shipDict = [info oo_dictionaryForKey:SHIPYARD_KEY_SHIP];
1629
1630 int cargoRating = [shipDict oo_intForKey:@"max_cargo"];
1631 int cargo_extra;
1632 cargo_extra = [shipDict oo_intForKey:@"extra_cargo" defaultValue:15];
1633 float speedRating = 0.001 * [shipDict oo_intForKey:@"max_flight_speed"];
1634
1635 NSArray *shipExtras = [info oo_arrayForKey:KEY_EQUIPMENT_EXTRAS];
1636 for (i = 0; i < [shipExtras count]; i++)
1637 {
1638 if ([[shipExtras oo_stringAtIndex:i] isEqualToString:@"EQ_CARGO_BAY"])
1639 {
1640 cargoRating += cargo_extra;
1641 }
1642 else if ([[shipExtras oo_stringAtIndex:i] isEqualToString:@"EQ_PASSENGER_BERTH"])
1643 {
1644 cargoRating -= PASSENGER_BERTH_SPACE;
1645 }
1646 }
1647
1648 [row_info replaceObjectAtIndex:2 withObject:OOExpandKey(@"shipyard-cargo-value", cargoRating)];
1649 [row_info replaceObjectAtIndex:3 withObject:OOExpandKey(@"shipyard-speed-value", speedRating)];
1650
1651 // Show footer first. It'll be overwritten by the sales_pitch if that text is longer than usual.
1652 [self showTradeInInformationFooter];
1653 i = [gui addLongText:salesPitch startingAtRow:GUI_ROW_SHIPYARD_INFO_START align:GUI_ALIGN_LEFT];
1654 if (i - 1 >= GUI_ROW_MARKET_CASH - 1)
1655 {
1656 [gui setColor:[gui colorFromSetting:kGuiShipyardDescriptionColor defaultValue:[OOColor greenColor]] forRow:i - 1];
1657 [gui setColor:[gui colorFromSetting:kGuiShipyardDescriptionColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_CASH - 1];
1658 }
1659
1660 // now display the ship
1661 [self showShipyardModel:[info oo_stringForKey:SHIPYARD_KEY_SHIPDATA_KEY]
1662 shipData:shipDict
1663 personality:[info oo_unsignedShortForKey:SHIPYARD_KEY_PERSONALITY]];
1664 }
1665 else
1666 {
1667 // the key is a particular model of ship which we must expand...
1668 // build an array from the entries for that model in the currentShipyard TODO
1669 //
1670 }
1671
1672 [gui setArray:[NSArray arrayWithArray:row_info] forRow:GUI_ROW_SHIPYARD_LABELS];
1673}

◆ showShipyardModel:shipData:personality:

- (void) showShipyardModel: (NSString *)  shipKey
shipData: (NSDictionary *)  shipDict
personality: (uint16_t personality 

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1690 :(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality
1691{
1692 if (shipKey == nil || [self dockedStation] == nil) return;
1693 [self showShipModelWithKey:shipKey shipData:shipData personality:personality factorX:1.2 factorY:0.8 factorZ:6.4 inContext:@"shipyard"];
1694}

◆ showTradeInInformationFooter

- (void) showTradeInInformationFooter

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1677{
1678 GuiDisplayGen *gui = [UNIVERSE gui];
1679 OOCreditsQuantity tradeIn = [self tradeInValue];
1680 OOCreditsQuantity total = tradeIn + credits;
1681 NSString *shipType = [self displayName];
1682
1683 [gui setColor:[gui colorFromSetting:kGuiShipyardTradeinColor defaultValue:nil] forRow:GUI_ROW_MARKET_CASH - 1];
1684 [gui setColor:[gui colorFromSetting:kGuiShipyardTradeinColor defaultValue:nil] forRow:GUI_ROW_MARKET_CASH];
1685 [gui setText:OOExpandKey(@"shipyard-trade-in-value", shipType, tradeIn) forRow: GUI_ROW_MARKET_CASH - 1];
1686 [gui setText:OOExpandKey(@"shipyard-total-available-with-trade-in", shipType, total, credits, tradeIn) forRow: GUI_ROW_MARKET_CASH];
1687}

◆ SliderString

+ (static NSString *) SliderString (NSInteger amountIn20ths
implementation

Definition at line 8865 of file PlayerEntity.m.

8866{
8867 NSString *filledSlider = [@"|||||||||||||||||||||||||" substringToIndex:amountIn20ths];
8868 NSString *emptySlider = [@"........................." substringToIndex:20 - amountIn20ths];
8869 return [NSString stringWithFormat:@"%@%@", filledSlider, emptySlider];
8870}

◆ sortCommanders

- (NSComparisonResult) sortCommanders (id cdr1
(id cdr2
(void *)  context 
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1011 of file PlayerEntityLoadSave.m.

1012{
1013 return [[cdr1 objectForKey:@"saved_game_path"] localizedCompare:[cdr2 objectForKey:@"saved_game_path"]];
1014}

◆ spawnShip:

- (void) spawnShip: (NSString *)  ship_key

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1677 :(NSString *)ship_key
1678{
1679 if ([UNIVERSE spawnShip:ship_key])
1680 {
1681 OOLog(kOOLogNoteAddShips, @"DEBUG: Spawned ship with shipdata key '%@'.", ship_key);
1682 }
1683 else
1684 {
1685 OOLog(kOOLogScriptAddShipsFailed, @"***** SCRIPT ERROR: in %@, could not spawn ship with shipdata key '%@'.", CurrentScriptDesc(), ship_key);
1686 }
1687}

◆ specialCargo

- (NSString *) specialCargo

◆ startAfterburnerSound

- (void) startAfterburnerSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

476{
477 if (!afterburnerSoundLooping)
478 {
479 afterburnerSoundLooping = YES;
480 [self updateAfterburnerSound];
481 }
482}

◆ startScenario

- (BOOL) startScenario

Provided by category PlayerEntity(LoadSave).

Definition at line 1420 of file PlayerEntityLoadSave.m.

315{
316 GuiDisplayGen* gui = [UNIVERSE gui];
317 NSString* key = [gui selectedRowKey];
318
319 if ([key isEqualToString:@"exit"])
320 {
321 // intended to return to main menu
322 return NO;
323 }
324 if ([key hasPrefix:@"__page"])
325 {
326 int page = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
327 [self setGuiToScenarioScreen:page];
328 return YES;
329 }
330 int selection = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
331
332 NSDictionary *scenario = [[UNIVERSE scenarios] objectAtIndex:selection];
333 NSString *file = [scenario oo_stringForKey:@"file" defaultValue:nil];
334 if (file == nil)
335 {
336 OOLog(@"scenario.init.error", @"%@", @"No file entry found for scenario");
337 return NO;
338 }
339 NSString *path = [ResourceManager pathForFileNamed:file inFolder:@"Scenarios"];
340 if (path == nil)
341 {
342 OOLog(@"scenario.init.error", @"Game file not found for scenario %@",file);
343 return NO;
344 }
345 BOOL result = [self loadPlayerFromFile:path asNew:YES];
346 if (!result)
347 {
348 return NO;
349 }
350 [scenarioKey release];
351 scenarioKey = [[scenario oo_stringForKey:@"scenario" defaultValue:nil] retain];
352
353 // don't drop the save game directory in
354 return YES;
355}
NSString * pathForFileNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)

◆ startUpComplete

- (void) startUpComplete

Definition at line 13727 of file PlayerEntity.m.

2275{
2276 JSContext *context = OOJSAcquireContext();
2277 [self doWorldScriptEvent:OOJSID("startUpComplete") inContext:context withArguments:NULL count:0 timeLimit:kOOJSLongTimeLimit];
2278 OOJSRelinquishContext(context);
2279}

◆ status_string

- (NSString *) status_string

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

913{
914 return OOStringFromEntityStatus([self status]);
915}

◆ stickFunctionList

- (NSArray *) stickFunctionList
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

592{
593 NSMutableArray *funcList = [NSMutableArray array];
594
595 // propulsion
596 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-propulsion")]];
597 [funcList addObject:
598 [self makeStickGuiDict:DESC(@"stickmapper-roll")
599 allowable:HW_AXIS
600 axisfn:AXIS_ROLL
601 butfn:STICK_NOFUNCTION]];
602 [funcList addObject:
603 [self makeStickGuiDict:DESC(@"stickmapper-pitch")
604 allowable:HW_AXIS
605 axisfn:AXIS_PITCH
606 butfn:STICK_NOFUNCTION]];
607 [funcList addObject:
608 [self makeStickGuiDict:DESC(@"stickmapper-yaw")
609 allowable:HW_AXIS
610 axisfn:AXIS_YAW
611 butfn:STICK_NOFUNCTION]];
612 [funcList addObject:
613 [self makeStickGuiDict:DESC(@"stickmapper-increase-thrust")
614 allowable:HW_AXIS|HW_BUTTON
615 axisfn:AXIS_THRUST
616 butfn:BUTTON_INCTHRUST]];
617 [funcList addObject:
618 [self makeStickGuiDict:DESC(@"stickmapper-decrease-thrust")
619 allowable:HW_AXIS|HW_BUTTON
620 axisfn:AXIS_THRUST
621 butfn:BUTTON_DECTHRUST]];
622 [funcList addObject:
623 [self makeStickGuiDict:DESC(@"stickmapper-fuel-injection")
624 allowable:HW_BUTTON
625 axisfn:STICK_NOFUNCTION
626 butfn:BUTTON_FUELINJECT]];
627 [funcList addObject:
628 [self makeStickGuiDict:DESC(@"stickmapper-hyperspeed")
629 allowable:HW_BUTTON
630 axisfn:STICK_NOFUNCTION
631 butfn:BUTTON_HYPERSPEED]];
632 [funcList addObject:
633 [self makeStickGuiDict:DESC(@"stickmapper-hyperdrive")
634 allowable:HW_BUTTON
635 axisfn:STICK_NOFUNCTION
636 butfn:BUTTON_HYPERDRIVE]];
637 [funcList addObject:
638 [self makeStickGuiDict:DESC(@"stickmapper-gal-hyperdrive")
639 allowable:HW_BUTTON
640 axisfn:STICK_NOFUNCTION
641 butfn:BUTTON_GALACTICDRIVE]];
642
643 [funcList addObject:
644 [self makeStickGuiDict:DESC(@"stickmapper-roll/pitch-precision-toggle")
645 allowable:HW_BUTTON
646 axisfn:STICK_NOFUNCTION
647 butfn:BUTTON_PRECISION]];
648
649 // navigation
650 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-navigation")]];
651 [funcList addObject:
652 [self makeStickGuiDict:DESC(@"stickmapper-compass-mode-next")
653 allowable:HW_BUTTON
654 axisfn:STICK_NOFUNCTION
655 butfn:BUTTON_COMPASSMODE]];
656 [funcList addObject:
657 [self makeStickGuiDict:DESC(@"stickmapper-compass-mode-prev")
658 allowable:HW_BUTTON
659 axisfn:STICK_NOFUNCTION
660 butfn:BUTTON_COMPASSMODE_PREV]];
661 [funcList addObject:
662 [self makeStickGuiDict:DESC(@"stickmapper-scanner-zoom")
663 allowable:HW_BUTTON
664 axisfn:STICK_NOFUNCTION
665 butfn:BUTTON_SCANNERZOOM]];
666 [funcList addObject:
667 [self makeStickGuiDict:DESC(@"stickmapper-scanner-unzoom")
668 allowable:HW_BUTTON
669 axisfn:STICK_NOFUNCTION
670 butfn:BUTTON_SCANNERUNZOOM]];
671 [funcList addObject:
672 [self makeStickGuiDict:DESC(@"stickmapper-view-forward")
673 allowable:HW_AXIS|HW_BUTTON
674 axisfn:AXIS_VIEWY
675 butfn:BUTTON_VIEWFORWARD]];
676 [funcList addObject:
677 [self makeStickGuiDict:DESC(@"stickmapper-view-aft")
678 allowable:HW_AXIS|HW_BUTTON
679 axisfn:AXIS_VIEWY
680 butfn:BUTTON_VIEWAFT]];
681 [funcList addObject:
682 [self makeStickGuiDict:DESC(@"stickmapper-view-port")
683 allowable:HW_AXIS|HW_BUTTON
684 axisfn:AXIS_VIEWX
685 butfn:BUTTON_VIEWPORT]];
686 [funcList addObject:
687 [self makeStickGuiDict:DESC(@"stickmapper-view-starboard")
688 allowable:HW_AXIS|HW_BUTTON
689 axisfn:AXIS_VIEWX
690 butfn:BUTTON_VIEWSTARBOARD]];
691 [funcList addObject:
692 [self makeStickGuiDict:DESC(@"stickmapper-ext-view-cycle")
693 allowable:HW_BUTTON
694 axisfn:STICK_NOFUNCTION
695 butfn:BUTTON_EXTVIEWCYCLE]];
696 [funcList addObject:
697 [self makeStickGuiDict:DESC(@"stickmapper-toggle-ID")
698 allowable:HW_BUTTON
699 axisfn:STICK_NOFUNCTION
700 butfn:BUTTON_ID]];
701 [funcList addObject:
702 [self makeStickGuiDict:DESC(@"stickmapper-docking-clearance")
703 allowable:HW_BUTTON
704 axisfn:STICK_NOFUNCTION
705 butfn:BUTTON_DOCKINGCLEARANCE]];
706 [funcList addObject:
707 [self makeStickGuiDict:DESC(@"stickmapper-dockcpu")
708 allowable:HW_BUTTON
709 axisfn:STICK_NOFUNCTION
710 butfn:BUTTON_DOCKCPU]];
711 [funcList addObject:
712 [self makeStickGuiDict:DESC(@"stickmapper-dockcpufast")
713 allowable:HW_BUTTON
714 axisfn:STICK_NOFUNCTION
715 butfn:BUTTON_DOCKCPUFAST]];
716 [funcList addObject:
717 [self makeStickGuiDict:DESC(@"stickmapper-docking-music")
718 allowable:HW_BUTTON
719 axisfn:STICK_NOFUNCTION
720 butfn:BUTTON_DOCKINGMUSIC]];
721
722 // offensive
723 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-offensive")]];
724 [funcList addObject:
725 [self makeStickGuiDict:DESC(@"stickmapper-weapons-online-toggle")
726 allowable:HW_BUTTON
727 axisfn:STICK_NOFUNCTION
728 butfn:BUTTON_WEAPONSONLINETOGGLE]];
729 [funcList addObject:
730 [self makeStickGuiDict:DESC(@"stickmapper-primary-weapon")
731 allowable:HW_BUTTON
732 axisfn:STICK_NOFUNCTION
733 butfn:BUTTON_FIRE]];
734 [funcList addObject:
735 [self makeStickGuiDict:DESC(@"stickmapper-secondary-weapon")
736 allowable:HW_BUTTON
737 axisfn:STICK_NOFUNCTION
738 butfn:BUTTON_LAUNCHMISSILE]];
739 [funcList addObject:
740 [self makeStickGuiDict:DESC(@"stickmapper-arm-secondary")
741 allowable:HW_BUTTON
742 axisfn:STICK_NOFUNCTION
743 butfn:BUTTON_ARMMISSILE]];
744 [funcList addObject:
745 [self makeStickGuiDict:DESC(@"stickmapper-disarm-secondary")
746 allowable:HW_BUTTON
747 axisfn:STICK_NOFUNCTION
748 butfn:BUTTON_UNARM]];
749 [funcList addObject:
750 [self makeStickGuiDict:DESC(@"stickmapper-target-nearest-incoming-missile")
751 allowable:HW_BUTTON
752 axisfn:STICK_NOFUNCTION
753 butfn:BUTTON_TARGETINCOMINGMISSILE]];
754 [funcList addObject:
755 [self makeStickGuiDict:DESC(@"stickmapper-cycle-secondary")
756 allowable:HW_BUTTON
757 axisfn:STICK_NOFUNCTION
758 butfn:BUTTON_CYCLEMISSILE]];
759 [funcList addObject:
760 [self makeStickGuiDict:DESC(@"stickmapper-next-target")
761 allowable:HW_BUTTON
762 axisfn:STICK_NOFUNCTION
763 butfn:BUTTON_NEXTTARGET]];
764 [funcList addObject:
765 [self makeStickGuiDict:DESC(@"stickmapper-previous-target")
766 allowable:HW_BUTTON
767 axisfn:STICK_NOFUNCTION
768 butfn:BUTTON_PREVTARGET]];
769
770 // defensive
771 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-defensive")]];
772 [funcList addObject:
773 [self makeStickGuiDict:DESC(@"stickmapper-ECM")
774 allowable:HW_BUTTON
775 axisfn:STICK_NOFUNCTION
776 butfn:BUTTON_ECM]];
777 [funcList addObject:
778 [self makeStickGuiDict:DESC(@"stickmapper-jettison")
779 allowable:HW_BUTTON
780 axisfn:STICK_NOFUNCTION
781 butfn:BUTTON_JETTISON]];
782 [funcList addObject:
783 [self makeStickGuiDict:DESC(@"stickmapper-rotate-cargo")
784 allowable:HW_BUTTON
785 axisfn:STICK_NOFUNCTION
786 butfn:BUTTON_ROTATECARGO]];
787 [funcList addObject:
788 [self makeStickGuiDict:DESC(@"stickmapper-escape-pod")
789 allowable:HW_BUTTON
790 axisfn:STICK_NOFUNCTION
791 butfn:BUTTON_ESCAPE]];
792
793 // oxp special equip
794 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-special-equip")]];
795 [funcList addObject:
796 [self makeStickGuiDict:DESC(@"stickmapper-mfd-select-next")
797 allowable:HW_BUTTON
798 axisfn:STICK_NOFUNCTION
799 butfn:BUTTON_MFDSELECTNEXT]];
800 [funcList addObject:
801 [self makeStickGuiDict:DESC(@"stickmapper-mfd-select-prev")
802 allowable:HW_BUTTON
803 axisfn:STICK_NOFUNCTION
804 butfn:BUTTON_MFDSELECTPREV]];
805 [funcList addObject:
806 [self makeStickGuiDict:DESC(@"stickmapper-mfd-cycle-next")
807 allowable:HW_BUTTON
808 axisfn:STICK_NOFUNCTION
809 butfn:BUTTON_MFDCYCLENEXT]];
810 [funcList addObject:
811 [self makeStickGuiDict:DESC(@"stickmapper-mfd-cycle-prev")
812 allowable:HW_BUTTON
813 axisfn:STICK_NOFUNCTION
814 butfn:BUTTON_MFDCYCLEPREV]];
815 [funcList addObject:
816 [self makeStickGuiDict:DESC(@"stickmapper-prime-equipment")
817 allowable:HW_BUTTON
818 axisfn:STICK_NOFUNCTION
819 butfn:BUTTON_PRIMEEQUIPMENT]];
820 [funcList addObject:
821 [self makeStickGuiDict:DESC(@"stickmapper-prime-prev-equipment")
822 allowable:HW_BUTTON
823 axisfn:STICK_NOFUNCTION
824 butfn:BUTTON_PRIMEEQUIPMENT]];
825 [funcList addObject:
826 [self makeStickGuiDict:DESC(@"stickmapper-activate-equipment")
827 allowable:HW_BUTTON
828 axisfn:STICK_NOFUNCTION
829 butfn:BUTTON_ACTIVATEEQUIPMENT]];
830 [funcList addObject:
831 [self makeStickGuiDict:DESC(@"stickmapper-mode-equipment")
832 allowable:HW_BUTTON
833 axisfn:STICK_NOFUNCTION
834 butfn:BUTTON_MODEEQUIPMENT]];
835 [funcList addObject:
836 [self makeStickGuiDict:DESC(@"stickmapper-fastactivate-a")
837 allowable:HW_BUTTON
838 axisfn:STICK_NOFUNCTION
839 butfn:BUTTON_CLOAK]];
840 [funcList addObject:
841 [self makeStickGuiDict:DESC(@"stickmapper-fastactivate-b")
842 allowable:HW_BUTTON
843 axisfn:STICK_NOFUNCTION
844 butfn:BUTTON_ENERGYBOMB]];
845
846 // misc
847 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-misc")]];
848 [funcList addObject:
849 [self makeStickGuiDict:DESC(@"stickmapper-snapshot")
850 allowable:HW_BUTTON
851 axisfn:STICK_NOFUNCTION
852 butfn:BUTTON_SNAPSHOT]];
853 [funcList addObject:
854 [self makeStickGuiDict:DESC(@"stickmapper-pause")
855 allowable:HW_BUTTON
856 axisfn:STICK_NOFUNCTION
857 butfn:BUTTON_PAUSE]];
858 [funcList addObject:
859 [self makeStickGuiDict:DESC(@"stickmapper-toggle-hud")
860 allowable:HW_BUTTON
861 axisfn:STICK_NOFUNCTION
862 butfn:BUTTON_TOGGLEHUD]];
863 [funcList addObject:
864 [self makeStickGuiDict:DESC(@"stickmapper-comms-log")
865 allowable:HW_BUTTON
866 axisfn:STICK_NOFUNCTION
867 butfn:BUTTON_COMMSLOG]];
868#if OO_FOV_INFLIGHT_CONTROL_ENABLED
869 [funcList addObject:
870 [self makeStickGuiDict:DESC(@"stickmapper-increase-field-of-view")
871 allowable:HW_AXIS|HW_BUTTON
872 axisfn:AXIS_FIELD_OF_VIEW
873 butfn:BUTTON_INC_FIELD_OF_VIEW]];
874 [funcList addObject:
875 [self makeStickGuiDict:DESC(@"stickmapper-decrease-field-of-view")
876 allowable:HW_AXIS|HW_BUTTON
877 axisfn:AXIS_FIELD_OF_VIEW
878 butfn:BUTTON_DEC_FIELD_OF_VIEW]];
879#endif
880 if ([customEquipActivation count] > 0) {
881 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-oxp-equip")]];
882 int i;
883 for (i = 0; i < [customEquipActivation count]; i++)
884 {
885 [funcList addObject:
886 [self makeStickGuiDict:[NSString stringWithFormat: @"Activate '%@'", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPNAME]]
887 allowable:HW_BUTTON
888 axisfn:STICK_NOFUNCTION
889 butfn:(i+10000)]];
890 [funcList addObject:
891 [self makeStickGuiDict:[NSString stringWithFormat: @"Mode '%@'", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPNAME]]
892 allowable:HW_BUTTON
893 axisfn:STICK_NOFUNCTION
894 butfn:(i+20000)]];
895 }
896
897 }
898 return funcList;
899}

◆ stickMapperInputHandler:view:

- (void) stickMapperInputHandler: (GuiDisplayGen *)  gui
view: (MyOpenGLView *)  gameView 

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

132 :(GuiDisplayGen *)gui
133 view:(MyOpenGLView *)gameView
134{
136
137 // Don't do anything if the user is supposed to be selecting
138 // a function - other than look for Escape.
139 if(waitingForStickCallback)
140 {
141 if([gameView isDown: 27])
142 {
143 [stickHandler clearCallback];
144 [gui setArray: [NSArray arrayWithObjects:
145 @"Function setting aborted.", nil]
146 forRow: GUI_ROW_INSTRUCT];
147 waitingForStickCallback=NO;
148 }
149
150 // Break out now.
151 return;
152 }
153
154 [self handleGUIUpDownArrowKeys];
155
156 if ([gui selectedRow] == GUI_ROW_STICKPROFILE && [gameView isDown: 13])
157 {
158 [self setGuiToStickProfileScreen: gui];
159 return;
160 }
161
162 NSString* key = [gui keyForRow: [gui selectedRow]];
163 if ([key hasPrefix:@"Index:"])
164 selFunctionIdx=[[[key componentsSeparatedByString:@":"] objectAtIndex: 1] intValue];
165 else
166 selFunctionIdx=-1;
167
168 if([gameView isDown: 13])
169 {
170 if ([key hasPrefix:@"More:"])
171 {
172 int from_function = [[[key componentsSeparatedByString:@":"] objectAtIndex: 1] intValue];
173 if (from_function < 0) from_function = 0;
174
175 [self setGuiToStickMapperScreen:from_function];
176 if ([[UNIVERSE gui] selectedRow] < 0)
177 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART];
178 if (from_function == 0)
179 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART + MAX_ROWS_FUNCTIONS - 1];
180 return;
181 }
182
183 NSDictionary *entry=[stickFunctions objectAtIndex: selFunctionIdx];
184 int hw=[(NSNumber *)[entry objectForKey: KEY_ALLOWABLE] intValue];
185 [stickHandler setCallback: @selector(updateFunction:)
186 object: self
187 hardware: hw];
188
189 // Print instructions
190 NSString *instructions;
191 switch(hw)
192 {
193 case HW_AXIS:
194 instructions = @"Fully deflect the axis you want to use for this function. Esc aborts.";
195 break;
196 case HW_BUTTON:
197 instructions = @"Press the button you want to use for this function. Esc aborts.";
198 break;
199 default:
200 instructions = @"Press the button or deflect the axis you want to use for this function.";
201 }
202 [gui setArray: [NSArray arrayWithObjects: instructions, nil] forRow: GUI_ROW_INSTRUCT];
203 waitingForStickCallback=YES;
204 }
205
206 if([gameView isDown: 'u'])
207 {
208 if (selFunctionIdx >= 0) [self removeFunction: selFunctionIdx];
209 }
210}
#define GUI_ROW_STICKPROFILE
void setCallback:object:hardware:(SEL selector,[object] id obj,[hardware] char hwflags)

◆ stickProfileGraphAxisProfile:screenAt:screenSize:

- (void) stickProfileGraphAxisProfile: (GLfloat alpha
screenAt: (Vector screenAt
screenSize: (NSSize screenSize 

Provided by category PlayerEntity(StickProfile).

Definition at line 43 of file PlayerEntityStickProfile.m.

225 : (GLfloat) alpha screenAt: (Vector) screenAt screenSize: (NSSize) screenSize
226{
227
228 [stickProfileScreen graphProfile: alpha at: make_vector(screenAt.x - 110.0, screenAt.y - 100, screenAt.z) size: NSMakeSize(220,220)];
229 return;
230}

◆ stickProfileInputHandler:view:

- (void) stickProfileInputHandler: (GuiDisplayGen *)  gui
view: (MyOpenGLView *)  gameView 

Provided by category PlayerEntity(StickProfile).

Definition at line 43 of file PlayerEntityStickProfile.m.

76 : (GuiDisplayGen *) gui
77 view: (MyOpenGLView *) gameView
78{
79 if ([gameView isDown: gvMouseLeftButton])
80 {
81 NSPoint mouse_position = NSMakePoint(
82 [gameView virtualJoystickPosition].x * [gui size].width,
83 [gameView virtualJoystickPosition].y * [gui size].height );
84 [stickProfileScreen mouseDown: mouse_position];
85 }
86 else
87 {
88 [stickProfileScreen mouseUp];
89 }
90 if ([gameView isDown: gvDeleteKey])
91 {
92 [stickProfileScreen deleteSelected];
93 }
94 [self handleGUIUpDownArrowKeys];
95
96 if ([self checkKeyPress:n_key_gui_select] && [gui selectedRow] == GUI_ROW_STICKPROFILE_BACK)
97 {
98 [stickProfileScreen saveSettings];
99 [self setGuiToStickMapperScreen: 0 resetCurrentRow: YES];
100 }
101 switch ([gui selectedRow])
102 {
104 if ([self checkKeyPress:n_key_gui_arrow_left])
105 {
106 if (!stickProfileArrow_pressed && ![self checkKeyPress:n_key_gui_arrow_right])
107 {
108 [stickProfileScreen previousAxis];
110 }
111 }
112 else if ([self checkKeyPress: n_key_gui_arrow_right])
113 {
114 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
115 {
116 [stickProfileScreen nextAxis];
118 }
119 }
120 else
121 {
123 }
124 break;
125
127 if ([self checkKeyPress:n_key_gui_arrow_left])
128 {
129 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_right])
130 {
131 [stickProfileScreen decreaseDeadzone];
133 }
134 }
135 else if ([self checkKeyPress: n_key_gui_arrow_right])
136 {
137 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
138 {
139 [stickProfileScreen increaseDeadzone];
141 }
142 }
143 else
144 {
146 }
147 break;
148
150 if ([self checkKeyPress:n_key_gui_arrow_left])
151 {
152 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_right])
153 {
154 [stickProfileScreen previousProfileType];
156 }
157 }
158 else if ([self checkKeyPress: n_key_gui_arrow_right])
159 {
160 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
161 {
162 [stickProfileScreen nextProfileType];
164 }
165 }
166 else
167 {
169 }
170 break;
171 }
172
173 if (![stickProfileScreen currentProfileIsSpline])
174 {
175 if ([gui selectedRow] == GUI_ROW_STICKPROFILE_POWER)
176 {
177 if ([self checkKeyPress:n_key_gui_arrow_left])
178 {
179 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_right])
180 {
181 [stickProfileScreen DecreasePower];
183 }
184 }
185 else if ([self checkKeyPress: n_key_gui_arrow_right])
186 {
187 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
188 {
189 [stickProfileScreen IncreasePower];
191 }
192 }
193 else
194 {
196 }
197 }
198 else if ([gui selectedRow] == GUI_ROW_STICKPROFILE_PARAM)
199 {
200 if ([self checkKeyPress:n_key_gui_arrow_left])
201 {
202 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_right])
203 {
204 [stickProfileScreen DecreaseParam];
206 }
207 }
208 else if ([self checkKeyPress: n_key_gui_arrow_right])
209 {
210 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
211 {
212 [stickProfileScreen IncreaseParam];
214 }
215 }
216 else
217 {
219 }
220 }
221 }
222 return;
223}
#define GUI_ROW_STICKPROFILE_PARAM
static BOOL stickProfileArrow_pressed
#define GUI_ROW_STICKPROFILE_AXIS
#define GUI_ROW_STICKPROFILE_BACK
#define GUI_ROW_STICKPROFILE_DEADZONE
#define GUI_ROW_STICKPROFILE_PROFILE_TYPE
#define GUI_ROW_STICKPROFILE_POWER
voidpf void uLong size
Definition ioapi.h:134

◆ stopAfterburnerSound

- (void) stopAfterburnerSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

486{
487 // Do nothing, stop is detected in updateAfterburnerSound
488}

◆ subtract:

- (void) subtract: (NSString *)  missionVariableString_value

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1846 :(NSString *)missionVariableString_value
1847{
1848 NSString* missionVariableString = nil;
1849 NSString* valueString;
1850 double value;
1851 NSMutableArray* tokens = ScanTokensFromString(missionVariableString_value);
1852 BOOL hasMissionPrefix, hasLocalPrefix;
1853
1854 if ([tokens count] < 2)
1855 {
1856 OOLog(kOOLogSyntaxSubtract, @"***** SCRIPT ERROR: in %@, CANNOT SUBTRACT: '%@'", CurrentScriptDesc(), missionVariableString_value);
1857 return;
1858 }
1859
1860 missionVariableString = [tokens objectAtIndex:0];
1861 [tokens removeObjectAtIndex:0];
1862 valueString = [tokens componentsJoinedByString:@" "];
1863
1864 hasMissionPrefix = [missionVariableString hasPrefix:@"mission_"];
1865 hasLocalPrefix = [missionVariableString hasPrefix:@"local_"];
1866
1867 if (hasMissionPrefix)
1868 {
1869 value = [[self missionVariableForKey:missionVariableString] doubleValue];
1870 value -= [valueString doubleValue];
1871 [self setMissionVariable:[NSString stringWithFormat:@"%f", value] forKey:missionVariableString];
1872 }
1873 else if (hasLocalPrefix)
1874 {
1875 value = [[self localVariableForKey:missionVariableString andMission:sCurrentMissionKey] doubleValue];
1876 value -= [valueString doubleValue];
1877 [self setLocalVariable:[NSString stringWithFormat:@"%f", value] forKey:missionVariableString andMission:sCurrentMissionKey];
1878 }
1879 else
1880 {
1881 OOLog(kOOLogSyntaxSubtract, @"***** SCRIPT ERROR: in %@, CANNOT SUBTRACT: '%@' -- IDENTIFIER '%@' DOES NOT BEGIN WITH 'mission_' or 'local_'", CurrentScriptDesc(), missionVariableString_value, missionVariableString_value);
1882 }
1883}
static NSString *const kOOLogSyntaxSubtract

◆ sunGoneNova_bool

- (NSString *) sunGoneNova_bool

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1061{
1062 return ([[UNIVERSE sun] goneNova])? @"YES" : @"NO";
1063}

◆ sunWillGoNova_bool

- (NSString *) sunWillGoNova_bool

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1055{
1056 return ([[UNIVERSE sun] willGoNova])? @"YES" : @"NO";
1057}

◆ suppressClangStuff

- (BOOL) suppressClangStuff
implementation

Definition at line 9242 of file PlayerEntity.m.

13537{
13538 return missionChoice &&
13541 currentPage &&
13573 n_key_ecm &&
13601 n_key_map_end &&
13651#if OO_FOV_INFLIGHT_CONTROL_ENABLED
13654#endif
13663 _sysInfoLight.x &&
13666 keyFunctions &&
13670 kbdLayouts &&
13674 _missionTitle &&
13676}
NSArray * n_key_yaw_left
NSArray * n_key_activate_equipment
NSArray * n_key_gui_screen_interfaces
NSArray * n_key_gui_arrow_right
NSArray * n_key_scanner_zoom
NSArray * n_key_debug_shaders
NSArray * n_key_next_target
NSArray * n_key_docking_clearance_request
NSArray * n_key_market_buy_max
NSArray * n_key_rotate_cargo
NSArray * n_key_custom_view_rotate_left
NSArray * n_key_untarget_missile
NSArray * n_key_gui_screen_status
NSArray * n_key_oxzmanager_extract
NSArray * n_key_map_next_system
NSArray * n_key_custom_view_pan_left
NSArray * n_key_info_next_system
NSArray * n_key_yaw_right
NSArray * n_key_custom_view_pan_down
NSArray * n_key_map_info
NSArray * n_key_view_forward
NSString * _missionScreenID
BOOL _missionAllowInterrupt
NSArray * n_key_debug_off
NSArray * n_key_galactic_hyperspace
NSArray * n_key_autopilot
NSArray * n_key_weapons_online_toggle
NSArray * n_key_pausebutton
NSArray * n_key_ecm
NSArray * n_key_dump_target_state
NSArray * n_key_gui_select
NSArray * n_key_custom_view_zoom_out
NSArray * n_key_custom_view_roll_right
NSArray * n_key_dump_entity_list
NSMutableArray * cdrDetailArray
NSArray * n_key_market_buy_one
NSArray * n_key_roll_right
NSArray * n_key_cycle_next_mfd
NSString * _missionTitle
NSArray * n_key_advanced_nav_array_previous
NSArray * n_key_gui_chart_screens
NSArray * n_key_system_previous_system
NSArray * n_key_snapshot
NSArray * n_key_gui_arrow_up
NSArray * n_key_debug_full
NSArray * n_key_gui_arrow_down
NSArray * n_key_custom_view
NSArray * n_key_autodock
NSString * commanderNameString
NSArray * n_key_gui_page_up
NSArray * n_key_prev_compass_mode
NSArray * n_key_jumpdrive
NSArray * n_key_cycle_previous_mfd
NSArray * n_key_market_sell_max
NSArray * n_key_bloom_toggle
NSArray * n_key_roll_left
NSArray * n_key_system_home
NSArray * n_key_custom_view_zoom_in
NSArray * n_key_chart_highlight
NSArray * n_key_mode_equipment
NSArray * n_key_inject_fuel
NSArray * n_key_hyperspace
NSArray * n_key_custom_view_rotate_up
NSString * missionChoice
NSArray * n_key_increase_speed
NSArray * n_key_system_next_system
NSArray * n_key_show_fps
NSArray * n_key_system_end
NSArray * n_key_debug_bounding_boxes
NSArray * n_key_market_sell_one
NSArray * n_key_custom_view_rotate_right
NSArray * n_key_market_sorter_cycle
NSArray * n_key_scanner_unzoom
NSArray * n_key_gui_arrow_left
NSArray * n_key_view_starboard
NSArray * n_key_pitch_back
BOOL showingLongRangeChart
NSArray * n_key_mouse_control_roll
NSArray * n_key_launch_ship
Vector _sysInfoLight
NSArray * n_key_gui_market
NSArray * n_key_launch_missile
NSArray * n_key_gui_system_data
NSArray * n_key_gui_screen_equipship
NSArray * n_key_debug_console_connect
NSArray * n_key_info_previous_system
NSArray * n_key_custom_view_rotate_down
NSArray * n_key_prime_next_equipment
BOOL _missionTextEntry
NSArray * n_key_map_end
NSArray * n_key_custom_view_pan_up
NSArray * n_key_ident_system
NSArray * n_key_oxzmanager_setfilter
NSArray * n_key_gui_page_down
NSArray * n_key_decrease_speed
NSArray * n_key_target_incoming_missile
NSArray * n_key_next_missile
NSArray * n_key_gui_screen_options
NSArray * n_key_prime_previous_equipment
NSArray * n_key_oxzmanager_showinfo
NSArray * n_key_comms_log
NSArray * n_key_view_port
NSArray * n_key_market_filter_cycle
NSArray * n_key_target_missile
NSArray * n_key_map_zoom_out
NSArray * n_key_switch_next_mfd
NSArray * n_key_advanced_nav_array_next
NSArray * n_key_pitch_forward
NSArray * n_key_fire_lasers
NSArray * n_key_mouse_control_yaw
NSArray * n_key_map_home
NSArray * n_key_view_aft
NSArray * n_key_fastactivate_equipment_b
NSArray * n_key_debug_collision
NSArray * n_key_docking_music
NSArray * n_key_custom_view_pan_right
NSArray * n_key_dump_cargo
NSArray * n_key_launch_escapepod
NSArray * n_key_custom_view_roll_left
NSArray * n_key_map_previous_system
NSArray * n_key_fastactivate_equipment_a
NSArray * n_key_hud_toggle
NSArray * n_key_switch_previous_mfd
NSArray * n_key_previous_target
NSArray * n_key_map_zoom_in
NSArray * n_key_next_compass_mode

◆ suppressTargetLost

- (void) suppressTargetLost

Reimplemented from ShipEntity.

◆ switchHudTo:

- (BOOL) switchHudTo: (NSString *)  hudFileName

Definition at line 13727 of file PlayerEntity.m.

4545{
4547 BOOL wasHidden = NO;
4549 double scannerZoom = 1.0;
4550 NSUInteger lastMFD = 0;
4551 NSUInteger i;
4552
4553 if (!hudFileName) return NO;
4554
4555 // is the HUD in the process of being rendered? If yes, set it to defer state and abort the switching now
4556 if (hud != nil && [hud isUpdating])
4557 {
4558 [hud setDeferredHudName:hudFileName];
4559 return NO;
4560 }
4561
4563 // hud defined, but buggy?
4564 if (hudDict == nil)
4565 {
4566 OOLog(@"PlayerEntity.switchHudTo.failed", @"HUD dictionary file %@ to switch to not found or invalid.", hudFileName);
4567 return NO;
4568 }
4569
4570 if (hud != nil)
4571 {
4572 // remember these values
4573 wasHidden = [hud isHidden];
4574 wasCompassActive = [hud isCompassActive];
4575 scannerZoom = [hud scannerZoom];
4577 }
4578
4579 // buggy oxp could override hud.plist with a non-dictionary.
4580 if (hudDict != nil)
4581 {
4582 [hud setHidden:YES]; // hide the hud while rebuilding it.
4583 DESTROY(hud);
4584 hud = [[HeadUpDisplay alloc] initWithDictionary:hudDict inFile:hudFileName];
4585 [hud resetGuis:hudDict];
4586 // reset zoom & hidden to what they were before the swich
4587 [hud setScannerZoom:scannerZoom];
4588 [hud setCompassActive:wasCompassActive];
4589 [hud setHidden:wasHidden];
4590 activeMFD = 0;
4591 NSArray *savedMFDs = [NSArray arrayWithArray:multiFunctionDisplaySettings];
4592 [multiFunctionDisplaySettings removeAllObjects];
4593 for (i = 0; i < [hud mfdCount] ; i++)
4594 {
4595 if ([savedMFDs count] > i)
4596 {
4597 [multiFunctionDisplaySettings addObject:[savedMFDs objectAtIndex:i]];
4598 }
4599 else
4600 {
4601 [multiFunctionDisplaySettings addObject:[NSNull null]];
4602 }
4603 }
4604 if (lastMFD < [hud mfdCount]) activeMFD = lastMFD;
4605 }
4606
4607 return YES;
4608}
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ switchToMainView

- (void) switchToMainView

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

831{
832 OOGUIScreenID oldScreen = gui_screen;
833 gui_screen = GUI_SCREEN_MAIN;
834 if (showDemoShips)
835 {
836 [self setShowDemoShips: NO];
837 [UNIVERSE removeDemoShips];
838 }
839 [(MyOpenGLView *)[UNIVERSE gameView] allowStringInput:NO];
840 if ([self isMouseControlOn]) [[UNIVERSE gameView] resetMouse];
841 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
842 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
843}

◆ switchToThisView:

- (void) switchToThisView: (OOViewID viewDirection
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

5435 :(OOViewID)viewDirection
5436{
5437 [self switchToThisView:viewDirection andProcessWeaponFacing:YES];
5438}

◆ switchToThisView:andProcessWeaponFacing:

- (void) switchToThisView: (OOViewID viewDirection
andProcessWeaponFacing: (BOOL processWeaponFacing 
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

5441 :(OOViewID)viewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing
5442{
5443 [self switchToThisView:viewDirection fromView:[UNIVERSE viewDirection] andProcessWeaponFacing:processWeaponFacing justNotify:NO];
5444}

◆ switchToThisView:fromView:andProcessWeaponFacing:justNotify:

- (void) switchToThisView: (OOViewID viewDirection
fromView: (OOViewID oldViewDirection
andProcessWeaponFacing: (BOOL processWeaponFacing
justNotify: (BOOL justNotify 
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 of file PlayerEntityControls.m.

5447 :(OOViewID)viewDirection fromView:(OOViewID)oldViewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing justNotify:(BOOL)justNotify
5448{
5449 if (!justNotify)
5450 {
5451 if ([UNIVERSE displayGUI]) [self switchToMainView];
5452 [UNIVERSE setViewDirection:viewDirection];
5453 }
5454 if (processWeaponFacing)
5455 {
5457 switch (viewDirection)
5458 {
5459 case VIEW_FORWARD:
5460 facing = WEAPON_FACING_FORWARD;
5461 break;
5462
5463 case VIEW_AFT:
5464 facing = WEAPON_FACING_AFT;
5465 break;
5466
5467 case VIEW_PORT:
5468 facing = WEAPON_FACING_PORT;
5469 break;
5470
5471 case VIEW_STARBOARD:
5472 facing = WEAPON_FACING_STARBOARD;
5473 break;
5474
5475 default:
5476 break;
5477 }
5478
5479 if (facing != WEAPON_FACING_NONE)
5480 {
5481 currentWeaponFacing = facing;
5482 [self currentWeaponStats];
5483 }
5484 else
5485 {
5486 OOLogERR(kOOLogParameterError, @"%s called with processWeaponFacing=YES for non-main view %i.", __FUNCTION__, viewDirection);
5487 }
5488 }
5489 if ((oldViewDirection != viewDirection || viewDirection == VIEW_CUSTOM) && ![[UNIVERSE gameController] isGamePaused])
5490 {
5491 JSContext *context = OOJSAcquireContext();
5492 ShipScriptEvent(context, self, "viewDirectionChanged", OOJSValueFromViewID(context, viewDirection), OOJSValueFromViewID(context, oldViewDirection));
5493 OOJSRelinquishContext(context);
5494 }
5495}
OOINLINE jsval OOJSValueFromViewID(JSContext *context, OOViewID value)
NSString *const kOOLogParameterError
Definition OOLogging.m:647

◆ systemEconomy_number

- (NSNumber *) systemEconomy_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1127{
1128 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1129 return [systeminfo objectForKey:KEY_ECONOMY];
1130}

◆ systemEconomy_string

- (NSString *) systemEconomy_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1117{
1118 int economy = [[self systemEconomy_number] intValue]; // 0 .. 7 (0 rich industrial .. 7 poor agricultural)
1119 NSString *result = OODisplayStringFromEconomyID(economy);
1120 if (result == nil) result = @"UNKNOWN";
1121
1122 return result;
1123}
NSString * OODisplayStringFromEconomyID(OOEconomyID economy)

◆ systemGovernment_number

- (NSNumber *) systemGovernment_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1110{
1111 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1112 return [systeminfo objectForKey:KEY_GOVERNMENT];
1113}

◆ systemGovernment_string

- (NSString *) systemGovernment_string

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1100{
1101 int government = [[self systemGovernment_number] intValue]; // 0 .. 7 (0 anarchic .. 7 most stable)
1102 NSString *result = OODisplayStringFromGovernmentID(government);
1103 if (result == nil) result = @"UNKNOWN";
1104
1105 return result;
1106}
NSString * OODisplayStringFromGovernmentID(OOGovernmentID government)

◆ systemID

- (OOSystemID) systemID

Definition at line 13727 of file PlayerEntity.m.

685{
686 return system_id;
687}

◆ systemPopulation_number

- (NSNumber *) systemPopulation_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1141{
1142 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1143 return [systeminfo objectForKey:KEY_POPULATION];
1144}

◆ systemProductivity_number

- (NSNumber *) systemProductivity_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1148{
1149 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1150 return [systeminfo objectForKey:KEY_PRODUCTIVITY];
1151}

◆ systemPseudoRandom100

- (unsigned) systemPseudoRandom100

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

252{
253 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
254 return (gen_rnd_number() * 256 + gen_rnd_number()) % 100;
255}
int gen_rnd_number(void)

◆ systemPseudoRandom256

- (unsigned) systemPseudoRandom256

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

259{
260 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
261 return gen_rnd_number();
262}

◆ systemPseudoRandomFloat

- (double) systemPseudoRandomFloat

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

266{
267 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
268 unsigned a = gen_rnd_number();
269 unsigned b = gen_rnd_number();
270 unsigned c = gen_rnd_number();
271
272 a = (a << 16) | (b << 8) | c;
273 return (double)a / (double)0x01000000;
274
275}

◆ systemTechLevel_number

- (NSNumber *) systemTechLevel_number

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1134{
1135 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1136 return [systeminfo objectForKey:KEY_TECHLEVEL];
1137}

◆ takeEnergyDamage:from:becauseOf:weaponIdentifier:

- (void) takeEnergyDamage: (double amount
from: (Entity *)  ent
becauseOf: (Entity *)  other
weaponIdentifier: (NSString *)  weaponIdentifier 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6360{
6363 BOOL internal_damage = NO; // base chance
6364
6365 OOLog(@"player.ship.damage", @"Player took damage from %@ becauseOf %@", ent, other);
6366
6367 if ([self status] == STATUS_DEAD) return;
6368 if ([self status] == STATUS_ESCAPE_SEQUENCE) return; // if the player has ejected, don't deal more damage
6369 if (amount == 0.0) return;
6370
6372 BOOL cascading = NO;
6373 if (cascadeWeapon)
6374 {
6375 cascading = [self cascadeIfAppropriateWithDamageAmount:amount cascadeOwner:[ent owner]];
6376 }
6377
6378 // make sure ent (& its position) is the attacking _ship_/missile !
6379 if (ent && [ent isSubEntity]) ent = [ent owner];
6380
6381 [[ent retain] autorelease];
6382 [[other retain] autorelease];
6383
6384 rel_pos = (ent != nil) ? [ent position] : kZeroHPVector;
6386
6387 [self doScriptEvent:OOJSID("shipBeingAttacked") withArgument:ent];
6388 if ([ent isShip]) [(ShipEntity *)ent doScriptEvent:OOJSID("shipAttackedOther") withArgument:self];
6389
6394
6395 [self playShieldHit:relative weaponIdentifier:weaponIdentifier];
6396
6397 // firing on an innocent ship is an offence
6398 if ([other isShip])
6399 {
6400 [self broadcastHitByLaserFrom:(ShipEntity*) other];
6401 }
6402
6403 if (d_forward >= 0)
6404 {
6406 if (forward_shield < 0.0)
6407 {
6409 forward_shield = 0.0f;
6410 }
6411 else
6412 {
6413 amount = 0.0;
6414 }
6415 }
6416 else
6417 {
6418 aft_shield -= amount;
6419 if (aft_shield < 0.0)
6420 {
6421 amount = -aft_shield;
6422 aft_shield = 0.0f;
6423 }
6424 else
6425 {
6426 amount = 0.0;
6427 }
6428 }
6429
6431
6432 if (amount > 0.0)
6433 {
6434 energy -= amount;
6435 [self playDirectHit:relative weaponIdentifier:weaponIdentifier];
6437 {
6438 /* Heat increase from energy impacts will never directly cause
6439 * overheating - too easy for missile hits to cause an uncredited
6440 * death by overheating against NPCs, so same rules for player */
6443 {
6445 }
6446 }
6447 }
6448 [self noteTakingDamage:amount from:other type:damageType];
6449 if (cascading) energy = 0.0; // explicitly set energy to zero when cascading, in case an oxp raised the energy in noteTakingDamage.
6450
6451 if (energy <= 0.0) //use normal ship temperature calculations for heat damage
6452 {
6453 if ([other isShip])
6454 {
6455 [(ShipEntity *)other noteTargetDestroyed:self];
6456 }
6457
6458 [self getDestroyedBy:other damageType:damageType];
6459 }
6460 else
6461 {
6462 while (amount > 0.0)
6463 {
6464 internal_damage = ((ranrot_rand() & PLAYER_INTERNAL_DAMAGE_FACTOR) < amount); // base chance of damage to systems
6465 if (internal_damage)
6466 {
6467 [self takeInternalDamage];
6468 }
6470 }
6471 }
6472}
const HPVector kZeroHPVector
Definition OOHPVector.m:28
#define PLAYER_INTERNAL_DAMAGE_FACTOR
#define SHIP_ENERGY_DAMAGE_TO_HEAT_FACTOR
Definition ShipEntity.h:65
id owner()
Definition Entity.m:584

◆ takeHeatDamage:

- (void) takeHeatDamage: (double amount
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6541 :(double) amount
6542{
6543 if ([self status] == STATUS_DEAD || amount < 0) return;
6544
6545 // hit the shields first!
6546 float fwd_amount = (float)(0.5 * amount);
6547 float aft_amount = (float)(0.5 * amount);
6548
6550 if (forward_shield < 0.0)
6551 {
6553 forward_shield = 0.0f;
6554 }
6555 else
6556 {
6557 fwd_amount = 0.0f;
6558 }
6559
6561 if (aft_shield < 0.0)
6562 {
6564 aft_shield = 0.0f;
6565 }
6566 else
6567 {
6568 aft_amount = 0.0f;
6569 }
6570
6572
6573 [super takeHeatDamage:residual_amount];
6574}

◆ takeInternalDamage

- (BOOL) takeInternalDamage

Definition at line 13727 of file PlayerEntity.m.

6927{
6928 unsigned n_cargo = [self maxAvailableCargoSpace];
6929 unsigned n_mass = [self mass] / 10000;
6930 unsigned n_considered = (n_cargo + n_mass) * ship_trade_in_factor / 100; // a lower value of n_considered means more vulnerable to damage.
6931 unsigned damage_to = n_considered ? (ranrot_rand() % n_considered) : 0; // n_considered can be 0 for small ships.
6932 BOOL result = NO;
6933 // cargo damage
6934 if (damage_to < [cargo count])
6935 {
6937 NSString* cargo_desc = [UNIVERSE displayNameForCommodity:[pod commodityType]];
6938 if (!cargo_desc)
6939 return NO;
6940 [UNIVERSE clearPreviousMessage];
6941 [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-destroyed"), cargo_desc] forCount:4.5];
6942 [cargo removeObject:pod];
6943 return YES;
6944 }
6945 else
6946 {
6947 damage_to = n_considered - (damage_to + 1); // reverse the die-roll
6948 }
6949 // equipment damage
6950 NSEnumerator *eqEnum = [self equipmentEnumerator];
6953 unsigned damageableCounter = 0;
6954 GLfloat damageableOdds = 0.0;
6955 while ((system_key = [eqEnum nextObject]) != nil)
6956 {
6958 if ([eqType canBeDamaged])
6959 {
6961 damageableOdds += [eqType damageProbability];
6962 }
6963 }
6964
6966 {
6968 GLfloat accumulator = 0.0;
6969 eqEnum = [self equipmentEnumerator];
6970 while ((system_key = [eqEnum nextObject]) != nil)
6971 {
6973 accumulator += [eqType damageProbability];
6974 if (accumulator > target)
6975 {
6976 [system_key retain];
6977 break;
6978 }
6979 }
6980 if (system_key == nil)
6981 {
6982 [system_key release];
6983 return NO;
6984 }
6985
6986 NSString *system_name = [eqType name];
6987 if (![eqType canBeDamaged] || system_name == nil)
6988 {
6989 [system_key release];
6990 return NO;
6991 }
6992
6993 // set the following so removeEquipment works on the right entity
6994 [self setScriptTarget:self];
6995 [UNIVERSE clearPreviousMessage];
6996 [self removeEquipmentItem:system_key];
6997
6998 NSString *damagedKey = [NSString stringWithFormat:@"%@_DAMAGED", system_key];
6999 [self addEquipmentItem:damagedKey withValidation: NO inContext:@"damage"]; // for possible future repair.
7000 [self doScriptEvent:OOJSID("equipmentDamaged") withArgument:system_key];
7001
7003 {
7004 /*
7005 Display "foo damaged" message only if no script has
7006 repaired or removed the equipment item. (If a script does
7007 either of those and wants a message, it can write it
7008 itself.)
7009 */
7010 [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-damaged"), system_name] forCount:4.5];
7011 }
7012
7013 /* There used to be a check for docking computers here, but
7014 * that didn't cover other ways they might fail in flight, so
7015 * it has been moved to the removeEquipment method. */
7016 [system_key release];
7017 return YES;
7018 }
7019 //cosmetic damage
7020 if (((damage_to & 7) == 7)&&(ship_trade_in_factor > 75))
7021 {
7023 result = YES;
7024 }
7025 return result;
7026}

Referenced by PlayerShipTakeInternalDamage().

+ Here is the caller graph for this function:

◆ takeScrapeDamage:from:

- (void) takeScrapeDamage: (double amount
from: (Entity *)  ent 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

6475 :(double) amount from:(Entity *) ent
6476{
6479 BOOL internal_damage = NO; // base chance
6480
6481 if ([self status] == STATUS_DEAD) return;
6482
6483 if (amount < 0)
6484 {
6485 OOLog(@"player.ship.damage", @"Player took negative scrape damage %.3f so we made it positive", amount);
6486 amount = -amount;
6487 }
6488 OOLog(@"player.ship.damage", @"Player took %.3f scrape damage from %@", amount, ent);
6489
6490 [[ent retain] autorelease];
6491 rel_pos = ent ? [ent position] : kZeroHPVector;
6493 // rel_pos is now small
6498
6499 [self playScrapeDamage:relative];
6500 if (d_forward >= 0)
6501 {
6503 if (forward_shield < 0.0)
6504 {
6506 forward_shield = 0.0f;
6507 }
6508 else
6509 {
6510 amount = 0.0;
6511 }
6512 }
6513 else
6514 {
6515 aft_shield -= amount;
6516 if (aft_shield < 0.0)
6517 {
6518 amount = -aft_shield;
6519 aft_shield = 0.0f;
6520 }
6521 else
6522 {
6523 amount = 0.0;
6524 }
6525 }
6526
6527 [super takeScrapeDamage:amount from:ent];
6528
6529 while (amount > 0.0)
6530 {
6531 internal_damage = ((ranrot_rand() & PLAYER_INTERNAL_DAMAGE_FACTOR) < amount); // base chance of damage to systems
6532 if (internal_damage)
6533 {
6534 [self takeInternalDamage];
6535 }
6537 }
6538}

◆ targetInfoSystem

- (void) targetInfoSystem

Definition at line 13727 of file PlayerEntity.m.

868{
869 [self setInfoSystemID: target_system_id moveChart: YES];
870 return;
871}

◆ targetMemory

- (NSMutableArray *) targetMemory

Definition at line 9242 of file PlayerEntity.m.

12352{
12353 return target_memory;
12354}

◆ targetNearestHostile

- (void) targetNearestHostile

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2927{
2928 [self scanForHostiles];
2929 Entity *ent = [self foundTarget];
2930 if (ent != nil)
2931 {
2932 ident_engaged = YES;
2933 missile_status = MISSILE_STATUS_TARGET_LOCKED;
2934 [self addTarget:ent];
2935 }
2936}

◆ targetNearestIncomingMissile

- (void) targetNearestIncomingMissile

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

2940{
2941 [self scanForNearestIncomingMissile];
2942 Entity *ent = [self foundTarget];
2943 if (ent != nil)
2944 {
2945 ident_engaged = YES;
2946 missile_status = MISSILE_STATUS_TARGET_LOCKED;
2947 [self addTarget:ent];
2948 }
2949}

◆ targetNewSystem:

- (void) targetNewSystem: (int direction

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

824 :(int) direction
825{
826 [self targetNewSystem:direction whileTyping:NO];
827}

◆ targetNewSystem:whileTyping:

- (void) targetNewSystem: (int direction
whileTyping: (BOOL whileTyping 
implementation

Provided by category PlayerEntity(Controls).

Definition at line 164 of file PlayerEntityControls.m.

801 :(int) direction whileTyping:(BOOL) whileTyping
802{
803 target_system_id = [[UNIVERSE gui] targetNextFoundSystem:direction];
804 [self setInfoSystemID: target_system_id moveChart: YES];
805 cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
806
807 found_system_id = target_system_id;
808 if (!whileTyping)
809 {
810 [self clearPlanetSearchString];
811 }
812 cursor_moving = YES;
813}

◆ targetSystemID

- (OOSystemID) targetSystemID

Definition at line 13727 of file PlayerEntity.m.

712{
713 return target_system_id;
714}

◆ testForEquipment:

- (void) testForEquipment: (NSString *)  equipString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1444 :(NSString *)equipString //eg. EQ_NAVAL_ENERGY_UNIT
1445{
1446 found_equipment = [self hasEquipmentItem:equipString];
1447}

◆ TestScriptConditions

+ (static BOOL) TestScriptConditions (NSArray *)  conditions
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 233 of file PlayerEntityLegacyScriptEngine.m.

234{
235 NSEnumerator *condEnum = nil;
236 NSArray *condition = nil;
237 PlayerEntity *player = PLAYER;
238
239 for (condEnum = [conditions objectEnumerator]; (condition = [condEnum nextObject]); )
240 {
241 if (![player scriptTestCondition:condition]) return NO;
242 }
243
244 return YES;
245}

◆ tidyMissilePylons

- (void) tidyMissilePylons

Definition at line 13727 of file PlayerEntity.m.

5712{
5713 // Make sure there's no gaps between missiles, synchronise missile_entity & missile_list.
5714 int i, pylon = 0;
5715 OOLog(@"missile.tidying.debug",@"Tidying fitted %d of possible %d missiles",missiles,PLAYER_MAX_MISSILES);
5716 for(i = 0; i < PLAYER_MAX_MISSILES; i++)
5717 {
5718 OOLog(@"missile.tidying.debug",@"%d %@ %@",i,missile_entity[i],missile_list[i]);
5719 if(missile_entity[i] != nil)
5720 {
5721 missile_entity[pylon] = missile_entity[i];
5722 missile_list[pylon] = [OOEquipmentType equipmentTypeWithIdentifier:[missile_entity[i] primaryRole]];
5723 pylon++;
5724 }
5725 }
5726
5727 // Now clean up the remainder of the pylons.
5728 for(i = pylon; i < PLAYER_MAX_MISSILES; i++)
5729 {
5730 missile_entity[i] = nil;
5731 // not strictly needed, but helps clear things up
5732 missile_list[i] = nil;
5733 }
5734}

◆ tradeInFactor

- (int) tradeInFactor

Definition at line 9242 of file PlayerEntity.m.

11915{
11916 return ship_trade_in_factor;
11917}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ tradeInValue

- (OOCreditsQuantity) tradeInValue
implementation

Provided by category PlayerEntity(ContractsPrivate).

Definition at line 1443 of file PlayerEntityContracts.m.

1706{
1707 // returns down to ship_trade_in_factor% of the full credit value of your ship
1708
1709 /* FIXME: the trade-in value can be more than the sale value, and
1710 ship_trade_in_factor starts at 100%, so it can be profitable to sit
1711 and buy the same ship over and over again. This bug predates Oolite
1712 1.65.
1713 Partial fix: make effective trade-in value 75% * ship_trade_in_factor%
1714 of the "raw" trade-in value. This still allows profitability! A better
1715 solution would be to unify the price calculation for trade-in and
1716 for-sale ships.
1717 -- Ahruman 20070707, fix applied 20070708
1718 */
1719 unsigned long long value = [UNIVERSE tradeInValueForCommanderDictionary:[self commanderDataDictionary]];
1720 value -= value * 0.006 * [self missingSubEntitiesAdjustment]; // TODO: 0.006 might need rethinking.
1721 value = cunningFee(((value * 75 * ship_trade_in_factor) + 5000) / 10000, 0.005); // Multiply by two percentages, divide by 100*100. The +5000 is to get normal rounding.
1722 return value * 10;
1723}

◆ trumbleAppetiteAccumulator

- (float) trumbleAppetiteAccumulator

Definition at line 9242 of file PlayerEntity.m.

12206{
12208}

◆ trumbleArray

- (OOTrumble **) trumbleArray

Definition at line 9242 of file PlayerEntity.m.

12061{
12062 return trumble;
12063}

◆ trumbleCount

- (NSUInteger) trumbleCount

◆ trumbleValue

- (id) trumbleValue

Definition at line 9242 of file PlayerEntity.m.

12073{
12074 NSString *namekey = [NSString stringWithFormat:@"%@-humbletrash", [self commanderName]];
12075 int trumbleHash;
12076
12078 [self mungChecksumWithNSString:[self commanderName]];
12082
12083 [[NSUserDefaults standardUserDefaults] setInteger:trumbleHash forKey:namekey];
12084
12085 int i;
12086 NSMutableArray *trumbleArray = [NSMutableArray arrayWithCapacity:PLAYER_MAX_TRUMBLES];
12087 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12088 {
12089 [trumbleArray addObject:[trumble[i] dictionary]];
12090 }
12091
12092 return [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInteger:trumbleCount], [NSNumber numberWithInt:trumbleHash], trumbleArray, nil];
12093}
OOTrumble ** trumbleArray()

◆ tryBuyingCommodity:all:

- (BOOL) tryBuyingCommodity: (OOCommodityType type
all: (BOOL all 

Definition at line 9242 of file PlayerEntity.m.

11361 :(OOCommodityType)index all:(BOOL)all
11362{
11363 if ([index isEqualToString:@"<<<"] || [index isEqualToString:@">>>"])
11364 {
11365 ++marketOffset;
11366 return NO;
11367 }
11368
11369 if (![self isDocked]) return NO; // can't buy if not docked.
11370
11371 OOCommodityMarket *localMarket = [self localMarket];
11372 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:index];
11373 OOMassUnit unit = [localMarket massUnitForGood:index];
11374
11375 if (specialCargo != nil && unit == UNITS_TONS)
11376 {
11377 return NO; // can't buy tons of stuff when carrying a specialCargo
11378 }
11379 int manifest_quantity = [shipCommodityData quantityForGood:index];
11380 int market_quantity = [localMarket quantityForGood:index];
11381
11382 int purchase = 1;
11383 if (all)
11384 {
11385 // if cargo contracts, put a break point on the contract volume
11386 int contracted = [self contractedVolumeForGood:index];
11388 {
11389 purchase = [localMarket capacityForGood:index];
11390 }
11391 else
11392 {
11394 }
11395 }
11397 {
11398 purchase = market_quantity; // limit to what's available
11399 }
11401 {
11402 purchase = floor (credits / pricePerUnit); // limit to what's affordable
11403 }
11404 // TODO - fix brokenness here...
11406 {
11407 purchase = [self availableCargoSpace]; // limit to available cargo space
11408 }
11409 else
11410 {
11412 {
11413 // other cases are fine so long as buying is limited to <1000kg / <1000000g
11414 // but if this case is true, we need to see if there is more space in
11415 // the manifest (safe) or an already-accounted-for pod
11416 if (unit == UNITS_KILOGRAMS)
11417 {
11419 {
11420 // going from < n500 to >= n500 would increase pods needed by 1
11422 }
11423 }
11424 else // UNITS_GRAMS
11425 {
11427 {
11428 // going from < n500000 to >= n500000 would increase pods needed by 1
11429 purchase = MAX_GRAMS_IN_SAFE - manifest_quantity; // max possible
11430 }
11431 }
11432 }
11433 }
11434 if (purchase <= 0)
11435 {
11436 return NO; // stop if that results in nothing to be bought
11437 }
11438
11439 [localMarket removeQuantity:purchase forGood:index];
11440 [shipCommodityData addQuantity:purchase forGood:index];
11442
11443 [self calculateCurrentCargo];
11444
11445 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11446
11447 [self doScriptEvent:OOJSID("playerBoughtCargo") withArguments:[NSArray arrayWithObjects:index, [NSNumber numberWithInt:purchase], [NSNumber numberWithUnsignedLongLong:pricePerUnit], nil]];
11448 if ([localMarket exportLegalityForGood:index] > 0)
11449 {
11450 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-illegal"];
11451 }
11452 else
11453 {
11454 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-legal"];
11455 }
11456
11457 return YES;
11458}
BOOL removeQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)
OOCargoQuantity capacityForGood:(OOCommodityType good)

◆ tryBuyingItem:

- (BOOL) tryBuyingItem: (NSString *)  eqKey
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9242 of file PlayerEntity.m.

10336 :(NSString *)eqKey
10337{
10338 // note this doesn't check the availability by tech-level
10342 double price = pricePerUnit;
10343 double priceFactor = 1.0;
10345 BOOL isRepair = NO;
10346
10347 // repairs cost 50%
10348 if ([self hasEquipmentItem:eqKeyDamaged])
10349 {
10350 price /= 2.0;
10351 isRepair = YES;
10352 }
10353
10354 if ([eqKey isEqualToString:@"EQ_RENOVATION"])
10355 {
10356 price = [self renovationCosts];
10357 }
10358
10359 price = [self adjustPriceByScriptForEqKey:eqKey withCurrent:price];
10360
10361 StationEntity *dockedStation = [self dockedStation];
10362 if (dockedStation)
10363 {
10364 priceFactor = [dockedStation equipmentPriceFactor];
10365 }
10366
10367 price *= priceFactor; // increased prices at some stations
10368
10369 if (price > credits)
10370 {
10371 return NO;
10372 }
10373
10374 if ([eqType isPrimaryWeapon])
10375 {
10377 {
10378 [self setGuiToEquipShipScreen:0 selectingFacingFor:eqKey]; // reset
10379 return YES;
10380 }
10381
10384
10386
10387 switch (chosen_weapon_facing)
10388 {
10392 if (_multiplyWeapons)
10393 {
10394 multiplier = [forwardWeaponOffset count];
10395 }
10396 break;
10397
10398 case WEAPON_FACING_AFT:
10401 if (_multiplyWeapons)
10402 {
10403 multiplier = [aftWeaponOffset count];
10404 }
10405 break;
10406
10407 case WEAPON_FACING_PORT:
10410 if (_multiplyWeapons)
10411 {
10412 multiplier = [portWeaponOffset count];
10413 }
10414 break;
10415
10419 if (_multiplyWeapons)
10420 {
10421 multiplier = [starboardWeaponOffset count];
10422 }
10423 break;
10424
10425 case WEAPON_FACING_NONE:
10426 break;
10427 }
10428
10429 price *= multiplier;
10430
10431 if (price > credits)
10432 {
10433 // not enough money - ensure that weapon
10434 // type is reset to what it was before
10435 // the attempt to buy took place
10436 switch (chosen_weapon_facing)
10437 {
10440 break;
10441 case WEAPON_FACING_AFT:
10443 break;
10444 case WEAPON_FACING_PORT:
10446 break;
10449 break;
10450 case WEAPON_FACING_NONE:
10451 break;
10452 }
10453 return NO;
10454 }
10455 credits -= price;
10456
10457 // Refund current_weapon
10458 if (current_weapon != nil)
10459 {
10460 tradeIn = [UNIVERSE getEquipmentPriceForKey:OOEquipmentIdentifierFromWeaponType(current_weapon)] * multiplier;
10461 }
10462
10463 [self doTradeIn:tradeIn forPriceFactor:priceFactor];
10464 // If equipped, remove damaged weapon after repairs. -- But there's no way we should get a damaged weapon. Ever.
10465 [self removeEquipmentItem:eqKeyDamaged];
10466 return YES;
10467 }
10468
10469 if ([eqType isMissileOrMine] && missiles >= max_missiles)
10470 {
10471 OOLog(@"equip.buy.mounted.failed.full", @"%@", @"rejecting missile because already full");
10472 return NO;
10473 }
10474
10475 // NSFO!
10476 //unsigned passenger_space = [[OOEquipmentType equipmentTypeWithIdentifier:@"EQ_PASSENGER_BERTH"] requiredCargoSpace];
10477 //if (passenger_space == 0) passenger_space = PASSENGER_BERTH_SPACE;
10478
10479 if ([eqKey isEqualToString:@"EQ_PASSENGER_BERTH"] && [self availableCargoSpace] < PASSENGER_BERTH_SPACE)
10480 {
10481 return NO;
10482 }
10483
10484 if ([eqKey isEqualToString:@"EQ_FUEL"])
10485 {
10486#if MASS_DEPENDENT_FUEL_PRICES
10488#else
10489 OOCreditsQuantity creditsForRefuel = ([self fuelCapacity] - [self fuel]) * pricePerUnit;
10490#endif
10491 if (credits >= creditsForRefuel) // Ensure we don't overflow
10492 {
10494 fuel = [self fuelCapacity];
10495 return YES;
10496 }
10497 else
10498 {
10499 return NO;
10500 }
10501 }
10502
10503 // check energy unit replacement
10504 if ([eqKey hasSuffix:@"ENERGY_UNIT"] && [self energyUnitType] != ENERGY_UNIT_NONE)
10505 {
10506 switch ([self energyUnitType])
10507 {
10508 case ENERGY_UNIT_NAVAL :
10509 [self removeEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"];
10510 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_NAVAL_ENERGY_UNIT"] / 2; // 50 % refund
10511 break;
10513 [self removeEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"];
10514 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_NAVAL_ENERGY_UNIT"] / 4; // half of the working one
10515 break;
10516 case ENERGY_UNIT_NORMAL :
10517 [self removeEquipmentItem:@"EQ_ENERGY_UNIT"];
10518 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_ENERGY_UNIT"] * 3 / 4; // 75 % refund
10519 break;
10521 [self removeEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"];
10522 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_ENERGY_UNIT"] * 3 / 8; // half of the working one
10523 break;
10524
10525 default:
10526 break;
10527 }
10528 [self doTradeIn:tradeIn forPriceFactor:priceFactor];
10529 }
10530
10531 // maintain ship
10532 if ([eqKey isEqualToString:@"EQ_RENOVATION"])
10533 {
10534 OOTechLevelID techLevel = NSNotFound;
10535 if (dockedStation != nil) techLevel = [dockedStation equivalentTechLevel];
10536 if (techLevel == NSNotFound) techLevel = [[UNIVERSE currentSystemData] oo_unsignedIntForKey:KEY_TECHLEVEL];
10537
10538 credits -= price;
10539 ship_trade_in_factor += 5 + techLevel; // you get better value at high-tech repair bases
10541
10542 [self clearSubEntities];
10543 [self setUpSubEntities];
10544
10545 return YES;
10546 }
10547
10548 if ([eqKey hasSuffix:@"MISSILE"] || [eqKey hasSuffix:@"MINE"])
10549 {
10550 ShipEntity* weapon = [[UNIVERSE newShipWithRole:eqKey] autorelease];
10551 if (weapon) OOLog(kOOLogBuyMountedOK, @"Got ship for mounted weapon role %@", eqKey);
10552 else OOLog(kOOLogBuyMountedFailed, @"Could not find ship for mounted weapon role %@", eqKey);
10553
10554 BOOL mounted_okay = [self mountMissile:weapon];
10555 if (mounted_okay)
10556 {
10557 credits -= price;
10558 [self safeAllMissiles];
10559 [self tidyMissilePylons];
10560 [self setActiveMissile:0];
10561 }
10562 return mounted_okay;
10563 }
10564
10565 if ([eqKey isEqualToString:@"EQ_PASSENGER_BERTH"])
10566 {
10567 [self changePassengerBerths:+1];
10568 credits -= price;
10569 return YES;
10570 }
10571
10572 if ([eqKey isEqualToString:@"EQ_PASSENGER_BERTH_REMOVAL"])
10573 {
10574 [self changePassengerBerths:-1];
10575 credits -= price;
10576 return YES;
10577 }
10578
10579 if ([eqKey isEqualToString:@"EQ_MISSILE_REMOVAL"])
10580 {
10581 credits -= price;
10583 [self doTradeIn:tradeIn forPriceFactor:priceFactor];
10584 return YES;
10585 }
10586
10587 if ([self canAddEquipment:eqKey inContext:@"purchase"])
10588 {
10589 credits -= price;
10590 [self addEquipmentItem:eqKey withValidation:NO inContext:@"purchase"]; // no need to validate twice.
10591 if (isRepair)
10592 {
10593 [self doScriptEvent:OOJSID("equipmentRepaired") withArgument:eqKey];
10594 }
10595 return YES;
10596 }
10597
10598 return NO;
10599}
static NSString *const kOOLogBuyMountedOK
static NSString *const kOOLogBuyMountedFailed
OOCreditsQuantity removeMissiles()
OOEnergyUnitType energyUnitType()
OOCargoQuantity availableCargoSpace()

◆ trySellingCommodity:all:

- (BOOL) trySellingCommodity: (OOCommodityType type
all: (BOOL all 

Definition at line 9242 of file PlayerEntity.m.

11461 :(OOCommodityType)index all:(BOOL)all
11462{
11463 if ([index isEqualToString:@"<<<"] || [index isEqualToString:@">>>"])
11464 {
11465 --marketOffset;
11466 return NO;
11467 }
11468
11469 if (![self isDocked]) return NO; // can't sell if not docked.
11470
11471 OOCommodityMarket *localMarket = [self localMarket];
11472 int available_units = [shipCommodityData quantityForGood:index];
11473 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:index];
11474
11475 if (available_units == 0) return NO;
11476
11477 int market_quantity = [localMarket quantityForGood:index];
11478
11479 int capacity = [localMarket capacityForGood:index];
11480 int sell = 1;
11481 if (all)
11482 {
11483 // if cargo contracts, put a break point on the contract volume
11484 int contracted = [self contractedVolumeForGood:index];
11486 {
11487 sell = capacity;
11488 }
11489 else
11490 {
11492 }
11493 }
11494
11495 if (sell > available_units)
11496 sell = available_units; // limit to what's in the hold
11497 if (sell + market_quantity > capacity)
11498 sell = capacity - market_quantity; // avoid flooding the market
11499 if (sell <= 0)
11500 return NO; // stop if that results in nothing to be sold
11501
11502 [localMarket addQuantity:sell forGood:index];
11503 [shipCommodityData removeQuantity:sell forGood:index];
11505
11506 [self calculateCurrentCargo];
11507
11508 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11509
11510 [self doScriptEvent:OOJSID("playerSoldCargo") withArguments:[NSArray arrayWithObjects:index, [NSNumber numberWithInt:sell], [NSNumber numberWithUnsignedLongLong: pricePerUnit], nil]];
11511
11512 return YES;
11513}
BOOL addQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)

◆ unloadAllCargoPodsForType:toManifest:

- (void) unloadAllCargoPodsForType: (OOCommodityType type
toManifest: (OOCommodityMarket *)  manifest 

Definition at line 13727 of file PlayerEntity.m.

218{
219 NSInteger i, cargoCount = [cargo count];
220 if (cargoCount == 0) return;
221
222 // step through the cargo pods adding in the quantities
223 for (i = cargoCount - 1; i >= 0 ; i--)
224 {
225 ShipEntity *cargoItem = [cargo objectAtIndex:i];
226 NSString * commodityType = [cargoItem commodityType];
228 {
230 {
231 // transfer
232 [manifest addQuantity:[cargoItem commodityAmount] forGood:type];
233 }
234 else // undefined
235 {
236 OOLog(@"player.badCargoPod", @"Cargo pod %@ has bad commodity type, rejecting.", cargoItem);
237 continue;
238 }
239 [cargo removeObjectAtIndex:i];
240 }
241 }
242}

◆ unloadCargoPods

- (void) unloadCargoPods

Definition at line 13727 of file PlayerEntity.m.

295{
296 NSAssert([self isDocked], @"Cannot unload cargo pods unless docked.");
297
298 /* loads commodities from the cargo pods onto the ship's manifest */
299 NSString *good = nil;
300 foreach (good, [shipCommodityData goods])
301 {
302 [self unloadAllCargoPodsForType:good toManifest:shipCommodityData];
303 }
304#ifndef NDEBUG
305 if ([cargo count] > 0)
306 {
307 OOLog(@"player.unloadCargo",@"Cargo remains in pods after unloading - %@",cargo);
308 }
309#endif
310
311 [self calculateCurrentCargo]; // work out the correct value for current_cargo
312}

◆ unloadCargoPodsForType:amount:

- (void) unloadCargoPodsForType: (OOCommodityType type
amount: (OOCargoQuantity quantity 

Definition at line 13727 of file PlayerEntity.m.

246{
247 NSInteger i, n_cargo = [cargo count];
248 if (n_cargo == 0) return;
249
254
255 // step through the cargo pods removing pods or quantities
256 for (i = n_cargo - 1; (i >= 0 && cargoToGo > 0) ; i--)
257 {
258 cargoItem = [cargo objectAtIndex:i];
259 co_type = [cargoItem commodityType];
260 if (co_type == nil || [co_type isEqualToString:type])
261 {
262 if ([co_type isEqualToString:type])
263 {
264 amount = [cargoItem commodityAmount];
265 if (amount <= cargoToGo)
266 {
267 [cargo removeObjectAtIndex:i];
268 cargoToGo -= amount;
269 }
270 else
271 {
272 // we only need to remove a part of the cargo to meet our target
273 [cargoItem setCommodity:co_type andAmount:(amount - cargoToGo)];
274 cargoToGo = 0;
275
276 }
277 }
278 else // undefined
279 {
280 OOLog(@"player.badCargoPod", @"Cargo pod %@ has bad commodity type (COMMODITY_UNDEFINED), rejecting.", cargoItem);
281 continue;
282 }
283 }
284 }
285
286 // now check if we are ready. When not, proceed with quantities in the manifest.
287 if (cargoToGo > 0)
288 {
289 [shipCommodityData removeQuantity:cargoToGo forGood:type];
290 }
291}

◆ unsetKeySetting:

- (void) unsetKeySetting: (NSString*)  key
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1656 :(NSString*)key
1657{
1658 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1659 if (![self entryIsCustomEquip:key])
1660 {
1661 NSMutableDictionary *keyconf = [NSMutableDictionary dictionaryWithDictionary:[defaults objectForKey:KEYCONFIG_OVERRIDES]];
1662 NSMutableArray *empty = [[NSMutableArray alloc] init];
1663 [keyconf setObject:empty forKey:key];
1664 [defaults setObject:keyconf forKey:KEYCONFIG_OVERRIDES];
1665 [empty release];
1666 }
1667 else
1668 {
1669 NSString *custkey = [self getCustomEquipKeyDefType:key];
1670 NSMutableDictionary *custEquip = [[customEquipActivation objectAtIndex:[self getCustomEquipIndex:key]] mutableCopy];
1671 [custEquip removeObjectForKey:custkey];
1672 [customEquipActivation replaceObjectAtIndex:[self getCustomEquipIndex:key] withObject:custEquip];
1673 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1674 [custEquip release];
1675 }
1676 // reload settings
1677 [self initKeyConfigSettings];
1678}

◆ update:

- (void) update: (OOTimeDelta delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

2623 :(OOTimeDelta)delta_t
2624{
2626
2627 UPDATE_STAGE(@"updateMovementFlags");
2628 [self updateMovementFlags];
2629 UPDATE_STAGE(@"updateAlertCondition");
2630 [self updateAlertCondition];
2631 UPDATE_STAGE(@"updateFuelScoops:");
2632 [self updateFuelScoops:delta_t];
2633
2634 UPDATE_STAGE(@"updateClocks:");
2635 [self updateClocks:delta_t];
2636
2637 // scripting
2638 UPDATE_STAGE(@"updateTimers");
2640 UPDATE_STAGE(@"checkScriptsIfAppropriate");
2641 [self checkScriptsIfAppropriate];
2642
2643 // deal with collisions
2644 UPDATE_STAGE(@"manageCollisions");
2645 [self manageCollisions];
2646
2647 UPDATE_STAGE(@"pollControls:");
2648 [self pollControls:delta_t];
2649
2650 UPDATE_STAGE(@"updateTrumbles:");
2651 [self updateTrumbles:delta_t];
2652
2653 OOEntityStatus status = [self status];
2654 /* Validate that if the status is STATUS_START_GAME we're on one
2655 * of the few GUI screens which that makes sense for */
2670 {
2671 // and if not, do a restart of the GUI
2672 UPDATE_STAGE(@"setGuiToIntroFirstGo:");
2673 [self setGuiToIntroFirstGo:YES]; //set up demo mode
2674 }
2675
2677 {
2678 UPDATE_STAGE(@"performAutopilotUpdates:");
2679 [self performAutopilotUpdates:delta_t];
2680 }
2681 else if (![self isDocked])
2682 {
2683 UPDATE_STAGE(@"performInFlightUpdates:");
2684 [self performInFlightUpdates:delta_t];
2685 }
2686
2687 /* NOTE: status-contingent updates are not a switch since they can
2688 cascade when status changes.
2689 */
2690 if (status == STATUS_IN_FLIGHT)
2691 {
2692 UPDATE_STAGE(@"doBookkeeping:");
2693 [self doBookkeeping:delta_t];
2694 }
2696 {
2697 UPDATE_STAGE(@"performWitchspaceCountdownUpdates:");
2698 [self performWitchspaceCountdownUpdates:delta_t];
2699 }
2701 {
2702 UPDATE_STAGE(@"performWitchspaceExitUpdates:");
2703 [self performWitchspaceExitUpdates:delta_t];
2704 }
2705 if (status == STATUS_LAUNCHING)
2706 {
2707 UPDATE_STAGE(@"performLaunchingUpdates:");
2708 [self performLaunchingUpdates:delta_t];
2709 }
2710 if (status == STATUS_DOCKING)
2711 {
2712 UPDATE_STAGE(@"performDockingUpdates:");
2713 [self performDockingUpdates:delta_t];
2714 }
2715 if (status == STATUS_DEAD)
2716 {
2717 UPDATE_STAGE(@"performDeadUpdates:");
2718 [self performDeadUpdates:delta_t];
2719 }
2720
2721 UPDATE_STAGE(@"updateWormholes");
2722 [self updateWormholes];
2723
2725}

◆ updateAfterburnerSound

- (void) updateAfterburnerSound
implementation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

455{
456 static uint8_t which = 0;
457
458 if (!afterburner_engaged) // end the loop cycle
459 {
460 afterburnerSoundLooping = NO;
461 }
462
463 if (afterburnerSoundLooping)
464 {
465 [sAfterburnerSources[which] play];
466 which = !which;
467
468 [self performSelector:@selector(updateAfterburnerSound)
469 withObject:NULL
470 afterDelay:1.25]; // and swap sounds in 1.25s time
471 }
472}

◆ updateAlertCondition

- (void) updateAlertCondition
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3429{
3430 [self updateAlertConditionForNearbyEntities];
3431 /* TODO: update alert condition once per frame. Tried this before, but
3432 there turned out to be complications. See mailing list archive.
3433 -- Ahruman 20070802
3434 */
3435 OOAlertCondition cond = [self alertCondition];
3436 OOTimeAbsolute t = [UNIVERSE getTime];
3438 {
3441 }
3442 /* Update heuristic assessment of whether player is fleeing */
3444 {
3446 }
3448 {
3450 }
3452 {
3454 }
3455 else if (fleeing_status == PLAYER_FLEEING_MAYBE && last_shot_time + 10 > t)
3456 {
3458 }
3459 else if (fleeing_status == PLAYER_FLEEING_LIKELY && last_shot_time + 10 > t)
3460 {
3462 }
3464 {
3466 }
3468 {
3470 }
3471}
double OOTimeAbsolute
Definition OOTypes.h:223
@ PLAYER_FLEEING_MAYBE
@ PLAYER_FLEEING_LIKELY
@ PLAYER_FLEEING_NONE
@ PLAYER_FLEEING_CARGO
@ PLAYER_FLEEING_UNLIKELY
OOAlertCondition
Definition ShipEntity.h:172
@ ALERT_CONDITION_GREEN
Definition ShipEntity.h:176
@ ALERT_CONDITION_YELLOW
Definition ShipEntity.h:177
@ ALERT_CONDITION_DOCKED
Definition ShipEntity.h:175
OOTimeAbsolute last_shot_time
Definition ShipEntity.h:359

◆ updateAlertConditionForNearbyEntities

- (void) updateAlertConditionForNearbyEntities
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3218{
3219 if (![self isInSpace] || [self status] == STATUS_DOCKING)
3220 {
3221 [self clearAlertFlags];
3222 // not needed while docked
3223 return;
3224 }
3225
3226 int i, ent_count = UNIVERSE->n_entities;
3227 Entity **uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
3228 Entity *my_entities[ent_count];
3230 for (i = 0; i < ent_count; i++)
3231 {
3232 my_entities[i] = [uni_entities[i] retain]; // retained
3233 }
3234 BOOL massLocked = NO;
3236#if OO_VARIABLE_TORUS_SPEED
3238 double hsnDistance = 0;
3239#endif
3240 for (i = 0; i < ent_count; i++) // scanner lollypops
3241 {
3243
3244#if OO_VARIABLE_TORUS_SPEED
3246 {
3247 // not visual effects, waypoints, ships, etc.
3249 {
3252 }
3253 }
3254 else if ([scannedEntity isStellarObject])
3255 {
3256 // planets, stars might be closest surface even if not
3257 // closest centre. That could be true of others, but the
3258 // error is negligible there.
3259 double thisHSN = sqrt(scannedEntity->zero_distance)-[scannedEntity collisionRadius];
3260 if (thisHSN < hsnDistance)
3261 {
3263 }
3264 }
3265#endif
3266
3267 if (scannedEntity->zero_distance < SCANNER_MAX_RANGE2 || !scannedEntity->isShip)
3268 {
3269 int theirClass = [scannedEntity scanClass];
3270 // here we could also force masslock for higher than yellow alert, but
3271 // if we are going to hand over masslock control to scripting, might as well
3272 // hand it over fully
3273 if ([self massLockable] /*|| alertFlags > ALERT_FLAG_YELLOW_LIMIT*/)
3274 {
3275 massLocked |= [self checkEntityForMassLock:scannedEntity withScanClass:theirClass]; // we just need one masslocker..
3276 }
3278 {
3279 if (theirClass == CLASS_THARGOID || [scannedEntity isCascadeWeapon])
3280 {
3282 }
3283 else if ([scannedEntity isShip])
3284 {
3286 foundHostiles |= (([ship hasHostileTarget])&&([ship primaryTarget] == self));
3287 }
3288 }
3289 }
3290 }
3291#if OO_VARIABLE_TORUS_SPEED
3293 {
3294 // this case should only occur in an otherwise empty
3295 // interstellar space - unlikely but possible
3297 }
3298 else
3299 {
3300 // once nearest object is >4x scanner range
3301 // start increasing torus speed
3303 if (factor < 1.0)
3304 {
3306 }
3307 else
3308 {
3311 {
3312 // caps out at ~10^8m from nearest object
3313 // which takes ~10 minutes of flying
3315 }
3316 }
3317 }
3318#endif
3319
3320 [self setAlertFlag:ALERT_FLAG_MASS_LOCK to:massLocked];
3321
3322 [self setAlertFlag:ALERT_FLAG_HOSTILES to:foundHostiles];
3323
3324 for (i = 0; i < ent_count; i++)
3325 {
3326 [my_entities[i] release]; // released
3327 }
3328
3330 if (energy < 64 && energy < maxEnergy * 0.8)
3331 {
3333 }
3334 [self setAlertFlag:ALERT_FLAG_ENERGY to:energyCritical];
3335
3336 [self setAlertFlag:ALERT_FLAG_TEMP to:([self hullHeatLevel] > .90)];
3337
3338 [self setAlertFlag:ALERT_FLAG_ALT to:([self dialAltitude] < .10)];
3339
3340}
#define MAX_HYPERSPEED_FACTOR
#define MIN_HYPERSPEED_FACTOR
GLfloat hyperspeedFactor
BOOL hasHostileTarget()

◆ updateClocks:

- (void) updateClocks: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3488 :(OOTimeDelta)delta_t
3489{
3490 // shot time updates are still needed here for STATUS_DEAD!
3491 shot_time += delta_t;
3492 script_time += delta_t;
3493 unsigned prev_day = floor(ship_clock / 86400);
3494 ship_clock += delta_t;
3495 if (ship_clock_adjust > 0.0) // adjust for coming out of warp (add LY * LY hrs)
3496 {
3497 double fine_adjust = delta_t * 7200.0;
3498 if (ship_clock_adjust > 86400) // more than a day
3499 fine_adjust = delta_t * 115200.0; // 16 times faster
3500 if (ship_clock_adjust > 0)
3501 {
3506 }
3507 else
3508 {
3513 }
3514 }
3515 else
3516 ship_clock_adjust = 0.0;
3517
3518 unsigned now_day = floor(ship_clock / 86400.0);
3519 while (prev_day < now_day)
3520 {
3521 prev_day++;
3522 [self doScriptEvent:OOJSID("dayChanged") withArgument:[NSNumber numberWithUnsignedInt:prev_day]];
3523 // not impossible that at ultra-low frame rates two of these will
3524 // happen in a single update.
3525 }
3526
3527 //fps
3529 {
3530 if (![self clockAdjusting])
3531 {
3532 fps_counter = (int)([UNIVERSE timeAccelerationFactor] * floor([UNIVERSE framesDoneThisUpdate] / (fps_check_time - last_fps_check_time)));
3535 }
3536 else
3537 {
3538 // Good approximation for when the clock is adjusting and proper fps calculation
3539 // cannot be performed.
3540 fps_counter = (int)([UNIVERSE timeAccelerationFactor] * floor(1.0 / delta_t));
3542 }
3543 [UNIVERSE resetFramesDoneThisUpdate]; // Reset frame counter
3544 }
3545}
double last_fps_check_time

◆ updateFuelScoops:

- (void) updateFuelScoops: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3474 :(OOTimeDelta)delta_t
3475{
3476 if (scoopsActive)
3477 {
3478 [self updateFuelScoopSoundWithInterval:delta_t];
3479 if (![self scoopOverride])
3480 {
3481 scoopsActive = NO;
3482 [self updateFuelScoopSoundWithInterval:delta_t];
3483 }
3484 }
3485}

◆ updateFuelScoopSoundWithInterval:

- (void) updateFuelScoopSoundWithInterval: (OOTimeDelta delta_t

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

429 :(OOTimeDelta)delta_t
430{
431 static double scoopSoundPlayTime = 0.0;
432 scoopSoundPlayTime -= delta_t;
433 if (scoopSoundPlayTime < 0.0)
434 {
435 if(![sInterfaceBeepSource isPlaying])
436 {
437 /* TODO: this should use the scoop position, not the standard
438 * interface beep position */
439 [self playInterfaceBeep:@"[scoop]"];
440 scoopSoundPlayTime = 0.5;
441 }
442 else scoopSoundPlayTime = 0.0;
443 }
444 if (![self scoopOverride])
445 {
446 scoopSoundPlayTime = 0.0;
447 }
448}

◆ updateFunction:

- (void) updateFunction: (NSDictionary *)  hwDict

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

215 : (NSDictionary *)hwDict
216{
218 waitingForStickCallback = NO;
219
220 // Right time and the right place?
221 if(gui_screen != GUI_SCREEN_STICKMAPPER)
222 {
223 OOLog(@"joystick.configure.error", @"%s called when not on stick mapper screen.", __PRETTY_FUNCTION__);
224 return;
225 }
226 // What moved?
227 int function;
228 NSDictionary *entry = [stickFunctions objectAtIndex:selFunctionIdx];
229 if([hwDict oo_boolForKey:STICK_ISAXIS])
230 {
231 function=[entry oo_intForKey: KEY_AXISFN];
232 if (function == AXIS_THRUST)
233 {
234 [stickHandler unsetButtonFunction:BUTTON_INCTHRUST];
235 [stickHandler unsetButtonFunction:BUTTON_DECTHRUST];
236 }
237#if OO_FOV_INFLIGHT_CONTROL_ENABLED
238 if (function == AXIS_FIELD_OF_VIEW)
239 {
240 [stickHandler unsetButtonFunction:BUTTON_INC_FIELD_OF_VIEW];
241 [stickHandler unsetButtonFunction:BUTTON_DEC_FIELD_OF_VIEW];
242 }
243#endif
244 if (function == AXIS_VIEWX)
245 {
246 [stickHandler unsetButtonFunction:BUTTON_VIEWPORT];
247 [stickHandler unsetButtonFunction:BUTTON_VIEWSTARBOARD];
248 }
249 if (function == AXIS_VIEWY)
250 {
251 [stickHandler unsetButtonFunction:BUTTON_VIEWFORWARD];
252 [stickHandler unsetButtonFunction:BUTTON_VIEWAFT];
253 }
254 }
255 else
256 {
257 function = [entry oo_intForKey:KEY_BUTTONFN];
258 if (function == BUTTON_INCTHRUST || function == BUTTON_DECTHRUST)
259 {
260 [stickHandler unsetAxisFunction:AXIS_THRUST];
261 }
262#if OO_FOV_INFLIGHT_CONTROL_ENABLED
263 if (function == BUTTON_INC_FIELD_OF_VIEW || function == BUTTON_DEC_FIELD_OF_VIEW)
264 {
265 [stickHandler unsetAxisFunction:AXIS_FIELD_OF_VIEW];
266 }
267#endif
268 if (function == BUTTON_VIEWPORT || function == BUTTON_VIEWSTARBOARD)
269 {
270 [stickHandler unsetAxisFunction:AXIS_VIEWX];
271 }
272 if (function == BUTTON_VIEWFORWARD || function == BUTTON_VIEWAFT)
273 {
274 [stickHandler unsetAxisFunction:AXIS_VIEWY];
275 }
276 }
277 // special case for OXP equipment buttons
278 if (function >= 10000)
279 {
280 NSString *key = CUSTOMEQUIP_BUTTONACTIVATE;
281 function -= 10000;
282 if (function >= 10000)
283 {
284 function -= 10000;
286 }
287 NSMutableDictionary *custEquip = [[customEquipActivation objectAtIndex:function] mutableCopy];
288 [custEquip setObject:hwDict forKey:key];
289 [customEquipActivation replaceObjectAtIndex:function withObject:custEquip];
290 [custEquip release];
291 [self checkCustomEquipButtons:hwDict ignore:function];
292 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
293 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
294 }
295 else
296 {
297 [stickHandler setFunction:function withDict:hwDict];
298 [self checkCustomEquipButtons:hwDict ignore:-1];
299 [stickHandler saveStickSettings];
300 }
301
302 // Update the GUI (this will refresh the function list).
303 unsigned skip;
304 if (selFunctionIdx < MAX_ROWS_FUNCTIONS - 1)
305 {
306 skip = 0;
307 }
308 else
309 {
310 skip = ((selFunctionIdx - 1) / (MAX_ROWS_FUNCTIONS - 2)) * (MAX_ROWS_FUNCTIONS - 2) + 1;
311 }
312
313 [self setGuiToStickMapperScreen:skip];
314}
#define STICK_ISAXIS
@ AXIS_VIEWX
@ AXIS_THRUST
@ AXIS_VIEWY
void setFunction:withDict:(int function,[withDict] NSDictionary *stickFn)

◆ updateKeyDefinition:index:

- (void) updateKeyDefinition: (NSString *)  keystring
index: (NSUInteger index 
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

678 :(NSString *)keystring index:(NSUInteger)index
679{
680 NSMutableDictionary *key_def = [[NSMutableDictionary alloc] initWithDictionary:(NSDictionary *)[key_list objectAtIndex:index] copyItems:YES];
681 [key_def setObject:keystring forKey:@"key"];
682 // auto=turn on shift if the entered key was shifted
683
684 if (last_shift && [keystring length] == 1 && ![nav_keys containsObject:[selected_entry objectForKey: KEY_KC_DEFINITION]])
685 {
686 [key_def setObject:[NSNumber numberWithBool:YES] forKey:@"shift"];
687 }
688 if (!last_shift && [keystring length] == 1)
689 {
690 [key_def setObject:[NSNumber numberWithBool:NO] forKey:@"shift"];
691 }
692 last_shift = NO;
693 if (index > [key_list count] - 1)
694 {
695 [key_list insertObject:key_def atIndex:index];
696 }
697 else
698 {
699 [key_list replaceObjectAtIndex:index withObject:key_def];
700 }
701 [key_def release];
702 NSArray *new_array = [self processKeyCode:key_list];
703 [key_list release];
704 key_list = [[NSMutableArray alloc] initWithArray:new_array copyItems:YES];
705 [new_array release];
706}

◆ updateMovementFlags

- (void) updateMovementFlags
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

◆ updateShiftKeyDefinition:index:

- (void) updateShiftKeyDefinition: (NSString *)  key
index: (NSUInteger index 
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

710 :(NSString *)key index:(NSUInteger)index
711{
712 NSMutableDictionary *key_def = [[NSMutableDictionary alloc] initWithDictionary:(NSDictionary *)[key_list objectAtIndex:index] copyItems:YES];
713 BOOL current = [[key_def objectForKey:key] boolValue];
714 BOOL keycode_changed = NO;
715 current = !current;
716 [key_def setObject:[NSNumber numberWithBool:current] forKey:key];
717 if ([key isEqualToString:@"shift"])
718 {
719 // force the key into upper or lower case, to limit invalid key combos as much as possible
720 NSString* keycode = [key_def objectForKey:@"key"];
721 NSInteger k_int = (OOKeyCode)[keycode integerValue];
722 if (k_int > 0)
723 {
724 NSString* keystring = [self keyCodeDescription:k_int];
725 NSString* newstring;
726 if ([keystring length] == 1)
727 {
728 // try switching the case. for characters that can't be switched (eg 1,2,3,etc), this should do nothing
729 if (current)
730 {
731 newstring = [keystring uppercaseString];
732 }
733 else
734 {
735 newstring = [keystring lowercaseString];
736 }
737 if (![newstring isEqualToString:keystring])
738 {
739 [key_def setObject:newstring forKey:@"key"];
740 keycode_changed = YES;
741 }
742 }
743 }
744 }
745 if (index > [key_list count] - 1)
746 {
747 [key_list insertObject:key_def atIndex:index];
748 }
749 else
750 {
751 [key_list replaceObjectAtIndex:index withObject:key_def];
752 }
753 [key_def release];
754 if (keycode_changed)
755 {
756 NSArray *new_array = [self processKeyCode:key_list];
757 [key_list release];
758 key_list = [[NSMutableArray alloc] initWithArray:new_array copyItems:YES];
759 [new_array release];
760 }
761}

◆ updateSystemMemory

- (void) updateSystemMemory

Definition at line 13727 of file PlayerEntity.m.

5169{
5170 OOSystemID sys = [self currentSystemID];
5171 if (sys < 0)
5172 {
5173 return;
5174 }
5175 NSUInteger memory = 4;
5176 if (ship_kills >= 6400)
5177 {
5178 memory = 32;
5179 }
5180 else if (ship_kills >= 256)
5181 {
5182 memory = 16;
5183 }
5184 else if (ship_kills >= 64)
5185 {
5186 memory = 8;
5187 }
5188 if ([roleSystemList count] >= memory)
5189 {
5190 [roleSystemList removeObjectAtIndex:0];
5191 }
5192 [roleSystemList addObject:[NSNumber numberWithInt:sys]];
5193}

◆ updateTargeting

- (void) updateTargeting
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

4149{
4151
4152 // check for lost ident target and ensure the ident system is actually scanning
4153 UPDATE_STAGE(@"checking ident target");
4154 if (ident_engaged && [self primaryTarget] != nil)
4155 {
4156 if (![self isValidTarget:[self primaryTarget]])
4157 {
4158 if (!suppressTargetLost)
4159 {
4160 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4161 [self playTargetLost];
4162 [self noteLostTarget];
4163 }
4164 else
4165 {
4167 }
4168
4170 }
4171 }
4172
4173 // check each unlaunched missile's target still exists and is in-range
4174 UPDATE_STAGE(@"checking missile targets");
4176 {
4177 unsigned i;
4178 for (i = 0; i < max_missiles; i++)
4179 {
4180 if ([missile_entity[i] primaryTarget] != nil &&
4182 {
4183 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4184 [self playTargetLost];
4185 [missile_entity[i] removeTarget:nil];
4186 if (i == activeMissile)
4187 {
4188 [self noteLostTarget];
4191 }
4192 } else if (i == activeMissile && [missile_entity[i] primaryTarget] == nil) {
4194 }
4195 }
4196 }
4197
4198 // if we don't have a primary target, and we're scanning, then check for a new
4199 // target to lock on to
4200 UPDATE_STAGE(@"looking for new target");
4201 if ([self primaryTarget] == nil &&
4204 {
4205 Entity *target = [UNIVERSE firstEntityTargetedByPlayer];
4206 if ([self isValidTarget:target])
4207 {
4208 [self addTarget:target];
4209 }
4210 }
4211
4212 // If our primary target is a wormhole, check to see if we have additional
4213 // information
4214 UPDATE_STAGE(@"checking for additional wormhole information");
4215 if ([[self primaryTarget] isWormhole])
4216 {
4217 WormholeEntity *wh = [self primaryTarget];
4218 switch ([wh scanInfo])
4219 {
4220 case WH_SCANINFO_NONE:
4221 OOLog(kOOLogInconsistentState, @"%@", @"Internal Error - WH_SCANINFO_NONE reached in [PlayerEntity updateTargeting:]");
4222 [self dumpState];
4223 [wh dumpState];
4224 // Workaround a reported hit of the assert here. We really
4225 // should work out how/why this could happen though and fix
4226 // the underlying cause.
4227 // - MKW 2011.03.11
4228 //assert([wh scanInfo] != WH_SCANINFO_NONE);
4229 [wh setScannedAt:[self clockTimeAdjusted]];
4230 break;
4232 if ([self clockTimeAdjusted] > [wh scanTime] + 2)
4233 {
4234 [wh setScanInfo:WH_SCANINFO_COLLAPSE_TIME];
4235 //[UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-collapse-time-computed"),
4236 // [UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
4237 }
4238 break;
4240 if([self clockTimeAdjusted] > [wh scanTime] + 4)
4241 {
4242 [wh setScanInfo:WH_SCANINFO_ARRIVAL_TIME];
4243 [UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-arrival-time-computed-@"),
4244 ClockToString([wh estimatedArrivalTime], NO)] forCount:5.0];
4245 }
4246 break;
4248 if ([self clockTimeAdjusted] > [wh scanTime] + 7)
4249 {
4250 [wh setScanInfo:WH_SCANINFO_DESTINATION];
4251 [UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-destination-computed-@"),
4252 [UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
4253 }
4254 break;
4256 if ([self clockTimeAdjusted] > [wh scanTime] + 10)
4257 {
4258 [wh setScanInfo:WH_SCANINFO_SHIP];
4259 // TODO: Extract last ship from wormhole and display its name
4260 }
4261 break;
4262 case WH_SCANINFO_SHIP:
4263 break;
4264 }
4265 }
4266
4268}
@ WH_SCANINFO_NONE
@ WH_SCANINFO_SCANNED
@ WH_SCANINFO_SHIP
@ WH_SCANINFO_ARRIVAL_TIME
@ WH_SCANINFO_DESTINATION
@ WH_SCANINFO_COLLAPSE_TIME
void dumpState()
Definition Entity.m:997
double clockTimeAdjusted()
double estimatedArrivalTime()
void setScannedAt:(double time)
void setScanInfo:(WORMHOLE_SCANINFO scanInfo)

◆ updateTrumbles:

- (void) updateTrumbles: (OOTimeDelta delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

3601 :(OOTimeDelta)delta_t
3602{
3603 OOTrumble **trumbles = [self trumbleArray];
3604 NSUInteger i;
3605
3606 for (i = [self trumbleCount] ; i > 0; i--)
3607 {
3608 OOTrumble* trum = trumbles[i - 1];
3609 [trum updateTrumble:delta_t];
3610 }
3611}
void updateTrumble:(double delta_t)
Definition OOTrumble.m:494

◆ updateWormholes

- (void) updateWormholes
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9242 of file PlayerEntity.m.

13234{
13236
13237 if ([scannedWormholes count] == 0)
13238 return;
13239
13240 double now = [self clockTimeAdjusted];
13241
13242 NSMutableArray * savedWormholes = [[NSMutableArray alloc] initWithCapacity:[scannedWormholes count]];
13244
13245 foreach (wh, scannedWormholes)
13246 {
13247 // TODO: Start drawing wormhole exit a few seconds before the first
13248 // ship is disgorged.
13249 if ([wh arrivalTime] > now)
13250 {
13251 [savedWormholes addObject:wh];
13252 }
13253 else if (NSEqualPoints(galaxy_coordinates, [wh destinationCoordinates]))
13254 {
13255 [wh disgorgeShips];
13256 if ([[wh shipsInTransit] count] > 0)
13257 {
13258 [savedWormholes addObject:wh];
13259 }
13260 }
13261 // Else wormhole has expired in another system, let it expire
13262 }
13263
13264 [scannedWormholes release];
13266}

◆ useSpecialCargo:

- (void) useSpecialCargo: (NSString *)  descriptionString

Provided by category PlayerEntity(Scripting).

Definition at line 954 of file PlayerEntityLegacyScriptEngine.m.

1434 :(NSString *)descriptionString
1435{
1436 if (scriptTarget != self) return;
1437
1438 [self removeAllCargo:YES];
1439 OOLog(kOOLogNoteUseSpecialCargo, @"Going to useSpecialCargo:'%@'", descriptionString);
1440 specialCargo = [OOExpand(descriptionString) retain];
1441}
static NSString *const kOOLogNoteUseSpecialCargo

Referenced by PlayerShipUseSpecialCargo().

+ Here is the caller graph for this function:

◆ validateAllKeys

- (NSArray *) validateAllKeys
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1372{
1373 NSMutableArray *failed = [[NSMutableArray alloc] init];
1374 NSString *validate = nil;
1375 NSUInteger i;
1376
1377 for (i = 0; i < [keyFunctions count]; i++)
1378 {
1379 NSDictionary *entry = [keyFunctions objectAtIndex:i];
1380 validate = [self validateKey:[entry objectForKey:KEY_KC_DEFINITION] checkKeys:(NSArray *)[keyconfig2_settings objectForKey:[entry objectForKey:KEY_KC_DEFINITION]]];
1381 if (validate)
1382 {
1383 [failed addObject:validate];
1384 }
1385 }
1386 return [failed copy];
1387}

◆ validateCompassTarget

- (void) validateCompassTarget

Definition at line 13727 of file PlayerEntity.m.

5216{
5217 OOSunEntity *the_sun = [UNIVERSE sun];
5218 OOPlanetEntity *the_planet = [UNIVERSE planet];
5219 StationEntity *the_station = [UNIVERSE station];
5220 Entity *the_target = [self primaryTarget];
5221 Entity <OOBeaconEntity> *beacon = [self nextBeacon];
5222 if ([self isInSpace] && the_sun && the_planet // be in a system
5223 && ![the_sun goneNova]) // and the system has not been novabombed
5224 {
5226 OOAegisStatus aegis = [self checkForAegis];
5227
5228 switch ([self compassMode])
5229 {
5231 break;
5232
5233 case COMPASS_MODE_BASIC:
5235 {
5237 }
5238 else
5239 {
5241 }
5242 break;
5243
5246 break;
5247
5250 break;
5251
5252 case COMPASS_MODE_SUN:
5254 break;
5255
5258 break;
5259
5262 break;
5263 }
5264
5266 {
5267 [self setCompassMode:COMPASS_MODE_PLANET];
5269 }
5270
5271 if (EXPECT_NOT(new_target != [self compassTarget]))
5272 {
5273 [self setCompassTarget:new_target];
5274 [self doScriptEvent:OOJSID("compassTargetChanged") withArguments:[NSArray arrayWithObjects:new_target, OOStringFromCompassMode([self compassMode]), nil]];
5275 }
5276 }
5277}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ validateCustomEquipActivationArray

- (void) validateCustomEquipActivationArray

Definition at line 9242 of file PlayerEntity.m.

11633{
11634 int i;
11635 bool update = NO;
11637 if ([customEquipActivation count] == 0) return;
11638 for (i = [customEquipActivation count] - 1; i >= 0; i--) {
11639 equipmentKey = [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY];
11641 if (!eq) {
11642 [customEquipActivation removeObjectAtIndex:i];
11643 [customActivatePressed removeObjectAtIndex:i];
11644 [customModePressed removeObjectAtIndex:i];
11645 update = YES;
11646 }
11647 }
11648 if (update) {
11649 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
11650 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
11651 }
11652}

◆ validatedMarker:

- (NSDictionary *) validatedMarker: (NSDictionary *)  marker

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

322 :(NSDictionary *)marker
323{
324 OOSystemID dest = [marker oo_intForKey:@"system"];
325// FIXME: parameters
326 if (dest < 0 || dest > kOOMaximumSystemID)
327 {
328 return nil;
329 }
330 NSString *group = [marker oo_stringForKey:@"name" defaultValue:MISSION_DEST_LEGACY];
331
332 return [[[NSDictionary dictionaryWithObjectsAndKeys:
333 [NSNumber numberWithInt:dest], @"system",
334 group, @"name",
335 [marker oo_stringForKey:@"markerColor" defaultValue:@"redColor"], @"markerColor",
336 [marker oo_stringForKey:@"markerShape" defaultValue:@"MARKER_X"], @"markerShape",
337 [NSNumber numberWithFloat:[marker oo_floatForKey:@"markerScale" defaultValue:1.0]], @"markerScale",
338 nil] retain] autorelease];
339
340}
@ kOOMaximumSystemID
Definition OOTypes.h:217

◆ validateKey:checkKeys:

- (NSString *) validateKey: (NSString*)  key
checkKeys: (NSArray*)  check_keys 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1391 :(NSString *)key checkKeys:(NSArray *)check_keys
1392{
1393 NSString *result = nil;
1394
1395 // need to group keys into validation groups
1396 NSArray *gui_keys = [NSArray arrayWithObjects:@"key_gui_arrow_left", @"key_gui_arrow_right", @"key_gui_arrow_up", @"key_gui_arrow_down", @"key_gui_page_up",
1397 @"key_gui_page_down", @"key_gui_select", nil];
1398
1399 if ([gui_keys containsObject:key])
1400 {
1401 result = [self searchArrayForMatch:gui_keys key:key checkKeys:check_keys];
1402 if (result) return result;
1403 }
1404
1405 NSArray *debug_keys = [NSArray arrayWithObjects:
1406 @"key_dump_target_state", @"key_dump_entity_list", @"key_debug_full", @"key_debug_collision", @"key_debug_console_connect", @"key_debug_bounding_boxes",
1407 @"key_debug_shaders", @"key_debug_off", nil];
1408
1409 if ([debug_keys containsObject:key])
1410 {
1411 result = [self searchArrayForMatch:debug_keys key:key checkKeys:check_keys];
1412 if (result) return result;
1413 }
1414
1415 NSArray *customview_keys = [NSArray arrayWithObjects:
1416 @"key_custom_view", @"key_custom_view_zoom_out", @"key_custom_view_zoom_in", @"key_custom_view_roll_left", @"key_custom_view_pan_left",
1417 @"key_custom_view_roll_right", @"key_custom_view_pan_right", @"key_custom_view_rotate_up", @"key_custom_view_pan_up", @"key_custom_view_rotate_down",
1418 @"key_custom_view_pan_down", @"key_custom_view_rotate_left", @"key_custom_view_rotate_right", nil];
1419
1420 if ([customview_keys containsObject:key])
1421 {
1422 result = [self searchArrayForMatch:customview_keys key:key checkKeys:check_keys];
1423 if (result) return result;
1424 }
1425
1426 NSMutableArray *inflight_keys = [NSMutableArray arrayWithObjects:
1427 @"key_roll_left", @"key_roll_right", @"key_pitch_forward", @"key_pitch_back", @"key_yaw_left", @"key_yaw_right", @"key_view_forward", @"key_view_aft",
1428 @"key_view_port", @"key_view_starboard", @"key_increase_speed", @"key_decrease_speed", @"key_inject_fuel", @"key_fire_lasers", @"key_weapons_online_toggle",
1429 @"key_launch_missile", @"key_next_missile", @"key_ecm", @"key_prime_next_equipment", @"key_prime_previous_equipment", @"key_activate_equipment",
1430 @"key_mode_equipment", @"key_fastactivate_equipment_a", @"key_fastactivate_equipment_b", @"key_target_incoming_missile", @"key_target_missile",
1431 @"key_untarget_missile", @"key_ident_system", @"key_scanner_zoom", @"key_scanner_unzoom", @"key_launch_escapepod", @"key_galactic_hyperspace",
1432 @"key_hyperspace", @"key_jumpdrive", @"key_dump_cargo", @"key_rotate_cargo", @"key_autopilot", @"key_autodock", @"key_docking_clearance_request",
1433 @"key_snapshot", @"key_cycle_next_mfd", @"key_cycle_previous_mfd", @"key_switch_next_mfd", @"key_switch_previous_mfd",
1434 @"key_next_target", @"key_previous_target", @"key_comms_log", @"key_prev_compass_mode", @"key_next_compass_mode", @"key_custom_view",
1435#if OO_FOV_INFLIGHT_CONTROL_ENABLED
1436 @"key_inc_field_of_view", @"key_dec_field_of_view",
1437#endif
1438 @"key_pausebutton", @"key_dump_target_state", nil];
1439
1440 if ([self entryIsCustomEquip:key]) {
1441 NSUInteger i;
1442 for (i = 0; i < [customEquipActivation count]; i++)
1443 {
1444 [inflight_keys addObject:[NSString stringWithFormat:@"activate_%@", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]]];
1445 [inflight_keys addObject:[NSString stringWithFormat:@"mode_%@", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]]];
1446 }
1447 }
1448
1449 if ([inflight_keys containsObject:key])
1450 {
1451 result = [self searchArrayForMatch:inflight_keys key:key checkKeys:check_keys];
1452 if (result) return result;
1453 }
1454
1455 NSArray *docking_keys = [NSArray arrayWithObjects:
1456 @"key_docking_music", @"key_autopilot", @"key_pausebutton", nil];
1457
1458 if ([docking_keys containsObject:key])
1459 {
1460 result = [self searchArrayForMatch:docking_keys key:key checkKeys:check_keys];
1461 if (result) return result;
1462 }
1463
1464 NSArray *docked_keys = [
1465 [NSArray arrayWithObjects:@"key_launch_ship", @"key_gui_screen_options", @"key_gui_screen_equipship", @"key_gui_screen_interfaces", @"key_gui_screen_status",
1466 @"key_gui_chart_screens", @"key_gui_system_data", @"key_gui_market", nil]
1467 arrayByAddingObjectsFromArray:gui_keys];
1468
1469 if ([docked_keys containsObject:key])
1470 {
1471 result = [self searchArrayForMatch:docked_keys key:key checkKeys:check_keys];
1472 if (result) return result;
1473 }
1474
1475 NSArray *paused_keys = [[
1476 [NSArray arrayWithObjects:@"key_pausebutton", @"key_gui_screen_options", @"key_hud_toggle", @"key_show_fps", @"key_mouse_control_roll",
1477 @"key_mouse_control_yaw", nil]
1478 arrayByAddingObjectsFromArray:debug_keys]
1479 arrayByAddingObjectsFromArray:customview_keys];
1480
1481 if ([paused_keys containsObject:key])
1482 {
1483 result = [self searchArrayForMatch:paused_keys key:key checkKeys:check_keys];
1484 if (result) return result;
1485 }
1486
1487 NSArray *chart_keys = [NSArray arrayWithObjects:
1488 @"key_advanced_nav_array_next", @"key_advanced_nav_array_previous", @"key_map_home", @"key_map_end", @"key_map_info",
1489 @"key_map_zoom_in", @"key_map_zoom_out", @"key_map_next_system", @"key_map_previous_system", @"key_chart_highlight",
1490 @"key_launch_ship", @"key_gui_screen_options", @"key_gui_screen_equipship", @"key_gui_screen_interfaces", @"key_gui_screen_status",
1491 @"key_gui_chart_screens", @"key_gui_system_data", @"key_gui_market", nil];
1492
1493 if ([chart_keys containsObject:key])
1494 {
1495 result = [self searchArrayForMatch:chart_keys key:key checkKeys:check_keys];
1496 if (result) return result;
1497 }
1498
1499 NSArray *sysinfo_keys = [NSArray arrayWithObjects:
1500 @"key_system_home", @"key_system_end", @"key_system_next_system", @"key_system_previous_system",
1501 @"key_launch_ship", @"key_gui_screen_options", @"key_gui_screen_equipship", @"key_gui_screen_interfaces", @"key_gui_screen_status",
1502 @"key_gui_chart_screens", @"key_gui_system_data", @"key_gui_market", nil];
1503
1504 if ([sysinfo_keys containsObject:key])
1505 {
1506 result = [self searchArrayForMatch:sysinfo_keys key:key checkKeys:check_keys];
1507 if (result) return result;
1508 }
1509
1510 NSArray *market_keys = [NSArray arrayWithObjects:
1511 @"key_market_filter_cycle", @"key_market_sorter_cycle", @"key_market_buy_one", @"key_market_sell_one", @"key_market_buy_max",
1512 @"key_market_sell_max", @"key_launch_ship", @"key_gui_screen_options", @"key_gui_screen_equipship", @"key_gui_screen_interfaces", @"key_gui_screen_status",
1513 @"key_gui_chart_screens", @"key_gui_system_data", @"key_gui_market", @"key_gui_arrow_up", @"key_gui_arrow_down", @"key_gui_page_up",
1514 @"key_gui_page_down", @"key_gui_select", nil];
1515
1516 if ([market_keys containsObject:key])
1517 {
1518 result = [self searchArrayForMatch:market_keys key:key checkKeys:check_keys];
1519 if (result) return result;
1520 }
1521
1522 // if we get here, we should be good
1523 return nil;
1524}

◆ validForAddToUniverse

- (BOOL) validForAddToUniverse
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

2503{
2504 return YES;
2505}

◆ viewpointOffset

- (Vector) viewpointOffset

Definition at line 13727 of file PlayerEntity.m.

4371{
4372// if ([UNIVERSE breakPatternHide])
4373// return kZeroVector; // center view for break pattern
4374 // now done by positioning break pattern correctly
4375
4376 switch ([UNIVERSE viewDirection])
4377 {
4378 case VIEW_FORWARD:
4379 return forwardViewOffset;
4380 case VIEW_AFT:
4381 return aftViewOffset;
4382 case VIEW_PORT:
4383 return portViewOffset;
4384 case VIEW_STARBOARD:
4385 return starboardViewOffset;
4386 /* GILES custom viewpoints */
4387 case VIEW_CUSTOM:
4388 return customViewOffset;
4389 /* -- */
4390
4391 default:
4392 break;
4393 }
4394
4395 return kZeroVector;
4396}

◆ viewpointOffsetAft

- (Vector) viewpointOffsetAft

Definition at line 13727 of file PlayerEntity.m.

4400{
4401 return aftViewOffset;
4402}

◆ viewpointOffsetForward

- (Vector) viewpointOffsetForward

Definition at line 13727 of file PlayerEntity.m.

4405{
4406 return forwardViewOffset;
4407}

◆ viewpointOffsetPort

- (Vector) viewpointOffsetPort

Definition at line 13727 of file PlayerEntity.m.

4410{
4411 return portViewOffset;
4412}

◆ viewpointOffsetStarboard

- (Vector) viewpointOffsetStarboard

Definition at line 13727 of file PlayerEntity.m.

4415{
4416 return starboardViewOffset;
4417}

◆ viewpointPosition

- (HPVector) viewpointPosition

Definition at line 13727 of file PlayerEntity.m.

4423{
4425 if (showDemoShips)
4426 {
4428 }
4429 Vector offset = [self viewpointOffset];
4430
4431 // FIXME: this ought to be done with matrix or quaternion functions.
4432 OOMatrix r = rotMatrix;
4433
4434 viewpoint.x += offset.x * r.m[0][0]; viewpoint.y += offset.x * r.m[1][0]; viewpoint.z += offset.x * r.m[2][0];
4435 viewpoint.x += offset.y * r.m[0][1]; viewpoint.y += offset.y * r.m[1][1]; viewpoint.z += offset.y * r.m[2][1];
4436 viewpoint.x += offset.z * r.m[0][2]; viewpoint.y += offset.z * r.m[1][2]; viewpoint.z += offset.z * r.m[2][2];
4437
4438 return viewpoint;
4439}

◆ warnAboutHostiles

- (void) warnAboutHostiles

Reimplemented from Entity.

Definition at line 13727 of file PlayerEntity.m.

2474{
2475 [self playHostileWarning];
2476}

◆ weaponForFacing:

- (OOWeaponType) weaponForFacing: (OOWeaponFacing facing

Definition at line 13727 of file PlayerEntity.m.

6280{
6281 switch (facing)
6282 {
6284 return forward_weapon_type;
6285
6286 case WEAPON_FACING_AFT:
6287 return aft_weapon_type;
6288
6289 case WEAPON_FACING_PORT:
6290 return port_weapon_type;
6291
6293 return starboard_weapon_type;
6294
6295 case WEAPON_FACING_NONE:
6296 break;
6297 }
6298 return nil;
6299}

◆ weaponsOnline

- (BOOL) weaponsOnline

Definition at line 13727 of file PlayerEntity.m.

6172{
6173 return weapons_online;
6174}

◆ weaponTypeForFacing:strict:

- (OOEquipmentType *) weaponTypeForFacing: (OOWeaponFacing facing
strict: (BOOL strict 
implementation

Reimplemented from ShipEntity.

Definition at line 13727 of file PlayerEntity.m.

8315{
8317
8318 switch (facing)
8319 {
8322 break;
8323
8324 case WEAPON_FACING_AFT:
8326 break;
8327
8328 case WEAPON_FACING_PORT:
8330 break;
8331
8334 break;
8335
8336 case WEAPON_FACING_NONE:
8337 break;
8338 }
8339
8340 return weaponType;
8341}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ weaponViewOffset

- (Vector) weaponViewOffset

Definition at line 9242 of file PlayerEntity.m.

11968{
11969 switch (currentWeaponFacing)
11970 {
11972 return forwardViewOffset;
11973 case WEAPON_FACING_AFT:
11974 return aftViewOffset;
11975 case WEAPON_FACING_PORT:
11976 return portViewOffset;
11978 return starboardViewOffset;
11979
11980 case WEAPON_FACING_NONE:
11981 // N.b.: this case should never happen.
11982 return customViewOffset;
11983 }
11984 return kZeroVector;
11985}

◆ witchEnd

- (void) witchEnd
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

7396{
7397 [UNIVERSE setSystemTo:system_id];
7398 galaxy_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:system_id inGalaxy:galaxy_number];
7399
7400 [UNIVERSE setUpUniverseFromWitchspace];
7401 [[UNIVERSE planet] update: 2.34375 * market_rnd]; // from 0..10 minutes
7402 [[UNIVERSE station] update: 2.34375 * market_rnd]; // from 0..10 minutes
7403
7406}

◆ witchJumpChecklist:

- (BOOL) witchJumpChecklist: (BOOL isGalacticJump

Definition at line 13727 of file PlayerEntity.m.

7410{
7411 // Perform this check only when doing the actual jump
7412 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7413 {
7414 // check nearby masses
7415 //UPDATE_STAGE(@"checking for mass blockage");
7416 ShipEntity* blocker = [UNIVERSE entityForUniversalID:[self checkShipsInVicinityForWitchJumpExit]];
7417 if (blocker)
7418 {
7419 [UNIVERSE clearPreviousMessage];
7420 NSString *blockerName = [blocker name];
7421 [UNIVERSE addMessage:OOExpandKey(@"witch-blocked", blockerName) forCount:4.5];
7422 [self playWitchjumpBlocked];
7423 [self setStatus:STATUS_IN_FLIGHT];
7424 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("blocked"));
7425 return NO;
7426 }
7427 }
7428
7429 // For galactic hyperspace jumps we skip the remaining checks
7430 if (isGalacticJump)
7431 {
7432 return YES;
7433 }
7434
7435 // Check we're not jumping into the current system
7436 if (![UNIVERSE inInterstellarSpace] && system_id == target_system_id)
7437 {
7438 //dont allow player to hyperspace to current location.
7439 //Note interstellar space will have a system_seed place we came from
7440 [UNIVERSE clearPreviousMessage];
7441 [UNIVERSE addMessage:OOExpandKey(@"witch-no-target") forCount: 4.5];
7442 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7443 {
7444 [self playWitchjumpInsufficientFuel];
7445 [self setStatus:STATUS_IN_FLIGHT];
7446 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("no target"));
7447 }
7448 else [self playHyperspaceNoTarget];
7449
7450 return NO;
7451 }
7452
7453 // check max distance permitted
7455 {
7456 [UNIVERSE clearPreviousMessage];
7457 [UNIVERSE addMessage:DESC(@"witch-too-far") forCount: 4.5];
7458 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7459 {
7460 [self playWitchjumpDistanceTooGreat];
7461 [self setStatus:STATUS_IN_FLIGHT];
7462 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("too far"));
7463 }
7464 else [self playHyperspaceDistanceTooGreat];
7465
7466 return NO;
7467 }
7468
7469 // check fuel level
7470 if (![self hasSufficientFuelForJump])
7471 {
7472 [UNIVERSE clearPreviousMessage];
7473 [UNIVERSE addMessage:DESC(@"witch-no-fuel") forCount: 4.5];
7474 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7475 {
7476 [self playWitchjumpInsufficientFuel];
7477 [self setStatus:STATUS_IN_FLIGHT];
7478 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("insufficient fuel"));
7479 }
7480 else [self playHyperspaceNoFuel];
7481
7482 return NO;
7483 }
7484
7485 // All checks passed
7486 return YES;
7487}
BOOL hasSufficientFuelForJump()
double maxHyperspaceDistance()

Referenced by PlayerShipBeginGalacticHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ witchJumpTo:misjump:

- (void) witchJumpTo: (OOSystemID sTo
misjump: (BOOL misjump 
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

7778{
7779 [self witchStart];
7781 {
7782 [self setInfoSystemID: sTo moveChart: YES];
7783 }
7784 //wear and tear on all jumps (inc misjumps, failures, and wormholes)
7786 {
7787 // every eight jumps or so drop the price down towards 75%
7788 [self adjustTradeInFactorBy:-(1 + (market_rnd & 3))];
7789 }
7790
7791 // set clock after "playerWillEnterWitchspace" and before removeAllEntitiesExceptPlayer, to allow escorts time to follow their mother.
7794
7795 // if we just escaped a system gone nova, make sure all nova parameters are reset
7796 OOSunEntity *theSun = [UNIVERSE sun];
7797 if (theSun && [theSun goneNova])
7798 {
7799 [theSun resetNova];
7800 }
7801
7802 [UNIVERSE removeAllEntitiesExceptPlayer];
7803 if (!misjump)
7804 {
7805 ship_clock_adjust += distance * distance * 3600.0;
7806 [self setSystemID:sTo];
7807 [self setBounty:(legalStatus/2) withReason:kOOLegalStatusReasonNewSystem]; // 'another day, another system'
7808 [self witchEnd];
7809 if (market_rnd < 8) [self erodeReputation]; // every 32 systems or so, drop back towards 'unknown'
7810 }
7811 else
7812 {
7813 // Misjump: move halfway there!
7814 // misjumps do not change legal status.
7815 if (randf() < 0.1) [self erodeReputation]; // once every 10 misjumps - should be much rarer than successful jumps!
7816
7817 [wormhole setMisjump];
7818 // just in case, but this has usually been set already
7819
7820 // and now the wormhole has travel time and coordinates calculated
7821 // so rather than duplicate the calculation we'll just ask it...
7822 NSPoint dest = [wormhole destinationCoordinates];
7825
7826 ship_clock_adjust += [wormhole travelTime];
7827
7828 [self playWitchjumpMisjump];
7829 [UNIVERSE setUpUniverseFromMisjump];
7830 }
7831}

◆ witchStart

- (void) witchStart
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13727 of file PlayerEntity.m.

7351{
7352 // chances of entering witchspace with autopilot on are very low, but as Berlios bug #18307 has shown us, entirely possible
7353 // so in such cases we need to ensure that at least the docking music stops playing
7354 if (autopilot_engaged) [self disengageAutopilot];
7355
7356 if (![hud nonlinearScanner])
7357 {
7358 [hud setScannerZoom: 1.0];
7359 }
7360 [self safeAllMissiles];
7361
7362 OOViewID previousViewDirection = [UNIVERSE viewDirection];
7363 [UNIVERSE setViewDirection:VIEW_FORWARD];
7364 [self noteSwitchToView:VIEW_FORWARD fromView:previousViewDirection]; // notifies scripts of the switch
7365
7367 [self currentWeaponStats];
7368
7369 [self transitionToAegisNone];
7372
7373 if ([self primaryTarget] != nil)
7374 {
7375 [self noteLostTarget]; // losing target? Fire lost target event!
7377 }
7378
7379 scanner_zoom_rate = 0.0f;
7380 [UNIVERSE setDisplayText:NO];
7381
7382 if ( ![self wormhole] && !galactic_witchjump) // galactic hyperspace does not generate a wormhole
7383 {
7384 OOLog(kOOLogInconsistentState, @"%@", @"Internal Error : Player entering witchspace with no wormhole.");
7385 }
7386 [UNIVERSE allShipsDoScriptEvent:OOJSID("playerWillEnterWitchspace") andReactToAIMessage:@"PLAYER WITCHSPACE"];
7387
7388 // set the new market seed now!
7389 // reseeding the RNG should be completely unnecessary here
7390// ranrot_srand((uint32_t)[[NSDate date] timeIntervalSince1970]); // seed randomiser by time
7391 market_rnd = ranrot_rand() & 255; // random factor for market values is reset
7392}

◆ worldScriptNames

- (NSArray *) worldScriptNames

Definition at line 9242 of file PlayerEntity.m.

12880{
12881 return [worldScripts allKeys];
12882}

◆ worldScriptsByName

- (NSDictionary *) worldScriptsByName

Definition at line 9242 of file PlayerEntity.m.

12886{
12887 return [[worldScripts copy] autorelease];
12888}

Referenced by WorldScriptsGetProperty().

+ Here is the caller graph for this function:

◆ wormhole

- (WormholeEntity *) wormhole

◆ writePlayerToPath:

- (void) writePlayerToPath: (NSString *)  path
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1420 of file PlayerEntityLoadSave.m.

869 :(NSString *)path
870{
871 NSString *errDesc = nil;
872 NSDictionary *dict = nil;
873 BOOL didSave = NO;
874 [[UNIVERSE gameView] resetTypedString];
875
876 if (!path)
877 {
878 OOLog(@"save.failed", @"***** SAVE ERROR: %s called with nil path.", __PRETTY_FUNCTION__);
879 return;
880 }
881
882 dict = [self commanderDataDictionary];
883 if (dict == nil) errDesc = @"could not construct commander data dictionary.";
884 else didSave = [dict writeOOXMLToFile:path atomically:YES errorDescription:&errDesc];
885 if (didSave)
886 {
887 [UNIVERSE clearPreviousMessage]; // allow this to be given time and again
888 [UNIVERSE addMessage:DESC(@"game-saved") forCount:2];
889 [save_path autorelease];
890 save_path = [path copy];
891 [[UNIVERSE gameController] setPlayerFileToLoad:save_path];
892 [[UNIVERSE gameController] setPlayerFileDirectory:save_path];
893 // no duplicated autosave immediately after a save.
894 [UNIVERSE setAutoSaveNow:NO];
895 }
896 else
897 {
898 OOLog(@"save.failed", @"***** SAVE ERROR: %@", errDesc);
899 [NSException raise:@"OoliteException"
900 format:@"Attempt to save game to file '%@' failed: %@", path, errDesc];
901 }
902 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
903 [self setGuiToStatusScreen];
904}

Member Data Documentation

◆ _commanderName

- (NSString*) _commanderName
private

Definition at line 514 of file PlayerEntity.h.

◆ _customViewIndex

- (NSUInteger) _customViewIndex
private

Definition at line 798 of file PlayerEntity.h.

◆ _customViews

- (NSArray*) _customViews
private

Definition at line 797 of file PlayerEntity.h.

◆ _dockedStation

- (OOWeakReference*) _dockedStation
private

Definition at line 457 of file PlayerEntity.h.

◆ _dockTarget

- (OOUniversalID) _dockTarget
private

Definition at line 524 of file PlayerEntity.h.

◆ _equipScreenBackgroundDescriptor

- (NSDictionary*) _equipScreenBackgroundDescriptor
private

Definition at line 400 of file PlayerEntity.h.

◆ _fastEquipmentA

- (NSString*) _fastEquipmentA
private

Definition at line 490 of file PlayerEntity.h.

◆ _fastEquipmentB

- (NSString*) _fastEquipmentB
private

Definition at line 491 of file PlayerEntity.h.

◆ _jumpCause

- (NSString*) _jumpCause
private

Definition at line 511 of file PlayerEntity.h.

◆ _lastsaveName

- (NSString*) _lastsaveName
private

Definition at line 515 of file PlayerEntity.h.

◆ _missionAllowInterrupt

- (BOOL) _missionAllowInterrupt
private

Definition at line 387 of file PlayerEntity.h.

◆ _missionBackgroundDescriptor

- (NSDictionary*) _missionBackgroundDescriptor
private

Definition at line 398 of file PlayerEntity.h.

◆ _missionBackgroundSpecial

- (OOGUIBackgroundSpecial) _missionBackgroundSpecial
private

Definition at line 399 of file PlayerEntity.h.

◆ _missionExitScreen

- (OOGUIScreenID) _missionExitScreen
private

Definition at line 389 of file PlayerEntity.h.

◆ _missionOverlayDescriptor

- (NSDictionary*) _missionOverlayDescriptor
private

Definition at line 397 of file PlayerEntity.h.

◆ _missionScreenID

- (NSString*) _missionScreenID
private

Definition at line 401 of file PlayerEntity.h.

◆ _missionTextEntry

- (BOOL) _missionTextEntry
private

Definition at line 388 of file PlayerEntity.h.

◆ _missionTitle

- (NSString*) _missionTitle
private

Definition at line 382 of file PlayerEntity.h.

◆ _missionWithCallback

- (BOOL) _missionWithCallback
private

Definition at line 386 of file PlayerEntity.h.

◆ _sysInfoLight

- (Vector) _sysInfoLight
private

Definition at line 708 of file PlayerEntity.h.

◆ _trumbleAppetiteAccumulator

- (float) _trumbleAppetiteAccumulator
private

Definition at line 713 of file PlayerEntity.h.

◆ activeMFD

- (NSUInteger) activeMFD
private

Definition at line 467 of file PlayerEntity.h.

◆ activeMissile

- (NSUInteger) activeMissile
private

Definition at line 488 of file PlayerEntity.h.

◆ aft_shield

- (GLfloat) aft_shield
private

Definition at line 473 of file PlayerEntity.h.

◆ aft_shield_recharge_rate

- (GLfloat) aft_shield_recharge_rate
private

Definition at line 474 of file PlayerEntity.h.

◆ aft_shot_time

- (OOTimeDelta) aft_shot_time
private

Definition at line 475 of file PlayerEntity.h.

◆ afterburner_engaged

- (unsigned) afterburner_engaged
private

Definition at line 743 of file PlayerEntity.h.

◆ afterburnerSoundLooping

- (unsigned) afterburnerSoundLooping
private

Definition at line 744 of file PlayerEntity.h.

◆ aftViewOffset

- (Vector) aftViewOffset
private

Definition at line 707 of file PlayerEntity.h.

◆ alertCondition

- (OOAlertCondition) alertCondition
private

Definition at line 484 of file PlayerEntity.h.

◆ alertFlags

- (int) alertFlags
private

Definition at line 483 of file PlayerEntity.h.

◆ ANA_mode

- (OORouteType) ANA_mode
private

Definition at line 508 of file PlayerEntity.h.

◆ autopilot_engaged

- (unsigned) autopilot_engaged
private

Definition at line 741 of file PlayerEntity.h.

◆ bomb_detonated

- (unsigned) bomb_detonated
private

Definition at line 740 of file PlayerEntity.h.

◆ cdrDetailArray

- (NSMutableArray*) cdrDetailArray
private

Definition at line 447 of file PlayerEntity.h.

◆ chart_centre_coordinates

- (NSPoint) chart_centre_coordinates
private

Definition at line 497 of file PlayerEntity.h.

◆ chart_focus_coordinates

- (NSPoint) chart_focus_coordinates
private

Definition at line 496 of file PlayerEntity.h.

◆ chart_zoom

- (OOScalar) chart_zoom
private

Definition at line 504 of file PlayerEntity.h.

◆ chosen_weapon_facing

- (OOWeaponFacing) chosen_weapon_facing
private

Definition at line 477 of file PlayerEntity.h.

◆ commanderNameString

- (NSString*) commanderNameString
private

Definition at line 446 of file PlayerEntity.h.

◆ commLog

- (NSMutableArray *) commLog
private

Definition at line 393 of file PlayerEntity.h.

◆ commodityScripts

- (NSMutableDictionary*) commodityScripts
private

Definition at line 379 of file PlayerEntity.h.

◆ compassMode

- (OOCompassMode) compassMode
private

Definition at line 530 of file PlayerEntity.h.

Referenced by PlayerShipGetProperty().

◆ compassTarget

- (Entity *) compassTarget
private

Definition at line 531 of file PlayerEntity.h.

Referenced by PlayerShipGetProperty(), and PlayerShipSetProperty().

◆ contract_record

- (NSMutableDictionary*) contract_record
private

Definition at line 415 of file PlayerEntity.h.

◆ contracts

- (NSMutableArray*) contracts
private

Definition at line 414 of file PlayerEntity.h.

◆ credits

- (OOCreditsQuantity) credits
private

Definition at line 518 of file PlayerEntity.h.

◆ current_cargo

- (OOCargoQuantity) current_cargo
private

Definition at line 493 of file PlayerEntity.h.

◆ currentPage

- (int) currentPage
private

Definition at line 448 of file PlayerEntity.h.

◆ cursor_coordinates

- (NSPoint) cursor_coordinates
private

Definition at line 495 of file PlayerEntity.h.

◆ custom_chart_centre_coordinates

- (NSPoint) custom_chart_centre_coordinates
private

Definition at line 498 of file PlayerEntity.h.

◆ custom_chart_zoom

- (OOScalar) custom_chart_zoom
private

Definition at line 505 of file PlayerEntity.h.

◆ customActivatePressed

- (NSMutableArray*) customActivatePressed
private

Definition at line 694 of file PlayerEntity.h.

◆ customDialSettings

- (NSMutableDictionary*) customDialSettings
private

Definition at line 468 of file PlayerEntity.h.

◆ customEquipActivation

- (NSMutableArray*) customEquipActivation
private

Definition at line 693 of file PlayerEntity.h.

◆ customModePressed

- (NSMutableArray*) customModePressed
private

Definition at line 695 of file PlayerEntity.h.

◆ customViewDescription

- (NSString *) customViewDescription
private

Definition at line 727 of file PlayerEntity.h.

◆ customViewForwardVector

- (Vector) customViewForwardVector
private

Definition at line 726 of file PlayerEntity.h.

Referenced by HeadUpDisplay::hudRotateViewpointForVirtualDepth.

◆ customViewMatrix

- (OOMatrix) customViewMatrix
private

Definition at line 725 of file PlayerEntity.h.

◆ customViewOffset

- (Vector) customViewOffset
private

Definition at line 726 of file PlayerEntity.h.

◆ customViewQuaternion

- (Quaternion) customViewQuaternion
private

Definition at line 724 of file PlayerEntity.h.

◆ customViewRightVector

- (Vector) customViewRightVector
private

Definition at line 726 of file PlayerEntity.h.

◆ customViewRotationCenter

- (Vector) customViewRotationCenter
private

Definition at line 726 of file PlayerEntity.h.

◆ customViewUpVector

- (Vector) customViewUpVector
private

Definition at line 726 of file PlayerEntity.h.

Referenced by HeadUpDisplay::hudRotateViewpointForVirtualDepth.

◆ demoShip

- (ShipEntity*) demoShip
private

Definition at line 805 of file PlayerEntity.h.

◆ dockingClearanceStatus

- (OODockingClearanceStatus) dockingClearanceStatus
private

Definition at line 800 of file PlayerEntity.h.

◆ dockingReport

- (NSMutableString*) dockingReport
private

Definition at line 731 of file PlayerEntity.h.

◆ ecm_in_operation

- (unsigned) ecm_in_operation
private

Definition at line 754 of file PlayerEntity.h.

◆ ecm_start_time

- (double) ecm_start_time
private

Definition at line 479 of file PlayerEntity.h.

◆ eqScripts

- (NSMutableArray*) eqScripts
private

Definition at line 395 of file PlayerEntity.h.

◆ escape_pod_rescue_time

- (double) escape_pod_rescue_time
private

Definition at line 433 of file PlayerEntity.h.

◆ extraGuiScreenKeys

- (NSMutableDictionary*) extraGuiScreenKeys
private

Definition at line 700 of file PlayerEntity.h.

◆ extraMissionKeys

- (NSDictionary*) extraMissionKeys
private

Definition at line 698 of file PlayerEntity.h.

◆ fieldOfView

- (double) fieldOfView
private

Definition at line 811 of file PlayerEntity.h.

◆ finished

- (unsigned) finished
private

Definition at line 739 of file PlayerEntity.h.

◆ fleeing_status

- (OOPlayerFleeingStatus) fleeing_status
private

Definition at line 486 of file PlayerEntity.h.

◆ forward_shield

- (GLfloat) forward_shield
private

Definition at line 473 of file PlayerEntity.h.

◆ forward_shield_recharge_rate

- (GLfloat) forward_shield_recharge_rate
private

Definition at line 474 of file PlayerEntity.h.

◆ forward_shot_time

- (OOTimeDelta) forward_shot_time
private

Definition at line 475 of file PlayerEntity.h.

◆ forwardViewOffset

- (Vector) forwardViewOffset
private

Definition at line 707 of file PlayerEntity.h.

◆ found_equipment

- (BOOL) found_equipment
private

Definition at line 403 of file PlayerEntity.h.

◆ found_system_id

- (OOSystemID) found_system_id
private

Definition at line 374 of file PlayerEntity.h.

◆ fps_check_time

- (double) fps_check_time
private

Definition at line 435 of file PlayerEntity.h.

◆ fps_counter

- (int) fps_counter
private

Definition at line 436 of file PlayerEntity.h.

◆ fuel_leak_rate

- (GLfloat) fuel_leak_rate
private

Definition at line 533 of file PlayerEntity.h.

◆ galactic_witchjump

- (unsigned) galactic_witchjump
private

Definition at line 752 of file PlayerEntity.h.

◆ galacticHyperspaceBehaviour

- (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour
private

Definition at line 792 of file PlayerEntity.h.

◆ galacticHyperspaceFixedCoords

- (NSPoint) galacticHyperspaceFixedCoords
private

Definition at line 793 of file PlayerEntity.h.

◆ galaxy_coordinates

- (NSPoint) galaxy_coordinates
private

Definition at line 516 of file PlayerEntity.h.

Referenced by MissionRunScreen().

◆ galaxy_number

- (OOGalaxyID) galaxy_number
private

Provided by category PlayerEntity(Scripting).

Definition at line 519 of file PlayerEntity.h.

◆ game_over

- (unsigned) game_over
private

Definition at line 738 of file PlayerEntity.h.

◆ gui_screen

- (OOGUIScreenID) gui_screen
private

Definition at line 482 of file PlayerEntity.h.

◆ hud

◆ hyperspeed_engaged

- (unsigned) hyperspeed_engaged
private

Definition at line 746 of file PlayerEntity.h.

◆ hyperspeed_locked

- (unsigned) hyperspeed_locked
private

Definition at line 748 of file PlayerEntity.h.

◆ hyperspeedFactor

- (GLfloat) hyperspeedFactor
private

Definition at line 536 of file PlayerEntity.h.

◆ ident_engaged

- (unsigned) ident_engaged
private

Definition at line 750 of file PlayerEntity.h.

◆ info_system_id

- (OOSystemID) info_system_id
private

Definition at line 369 of file PlayerEntity.h.

◆ isSpeechOn

- (OOSpeechSettings) isSpeechOn
private

Definition at line 780 of file PlayerEntity.h.

◆ kbdLayouts

- (NSArray*) kbdLayouts
private

Definition at line 787 of file PlayerEntity.h.

◆ keyboardPitchOverride

- (unsigned) keyboardPitchOverride
private

Definition at line 766 of file PlayerEntity.h.

◆ keyboardRollOverride

- (unsigned) keyboardRollOverride
private

Definition at line 765 of file PlayerEntity.h.

◆ keyboardYawOverride

- (unsigned) keyboardYawOverride
private

Definition at line 767 of file PlayerEntity.h.

◆ keyCodeLookups

- (NSDictionary*) keyCodeLookups
private

Definition at line 541 of file PlayerEntity.h.

◆ keyconfig2_settings

- (NSDictionary*) keyconfig2_settings
private

Definition at line 540 of file PlayerEntity.h.

◆ keyFunctions

- (NSArray*) keyFunctions
private

Definition at line 786 of file PlayerEntity.h.

◆ keyMod1Text

- (NSString*) keyMod1Text
private

Definition at line 789 of file PlayerEntity.h.

◆ keyMod2Text

- (NSString*) keyMod2Text
private

Definition at line 790 of file PlayerEntity.h.

◆ keyShiftText

- (NSString*) keyShiftText
private

Definition at line 788 of file PlayerEntity.h.

◆ last_ecm_time

- (double) last_ecm_time
private

Definition at line 480 of file PlayerEntity.h.

◆ last_fps_check_time

- (double) last_fps_check_time
private

Definition at line 437 of file PlayerEntity.h.

◆ lastScriptAlertCondition

- (OOAlertCondition) lastScriptAlertCondition
private

Definition at line 485 of file PlayerEntity.h.

◆ lastShot

- (NSArray*) lastShot
private

Definition at line 806 of file PlayerEntity.h.

◆ lastTextKey

- (NSString*) lastTextKey
private

Definition at line 428 of file PlayerEntity.h.

◆ launchingMissile

- (unsigned) launchingMissile
private

Definition at line 772 of file PlayerEntity.h.

◆ launchRoll

- (GLfloat) launchRoll
private

Definition at line 471 of file PlayerEntity.h.

◆ legalStatus

- (int) legalStatus
private

Definition at line 526 of file PlayerEntity.h.

◆ localVariables

- (NSMutableDictionary*) localVariables
private

Definition at line 381 of file PlayerEntity.h.

◆ longRangeChartMode

- (OOLongRangeChartMode) longRangeChartMode
private

Definition at line 795 of file PlayerEntity.h.

Referenced by PlayerShipSetProperty().

◆ market_rnd

- (int) market_rnd
private

Definition at line 527 of file PlayerEntity.h.

◆ marketFilterMode

- (OOMarketFilterMode) marketFilterMode
private

Definition at line 454 of file PlayerEntity.h.

◆ marketOffset

- (NSInteger) marketOffset
private

Definition at line 452 of file PlayerEntity.h.

◆ marketSelectedCommodity

- (OOCommodityType) marketSelectedCommodity
private

Definition at line 453 of file PlayerEntity.h.

◆ marketSorterMode

- (OOMarketSorterMode) marketSorterMode
private

Definition at line 455 of file PlayerEntity.h.

◆ massLockable

- (BOOL) massLockable
private

Definition at line 775 of file PlayerEntity.h.

◆ max_aft_shield

- (GLfloat) max_aft_shield
private

Definition at line 474 of file PlayerEntity.h.

◆ max_forward_shield

- (GLfloat) max_forward_shield
private

Definition at line 474 of file PlayerEntity.h.

◆ max_passengers

- (unsigned) max_passengers
private

Definition at line 407 of file PlayerEntity.h.

◆ maxFieldOfView

- (double) maxFieldOfView
private

Definition at line 810 of file PlayerEntity.h.

◆ missile_entity

- (ShipEntity* missile_entity[PLAYER_MAX_MISSILES])
private

Definition at line 523 of file PlayerEntity.h.

◆ missile_status

- (OOMissileStatus) missile_status
private

Definition at line 487 of file PlayerEntity.h.

◆ mission_variables

- (NSMutableDictionary*) mission_variables
private

Definition at line 380 of file PlayerEntity.h.

◆ missionChoice

- (NSString*) missionChoice
private

Definition at line 384 of file PlayerEntity.h.

◆ missionDestinations

- (NSMutableDictionary*) missionDestinations
private

Definition at line 419 of file PlayerEntity.h.

◆ missionKeyPress

- (NSString*) missionKeyPress
private

Definition at line 385 of file PlayerEntity.h.

◆ missionTextRow

- (NSInteger) missionTextRow
private

Definition at line 383 of file PlayerEntity.h.

◆ mouse_control_on

- (unsigned) mouse_control_on
private

Definition at line 763 of file PlayerEntity.h.

◆ multiFunctionDisplaySettings

- (NSMutableArray*) multiFunctionDisplaySettings
private

Definition at line 466 of file PlayerEntity.h.

◆ multiFunctionDisplayText

- (NSMutableDictionary*) multiFunctionDisplayText
private

Definition at line 465 of file PlayerEntity.h.

◆ n_key_activate_equipment

- (NSArray*) n_key_activate_equipment
private

Definition at line 583 of file PlayerEntity.h.

◆ n_key_advanced_nav_array_next

- (NSArray*) n_key_advanced_nav_array_next
private

Definition at line 611 of file PlayerEntity.h.

◆ n_key_advanced_nav_array_previous

- (NSArray*) n_key_advanced_nav_array_previous
private

Definition at line 612 of file PlayerEntity.h.

◆ n_key_autodock

- (NSArray*) n_key_autodock
private

Definition at line 606 of file PlayerEntity.h.

◆ n_key_autopilot

- (NSArray*) n_key_autopilot
private

Definition at line 605 of file PlayerEntity.h.

◆ n_key_bloom_toggle

- (NSArray*) n_key_bloom_toggle
private

Definition at line 630 of file PlayerEntity.h.

◆ n_key_chart_highlight

- (NSArray*) n_key_chart_highlight
private

Definition at line 639 of file PlayerEntity.h.

◆ n_key_comms_log

- (NSArray*) n_key_comms_log
private

Definition at line 635 of file PlayerEntity.h.

◆ n_key_custom_view

- (NSArray*) n_key_custom_view
private

Definition at line 650 of file PlayerEntity.h.

◆ n_key_custom_view_pan_down

- (NSArray*) n_key_custom_view_pan_down
private

Definition at line 660 of file PlayerEntity.h.

◆ n_key_custom_view_pan_left

- (NSArray*) n_key_custom_view_pan_left
private

Definition at line 654 of file PlayerEntity.h.

◆ n_key_custom_view_pan_right

- (NSArray*) n_key_custom_view_pan_right
private

Definition at line 656 of file PlayerEntity.h.

◆ n_key_custom_view_pan_up

- (NSArray*) n_key_custom_view_pan_up
private

Definition at line 658 of file PlayerEntity.h.

◆ n_key_custom_view_roll_left

- (NSArray*) n_key_custom_view_roll_left
private

Definition at line 653 of file PlayerEntity.h.

◆ n_key_custom_view_roll_right

- (NSArray*) n_key_custom_view_roll_right
private

Definition at line 655 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_down

- (NSArray*) n_key_custom_view_rotate_down
private

Definition at line 659 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_left

- (NSArray*) n_key_custom_view_rotate_left
private

Definition at line 661 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_right

- (NSArray*) n_key_custom_view_rotate_right
private

Definition at line 662 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_up

- (NSArray*) n_key_custom_view_rotate_up
private

Definition at line 657 of file PlayerEntity.h.

◆ n_key_custom_view_zoom_in

- (NSArray*) n_key_custom_view_zoom_in
private

Definition at line 652 of file PlayerEntity.h.

◆ n_key_custom_view_zoom_out

- (NSArray*) n_key_custom_view_zoom_out
private

Definition at line 651 of file PlayerEntity.h.

◆ n_key_cycle_next_mfd

- (NSArray*) n_key_cycle_next_mfd
private

Definition at line 667 of file PlayerEntity.h.

◆ n_key_cycle_previous_mfd

- (NSArray*) n_key_cycle_previous_mfd
private

Definition at line 668 of file PlayerEntity.h.

◆ n_key_debug_bounding_boxes

- (NSArray*) n_key_debug_bounding_boxes
private

Definition at line 687 of file PlayerEntity.h.

◆ n_key_debug_collision

- (NSArray*) n_key_debug_collision
private

Definition at line 685 of file PlayerEntity.h.

◆ n_key_debug_console_connect

- (NSArray*) n_key_debug_console_connect
private

Definition at line 686 of file PlayerEntity.h.

◆ n_key_debug_full

- (NSArray*) n_key_debug_full
private

Definition at line 684 of file PlayerEntity.h.

◆ n_key_debug_off

- (NSArray*) n_key_debug_off
private

Definition at line 689 of file PlayerEntity.h.

◆ n_key_debug_shaders

- (NSArray*) n_key_debug_shaders
private

Definition at line 688 of file PlayerEntity.h.

◆ n_key_decrease_speed

- (NSArray*) n_key_decrease_speed
private

Definition at line 573 of file PlayerEntity.h.

◆ n_key_docking_clearance_request

- (NSArray*) n_key_docking_clearance_request
private

Definition at line 664 of file PlayerEntity.h.

◆ n_key_docking_music

- (NSArray*) n_key_docking_music
private

Definition at line 609 of file PlayerEntity.h.

◆ n_key_dump_cargo

- (NSArray*) n_key_dump_cargo
private

Definition at line 602 of file PlayerEntity.h.

◆ n_key_dump_entity_list

- (NSArray*) n_key_dump_entity_list
private

Definition at line 683 of file PlayerEntity.h.

◆ n_key_dump_target_state

- (NSArray*) n_key_dump_target_state
private

Definition at line 682 of file PlayerEntity.h.

◆ n_key_ecm

- (NSArray*) n_key_ecm
private

Definition at line 579 of file PlayerEntity.h.

◆ n_key_fastactivate_equipment_a

- (NSArray*) n_key_fastactivate_equipment_a
private

Definition at line 585 of file PlayerEntity.h.

◆ n_key_fastactivate_equipment_b

- (NSArray*) n_key_fastactivate_equipment_b
private

Definition at line 586 of file PlayerEntity.h.

◆ n_key_fire_lasers

- (NSArray*) n_key_fire_lasers
private

Definition at line 576 of file PlayerEntity.h.

◆ n_key_galactic_hyperspace

- (NSArray*) n_key_galactic_hyperspace
private

Definition at line 598 of file PlayerEntity.h.

◆ n_key_gui_arrow_down

- (NSArray*) n_key_gui_arrow_down
private

Definition at line 567 of file PlayerEntity.h.

◆ n_key_gui_arrow_left

- (NSArray*) n_key_gui_arrow_left
private

Definition at line 564 of file PlayerEntity.h.

◆ n_key_gui_arrow_right

- (NSArray*) n_key_gui_arrow_right
private

Definition at line 565 of file PlayerEntity.h.

◆ n_key_gui_arrow_up

- (NSArray*) n_key_gui_arrow_up
private

Definition at line 566 of file PlayerEntity.h.

◆ n_key_gui_chart_screens

- (NSArray*) n_key_gui_chart_screens
private

Definition at line 560 of file PlayerEntity.h.

◆ n_key_gui_market

- (NSArray*) n_key_gui_market
private

Definition at line 562 of file PlayerEntity.h.

◆ n_key_gui_page_down

- (NSArray*) n_key_gui_page_down
private

Definition at line 569 of file PlayerEntity.h.

◆ n_key_gui_page_up

- (NSArray*) n_key_gui_page_up
private

Definition at line 568 of file PlayerEntity.h.

◆ n_key_gui_screen_equipship

- (NSArray*) n_key_gui_screen_equipship
private

Definition at line 557 of file PlayerEntity.h.

◆ n_key_gui_screen_interfaces

- (NSArray*) n_key_gui_screen_interfaces
private

Definition at line 558 of file PlayerEntity.h.

◆ n_key_gui_screen_options

- (NSArray*) n_key_gui_screen_options
private

Definition at line 556 of file PlayerEntity.h.

◆ n_key_gui_screen_status

- (NSArray*) n_key_gui_screen_status
private

Definition at line 559 of file PlayerEntity.h.

◆ n_key_gui_select

- (NSArray*) n_key_gui_select
private

Definition at line 570 of file PlayerEntity.h.

◆ n_key_gui_system_data

- (NSArray*) n_key_gui_system_data
private

Definition at line 561 of file PlayerEntity.h.

◆ n_key_hud_toggle

- (NSArray*) n_key_hud_toggle
private

Definition at line 633 of file PlayerEntity.h.

◆ n_key_hyperspace

- (NSArray*) n_key_hyperspace
private

Definition at line 599 of file PlayerEntity.h.

◆ n_key_ident_system

- (NSArray*) n_key_ident_system
private

Definition at line 591 of file PlayerEntity.h.

◆ n_key_increase_speed

- (NSArray*) n_key_increase_speed
private

Definition at line 572 of file PlayerEntity.h.

◆ n_key_info_next_system

- (NSArray*) n_key_info_next_system
private

Definition at line 613 of file PlayerEntity.h.

◆ n_key_info_previous_system

- (NSArray*) n_key_info_previous_system
private

Definition at line 614 of file PlayerEntity.h.

◆ n_key_inject_fuel

- (NSArray*) n_key_inject_fuel
private

Definition at line 574 of file PlayerEntity.h.

◆ n_key_jumpdrive

- (NSArray*) n_key_jumpdrive
private

Definition at line 600 of file PlayerEntity.h.

◆ n_key_launch_escapepod

- (NSArray*) n_key_launch_escapepod
private

Definition at line 596 of file PlayerEntity.h.

◆ n_key_launch_missile

- (NSArray*) n_key_launch_missile
private

Definition at line 577 of file PlayerEntity.h.

◆ n_key_launch_ship

- (NSArray*) n_key_launch_ship
private

Definition at line 555 of file PlayerEntity.h.

◆ n_key_map_end

- (NSArray*) n_key_map_end
private

Definition at line 616 of file PlayerEntity.h.

◆ n_key_map_home

- (NSArray*) n_key_map_home
private

Definition at line 615 of file PlayerEntity.h.

◆ n_key_map_info

- (NSArray*) n_key_map_info
private

Definition at line 619 of file PlayerEntity.h.

◆ n_key_map_next_system

- (NSArray*) n_key_map_next_system
private

Definition at line 617 of file PlayerEntity.h.

◆ n_key_map_previous_system

- (NSArray*) n_key_map_previous_system
private

Definition at line 618 of file PlayerEntity.h.

◆ n_key_map_zoom_in

- (NSArray*) n_key_map_zoom_in
private

Definition at line 620 of file PlayerEntity.h.

◆ n_key_map_zoom_out

- (NSArray*) n_key_map_zoom_out
private

Definition at line 621 of file PlayerEntity.h.

◆ n_key_market_buy_max

- (NSArray*) n_key_market_buy_max
private

Definition at line 644 of file PlayerEntity.h.

◆ n_key_market_buy_one

- (NSArray*) n_key_market_buy_one
private

Definition at line 642 of file PlayerEntity.h.

◆ n_key_market_filter_cycle

- (NSArray*) n_key_market_filter_cycle
private

Definition at line 640 of file PlayerEntity.h.

◆ n_key_market_sell_max

- (NSArray*) n_key_market_sell_max
private

Definition at line 645 of file PlayerEntity.h.

◆ n_key_market_sell_one

- (NSArray*) n_key_market_sell_one
private

Definition at line 643 of file PlayerEntity.h.

◆ n_key_market_sorter_cycle

- (NSArray*) n_key_market_sorter_cycle
private

Definition at line 641 of file PlayerEntity.h.

◆ n_key_mode_equipment

- (NSArray*) n_key_mode_equipment
private

Definition at line 584 of file PlayerEntity.h.

◆ n_key_mouse_control_roll

- (NSArray*) n_key_mouse_control_roll
private

Definition at line 631 of file PlayerEntity.h.

◆ n_key_mouse_control_yaw

- (NSArray*) n_key_mouse_control_yaw
private

Definition at line 632 of file PlayerEntity.h.

◆ n_key_next_compass_mode

- (NSArray*) n_key_next_compass_mode
private

Definition at line 637 of file PlayerEntity.h.

◆ n_key_next_missile

- (NSArray*) n_key_next_missile
private

Definition at line 578 of file PlayerEntity.h.

◆ n_key_next_target

- (NSArray*) n_key_next_target
private

Definition at line 647 of file PlayerEntity.h.

◆ n_key_oxzmanager_extract

- (NSArray*) n_key_oxzmanager_extract
private

Definition at line 674 of file PlayerEntity.h.

◆ n_key_oxzmanager_setfilter

- (NSArray*) n_key_oxzmanager_setfilter
private

Definition at line 672 of file PlayerEntity.h.

◆ n_key_oxzmanager_showinfo

- (NSArray*) n_key_oxzmanager_showinfo
private

Definition at line 673 of file PlayerEntity.h.

◆ n_key_pausebutton

- (NSArray*) n_key_pausebutton
private

Definition at line 628 of file PlayerEntity.h.

◆ n_key_pitch_back

- (NSArray*) n_key_pitch_back
private

Definition at line 546 of file PlayerEntity.h.

◆ n_key_pitch_forward

- (NSArray*) n_key_pitch_forward
private

Definition at line 545 of file PlayerEntity.h.

◆ n_key_prev_compass_mode

- (NSArray*) n_key_prev_compass_mode
private

Definition at line 636 of file PlayerEntity.h.

◆ n_key_previous_target

- (NSArray*) n_key_previous_target
private

Definition at line 648 of file PlayerEntity.h.

◆ n_key_prime_next_equipment

- (NSArray*) n_key_prime_next_equipment
private

Definition at line 581 of file PlayerEntity.h.

◆ n_key_prime_previous_equipment

- (NSArray*) n_key_prime_previous_equipment
private

Definition at line 582 of file PlayerEntity.h.

◆ n_key_roll_left

- (NSArray*) n_key_roll_left
private

Definition at line 543 of file PlayerEntity.h.

◆ n_key_roll_right

- (NSArray*) n_key_roll_right
private

Definition at line 544 of file PlayerEntity.h.

◆ n_key_rotate_cargo

- (NSArray*) n_key_rotate_cargo
private

Definition at line 603 of file PlayerEntity.h.

◆ n_key_scanner_unzoom

- (NSArray*) n_key_scanner_unzoom
private

Definition at line 594 of file PlayerEntity.h.

◆ n_key_scanner_zoom

- (NSArray*) n_key_scanner_zoom
private

Definition at line 593 of file PlayerEntity.h.

◆ n_key_show_fps

- (NSArray*) n_key_show_fps
private

Definition at line 629 of file PlayerEntity.h.

◆ n_key_snapshot

- (NSArray*) n_key_snapshot
private

Definition at line 608 of file PlayerEntity.h.

◆ n_key_switch_next_mfd

- (NSArray*) n_key_switch_next_mfd
private

Definition at line 669 of file PlayerEntity.h.

◆ n_key_switch_previous_mfd

- (NSArray*) n_key_switch_previous_mfd
private

Definition at line 670 of file PlayerEntity.h.

◆ n_key_system_end

- (NSArray*) n_key_system_end
private

Definition at line 624 of file PlayerEntity.h.

◆ n_key_system_home

- (NSArray*) n_key_system_home
private

Definition at line 623 of file PlayerEntity.h.

◆ n_key_system_next_system

- (NSArray*) n_key_system_next_system
private

Definition at line 625 of file PlayerEntity.h.

◆ n_key_system_previous_system

- (NSArray*) n_key_system_previous_system
private

Definition at line 626 of file PlayerEntity.h.

◆ n_key_target_incoming_missile

- (NSArray*) n_key_target_incoming_missile
private

Definition at line 590 of file PlayerEntity.h.

◆ n_key_target_missile

- (NSArray*) n_key_target_missile
private

Definition at line 588 of file PlayerEntity.h.

◆ n_key_untarget_missile

- (NSArray*) n_key_untarget_missile
private

Definition at line 589 of file PlayerEntity.h.

◆ n_key_view_aft

- (NSArray*) n_key_view_aft
private

Definition at line 551 of file PlayerEntity.h.

◆ n_key_view_forward

- (NSArray*) n_key_view_forward
private

Definition at line 550 of file PlayerEntity.h.

◆ n_key_view_port

- (NSArray*) n_key_view_port
private

Definition at line 552 of file PlayerEntity.h.

◆ n_key_view_starboard

- (NSArray*) n_key_view_starboard
private

Definition at line 553 of file PlayerEntity.h.

◆ n_key_weapons_online_toggle

- (NSArray*) n_key_weapons_online_toggle
private

Definition at line 665 of file PlayerEntity.h.

◆ n_key_yaw_left

- (NSArray*) n_key_yaw_left
private

Definition at line 547 of file PlayerEntity.h.

◆ n_key_yaw_right

- (NSArray*) n_key_yaw_right
private

Definition at line 548 of file PlayerEntity.h.

◆ occlusion_dial

- (float) occlusion_dial
private

Definition at line 372 of file PlayerEntity.h.

◆ parcel_record

- (NSMutableDictionary*) parcel_record
private

Definition at line 412 of file PlayerEntity.h.

◆ parcels

- (NSMutableArray*) parcels
private

Definition at line 411 of file PlayerEntity.h.

◆ passenger_record

- (NSMutableDictionary*) passenger_record
private

Definition at line 409 of file PlayerEntity.h.

◆ passengers

- (NSMutableArray*) passengers
private

Definition at line 408 of file PlayerEntity.h.

◆ pitch_delta

- (GLfloat) pitch_delta
private

Definition at line 470 of file PlayerEntity.h.

◆ pitching

- (unsigned) pitching
private

Definition at line 760 of file PlayerEntity.h.

◆ planetSearchString

- (NSString*) planetSearchString
private

Definition at line 439 of file PlayerEntity.h.

◆ playerRotMatrix

- (OOMatrix) playerRotMatrix
private

Definition at line 441 of file PlayerEntity.h.

◆ pollControls

- (BOOL) pollControls
private

Definition at line 449 of file PlayerEntity.h.

◆ port_shot_time

- (OOTimeDelta) port_shot_time
private

Definition at line 475 of file PlayerEntity.h.

◆ portViewOffset

- (Vector) portViewOffset
private

Definition at line 707 of file PlayerEntity.h.

◆ previous_system_id

- (OOSystemID) previous_system_id
private

Definition at line 370 of file PlayerEntity.h.

◆ primedEquipment

- (NSUInteger) primedEquipment
private

Definition at line 489 of file PlayerEntity.h.

◆ replacingMissile

- (unsigned) replacingMissile
private

Definition at line 773 of file PlayerEntity.h.

◆ reputation

- (NSMutableDictionary*) reputation
private

Provided by category PlayerEntity(Contracts).

Definition at line 405 of file PlayerEntity.h.

◆ roleSystemList

- (NSMutableArray*) roleSystemList
private

Definition at line 423 of file PlayerEntity.h.

◆ roleWeightFlags

- (NSMutableDictionary*) roleWeightFlags
private

Definition at line 422 of file PlayerEntity.h.

◆ roleWeights

- (NSMutableArray *) roleWeights
private

Definition at line 420 of file PlayerEntity.h.

Referenced by PlayerGetProperty().

◆ roll_delta

- (GLfloat) roll_delta
private

Definition at line 470 of file PlayerEntity.h.

◆ rolling

- (unsigned) rolling
private

Definition at line 760 of file PlayerEntity.h.

◆ save_path

- (NSString*) save_path
private

Definition at line 703 of file PlayerEntity.h.

◆ saved_chart_zoom

- (OOScalar) saved_chart_zoom
private

Definition at line 507 of file PlayerEntity.h.

◆ scannedWormholes

- (NSArray *) scannedWormholes
private

Definition at line 802 of file PlayerEntity.h.

◆ scanner_zoom_rate

- (GLfloat) scanner_zoom_rate
private

Definition at line 716 of file PlayerEntity.h.

◆ scenarioKey

- (NSString*) scenarioKey
private

Definition at line 704 of file PlayerEntity.h.

◆ scoopOverride

- (BOOL) scoopOverride
private

Definition at line 737 of file PlayerEntity.h.

◆ scoopsActive

- (unsigned) scoopsActive
private

Definition at line 735 of file PlayerEntity.h.

◆ script_time

- (double) script_time
private

Definition at line 425 of file PlayerEntity.h.

◆ script_time_check

- (double) script_time_check
private

Definition at line 426 of file PlayerEntity.h.

◆ script_time_interval

- (double) script_time_interval
private

Definition at line 427 of file PlayerEntity.h.

◆ selFunctionIdx

- (int) selFunctionIdx
private

Definition at line 784 of file PlayerEntity.h.

◆ ship_clock

- (double) ship_clock
private

Definition at line 430 of file PlayerEntity.h.

◆ ship_clock_adjust

- (double) ship_clock_adjust
private

Definition at line 431 of file PlayerEntity.h.

◆ ship_kills

- (unsigned) ship_kills
private

Definition at line 528 of file PlayerEntity.h.

◆ ship_trade_in_factor

- (int) ship_trade_in_factor
private

Definition at line 375 of file PlayerEntity.h.

◆ shipCommodityData

- (OOCommodityMarket *) shipCommodityData
private

Definition at line 521 of file PlayerEntity.h.

◆ shipyard_record

- (NSMutableDictionary*) shipyard_record
private

Definition at line 417 of file PlayerEntity.h.

◆ show_info_flag

- (unsigned) show_info_flag
private

Definition at line 756 of file PlayerEntity.h.

◆ showDemoShips

- (BOOL) showDemoShips
private

Definition at line 758 of file PlayerEntity.h.

◆ showingLongRangeChart

- (BOOL) showingLongRangeChart
private

Definition at line 443 of file PlayerEntity.h.

◆ specialCargo

- (NSString *) specialCargo
private

Definition at line 391 of file PlayerEntity.h.

Referenced by PlayerShipGetProperty().

◆ starboard_shot_time

- (OOTimeDelta) starboard_shot_time
private

Definition at line 475 of file PlayerEntity.h.

◆ starboardViewOffset

- (Vector) starboardViewOffset
private

Definition at line 707 of file PlayerEntity.h.

◆ stickFunctions

- (NSArray*) stickFunctions
private

Definition at line 785 of file PlayerEntity.h.

◆ stickProfileScreen

- (StickProfileScreen*) stickProfileScreen
private

Definition at line 808 of file PlayerEntity.h.

◆ suppressTargetLost

- (void) suppressTargetLost
private

Definition at line 734 of file PlayerEntity.h.

◆ system_id

- (OOSystemID) system_id
private

Definition at line 367 of file PlayerEntity.h.

◆ target_chart_centre

- (NSPoint) target_chart_centre
private

Definition at line 500 of file PlayerEntity.h.

◆ target_chart_focus

- (NSPoint) target_chart_focus
private

Definition at line 501 of file PlayerEntity.h.

◆ target_chart_zoom

- (OOScalar) target_chart_zoom
private

Definition at line 506 of file PlayerEntity.h.

◆ target_memory

- (NSMutableArray*) target_memory
private

Definition at line 720 of file PlayerEntity.h.

◆ target_memory_index

- (NSUInteger) target_memory_index
private

Definition at line 721 of file PlayerEntity.h.

◆ target_system_id

- (OOSystemID) target_system_id
private

Definition at line 368 of file PlayerEntity.h.

◆ targetDockStation

- (StationEntity*) targetDockStation
private

Definition at line 462 of file PlayerEntity.h.

◆ travelling_at_hyperspeed

- (unsigned) travelling_at_hyperspeed
private

Definition at line 747 of file PlayerEntity.h.

◆ trumble

- (OOTrumble* trumble[PLAYER_MAX_TRUMBLES])
private

Definition at line 712 of file PlayerEntity.h.

◆ trumbleCount

- (NSUInteger) trumbleCount
private

Definition at line 711 of file PlayerEntity.h.

◆ using_mining_laser

- (unsigned) using_mining_laser
private

Definition at line 761 of file PlayerEntity.h.

◆ waitingForStickCallback

- (unsigned) waitingForStickCallback
private

Definition at line 768 of file PlayerEntity.h.

◆ weapons_online

- (unsigned) weapons_online
private

Definition at line 770 of file PlayerEntity.h.

◆ witchspaceCountdown

- (OOTimeDelta) witchspaceCountdown
private

Definition at line 509 of file PlayerEntity.h.

◆ worldScripts

- (NSDictionary*) worldScripts
private

Definition at line 377 of file PlayerEntity.h.

◆ worldScriptsRequiringTickle

- (NSDictionary*) worldScriptsRequiringTickle
private

Provided by category PlayerEntity(Scripting).

Definition at line 378 of file PlayerEntity.h.

◆ wormhole

- (WormholeEntity *) wormhole
private

Definition at line 803 of file PlayerEntity.h.

◆ yaw_delta

- (GLfloat) yaw_delta
private

Definition at line 470 of file PlayerEntity.h.

◆ yawing

- (unsigned) yawing
private

Definition at line 760 of file PlayerEntity.h.


The documentation for this class was generated from the following files: