Oolite 1.91.0.7644-241112-7f5034b
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]
 
(GLfloat) - fuelChargeRate [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]
 
(NSString *) - inspSecondaryIdentityLine [implementation]
 
(BOOL) - inspCanBecomeTarget [implementation]
 
(NSString *) - inspDescription [implementation]
 
(void) - setJSSelf:context:
 
(NSString *) - oo_jsClassName [implementation]
 
(void) - javaScriptEngineWillReset: [implementation]
 
(BOOL) - loadPlayerWithPanel [implementation]
 
(void) - savePlayerWithPanel [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
 
(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]
 
(BOOL) - inspHasSecondaryIdentityLine [implementation]
 
(NSString *) - inspTargetLine [implementation]
 
(void) - inspBecomeTarget [implementation]
 
(NSArray *) - subEntitiesForScript
 
(void) - setTargetForScript:
 
(BOOL) - isVisibleToScripts [implementation]
 
(void) - getJSClass:andPrototype: [implementation]
 
(NSArray *) - debugInspectorModules [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
 
(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
 
(NSString *) - inspScanClassLine
 
(NSString *) - inspStatusLine
 
(NSString *) - inspRetainCountLine
 
(NSString *) - inspPositionLine
 
(NSString *) - inspVelocityLine
 
(NSString *) - inspOrientationLine
 
(NSString *) - inspEnergyLine
 
(NSString *) - inspOwnerLine
 
(NSString *) - inspBasicIdentityLine [implementation]
 
(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
 
- Instance Methods inherited from <OOSubEntity>
- Instance Methods inherited from <OOBeaconEntity>

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
 
NSDictionary * worldScripts
 
NSDictionary * worldScriptsRequiringTickle
 
NSMutableDictionary * commodityScripts
 
NSMutableDictionary * mission_variables
 
NSMutableDictionary * localVariables
 
NSString * _missionTitle
 
NSInteger missionTextRow
 
NSString * missionChoice
 
NSString * missionKeyPress
 
BOOL _missionWithCallback
 
BOOL _missionAllowInterrupt
 
BOOL _missionTextEntry
 
OOGUIScreenID _missionExitScreen
 
NSString * specialCargo
 
NSMutableArray * commLog
 
NSMutableArray * eqScripts
 
NSDictionary * _missionOverlayDescriptor
 
NSDictionary * _missionBackgroundDescriptor
 
OOGUIBackgroundSpecial _missionBackgroundSpecial
 
NSDictionary * _equipScreenBackgroundDescriptor
 
NSString * _missionScreenID
 
BOOL found_equipment
 
NSMutableDictionary * reputation
 
unsigned max_passengers
 
NSMutableArray * passengers
 
NSMutableDictionary * passenger_record
 
NSMutableArray * parcels
 
NSMutableDictionary * parcel_record
 
NSMutableArray * contracts
 
NSMutableDictionary * contract_record
 
NSMutableDictionary * shipyard_record
 
NSMutableDictionary * missionDestinations
 
NSMutableArray * roleWeights
 
NSMutableDictionary * roleWeightFlags
 
NSMutableArray * roleSystemList
 
double script_time
 
double script_time_check
 
double script_time_interval
 
NSString * lastTextKey
 
double ship_clock
 
double ship_clock_adjust
 
double escape_pod_rescue_time
 
double fps_check_time
 
int fps_counter
 
double last_fps_check_time
 
NSString * planetSearchString
 
OOMatrix playerRotMatrix
 
BOOL showingLongRangeChart
 
NSString * commanderNameString
 
NSMutableArray * cdrDetailArray
 
int currentPage
 
BOOL pollControls
 
NSInteger marketOffset
 
OOCommodityType marketSelectedCommodity
 
OOMarketFilterMode marketFilterMode
 
OOMarketSorterMode marketSorterMode
 
OOWeakReference_dockedStation
 
StationEntitytargetDockStation
 
HeadUpDisplayhud
 
NSMutableDictionary * multiFunctionDisplayText
 
NSMutableArray * multiFunctionDisplaySettings
 
NSUInteger activeMFD
 
NSMutableDictionary * customDialSettings
 
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
 
NSDictionary * keyconfig2_settings
 
NSDictionary * keyCodeLookups
 
NSArray * n_key_roll_left
 
NSArray * n_key_roll_right
 
NSArray * n_key_pitch_forward
 
NSArray * n_key_pitch_back
 
NSArray * n_key_yaw_left
 
NSArray * n_key_yaw_right
 
NSArray * n_key_view_forward
 
NSArray * n_key_view_aft
 
NSArray * n_key_view_port
 
NSArray * n_key_view_starboard
 
NSArray * n_key_launch_ship
 
NSArray * n_key_gui_screen_options
 
NSArray * n_key_gui_screen_equipship
 
NSArray * n_key_gui_screen_interfaces
 
NSArray * n_key_gui_screen_status
 
NSArray * n_key_gui_chart_screens
 
NSArray * n_key_gui_system_data
 
NSArray * n_key_gui_market
 
NSArray * n_key_gui_arrow_left
 
NSArray * n_key_gui_arrow_right
 
NSArray * n_key_gui_arrow_up
 
NSArray * n_key_gui_arrow_down
 
NSArray * n_key_gui_page_up
 
NSArray * n_key_gui_page_down
 
NSArray * n_key_gui_select
 
NSArray * n_key_increase_speed
 
NSArray * n_key_decrease_speed
 
NSArray * n_key_inject_fuel
 
NSArray * n_key_fire_lasers
 
NSArray * n_key_launch_missile
 
NSArray * n_key_next_missile
 
NSArray * n_key_ecm
 
NSArray * n_key_prime_next_equipment
 
NSArray * n_key_prime_previous_equipment
 
NSArray * n_key_activate_equipment
 
NSArray * n_key_mode_equipment
 
NSArray * n_key_fastactivate_equipment_a
 
NSArray * n_key_fastactivate_equipment_b
 
NSArray * n_key_target_missile
 
NSArray * n_key_untarget_missile
 
NSArray * n_key_target_incoming_missile
 
NSArray * n_key_ident_system
 
NSArray * n_key_scanner_zoom
 
NSArray * n_key_scanner_unzoom
 
NSArray * n_key_launch_escapepod
 
NSArray * n_key_galactic_hyperspace
 
NSArray * n_key_hyperspace
 
NSArray * n_key_jumpdrive
 
NSArray * n_key_dump_cargo
 
NSArray * n_key_rotate_cargo
 
NSArray * n_key_autopilot
 
NSArray * n_key_autodock
 
NSArray * n_key_snapshot
 
NSArray * n_key_docking_music
 
NSArray * n_key_advanced_nav_array_next
 
NSArray * n_key_advanced_nav_array_previous
 
NSArray * n_key_info_next_system
 
NSArray * n_key_info_previous_system
 
NSArray * n_key_map_home
 
NSArray * n_key_map_end
 
NSArray * n_key_map_next_system
 
NSArray * n_key_map_previous_system
 
NSArray * n_key_map_info
 
NSArray * n_key_map_zoom_in
 
NSArray * n_key_map_zoom_out
 
NSArray * n_key_system_home
 
NSArray * n_key_system_end
 
NSArray * n_key_system_next_system
 
NSArray * n_key_system_previous_system
 
NSArray * n_key_pausebutton
 
NSArray * n_key_show_fps
 
NSArray * n_key_bloom_toggle
 
NSArray * n_key_mouse_control_roll
 
NSArray * n_key_mouse_control_yaw
 
NSArray * n_key_hud_toggle
 
NSArray * n_key_comms_log
 
NSArray * n_key_prev_compass_mode
 
NSArray * n_key_next_compass_mode
 
NSArray * n_key_chart_highlight
 
NSArray * n_key_market_filter_cycle
 
NSArray * n_key_market_sorter_cycle
 
NSArray * n_key_market_buy_one
 
NSArray * n_key_market_sell_one
 
NSArray * n_key_market_buy_max
 
NSArray * n_key_market_sell_max
 
NSArray * n_key_next_target
 
NSArray * n_key_previous_target
 
NSArray * n_key_custom_view
 
NSArray * n_key_custom_view_zoom_out
 
NSArray * n_key_custom_view_zoom_in
 
NSArray * n_key_custom_view_roll_left
 
NSArray * n_key_custom_view_pan_left
 
NSArray * n_key_custom_view_roll_right
 
NSArray * n_key_custom_view_pan_right
 
NSArray * n_key_custom_view_rotate_up
 
NSArray * n_key_custom_view_pan_up
 
NSArray * n_key_custom_view_rotate_down
 
NSArray * n_key_custom_view_pan_down
 
NSArray * n_key_custom_view_rotate_left
 
NSArray * n_key_custom_view_rotate_right
 
NSArray * n_key_docking_clearance_request
 
NSArray * n_key_weapons_online_toggle
 
NSArray * n_key_cycle_next_mfd
 
NSArray * n_key_cycle_previous_mfd
 
NSArray * n_key_switch_next_mfd
 
NSArray * n_key_switch_previous_mfd
 
NSArray * n_key_oxzmanager_setfilter
 
NSArray * n_key_oxzmanager_showinfo
 
NSArray * n_key_oxzmanager_extract
 
NSArray * n_key_dump_target_state
 
NSArray * n_key_dump_entity_list
 
NSArray * n_key_debug_full
 
NSArray * n_key_debug_collision
 
NSArray * n_key_debug_console_connect
 
NSArray * n_key_debug_bounding_boxes
 
NSArray * n_key_debug_shaders
 
NSArray * n_key_debug_off
 
NSMutableArray * customEquipActivation
 
NSMutableArray * customActivatePressed
 
NSMutableArray * customModePressed
 
NSDictionary * extraMissionKeys
 
NSMutableDictionary * extraGuiScreenKeys
 
NSString * save_path
 
NSString * scenarioKey
 
Vector forwardViewOffset
 
Vector aftViewOffset
 
Vector portViewOffset
 
Vector starboardViewOffset
 
Vector _sysInfoLight
 
NSUInteger trumbleCount
 
OOTrumbletrumble [PLAYER_MAX_TRUMBLES]
 
float _trumbleAppetiteAccumulator
 
GLfloat scanner_zoom_rate
 
NSMutableArray * target_memory
 
NSUInteger target_memory_index
 
Quaternion customViewQuaternion
 
OOMatrix customViewMatrix
 
Vector customViewOffset
 
Vector customViewForwardVector
 
Vector customViewUpVector
 
Vector customViewRightVector
 
Vector customViewRotationCenter
 
NSString * customViewDescription
 
NSMutableString * dockingReport
 
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
 
NSArray * stickFunctions
 
NSArray * keyFunctions
 
NSArray * kbdLayouts
 
NSString * keyShiftText
 
NSString * keyMod1Text
 
NSString * keyMod2Text
 
OOGalacticHyperspaceBehaviour galacticHyperspaceBehaviour
 
NSPoint galacticHyperspaceFixedCoords
 
OOLongRangeChartMode longRangeChartMode
 
NSArray * _customViews
 
NSUInteger _customViewIndex
 
OODockingClearanceStatus dockingClearanceStatus
 
NSMutableArray * scannedWormholes
 
WormholeEntitywormhole
 
ShipEntitydemoShip
 
NSArray * lastShot
 
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
 
- Protected Attributes inherited from OOWeakRefObject
OOWeakReferenceweakSelf
 

Detailed Description

Definition at line 367 of file PlayerEntity.h.

Method Documentation

◆ activateCloakingDevice

- (BOOL) activateCloakingDevice

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6034{
6035 if (![self hasCloakingDevice]) return NO;
6036
6037 if ([super activateCloakingDevice])
6038 {
6039 [UNIVERSE setCurrentPostFX:OO_POSTFX_CLOAK];
6040 [UNIVERSE addMessage:DESC(@"cloak-on") forCount:2];
6041 [self playCloakingDeviceOn];
6042 return YES;
6043 }
6044 else
6045 {
6046 [UNIVERSE addMessage:DESC(@"cloak-low-juice") forCount:3];
6047 [self playCloakingDeviceInsufficientEnergy];
6048 return NO;
6049 }
6050}
BOOL activateCloakingDevice()
BOOL hasCloakingDevice()

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

+ Here is the call graph for this function:

◆ activatePrimableEquipment:withMode:

- (void) activatePrimableEquipment: (NSUInteger) index
withMode: (OOPrimedEquipmentMode) mode 

Definition at line 13699 of file PlayerEntity.m.

8223 :(NSUInteger)index withMode:(OOPrimedEquipmentMode)mode
8224{
8225 // index == [eqScripts count] means we don't want to activate any equipment.
8226 if(index < [eqScripts count])
8227 {
8228 OOJSScript *eqScript = [[eqScripts oo_arrayAtIndex:index] objectAtIndex:1];
8229 JSContext *context = OOJSAcquireContext();
8230 NSAssert1(mode <= OOPRIMEDEQUIP_MODE, @"Primable equipment mode %i out of range", (int)mode);
8231
8232 switch (mode)
8233 {
8234 case OOPRIMEDEQUIP_MODE:
8235 [eqScript callMethod:OOJSID("mode") inContext:context withArguments:NULL count:0 result:NULL];
8236 break;
8238 [eqScript callMethod:OOJSID("activated") inContext:context withArguments:NULL count:0 result:NULL];
8239 break;
8240 }
8241 OOJSRelinquishContext(context);
8242 }
8243
8244}
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:395
NSMutableArray * eqScripts
const char int mode
Definition ioapi.h:133

◆ activateSelectedInterface

- (void) activateSelectedInterface

Definition at line 9211 of file PlayerEntity.m.

9857{
9858 GuiDisplayGen* gui = [UNIVERSE gui];
9859 NSString* key = [gui selectedRowKey];
9860
9861 if ([key hasPrefix:@"More:"])
9862 {
9863 int from_item = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
9864 [self setGuiToInterfacesScreen:from_item];
9865
9866 if ([gui selectedRow] < 0)
9867 [gui setSelectedRow:GUI_ROW_INTERFACES_START];
9868 if (from_item == 0)
9869 [gui setSelectedRow:GUI_ROW_INTERFACES_START + GUI_MAX_ROWS_INTERFACES - 1];
9870 [self showInformationForSelectedInterface];
9871
9872
9873 return;
9874 }
9875
9876 NSDictionary *interfaces = [[self dockedStation] localInterfaces];
9877 OOJSInterfaceDefinition *definition = [interfaces objectForKey:key];
9878 if (definition)
9879 {
9880 [[UNIVERSE gameView] clearKeys];
9881 [definition runCallback:key];
9882 }
9883 else
9884 {
9885 OOLog(@"interface.missingCallback", @"Unable to find callback definition for key %@", key);
9886 }
9887}
#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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addEqScriptForKey:

- (BOOL) addEqScriptForKey: (NSString *) eq_key

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addEquipmentFromCollection:

- (void) addEquipmentFromCollection: (id) equipment

Definition at line 9211 of file PlayerEntity.m.

11638 :(id)equipment
11639{
11640 NSDictionary *dict = nil;
11641 NSEnumerator *eqEnum = nil;
11642 NSString *eqDesc = nil;
11643 NSUInteger i, count;
11644
11645 // Pass 1: Load the entire collection.
11646 if ([equipment isKindOfClass:[NSDictionary class]])
11647 {
11648 dict = equipment;
11649 eqEnum = [equipment keyEnumerator];
11650 }
11651 else if ([equipment isKindOfClass:[NSArray class]] || [equipment isKindOfClass:[NSSet class]])
11652 {
11653 eqEnum = [equipment objectEnumerator];
11654 }
11655 else if ([equipment isKindOfClass:[NSString class]])
11656 {
11657 eqEnum = [[NSArray arrayWithObject:equipment] objectEnumerator];
11658 }
11659 else
11660 {
11661 return;
11662 }
11663
11664 while ((eqDesc = [eqEnum nextObject]))
11665 {
11666 /* Bug workaround: extra_equipment should never contain EQ_TRUMBLE,
11667 which is basically a magic flag passed to awardEquipment: to infect
11668 the player. However, prior to Oolite 1.70.1, if the player had a
11669 trumble infection and awardEquipment:EQ_TRUMBLE was called, an
11670 EQ_TRUMBLE would be added to the equipment list. Subsequent calls
11671 to awardEquipment:EQ_TRUMBLE would exit early because there was an
11672 EQ_TRUMBLE in the equipment list. as a result, it would no longer
11673 be possible to infect the player after the current infection ended.
11674
11675 The bug is fixed in 1.70.1. The following line is to fix old saved
11676 games which had been "corrupted" by the bug.
11677 -- Ahruman 2007-12-04
11678 */
11679 if ([eqDesc isEqualToString:@"EQ_TRUMBLE"]) continue;
11680
11681 // Traditional form is a dictionary of booleans; we only accept those where the value is true.
11682 if (dict != nil && ![dict oo_boolForKey:eqDesc]) continue;
11683
11684 // We need to add the entire collection without validation first and then remove the items that are
11685 // not compliant (like items that do not satisfy the requiresEquipment criterion). This is to avoid
11686 // unintentionally excluding valid equipment, just because the required equipment existed but had
11687 // not been yet added to the equipment list at the time of the canAddEquipment validation check.
11688 // Nikos, 20080817.
11689 count = [dict oo_unsignedIntegerForKey:eqDesc];
11690 for (i=0;i<count;i++)
11691 {
11692 [self addEquipmentItem:eqDesc withValidation:NO inContext:@"loading"];
11693 }
11694 }
11695
11696 // Pass 2: Remove items that do not satisfy validation criteria (like requires_equipment etc.).
11697 if ([equipment isKindOfClass:[NSDictionary class]])
11698 {
11699 eqEnum = [equipment keyEnumerator];
11700 }
11701 else if ([equipment isKindOfClass:[NSArray class]] || [equipment isKindOfClass:[NSSet class]])
11702 {
11703 eqEnum = [equipment objectEnumerator];
11704 }
11705 else if ([equipment isKindOfClass:[NSString class]])
11706 {
11707 eqEnum = [[NSArray arrayWithObject:equipment] objectEnumerator];
11708 }
11709 // Now remove items that should not be in the equipment list.
11710 while ((eqDesc = [eqEnum nextObject]))
11711 {
11712 if (![self equipmentValidToAdd:eqDesc whileLoading:YES inContext:@"loading"])
11713 {
11714 [self removeEquipmentItem:eqDesc];
11715 }
11716 }
11717}

◆ addEquipmentItem:inContext:

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

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

11509 :(NSString *)equipmentKey inContext:(NSString *)context
11510{
11511 return [self addEquipmentItem:equipmentKey withValidation:YES inContext:context];
11512}

◆ addEquipmentItem:withValidation:inContext:

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

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

11515 :(NSString *)equipmentKey withValidation:(BOOL)validateAddition inContext:(NSString *)context
11516{
11517 // deal with trumbles..
11518 if ([equipmentKey isEqualToString:@"EQ_TRUMBLE"])
11519 {
11520 /* Bug fix: must return here if eqKey == @"EQ_TRUMBLE", even if
11521 trumbleCount >= 1. Otherwise, the player becomes immune to
11522 trumbles. See comment in -setCommanderDataFromDictionary: for more
11523 details.
11524 -- Ahruman 2008-12-04
11525 */
11526 // the old trumbles will kill the new one if there are enough of them.
11528 {
11529 [self addTrumble:trumble[ranrot_rand() % PLAYER_MAX_TRUMBLES]]; // randomise its looks.
11530 return YES;
11531 }
11532 return NO;
11533 }
11534
11535 BOOL OK = [super addEquipmentItem:equipmentKey withValidation:validateAddition inContext:context];
11536
11537 if (OK)
11538 {
11539 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_COMPASS"] && [self compassMode] == COMPASS_MODE_BASIC)
11540 {
11541 [self setCompassMode:COMPASS_MODE_PLANET];
11542 }
11543
11544 [self addEqScriptForKey:equipmentKey];
11545 [self addEquipmentWithScriptToCustomKeyArray:equipmentKey];
11546 }
11547 return OK;
11548}
#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 9211 of file PlayerEntity.m.

11557 :(NSString *)equipmentKey
11558{
11559 NSDictionary *item;
11560 NSUInteger i, j;
11561 NSArray *object;
11562
11563 for (i = 0; i < [eqScripts count]; i++)
11564 {
11565 if ([[[eqScripts oo_arrayAtIndex:i] oo_stringAtIndex:0] isEqualToString:equipmentKey])
11566 {
11567 //check if this equipment item is already in the array
11568 for (j = 0; j < [customEquipActivation count]; j++) {
11569 item = [customEquipActivation objectAtIndex:j];
11570 if ([[item oo_stringForKey:CUSTOMEQUIP_EQUIPKEY] isEqualToString:equipmentKey]) return;
11571 }
11572 // if we get here, this item is new
11573 // add the basic info at this point (equipkey and name only)
11575 NSMutableDictionary *customKey = [[NSMutableDictionary alloc] initWithObjectsAndKeys:equipmentKey, CUSTOMEQUIP_EQUIPKEY, [eq name], CUSTOMEQUIP_EQUIPNAME, nil];
11576
11577 // grab any default keys from the equipment item
11578 // default activate
11579 object = [eq defaultActivateKey];
11580 if ((object != nil && [object count] > 0))
11581 [customKey setObject:object forKey:CUSTOMEQUIP_KEYACTIVATE];
11582 // default mode
11583 object = [eq defaultModeKey];
11584 if ((object != nil && [object count] > 0))
11585 [customKey setObject:object forKey:CUSTOMEQUIP_KEYMODE];
11586
11587 [customEquipActivation addObject:customKey];
11588 [customKey release];
11589 // keep the keypress arrays in sync
11590 [customActivatePressed addObject:[NSNumber numberWithBool:NO]];
11591 [customModePressed addObject:[NSNumber numberWithBool:NO]];
11592
11593 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
11594 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
11595 return;
11596 }
11597 }
11598}
#define CUSTOMEQUIP_KEYACTIVATE
#define CUSTOMEQUIP_EQUIPKEY
#define CUSTOMEQUIP_KEYMODE
NSArray * defaultActivateKey()
NSArray * defaultModeKey()

◆ addLiteralMissionText:

- (void) addLiteralMissionText: (NSString *) text

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1919 :(NSString *)text
1920{
1921 if (text != nil)
1922 {
1923 GuiDisplayGen *gui = [UNIVERSE gui];
1924
1925 NSString *para = nil;
1926 foreach (para, [text componentsSeparatedByString:@"\n"])
1927 {
1928 missionTextRow = [gui addLongText:para startingAtRow:missionTextRow align:GUI_ALIGN_LEFT];
1929 }
1930 }
1931}
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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addMissionDestinationMarker:

- (void) addMissionDestinationMarker: (NSDictionary *) marker

Definition at line 9211 of file PlayerEntity.m.

13292 :(NSDictionary *)marker
13293{
13294 NSDictionary *validated = [self validatedMarker:marker];
13295 if (validated == nil)
13296 {
13297 return;
13298 }
13299
13300 [missionDestinations setObject:validated forKey:[self markerKey:validated]];
13301}

Referenced by MissionMarkSystem().

+ Here is the caller graph for this function:

◆ addMissionText:

- (void) addMissionText: (NSString *) textKey

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1901 : (NSString *)textKey
1902{
1903 NSString *text = nil;
1904
1905 if ([textKey isEqualToString:lastTextKey]) return; // don't repeatedly add the same text
1906 [lastTextKey release];
1907 lastTextKey = [textKey copy];
1908
1909 // Replace literal \n in strings with line breaks and perform expansions.
1910 text = [[UNIVERSE missiontext] oo_stringForKey:textKey];
1911 if (text == nil) return;
1913 text = [self replaceVariablesInString:text];
1914
1915 [self addLiteralMissionText:text];
1916}
@ 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 955 of file PlayerEntityLegacyScriptEngine.m.

2361 : (NSString *)moonKey
2362{
2363 OOLog(kOOLogNoteAddPlanet, @"DEBUG: addMoon '%@'", moonKey);
2364
2365 if (!UNIVERSE)
2366 return nil;
2367 NSDictionary* dict = [[UNIVERSE systemManager] getPropertiesForSystemKey:moonKey];
2368 if (!dict)
2369 {
2370 OOLog(@"script.error.addPlanet.keyNotFound", @"***** ERROR: could not find an entry in planetinfo.plist for '%@'", moonKey);
2371 return nil;
2372 }
2373
2374 OOLog(kOOLogDebugAddPlanet, @"DEBUG: initMoonFromDictionary: %@", dict);
2375 OOPlanetEntity *planet = [[[OOPlanetEntity alloc] initFromDictionary:dict withAtmosphere:NO andSeed:[[UNIVERSE systemManager] getRandomSeedForCurrentSystem] forSystem:system_id] autorelease];
2376
2377 Quaternion planetOrientation;
2378 if (ScanQuaternionFromString([dict objectForKey:@"orientation"], &planetOrientation))
2379 {
2380 [planet setOrientation:planetOrientation];
2381 }
2382
2383 if (![dict objectForKey:@"position"])
2384 {
2385 OOLog(@"script.error.addPlanet.noPosition", @"***** ERROR: you must specify a position for scripted moon '%@' before it can be created", moonKey);
2386 return nil;
2387 }
2388
2389 NSString *positionString = [dict objectForKey:@"position"];
2390 if([positionString hasPrefix:@"abs "] && ([UNIVERSE planet] != nil || [UNIVERSE sun] !=nil))
2391 {
2392 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);
2393 }
2394 HPVector posn = [UNIVERSE coordinatesFromCoordinateSystemString:positionString];
2395 if (posn.x || posn.y || posn.z)
2396 {
2397 OOLog(kOOLogDebugAddPlanet, @"moon position (%.2f %.2f %.2f) derived from %@", posn.x, posn.y, posn.z, positionString);
2398 }
2399 else
2400 {
2401 ScanHPVectorFromString(positionString, &posn);
2402 OOLog(kOOLogDebugAddPlanet, @"moon position (%.2f %.2f %.2f) derived from %@", posn.x, posn.y, posn.z, positionString);
2403 }
2404 [planet setPosition: posn];
2405
2406 [UNIVERSE addEntity:planet];
2407 return planet;
2408}
#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:833

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 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by SystemAddPlanet().

+ Here is the caller graph for this function:

◆ addRoleForAggression:

- (void) addRoleForAggression: (ShipEntity *) victim

Definition at line 13699 of file PlayerEntity.m.

5011 :(ShipEntity *)victim
5012{
5013 if ([victim isExplicitlyUnpiloted] || [victim isHulk] || [victim hasHostileTarget] || [[victim primaryAggressor] isPlayer])
5014 {
5015 return;
5016 }
5017 NSString *role = nil;
5018 if ([[victim primaryRole] isEqualToString:@"escape-capsule"])
5019 {
5020 role = @"assassin-player";
5021 }
5022 else if ([victim bounty] > 0)
5023 {
5024 role = @"hunter";
5025 }
5026 else if ([victim isPirateVictim])
5027 {
5028 role = @"pirate";
5029 }
5030 else if ([UNIVERSE role:[self primaryRole] isInCategory:@"oolite-hunter"] || [victim scanClass] == CLASS_POLICE)
5031 {
5032 role = @"pirate-interceptor";
5033 }
5034 if (role == nil)
5035 {
5036 return;
5037 }
5038 NSUInteger times = [roleWeightFlags oo_intForKey:role defaultValue:0];
5039 times++;
5040 [roleWeightFlags setObject:[NSNumber numberWithUnsignedInteger:times] forKey:role];
5041 if ((times & (times-1)) == 0) // is power of 2
5042 {
5043 [self addRoleToPlayer:role];
5044 }
5045}
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 13699 of file PlayerEntity.m.

5049{
5050 NSString *role = @"miner";
5051 NSUInteger times = [roleWeightFlags oo_intForKey:role defaultValue:0];
5052 times++;
5053 [roleWeightFlags setObject:[NSNumber numberWithUnsignedInteger:times] forKey:role];
5054 if ((times & (times-1)) == 0) // is power of 2
5055 {
5056 [self addRoleToPlayer:role];
5057 }
5058}

◆ addRoleToPlayer:

- (void) addRoleToPlayer: (NSString *) role

Definition at line 13699 of file PlayerEntity.m.

5061 :(NSString *)role
5062{
5063 NSUInteger slot = Ranrot() & ([self maxPlayerRoles]-1);
5064 [self addRoleToPlayer:role inSlot:slot];
5065}
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 13699 of file PlayerEntity.m.

5068 :(NSString *)role inSlot:(NSUInteger)slot
5069{
5070 if (slot >= [self maxPlayerRoles])
5071 {
5072 slot = [self maxPlayerRoles]-1;
5073 }
5074 if (slot >= [roleWeights count])
5075 {
5076 [roleWeights addObject:role];
5077 }
5078 else
5079 {
5080 [roleWeights replaceObjectAtIndex:slot withObject:role];
5081 }
5082}
NSMutableArray * roleWeights
NSUInteger maxPlayerRoles()

Referenced by PlayerSetPlayerRole().

+ Here is the caller graph for this function:

◆ addScannedWormhole:

- (void) addScannedWormhole: (WormholeEntity*) wormhole

Definition at line 9211 of file PlayerEntity.m.

13185 :(WormholeEntity*)whole
13186{
13187 assert(scannedWormholes != nil);
13188 assert(whole != nil);
13189
13190 // Only add if we don't have it already!
13191 NSEnumerator *wormholes = [scannedWormholes objectEnumerator];
13192 WormholeEntity *wh = nil;
13193 while ((wh = [wormholes nextObject]))
13194 {
13195 if (wh == whole) return;
13196 }
13197 [whole setScannedAt:[self clockTimeAdjusted]];
13198 [scannedWormholes addObject:whole];
13199}
NSMutableArray * scannedWormholes

◆ addScenarioModel:

- (void) addScenarioModel: (NSString *) shipKey

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addShips:

- (void) addShips: (NSString *) roles_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

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

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

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 955 of file PlayerEntityLegacyScriptEngine.m.

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

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

◆ addTarget:

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

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

12238 :(Entity *) targetEntity
12239{
12240 if ([self status] != STATUS_IN_FLIGHT && [self status] != STATUS_WITCHSPACE_COUNTDOWN) return;
12241 if (targetEntity == self) return;
12242
12243 [super addTarget:targetEntity];
12244
12245 if ([targetEntity isWormhole])
12246 {
12247 assert ([self hasEquipmentItemProviding:@"EQ_WORMHOLE_SCANNER"]);
12248 [self addScannedWormhole:(WormholeEntity*)targetEntity];
12249 }
12250 // wormholes don't go in target memory
12251 else if ([self hasEquipmentItemProviding:@"EQ_TARGET_MEMORY"] && targetEntity != nil)
12252 {
12253 OOWeakReference *targetRef = [targetEntity weakSelf];
12254 NSUInteger i = [target_memory indexOfObject:targetRef];
12255 // if already in target memory, preserve that and just change the index
12256 if (i != NSNotFound)
12257 {
12259 }
12260 else
12261 {
12262 i = [target_memory indexOfObject:[NSNull null]];
12263 // find and use a blank space in memory
12264 if (i != NSNotFound)
12265 {
12266 [target_memory replaceObjectAtIndex:i withObject:targetRef];
12268 }
12269 else
12270 {
12271 // use the next memory space
12273 [target_memory replaceObjectAtIndex:target_memory_index withObject:targetRef];
12274 }
12275 }
12276 }
12277
12278 if (ident_engaged)
12279 {
12280 [self playIdentLockedOn];
12281 [self printIdentLockedOnForMissile:NO];
12282 }
12283 else if ([targetEntity isShip] && [self weaponsOnline]) // Only let missiles target-lock onto ships
12284 {
12286 {
12288 [missile_entity[activeMissile] addTarget:targetEntity];
12289 [self playMissileLockedOn];
12290 [self printIdentLockedOnForMissile:YES];
12291 }
12292 else // It's a mine or something
12293 {
12295 [self playIdentLockedOn];
12296 [self printIdentLockedOnForMissile:NO];
12297 }
12298 }
12299}
@ MISSILE_STATUS_TARGET_LOCKED
@ MISSILE_STATUS_ARMED
#define PLAYER_TARGET_MEMORY_SIZE
unsigned isShip
Definition Entity.h:91
OOEntityStatus status()
Definition Entity.m:793
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 13699 of file PlayerEntity.m.

4867 :(double)seconds
4868{
4869 ship_clock_adjust += seconds;
4870}
double ship_clock_adjust

Referenced by PlayerSetEscapePodDestination().

+ Here is the caller graph for this function:

◆ addTrumble:

- (void) addTrumble: (OOTrumble *) papaTrumble

Definition at line 9211 of file PlayerEntity.m.

11992 :(OOTrumble *)papaTrumble
11993{
11995 {
11996 return;
11997 }
11998 OOTrumble *trumblePup = trumble[trumbleCount];
11999 [trumblePup spawnFrom:papaTrumble];
12000 trumbleCount++;
12001}
void spawnFrom:(OOTrumble *parentTrumble)
Definition OOTrumble.m:219
OOTrumble * trumble[PLAYER_MAX_TRUMBLES]

◆ adjusted_chart_centre

- (NSPoint) adjusted_chart_centre

Definition at line 13699 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.
616 acc.x = chart_centre_coordinates.x + (128.0 - chart_centre_coordinates.x) * (chart_zoom - 1.0) / (CHART_MAX_ZOOM - 1.0);
617 acc.y = chart_centre_coordinates.y + (128.0 - chart_centre_coordinates.y) * (chart_zoom - 1.0) / (CHART_MAX_ZOOM - 1.0);
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 {
624 scroll_pos = acc.x - CHART_SCROLL_AT_X*chart_zoom;
626 if (scroll_pos <= 0)
627 {
628 acc.x = ecc;
629 }
630 else
631 {
632 acc.x = ((scroll_pos-chart_focus_coordinates.x)*ecc + chart_focus_coordinates.x*acc.x)/scroll_pos;
633 }
634 }
636 {
637 scroll_pos = acc.x + CHART_SCROLL_AT_X*chart_zoom;
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 {
645 acc.x = ((chart_focus_coordinates.x-scroll_pos)*ecc + (256.0 - chart_focus_coordinates.x)*acc.x)/(256.0 - scroll_pos);
646 }
647 }
649 {
650 scroll_pos = acc.y - CHART_SCROLL_AT_Y*chart_zoom;
652 if (scroll_pos <= 0)
653 {
654 acc.y = ecc;
655 }
656 else
657 {
658 acc.y = ((scroll_pos-chart_focus_coordinates.y)*ecc + chart_focus_coordinates.y*acc.y)/scroll_pos;
659 }
660 }
662 {
663 scroll_pos = acc.y + CHART_SCROLL_AT_Y*chart_zoom;
664 ecc = 256.0 - CHART_HEIGHT_AT_MAX_ZOOM*chart_zoom / 2.0;
665 if (scroll_pos >= 256.0)
666 {
667 acc.y = ecc;
668 }
669 else
670 {
671 acc.y = ((chart_focus_coordinates.y-scroll_pos)*ecc + (256.0 - chart_focus_coordinates.y)*acc.y)/(256.0 - scroll_pos);
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:

- (OOCreditsQuantity) adjustPriceByScriptForEqKey: (NSString *) eqKey
withCurrent: (OOCreditsQuantity) price 

Definition at line 9211 of file PlayerEntity.m.

10267 :(NSString *)eqKey withCurrent:(OOCreditsQuantity)price
10268{
10269 NSString *condition_script = [[OOEquipmentType equipmentTypeWithIdentifier:eqKey] conditionScript];
10270 if (condition_script != nil)
10271 {
10272 OOJSScript *condScript = [UNIVERSE getConditionScript:condition_script];
10273 if (condScript != nil) // should always be non-nil, but just in case
10274 {
10275 JSContext *JScontext = OOJSAcquireContext();
10276 BOOL OK;
10277 jsval result;
10278 int32 newPrice;
10279 jsval args[] = { OOJSValueFromNativeObject(JScontext, eqKey) , JSVAL_NULL };
10280 OK = JS_NewNumberValue(JScontext, price, &args[1]);
10281
10282 if (OK)
10283 {
10284 OK = [condScript callMethod:OOJSID("updateEquipmentPrice")
10285 inContext:JScontext
10286 withArguments:args count:sizeof args / sizeof *args
10287 result:&result];
10288 }
10289
10290 if (OK)
10291 {
10292 OK = JS_ValueToInt32(JScontext, result, &newPrice);
10293 if (OK && newPrice >= 0)
10294 {
10295 price = (OOCreditsQuantity)newPrice;
10296 }
10297 }
10298 OOJSRelinquishContext(JScontext);
10299 }
10300 }
10301 return price;
10302}
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
uint64_t OOCreditsQuantity
Definition OOTypes.h:182
NSString * conditionScript()

◆ adjustTradeInFactorBy:

- (void) adjustTradeInFactorBy: (int) value

Definition at line 9211 of file PlayerEntity.m.

11875 :(int)value
11876{
11877 ship_trade_in_factor += value;
11880}
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 13699 of file PlayerEntity.m.

4665{
4666 return aft_shield;
4667}
GLfloat aft_shield

◆ aftShieldRechargeRate

- (float) aftShieldRechargeRate

Definition at line 13699 of file PlayerEntity.m.

4629{
4631}
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 13699 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 13699 of file PlayerEntity.m.

4246 :(double) delta_t
4247{
4248 [self applyRoll:flightRoll*delta_t andClimb:flightPitch*delta_t];
4249 [self applyYaw:flightYaw*delta_t];
4250}

◆ applyMarketFilter:onMarket:

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

Definition at line 9211 of file PlayerEntity.m.

10825 :(NSArray *)goods onMarket:(OOCommodityMarket *)market
10826{
10828 {
10829 return goods;
10830 }
10831 NSMutableArray *filteredGoods = [NSMutableArray arrayWithCapacity:[goods count]];
10832 OOCommodityType good = nil;
10833 foreach (good, goods)
10834 {
10835 switch (marketFilterMode)
10836 {
10838 // never reached, but keeps compiler happy
10839 [filteredGoods addObject:good];
10840 break;
10842 if ([market quantityForGood:good] > 0 || [self cargoQuantityForType:good] > 0)
10843 {
10844 [filteredGoods addObject:good];
10845 }
10846 break;
10848 if ([self cargoQuantityForType:good] > 0)
10849 {
10850 [filteredGoods addObject:good];
10851 }
10852 break;
10854 if ([market quantityForGood:good] > 0)
10855 {
10856 [filteredGoods addObject:good];
10857 }
10858 break;
10860 if ([market exportLegalityForGood:good] == 0 && [market importLegalityForGood:good] == 0)
10861 {
10862 [filteredGoods addObject:good];
10863 }
10864 break;
10866 if ([market exportLegalityForGood:good] > 0 || [market importLegalityForGood:good] > 0)
10867 {
10868 [filteredGoods addObject:good];
10869 }
10870 break;
10871 }
10872 }
10873 return [[filteredGoods copy] autorelease];
10874}
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 9211 of file PlayerEntity.m.

10877 :(NSArray *)goods onMarket:(OOCommodityMarket *)market
10878{
10879 switch (marketSorterMode)
10880 {
10882 return [goods sortedArrayUsingFunction:marketSorterByName context:market];
10884 return [goods sortedArrayUsingFunction:marketSorterByPrice context:market];
10886 return [goods sortedArrayUsingFunction:marketSorterByQuantity context:market];
10888 return [goods sortedArrayUsingFunction:marketSorterByQuantity context:shipCommodityData];
10890 return [goods sortedArrayUsingFunction:marketSorterByMassUnit context:market];
10892 // keep default sort order
10893 break;
10894 }
10895 return goods;
10896}
@ 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 13699 of file PlayerEntity.m.

4253 :(GLfloat) roll1 andClimb:(GLfloat) climb1
4254{
4255 if (roll1 == 0.0 && climb1 == 0.0 && hasRotated == NO)
4256 return;
4257
4258 if (roll1)
4260 if (climb1)
4262
4263 /* Bugginess may put us in a state where the orientation quat is all
4264 zeros, at which point it’s impossible to move.
4265 */
4266 if (EXPECT_NOT(quaternion_equal(orientation, kZeroQuaternion)))
4267 {
4268 if (!quaternion_equal(lastOrientation, kZeroQuaternion))
4269 {
4271 }
4272 else
4273 {
4275 }
4276 }
4277
4278 [self orientationChanged];
4279}
#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 13699 of file PlayerEntity.m.

4286 :(GLfloat) yaw
4287{
4289
4290 [self orientationChanged];
4291}
void quaternion_rotate_about_y(Quaternion *quat, OOScalar angle)

◆ assignToActivePylon:

- (BOOL) assignToActivePylon: (NSString *) identifierKey

Definition at line 13699 of file PlayerEntity.m.

5992 :(NSString *)equipmentKey
5993{
5994 if (!launchingMissile) return NO;
5995
5996 OOEquipmentType *eqType = nil;
5997
5998 if ([equipmentKey hasSuffix:@"_DAMAGED"])
5999 {
6000 return NO;
6001 }
6002 else
6003 {
6004 eqType = [OOEquipmentType equipmentTypeWithIdentifier:equipmentKey];
6005 }
6006
6007 // missiles with techlevel above 99 (kOOVariableTechLevel) are never available to the player
6008 if (![eqType isMissileOrMine] || [eqType effectiveTechLevel] > kOOVariableTechLevel)
6009 {
6010 return NO;
6011 }
6012
6013 ShipEntity *amiss = [UNIVERSE newShipWithRole:equipmentKey];
6014
6015 if (!amiss) return NO;
6016
6017 // replace the missile now.
6018 [missile_entity[activeMissile] release];
6019 missile_entity[activeMissile] = amiss;
6020 missile_list[activeMissile] = eqType;
6021
6022 // make sure the new missile is properly activated.
6023 if (activeMissile > 0) activeMissile--;
6024 else activeMissile = max_missiles - 1;
6025 [self selectNextMissile];
6026
6027 replacingMissile = YES;
6028
6029 return YES;
6030}
@ 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 13699 of file PlayerEntity.m.

4443{
4445}
unsigned travelling_at_hyperspeed

◆ autosavePlayer

- (void) autosavePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 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:839

◆ availableFacings

- (OOWeaponFacingSet) availableFacings

Definition at line 9211 of file PlayerEntity.m.

9263{
9265 NSDictionary *shipyardInfo = [registry shipyardInfoForKey:[self shipDataKey]];
9266 unsigned available_facings = [shipyardInfo oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:[self weaponFacings]]; // use defaults explicitly
9267
9268 return available_facings & VALID_WEAPON_FACINGS;
9269}
#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 955 of file PlayerEntityLegacyScriptEngine.m.

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

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

◆ awardEquipment:

- (void) awardEquipment: (NSString *) equipString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ awardFuel:

- (void) awardFuel: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ awardShipKills:

- (void) awardShipKills: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ baseMass

- (GLfloat) baseMass

Definition at line 13699 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 167 of file PlayerEntityControls.m.

892{
893 if ([self hasHyperspaceMotor]) {
894 [self beginWitchspaceCountdown:hyperspaceMotorSpinTime];
895 }
896}

◆ beginWitchspaceCountdown:

- (void) beginWitchspaceCountdown: (int) spin_time

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

Referenced by PlayerShipBeginHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ blowUpStation

- (void) blowUpStation

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2257{
2258 StationEntity *mainStation = nil;
2259
2260 mainStation = [UNIVERSE station];
2261 if (mainStation != nil)
2262 {
2263 [UNIVERSE unMagicMainStation];
2264 [mainStation takeEnergyDamage:500000000.0 from:nil becauseOf:nil weaponIdentifier:@""]; // 500 million should do it!
2265 }
2266}
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 13699 of file PlayerEntity.m.

6786{
6787 return legalStatus;
6788}

◆ breakPatternPosition

- (HPVector) breakPatternPosition

Definition at line 13699 of file PlayerEntity.m.

4328{
4329 return HPvector_add(position,vectorToHPVector(quaternion_rotate_vector(quaternion_conjugate(orientation),forwardViewOffset)));
4330}
Vector quaternion_rotate_vector(Quaternion q, Vector v)
HPVector position
Definition Entity.h:112
Vector forwardViewOffset

◆ buySelectedItem

- (void) buySelectedItem

Definition at line 9211 of file PlayerEntity.m.

10171{
10172 GuiDisplayGen* gui = [UNIVERSE gui];
10173 NSString* key = [gui selectedRowKey];
10174
10175 if ([key hasPrefix:@"More:"])
10176 {
10177 int from_item = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
10178 NSString *weaponKey = [[key componentsSeparatedByString:@":"] oo_stringAtIndex:2];
10179
10180 [self setGuiToEquipShipScreen:from_item];
10181 if (weaponKey != nil)
10182 {
10183 [self highlightEquipShipScreenKey:weaponKey];
10184 }
10185 else
10186 {
10187 if ([gui selectedRow] < 0)
10188 [gui setSelectedRow:GUI_ROW_EQUIPMENT_START];
10189 if (from_item == 0)
10190 [gui setSelectedRow:GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT - 1];
10191 [self showInformationForSelectedUpgrade];
10192 }
10193
10194 return;
10195 }
10196
10197 NSString *itemText = [gui selectedRowText];
10198
10199 // FIXME: this is nuts, should be associating lines with keys in some sensible way. --Ahruman 20080311
10200 if ([itemText isEqual:FORWARD_FACING_STRING])
10202 if ([itemText isEqual:AFT_FACING_STRING])
10204 if ([itemText isEqual:PORT_FACING_STRING])
10206 if ([itemText isEqual:STARBOARD_FACING_STRING])
10208
10209 OOCreditsQuantity old_credits = credits;
10211 BOOL isRepair = [self hasEquipmentItem:[eqInfo damagedIdentifier]];
10212 if ([self tryBuyingItem:key])
10213 {
10214 if (credits == old_credits)
10215 {
10216 // laser pre-purchase, or free equipment
10217 [self playMenuNavigationDown];
10218 }
10219 else
10220 {
10221 [self playBuyCommodity];
10222 }
10223
10224 if(credits != old_credits || ![key hasPrefix:@"EQ_WEAPON_"])
10225 {
10226 // adjust time before playerBoughtEquipment gets to change credits dynamically
10227 // wind the clock forward by 10 minutes plus 10 minutes for every 60 credits spent
10228 NSUInteger adjust = 0;
10229 if (isRepair)
10230 {
10231 adjust = [eqInfo repairTime];
10232 }
10233 else
10234 {
10235 adjust = [eqInfo installTime];
10236 }
10237 double time_adjust = (old_credits > credits) ? (old_credits - credits) : 0.0;
10238 [UNIVERSE forceWitchspaceEntries];
10239 if (adjust == 0)
10240 {
10241 ship_clock_adjust += time_adjust + 600.0;
10242 }
10243 else
10244 {
10245 ship_clock_adjust += (double)adjust;
10246 }
10247
10248 [self doScriptEvent:OOJSID("playerBoughtEquipment") withArguments:[NSArray arrayWithObjects:key, [NSNumber numberWithLongLong:(old_credits - credits)], nil]];
10249 if (gui_screen == GUI_SCREEN_EQUIP_SHIP) //if we haven't changed gui screen inside playerBoughtEquipment
10250 {
10251 // show any change due to playerBoughtEquipment
10252 [self setGuiToEquipShipScreen:0];
10253 // then try to go back where we were
10254 [self highlightEquipShipScreenKey:key];
10255 }
10256
10257 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
10258 }
10259 }
10260 else
10261 {
10262 [self playCantBuyCommodity];
10263 }
10264}
@ 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:151
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 9211 of file PlayerEntity.m.

10750{
10751 current_cargo = [self cargoQuantityOnBoard];
10752}
OOCargoQuantity current_cargo

◆ canAddEquipment:inContext:

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

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

11497 :(NSString *)equipmentKey inContext:(NSString *)context
11498{
11499 if ([equipmentKey isEqualToString:@"EQ_RENOVATION"] && !(ship_trade_in_factor < 85 || [[[self shipSubEntityEnumerator] allObjects] count] < [self maxShipSubEntities])) return NO;
11500 if (![super canAddEquipment:equipmentKey inContext:context]) return NO;
11501
11502 NSArray *conditions = [[OOEquipmentType equipmentTypeWithIdentifier:equipmentKey] conditions];
11503 if (conditions != nil && ![self scriptTestConditions:conditions]) return NO;
11504
11505 return YES;
11506}
NSEnumerator * shipSubEntityEnumerator()
NSUInteger maxShipSubEntities()
Definition ShipEntity.m:792

◆ cancelDockingRequest:

- (void) cancelDockingRequest: (StationEntity *) stationForDocking

Definition at line 13699 of file PlayerEntity.m.

3620 :(StationEntity *)stationForDocking
3621{
3622 if (stationForDocking == nil) return;
3623 if (![stationForDocking isStation] || ![stationForDocking isKindOfClass:[StationEntity class]]) return;
3624 if ([self isDocked]) return;
3625 if (autopilot_engaged && [self targetStation] == stationForDocking) return;
3626 if (autopilot_engaged && [self targetStation] != stationForDocking)
3627 {
3628 [self disengageAutopilot];
3629 }
3631 {
3632 NSString *stationDockingClearanceStatus = [stationForDocking acceptDockingClearanceRequestFrom:self];
3633 if (stationDockingClearanceStatus != nil && [stationDockingClearanceStatus isEqualToString:@"DOCKING_CLEARANCE_CANCELLED"])
3634 {
3635 [self doScriptEvent:OOJSID("playerDockingClearanceCancelled")];
3636 }
3637 }
3638}
@ 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 167 of file PlayerEntityControls.m.

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

Referenced by PlayerShipCancelHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

2475{
2476 switch ([self status])
2477 {
2478 case STATUS_START_GAME:
2479 case STATUS_DOCKING:
2480 case STATUS_DOCKED:
2481 case STATUS_DEAD:
2482 case STATUS_ESCAPE_SEQUENCE:
2483 return NO;
2484
2485 default:
2486 return YES;
2487 }
2488}

◆ canScoop:

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

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

4946 :(ShipEntity *)other
4947{
4948 if (specialCargo) return NO;
4949 return [super canScoop:other];
4950}
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 13699 of file PlayerEntity.m.

8311{
8312 NSMutableArray *manifest = [NSMutableArray array];
8313 NSArray *list = [self cargoListForScripting];
8314 NSEnumerator *cargoEnum = nil;
8315 NSDictionary *commodity;
8316
8317 if (specialCargo) [manifest addObject:specialCargo];
8318
8319 for (cargoEnum = [list objectEnumerator]; (commodity = [cargoEnum nextObject]); )
8320 {
8321 NSInteger quantity = [commodity oo_integerForKey:@"quantity"];
8322 NSString *units = [commodity oo_stringForKey:@"unit"];
8323 NSString *commodityName = [commodity oo_stringForKey:@"displayName"];
8324 NSInteger containers = [commodity oo_intForKey:@"containers"];
8325 BOOL extended = ![units isEqualToString:DESC(@"cargo-tons-symbol")] && containers > 0;
8326
8327 if (extended) {
8328 [manifest addObject:OOExpandKey(@"manifest-cargo-quantity-extended", quantity, units, commodityName, containers)];
8329 } else {
8330 [manifest addObject:OOExpandKey(@"manifest-cargo-quantity", quantity, units, commodityName)];
8331 }
8332 }
8333
8334 return manifest;
8335}

◆ cargoListForScripting

- (NSArray *) cargoListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

8339{
8340 NSMutableArray *list = [NSMutableArray array];
8341
8342 NSUInteger i, j, commodityCount = [shipCommodityData count];
8343 OOCargoQuantity quantityInHold[commodityCount];
8344 OOCargoQuantity containersInHold[commodityCount];
8345 NSArray *goods = [shipCommodityData goods];
8346
8347 // following changed to work whether docked or not
8348 for (i = 0; i < commodityCount; i++)
8349 {
8350 quantityInHold[i] = [shipCommodityData quantityForGood:[goods oo_stringAtIndex:i]];
8351 containersInHold[i] = 0;
8352 }
8353 for (i = 0; i < [cargo count]; i++)
8354 {
8355 ShipEntity *container = [cargo objectAtIndex:i];
8356 j = [goods indexOfObject:[container commodityType]];
8357 quantityInHold[j] += [container commodityAmount];
8358 ++containersInHold[j];
8359 }
8360
8361 for (i = 0; i < commodityCount; i++)
8362 {
8363 if (quantityInHold[i] > 0)
8364 {
8365 NSMutableDictionary *commodity = [NSMutableDictionary dictionaryWithCapacity:4];
8366 NSString *symName = [goods oo_stringAtIndex:i];
8367 // commodity, quantity - keep consistency between .manifest and .contracts
8368 [commodity setObject:symName forKey:@"commodity"];
8369 [commodity setObject:[NSNumber numberWithUnsignedInt:quantityInHold[i]] forKey:@"quantity"];
8370 [commodity setObject:[NSNumber numberWithUnsignedInt:containersInHold[i]] forKey:@"containers"];
8371 [commodity setObject:[shipCommodityData nameForGood:symName] forKey:@"displayName"];
8372 [commodity setObject:DisplayStringForMassUnitForCommodity(symName) forKey:@"unit"];
8373 [list addObject:commodity];
8374 }
8375 }
8376
8377 return [[list copy] autorelease]; // return an immutable copy
8378}
OOCargoQuantity commodityAmount()
OOCommodityType commodityType()

Referenced by ManifestGetProperty().

+ Here is the caller graph for this function:

◆ cargoQuantityForType:

- (OOCargoQuantity) cargoQuantityForType: (OOCommodityType) type

Definition at line 9211 of file PlayerEntity.m.

10675 :(OOCommodityType)type
10676{
10677 OOCargoQuantity amount = [shipCommodityData quantityForGood:type];
10678
10679 if ([self status] != STATUS_DOCKED)
10680 {
10681 NSInteger i;
10682 OOCommodityType co_type;
10683 ShipEntity *cargoItem = nil;
10684
10685 for (i = [cargo count] - 1; i >= 0 ; i--)
10686 {
10687 cargoItem = [cargo objectAtIndex:i];
10688 co_type = [cargoItem commodityType];
10689 if ([co_type isEqualToString:type])
10690 {
10691 amount += [cargoItem commodityAmount];
10692 }
10693 }
10694 }
10695
10696 return amount;
10697}
NSMutableArray * cargo
Definition ShipEntity.h:361

◆ cargoQuantityOnBoard

- (OOCargoQuantity) cargoQuantityOnBoard
implementation

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

10756{
10757 if ([self specialCargo] != nil)
10758 {
10759 return [self maxAvailableCargoSpace];
10760 }
10761
10762 /*
10763 The cargo array is nil when the player ship is docked, due to action in unloadCargopods. For
10764 this reason, we must use a slightly more complex method to determine the quantity of cargo
10765 carried in this case - Nikos 20090830
10766
10767 Optimised this method, to compensate for increased usage - Kaks 20091002
10768 */
10769 OOCargoQuantity cargoQtyOnBoard = 0;
10770 NSString *good = nil;
10771
10772 foreach (good, [shipCommodityData goods])
10773 {
10774 OOCargoQuantity quantity = [shipCommodityData quantityForGood:good];
10775
10776 OOMassUnit commodityUnits = [shipCommodityData massUnitForGood:good];
10777
10778 if (commodityUnits != UNITS_TONS)
10779 {
10780 // calculate the number of pods that would be used
10781 // we're using integer math, so 99/100 = 0 , 100/100 = 1, etc...
10782
10783 assert(KILOGRAMS_PER_POD > MAX_KILOGRAMS_IN_SAFE && GRAMS_PER_POD > MAX_GRAMS_IN_SAFE); // otherwise we're in trouble!
10784
10785 if (commodityUnits == UNITS_KILOGRAMS) quantity = ((KILOGRAMS_PER_POD - MAX_KILOGRAMS_IN_SAFE - 1) + quantity) / KILOGRAMS_PER_POD;
10786 else quantity = ((GRAMS_PER_POD - MAX_GRAMS_IN_SAFE - 1) + quantity) / GRAMS_PER_POD;
10787 }
10788 cargoQtyOnBoard += quantity;
10789 }
10790 cargoQtyOnBoard += [[self cargo] count];
10791
10792 return cargoQtyOnBoard;
10793}
return self
#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 9211 of file PlayerEntity.m.

10627 :(int) addRemove
10628{
10629 if (addRemove == 0) return NO;
10630 addRemove = (addRemove > 0) ? 1 : -1; // change only by one berth at a time!
10631 // NSFO!
10632 //unsigned passenger_space = [[OOEquipmentType equipmentTypeWithIdentifier:@"EQ_PASSENGER_BERTH"] requiredCargoSpace];
10633 //if (passenger_space == 0) passenger_space = PASSENGER_BERTH_SPACE;
10634 if ((max_passengers < 1 && addRemove == -1) || ([self maxAvailableCargoSpace] - current_cargo < PASSENGER_BERTH_SPACE && addRemove == 1)) return NO;
10635 max_passengers += addRemove;
10636 max_cargo -= PASSENGER_BERTH_SPACE * addRemove;
10637 return YES;
10638}
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.

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

◆ checkEntityForMassLock:withScanClass:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

3334 :(Entity *)ent withScanClass:(int)theirClass
3335{
3336 BOOL massLocked = NO;
3337 BOOL entIsCloakedShip = [ent isShip] && [(ShipEntity *)ent isCloaked];
3338
3339 if (EXPECT_NOT([ent isStellarObject]))
3340 {
3342 if (EXPECT([stellar planetType] != STELLAR_TYPE_MINIATURE))
3343 {
3344 double dist = stellar->zero_distance;
3345 double rad = stellar->collision_radius;
3346 double factor = ([stellar isSun]) ? 2.0 : 4.0;
3347 // plus ensure mass lock when 25 km or less from the surface of small stellar bodies
3348 // dist is a square distance so it needs to be compared to (rad+25000) * (rad+25000)!
3349 if (dist < rad*rad*factor || dist < rad*rad + 50000*rad + 625000000 )
3350 {
3351 massLocked = YES;
3352 }
3353 }
3354 }
3355 else if (theirClass != CLASS_NO_DRAW)
3356 {
3357 if (EXPECT_NOT (entIsCloakedShip))
3358 {
3359 theirClass = CLASS_NO_DRAW;
3360 }
3361 }
3362
3364 {
3365 switch (theirClass)
3366 {
3367 case CLASS_NO_DRAW:
3368 // cloaked ships do mass lock! - Nikos 20200718
3369 if (entIsCloakedShip && ![ent isPlayer])
3370 {
3371 massLocked = YES;
3372 }
3373 break;
3374 case CLASS_PLAYER:
3375 case CLASS_BUOY:
3376 case CLASS_ROCK:
3377 case CLASS_CARGO:
3378 case CLASS_MINE:
3379 case CLASS_VISUAL_EFFECT:
3380 break;
3381
3382 case CLASS_THARGOID:
3383 case CLASS_MISSILE:
3384 case CLASS_STATION:
3385 case CLASS_POLICE:
3386 case CLASS_MILITARY:
3387 case CLASS_WORMHOLE:
3388 default:
3389 massLocked = YES;
3390 break;
3391 }
3392 }
3393
3394 return massLocked;
3395}
#define SCANNER_MAX_RANGE2
Definition Entity.h:52
#define EXPECT(x)
@ STELLAR_TYPE_MINIATURE
GLfloat collision_radius
Definition Entity.h:111
BOOL isSun()
Definition Entity.m:167
GLfloat zero_distance
Definition Entity.h:108
BOOL isStellarObject()
Definition Entity.m:179

◆ checkForShips:

- (void) checkForShips: (NSString *) roleString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ checkKeyPress:

- (BOOL) checkKeyPress: (NSArray*) key_def

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

613 :(NSArray*)key_def
614{
615 return [self checkKeyPress:key_def fKey_only:NO ignore_ctrl:NO];
616}

◆ checkKeyPress:fKey_only:

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

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

619 :(NSArray*)key_def fKey_only:(BOOL)fKey_only
620{
621 return [self checkKeyPress:key_def fKey_only:fKey_only ignore_ctrl:NO];
622}

◆ 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 167 of file PlayerEntityControls.m.

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

◆ checkKeyPress:ignore_ctrl:

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

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

625 :(NSArray*)key_def ignore_ctrl:(BOOL)ignore_ctrl
626{
627 return [self checkKeyPress:key_def fKey_only:NO ignore_ctrl:ignore_ctrl];
628}

◆ checkNavKeyPress:

- (BOOL) checkNavKeyPress: (NSArray*) key_def

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ 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 13699 of file PlayerEntity.m.

3519{
3520 if (script_time <= script_time_check) return;
3521
3522 if ([self status] != STATUS_IN_FLIGHT)
3523 {
3524 switch (gui_screen)
3525 {
3526 // Screens where no world script tickles are performed
3527 case GUI_SCREEN_MAIN:
3528 case GUI_SCREEN_INTRO1:
3529 case GUI_SCREEN_SHIPLIBRARY:
3530 case GUI_SCREEN_KEYBOARD:
3531 case GUI_SCREEN_NEWGAME:
3532 case GUI_SCREEN_OXZMANAGER:
3533 case GUI_SCREEN_MARKET:
3534 case GUI_SCREEN_MARKETINFO:
3535 case GUI_SCREEN_OPTIONS:
3536 case GUI_SCREEN_GAMEOPTIONS:
3537 case GUI_SCREEN_LOAD:
3538 case GUI_SCREEN_SAVE:
3539 case GUI_SCREEN_SAVE_OVERWRITE:
3540 case GUI_SCREEN_STICKMAPPER:
3541 case GUI_SCREEN_STICKPROFILE:
3542 case GUI_SCREEN_MISSION:
3543 case GUI_SCREEN_REPORT:
3544 case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
3545 case GUI_SCREEN_KEYBOARD_CONFIG:
3546 case GUI_SCREEN_KEYBOARD_ENTRY:
3547 case GUI_SCREEN_KEYBOARD_LAYOUT:
3548 return;
3549
3550 // Screens from which it's safe to jump to the mission screen
3551// case GUI_SCREEN_CONTRACTS:
3552 case GUI_SCREEN_EQUIP_SHIP:
3553 case GUI_SCREEN_INTERFACES:
3554 case GUI_SCREEN_MANIFEST:
3555 case GUI_SCREEN_SHIPYARD:
3556 case GUI_SCREEN_LONG_RANGE_CHART:
3557 case GUI_SCREEN_SHORT_RANGE_CHART:
3558 case GUI_SCREEN_STATUS:
3559 case GUI_SCREEN_SYSTEM_DATA:
3560 // Test passed, we can run scripts. Nothing to do here.
3561 break;
3562 }
3563 }
3564
3565 // Test either passed or never ran, run scripts.
3566 [self checkScript];
3568}
double script_time_check
double script_time
double script_time_interval

◆ clearAlertFlags

- (void) clearAlertFlags

Definition at line 13699 of file PlayerEntity.m.

5759{
5760 alertFlags = 0;
5761}
OOAlertFlags alertFlags

◆ clearedToDock

- (BOOL) clearedToDock

Definition at line 9211 of file PlayerEntity.m.

◆ clearExtraGuiScreenKeys:key:

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

Definition at line 9211 of file PlayerEntity.m.

13358 :(OOGUIScreenID)gui key:(NSString *)key
13359{
13360 NSMutableArray *keydefs = [extraGuiScreenKeys objectForKey:[NSString stringWithFormat:@"%d",gui]];
13361 NSInteger i = [keydefs count];
13362 NSDictionary *def = nil;
13363 while (i--)
13364 {
13365 def = [keydefs objectAtIndex:i];
13366 if (def && [[def oo_stringForKey:@"name"] isEqualToString:key])
13367 {
13368 [keydefs removeObjectAtIndex:i];
13369 break;
13370 }
13371 }
13372 // do we have to put the array back, or does the reference update the source?
13373}
OOGUIScreenID

Referenced by GlobalClearExtraGuiScreenKeys().

+ Here is the caller graph for this function:

◆ clearExtraMissionKeys

- (void) clearExtraMissionKeys

Definition at line 9211 of file PlayerEntity.m.

13339{
13340 [extraMissionKeys release];
13342}
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.

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

◆ clearMissionDescriptionForMission:

- (void) clearMissionDescriptionForMission: (NSString *) key

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

893 :(NSString *)key
894{
895 if (!key)
896 {
897 OOLogERR(kOOLogScriptMissionDescNoKey, @"in %@, mission key not set", CurrentScriptDesc());
898 return;
899 }
900
901 if (![mission_variables objectForKey:key]) return;
902
903 [mission_variables removeObjectForKey:key];
904}
#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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clearMissionScreenID

- (void) clearMissionScreenID

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2448{
2449 [_missionScreenID release];
2450 _missionScreenID = nil;
2451}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ clearPlanetSearchString

- (void) clearPlanetSearchString

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

820{
821 [[UNIVERSE gameView] resetTypedString];
822 if (planetSearchString) [planetSearchString release];
823 planetSearchString = nil;
824}

◆ clearRoleFromPlayer:

- (void) clearRoleFromPlayer: (BOOL) includingLongRange

Definition at line 13699 of file PlayerEntity.m.

5085 :(BOOL)includingLongRange
5086{
5087 NSUInteger slot = Ranrot() % [roleWeights count];
5088 if (!includingLongRange)
5089 {
5090 NSString *role = [roleWeights objectAtIndex:slot];
5091 // long range roles cleared at 1/2 normal rate
5092 if ([role hasSuffix:@"+"] && randf() > 0.5)
5093 {
5094 return;
5095 }
5096 }
5097 [roleWeights replaceObjectAtIndex:slot withObject:@"player-unknown"];
5098}

◆ clearRolesFromPlayer:

- (void) clearRolesFromPlayer: (float) chance

Definition at line 13699 of file PlayerEntity.m.

5101 :(float)chance
5102{
5103 NSUInteger i, count=[roleWeights count];
5104 for (i = 0; i < count; i++)
5105 {
5106 if (randf() < chance)
5107 {
5108 [roleWeights replaceObjectAtIndex:i withObject:@"player-unknown"];
5109 }
5110 }
5111}

◆ clearTargetMemory

- (void) clearTargetMemory

Definition at line 9211 of file PlayerEntity.m.

12303{
12304 NSUInteger memoryCount = [target_memory count];
12305 for (NSUInteger i = 0; i < PLAYER_TARGET_MEMORY_SIZE; i++)
12306 {
12307 if (i < memoryCount)
12308 {
12309 [target_memory replaceObjectAtIndex:i withObject:[NSNull null]];
12310 }
12311 else
12312 {
12313 [target_memory addObject:[NSNull null]];
12314 }
12315 }
12317}

◆ clock_days_number

- (NSNumber *) clock_days_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clock_hours_number

- (NSNumber *) clock_hours_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clock_mins_number

- (NSNumber *) clock_mins_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clock_number

- (NSNumber *) clock_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clock_secs_number

- (NSNumber *) clock_secs_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clockAdjusting

- (BOOL) clockAdjusting

Definition at line 13699 of file PlayerEntity.m.

4862{
4863 return ship_clock_adjust > 0;
4864}

◆ clockTime

- (double) clockTime

Definition at line 13699 of file PlayerEntity.m.

4850{
4851 return ship_clock;
4852}
double ship_clock

Referenced by ClockGetProperty().

+ Here is the caller graph for this function:

◆ clockTimeAdjusted

- (double) clockTimeAdjusted

Definition at line 13699 of file PlayerEntity.m.

4856{
4858}

Referenced by HeadUpDisplay::hudDrawReticleOnTarget.

+ Here is the caller graph for this function:

◆ collectBountyFor:

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

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6825 :(ShipEntity *)other
6826{
6827 if ([self status] == STATUS_DEAD) return; // no bounty if we died while trying
6828
6829 if (other == nil || [other isSubEntity]) return;
6830
6831 if (other == [UNIVERSE station])
6832 {
6833 // there is no way the player can destroy the main station
6834 // and so the explosion will be cancelled, so there shouldn't
6835 // be a kill award
6836 return;
6837 }
6838
6839 if ([self isCloaked])
6840 {
6841 // no-one knows about it; no award
6842 return;
6843 }
6844
6845 OOCreditsQuantity score = 10 * [other bounty];
6846 OOScanClass killClass = [other scanClass]; // **tgape** change (+line)
6847 BOOL killAward = [other countsAsKill];
6848
6849 if ([other isPolice]) // oops, we shot a copper!
6850 {
6851 [self markAsOffender:64 withReason:kOOLegalStatusReasonAttackedPolice];
6852 }
6853
6854 BOOL killIsCargo = ((killClass == CLASS_CARGO) && ([other commodityAmount] > 0) && ![other isHulk]);
6855 if ((killIsCargo) || (killClass == CLASS_BUOY) || (killClass == CLASS_ROCK))
6856 {
6857 // EMMSTRAN: no killaward (but full bounty) for tharglets?
6858 if (![other hasRole:@"tharglet"]) // okay, we'll count tharglets as proper kills
6859 {
6860 score /= 10; // reduce bounty awarded
6861 killAward = NO; // don't award a kill
6862 }
6863 }
6864
6865 credits += score;
6866
6867 if (score > 9)
6868 {
6869 NSString *bonusMessage = OOExpandKey(@"bounty-awarded", score, credits);
6870 [UNIVERSE addDelayedMessage:bonusMessage forCount:6 afterDelay:0.15];
6871 }
6872
6873 if (killAward)
6874 {
6875 ship_kills++;
6876 if ((ship_kills % 256) == 0)
6877 {
6878 // congratulations method needs to be delayed a fraction of a second
6879 [UNIVERSE addDelayedMessage:DESC(@"right-on-commander") forCount:4 afterDelay:0.2];
6880 }
6881 }
6882}
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 13699 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];
1072 if (pGood+pBad+pUnknown != MAX_CONTRACT_REP)
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]];
1136 NSEnumerator *wormholes = [scannedWormholes objectEnumerator];
1137 WormholeEntity *wh = nil;
1138 foreach(wh, wormholes)
1139 {
1140 [wormholeDicts addObject:[wh getDict]];
1141 }
1142 [result setObject:wormholeDicts forKey:@"wormholes"];
1143
1144 // docked station
1145 StationEntity *dockedStation = [self dockedStation];
1146 [result setObject:dockedStation != nil ? [dockedStation primaryRole]:(NSString *)@"" forKey:@"docked_station_role"];
1147 if (dockedStation)
1148 {
1149 HPVector dpos = [dockedStation position];
1150 [result setObject:ArrayFromHPVector(dpos) forKey:@"docked_station_position"];
1151 }
1152 else
1153 {
1154 [result setObject:[NSArray array] forKey:@"docked_station_position"];
1155 }
1156 [result setObject:[UNIVERSE getStationMarkets] forKey:@"station_markets"];
1157
1158 // scenario information
1159 if (scenarioKey != nil)
1160 {
1161 [result setObject:scenarioKey forKey:@"scenario"];
1162 }
1163
1164 // create checksum
1166// TODO: should checksum checks be removed?
1167// munge_checksum(galaxy_seed.a); munge_checksum(galaxy_seed.b); munge_checksum(galaxy_seed.c);
1168// munge_checksum(galaxy_seed.d); munge_checksum(galaxy_seed.e); munge_checksum(galaxy_seed.f);
1173
1174 if (mission_variables != nil)
1175 {
1176 munge_checksum([[mission_variables description] length]);
1177 }
1178 if (equipment != nil)
1179 {
1180 munge_checksum([[equipment description] length]);
1181 }
1182
1183 int final_checksum = munge_checksum([[self shipDataKey] length]);
1184
1185 //set checksum
1186 [result oo_setInteger:final_checksum forKey:@"checksum"];
1187
1188 return result;
1189}
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_)

◆ 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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ commanderLegalStatus_string

- (NSString *) commanderLegalStatus_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ commanderName

- (NSString *) commanderName

Definition at line 9211 of file PlayerEntity.m.

13045{
13046 return _commanderName;
13047}
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 955 of file PlayerEntityLegacyScriptEngine.m.

1156{
1157 return [self commanderName];
1158}

◆ commanderRank_string

- (NSString *) commanderRank_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ commanderSelector

- (NSString *) commanderSelector

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 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 955 of file PlayerEntityLegacyScriptEngine.m.

1168{
1169 return [self name];
1170}

◆ commanderShipDisplayName_string

- (NSString *) commanderShipDisplayName_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1174{
1175 return [self displayName];
1176}

◆ commLog

- (NSMutableArray *) commLog

◆ commodityScriptNamed:

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

Definition at line 9211 of file PlayerEntity.m.

12860 :(NSString *)scriptName
12861{
12862 if (scriptName == nil)
12863 {
12864 return nil;
12865 }
12866 OOScript *cscript = nil;
12867 if ((cscript = [commodityScripts objectForKey:scriptName]))
12868 {
12869 return cscript;
12870 }
12871 cscript = [OOScript jsScriptFromFileNamed:scriptName properties:nil];
12872 if (cscript != nil)
12873 {
12874 // storing it in here retains it
12875 [commodityScripts setObject:cscript forKey:scriptName];
12876 }
12877 else
12878 {
12879 OOLog(@"script.commodityScript.load",@"Could not load script %@",scriptName);
12880 }
12881 return cscript;
12882}
NSMutableDictionary * commodityScripts

◆ commsMessage:

- (void) commsMessage: (NSString *) valueString

Reimplemented from ShipEntity.

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ commsMessageByUnpiloted:

- (void) commsMessageByUnpiloted: (NSString *) valueString

Reimplemented from ShipEntity.

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ 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 13699 of file PlayerEntity.m.

2491 :(Entity *)otherEntity
2492{
2493 return NSOrderedDescending; // always the most near
2494}

◆ compassMode

- (OOCompassMode) compassMode

◆ compassTarget

- (Entity *) compassTarget

◆ compassTargetLabel

- (NSString *) compassTargetLabel

Definition at line 13699 of file PlayerEntity.m.

5244{
5245 switch (compassMode)
5246 {
5247 case COMPASS_MODE_INACTIVE:
5248 return @"";
5249 case COMPASS_MODE_BASIC:
5250 return @"";
5251 case COMPASS_MODE_BEACONS:
5252 {
5253 Entity *target = [self compassTarget];
5254 if (target)
5255 {
5256 return [(Entity <OOBeaconEntity> *)target beaconLabel];
5257 }
5258 return @"";
5259 }
5260 case COMPASS_MODE_PLANET:
5261 return [[UNIVERSE planet] name];
5262 case COMPASS_MODE_SUN:
5263 return [[UNIVERSE sun] name];
5264 case COMPASS_MODE_STATION:
5265 return [[UNIVERSE station] displayName];
5266 case COMPASS_MODE_TARGET:
5267 return DESC(@"oolite-beacon-label-target");
5268 }
5269 return @"";
5270}

◆ completeSetUp

- (void) completeSetUp

Definition at line 13699 of file PlayerEntity.m.

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

◆ completeSetUpAndSetTarget:

- (void) completeSetUpAndSetTarget: (BOOL) setTarget

Definition at line 13699 of file PlayerEntity.m.

2255 :(BOOL)setTarget
2256{
2258
2259 [self setDockedStation:[UNIVERSE station]];
2260 [self setLastAegisLock:[UNIVERSE planet]];
2261 [self validateCustomEquipActivationArray];
2262
2263 JSContext *context = OOJSAcquireContext();
2264 [self doWorldScriptEvent:OOJSID("startUp") inContext:context withArguments:NULL count:0 timeLimit:MAX(0.0, [[NSUserDefaults standardUserDefaults] oo_floatForKey:@"start-script-limit-value" defaultValue:kOOJSLongTimeLimit])];
2265 OOJSRelinquishContext(context);
2266}

◆ consoleMessage3s:

- (void) consoleMessage3s: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ consoleMessage6s:

- (void) consoleMessage6s: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ 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 13699 of file PlayerEntity.m.

8453{
8454 return [self contractsListForScriptingFromArray:contracts forCargo:YES];
8455}

◆ 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 13699 of file PlayerEntity.m.

8397 :(NSArray *) contracts_array forCargo:(BOOL)forCargo
8398{
8399 NSMutableArray *result = [NSMutableArray array];
8400 NSUInteger i;
8401
8402 for (i = 0; i < [contracts_array count]; i++)
8403 {
8404 NSMutableDictionary *contract = [NSMutableDictionary dictionaryWithCapacity:10];
8405 NSDictionary *dict = [contracts_array oo_dictionaryAtIndex:i];
8406 if (forCargo)
8407 {
8408 // commodity, quantity - keep consistency between .manifest and .contracts
8409 [contract setObject:[dict oo_stringForKey:CARGO_KEY_TYPE] forKey:@"commodity"];
8410 [contract setObject:[NSNumber numberWithUnsignedInt:[dict oo_intForKey:CARGO_KEY_AMOUNT]] forKey:@"quantity"];
8411 [contract setObject:[dict oo_stringForKey:CARGO_KEY_DESCRIPTION] forKey:@"description"];
8412 }
8413 else
8414 {
8415 [contract setObject:[dict oo_stringForKey:PASSENGER_KEY_NAME] forKey:PASSENGER_KEY_NAME];
8416 [contract setObject:[NSNumber numberWithUnsignedInt:[dict oo_unsignedIntForKey:CONTRACT_KEY_RISK]] forKey:CONTRACT_KEY_RISK];
8417 }
8418
8419 OOSystemID planet = [dict oo_intForKey:CONTRACT_KEY_DESTINATION];
8420 NSString *planetName = [UNIVERSE getSystemName:planet];
8421 [contract setObject:[NSNumber numberWithUnsignedInt:planet] forKey:CONTRACT_KEY_DESTINATION];
8422 [contract setObject:planetName forKey:@"destinationName"];
8423 planet = [dict oo_intForKey:CONTRACT_KEY_START];
8424 planetName = [UNIVERSE getSystemName: planet];
8425 [contract setObject:[NSNumber numberWithUnsignedInt:planet] forKey:CONTRACT_KEY_START];
8426 [contract setObject:planetName forKey:@"startName"];
8427
8428 int dest_eta = [dict oo_doubleForKey:CONTRACT_KEY_ARRIVAL_TIME] - ship_clock;
8429 [contract setObject:[NSNumber numberWithInt:dest_eta] forKey:@"eta"];
8430 [contract setObject:[UNIVERSE shortTimeDescription:dest_eta] forKey:@"etaDescription"];
8431 [contract setObject:[NSNumber numberWithInt:[dict oo_intForKey:CONTRACT_KEY_PREMIUM]] forKey:CONTRACT_KEY_PREMIUM];
8432 [contract setObject:[NSNumber numberWithInt:[dict oo_intForKey:CONTRACT_KEY_FEE]] forKey:CONTRACT_KEY_FEE];
8433 [result addObject:contract];
8434 }
8435
8436 return [[result copy] autorelease]; // return an immutable copy
8437}

◆ 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 13699 of file PlayerEntity.m.

4915{
4916 unsigned n_missiles = 0;
4917 unsigned i;
4918 for (i = 0; i < max_missiles; i++)
4919 {
4920 if (missile_entity[i])
4921 n_missiles++;
4922 }
4923 return n_missiles;
4924}

◆ createCargoPodWithType:andAmount:

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

Definition at line 13699 of file PlayerEntity.m.

316 :(OOCommodityType)type andAmount:(OOCargoQuantity)amount
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 13699 of file PlayerEntity.m.

6537{
6538 ProxyPlayerEntity *result = (ProxyPlayerEntity *)[[UNIVERSE newShipWithName:[self shipDataKey] usePlayerProxy:YES] autorelease];
6539
6540 if (result != nil)
6541 {
6542 [result setPosition:[self position]];
6543 [result setScanClass:CLASS_NEUTRAL];
6544 [result setOrientation:[self normalOrientation]];
6545 [result setVelocity:[self velocity]];
6546 [result setSpeed:[self flightSpeed]];
6547 [result setDesiredSpeed:[self flightSpeed]];
6548 [result setRoll:flightRoll];
6549 [result setBehaviour:BEHAVIOUR_IDLE];
6550 [result switchAITo:@"nullAI.plist"]; // fly straight on
6551 [result setTemperature:[self temperature]];
6552 [result copyValuesFromPlayer:self];
6553 }
6554
6555 return result;
6556}
void setVelocity:(Vector vel)
Definition Entity.m:757
void setOrientation:(Quaternion quat)
Definition Entity.m:725
void setPosition:(HPVector posn)
Definition Entity.m:647
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.

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

◆ 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 13699 of file PlayerEntity.m.

6144{
6145 return [self laserPortOffset:currentWeaponFacing];
6146}

◆ currentPrimedEquipment

- (NSString *) currentPrimedEquipment

Definition at line 13699 of file PlayerEntity.m.

8187{
8188 NSString *result = @"";
8189 NSUInteger c = [eqScripts count];
8190 if (primedEquipment != c)
8191 {
8192 result = [[eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0];
8193 }
8194 return result;
8195}

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 13699 of file PlayerEntity.m.

6262{
6263 return [self weaponForFacing:currentWeaponFacing];
6264}

◆ currentWeaponStats

- (void) currentWeaponStats

Definition at line 13699 of file PlayerEntity.m.

6121{
6122 OOWeaponType currentWeapon = [self currentWeapon];
6123 // Did find & correct a minor mismatch between player and NPC weapon stats. This is the resulting code - Kaks 20101027
6124
6125 // Basic stats: weapon_damage & weaponRange (weapon_recharge_rate is not used by the player)
6126 [self setWeaponDataFromType:currentWeapon];
6127}
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 9211 of file PlayerEntity.m.

11552{
11553 return customEquipActivation;
11554}
NSMutableArray * customEquipActivation

◆ customViewDescription

- (NSString *) customViewDescription

◆ customViewForwardVector

- (Vector) customViewForwardVector

◆ customViewMatrix

- (OOMatrix) customViewMatrix

◆ customViewOffset

- (Vector) customViewOffset

◆ customViewPanDown:

- (void) customViewPanDown: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12540 :(OOScalar) angle
12541{
12543 [self setCustomViewData];
12544 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12545}
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:

- (void) customViewPanLeft: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12548 :(OOScalar) angle
12549{
12551 [self setCustomViewData];
12552 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12553}
Vector customViewUpVector

◆ customViewPanRight:

- (void) customViewPanRight: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12556 :(OOScalar) angle
12557{
12559 [self setCustomViewData];
12560 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12561}

◆ customViewPanUp:

- (void) customViewPanUp: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12532 :(OOScalar) angle
12533{
12535 [self setCustomViewData];
12536 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12537}

◆ customViewQuaternion

- (Quaternion) customViewQuaternion

◆ customViewRightVector

- (Vector) customViewRightVector

◆ customViewRollLeft:

- (void) customViewRollLeft: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12520 :(OOScalar) angle
12521{
12523 OOScalar m = magnitude(customViewOffset);
12525 [self setCustomViewData];
12527 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12529}

◆ customViewRollRight:

- (void) customViewRollRight: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12508 :(OOScalar) angle
12509{
12511 OOScalar m = magnitude(customViewOffset);
12513 [self setCustomViewData];
12515 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12517}

◆ customViewRotateDown:

- (void) customViewRotateDown: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12496 :(OOScalar) angle
12497{
12499 OOScalar m = magnitude(customViewOffset);
12501 [self setCustomViewData];
12503 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12505}

◆ customViewRotateLeft:

- (void) customViewRotateLeft: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12460 :(OOScalar) angle
12461{
12463 OOScalar m = magnitude(customViewOffset);
12465 [self setCustomViewData];
12467 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12469}

◆ customViewRotateRight:

- (void) customViewRotateRight: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12472 :(OOScalar) angle
12473{
12475 OOScalar m = magnitude(customViewOffset);
12477 [self setCustomViewData];
12479 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12481}

◆ customViewRotateUp:

- (void) customViewRotateUp: (OOScalar) angle

Definition at line 9211 of file PlayerEntity.m.

12484 :(OOScalar) angle
12485{
12487 OOScalar m = magnitude(customViewOffset);
12489 [self setCustomViewData];
12491 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12493}

◆ customViewRotationCenter

- (Vector) customViewRotationCenter

◆ customViewUpVector

- (Vector) customViewUpVector

◆ customViewZoomIn:

- (void) customViewZoomIn: (OOScalar) rate

Definition at line 9211 of file PlayerEntity.m.

12434 :(OOScalar) rate
12435{
12437 customViewOffset = vector_multiply_scalar(customViewOffset, 1.0/rate);
12438 OOScalar m = magnitude(customViewOffset);
12440 {
12442 }
12444}
#define CUSTOM_VIEW_MAX_ZOOM_IN

◆ customViewZoomOut:

- (void) customViewZoomOut: (OOScalar) rate

Definition at line 9211 of file PlayerEntity.m.

12447 :(OOScalar) rate
12448{
12450 customViewOffset = vector_multiply_scalar(customViewOffset, rate);
12451 OOScalar m = magnitude(customViewOffset);
12453 {
12455 }
12457}
#define CUSTOM_VIEW_MAX_ZOOM_OUT

◆ cycleNextMultiFunctionDisplay:

- (void) cycleNextMultiFunctionDisplay: (NSUInteger) index

Definition at line 13699 of file PlayerEntity.m.

5541 :(NSUInteger) index
5542{
5543 if ([[self hud] mfdCount] == 0) return;
5544 NSArray *keys = [multiFunctionDisplayText allKeys];
5545 NSString *key = nil;
5546 if ([keys count] == 0)
5547 {
5548 [self setMultiFunctionDisplay:index toKey:nil];
5549 return;
5550 }
5551 id current = [multiFunctionDisplaySettings objectAtIndex:index];
5552 if (current == [NSNull null])
5553 {
5554 key = [keys objectAtIndex:0];
5555 [self setMultiFunctionDisplay:index toKey:key];
5556 }
5557 else
5558 {
5559 NSUInteger cIndex = [keys indexOfObject:current];
5560 if (cIndex == NSNotFound || cIndex + 1 >= [keys count])
5561 {
5562 key = nil;
5563 [self setMultiFunctionDisplay:index toKey:nil];
5564 }
5565 else
5566 {
5567 key = [keys objectAtIndex:(cIndex+1)];
5568 [self setMultiFunctionDisplay:index toKey:key];
5569 }
5570 }
5571 JSContext *context = OOJSAcquireContext();
5572 jsval keyVal = OOJSValueFromNativeObject(context,key);
5573 ShipScriptEvent(context, self, "mfdKeyChanged", INT_TO_JSVAL(activeMFD), keyVal);
5574 OOJSRelinquishContext(context);
5575}
#define ShipScriptEvent(context, ship, event,...)
NSUInteger activeMFD

◆ cyclePreviousMultiFunctionDisplay:

- (void) cyclePreviousMultiFunctionDisplay: (NSUInteger) index

Definition at line 13699 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:([keys count]-1)];
5592 [self setMultiFunctionDisplay:index toKey:key];
5593 }
5594 else
5595 {
5596 NSUInteger cIndex = [keys indexOfObject:current];
5597 if (cIndex == NSNotFound || cIndex == 0)
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}

◆ d100_number

- (NSNumber *) d100_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ d256_number

- (NSNumber *) d256_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ deactivateCloakingDevice

- (void) deactivateCloakingDevice

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6054{
6055 if (![self hasCloakingDevice]) return;
6056
6057 [super deactivateCloakingDevice];
6058 [UNIVERSE setCurrentPostFX:[UNIVERSE colorblindMode]];
6059 [UNIVERSE addMessage:DESC(@"cloak-off") forCount:2];
6060 [self playCloakingDeviceOff];
6061}

◆ dealloc

- (void) dealloc
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

2377{
2379 DESTROY(hud);
2383
2387
2390
2396
2398
2400
2414
2418
2422
2424
2427
2430
2432
2434
2435 [self destroySound];
2436
2439
2440 int i;
2441 for (i = 0; i < PLAYER_MAX_MISSILES; i++) DESTROY(missile_entity[i]);
2442 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++) DESTROY(trumble[i]);
2443
2450
2454
2456
2457 [super dealloc];
2458}
#define DESTROY(x)
Definition OOCocoa.h:77
#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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ debugOff

- (void) debugOff

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2419{
2420 OOLog(kOOLogDebugOnOff, @"%@", @"SCRIPT debug messages OFF");
2422}
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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ deciCredits

- (OOCreditsQuantity) deciCredits

Definition at line 13699 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 955 of file PlayerEntityLegacyScriptEngine.m.

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

+ Here is the caller graph for this function:

◆ deferredInit

- (void) deferredInit

Definition at line 13699 of file PlayerEntity.m.

1829{
1830 NSAssert(gOOPlayer == self, @"Expected only one PlayerEntity to exist at a time.");
1831 NSAssert([super initWithKey:PLAYER_SHIP_DESC definition:[NSDictionary dictionary]] == self, @"PlayerEntity requires -[ShipEntity initWithKey:definition:] to return unmodified self.");
1832
1834#if OO_FOV_INFLIGHT_CONTROL_ENABLED
1835 fov_delta = 2.0; // multiply by 2 each second
1836#endif
1837
1838 compassMode = COMPASS_MODE_BASIC;
1839
1841
1842 isPlayer = YES;
1843
1844 [self setStatus:STATUS_START_GAME];
1845
1846 int i;
1847 for (i = 0; i < PLAYER_MAX_MISSILES; i++)
1848 {
1849 missile_entity[i] = nil;
1850 }
1851 [self setUpAndConfirmOK:NO];
1852
1853 save_path = nil;
1854
1855 scoopsActive = NO;
1856
1858
1860 dockingReport = [[NSMutableString alloc] init];
1861 [hud resetGuis:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionary], @"message_gui",
1862 [NSDictionary dictionary], @"comm_log_gui", nil]];
1863
1864 [self initControls];
1865}
#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.

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

◆ deleteKeySetting:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ describeStickDict:

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

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

529 : (NSDictionary *)stickDict
530{
531 NSString *desc=nil;
532 if(stickDict)
533 {
534 int thingNumber=[(NSNumber *)[stickDict objectForKey: STICK_AXBUT]
535 intValue];
536 int stickNumber=[(NSNumber *)[stickDict objectForKey: STICK_NUMBER]
537 intValue];
538 // Button or axis?
539 if([(NSNumber *)[stickDict objectForKey: STICK_ISAXIS] boolValue])
540 {
541 desc=[NSString stringWithFormat: @"Stick %d axis %d",
542 stickNumber+1, thingNumber+1];
543 }
544 else if(thingNumber >= MAX_REAL_BUTTONS)
545 {
546 static const char dir[][6] = { "up", "right", "down", "left" };
547 desc=[NSString stringWithFormat: @"Stick %d hat %d %s",
548 stickNumber+1, (thingNumber - MAX_REAL_BUTTONS) / 4 + 1,
549 dir[thingNumber & 3]];
550 }
551 else
552 {
553 desc=[NSString stringWithFormat: @"Stick %d button %d",
554 stickNumber+1, thingNumber+1];
555 }
556 }
557 return desc;
558}
#define STICK_ISAXIS
#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 13699 of file PlayerEntity.m.

4885{
4887}
NSString * ClockToString(double clock, BOOL adjusting)

◆ dial_clock_adjusted

- (NSString *) dial_clock_adjusted

Definition at line 13699 of file PlayerEntity.m.

4891{
4893}

◆ dial_fpsinfo

- (NSString *) dial_fpsinfo

Definition at line 13699 of file PlayerEntity.m.

4897{
4898 unsigned fpsVal = fps_counter;
4899 return [NSString stringWithFormat:@"FPS: %3d", fpsVal];
4900}

◆ dial_objinfo

- (NSString *) dial_objinfo

Definition at line 13699 of file PlayerEntity.m.

4904{
4905 NSString *result = [NSString stringWithFormat:@"Entities: %3ld", [UNIVERSE entityCount]];
4906#ifndef NDEBUG
4907 result = [NSString stringWithFormat:@"%@ (%d, %zu KiB, avg %lu bytes)", result, gLiveEntityCount, gTotalEntityMemory >> 10, gTotalEntityMemory / gLiveEntityCount];
4908#endif
4909
4910 return result;
4911}

◆ dialAftShield

- (GLfloat) dialAftShield

Definition at line 13699 of file PlayerEntity.m.

4753{
4754 if (EXPECT_NOT([self maxAftShieldLevel] <= 0))
4755 {
4756 return 0.0;
4757 }
4758 GLfloat result = aft_shield / [self maxAftShieldLevel];
4759 return OOClamp_0_1_f(result);
4760}
float maxAftShieldLevel()

◆ dialAltitude

- (GLfloat) dialAltitude

Definition at line 13699 of file PlayerEntity.m.

4832{
4833 if ([self isDocked]) return 0.0f;
4834
4835 // find nearest planet type entity...
4836 assert(UNIVERSE != nil);
4837
4838 Entity *nearestPlanet = [self findNearestStellarBody];
4839 if (nearestPlanet == nil) return 1.0f;
4840
4841 GLfloat zd = nearestPlanet->zero_distance;
4842 GLfloat cr = nearestPlanet->collision_radius;
4843 GLfloat alt = sqrt(zd) - cr;
4844
4845 return OOClamp_0_1_f(alt / (GLfloat)PLAYER_DIAL_MAX_ALTITUDE);
4846}
#define PLAYER_DIAL_MAX_ALTITUDE

◆ dialCustomColor:

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

Definition at line 13699 of file PlayerEntity.m.

4586 :(NSString *)dialKey
4587{
4588 return [OOColor colorWithDescription:[customDialSettings objectForKey:dialKey]];
4589}
OOColor * colorWithDescription:(id description)
Definition OOColor.m:127

◆ dialCustomFloat:

- (float) dialCustomFloat: (NSString *) dialKey

Definition at line 13699 of file PlayerEntity.m.

4574 :(NSString *)dialKey
4575{
4576 return [customDialSettings oo_floatForKey:dialKey defaultValue:0.0];
4577}

◆ dialCustomString:

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

Definition at line 13699 of file PlayerEntity.m.

4580 :(NSString *)dialKey
4581{
4582 return [customDialSettings oo_stringForKey:dialKey defaultValue:@""];
4583}

◆ dialEnergy

- (GLfloat) dialEnergy

Definition at line 13699 of file PlayerEntity.m.

4764{
4765 GLfloat result = energy / maxEnergy;
4766 return OOClamp_0_1_f(result);
4767}
GLfloat maxEnergy
Definition Entity.h:143
GLfloat energy
Definition Entity.h:142

◆ dialForwardShield

- (GLfloat) dialForwardShield

Definition at line 13699 of file PlayerEntity.m.

4742{
4743 if (EXPECT_NOT([self maxForwardShieldLevel] <= 0))
4744 {
4745 return 0.0;
4746 }
4747 GLfloat result = forward_shield / [self maxForwardShieldLevel];
4748 return OOClamp_0_1_f(result);
4749}
float maxForwardShieldLevel()
GLfloat forward_shield

◆ dialFuel

- (GLfloat) dialFuel

Definition at line 13699 of file PlayerEntity.m.

4777{
4778 if (fuel <= 0.0f)
4779 return 0.0f;
4780 if (fuel > [self fuelCapacity])
4781 return 1.0f;
4782 return (GLfloat)fuel / (GLfloat)[self fuelCapacity];
4783}
OOFuelQuantity fuelCapacity()

◆ dialFuelScoopStatus

- (OOFuelScoopStatus) dialFuelScoopStatus

Definition at line 13699 of file PlayerEntity.m.

4954{
4955 // need to account for the different ways of calculating cargo on board when docked/in-flight
4956 OOCargoQuantity cargoOnBoard = [self status] == STATUS_DOCKED ? current_cargo : (OOCargoQuantity)[cargo count];
4957 if ([self hasScoop])
4958 {
4959 if (scoopsActive)
4960 return SCOOP_STATUS_ACTIVE;
4961 if (cargoOnBoard >= [self maxAvailableCargoSpace] || specialCargo)
4963 return SCOOP_STATUS_OKAY;
4964 }
4965 else
4966 {
4968 }
4969}
@ SCOOP_STATUS_FULL_HOLD
@ SCOOP_STATUS_NOT_INSTALLED
@ SCOOP_STATUS_ACTIVE
@ SCOOP_STATUS_OKAY
BOOL hasScoop()

◆ dialHyperRange

- (GLfloat) dialHyperRange

Definition at line 13699 of file PlayerEntity.m.

4787{
4788 if (target_system_id == system_id && ![UNIVERSE inInterstellarSpace]) return 0.0f;
4789 return [self fuelRequiredForJump] / (GLfloat)PLAYER_MAX_FUEL;
4790}
#define PLAYER_MAX_FUEL
OOSystemID system_id
OOSystemID target_system_id

◆ dialHyperSpeed

- (GLfloat) dialHyperSpeed

Definition at line 13699 of file PlayerEntity.m.

4736{
4737 return flightSpeed / maxFlightSpeed;
4738}
GLfloat flightSpeed
Definition ShipEntity.h:368
GLfloat maxFlightSpeed
Definition ShipEntity.h:239

◆ dialIdentEngaged

- (BOOL) dialIdentEngaged

Definition at line 13699 of file PlayerEntity.m.

5435{
5436 return ident_engaged;
5437}

◆ dialMaxEnergy

- (GLfloat) dialMaxEnergy

Definition at line 13699 of file PlayerEntity.m.

4771{
4772 return maxEnergy;
4773}

◆ dialMaxMissiles

- (NSUInteger) dialMaxMissiles

Definition at line 13699 of file PlayerEntity.m.

5429{
5430 return max_missiles;
5431}

◆ dialMissileStatus

- (OOMissileStatus) dialMissileStatus

Definition at line 13699 of file PlayerEntity.m.

4928{
4929 if ([self weaponsOnline])
4930 {
4931 return missile_status;
4932 }
4933 else
4934 {
4935 // Invariant/safety interlock: weapons offline implies missiles safe. -- Ahruman 2012-07-21
4937 {
4938 OOLogERR(@"player.missilesUnsafe", @"%@", @"Missile state is not SAFE when weapons are offline. This is a bug, please report it.");
4939 [self safeAllMissiles];
4940 }
4941 return MISSILE_STATUS_SAFE;
4942 }
4943}
@ MISSILE_STATUS_SAFE

◆ dialPitch

- (GLfloat) dialPitch

Definition at line 13699 of file PlayerEntity.m.

4707{
4708 GLfloat result = flightPitch / max_flight_pitch;
4709 if ((result < 1.0f)&&(result > -1.0f))
4710 return result;
4711 if (result > 0.0f)
4712 return 1.0f;
4713 return -1.0f;
4714}
GLfloat max_flight_pitch
Definition ShipEntity.h:241
GLfloat flightPitch
Definition ShipEntity.h:370

◆ dialRoll

- (GLfloat) dialRoll

Definition at line 13699 of file PlayerEntity.m.

4696{
4697 GLfloat result = flightRoll / max_flight_roll;
4698 if ((result < 1.0f)&&(result > -1.0f))
4699 return result;
4700 if (result > 0.0f)
4701 return 1.0f;
4702 return -1.0f;
4703}
GLfloat max_flight_roll
Definition ShipEntity.h:240
GLfloat flightRoll
Definition ShipEntity.h:369

◆ dialSpeed

- (GLfloat) dialSpeed

Definition at line 13699 of file PlayerEntity.m.

4729{
4730 GLfloat result = flightSpeed / maxFlightSpeed;
4731 return OOClamp_0_1_f(result);
4732}

◆ dialTargetName

- (NSString *) dialTargetName

Definition at line 13699 of file PlayerEntity.m.

5453{
5454 Entity *target_entity = [self primaryTarget];
5455 NSString *result = nil;
5456
5457 if (target_entity == nil)
5458 {
5459 result = DESC(@"no-target-string");
5460 }
5461
5462 if ([target_entity respondsToSelector:@selector(identFromShip:)])
5463 {
5464 result = [(ShipEntity*)target_entity identFromShip:self];
5465 }
5466
5467 if (result == nil) result = DESC(@"unknown-target");
5468
5469 return result;
5470}

◆ dialYaw

- (GLfloat) dialYaw

Definition at line 13699 of file PlayerEntity.m.

4718{
4719 GLfloat result = -flightYaw / max_flight_yaw;
4720 if ((result < 1.0f)&&(result > -1.0f))
4721 return result;
4722 if (result > 0.0f)
4723 return 1.0f;
4724 return -1.0f;
4725}
GLfloat max_flight_yaw
Definition ShipEntity.h:242
GLfloat flightYaw
Definition ShipEntity.h:371

◆ disengageAutopilot

- (void) disengageAutopilot

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

3676{
3678 {
3679 [self abortDocking]; // let the station know that you are no longer on approach
3680 behaviour = BEHAVIOUR_IDLE;
3681 frustration = 0.0;
3682 autopilot_engaged = NO;
3684 [self setTargetStation:nil];
3685 [self setStatus:STATUS_IN_FLIGHT];
3686 [self playAutopilotOff];
3687 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
3689 [self doScriptEvent:OOJSID("playerCancelledAutoPilot")];
3690
3691 [self resetAutopilotAI];
3692 }
3693}
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.

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

2723 :(double) delta_t
2724{
2726
2727 double speed_delta = SHIP_THRUST_FACTOR * thrust;
2728
2729 OOSunEntity *sun = [UNIVERSE sun];
2730 double external_temp = 0;
2731 GLfloat air_friction = 0.0f;
2732 air_friction = 0.5f * [UNIVERSE airResistanceFactor];
2733 if (air_friction < 0.005f) // aRF < 0.01
2734 {
2735 // stops mysteriously overheating and exploding in the middle of empty space
2736 air_friction = 0;
2737 }
2738
2739 UPDATE_STAGE(@"updating weapon temperatures and shot times");
2740 // cool all weapons.
2741 float coolAmount = WEAPON_COOLING_FACTOR * delta_t;
2742 forward_weapon_temp = fdim(forward_weapon_temp, coolAmount);
2743 aft_weapon_temp = fdim(aft_weapon_temp, coolAmount);
2744 port_weapon_temp = fdim(port_weapon_temp, coolAmount);
2745 starboard_weapon_temp = fdim(starboard_weapon_temp, coolAmount);
2746
2747 // update shot times.
2748 forward_shot_time += delta_t;
2749 aft_shot_time += delta_t;
2750 port_shot_time += delta_t;
2751 starboard_shot_time += delta_t;
2752
2753 // copy new temp & shot time to main temp & shot time
2754 switch (currentWeaponFacing)
2755 {
2759 break;
2760 case WEAPON_FACING_AFT:
2763 break;
2764 case WEAPON_FACING_PORT:
2767 break;
2771 break;
2772
2773 case WEAPON_FACING_NONE:
2774 break;
2775 }
2776
2777 // cloaking device
2779 {
2780 UPDATE_STAGE(@"updating cloaking device");
2781
2782 energy -= (float)delta_t * CLOAKING_DEVICE_ENERGY_RATE;
2784 [self deactivateCloakingDevice];
2785 }
2786
2787 // military_jammer
2788 if ([self hasMilitaryJammer])
2789 {
2790 UPDATE_STAGE(@"updating military jammer");
2791
2793 {
2794 energy -= (float)delta_t * MILITARY_JAMMER_ENERGY_RATE;
2797 }
2798 else
2799 {
2802 }
2803 }
2804
2805 // ecm
2806 if (ecm_in_operation)
2807 {
2808 UPDATE_STAGE(@"updating ECM");
2809
2810 if (energy > 0.0)
2811 energy -= (float)(ECM_ENERGY_DRAIN_FACTOR * delta_t); // drain energy because of the ECM
2812 else
2813 {
2814 ecm_in_operation = NO;
2815 [UNIVERSE addMessage:DESC(@"ecm-out-of-juice") forCount:3.0];
2816 }
2817 if ([UNIVERSE getTime] > ecm_start_time + ECM_DURATION)
2818 {
2819 ecm_in_operation = NO;
2820 }
2821 }
2822
2823 // Energy Banks and Shields
2824
2825 /* Shield-charging behaviour, as per Eric's proposal:
2826 1. If shields are less than a threshold, recharge with all available energy
2827 2. If energy banks are below threshold, recharge with generated energy
2828 3. Charge shields with any surplus energy
2829 */
2830 UPDATE_STAGE(@"updating energy and shield charges");
2831
2832 // 1. (Over)charge energy banks (will get normalised later)
2833 energy += [self energyRechargeRate] * delta_t;
2834
2835 // 2. Calculate shield recharge rates
2836 float fwdMax = [self maxForwardShieldLevel];
2837 float aftMax = [self maxAftShieldLevel];
2838 float shieldRechargeFwd = [self forwardShieldRechargeRate] * delta_t;
2839 float shieldRechargeAft = [self aftShieldRechargeRate] * delta_t;
2840 /* there is potential for negative rechargeFwd and rechargeAFt values here
2841 (e.g. getting shield boosters damaged while shields are full). This may
2842 lead to energy being gained rather than consumed when recharging. Leaving
2843 as-is for now, as there might be OXPs that rely in such behaviour.
2844 Boosters case example mentioned above is the only known core equipment
2845 occurrence at this time and it has been fixed inside the
2846 oolite-equipment-control.js script. - Nikos 20160104.
2847 */
2848 float rechargeFwd = MIN(shieldRechargeFwd, fwdMax - forward_shield);
2849 float rechargeAft = MIN(shieldRechargeAft, aftMax - aft_shield);
2850
2851 // Note: we've simplified this a little, so if either shield is below
2852 // the critical threshold, we allocate all energy. Ideally we
2853 // would only allocate the full recharge to the critical shield,
2854 // but doing so would add another few levels of if-then below.
2855 float energyForShields = energy;
2856 if( (forward_shield > fwdMax * 0.25) && (aft_shield > aftMax * 0.25) )
2857 {
2858 // TODO: Can this be cached anywhere sensibly (without adding another member variable)?
2859 float minEnergyBankLevel = [[UNIVERSE globalSettings] oo_floatForKey:@"shield_charge_energybank_threshold" defaultValue:0.25];
2860 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
2861 }
2862
2864 {
2865 rechargeFwd = MIN(rechargeFwd, energyForShields);
2866 rechargeAft = MIN(rechargeAft, energyForShields - rechargeFwd);
2867 }
2868 else
2869 {
2870 rechargeAft = MIN(rechargeAft, energyForShields);
2871 rechargeFwd = MIN(rechargeFwd, energyForShields - rechargeAft);
2872 }
2873
2874 // 3. Recharge shields, drain banks, and clamp values
2875 forward_shield += rechargeFwd;
2876 aft_shield += rechargeAft;
2877 energy -= rechargeFwd + rechargeAft;
2878
2879 forward_shield = OOClamp_0_max_f(forward_shield, fwdMax);
2880 aft_shield = OOClamp_0_max_f(aft_shield, aftMax);
2881 energy = OOClamp_0_max_f(energy, maxEnergy);
2882
2883 if (sun)
2884 {
2885 UPDATE_STAGE(@"updating sun effects");
2886
2887 // set the ambient temperature here
2888 double sun_zd = sun->zero_distance; // square of distance
2889 double sun_cr = sun->collision_radius;
2890 double alt1 = sun_cr * sun_cr / sun_zd;
2891 external_temp = SUN_TEMPERATURE * alt1;
2892
2893 if ([sun goneNova])
2894 external_temp *= 100;
2895 // fuel scooping during the nova mission very unlikely
2896 if ([sun willGoNova])
2897 external_temp *= 3;
2898
2899 // do Revised sun-skimming check here...
2900 if ([self hasFuelScoop] && alt1 > 0.75 && [self fuel] < [self fuelCapacity])
2901 {
2902 fuel_accumulator += (float)(delta_t * flightSpeed * 0.010 / [self fuelChargeRate]);
2903 // are we fast enough to collect any fuel?
2904 scoopsActive = YES && flightSpeed > 0.1f;
2905 while (fuel_accumulator > 1.0f)
2906 {
2907 [self setFuel:[self fuel] + 1];
2908 fuel_accumulator -= 1.0f;
2909 [self doScriptEvent:OOJSID("shipScoopedFuel")];
2910 }
2911 [UNIVERSE displayCountdownMessage:DESC(@"fuel-scoop-active") forCount:1.0];
2912 }
2913 }
2914
2915 //Bug #11692 CmdrJames added Status entering witchspace
2916 OOEntityStatus status = [self status];
2917 if ((status != STATUS_ESCAPE_SEQUENCE) && (status != STATUS_ENTERING_WITCHSPACE))
2918 {
2919 UPDATE_STAGE(@"updating cabin temperature");
2920
2921 // work on the cabin temperature
2922 float heatInsulation = [self heatInsulation]; // Optimisation, suggested by EricW
2923 float deltaInsulation = delta_t/heatInsulation;
2924 float heatThreshold = heatInsulation * 100.0f;
2925 ship_temperature += (float)( flightSpeed * air_friction * deltaInsulation); // wind_speed
2926
2927 if (external_temp > heatThreshold && external_temp > ship_temperature)
2928 ship_temperature += (float)((external_temp - ship_temperature) * SHIP_INSULATION_FACTOR * deltaInsulation);
2929 else
2930 {
2932 ship_temperature += (float)((external_temp - heatThreshold - ship_temperature) * SHIP_COOLING_FACTOR * deltaInsulation);
2933 }
2934
2936 [self takeHeatDamage: delta_t * ship_temperature];
2937 }
2938
2939 if ((status == STATUS_ESCAPE_SEQUENCE)&&(shot_time > ESCAPE_SEQUENCE_TIME))
2940 {
2941 UPDATE_STAGE(@"resetting after escape");
2942 ShipEntity *doppelganger = (ShipEntity*)[self foundTarget];
2943 // reset legal status again! Could have changed if a previously launched missile hit a clean NPC while in the escape pod.
2944 [self setBounty:0 withReason:kOOLegalStatusReasonEscapePod];
2945 bounty = 0;
2946 thrust = max_thrust; // re-enable inertialess drives
2947 // no access to all player.ship properties while inside the escape pod,
2948 // we're not supposed to be inside our ship anymore!
2949 [self doScriptEvent:OOJSID("escapePodSequenceOver")]; // allow oxps to override the escape pod target
2954 if (EXPECT_NOT(target_system_id != system_id)) // overridden: we're going to a nearby system!
2955 {
2958 [UNIVERSE setSystemTo:system_id];
2959 galaxy_coordinates = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:system_id inGalaxy:galaxy_number]);
2960
2961 [UNIVERSE setUpSpace];
2962 // run initial system population
2963 [UNIVERSE populateNormalSpace];
2964
2965 [self setDockTarget:[UNIVERSE station]];
2966 // send world script events to let oxps know we're in a new system.
2967 // all player.ship properties are still disabled at this stage.
2968 [UNIVERSE setWitchspaceBreakPattern:YES];
2969 [self doScriptEvent:OOJSID("shipWillExitWitchspace")];
2970 [self doScriptEvent:OOJSID("shipExitedWitchspace")];
2971
2972 [[UNIVERSE planet] update: 2.34375 * market_rnd]; // from 0..10 minutes
2973 [[UNIVERSE station] update: 2.34375 * market_rnd]; // from 0..10 minutes
2974 }
2975
2976 Entity *dockTargetEntity = [UNIVERSE entityForUniversalID:_dockTarget]; // main station in the original system, unless overridden.
2977 if ([dockTargetEntity isStation]) // fails if _dockTarget is NO_TARGET
2978 {
2979 [doppelganger becomeExplosion]; // blow up the doppelganger
2980 // restore player ship
2981 ShipEntity *player_ship = [UNIVERSE newShipWithName:[self shipDataKey]]; // retained
2982 if (player_ship)
2983 {
2984 // FIXME: this should use OOShipType, which should exist. -- Ahruman
2985 [self setMesh:[player_ship mesh]];
2986 [player_ship release]; // we only wanted it for its polygons!
2987 }
2988 [UNIVERSE setViewDirection:VIEW_FORWARD];
2989 [UNIVERSE setBlockJSPlayerShipProps:NO]; // re-enable player.ship!
2990 [self enterDock:(StationEntity *)dockTargetEntity];
2991 }
2992 else // no dock target? dock target is not a station? game over!
2993 {
2994 [self setStatus:STATUS_DEAD];
2995 //[self playGameOver]; // no death explosion sounds for player pods
2996 // no shipDied events for player pods, either
2997 [UNIVERSE displayMessage:DESC(@"gameoverscreen-escape-pod") forCount:kDeadResetTime];
2998 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
2999 [self showGameOver];
3000 }
3001 }
3002
3003
3004 // MOVED THE FOLLOWING FROM PLAYERENTITY POLLFLIGHTCONTROLS:
3007 {
3008 UPDATE_STAGE(@"updating hyperspeed");
3009
3010 // increase speed up to maximum hyperspeed
3012 flightSpeed += (float)(speed_delta * delta_t * HYPERSPEED_FACTOR);
3015
3016 // check for mass lock
3017 hyperspeed_locked = [self massLocked];
3018 // check for mass lock & external temperature?
3019 //hyperspeed_locked = flightSpeed * air_friction > 40.0f+(ship_temperature - external_temp ) * SHIP_COOLING_FACTOR || [self massLocked];
3020
3022 {
3023 [self playJumpMassLocked];
3024 [UNIVERSE addMessage:DESC(@"jump-mass-locked") forCount:4.5];
3025 hyperspeed_engaged = NO;
3026 }
3027 }
3028 else
3029 {
3031 {
3032 UPDATE_STAGE(@"updating afterburner");
3033
3034 float abFactor = [self afterburnerFactor];
3035 float maxInjectionSpeed = maxFlightSpeed * abFactor;
3036 if (flightSpeed > maxInjectionSpeed)
3037 {
3038 // decellerate to maxInjectionSpeed but slower than without afterburner.
3039 flightSpeed -= (float)(speed_delta * delta_t * abFactor);
3040 }
3041 else
3042 {
3043 if (flightSpeed < maxInjectionSpeed)
3044 flightSpeed += (float)(speed_delta * delta_t * abFactor);
3045 if (flightSpeed > maxInjectionSpeed)
3046 flightSpeed = maxInjectionSpeed;
3047 }
3048 fuel_accumulator -= (float)(delta_t * afterburner_rate);
3049 while ((fuel_accumulator < 0)&&(fuel > 0))
3050 {
3051 fuel_accumulator += 1.0f;
3052 if (--fuel <= MIN_FUEL)
3054 }
3055 }
3056 else
3057 {
3058 UPDATE_STAGE(@"slowing from hyperspeed");
3059
3060 // slow back down...
3062 {
3063 // decrease speed to maximum normal speed
3064 float deceleration = (speed_delta * delta_t * HYPERSPEED_FACTOR);
3066 {
3067 // decelerate much quicker in masslocks
3068 // this does also apply to injector deceleration
3069 // but it's not very noticeable
3070 deceleration *= 3;
3071 }
3072 flightSpeed -= deceleration;
3075 }
3076 }
3077 }
3078
3079
3080
3081 // fuel leakage
3082 if ((fuel_leak_rate > 0.0)&&(fuel > 0))
3083 {
3084 UPDATE_STAGE(@"updating fuel leakage");
3085
3086 fuel_accumulator -= (float)(fuel_leak_rate * delta_t);
3087 while ((fuel_accumulator < 0)&&(fuel > 0))
3088 {
3089 fuel_accumulator += 1.0f;
3090 fuel--;
3091 }
3092 if (fuel == 0)
3093 fuel_leak_rate = 0;
3094 }
3095
3096 // smart_zoom
3097 UPDATE_STAGE(@"updating scanner zoom");
3099 {
3100 double z = [hud scannerZoom];
3101 double z1 = z + scanner_zoom_rate * delta_t;
3102 if (scanner_zoom_rate > 0.0)
3103 {
3104 if (floor(z1) > floor(z))
3105 {
3106 z1 = floor(z1);
3107 scanner_zoom_rate = 0.0f;
3108 }
3109 }
3110 else
3111 {
3112 if (z1 < 1.0)
3113 {
3114 z1 = 1.0;
3115 scanner_zoom_rate = 0.0f;
3116 }
3117 }
3118 [hud setScannerZoom:z1];
3119 }
3120
3121 [[UNIVERSE gameView] setFov:fieldOfView fromFraction:YES];
3122
3123 // scanner sanity check - lose any targets further than maximum scanner range
3124 ShipEntity *primeTarget = [self primaryTarget];
3125 if (primeTarget && HPdistance2([primeTarget position], [self position]) > SCANNER_MAX_RANGE2 && !autopilot_engaged)
3126 {
3127 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
3128 [self removeTarget:primeTarget];
3129 }
3130 // compass sanity check and update target for changed mode
3131 [self validateCompassTarget];
3132
3133 // update subentities
3134 UPDATE_STAGE(@"updating subentities");
3135 totalBoundingBox = boundingBox; // reset totalBoundingBox
3136 ShipEntity *se = nil;
3137 foreach (se, [self subEntities])
3138 {
3139 [se update:delta_t];
3140 if ([se isShip])
3141 {
3142 BoundingBox sebb = [se findSubentityBoundingBox];
3143 bounding_box_add_vector(&totalBoundingBox, sebb.max);
3144 bounding_box_add_vector(&totalBoundingBox, sebb.min);
3145 }
3146 }
3147 // and one thing which isn't a subentity. Fixes bug with
3148 // mispositioned laser beams particularly noticeable on side view.
3149 if (lastShot != nil)
3150 {
3151 OOLaserShotEntity *lse = nil;
3152 foreach (lse, lastShot)
3153 {
3154 [lse update:0.0];
3155 }
3157 }
3158
3159 // update mousewheel status
3160 UPDATE_STAGE(@"updating mousewheel delta");
3161 MyOpenGLView *gView = [UNIVERSE gameView];
3162 float mouseWheelDelta = [gView mouseWheelDelta];
3163 if (mouseWheelDelta > 0.0f)
3164 {
3165 if (mouseWheelDelta < delta_t) [gView setMouseWheelDelta:0.0f];
3166 else [gView setMouseWheelDelta:mouseWheelDelta - delta_t];
3167 }
3168 else if (mouseWheelDelta < 0.0f)
3169 {
3170 if (mouseWheelDelta > -delta_t) [gView setMouseWheelDelta:0.0f];
3171 else [gView setMouseWheelDelta:mouseWheelDelta + delta_t];
3172 }
3173
3175}
#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 ecm_start_time
unsigned hyperspeed_engaged
unsigned afterburner_engaged
GLfloat fuelChargeRate()
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()
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 13699 of file PlayerEntity.m.

7107{
7108 StationEntity *dockedStation = [self dockedStation];
7109 if (dockedStation == nil)
7110 {
7111 [self setStatus:STATUS_IN_FLIGHT];
7112 return;
7113 }
7114
7115 [self setStatus:STATUS_DOCKED];
7116 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
7117
7118 [self loseTargetStatus];
7119
7120 [self setPosition:[dockedStation position]];
7121 [self setOrientation:kIdentityQuaternion]; // reset orientation to dock
7122
7123 flightRoll = 0.0f;
7124 flightPitch = 0.0f;
7125 flightYaw = 0.0f;
7126 flightSpeed = 0.0f;
7127
7128 hyperspeed_engaged = NO;
7129 hyperspeed_locked = NO;
7130
7131 forward_shield = [self maxForwardShieldLevel];
7132 aft_shield = [self maxAftShieldLevel];
7133 energy = maxEnergy;
7134 weapon_temp = 0.0f;
7135 ship_temperature = 60.0f;
7136
7137 [self setAlertFlag:ALERT_FLAG_DOCKED to:YES];
7138
7139 if ([dockedStation localMarket] == nil)
7140 {
7141 [dockedStation initialiseLocalMarket];
7142 }
7143
7144 NSString *escapepodReport = [self processEscapePods];
7145 [self addMessageToReport:escapepodReport];
7146
7147 [self unloadCargoPods]; // fill up the on-ship commodities before...
7148
7149 // check import status of station
7150 // escape pods must be cleared before this happens
7151 if ([dockedStation marketMonitored])
7152 {
7153 OOCreditsQuantity oldbounty = [self bounty];
7154 [self markAsOffender:[dockedStation legalStatusOfManifest:shipCommodityData export:NO] withReason:kOOLegalStatusReasonIllegalImports];
7155 if ([self bounty] > oldbounty)
7156 {
7157 [self addRoleToPlayer:@"trader-smuggler"];
7158 }
7159 }
7160
7161 // check contracts
7162 NSString *passengerAndCargoReport = [self checkPassengerContracts]; // Is also processing cargo and parcel contracts.
7163 [self addMessageToReport:passengerAndCargoReport];
7164
7165 [UNIVERSE setDisplayText:YES];
7166
7169
7170 // Did we fail to observe traffic control regulations? However, due to the state of emergency,
7171 // apply no unauthorized docking penalties if a nova is ongoing.
7172 if ([dockedStation requiresDockingClearance] &&
7173 ![self clearedToDock] && ![[UNIVERSE sun] willGoNova])
7174 {
7175 [self penaltyForUnauthorizedDocking];
7176 }
7177
7178 // apply any pending fines. (No need to check gui_screen as fines is no longer an on-screen message).
7179 if (dockedStation == [UNIVERSE station])
7180 {
7181 // TODO: A proper system to allow some OXP stations to have a
7182 // galcop presence for fines. - CIM 18/11/2012
7183 if (being_fined && ![[UNIVERSE sun] willGoNova] && ![dockedStation suppressArrivalReports]) [self getFined];
7184 }
7185
7186 // it's time to check the script - can trigger legacy missions
7187 if (gui_screen != GUI_SCREEN_MISSION) [self checkScript]; // a scripted pilot could have created a mission screen.
7188
7190 [self doScriptEvent:OOJSID("shipDockedWithStation") withArgument:dockedStation];
7192 if ([self status] == STATUS_LAUNCHING) return;
7193
7194 // if we've not switched to the mission screen yet then proceed normally..
7195 if (gui_screen != GUI_SCREEN_MISSION)
7196 {
7197 [self setGuiToStatusScreen];
7198 }
7201
7202 // When a mission screen is started, any on-screen message is removed immediately.
7203 [self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")]; // also displays docking reports first.
7204}
#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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ dockedStation

- (StationEntity *) dockedStation

Definition at line 13699 of file PlayerEntity.m.

4468{
4469 return [_dockedStation weakRefUnderlyingObject];
4470}

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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ dockedTechLevel_number

- (NSNumber *) dockedTechLevel_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ doesHitLine:v0:v1:

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

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6270 :(HPVector)v0 :(HPVector)v1 :(ShipEntity **)hitEntity
6271{
6272 if (hitEntity)
6273 hitEntity[0] = (ShipEntity*)nil;
6274 Vector u0 = HPVectorToVector(HPvector_between(position, v0)); // relative to origin of model / octree
6275 Vector u1 = HPVectorToVector(HPvector_between(position, v1));
6276 Vector w0 = make_vector(dot_product(u0, v_right), dot_product(u0, v_up), dot_product(u0, v_forward)); // in ijk vectors
6277 Vector w1 = make_vector(dot_product(u1, v_right), dot_product(u1, v_up), dot_product(u1, v_forward));
6278 GLfloat hit_distance = [octree isHitByLine:w0 :w1];
6279 if (hit_distance)
6280 {
6281 if (hitEntity)
6282 hitEntity[0] = self;
6283 }
6284
6285 bool shields = false;
6286 if ((w0.z >= 0 && forward_shield > 1) || (w0.z <= 0 && aft_shield > 1))
6287 {
6288 shields = true;
6289 }
6290
6291 NSEnumerator *subEnum = nil;
6292 ShipEntity *se = nil;
6293 for (subEnum = [self shipSubEntityEnumerator]; (se = [subEnum nextObject]); )
6294 {
6295 HPVector p0 = [se absolutePositionForSubentity];
6296 Triangle ijk = [se absoluteIJKForSubentity];
6297 u0 = HPVectorToVector(HPvector_between(p0, v0));
6298 u1 = HPVectorToVector(HPvector_between(p0, v1));
6299 w0 = resolveVectorInIJK(u0, ijk);
6300 w1 = resolveVectorInIJK(u1, ijk);
6301
6302 GLfloat hitSub = [se->octree isHitByLine:w0 :w1];
6303 if (hitSub && (hit_distance == 0 || hit_distance > hitSub))
6304 {
6305 hit_distance = hitSub;
6306 if (hitEntity && !shields)
6307 {
6308 *hitEntity = se;
6309 }
6310 }
6311 }
6312
6313 return hit_distance;
6314}
HPVector absolutePositionForSubentity()
Definition Entity.m:669
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 13699 of file PlayerEntity.m.

4084{
4085 switch ([self guiScreen])
4086 {
4087 case GUI_SCREEN_GAMEOPTIONS:
4088 //refresh play windowed / full screen
4089 [self setGuiToGameOptionsScreen];
4090 break;
4091 case GUI_SCREEN_STATUS:
4092 // status screen must be redone in order to possibly
4093 // refresh displayed model's draw position
4094 [self setGuiToStatusScreen];
4095 break;
4096 default:
4097 break;
4098 }
4099
4100
4101 [hud resetGuiPositions];
4102}
OOGUIScreenID guiScreen()

◆ doMissionCallback

- (void) doMissionCallback

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ doScriptEvent:inContext:withArguments:count:

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

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

12885 :(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc
12886{
12887 [super doScriptEvent:message inContext:context withArguments:argv count:argc];
12888 [self doWorldScriptEvent:message inContext:context withArguments:argv count:argc timeLimit:0.0];
12889}

◆ doTradeIn:forPriceFactor:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 9211 of file PlayerEntity.m.

10665 :(OOCreditsQuantity)tradeInValue forPriceFactor:(double)priceFactor
10666{
10667 if (tradeInValue != 0)
10668 {
10669 if (priceFactor < 1.0) tradeInValue *= priceFactor;
10671 }
10672}
OOCreditsQuantity tradeInValue()

◆ doWorldEventUntilMissionScreen:

- (BOOL) doWorldEventUntilMissionScreen: (jsid) message

Definition at line 9211 of file PlayerEntity.m.

12892 :(jsid)message
12893{
12894 NSEnumerator *scriptEnum = [worldScripts objectEnumerator];
12895 OOScript *theScript;
12896
12897 // Check for the presence of report messages first.
12898 if (gui_screen != GUI_SCREEN_MISSION && [dockingReport length] > 0 && [self isDocked] && ![[self dockedStation] suppressArrivalReports])
12899 {
12900 [self setGuiToDockingReportScreen]; // go here instead!
12901 [[UNIVERSE messageGUI] clear];
12902 return YES;
12903 }
12904
12905 JSContext *context = OOJSAcquireContext();
12906 while ((theScript = [scriptEnum nextObject]) && gui_screen != GUI_SCREEN_MISSION && [self isDocked])
12907 {
12908 [theScript callMethod:message inContext:context withArguments:NULL count:0 result:NULL];
12909 }
12910 OOJSRelinquishContext(context);
12911
12912 if (gui_screen == GUI_SCREEN_MISSION)
12913 {
12914 // remove any comms/console messages from the screen!
12915 [[UNIVERSE messageGUI] clear];
12916 return YES;
12917 }
12918
12919 return NO;
12920}
BOOL callMethod:inContext:withArguments:count:result:(jsid methodID,[inContext] JSContext *context,[withArguments] jsval *argv,[count] intN argc,[result] jsval *outResult)
Definition OOJSScript.m:652

◆ doWorldScriptEvent:inContext:withArguments:count:timeLimit:

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

Definition at line 9211 of file PlayerEntity.m.

12923 :(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc timeLimit:(OOTimeDelta)limit
12924{
12925 NSParameterAssert(context != NULL && JS_IsInRequest(context));
12926
12927 NSEnumerator *scriptEnum = nil;
12928 OOScript *theScript = nil;
12929
12930 for (scriptEnum = [worldScripts objectEnumerator]; (theScript = [scriptEnum nextObject]); )
12931 {
12933 [theScript callMethod:message inContext:context withArguments:argv count:argc result:NULL];
12935 }
12936}
#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 13699 of file PlayerEntity.m.

4405 :(bool)immediate translucent:(bool)translucent
4406{
4407 switch ([self status])
4408 {
4409 case STATUS_DEAD:
4410 case STATUS_COCKPIT_DISPLAY:
4411 case STATUS_DOCKED:
4412 case STATUS_START_GAME:
4413 return;
4414
4415 default:
4416 if ([UNIVERSE breakPatternHide]) return;
4417 }
4418
4419 [super drawImmediate:immediate translucent:translucent];
4420}

◆ drawRotationMatrix

- (OOMatrix) drawRotationMatrix
implementation

Reimplemented from Entity.

Definition at line 13699 of file PlayerEntity.m.

4295{
4296 return playerRotMatrix;
4297}
OOMatrix playerRotMatrix

◆ drawTransformationMatrix

- (OOMatrix) drawTransformationMatrix
implementation

Reimplemented from Entity.

Definition at line 13699 of file PlayerEntity.m.

4301{
4302 OOMatrix result = playerRotMatrix;
4303 // HPVect: modify to use camera-relative positioning
4304 return OOMatrixTranslate(result, HPVectorToVector(position));
4305}

◆ dumpCargo

- (OOCommodityType) dumpCargo
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6695{
6696 if (flightSpeed > 4.0 * maxFlightSpeed)
6697 {
6698 [UNIVERSE addMessage:OOExpandKey(@"hold-locked") forCount:3.0];
6699 return nil;
6700 }
6701
6702 OOCommodityType result = [super dumpCargo];
6703 if (result != nil)
6704 {
6705 NSString *commodity = [UNIVERSE displayNameForCommodity:result];
6706 [UNIVERSE addMessage:OOExpandKey(@"commodity-ejected", commodity) forCount:3.0 forceDisplay:YES];
6707 [self playCargoJettisioned];
6708 }
6709 return result;
6710}

◆ dumpSelfState

- (void) dumpSelfState
implementation

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

13449{
13450 NSMutableArray *flags = nil;
13451 NSString *flagsString = nil;
13452
13453 [super dumpSelfState];
13454
13455 OOLog(@"dumpState.playerEntity", @"Script time: %g", script_time);
13456 OOLog(@"dumpState.playerEntity", @"Script time check: %g", script_time_check);
13457 OOLog(@"dumpState.playerEntity", @"Script time interval: %g", script_time_interval);
13458 OOLog(@"dumpState.playerEntity", @"Roll/pitch/yaw delta: %g, %g, %g", roll_delta, pitch_delta, yaw_delta);
13459 OOLog(@"dumpState.playerEntity", @"Shield: %g fore, %g aft", forward_shield, aft_shield);
13460 OOLog(@"dumpState.playerEntity", @"Alert level: %u, flags: %#x", alertFlags, alertCondition);
13461 OOLog(@"dumpState.playerEntity", @"Missile status: %i", missile_status);
13462 OOLog(@"dumpState.playerEntity", @"Energy unit: %@", EnergyUnitTypeToString([self installedEnergyUnitType]));
13463 OOLog(@"dumpState.playerEntity", @"Fuel leak rate: %g", fuel_leak_rate);
13464 OOLog(@"dumpState.playerEntity", @"Trumble count: %lu", trumbleCount);
13465
13466 flags = [NSMutableArray array];
13467 #define ADD_FLAG_IF_SET(x) if (x) { [flags addObject:@#x]; }
13491// ADD_FLAG_IF_SET(isSpeechOn);
13492 ADD_FLAG_IF_SET(keyboardRollOverride); // Handle keyboard roll...
13493 ADD_FLAG_IF_SET(keyboardPitchOverride); // ...and pitch override separately - (fix for BUG #17490)
13496 flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
13497 OOLog(@"dumpState.playerEntity", @"Flags: %@", flagsString);
13498}
#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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ endMissionScreenAndNoteOpportunity

- (void) endMissionScreenAndNoteOpportunity

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ endScenario:

- (BOOL) endScenario: (NSString *) key

Definition at line 13699 of file PlayerEntity.m.

7056 :(NSString *)key
7057{
7058 if (scenarioKey != nil && [key isEqualToString:scenarioKey])
7059 {
7060 [self setStatus:STATUS_RESTART_GAME];
7061 return YES;
7062 }
7063 return NO;
7064}

◆ energyUnitType

- (OOEnergyUnitType) energyUnitType

Definition at line 13699 of file PlayerEntity.m.

6111{
6112 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"]) return ENERGY_UNIT_NAVAL;
6113 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"]) return ENERGY_UNIT_NORMAL;
6114 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NAVAL_DAMAGED;
6115 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NORMAL_DAMAGED;
6116 return ENERGY_UNIT_NONE;
6117}
@ 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 13699 of file PlayerEntity.m.

3640 :(StationEntity *)stationForDocking
3641{
3642 if (stationForDocking == nil) return NO;
3643 if ([self isDocked]) return NO;
3644
3645 if (autopilot_engaged && [self targetStation] == stationForDocking)
3646 {
3647 return YES;
3648 }
3649
3650 [self setTargetStation:stationForDocking];
3652 autopilot_engaged = YES;
3653 ident_engaged = NO;
3654 [self safeAllMissiles];
3656 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN) [self cancelWitchspaceCountdown]; // cancel witchspace countdown properly
3657 [self setStatus:STATUS_AUTOPILOT_ENGAGED];
3658 [self resetAutopilotAI];
3659 [shipAI setState:@"BEGIN_DOCKING"]; // reboot the AI
3660 [self playAutopilotOn];
3662 [self doScriptEvent:OOJSID("playerStartedAutoPilot") withArgument:stationForDocking];
3663 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_GRANTED];
3664
3666 {
3668 if (afterburnerSoundLooping) [self stopAfterburnerSound];
3669 }
3670 return YES;
3671}
const Vector kZeroVector
Definition OOVector.m:28
Vector velocity()

◆ enterDock:

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

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

7067 :(StationEntity *)station
7068{
7069 NSParameterAssert(station != nil);
7070 if ([self status] == STATUS_DEAD) return;
7071
7072 [self setStatus:STATUS_DOCKING];
7073 [self setDockedStation:station];
7074 [self doScriptEvent:OOJSID("shipWillDockWithStation") withArgument:station];
7075
7076 if (![hud nonlinearScanner])
7077 {
7078 [hud setScannerZoom: 1.0];
7079 }
7080 ident_engaged = NO;
7082 autopilot_engaged = NO;
7083 [self resetAutopilotAI];
7084
7086 hyperspeed_engaged = NO;
7087 hyperspeed_locked = NO;
7088 [self safeAllMissiles];
7089 DESTROY(_primaryTarget); // must happen before showing break_pattern to suppress active reticule.
7090 [self clearTargetMemory];
7091
7092 scanner_zoom_rate = 0.0f;
7093 [UNIVERSE setDisplayText:NO];
7094 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
7095 if ([self status] == STATUS_LAUNCHING) return; // a JS script has aborted the docking.
7096
7097 [self setOrientation: kIdentityQuaternion]; // reset orientation to dock
7098 [UNIVERSE setUpBreakPattern:[self breakPatternPosition] orientation:orientation forDocking:YES];
7099 [self playDockWithStation];
7100 [station noteDockedShip:self];
7101
7102 [[UNIVERSE gameView] clearKeys]; // try to stop key bounces
7103}
void noteDockedShip:(ShipEntity *ship)

Referenced by StationDockPlayer().

+ Here is the caller graph for this function:

◆ enterGalacticWitchspace

- (void) enterGalacticWitchspace

Definition at line 13699 of file PlayerEntity.m.

7497{
7498 if (![self witchJumpChecklist:true])
7499 return;
7500
7501
7502 OOGalaxyID destGalaxy = galaxy_number + 1;
7503 if (EXPECT_NOT(destGalaxy >= OO_GALAXIES_AVAILABLE))
7504 {
7505 destGalaxy = 0;
7506 }
7507
7508
7509 [self setStatus:STATUS_ENTERING_WITCHSPACE];
7510 JSContext *context = OOJSAcquireContext();
7511 [self setJumpCause:@"galactic jump"];
7512 [self setPreviousSystemID:[self currentSystemID]];
7513 ShipScriptEvent(context, self, "shipWillEnterWitchspace", STRING_TO_JSVAL(JS_InternString(context, [[self jumpCause] UTF8String])), INT_TO_JSVAL(destGalaxy));
7514 OOJSRelinquishContext(context);
7515
7516 [self noteCompassLostTarget];
7517
7518 [self witchStart];
7519
7520 [UNIVERSE removeAllEntitiesExceptPlayer];
7521
7522 // remove any contracts and parcels for the old galaxy
7523 if (contracts)
7524 [contracts removeAllObjects];
7525
7526 if (parcels)
7527 [parcels removeAllObjects];
7528
7529 // remove any mission destinations for the old galaxy
7531 [missionDestinations removeAllObjects];
7532
7533 // expire passenger contracts for the old galaxy
7534 if (passengers)
7535 {
7536 unsigned i;
7537 for (i = 0; i < [passengers count]; i++)
7538 {
7539 // set the expected arrival time to now, so they storm off the ship at the first port
7540 NSMutableDictionary* passenger_info = [NSMutableDictionary dictionaryWithDictionary:[passengers oo_dictionaryAtIndex:i]];
7541 [passenger_info setObject:[NSNumber numberWithDouble:ship_clock] forKey:CONTRACT_KEY_ARRIVAL_TIME];
7542 [passengers replaceObjectAtIndex:i withObject:passenger_info];
7543 }
7544 }
7545
7546 // clear a lot of memory of player actions
7547 if (ship_kills >= 6400)
7548 {
7549 [self clearRolesFromPlayer:0.25];
7550 }
7551 else if (ship_kills >= 2560)
7552 {
7553 [self clearRolesFromPlayer:0.5];
7554 }
7555 else
7556 {
7557 [self clearRolesFromPlayer:0.9];
7558 }
7559 [roleWeightFlags removeAllObjects];
7560 [roleSystemList removeAllObjects];
7561
7562 // may be more than one item providing this
7563 [self removeEquipmentItem:[self equipmentItemProviding:@"EQ_GAL_DRIVE"]];
7564
7565 galaxy_number = destGalaxy;
7566
7567 [UNIVERSE setGalaxyTo:galaxy_number];
7568
7569 // Choose the galactic hyperspace behaviour. Refers to where we may actually end up after an intergalactic jump.
7570 // The default behaviour is that the player cannot arrive on unreachable or isolated systems. The options
7571 // in planetinfo.plist, galactic_hyperspace_behaviour key can be used to allow arrival even at unreachable systems,
7572 // or at fixed coordinates on the galactic chart. The key galactic_hyperspace_fixed_coords in planetinfo.plist is
7573 // used in the fixed coordinates case and specifies the exact coordinates for the intergalactic jump.
7575 {
7576 case GALACTIC_HYPERSPACE_BEHAVIOUR_FIXED_COORDINATES:
7577 system_id = [UNIVERSE findSystemNumberAtCoords:galacticHyperspaceFixedCoords withGalaxy:galaxy_number includingHidden:YES];
7578 break;
7579 case GALACTIC_HYPERSPACE_BEHAVIOUR_ALL_SYSTEMS_REACHABLE:
7580 system_id = [UNIVERSE findSystemNumberAtCoords:galaxy_coordinates withGalaxy:galaxy_number includingHidden:YES];
7581 break;
7582 case GALACTIC_HYPERSPACE_BEHAVIOUR_STANDARD:
7583 default:
7584 // instead find a system connected to system 0 near the current coordinates...
7585 system_id = [UNIVERSE findConnectedSystemAtCoords:galaxy_coordinates withGalaxy:galaxy_number];
7586 break;
7587 }
7590
7591 [self setBounty:0 withReason:kOOLegalStatusReasonNewGalaxy]; // let's make a fresh start!
7592 cursor_coordinates = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:system_id inGalaxy:galaxy_number]);
7593
7594 [self witchEnd]; // sets coordinates, calls exiting witchspace JS events
7595}
#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 13699 of file PlayerEntity.m.

7632{
7633 if (![self witchJumpChecklist:false]) return;
7634
7635 OOSystemID jumpTarget = [self nextHopTargetSystemID];
7636
7637 // perform any check here for forced witchspace encounters
7638 unsigned malfunc_chance = 253;
7639 if (ship_trade_in_factor < 80)
7640 {
7641 malfunc_chance -= (1 + ranrot_rand() % (81-ship_trade_in_factor)) / 2; // increase chance of misjump in worn-out craft
7642 }
7643 else if (ship_trade_in_factor >= 100)
7644 {
7645 malfunc_chance = 256; // force no misjumps on first jump
7646 }
7647
7648#ifdef OO_DUMP_PLANETINFO
7649 BOOL misjump = NO; // debugging
7650#else
7651 BOOL malfunc = ((ranrot_rand() & 0xff) > malfunc_chance);
7652 // 75% of the time a malfunction means a misjump
7653 BOOL misjump = [self scriptedMisjump] || (flightPitch == max_flight_pitch) || (malfunc && (randf() > 0.75));
7654
7655 if (malfunc && !misjump)
7656 {
7657 // some malfunctions will start fuel leaks, some will result in no witchjump at all.
7658 if ([self takeInternalDamage]) // Depending on ship type and loaded cargo, this will be true for 20 - 50% of the time.
7659 {
7660 [self playWitchjumpFailure];
7661 [self setStatus:STATUS_IN_FLIGHT];
7662 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("malfunction"));
7663 return;
7664 }
7665 else
7666 {
7667 [self setFuelLeak:[NSString stringWithFormat:@"%f", (randf() + randf()) * 5.0]];
7668 }
7669 }
7670#endif
7671
7672 // From this point forward we are -definitely- witchjumping
7673
7674 // burn the full fuel amount to create the wormhole
7676
7677 // Create the players' wormhole
7678 wormhole = [[WormholeEntity alloc] initWormholeTo:jumpTarget fromShip:self];
7679 [UNIVERSE addEntity:wormhole]; // Add new wormhole to Universe to let other ships target it. Required for ships following the player.
7680 [self addScannedWormhole:wormhole];
7681
7682 [self setStatus:STATUS_ENTERING_WITCHSPACE];
7683 JSContext *context = OOJSAcquireContext();
7684 [self setJumpCause:@"standard jump"];
7685 [self setPreviousSystemID:[self currentSystemID]];
7686 ShipScriptEvent(context, self, "shipWillEnterWitchspace", STRING_TO_JSVAL(JS_InternString(context, [[self jumpCause] UTF8String])), INT_TO_JSVAL(jumpTarget));
7687 OOJSRelinquishContext(context);
7688
7689 [self updateSystemMemory];
7690 NSUInteger legality = [self legalStatusOfCargoList];
7691 OOCargoQuantity maxSpace = [self maxAvailableCargoSpace];
7692 OOCargoQuantity availSpace = [self availableCargoSpace];
7693 if ([roleWeightFlags objectForKey:@"bought-legal"])
7694 {
7695 if (maxSpace != availSpace)
7696 {
7697 [self addRoleToPlayer:@"trader"];
7698 if (maxSpace - availSpace > 20 || availSpace == 0)
7699 {
7700 if (legality == 0)
7701 {
7702 [self addRoleToPlayer:@"trader"];
7703 }
7704 }
7705 }
7706 }
7707 if ([roleWeightFlags objectForKey:@"bought-illegal"])
7708 {
7709 if (maxSpace != availSpace && legality > 0)
7710 {
7711 [self addRoleToPlayer:@"trader-smuggler"];
7712 if (maxSpace - availSpace > 20 || availSpace == 0)
7713 {
7714 if (legality >= 20 || legality >= maxSpace)
7715 {
7716 [self addRoleToPlayer:@"trader-smuggler"];
7717 }
7718 }
7719 }
7720 }
7721 [roleWeightFlags removeAllObjects];
7722
7723 [self noteCompassLostTarget];
7724 if ([self scriptedMisjump])
7725 {
7726 misjump = YES; // a script could just have changed this to true;
7727 }
7728 if (misjump)
7729 {
7730 [wormhole setMisjumpWithRange:[self scriptedMisjumpRange]];
7731 }
7732 [self witchJumpTo:jumpTarget misjump:misjump];
7733}
BOOL takeInternalDamage()
OOFuelQuantity fuelRequiredForJump()
BOOL scriptedMisjump()

◆ enterWormhole:

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

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

7600 :(WormholeEntity *) w_hole
7601{
7602 if ([self status] == STATUS_ENTERING_WITCHSPACE
7603 || [self status] == STATUS_EXITING_WITCHSPACE)
7604 {
7605 return; // has already entered a different wormhole
7606 }
7607 BOOL misjump = [self scriptedMisjump] || [w_hole withMisjump] || flightPitch == max_flight_pitch || randf() > 0.995;
7608 wormhole = [w_hole retain];
7609 [self addScannedWormhole:wormhole];
7610 [self setStatus:STATUS_ENTERING_WITCHSPACE];
7611 JSContext *context = OOJSAcquireContext();
7612 [self setJumpCause:@"wormhole"];
7613 [self setPreviousSystemID:[self currentSystemID]];
7614 ShipScriptEvent(context, self, "shipWillEnterWitchspace", STRING_TO_JSVAL(JS_InternString(context, [[self jumpCause] UTF8String])), INT_TO_JSVAL([w_hole destination]));
7615 OOJSRelinquishContext(context);
7616 if ([self scriptedMisjump])
7617 {
7618 misjump = YES; // a script could just have changed this to true;
7619 }
7620#ifdef OO_DUMP_PLANETINFO
7621 misjump = NO;
7622#endif
7623 if (misjump && [self scriptedMisjumpRange] != 0.5)
7624 {
7625 [w_hole setMisjumpWithRange:[self scriptedMisjumpRange]]; // overrides wormholes, if player also had non-default scriptedMisjumpRange
7626 }
7627 [self witchJumpTo:[w_hole destination] misjump:misjump];
7628}
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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ equipmentList

- (NSArray *) equipmentList

Definition at line 13699 of file PlayerEntity.m.

8038{
8039 GuiDisplayGen *gui = [UNIVERSE gui];
8040 NSMutableArray *quip1 = [NSMutableArray array]; // damaged
8041 NSMutableArray *quip2 = [NSMutableArray array]; // working
8042 NSEnumerator *eqTypeEnum = nil;
8043 OOEquipmentType *eqType = nil;
8044 NSString *desc = nil;
8045 NSString *alldesc = nil;
8046
8047 BOOL prioritiseDamaged = [[gui userSettings] oo_boolForKey:kGuiStatusPrioritiseDamaged defaultValue:YES];
8048
8049 for (eqTypeEnum = [OOEquipmentType reverseEquipmentEnumerator]; (eqType = [eqTypeEnum nextObject]); )
8050 {
8051 if ([eqType isVisible])
8052 {
8053 if ([eqType canCarryMultiple] && ![eqType isMissileOrMine])
8054 {
8055 NSString *damagedIdentifier = [[eqType identifier] stringByAppendingString:@"_DAMAGED"];
8056 NSUInteger count = 0, okcount = 0;
8057 okcount = [self countEquipmentItem:[eqType identifier]];
8058 count = okcount + [self countEquipmentItem:damagedIdentifier];
8059 if (count == 0)
8060 {
8061 // do nothing
8062 }
8063 // all items okay
8064 else if (count == okcount)
8065 {
8066 // only one installed display normally
8067 if (count == 1)
8068 {
8069 [quip2 addObject:[NSArray arrayWithObjects:[eqType name], [NSNumber numberWithBool:YES], [eqType displayColor], nil]];
8070 }
8071 // display plural form
8072 else
8073 {
8074 NSString *equipmentName = [eqType name];
8075 alldesc = OOExpandKey(@"equipment-plural", count, equipmentName);
8076 [quip2 addObject:[NSArray arrayWithObjects:alldesc, [NSNumber numberWithBool:YES], [eqType displayColor], nil]];
8077 }
8078 }
8079 // all broken, only one installed
8080 else if (count == 1 && okcount == 0)
8081 {
8082 desc = [NSString stringWithFormat:DESC(@"equipment-@-not-available"), [eqType name]];
8083 if (prioritiseDamaged)
8084 {
8085 [quip1 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8086 }
8087 else
8088 {
8089 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8090 }
8091 }
8092 // some broken, multiple installed
8093 else
8094 {
8095 NSString *equipmentName = [eqType name];
8096 alldesc = OOExpandKey(@"equipment-plural-some-na", okcount, count, equipmentName);
8097 if (prioritiseDamaged)
8098 {
8099 [quip1 addObject:[NSArray arrayWithObjects:alldesc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8100 }
8101 else
8102 {
8103 [quip2 addObject:[NSArray arrayWithObjects:alldesc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8104 }
8105 }
8106 }
8107 else if ([self hasEquipmentItem:[eqType identifier]])
8108 {
8109 [quip2 addObject:[NSArray arrayWithObjects:[eqType name], [NSNumber numberWithBool:YES], [eqType displayColor], nil]];
8110 }
8111 else
8112 {
8113 // Check for damaged version
8114 if ([self hasEquipmentItem:[[eqType identifier] stringByAppendingString:@"_DAMAGED"]])
8115 {
8116 desc = [NSString stringWithFormat:DESC(@"equipment-@-not-available"), [eqType name]];
8117
8118 if (prioritiseDamaged)
8119 {
8120 [quip1 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8121 }
8122 else
8123 {
8124 // just add in to the normal array
8125 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:NO], [eqType displayColor], nil]];
8126 }
8127 }
8128 }
8129 }
8130 }
8131
8132 if (max_passengers > 0)
8133 {
8134 desc = [NSString stringWithFormat:DESC_PLURAL(@"equipment-pass-berth-@", max_passengers), max_passengers];
8135 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [[OOEquipmentType equipmentTypeWithIdentifier:@"EQ_PASSENGER_BERTH"] displayColor], nil]];
8136 }
8137
8139 {
8140 desc = [NSString stringWithFormat:DESC(@"equipment-fwd-weapon-@"),[forward_weapon_type name]];
8141 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [forward_weapon_type displayColor], nil]];
8142 }
8144 {
8145 desc = [NSString stringWithFormat:DESC(@"equipment-aft-weapon-@"),[aft_weapon_type name]];
8146 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [aft_weapon_type displayColor], nil]];
8147 }
8149 {
8150 desc = [NSString stringWithFormat:DESC(@"equipment-port-weapon-@"),[port_weapon_type name]];
8151 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [port_weapon_type displayColor], nil]];
8152 }
8154 {
8155 desc = [NSString stringWithFormat:DESC(@"equipment-stb-weapon-@"),[starboard_weapon_type name]];
8156 [quip2 addObject:[NSArray arrayWithObjects:desc, [NSNumber numberWithBool:YES], [starboard_weapon_type displayColor], nil]];
8157 }
8158
8159 // list damaged first, then working
8160 [quip1 addObjectsFromArray:quip2];
8161 return quip1;
8162}
BOOL isWeaponNone(OOWeaponType weapon)
NSDictionary * userSettings()
OOColor * displayColor()
NSString * identifier()
BOOL isVisible()

◆ equipScreenBackgroundDescriptor

- (NSDictionary *) equipScreenBackgroundDescriptor

Definition at line 9211 of file PlayerEntity.m.

12827{
12829}

◆ 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 13699 of file PlayerEntity.m.

4874{
4876}
double escape_pod_rescue_time

◆ existingNativeSave:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1003 of file PlayerEntityLoadSave.m.

1193 : (NSString *)cdrName
1194{
1195 NSString* dir = [[UNIVERSE gameController] playerFileDirectory];
1196
1197 NSString *savePath=[dir stringByAppendingPathComponent:[cdrName stringByAppendingPathExtension:@"oolite-save"]];
1198 return [[NSFileManager defaultManager] fileExistsAtPath:savePath];
1199}

◆ expandMessage:

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

Provided by category PlayerEntity(ScriptingPrivate).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1181 :(NSString *)valueString
1182{
1183 Random_Seed very_random_seed;
1184 very_random_seed.a = rand() & 255;
1185 very_random_seed.b = rand() & 255;
1186 very_random_seed.c = rand() & 255;
1187 very_random_seed.d = rand() & 255;
1188 very_random_seed.e = rand() & 255;
1189 very_random_seed.f = rand() & 255;
1190 seed_RNG_only_for_planet_description(very_random_seed);
1191 NSString* expandedMessage = OOExpand(valueString);
1192 return [self replaceVariablesInString: expandedMessage];
1193}
#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 NSEnumerator *componentEnum = nil;
614 NSArray *component = nil;
615 NSString *value = nil;
616
617 result = [NSMutableArray arrayWithCapacity:[rhsComponents count]];
618
619 for (componentEnum = [rhsComponents objectEnumerator]; (component = [componentEnum nextObject]); )
620 {
621 /* Each component is a two-element array. The second element is a
622 string. The first element is a boolean indicating whether the
623 string is a selector (true) or a literal (false).
624
625 All valid selectors return a string or an NSNumber; in either
626 case, -description gives us a useful value to substitute into
627 the expanded string.
628 */
629
630 value = [component oo_stringAtIndex:1];
631
632 if ([[component objectAtIndex:0] boolValue])
633 {
634 value = [[self performSelector:NSSelectorFromString(value)] description];
635 if (value == nil) value = @"(null)"; // for backwards compatibility
636 }
637
638 [result addObject:value];
639 }
640
641 return [result componentsJoinedByString:@" "];
642}

◆ fastEquipmentA

- (NSString *) fastEquipmentA

Definition at line 13699 of file PlayerEntity.m.

8248{
8249 return _fastEquipmentA;
8250}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ fastEquipmentB

- (NSString *) fastEquipmentB

Definition at line 13699 of file PlayerEntity.m.

8254{
8255 return _fastEquipmentB;
8256}

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 1003 of file PlayerEntityLoadSave.m.

1329 : (NSString *)cdrName
1330{
1331 unsigned i;
1332 for (i=0; i < [cdrDetailArray count]; i++)
1333 {
1334 NSString *currentName = [[cdrDetailArray oo_dictionaryAtIndex: i] oo_stringForKey:@"player_save_name" defaultValue:[[cdrDetailArray oo_dictionaryAtIndex: i] oo_stringForKey:@"player_name"]];
1335 if([cdrName compare: currentName] == NSOrderedSame)
1336 {
1337 return i;
1338 }
1339 }
1340
1341 // not found!
1342 return -1;
1343}

◆ fireECM

- (BOOL) fireECM
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6088{
6089 if ([super fireECM])
6090 {
6091 ecm_in_operation = YES;
6092 ecm_start_time = [UNIVERSE getTime];
6093 return YES;
6094 }
6095 else
6096 {
6097 return NO;
6098 }
6099}

◆ fireMainWeapon

- (BOOL) fireMainWeapon

Definition at line 13699 of file PlayerEntity.m.

6150{
6151 OOWeaponType weapon_to_be_fired = [self currentWeapon];
6152
6153 if (![self weaponsOnline])
6154 {
6155 return NO;
6156 }
6157
6159 {
6160 [self playWeaponOverheated:[[self currentLaserOffset] oo_vectorAtIndex:0]];
6161 [UNIVERSE addMessage:DESC(@"weapon-overheat") forCount:3.0];
6162 return NO;
6163 }
6164
6165 if (isWeaponNone(weapon_to_be_fired))
6166 {
6167 return NO;
6168 }
6169
6170 [self currentWeaponStats];
6171
6172 NSUInteger multiplier = 1;
6173 if (_multiplyWeapons)
6174 {
6175 // multiple fitted
6176 multiplier = [[self laserPortOffset:currentWeaponFacing] count];
6177 }
6178
6179 if (energy <= weapon_energy_use * multiplier)
6180 {
6181 [UNIVERSE addMessage:DESC(@"weapon-out-of-juice") forCount:3.0];
6182 return NO;
6183 }
6184
6185 using_mining_laser = [weapon_to_be_fired isMiningLaser];
6186
6187 energy -= weapon_energy_use * multiplier;
6188
6189 switch (currentWeaponFacing)
6190 {
6193 forward_shot_time = 0.0;
6194 break;
6195
6196 case WEAPON_FACING_AFT:
6198 aft_shot_time = 0.0;
6199 break;
6200
6201 case WEAPON_FACING_PORT:
6203 port_shot_time = 0.0;
6204 break;
6205
6208 starboard_shot_time = 0.0;
6209 break;
6210
6211 case WEAPON_FACING_NONE:
6212 break;
6213 }
6214
6215 BOOL weaponFired = NO;
6216 if (!isWeaponNone(weapon_to_be_fired))
6217 {
6218 if (![weapon_to_be_fired isTurretLaser])
6219 {
6220 [self fireLaserShotInDirection:currentWeaponFacing weaponIdentifier:[[self currentWeapon] identifier]];
6221 weaponFired = YES;
6222 }
6223 else
6224 {
6225 // nothing: compatible with previous versions
6226 }
6227 }
6228
6229 if (weaponFired && cloaking_device_active && cloakPassive)
6230 {
6231 [self deactivateCloakingDevice];
6232 }
6233
6234 return weaponFired;
6235}
#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 13699 of file PlayerEntity.m.

5920{
5921 ShipEntity *missile = missile_entity[activeMissile]; // retain count is 1
5922 NSString *identifier = [missile primaryRole];
5923 ShipEntity *firedMissile = nil;
5924
5925 if (missile == nil) return nil;
5926
5927 if (![self weaponsOnline]) return nil;
5928
5929 // check if we were cloaked before firing the missile - can't use
5930 // cloaking_device_active directly because fireMissilewithIdentifier: andTarget:
5931 // will reset it in case passive cloak is set - Nikos 20130313
5932 BOOL cloakedPriorToFiring = cloaking_device_active;
5933
5934 launchingMissile = YES;
5935 replacingMissile = NO;
5936
5937 if ([missile isMine] && (missile_status != MISSILE_STATUS_SAFE))
5938 {
5939 firedMissile = [self launchMine:missile];
5940 if (!replacingMissile) [self removeFromPylon:activeMissile];
5941 if (firedMissile != nil) [self playMineLaunched:[self missileLaunchPosition] weaponIdentifier:identifier];
5942 }
5943 else
5944 {
5946 // release this before creating it anew in fireMissileWithIdentifier
5947 firedMissile = [self fireMissileWithIdentifier:identifier andTarget:[missile primaryTarget]];
5948
5949 if (firedMissile != nil)
5950 {
5951 if (!replacingMissile) [self removeFromPylon:activeMissile];
5952 [self playMissileLaunched:[self missileLaunchPosition] weaponIdentifier:identifier];
5953 }
5954 }
5955
5956 if (cloakedPriorToFiring && cloakPassive)
5957 {
5958 // fireMissilewithIdentifier: andTarget: has already taken care of deactivating
5959 // the cloak in the case of missiles by the time we get here, but explicitly
5960 // calling deactivateCloakingDevice is needed in order to be covered fully with mines too
5961 [self deactivateCloakingDevice];
5962 }
5963
5964 replacingMissile = NO;
5965 launchingMissile = NO;
5966
5967 return firedMissile;
5968}

◆ fleeingStatus

- (OOPlayerFleeingStatus) fleeingStatus

Definition at line 13699 of file PlayerEntity.m.

5823{
5824 return fleeing_status;
5825}
OOPlayerFleeingStatus fleeing_status

◆ forwardShieldLevel

- (GLfloat) forwardShieldLevel

Definition at line 13699 of file PlayerEntity.m.

4659{
4660 return forward_shield;
4661}

◆ forwardShieldRechargeRate

- (float) forwardShieldRechargeRate

Definition at line 13699 of file PlayerEntity.m.

4623{
4625}
GLfloat forward_shield_recharge_rate

◆ foundEquipment_bool

- (NSString *) foundEquipment_bool

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ fuelChargeRate

- (GLfloat) fuelChargeRate
implementation

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

13005{
13006 GLfloat rate = 1.0; // Standard charge rate.
13007
13008 rate = [super fuelChargeRate];
13009
13010 // Experimental: the state of repair affects the fuel charge rate - more fuel needed for jumps, etc...
13012 {
13013 rate *= 2.0 - (ship_trade_in_factor / 100); // between 1.1x and 1.25x
13014 //OOLog(@"fuelPrices", @"\"%@\" - repair status: %d%%, adjusted rate to:%.2f)", [self shipDataKey], ship_trade_in_factor, rate);
13015 }
13016
13017 return rate;
13018}

◆ fuelLeakRate

- (float) fuelLeakRate

Definition at line 13699 of file PlayerEntity.m.

4973{
4974 return fuel_leak_rate;
4975}

◆ fuelLeakRate_number

- (NSNumber *) fuelLeakRate_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2235{
2236 return [NSNumber numberWithFloat:[self fuelLeakRate]];
2237}

◆ fuelLevel_number

- (NSNumber *) fuelLevel_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ fuelRequiredForJump

- (OOFuelQuantity) fuelRequiredForJump
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

7470{
7471 return 10.0 * MAX(0.1, [self hyperspaceJumpDistance]);
7472}
double hyperspaceJumpDistance()

◆ galacticHyperspaceBehaviour

- (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour

◆ galacticHyperspaceFixedCoords

- (NSPoint) galacticHyperspaceFixedCoords

◆ galaxy_coordinates

- (NSPoint) galaxy_coordinates

◆ galaxyNumber

- (OOGalaxyID) galaxyNumber

Definition at line 13699 of file PlayerEntity.m.

513{
514 return galaxy_number;
515}

◆ gameOverFadeToBW

- (void) gameOverFadeToBW
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

3950{
3951 float secondsToBWFadeOut = [[NSUserDefaults standardUserDefaults] oo_floatForKey:@"gameover-seconds-to-bw-fadeout" defaultValue:5.0f];
3952 if ([UNIVERSE detailLevel] >= DETAIL_LEVEL_SHADERS && secondsToBWFadeOut > 0.0f)
3953 {
3954 MyOpenGLView *gameView = [UNIVERSE gameView];
3955 static float originalColorSaturation = -1.0f;
3956 if (originalColorSaturation == -1.0f) originalColorSaturation = [gameView colorSaturation];
3957 if ([self shotTime] < secondsToBWFadeOut)
3958 {
3959 // fade to black & white within secondsToBWFadeOut, independently of
3960 // frame rate and original color saturation
3961 if (fps_counter != 0)
3962 {
3963 [gameView adjustColorSaturation:-(originalColorSaturation * (1.0f / secondsToBWFadeOut) * [UNIVERSE timeAccelerationFactor] / fps_counter)];
3964 }
3965 }
3966
3967 if ([self shotTime] > kDeadResetTime)
3968 {
3969 // make sure to subtract the current saturation because if the user presses space to skip
3970 // the game over screen before the transition to b/w has been completed, whatever is left
3971 // will be added to the original saturation, resulting in an oversaturated image
3972 [gameView adjustColorSaturation:originalColorSaturation - [gameView colorSaturation]];
3973 originalColorSaturation = -1.0f;
3974 }
3975 }
3976}
@ 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 13699 of file PlayerEntity.m.

6988 :(Entity *)whom damageType:(OOShipDamageType)type
6989{
6990 if ([self isDocked]) return; // Can't die while docked. (Doing so would cause breakage elsewhere.)
6991
6992 OOLog(@"player.ship.damage", @"Player destroyed by %@ due to %@", whom, OOStringFromShipDamageType(type));
6993
6994 if (![[UNIVERSE gameController] playerFileToLoad])
6995 {
6996 [[UNIVERSE gameController] setPlayerFileToLoad: save_path]; // make sure we load the correct game
6997 }
6998
6999 energy = 0.0f;
7001 [self disengageAutopilot];
7002
7003 [UNIVERSE setDisplayText:NO];
7004 [UNIVERSE setViewDirection:VIEW_AFT];
7005
7006 // Let scripts know the player died.
7007 [self noteKilledBy:whom damageType:type]; // called before exploding, consistant with npc ships.
7008
7009 [self becomeLargeExplosion:4.0]; // also sets STATUS_DEAD
7010 [self moveForward:100.0];
7011
7012 flightSpeed = 160.0f;
7014 flightRoll = 0.0;
7015 flightPitch = 0.0;
7016 flightYaw = 0.0;
7017 [[UNIVERSE messageGUI] clear]; // No messages for the dead.
7018 [self suppressTargetLost]; // No target lost messages when dead.
7019 [self playGameOver];
7020 [UNIVERSE setBlockJSPlayerShipProps:YES]; // Treat JS player as stale entity.
7021 [self removeAllEquipment]; // No scooping / equipment damage when dead.
7022 [self loseTargetStatus];
7023 [self showGameOver];
7024}
NSString * OOStringFromShipDamageType(OOShipDamageType type) CONST_FUNC
OOShipDamageType
Definition ShipEntity.h:183

◆ getDockingClearanceStatus

- (OODockingClearanceStatus) getDockingClearanceStatus

Definition at line 9211 of file PlayerEntity.m.

13162{
13164}

◆ getFined

- (void) getFined

Definition at line 9211 of file PlayerEntity.m.

11848{
11849 if (legalStatus == 0) return; // nothing to pay for
11850
11851 OOGovernmentID local_gov = [[UNIVERSE currentSystemData] oo_intForKey:KEY_GOVERNMENT];
11852 if ([UNIVERSE inInterstellarSpace]) local_gov = 1; // equivalent to Feudal. I'm assuming any station in interstellar space is military. -- Ahruman 2008-05-29
11853 OOCreditsQuantity fine = 500 + ((local_gov < 2 || local_gov > 5) ? 500 : 0);
11854 fine *= legalStatus;
11855 if (fine > credits)
11856 {
11857 int payback = (int)(legalStatus * credits / fine);
11858 [self setBounty:(legalStatus-payback) withReason:kOOLegalStatusReasonPaidFine];
11859 credits = 0;
11860 }
11861 else
11862 {
11863 [self setBounty:0 withReason:kOOLegalStatusReasonPaidFine];
11864 credits -= fine;
11865 }
11866
11867 // one of the fined-@-credits strings includes expansion tokens
11868 NSString *fined_message = [NSString stringWithFormat:OOExpandKey(@"fined-@-credits"), OOCredits(fine)];
11869 [self addMessageToReport:fined_message];
11870 [UNIVERSE forceWitchspaceEntries];
11871 ship_clock_adjust += 24 * 3600; // take up a day
11872}

◆ getFirstKeyCode:

- (int) getFirstKeyCode: (NSArray*) key_def

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ 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 9211 of file PlayerEntity.m.

13321{
13322 return missionDestinations;
13323}

Referenced by MissionGetProperty().

+ Here is the caller graph for this function:

◆ getTargetDockStation

- (StationEntity *) getTargetDockStation

Definition at line 13699 of file PlayerEntity.m.

4487{
4488 return targetDockStation;
4489}
StationEntity * targetDockStation

◆ gui_screen_string

- (NSString *) gui_screen_string

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ guiScreen

- (OOGUIScreenID) guiScreen

Definition at line 9211 of file PlayerEntity.m.

11325{
11326 return gui_screen;
11327}

Referenced by OOJavaScriptEngine(OOMonitorSupportInternal)::sendMonitorLogMessage:withMessageClass:inContext:.

+ Here is the caller graph for this function:

◆ handleAutopilotOn:

- (void) handleAutopilotOn: (BOOL) fastDocking
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ handleButtonIdent

- (void) handleButtonIdent
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

5636{
5637 // Clear current target if we're already in Ident mode
5638 if (ident_engaged) [self noteLostTarget];
5639
5640 [self safeAllMissiles];
5641 ident_engaged = YES;
5642 if ([self primaryTarget] == nil)
5643 {
5644 [self playIdentOn];
5645 [UNIVERSE addMessage:OOExpandKey(@"ident-on") forCount:2.0];
5646 }
5647 else
5648 {
5649 [self playIdentLockedOn];
5650 [self printIdentLockedOnForMissile:NO];
5651 }
5652}

◆ handleButtonTargetMissile

- (void) handleButtonTargetMissile
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ handleGameOptionsScreenKeys

- (void) handleGameOptionsScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

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

3965{
3966 MyOpenGLView *gameView = [UNIVERSE gameView];
3967 GuiDisplayGen *gui = [UNIVERSE gui];
3968
3969 [self handleKeyboardLayoutEntryKeys: gui view: gameView];
3970 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];
3972 {
3973 NSString *key = [gui keyForRow: [gui selectedRow]];
3974 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
3975 {
3976 key = [gui keyForRow:GUI_ROW_KC_FUNCEND];
3977 }
3978 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
3979 {
3980 key = [gui keyForRow:GUI_ROW_KC_FUNCSTART];
3981 }
3982 int from_function = 0;
3983 NSArray *keyComponents = [key componentsSeparatedByString:@":"];
3984 if ([keyComponents count] > 1)
3985 {
3986 from_function = [keyComponents oo_intAtIndex:1];
3987 if (from_function < 0) from_function = 0;
3988
3989 [self setGuiToKeyboardLayoutScreen:from_function resetCurrentRow:YES];
3990 if ([[UNIVERSE gui] selectedRow] < GUI_ROW_KC_FUNCSTART)
3991 {
3992 [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART];
3993 }
3994 if (from_function == 0)
3995 {
3996 [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1];
3997 }
3998 }
3999 }
4000}
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 167 of file PlayerEntityControls.m.

3926{
3927 MyOpenGLView *gameView = [UNIVERSE gameView];
3928 GuiDisplayGen *gui = [UNIVERSE gui];
3929
3930 [self keyMapperInputHandler: gui view: gameView];
3931 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];
3933 {
3934 NSString *key = [gui keyForRow: [gui selectedRow]];
3935 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
3936 {
3937 key = [gui keyForRow:GUI_ROW_KC_FUNCEND];
3938 }
3939 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
3940 {
3941 key = [gui keyForRow:GUI_ROW_KC_FUNCSTART];
3942 }
3943 int from_function = 0;
3944 NSArray *keyComponents = [key componentsSeparatedByString:@":"];
3945 if ([keyComponents count] > 1)
3946 {
3947 from_function = [keyComponents oo_intAtIndex:1];
3948 if (from_function < 0) from_function = 0;
3949
3950 [self setGuiToKeyMapperScreen:from_function resetCurrentRow: YES];
3951 if ([[UNIVERSE gui] selectedRow] < GUI_ROW_KC_FUNCSTART)
3952 {
3953 [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART];
3954 }
3955 if (from_function == 0)
3956 {
3957 [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1];
3958 }
3959 }
3960 }
3961}

◆ handleMissionCallback

- (void) handleMissionCallback
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ handleStickMapperScreenKeys

- (void) handleStickMapperScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

4004{
4005 MyOpenGLView *gameView = [UNIVERSE gameView];
4006 GuiDisplayGen *gui = [UNIVERSE gui];
4007
4008 [self stickMapperInputHandler: gui view: gameView];
4009 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];
4011 {
4012 NSString *key = [gui keyForRow: [gui selectedRow]];
4013 if ([self checkKeyPress:n_key_gui_arrow_right] || [self checkKeyPress:n_key_gui_page_down])
4014 {
4015 key = [gui keyForRow:GUI_ROW_FUNCEND];
4016 }
4017 if ([self checkKeyPress:n_key_gui_arrow_left] || [self checkKeyPress:n_key_gui_page_up])
4018 {
4019 key = [gui keyForRow:GUI_ROW_FUNCSTART];
4020 }
4021 int from_function = 0;
4022 NSArray *keyComponents = [key componentsSeparatedByString:@":"];
4023 if ([keyComponents count] > 1)
4024 {
4025 from_function = [keyComponents oo_intAtIndex:1];
4026 if (from_function < 0) from_function = 0;
4027
4028 [self setGuiToStickMapperScreen:from_function resetCurrentRow: YES];
4029 if ([[UNIVERSE gui] selectedRow] < GUI_ROW_FUNCSTART)
4030 {
4031 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART];
4032 }
4033 if (from_function == 0)
4034 {
4035 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART + MAX_ROWS_FUNCTIONS - 1];
4036 }
4037 }
4038 }
4039 if([gameView isDown:' ']) [self setGuiToGameOptionsScreen];
4040}

◆ handleUndockControl

- (void) handleUndockControl
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

4929{
4930 // FIXME: should this not be in leaveDock:? (Note: leaveDock: is also called from script method launchFromStation and -[StationEntity becomeExplosion]) -- Ahruman 20080308
4931 [UNIVERSE setUpUniverseFromStation]; // player pre-launch
4932 if ([self dockedStation] == nil) [self setDockedAtMainStation];
4933
4934 StationEntity *dockedStation = [self dockedStation];
4935 if (dockedStation == [UNIVERSE station] && [UNIVERSE autoSaveNow] && !([[UNIVERSE sun] goneNova] || [[UNIVERSE sun] willGoNova]))
4936 {
4937 [self autosavePlayer];
4938 }
4939 [self launchFromStation];
4940}

◆ hasHostileTarget

- (BOOL) hasHostileTarget
implementation

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

11829{
11830 ShipEntity *playersTarget = [self primaryTarget];
11831 return ([playersTarget isShip] && [playersTarget hasHostileTarget] && [playersTarget primaryTarget] == self);
11832}

◆ hasOneEquipmentItem:includeMissiles:

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

Definition at line 9211 of file PlayerEntity.m.

11720 :(NSString *)itemKey includeMissiles:(BOOL)includeMissiles
11721{
11722 // Check basic equipment the normal way.
11723 if ([super hasOneEquipmentItem:itemKey includeMissiles:NO whileLoading:NO]) return YES;
11724
11725 // Custom handling for player missiles.
11726 if (includeMissiles)
11727 {
11728 unsigned i;
11729 for (i = 0; i < max_missiles; i++)
11730 {
11731 if ([[self missileForPylon:i] hasPrimaryRole:itemKey]) return YES;
11732 }
11733 }
11734
11735 if ([itemKey isEqualToString:@"EQ_TRUMBLE"])
11736 {
11737 return [self trumbleCount] > 0;
11738 }
11739
11740 return NO;
11741}

◆ hasPrimaryWeapon:

- (BOOL) hasPrimaryWeapon: (OOWeaponType) weaponType
implementation

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

11744 :(OOWeaponType)weaponType
11745{
11746 if ([[forward_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11747 [[aft_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11748 [[port_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11749 [[starboard_weapon_type identifier] isEqualToString:[weaponType identifier]])
11750 {
11751 return YES;
11752 }
11753
11754 return [super hasPrimaryWeapon:weaponType];
11755}
OOEquipmentType * OOWeaponType
Definition ShipEntity.h:168

◆ hasSufficientFuelForJump

- (BOOL) hasSufficientFuelForJump

Definition at line 13699 of file PlayerEntity.m.

7476{
7477 return fuel >= [self fuelRequiredForJump];
7478}

◆ highlightEquipShipScreenKey:

- (void) highlightEquipShipScreenKey: (NSString *) key

Definition at line 9211 of file PlayerEntity.m.

9214 :(NSString *)key
9215{
9216 int i=0;
9217 OOGUIRow row;
9218 NSString *otherKey = @"";
9219 GuiDisplayGen *gui = [UNIVERSE gui];
9220 [last_outfitting_key release];
9221 last_outfitting_key = [key copy];
9222 [self setGuiToEquipShipScreen:-1];
9223 key = last_outfitting_key;
9224 // TODO: redo the equipShipScreen in a way that isn't broken. this whole method 'works'
9225 // based on the way setGuiToEquipShipScreen 'worked' on 20090913 - Kaks
9226
9227 // setGuiToEquipShipScreen doesn't take a page number, it takes an offset from the beginning
9228 // of the dictionary, the first line will show the key at that offset...
9229
9230 // try the last page first - 10 pages max.
9231 while (otherKey)
9232 {
9233 [self setGuiToEquipShipScreen:i];
9234 for (row = GUI_ROW_EQUIPMENT_START;row<=GUI_MAX_ROWS_EQUIPMENT+2;row++)
9235 {
9236 otherKey = [gui keyForRow:row];
9237 if (!otherKey)
9238 {
9239 [self setGuiToEquipShipScreen:0];
9240 return;
9241 }
9242 if ([otherKey isEqualToString:key])
9243 {
9244 [gui setSelectedRow:row];
9245 [self showInformationForSelectedUpgrade];
9246 return;
9247 }
9248 }
9249 if ([otherKey hasPrefix:@"More:"])
9250 {
9251 i = [[otherKey componentsSeparatedByString:@":"] oo_intAtIndex:1];
9252 }
9253 else
9254 {
9255 [self setGuiToEquipShipScreen:0];
9256 return;
9257 }
9258 }
9259}
@ GUI_MAX_ROWS_EQUIPMENT
@ GUI_ROW_EQUIPMENT_START
static NSString * last_outfitting_key

◆ homeInfoSystem

- (void) homeInfoSystem

Definition at line 13699 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.

561 : (int)hwFlags
562{
563 NSString *hwString;
564 switch(hwFlags)
565 {
566 case HW_AXIS:
567 hwString = @"axis";
568 break;
569 case HW_BUTTON:
570 hwString = @"button";
571 break;
572 default:
573 hwString = @"axis/button";
574 }
575 return hwString;
576}

◆ hyperspaceJumpDistance

- (double) hyperspaceJumpDistance
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

7463{
7464 NSPoint targetCoordinates = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:[self nextHopTargetSystemID] inGalaxy:galaxy_number]);
7465 return distanceBetweenPlanetPositions(targetCoordinates.x,targetCoordinates.y,galaxy_coordinates.x,galaxy_coordinates.y);
7466}
OOSystemID nextHopTargetSystemID()
OOINLINE double distanceBetweenPlanetPositions(int x1, int y1, int x2, int y2) INLINE_CONST_FUNC

◆ hyperspeedEngaged

- (BOOL) hyperspeedEngaged

Definition at line 13699 of file PlayerEntity.m.

3731{
3732 return hyperspeed_engaged;
3733}

◆ 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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ infoSystemID

- (OOSystemID) infoSystemID

Definition at line 13699 of file PlayerEntity.m.

754{
755 return info_system_id;
756}

◆ infoSystemOnRoute

- (BOOL) infoSystemOnRoute

Definition at line 13699 of file PlayerEntity.m.

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

◆ init

- (id) init
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

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

◆ 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 167 of file PlayerEntityControls.m.

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

◆ initialiseMissionDestinations:andLegacy:

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

Definition at line 9211 of file PlayerEntity.m.

13247 :(NSDictionary *)destinations andLegacy:(NSArray *)legacy
13248{
13249 NSEnumerator *keyEnum = nil;
13250 NSString *key = nil;
13251 id value = nil;
13252
13253 /* same need to make inner objects mutable as in localPlanetInfoOverrides */
13254
13255 [missionDestinations release];
13256 missionDestinations = [[NSMutableDictionary alloc] init];
13257
13258 for (keyEnum = [destinations keyEnumerator]; (key = [keyEnum nextObject]); )
13259 {
13260 value = [destinations objectForKey:key];
13261 if (value != nil)
13262 {
13263 if ([value isKindOfClass:[NSDictionary class]])
13264 {
13265 value = [value mutableCopy];
13266 [missionDestinations setObject:value forKey:key];
13267 [value release];
13268 }
13269 }
13270 }
13271
13272 if (legacy != nil)
13273 {
13274 OOSystemID dest;
13275 NSNumber *legacyMarker;
13276 for (keyEnum = [legacy objectEnumerator]; (legacyMarker = [keyEnum nextObject]); )
13277 {
13278 dest = [legacyMarker intValue];
13279 [self addMissionDestinationMarker:[self defaultMarker:dest]];
13280 }
13281 }
13282
13283}

◆ initKeyConfigSettings

- (void) initKeyConfigSettings

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

3725{
3726 return afterburner_engaged;
3727}

◆ insideAtmosphereFraction

- (GLfloat) insideAtmosphereFraction

Definition at line 13699 of file PlayerEntity.m.

2587{
2588 GLfloat insideAtmoFrac = 0.0f;
2589
2590 if ([UNIVERSE airResistanceFactor] > 0.01) // player is inside planetary atmosphere
2591 {
2592 insideAtmoFrac = 1.0f - ([self dialAltitude] * (GLfloat)PLAYER_DIAL_MAX_ALTITUDE / (10.0f * (GLfloat)ATMOSPHERE_DEPTH));
2593 }
2594
2595 return insideAtmoFrac;
2596}
#define ATMOSPHERE_DEPTH
GLfloat dialAltitude()

◆ inspCanBecomeTarget

- (BOOL) inspCanBecomeTarget
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

219{
220 return NO;
221}

◆ inspDescription

- (NSString *) inspDescription
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

225{
226 return @"Player";
227}

◆ inspSecondaryIdentityLine

- (NSString *) inspSecondaryIdentityLine
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

213{
214 return [NSString stringWithFormat:NSLocalizedStringFromTableInBundle(@"\"%@\", %@", nil, [NSBundle bundleForClass:[self class]], @""), [self commanderName], [self displayName]];
215}

◆ installedEnergyUnitType

- (OOEnergyUnitType) installedEnergyUnitType

Definition at line 13699 of file PlayerEntity.m.

6103{
6104 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"]) return ENERGY_UNIT_NAVAL;
6105 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"]) return ENERGY_UNIT_NORMAL;
6106 return ENERGY_UNIT_NONE;
6107}

◆ interpretAIMessage:

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

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

5830 :(NSString *)ms
5831{
5832 if ([ms isEqual:@"HOLD_FULL"])
5833 {
5834 [self playHoldFull];
5835 [UNIVERSE addMessage:DESC(@"hold-full") forCount:4.5];
5836 }
5837
5838 if ([ms isEqual:@"INCOMING_MISSILE"])
5839 {
5840 if ([self primaryAggressor] != nil)
5841 {
5842 [self playIncomingMissile:HPVectorToVector([[self primaryAggressor] position])];
5843 }
5844 else
5845 {
5846 [self playIncomingMissile:kZeroVector];
5847 }
5848 [UNIVERSE addMessage:DESC(@"incoming-missile") forCount:4.5];
5849 }
5850
5851 if ([ms isEqual:@"ENERGY_LOW"])
5852 {
5853 [UNIVERSE addMessage:DESC(@"energy-low") forCount:6.0];
5854 }
5855
5856 if ([ms isEqual:@"ECM"] && ![self isDocked]) [self playHitByECMSound];
5857
5858 if ([ms isEqual:@"DOCKING_REFUSED"] && [self status] == STATUS_AUTOPILOT_ENGAGED)
5859 {
5860 [self playDockingDenied];
5861 [UNIVERSE addMessage:DESC(@"autopilot-denied") forCount:4.5];
5862 autopilot_engaged = NO;
5863 [self resetAutopilotAI];
5865 [self setStatus:STATUS_IN_FLIGHT];
5867 [self doScriptEvent:OOJSID("playerDockingRefused")];
5868 }
5869
5870 // aegis messages to advanced compass so in planet mode it behaves like the old compass
5871 if (compassMode != COMPASS_MODE_BASIC)
5872 {
5873 if ([ms isEqual:@"AEGIS_CLOSE_TO_MAIN_PLANET"]&&(compassMode == COMPASS_MODE_PLANET))
5874 {
5875 [self playAegisCloseToPlanet];
5876 [self setCompassMode:COMPASS_MODE_STATION];
5877 }
5878 if ([ms isEqual:@"AEGIS_IN_DOCKING_RANGE"]&&(compassMode == COMPASS_MODE_PLANET))
5879 {
5880 [self playAegisCloseToStation];
5881 [self setCompassMode:COMPASS_MODE_STATION];
5882 }
5883 if ([ms isEqual:@"AEGIS_NONE"]&&(compassMode == COMPASS_MODE_STATION))
5884 {
5885 [self setCompassMode:COMPASS_MODE_PLANET];
5886 }
5887 }
5888}

◆ 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 9211 of file PlayerEntity.m.

13073{
13074 BOOL isDockedStatus = NO;
13075
13076 switch ([self status])
13077 {
13078 case STATUS_DOCKED:
13079 case STATUS_DOCKING:
13080 case STATUS_START_GAME:
13081 isDockedStatus = YES;
13082 break;
13083 // special case - can be either docked or not, so avoid safety check below
13084 case STATUS_RESTART_GAME:
13085 return NO;
13086 case STATUS_EFFECT:
13087 case STATUS_ACTIVE:
13088 case STATUS_COCKPIT_DISPLAY:
13089 case STATUS_TEST:
13090 case STATUS_INACTIVE:
13091 case STATUS_DEAD:
13092 case STATUS_IN_FLIGHT:
13093 case STATUS_AUTOPILOT_ENGAGED:
13094 case STATUS_LAUNCHING:
13095 case STATUS_WITCHSPACE_COUNTDOWN:
13096 case STATUS_ENTERING_WITCHSPACE:
13097 case STATUS_EXITING_WITCHSPACE:
13098 case STATUS_ESCAPE_SEQUENCE:
13099 case STATUS_IN_HOLD:
13100 case STATUS_BEING_SCOOPED:
13101 case STATUS_HANDLING_ERROR:
13102 break;
13103 //no default, so that we get notified by the compiler if something is missing
13104 }
13105
13106#ifndef NDEBUG
13107 // Sanity check
13108 if (isDockedStatus)
13109 {
13110 if ([self dockedStation] == nil)
13111 {
13112 //there are a number of possible current statuses, not just STATUS_DOCKED
13113 OOLogERR(kOOLogInconsistentState, @"status is %@, but dockedStation is nil; treating as not docked. %@", OOStringFromEntityStatus([self status]), @"This is an internal error, please report it.");
13114 [self setStatus:STATUS_IN_FLIGHT];
13115 isDockedStatus = NO;
13116 }
13117 }
13118 else
13119 {
13120 if ([self dockedStation] != nil && [self status] != STATUS_LAUNCHING)
13121 {
13122 OOLogERR(kOOLogInconsistentState, @"status is %@, but dockedStation is not nil; treating as docked. %@", OOStringFromEntityStatus([self status]), @"This is an internal error, please report it.");
13123 [self setStatus:STATUS_DOCKED];
13124 isDockedStatus = YES;
13125 }
13126 }
13127#endif
13128
13129 return isDockedStatus;
13130}
NSString * OOStringFromEntityStatus(OOEntityStatus status) CONST_FUNC
NSString *const kOOLogInconsistentState
Definition OOLogging.m:650

◆ isMining

- (BOOL) isMining
implementation

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

11486{
11487 return using_mining_laser;
11488}

◆ isMouseControlOn

- (BOOL) isMouseControlOn

Definition at line 13699 of file PlayerEntity.m.

4690{
4691 return mouse_control_on;
4692}

◆ 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 13699 of file PlayerEntity.m.

3982 :(Entity*)target
3983{
3984 // Just in case we got called with a bad target.
3985 if (!target)
3986 return NO;
3987
3988 // If target is beyond scanner range, it's lost
3989 if(target->zero_distance > SCANNER_MAX_RANGE2)
3990 return NO;
3991
3992 // If target is a ship, check whether it's cloaked or is actively jamming our scanner
3993 if ([target isShip])
3994 {
3995 ShipEntity *targetShip = (ShipEntity*)target;
3996 if ([targetShip isCloaked] || // checks for cloaked ships
3997 ([targetShip isJammingScanning] && ![self hasMilitaryScannerFilter])) // checks for activated jammer
3998 {
3999 return NO;
4000 }
4001 OOEntityStatus tstatus = [targetShip status];
4002 if (tstatus == STATUS_ENTERING_WITCHSPACE || tstatus == STATUS_IN_HOLD || tstatus == STATUS_DOCKED)
4003 { // checks for ships entering wormholes, docking, or been scooped
4004 return NO;
4005 }
4006 return YES;
4007 }
4008
4009 // If target is an unexpired wormhole and the player has bought the Wormhole Scanner and we're in ID mode
4010 if ([target isWormhole] && [target scanClass] != CLASS_NO_DRAW &&
4011 [self hasEquipmentItemProviding:@"EQ_WORMHOLE_SCANNER"] && ident_engaged)
4012 {
4013 return YES;
4014 }
4015
4016 // Target is neither a wormhole nor a ship
4017 return NO;
4018}
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 9211 of file PlayerEntity.m.

13031{
13032 return _jumpCause;
13033}

◆ 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 13699 of file PlayerEntity.m.

4683{
4684 //return keyconfig_settings;
4685 return keyconfig2_settings;
4686}

◆ 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 13699 of file PlayerEntity.m.

4794{
4795 GLfloat result = (GLfloat)weapon_temp / (GLfloat)PLAYER_MAX_WEAPON_TEMP;
4796 return OOClamp_0_1_f(result);
4797}

◆ laserHeatLevelAft

- (GLfloat) laserHeatLevelAft
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

4801{
4802 GLfloat result = aft_weapon_temp / (GLfloat)PLAYER_MAX_WEAPON_TEMP;
4803 return OOClamp_0_1_f(result);
4804}

◆ laserHeatLevelForward

- (GLfloat) laserHeatLevelForward
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

4808{
4809 GLfloat result = forward_weapon_temp / (GLfloat)PLAYER_MAX_WEAPON_TEMP;
4810// no need to check subents here
4811 return OOClamp_0_1_f(result);
4812}

◆ laserHeatLevelPort

- (GLfloat) laserHeatLevelPort
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

4816{
4817 GLfloat result = port_weapon_temp / PLAYER_MAX_WEAPON_TEMP;
4818 return OOClamp_0_1_f(result);
4819}

◆ laserHeatLevelStarboard

- (GLfloat) laserHeatLevelStarboard
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

4823{
4825 return OOClamp_0_1_f(result);
4826}

◆ lastsaveName

- (NSString *) lastsaveName

Definition at line 9211 of file PlayerEntity.m.

13051{
13052 return _lastsaveName;
13053}

◆ launchEscapeCapsule

- (ShipEntity *) launchEscapeCapsule
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6560{
6561 ShipEntity *doppelganger = nil;
6562 ShipEntity *escapePod = nil;
6563
6564 if ([UNIVERSE displayGUI]) [self switchToMainView]; // Clear the F7 screen!
6565 [UNIVERSE setViewDirection:VIEW_FORWARD];
6566
6567 if ([self status] == STATUS_DEAD) return nil;
6568
6569 /*
6570 While inside the escape pod, we need to block access to all player.ship properties,
6571 since we're not supposed to be inside our ship anymore! -- Kaks 20101114
6572 */
6573
6574 [UNIVERSE setBlockJSPlayerShipProps:YES]; // no player.ship properties while inside the pod!
6575 // if a specific amount of time has been provided for the rescue, use it now
6576 if (escape_pod_rescue_time > 0)
6577 {
6579 escape_pod_rescue_time = 0; // reset value
6580 }
6581 else
6582 {
6583 // otherwise, use the default time calc
6584 ship_clock_adjust += 43200 + 5400 * (ranrot_rand() & 127); // add up to 8 days until rescue!
6585 }
6588
6589 doppelganger = [self createDoppelganger];
6590 if (doppelganger)
6591 {
6592 [doppelganger setVelocity:vector_multiply_scalar(v_forward, flightSpeed)];
6593 [doppelganger setSpeed:0.0];
6594 [doppelganger setDesiredSpeed:0.0];
6595 [doppelganger setRoll:0.2 * (randf() - 0.5)];
6596 [doppelganger setOwner:self];
6597 [doppelganger setThrust:0]; // drifts
6598 [UNIVERSE addEntity:doppelganger];
6599 }
6600
6601 [self setFoundTarget:doppelganger]; // must do this before setting status
6602 [self setStatus:STATUS_ESCAPE_SEQUENCE]; // now set up the escape sequence.
6603
6604
6605 // must do this before next step or uses BBox of pod, not old ship!
6606 float sheight = (float)(boundingBox.max.y - boundingBox.min.y);
6607 position = HPvector_subtract(position, vectorToHPVector(vector_multiply_scalar(v_up, sheight)));
6608 float sdepth = (float)(boundingBox.max.z - boundingBox.min.z);
6609 position = HPvector_subtract(position, vectorToHPVector(vector_multiply_scalar(v_forward, sdepth/2.0)));
6610
6611 // set up you
6612 escapePod = [UNIVERSE newShipWithName:@"escape-capsule"]; // retained
6613 if (escapePod != nil)
6614 {
6615 // FIXME: this should use OOShipType, which should exist. -- Ahruman
6616 [self setMesh:[escapePod mesh]];
6617 }
6618
6619 /* These used to be non-zero, but BEHAVIOUR_IDLE levels off flight
6620 * anyway, and inertial velocity is used instead of inertialess
6621 * thrust - CIM */
6622 flightSpeed = 0.0f;
6623 flightPitch = 0.0f;
6624 flightRoll = 0.0f;
6625 flightYaw = 0.0f;
6626 // and turn off inertialess drive
6627 thrust = 0.0f;
6628
6629
6630 /* Add an impulse upwards and backwards to the escape pod. This avoids
6631 flying straight through the doppelganger in interstellar space or when
6632 facing the main station/escape target, and generally looks cool.
6633 -- Ahruman 2011-04-02
6634 */
6635 Vector launchVector = vector_add([doppelganger velocity],
6636 vector_add(vector_multiply_scalar(v_up, 15.0f),
6637 vector_multiply_scalar(v_forward, -90.0f)));
6638 [self setVelocity:launchVector];
6639
6640
6641
6642 // if multiple items providing escape pod, remove the first one
6643 [self removeEquipmentItem:[self equipmentItemProviding:@"EQ_ESCAPE_POD"]];
6644
6645
6646 // set up the standard location where the escape pod will dock.
6647 target_system_id = system_id; // we're staying in this system
6649 [self setDockTarget:[UNIVERSE station]]; // we're docking at the main station, if there is one
6650
6651 [self doScriptEvent:OOJSID("shipLaunchedEscapePod") withArgument:escapePod]; // no player.ship properties should be available to script
6652
6653 // reset legal status
6654 [self setBounty:0 withReason:kOOLegalStatusReasonEscapePod];
6655 bounty = 0;
6656
6657 // new ship, so lose some memory of player actions
6658 if (ship_kills >= 6400)
6659 {
6660 [self clearRolesFromPlayer:0.1];
6661 }
6662 else if (ship_kills >= 2560)
6663 {
6664 [self clearRolesFromPlayer:0.25];
6665 }
6666 else
6667 {
6668 [self clearRolesFromPlayer:0.5];
6669 }
6670
6671 // reset trumbles
6672 if (trumbleCount != 0) trumbleCount = 1;
6673
6674 // remove cargo
6675 [cargo removeAllObjects];
6676
6677 energy = 25;
6678 [UNIVERSE addMessage:DESC(@"escape-sequence") forCount:4.5];
6679 [self resetShotTime];
6680
6681 // need to zero out all facings shot_times too, otherwise we may end up
6682 // with a broken escape pod sequence - Nikos 20100909
6683 forward_shot_time = 0.0;
6684 aft_shot_time = 0.0;
6685 port_shot_time = 0.0;
6686 starboard_shot_time = 0.0;
6687
6688 [escapePod release];
6689
6690 return doppelganger;
6691}
void setThrust:(double amount)
void setOwner:(Entity *who_owns_entity)

◆ launchFromStation

- (void) launchFromStation

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ launchMine:

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

Definition at line 13699 of file PlayerEntity.m.

5971 :(ShipEntity*) mine
5972{
5973 if (!mine)
5974 return nil;
5975
5976 if (![self weaponsOnline])
5977 return nil;
5978
5979 [mine setOwner: self];
5980 [mine setBehaviour: BEHAVIOUR_IDLE];
5981 [self dumpItem: mine]; // includes UNIVERSE addEntity: CLASS_CARGO, STATUS_IN_FLIGHT, AI state GLOBAL ( the last one starts the timer !)
5982 [mine setScanClass: CLASS_MINE];
5983
5984 float mine_speed = 500.0f;
5985 Vector mvel = vector_subtract([mine velocity], vector_multiply_scalar(v_forward, mine_speed));
5986 [mine setVelocity: mvel];
5987 [self doScriptEvent:OOJSID("shipReleasedEquipment") withArgument:mine];
5988 return mine;
5989}

◆ leaveDock:

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

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

7207 :(StationEntity *)station
7208{
7209 if (station == nil) return;
7210 NSParameterAssert(station == [self dockedStation]);
7211
7212 // ensure we've not left keyboard entry on
7213 [[UNIVERSE gameView] allowStringInput: NO];
7214
7215 if (gui_screen == GUI_SCREEN_MISSION)
7216 {
7217 [[UNIVERSE gui] clearBackground];
7219 {
7220 [self doMissionCallback];
7221 }
7222 // notify older scripts, but do not trigger missionScreenOpportunity.
7223 [self doWorldEventUntilMissionScreen:OOJSID("missionScreenEnded")];
7224 }
7225
7226 if ([station marketMonitored])
7227 {
7228 // 'leaving with those guns were you sir?'
7229 OOCreditsQuantity oldbounty = [self bounty];
7230 [self markAsOffender:[station legalStatusOfManifest:shipCommodityData export:YES] withReason:kOOLegalStatusReasonIllegalExports];
7231 if ([self bounty] > oldbounty)
7232 {
7233 [self addRoleToPlayer:@"trader-smuggler"];
7234 }
7235 }
7236 OOGUIScreenID oldScreen = gui_screen;
7237 gui_screen = GUI_SCREEN_MAIN;
7238 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
7239
7240 if (![hud nonlinearScanner])
7241 {
7242 [hud setScannerZoom: 1.0];
7243 }
7244 [self loadCargoPods];
7245 // do not do anything that calls JS handlers between now and calling
7246 // [station launchShip] below, or the cargo returned by JS may be off
7247 // CIM - 3.2.2012
7248
7249 // clear the way
7250 [station autoDockShipsOnApproach];
7251 [station clearDockingCorridor];
7252
7253// [self setAlertFlag:ALERT_FLAG_DOCKED to:NO];
7254 [self clearAlertFlags];
7255 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
7256
7257 scanner_zoom_rate = 0.0f;
7259 [self currentWeaponStats];
7260
7261 forward_weapon_temp = 0.0f;
7262 aft_weapon_temp = 0.0f;
7263 port_weapon_temp = 0.0f;
7264 starboard_weapon_temp = 0.0f;
7265
7266 forward_shield = [self maxForwardShieldLevel];
7267 aft_shield = [self maxAftShieldLevel];
7268
7269 [self clearTargetMemory];
7270 [self setShowDemoShips:NO];
7271 [UNIVERSE setDisplayText:NO];
7272 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
7273
7274 [[UNIVERSE gameView] clearKeys]; // try to stop keybounces
7275
7276 if ([self isMouseControlOn])
7277 {
7278 [[UNIVERSE gameView] resetMouse];
7279 }
7280
7282
7283 [UNIVERSE forceWitchspaceEntries];
7284 ship_clock_adjust += 600.0; // 10 minutes to leave dock
7285 velocity = kZeroVector; // just in case
7286
7287 [station launchShip:self];
7288
7289 launchRoll = -flightRoll; // save the station's spin. (inverted for player)
7290 flightRoll = 0; // don't spin when showing the break pattern.
7291 [UNIVERSE setUpBreakPattern:[self breakPatternPosition] orientation:orientation forDocking:YES];
7292
7293 [self setDockedStation:nil];
7294
7296 [self checkForAegis];
7298 ident_engaged = NO;
7299
7300 [UNIVERSE removeDemoShips];
7301 // MKW - ensure GUI Screen ship is removed
7302 [demoShip release];
7303 demoShip = nil;
7304
7305 [self playLaunchFromStation];
7306}
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 13699 of file PlayerEntity.m.

7794{
7795 double d1 = SCANNER_MAX_RANGE * ((Ranrot() & 255)/256.0 - 0.5);
7796 HPVector pos = [UNIVERSE getWitchspaceExitPosition]; // no need to reset the PRNG
7797 Quaternion q1;
7798 HPVector whpos, exitpos;
7799
7800 double min_d1 = [UNIVERSE safeWitchspaceExitDistance];
7802 if (abs((int)d1) < min_d1)
7803 {
7804 d1 += ((d1 > 0.0)? min_d1: -min_d1); // not too close to the buoy.
7805 }
7806 HPVector v1 = HPvector_forward_from_quaternion(q1);
7807 exitpos = HPvector_add(pos, HPvector_multiply_scalar(v1, d1)); // randomise exit position
7808 position = exitpos;
7809 [self setOrientation:[UNIVERSE getWitchspaceExitRotation]];
7810
7811 // While setting the wormhole position to the player position looks very nice for ships following the player,
7812 // the more common case of the player following other ships, the player tends to
7813 // ram the back of the ships, or even jump on top of is when the ship jumped without initial speed, which is messy.
7814 // To avoid this problem, a small wormhole displacement is added.
7815 if (wormhole) // will be nil for galactic jump
7816 {
7817 if ([[wormhole shipsInTransit] count] > 0)
7818 {
7819 // player is not allone in his wormhole, synchronise player and wormhole position.
7820 double wh_arrival_time = ([PLAYER clockTimeAdjusted] - [wormhole arrivalTime]);
7821 if (wh_arrival_time > 0)
7822 {
7823 // Player is following other ship
7824 whpos = HPvector_add(exitpos, vectorToHPVector(vector_multiply_scalar([self forwardVector], 1000.0f)));
7825 [wormhole setContainsPlayer:YES];
7826 }
7827 else
7828 {
7829 // Player is the leadship
7830 whpos = HPvector_add(exitpos, vectorToHPVector(vector_multiply_scalar([self forwardVector], -500.0f)));
7831 // so it won't contain the player by the time they exit
7832 [wormhole setExitSpeed:maxFlightSpeed*WORMHOLE_LEADER_SPEED_FACTOR];
7833 }
7834
7835 HPVector distance = HPvector_subtract(whpos, pos);
7836 if (HPmagnitude2(distance) < min_d1*min_d1 ) // within safety distance from the buoy?
7837 {
7838 // the wormhole is to close to the buoy. Move both player and wormhole away from it in the x-y plane.
7839 distance.z = 0;
7840 distance = HPvector_multiply_scalar(HPvector_normal(distance), min_d1);
7841 whpos = HPvector_add(whpos, distance);
7842 position = HPvector_add(position, distance);
7843 }
7844 [wormhole setExitPosition: whpos];
7845 }
7846 else
7847 {
7848 // no-one else in the wormhole
7849 [wormhole setExitSpeed:maxFlightSpeed*WORMHOLE_LEADER_SPEED_FACTOR];
7850 }
7851 }
7852 /* there's going to be a slight pause at this stage anyway;
7853 * there's also going to be a lot of stale ship scripts. Force a
7854 * garbage collection while we have chance. - CIM */
7856 flightSpeed = wormhole ? [wormhole exitSpeed] : fmin(maxFlightSpeed,50.0f);
7857 [wormhole release]; // OK even if nil
7858 wormhole = nil;
7859
7860 flightRoll = 0.0f;
7861 flightPitch = 0.0f;
7862 flightYaw = 0.0f;
7863
7865 [self setStatus:STATUS_EXITING_WITCHSPACE];
7866 gui_screen = GUI_SCREEN_MAIN;
7867 being_fined = NO; // until you're scanned by a copper!
7868 [self clearTargetMemory];
7869 [self setShowDemoShips:NO];
7870 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
7871 [UNIVERSE setDisplayText:NO];
7872 [UNIVERSE setWitchspaceBreakPattern:YES];
7873 [self playExitWitchspace];
7874 if ([self currentSystemID] >= 0)
7875 {
7876 if (![roleSystemList containsObject:[NSNumber numberWithInt:[self currentSystemID]]])
7877 {
7878 // going somewhere new?
7879 [self clearRoleFromPlayer:NO];
7880 }
7881 }
7882
7884 {
7885 [self doScriptEvent:OOJSID("playerEnteredNewGalaxy") withArgument:[NSNumber numberWithUnsignedInt:galaxy_number]];
7886 }
7887
7888 [self doScriptEvent:OOJSID("shipWillExitWitchspace") withArgument:[self jumpCause]];
7889 [UNIVERSE setUpBreakPattern:[self breakPatternPosition] orientation:orientation forDocking:NO];
7890}
#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 13699 of file PlayerEntity.m.

8383{
8384 NSString *good = nil;
8385 OOCargoQuantity amount;
8386 unsigned penalty = 0;
8387
8388 foreach (good, [shipCommodityData goods])
8389 {
8390 amount = [shipCommodityData quantityForGood:good];
8391 penalty += [shipCommodityData exportLegalityForGood:good] * amount;
8392 }
8393 return penalty;
8394}

◆ loadCargoPods

- (void) loadCargoPods

Definition at line 13699 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 13699 of file PlayerEntity.m.

413 :(OOCommodityType)type amount:(OOCargoQuantity)quantity
414{
415 OOMassUnit unit = [shipCommodityData massUnitForGood:type];
416
417 while (quantity)
418 {
419 if (unit != UNITS_TONS)
420 {
421 int amount_per_container = (unit == UNITS_KILOGRAMS)? KILOGRAMS_PER_POD : GRAMS_PER_POD;
422 while (quantity > 0)
423 {
424 int smaller_quantity = 1 + ((quantity - 1) % amount_per_container);
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;
442 if (amount > MAX_GRAMS_IN_SAFE && unit == UNITS_GRAMS) amount = MAX_GRAMS_IN_SAFE;
443 else if (amount > MAX_KILOGRAMS_IN_SAFE && unit == UNITS_KILOGRAMS) amount = MAX_KILOGRAMS_IN_SAFE;
444
445 [shipCommodityData setQuantity:amount forGood:type];
446 }
447 quantity -= smaller_quantity;
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 13699 of file PlayerEntity.m.

337 :(OOCommodityType)type fromManifest:(OOCommodityMarket *) manifest
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 {
358 OOCargoQuantity podsRequiredForQuantity, amountToLoadInCargopod, tmpQuantity;
359 // reserve up to 1/2 ton of each commodity for the safe
360 if (units == UNITS_KILOGRAMS)
361 {
362 if (quantity <= MAX_KILOGRAMS_IN_SAFE)
363 {
364 tmpQuantity = quantity;
365 quantity = 0;
366 }
367 else
368 {
369 tmpQuantity = MAX_KILOGRAMS_IN_SAFE;
370 quantity -= tmpQuantity;
371 }
372 amountToLoadInCargopod = KILOGRAMS_PER_POD;
373 }
374 else
375 {
376 if (quantity <= MAX_GRAMS_IN_SAFE) {
377 tmpQuantity = quantity;
378 quantity = 0;
379 }
380 else
381 {
382 tmpQuantity = MAX_GRAMS_IN_SAFE;
383 quantity -= tmpQuantity;
384 }
385 amountToLoadInCargopod = GRAMS_PER_POD;
386 }
387 if (quantity > 0)
388 {
389 podsRequiredForQuantity = 1 + (quantity/amountToLoadInCargopod);
390 // this check is needed so that initial quantities like 1499kg or 1499999g
391 // do not result in generation of an empty cargopod
392 if (quantity % amountToLoadInCargopod == 0) podsRequiredForQuantity--;
393
394 // put each ton or part-ton beyond that in a separate container
395 for (j = 0; j < podsRequiredForQuantity; j++)
396 {
397 if (amountToLoadInCargopod > quantity)
398 {
399 // last pod gets the dregs. :)
400 amountToLoadInCargopod = quantity;
401 }
402 [self createCargoPodWithType:type andAmount:amountToLoadInCargopod]; // or CTD if unsuccesful (!)
403 quantity -= amountToLoadInCargopod;
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.

1730{
1731 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1732 return [defaults objectForKey:KEYCONFIG_OVERRIDES];
1733}

◆ loadPlayer

- (BOOL) loadPlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 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 1412 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 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
800 gui_screen = GUI_SCREEN_LOAD; // force evaluation of new gui screen on startup
801 [self setGuiToStatusScreen];
802 if (loadedOK) [self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")]; // trigger missionScreenOpportunity immediately after loading
803 OOLog(@"load.progress", @"%@", @"Loading complete");
804 return loadedOK;
805}
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_NONE
#define SCENARIO_OXP_DEFINITION_ALL
NSDictionary * shipInfoForKey:(NSString *key)

◆ loadPlayerWithPanel

- (BOOL) loadPlayerWithPanel
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

815{
816 NSOpenPanel *oPanel = [NSOpenPanel openPanel];
817
818 oPanel.allowsMultipleSelection = NO;
819 oPanel.allowedFileTypes = [NSArray arrayWithObject:@"oolite-save"];
820
821 if ([oPanel runModal] == NSOKButton)
822 {
823 NSURL *url = oPanel.URL;
824 if (url.isFileURL)
825 {
826 return [self loadPlayerFromFile:url.path asNew:NO];
827 }
828 }
829
830 return NO;
831}

◆ localMarket

- (OOCommodityMarket *) localMarket

Definition at line 9211 of file PlayerEntity.m.

10797{
10798 StationEntity *station = [self dockedStation];
10799 if (station == nil)
10800 {
10801 if ([[self primaryTarget] isStation] && [(StationEntity *)[self primaryTarget] marketBroadcast])
10802 {
10803 station = [self primaryTarget];
10804 }
10805 else
10806 {
10807 station = [UNIVERSE station];
10808 }
10809 if (station == nil)
10810 {
10811 // interstellar space or similar
10812 return nil;
10813 }
10814 }
10816 if (localMarket == nil)
10817 {
10819 }
10820
10821 return localMarket;
10822}
OOCommodityMarket * localMarket

◆ localVariableForKey:andMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ localVariablesForMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

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 13699 of file PlayerEntity.m.

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

◆ loseTargetStatus

- (void) loseTargetStatus

Definition at line 13699 of file PlayerEntity.m.

7028{
7029 if (!UNIVERSE)
7030 return;
7031 int ent_count = UNIVERSE->n_entities;
7032 Entity** uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
7033 Entity* my_entities[ent_count];
7034 int i;
7035 for (i = 0; i < ent_count; i++)
7036 my_entities[i] = [uni_entities[i] retain]; // retained
7037 for (i = 0; i < ent_count ; i++)
7038 {
7039 Entity* thing = my_entities[i];
7040 if (thing->isShip)
7041 {
7042 ShipEntity* ship = (ShipEntity *)thing;
7043 if (self == [ship primaryTarget])
7044 {
7045 [ship noteLostTarget];
7046 }
7047 }
7048 }
7049 for (i = 0; i < ent_count; i++)
7050 {
7051 [my_entities[i] release]; // released
7052 }
7053}

◆ 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 1003 of file PlayerEntityLoadSave.m.

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

893 :(NSString *)what
894 allowable:(int)allowable
895 axisfn:(int)axisfn
896 butfn:(int)butfn
897{
898 NSMutableDictionary *guiDict = [NSMutableDictionary dictionary];
899
900 if ([what length] > 50) what = [[what substringToIndex:28] stringByAppendingString:@"..."];
901 [guiDict setObject: what forKey: KEY_GUIDESC];
902 [guiDict setObject: [NSNumber numberWithInt: allowable]
903 forKey: KEY_ALLOWABLE];
904 if(axisfn >= 0)
905 [guiDict setObject: [NSNumber numberWithInt: axisfn]
906 forKey: KEY_AXISFN];
907 if(butfn >= 0)
908 [guiDict setObject: [NSNumber numberWithInt: butfn]
909 forKey: KEY_BUTTONFN];
910 return guiDict;
911}
#define KEY_AXISFN
#define KEY_BUTTONFN

◆ makeStickGuiDictHeader:

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

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

913 :(NSString *)header
914{
915 NSMutableDictionary *guiDict = [NSMutableDictionary dictionary];
916 [guiDict setObject:header forKey:KEY_HEADER];
917 [guiDict setObject:@"" forKey:KEY_ALLOWABLE];
918 [guiDict setObject:@"" forKey:KEY_AXISFN];
919 [guiDict setObject:@"" forKey:KEY_BUTTONFN];
920 return guiDict;
921}

◆ markAsOffender:

- (void) markAsOffender: (int) offence_value
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6797 :(int)offence_value
6798{
6799 [self markAsOffender:offence_value withReason:kOOLegalStatusReasonUnknown];
6800}

◆ markAsOffender:withReason:

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

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6803 :(int)offence_value withReason:(OOLegalStatusReason)reason
6804{
6805 if (![self isCloaked])
6806 {
6807 JSContext *context = OOJSAcquireContext();
6808
6809 jsval amountVal = JSVAL_VOID;
6810 int amountVal2 = (legalStatus | offence_value) - legalStatus;
6811 JS_NewNumberValue(context, amountVal2, &amountVal);
6812
6813 legalStatus |= offence_value; // can't set the new bounty until the size of the change is known
6814
6815 jsval reasonVal = OOJSValueFromLegalStatusReason(context, reason);
6816
6817 ShipScriptEvent(context, self, "shipBountyChanged", amountVal, reasonVal);
6818
6819 OOJSRelinquishContext(context);
6820
6821 }
6822}
OOINLINE jsval OOJSValueFromLegalStatusReason(JSContext *context, OOLegalStatusReason value)
OOLegalStatusReason
Definition OOTypes.h:157

◆ markedDestinations

- (NSDictionary *) markedDestinations

Definition at line 13699 of file PlayerEntity.m.

8705{
8706 // get a list of systems marked as contract destinations
8707 NSMutableDictionary *destinations = [NSMutableDictionary dictionaryWithCapacity:256];
8708 unsigned i;
8709 OOSystemID sysid;
8710 NSDictionary *marker;
8711
8712 for (i = 0; i < [passengers count]; i++)
8713 {
8714 sysid = [[passengers oo_dictionaryAtIndex:i] oo_unsignedCharForKey:CONTRACT_KEY_DESTINATION];
8715 marker = [self passengerContractMarker:sysid];
8716 [self prepareMarkedDestination:destinations:marker];
8717 }
8718 for (i = 0; i < [parcels count]; i++)
8719 {
8720 sysid = [[parcels oo_dictionaryAtIndex:i] oo_unsignedCharForKey:CONTRACT_KEY_DESTINATION];
8721 marker = [self parcelContractMarker:sysid];
8722 [self prepareMarkedDestination:destinations:marker];
8723 }
8724 for (i = 0; i < [contracts count]; i++)
8725 {
8726 sysid = [[contracts oo_dictionaryAtIndex:i] oo_unsignedCharForKey:CONTRACT_KEY_DESTINATION];
8727 marker = [self cargoContractMarker:sysid];
8728 [self prepareMarkedDestination:destinations:marker];
8729 }
8730
8731 NSEnumerator *keyEnum = nil;
8732 NSString *key = nil;
8733
8734 for (keyEnum = [missionDestinations keyEnumerator]; (key = [keyEnum nextObject]); )
8735 {
8736 marker = [missionDestinations objectForKey:key];
8737 [self prepareMarkedDestination:destinations:marker];
8738 }
8739
8740 return destinations;
8741}

◆ markerKey:

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

Definition at line 9211 of file PlayerEntity.m.

13286 :(NSDictionary *)marker
13287{
13288 return [NSString stringWithFormat:@"%d-%@",[marker oo_intForKey:@"system"], [marker oo_stringForKey:@"name"]];
13289}

◆ marketScreenTitle

- (NSString *) marketScreenTitle
implementation

Definition at line 9211 of file PlayerEntity.m.

10979{
10980 StationEntity *dockedStation = [self dockedStation];
10981
10982 /* Override normal behaviour if station broadcasts market */
10983 if (dockedStation == nil)
10984 {
10985 if ([[self primaryTarget] isStation] && [(StationEntity *)[self primaryTarget] marketBroadcast])
10986 {
10987 dockedStation = [self primaryTarget];
10988 }
10989 }
10990
10991 NSString *system = nil;
10992 if ([UNIVERSE sun] != nil) system = [UNIVERSE getSystemName:system_id];
10993
10994 if (dockedStation == nil || dockedStation == [UNIVERSE station])
10995 {
10996 if ([UNIVERSE sun] != nil)
10997 {
10998 return OOExpandKey(@"system-commodity-market", system);
10999 }
11000 else
11001 {
11002 // Witchspace
11003 return OOExpandKey(@"commodity-market");
11004 }
11005 }
11006 else
11007 {
11008 NSString *station = [dockedStation displayName];
11009 return OOExpandKey(@"station-commodity-market", station);
11010 }
11011}

◆ massLockable

- (BOOL) massLockable

◆ massLocked

- (BOOL) massLocked

Definition at line 13699 of file PlayerEntity.m.

4437{
4438 return ((alertFlags & ALERT_FLAG_MASS_LOCK) != 0);
4439}

◆ maxAftShieldLevel

- (float) maxAftShieldLevel
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

4617{
4618 return max_aft_shield;
4619}
GLfloat max_aft_shield

◆ maxForwardShieldLevel

- (float) maxForwardShieldLevel
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

4611{
4612 return max_forward_shield;
4613}
GLfloat max_forward_shield

◆ maxPlayerRoles

- (NSUInteger) maxPlayerRoles

Definition at line 13699 of file PlayerEntity.m.

5115{
5116 if (ship_kills >= 6400)
5117 {
5118 return 32;
5119 }
5120 else if (ship_kills >= 128)
5121 {
5122 return 16;
5123 }
5124 else
5125 {
5126 return 8;
5127 }
5128}

◆ messageShipAIs:

- (void) messageShipAIs: (NSString *) roles_message

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ missileForPylon:

- (ShipEntity *) missileForPylon: (NSUInteger) value

Definition at line 13699 of file PlayerEntity.m.

5652 :(NSUInteger)value
5653{
5654 if (value < max_missiles) return missile_entity[value];
5655 return nil;
5656}

◆ missilesList

- (NSArray *) missilesList
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

8304{
8305 [self tidyMissilePylons]; // just in case.
8306 return [super missilesList];
8307}

◆ 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.

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

◆ missionBackgroundDescriptor

- (NSDictionary *) missionBackgroundDescriptor

Definition at line 9211 of file PlayerEntity.m.

12691{
12693}

◆ missionBackgroundDescriptorOrDefault

- (NSDictionary *) missionBackgroundDescriptorOrDefault

Definition at line 9211 of file PlayerEntity.m.

12697{
12698 NSDictionary *result = [self missionBackgroundDescriptor];
12699 if (result == nil)
12700 {
12701 result = [UNIVERSE screenTextureDescriptorForKey:@"mission"];
12702 }
12703
12704 return result;
12705}

◆ missionBackgroundSpecial

- (OOGUIBackgroundSpecial) missionBackgroundSpecial

Definition at line 9211 of file PlayerEntity.m.

12719{
12721}

◆ missionChoice_string

- (NSString *) missionChoice_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1068{
1069 return missionChoice;
1070}

◆ missionExitScreen

- (OOGUIScreenID) missionExitScreen

Definition at line 9211 of file PlayerEntity.m.

12821{
12822 return _missionExitScreen;
12823}
OOGUIScreenID _missionExitScreen

◆ missionKeyPress_string

- (NSString *) missionKeyPress_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1074{
1075 return missionKeyPress;
1076}

◆ missionOverlayDescriptor

- (NSDictionary *) missionOverlayDescriptor

Definition at line 9211 of file PlayerEntity.m.

12656{
12658}

◆ missionOverlayDescriptorOrDefault

- (NSDictionary *) missionOverlayDescriptorOrDefault

Definition at line 9211 of file PlayerEntity.m.

12662{
12663 NSDictionary *result = [self missionOverlayDescriptor];
12664 if (result == nil)
12665 {
12666 if ([[self missionTitle] length] == 0)
12667 {
12668 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_no_title"];
12669 }
12670 else
12671 {
12672 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_with_title"];
12673 }
12674 }
12675
12676 return result;
12677}

◆ missionScreenID

- (NSString *) missionScreenID

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2461{
2462 return _missionScreenID;
2463}

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.

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

◆ missionTitle

- (NSString *) missionTitle

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2174{
2175 return _missionTitle;
2176}

◆ missionVariableForKey:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

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.

646{
647 return mission_variables;
648}

◆ mountMissile:

- (BOOL) mountMissile: (ShipEntity *) missile

Definition at line 13699 of file PlayerEntity.m.

5891 :(ShipEntity *)missile
5892{
5893 if (missile == nil) return NO;
5894
5895 unsigned i;
5896 for (i = 0; i < max_missiles; i++)
5897 {
5898 if (missile_entity[i] == nil)
5899 {
5900 missile_entity[i] = [missile retain];
5902 missiles++;
5903 if (missiles == 1) [self setActiveMissile:0]; // auto select the first purchased missile
5904 return YES;
5905 }
5906 }
5907
5908 return NO;
5909}

◆ mountMissileWithRole:

- (BOOL) mountMissileWithRole: (NSString *) role

Definition at line 13699 of file PlayerEntity.m.

5912 :(NSString *)role
5913{
5914 if ([self missileCount] >= [self missileCapacity]) return NO;
5915 return [self mountMissile:[[UNIVERSE newShipWithRole:role] autorelease]];
5916}
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 13699 of file PlayerEntity.m.

4320 :(double) amount
4321{
4322 distanceTravelled += (float)amount;
4323 [self setPosition:HPvector_add(position, vectorToHPVector(vector_multiply_scalar(v_forward, (float)amount)))];
4324}
GLfloat distanceTravelled
Definition Entity.h:136

◆ moveTargetMemoryBy:

- (BOOL) moveTargetMemoryBy: (NSInteger) delta

Definition at line 9211 of file PlayerEntity.m.

12325 :(NSInteger)delta
12326{
12327 unsigned i = 0;
12328 while (i++ < PLAYER_TARGET_MEMORY_SIZE) // limit loops
12329 {
12330 NSInteger idx = (NSInteger)target_memory_index + delta;
12331 while (idx < 0) idx += PLAYER_TARGET_MEMORY_SIZE;
12333 target_memory_index = idx;
12334
12335 id targ_id = [target_memory objectAtIndex:target_memory_index];
12336 if ([targ_id isProxy])
12337 {
12338 ShipEntity *potential_target = [(OOWeakReference *)targ_id weakRefUnderlyingObject];
12339
12340 if ((potential_target)&&(potential_target->isShip)&&([potential_target isInSpace]))
12341 {
12342 if (potential_target->zero_distance < SCANNER_MAX_RANGE2 && (![potential_target isCloaked]))
12343 {
12344 [super addTarget:potential_target];
12346 {
12348 {
12349 [missile_entity[activeMissile] addTarget:potential_target];
12351 [self printIdentLockedOnForMissile:YES];
12352 }
12353 else
12354 {
12356 [self playIdentLockedOn];
12357 [self printIdentLockedOnForMissile:NO];
12358 }
12359 }
12360 else
12361 {
12362 ident_engaged = YES;
12363 [self printIdentLockedOnForMissile:NO];
12364 }
12365 [self playTargetSwitched];
12366 return YES;
12367 }
12368 }
12369 else
12370 {
12371 [target_memory replaceObjectAtIndex:target_memory_index withObject:[NSNull null]];
12372 }
12373 }
12374 }
12375
12376 [self playNoTargetInMemory];
12377 return NO;
12378}
BOOL isInSpace()
Definition Entity.m:1120

◆ multiFunctionDisplayList

- (NSArray *) multiFunctionDisplayList

Definition at line 13699 of file PlayerEntity.m.

5474{
5476}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ multiFunctionText:

- (NSString *) multiFunctionText: (NSUInteger) index

Definition at line 13699 of file PlayerEntity.m.

5479 :(NSUInteger)i
5480{
5481 NSString *key = [multiFunctionDisplaySettings oo_stringAtIndex:i defaultValue:nil];
5482 if (key == nil)
5483 {
5484 return nil;
5485 }
5486 NSString *text = [multiFunctionDisplayText oo_stringForKey:key defaultValue:nil];
5487 return text;
5488}

◆ mungChecksumWithNSString:

- (void) mungChecksumWithNSString: (NSString *) str

Definition at line 9211 of file PlayerEntity.m.

12186 :(NSString *)str
12187{
12188 if (str == nil) return;
12189
12190 NSUInteger i, length = [str length];
12191 for (i = 0; i < length; i++)
12192 {
12193 munge_checksum([str characterAtIndex:i]);
12194 }
12195}

◆ nativeSavePlayer:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

899 :(NSString *)cdrName
900{
901 NSString* dir = [[UNIVERSE gameController] playerFileDirectory];
902 NSString *savePath = [dir stringByAppendingPathComponent:[cdrName stringByAppendingPathExtension:@"oolite-save"]];
903
904 ShipScriptEventNoCx(self, "playerWillSaveGame", OOJSSTR("STANDARD_SAVE"));
905
906 [self setLastsaveName:cdrName];
907
908 [self writePlayerToPath:savePath];
909}

◆ 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 13699 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 }
742 NSDictionary *routeInfo = nil;
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 13699 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];
802 NSUInteger i;
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 {
810 if ([[route objectAtIndex: i] intValue] == info_system_id)
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 13699 of file PlayerEntity.m.

4309{
4310 return make_quaternion(-orientation.w, orientation.x, orientation.y, orientation.z);
4311}

◆ noteCompassLostTarget

- (void) noteCompassLostTarget
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

7482{
7483 if ([[self hud] isCompassActive])
7484 {
7485 // "the compass, it says we're lost!" :)
7486 JSContext *context = OOJSAcquireContext();
7487 jsval jsmode = OOJSValueFromCompassMode(context, [self compassMode]);
7488 ShipScriptEvent(context, self, "compassTargetChanged", JSVAL_VOID, jsmode);
7489 OOJSRelinquishContext(context);
7490
7491 [[self hud] setCompassActive:NO]; // ensure a target change when returning to normal space.
7492 }
7493}
OOINLINE jsval OOJSValueFromCompassMode(JSContext *context, OOCompassMode value)

◆ noteGUIDidChangeFrom:to:

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

Definition at line 9211 of file PlayerEntity.m.

10117 :(OOGUIScreenID)fromScreen to:(OOGUIScreenID)toScreen
10118{
10119 [self noteGUIDidChangeFrom: fromScreen to: toScreen refresh: NO];
10120}

◆ noteGUIDidChangeFrom:to:refresh:

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

Definition at line 9211 of file PlayerEntity.m.

10123 :(OOGUIScreenID)fromScreen to:(OOGUIScreenID)toScreen refresh: (BOOL) refresh
10124{
10125 // No events triggered if we're changing screens while paused, or if screen never actually changed.
10126 if (fromScreen != toScreen || refresh)
10127 {
10128 // MKW - release GUI Screen ship, if we have one
10129 switch (fromScreen)
10130 {
10131 case GUI_SCREEN_SHIPYARD:
10132 case GUI_SCREEN_LOAD:
10133 case GUI_SCREEN_SAVE:
10134 [demoShip release];
10135 demoShip = nil;
10136 break;
10137 default:
10138 // Nothing
10139 break;
10140
10141 }
10142
10143 if (toScreen == GUI_SCREEN_SYSTEM_DATA)
10144 {
10145 // system data screen: ensure correct sun light color is used on miniature planet
10146 [[UNIVERSE sun] setSunColor:[OOColor colorWithDescription:[[UNIVERSE systemManager] getProperty:@"sun_color" forSystem:info_system_id inGalaxy:[self galaxyNumber]]]];
10147 }
10148 else
10149 {
10150 // any other screen: reset local sun light color
10151 [[UNIVERSE sun] setSunColor:[OOColor colorWithDescription:[[UNIVERSE systemManager] getProperty:@"sun_color" forSystem:system_id inGalaxy:[self galaxyNumber]]]];
10152 }
10153
10154 if (![[UNIVERSE gameController] isGamePaused])
10155 {
10156 JSContext *context = OOJSAcquireContext();
10157 ShipScriptEvent(context, self, "guiScreenChanged", OOJSValueFromGUIScreenID(context, toScreen), OOJSValueFromGUIScreenID(context, fromScreen));
10158 OOJSRelinquishContext(context);
10159 }
10160 }
10161}
OOINLINE jsval OOJSValueFromGUIScreenID(JSContext *context, OOGUIScreenID value)

◆ noteGUIWillChangeTo:

- (void) noteGUIWillChangeTo: (OOGUIScreenID) toScreen

Definition at line 9211 of file PlayerEntity.m.

10109 :(OOGUIScreenID)toScreen
10110{
10111 JSContext *context = OOJSAcquireContext();
10112 ShipScriptEvent(context, self, "guiScreenWillChange", OOJSValueFromGUIScreenID(context, toScreen), OOJSValueFromGUIScreenID(context, gui_screen));
10113 OOJSRelinquishContext(context);
10114}

◆ noteSwitchToView:fromView:

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

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

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 9211 of file PlayerEntity.m.

10164 :(OOViewID)fromView toView:(OOViewID)toView
10165{
10166 [self noteSwitchToView:toView fromView:fromView];
10167}

◆ noticeECM

- (void) noticeECM
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6082{
6083 last_ecm_time = [UNIVERSE getTime];
6084}
double last_ecm_time

◆ occlusionLevel

- (float) occlusionLevel

Definition at line 13699 of file PlayerEntity.m.

4449{
4450 return occlusion_dial;
4451}
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 13699 of file PlayerEntity.m.

4235{
4236 quaternion_normalize(&orientation);
4238 OOMatrixGetBasisVectors(rotMatrix, &v_right, &v_up, &v_forward);
4239
4240 orientation.w = -orientation.w;
4241 playerRotMatrix = OOMatrixForQuaternionRotation(orientation); // this is the rotation similar to ordinary ships
4242 orientation.w = -orientation.w;
4243}
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 1412 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 9211 of file PlayerEntity.m.

11811{
11812 return [parcels count];
11813}

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 13699 of file PlayerEntity.m.

8447{
8448 return [self contractsListForScriptingFromArray:parcels forCargo:NO];
8449}

◆ 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 9211 of file PlayerEntity.m.

11823{
11824 return max_passengers;
11825}

◆ 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 9211 of file PlayerEntity.m.

11817{
11818 return [passengers count];
11819}

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 13699 of file PlayerEntity.m.

8441{
8442 return [self contractsListForScriptingFromArray:passengers forCargo:NO];
8443}

◆ 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 9211 of file PlayerEntity.m.

13168{
13169 OOCreditsQuantity amountToPay = 0;
13170 OOCreditsQuantity calculatedFine = credits * 0.05;
13171 OOCreditsQuantity maximumFine = 50000ULL;
13172
13173 if ([self clearedToDock])
13174 return;
13175
13176 amountToPay = MIN(maximumFine, calculatedFine);
13177 credits -= amountToPay;
13178 [self addMessageToReport:[NSString stringWithFormat:DESC(@"station-docking-clearance-fined-@-cr"), OOCredits(amountToPay)]];
13179}

◆ 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 13699 of file PlayerEntity.m.

3584 :(OOTimeDelta)delta_t
3585{
3586 [self processBehaviour:delta_t];
3587 [self applyVelocity:delta_t];
3588 [self doBookkeeping:delta_t];
3589}

◆ 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 13699 of file PlayerEntity.m.

3936 :(OOTimeDelta)delta_t
3937{
3938 [self gameOverFadeToBW];
3939
3940 if ([self shotTime] > kDeadResetTime)
3941 {
3942 BOOL was_mouse_control_on = mouse_control_on;
3943 [UNIVERSE handleGameOver]; // we restart the UNIVERSE
3944 mouse_control_on = was_mouse_control_on;
3945 }
3946}

◆ performDockingRequest:

- (void) performDockingRequest: (StationEntity *) stationForDocking

Definition at line 13699 of file PlayerEntity.m.

3591 :(StationEntity *)stationForDocking
3592{
3593 if (stationForDocking == nil) return;
3594 if (![stationForDocking isStation] || ![stationForDocking isKindOfClass:[StationEntity class]]) return;
3595 if ([self isDocked]) return;
3596 if (autopilot_engaged && [self targetStation] == stationForDocking) return;
3597 if (autopilot_engaged && [self targetStation] != stationForDocking)
3598 {
3599 [self disengageAutopilot];
3600 }
3601 NSString *stationDockingClearanceStatus = [stationForDocking acceptDockingClearanceRequestFrom:self];
3602 if (stationDockingClearanceStatus != nil)
3603 {
3604 [self doScriptEvent:OOJSID("playerRequestedDockingClearance") withArgument:stationDockingClearanceStatus];
3605 if ([stationDockingClearanceStatus isEqualToString:@"DOCKING_CLEARANCE_GRANTED"])
3606 {
3607 [self doScriptEvent:OOJSID("playerDockingClearanceGranted")];
3608 }
3609 }
3610}

◆ performDockingUpdates:

- (void) performDockingUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

3927 :(OOTimeDelta)delta_t
3928{
3929 if ([UNIVERSE breakPatternOver])
3930 {
3931 [self docked]; // bookkeeping for docking
3932 }
3933}

◆ performInFlightUpdates:

- (void) performInFlightUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

3736 :(OOTimeDelta)delta_t
3737{
3739
3740 // do flight routines
3742 UPDATE_STAGE(@"applying newtonian drift");
3744
3745 [self applyVelocity:delta_t];
3746
3747 GLfloat thrust_factor = 1.0;
3749 {
3751 {
3752 thrust_factor = [self afterburnerFactor];
3753 }
3754 else
3755 {
3756 thrust_factor = HYPERSPEED_FACTOR;
3757 }
3758 }
3759
3760
3761 GLfloat velmag = magnitude(velocity);
3762 GLfloat velmag2 = velmag - (float)delta_t * thrust * thrust_factor;
3763 if (velmag > 0)
3764 {
3765 UPDATE_STAGE(@"applying power braking");
3766
3767 if (velmag > VELOCITY_CLEANUP_MIN)
3768 {
3769 GLfloat rate;
3770 // Fix up extremely ridiculous speeds that can happen in collisions or explosions
3771 if (velmag > VELOCITY_CLEANUP_FULL) rate = VELOCITY_CLEANUP_RATE;
3773 velmag2 -= velmag * rate;
3774 }
3775 if (velmag2 < 0.0f) velocity = kZeroVector;
3776 else velocity = vector_multiply_scalar(velocity, velmag2 / velmag);
3777
3778 }
3779
3780 UPDATE_STAGE(@"updating joystick");
3781 [self applyRoll:(float)delta_t*flightRoll andClimb:(float)delta_t*flightPitch];
3782 if (flightYaw != 0.0)
3783 {
3784 [self applyYaw:(float)delta_t*flightYaw];
3785 }
3786
3787 UPDATE_STAGE(@"applying para-newtonian thrust");
3788 [self moveForward:delta_t*flightSpeed];
3789
3790 UPDATE_STAGE(@"updating targeting");
3791 [self updateTargeting];
3792
3794}
#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 13699 of file PlayerEntity.m.

3904 :(OOTimeDelta)delta_t
3905{
3906 if (![UNIVERSE breakPatternHide])
3907 {
3908 flightRoll = launchRoll; // synchronise player's & launching station's spins.
3909 [self doBookkeeping:delta_t]; // don't show ghost exhaust plumes from previous docking!
3910 }
3911
3912 if ([UNIVERSE breakPatternOver])
3913 {
3914 // time to check the legacy scripts!
3915 [self checkScript];
3916 // next check in 10s
3917
3918 [self setStatus:STATUS_IN_FLIGHT];
3919
3920 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
3921 StationEntity *stationLaunchedFrom = [UNIVERSE nearestEntityMatchingPredicate:IsStationPredicate parameter:NULL relativeToEntity:self];
3922 [self doScriptEvent:OOJSID("shipLaunchedFromStation") withArgument:stationLaunchedFrom];
3923 }
3924}

◆ 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 13699 of file PlayerEntity.m.

3797 :(OOTimeDelta)delta_t
3798{
3800
3801 UPDATE_STAGE(@"doing bookkeeping");
3802 [self doBookkeeping:delta_t];
3803
3804 UPDATE_STAGE(@"updating countdown timer");
3806
3807 // damaged gal drive? abort!
3808 /* TODO: this check should possibly be hasEquipmentItemProviding:,
3809 * but if it was we'd need to know which item was actually doing
3810 * the providing so it could be removed. */
3811 if (EXPECT_NOT(galactic_witchjump && ![self hasEquipmentItem:@"EQ_GAL_DRIVE"]))
3812 {
3813 galactic_witchjump = NO;
3814 [self setStatus:STATUS_IN_FLIGHT];
3815 [self playHyperspaceAborted];
3816 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("malfunction"));
3817 return;
3818 }
3819
3820 int seconds = round(witchspaceCountdown);
3822 {
3823 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-galactic-in-x-seconds", seconds) forCount:1.0];
3824 }
3825 else
3826 {
3827 NSString *destination = [UNIVERSE getSystemName:[self nextHopTargetSystemID]];
3828 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-to-x-in-y-seconds", seconds, destination) forCount:1.0];
3829 }
3830
3831 if (witchspaceCountdown == 0.0)
3832 {
3833 UPDATE_STAGE(@"preloading planet textures");
3834 if (!galactic_witchjump)
3835 {
3836 /* Note: planet texture preloading is done twice for hyperspace jumps:
3837 once when starting the countdown and once at the beginning of the
3838 jump. The reason is that the preloading may have been skipped the
3839 first time because of rate limiting (see notes at
3840 -preloadPlanetTexturesForSystem:). There is no significant overhead
3841 from doing it twice thanks to the texture cache.
3842 -- Ahruman 2009-12-19
3843 */
3844 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
3845 }
3846 else
3847 {
3848 // FIXME: preload target system for galactic jump?
3849 }
3850
3851 UPDATE_STAGE(@"JUMP!");
3852 if (galactic_witchjump) [self enterGalacticWitchspace];
3853 else [self enterWitchspace];
3854 galactic_witchjump = NO;
3855 }
3856
3858}
OOTimeDelta witchspaceCountdown

◆ performWitchspaceExitUpdates:

- (void) performWitchspaceExitUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

3861 :(OOTimeDelta)delta_t
3862{
3863 if ([UNIVERSE breakPatternOver])
3864 {
3865 [self resetExhaustPlumes];
3866 // time to check the script!
3867 [self checkScript];
3868 // next check in 10s
3869 [self resetScriptTimer]; // reset the in-system timer
3870
3871 // announce arrival
3872 if ([UNIVERSE planet])
3873 {
3874 [UNIVERSE addMessage:[NSString stringWithFormat:@" %@. ",[UNIVERSE getSystemName:system_id]] forCount:3.0];
3875 // and reset the compass
3876 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_COMPASS"])
3877 compassMode = COMPASS_MODE_PLANET;
3878 else
3879 compassMode = COMPASS_MODE_BASIC;
3880 }
3881 else
3882 {
3883 if ([UNIVERSE inInterstellarSpace]) [UNIVERSE addMessage:DESC(@"witch-engine-malfunction") forCount:3.0]; // if sun gone nova, print nothing
3884 }
3885
3886 [self setStatus:STATUS_IN_FLIGHT];
3887
3888 // If we are exiting witchspace after a scripted misjump. then make sure it gets reset now.
3889 // Scripted misjump situations should have a lifespan of one jump only, to keep things
3890 // simple - Nikos 20090728
3891 if ([self scriptedMisjump]) [self setScriptedMisjump:NO];
3892 // similarly reset the misjump range to the traditional 0.5
3893 [self setScriptedMisjumpRange:0.5];
3894
3895 [self doScriptEvent:OOJSID("shipExitedWitchspace") withArgument:[self jumpCause]];
3896
3897 [self doBookkeeping:delta_t]; // arrival frame updates
3898
3900 }
3901}

◆ planet_number

- (NSNumber *) planet_number

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ 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:11032

◆ 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 955 of file PlayerEntityLegacyScriptEngine.m.

2431 :(NSString *) soundName
2432{
2433 [self playLegacyScriptSound:soundName];
2434}

◆ 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 167 of file PlayerEntityControls.m.

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

4760 :(double)delta_t
4761{
4762 // don't do anything if we're configuring the keyboard
4763 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;
4764
4765 const BOOL *joyButtonState = [[OOJoystickManager sharedStickHandler] getAllButtonStates];
4766
4767 // controls polled while the autopilot is active
4768 if (![[UNIVERSE gameController] isGamePaused])
4769 {
4770 // view keys
4771 [self pollViewControls];
4772
4773 // text displays
4774 [self pollGuiScreenControls];
4775
4776 if ([UNIVERSE displayGUI])
4777 [self pollGuiArrowKeyControls:delta_t];
4778
4779 if ([self checkKeyPress:n_key_autopilot] || joyButtonState[BUTTON_DOCKCPU]
4780 || [self checkKeyPress:n_key_autodock] || joyButtonState[BUTTON_DOCKCPUFAST]) // look for the 'c' and 'C' key
4781 {
4782 if ([self hasDockingComputer] && !autopilot_key_pressed && !fast_autopilot_key_pressed)
4783 {
4784 [self disengageAutopilot];
4785 [UNIVERSE addMessage:DESC(@"autopilot-off") forCount:4.5];
4786 }
4788 if ([self checkKeyPress:n_key_autodock] || joyButtonState[BUTTON_DOCKCPUFAST])
4789 {
4791 }
4792 }
4793 else
4794 {
4797 }
4798
4799 if (([self checkKeyPress:n_key_docking_music] || joyButtonState[BUTTON_DOCKINGMUSIC])) // look for the 's' key
4800 {
4801 if (!toggling_music)
4802 {
4804 }
4805 toggling_music = YES;
4806 }
4807 else
4808 {
4809 toggling_music = NO;
4810 }
4811 // look for the pause game, 'p' key
4812 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)
4813 {
4814 if (!autopilot_pause)
4815 {
4818 // normal flight controls can handle the rest.
4819 pause_pressed = NO; // pause button flag must be NO for pollflightControls to react!
4820 [self pollFlightControls:delta_t];
4821 }
4822 autopilot_pause = YES;
4823 }
4824 else
4825 {
4826 autopilot_pause = NO;
4827 }
4828 }
4829 else
4830 {
4831 // paused
4832 if ([self checkKeyPress:n_key_pausebutton] || joyButtonState[BUTTON_PAUSE])
4833 {
4834 if (!autopilot_pause)
4835 {
4837 }
4838 autopilot_pause = YES;
4839 }
4840 else
4841 {
4842 autopilot_pause = NO;
4843 }
4844 // let the normal flight controls handle paused commands.
4845 [self pollFlightControls:delta_t];
4846 }
4847}
@ 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 167 of file PlayerEntityControls.m.

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

◆ pollCustomViewControls

- (void) pollCustomViewControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

4044{
4045 static Quaternion viewQuaternion;
4046 static Vector viewOffset;
4047 static Vector rotationCenter;
4048 static Vector up;
4049 static Vector right;
4050 static BOOL mouse_clicked = NO;
4051 static NSPoint mouse_clicked_position;
4052 static BOOL shift_down;
4053 static BOOL caps_on = NO;
4054 static NSTimeInterval last_time = 0.0;
4055 MyOpenGLView *gameView = [UNIVERSE gameView];
4056 const BOOL *joyButtonState = [[OOJoystickManager sharedStickHandler] getAllButtonStates];
4057
4058 if ([self checkKeyPress:n_key_custom_view] || joyButtonState[BUTTON_EXTVIEWCYCLE])
4059 {
4060 if (!customView_pressed && [_customViews count] != 0 && gui_screen != GUI_SCREEN_LONG_RANGE_CHART && ![gameView allowingStringInput])
4061 {
4062 if ([UNIVERSE viewDirection] == VIEW_CUSTOM) // already in custom view mode
4063 {
4064 // rotate the custom views
4065 _customViewIndex = (_customViewIndex + 1) % [_customViews count];
4066 }
4067
4068 [self setCustomViewDataFromDictionary:[_customViews oo_dictionaryAtIndex:_customViewIndex] withScaling:YES];
4069
4070 [self switchToThisView:VIEW_CUSTOM andProcessWeaponFacing:NO]; // weapon facing must not change, we just want an external view
4071 }
4072 customView_pressed = YES;
4073 }
4074 else
4075 customView_pressed = NO;
4076 NSTimeInterval this_time = [NSDate timeIntervalSinceReferenceDate];
4077 if ([UNIVERSE viewDirection] > VIEW_STARBOARD && [gameView isCapsLockOn])
4078 {
4079 BOOL ctrl_down = [gameView isCtrlDown];
4080 float customViewZoomSpeed = ctrl_down ? CUSTOM_VIEW_ZOOM_SPEED * CUSTOM_VIEW_SPEED_REDUCTION_FACTOR: CUSTOM_VIEW_ZOOM_SPEED;
4082
4083 if (!caps_on) caps_on = YES;
4084
4085 OOTimeDelta delta_t = this_time - last_time;
4086 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)
4087 {
4088 [self customViewZoomOut: pow(customViewZoomSpeed, delta_t)];
4089 }
4090 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)
4091 {
4092 [self customViewZoomIn: pow(customViewZoomSpeed, delta_t)];
4093 }
4094 if ([self checkKeyPress:n_key_custom_view_roll_left ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_roll_right ignore_ctrl:YES])
4095 {
4096 [self customViewRollLeft:customViewRotateSpeed * delta_t];
4097 }
4098 if ([self checkKeyPress:n_key_custom_view_pan_left ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_pan_right ignore_ctrl:YES])
4099 {
4100 [self customViewPanLeft:customViewRotateSpeed * delta_t];
4101 }
4102 if ([self checkKeyPress:n_key_custom_view_roll_right ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_roll_left ignore_ctrl:YES])
4103 {
4104 [self customViewRollRight:customViewRotateSpeed * delta_t];
4105 }
4106 if ([self checkKeyPress:n_key_custom_view_pan_right ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_pan_left ignore_ctrl:YES])
4107 {
4108 [self customViewPanRight:customViewRotateSpeed * delta_t];
4109 }
4110 if ([self checkKeyPress:n_key_custom_view_rotate_up ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_rotate_down ignore_ctrl:YES])
4111 {
4112 [self customViewRotateUp:customViewRotateSpeed * delta_t];
4113 }
4114 if ([self checkKeyPress:n_key_custom_view_pan_down ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_pan_up ignore_ctrl:YES])
4115 {
4116 [self customViewPanDown:customViewRotateSpeed * delta_t];
4117 }
4118 if ([self checkKeyPress:n_key_custom_view_rotate_down ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_rotate_up ignore_ctrl:YES])
4119 {
4120 [self customViewRotateDown:customViewRotateSpeed * delta_t];
4121 }
4122 if ([self checkKeyPress:n_key_custom_view_pan_up ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_pan_down ignore_ctrl:YES])
4123 {
4124 [self customViewPanUp:customViewRotateSpeed * delta_t];
4125 }
4126 if ([self checkKeyPress:n_key_custom_view_rotate_left ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_rotate_right ignore_ctrl:YES])
4127 {
4128 [self customViewRotateLeft:customViewRotateSpeed * delta_t];
4129 }
4130 if ([self checkKeyPress:n_key_custom_view_rotate_right ignore_ctrl:YES] && ![self checkKeyPress:n_key_custom_view_rotate_left ignore_ctrl:YES])
4131 {
4132 [self customViewRotateRight:customViewRotateSpeed * delta_t];
4133 }
4134 if ([gameView isDown:gvMouseLeftButton])
4135 {
4136 if(!mouse_clicked || shift_down != [gameView isShiftDown])
4137 {
4138 mouse_clicked = YES;
4139 viewQuaternion = [PLAYER customViewQuaternion];
4140 viewOffset = [PLAYER customViewOffset];
4141 rotationCenter = [PLAYER customViewRotationCenter];
4142 up = [PLAYER customViewUpVector];
4143 right = [PLAYER customViewRightVector];
4144 mouse_clicked_position = [gameView virtualJoystickPosition];
4145 shift_down = [gameView isShiftDown];
4146 }
4147 NSPoint mouse_position = [gameView virtualJoystickPosition];
4148 Vector axis = vector_add(vector_multiply_scalar(up, mouse_position.x - mouse_clicked_position.x),
4149 vector_multiply_scalar(right, mouse_position.y - mouse_clicked_position.y));
4150 float angle = magnitude(axis);
4151 axis = vector_normal(axis);
4152 Quaternion newViewQuaternion = viewQuaternion;
4153 if ([gameView isShiftDown])
4154 {
4155 quaternion_rotate_about_axis(&newViewQuaternion, axis, angle);
4156 [PLAYER setCustomViewQuaternion: newViewQuaternion];
4157 [PLAYER setCustomViewRotationCenter: vector_subtract(viewOffset,
4158 vector_multiply_scalar([PLAYER customViewForwardVector],
4159 dot_product([PLAYER customViewForwardVector], viewOffset)))];
4160 }
4161 else
4162 {
4163 quaternion_rotate_about_axis(&newViewQuaternion, axis, -angle);
4164 OOScalar m = magnitude(vector_subtract(viewOffset, rotationCenter));
4165 [PLAYER setCustomViewQuaternion: newViewQuaternion];
4166 Vector offset = vector_flip([PLAYER customViewForwardVector]);
4167 scale_vector(&offset, m / magnitude(offset));
4168 [PLAYER setCustomViewOffset:vector_add(offset, rotationCenter)];
4169 }
4170 }
4171 else
4172 {
4173 mouse_clicked = NO;
4174 }
4175 }
4176 else
4177 {
4178 mouse_clicked = NO;
4179 if (caps_on)
4180 {
4181 caps_on = NO;
4182 if ([self isMouseControlOn]) [gameView resetMouse];
4183 }
4184 }
4185 last_time = this_time;
4186}
@ 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 4758 of file PlayerEntityControls.m.

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

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

◆ pollFlightArrowKeyControls:

- (void) pollFlightArrowKeyControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

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

4739 :(double)delta_t
4740{
4741 MyOpenGLView *gameView = [UNIVERSE gameView];
4742 if ([gameView isDown:32]) // look for the spacebar
4743 {
4744 if (!spacePressed)
4745 {
4746 [UNIVERSE displayMessage:@"" forCount:1.0];
4747 shot_time = INITIAL_SHOT_TIME; // forces immediate restart
4748 }
4749 spacePressed = YES;
4750 }
4751 else
4752 spacePressed = NO;
4753}
#define INITIAL_SHOT_TIME
Definition ShipEntity.h:100

◆ pollGuiArrowKeyControls:

- (void) pollGuiArrowKeyControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

4587{
4588 [self pollGuiScreenControlsWithFKeyAlias:YES];
4589}

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 167 of file PlayerEntityControls.m.

4592 :(BOOL)fKeyAlias
4593{
4594 if(!pollControls && fKeyAlias) // Still OK to run, if we don't use number keys.
4595 return;
4596
4597 GuiDisplayGen *gui = [UNIVERSE gui];
4598 MyOpenGLView *gameView = [UNIVERSE gameView];
4599 BOOL docked_okay = ([self status] == STATUS_DOCKED);
4600
4601 // text displays
4602 if ([self checkKeyPress:n_key_gui_screen_status fKey_only:!fKeyAlias])
4603 {
4605 {
4607 if (gui_screen == GUI_SCREEN_STATUS)
4608 {
4609 [self noteGUIWillChangeTo:GUI_SCREEN_MANIFEST];
4610 [self setGuiToManifestScreen];
4611 }
4612 else
4613 [self setGuiToStatusScreen];
4614 [self checkScript];
4615 }
4616 }
4617 else
4618 {
4620 }
4621
4622 if ([self checkKeyPress:n_key_gui_chart_screens fKey_only:!fKeyAlias])
4623 {
4624 mouse_left_down = NO;
4625 [gameView clearMouse];
4627 {
4629 // handles http://aegidian.org/bb/viewtopic.php?p=233189#p233189
4630 if (EXPECT_NOT([self status] == STATUS_WITCHSPACE_COUNTDOWN && gui_screen == GUI_SCREEN_SHORT_RANGE_CHART))
4631 {
4632 // don't switch to LRC if countdown in progress
4634 }
4635 else if (gui_screen == GUI_SCREEN_SHORT_RANGE_CHART || (gui_screen == GUI_SCREEN_SYSTEM_DATA && showingLongRangeChart))
4636 {
4637 if (target_chart_zoom != CHART_MAX_ZOOM)
4638 {
4639 saved_chart_zoom = target_chart_zoom;
4640 }
4641 target_chart_zoom = CHART_MAX_ZOOM;
4642 [self noteGUIWillChangeTo:GUI_SCREEN_LONG_RANGE_CHART];
4643 [self setGuiToLongRangeChartScreen];
4644 }
4645 else
4646 {
4647 if (target_chart_zoom == CHART_MAX_ZOOM)
4648 {
4649 target_chart_zoom = saved_chart_zoom;
4650 }
4651 //target_chart_centre = cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
4652 [self noteGUIWillChangeTo:GUI_SCREEN_SHORT_RANGE_CHART];
4653 [self setGuiToShortRangeChartScreen];
4654 }
4655 }
4656 }
4657 else
4658 {
4660 }
4661
4662 if ([self checkKeyPress:n_key_gui_system_data fKey_only:!fKeyAlias])
4663 {
4664 if (gui_screen != GUI_SCREEN_SYSTEM_DATA)
4665 {
4666 showingLongRangeChart = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART);
4667 [self noteGUIWillChangeTo:GUI_SCREEN_SYSTEM_DATA];
4668 [self setGuiToSystemDataScreen];
4669 }
4670 }
4671
4672 if ([self checkKeyPress:n_key_gui_market fKey_only:!fKeyAlias])
4673 {
4674 if (gui_screen != GUI_SCREEN_MARKET)
4675 {
4676 [gameView clearKeys];
4677 [self noteGUIWillChangeTo:GUI_SCREEN_MARKET];
4678 [self setGuiToMarketScreen];
4679 }
4680 else
4681 {
4682 [gameView clearKeys];
4683 [self noteGUIWillChangeTo:GUI_SCREEN_MARKETINFO];
4684 [self setGuiToMarketInfoScreen];
4685 }
4686 }
4687
4688
4689 if (docked_okay)
4690 {
4691 if (([self checkKeyPress:n_key_gui_screen_options fKey_only:!fKeyAlias]) && (gui_screen != GUI_SCREEN_OPTIONS))
4692 {
4693 [gameView clearKeys];
4694 [self setGuiToLoadSaveScreen];
4695 }
4696
4697 if ([self checkKeyPress:n_key_gui_screen_equipship fKey_only:!fKeyAlias])
4698 {
4700 {
4701 if ([self dockedStation] == nil) [self setDockedAtMainStation];
4702 OOGUIScreenID oldScreen = gui_screen;
4703
4704 if ((gui_screen == GUI_SCREEN_EQUIP_SHIP) && [[self dockedStation] hasShipyard])
4705 {
4706 [gameView clearKeys];
4707 [self noteGUIWillChangeTo:GUI_SCREEN_SHIPYARD];
4708 [self setGuiToShipyardScreen:0];
4709 [gui setSelectedRow:GUI_ROW_SHIPYARD_START];
4710 [self showShipyardInfoForSelection];
4711 }
4712 else
4713 {
4714 [gameView clearKeys];
4715 [self noteGUIWillChangeTo:GUI_SCREEN_EQUIP_SHIP];
4716 [self setGuiToEquipShipScreen:0];
4717 [gui setSelectedRow:GUI_ROW_EQUIPMENT_START];
4718 }
4719
4720 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
4721 }
4723 }
4724 else
4725 {
4727 }
4728
4729 if ([self checkKeyPress:n_key_gui_screen_interfaces fKey_only:!fKeyAlias])
4730 {
4731 [self setGuiToInterfacesScreen:0];
4732 [gui setSelectedRow:GUI_ROW_INTERFACES_START];
4733 }
4734
4735 }
4736}
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 167 of file PlayerEntityControls.m.

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

5332{
5333 if (_missionAllowInterrupt)
5334 {
5335 if (gui_screen == GUI_SCREEN_MISSION && _missionTextEntry)
5336 {
5337 [self pollGuiScreenControlsWithFKeyAlias:NO];
5338 }
5339 else {
5340 [self pollGuiScreenControls];
5341 }
5342 if (gui_screen != GUI_SCREEN_MISSION)
5343 {
5344 if (gui_screen != GUI_SCREEN_SYSTEM_DATA)
5345 {
5346 [UNIVERSE removeDemoShips];
5347 }
5348 [self endMissionScreenAndNoteOpportunity];
5349 }
5350 }
5351}

◆ pollViewControls

- (void) pollViewControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

4190{
4191 if(!pollControls)
4192 return;
4193
4194 MyOpenGLView *gameView = [UNIVERSE gameView];
4196
4197 NSPoint virtualView = NSZeroPoint;
4198 double view_threshold = 0.5;
4199
4200 if ([stickHandler joystickCount])
4201 {
4202 virtualView = [stickHandler viewAxis];
4203 if (virtualView.y == STICK_AXISUNASSIGNED)
4204 virtualView.y = 0.0;
4205 if (virtualView.x == STICK_AXISUNASSIGNED)
4206 virtualView.x = 0.0;
4207 if (fabs(virtualView.y) >= fabs(virtualView.x))
4208 virtualView.x = 0.0; // forward/aft takes precedence
4209 else
4210 virtualView.y = 0.0;
4211 }
4212
4213 const BOOL *joyButtonState = [stickHandler getAllButtonStates];
4214
4215 // view keys
4216 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]))
4217 {
4218 [self switchToThisView:VIEW_FORWARD];
4219 }
4220 if (([self checkKeyPress:n_key_view_aft])||(virtualView.y > view_threshold)||joyButtonState[BUTTON_VIEWAFT])
4221 {
4222 [self switchToThisView:VIEW_AFT];
4223 }
4224 if (([self checkKeyPress:n_key_view_port])||(virtualView.x < -view_threshold)||joyButtonState[BUTTON_VIEWPORT])
4225 {
4226 [self switchToThisView:VIEW_PORT];
4227 }
4228 if (([self checkKeyPress:n_key_view_starboard])||(virtualView.x > view_threshold)||joyButtonState[BUTTON_VIEWSTARBOARD])
4229 {
4230 [self switchToThisView:VIEW_STARBOARD];
4231 }
4232
4233 [self pollCustomViewControls];
4234
4235 // Zoom scanner 'z'
4236 if (([self checkKeyPress:n_key_scanner_zoom] && ([gameView allowingStringInput] == gvStringInputNo)) || joyButtonState[BUTTON_SCANNERZOOM]) // look for the 'z' key
4237 {
4238 if (!scanner_zoom_rate)
4239 {
4240 if ([hud scannerZoom] < 5.0)
4241 {
4242 if (([hud scannerZoom] > 1.0)||(!zoom_pressed))
4243 scanner_zoom_rate = SCANNER_ZOOM_RATE_UP;
4244 }
4245 else
4246 {
4247 if (!zoom_pressed) // must release and re-press zoom to zoom back down..
4248 scanner_zoom_rate = SCANNER_ZOOM_RATE_DOWN;
4249 }
4250 }
4251 zoom_pressed = YES;
4252 }
4253 else
4254 zoom_pressed = NO;
4255
4256 // Unzoom scanner 'Z'
4257 if (([self checkKeyPress:n_key_scanner_unzoom] && ([gameView allowingStringInput] == gvStringInputNo)) || joyButtonState[BUTTON_SCANNERUNZOOM]) // look for the 'Z' key
4258 {
4259 if ((!scanner_zoom_rate)&&([hud scannerZoom] > 1.0))
4260 scanner_zoom_rate = SCANNER_ZOOM_RATE_DOWN;
4261 }
4262
4263 if (EXPECT([[self hud] isCompassActive])) // only switch compass modes if there is a compass
4264 {
4265 // Compass mode '|'
4266 if ([self checkKeyPress:n_key_prev_compass_mode] || joyButtonState[BUTTON_COMPASSMODE_PREV]) // look for the '|' key
4267 {
4268 if ((!prev_compass_mode_pressed)&&(compassMode != COMPASS_MODE_BASIC))
4269 [self setPrevCompassMode];
4271 }
4272 else
4273 {
4275 }
4276 // Compass mode '\'
4277 if ([self checkKeyPress:n_key_next_compass_mode] || joyButtonState[BUTTON_COMPASSMODE]) // look for the '\' key
4278 {
4279 if ((!next_compass_mode_pressed)&&(compassMode != COMPASS_MODE_BASIC))
4280 [self setNextCompassMode];
4282 }
4283 else
4284 {
4286 }
4287 }
4288
4289 // ';' // Cycle active MFD
4290 if ([self checkKeyPress:n_key_cycle_next_mfd] || [self checkKeyPress:n_key_cycle_previous_mfd] || joyButtonState[BUTTON_MFDCYCLENEXT] || joyButtonState[BUTTON_MFDCYCLEPREV])
4291 {
4292 if (!cycleMFD_pressed)
4293 {
4294 //if (![gameView isCtrlDown])
4295 if (![self checkKeyPress:n_key_cycle_previous_mfd] || joyButtonState[BUTTON_MFDCYCLEPREV])
4296 {
4297 [self cycleNextMultiFunctionDisplay:activeMFD];
4298 }
4299 else
4300 {
4301 [self cyclePreviousMultiFunctionDisplay:activeMFD];
4302 }
4303 }
4304 cycleMFD_pressed = YES;
4305 }
4306 else
4307 {
4308 cycleMFD_pressed = NO;
4309 }
4310
4311 // ':' // Select next MFD
4312 if ([self checkKeyPress:n_key_switch_next_mfd] || [self checkKeyPress:n_key_switch_previous_mfd] || joyButtonState[BUTTON_MFDSELECTNEXT] || joyButtonState[BUTTON_MFDSELECTPREV])
4313 {
4314 if ([[self hud] mfdCount] > 1)
4315 {
4316 if (!switchMFD_pressed)
4317 {
4318 //if (![gameView isCtrlDown])
4319 if (![self checkKeyPress:n_key_switch_previous_mfd] || joyButtonState[BUTTON_MFDSELECTPREV])
4320 {
4321 [self selectNextMultiFunctionDisplay];
4322 }
4323 else
4324 {
4325 [self selectPreviousMultiFunctionDisplay];
4326 }
4327 }
4328 }
4329 switchMFD_pressed = YES;
4330 }
4331 else
4332 {
4333 switchMFD_pressed = NO;
4334 }
4335
4336
4337 // show comms log '`'
4338 if ([self checkKeyPress:n_key_comms_log])
4339 {
4340 [UNIVERSE showCommsLog: 1.5];
4341 [hud refreshLastTransmitter];
4342 }
4343}
@ 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 13699 of file PlayerEntity.m.

8688 :(NSMutableDictionary *)markers :(NSDictionary *)marker
8689{
8690 NSNumber *key = [NSNumber numberWithInt:[marker oo_intForKey:@"system"]];
8691 NSMutableArray *list = [markers objectForKey:key];
8692 if (list == nil)
8693 {
8694 list = [NSMutableArray arrayWithObject:marker];
8695 }
8696 else
8697 {
8698 [list addObject:marker];
8699 }
8700 [markers setObject:list forKey:key];
8701}

◆ previousInfoSystem

- (void) previousInfoSystem

Definition at line 13699 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];
835 NSUInteger i;
836 if (route == nil)
837 {
838 [self setInfoSystemID: system_id moveChart: YES];
839 return;
840 }
841 for (i = 0; i < [route count]; i++)
842 {
843 if ([[route objectAtIndex: i] intValue] == info_system_id)
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 13699 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 13699 of file PlayerEntity.m.

8166{
8167 return [eqScripts count];
8168}

◆ primedEquipmentName:

- (NSString *) primedEquipmentName: (NSInteger) offset

Definition at line 13699 of file PlayerEntity.m.

8171 :(NSInteger)offset
8172{
8173 NSUInteger c = [self primedEquipmentCount];
8174 NSUInteger idx = (primedEquipment+(c+1)+offset)%(c+1);
8175 if (idx == c)
8176 {
8177 return DESC(@"equipment-primed-none-hud-label");
8178 }
8179 else
8180 {
8181 return [[OOEquipmentType equipmentTypeWithIdentifier:[[eqScripts oo_arrayAtIndex:idx] oo_stringAtIndex:0]] name];
8182 }
8183}

◆ printIdentLockedOnForMissile:

- (void) printIdentLockedOnForMissile: (BOOL) missile

Definition at line 9211 of file PlayerEntity.m.

12381 :(BOOL)missile
12382{
12383 if ([self primaryTarget] == nil) return;
12384
12385 NSString *fmt = missile ? @"missile-locked-onto-target" : @"ident-locked-onto-target";
12386 NSString *target = [[self primaryTarget] identFromShip:self];
12387 [UNIVERSE addMessage:OOExpandKey(fmt, target) forCount:4.5];
12388}

◆ 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 167 of file PlayerEntityControls.m.

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

◆ processSceneDictionary:atOffset:

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

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ processSceneString:atOffset:

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

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ pseudoFixedD100_number

- (NSNumber *) pseudoFixedD100_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ pseudoFixedD256_number

- (NSNumber *) pseudoFixedD256_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ quicksavePlayer

- (void) quicksavePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 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 13699 of file PlayerEntity.m.

501{
502 return market_rnd;
503}

◆ realAlertCondition

- (OOAlertCondition) realAlertCondition
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

5786{
5787 return [self alertCondition];
5788}

◆ receiveCommsMessage:from:

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

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

11835 :(NSString *) message_text from:(ShipEntity *) other
11836{
11837 if ([self status] == STATUS_DEAD || [self status] == STATUS_DOCKED)
11838 {
11839 // only when in flight
11840 return;
11841 }
11842 [UNIVERSE addCommsMessage:[NSString stringWithFormat:@"%@:\n %@", [other displayName], message_text] forCount:4.5];
11843 [super receiveCommsMessage:message_text from:other];
11844}

◆ 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 955 of file PlayerEntityLegacyScriptEngine.m.

2492{
2493 MyOpenGLView *gameView = [UNIVERSE gameView];
2494 GuiDisplayGen *gui = [UNIVERSE gui];
2495 NSUInteger end_row = 21;
2496 if ([[self hud] allowBigGui])
2497 {
2498 end_row = 27;
2499 }
2500
2501 [gui setText:[NSString stringWithFormat:DESC(@"mission-screen-text-prompt-@"), [gameView typedString]] forRow:end_row align:GUI_ALIGN_LEFT];
2502 [gui setColor:[OOColor cyanColor] forRow:end_row];
2503
2504 [gui setShowTextCursor:YES];
2505 [gui setCurrentRow:end_row];
2506
2507}
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.

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

◆ removeAllCargo

- (void) removeAllCargo

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by PlayerShipRemoveAllCargo().

+ Here is the caller graph for this function:

◆ removeAllCargo:

- (void) removeAllCargo: (BOOL) forceRemoval

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

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

◆ removeEquipment:

- (void) removeEquipment: (NSString *) equipString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ removeEquipmentItem:

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

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

11624 :(NSString *)equipmentKey
11625{
11626 if(![self hasEquipmentItemProviding:@"EQ_ADVANCED_COMPASS"] && [self compassMode] != COMPASS_MODE_BASIC)
11627 {
11628 [self setCompassMode:COMPASS_MODE_BASIC];
11629 }
11630 [super removeEquipmentItem:equipmentKey];
11631 if(![self hasEquipmentItem:equipmentKey]) {
11632 // removed the last one
11633 [self removeEqScriptForKey:equipmentKey];
11634 }
11635}

◆ removeExternalStore:

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

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

11758 :(OOEquipmentType *)eqType
11759{
11760 NSString *identifier = [eqType identifier];
11761
11762 // Look for matching missile.
11763 unsigned i;
11764 for (i = 0; i < max_missiles; i++)
11765 {
11766 if ([[self missileForPylon:i] hasPrimaryRole:identifier])
11767 {
11768 [self removeFromPylon:i];
11769
11770 // Just remove one at a time.
11771 return YES;
11772 }
11773 }
11774 return NO;
11775}

◆ removeFromPylon:

- (BOOL) removeFromPylon: (NSUInteger) pylon

Definition at line 9211 of file PlayerEntity.m.

11778 :(NSUInteger)pylon
11779{
11780 if (pylon >= max_missiles) return NO;
11781
11782 if (missile_entity[pylon] != nil)
11783 {
11784 NSString *identifier = [missile_entity[pylon] primaryRole];
11785 [super removeExternalStore:[OOEquipmentType equipmentTypeWithIdentifier:identifier]];
11786
11787 // Remove the missile (must wait until we've finished with its identifier string!)
11788 [missile_entity[pylon] release];
11789 missile_entity[pylon] = nil;
11790
11791 [self tidyMissilePylons];
11792
11793 // This should be the currently selected missile, deselect it.
11794 if (pylon <= activeMissile)
11795 {
11797 if (activeMissile > 0) activeMissile--;
11798 else activeMissile = max_missiles - 1;
11799
11800 [self selectNextMissile];
11801 }
11802
11803 return YES;
11804 }
11805
11806 return NO;
11807}

◆ removeFunction:

- (void) removeFunction: (int) idx
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ removeMissiles

- (OOCreditsQuantity) removeMissiles
implementation

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

10642{
10643 [self safeAllMissiles];
10644 OOCreditsQuantity tradeIn = 0;
10645 unsigned i;
10646 for (i = 0; i < missiles; i++)
10647 {
10648 NSString *weapon_key = [missile_list[i] identifier];
10649
10650 if (weapon_key != nil)
10651 tradeIn += (int)[UNIVERSE getEquipmentPriceForKey:weapon_key];
10652 }
10653
10654 for (i = 0; i < max_missiles; i++)
10655 {
10656 [missile_entity[i] release];
10657 missile_entity[i] = nil;
10658 }
10659
10660 missiles = 0;
10661 return tradeIn;
10662}

Referenced by ShipAwardEquipment().

+ Here is the caller graph for this function:

◆ removeMissionDestination:

- (void) removeMissionDestination: (NSString *) destinations

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ removeMissionDestinationMarker:

- (BOOL) removeMissionDestinationMarker: (NSDictionary *) marker

Definition at line 9211 of file PlayerEntity.m.

13304 :(NSDictionary *)marker
13305{
13306 NSDictionary *validated = [self validatedMarker:marker];
13307 if (validated == nil)
13308 {
13309 return NO;
13310 }
13311 BOOL result = NO;
13312 if ([missionDestinations objectForKey:[self markerKey:validated]] != nil) {
13313 result = YES;
13314 }
13315 [missionDestinations removeObjectForKey:[self markerKey:validated]];
13316 return result;
13317}

◆ 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 9211 of file PlayerEntity.m.

12004 :(OOTrumble *)deadTrumble
12005{
12006 if (trumbleCount <= 0)
12007 {
12008 return;
12009 }
12010 NSUInteger trumble_index = NSNotFound;
12011 NSUInteger i;
12012
12013 for (i = 0; (trumble_index == NSNotFound)&&(i < trumbleCount); i++)
12014 {
12015 if (trumble[i] == deadTrumble)
12016 trumble_index = i;
12017 }
12018 if (trumble_index == NSNotFound)
12019 {
12020 OOLog(@"trumble.zombie", @"DEBUG can't get rid of inactive trumble %@", deadTrumble);
12021 return;
12022 }
12023 trumbleCount--; // reduce number of trumbles
12024 trumble[trumble_index] = trumble[trumbleCount]; // swap with the current last trumble
12025 trumble[trumbleCount] = deadTrumble; // swap with the current last trumble
12026}

◆ renovationCosts

- (double) renovationCosts

Definition at line 9211 of file PlayerEntity.m.

11890{
11891 // 5% of value of ships wear + correction for missing subentities.
11892 OOCreditsQuantity shipValue = [UNIVERSE tradeInValueForCommanderDictionary:[self commanderDataDictionary]];
11893
11894 double costs = 0.005 * (100 - ship_trade_in_factor) * shipValue;
11895 costs += 0.01 * shipValue * [self missingSubEntitiesAdjustment];
11896 costs *= [self renovationFactor];
11897 return cunningFee(costs, 0.05);
11898}
NSInteger missingSubEntitiesAdjustment()
double cunningFee(double value, double precision)

◆ renovationFactor

- (double) renovationFactor

Definition at line 9211 of file PlayerEntity.m.

11902{
11904 NSDictionary *shipyardInfo = [registry shipyardInfoForKey:[self shipDataKey]];
11905 return [shipyardInfo oo_doubleForKey:KEY_RENOVATION_MULTIPLIER defaultValue:1.0];
11906}

◆ 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.

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

◆ requestDockingClearance:

- (void) requestDockingClearance: (StationEntity *) stationForDocking

Definition at line 13699 of file PlayerEntity.m.

3612 :(StationEntity *)stationForDocking
3613{
3615 {
3616 [self performDockingRequest:stationForDocking];
3617 }
3618}

Referenced by PlayerShipRequestDockingClearance().

+ Here is the caller graph for this function:

◆ reset:

- (void) reset: (NSString *) missionvariable

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ resetAutopilotAI

- (void) resetAutopilotAI

Definition at line 13699 of file PlayerEntity.m.

3697{
3698 AI *myAI = [self getAI];
3699 // JSAI: will need changing if oolite-dockingAI.js written
3700 if (![[myAI name] isEqualToString:PLAYER_DOCKING_AI_NAME])
3701 {
3702 [self setAITo:PLAYER_DOCKING_AI_NAME ];
3703 }
3704 [myAI clearAllData];
3705 [myAI setState:@"GLOBAL"];
3706 [myAI setNextThinkTime:[UNIVERSE getTime] + 2];
3707 [myAI setOwner:self];
3708}
#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 9211 of file PlayerEntity.m.

12589{
12590 [self setCustomViewDataFromDictionary:[_customViews oo_dictionaryAtIndex:_customViewIndex] withScaling:NO];
12591}

Referenced by PlayerShipResetCustomView().

+ Here is the caller graph for this function:

◆ resetHud

- (void) resetHud

Definition at line 13699 of file PlayerEntity.m.

4499{
4500 // set up defauld HUD for the ship
4501 NSDictionary *shipDict = [[OOShipRegistry sharedRegistry] shipInfoForKey:[self shipDataKey]];
4502 NSString *hud_desc = [shipDict oo_stringForKey:@"hud" defaultValue:@"hud.plist"];
4503 if (![self switchHudTo:hud_desc]) [self switchHudTo:@"hud.plist"]; // ensure we have a HUD to fall back to
4504}

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 955 of file PlayerEntityLegacyScriptEngine.m.

2101{
2102 [self setMissionChoice:nil];
2103}

◆ 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 955 of file PlayerEntityLegacyScriptEngine.m.

1894{
1895 script_time = 0.0;
1896 script_time_check = SCRIPT_TIMER_INTERVAL;
1897 script_time_interval = SCRIPT_TIMER_INTERVAL;
1898}
#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 13699 of file PlayerEntity.m.

6714{
6715 NSInteger i, n_cargo = [cargo count];
6716 if (n_cargo == 0) return;
6717
6718 ShipEntity *pod = (ShipEntity *)[[cargo objectAtIndex:0] retain];
6719 OOCommodityType current_contents = [pod commodityType];
6720 OOCommodityType contents;
6721 NSInteger rotates = 0;
6722
6723 do
6724 {
6725 [cargo removeObjectAtIndex:0]; // take it from the eject position
6726 [cargo addObject:pod]; // move it to the last position
6727 [pod release];
6728 pod = (ShipEntity*)[[cargo objectAtIndex:0] retain];
6729 contents = [pod commodityType];
6730 rotates++;
6731 } while ([contents isEqualToString:current_contents]&&(rotates < n_cargo));
6732 [pod release];
6733
6734 NSString *commodity = [UNIVERSE displayNameForCommodity:contents];
6735 [UNIVERSE addMessage:OOExpandKey(@"ready-to-eject-commodity", commodity) forCount:3.0];
6736
6737 // now scan through the remaining 1..(n_cargo - rotates) places moving similar cargo to the last place
6738 // this means the cargo gets to be sorted as it is rotated through
6739 for (i = 1; i < (n_cargo - rotates); i++)
6740 {
6741 pod = [cargo objectAtIndex:i];
6742 if ([[pod commodityType] isEqualToString:current_contents])
6743 {
6744 [pod retain];
6745 [cargo removeObjectAtIndex:i--];
6746 [cargo addObject:pod];
6747 [pod release];
6748 rotates++;
6749 }
6750 }
6751}

◆ 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 13699 of file PlayerEntity.m.

5661{
5662 // sets all missile targets to NO_TARGET
5663
5664 unsigned i;
5665 for (i = 0; i < max_missiles; i++)
5666 {
5668 [missile_entity[i] removeTarget:nil];
5669 }
5671}

Referenced by StationDockPlayer().

+ Here is the caller graph for this function:

◆ saveCommanderInputHandler

- (void) saveCommanderInputHandler

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 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 1412 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}

◆ savePlayerWithPanel

- (void) savePlayerWithPanel
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

835{
836 NSSavePanel *sPanel = [NSSavePanel savePanel];
837
838 sPanel.allowedFileTypes = [NSArray arrayWithObject:@"oolite-save"];
839 sPanel.canSelectHiddenExtension = YES;
840 sPanel.nameFieldStringValue = self.lastsaveName;
841
842 if ([sPanel runModal] == NSOKButton)
843 {
844 NSURL *url = sPanel.URL;
845 NSAssert(url.isFileURL, @"Save panel with default configuration should not provide non-file URLs.");
846
847 NSString *path = url.path;
848 NSString *newName = [path.lastPathComponent stringByDeletingPathExtension];
849
850 ShipScriptEventNoCx(self, "playerWillSaveGame", OOJSSTR("STANDARD_SAVE"));
851
852 self.lastsaveName = newName;
853 [self writePlayerToPath:path];
854 }
855 [self setGuiToStatusScreen];
856}

◆ scannedWormholes

- (NSArray *) scannedWormholes

◆ scannerFuzziness

- (double) scannerFuzziness

Definition at line 13699 of file PlayerEntity.m.

6067{
6068 double fuzz = 0.0;
6069 /* Fuzziness from ECM bursts */
6070 double since = [UNIVERSE getTime] - last_ecm_time;
6071 if (since < SCANNER_ECM_FUZZINESS)
6072 {
6073 fuzz += (SCANNER_ECM_FUZZINESS - since) * (SCANNER_ECM_FUZZINESS - since) * 500.0;
6074 }
6075 /* Other causes could go here */
6076
6077 return fuzz;
6078}
#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.

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

◆ screenModeStringForWidth:height:refreshRate:

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

Definition at line 9211 of file PlayerEntity.m.

12198 :(unsigned)width height:(unsigned)height refreshRate:(float)refreshRate
12199{
12200 if (0.0f != refreshRate)
12201 {
12202 return OOExpandKey(@"gameoptions-fullscreen-with-refresh-rate", width, height, refreshRate);
12203 }
12204 else
12205 {
12206 return OOExpandKey(@"gameoptions-fullscreen", width, height);
12207 }
12208}

◆ 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 9211 of file PlayerEntity.m.

12843{
12844 return worldScripts != nil && [worldScripts count] > 0;
12845}

◆ 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.

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

◆ 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 13699 of file PlayerEntity.m.

5701{
5702 if (![self weaponsOnline]) return;
5703
5704 unsigned i;
5705 for (i = 1; i < max_missiles; i++)
5706 {
5707 int next_missile = (activeMissile + i) % max_missiles;
5708 if (missile_entity[next_missile])
5709 {
5710 // If we don't have the multi-targeting module installed, clear the active missiles' target
5711 if( ![self hasEquipmentItemProviding:@"EQ_MULTI_TARGET"] && [missile_entity[activeMissile] isMissile] )
5712 {
5713 [missile_entity[activeMissile] removeTarget:nil];
5714 }
5715
5716 // Set next missile to active
5717 [self setActiveMissile:next_missile];
5718
5720 {
5722
5723 // If the newly active pylon contains a missile then work out its target, if any
5725 {
5726 if( [self hasEquipmentItemProviding:@"EQ_MULTI_TARGET"] &&
5727 ([missile_entity[next_missile] primaryTarget] != nil))
5728 {
5729 // copy the missile's target
5730 [self addTarget:[missile_entity[next_missile] primaryTarget]];
5732 }
5733 else if ([self primaryTarget] != nil)
5734 {
5735 // never inherit target if we have EQ_MULTI_TARGET installed! [ Bug #16221 : Targeting enhancement regression ]
5736 /* CIM: seems okay to do this when launching a
5737 * missile to stop multi-target being a bit
5738 * irritating in a fight - 20/8/2014 */
5739 if([self hasEquipmentItemProviding:@"EQ_MULTI_TARGET"] && !launchingMissile)
5740 {
5741 [self noteLostTarget];
5743 }
5744 else
5745 {
5746 [missile_entity[activeMissile] addTarget:[self primaryTarget]];
5748 }
5749 }
5750 }
5751 }
5752 return;
5753 }
5754 }
5755}

◆ selectNextMultiFunctionDisplay

- (void) selectNextMultiFunctionDisplay

Definition at line 13699 of file PlayerEntity.m.

5616{
5617 if ([[self hud] mfdCount] == 0) return;
5618 activeMFD = (activeMFD + 1) % [[self hud] mfdCount];
5619 NSUInteger mfdID = activeMFD + 1;
5620 [UNIVERSE addMessage:OOExpandKey(@"mfd-N-selected", mfdID) forCount:3.0 ];
5621 JSContext *context = OOJSAcquireContext();
5622 ShipScriptEvent(context, self, "selectedMFDChanged", INT_TO_JSVAL(activeMFD));
5623 OOJSRelinquishContext(context);
5624}

◆ selectPreviousMultiFunctionDisplay

- (void) selectPreviousMultiFunctionDisplay

Definition at line 13699 of file PlayerEntity.m.

5628{
5629 if ([[self hud] mfdCount] == 0) return;
5630 if (activeMFD == 0)
5631 {
5632 activeMFD = ([[self hud] mfdCount] - 1);
5633 }
5634 else
5635 {
5636 activeMFD = (activeMFD - 1);
5637 }
5638 NSUInteger mfdID = activeMFD + 1;
5639 [UNIVERSE addMessage:OOExpandKey(@"mfd-N-selected", mfdID) forCount:3.0 ];
5640 JSContext *context = OOJSAcquireContext();
5641 ShipScriptEvent(context, self, "selectedMFDChanged", INT_TO_JSVAL(activeMFD));
5642 OOJSRelinquishContext(context);
5643}

◆ sendAllShipsAway

- (void) sendAllShipsAway

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

2462{
2463 // The player ship always belongs to the current session.
2464 return [UNIVERSE sessionID];
2465}

◆ set:

- (void) set: (NSString *) missionvariable_value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setActiveMissile:

- (void) setActiveMissile: (NSUInteger) value

Definition at line 13699 of file PlayerEntity.m.

5422 :(NSUInteger)value
5423{
5424 activeMissile = value;
5425}

◆ setAftShieldLevel:

- (void) setAftShieldLevel: (GLfloat) level

Definition at line 13699 of file PlayerEntity.m.

4676 :(GLfloat)level
4677{
4678 aft_shield = OOClamp_0_max_f(level, [self maxAftShieldLevel]);
4679}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setAftShieldRechargeRate:

- (void) setAftShieldRechargeRate: (float) new

Definition at line 13699 of file PlayerEntity.m.

4652 :(float)new
4653{
4655}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setAlertFlag:to:

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

Definition at line 13699 of file PlayerEntity.m.

5770 :(int)flag to:(BOOL)value
5771{
5772 if (value)
5773 {
5774 alertFlags |= flag;
5775 }
5776 else
5777 {
5778 int comp = ~flag;
5779 alertFlags &= comp;
5780 }
5781}

◆ setBackgroundFromDescriptionsKey:

- (void) setBackgroundFromDescriptionsKey: (NSString*) d_key

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setBounty:

- (void) setBounty: (OOCreditsQuantity) amount
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6754 :(OOCreditsQuantity) amount
6755{
6756 [self setBounty:amount withReason:kOOLegalStatusReasonUnknown];
6757}

◆ setBounty:withReason:

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

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6760 :(OOCreditsQuantity)amount withReason:(OOLegalStatusReason)reason
6761{
6762 NSString *nReason = OOStringFromLegalStatusReason(reason);
6763 [self setBounty:amount withReasonAsString:nReason];
6764}
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 13699 of file PlayerEntity.m.

6767 :(OOCreditsQuantity)amount withReasonAsString:(NSString *)reason
6768{
6769 JSContext *context = OOJSAcquireContext();
6770
6771 jsval amountVal = JSVAL_VOID;
6772 int amountVal2 = (int)amount-(int)legalStatus;
6773 JS_NewNumberValue(context, amountVal2, &amountVal);
6774
6775 legalStatus = (int)amount; // can't set the new bounty until the size of the change is known
6776
6777 jsval reasonVal = OOJSValueFromNativeObject(context,reason);
6778
6779 ShipScriptEvent(context, self, "shipBountyChanged", amountVal, reasonVal);
6780
6781 OOJSRelinquishContext(context);
6782}

◆ setCargoQuantityForType:amount:

- (OOCargoQuantity) setCargoQuantityForType: (OOCommodityType) type
amount: (OOCargoQuantity) amount 

Definition at line 9211 of file PlayerEntity.m.

10700 :(OOCommodityType)type amount:(OOCargoQuantity)amount
10701{
10702 OOMassUnit unit = [shipCommodityData massUnitForGood:type];
10703 if([self specialCargo] && unit == UNITS_TONS) return 0; // don't do anything if we've got a special cargo...
10704
10705 OOCargoQuantity oldAmount = [self cargoQuantityForType:type];
10706 OOCargoQuantity available = [self availableCargoSpace];
10707 BOOL inPods = ([self status] != STATUS_DOCKED);
10708
10709 // check it against the max amount.
10710 if (unit == UNITS_TONS && (available + oldAmount) < amount)
10711 {
10712 amount = available + oldAmount;
10713 }
10714 // if we have 1499 kg the ship registers only 1 ton, so it's possible to exceed the max cargo:
10715 // eg: with maxAvailableCargoSpace 2 & gold 1499kg, you can still add 1 ton alloy.
10716 else if (unit == UNITS_KILOGRAMS && amount > oldAmount)
10717 {
10718 // Allow up to 0.5 ton of kg (& g) goods above the cargo capacity but respect existing quantities.
10719 OOCargoQuantity safeAmount = available * KILOGRAMS_PER_POD + MAX_KILOGRAMS_IN_SAFE;
10720 if (safeAmount < amount) amount = (safeAmount < oldAmount) ? oldAmount : safeAmount;
10721 }
10722 else if (unit == UNITS_GRAMS && amount > oldAmount)
10723 {
10724 OOCargoQuantity safeAmount = available * GRAMS_PER_POD + MAX_GRAMS_IN_SAFE;
10725 if (safeAmount < amount) amount = (safeAmount < oldAmount) ? oldAmount : safeAmount;
10726 }
10727
10728 if (inPods)
10729 {
10730 if (amount > oldAmount) // increase
10731 {
10732 [self loadCargoPodsForType:type amount:(amount - oldAmount)];
10733 }
10734 else
10735 {
10736 [self unloadCargoPodsForType:type amount:(oldAmount - amount)];
10737 }
10738 }
10739 else
10740 {
10741 [shipCommodityData setQuantity:amount forGood:type];
10742 }
10743
10744 [self calculateCurrentCargo];
10745 return [shipCommodityData quantityForGood:type];
10746}

Referenced by ManifestSetProperty().

+ Here is the caller graph for this function:

◆ setCommanderDataFromDictionary:

- (BOOL) setCommanderDataFromDictionary: (NSDictionary *) dict

Definition at line 13699 of file PlayerEntity.m.

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

13056 :(NSString *)value
13057{
13058 NSParameterAssert(value != nil);
13059 [_commanderName autorelease];
13060 _commanderName = [value copy];
13061}

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setCompassMode:

- (void) setCompassMode: (OOCompassMode) value

Definition at line 13699 of file PlayerEntity.m.

5279 :(OOCompassMode) value
5280{
5281 compassMode = value;
5282}
OOCompassMode
Definition OOTypes.h:145

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setCompassTarget:

- (void) setCompassTarget: (Entity *) value

Definition at line 13699 of file PlayerEntity.m.

5171 :(Entity *)value
5172{
5173 [compassTarget release];
5174 compassTarget = [value weakRetain];
5175}

◆ 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 13699 of file PlayerEntity.m.

583 :(NSPoint)coords
584{
587}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setCustomChartZoom:

- (void) setCustomChartZoom: (OOScalar) zoom

Definition at line 13699 of file PlayerEntity.m.

571 :(OOScalar)zoom
572{
573 custom_chart_zoom = zoom;
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 9211 of file PlayerEntity.m.

12605 :(NSDictionary *)viewDict withScaling:(BOOL)withScaling
12606{
12609 if (viewDict == nil) return;
12610
12611 customViewQuaternion = [viewDict oo_quaternionForKey:@"view_orientation"];
12612 [self setCustomViewData];
12613
12614 // easier to do the multiplication at this point than at load time
12615 if (withScaling)
12616 {
12617 customViewOffset = vector_multiply_scalar([viewDict oo_vectorForKey:@"view_position"],_scaleFactor);
12618 }
12619 else
12620 {
12621 // but don't do this when the custom view is set through JS
12622 customViewOffset = [viewDict oo_vectorForKey:@"view_position"];
12623 }
12624 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12625 customViewDescription = [viewDict oo_stringForKey:@"view_description"];
12626
12627 NSString *facing = [[viewDict oo_stringForKey:@"weapon_facing"] lowercaseString];
12628 if ([facing isEqual:@"aft"])
12629 {
12631 }
12632 else if ([facing isEqual:@"port"])
12633 {
12635 }
12636 else if ([facing isEqual:@"starboard"])
12637 {
12639 }
12640 else if ([facing isEqual:@"forward"])
12641 {
12643 }
12644 // if the weapon facing is unset / unknown,
12645 // don't change current weapon facing!
12646}
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 9211 of file PlayerEntity.m.

12416 :(Vector) offset
12417{
12419}

◆ setCustomViewQuaternion:

- (void) setCustomViewQuaternion: (Quaternion) q1

Definition at line 9211 of file PlayerEntity.m.

12397 :(Quaternion)q
12398{
12400 [self setCustomViewData];
12401}

◆ setCustomViewRotationCenter:

- (void) setCustomViewRotationCenter: (Vector) center

Definition at line 9211 of file PlayerEntity.m.

12428 :(Vector) center
12429{
12430 customViewRotationCenter = center;
12431}

◆ setDefaultCustomViews

- (void) setDefaultCustomViews

Definition at line 9211 of file PlayerEntity.m.

11923{
11924 NSArray *customViews = [[[OOShipRegistry sharedRegistry] shipInfoForKey:PLAYER_SHIP_DESC] oo_arrayForKey:@"custom_views"];
11925
11926 [_customViews release];
11927 _customViews = nil;
11928 _customViewIndex = 0;
11929 if (customViews != nil)
11930 {
11931 _customViews = [customViews retain];
11932 }
11933}

◆ setDefaultViewOffsets

- (void) setDefaultViewOffsets

Definition at line 9211 of file PlayerEntity.m.

11910{
11911 float halfLength = 0.5f * (boundingBox.max.z - boundingBox.min.z);
11912 float halfWidth = 0.5f * (boundingBox.max.x - boundingBox.min.x);
11913
11914 forwardViewOffset = make_vector(0.0f, 0.0f, boundingBox.max.z - halfLength);
11915 aftViewOffset = make_vector(0.0f, 0.0f, boundingBox.min.z + halfLength);
11916 portViewOffset = make_vector(boundingBox.min.x + halfWidth, 0.0f, 0.0f);
11917 starboardViewOffset = make_vector(boundingBox.max.x - halfWidth, 0.0f, 0.0f);
11919}
Vector starboardViewOffset
Vector portViewOffset
Vector aftViewOffset

◆ setDialCustom:forKey:

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

Definition at line 13699 of file PlayerEntity.m.

4592 :(id)value forKey:(NSString *)dialKey
4593{
4594 [customDialSettings setObject:value forKey:dialKey];
4595}

Referenced by PlayerShipSetCustomHUDDial().

+ Here is the caller graph for this function:

◆ setDialIdentEngaged:

- (void) setDialIdentEngaged: (BOOL) newValue

Definition at line 13699 of file PlayerEntity.m.

5440 :(BOOL)newValue
5441{
5442 ident_engaged = !!newValue;
5443}

◆ setDockedAtMainStation

- (void) setDockedAtMainStation

Definition at line 13699 of file PlayerEntity.m.

4461{
4462 [self setDockedStation:[UNIVERSE station]];
4463 if (_dockedStation != nil) [self setStatus:STATUS_DOCKED];
4464}
OOWeakReference * _dockedStation

◆ setDockedStation:

- (void) setDockedStation: (StationEntity *) station

Definition at line 13699 of file PlayerEntity.m.

4473 :(StationEntity *)station
4474{
4475 [_dockedStation release];
4476 _dockedStation = [station weakRetain];
4477}

◆ setDockingClearanceStatus:

- (void) setDockingClearanceStatus: (OODockingClearanceStatus) newValue

Definition at line 9211 of file PlayerEntity.m.

13139 :(OODockingClearanceStatus)newValue
13140{
13141 dockingClearanceStatus = newValue;
13143 {
13145 }
13147 {
13148 if ([[self primaryTarget] isStation])
13149 {
13150 targetDockStation = [self primaryTarget];
13151 }
13152 else
13153 {
13154 OOLog(@"player.badDockingTarget", @"Attempt to dock at %@.", [self primaryTarget]);
13157 }
13158 }
13159}
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 9211 of file PlayerEntity.m.

13022 :(ShipEntity *)entity
13023{
13024if ([entity isStation]) _dockTarget = [entity universalID];
13025else _dockTarget = NO_TARGET;
13026 //_dockTarget = [entity isStation] ? [entity universalID]: NO_TARGET;
13027}
@ 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 9211 of file PlayerEntity.m.

12832 :(NSDictionary *)descriptor
12833{
12834 if (descriptor != _equipScreenBackgroundDescriptor)
12835 {
12836 [_equipScreenBackgroundDescriptor autorelease];
12837 _equipScreenBackgroundDescriptor = [descriptor copy];
12838 }
12839}

◆ setEscapePodRescueTime:

- (void) setEscapePodRescueTime: (double) seconds

Definition at line 13699 of file PlayerEntity.m.

4879 :(double)seconds
4880{
4881 escape_pod_rescue_time = seconds;
4882}

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 9211 of file PlayerEntity.m.

13376 :(OOGUIScreenID)gui definition:(OOJSGuiScreenKeyDefinition *)definition
13377{
13378 // process all the keys in the definition
13379 BOOL result = YES;
13380 NSMutableArray *newarray = nil;
13381 NSString *key = nil;
13382 NSMutableDictionary *final = [[NSMutableDictionary alloc] init];
13383 NSDictionary *keys = [definition registerKeys];
13384 NSMutableArray *checklist = [[NSMutableArray alloc] init];
13385
13386 foreach (key, [keys allKeys])
13387 {
13388 NSArray *item = [self processKeyCode:[keys oo_arrayForKey:key]];
13389 [checklist addObject:item];
13390 [final setObject:item forKey:key];
13391 }
13392 [definition setRegisterKeys:[final copy]];
13393 [final release];
13394
13396 if (!extraGuiScreenKeys)
13397 {
13398 extraGuiScreenKeys = [[NSMutableDictionary alloc] init];
13399 }
13400
13401 if (![extraGuiScreenKeys objectForKey:[NSString stringWithFormat:@"%d",gui]])
13402 {
13403 // brand new - just add
13404 newarray = [[NSMutableArray alloc] init];
13405 }
13406 else
13407 {
13408 newarray = [[extraGuiScreenKeys objectForKey:[NSString stringWithFormat:@"%d",gui]] mutableCopy];
13409 NSInteger i = [newarray count];
13410 NSInteger j = 0;
13411 OOJSGuiScreenKeyDefinition *def_existing = nil;
13412 while (i--)
13413 {
13414 def_existing = [newarray objectAtIndex:i];
13415 // if we find this name already in the array, remove it
13416 if (def_existing && [[def_existing name] isEqualToString:[definition name]])
13417 {
13418 [newarray removeObjectAtIndex:i];
13419 }
13420 else
13421 {
13422 // check whether any of those keycodes is already in use on this screen
13423 NSDictionary *keydefs = [def_existing registerKeys];
13424 j = [checklist count];
13425 foreach (key, [keydefs allKeys])
13426 {
13427 while (j--)
13428 {
13429 if ([[NSString stringWithFormat:@"%@",[keydefs objectForKey:key]] isEqualToString:[NSString stringWithFormat:@"%@",[checklist objectAtIndex:j]]])
13430 {
13431 result = NO;
13432 OOLog(kOOLogException, @"***** Exception in setExtraGuiScreenKeys: %@ : %@ (%@)", @"invalid key settings", @"key already in use", key);
13433 }
13434 }
13435 }
13436 }
13437 }
13438 }
13439 [newarray addObject:definition];
13440 // only add the item if there were no errors
13441 if (result) [extraGuiScreenKeys setObject:[newarray mutableCopy] forKey:[NSString stringWithFormat:@"%d",gui]];
13442 [newarray release];
13443 return result;
13444}
void setRegisterKeys:(NSDictionary *registerKeys)

Referenced by GlobalSetExtraGuiScreenKeys().

+ Here is the caller graph for this function:

◆ setExtraMissionKeys:

- (void) setExtraMissionKeys: (NSDictionary *) keys

Definition at line 9211 of file PlayerEntity.m.

13345 :(NSDictionary *)keys
13346{
13347 NSString *key = nil;
13348 NSMutableDictionary *final = [[NSMutableDictionary alloc] init];
13349 foreach (key, [keys allKeys])
13350 {
13351 [final setObject:[self processKeyCode:[keys oo_arrayForKey:key]] forKey:key];
13352 }
13353 extraMissionKeys = [final copy];
13354 [final release];
13355}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setFastEquipmentA:

- (void) setFastEquipmentA: (NSString *) eqKey

Definition at line 13699 of file PlayerEntity.m.

8259 :(NSString *)eqKey
8260{
8261 [_fastEquipmentA release];
8262 _fastEquipmentA = [eqKey copy];
8263}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setFastEquipmentB:

- (void) setFastEquipmentB: (NSString *) eqKey

Definition at line 13699 of file PlayerEntity.m.

8266 :(NSString *)eqKey
8267{
8268 [_fastEquipmentB release];
8269 _fastEquipmentB = [eqKey copy];
8270}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setForwardShieldLevel:

- (void) setForwardShieldLevel: (GLfloat) level

Definition at line 13699 of file PlayerEntity.m.

4670 :(GLfloat)level
4671{
4672 forward_shield = OOClamp_0_max_f(level, [self maxForwardShieldLevel]);
4673}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setForwardShieldRechargeRate:

- (void) setForwardShieldRechargeRate: (float) new

Definition at line 13699 of file PlayerEntity.m.

4646 :(float)new
4647{
4649}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setFoundTarget:

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

Reimplemented from ShipEntity.

Definition at line 9211 of file PlayerEntity.m.

12224 :(Entity *) targetEntity
12225{
12226 /* Rare, but can happen, e.g. if a Q-mine goes off nearby during
12227 * the sequence */
12228 if ([self status] == STATUS_ESCAPE_SEQUENCE)
12229 {
12230 return;
12231 }
12232 [_foundTarget release];
12233 _foundTarget = [targetEntity weakRetain];
12234}
OOWeakReference * _foundTarget
Definition ShipEntity.h:440

◆ setFuelLeak:

- (void) setFuelLeak: (NSString *) value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setFuelLeakRate:

- (void) setFuelLeakRate: (float) value

Definition at line 13699 of file PlayerEntity.m.

4978 :(float)value
4979{
4980 fuel_leak_rate = fmax(value, 0.0f);
4981}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceBehaviour:

- (void) setGalacticHyperspaceBehaviour: (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour

Definition at line 9211 of file PlayerEntity.m.

12939 :(OOGalacticHyperspaceBehaviour)inBehaviour
12940{
12941 if (GALACTIC_HYPERSPACE_BEHAVIOUR_UNKNOWN < inBehaviour && inBehaviour <= GALACTIC_HYPERSPACE_MAX)
12942 {
12943 galacticHyperspaceBehaviour = inBehaviour;
12944 }
12945}
OOGalacticHyperspaceBehaviour
@ GALACTIC_HYPERSPACE_MAX

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceBehaviourTo:

- (void) setGalacticHyperspaceBehaviourTo: (NSString *) galacticHyperspaceBehaviourString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setGalacticHyperspaceFixedCoords:

- (void) setGalacticHyperspaceFixedCoords: (NSPoint) point

Definition at line 9211 of file PlayerEntity.m.

12954 :(NSPoint)point
12955{
12956 return [self setGalacticHyperspaceFixedCoordsX:OOClamp_0_max_f(round(point.x), 255.0f) y:OOClamp_0_max_f(round(point.y), 255.0f)];
12957}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceFixedCoordsTo:

- (void) setGalacticHyperspaceFixedCoordsTo: (NSString *) galacticHyperspaceFixedCoordsString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setGalacticHyperspaceFixedCoordsX:y:

- (void) setGalacticHyperspaceFixedCoordsX: (unsigned char) x
y: (unsigned char) y 

Definition at line 9211 of file PlayerEntity.m.

12960 :(unsigned char)x y:(unsigned char)y
12961{
12964}
NSPoint galacticHyperspaceFixedCoords

◆ setGalaxyCoordinates:

- (void) setGalaxyCoordinates: (NSPoint) newPosition

Definition at line 13699 of file PlayerEntity.m.

524 :(NSPoint)newPosition
525{
526 galaxy_coordinates.x = newPosition.x;
527 galaxy_coordinates.y = newPosition.y;
528}

◆ setGuiToChartScreenFrom:

- (void) setGuiToChartScreenFrom: (OOGUIScreenID) oldScreen

Definition at line 13699 of file PlayerEntity.m.

8766 : (OOGUIScreenID) oldScreen
8767{
8768 GuiDisplayGen *gui = [UNIVERSE gui];
8769
8770 BOOL guiChanged = (oldScreen != gui_screen);
8771
8772 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
8773
8774 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
8775
8776 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
8777
8778 // GUI stuff
8779 {
8780 //[gui clearAndKeepBackground:!guiChanged];
8781 [gui setStarChartTitle];
8782 // refresh the short range chart cache, in case we've just loaded a save game with different local overrides, etc.
8783 [gui refreshStarChart];
8784 //[gui setText:targetSystemName forRow:19];
8785 // distance-f & est-travel-time-f are identical between short & long range charts in standard Oolite, however can be alterered separately via OXPs
8786 //[gui setText:OOExpandKey(@"short-range-chart-distance", distance) forRow:20];
8787 //NSString *travelTimeRow = @"";
8788 //if ([self hasHyperspaceMotor] && distance > 0.0 && distance * 10.0 <= fuel)
8789 //{
8790 // double time = estimatedTravelTime;
8791 // travelTimeRow = OOExpandKey(@"short-range-chart-est-travel-time", time);
8792 //}
8793 //[gui setText:travelTimeRow forRow:21];
8794 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
8795 {
8796 NSString *displaySearchString = planetSearchString ? [planetSearchString capitalizedString] : (NSString *)@"";
8797 [gui setText:[NSString stringWithFormat:DESC(@"long-range-chart-find-planet-@"), displaySearchString] forRow:GUI_ROW_PLANET_FINDER];
8798 [gui setColor:[OOColor cyanColor] forRow:GUI_ROW_PLANET_FINDER];
8799 [gui setShowTextCursor:YES];
8800 [gui setCurrentRow:GUI_ROW_PLANET_FINDER];
8801 }
8802 else
8803 {
8804 [gui setShowTextCursor:NO];
8805 }
8806 }
8807 /* ends */
8808
8809 [self setShowDemoShips:NO];
8810 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
8811
8812 if (guiChanged)
8813 {
8814 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"overlay"];
8815
8816 [gui setBackgroundTextureKey:@"short_range_chart"];
8817 if (found_system_id >= 0)
8818 {
8819 [UNIVERSE findSystemCoordinatesWithPrefix:[[UNIVERSE getSystemName:found_system_id] lowercaseString] exactMatch:YES];
8820 }
8821 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
8822 }
8823}
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 9211 of file PlayerEntity.m.

9656 :(int)skip
9657{
9658 [self setGuiToEquipShipScreen:skip selectingFacingFor:nil];
9659}

Referenced by activateSelectedInterface.

+ Here is the caller graph for this function:

◆ setGuiToEquipShipScreen:selectingFacingFor:

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

Definition at line 9211 of file PlayerEntity.m.

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

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

9704 :(int)skip
9705{
9706 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9707 if (gui_screen != GUI_SCREEN_INTERFACES)
9708 {
9709 [self noteGUIWillChangeTo:GUI_SCREEN_INTERFACES];
9710 }
9711
9712 // build an array of available interfaces
9713 NSDictionary *interfaces = [[self dockedStation] localInterfaces];
9714 NSArray *interfaceKeys = [interfaces keysSortedByValueUsingSelector:@selector(interfaceCompare:)]; // sorts by category, then title
9715 int i;
9716
9717 // GUI stuff
9718 {
9719 GuiDisplayGen *gui = [UNIVERSE gui];
9721 OOGUIRow row = start_row;
9722 BOOL guiChanged = (gui_screen != GUI_SCREEN_INTERFACES);
9723
9724 [gui clearAndKeepBackground:!guiChanged];
9725 [gui setTitle:DESC(@"interfaces-title")];
9726
9727
9728 OOGUITabSettings tab_stops;
9729 tab_stops[0] = 0;
9730 tab_stops[1] = -480;
9731 [gui overrideTabs:tab_stops from:kGuiInterfaceTabs length:2];
9732 [gui setTabStops:tab_stops];
9733
9734 unsigned n_rows = GUI_MAX_ROWS_INTERFACES;
9735 NSUInteger count = [interfaceKeys count];
9736
9737 if (count > 0)
9738 {
9739 if (skip > 0) // lose the first row to Back <--
9740 {
9741 unsigned previous;
9742
9743 if (count <= n_rows || skip < (NSInteger)n_rows)
9744 {
9745 previous = 0; // single page
9746 }
9747 else
9748 {
9749 previous = skip - (n_rows - 2); // multi-page.
9750 if (previous < 2)
9751 {
9752 previous = 0; // if only one previous item, just show it
9753 }
9754 }
9755
9756 [gui setKey:[NSString stringWithFormat:@"More:%d", previous] forRow:row];
9757 [gui setColor:[gui colorFromSetting:kGuiInterfaceScrollColor defaultValue:[OOColor greenColor]] forRow:row];
9758 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:row];
9759 row++;
9760 }
9761
9762 for (i = skip; i < (NSInteger)count && (row - start_row < (OOGUIRow)n_rows); i++)
9763 {
9764 NSString *interfaceKey = [interfaceKeys objectAtIndex:i];
9765 OOJSInterfaceDefinition *definition = [interfaces objectForKey:interfaceKey];
9766
9767 [gui setColor:[gui colorFromSetting:kGuiInterfaceEntryColor defaultValue:nil] forRow:row];
9768 [gui setKey:interfaceKey forRow:row];
9769 [gui setArray:[NSArray arrayWithObjects:[definition title],[definition category], nil] forRow:row];
9770
9771 row++;
9772 }
9773
9774 if (i < (NSInteger)count)
9775 {
9776 // just overwrite the last item :-)
9777 [gui setColor:[gui colorFromSetting:kGuiInterfaceScrollColor defaultValue:[OOColor greenColor]] forRow:row - 1];
9778 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil] forRow:row - 1];
9779 [gui setKey:[NSString stringWithFormat:@"More:%d", i - 1] forRow:row - 1];
9780 }
9781
9782 [gui setSelectableRange:NSMakeRange(start_row,row - start_row)];
9783
9784 if ([gui selectedRow] != start_row)
9785 {
9786 [gui setSelectedRow:start_row];
9787 }
9788
9789 [self showInformationForSelectedInterface];
9790 }
9791 else
9792 {
9793 [gui setText:DESC(@"interfaces-no-interfaces-available-for-use") forRow:GUI_ROW_NO_INTERFACES align:GUI_ALIGN_LEFT];
9794 [gui setColor:[gui colorFromSetting:kGuiInterfaceNoneColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_NO_INTERFACES];
9795
9796 [gui setSelectableRange:NSMakeRange(0,0)];
9797 [gui setNoSelectedRow];
9798
9799 }
9800
9801 [gui setShowTextCursor:NO];
9802
9803 NSString *desc = [NSString stringWithFormat:DESC(@"interfaces-for-ship-@-and-station-@"), [self displayName], [[self dockedStation] displayName]];
9804 [gui setColor:[gui colorFromSetting:kGuiInterfaceHeadingColor defaultValue:nil] forRow:GUI_ROW_INTERFACES_HEADING];
9805 [gui setText:desc forRow:GUI_ROW_INTERFACES_HEADING];
9806
9807
9808 if (guiChanged)
9809 {
9810 [gui setForegroundTextureKey:@"docked_overlay"];
9811 NSDictionary *background = [UNIVERSE screenTextureDescriptorForKey:@"interfaces"];
9812 [gui setBackgroundTextureDescriptor:background];
9813 }
9814 }
9815 /* ends */
9816
9817
9818 [self setShowDemoShips:NO];
9819
9820 OOGUIScreenID oldScreen = gui_screen;
9821 gui_screen = GUI_SCREEN_INTERFACES;
9822 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
9823
9824 [self setShowDemoShips:NO];
9825 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9826
9827}

◆ 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
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 1412 of file PlayerEntityLoadSave.m.

915{
916 GuiDisplayGen *gui=[UNIVERSE gui];
917 NSString* dir = [[UNIVERSE gameController] playerFileDirectory];
918
919 gui_screen = GUI_SCREEN_LOAD;
920
921 [gui clear];
922 [gui setTitle:DESC(@"loadscreen-title")];
923
924 currentPage = 0;
925 [self lsCommanders:gui directory:dir pageNumber: currentPage highlightName:nil];
926
927 [gui setForegroundTextureKey:@"docked_overlay"];
928 [gui setBackgroundTextureKey:@"load_save"];
929
930 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
931
932 [self setShowDemoShips:YES];
933 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
934}

◆ setGuiToLoadSaveScreen

- (void) setGuiToLoadSaveScreen

Definition at line 8826 of file PlayerEntity.m.

9111{
9112 BOOL gamePaused = [[UNIVERSE gameController] isGamePaused];
9113 BOOL canLoadOrSave = NO;
9114 MyOpenGLView *gameView = [UNIVERSE gameView];
9115 OOGUIScreenID oldScreen = gui_screen;
9116
9117 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9118
9119 if ([self status] == STATUS_DOCKED)
9120 {
9121 if ([self dockedStation] == nil) [self setDockedAtMainStation];
9122 canLoadOrSave = (([self dockedStation] == [UNIVERSE station] || [[self dockedStation] allowsSaving]) && !([[UNIVERSE sun] goneNova] || [[UNIVERSE sun] willGoNova]));
9123 }
9124
9125 BOOL canQuickSave = (canLoadOrSave && ([[gameView gameController] playerFileToLoad] != nil));
9126
9127 // GUI stuff
9128 {
9129 GuiDisplayGen* gui = [UNIVERSE gui];
9130 GUI_ROW_INIT(gui);
9131
9132 int first_sel_row = (canLoadOrSave)? GUI_ROW(,SAVE) : GUI_ROW(,GAMEOPTIONS);
9133 if (canQuickSave)
9134 first_sel_row = GUI_ROW(,QUICKSAVE);
9135
9136 [gui clear];
9137 [gui setTitle:[NSString stringWithFormat:DESC(@"status-commander-@"), [self commanderName]]]; //Same title as status screen.
9138
9139 [gui setText:DESC(@"options-quick-save") forRow:GUI_ROW(,QUICKSAVE) align:GUI_ALIGN_CENTER];
9140 if (canQuickSave)
9141 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,QUICKSAVE)];
9142 else
9143 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(,QUICKSAVE)];
9144
9145 [gui setText:DESC(@"options-save-commander") forRow:GUI_ROW(,SAVE) align:GUI_ALIGN_CENTER];
9146 [gui setText:DESC(@"options-load-commander") forRow:GUI_ROW(,LOAD) align:GUI_ALIGN_CENTER];
9147 if (canLoadOrSave)
9148 {
9149 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,SAVE)];
9150 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,LOAD)];
9151 }
9152 else
9153 {
9154 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(,SAVE)];
9155 [gui setColor:[OOColor grayColor] forRow:GUI_ROW(,LOAD)];
9156 }
9157
9158 [gui setText:DESC(@"options-return-to-menu") forRow:GUI_ROW(,BEGIN_NEW) align:GUI_ALIGN_CENTER];
9159 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,BEGIN_NEW)];
9160
9161 [gui setText:DESC(@"options-game-options") forRow:GUI_ROW(,GAMEOPTIONS) align:GUI_ALIGN_CENTER];
9162 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,GAMEOPTIONS)];
9163
9164#if OOLITE_SDL
9165 // GNUstep needs a quit option at present (no Cmd-Q) but
9166 // doesn't need speech.
9167
9168 // quit menu option
9169 [gui setText:DESC(@"options-exit-game") forRow:GUI_ROW(,QUIT) align:GUI_ALIGN_CENTER];
9170 [gui setKey:GUI_KEY_OK forRow:GUI_ROW(,QUIT)];
9171#endif
9172
9173 [gui setSelectableRange:NSMakeRange(first_sel_row, GUI_ROW_OPTIONS_END_OF_LIST)];
9174
9175 if (gamePaused || (!canLoadOrSave && [self status] == STATUS_DOCKED))
9176 {
9177 [gui setSelectedRow: GUI_ROW(,GAMEOPTIONS)];
9178 }
9179 else
9180 {
9181 [gui setSelectedRow: first_sel_row];
9182 }
9183
9184 [gui setShowTextCursor:NO];
9185
9186 if ([gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"paused_overlay"] && [UNIVERSE pauseMessageVisible])
9187 [[UNIVERSE messageGUI] clear];
9188 // Graphically, this screen is analogous to the various settings screens
9189 [gui setBackgroundTextureKey:@"settings"];
9190 }
9191 /* ends */
9192
9193 [[UNIVERSE gameView] clearMouse];
9194
9195 [self setShowDemoShips:NO];
9196 gui_screen = GUI_SCREEN_OPTIONS;
9197
9198 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
9199
9200 if (gamePaused)
9201 {
9202 [[UNIVERSE messageGUI] clear];
9203 NSString *pauseKey = [PLAYER keyBindingDescription2:@"key_pausebutton"];
9204 [UNIVERSE addMessage:OOExpandKey(@"game-paused-docked", pauseKey) forCount:1.0 forceDisplay:YES];
9205 }
9206
9207 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
9208}

◆ setGuiToLongRangeChartScreen

- (void) setGuiToLongRangeChartScreen

Definition at line 13699 of file PlayerEntity.m.

8744{
8745 OOGUIScreenID oldScreen = gui_screen;
8746 GuiDisplayGen *gui = [UNIVERSE gui];
8747 [gui clearAndKeepBackground:NO];
8748 [gui setBackgroundTextureKey:@"short_range_chart"];
8749 [self setMissionBackgroundSpecial: nil];
8750 gui_screen = GUI_SCREEN_LONG_RANGE_CHART;
8752 [self setGuiToChartScreenFrom: oldScreen];
8753}

◆ 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 9211 of file PlayerEntity.m.

11216{
11217 OOCommodityMarket *localMarket = [self localMarket];
11218 GuiDisplayGen *gui = [UNIVERSE gui];
11219 OOGUIScreenID oldScreen = gui_screen;
11220
11221 gui_screen = GUI_SCREEN_MARKETINFO;
11222 BOOL guiChanged = (oldScreen != gui_screen);
11223
11224
11225 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
11226
11227 // fix problems with economies in witchspace
11228 if (localMarket == nil)
11229 {
11230 localMarket = [[UNIVERSE commodities] generateBlankMarket];
11231 }
11232
11233 // following changed to work whether docked or not
11234 NSArray *goods = [self applyMarketSorter:[self applyMarketFilter:[localMarket goods] onMarket:localMarket] onMarket:localMarket];
11235
11236 NSUInteger i, j, commodityCount = [shipCommodityData count];
11237 OOCargoQuantity quantityInHold[commodityCount];
11238
11239 for (i = 0; i < commodityCount; i++)
11240 {
11241 quantityInHold[i] = [shipCommodityData quantityForGood:[goods oo_stringAtIndex:i]];
11242 }
11243 for (i = 0; i < [cargo count]; i++)
11244 {
11245 ShipEntity *container = [cargo objectAtIndex:i];
11246 j = [goods indexOfObject:[container commodityType]];
11247 quantityInHold[j] += [container commodityAmount];
11248 }
11249
11250
11251 // GUI stuff
11252 {
11254 {
11255 j = NSNotFound;
11256 }
11257 else
11258 {
11259 j = [goods indexOfObject:marketSelectedCommodity];
11260 }
11261 if (j == NSNotFound)
11262 {
11264 [self setGuiToMarketScreen];
11265 return;
11266 }
11267
11268 [gui clearAndKeepBackground:!guiChanged];
11269
11270 [gui setTitle:[NSString stringWithFormat:DESC(@"oolite-commodity-information-@"), [shipCommodityData nameForGood:marketSelectedCommodity]]];
11271
11272 [self showMarketScreenHeaders];
11273 [self showMarketScreenDataLine:GUI_ROW_MARKET_START forGood:marketSelectedCommodity inMarket:localMarket holdQuantity:quantityInHold[j]];
11274
11275 OOCargoQuantity contracted = [self contractedVolumeForGood:marketSelectedCommodity];
11276 if (contracted > 0)
11277 {
11278 OOMassUnit unit = [shipCommodityData massUnitForGood:marketSelectedCommodity];
11279 [gui setColor:[gui colorFromSetting:kGuiMarketContractedColor defaultValue:nil] forRow:GUI_ROW_MARKET_START+1];
11280 [gui setText:[NSString stringWithFormat:DESC(@"oolite-commodity-contracted-d-@"), contracted, DisplayStringForMassUnit(unit)] forRow:GUI_ROW_MARKET_START+1];
11281 }
11282
11283 NSString *info = [shipCommodityData commentForGood:marketSelectedCommodity];
11284 OOGUIRow i = 0;
11285 if (info == nil || [info length] == 0)
11286 {
11287 i = [gui addLongText:DESC(@"oolite-commodity-no-comment") startingAtRow:GUI_ROW_MARKET_START+2 align:GUI_ALIGN_LEFT];
11288 }
11289 else
11290 {
11291 i = [gui addLongText:info startingAtRow:GUI_ROW_MARKET_START+2 align:GUI_ALIGN_LEFT];
11292 }
11293 for (i-- ; i > GUI_ROW_MARKET_START+2 ; --i)
11294 {
11295 [gui setColor:[gui colorFromSetting:kGuiMarketDescriptionColor defaultValue:nil] forRow:i];
11296 }
11297
11298 [self showMarketCashAndLoadLine];
11299
11300 }
11301
11302 [[UNIVERSE gameView] clearMouse];
11303
11304 [self setShowDemoShips:NO];
11305 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
11306
11307 if (guiChanged)
11308 {
11309 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"overlay"];
11310 [gui setBackgroundTextureKey:@"marketinfo"];
11311 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
11312 }
11313}

◆ setGuiToMarketScreen

- (void) setGuiToMarketScreen

Definition at line 9211 of file PlayerEntity.m.

11015{
11016 OOCommodityMarket *localMarket = [self localMarket];
11017 GuiDisplayGen *gui = [UNIVERSE gui];
11018 OOGUIScreenID oldScreen = gui_screen;
11019
11020 gui_screen = GUI_SCREEN_MARKET;
11021 BOOL guiChanged = (oldScreen != gui_screen);
11022
11023
11024 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
11025
11026 // fix problems with economies in witchspace
11027 if (localMarket == nil)
11028 {
11029 localMarket = [[UNIVERSE commodities] generateBlankMarket];
11030 }
11031
11032 // following changed to work whether docked or not
11033 NSArray *goods = [self applyMarketSorter:[self applyMarketFilter:[localMarket goods] onMarket:localMarket] onMarket:localMarket];
11034 NSInteger maxOffset = 0;
11036 {
11037 maxOffset = [goods count]-(GUI_ROW_MARKET_END-GUI_ROW_MARKET_START);
11038 }
11039
11040 NSUInteger commodityCount = [shipCommodityData count];
11041 OOCargoQuantity quantityInHold[commodityCount];
11042
11043 for (NSUInteger i = 0; i < commodityCount; i++)
11044 {
11045 quantityInHold[i] = [shipCommodityData quantityForGood:[goods oo_stringAtIndex:i]];
11046 }
11047 for (NSUInteger i = 0; i < [cargo count]; i++)
11048 {
11049 ShipEntity *container = [cargo objectAtIndex:i];
11050 NSUInteger goodsIndex = [goods indexOfObject:[container commodityType]];
11051 // can happen with filters
11052 if (goodsIndex != NSNotFound)
11053 {
11054 quantityInHold[goodsIndex] += [container commodityAmount];
11055 }
11056 }
11057
11058 if (marketSelectedCommodity != nil && ([marketSelectedCommodity isEqualToString:@"<<<"] || [marketSelectedCommodity isEqualToString:@">>>"]))
11059 {
11060 // nothing?
11061 }
11062 else
11063 {
11064 if (marketSelectedCommodity == nil || [goods indexOfObject:marketSelectedCommodity] == NSNotFound)
11065 {
11067 if ([goods count] > 0)
11068 {
11069 marketSelectedCommodity = [[goods oo_stringAtIndex:0] retain];
11070 }
11071 }
11072 if (maxOffset > 0)
11073 {
11074 NSInteger goodsIndex = [goods indexOfObject:marketSelectedCommodity];
11075 // validate marketOffset when returning from infoscreen
11076 if (goodsIndex <= marketOffset)
11077 {
11078 // is off top of list, move list upwards
11079 if (goodsIndex == 0) {
11080 marketOffset = 0;
11081 } else {
11082 marketOffset = goodsIndex-1;
11083 }
11084 }
11085 else if (goodsIndex > marketOffset+(GUI_ROW_MARKET_END-GUI_ROW_MARKET_START)-2)
11086 {
11087 // is off bottom of list, move list downwards
11089 if (marketOffset > maxOffset)
11090 {
11091 marketOffset = maxOffset;
11092 }
11093 }
11094 }
11095 }
11096
11097 // GUI stuff
11098 {
11099 OOGUIRow start_row = GUI_ROW_MARKET_START;
11100 OOGUIRow row = start_row;
11101 OOGUIRow active_row = [gui selectedRow];
11102
11103 [gui clearAndKeepBackground:!guiChanged];
11104
11105
11106 StationEntity *dockedStation = [self dockedStation];
11107 if (dockedStation == nil && [[self primaryTarget] isStation] && [(StationEntity *)[self primaryTarget] marketBroadcast])
11108 {
11109 dockedStation = [self primaryTarget];
11110 }
11111
11112 [gui setTitle:[self marketScreenTitle]];
11113
11114 [self showMarketScreenHeaders];
11115
11116 if (marketOffset > maxOffset)
11117 {
11118 marketOffset = 0;
11119 }
11120 else if (marketOffset < 0)
11121 {
11122 marketOffset = maxOffset;
11123 }
11124
11125 if ([goods count] > 0)
11126 {
11127 OOCommodityType good = nil;
11128 NSInteger i = 0;
11129 foreach (good, goods)
11130 {
11131 if (i < marketOffset)
11132 {
11133 ++i;
11134 continue;
11135 }
11136 [self showMarketScreenDataLine:row forGood:good inMarket:localMarket holdQuantity:quantityInHold[i++]];
11137 if ([good isEqualToString:marketSelectedCommodity])
11138 {
11139 active_row = row;
11140 }
11141
11142 ++row;
11143 if (row >= GUI_ROW_MARKET_END)
11144 {
11145 break;
11146 }
11147 }
11148
11149 if (marketOffset < maxOffset)
11150 {
11151 if ([marketSelectedCommodity isEqualToString:@">>>"])
11152 {
11153 active_row = GUI_ROW_MARKET_LAST;
11154 }
11155 [gui setKey:@">>>" forRow:GUI_ROW_MARKET_LAST];
11156 [gui setColor:[gui colorFromSetting:kGuiMarketScrollColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_LAST];
11157 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @"", @"", @"", @" --> ", nil] forRow:GUI_ROW_MARKET_LAST];
11158 }
11159 if (marketOffset > 0)
11160 {
11161 if ([marketSelectedCommodity isEqualToString:@"<<<"])
11162 {
11163 active_row = GUI_ROW_MARKET_START;
11164 }
11165 [gui setKey:@"<<<" forRow:GUI_ROW_MARKET_START];
11166 [gui setColor:[gui colorFromSetting:kGuiMarketScrollColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_START];
11167 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @"", @"", @"", @" <-- ", nil] forRow:GUI_ROW_MARKET_START];
11168 }
11169 }
11170 else
11171 {
11172 // filter is excluding everything
11173 [gui setColor:[gui colorFromSetting:kGuiMarketFilteredAllColor defaultValue:[OOColor yellowColor]] forRow:GUI_ROW_MARKET_START];
11174 [gui setText:DESC(@"oolite-market-filtered-all") forRow:GUI_ROW_MARKET_START];
11175 active_row = -1;
11176 }
11177
11178 // actually count the containers and valuables (may be > max_cargo)
11179 current_cargo = [self cargoQuantityOnBoard];
11180 if (current_cargo > [self maxAvailableCargoSpace]) current_cargo = [self maxAvailableCargoSpace];
11181
11182 // filter sort info
11183 {
11184 NSString *filterMode = OOExpandKey(OOExpand(@"oolite-market-filter-[marketFilterMode]", marketFilterMode));
11185 NSString *filterText = OOExpandKey(@"oolite-market-filter-line", filterMode);
11186 NSString *sortMode = OOExpandKey(OOExpand(@"oolite-market-sorter-[marketSorterMode]", marketSorterMode));
11187 NSString *sorterText = OOExpandKey(@"oolite-market-sorter-line", sortMode);
11188 [gui setArray:[NSArray arrayWithObjects:filterText, @"", sorterText, nil] forRow:GUI_ROW_MARKET_END];
11189 }
11190 [gui setColor:[gui colorFromSetting:kGuiMarketFilterInfoColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_END];
11191
11192 [self showMarketCashAndLoadLine];
11193
11194 [gui setSelectableRange:NSMakeRange(start_row,row - start_row)];
11195 [gui setSelectedRow:active_row];
11196
11197 [gui setShowTextCursor:NO];
11198 }
11199
11200
11201 [[UNIVERSE gameView] clearMouse];
11202
11203 [self setShowDemoShips:NO];
11204 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
11205
11206 if (guiChanged)
11207 {
11208 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"overlay"];
11209 [gui setBackgroundTextureKey:@"market"];
11210 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
11211 }
11212}
@ GUI_ROW_MARKET_END
NSInteger marketOffset

◆ setGuiToMissionEndScreen

- (void) setGuiToMissionEndScreen
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ setGuiToMissionScreen

- (void) setGuiToMissionScreen

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setGuiToMissionScreenWithCallback:

- (void) setGuiToMissionScreenWithCallback: (BOOL) callback

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

968 :(NSString *)cdrName
969{
970 GuiDisplayGen *gui=[UNIVERSE gui];
971 MyOpenGLView* gameView = [UNIVERSE gameView];
972
973 // Don't poll controls
974 pollControls=NO;
975
976 gui_screen = GUI_SCREEN_SAVE_OVERWRITE;
977
978 [gui clear];
979 [gui setTitle:[NSString stringWithFormat:DESC(@"overwrite-save-commander-@"), cdrName]];
980
981 [gui setText:[NSString stringWithFormat:DESC(@"overwritescreen-commander-@-already-exists-overwrite-query"), cdrName]
982 forRow:SAVE_OVERWRITE_WARN_ROW align: GUI_ALIGN_CENTER];
983
984 [gui setText:DESC(@"overwritescreen-yes") forRow: SAVE_OVERWRITE_YES_ROW align: GUI_ALIGN_CENTER];
985 [gui setKey:GUI_KEY_OK forRow: SAVE_OVERWRITE_YES_ROW];
986
987 [gui setText:DESC(@"overwritescreen-no") forRow: SAVE_OVERWRITE_NO_ROW align: GUI_ALIGN_CENTER];
988 [gui setKey:GUI_KEY_OK forRow: SAVE_OVERWRITE_NO_ROW];
989
990 [gui setSelectableRange: NSMakeRange(SAVE_OVERWRITE_YES_ROW, 2)];
991 [gui setSelectedRow: SAVE_OVERWRITE_NO_ROW];
992
993 // We can only leave this screen by answering yes or no, or esc. Therefore
994 // use a specific overlay, to allow visual reminders of the available options.
995 [gui setForegroundTextureKey:@"overwrite_overlay"];
996 [gui setBackgroundTextureKey:@"load_save"];
997
998 [self setShowDemoShips:NO];
999 [gameView setStringInput:gvStringInputNo];
1000 [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.
1001}

◆ setGuiToOXZManager

- (void) setGuiToOXZManager

Definition at line 9211 of file PlayerEntity.m.

10088{
10089
10090 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
10091 [[UNIVERSE gameView] clearMouse];
10092 [UNIVERSE removeDemoShips];
10093
10094 gui_screen = GUI_SCREEN_OXZMANAGER;
10095
10096 [[UNIVERSE gui] clearAndKeepBackground:NO];
10097
10099
10101 [[UNIVERSE gui] setBackgroundTextureKey:@"oxz-manager"];
10102 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
10103}

◆ setGuiToSaveCommanderScreen:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ setGuiToScenarioScreen:

- (void) setGuiToScenarioScreen: (int) page

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 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 setSelectableRange:NSMakeRange(start_row - 2,3 + row - start_row)];
263 [gui setSelectedRow:start_row];
264 [self showScenarioDetails];
265
266 gui_screen = GUI_SCREEN_NEWGAME;
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:%ld", 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:%ld", 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
NSMutableArray * localShipyard
void generateShipyard:(OOTechLevelID stationTechLevel)

◆ setGuiToShortRangeChartScreen

- (void) setGuiToShortRangeChartScreen

Definition at line 13699 of file PlayerEntity.m.

8756{
8757 OOGUIScreenID oldScreen = gui_screen;
8758 GuiDisplayGen *gui = [UNIVERSE gui];
8759 [gui clearAndKeepBackground:NO];
8760 [gui setBackgroundTextureKey:@"short_range_chart"];
8761 [self setMissionBackgroundSpecial: nil];
8762 gui_screen = GUI_SCREEN_SHORT_RANGE_CHART;
8763 [self setGuiToChartScreenFrom: oldScreen];
8764}

◆ setGuiToStatusScreen

- (void) setGuiToStatusScreen

Definition at line 13699 of file PlayerEntity.m.

7896{
7897 NSString *systemName = nil;
7898 NSString *targetSystemName = nil;
7899 NSString *text = nil;
7900
7901 GuiDisplayGen *gui = [UNIVERSE gui];
7902 OOGUIScreenID oldScreen = gui_screen;
7903 if (oldScreen != GUI_SCREEN_STATUS)
7904 {
7905 [self noteGUIWillChangeTo:GUI_SCREEN_STATUS];
7906 }
7907
7908 gui_screen = GUI_SCREEN_STATUS;
7909 BOOL guiChanged = (oldScreen != gui_screen);
7910
7911 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
7912
7913 // Both system_seed & target_system_seed are != nil at all times when this function is called.
7914
7915 systemName = [UNIVERSE inInterstellarSpace] ? DESC(@"interstellar-space") : [UNIVERSE getSystemName:system_id];
7916 if ([self isDocked] && [self dockedStation] != [UNIVERSE station])
7917 {
7918 systemName = [NSString stringWithFormat:@"%@ : %@", systemName, [[self dockedStation] displayName]];
7919 }
7920
7921 targetSystemName = [UNIVERSE getSystemName:target_system_id];
7922 NSDictionary *systemInfo = [[UNIVERSE systemManager] getPropertiesForSystem:target_system_id inGalaxy:galaxy_number];
7923 NSInteger concealment = [systemInfo oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
7924 if (concealment >= OO_SYSTEMCONCEALMENT_NONAME) targetSystemName = DESC(@"status-unknown-system");
7925
7926 OOSystemID nextHop = [self nextHopTargetSystemID];
7927 if (nextHop != target_system_id) {
7928 NSString *nextHopSystemName = [UNIVERSE getSystemName:nextHop];
7929 systemInfo = [[UNIVERSE systemManager] getPropertiesForSystem:nextHop inGalaxy:galaxy_number];
7930 concealment = [systemInfo oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
7931 if (concealment >= OO_SYSTEMCONCEALMENT_NONAME) nextHopSystemName = DESC(@"status-unknown-system");
7932 targetSystemName = OOExpandKey(@"status-hyperspace-system-multi", targetSystemName, nextHopSystemName);
7933 }
7934
7935 // GUI stuff
7936 {
7937 NSString *shipName = [self displayName];
7938 NSString *legal_desc = nil, *rating_desc = nil,
7939 *alert_desc = nil, *fuel_desc = nil,
7940 *credits_desc = nil;
7941
7942 OOGUIRow i;
7943 OOGUITabSettings tab_stops;
7944 tab_stops[0] = 20;
7945 tab_stops[1] = 160;
7946 tab_stops[2] = 290;
7947 [gui overrideTabs:tab_stops from:kGuiStatusTabs length:3];
7948 [gui setTabStops:tab_stops];
7949
7950 NSString *lightYearsDesc = DESC(@"status-light-years-desc");
7951
7955 fuel_desc = [NSString stringWithFormat:@"%.1f %@", fuel/10.0, lightYearsDesc];
7956 credits_desc = OOCredits(credits);
7957
7958 [gui clearAndKeepBackground:!guiChanged];
7959 text = DESC(@"status-commander-@");
7960 [gui setTitle:[NSString stringWithFormat:text, [self commanderName]]];
7961
7962 [gui setText:shipName forRow:0 align:GUI_ALIGN_CENTER];
7963
7964 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-present-system"), systemName, nil] forRow:1];
7965 if ([self hasHyperspaceMotor]) [gui setArray:[NSArray arrayWithObjects:DESC(@"status-hyperspace-system"), targetSystemName, nil] forRow:2];
7966 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-condition"), alert_desc, nil] forRow:3];
7967 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-fuel"), fuel_desc, nil] forRow:4];
7968 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-cash"), credits_desc, nil] forRow:5];
7969 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-legal-status"), legal_desc, nil] forRow:6];
7970 [gui setArray:[NSArray arrayWithObjects:DESC(@"status-rating"), rating_desc, nil] forRow:7];
7971
7972
7973 [gui setColor:[gui colorFromSetting:kGuiStatusShipnameColor defaultValue:nil] forRow:0];
7974 for (i = 1 ; i <= 7 ; ++i)
7975 {
7976 // nil default = fall back to global default colour
7977 [gui setColor:[gui colorFromSetting:kGuiStatusDataColor defaultValue:nil] forRow:i];
7978 }
7979
7980 [gui setText:DESC(@"status-equipment") forRow:9];
7981
7982 [gui setColor:[gui colorFromSetting:kGuiStatusEquipmentHeadingColor defaultValue:nil] forRow:9];
7983
7984 [gui setShowTextCursor:NO];
7985 }
7986 /* ends */
7987
7988 if (lastTextKey)
7989 {
7990 [lastTextKey release];
7991 lastTextKey = nil;
7992 }
7993
7994 [[UNIVERSE gameView] clearMouse];
7995
7996 // Contributed by Pleb - show ship model if the appropriate user default key has been set - Nikos 20140127
7997 if (EXPECT_NOT([[NSUserDefaults standardUserDefaults] boolForKey:@"show-ship-model-in-status-screen"]))
7998 {
7999 [UNIVERSE removeDemoShips];
8000 [self showShipModelWithKey:[self shipDataKey] shipData:nil personality:[self entityPersonalityInt]
8001 factorX:2.5 factorY:1.7 factorZ:8.0 inContext:@"GUI_SCREEN_STATUS"];
8002 [self setShowDemoShips:YES];
8003 }
8004 else
8005 {
8006 [self setShowDemoShips:NO];
8007 }
8008
8009 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
8010
8011 if (guiChanged)
8012 {
8013 NSDictionary *fgDescriptor = nil, *bgDescriptor = nil;
8014 if ([self status] == STATUS_DOCKED)
8015 {
8016 fgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"docked_overlay"];
8017 bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status_docked"];
8018 }
8019 else
8020 {
8021 fgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"overlay"];
8022 if (alertCondition == ALERT_CONDITION_RED) bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status_red_alert"];
8023 else bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status_in_flight"];
8024 }
8025
8026 [gui setForegroundTextureDescriptor:fgDescriptor];
8027
8028 if (bgDescriptor == nil) bgDescriptor = [UNIVERSE screenTextureDescriptorForKey:@"status"];
8029 [gui setBackgroundTextureDescriptor:bgDescriptor];
8030
8031 [gui setStatusPage:0];
8032 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
8033 }
8034}
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 13699 of file PlayerEntity.m.

8458{
8459 [self setGuiToSystemDataScreenRefreshBackground: NO];
8460}

◆ setGuiToSystemDataScreenRefreshBackground:

- (void) setGuiToSystemDataScreenRefreshBackground: (BOOL) refreshBackground

Definition at line 13699 of file PlayerEntity.m.

8462 : (BOOL) refreshBackground
8463{
8464 NSDictionary *infoSystemData;
8465 NSString *infoSystemName;
8466
8467 infoSystemData = [[UNIVERSE generateSystemData:info_system_id] retain]; // retained
8468 NSInteger concealment = [infoSystemData oo_intForKey:@"concealment" defaultValue:OO_SYSTEMCONCEALMENT_NONE];
8469 infoSystemName = [infoSystemData oo_stringForKey:KEY_NAME];
8470
8471 BOOL sunGoneNova = ([infoSystemData oo_boolForKey:@"sun_gone_nova"]);
8472 OOGUIScreenID oldScreen = gui_screen;
8473
8474 GuiDisplayGen *gui = [UNIVERSE gui];
8475 gui_screen = GUI_SCREEN_SYSTEM_DATA;
8476 BOOL guiChanged = (oldScreen != gui_screen);
8477
8478 Random_Seed infoSystemRandomSeed = [[UNIVERSE systemManager] getRandomSeedForSystem:info_system_id
8479 inGalaxy:[self galaxyNumber]];
8480
8481 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
8482
8483 // GUI stuff
8484 {
8485 OOGUITabSettings tab_stops;
8486 tab_stops[0] = 0;
8487 tab_stops[1] = 96;
8488 tab_stops[2] = 144;
8489 [gui overrideTabs:tab_stops from:kGuiSystemdataTabs length:3];
8490 [gui setTabStops:tab_stops];
8491
8492 NSUInteger techLevel = [infoSystemData oo_intForKey:KEY_TECHLEVEL] + 1;
8493 int population = [infoSystemData oo_intForKey:KEY_POPULATION];
8494 int productivity = [infoSystemData oo_intForKey:KEY_PRODUCTIVITY];
8495 int radius = [infoSystemData oo_intForKey:KEY_RADIUS];
8496
8497 NSString *government_desc = [infoSystemData oo_stringForKey:KEY_GOVERNMENT_DESC
8498 defaultValue:OODisplayStringFromGovernmentID([infoSystemData oo_intForKey:KEY_GOVERNMENT])];
8499 NSString *economy_desc = [infoSystemData oo_stringForKey:KEY_ECONOMY_DESC
8500 defaultValue:OODisplayStringFromEconomyID([infoSystemData oo_intForKey:KEY_ECONOMY])];
8501 NSString *inhabitants = [infoSystemData oo_stringForKey:KEY_INHABITANTS];
8502 NSString *system_desc = [infoSystemData oo_stringForKey:KEY_DESCRIPTION];
8503
8504 NSString *populationDesc = [infoSystemData oo_stringForKey:KEY_POPULATION_DESC
8505 defaultValue:OOExpandKeyWithSeed(kNilRandomSeed, @"sysdata-pop-value", population)];
8506
8507 if (sunGoneNova)
8508 {
8509 population = 0;
8510 productivity = 0;
8511 radius = 0;
8512 techLevel = 0;
8513
8514 government_desc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-government");
8515 economy_desc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-economy");
8516 inhabitants = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-inhabitants");
8517 {
8518 NSString *system = infoSystemName;
8519 system_desc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"nova-system-description", system);
8520 }
8521 populationDesc = OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-pop-value", population);
8522 }
8523
8524
8525 [gui clearAndKeepBackground:!refreshBackground && !guiChanged];
8526 [UNIVERSE removeDemoShips];
8527
8528 if (concealment < OO_SYSTEMCONCEALMENT_NONAME)
8529 {
8530 NSString *system = infoSystemName;
8531 [gui setTitle:OOExpandKeyWithSeed(infoSystemRandomSeed, @"sysdata-data-on-system", system)];
8532 }
8533 else
8534 {
8535 [gui setTitle:OOExpandKey(@"sysdata-data-on-system-no-name")];
8536 }
8537
8538 if (concealment >= OO_SYSTEMCONCEALMENT_NODATA)
8539 {
8540 OOGUIRow i = [gui addLongText:OOExpandKey(@"sysdata-data-on-system-no-data") startingAtRow:15 align:GUI_ALIGN_LEFT];
8541 missionTextRow = i;
8542 for (i-- ; i > 14 ; --i)
8543 {
8544 [gui setColor:[gui colorFromSetting:kGuiSystemdataDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
8545 }
8546 }
8547 else
8548 {
8549 NSPoint infoSystemCoordinates = [[UNIVERSE systemManager] getCoordinatesForSystem: info_system_id inGalaxy: galaxy_number];
8550 double distance = distanceBetweenPlanetPositions(infoSystemCoordinates.x, infoSystemCoordinates.y, galaxy_coordinates.x, galaxy_coordinates.y);
8551 if(distance == 0.0 && info_system_id != system_id)
8552 {
8553 distance = 0.1;
8554 }
8555 NSString *distanceInfo = [NSString stringWithFormat: @"%.1f ly", distance];
8557 {
8558 NSDictionary *routeInfo = nil;
8559 routeInfo = [UNIVERSE routeFromSystem: system_id toSystem: info_system_id optimizedBy: ANA_mode];
8560 if (routeInfo != nil)
8561 {
8562 double routeDistance = [[routeInfo objectForKey: @"distance"] doubleValue];
8563 double routeTime = [[routeInfo objectForKey: @"time"] doubleValue];
8564 int routeJumps = [[routeInfo objectForKey: @"jumps"] intValue];
8565 if(routeDistance == 0.0 && info_system_id != system_id) {
8566 routeDistance = 0.1;
8567 routeTime = 0.01;
8568 routeJumps = 0;
8569 }
8570 distanceInfo = [NSString stringWithFormat: @"%.1f ly / %.1f %@ / %d %@",
8571 routeDistance,
8572 routeTime,
8573 // don't rely on DESC_PLURAL for routeTime since it is of type double
8574 routeTime > 1.05 || routeTime < 0.95 ? DESC(@"sysdata-route-hours%1") : DESC(@"sysdata-route-hours%0"),
8575 routeJumps,
8576 DESC_PLURAL(@"sysdata-route-jumps", routeJumps)];
8577 }
8578 }
8579
8580 OOGUIRow i;
8581
8582 for (i = 1; i <= 16; i++) {
8583 NSString *ln = [NSString stringWithFormat:@"sysdata-line-%ld", (long)i];
8584 NSString *line = OOExpandKeyWithSeed(infoSystemRandomSeed, ln, economy_desc, government_desc, techLevel, populationDesc, inhabitants, productivity, radius, distanceInfo);
8585 if (![line isEqualToString:@""])
8586 {
8587 NSArray *lines = [line componentsSeparatedByString:@"\t"];
8588 if ([lines count] == 1)
8589 {
8590 [gui setArray:[NSArray arrayWithObjects:[lines objectAtIndex:0],
8591 nil]
8592 forRow:i];
8593 }
8594 if ([lines count] == 2)
8595 {
8596 [gui setArray:[NSArray arrayWithObjects:[lines objectAtIndex:0],
8597 [lines objectAtIndex:1],
8598 nil]
8599 forRow:i];
8600 }
8601 if ([lines count] == 3)
8602 {
8603 if ([[lines objectAtIndex:2] isEqualToString:@""])
8604 {
8605 [gui setArray:[NSArray arrayWithObjects:[lines objectAtIndex:0],
8606 [lines objectAtIndex:1],
8607 nil]
8608 forRow:i];
8609 }
8610 else
8611 {
8612 [gui setArray:[NSArray arrayWithObjects:[lines objectAtIndex:0],
8613 [lines objectAtIndex:1],
8614 [lines objectAtIndex:2],
8615 nil]
8616 forRow:i];
8617 }
8618 }
8619 }
8620 else
8621 {
8622 [gui setArray:[NSArray arrayWithObjects:@"",
8623 nil]
8624 forRow:i];
8625 }
8626 }
8627
8628
8629 i = [gui addLongText:system_desc startingAtRow:17 align:GUI_ALIGN_LEFT];
8630 missionTextRow = i;
8631 for (i-- ; i > 16 ; --i)
8632 {
8633 [gui setColor:[gui colorFromSetting:kGuiSystemdataDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
8634 }
8635 for (i = 1 ; i <= 14 ; ++i)
8636 {
8637 // nil default = fall back to global default colour
8638 [gui setColor:[gui colorFromSetting:kGuiSystemdataFactsColor defaultValue:nil] forRow:i];
8639 }
8640 }
8641
8642 [gui setShowTextCursor:NO];
8643 }
8644 /* ends */
8645
8646 [lastTextKey release];
8647 lastTextKey = nil;
8648
8649 [[UNIVERSE gameView] clearMouse];
8650
8651 [infoSystemData release];
8652
8653 [self setShowDemoShips:NO];
8654 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
8655
8656 // if the system has gone nova, there's no planet to display
8657 if (!sunGoneNova && concealment < OO_SYSTEMCONCEALMENT_NODATA)
8658 {
8659 // The next code is generating the miniature planets.
8660 // When normal planets are displayed, the PRNG is reset. This happens not with procedural planet display.
8661 RANROTSeed ranrotSavedSeed = RANROTGetFullSeed();
8662 RNG_Seed saved_seed = currentRandomSeed();
8663
8665 {
8666 [self setBackgroundFromDescriptionsKey:@"gui-scene-show-local-planet"];
8667 }
8668 else
8669 {
8670 [self setBackgroundFromDescriptionsKey:@"gui-scene-show-planet"];
8671 }
8672
8673 setRandomSeed(saved_seed);
8674 RANROTSetFullSeed(ranrotSavedSeed);
8675 }
8676
8677 if (refreshBackground || guiChanged)
8678 {
8679 [gui setForegroundTextureKey:[self status] == STATUS_DOCKED ? @"docked_overlay" : @"overlay"];
8680 [gui setBackgroundTextureKey:sunGoneNova ? @"system_data_nova" : @"system_data"];
8681
8682 [self noteGUIDidChangeFrom:oldScreen to:gui_screen refresh: refreshBackground];
8683 [self checkScript]; // Still needed by some OXPs?
8684 }
8685}
#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 13699 of file PlayerEntity.m.

759 : (OOSystemID) sid moveChart: (BOOL) moveChart
760{
761 if (sid != info_system_id)
762 {
764 info_system_id = sid;
765 JSContext *context = OOJSAcquireContext();
766 ShipScriptEvent(context, self, "infoSystemWillChange", INT_TO_JSVAL(info_system_id), INT_TO_JSVAL(old));
767 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART || gui_screen == GUI_SCREEN_SHORT_RANGE_CHART)
768 {
769 if(moveChart)
770 {
771 target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
772 }
773 }
774 else
775 {
776 if(gui_screen == GUI_SCREEN_SYSTEM_DATA)
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 9211 of file PlayerEntity.m.

13036 :(NSString *)value
13037{
13038 NSParameterAssert(value != nil);
13039 [_jumpCause autorelease];
13040 _jumpCause = [value copy];
13041}

◆ setJumpType:

- (void) setJumpType: (BOOL) isGalacticJump

Definition at line 13699 of file PlayerEntity.m.

7448 :(BOOL)isGalacticJump
7449{
7450 if (isGalacticJump)
7451 {
7452 galactic_witchjump = YES;
7453 }
7454 else
7455 {
7456 galactic_witchjump = NO;
7457 }
7458}

Referenced by PlayerShipBeginGalacticHyperspaceCountdown(), and PlayerShipCancelHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ setLastsaveName:

- (void) setLastsaveName: (NSString *) value

Definition at line 9211 of file PlayerEntity.m.

13064 :(NSString *)value
13065{
13066 NSParameterAssert(value != nil);
13067 [_lastsaveName autorelease];
13068 _lastsaveName = [value copy];
13069}

◆ setLastShot:

- (void) setLastShot: (NSArray *) shot

Definition at line 9211 of file PlayerEntity.m.

13332 :(NSArray *)shot
13333{
13334 lastShot = [shot retain];
13335}

◆ setLegalStatus:

- (void) setLegalStatus: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ 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.

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

◆ setLongRangeChartMode:

- (void) setLongRangeChartMode: (OOLongRangeChartMode) mode

Definition at line 9211 of file PlayerEntity.m.

12985{
12987}

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 13699 of file PlayerEntity.m.

4423 :(BOOL)newValue
4424{
4425 massLockable = !!newValue;
4426 [self updateAlertCondition];
4427}
unsigned massLockable

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setMaxAftShieldLevel:

- (void) setMaxAftShieldLevel: (float) new

Definition at line 13699 of file PlayerEntity.m.

4640 :(float)new
4641{
4642 max_aft_shield = new;
4643}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setMaxFlightPitch:

- (void) setMaxFlightPitch: (GLfloat) new
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

3313 :(GLfloat)new
3314{
3315 max_flight_pitch = new;
3316 pitch_delta = 2.0 * new;
3317}

◆ setMaxFlightRoll:

- (void) setMaxFlightRoll: (GLfloat) new
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

3320 :(GLfloat)new
3321{
3322 max_flight_roll = new;
3323 roll_delta = 2.0 * new;
3324}

◆ setMaxFlightYaw:

- (void) setMaxFlightYaw: (GLfloat) new
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

3327 :(GLfloat)new
3328{
3329 max_flight_yaw = new;
3330 yaw_delta = 2.0 * new;
3331}

◆ setMaxForwardShieldLevel:

- (void) setMaxForwardShieldLevel: (float) new

Definition at line 13699 of file PlayerEntity.m.

4634 :(float)new
4635{
4636 max_forward_shield = new;
4637}

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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setMissionBackgroundDescriptor:

- (void) setMissionBackgroundDescriptor: (NSDictionary *) descriptor

Definition at line 9211 of file PlayerEntity.m.

12708 :(NSDictionary *)descriptor
12709{
12710 if (descriptor != _missionBackgroundDescriptor)
12711 {
12712 [_missionBackgroundDescriptor autorelease];
12713 _missionBackgroundDescriptor = [descriptor copy];
12714 }
12715}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionBackgroundSpecial:

- (void) setMissionBackgroundSpecial: (NSString *) special

Definition at line 9211 of file PlayerEntity.m.

12724 :(NSString *)special
12725{
12726 if (special == nil) {
12728 }
12729 else if ([special isEqualToString:@"SHORT_RANGE_CHART"])
12730 {
12732 }
12733 else if ([special isEqualToString:@"SHORT_RANGE_CHART_SHORTEST"])
12734 {
12735 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12736 {
12738 }
12739 else
12740 {
12742 }
12743 }
12744 else if ([special isEqualToString:@"SHORT_RANGE_CHART_QUICKEST"])
12745 {
12746 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12747 {
12749 }
12750 else
12751 {
12753 }
12754 }
12755 else if ([special isEqualToString:@"CUSTOM_CHART"])
12756 {
12758 }
12759 else if ([special isEqualToString:@"CUSTOM_CHART_SHORTEST"])
12760 {
12761 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12762 {
12764 }
12765 else
12766 {
12768 }
12769 }
12770 else if ([special isEqualToString:@"CUSTOM_CHART_QUICKEST"])
12771 {
12772 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12773 {
12775 }
12776 else
12777 {
12779 }
12780 }
12781 else if ([special isEqualToString:@"LONG_RANGE_CHART"])
12782 {
12784 }
12785 else if ([special isEqualToString:@"LONG_RANGE_CHART_SHORTEST"])
12786 {
12787 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12788 {
12790 }
12791 else
12792 {
12794 }
12795 }
12796 else if ([special isEqualToString:@"LONG_RANGE_CHART_QUICKEST"])
12797 {
12798 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12799 {
12801 }
12802 else
12803 {
12805 }
12806 }
12807 else
12808 {
12810 }
12811}
@ 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 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionChoices:

- (void) setMissionChoices: (NSString *) choicesKey

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionChoicesDictionary:

- (void) setMissionChoicesDictionary: (NSDictionary *) choicesDict

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

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

◆ setMissionDescription:forMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ setMissionExitScreen:

- (void) setMissionExitScreen: (OOGUIScreenID) screen

Definition at line 9211 of file PlayerEntity.m.

12814 :(OOGUIScreenID)screen
12815{
12816 _missionExitScreen = screen;
12817}

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 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setMissionInstructions:forMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

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.

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

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ setMissionMusic:

- (void) setMissionMusic: (NSString *) value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionOverlayDescriptor:

- (void) setMissionOverlayDescriptor: (NSDictionary *) descriptor

Definition at line 9211 of file PlayerEntity.m.

12680 :(NSDictionary *)descriptor
12681{
12682 if (descriptor != _missionOverlayDescriptor)
12683 {
12684 [_missionOverlayDescriptor autorelease];
12685 _missionOverlayDescriptor = [descriptor copy];
12686 }
12687}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionScreenID:

- (void) setMissionScreenID: (NSString *) msid

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionTitle:

- (void) setMissionTitle: (NSString *) value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

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.

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

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 13699 of file PlayerEntity.m.

5510 :(NSUInteger)index toKey:(NSString *)key
5511{
5512 if (index >= [hud mfdCount])
5513 {
5514 // is first inactive display
5515 index = [multiFunctionDisplaySettings indexOfObject:[NSNull null]];
5516 if (index == NSNotFound)
5517 {
5518 return NO;
5519 }
5520 }
5521
5522 if (index < [hud mfdCount])
5523 {
5524 if (key == nil)
5525 {
5526 [multiFunctionDisplaySettings replaceObjectAtIndex:index withObject:[NSNull null]];
5527 }
5528 else
5529 {
5530 [multiFunctionDisplaySettings replaceObjectAtIndex:index withObject:key];
5531 }
5532 return YES;
5533 }
5534 else
5535 {
5536 return NO;
5537 }
5538}

Referenced by PlayerShipSetMultiFunctionDisplay().

+ Here is the caller graph for this function:

◆ setMultiFunctionText:forKey:

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

Definition at line 13699 of file PlayerEntity.m.

5491 :(NSString *)text forKey:(NSString *)key
5492{
5493 if (text != nil)
5494 {
5495 [multiFunctionDisplayText setObject:text forKey:key];
5496 }
5497 else if (key != nil)
5498 {
5499 [multiFunctionDisplayText removeObjectForKey:key];
5500 // and blank any MFDs currently using it
5501 NSUInteger index;
5502 while ((index = [multiFunctionDisplaySettings indexOfObject:key]) != NSNotFound)
5503 {
5504 [multiFunctionDisplaySettings replaceObjectAtIndex:index withObject:[NSNull null]];
5505 }
5506 }
5507}

Referenced by PlayerShipSetMultiFunctionText().

+ Here is the caller graph for this function:

◆ setName:

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

Reimplemented from ShipEntity.

Definition at line 13699 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 13699 of file PlayerEntity.m.

5355{
5356 OOAegisStatus aegis = AEGIS_NONE;
5357 Entity <OOBeaconEntity> *beacon = nil;
5358
5359 switch (compassMode)
5360 {
5361 case COMPASS_MODE_INACTIVE:
5362 case COMPASS_MODE_BASIC:
5363 case COMPASS_MODE_PLANET:
5364 aegis = [self checkForAegis];
5365 if ([UNIVERSE station] && (aegis == AEGIS_CLOSE_TO_MAIN_PLANET || aegis == AEGIS_IN_DOCKING_RANGE))
5366 {
5367 [self setCompassMode:COMPASS_MODE_STATION];
5368 }
5369 else
5370 {
5371 [self setCompassMode:COMPASS_MODE_SUN];
5372 }
5373 break;
5374
5375 case COMPASS_MODE_STATION:
5376 [self setCompassMode:COMPASS_MODE_SUN];
5377 break;
5378
5379 case COMPASS_MODE_SUN:
5380 if ([self primaryTarget])
5381 {
5382 [self setCompassMode:COMPASS_MODE_TARGET];
5383 break;
5384 }
5385 // else fall through to switch to beacon mode.
5386
5387 case COMPASS_MODE_TARGET:
5388 beacon = [UNIVERSE firstBeacon];
5389 while (beacon != nil && [beacon isJammingScanning])
5390 {
5391 beacon = [beacon nextBeacon];
5392 }
5393 [self setNextBeacon:beacon];
5394
5395 if (beacon != nil) [self setCompassMode:COMPASS_MODE_BEACONS];
5396 else [self setCompassMode:COMPASS_MODE_PLANET];
5397 break;
5398
5399 case COMPASS_MODE_BEACONS:
5400 beacon = [self nextBeacon];
5401 do
5402 {
5403 beacon = [beacon nextBeacon];
5404 } while (beacon != nil && [beacon isJammingScanning]);
5405 [self setNextBeacon:beacon];
5406
5407 if (beacon == nil)
5408 {
5409 [self setCompassMode:COMPASS_MODE_PLANET];
5410 }
5411 break;
5412 }
5413}
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 13699 of file PlayerEntity.m.

4314 :(Quaternion) quat
4315{
4316 [self setOrientation:make_quaternion(-quat.w, quat.x, quat.y, quat.z)];
4317}

◆ setOcclusionLevel:

- (void) setOcclusionLevel: (float) level

Definition at line 13699 of file PlayerEntity.m.

4454 :(float)level
4455{
4456 occlusion_dial = level;
4457}

◆ setPlanetinfo:

- (void) setPlanetinfo: (NSString *) key_valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setPrevCompassMode

- (void) setPrevCompassMode

Definition at line 13699 of file PlayerEntity.m.

5286{
5287 OOAegisStatus aegis = AEGIS_NONE;
5288 Entity <OOBeaconEntity> *beacon = nil;
5289
5290 switch (compassMode)
5291 {
5292 case COMPASS_MODE_INACTIVE:
5293 case COMPASS_MODE_BASIC:
5294 case COMPASS_MODE_PLANET:
5295 beacon = [UNIVERSE lastBeacon];
5296 while (beacon != nil && [beacon isJammingScanning])
5297 {
5298 beacon = [beacon prevBeacon];
5299 }
5300 [self setNextBeacon:beacon];
5301
5302 if (beacon != nil)
5303 {
5304 [self setCompassMode:COMPASS_MODE_BEACONS];
5305 break;
5306 }
5307 // else fall through to switch to target mode.
5308
5309 case COMPASS_MODE_BEACONS:
5310 beacon = [self nextBeacon];
5311 do
5312 {
5313 beacon = [beacon prevBeacon];
5314 } while (beacon != nil && [beacon isJammingScanning]);
5315 [self setNextBeacon:beacon];
5316
5317 if (beacon == nil)
5318 {
5319 if ([self primaryTarget])
5320 {
5321 [self setCompassMode:COMPASS_MODE_TARGET];
5322 }
5323 else
5324 {
5325 [self setCompassMode:COMPASS_MODE_SUN];
5326 }
5327 break;
5328 }
5329 break;
5330
5331 case COMPASS_MODE_TARGET:
5332 [self setCompassMode:COMPASS_MODE_SUN];
5333 break;
5334
5335 case COMPASS_MODE_SUN:
5336 aegis = [self checkForAegis];
5337 if (aegis == AEGIS_CLOSE_TO_MAIN_PLANET || aegis == AEGIS_IN_DOCKING_RANGE)
5338 {
5339 [self setCompassMode:COMPASS_MODE_STATION];
5340 }
5341 else
5342 {
5343 [self setCompassMode:COMPASS_MODE_PLANET];
5344 }
5345 break;
5346
5347 case COMPASS_MODE_STATION:
5348 [self setCompassMode:COMPASS_MODE_PLANET];
5349 break;
5350 }
5351}

◆ setPreviousSystemID:

- (void) setPreviousSystemID: (OOSystemID) sid

Definition at line 13699 of file PlayerEntity.m.

705 :(OOSystemID) sid
706{
707 previous_system_id = sid;
708}

◆ setPrimedEquipment:showMessage:

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

Definition at line 13699 of file PlayerEntity.m.

8198 :(NSString *)eqKey showMessage:(BOOL)showMsg
8199{
8200 NSUInteger c = [eqScripts count];
8201 NSUInteger current = primedEquipment;
8202 primedEquipment = [self eqScriptIndexForKey:eqKey]; // if key not found primedEquipment is set to primed-none
8203 BOOL unprimeEq = [eqKey isEqualToString:@""];
8204 BOOL result = YES;
8205
8206 if (primedEquipment == c && !unprimeEq)
8207 {
8208 primedEquipment = current;
8209 result = NO;
8210 }
8211 else
8212 {
8213 if (primedEquipment != current && showMsg == YES)
8214 {
8215 NSString *equipmentName = [[OOEquipmentType equipmentTypeWithIdentifier:[[eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0]] name];
8216 [UNIVERSE addMessage:unprimeEq ? OOExpandKey(@"equipment-primed-none") : OOExpandKey(@"equipment-primed", equipmentName) forCount:2.0];
8217 }
8218 }
8219 return result;
8220}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setRandom_factor:

- (void) setRandom_factor: (int) rf

Definition at line 13699 of file PlayerEntity.m.

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

◆ setScoopOverride:

- (void) setScoopOverride: (BOOL) newValue

Definition at line 9211 of file PlayerEntity.m.

12996 :(BOOL)newValue
12997{
12998 scoopOverride = !!newValue;
12999 if (scoopOverride) [self setScoopsActive];
13000}
unsigned scoopOverride

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setScoopsActive

- (void) setScoopsActive

Definition at line 9211 of file PlayerEntity.m.

12218{
12219 scoopsActive = YES;
12220}

◆ 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 13699 of file PlayerEntity.m.

4598 :(BOOL)value
4599{
4600 showDemoShips = value;
4601}

◆ setSpecificPlanetInfo:

- (void) setSpecificPlanetInfo: (NSString *) key_valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setSunNovaIn:

- (void) setSunNovaIn: (NSString *) time_value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setSystemID:

- (void) setSystemID: (OOSystemID) sid

Definition at line 13699 of file PlayerEntity.m.

690 :(OOSystemID) sid
691{
692 system_id = sid;
693 galaxy_coordinates = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:sid inGalaxy:galaxy_number]);
696}

◆ setTargetDockStationTo:

- (void) setTargetDockStationTo: (StationEntity *) value

Definition at line 13699 of file PlayerEntity.m.

4480 :(StationEntity *) value
4481{
4482 targetDockStation = value;
4483}

◆ setTargetSystemID:

- (void) setTargetSystemID: (OOSystemID) sid

Definition at line 13699 of file PlayerEntity.m.

717 :(OOSystemID) sid
718{
719 target_system_id = sid;
720 cursor_coordinates = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystemKey:[UNIVERSE keyForPlanetOverridesForSystem:sid inGalaxy:galaxy_number]]);
721}

Referenced by PlayerSetEscapePodDestination(), and PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setTrumbleAppetiteAccumulator:

- (void) setTrumbleAppetiteAccumulator: (float) value

Definition at line 9211 of file PlayerEntity.m.

12180 :(float)value
12181{
12183}
float _trumbleAppetiteAccumulator

◆ setTrumbleValueFrom:

- (void) setTrumbleValueFrom: (NSObject *) trumbleValue

Definition at line 9211 of file PlayerEntity.m.

12065 :(NSObject*) trumbleValue
12066{
12067 BOOL info_failed = NO;
12068 int trumbleHash;
12069 int putativeHash = 0;
12070 int putativeNTrumbles = 0;
12071 NSArray *putativeTrumbleArray = nil;
12072 int i;
12073 NSString *namekey = [NSString stringWithFormat:@"%@-humbletrash", [self commanderName]];
12074
12075 [self setUpTrumbles];
12076
12077 if (trumbleValue)
12078 {
12079 BOOL possible_cheat = NO;
12080 if (![trumbleValue isKindOfClass:[NSArray class]])
12081 info_failed = YES;
12082 else
12083 {
12084 NSArray* values = (NSArray*) trumbleValue;
12085 if ([values count] >= 1)
12086 putativeNTrumbles = [values oo_intAtIndex:0];
12087 if ([values count] >= 2)
12088 putativeHash = [values oo_intAtIndex:1];
12089 if ([values count] >= 3)
12090 putativeTrumbleArray = [values oo_arrayAtIndex:2];
12091 }
12092 // calculate a hash for the putative values
12094 [self mungChecksumWithNSString:[self commanderName]];
12097 trumbleHash = munge_checksum(putativeNTrumbles);
12098
12099 if (putativeHash != trumbleHash)
12100 info_failed = YES;
12101
12102 if (info_failed)
12103 {
12104 OOLog(@"cheat.tentative", @"%@", @"POSSIBLE CHEAT DETECTED");
12105 possible_cheat = YES;
12106 }
12107
12108 for (i = 1; (info_failed)&&(i < PLAYER_MAX_TRUMBLES); i++)
12109 {
12110 // try to determine trumbleCount from the key in the saved game
12112 [self mungChecksumWithNSString:[self commanderName]];
12115 trumbleHash = munge_checksum(i);
12116 if (putativeHash == trumbleHash)
12117 {
12118 info_failed = NO;
12119 putativeNTrumbles = i;
12120 }
12121 }
12122
12123 if (possible_cheat && !info_failed)
12124 OOLog(@"cheat.verified", @"%@", @"CHEAT DEFEATED - that's not the way to get rid of trumbles!");
12125 }
12126 else
12127 // if trumbleValue comes in as nil, then probably someone has toyed with the save file
12128 // by removing the entire trumbles array
12129 {
12130 OOLog(@"cheat.tentative", @"%@", @"POSSIBLE CHEAT DETECTED");
12131 info_failed = YES;
12132 }
12133
12134 if (info_failed && [[NSUserDefaults standardUserDefaults] objectForKey:namekey])
12135 {
12136 // try to determine trumbleCount from the key in user defaults
12137 putativeHash = (int)[[NSUserDefaults standardUserDefaults] integerForKey:namekey];
12138 for (i = 1; (info_failed)&&(i < PLAYER_MAX_TRUMBLES); i++)
12139 {
12141 [self mungChecksumWithNSString:[self commanderName]];
12144 trumbleHash = munge_checksum(i);
12145 if (putativeHash == trumbleHash)
12146 {
12147 info_failed = NO;
12148 putativeNTrumbles = i;
12149 }
12150 }
12151
12152 if (!info_failed)
12153 OOLog(@"cheat.verified", @"%@", @"CHEAT DEFEATED - that's not the way to get rid of trumbles!");
12154 }
12155 // at this stage we've done the best we can to stop cheaters
12156 trumbleCount = putativeNTrumbles;
12157
12158 if ((putativeTrumbleArray != nil) && ([putativeTrumbleArray count] == PLAYER_MAX_TRUMBLES))
12159 {
12160 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12161 [trumble[i] setFromDictionary:[putativeTrumbleArray oo_dictionaryAtIndex:i]];
12162 }
12163
12165 [self mungChecksumWithNSString:[self commanderName]];
12168 trumbleHash = munge_checksum(trumbleCount);
12169
12170 [[NSUserDefaults standardUserDefaults] setInteger:trumbleHash forKey:namekey];
12171}

◆ setUpAndConfirmOK:

- (BOOL) setUpAndConfirmOK: (BOOL) stopOnError

Definition at line 13699 of file PlayerEntity.m.

1868 :(BOOL)stopOnError
1869{
1870 return [self setUpAndConfirmOK:stopOnError saveGame:NO];
1871}

◆ setUpAndConfirmOK:saveGame:

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

Definition at line 13699 of file PlayerEntity.m.

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

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

9891{
9892 GuiDisplayGen *gui = [UNIVERSE gui];
9893 NSString *text = nil;
9894
9895 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9896
9897 [gui clear];
9898
9899 [gui setTitle:@"Oolite"];
9900
9901 text = DESC(@"game-copyright");
9902 [gui setText:text forRow:15 align:GUI_ALIGN_CENTER];
9903 [gui setColor:[OOColor whiteColor] forRow:15];
9904
9905 text = DESC(@"theme-music-credit");
9906 [gui setText:text forRow:17 align:GUI_ALIGN_CENTER];
9907 [gui setColor:[OOColor grayColor] forRow:17];
9908
9909 int initialRow = 22;
9910 int row = initialRow;
9911
9912 text = DESC(@"oolite-start-option-1");
9913 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9914 [gui setColor:[OOColor yellowColor] forRow:row];
9915 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9916
9917 ++row;
9918
9919 text = DESC(@"oolite-start-option-2");
9920 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9921 [gui setColor:[OOColor yellowColor] forRow:row];
9922 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9923
9924 ++row;
9925
9926 text = DESC(@"oolite-start-option-3");
9927 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9928 [gui setColor:[OOColor yellowColor] forRow:row];
9929 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9930
9931 ++row;
9932
9933 text = DESC(@"oolite-start-option-4");
9934 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9935 [gui setColor:[OOColor yellowColor] forRow:row];
9936 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9937
9938 ++row;
9939
9940 text = DESC(@"oolite-start-option-5");
9941 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9942 [gui setColor:[OOColor yellowColor] forRow:row];
9943 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9944
9945 ++row;
9946
9947 text = DESC(@"oolite-start-option-6");
9948 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9949 [gui setColor:[OOColor yellowColor] forRow:row];
9950 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9951
9952
9953 [gui setSelectableRange:NSMakeRange(initialRow, row - initialRow + 1)];
9954 [gui setSelectedRow:initialRow];
9955
9956 [gui setBackgroundTextureKey:@"intro"];
9957
9958}
OOColor * whiteColor()
Definition OOColor.m:256

◆ setUpTrumbles

- (void) setUpTrumbles

Definition at line 9211 of file PlayerEntity.m.

11958{
11959 NSMutableString *trumbleDigrams = [NSMutableString stringWithCapacity:256];
11960 unichar xchar = (unichar)0;
11961 unichar digramchars[2];
11962
11963 while ([trumbleDigrams length] < PLAYER_MAX_TRUMBLES + 2)
11964 {
11965 NSString *commanderName = [self commanderName];
11966 if ([commanderName length] > 0)
11967 {
11968 [trumbleDigrams appendFormat:@"%@%@", commanderName, [[self mesh] modelName]];
11969 }
11970 else
11971 {
11972 [trumbleDigrams appendString:@"Some Random Text!"];
11973 }
11974 }
11975 int i;
11976 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
11977 {
11978 digramchars[0] = ([trumbleDigrams characterAtIndex:i] & 0x007f) | 0x0020;
11979 digramchars[1] = (([trumbleDigrams characterAtIndex:i + 1] ^ xchar) & 0x007f) | 0x0020;
11980 xchar = digramchars[0];
11981 NSString *digramstring = [NSString stringWithCharacters:digramchars length:2];
11982 [trumble[i] release];
11983 trumble[i] = [[OOTrumble alloc] initForPlayer:self digram:digramstring];
11984 }
11985
11986 trumbleCount = 0;
11987
11988 [self setTrumbleAppetiteAccumulator:0.0f];
11989}
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 9211 of file PlayerEntity.m.

10571 :(OOWeaponFacing)facing toWeapon:(NSString *)eqKey
10572{
10573 return [self setWeaponMount:facing toWeapon:eqKey inContext:@"purchase"];
10574}
OOWeaponFacing
Definition OOTypes.h:228

◆ setWeaponMount:toWeapon:inContext:

- (BOOL) setWeaponMount: (OOWeaponFacing) facing
toWeapon: (NSString *) eqKey
inContext: (NSString *) context 

Definition at line 9211 of file PlayerEntity.m.

10577 :(OOWeaponFacing)facing toWeapon:(NSString *)eqKey inContext:(NSString *) context
10578{
10579
10580 NSDictionary *shipyardInfo = [[OOShipRegistry sharedRegistry] shipyardInfoForKey:[self shipDataKey]];
10581 unsigned available_facings = [shipyardInfo oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:[self weaponFacings]]; // use defaults explicitly
10582
10583 // facing exists?
10584 if (!(available_facings & facing))
10585 {
10586 return NO;
10587 }
10588
10589 // weapon allowed (or NONE)?
10590 if (![eqKey isEqualToString:@"EQ_WEAPON_NONE"])
10591 {
10592 if (![self canAddEquipment:eqKey inContext:context])
10593 {
10594 return NO;
10595 }
10596 }
10597
10598 // sets WEAPON_NONE if not recognised
10600
10601 switch (facing)
10602 {
10604 forward_weapon_type = chosen_weapon;
10605 break;
10606
10607 case WEAPON_FACING_AFT:
10608 aft_weapon_type = chosen_weapon;
10609 break;
10610
10611 case WEAPON_FACING_PORT:
10612 port_weapon_type = chosen_weapon;
10613 break;
10614
10616 starboard_weapon_type = chosen_weapon;
10617 break;
10618
10619 case WEAPON_FACING_NONE:
10620 break;
10621 }
10622
10623 return YES;
10624}
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 13699 of file PlayerEntity.m.

6136 :(BOOL)newValue
6137{
6138 weapons_online = !!newValue;
6139 if (!weapons_online) [self safeAllMissiles];
6140}

◆ setWitchspaceCountdown:

- (void) setWitchspaceCountdown: (int) spin_time

Definition at line 9211 of file PlayerEntity.m.

12973 :(int)spin_time
12974{
12975 witchspaceCountdown = spin_time;
12976}

Referenced by PlayerShipBeginGalacticHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ setWormhole:

- (void) setWormhole: (WormholeEntity *) newWormhole

Definition at line 13699 of file PlayerEntity.m.

899 :(WormholeEntity*)newWormhole
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 13699 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 955 of file PlayerEntityLegacyScriptEngine.m.

957{
958 return [NSNumber numberWithInt:shipsFound];
959}

◆ shipyardRecord

- (NSMutableDictionary *) shipyardRecord

Definition at line 9211 of file PlayerEntity.m.

13327{
13328 return shipyard_record;
13329}

◆ showCommanderShip:

- (void) showCommanderShip: (int) cdrArrayIndex
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1003 of file PlayerEntityLoadSave.m.

1203 :(int)cdrArrayIndex
1204{
1205 GuiDisplayGen *gui=[UNIVERSE gui];
1206 [UNIVERSE removeDemoShips];
1207 NSDictionary *cdr=[cdrDetailArray objectAtIndex: cdrArrayIndex];
1208
1209 [gui setText:@"" forRow:CDRDESCROW align:GUI_ALIGN_LEFT];
1210 [gui setText:@"" forRow:CDRDESCROW + 1 align:GUI_ALIGN_LEFT];
1211 [gui setText:@"" forRow:CDRDESCROW + 2 align:GUI_ALIGN_LEFT];
1212
1213 if ([cdr oo_boolForKey:@"isFolder"])
1214 {
1215 NSString *folderDesc=[NSString stringWithFormat: DESC(@"loadsavescreen-hold-@-and-press-return-to-open-folder-@"), @COMMAND_MODIFIER_KEY, [[cdr oo_stringForKey:@"saved_game_path"] lastPathComponent]];
1216 [gui setColor: [OOColor orangeColor] forRow: CDRDESCROW];
1217 [gui addLongText: folderDesc startingAtRow: CDRDESCROW align: GUI_ALIGN_LEFT];
1218 return;
1219 }
1220
1221 if ([cdr oo_boolForKey:@"isParentFolder"])
1222 {
1223 NSString *folderDesc=[NSString stringWithFormat: DESC(@"loadsavescreen-hold-@-and-press-return-to-open-parent-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 [gui setColor:[gui colorFromSetting:nil defaultValue:nil] forRow: CDRDESCROW];
1229
1230 if (![cdr oo_boolForKey:@"isSavedGame"]) return; // don't show things that aren't saved games
1231
1232 if ([self dockedStation] == nil) [self setDockedAtMainStation];
1233
1234 // Display the commander's ship.
1235 NSString *shipDesc = [cdr oo_stringForKey:@"ship_desc"];
1236 NSString *shipName = nil;
1237 NSDictionary *shipDict = nil;
1238 NSString *rating = nil;
1239 uint16_t personality = PersonalityForCommanderDict(cdr);
1240
1241 shipDict = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipDesc];
1242 if(shipDict != nil)
1243 {
1244 NSMutableDictionary * dict = [[NSMutableDictionary alloc] initWithCapacity:[shipDict count] + 1];
1245 [dict setDictionary:shipDict];
1246 id subEntStatus = [cdr objectForKey:@"subentities_status"];
1247 // don't add it to the dictionary if there's no subentities_status key
1248 if (subEntStatus != nil) [dict setObject:subEntStatus forKey:@"subentities_status"];
1249 [self showShipyardModel:shipDesc shipData:dict personality:personality];
1250 [dict release];
1251 shipName = [shipDict oo_stringForKey:@"display_name"];
1252 if (shipName == nil) shipName = [shipDict oo_stringForKey:KEY_NAME];
1253 }
1254 else
1255 {
1256 [self showShipyardModel:@"oolite-unknown-ship" shipData:nil personality:personality];
1257 shipName = [cdr oo_stringForKey:@"ship_name" defaultValue:@"unknown"];
1258 if (![[UNIVERSE useAddOns] isEqualToString:SCENARIO_OXP_DEFINITION_ALL])
1259 {
1260 shipName = [shipName stringByAppendingString:@" - OXPs disabled or not installed"];
1261 }
1262 else
1263 {
1264 shipName = [shipName stringByAppendingString:@" - OXP not installed"];
1265 }
1266 }
1267
1268 // Make a short description of the commander
1269 NSString *legalDesc = OODisplayStringFromLegalStatus([cdr oo_intForKey:@"legal_status"]);
1270
1271 rating = KillCountToRatingAndKillString([cdr oo_unsignedIntForKey:@"ship_kills"]);
1272 OOCreditsQuantity money = OODeciCreditsFromObject([cdr objectForKey:@"credits"]);
1273
1274 // Nikos - Add some more information in the load game screen (current location, galaxy number and timestamp).
1275 //-------------------------------------------------------------------------------------------------------------------------
1276
1277 int galNumber;
1278 NSString *timeStamp = nil;
1279 NSString *locationName = [cdr oo_stringForKey:@"current_system_name"];
1280
1281 // If there is no key containing the name of the current system in
1282 // the savefile, calculating what it should have been is going to
1283 // be tricky now that system generation isn't seed based - but
1284 // this implies a save game well over 5 years old.
1285 if (locationName == nil)
1286 {
1287 // Leaving the location blank in this case is probably okay
1288 locationName = @"";
1289 }
1290
1291 galNumber = [cdr oo_intForKey:@"galaxy_number"] + 1; // Galaxy numbering starts at 0.
1292
1293 NSString *locationGov = @"";
1294 NSString *locationEco = @"";
1295 NSString *locationTL = [cdr objectForKey:@"current_system_techlevel"] ? [NSString stringWithFormat:@"%u", [cdr oo_unsignedIntForKey:@"current_system_techlevel"] + 1] : nil;
1296 if (locationTL)
1297 {
1298 locationGov = [NSString stringWithFormat:@"%c", [cdr oo_unsignedCharForKey:@"current_system_government"]];
1299 locationEco = [NSString stringWithFormat:@" %c", (7 - [cdr oo_unsignedCharForKey:@"current_system_economy"]) + 16];
1300 }
1301 else locationTL = @"";
1302
1303 timeStamp = ClockToString([cdr oo_doubleForKey:@"ship_clock" defaultValue:PLAYER_SHIP_CLOCK_START], NO);
1304
1305 //-------------------------------------------------------------------------------------------------------------------------
1306
1307 NSString *cdrDesc = nil;
1308
1309 cdrDesc = [NSString stringWithFormat:DESC(@"loadsavescreen-commander-@-rated-@-has-@-legal-status-@-ship-@-location-@-g-@-eco-@-gov-@-tl-@-timestamp-@"),
1310 [cdr oo_stringForKey:@"player_name"],
1311 rating,
1312 OOCredits(money),
1313 legalDesc,
1314 shipName,
1315 locationName,
1316 galNumber,
1317 locationEco,
1318 locationGov,
1319 locationTL,
1320 timeStamp];
1321
1322 //-------------------------------------------------------------------------------------------------------------------------
1323
1324 [gui addLongText:cdrDesc startingAtRow:CDRDESCROW align:GUI_ALIGN_LEFT];
1325
1326}
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 13699 of file PlayerEntity.m.

4022{
4023 [hud resetGuis:[NSDictionary dictionaryWithObject:[NSDictionary dictionary] forKey:@"message_gui"]];
4024 NSString *scoreMS = [NSString stringWithFormat:OOExpandKey(@"gameoverscreen-score-@"),
4025 KillCountToRatingAndKillString(ship_kills)];
4026
4027 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-game-over") forCount:kDeadResetTime];
4028 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4029 [UNIVERSE displayMessage:scoreMS forCount:kDeadResetTime];
4030 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4031 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-press-space") forCount:kDeadResetTime];
4032 [UNIVERSE displayMessage:@" " forCount:kDeadResetTime];
4033 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4034 [self resetShotTime];
4035}

◆ showInfoFlag

- (BOOL) showInfoFlag

Definition at line 9211 of file PlayerEntity.m.

12650{
12651 return show_info_flag;
12652}

◆ showInformationForSelectedInterface

- (void) showInformationForSelectedInterface

Definition at line 9211 of file PlayerEntity.m.

9831{
9832 GuiDisplayGen* gui = [UNIVERSE gui];
9833 NSString* interfaceKey = [gui selectedRowKey];
9834
9835 int i;
9836
9837 for (i = GUI_ROW_EQUIPMENT_DETAIL; i < GUI_MAX_ROWS; i++)
9838 {
9839 [gui setText:@"" forRow:i];
9840 [gui setColor:[gui colorFromSetting:kGuiInterfaceDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
9841 }
9842
9843 if (interfaceKey && ![interfaceKey hasPrefix:@"More:"])
9844 {
9845 NSDictionary *interfaces = [[self dockedStation] localInterfaces];
9846 OOJSInterfaceDefinition *definition = [interfaces objectForKey:interfaceKey];
9847 if (definition)
9848 {
9849 [gui addLongText:[definition summary] startingAtRow:GUI_ROW_INTERFACES_DETAIL align:GUI_ALIGN_LEFT];
9850 }
9851 }
9852
9853}
#define GUI_MAX_ROWS
@ GUI_ROW_EQUIPMENT_DETAIL

◆ showInformationForSelectedUpgrade

- (void) showInformationForSelectedUpgrade

Definition at line 9211 of file PlayerEntity.m.

9663{
9664 [self showInformationForSelectedUpgradeWithFormatString:nil];
9665}

Referenced by activateSelectedInterface.

+ Here is the caller graph for this function:

◆ showInformationForSelectedUpgradeWithFormatString:

- (void) showInformationForSelectedUpgradeWithFormatString: (NSString *) extraString

Definition at line 9211 of file PlayerEntity.m.

9668 :(NSString *)formatString
9669{
9670 GuiDisplayGen* gui = [UNIVERSE gui];
9671 NSString* eqKey = [gui selectedRowKey];
9672 int i;
9673
9674 OOColor *descColor = [gui colorFromSetting:kGuiEquipmentDescriptionColor defaultValue:[OOColor greenColor]];
9675 for (i = GUI_ROW_EQUIPMENT_DETAIL; i < GUI_MAX_ROWS; i++)
9676 {
9677 [gui setText:@"" forRow:i];
9678 [gui setColor:descColor forRow:i];
9679 }
9680 if (eqKey)
9681 {
9682 if (![eqKey hasPrefix:@"More:"])
9683 {
9685 NSString* eq_key_damaged = [NSString stringWithFormat:@"%@_DAMAGED", eqKey];
9687 if ([self hasEquipmentItem:eq_key_damaged])
9688 {
9689 desc = [NSString stringWithFormat:DESC(@"upgradeinfo-@-price-is-for-repairing"), desc];
9690 }
9691 else
9692 {
9693 if([eqKey hasSuffix:@"ENERGY_UNIT"] && ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"] || [self hasEquipmentItem:@"EQ_ENERGY_UNIT"] || [self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]))
9694 desc = [NSString stringWithFormat:DESC(@"@-will-replace-other-energy"), desc];
9695 if (weight > 0) desc = [NSString stringWithFormat:DESC(@"upgradeinfo-@-weight-d-of-equipment"), desc, weight];
9696 }
9697 if (formatString) desc = [NSString stringWithFormat:formatString, desc];
9698 [gui addLongText:desc startingAtRow:GUI_ROW_EQUIPMENT_DETAIL align:GUI_ALIGN_LEFT];
9699 }
9700 }
9701}
OOCargoQuantity requiredCargoSpace()
NSString * descriptiveText()

◆ showMarketCashAndLoadLine

- (void) showMarketCashAndLoadLine
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9211 of file PlayerEntity.m.

11316{
11317 GuiDisplayGen *gui = [UNIVERSE gui];
11318 OOCargoQuantity currentCargo = current_cargo;
11319 OOCargoQuantity cargoCapacity = [self maxAvailableCargoSpace];
11320 [gui setText:OOExpandKey(@"market-cash-and-load", credits, currentCargo, cargoCapacity) forRow:GUI_ROW_MARKET_CASH];
11321 [gui setColor:[gui colorFromSetting:kGuiMarketCashColor defaultValue:[OOColor yellowColor]] forRow:GUI_ROW_MARKET_CASH];
11322}

◆ 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 9211 of file PlayerEntity.m.

10921 :(OOGUIRow)row forGood:(OOCommodityType)good inMarket:(OOCommodityMarket *)localMarket holdQuantity:(OOCargoQuantity)quantity
10922{
10923 GuiDisplayGen *gui = [UNIVERSE gui];
10924 NSString* desc = [NSString stringWithFormat:@" %@ ", [shipCommodityData nameForGood:good]];
10925 OOCargoQuantity available_units = [localMarket quantityForGood:good];
10926 OOCargoQuantity units_in_hold = quantity;
10927 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:good];
10928 OOMassUnit unit = [shipCommodityData massUnitForGood:good];
10929
10930 NSString *available = OOPadStringToEms(((available_units > 0) ? (NSString *)[NSString stringWithFormat:@"%d",available_units] : DESC(@"commodity-quantity-none")), 2.5);
10931
10932 NSUInteger priceDecimal = pricePerUnit % 10;
10933 NSString *price = [NSString stringWithFormat:@" %@.%lu ",OOPadStringToEms([NSString stringWithFormat:@"%lu",(unsigned long)(pricePerUnit/10)],2.5),priceDecimal];
10934
10935 // this works with up to 9999 tons of gemstones. Any more than that, they deserve the formatting they get! :)
10936
10937 NSString *owned = OOPadStringToEms((units_in_hold > 0) ? (NSString *)[NSString stringWithFormat:@"%d",units_in_hold] : DESC(@"commodity-quantity-none"), 4.5);
10938 NSString *units = DisplayStringForMassUnit(unit);
10939 NSString *units_available = [NSString stringWithFormat:@" %@ %@ ",available, units];
10940 NSString *units_owned = [NSString stringWithFormat:@" %@ %@ ",owned, units];
10941
10942 NSUInteger import_legality = [localMarket importLegalityForGood:good];
10943 NSUInteger export_legality = [localMarket exportLegalityForGood:good];
10944 NSString *legaldesc = nil;
10945 if (import_legality == 0)
10946 {
10947 if (export_legality == 0)
10948 {
10949 legaldesc = DESC(@"oolite-legality-clear");
10950 }
10951 else
10952 {
10953 legaldesc = DESC(@"oolite-legality-import");
10954 }
10955 }
10956 else
10957 {
10958 if (export_legality == 0)
10959 {
10960 legaldesc = DESC(@"oolite-legality-export");
10961 }
10962 else
10963 {
10964 legaldesc = DESC(@"oolite-legality-neither");
10965 }
10966 }
10967 legaldesc = [NSString stringWithFormat:@" %@ ",legaldesc];
10968
10969 NSString *extradesc = [shipCommodityData shortCommentForGood:good];
10970
10971 [gui setKey:good forRow:row];
10972 [gui setColor:[gui colorFromSetting:kGuiMarketCommodityColor defaultValue:nil] forRow:row];
10973 [gui setArray:[NSArray arrayWithObjects: desc, extradesc, price, units_available, units_owned, legaldesc, nil] forRow:row++];
10974
10975}
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 9211 of file PlayerEntity.m.

10900{
10901 GuiDisplayGen *gui = [UNIVERSE gui];
10902 OOGUITabSettings tab_stops;
10903 tab_stops[0] = 0;
10904 tab_stops[1] = 137;
10905 tab_stops[2] = 187;
10906 tab_stops[3] = 267;
10907 tab_stops[4] = 321;
10908 tab_stops[5] = 431;
10909 [gui overrideTabs:tab_stops from:kGuiMarketTabs length:6];
10910 [gui setTabStops:tab_stops];
10911
10912 [gui setColor:[gui colorFromSetting:kGuiMarketHeadingColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_KEY];
10913 [gui setArray:[NSArray arrayWithObjects: DESC(@"commodity-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10914 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];
10915 [gui setArray:[NSArray arrayWithObjects: DESC(@"commodity-column-title"), DESC(@"oolite-extras-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10916 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];
10917
10918}

◆ showScenarioDetails

- (void) showScenarioDetails

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 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 955 of file PlayerEntityLegacyScriptEngine.m.

2150 :(NSString *)role
2151{
2152 if ([role isEqualToString:@"none"] || [role length] == 0)
2153 {
2154 [UNIVERSE removeDemoShips];
2155 return;
2156 }
2157
2158 ShipEntity *ship = [UNIVERSE makeDemoShipWithRole:role spinning:YES];
2159 OOLog(kOOLogNoteShowShipModel, @"::::: showShipModel:'%@' (%@) (%@)", role, ship, [ship name]);
2160}
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 13699 of file PlayerEntity.m.

4038 :(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality factorX:(GLfloat)factorX factorY:(GLfloat)factorY factorZ:(GLfloat)factorZ inContext:(NSString *)context
4039{
4040 if (shipKey == nil) return;
4041 if (shipData == nil) shipData = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipKey];
4042 if (shipData == nil) return;
4043
4044 Quaternion q2 = { (GLfloat)M_SQRT1_2, (GLfloat)M_SQRT1_2, (GLfloat)0.0f, (GLfloat)0.0f };
4045 // MKW - retrieve last demo ships' orientation and release it
4046 if( demoShip != nil )
4047 {
4048 q2 = [demoShip orientation];
4049 [demoShip release];
4050 }
4051
4052 ShipEntity *ship = [[ProxyPlayerEntity alloc] initWithKey:shipKey definition:shipData];
4053 if (personality != ENTITY_PERSONALITY_INVALID) [ship setEntityPersonalityInt:personality];
4054
4055 [ship wasAddedToUniverse];
4056
4057 if (context) OOLog(@"script.debug.note.showShipModel", @"::::: showShipModel:'%@' in context: %@.", [ship name], context);
4058
4059 GLfloat cr = [ship collisionRadius];
4060 [ship setOrientation: q2];
4061 [ship setPositionX:factorX * cr y:factorY * cr z:factorZ * cr];
4062 [ship setScanClass: CLASS_NO_DRAW];
4063 [ship setDemoShip: 0.6];
4064 [ship setDemoStartTime: [UNIVERSE getTime]];
4065 if([ship pendingEscortCount] > 0) [ship setPendingEscortCount:0];
4066 [ship setAITo: @"nullAI.plist"];
4067 id subEntStatus = [shipData objectForKey:@"subentities_status"];
4068 // show missing subentities if there's a subentities_status key
4069 if (subEntStatus != nil) [ship deserializeShipSubEntitiesFrom:(NSString *)subEntStatus];
4070 [UNIVERSE addEntity: ship];
4071 // MKW - save demo ship for its rotation
4072 demoShip = [ship retain];
4073
4074 [ship setStatus: STATUS_COCKPIT_DISPLAY];
4075
4076 [ship release];
4077}
#define M_SQRT1_2
Definition OOMaths.h:94
#define ENTITY_PERSONALITY_INVALID
Definition ShipEntity.h:111
GLfloat collisionRadius()
Definition Entity.m:905
void setPositionX:y:z:(OOHPScalar x,[y] OOHPScalar y,[z] OOHPScalar z)
Definition Entity.m:654
void setDemoStartTime:(OOTimeAbsolute time)
void wasAddedToUniverse()
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 8826 of file PlayerEntity.m.

8827{
8828 NSString *filledSlider = [@"|||||||||||||||||||||||||" substringToIndex:amountIn20ths];
8829 NSString *emptySlider = [@"........................." substringToIndex:20 - amountIn20ths];
8830 return [NSString stringWithFormat:@"%@%@", filledSlider, emptySlider];
8831}

◆ sortCommanders

- (NSComparisonResult) sortCommanders (id) cdr1
(id) cdr2
(void *) context 
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1003 of file PlayerEntityLoadSave.m.

1004{
1005 return [[cdr1 objectForKey:@"saved_game_path"] localizedCompare:[cdr2 objectForKey:@"saved_game_path"]];
1006}

◆ spawnShip:

- (void) spawnShip: (NSString *) ship_key

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1678 :(NSString *)ship_key
1679{
1680 if ([UNIVERSE spawnShip:ship_key])
1681 {
1682 OOLog(kOOLogNoteAddShips, @"DEBUG: Spawned ship with shipdata key '%@'.", ship_key);
1683 }
1684 else
1685 {
1686 OOLog(kOOLogScriptAddShipsFailed, @"***** SCRIPT ERROR: in %@, could not spawn ship with shipdata key '%@'.", CurrentScriptDesc(), ship_key);
1687 }
1688}

◆ 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 1412 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 13699 of file PlayerEntity.m.

2270{
2271 JSContext *context = OOJSAcquireContext();
2272 [self doWorldScriptEvent:OOJSID("startUpComplete") inContext:context withArguments:NULL count:0 timeLimit:kOOJSLongTimeLimit];
2273 OOJSRelinquishContext(context);
2274}

◆ status_string

- (NSString *) status_string

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

914{
915 return OOStringFromEntityStatus([self status]);
916}

◆ stickFunctionList

- (NSArray *) stickFunctionList
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

582{
583 NSMutableArray *funcList = [NSMutableArray array];
584
585 // propulsion
586 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-propulsion")]];
587 [funcList addObject:
588 [self makeStickGuiDict:DESC(@"stickmapper-roll")
589 allowable:HW_AXIS
590 axisfn:AXIS_ROLL
591 butfn:STICK_NOFUNCTION]];
592 [funcList addObject:
593 [self makeStickGuiDict:DESC(@"stickmapper-pitch")
594 allowable:HW_AXIS
595 axisfn:AXIS_PITCH
596 butfn:STICK_NOFUNCTION]];
597 [funcList addObject:
598 [self makeStickGuiDict:DESC(@"stickmapper-yaw")
599 allowable:HW_AXIS
600 axisfn:AXIS_YAW
601 butfn:STICK_NOFUNCTION]];
602 [funcList addObject:
603 [self makeStickGuiDict:DESC(@"stickmapper-increase-thrust")
604 allowable:HW_AXIS|HW_BUTTON
605 axisfn:AXIS_THRUST
606 butfn:BUTTON_INCTHRUST]];
607 [funcList addObject:
608 [self makeStickGuiDict:DESC(@"stickmapper-decrease-thrust")
609 allowable:HW_AXIS|HW_BUTTON
610 axisfn:AXIS_THRUST
611 butfn:BUTTON_DECTHRUST]];
612 [funcList addObject:
613 [self makeStickGuiDict:DESC(@"stickmapper-fuel-injection")
614 allowable:HW_BUTTON
615 axisfn:STICK_NOFUNCTION
616 butfn:BUTTON_FUELINJECT]];
617 [funcList addObject:
618 [self makeStickGuiDict:DESC(@"stickmapper-hyperspeed")
619 allowable:HW_BUTTON
620 axisfn:STICK_NOFUNCTION
621 butfn:BUTTON_HYPERSPEED]];
622 [funcList addObject:
623 [self makeStickGuiDict:DESC(@"stickmapper-hyperdrive")
624 allowable:HW_BUTTON
625 axisfn:STICK_NOFUNCTION
626 butfn:BUTTON_HYPERDRIVE]];
627 [funcList addObject:
628 [self makeStickGuiDict:DESC(@"stickmapper-gal-hyperdrive")
629 allowable:HW_BUTTON
630 axisfn:STICK_NOFUNCTION
631 butfn:BUTTON_GALACTICDRIVE]];
632
633 [funcList addObject:
634 [self makeStickGuiDict:DESC(@"stickmapper-roll/pitch-precision-toggle")
635 allowable:HW_BUTTON
636 axisfn:STICK_NOFUNCTION
637 butfn:BUTTON_PRECISION]];
638
639 // navigation
640 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-navigation")]];
641 [funcList addObject:
642 [self makeStickGuiDict:DESC(@"stickmapper-compass-mode-next")
643 allowable:HW_BUTTON
644 axisfn:STICK_NOFUNCTION
645 butfn:BUTTON_COMPASSMODE]];
646 [funcList addObject:
647 [self makeStickGuiDict:DESC(@"stickmapper-compass-mode-prev")
648 allowable:HW_BUTTON
649 axisfn:STICK_NOFUNCTION
650 butfn:BUTTON_COMPASSMODE_PREV]];
651 [funcList addObject:
652 [self makeStickGuiDict:DESC(@"stickmapper-scanner-zoom")
653 allowable:HW_BUTTON
654 axisfn:STICK_NOFUNCTION
655 butfn:BUTTON_SCANNERZOOM]];
656 [funcList addObject:
657 [self makeStickGuiDict:DESC(@"stickmapper-scanner-unzoom")
658 allowable:HW_BUTTON
659 axisfn:STICK_NOFUNCTION
660 butfn:BUTTON_SCANNERUNZOOM]];
661 [funcList addObject:
662 [self makeStickGuiDict:DESC(@"stickmapper-view-forward")
663 allowable:HW_AXIS|HW_BUTTON
664 axisfn:AXIS_VIEWY
665 butfn:BUTTON_VIEWFORWARD]];
666 [funcList addObject:
667 [self makeStickGuiDict:DESC(@"stickmapper-view-aft")
668 allowable:HW_AXIS|HW_BUTTON
669 axisfn:AXIS_VIEWY
670 butfn:BUTTON_VIEWAFT]];
671 [funcList addObject:
672 [self makeStickGuiDict:DESC(@"stickmapper-view-port")
673 allowable:HW_AXIS|HW_BUTTON
674 axisfn:AXIS_VIEWX
675 butfn:BUTTON_VIEWPORT]];
676 [funcList addObject:
677 [self makeStickGuiDict:DESC(@"stickmapper-view-starboard")
678 allowable:HW_AXIS|HW_BUTTON
679 axisfn:AXIS_VIEWX
680 butfn:BUTTON_VIEWSTARBOARD]];
681 [funcList addObject:
682 [self makeStickGuiDict:DESC(@"stickmapper-ext-view-cycle")
683 allowable:HW_BUTTON
684 axisfn:STICK_NOFUNCTION
685 butfn:BUTTON_EXTVIEWCYCLE]];
686 [funcList addObject:
687 [self makeStickGuiDict:DESC(@"stickmapper-toggle-ID")
688 allowable:HW_BUTTON
689 axisfn:STICK_NOFUNCTION
690 butfn:BUTTON_ID]];
691 [funcList addObject:
692 [self makeStickGuiDict:DESC(@"stickmapper-docking-clearance")
693 allowable:HW_BUTTON
694 axisfn:STICK_NOFUNCTION
695 butfn:BUTTON_DOCKINGCLEARANCE]];
696 [funcList addObject:
697 [self makeStickGuiDict:DESC(@"stickmapper-dockcpu")
698 allowable:HW_BUTTON
699 axisfn:STICK_NOFUNCTION
700 butfn:BUTTON_DOCKCPU]];
701 [funcList addObject:
702 [self makeStickGuiDict:DESC(@"stickmapper-dockcpufast")
703 allowable:HW_BUTTON
704 axisfn:STICK_NOFUNCTION
705 butfn:BUTTON_DOCKCPUFAST]];
706 [funcList addObject:
707 [self makeStickGuiDict:DESC(@"stickmapper-docking-music")
708 allowable:HW_BUTTON
709 axisfn:STICK_NOFUNCTION
710 butfn:BUTTON_DOCKINGMUSIC]];
711
712 // offensive
713 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-offensive")]];
714 [funcList addObject:
715 [self makeStickGuiDict:DESC(@"stickmapper-weapons-online-toggle")
716 allowable:HW_BUTTON
717 axisfn:STICK_NOFUNCTION
718 butfn:BUTTON_WEAPONSONLINETOGGLE]];
719 [funcList addObject:
720 [self makeStickGuiDict:DESC(@"stickmapper-primary-weapon")
721 allowable:HW_BUTTON
722 axisfn:STICK_NOFUNCTION
723 butfn:BUTTON_FIRE]];
724 [funcList addObject:
725 [self makeStickGuiDict:DESC(@"stickmapper-secondary-weapon")
726 allowable:HW_BUTTON
727 axisfn:STICK_NOFUNCTION
728 butfn:BUTTON_LAUNCHMISSILE]];
729 [funcList addObject:
730 [self makeStickGuiDict:DESC(@"stickmapper-arm-secondary")
731 allowable:HW_BUTTON
732 axisfn:STICK_NOFUNCTION
733 butfn:BUTTON_ARMMISSILE]];
734 [funcList addObject:
735 [self makeStickGuiDict:DESC(@"stickmapper-disarm-secondary")
736 allowable:HW_BUTTON
737 axisfn:STICK_NOFUNCTION
738 butfn:BUTTON_UNARM]];
739 [funcList addObject:
740 [self makeStickGuiDict:DESC(@"stickmapper-target-nearest-incoming-missile")
741 allowable:HW_BUTTON
742 axisfn:STICK_NOFUNCTION
743 butfn:BUTTON_TARGETINCOMINGMISSILE]];
744 [funcList addObject:
745 [self makeStickGuiDict:DESC(@"stickmapper-cycle-secondary")
746 allowable:HW_BUTTON
747 axisfn:STICK_NOFUNCTION
748 butfn:BUTTON_CYCLEMISSILE]];
749 [funcList addObject:
750 [self makeStickGuiDict:DESC(@"stickmapper-next-target")
751 allowable:HW_BUTTON
752 axisfn:STICK_NOFUNCTION
753 butfn:BUTTON_NEXTTARGET]];
754 [funcList addObject:
755 [self makeStickGuiDict:DESC(@"stickmapper-previous-target")
756 allowable:HW_BUTTON
757 axisfn:STICK_NOFUNCTION
758 butfn:BUTTON_PREVTARGET]];
759
760 // defensive
761 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-defensive")]];
762 [funcList addObject:
763 [self makeStickGuiDict:DESC(@"stickmapper-ECM")
764 allowable:HW_BUTTON
765 axisfn:STICK_NOFUNCTION
766 butfn:BUTTON_ECM]];
767 [funcList addObject:
768 [self makeStickGuiDict:DESC(@"stickmapper-jettison")
769 allowable:HW_BUTTON
770 axisfn:STICK_NOFUNCTION
771 butfn:BUTTON_JETTISON]];
772 [funcList addObject:
773 [self makeStickGuiDict:DESC(@"stickmapper-rotate-cargo")
774 allowable:HW_BUTTON
775 axisfn:STICK_NOFUNCTION
776 butfn:BUTTON_ROTATECARGO]];
777 [funcList addObject:
778 [self makeStickGuiDict:DESC(@"stickmapper-escape-pod")
779 allowable:HW_BUTTON
780 axisfn:STICK_NOFUNCTION
781 butfn:BUTTON_ESCAPE]];
782
783 // oxp special equip
784 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-special-equip")]];
785 [funcList addObject:
786 [self makeStickGuiDict:DESC(@"stickmapper-mfd-select-next")
787 allowable:HW_BUTTON
788 axisfn:STICK_NOFUNCTION
789 butfn:BUTTON_MFDSELECTNEXT]];
790 [funcList addObject:
791 [self makeStickGuiDict:DESC(@"stickmapper-mfd-select-prev")
792 allowable:HW_BUTTON
793 axisfn:STICK_NOFUNCTION
794 butfn:BUTTON_MFDSELECTPREV]];
795 [funcList addObject:
796 [self makeStickGuiDict:DESC(@"stickmapper-mfd-cycle-next")
797 allowable:HW_BUTTON
798 axisfn:STICK_NOFUNCTION
799 butfn:BUTTON_MFDCYCLENEXT]];
800 [funcList addObject:
801 [self makeStickGuiDict:DESC(@"stickmapper-mfd-cycle-prev")
802 allowable:HW_BUTTON
803 axisfn:STICK_NOFUNCTION
804 butfn:BUTTON_MFDCYCLEPREV]];
805 [funcList addObject:
806 [self makeStickGuiDict:DESC(@"stickmapper-prime-equipment")
807 allowable:HW_BUTTON
808 axisfn:STICK_NOFUNCTION
809 butfn:BUTTON_PRIMEEQUIPMENT]];
810 [funcList addObject:
811 [self makeStickGuiDict:DESC(@"stickmapper-prime-prev-equipment")
812 allowable:HW_BUTTON
813 axisfn:STICK_NOFUNCTION
814 butfn:BUTTON_PRIMEEQUIPMENT]];
815 [funcList addObject:
816 [self makeStickGuiDict:DESC(@"stickmapper-activate-equipment")
817 allowable:HW_BUTTON
818 axisfn:STICK_NOFUNCTION
819 butfn:BUTTON_ACTIVATEEQUIPMENT]];
820 [funcList addObject:
821 [self makeStickGuiDict:DESC(@"stickmapper-mode-equipment")
822 allowable:HW_BUTTON
823 axisfn:STICK_NOFUNCTION
824 butfn:BUTTON_MODEEQUIPMENT]];
825 [funcList addObject:
826 [self makeStickGuiDict:DESC(@"stickmapper-fastactivate-a")
827 allowable:HW_BUTTON
828 axisfn:STICK_NOFUNCTION
829 butfn:BUTTON_CLOAK]];
830 [funcList addObject:
831 [self makeStickGuiDict:DESC(@"stickmapper-fastactivate-b")
832 allowable:HW_BUTTON
833 axisfn:STICK_NOFUNCTION
834 butfn:BUTTON_ENERGYBOMB]];
835
836 // misc
837 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-misc")]];
838 [funcList addObject:
839 [self makeStickGuiDict:DESC(@"stickmapper-snapshot")
840 allowable:HW_BUTTON
841 axisfn:STICK_NOFUNCTION
842 butfn:BUTTON_SNAPSHOT]];
843 [funcList addObject:
844 [self makeStickGuiDict:DESC(@"stickmapper-pause")
845 allowable:HW_BUTTON
846 axisfn:STICK_NOFUNCTION
847 butfn:BUTTON_PAUSE]];
848 [funcList addObject:
849 [self makeStickGuiDict:DESC(@"stickmapper-toggle-hud")
850 allowable:HW_BUTTON
851 axisfn:STICK_NOFUNCTION
852 butfn:BUTTON_TOGGLEHUD]];
853 [funcList addObject:
854 [self makeStickGuiDict:DESC(@"stickmapper-comms-log")
855 allowable:HW_BUTTON
856 axisfn:STICK_NOFUNCTION
857 butfn:BUTTON_COMMSLOG]];
858#if OO_FOV_INFLIGHT_CONTROL_ENABLED
859 [funcList addObject:
860 [self makeStickGuiDict:DESC(@"stickmapper-increase-field-of-view")
861 allowable:HW_AXIS|HW_BUTTON
862 axisfn:AXIS_FIELD_OF_VIEW
863 butfn:BUTTON_INC_FIELD_OF_VIEW]];
864 [funcList addObject:
865 [self makeStickGuiDict:DESC(@"stickmapper-decrease-field-of-view")
866 allowable:HW_AXIS|HW_BUTTON
867 axisfn:AXIS_FIELD_OF_VIEW
868 butfn:BUTTON_DEC_FIELD_OF_VIEW]];
869#endif
870 if ([customEquipActivation count] > 0) {
871 [funcList addObject:[self makeStickGuiDictHeader:DESC(@"stickmapper-header-oxp-equip")]];
872 int i;
873 for (i = 0; i < [customEquipActivation count]; i++)
874 {
875 [funcList addObject:
876 [self makeStickGuiDict:[NSString stringWithFormat: @"Activate '%@'", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPNAME]]
877 allowable:HW_BUTTON
878 axisfn:STICK_NOFUNCTION
879 butfn:(i+10000)]];
880 [funcList addObject:
881 [self makeStickGuiDict:[NSString stringWithFormat: @"Mode '%@'", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPNAME]]
882 allowable:HW_BUTTON
883 axisfn:STICK_NOFUNCTION
884 butfn:(i+20000)]];
885 }
886
887 }
888 return funcList;
889}

◆ 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 955 of file PlayerEntityLegacyScriptEngine.m.

1847 :(NSString *)missionVariableString_value
1848{
1849 NSString* missionVariableString = nil;
1850 NSString* valueString;
1851 double value;
1852 NSMutableArray* tokens = ScanTokensFromString(missionVariableString_value);
1853 BOOL hasMissionPrefix, hasLocalPrefix;
1854
1855 if ([tokens count] < 2)
1856 {
1857 OOLog(kOOLogSyntaxSubtract, @"***** SCRIPT ERROR: in %@, CANNOT SUBTRACT: '%@'", CurrentScriptDesc(), missionVariableString_value);
1858 return;
1859 }
1860
1861 missionVariableString = [tokens objectAtIndex:0];
1862 [tokens removeObjectAtIndex:0];
1863 valueString = [tokens componentsJoinedByString:@" "];
1864
1865 hasMissionPrefix = [missionVariableString hasPrefix:@"mission_"];
1866 hasLocalPrefix = [missionVariableString hasPrefix:@"local_"];
1867
1868 if (hasMissionPrefix)
1869 {
1870 value = [[self missionVariableForKey:missionVariableString] doubleValue];
1871 value -= [valueString doubleValue];
1872 [self setMissionVariable:[NSString stringWithFormat:@"%f", value] forKey:missionVariableString];
1873 }
1874 else if (hasLocalPrefix)
1875 {
1876 value = [[self localVariableForKey:missionVariableString andMission:sCurrentMissionKey] doubleValue];
1877 value -= [valueString doubleValue];
1878 [self setLocalVariable:[NSString stringWithFormat:@"%f", value] forKey:missionVariableString andMission:sCurrentMissionKey];
1879 }
1880 else
1881 {
1882 OOLog(kOOLogSyntaxSubtract, @"***** SCRIPT ERROR: in %@, CANNOT SUBTRACT: '%@' -- IDENTIFIER '%@' DOES NOT BEGIN WITH 'mission_' or 'local_'", CurrentScriptDesc(), missionVariableString_value, missionVariableString_value);
1883 }
1884}
static NSString *const kOOLogSyntaxSubtract

◆ sunGoneNova_bool

- (NSString *) sunGoneNova_bool

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1062{
1063 return ([[UNIVERSE sun] goneNova])? @"YES" : @"NO";
1064}

◆ sunWillGoNova_bool

- (NSString *) sunWillGoNova_bool

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1056{
1057 return ([[UNIVERSE sun] willGoNova])? @"YES" : @"NO";
1058}

◆ suppressClangStuff

- (BOOL) suppressClangStuff
implementation

Definition at line 9211 of file PlayerEntity.m.

13509{
13510 return missionChoice &&
13513 currentPage &&
13545 n_key_ecm &&
13573 n_key_map_end &&
13623#if OO_FOV_INFLIGHT_CONTROL_ENABLED
13624 n_key_inc_field_of_view &&
13625 n_key_dec_field_of_view &&
13626#endif
13635 _sysInfoLight.x &&
13638 keyFunctions &&
13642 kbdLayouts &&
13646 _missionTitle &&
13648}
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 13699 of file PlayerEntity.m.

4507 :(NSString *)hudFileName
4508{
4509 NSDictionary *hudDict = nil;
4510 BOOL wasHidden = NO;
4511 BOOL wasCompassActive = YES;
4512 double scannerZoom = 1.0;
4513 NSUInteger lastMFD = 0;
4514 NSUInteger i;
4515
4516 if (!hudFileName) return NO;
4517
4518 // is the HUD in the process of being rendered? If yes, set it to defer state and abort the switching now
4519 if (hud != nil && [hud isUpdating])
4520 {
4521 [hud setDeferredHudName:hudFileName];
4522 return NO;
4523 }
4524
4525 hudDict = [ResourceManager dictionaryFromFilesNamed:hudFileName inFolder:@"Config" andMerge:YES];
4526 // hud defined, but buggy?
4527 if (hudDict == nil)
4528 {
4529 OOLog(@"PlayerEntity.switchHudTo.failed", @"HUD dictionary file %@ to switch to not found or invalid.", hudFileName);
4530 return NO;
4531 }
4532
4533 if (hud != nil)
4534 {
4535 // remember these values
4536 wasHidden = [hud isHidden];
4537 wasCompassActive = [hud isCompassActive];
4538 scannerZoom = [hud scannerZoom];
4539 lastMFD = activeMFD;
4540 }
4541
4542 // buggy oxp could override hud.plist with a non-dictionary.
4543 if (hudDict != nil)
4544 {
4545 [hud setHidden:YES]; // hide the hud while rebuilding it.
4546 DESTROY(hud);
4547 hud = [[HeadUpDisplay alloc] initWithDictionary:hudDict inFile:hudFileName];
4548 [hud resetGuis:hudDict];
4549 // reset zoom & hidden to what they were before the swich
4550 [hud setScannerZoom:scannerZoom];
4551 [hud setCompassActive:wasCompassActive];
4552 [hud setHidden:wasHidden];
4553 activeMFD = 0;
4554 NSArray *savedMFDs = [NSArray arrayWithArray:multiFunctionDisplaySettings];
4555 [multiFunctionDisplaySettings removeAllObjects];
4556 for (i = 0; i < [hud mfdCount] ; i++)
4557 {
4558 if ([savedMFDs count] > i)
4559 {
4560 [multiFunctionDisplaySettings addObject:[savedMFDs objectAtIndex:i]];
4561 }
4562 else
4563 {
4564 [multiFunctionDisplaySettings addObject:[NSNull null]];
4565 }
4566 }
4567 if (lastMFD < [hud mfdCount]) activeMFD = lastMFD;
4568 }
4569
4570 return YES;
4571}
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 167 of file PlayerEntityControls.m.

834{
835 OOGUIScreenID oldScreen = gui_screen;
836 gui_screen = GUI_SCREEN_MAIN;
837 if (showDemoShips)
838 {
839 [self setShowDemoShips: NO];
840 [UNIVERSE removeDemoShips];
841 }
842 [(MyOpenGLView *)[UNIVERSE gameView] allowStringInput:NO];
843 if ([self isMouseControlOn]) [[UNIVERSE gameView] resetMouse];
844 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
845 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
846}

◆ switchToThisView:

- (void) switchToThisView: (OOViewID) viewDirection
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

5447 :(OOViewID)viewDirection
5448{
5449 [self switchToThisView:viewDirection andProcessWeaponFacing:YES];
5450}

◆ switchToThisView:andProcessWeaponFacing:

- (void) switchToThisView: (OOViewID) viewDirection
andProcessWeaponFacing: (BOOL) processWeaponFacing 
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

5453 :(OOViewID)viewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing
5454{
5455 [self switchToThisView:viewDirection fromView:[UNIVERSE viewDirection] andProcessWeaponFacing:processWeaponFacing justNotify:NO];
5456}

◆ 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 4758 of file PlayerEntityControls.m.

5459 :(OOViewID)viewDirection fromView:(OOViewID)oldViewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing justNotify:(BOOL)justNotify
5460{
5461 if (!justNotify)
5462 {
5463 if ([UNIVERSE displayGUI]) [self switchToMainView];
5464 [UNIVERSE setViewDirection:viewDirection];
5465 }
5466 if (processWeaponFacing)
5467 {
5469 switch (viewDirection)
5470 {
5471 case VIEW_FORWARD:
5472 facing = WEAPON_FACING_FORWARD;
5473 break;
5474
5475 case VIEW_AFT:
5476 facing = WEAPON_FACING_AFT;
5477 break;
5478
5479 case VIEW_PORT:
5480 facing = WEAPON_FACING_PORT;
5481 break;
5482
5483 case VIEW_STARBOARD:
5484 facing = WEAPON_FACING_STARBOARD;
5485 break;
5486
5487 default:
5488 break;
5489 }
5490
5491 if (facing != WEAPON_FACING_NONE)
5492 {
5493 currentWeaponFacing = facing;
5494 [self currentWeaponStats];
5495 }
5496 else
5497 {
5498 OOLogERR(kOOLogParameterError, @"%s called with processWeaponFacing=YES for non-main view %i.", __FUNCTION__, viewDirection);
5499 }
5500 }
5501 if ((oldViewDirection != viewDirection || viewDirection == VIEW_CUSTOM) && ![[UNIVERSE gameController] isGamePaused])
5502 {
5503 JSContext *context = OOJSAcquireContext();
5504 ShipScriptEvent(context, self, "viewDirectionChanged", OOJSValueFromViewID(context, viewDirection), OOJSValueFromViewID(context, oldViewDirection));
5505 OOJSRelinquishContext(context);
5506 }
5507}
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 955 of file PlayerEntityLegacyScriptEngine.m.

1128{
1129 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1130 return [systeminfo objectForKey:KEY_ECONOMY];
1131}

◆ systemEconomy_string

- (NSString *) systemEconomy_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1118{
1119 int economy = [[self systemEconomy_number] intValue]; // 0 .. 7 (0 rich industrial .. 7 poor agricultural)
1120 NSString *result = OODisplayStringFromEconomyID(economy);
1121 if (result == nil) result = @"UNKNOWN";
1122
1123 return result;
1124}
NSString * OODisplayStringFromEconomyID(OOEconomyID economy)

◆ systemGovernment_number

- (NSNumber *) systemGovernment_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1111{
1112 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1113 return [systeminfo objectForKey:KEY_GOVERNMENT];
1114}

◆ systemGovernment_string

- (NSString *) systemGovernment_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1101{
1102 int government = [[self systemGovernment_number] intValue]; // 0 .. 7 (0 anarchic .. 7 most stable)
1103 NSString *result = OODisplayStringFromGovernmentID(government);
1104 if (result == nil) result = @"UNKNOWN";
1105
1106 return result;
1107}
NSString * OODisplayStringFromGovernmentID(OOGovernmentID government)

◆ systemID

- (OOSystemID) systemID

Definition at line 13699 of file PlayerEntity.m.

685{
686 return system_id;
687}

◆ systemPopulation_number

- (NSNumber *) systemPopulation_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1142{
1143 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1144 return [systeminfo objectForKey:KEY_POPULATION];
1145}

◆ systemProductivity_number

- (NSNumber *) systemProductivity_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1149{
1150 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1151 return [systeminfo objectForKey:KEY_PRODUCTIVITY];
1152}

◆ 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 955 of file PlayerEntityLegacyScriptEngine.m.

1135{
1136 NSDictionary *systeminfo = [UNIVERSE currentSystemData];
1137 return [systeminfo objectForKey:KEY_TECHLEVEL];
1138}

◆ takeEnergyDamage:from:becauseOf:weaponIdentifier:

- (void) takeEnergyDamage: (double) amount
from: (Entity *) ent
becauseOf: (Entity *) other
weaponIdentifier: (NSString *) weaponIdentifier 
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6318 :(double)amount from:(Entity *)ent becauseOf:(Entity *)other weaponIdentifier:(NSString *)weaponIdentifier
6319{
6320 HPVector rel_pos;
6321 OOScalar d_forward, d_right, d_up;
6322 BOOL internal_damage = NO; // base chance
6323
6324 OOLog(@"player.ship.damage", @"Player took damage from %@ becauseOf %@", ent, other);
6325
6326 if ([self status] == STATUS_DEAD) return;
6327 if ([self status] == STATUS_ESCAPE_SEQUENCE) return; // if the player has ejected, don't deal more damage
6328 if (amount == 0.0) return;
6329
6330 BOOL cascadeWeapon = [ent isCascadeWeapon];
6331 BOOL cascading = NO;
6332 if (cascadeWeapon)
6333 {
6334 cascading = [self cascadeIfAppropriateWithDamageAmount:amount cascadeOwner:[ent owner]];
6335 }
6336
6337 // make sure ent (& its position) is the attacking _ship_/missile !
6338 if (ent && [ent isSubEntity]) ent = [ent owner];
6339
6340 [[ent retain] autorelease];
6341 [[other retain] autorelease];
6342
6343 rel_pos = (ent != nil) ? [ent position] : kZeroHPVector;
6344 rel_pos = HPvector_subtract(rel_pos, position);
6345
6346 [self doScriptEvent:OOJSID("shipBeingAttacked") withArgument:ent];
6347 if ([ent isShip]) [(ShipEntity *)ent doScriptEvent:OOJSID("shipAttackedOther") withArgument:self];
6348
6349 d_forward = dot_product(HPVectorToVector(rel_pos), v_forward);
6350 d_right = dot_product(HPVectorToVector(rel_pos), v_right);
6351 d_up = dot_product(HPVectorToVector(rel_pos), v_up);
6352 Vector relative = make_vector(d_right,d_up,d_forward);
6353
6354 [self playShieldHit:relative weaponIdentifier:weaponIdentifier];
6355
6356 // firing on an innocent ship is an offence
6357 if ([other isShip])
6358 {
6359 [self broadcastHitByLaserFrom:(ShipEntity*) other];
6360 }
6361
6362 if (d_forward >= 0)
6363 {
6364 forward_shield -= amount;
6365 if (forward_shield < 0.0)
6366 {
6367 amount = -forward_shield;
6368 forward_shield = 0.0f;
6369 }
6370 else
6371 {
6372 amount = 0.0;
6373 }
6374 }
6375 else
6376 {
6377 aft_shield -= amount;
6378 if (aft_shield < 0.0)
6379 {
6380 amount = -aft_shield;
6381 aft_shield = 0.0f;
6382 }
6383 else
6384 {
6385 amount = 0.0;
6386 }
6387 }
6388
6389 OOShipDamageType damageType = cascadeWeapon ? kOODamageTypeCascadeWeapon : kOODamageTypeEnergy;
6390
6391 if (amount > 0.0)
6392 {
6393 energy -= amount;
6394 [self playDirectHit:relative weaponIdentifier:weaponIdentifier];
6396 {
6397 /* Heat increase from energy impacts will never directly cause
6398 * overheating - too easy for missile hits to cause an uncredited
6399 * death by overheating against NPCs, so same rules for player */
6402 {
6404 }
6405 }
6406 }
6407 [self noteTakingDamage:amount from:other type:damageType];
6408 if (cascading) energy = 0.0; // explicitly set energy to zero when cascading, in case an oxp raised the energy in noteTakingDamage.
6409
6410 if (energy <= 0.0) //use normal ship temperature calculations for heat damage
6411 {
6412 if ([other isShip])
6413 {
6414 [(ShipEntity *)other noteTargetDestroyed:self];
6415 }
6416
6417 [self getDestroyedBy:other damageType:damageType];
6418 }
6419 else
6420 {
6421 while (amount > 0.0)
6422 {
6423 internal_damage = ((ranrot_rand() & PLAYER_INTERNAL_DAMAGE_FACTOR) < amount); // base chance of damage to systems
6424 if (internal_damage)
6425 {
6426 [self takeInternalDamage];
6427 }
6428 amount -= (PLAYER_INTERNAL_DAMAGE_FACTOR + 1);
6429 }
6430 }
6431}
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:583

◆ takeHeatDamage:

- (void) takeHeatDamage: (double) amount
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

6500 :(double) amount
6501{
6502 if ([self status] == STATUS_DEAD || amount < 0) return;
6503
6504 // hit the shields first!
6505 float fwd_amount = (float)(0.5 * amount);
6506 float aft_amount = (float)(0.5 * amount);
6507
6508 forward_shield -= fwd_amount;
6509 if (forward_shield < 0.0)
6510 {
6511 fwd_amount = -forward_shield;
6512 forward_shield = 0.0f;
6513 }
6514 else
6515 {
6516 fwd_amount = 0.0f;
6517 }
6518
6519 aft_shield -= aft_amount;
6520 if (aft_shield < 0.0)
6521 {
6522 aft_amount = -aft_shield;
6523 aft_shield = 0.0f;
6524 }
6525 else
6526 {
6527 aft_amount = 0.0f;
6528 }
6529
6530 double residual_amount = fwd_amount + aft_amount;
6531
6532 [super takeHeatDamage:residual_amount];
6533}

◆ takeInternalDamage

- (BOOL) takeInternalDamage

Definition at line 13699 of file PlayerEntity.m.

6886{
6887 unsigned n_cargo = [self maxAvailableCargoSpace];
6888 unsigned n_mass = [self mass] / 10000;
6889 unsigned n_considered = (n_cargo + n_mass) * ship_trade_in_factor / 100; // a lower value of n_considered means more vulnerable to damage.
6890 unsigned damage_to = n_considered ? (ranrot_rand() % n_considered) : 0; // n_considered can be 0 for small ships.
6891 BOOL result = NO;
6892 // cargo damage
6893 if (damage_to < [cargo count])
6894 {
6895 ShipEntity* pod = (ShipEntity*)[cargo objectAtIndex:damage_to];
6896 NSString* cargo_desc = [UNIVERSE displayNameForCommodity:[pod commodityType]];
6897 if (!cargo_desc)
6898 return NO;
6899 [UNIVERSE clearPreviousMessage];
6900 [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-destroyed"), cargo_desc] forCount:4.5];
6901 [cargo removeObject:pod];
6902 return YES;
6903 }
6904 else
6905 {
6906 damage_to = n_considered - (damage_to + 1); // reverse the die-roll
6907 }
6908 // equipment damage
6909 NSEnumerator *eqEnum = [self equipmentEnumerator];
6910 OOEquipmentType *eqType = nil;
6911 NSString *system_key;
6912 unsigned damageableCounter = 0;
6913 GLfloat damageableOdds = 0.0;
6914 while ((system_key = [eqEnum nextObject]) != nil)
6915 {
6916 eqType = [OOEquipmentType equipmentTypeWithIdentifier:system_key];
6917 if ([eqType canBeDamaged])
6918 {
6919 damageableCounter++;
6920 damageableOdds += [eqType damageProbability];
6921 }
6922 }
6923
6924 if (damage_to < damageableCounter)
6925 {
6926 GLfloat target = randf() * damageableOdds;
6927 GLfloat accumulator = 0.0;
6928 eqEnum = [self equipmentEnumerator];
6929 while ((system_key = [eqEnum nextObject]) != nil)
6930 {
6931 eqType = [OOEquipmentType equipmentTypeWithIdentifier:system_key];
6932 accumulator += [eqType damageProbability];
6933 if (accumulator > target)
6934 {
6935 [system_key retain];
6936 break;
6937 }
6938 }
6939 if (system_key == nil)
6940 {
6941 [system_key release];
6942 return NO;
6943 }
6944
6945 NSString *system_name = [eqType name];
6946 if (![eqType canBeDamaged] || system_name == nil)
6947 {
6948 [system_key release];
6949 return NO;
6950 }
6951
6952 // set the following so removeEquipment works on the right entity
6953 [self setScriptTarget:self];
6954 [UNIVERSE clearPreviousMessage];
6955 [self removeEquipmentItem:system_key];
6956
6957 NSString *damagedKey = [NSString stringWithFormat:@"%@_DAMAGED", system_key];
6958 [self addEquipmentItem:damagedKey withValidation: NO inContext:@"damage"]; // for possible future repair.
6959 [self doScriptEvent:OOJSID("equipmentDamaged") withArgument:system_key];
6960
6961 if (![self hasEquipmentItem:system_name] && [self hasEquipmentItem:damagedKey])
6962 {
6963 /*
6964 Display "foo damaged" message only if no script has
6965 repaired or removed the equipment item. (If a script does
6966 either of those and wants a message, it can write it
6967 itself.)
6968 */
6969 [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-damaged"), system_name] forCount:4.5];
6970 }
6971
6972 /* There used to be a check for docking computers here, but
6973 * that didn't cover other ways they might fail in flight, so
6974 * it has been moved to the removeEquipment method. */
6975 [system_key release];
6976 return YES;
6977 }
6978 //cosmetic damage
6979 if (((damage_to & 7) == 7)&&(ship_trade_in_factor > 75))
6980 {
6982 result = YES;
6983 }
6984 return result;
6985}

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 13699 of file PlayerEntity.m.

6434 :(double) amount from:(Entity *) ent
6435{
6436 HPVector rel_pos;
6437 OOScalar d_forward, d_right, d_up;
6438 BOOL internal_damage = NO; // base chance
6439
6440 if ([self status] == STATUS_DEAD) return;
6441
6442 if (amount < 0)
6443 {
6444 OOLog(@"player.ship.damage", @"Player took negative scrape damage %.3f so we made it positive", amount);
6445 amount = -amount;
6446 }
6447 OOLog(@"player.ship.damage", @"Player took %.3f scrape damage from %@", amount, ent);
6448
6449 [[ent retain] autorelease];
6450 rel_pos = ent ? [ent position] : kZeroHPVector;
6451 rel_pos = HPvector_subtract(rel_pos, position);
6452 // rel_pos is now small
6453 d_forward = dot_product(HPVectorToVector(rel_pos), v_forward);
6454 d_right = dot_product(HPVectorToVector(rel_pos), v_right);
6455 d_up = dot_product(HPVectorToVector(rel_pos), v_up);
6456 Vector relative = make_vector(d_right,d_up,d_forward);
6457
6458 [self playScrapeDamage:relative];
6459 if (d_forward >= 0)
6460 {
6461 forward_shield -= amount;
6462 if (forward_shield < 0.0)
6463 {
6464 amount = -forward_shield;
6465 forward_shield = 0.0f;
6466 }
6467 else
6468 {
6469 amount = 0.0;
6470 }
6471 }
6472 else
6473 {
6474 aft_shield -= amount;
6475 if (aft_shield < 0.0)
6476 {
6477 amount = -aft_shield;
6478 aft_shield = 0.0f;
6479 }
6480 else
6481 {
6482 amount = 0.0;
6483 }
6484 }
6485
6486 [super takeScrapeDamage:amount from:ent];
6487
6488 while (amount > 0.0)
6489 {
6490 internal_damage = ((ranrot_rand() & PLAYER_INTERNAL_DAMAGE_FACTOR) < amount); // base chance of damage to systems
6491 if (internal_damage)
6492 {
6493 [self takeInternalDamage];
6494 }
6495 amount -= (PLAYER_INTERNAL_DAMAGE_FACTOR + 1);
6496 }
6497}

◆ targetInfoSystem

- (void) targetInfoSystem

Definition at line 13699 of file PlayerEntity.m.

868{
869 [self setInfoSystemID: target_system_id moveChart: YES];
870 return;
871}

◆ targetMemory

- (NSMutableArray *) targetMemory

Definition at line 9211 of file PlayerEntity.m.

12321{
12322 return target_memory;
12323}

◆ targetNearestHostile

- (void) targetNearestHostile

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2929{
2930 [self scanForHostiles];
2931 Entity *ent = [self foundTarget];
2932 if (ent != nil)
2933 {
2934 ident_engaged = YES;
2935 missile_status = MISSILE_STATUS_TARGET_LOCKED;
2936 [self addTarget:ent];
2937 }
2938}

◆ targetNearestIncomingMissile

- (void) targetNearestIncomingMissile

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2942{
2943 [self scanForNearestIncomingMissile];
2944 Entity *ent = [self foundTarget];
2945 if (ent != nil)
2946 {
2947 ident_engaged = YES;
2948 missile_status = MISSILE_STATUS_TARGET_LOCKED;
2949 [self addTarget:ent];
2950 }
2951}

◆ targetNewSystem:

- (void) targetNewSystem: (int) direction

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

827 :(int) direction
828{
829 [self targetNewSystem:direction whileTyping:NO];
830}

◆ targetNewSystem:whileTyping:

- (void) targetNewSystem: (int) direction
whileTyping: (BOOL) whileTyping 
implementation

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

804 :(int) direction whileTyping:(BOOL) whileTyping
805{
806 target_system_id = [[UNIVERSE gui] targetNextFoundSystem:direction];
807 [self setInfoSystemID: target_system_id moveChart: YES];
808 cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
809
810 found_system_id = target_system_id;
811 if (!whileTyping)
812 {
813 [self clearPlanetSearchString];
814 }
815 cursor_moving = YES;
816}

◆ targetSystemID

- (OOSystemID) targetSystemID

Definition at line 13699 of file PlayerEntity.m.

712{
713 return target_system_id;
714}

◆ testForEquipment:

- (void) testForEquipment: (NSString *) equipString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1445 :(NSString *)equipString //eg. EQ_NAVAL_ENERGY_UNIT
1446{
1447 found_equipment = [self hasEquipmentItem:equipString];
1448}

◆ 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 13699 of file PlayerEntity.m.

5675{
5676 // Make sure there's no gaps between missiles, synchronise missile_entity & missile_list.
5677 int i, pylon = 0;
5678 OOLog(@"missile.tidying.debug",@"Tidying fitted %d of possible %d missiles",missiles,PLAYER_MAX_MISSILES);
5679 for(i = 0; i < PLAYER_MAX_MISSILES; i++)
5680 {
5681 OOLog(@"missile.tidying.debug",@"%d %@ %@",i,missile_entity[i],missile_list[i]);
5682 if(missile_entity[i] != nil)
5683 {
5684 missile_entity[pylon] = missile_entity[i];
5685 missile_list[pylon] = [OOEquipmentType equipmentTypeWithIdentifier:[missile_entity[i] primaryRole]];
5686 pylon++;
5687 }
5688 }
5689
5690 // Now clean up the remainder of the pylons.
5691 for(i = pylon; i < PLAYER_MAX_MISSILES; i++)
5692 {
5693 missile_entity[i] = nil;
5694 // not strictly needed, but helps clear things up
5695 missile_list[i] = nil;
5696 }
5697}

◆ tradeInFactor

- (int) tradeInFactor

Definition at line 9211 of file PlayerEntity.m.

11884{
11885 return ship_trade_in_factor;
11886}

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 9211 of file PlayerEntity.m.

12175{
12177}

◆ trumbleArray

- (OOTrumble **) trumbleArray

Definition at line 9211 of file PlayerEntity.m.

12030{
12031 return trumble;
12032}

◆ trumbleCount

- (NSUInteger) trumbleCount

◆ trumbleValue

- (id) trumbleValue

Definition at line 9211 of file PlayerEntity.m.

12042{
12043 NSString *namekey = [NSString stringWithFormat:@"%@-humbletrash", [self commanderName]];
12044 int trumbleHash;
12045
12047 [self mungChecksumWithNSString:[self commanderName]];
12050 trumbleHash = munge_checksum(trumbleCount);
12051
12052 [[NSUserDefaults standardUserDefaults] setInteger:trumbleHash forKey:namekey];
12053
12054 int i;
12055 NSMutableArray *trumbleArray = [NSMutableArray arrayWithCapacity:PLAYER_MAX_TRUMBLES];
12056 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12057 {
12058 [trumbleArray addObject:[trumble[i] dictionary]];
12059 }
12060
12061 return [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInteger:trumbleCount], [NSNumber numberWithInt:trumbleHash], trumbleArray, nil];
12062}
OOTrumble ** trumbleArray()

◆ tryBuyingCommodity:all:

- (BOOL) tryBuyingCommodity: (OOCommodityType) type
all: (BOOL) all 

Definition at line 9211 of file PlayerEntity.m.

11330 :(OOCommodityType)index all:(BOOL)all
11331{
11332 if ([index isEqualToString:@"<<<"] || [index isEqualToString:@">>>"])
11333 {
11334 ++marketOffset;
11335 return NO;
11336 }
11337
11338 if (![self isDocked]) return NO; // can't buy if not docked.
11339
11340 OOCommodityMarket *localMarket = [self localMarket];
11341 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:index];
11342 OOMassUnit unit = [localMarket massUnitForGood:index];
11343
11344 if (specialCargo != nil && unit == UNITS_TONS)
11345 {
11346 return NO; // can't buy tons of stuff when carrying a specialCargo
11347 }
11348 int manifest_quantity = [shipCommodityData quantityForGood:index];
11349 int market_quantity = [localMarket quantityForGood:index];
11350
11351 int purchase = 1;
11352 if (all)
11353 {
11354 // if cargo contracts, put a break point on the contract volume
11355 int contracted = [self contractedVolumeForGood:index];
11356 if (manifest_quantity >= contracted)
11357 {
11358 purchase = [localMarket capacityForGood:index];
11359 }
11360 else
11361 {
11362 purchase = contracted-manifest_quantity;
11363 }
11364 }
11365 if (purchase > market_quantity)
11366 {
11367 purchase = market_quantity; // limit to what's available
11368 }
11369 if (purchase * pricePerUnit > credits)
11370 {
11371 purchase = floor (credits / pricePerUnit); // limit to what's affordable
11372 }
11373 // TODO - fix brokenness here...
11374 if (unit == UNITS_TONS && purchase + current_cargo > [self maxAvailableCargoSpace])
11375 {
11376 purchase = [self availableCargoSpace]; // limit to available cargo space
11377 }
11378 else
11379 {
11381 {
11382 // other cases are fine so long as buying is limited to <1000kg / <1000000g
11383 // but if this case is true, we need to see if there is more space in
11384 // the manifest (safe) or an already-accounted-for pod
11385 if (unit == UNITS_KILOGRAMS)
11386 {
11387 if (manifest_quantity % KILOGRAMS_PER_POD <= MAX_KILOGRAMS_IN_SAFE && (manifest_quantity + purchase) % KILOGRAMS_PER_POD > MAX_KILOGRAMS_IN_SAFE)
11388 {
11389 // going from < n500 to >= n500 would increase pods needed by 1
11390 purchase = MAX_KILOGRAMS_IN_SAFE - manifest_quantity; // max possible
11391 }
11392 }
11393 else // UNITS_GRAMS
11394 {
11395 if (manifest_quantity % GRAMS_PER_POD <= MAX_GRAMS_IN_SAFE && (manifest_quantity + purchase) % GRAMS_PER_POD > MAX_GRAMS_IN_SAFE)
11396 {
11397 // going from < n500000 to >= n500000 would increase pods needed by 1
11398 purchase = MAX_GRAMS_IN_SAFE - manifest_quantity; // max possible
11399 }
11400 }
11401 }
11402 }
11403 if (purchase <= 0)
11404 {
11405 return NO; // stop if that results in nothing to be bought
11406 }
11407
11408 [localMarket removeQuantity:purchase forGood:index];
11409 [shipCommodityData addQuantity:purchase forGood:index];
11410 credits -= pricePerUnit * purchase;
11411
11412 [self calculateCurrentCargo];
11413
11414 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11415
11416 [self doScriptEvent:OOJSID("playerBoughtCargo") withArguments:[NSArray arrayWithObjects:index, [NSNumber numberWithInt:purchase], [NSNumber numberWithUnsignedLongLong:pricePerUnit], nil]];
11417 if ([localMarket exportLegalityForGood:index] > 0)
11418 {
11419 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-illegal"];
11420 }
11421 else
11422 {
11423 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-legal"];
11424 }
11425
11426 return YES;
11427}
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 9211 of file PlayerEntity.m.

10305 :(NSString *)eqKey
10306{
10307 // note this doesn't check the availability by tech-level
10309 OOCreditsQuantity pricePerUnit = [eqType price];
10310 NSString *eqKeyDamaged = [eqType damagedIdentifier];
10311 double price = pricePerUnit;
10312 double priceFactor = 1.0;
10313 OOCreditsQuantity tradeIn = 0;
10314 BOOL isRepair = NO;
10315
10316 // repairs cost 50%
10317 if ([self hasEquipmentItem:eqKeyDamaged])
10318 {
10319 price /= 2.0;
10320 isRepair = YES;
10321 }
10322
10323 if ([eqKey isEqualToString:@"EQ_RENOVATION"])
10324 {
10325 price = [self renovationCosts];
10326 }
10327
10328 price = [self adjustPriceByScriptForEqKey:eqKey withCurrent:price];
10329
10330 StationEntity *dockedStation = [self dockedStation];
10331 if (dockedStation)
10332 {
10333 priceFactor = [dockedStation equipmentPriceFactor];
10334 }
10335
10336 price *= priceFactor; // increased prices at some stations
10337
10338 if (price > credits)
10339 {
10340 return NO;
10341 }
10342
10343 if ([eqType isPrimaryWeapon])
10344 {
10346 {
10347 [self setGuiToEquipShipScreen:0 selectingFacingFor:eqKey]; // reset
10348 return YES;
10349 }
10350
10352 OOWeaponType current_weapon = nil;
10353
10354 NSUInteger multiplier = 1;
10355
10356 switch (chosen_weapon_facing)
10357 {
10359 current_weapon = forward_weapon_type;
10360 forward_weapon_type = chosen_weapon;
10361 if (_multiplyWeapons)
10362 {
10363 multiplier = [forwardWeaponOffset count];
10364 }
10365 break;
10366
10367 case WEAPON_FACING_AFT:
10368 current_weapon = aft_weapon_type;
10369 aft_weapon_type = chosen_weapon;
10370 if (_multiplyWeapons)
10371 {
10372 multiplier = [aftWeaponOffset count];
10373 }
10374 break;
10375
10376 case WEAPON_FACING_PORT:
10377 current_weapon = port_weapon_type;
10378 port_weapon_type = chosen_weapon;
10379 if (_multiplyWeapons)
10380 {
10381 multiplier = [portWeaponOffset count];
10382 }
10383 break;
10384
10386 current_weapon = starboard_weapon_type;
10387 starboard_weapon_type = chosen_weapon;
10388 if (_multiplyWeapons)
10389 {
10390 multiplier = [starboardWeaponOffset count];
10391 }
10392 break;
10393
10394 case WEAPON_FACING_NONE:
10395 break;
10396 }
10397
10398 price *= multiplier;
10399
10400 if (price > credits)
10401 {
10402 // not enough money - ensure that weapon
10403 // type is reset to what it was before
10404 // the attempt to buy took place
10405 switch (chosen_weapon_facing)
10406 {
10408 forward_weapon_type = current_weapon;
10409 break;
10410 case WEAPON_FACING_AFT:
10411 aft_weapon_type = current_weapon;
10412 break;
10413 case WEAPON_FACING_PORT:
10414 port_weapon_type = current_weapon;
10415 break;
10417 starboard_weapon_type = current_weapon;
10418 break;
10419 case WEAPON_FACING_NONE:
10420 break;
10421 }
10422 return NO;
10423 }
10424 credits -= price;
10425
10426 // Refund current_weapon
10427 if (current_weapon != nil)
10428 {
10429 tradeIn = [UNIVERSE getEquipmentPriceForKey:OOEquipmentIdentifierFromWeaponType(current_weapon)] * multiplier;
10430 }
10431
10432 [self doTradeIn:tradeIn forPriceFactor:priceFactor];
10433 // If equipped, remove damaged weapon after repairs. -- But there's no way we should get a damaged weapon. Ever.
10434 [self removeEquipmentItem:eqKeyDamaged];
10435 return YES;
10436 }
10437
10438 if ([eqType isMissileOrMine] && missiles >= max_missiles)
10439 {
10440 OOLog(@"equip.buy.mounted.failed.full", @"%@", @"rejecting missile because already full");
10441 return NO;
10442 }
10443
10444 // NSFO!
10445 //unsigned passenger_space = [[OOEquipmentType equipmentTypeWithIdentifier:@"EQ_PASSENGER_BERTH"] requiredCargoSpace];
10446 //if (passenger_space == 0) passenger_space = PASSENGER_BERTH_SPACE;
10447
10448 if ([eqKey isEqualToString:@"EQ_PASSENGER_BERTH"] && [self availableCargoSpace] < PASSENGER_BERTH_SPACE)
10449 {
10450 return NO;
10451 }
10452
10453 if ([eqKey isEqualToString:@"EQ_FUEL"])
10454 {
10455#if MASS_DEPENDENT_FUEL_PRICES
10456 OOCreditsQuantity creditsForRefuel = ([self fuelCapacity] - [self fuel]) * pricePerUnit * [self fuelChargeRate];
10457#else
10458 OOCreditsQuantity creditsForRefuel = ([self fuelCapacity] - [self fuel]) * pricePerUnit;
10459#endif
10460 if (credits >= creditsForRefuel) // Ensure we don't overflow
10461 {
10462 credits -= creditsForRefuel;
10463 fuel = [self fuelCapacity];
10464 return YES;
10465 }
10466 else
10467 {
10468 return NO;
10469 }
10470 }
10471
10472 // check energy unit replacement
10473 if ([eqKey hasSuffix:@"ENERGY_UNIT"] && [self energyUnitType] != ENERGY_UNIT_NONE)
10474 {
10475 switch ([self energyUnitType])
10476 {
10477 case ENERGY_UNIT_NAVAL :
10478 [self removeEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"];
10479 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_NAVAL_ENERGY_UNIT"] / 2; // 50 % refund
10480 break;
10482 [self removeEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"];
10483 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_NAVAL_ENERGY_UNIT"] / 4; // half of the working one
10484 break;
10485 case ENERGY_UNIT_NORMAL :
10486 [self removeEquipmentItem:@"EQ_ENERGY_UNIT"];
10487 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_ENERGY_UNIT"] * 3 / 4; // 75 % refund
10488 break;
10490 [self removeEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"];
10491 tradeIn = [UNIVERSE getEquipmentPriceForKey:@"EQ_ENERGY_UNIT"] * 3 / 8; // half of the working one
10492 break;
10493
10494 default:
10495 break;
10496 }
10497 [self doTradeIn:tradeIn forPriceFactor:priceFactor];
10498 }
10499
10500 // maintain ship
10501 if ([eqKey isEqualToString:@"EQ_RENOVATION"])
10502 {
10503 OOTechLevelID techLevel = NSNotFound;
10504 if (dockedStation != nil) techLevel = [dockedStation equivalentTechLevel];
10505 if (techLevel == NSNotFound) techLevel = [[UNIVERSE currentSystemData] oo_unsignedIntForKey:KEY_TECHLEVEL];
10506
10507 credits -= price;
10508 ship_trade_in_factor += 5 + techLevel; // you get better value at high-tech repair bases
10510
10511 [self clearSubEntities];
10512 [self setUpSubEntities];
10513
10514 return YES;
10515 }
10516
10517 if ([eqKey hasSuffix:@"MISSILE"] || [eqKey hasSuffix:@"MINE"])
10518 {
10519 ShipEntity* weapon = [[UNIVERSE newShipWithRole:eqKey] autorelease];
10520 if (weapon) OOLog(kOOLogBuyMountedOK, @"Got ship for mounted weapon role %@", eqKey);
10521 else OOLog(kOOLogBuyMountedFailed, @"Could not find ship for mounted weapon role %@", eqKey);
10522
10523 BOOL mounted_okay = [self mountMissile:weapon];
10524 if (mounted_okay)
10525 {
10526 credits -= price;
10527 [self safeAllMissiles];
10528 [self tidyMissilePylons];
10529 [self setActiveMissile:0];
10530 }
10531 return mounted_okay;
10532 }
10533
10534 if ([eqKey isEqualToString:@"EQ_PASSENGER_BERTH"])
10535 {
10536 [self changePassengerBerths:+1];
10537 credits -= price;
10538 return YES;
10539 }
10540
10541 if ([eqKey isEqualToString:@"EQ_PASSENGER_BERTH_REMOVAL"])
10542 {
10543 [self changePassengerBerths:-1];
10544 credits -= price;
10545 return YES;
10546 }
10547
10548 if ([eqKey isEqualToString:@"EQ_MISSILE_REMOVAL"])
10549 {
10550 credits -= price;
10551 tradeIn += [self removeMissiles];
10552 [self doTradeIn:tradeIn forPriceFactor:priceFactor];
10553 return YES;
10554 }
10555
10556 if ([self canAddEquipment:eqKey inContext:@"purchase"])
10557 {
10558 credits -= price;
10559 [self addEquipmentItem:eqKey withValidation:NO inContext:@"purchase"]; // no need to validate twice.
10560 if (isRepair)
10561 {
10562 [self doScriptEvent:OOJSID("equipmentRepaired") withArgument:eqKey];
10563 }
10564 return YES;
10565 }
10566
10567 return NO;
10568}
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 9211 of file PlayerEntity.m.

11430 :(OOCommodityType)index all:(BOOL)all
11431{
11432 if ([index isEqualToString:@"<<<"] || [index isEqualToString:@">>>"])
11433 {
11434 --marketOffset;
11435 return NO;
11436 }
11437
11438 if (![self isDocked]) return NO; // can't sell if not docked.
11439
11440 OOCommodityMarket *localMarket = [self localMarket];
11441 int available_units = [shipCommodityData quantityForGood:index];
11442 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:index];
11443
11444 if (available_units == 0) return NO;
11445
11446 int market_quantity = [localMarket quantityForGood:index];
11447
11448 int capacity = [localMarket capacityForGood:index];
11449 int sell = 1;
11450 if (all)
11451 {
11452 // if cargo contracts, put a break point on the contract volume
11453 int contracted = [self contractedVolumeForGood:index];
11454 if (available_units <= contracted)
11455 {
11456 sell = capacity;
11457 }
11458 else
11459 {
11460 sell = available_units-contracted;
11461 }
11462 }
11463
11464 if (sell > available_units)
11465 sell = available_units; // limit to what's in the hold
11466 if (sell + market_quantity > capacity)
11467 sell = capacity - market_quantity; // avoid flooding the market
11468 if (sell <= 0)
11469 return NO; // stop if that results in nothing to be sold
11470
11471 [localMarket addQuantity:sell forGood:index];
11472 [shipCommodityData removeQuantity:sell forGood:index];
11473 credits += pricePerUnit * sell;
11474
11475 [self calculateCurrentCargo];
11476
11477 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11478
11479 [self doScriptEvent:OOJSID("playerSoldCargo") withArguments:[NSArray arrayWithObjects:index, [NSNumber numberWithInt:sell], [NSNumber numberWithUnsignedLongLong: pricePerUnit], nil]];
11480
11481 return YES;
11482}
BOOL addQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)

◆ unloadAllCargoPodsForType:toManifest:

- (void) unloadAllCargoPodsForType: (OOCommodityType) type
toManifest: (OOCommodityMarket *) manifest 

Definition at line 13699 of file PlayerEntity.m.

217 :(OOCommodityType)type toManifest:(OOCommodityMarket *) manifest
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];
227 if (commodityType == nil || [commodityType isEqualToString:type])
228 {
229 if ([commodityType isEqualToString:type])
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 13699 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 13699 of file PlayerEntity.m.

245 :(OOCommodityType)type amount:(OOCargoQuantity)quantity
246{
247 NSInteger i, n_cargo = [cargo count];
248 if (n_cargo == 0) return;
249
250 ShipEntity *cargoItem = nil;
251 OOCommodityType co_type;
252 OOCargoQuantity amount;
253 OOCargoQuantity cargoToGo = quantity;
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 [[customEquipActivation objectAtIndex:[self getCustomEquipIndex:key]] removeObjectForKey:custkey];
1671 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1672 }
1673 // reload settings
1674 [self initKeyConfigSettings];
1675}

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

2618 :(OOTimeDelta)delta_t
2619{
2621
2622 UPDATE_STAGE(@"updateMovementFlags");
2623 [self updateMovementFlags];
2624 UPDATE_STAGE(@"updateAlertCondition");
2625 [self updateAlertCondition];
2626 UPDATE_STAGE(@"updateFuelScoops:");
2627 [self updateFuelScoops:delta_t];
2628
2629 UPDATE_STAGE(@"updateClocks:");
2630 [self updateClocks:delta_t];
2631
2632 // scripting
2633 UPDATE_STAGE(@"updateTimers");
2635 UPDATE_STAGE(@"checkScriptsIfAppropriate");
2636 [self checkScriptsIfAppropriate];
2637
2638 // deal with collisions
2639 UPDATE_STAGE(@"manageCollisions");
2640 [self manageCollisions];
2641
2642 UPDATE_STAGE(@"pollControls:");
2643 [self pollControls:delta_t];
2644
2645 UPDATE_STAGE(@"updateTrumbles:");
2646 [self updateTrumbles:delta_t];
2647
2648 OOEntityStatus status = [self status];
2649 /* Validate that if the status is STATUS_START_GAME we're on one
2650 * of the few GUI screens which that makes sense for */
2651 if (EXPECT_NOT(status == STATUS_START_GAME &&
2652 gui_screen != GUI_SCREEN_INTRO1 &&
2653 gui_screen != GUI_SCREEN_SHIPLIBRARY &&
2654 gui_screen != GUI_SCREEN_GAMEOPTIONS &&
2655 gui_screen != GUI_SCREEN_STICKMAPPER &&
2656 gui_screen != GUI_SCREEN_STICKPROFILE &&
2657 gui_screen != GUI_SCREEN_NEWGAME &&
2658 gui_screen != GUI_SCREEN_OXZMANAGER &&
2659 gui_screen != GUI_SCREEN_LOAD &&
2660 gui_screen != GUI_SCREEN_KEYBOARD &&
2661 gui_screen != GUI_SCREEN_KEYBOARD_CONFIRMCLEAR &&
2662 gui_screen != GUI_SCREEN_KEYBOARD_CONFIG &&
2663 gui_screen != GUI_SCREEN_KEYBOARD_ENTRY &&
2664 gui_screen != GUI_SCREEN_KEYBOARD_LAYOUT))
2665 {
2666 // and if not, do a restart of the GUI
2667 UPDATE_STAGE(@"setGuiToIntroFirstGo:");
2668 [self setGuiToIntroFirstGo:YES]; //set up demo mode
2669 }
2670
2671 if (status == STATUS_AUTOPILOT_ENGAGED || status == STATUS_ESCAPE_SEQUENCE)
2672 {
2673 UPDATE_STAGE(@"performAutopilotUpdates:");
2674 [self performAutopilotUpdates:delta_t];
2675 }
2676 else if (![self isDocked])
2677 {
2678 UPDATE_STAGE(@"performInFlightUpdates:");
2679 [self performInFlightUpdates:delta_t];
2680 }
2681
2682 /* NOTE: status-contingent updates are not a switch since they can
2683 cascade when status changes.
2684 */
2685 if (status == STATUS_IN_FLIGHT)
2686 {
2687 UPDATE_STAGE(@"doBookkeeping:");
2688 [self doBookkeeping:delta_t];
2689 }
2690 if (status == STATUS_WITCHSPACE_COUNTDOWN)
2691 {
2692 UPDATE_STAGE(@"performWitchspaceCountdownUpdates:");
2693 [self performWitchspaceCountdownUpdates:delta_t];
2694 }
2695 if (status == STATUS_EXITING_WITCHSPACE)
2696 {
2697 UPDATE_STAGE(@"performWitchspaceExitUpdates:");
2698 [self performWitchspaceExitUpdates:delta_t];
2699 }
2700 if (status == STATUS_LAUNCHING)
2701 {
2702 UPDATE_STAGE(@"performLaunchingUpdates:");
2703 [self performLaunchingUpdates:delta_t];
2704 }
2705 if (status == STATUS_DOCKING)
2706 {
2707 UPDATE_STAGE(@"performDockingUpdates:");
2708 [self performDockingUpdates:delta_t];
2709 }
2710 if (status == STATUS_DEAD)
2711 {
2712 UPDATE_STAGE(@"performDeadUpdates:");
2713 [self performDeadUpdates:delta_t];
2714 }
2715
2716 UPDATE_STAGE(@"updateWormholes");
2717 [self updateWormholes];
2718
2720}

◆ 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 13699 of file PlayerEntity.m.

3399{
3400 [self updateAlertConditionForNearbyEntities];
3401 /* TODO: update alert condition once per frame. Tried this before, but
3402 there turned out to be complications. See mailing list archive.
3403 -- Ahruman 20070802
3404 */
3405 OOAlertCondition cond = [self alertCondition];
3406 OOTimeAbsolute t = [UNIVERSE getTime];
3407 if (cond != lastScriptAlertCondition)
3408 {
3409 ShipScriptEventNoCx(self, "alertConditionChanged", INT_TO_JSVAL(cond), INT_TO_JSVAL(lastScriptAlertCondition));
3411 }
3412 /* Update heuristic assessment of whether player is fleeing */
3414 {
3416 }
3418 {
3420 }
3422 {
3424 }
3425 else if (fleeing_status == PLAYER_FLEEING_MAYBE && last_shot_time + 10 > t)
3426 {
3428 }
3429 else if (fleeing_status == PLAYER_FLEEING_LIKELY && last_shot_time + 10 > t)
3430 {
3432 }
3434 {
3436 }
3438 {
3440 }
3441}
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 13699 of file PlayerEntity.m.

3188{
3189 if (![self isInSpace] || [self status] == STATUS_DOCKING)
3190 {
3191 [self clearAlertFlags];
3192 // not needed while docked
3193 return;
3194 }
3195
3196 int i, ent_count = UNIVERSE->n_entities;
3197 Entity **uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
3198 Entity *my_entities[ent_count];
3199 Entity *scannedEntity = nil;
3200 for (i = 0; i < ent_count; i++)
3201 {
3202 my_entities[i] = [uni_entities[i] retain]; // retained
3203 }
3204 BOOL massLocked = NO;
3205 BOOL foundHostiles = NO;
3206#if OO_VARIABLE_TORUS_SPEED
3207 BOOL needHyperspeedNearest = YES;
3208 double hsnDistance = 0;
3209#endif
3210 for (i = 0; i < ent_count; i++) // scanner lollypops
3211 {
3212 scannedEntity = my_entities[i];
3213
3214#if OO_VARIABLE_TORUS_SPEED
3215 if (EXPECT_NOT(needHyperspeedNearest))
3216 {
3217 // not visual effects, waypoints, ships, etc.
3218 if (scannedEntity != self && [scannedEntity canCollide] && (![scannedEntity isShip] || ![self collisionExceptedFor:(ShipEntity *) scannedEntity]))
3219 {
3220 hsnDistance = sqrt(scannedEntity->zero_distance)-[scannedEntity collisionRadius];
3221 needHyperspeedNearest = NO;
3222 }
3223 }
3224 else if ([scannedEntity isStellarObject])
3225 {
3226 // planets, stars might be closest surface even if not
3227 // closest centre. That could be true of others, but the
3228 // error is negligible there.
3229 double thisHSN = sqrt(scannedEntity->zero_distance)-[scannedEntity collisionRadius];
3230 if (thisHSN < hsnDistance)
3231 {
3232 hsnDistance = thisHSN;
3233 }
3234 }
3235#endif
3236
3237 if (scannedEntity->zero_distance < SCANNER_MAX_RANGE2 || !scannedEntity->isShip)
3238 {
3239 int theirClass = [scannedEntity scanClass];
3240 // here we could also force masslock for higher than yellow alert, but
3241 // if we are going to hand over masslock control to scripting, might as well
3242 // hand it over fully
3243 if ([self massLockable] /*|| alertFlags > ALERT_FLAG_YELLOW_LIMIT*/)
3244 {
3245 massLocked |= [self checkEntityForMassLock:scannedEntity withScanClass:theirClass]; // we just need one masslocker..
3246 }
3247 if (theirClass != CLASS_NO_DRAW)
3248 {
3249 if (theirClass == CLASS_THARGOID || [scannedEntity isCascadeWeapon])
3250 {
3251 foundHostiles = YES;
3252 }
3253 else if ([scannedEntity isShip])
3254 {
3255 ShipEntity *ship = (ShipEntity *)scannedEntity;
3256 foundHostiles |= (([ship hasHostileTarget])&&([ship primaryTarget] == self));
3257 }
3258 }
3259 }
3260 }
3261#if OO_VARIABLE_TORUS_SPEED
3262 if (EXPECT_NOT(needHyperspeedNearest))
3263 {
3264 // this case should only occur in an otherwise empty
3265 // interstellar space - unlikely but possible
3267 }
3268 else
3269 {
3270 // once nearest object is >4x scanner range
3271 // start increasing torus speed
3272 double factor = hsnDistance/(4*SCANNER_MAX_RANGE);
3273 if (factor < 1.0)
3274 {
3276 }
3277 else
3278 {
3279 hyperspeedFactor = MIN_HYPERSPEED_FACTOR * sqrt(factor);
3281 {
3282 // caps out at ~10^8m from nearest object
3283 // which takes ~10 minutes of flying
3285 }
3286 }
3287 }
3288#endif
3289
3290 [self setAlertFlag:ALERT_FLAG_MASS_LOCK to:massLocked];
3291
3292 [self setAlertFlag:ALERT_FLAG_HOSTILES to:foundHostiles];
3293
3294 for (i = 0; i < ent_count; i++)
3295 {
3296 [my_entities[i] release]; // released
3297 }
3298
3299 BOOL energyCritical = NO;
3300 if (energy < 64 && energy < maxEnergy * 0.8)
3301 {
3302 energyCritical = YES;
3303 }
3304 [self setAlertFlag:ALERT_FLAG_ENERGY to:energyCritical];
3305
3306 [self setAlertFlag:ALERT_FLAG_TEMP to:([self hullHeatLevel] > .90)];
3307
3308 [self setAlertFlag:ALERT_FLAG_ALT to:([self dialAltitude] < .10)];
3309
3310}
#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 13699 of file PlayerEntity.m.

3458 :(OOTimeDelta)delta_t
3459{
3460 // shot time updates are still needed here for STATUS_DEAD!
3461 shot_time += delta_t;
3462 script_time += delta_t;
3463 unsigned prev_day = floor(ship_clock / 86400);
3464 ship_clock += delta_t;
3465 if (ship_clock_adjust > 0.0) // adjust for coming out of warp (add LY * LY hrs)
3466 {
3467 double fine_adjust = delta_t * 7200.0;
3468 if (ship_clock_adjust > 86400) // more than a day
3469 fine_adjust = delta_t * 115200.0; // 16 times faster
3470 if (ship_clock_adjust > 0)
3471 {
3472 if (fine_adjust > ship_clock_adjust)
3473 fine_adjust = ship_clock_adjust;
3474 ship_clock += fine_adjust;
3475 ship_clock_adjust -= fine_adjust;
3476 }
3477 else
3478 {
3479 if (fine_adjust < ship_clock_adjust)
3480 fine_adjust = ship_clock_adjust;
3481 ship_clock -= fine_adjust;
3482 ship_clock_adjust += fine_adjust;
3483 }
3484 }
3485 else
3486 ship_clock_adjust = 0.0;
3487
3488 unsigned now_day = floor(ship_clock / 86400.0);
3489 while (prev_day < now_day)
3490 {
3491 prev_day++;
3492 [self doScriptEvent:OOJSID("dayChanged") withArgument:[NSNumber numberWithUnsignedInt:prev_day]];
3493 // not impossible that at ultra-low frame rates two of these will
3494 // happen in a single update.
3495 }
3496
3497 //fps
3499 {
3500 if (![self clockAdjusting])
3501 {
3502 fps_counter = (int)([UNIVERSE timeAccelerationFactor] * floor([UNIVERSE framesDoneThisUpdate] / (fps_check_time - last_fps_check_time)));
3505 }
3506 else
3507 {
3508 // Good approximation for when the clock is adjusting and proper fps calculation
3509 // cannot be performed.
3510 fps_counter = (int)([UNIVERSE timeAccelerationFactor] * floor(1.0 / delta_t));
3512 }
3513 [UNIVERSE resetFramesDoneThisUpdate]; // Reset frame counter
3514 }
3515}
double last_fps_check_time

◆ updateFuelScoops:

- (void) updateFuelScoops: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

3444 :(OOTimeDelta)delta_t
3445{
3446 if (scoopsActive)
3447 {
3448 [self updateFuelScoopSoundWithInterval:delta_t];
3449 if (![self scoopOverride])
3450 {
3451 scoopsActive = NO;
3452 [self updateFuelScoopSoundWithInterval:delta_t];
3453 }
3454 }
3455}

◆ 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
227 // What moved?
228 int function;
229 NSDictionary *entry = [stickFunctions objectAtIndex:selFunctionIdx];
230 if([hwDict oo_boolForKey:STICK_ISAXIS])
231 {
232 function=[entry oo_intForKey: KEY_AXISFN];
233 if (function == AXIS_THRUST)
234 {
235 [stickHandler unsetButtonFunction:BUTTON_INCTHRUST];
236 [stickHandler unsetButtonFunction:BUTTON_DECTHRUST];
237 }
238#if OO_FOV_INFLIGHT_CONTROL_ENABLED
239 if (function == AXIS_FIELD_OF_VIEW)
240 {
241 [stickHandler unsetButtonFunction:BUTTON_INC_FIELD_OF_VIEW];
242 [stickHandler unsetButtonFunction:BUTTON_DEC_FIELD_OF_VIEW];
243 }
244#endif
245 if (function == AXIS_VIEWX)
246 {
247 [stickHandler unsetButtonFunction:BUTTON_VIEWPORT];
248 [stickHandler unsetButtonFunction:BUTTON_VIEWSTARBOARD];
249 }
250 if (function == AXIS_VIEWY)
251 {
252 [stickHandler unsetButtonFunction:BUTTON_VIEWFORWARD];
253 [stickHandler unsetButtonFunction:BUTTON_VIEWAFT];
254 }
255 }
256 else
257 {
258 function = [entry oo_intForKey:KEY_BUTTONFN];
259 if (function == BUTTON_INCTHRUST || function == BUTTON_DECTHRUST)
260 {
261 [stickHandler unsetAxisFunction:AXIS_THRUST];
262 }
263#if OO_FOV_INFLIGHT_CONTROL_ENABLED
264 if (function == BUTTON_INC_FIELD_OF_VIEW || function == BUTTON_DEC_FIELD_OF_VIEW)
265 {
266 [stickHandler unsetAxisFunction:AXIS_FIELD_OF_VIEW];
267 }
268#endif
269 if (function == BUTTON_VIEWPORT || function == BUTTON_VIEWSTARBOARD)
270 {
271 [stickHandler unsetAxisFunction:AXIS_VIEWX];
272 }
273 if (function == BUTTON_VIEWFORWARD || function == BUTTON_VIEWAFT)
274 {
275 [stickHandler unsetAxisFunction:AXIS_VIEWY];
276 }
277 }
278 // special case for OXP equipment buttons
279 if (function >= 10000)
280 {
281 NSString *key = CUSTOMEQUIP_BUTTONACTIVATE;
282 function -= 10000;
283 if (function >= 10000)
284 {
285 function -= 10000;
287 }
288 [[customEquipActivation objectAtIndex:function] setObject:hwDict forKey:key];
289 [self checkCustomEquipButtons:hwDict ignore:function];
290
291 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
292 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
293 }
294 else
295 {
296 [stickHandler setFunction:function withDict:hwDict];
297 [self checkCustomEquipButtons:hwDict ignore:-1];
298 [stickHandler saveStickSettings];
299 }
300
301 // Update the GUI (this will refresh the function list).
302 unsigned skip;
303 if (selFunctionIdx < MAX_ROWS_FUNCTIONS - 1)
304 {
305 skip = 0;
306 }
307 else
308 {
309 skip = ((selFunctionIdx - 1) / (MAX_ROWS_FUNCTIONS - 2)) * (MAX_ROWS_FUNCTIONS - 2) + 1;
310 }
311
312 [self setGuiToStickMapperScreen:skip];
313}
@ 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 13699 of file PlayerEntity.m.

3179{
3180 hasMoved = !HPvector_equal(position, lastPosition);
3181 hasRotated = !quaternion_equal(orientation, lastOrientation);
3184}
unsigned hasMoved
Definition Entity.h:96
HPVector lastPosition
Definition Entity.h:133

◆ 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 13699 of file PlayerEntity.m.

5132{
5133 OOSystemID sys = [self currentSystemID];
5134 if (sys < 0)
5135 {
5136 return;
5137 }
5138 NSUInteger memory = 4;
5139 if (ship_kills >= 6400)
5140 {
5141 memory = 32;
5142 }
5143 else if (ship_kills >= 256)
5144 {
5145 memory = 16;
5146 }
5147 else if (ship_kills >= 64)
5148 {
5149 memory = 8;
5150 }
5151 if ([roleSystemList count] >= memory)
5152 {
5153 [roleSystemList removeObjectAtIndex:0];
5154 }
5155 [roleSystemList addObject:[NSNumber numberWithInt:sys]];
5156}

◆ updateTargeting

- (void) updateTargeting
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

4112{
4114
4115 // check for lost ident target and ensure the ident system is actually scanning
4116 UPDATE_STAGE(@"checking ident target");
4117 if (ident_engaged && [self primaryTarget] != nil)
4118 {
4119 if (![self isValidTarget:[self primaryTarget]])
4120 {
4121 if (!suppressTargetLost)
4122 {
4123 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4124 [self playTargetLost];
4125 [self noteLostTarget];
4126 }
4127 else
4128 {
4129 suppressTargetLost = NO;
4130 }
4131
4133 }
4134 }
4135
4136 // check each unlaunched missile's target still exists and is in-range
4137 UPDATE_STAGE(@"checking missile targets");
4139 {
4140 unsigned i;
4141 for (i = 0; i < max_missiles; i++)
4142 {
4143 if ([missile_entity[i] primaryTarget] != nil &&
4144 ![self isValidTarget:[missile_entity[i] primaryTarget]])
4145 {
4146 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4147 [self playTargetLost];
4148 [missile_entity[i] removeTarget:nil];
4149 if (i == activeMissile)
4150 {
4151 [self noteLostTarget];
4154 }
4155 } else if (i == activeMissile && [missile_entity[i] primaryTarget] == nil) {
4157 }
4158 }
4159 }
4160
4161 // if we don't have a primary target, and we're scanning, then check for a new
4162 // target to lock on to
4163 UPDATE_STAGE(@"looking for new target");
4164 if ([self primaryTarget] == nil &&
4166 ([self status] == STATUS_IN_FLIGHT || [self status] == STATUS_WITCHSPACE_COUNTDOWN))
4167 {
4168 Entity *target = [UNIVERSE firstEntityTargetedByPlayer];
4169 if ([self isValidTarget:target])
4170 {
4171 [self addTarget:target];
4172 }
4173 }
4174
4175 // If our primary target is a wormhole, check to see if we have additional
4176 // information
4177 UPDATE_STAGE(@"checking for additional wormhole information");
4178 if ([[self primaryTarget] isWormhole])
4179 {
4180 WormholeEntity *wh = [self primaryTarget];
4181 switch ([wh scanInfo])
4182 {
4183 case WH_SCANINFO_NONE:
4184 OOLog(kOOLogInconsistentState, @"%@", @"Internal Error - WH_SCANINFO_NONE reached in [PlayerEntity updateTargeting:]");
4185 [self dumpState];
4186 [wh dumpState];
4187 // Workaround a reported hit of the assert here. We really
4188 // should work out how/why this could happen though and fix
4189 // the underlying cause.
4190 // - MKW 2011.03.11
4191 //assert([wh scanInfo] != WH_SCANINFO_NONE);
4192 [wh setScannedAt:[self clockTimeAdjusted]];
4193 break;
4195 if ([self clockTimeAdjusted] > [wh scanTime] + 2)
4196 {
4197 [wh setScanInfo:WH_SCANINFO_COLLAPSE_TIME];
4198 //[UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-collapse-time-computed"),
4199 // [UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
4200 }
4201 break;
4203 if([self clockTimeAdjusted] > [wh scanTime] + 4)
4204 {
4205 [wh setScanInfo:WH_SCANINFO_ARRIVAL_TIME];
4206 [UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-arrival-time-computed-@"),
4207 ClockToString([wh estimatedArrivalTime], NO)] forCount:5.0];
4208 }
4209 break;
4211 if ([self clockTimeAdjusted] > [wh scanTime] + 7)
4212 {
4213 [wh setScanInfo:WH_SCANINFO_DESTINATION];
4214 [UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-destination-computed-@"),
4215 [UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
4216 }
4217 break;
4219 if ([self clockTimeAdjusted] > [wh scanTime] + 10)
4220 {
4221 [wh setScanInfo:WH_SCANINFO_SHIP];
4222 // TODO: Extract last ship from wormhole and display its name
4223 }
4224 break;
4225 case WH_SCANINFO_SHIP:
4226 break;
4227 }
4228 }
4229
4231}
@ 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:996
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 13699 of file PlayerEntity.m.

3571 :(OOTimeDelta)delta_t
3572{
3573 OOTrumble **trumbles = [self trumbleArray];
3574 NSUInteger i;
3575
3576 for (i = [self trumbleCount] ; i > 0; i--)
3577 {
3578 OOTrumble* trum = trumbles[i - 1];
3579 [trum updateTrumble:delta_t];
3580 }
3581}
void updateTrumble:(double delta_t)
Definition OOTrumble.m:494

◆ updateWormholes

- (void) updateWormholes
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9211 of file PlayerEntity.m.

13205{
13206 assert(scannedWormholes != nil);
13207
13208 if ([scannedWormholes count] == 0)
13209 return;
13210
13211 double now = [self clockTimeAdjusted];
13212
13213 NSMutableArray * savedWormholes = [[NSMutableArray alloc] initWithCapacity:[scannedWormholes count]];
13214 NSEnumerator * wormholes = [scannedWormholes objectEnumerator];
13215 WormholeEntity *wh;
13216
13217 while ((wh = (WormholeEntity*)[wormholes nextObject]))
13218 {
13219 // TODO: Start drawing wormhole exit a few seconds before the first
13220 // ship is disgorged.
13221 if ([wh arrivalTime] > now)
13222 {
13223 [savedWormholes addObject:wh];
13224 }
13225 else if (NSEqualPoints(galaxy_coordinates, [wh destinationCoordinates]))
13226 {
13227 [wh disgorgeShips];
13228 if ([[wh shipsInTransit] count] > 0)
13229 {
13230 [savedWormholes addObject:wh];
13231 }
13232 }
13233 // Else wormhole has expired in another system, let it expire
13234 }
13235
13236 [scannedWormholes release];
13237 scannedWormholes = savedWormholes;
13238}

◆ useSpecialCargo:

- (void) useSpecialCargo: (NSString *) descriptionString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1435 :(NSString *)descriptionString
1436{
1437 if (scriptTarget != self) return;
1438
1439 [self removeAllCargo:YES];
1440 OOLog(kOOLogNoteUseSpecialCargo, @"Going to useSpecialCargo:'%@'", descriptionString);
1441 specialCargo = [OOExpand(descriptionString) retain];
1442}
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 13699 of file PlayerEntity.m.

5179{
5180 OOSunEntity *the_sun = [UNIVERSE sun];
5181 OOPlanetEntity *the_planet = [UNIVERSE planet];
5182 StationEntity *the_station = [UNIVERSE station];
5183 Entity *the_target = [self primaryTarget];
5184 Entity <OOBeaconEntity> *beacon = [self nextBeacon];
5185 if ([self isInSpace] && the_sun && the_planet // be in a system
5186 && ![the_sun goneNova]) // and the system has not been novabombed
5187 {
5188 Entity *new_target = nil;
5189 OOAegisStatus aegis = [self checkForAegis];
5190
5191 switch ([self compassMode])
5192 {
5193 case COMPASS_MODE_INACTIVE:
5194 break;
5195
5196 case COMPASS_MODE_BASIC:
5197 if ((aegis == AEGIS_CLOSE_TO_MAIN_PLANET || aegis == AEGIS_IN_DOCKING_RANGE) && the_station)
5198 {
5199 new_target = the_station;
5200 }
5201 else
5202 {
5203 new_target = the_planet;
5204 }
5205 break;
5206
5207 case COMPASS_MODE_PLANET:
5208 new_target = the_planet;
5209 break;
5210
5211 case COMPASS_MODE_STATION:
5212 new_target = the_station;
5213 break;
5214
5215 case COMPASS_MODE_SUN:
5216 new_target = the_sun;
5217 break;
5218
5219 case COMPASS_MODE_TARGET:
5220 new_target = the_target;
5221 break;
5222
5223 case COMPASS_MODE_BEACONS:
5224 new_target = beacon;
5225 break;
5226 }
5227
5228 if (new_target == nil || [new_target status] < STATUS_ACTIVE || [new_target status] == STATUS_IN_HOLD)
5229 {
5230 [self setCompassMode:COMPASS_MODE_PLANET];
5231 new_target = the_planet;
5232 }
5233
5234 if (EXPECT_NOT(new_target != [self compassTarget]))
5235 {
5236 [self setCompassTarget:new_target];
5237 [self doScriptEvent:OOJSID("compassTargetChanged") withArguments:[NSArray arrayWithObjects:new_target, OOStringFromCompassMode([self compassMode]), nil]];
5238 }
5239 }
5240}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ validateCustomEquipActivationArray

- (void) validateCustomEquipActivationArray

Definition at line 9211 of file PlayerEntity.m.

11602{
11603 int i;
11604 bool update = NO;
11605 NSString *equipmentKey;
11606 if ([customEquipActivation count] == 0) return;
11607 for (i = [customEquipActivation count] - 1; i >= 0; i--) {
11608 equipmentKey = [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY];
11610 if (!eq) {
11611 [customEquipActivation removeObjectAtIndex:i];
11612 [customActivatePressed removeObjectAtIndex:i];
11613 [customModePressed removeObjectAtIndex:i];
11614 update = YES;
11615 }
11616 }
11617 if (update) {
11618 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
11619 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
11620 }
11621}

◆ 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 13699 of file PlayerEntity.m.

2498{
2499 return YES;
2500}

◆ viewpointOffset

- (Vector) viewpointOffset

Definition at line 13699 of file PlayerEntity.m.

4334{
4335// if ([UNIVERSE breakPatternHide])
4336// return kZeroVector; // center view for break pattern
4337 // now done by positioning break pattern correctly
4338
4339 switch ([UNIVERSE viewDirection])
4340 {
4341 case VIEW_FORWARD:
4342 return forwardViewOffset;
4343 case VIEW_AFT:
4344 return aftViewOffset;
4345 case VIEW_PORT:
4346 return portViewOffset;
4347 case VIEW_STARBOARD:
4348 return starboardViewOffset;
4349 /* GILES custom viewpoints */
4350 case VIEW_CUSTOM:
4351 return customViewOffset;
4352 /* -- */
4353
4354 default:
4355 break;
4356 }
4357
4358 return kZeroVector;
4359}

◆ viewpointOffsetAft

- (Vector) viewpointOffsetAft

Definition at line 13699 of file PlayerEntity.m.

4363{
4364 return aftViewOffset;
4365}

◆ viewpointOffsetForward

- (Vector) viewpointOffsetForward

Definition at line 13699 of file PlayerEntity.m.

4368{
4369 return forwardViewOffset;
4370}

◆ viewpointOffsetPort

- (Vector) viewpointOffsetPort

Definition at line 13699 of file PlayerEntity.m.

4373{
4374 return portViewOffset;
4375}

◆ viewpointOffsetStarboard

- (Vector) viewpointOffsetStarboard

Definition at line 13699 of file PlayerEntity.m.

4378{
4379 return starboardViewOffset;
4380}

◆ viewpointPosition

- (HPVector) viewpointPosition

Definition at line 13699 of file PlayerEntity.m.

4386{
4387 HPVector viewpoint = position;
4388 if (showDemoShips)
4389 {
4390 viewpoint = kZeroHPVector;
4391 }
4392 Vector offset = [self viewpointOffset];
4393
4394 // FIXME: this ought to be done with matrix or quaternion functions.
4395 OOMatrix r = rotMatrix;
4396
4397 viewpoint.x += offset.x * r.m[0][0]; viewpoint.y += offset.x * r.m[1][0]; viewpoint.z += offset.x * r.m[2][0];
4398 viewpoint.x += offset.y * r.m[0][1]; viewpoint.y += offset.y * r.m[1][1]; viewpoint.z += offset.y * r.m[2][1];
4399 viewpoint.x += offset.z * r.m[0][2]; viewpoint.y += offset.z * r.m[1][2]; viewpoint.z += offset.z * r.m[2][2];
4400
4401 return viewpoint;
4402}

◆ warnAboutHostiles

- (void) warnAboutHostiles

Reimplemented from Entity.

Definition at line 13699 of file PlayerEntity.m.

2469{
2470 [self playHostileWarning];
2471}

◆ weaponForFacing:

- (OOWeaponType) weaponForFacing: (OOWeaponFacing) facing

Definition at line 13699 of file PlayerEntity.m.

6238 :(OOWeaponFacing)facing
6239{
6240 switch (facing)
6241 {
6243 return forward_weapon_type;
6244
6245 case WEAPON_FACING_AFT:
6246 return aft_weapon_type;
6247
6248 case WEAPON_FACING_PORT:
6249 return port_weapon_type;
6250
6252 return starboard_weapon_type;
6253
6254 case WEAPON_FACING_NONE:
6255 break;
6256 }
6257 return nil;
6258}

◆ weaponsOnline

- (BOOL) weaponsOnline

Definition at line 13699 of file PlayerEntity.m.

6131{
6132 return weapons_online;
6133}

◆ weaponTypeForFacing:strict:

- (OOEquipmentType *) weaponTypeForFacing: (OOWeaponFacing) facing
strict: (BOOL) strict 
implementation

Reimplemented from ShipEntity.

Definition at line 13699 of file PlayerEntity.m.

8273 :(OOWeaponFacing)facing strict:(BOOL)strict
8274{
8275 OOWeaponType weaponType = nil;
8276
8277 switch (facing)
8278 {
8280 weaponType = forward_weapon_type;
8281 break;
8282
8283 case WEAPON_FACING_AFT:
8284 weaponType = aft_weapon_type;
8285 break;
8286
8287 case WEAPON_FACING_PORT:
8288 weaponType = port_weapon_type;
8289 break;
8290
8292 weaponType = starboard_weapon_type;
8293 break;
8294
8295 case WEAPON_FACING_NONE:
8296 break;
8297 }
8298
8299 return weaponType;
8300}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ weaponViewOffset

- (Vector) weaponViewOffset

Definition at line 9211 of file PlayerEntity.m.

11937{
11938 switch (currentWeaponFacing)
11939 {
11941 return forwardViewOffset;
11942 case WEAPON_FACING_AFT:
11943 return aftViewOffset;
11944 case WEAPON_FACING_PORT:
11945 return portViewOffset;
11947 return starboardViewOffset;
11948
11949 case WEAPON_FACING_NONE:
11950 // N.b.: this case should never happen.
11951 return customViewOffset;
11952 }
11953 return kZeroVector;
11954}

◆ witchEnd

- (void) witchEnd
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

7355{
7356 [UNIVERSE setSystemTo:system_id];
7357 galaxy_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:system_id inGalaxy:galaxy_number];
7358
7359 [UNIVERSE setUpUniverseFromWitchspace];
7360 [[UNIVERSE planet] update: 2.34375 * market_rnd]; // from 0..10 minutes
7361 [[UNIVERSE station] update: 2.34375 * market_rnd]; // from 0..10 minutes
7362
7365}

◆ witchJumpChecklist:

- (BOOL) witchJumpChecklist: (BOOL) isGalacticJump

Definition at line 13699 of file PlayerEntity.m.

7368 :(BOOL)isGalacticJump
7369{
7370 // Perform this check only when doing the actual jump
7371 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7372 {
7373 // check nearby masses
7374 //UPDATE_STAGE(@"checking for mass blockage");
7375 ShipEntity* blocker = [UNIVERSE entityForUniversalID:[self checkShipsInVicinityForWitchJumpExit]];
7376 if (blocker)
7377 {
7378 [UNIVERSE clearPreviousMessage];
7379 NSString *blockerName = [blocker name];
7380 [UNIVERSE addMessage:OOExpandKey(@"witch-blocked", blockerName) forCount:4.5];
7381 [self playWitchjumpBlocked];
7382 [self setStatus:STATUS_IN_FLIGHT];
7383 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("blocked"));
7384 return NO;
7385 }
7386 }
7387
7388 // For galactic hyperspace jumps we skip the remaining checks
7389 if (isGalacticJump)
7390 {
7391 return YES;
7392 }
7393
7394 // Check we're not jumping into the current system
7395 if (![UNIVERSE inInterstellarSpace] && system_id == target_system_id)
7396 {
7397 //dont allow player to hyperspace to current location.
7398 //Note interstellar space will have a system_seed place we came from
7399 [UNIVERSE clearPreviousMessage];
7400 [UNIVERSE addMessage:OOExpandKey(@"witch-no-target") forCount: 4.5];
7401 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7402 {
7403 [self playWitchjumpInsufficientFuel];
7404 [self setStatus:STATUS_IN_FLIGHT];
7405 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("no target"));
7406 }
7407 else [self playHyperspaceNoTarget];
7408
7409 return NO;
7410 }
7411
7412 // check max distance permitted
7414 {
7415 [UNIVERSE clearPreviousMessage];
7416 [UNIVERSE addMessage:DESC(@"witch-too-far") forCount: 4.5];
7417 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7418 {
7419 [self playWitchjumpDistanceTooGreat];
7420 [self setStatus:STATUS_IN_FLIGHT];
7421 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("too far"));
7422 }
7423 else [self playHyperspaceDistanceTooGreat];
7424
7425 return NO;
7426 }
7427
7428 // check fuel level
7429 if (![self hasSufficientFuelForJump])
7430 {
7431 [UNIVERSE clearPreviousMessage];
7432 [UNIVERSE addMessage:DESC(@"witch-no-fuel") forCount: 4.5];
7433 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7434 {
7435 [self playWitchjumpInsufficientFuel];
7436 [self setStatus:STATUS_IN_FLIGHT];
7437 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("insufficient fuel"));
7438 }
7439 else [self playHyperspaceNoFuel];
7440
7441 return NO;
7442 }
7443
7444 // All checks passed
7445 return YES;
7446}
BOOL hasSufficientFuelForJump()
double maxHyperspaceDistance()

◆ witchJumpTo:misjump:

- (void) witchJumpTo: (OOSystemID) sTo
misjump: (BOOL) misjump 
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

7736 :(OOSystemID)sTo misjump:(BOOL)misjump
7737{
7738 [self witchStart];
7740 {
7741 [self setInfoSystemID: sTo moveChart: YES];
7742 }
7743 //wear and tear on all jumps (inc misjumps, failures, and wormholes)
7745 {
7746 // every eight jumps or so drop the price down towards 75%
7747 [self adjustTradeInFactorBy:-(1 + (market_rnd & 3))];
7748 }
7749
7750 // set clock after "playerWillEnterWitchspace" and before removeAllEntitiesExceptPlayer, to allow escorts time to follow their mother.
7751 NSPoint destCoords = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:sTo inGalaxy:galaxy_number]);
7752 double distance = distanceBetweenPlanetPositions(destCoords.x,destCoords.y,galaxy_coordinates.x,galaxy_coordinates.y);
7753
7754 // if we just escaped a system gone nova, make sure all nova parameters are reset
7755 OOSunEntity *theSun = [UNIVERSE sun];
7756 if (theSun && [theSun goneNova])
7757 {
7758 [theSun resetNova];
7759 }
7760
7761 [UNIVERSE removeAllEntitiesExceptPlayer];
7762 if (!misjump)
7763 {
7764 ship_clock_adjust += distance * distance * 3600.0;
7765 [self setSystemID:sTo];
7766 [self setBounty:(legalStatus/2) withReason:kOOLegalStatusReasonNewSystem]; // 'another day, another system'
7767 [self witchEnd];
7768 if (market_rnd < 8) [self erodeReputation]; // every 32 systems or so, drop back towards 'unknown'
7769 }
7770 else
7771 {
7772 // Misjump: move halfway there!
7773 // misjumps do not change legal status.
7774 if (randf() < 0.1) [self erodeReputation]; // once every 10 misjumps - should be much rarer than successful jumps!
7775
7776 [wormhole setMisjump];
7777 // just in case, but this has usually been set already
7778
7779 // and now the wormhole has travel time and coordinates calculated
7780 // so rather than duplicate the calculation we'll just ask it...
7781 NSPoint dest = [wormhole destinationCoordinates];
7782 galaxy_coordinates.x = dest.x;
7783 galaxy_coordinates.y = dest.y;
7784
7785 ship_clock_adjust += [wormhole travelTime];
7786
7787 [self playWitchjumpMisjump];
7788 [UNIVERSE setUpUniverseFromMisjump];
7789 }
7790}

◆ witchStart

- (void) witchStart
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13699 of file PlayerEntity.m.

7310{
7311 // chances of entering witchspace with autopilot on are very low, but as Berlios bug #18307 has shown us, entirely possible
7312 // so in such cases we need to ensure that at least the docking music stops playing
7313 if (autopilot_engaged) [self disengageAutopilot];
7314
7315 if (![hud nonlinearScanner])
7316 {
7317 [hud setScannerZoom: 1.0];
7318 }
7319 [self safeAllMissiles];
7320
7321 OOViewID previousViewDirection = [UNIVERSE viewDirection];
7322 [UNIVERSE setViewDirection:VIEW_FORWARD];
7323 [self noteSwitchToView:VIEW_FORWARD fromView:previousViewDirection]; // notifies scripts of the switch
7324
7326 [self currentWeaponStats];
7327
7328 [self transitionToAegisNone];
7330 hyperspeed_engaged = NO;
7331
7332 if ([self primaryTarget] != nil)
7333 {
7334 [self noteLostTarget]; // losing target? Fire lost target event!
7336 }
7337
7338 scanner_zoom_rate = 0.0f;
7339 [UNIVERSE setDisplayText:NO];
7340
7341 if ( ![self wormhole] && !galactic_witchjump) // galactic hyperspace does not generate a wormhole
7342 {
7343 OOLog(kOOLogInconsistentState, @"%@", @"Internal Error : Player entering witchspace with no wormhole.");
7344 }
7345 [UNIVERSE allShipsDoScriptEvent:OOJSID("playerWillEnterWitchspace") andReactToAIMessage:@"PLAYER WITCHSPACE"];
7346
7347 // set the new market seed now!
7348 // reseeding the RNG should be completely unnecessary here
7349// ranrot_srand((uint32_t)[[NSDate date] timeIntervalSince1970]); // seed randomiser by time
7350 market_rnd = ranrot_rand() & 255; // random factor for market values is reset
7351}

◆ worldScriptNames

- (NSArray *) worldScriptNames

Definition at line 9211 of file PlayerEntity.m.

12849{
12850 return [worldScripts allKeys];
12851}

◆ worldScriptsByName

- (NSDictionary *) worldScriptsByName

Definition at line 9211 of file PlayerEntity.m.

12855{
12856 return [[worldScripts copy] autorelease];
12857}

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 1412 of file PlayerEntityLoadSave.m.

861 :(NSString *)path
862{
863 NSString *errDesc = nil;
864 NSDictionary *dict = nil;
865 BOOL didSave = NO;
866 [[UNIVERSE gameView] resetTypedString];
867
868 if (!path)
869 {
870 OOLog(@"save.failed", @"***** SAVE ERROR: %s called with nil path.", __PRETTY_FUNCTION__);
871 return;
872 }
873
874 dict = [self commanderDataDictionary];
875 if (dict == nil) errDesc = @"could not construct commander data dictionary.";
876 else didSave = [dict writeOOXMLToFile:path atomically:YES errorDescription:&errDesc];
877 if (didSave)
878 {
879 [UNIVERSE clearPreviousMessage]; // allow this to be given time and again
880 [UNIVERSE addMessage:DESC(@"game-saved") forCount:2];
881 [save_path autorelease];
882 save_path = [path copy];
883 [[UNIVERSE gameController] setPlayerFileToLoad:save_path];
884 [[UNIVERSE gameController] setPlayerFileDirectory:save_path];
885 // no duplicated autosave immediately after a save.
886 [UNIVERSE setAutoSaveNow:NO];
887 }
888 else
889 {
890 OOLog(@"save.failed", @"***** SAVE ERROR: %@", errDesc);
891 [NSException raise:@"OoliteException"
892 format:@"Attempt to save game to file '%@' failed: %@", path, errDesc];
893 }
894 [[UNIVERSE gameView] suppressKeysUntilKeyUp];
895 [self setGuiToStatusScreen];
896}

Member Data Documentation

◆ _commanderName

- (NSString*) _commanderName
private

Definition at line 517 of file PlayerEntity.h.

◆ _customViewIndex

- (NSUInteger) _customViewIndex
private

Definition at line 801 of file PlayerEntity.h.

◆ _customViews

- (NSArray*) _customViews
private

Definition at line 800 of file PlayerEntity.h.

◆ _dockedStation

- (OOWeakReference*) _dockedStation
private

Definition at line 460 of file PlayerEntity.h.

◆ _dockTarget

- (OOUniversalID) _dockTarget
private

Definition at line 527 of file PlayerEntity.h.

◆ _equipScreenBackgroundDescriptor

- (NSDictionary*) _equipScreenBackgroundDescriptor
private

Definition at line 403 of file PlayerEntity.h.

◆ _fastEquipmentA

- (NSString*) _fastEquipmentA
private

Definition at line 493 of file PlayerEntity.h.

◆ _fastEquipmentB

- (NSString*) _fastEquipmentB
private

Definition at line 494 of file PlayerEntity.h.

◆ _jumpCause

- (NSString*) _jumpCause
private

Definition at line 514 of file PlayerEntity.h.

◆ _lastsaveName

- (NSString*) _lastsaveName
private

Definition at line 518 of file PlayerEntity.h.

◆ _missionAllowInterrupt

- (BOOL) _missionAllowInterrupt
private

Definition at line 390 of file PlayerEntity.h.

◆ _missionBackgroundDescriptor

- (NSDictionary*) _missionBackgroundDescriptor
private

Definition at line 401 of file PlayerEntity.h.

◆ _missionBackgroundSpecial

- (OOGUIBackgroundSpecial) _missionBackgroundSpecial
private

Definition at line 402 of file PlayerEntity.h.

◆ _missionExitScreen

- (OOGUIScreenID) _missionExitScreen
private

Definition at line 392 of file PlayerEntity.h.

◆ _missionOverlayDescriptor

- (NSDictionary*) _missionOverlayDescriptor
private

Definition at line 400 of file PlayerEntity.h.

◆ _missionScreenID

- (NSString*) _missionScreenID
private

Definition at line 404 of file PlayerEntity.h.

◆ _missionTextEntry

- (BOOL) _missionTextEntry
private

Definition at line 391 of file PlayerEntity.h.

◆ _missionTitle

- (NSString*) _missionTitle
private

Definition at line 385 of file PlayerEntity.h.

◆ _missionWithCallback

- (BOOL) _missionWithCallback
private

Definition at line 389 of file PlayerEntity.h.

◆ _sysInfoLight

- (Vector) _sysInfoLight
private

Definition at line 711 of file PlayerEntity.h.

◆ _trumbleAppetiteAccumulator

- (float) _trumbleAppetiteAccumulator
private

Definition at line 716 of file PlayerEntity.h.

◆ activeMFD

- (NSUInteger) activeMFD
private

Definition at line 470 of file PlayerEntity.h.

◆ activeMissile

- (NSUInteger) activeMissile
private

Definition at line 491 of file PlayerEntity.h.

◆ aft_shield

- (GLfloat) aft_shield
private

Definition at line 476 of file PlayerEntity.h.

◆ aft_shield_recharge_rate

- (GLfloat) aft_shield_recharge_rate
private

Definition at line 477 of file PlayerEntity.h.

◆ aft_shot_time

- (OOTimeDelta) aft_shot_time
private

Definition at line 478 of file PlayerEntity.h.

◆ afterburner_engaged

- (unsigned) afterburner_engaged
private

Definition at line 746 of file PlayerEntity.h.

◆ afterburnerSoundLooping

- (unsigned) afterburnerSoundLooping
private

Definition at line 747 of file PlayerEntity.h.

◆ aftViewOffset

- (Vector) aftViewOffset
private

Definition at line 710 of file PlayerEntity.h.

◆ alertCondition

- (OOAlertCondition) alertCondition
private

Definition at line 487 of file PlayerEntity.h.

◆ alertFlags

- (int) alertFlags
private

Definition at line 486 of file PlayerEntity.h.

◆ ANA_mode

- (OORouteType) ANA_mode
private

Definition at line 511 of file PlayerEntity.h.

◆ autopilot_engaged

- (unsigned) autopilot_engaged
private

Definition at line 744 of file PlayerEntity.h.

◆ bomb_detonated

- (unsigned) bomb_detonated
private

Definition at line 743 of file PlayerEntity.h.

◆ cdrDetailArray

- (NSMutableArray*) cdrDetailArray
private

Definition at line 450 of file PlayerEntity.h.

◆ chart_centre_coordinates

- (NSPoint) chart_centre_coordinates
private

Definition at line 500 of file PlayerEntity.h.

◆ chart_focus_coordinates

- (NSPoint) chart_focus_coordinates
private

Definition at line 499 of file PlayerEntity.h.

◆ chart_zoom

- (OOScalar) chart_zoom
private

Definition at line 507 of file PlayerEntity.h.

◆ chosen_weapon_facing

- (OOWeaponFacing) chosen_weapon_facing
private

Definition at line 480 of file PlayerEntity.h.

◆ commanderNameString

- (NSString*) commanderNameString
private

Definition at line 449 of file PlayerEntity.h.

◆ commLog

- (NSMutableArray *) commLog
private

Definition at line 396 of file PlayerEntity.h.

◆ commodityScripts

- (NSMutableDictionary*) commodityScripts
private

Definition at line 382 of file PlayerEntity.h.

◆ compassMode

- (OOCompassMode) compassMode
private

Definition at line 533 of file PlayerEntity.h.

Referenced by PlayerShipGetProperty().

◆ compassTarget

- (Entity *) compassTarget
private

Definition at line 534 of file PlayerEntity.h.

Referenced by PlayerShipGetProperty(), and PlayerShipSetProperty().

◆ contract_record

- (NSMutableDictionary*) contract_record
private

Definition at line 418 of file PlayerEntity.h.

◆ contracts

- (NSMutableArray*) contracts
private

Definition at line 417 of file PlayerEntity.h.

◆ credits

- (OOCreditsQuantity) credits
private

Definition at line 521 of file PlayerEntity.h.

◆ current_cargo

- (OOCargoQuantity) current_cargo
private

Definition at line 496 of file PlayerEntity.h.

◆ currentPage

- (int) currentPage
private

Definition at line 451 of file PlayerEntity.h.

◆ cursor_coordinates

- (NSPoint) cursor_coordinates
private

Definition at line 498 of file PlayerEntity.h.

◆ custom_chart_centre_coordinates

- (NSPoint) custom_chart_centre_coordinates
private

Definition at line 501 of file PlayerEntity.h.

◆ custom_chart_zoom

- (OOScalar) custom_chart_zoom
private

Definition at line 508 of file PlayerEntity.h.

◆ customActivatePressed

- (NSMutableArray*) customActivatePressed
private

Definition at line 697 of file PlayerEntity.h.

◆ customDialSettings

- (NSMutableDictionary*) customDialSettings
private

Definition at line 471 of file PlayerEntity.h.

◆ customEquipActivation

- (NSMutableArray*) customEquipActivation
private

Definition at line 696 of file PlayerEntity.h.

◆ customModePressed

- (NSMutableArray*) customModePressed
private

Definition at line 698 of file PlayerEntity.h.

◆ customViewDescription

- (NSString *) customViewDescription
private

Definition at line 730 of file PlayerEntity.h.

◆ customViewForwardVector

- (Vector) customViewForwardVector
private

Definition at line 729 of file PlayerEntity.h.

Referenced by HeadUpDisplay::hudRotateViewpointForVirtualDepth.

◆ customViewMatrix

- (OOMatrix) customViewMatrix
private

Definition at line 728 of file PlayerEntity.h.

◆ customViewOffset

- (Vector) customViewOffset
private

Definition at line 729 of file PlayerEntity.h.

◆ customViewQuaternion

- (Quaternion) customViewQuaternion
private

Definition at line 727 of file PlayerEntity.h.

◆ customViewRightVector

- (Vector) customViewRightVector
private

Definition at line 729 of file PlayerEntity.h.

◆ customViewRotationCenter

- (Vector) customViewRotationCenter
private

Definition at line 729 of file PlayerEntity.h.

◆ customViewUpVector

- (Vector) customViewUpVector
private

Definition at line 729 of file PlayerEntity.h.

Referenced by HeadUpDisplay::hudRotateViewpointForVirtualDepth.

◆ demoShip

- (ShipEntity*) demoShip
private

Definition at line 808 of file PlayerEntity.h.

◆ dockingClearanceStatus

- (OODockingClearanceStatus) dockingClearanceStatus
private

Definition at line 803 of file PlayerEntity.h.

◆ dockingReport

- (NSMutableString*) dockingReport
private

Definition at line 734 of file PlayerEntity.h.

◆ ecm_in_operation

- (unsigned) ecm_in_operation
private

Definition at line 757 of file PlayerEntity.h.

◆ ecm_start_time

- (double) ecm_start_time
private

Definition at line 482 of file PlayerEntity.h.

◆ eqScripts

- (NSMutableArray*) eqScripts
private

Definition at line 398 of file PlayerEntity.h.

◆ escape_pod_rescue_time

- (double) escape_pod_rescue_time
private

Definition at line 436 of file PlayerEntity.h.

◆ extraGuiScreenKeys

- (NSMutableDictionary*) extraGuiScreenKeys
private

Definition at line 703 of file PlayerEntity.h.

◆ extraMissionKeys

- (NSDictionary*) extraMissionKeys
private

Definition at line 701 of file PlayerEntity.h.

◆ fieldOfView

- (double) fieldOfView
private

Definition at line 814 of file PlayerEntity.h.

◆ finished

- (unsigned) finished
private

Definition at line 742 of file PlayerEntity.h.

◆ fleeing_status

- (OOPlayerFleeingStatus) fleeing_status
private

Definition at line 489 of file PlayerEntity.h.

◆ forward_shield

- (GLfloat) forward_shield
private

Definition at line 476 of file PlayerEntity.h.

◆ forward_shield_recharge_rate

- (GLfloat) forward_shield_recharge_rate
private

Definition at line 477 of file PlayerEntity.h.

◆ forward_shot_time

- (OOTimeDelta) forward_shot_time
private

Definition at line 478 of file PlayerEntity.h.

◆ forwardViewOffset

- (Vector) forwardViewOffset
private

Definition at line 710 of file PlayerEntity.h.

◆ found_equipment

- (BOOL) found_equipment
private

Definition at line 406 of file PlayerEntity.h.

◆ found_system_id

- (OOSystemID) found_system_id
private

Definition at line 377 of file PlayerEntity.h.

◆ fps_check_time

- (double) fps_check_time
private

Definition at line 438 of file PlayerEntity.h.

◆ fps_counter

- (int) fps_counter
private

Definition at line 439 of file PlayerEntity.h.

◆ fuel_leak_rate

- (GLfloat) fuel_leak_rate
private

Definition at line 536 of file PlayerEntity.h.

◆ galactic_witchjump

- (unsigned) galactic_witchjump
private

Definition at line 755 of file PlayerEntity.h.

◆ galacticHyperspaceBehaviour

- (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour
private

Definition at line 795 of file PlayerEntity.h.

◆ galacticHyperspaceFixedCoords

- (NSPoint) galacticHyperspaceFixedCoords
private

Definition at line 796 of file PlayerEntity.h.

◆ galaxy_coordinates

- (NSPoint) galaxy_coordinates
private

Definition at line 519 of file PlayerEntity.h.

Referenced by MissionRunScreen().

◆ galaxy_number

- (OOGalaxyID) galaxy_number
private

Provided by category PlayerEntity(Scripting).

Definition at line 522 of file PlayerEntity.h.

◆ game_over

- (unsigned) game_over
private

Definition at line 741 of file PlayerEntity.h.

◆ gui_screen

- (OOGUIScreenID) gui_screen
private

Definition at line 485 of file PlayerEntity.h.

◆ hud

◆ hyperspeed_engaged

- (unsigned) hyperspeed_engaged
private

Definition at line 749 of file PlayerEntity.h.

◆ hyperspeed_locked

- (unsigned) hyperspeed_locked
private

Definition at line 751 of file PlayerEntity.h.

◆ hyperspeedFactor

- (GLfloat) hyperspeedFactor
private

Definition at line 539 of file PlayerEntity.h.

◆ ident_engaged

- (unsigned) ident_engaged
private

Definition at line 753 of file PlayerEntity.h.

◆ info_system_id

- (OOSystemID) info_system_id
private

Definition at line 372 of file PlayerEntity.h.

◆ isSpeechOn

- (OOSpeechSettings) isSpeechOn
private

Definition at line 783 of file PlayerEntity.h.

◆ kbdLayouts

- (NSArray*) kbdLayouts
private

Definition at line 790 of file PlayerEntity.h.

◆ keyboardPitchOverride

- (unsigned) keyboardPitchOverride
private

Definition at line 769 of file PlayerEntity.h.

◆ keyboardRollOverride

- (unsigned) keyboardRollOverride
private

Definition at line 768 of file PlayerEntity.h.

◆ keyboardYawOverride

- (unsigned) keyboardYawOverride
private

Definition at line 770 of file PlayerEntity.h.

◆ keyCodeLookups

- (NSDictionary*) keyCodeLookups
private

Definition at line 544 of file PlayerEntity.h.

◆ keyconfig2_settings

- (NSDictionary*) keyconfig2_settings
private

Definition at line 543 of file PlayerEntity.h.

◆ keyFunctions

- (NSArray*) keyFunctions
private

Definition at line 789 of file PlayerEntity.h.

◆ keyMod1Text

- (NSString*) keyMod1Text
private

Definition at line 792 of file PlayerEntity.h.

◆ keyMod2Text

- (NSString*) keyMod2Text
private

Definition at line 793 of file PlayerEntity.h.

◆ keyShiftText

- (NSString*) keyShiftText
private

Definition at line 791 of file PlayerEntity.h.

◆ last_ecm_time

- (double) last_ecm_time
private

Definition at line 483 of file PlayerEntity.h.

◆ last_fps_check_time

- (double) last_fps_check_time
private

Definition at line 440 of file PlayerEntity.h.

◆ lastScriptAlertCondition

- (OOAlertCondition) lastScriptAlertCondition
private

Definition at line 488 of file PlayerEntity.h.

◆ lastShot

- (NSArray*) lastShot
private

Definition at line 809 of file PlayerEntity.h.

◆ lastTextKey

- (NSString*) lastTextKey
private

Definition at line 431 of file PlayerEntity.h.

◆ launchingMissile

- (unsigned) launchingMissile
private

Definition at line 775 of file PlayerEntity.h.

◆ launchRoll

- (GLfloat) launchRoll
private

Definition at line 474 of file PlayerEntity.h.

◆ legalStatus

- (int) legalStatus
private

Definition at line 529 of file PlayerEntity.h.

◆ localVariables

- (NSMutableDictionary*) localVariables
private

Definition at line 384 of file PlayerEntity.h.

◆ longRangeChartMode

- (OOLongRangeChartMode) longRangeChartMode
private

Definition at line 798 of file PlayerEntity.h.

Referenced by PlayerShipSetProperty().

◆ market_rnd

- (int) market_rnd
private

Definition at line 530 of file PlayerEntity.h.

◆ marketFilterMode

- (OOMarketFilterMode) marketFilterMode
private

Definition at line 457 of file PlayerEntity.h.

◆ marketOffset

- (NSInteger) marketOffset
private

Definition at line 455 of file PlayerEntity.h.

◆ marketSelectedCommodity

- (OOCommodityType) marketSelectedCommodity
private

Definition at line 456 of file PlayerEntity.h.

◆ marketSorterMode

- (OOMarketSorterMode) marketSorterMode
private

Definition at line 458 of file PlayerEntity.h.

◆ massLockable

- (BOOL) massLockable
private

Definition at line 778 of file PlayerEntity.h.

◆ max_aft_shield

- (GLfloat) max_aft_shield
private

Definition at line 477 of file PlayerEntity.h.

◆ max_forward_shield

- (GLfloat) max_forward_shield
private

Definition at line 477 of file PlayerEntity.h.

◆ max_passengers

- (unsigned) max_passengers
private

Definition at line 410 of file PlayerEntity.h.

◆ maxFieldOfView

- (double) maxFieldOfView
private

Definition at line 813 of file PlayerEntity.h.

◆ missile_entity

- (ShipEntity* missile_entity[PLAYER_MAX_MISSILES])
private

Definition at line 526 of file PlayerEntity.h.

◆ missile_status

- (OOMissileStatus) missile_status
private

Definition at line 490 of file PlayerEntity.h.

◆ mission_variables

- (NSMutableDictionary*) mission_variables
private

Definition at line 383 of file PlayerEntity.h.

◆ missionChoice

- (NSString*) missionChoice
private

Definition at line 387 of file PlayerEntity.h.

◆ missionDestinations

- (NSMutableDictionary*) missionDestinations
private

Definition at line 422 of file PlayerEntity.h.

◆ missionKeyPress

- (NSString*) missionKeyPress
private

Definition at line 388 of file PlayerEntity.h.

◆ missionTextRow

- (NSInteger) missionTextRow
private

Definition at line 386 of file PlayerEntity.h.

◆ mouse_control_on

- (unsigned) mouse_control_on
private

Definition at line 766 of file PlayerEntity.h.

◆ multiFunctionDisplaySettings

- (NSMutableArray*) multiFunctionDisplaySettings
private

Definition at line 469 of file PlayerEntity.h.

◆ multiFunctionDisplayText

- (NSMutableDictionary*) multiFunctionDisplayText
private

Definition at line 468 of file PlayerEntity.h.

◆ n_key_activate_equipment

- (NSArray*) n_key_activate_equipment
private

Definition at line 586 of file PlayerEntity.h.

◆ n_key_advanced_nav_array_next

- (NSArray*) n_key_advanced_nav_array_next
private

Definition at line 614 of file PlayerEntity.h.

◆ n_key_advanced_nav_array_previous

- (NSArray*) n_key_advanced_nav_array_previous
private

Definition at line 615 of file PlayerEntity.h.

◆ n_key_autodock

- (NSArray*) n_key_autodock
private

Definition at line 609 of file PlayerEntity.h.

◆ n_key_autopilot

- (NSArray*) n_key_autopilot
private

Definition at line 608 of file PlayerEntity.h.

◆ n_key_bloom_toggle

- (NSArray*) n_key_bloom_toggle
private

Definition at line 633 of file PlayerEntity.h.

◆ n_key_chart_highlight

- (NSArray*) n_key_chart_highlight
private

Definition at line 642 of file PlayerEntity.h.

◆ n_key_comms_log

- (NSArray*) n_key_comms_log
private

Definition at line 638 of file PlayerEntity.h.

◆ n_key_custom_view

- (NSArray*) n_key_custom_view
private

Definition at line 653 of file PlayerEntity.h.

◆ n_key_custom_view_pan_down

- (NSArray*) n_key_custom_view_pan_down
private

Definition at line 663 of file PlayerEntity.h.

◆ n_key_custom_view_pan_left

- (NSArray*) n_key_custom_view_pan_left
private

Definition at line 657 of file PlayerEntity.h.

◆ n_key_custom_view_pan_right

- (NSArray*) n_key_custom_view_pan_right
private

Definition at line 659 of file PlayerEntity.h.

◆ n_key_custom_view_pan_up

- (NSArray*) n_key_custom_view_pan_up
private

Definition at line 661 of file PlayerEntity.h.

◆ n_key_custom_view_roll_left

- (NSArray*) n_key_custom_view_roll_left
private

Definition at line 656 of file PlayerEntity.h.

◆ n_key_custom_view_roll_right

- (NSArray*) n_key_custom_view_roll_right
private

Definition at line 658 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_down

- (NSArray*) n_key_custom_view_rotate_down
private

Definition at line 662 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_left

- (NSArray*) n_key_custom_view_rotate_left
private

Definition at line 664 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_right

- (NSArray*) n_key_custom_view_rotate_right
private

Definition at line 665 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_up

- (NSArray*) n_key_custom_view_rotate_up
private

Definition at line 660 of file PlayerEntity.h.

◆ n_key_custom_view_zoom_in

- (NSArray*) n_key_custom_view_zoom_in
private

Definition at line 655 of file PlayerEntity.h.

◆ n_key_custom_view_zoom_out

- (NSArray*) n_key_custom_view_zoom_out
private

Definition at line 654 of file PlayerEntity.h.

◆ n_key_cycle_next_mfd

- (NSArray*) n_key_cycle_next_mfd
private

Definition at line 670 of file PlayerEntity.h.

◆ n_key_cycle_previous_mfd

- (NSArray*) n_key_cycle_previous_mfd
private

Definition at line 671 of file PlayerEntity.h.

◆ n_key_debug_bounding_boxes

- (NSArray*) n_key_debug_bounding_boxes
private

Definition at line 690 of file PlayerEntity.h.

◆ n_key_debug_collision

- (NSArray*) n_key_debug_collision
private

Definition at line 688 of file PlayerEntity.h.

◆ n_key_debug_console_connect

- (NSArray*) n_key_debug_console_connect
private

Definition at line 689 of file PlayerEntity.h.

◆ n_key_debug_full

- (NSArray*) n_key_debug_full
private

Definition at line 687 of file PlayerEntity.h.

◆ n_key_debug_off

- (NSArray*) n_key_debug_off
private

Definition at line 692 of file PlayerEntity.h.

◆ n_key_debug_shaders

- (NSArray*) n_key_debug_shaders
private

Definition at line 691 of file PlayerEntity.h.

◆ n_key_decrease_speed

- (NSArray*) n_key_decrease_speed
private

Definition at line 576 of file PlayerEntity.h.

◆ n_key_docking_clearance_request

- (NSArray*) n_key_docking_clearance_request
private

Definition at line 667 of file PlayerEntity.h.

◆ n_key_docking_music

- (NSArray*) n_key_docking_music
private

Definition at line 612 of file PlayerEntity.h.

◆ n_key_dump_cargo

- (NSArray*) n_key_dump_cargo
private

Definition at line 605 of file PlayerEntity.h.

◆ n_key_dump_entity_list

- (NSArray*) n_key_dump_entity_list
private

Definition at line 686 of file PlayerEntity.h.

◆ n_key_dump_target_state

- (NSArray*) n_key_dump_target_state
private

Definition at line 685 of file PlayerEntity.h.

◆ n_key_ecm

- (NSArray*) n_key_ecm
private

Definition at line 582 of file PlayerEntity.h.

◆ n_key_fastactivate_equipment_a

- (NSArray*) n_key_fastactivate_equipment_a
private

Definition at line 588 of file PlayerEntity.h.

◆ n_key_fastactivate_equipment_b

- (NSArray*) n_key_fastactivate_equipment_b
private

Definition at line 589 of file PlayerEntity.h.

◆ n_key_fire_lasers

- (NSArray*) n_key_fire_lasers
private

Definition at line 579 of file PlayerEntity.h.

◆ n_key_galactic_hyperspace

- (NSArray*) n_key_galactic_hyperspace
private

Definition at line 601 of file PlayerEntity.h.

◆ n_key_gui_arrow_down

- (NSArray*) n_key_gui_arrow_down
private

Definition at line 570 of file PlayerEntity.h.

◆ n_key_gui_arrow_left

- (NSArray*) n_key_gui_arrow_left
private

Definition at line 567 of file PlayerEntity.h.

◆ n_key_gui_arrow_right

- (NSArray*) n_key_gui_arrow_right
private

Definition at line 568 of file PlayerEntity.h.

◆ n_key_gui_arrow_up

- (NSArray*) n_key_gui_arrow_up
private

Definition at line 569 of file PlayerEntity.h.

◆ n_key_gui_chart_screens

- (NSArray*) n_key_gui_chart_screens
private

Definition at line 563 of file PlayerEntity.h.

◆ n_key_gui_market

- (NSArray*) n_key_gui_market
private

Definition at line 565 of file PlayerEntity.h.

◆ n_key_gui_page_down

- (NSArray*) n_key_gui_page_down
private

Definition at line 572 of file PlayerEntity.h.

◆ n_key_gui_page_up

- (NSArray*) n_key_gui_page_up
private

Definition at line 571 of file PlayerEntity.h.

◆ n_key_gui_screen_equipship

- (NSArray*) n_key_gui_screen_equipship
private

Definition at line 560 of file PlayerEntity.h.

◆ n_key_gui_screen_interfaces

- (NSArray*) n_key_gui_screen_interfaces
private

Definition at line 561 of file PlayerEntity.h.

◆ n_key_gui_screen_options

- (NSArray*) n_key_gui_screen_options
private

Definition at line 559 of file PlayerEntity.h.

◆ n_key_gui_screen_status

- (NSArray*) n_key_gui_screen_status
private

Definition at line 562 of file PlayerEntity.h.

◆ n_key_gui_select

- (NSArray*) n_key_gui_select
private

Definition at line 573 of file PlayerEntity.h.

◆ n_key_gui_system_data

- (NSArray*) n_key_gui_system_data
private

Definition at line 564 of file PlayerEntity.h.

◆ n_key_hud_toggle

- (NSArray*) n_key_hud_toggle
private

Definition at line 636 of file PlayerEntity.h.

◆ n_key_hyperspace

- (NSArray*) n_key_hyperspace
private

Definition at line 602 of file PlayerEntity.h.

◆ n_key_ident_system

- (NSArray*) n_key_ident_system
private

Definition at line 594 of file PlayerEntity.h.

◆ n_key_increase_speed

- (NSArray*) n_key_increase_speed
private

Definition at line 575 of file PlayerEntity.h.

◆ n_key_info_next_system

- (NSArray*) n_key_info_next_system
private

Definition at line 616 of file PlayerEntity.h.

◆ n_key_info_previous_system

- (NSArray*) n_key_info_previous_system
private

Definition at line 617 of file PlayerEntity.h.

◆ n_key_inject_fuel

- (NSArray*) n_key_inject_fuel
private

Definition at line 577 of file PlayerEntity.h.

◆ n_key_jumpdrive

- (NSArray*) n_key_jumpdrive
private

Definition at line 603 of file PlayerEntity.h.

◆ n_key_launch_escapepod

- (NSArray*) n_key_launch_escapepod
private

Definition at line 599 of file PlayerEntity.h.

◆ n_key_launch_missile

- (NSArray*) n_key_launch_missile
private

Definition at line 580 of file PlayerEntity.h.

◆ n_key_launch_ship

- (NSArray*) n_key_launch_ship
private

Definition at line 558 of file PlayerEntity.h.

◆ n_key_map_end

- (NSArray*) n_key_map_end
private

Definition at line 619 of file PlayerEntity.h.

◆ n_key_map_home

- (NSArray*) n_key_map_home
private

Definition at line 618 of file PlayerEntity.h.

◆ n_key_map_info

- (NSArray*) n_key_map_info
private

Definition at line 622 of file PlayerEntity.h.

◆ n_key_map_next_system

- (NSArray*) n_key_map_next_system
private

Definition at line 620 of file PlayerEntity.h.

◆ n_key_map_previous_system

- (NSArray*) n_key_map_previous_system
private

Definition at line 621 of file PlayerEntity.h.

◆ n_key_map_zoom_in

- (NSArray*) n_key_map_zoom_in
private

Definition at line 623 of file PlayerEntity.h.

◆ n_key_map_zoom_out

- (NSArray*) n_key_map_zoom_out
private

Definition at line 624 of file PlayerEntity.h.

◆ n_key_market_buy_max

- (NSArray*) n_key_market_buy_max
private

Definition at line 647 of file PlayerEntity.h.

◆ n_key_market_buy_one

- (NSArray*) n_key_market_buy_one
private

Definition at line 645 of file PlayerEntity.h.

◆ n_key_market_filter_cycle

- (NSArray*) n_key_market_filter_cycle
private

Definition at line 643 of file PlayerEntity.h.

◆ n_key_market_sell_max

- (NSArray*) n_key_market_sell_max
private

Definition at line 648 of file PlayerEntity.h.

◆ n_key_market_sell_one

- (NSArray*) n_key_market_sell_one
private

Definition at line 646 of file PlayerEntity.h.

◆ n_key_market_sorter_cycle

- (NSArray*) n_key_market_sorter_cycle
private

Definition at line 644 of file PlayerEntity.h.

◆ n_key_mode_equipment

- (NSArray*) n_key_mode_equipment
private

Definition at line 587 of file PlayerEntity.h.

◆ n_key_mouse_control_roll

- (NSArray*) n_key_mouse_control_roll
private

Definition at line 634 of file PlayerEntity.h.

◆ n_key_mouse_control_yaw

- (NSArray*) n_key_mouse_control_yaw
private

Definition at line 635 of file PlayerEntity.h.

◆ n_key_next_compass_mode

- (NSArray*) n_key_next_compass_mode
private

Definition at line 640 of file PlayerEntity.h.

◆ n_key_next_missile

- (NSArray*) n_key_next_missile
private

Definition at line 581 of file PlayerEntity.h.

◆ n_key_next_target

- (NSArray*) n_key_next_target
private

Definition at line 650 of file PlayerEntity.h.

◆ n_key_oxzmanager_extract

- (NSArray*) n_key_oxzmanager_extract
private

Definition at line 677 of file PlayerEntity.h.

◆ n_key_oxzmanager_setfilter

- (NSArray*) n_key_oxzmanager_setfilter
private

Definition at line 675 of file PlayerEntity.h.

◆ n_key_oxzmanager_showinfo

- (NSArray*) n_key_oxzmanager_showinfo
private

Definition at line 676 of file PlayerEntity.h.

◆ n_key_pausebutton

- (NSArray*) n_key_pausebutton
private

Definition at line 631 of file PlayerEntity.h.

◆ n_key_pitch_back

- (NSArray*) n_key_pitch_back
private

Definition at line 549 of file PlayerEntity.h.

◆ n_key_pitch_forward

- (NSArray*) n_key_pitch_forward
private

Definition at line 548 of file PlayerEntity.h.

◆ n_key_prev_compass_mode

- (NSArray*) n_key_prev_compass_mode
private

Definition at line 639 of file PlayerEntity.h.

◆ n_key_previous_target

- (NSArray*) n_key_previous_target
private

Definition at line 651 of file PlayerEntity.h.

◆ n_key_prime_next_equipment

- (NSArray*) n_key_prime_next_equipment
private

Definition at line 584 of file PlayerEntity.h.

◆ n_key_prime_previous_equipment

- (NSArray*) n_key_prime_previous_equipment
private

Definition at line 585 of file PlayerEntity.h.

◆ n_key_roll_left

- (NSArray*) n_key_roll_left
private

Definition at line 546 of file PlayerEntity.h.

◆ n_key_roll_right

- (NSArray*) n_key_roll_right
private

Definition at line 547 of file PlayerEntity.h.

◆ n_key_rotate_cargo

- (NSArray*) n_key_rotate_cargo
private

Definition at line 606 of file PlayerEntity.h.

◆ n_key_scanner_unzoom

- (NSArray*) n_key_scanner_unzoom
private

Definition at line 597 of file PlayerEntity.h.

◆ n_key_scanner_zoom

- (NSArray*) n_key_scanner_zoom
private

Definition at line 596 of file PlayerEntity.h.

◆ n_key_show_fps

- (NSArray*) n_key_show_fps
private

Definition at line 632 of file PlayerEntity.h.

◆ n_key_snapshot

- (NSArray*) n_key_snapshot
private

Definition at line 611 of file PlayerEntity.h.

◆ n_key_switch_next_mfd

- (NSArray*) n_key_switch_next_mfd
private

Definition at line 672 of file PlayerEntity.h.

◆ n_key_switch_previous_mfd

- (NSArray*) n_key_switch_previous_mfd
private

Definition at line 673 of file PlayerEntity.h.

◆ n_key_system_end

- (NSArray*) n_key_system_end
private

Definition at line 627 of file PlayerEntity.h.

◆ n_key_system_home

- (NSArray*) n_key_system_home
private

Definition at line 626 of file PlayerEntity.h.

◆ n_key_system_next_system

- (NSArray*) n_key_system_next_system
private

Definition at line 628 of file PlayerEntity.h.

◆ n_key_system_previous_system

- (NSArray*) n_key_system_previous_system
private

Definition at line 629 of file PlayerEntity.h.

◆ n_key_target_incoming_missile

- (NSArray*) n_key_target_incoming_missile
private

Definition at line 593 of file PlayerEntity.h.

◆ n_key_target_missile

- (NSArray*) n_key_target_missile
private

Definition at line 591 of file PlayerEntity.h.

◆ n_key_untarget_missile

- (NSArray*) n_key_untarget_missile
private

Definition at line 592 of file PlayerEntity.h.

◆ n_key_view_aft

- (NSArray*) n_key_view_aft
private

Definition at line 554 of file PlayerEntity.h.

◆ n_key_view_forward

- (NSArray*) n_key_view_forward
private

Definition at line 553 of file PlayerEntity.h.

◆ n_key_view_port

- (NSArray*) n_key_view_port
private

Definition at line 555 of file PlayerEntity.h.

◆ n_key_view_starboard

- (NSArray*) n_key_view_starboard
private

Definition at line 556 of file PlayerEntity.h.

◆ n_key_weapons_online_toggle

- (NSArray*) n_key_weapons_online_toggle
private

Definition at line 668 of file PlayerEntity.h.

◆ n_key_yaw_left

- (NSArray*) n_key_yaw_left
private

Definition at line 550 of file PlayerEntity.h.

◆ n_key_yaw_right

- (NSArray*) n_key_yaw_right
private

Definition at line 551 of file PlayerEntity.h.

◆ occlusion_dial

- (float) occlusion_dial
private

Definition at line 375 of file PlayerEntity.h.

◆ parcel_record

- (NSMutableDictionary*) parcel_record
private

Definition at line 415 of file PlayerEntity.h.

◆ parcels

- (NSMutableArray*) parcels
private

Definition at line 414 of file PlayerEntity.h.

◆ passenger_record

- (NSMutableDictionary*) passenger_record
private

Definition at line 412 of file PlayerEntity.h.

◆ passengers

- (NSMutableArray*) passengers
private

Definition at line 411 of file PlayerEntity.h.

◆ pitch_delta

- (GLfloat) pitch_delta
private

Definition at line 473 of file PlayerEntity.h.

◆ pitching

- (unsigned) pitching
private

Definition at line 763 of file PlayerEntity.h.

◆ planetSearchString

- (NSString*) planetSearchString
private

Definition at line 442 of file PlayerEntity.h.

◆ playerRotMatrix

- (OOMatrix) playerRotMatrix
private

Definition at line 444 of file PlayerEntity.h.

◆ pollControls

- (BOOL) pollControls
private

Definition at line 452 of file PlayerEntity.h.

◆ port_shot_time

- (OOTimeDelta) port_shot_time
private

Definition at line 478 of file PlayerEntity.h.

◆ portViewOffset

- (Vector) portViewOffset
private

Definition at line 710 of file PlayerEntity.h.

◆ previous_system_id

- (OOSystemID) previous_system_id
private

Definition at line 373 of file PlayerEntity.h.

◆ primedEquipment

- (NSUInteger) primedEquipment
private

Definition at line 492 of file PlayerEntity.h.

◆ replacingMissile

- (unsigned) replacingMissile
private

Definition at line 776 of file PlayerEntity.h.

◆ reputation

- (NSMutableDictionary*) reputation
private

Provided by category PlayerEntity(Contracts).

Definition at line 408 of file PlayerEntity.h.

◆ roleSystemList

- (NSMutableArray*) roleSystemList
private

Definition at line 426 of file PlayerEntity.h.

◆ roleWeightFlags

- (NSMutableDictionary*) roleWeightFlags
private

Definition at line 425 of file PlayerEntity.h.

◆ roleWeights

- (NSMutableArray *) roleWeights
private

Definition at line 423 of file PlayerEntity.h.

Referenced by PlayerGetProperty().

◆ roll_delta

- (GLfloat) roll_delta
private

Definition at line 473 of file PlayerEntity.h.

◆ rolling

- (unsigned) rolling
private

Definition at line 763 of file PlayerEntity.h.

◆ save_path

- (NSString*) save_path
private

Definition at line 706 of file PlayerEntity.h.

◆ saved_chart_zoom

- (OOScalar) saved_chart_zoom
private

Definition at line 510 of file PlayerEntity.h.

◆ scannedWormholes

- (NSArray *) scannedWormholes
private

Definition at line 805 of file PlayerEntity.h.

◆ scanner_zoom_rate

- (GLfloat) scanner_zoom_rate
private

Definition at line 719 of file PlayerEntity.h.

◆ scenarioKey

- (NSString*) scenarioKey
private

Definition at line 707 of file PlayerEntity.h.

◆ scoopOverride

- (BOOL) scoopOverride
private

Definition at line 740 of file PlayerEntity.h.

◆ scoopsActive

- (unsigned) scoopsActive
private

Definition at line 738 of file PlayerEntity.h.

◆ script_time

- (double) script_time
private

Definition at line 428 of file PlayerEntity.h.

◆ script_time_check

- (double) script_time_check
private

Definition at line 429 of file PlayerEntity.h.

◆ script_time_interval

- (double) script_time_interval
private

Definition at line 430 of file PlayerEntity.h.

◆ selFunctionIdx

- (int) selFunctionIdx
private

Definition at line 787 of file PlayerEntity.h.

◆ ship_clock

- (double) ship_clock
private

Definition at line 433 of file PlayerEntity.h.

◆ ship_clock_adjust

- (double) ship_clock_adjust
private

Definition at line 434 of file PlayerEntity.h.

◆ ship_kills

- (unsigned) ship_kills
private

Definition at line 531 of file PlayerEntity.h.

◆ ship_trade_in_factor

- (int) ship_trade_in_factor
private

Definition at line 378 of file PlayerEntity.h.

◆ shipCommodityData

- (OOCommodityMarket *) shipCommodityData
private

Definition at line 524 of file PlayerEntity.h.

◆ shipyard_record

- (NSMutableDictionary*) shipyard_record
private

Definition at line 420 of file PlayerEntity.h.

◆ show_info_flag

- (unsigned) show_info_flag
private

Definition at line 759 of file PlayerEntity.h.

◆ showDemoShips

- (BOOL) showDemoShips
private

Definition at line 761 of file PlayerEntity.h.

◆ showingLongRangeChart

- (BOOL) showingLongRangeChart
private

Definition at line 446 of file PlayerEntity.h.

◆ specialCargo

- (NSString *) specialCargo
private

Definition at line 394 of file PlayerEntity.h.

Referenced by PlayerShipGetProperty().

◆ starboard_shot_time

- (OOTimeDelta) starboard_shot_time
private

Definition at line 478 of file PlayerEntity.h.

◆ starboardViewOffset

- (Vector) starboardViewOffset
private

Definition at line 710 of file PlayerEntity.h.

◆ stickFunctions

- (NSArray*) stickFunctions
private

Definition at line 788 of file PlayerEntity.h.

◆ stickProfileScreen

- (StickProfileScreen*) stickProfileScreen
private

Definition at line 811 of file PlayerEntity.h.

◆ suppressTargetLost

- (void) suppressTargetLost
private

Definition at line 737 of file PlayerEntity.h.

◆ system_id

- (OOSystemID) system_id
private

Definition at line 370 of file PlayerEntity.h.

◆ target_chart_centre

- (NSPoint) target_chart_centre
private

Definition at line 503 of file PlayerEntity.h.

◆ target_chart_focus

- (NSPoint) target_chart_focus
private

Definition at line 504 of file PlayerEntity.h.

◆ target_chart_zoom

- (OOScalar) target_chart_zoom
private

Definition at line 509 of file PlayerEntity.h.

◆ target_memory

- (NSMutableArray*) target_memory
private

Definition at line 723 of file PlayerEntity.h.

◆ target_memory_index

- (NSUInteger) target_memory_index
private

Definition at line 724 of file PlayerEntity.h.

◆ target_system_id

- (OOSystemID) target_system_id
private

Definition at line 371 of file PlayerEntity.h.

◆ targetDockStation

- (StationEntity*) targetDockStation
private

Definition at line 465 of file PlayerEntity.h.

◆ travelling_at_hyperspeed

- (unsigned) travelling_at_hyperspeed
private

Definition at line 750 of file PlayerEntity.h.

◆ trumble

- (OOTrumble* trumble[PLAYER_MAX_TRUMBLES])
private

Definition at line 715 of file PlayerEntity.h.

◆ trumbleCount

- (NSUInteger) trumbleCount
private

Definition at line 714 of file PlayerEntity.h.

◆ using_mining_laser

- (unsigned) using_mining_laser
private

Definition at line 764 of file PlayerEntity.h.

◆ waitingForStickCallback

- (unsigned) waitingForStickCallback
private

Definition at line 771 of file PlayerEntity.h.

◆ weapons_online

- (unsigned) weapons_online
private

Definition at line 773 of file PlayerEntity.h.

◆ witchspaceCountdown

- (OOTimeDelta) witchspaceCountdown
private

Definition at line 512 of file PlayerEntity.h.

◆ worldScripts

- (NSDictionary*) worldScripts
private

Definition at line 380 of file PlayerEntity.h.

◆ worldScriptsRequiringTickle

- (NSDictionary*) worldScriptsRequiringTickle
private

Provided by category PlayerEntity(Scripting).

Definition at line 381 of file PlayerEntity.h.

◆ wormhole

- (WormholeEntity *) wormhole
private

Definition at line 806 of file PlayerEntity.h.

◆ yaw_delta

- (GLfloat) yaw_delta
private

Definition at line 473 of file PlayerEntity.h.

◆ yawing

- (unsigned) yawing
private

Definition at line 763 of file PlayerEntity.h.


The documentation for this class was generated from the following files: