Oolite 1.91.0.7658-250404-b1488af
All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
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
 

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

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

References activateCloakingDevice, ShipEntity::hasCloakingDevice, playCloakingDeviceInsufficientEnergy, and playCloakingDeviceOn.

Referenced by activateCloakingDevice, and alertCondition.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activatePrimableEquipment:withMode:

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

Definition at line 8262 of file PlayerEntity.m.

8262 :(NSUInteger)index withMode:(OOPrimedEquipmentMode)mode
8263{
8264 // index == [eqScripts count] means we don't want to activate any equipment.
8265 if(index < [eqScripts count])
8266 {
8267 OOJSScript *eqScript = [[eqScripts oo_arrayAtIndex:index] objectAtIndex:1];
8268 JSContext *context = OOJSAcquireContext();
8269 NSAssert1(mode <= OOPRIMEDEQUIP_MODE, @"Primable equipment mode %i out of range", (int)mode);
8270
8271 switch (mode)
8272 {
8273 case OOPRIMEDEQUIP_MODE:
8274 [eqScript callMethod:OOJSID("mode") inContext:context withArguments:NULL count:0 result:NULL];
8275 break;
8277 [eqScript callMethod:OOJSID("activated") inContext:context withArguments:NULL count:0 result:NULL];
8278 break;
8279 }
8280 OOJSRelinquishContext(context);
8281 }
8282
8283}
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

References OOJSScript::callMethod:inContext:withArguments:count:result:, count, eqScripts, OOJSAcquireContext(), OOJSRelinquishContext(), OOPRIMEDEQUIP_ACTIVATED, and OOPRIMEDEQUIP_MODE.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activateSelectedInterface

- (void) activateSelectedInterface

Definition at line 9895 of file PlayerEntity.m.

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

References activateSelectedInterface, dockedStation, StationEntity::localInterfaces, OOLog, OOJSInterfaceDefinition::runCallback:, GuiDisplayGen::selectedRowKey, setGuiToInterfacesScreen:, GuiDisplayGen::setSelectedRow:, and showInformationForSelectedInterface.

Referenced by activateSelectedInterface, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activeMFD

- (NSUInteger) activeMFD

References activeMFD.

◆ activeMissile

- (NSUInteger) activeMissile

References activeMissile, dialIdentEngaged, and dialMaxMissiles.

+ Here is the call graph for this function:

◆ add:

- (void) add: (NSString *) missionVariableString_value

Provided by category PlayerEntity(Scripting).

Definition at line 1807 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 2853 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
NSUInteger primedEquipment

Referenced by addEquipmentItem:withValidation:inContext:.

+ Here is the caller graph for this function:

◆ addEquipmentFromCollection:

- (void) addEquipmentFromCollection: (id) equipment

Definition at line 11677 of file PlayerEntity.m.

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

References addEquipmentItem:withValidation:inContext:, count, nil, and removeEquipmentItem:.

Referenced by setCommanderDataFromDictionary:, and setUpShipFromDictionary:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addEquipmentItem:inContext:

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

Reimplemented from ShipEntity.

Definition at line 11548 of file PlayerEntity.m.

11548 :(NSString *)equipmentKey inContext:(NSString *)context
11549{
11550 return [self addEquipmentItem:equipmentKey withValidation:YES inContext:context];
11551}

References addEquipmentItem:withValidation:inContext:.

Referenced by setCommanderDataFromDictionary:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addEquipmentItem:withValidation:inContext:

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

Reimplemented from ShipEntity.

Definition at line 11554 of file PlayerEntity.m.

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

References addEqScriptForKey:, ShipEntity::addEquipmentItem:withValidation:inContext:, addEquipmentWithScriptToCustomKeyArray:, addTrumble:, compassMode, PLAYER_MAX_TRUMBLES, ranrot_rand, setCompassMode:, and trumbleCount.

Referenced by addEquipmentFromCollection:, addEquipmentItem:inContext:, PlayerEntity(Scripting)::awardEquipment:, PlayerEntity(Contracts)::buySelectedShip, PlayerEntity(Contracts)::newShipCommonSetup:yardInfo:baseInfo:, PlayerEntity(Contracts)::replaceShipWithNamedShip:, ShipAwardEquipment(), ShipSetEquipmentStatus(), takeInternalDamage, and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addEquipmentWithScriptToCustomKeyArray:

- (void) addEquipmentWithScriptToCustomKeyArray: (NSString *) equipmentKey

Definition at line 11596 of file PlayerEntity.m.

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

References count, CUSTOMEQUIP_EQUIPKEY, OOEquipmentType::defaultActivateKey, OOEquipmentType::defaultModeKey, eqScripts, OOEquipmentType::equipmentTypeWithIdentifier:, OOEquipmentType::name, and nil.

Referenced by addEquipmentItem:withValidation:inContext:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLiteralMissionText:

- (void) addLiteralMissionText: (NSString *) text

Provided by category PlayerEntity(Scripting).

Definition at line 1919 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)
NSInteger missionTextRow

Referenced by PlayerEntity(Scripting)::addMissionText:, MissionAddMessageText(), and MissionRunScreen().

+ Here is the caller graph for this function:

◆ addMessageToReport:

- (void) addMessageToReport: (NSString*) report

Provided by category PlayerEntity(Contracts).

Definition at line 513 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}
NSMutableString * dockingReport

Referenced by docked, getFined, penaltyForUnauthorizedDocking, and PlayerAddMessageToArrivalReport().

+ Here is the caller graph for this function:

◆ addMissionDestination:

- (void) addMissionDestination: (NSString *) destinations

Provided by category PlayerEntity(Scripting).

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

13331 :(NSDictionary *)marker
13332{
13333 NSDictionary *validated = [self validatedMarker:marker];
13334 if (validated == nil)
13335 {
13336 return;
13337 }
13338
13339 [missionDestinations setObject:validated forKey:[self markerKey:validated]];
13340}

References markerKey:, nil, and validatedMarker:.

Referenced by PlayerEntity(Scripting)::addMissionDestination:, initialiseMissionDestinations:andLegacy:, and MissionMarkSystem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMissionText:

- (void) addMissionText: (NSString *) textKey

Provided by category PlayerEntity(Scripting).

Definition at line 1901 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,...)
NSString * lastTextKey

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ addMoon:

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

Provided by category PlayerEntity(Scripting).

Definition at line 2361 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:840

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 933 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}
HPVector destination()

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 879 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}
NSMutableDictionary * passenger_record
NSMutableArray * passengers
unsigned max_passengers

Referenced by PlayerShipAddPassenger().

+ Here is the caller graph for this function:

◆ addPlanet:

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

Provided by category PlayerEntity(Scripting).

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

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

References addRoleToPlayer:, bounty, hasHostileTarget, ShipEntity::isExplicitlyUnpiloted, ShipEntity::isHulk, ShipEntity::isPirateVictim, Entity::isPlayer, nil, ShipEntity::primaryAggressor, ShipEntity::primaryRole, ShipEntity::scanClass, and UNIVERSE.

+ Here is the call graph for this function:

◆ addRoleForMining

- (void) addRoleForMining

Definition at line 5083 of file PlayerEntity.m.

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

References addRoleForMining, and addRoleToPlayer:.

Referenced by addRoleForMining, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRoleToPlayer:

- (void) addRoleToPlayer: (NSString *) role

Definition at line 5096 of file PlayerEntity.m.

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

References addRoleToPlayer:inSlot:, maxPlayerRoles, and Ranrot().

Referenced by PlayerEntity(Contracts)::addParcel:start:destination:eta:fee:premium:risk:, PlayerEntity(Contracts)::addPassenger:start:destination:eta:fee:advance:risk:, addRoleForAggression:, addRoleForMining, PlayerEntity(Contracts)::awardContract:commodity:start:destination:eta:fee:premium:, PlayerEntity(Contracts)::checkPassengerContracts, docked, enterWitchspace, leaveDock:, and PlayerSetPlayerRole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRoleToPlayer:inSlot:

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

Definition at line 5103 of file PlayerEntity.m.

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

References count, maxPlayerRoles, and roleWeights.

Referenced by addRoleToPlayer:, and PlayerSetPlayerRole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addScannedWormhole:

- (void) addScannedWormhole: (WormholeEntity*) wormhole

Definition at line 13224 of file PlayerEntity.m.

13224 :(WormholeEntity*)whole
13225{
13226 assert(scannedWormholes != nil);
13227 assert(whole != nil);
13228
13229 // Only add if we don't have it already!
13230 NSEnumerator *wormholes = [scannedWormholes objectEnumerator];
13231 WormholeEntity *wh = nil;
13232 while ((wh = [wormholes nextObject]))
13233 {
13234 if (wh == whole) return;
13235 }
13236 [whole setScannedAt:[self clockTimeAdjusted]];
13237 [scannedWormholes addObject:whole];
13238}
NSMutableArray * scannedWormholes

References clockTimeAdjusted, nil, scannedWormholes, and WormholeEntity::setScannedAt:.

Referenced by addTarget:, Universe::carryPlayerOn:inWormhole:, enterWitchspace, and enterWormhole:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addScenarioModel:

- (void) addScenarioModel: (NSString *) shipKey

Provided by category PlayerEntity(LoadSave).

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

Referenced by PlayerEntity(LoadSave)::showScenarioDetails.

+ Here is the caller graph for this function:

◆ addScene:atOffset:

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

Provided by category PlayerEntity(Scripting).

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

Referenced by PlayerEntity(Scripting)::addScene:atOffset:, PlayerEntity(Scripting)::processSceneDictionary:atOffset:, PlayerEntity(Scripting)::processSceneString:atOffset:, and PlayerEntity(Scripting)::setBackgroundFromDescriptionsKey:.

+ Here is the caller graph for this function:

◆ addShips:

- (void) addShips: (NSString *) roles_number

Provided by category PlayerEntity(Scripting).

Definition at line 1499 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 1560 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 1602 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 1644 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 1528 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 12277 of file PlayerEntity.m.

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

References activeMissile, addScannedWormhole:, ShipEntity::addTarget:, ident_engaged, ShipEntity::isMissile, Entity::isShip, Entity::isWormhole, missile_entity, missile_status, MISSILE_STATUS_ARMED, MISSILE_STATUS_TARGET_LOCKED, nil, PLAYER_TARGET_MEMORY_SIZE, playIdentLockedOn, playMissileLockedOn, printIdentLockedOnForMissile:, Entity::status, target_memory_index, OOWeakRefObject::weakSelf, and weaponsOnline.

Referenced by ShipEntity(OOEntityInspectorExtensions)::inspBecomeTarget, selectNextMissile, PlayerEntity(Scripting)::targetNearestHostile, PlayerEntity(Scripting)::targetNearestIncomingMissile, and PlayerEntity(OOPrivate)::updateTargeting.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToAdjustTime:

- (void) addToAdjustTime: (double) seconds

Definition at line 4902 of file PlayerEntity.m.

4902 :(double)seconds
4903{
4904 ship_clock_adjust += seconds;
4905}
double ship_clock_adjust

References ship_clock_adjust.

Referenced by Universe::carryPlayerOn:inWormhole:, ClockAddSeconds(), and PlayerSetEscapePodDestination().

+ Here is the caller graph for this function:

◆ addTrumble:

- (void) addTrumble: (OOTrumble *) papaTrumble

Definition at line 12031 of file PlayerEntity.m.

12031 :(OOTrumble *)papaTrumble
12032{
12034 {
12035 return;
12036 }
12037 OOTrumble *trumblePup = trumble[trumbleCount];
12038 [trumblePup spawnFrom:papaTrumble];
12039 trumbleCount++;
12040}
void spawnFrom:(OOTrumble *parentTrumble)
Definition OOTrumble.m:219
OOTrumble * trumble[PLAYER_MAX_TRUMBLES]

References PLAYER_MAX_TRUMBLES, OOTrumble::spawnFrom:, trumble, and trumbleCount.

Referenced by addEquipmentItem:withValidation:inContext:, and OOTrumble::updateSpawn:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjusted_chart_centre

- (NSPoint) adjusted_chart_centre

Definition at line 590 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

References _missionBackgroundSpecial, adjusted_chart_centre, chart_centre_coordinates, chart_focus_coordinates, CHART_HEIGHT_AT_MAX_ZOOM, CHART_MAX_ZOOM, CHART_SCROLL_AT_X, CHART_SCROLL_AT_Y, CHART_WIDTH_AT_MAX_ZOOM, chart_zoom, custom_chart_centre_coordinates, galaxy_coordinates, GUI_BACKGROUND_SPECIAL_CUSTOM, GUI_BACKGROUND_SPECIAL_CUSTOM_ANA_QUICKEST, GUI_BACKGROUND_SPECIAL_CUSTOM_ANA_SHORTEST, GUI_BACKGROUND_SPECIAL_LONG, GUI_BACKGROUND_SPECIAL_LONG_ANA_QUICKEST, GUI_BACKGROUND_SPECIAL_LONG_ANA_SHORTEST, GUI_BACKGROUND_SPECIAL_SHORT, GUI_BACKGROUND_SPECIAL_SHORT_ANA_QUICKEST, and GUI_BACKGROUND_SPECIAL_SHORT_ANA_SHORTEST.

Referenced by adjusted_chart_centre, custom_chart_zoom, GuiDisplayGen(Internal)::drawStarChart:x:y:z:alpha:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjustPriceByScriptForEqKey:withCurrent:

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

Definition at line 10306 of file PlayerEntity.m.

10306 :(NSString *)eqKey withCurrent:(OOCreditsQuantity)price
10307{
10308 NSString *condition_script = [[OOEquipmentType equipmentTypeWithIdentifier:eqKey] conditionScript];
10309 if (condition_script != nil)
10310 {
10311 OOJSScript *condScript = [UNIVERSE getConditionScript:condition_script];
10312 if (condScript != nil) // should always be non-nil, but just in case
10313 {
10314 JSContext *JScontext = OOJSAcquireContext();
10315 BOOL OK;
10316 jsval result;
10317 int32 newPrice;
10318 jsval args[] = { OOJSValueFromNativeObject(JScontext, eqKey) , JSVAL_NULL };
10319 OK = JS_NewNumberValue(JScontext, price, &args[1]);
10320
10321 if (OK)
10322 {
10323 OK = [condScript callMethod:OOJSID("updateEquipmentPrice")
10324 inContext:JScontext
10325 withArguments:args count:sizeof args / sizeof *args
10326 result:&result];
10327 }
10328
10329 if (OK)
10330 {
10331 OK = JS_ValueToInt32(JScontext, result, &newPrice);
10332 if (OK && newPrice >= 0)
10333 {
10334 price = (OOCreditsQuantity)newPrice;
10335 }
10336 }
10337 OOJSRelinquishContext(JScontext);
10338 }
10339 }
10340 return price;
10341}
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
uint64_t OOCreditsQuantity
Definition OOTypes.h:182
NSString * conditionScript()

References OOJSScript::callMethod:inContext:withArguments:count:result:, OOEquipmentType::conditionScript, OOEquipmentType::equipmentTypeWithIdentifier:, nil, OOJSAcquireContext(), OOJSRelinquishContext(), and OOJSValueFromNativeObject().

Referenced by setGuiToEquipShipScreen:selectingFacingFor:, and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjustTradeInFactorBy:

- (void) adjustTradeInFactorBy: (int) value

Definition at line 11914 of file PlayerEntity.m.

11914 :(int)value
11915{
11916 ship_trade_in_factor += value;
11919}
int ship_trade_in_factor
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

References ship_trade_in_factor.

Referenced by ShipEntity::becomeExplosion, PlayerShipSetProperty(), ShipRestoreSubEntities(), and PlayerEntity(OOPrivate)::witchJumpTo:misjump:.

+ Here is the caller graph for this function:

◆ aftShieldLevel

- (GLfloat) aftShieldLevel

Definition at line 4699 of file PlayerEntity.m.

4700{
4701 return aft_shield;
4702}
GLfloat aft_shield

References aft_shield, and aftShieldLevel.

Referenced by aftShieldLevel, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ aftShieldRechargeRate

- (float) aftShieldRechargeRate

Definition at line 4663 of file PlayerEntity.m.

4664{
4666}
GLfloat aft_shield_recharge_rate

References aft_shield_recharge_rate, and aftShieldRechargeRate.

Referenced by aftShieldRechargeRate, doBookkeeping:, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alertCondition

- (OOAlertCondition) alertCondition

Reimplemented from ShipEntity.

References activateCloakingDevice, alertCondition, currentLaserOffset, currentWeapon, deactivateCloakingDevice, energyUnitType, enterGalacticWitchspace, fireMainWeapon, fleeingStatus, hasSufficientFuelForJump, installedEnergyUnitType, rotateCargo, scannerFuzziness, takeInternalDamage, and weaponsOnline.

+ Here is the call graph for this function:

◆ alertFlags

- (int) alertFlags

References alertFlags, and int().

+ Here is the call graph for this function:

◆ allowMissionInterrupt

- (void) allowMissionInterrupt

Provided by category PlayerEntity(ScriptMethods).

Definition at line 236 of file PlayerEntityScriptMethods.m.

237{
239}
BOOL _missionAllowInterrupt

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ ANAMode

- (OORouteType) ANAMode

Definition at line 678 of file PlayerEntity.m.

679{
680 return ANA_mode;
681}
OORouteType ANA_mode

References ANA_mode, and ANAMode.

Referenced by ANAMode, custom_chart_zoom, GuiDisplayGen(Internal)::drawStarChart:x:y:z:alpha:, and PlayerShipGetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyAttitudeChanges:

- (void) applyAttitudeChanges: (double) delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 4281 of file PlayerEntity.m.

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

References applyRoll:andClimb:, and applyYaw:.

+ Here is the call graph for this function:

◆ applyMarketFilter:onMarket:

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

Definition at line 10864 of file PlayerEntity.m.

10864 :(NSArray *)goods onMarket:(OOCommodityMarket *)market
10865{
10867 {
10868 return goods;
10869 }
10870 NSMutableArray *filteredGoods = [NSMutableArray arrayWithCapacity:[goods count]];
10871 OOCommodityType good = nil;
10872 foreach (good, goods)
10873 {
10874 switch (marketFilterMode)
10875 {
10877 // never reached, but keeps compiler happy
10878 [filteredGoods addObject:good];
10879 break;
10881 if ([market quantityForGood:good] > 0 || [self cargoQuantityForType:good] > 0)
10882 {
10883 [filteredGoods addObject:good];
10884 }
10885 break;
10887 if ([self cargoQuantityForType:good] > 0)
10888 {
10889 [filteredGoods addObject:good];
10890 }
10891 break;
10893 if ([market quantityForGood:good] > 0)
10894 {
10895 [filteredGoods addObject:good];
10896 }
10897 break;
10899 if ([market exportLegalityForGood:good] == 0 && [market importLegalityForGood:good] == 0)
10900 {
10901 [filteredGoods addObject:good];
10902 }
10903 break;
10905 if ([market exportLegalityForGood:good] > 0 || [market importLegalityForGood:good] > 0)
10906 {
10907 [filteredGoods addObject:good];
10908 }
10909 break;
10910 }
10911 }
10912 return [[filteredGoods copy] autorelease];
10913}
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

References MARKET_FILTER_MODE_HOLD, MARKET_FILTER_MODE_LEGAL, MARKET_FILTER_MODE_OFF, MARKET_FILTER_MODE_RESTRICTED, MARKET_FILTER_MODE_STOCK, MARKET_FILTER_MODE_TRADE, marketFilterMode, and nil.

Referenced by PlayerEntity(OOControlsPrivate)::pollMarketScreenControls, setGuiToMarketInfoScreen, and setGuiToMarketScreen.

+ Here is the caller graph for this function:

◆ applyMarketSorter:onMarket:

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

Definition at line 10916 of file PlayerEntity.m.

10916 :(NSArray *)goods onMarket:(OOCommodityMarket *)market
10917{
10918 switch (marketSorterMode)
10919 {
10921 return [goods sortedArrayUsingFunction:marketSorterByName context:market];
10923 return [goods sortedArrayUsingFunction:marketSorterByPrice context:market];
10925 return [goods sortedArrayUsingFunction:marketSorterByQuantity context:market];
10927 return [goods sortedArrayUsingFunction:marketSorterByQuantity context:shipCommodityData];
10929 return [goods sortedArrayUsingFunction:marketSorterByMassUnit context:market];
10931 // keep default sort order
10932 break;
10933 }
10934 return goods;
10935}
@ 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

References MARKET_SORTER_MODE_ALPHA, MARKET_SORTER_MODE_HOLD, MARKET_SORTER_MODE_OFF, MARKET_SORTER_MODE_PRICE, MARKET_SORTER_MODE_STOCK, MARKET_SORTER_MODE_UNIT, and marketSorterMode.

Referenced by PlayerEntity(OOControlsPrivate)::pollMarketScreenControls, setGuiToMarketInfoScreen, and setGuiToMarketScreen.

+ Here is the caller graph for this function:

◆ applyRoll:andClimb:

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

Reimplemented from ShipEntity.

Definition at line 4288 of file PlayerEntity.m.

4288 :(GLfloat) roll1 andClimb:(GLfloat) climb1
4289{
4290 if (roll1 == 0.0 && climb1 == 0.0 && hasRotated == NO)
4291 return;
4292
4293 if (roll1)
4295 if (climb1)
4297
4298 /* Bugginess may put us in a state where the orientation quat is all
4299 zeros, at which point it’s impossible to move.
4300 */
4301 if (EXPECT_NOT(quaternion_equal(orientation, kZeroQuaternion)))
4302 {
4303 if (!quaternion_equal(lastOrientation, kZeroQuaternion))
4304 {
4306 }
4307 else
4308 {
4310 }
4311 }
4312
4313 [self orientationChanged];
4314}
#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.m:732
Quaternion lastOrientation
Definition Entity.h:134

References EXPECT_NOT, Entity::hasRotated, kIdentityQuaternion, kZeroQuaternion, Entity::lastOrientation, Entity::orientation, orientationChanged, quaternion_rotate_about_x(), and quaternion_rotate_about_z().

Referenced by applyAttitudeChanges:, and PlayerEntity(OOPrivate)::performInFlightUpdates:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyYaw:

- (void) applyYaw: (GLfloat) yaw

Definition at line 4321 of file PlayerEntity.m.

4321 :(GLfloat) yaw
4322{
4324
4325 [self orientationChanged];
4326}
void quaternion_rotate_about_y(Quaternion *quat, OOScalar angle)

References Entity::orientation, orientationChanged, and quaternion_rotate_about_y().

Referenced by applyAttitudeChanges:, and PlayerEntity(OOPrivate)::performInFlightUpdates:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignToActivePylon:

- (BOOL) assignToActivePylon: (NSString *) identifierKey

Definition at line 6027 of file PlayerEntity.m.

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

References activeMissile, OOEquipmentType::equipmentTypeWithIdentifier:, kOOVariableTechLevel, launchingMissile, ShipEntity::max_missiles, missile_entity, ShipEntity::missile_list, nil, replacingMissile, and selectNextMissile.

+ Here is the call graph for this function:

◆ atHyperspeed

- (BOOL) atHyperspeed

Definition at line 4477 of file PlayerEntity.m.

4478{
4480}
unsigned travelling_at_hyperspeed

References atHyperspeed, and travelling_at_hyperspeed.

Referenced by atHyperspeed, ProxyPlayerEntity::copyValuesFromPlayer:, DustEntity::drawImmediate:translucent:, and massLockable.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autosavePlayer

- (void) autosavePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 145 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:846
NSString * save_path

Referenced by PlayerEntity(OOControlsPrivate)::handleUndockControl.

+ Here is the caller graph for this function:

◆ availableFacings

- (OOWeaponFacingSet) availableFacings

Definition at line 9301 of file PlayerEntity.m.

9302{
9303 OOShipRegistry *registry = [OOShipRegistry sharedRegistry];
9304 NSDictionary *shipyardInfo = [registry shipyardInfoForKey:[self shipDataKey]];
9305 unsigned available_facings = [shipyardInfo oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:[self weaponFacings]]; // use defaults explicitly
9306
9307 return available_facings & VALID_WEAPON_FACINGS;
9308}
#define VALID_WEAPON_FACINGS
Definition OOTypes.h:239
NSDictionary * shipyardInfoForKey:(NSString *key)
OOShipRegistry * sharedRegistry()

References availableFacings, OOShipRegistry::sharedRegistry, ShipEntity::shipDataKey, OOShipRegistry::shipyardInfoForKey:, VALID_WEAPON_FACINGS, and ShipEntity::weaponFacings.

Referenced by availableFacings, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ awardCargo:

- (void) awardCargo: (NSString *) amount_typeString

Provided by category PlayerEntity(Scripting).

Definition at line 1346 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
NSString * specialCargo

◆ awardCommodityType:amount:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 82 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
OOCargoQuantity current_cargo
NSMutableArray * cargo
void setStatus:(OOEntityStatus stat)
OOCargoQuantity maxAvailableCargoSpace()
void setCommodity:andAmount:(OOCommodityType co_type,[andAmount] OOCargoQuantity co_amount)

Referenced by PlayerEntity(Scripting)::awardCargo:.

+ Here is the caller graph for this function:

◆ 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 989 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
NSMutableDictionary * contract_record
OOCommodityMarket * shipCommodityData
OOCargoQuantity availableCargoSpace()

Referenced by PlayerShipAwardContract().

+ Here is the caller graph for this function:

◆ awardCredits:

- (void) awardCredits: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 1223 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}
OOCreditsQuantity credits

◆ awardEquipment:

- (void) awardEquipment: (NSString *) equipString

Provided by category PlayerEntity(Scripting).

Definition at line 1247 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
1256 OOEquipmentType *eqType = [OOEquipmentType equipmentTypeWithIdentifier:equipString];
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 1451 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
void setFuel:(OOFuelQuantity amount)
OOFuelQuantity fuel

◆ awardShipKills:

- (void) awardShipKills: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 1238 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}
unsigned ship_kills

◆ baseMass

- (GLfloat) baseMass

Definition at line 195 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.m:719

References baseMass, Entity::mass, OOLog, and sBaseMass.

Referenced by baseMass, Universe(OOPrivate)::setUpInitialUniverse, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ beginWitchspaceCountdown

- (void) beginWitchspaceCountdown

Provided by category PlayerEntity(Controls).

Definition at line 891 of file PlayerEntityControls.m.

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

◆ beginWitchspaceCountdown:

- (void) beginWitchspaceCountdown: (int) spin_time

Provided by category PlayerEntity(Controls).

Definition at line 856 of file PlayerEntityControls.m.

856 :(int)spin_time
857{
858 if ([self hasHyperspaceMotor])
859 {
860 if (spin_time == 0)
861 {
863 }
864 else
865 {
866#ifndef OO_DUMP_PLANETINFO
867 if (spin_time < 5)
868 {
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}
OOTimeDelta witchspaceCountdown
float hyperspaceMotorSpinTime
Definition ShipEntity.h:247

Referenced by PlayerEntity(Controls)::beginWitchspaceCountdown, PlayerShipBeginHyperspaceCountdown(), and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ blowUpStation

- (void) blowUpStation

Provided by category PlayerEntity(Scripting).

Definition at line 2256 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 199 of file PlayerEntitySound.m.

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

◆ bounty

- (OOCreditsQuantity) bounty
implementation

Reimplemented from ShipEntity.

Definition at line 6824 of file PlayerEntity.m.

6825{
6826 return legalStatus;
6827}

References bounty, and legalStatus.

Referenced by addRoleForAggression:, bounty, doBookkeeping:, docked, launchEscapeCapsule, and leaveDock:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ breakPatternPosition

- (HPVector) breakPatternPosition

Definition at line 4362 of file PlayerEntity.m.

4363{
4364 return HPvector_add(position,vectorToHPVector(quaternion_rotate_vector(quaternion_conjugate(orientation),forwardViewOffset)));
4365}
Vector quaternion_rotate_vector(Quaternion q, Vector v)
HPVector position
Definition Entity.m:612
Vector forwardViewOffset

References breakPatternPosition, forwardViewOffset, Entity::orientation, Entity::position, and quaternion_rotate_vector().

Referenced by breakPatternPosition, customViewDescription, enterDock:, leaveDock:, and leaveWitchspace.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buySelectedItem

- (void) buySelectedItem

Definition at line 10209 of file PlayerEntity.m.

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

References AFT_FACING_STRING, buySelectedItem, chosen_weapon_facing, credits, OOEquipmentType::damagedIdentifier, ShipEntity::doScriptEvent:withArguments:, OOEquipmentType::equipmentTypeWithIdentifier:, FORWARD_FACING_STRING, gui_screen, ShipEntity::hasEquipmentItem:, highlightEquipShipScreenKey:, OOEquipmentType::installTime, nil, playBuyCommodity, playCantBuyCommodity, playMenuNavigationDown, PORT_FACING_STRING, OOEquipmentType::repairTime, GuiDisplayGen::selectedRowKey, GuiDisplayGen::selectedRowText, setGuiToEquipShipScreen:, GuiDisplayGen::setSelectedRow:, ship_clock_adjust, showInformationForSelectedUpgrade, STARBOARD_FACING_STRING, UNIVERSE, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_PORT, and WEAPON_FACING_STARBOARD.

Referenced by buySelectedItem, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buySelectedShip

- (BOOL) buySelectedShip

Provided by category PlayerEntity(Contracts).

Definition at line 1726 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 {
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
1836
1837 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
1838
1839 return YES;
1840}
NSInteger OOGUIRow
#define GUI_ROW_SHIPYARD_INFO_START
@ GUI_ROW_MARKET_CASH
#define PASSENGER_BERTH_SPACE
Definition Universe.h:152
OOColor * colorFromSetting:defaultValue:(NSString *setting,[defaultValue] OOColor *def)
void setText:forRow:(NSString *str,[forRow] OOGUIRow row)
OOGUIRow selectedRow
void setColor:forRow:(OOColor *color,[forRow] OOGUIRow row)
id objectForRow:(OOGUIRow row)
NSString * keyForRow:(OOGUIRow row)
void setArray:forRow:(NSArray *arr,[forRow] OOGUIRow row)
OOColor * greenColor()
Definition OOColor.m:274
OOCargoQuantity max_cargo
Definition ShipEntity.h:295

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ calculateCurrentCargo

- (void) calculateCurrentCargo

Definition at line 10788 of file PlayerEntity.m.

10789{
10790 current_cargo = [self cargoQuantityOnBoard];
10791}

References calculateCurrentCargo, cargoQuantityOnBoard, and current_cargo.

Referenced by PlayerEntity(ScriptMethods)::awardCommodityType:amount:, calculateCurrentCargo, loadCargoPods, PlayerEntity(LoadSave)::loadPlayerFromFile:asNew:, PlayerEntity(Contracts)::processEscapePods, PlayerEntity(Scripting)::removeAllCargo:, roleWeights, setCargoQuantityForType:amount:, tryBuyingCommodity:all:, trySellingCommodity:all:, and unloadCargoPods.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canAddEquipment:inContext:

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

Reimplemented from ShipEntity.

Definition at line 11536 of file PlayerEntity.m.

11536 :(NSString *)equipmentKey inContext:(NSString *)context
11537{
11538 if ([equipmentKey isEqualToString:@"EQ_RENOVATION"] && !(ship_trade_in_factor < 85 || [[[self shipSubEntityEnumerator] allObjects] count] < [self maxShipSubEntities])) return NO;
11539 if (![super canAddEquipment:equipmentKey inContext:context]) return NO;
11540
11541 NSArray *conditions = [[OOEquipmentType equipmentTypeWithIdentifier:equipmentKey] conditions];
11542 if (conditions != nil && ![self scriptTestConditions:conditions]) return NO;
11543
11544 return YES;
11545}
NSEnumerator * shipSubEntityEnumerator()
NSUInteger maxShipSubEntities()
Definition ShipEntity.m:792

References OOEquipmentType::conditions, count, OOEquipmentType::equipmentTypeWithIdentifier:, ShipEntity::maxShipSubEntities, nil, ship_trade_in_factor, and ShipEntity::shipSubEntityEnumerator.

+ Here is the call graph for this function:

◆ cancelDockingRequest:

- (void) cancelDockingRequest: (StationEntity *) stationForDocking

Definition at line 3648 of file PlayerEntity.m.

3648 :(StationEntity *)stationForDocking
3649{
3650 if (stationForDocking == nil) return;
3651 if (![stationForDocking isStation] || ![stationForDocking isKindOfClass:[StationEntity class]]) return;
3652 if ([self isDocked]) return;
3653 if (autopilot_engaged && [self targetStation] == stationForDocking) return;
3654 if (autopilot_engaged && [self targetStation] != stationForDocking)
3655 {
3656 [self disengageAutopilot];
3657 }
3659 {
3660 NSString *stationDockingClearanceStatus = [stationForDocking acceptDockingClearanceRequestFrom:self];
3661 if (stationDockingClearanceStatus != nil && [stationDockingClearanceStatus isEqualToString:@"DOCKING_CLEARANCE_CANCELLED"])
3662 {
3663 [self doScriptEvent:OOJSID("playerDockingClearanceCancelled")];
3664 }
3665 }
3666}
@ DOCKING_CLEARANCE_STATUS_GRANTED
Definition OOTypes.h:171
@ DOCKING_CLEARANCE_STATUS_REQUESTED
Definition OOTypes.h:170
unsigned isStation
Definition Entity.m:143
unsigned autopilot_engaged
OODockingClearanceStatus dockingClearanceStatus
StationEntity * targetStation()
NSString * acceptDockingClearanceRequestFrom:(ShipEntity *other)

References StationEntity::acceptDockingClearanceRequestFrom:, autopilot_engaged, disengageAutopilot, DOCKING_CLEARANCE_STATUS_GRANTED, DOCKING_CLEARANCE_STATUS_REQUESTED, dockingClearanceStatus, ShipEntity::doScriptEvent:, isDocked, Entity::isStation, nil, and ShipEntity::targetStation.

Referenced by PlayerShipCancelDockingRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelWitchspaceCountdown

- (void) cancelWitchspaceCountdown

Provided by category PlayerEntity(Controls).

Definition at line 899 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 engageAutopilotToStation:, PlayerShipCancelHyperspaceCountdown(), and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from ShipEntity.

Definition at line 2477 of file PlayerEntity.m.

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

References canCollide, and Entity::status.

Referenced by canCollide.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canScoop:

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

Reimplemented from ShipEntity.

Definition at line 4981 of file PlayerEntity.m.

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

References ShipEntity::canScoop:, and specialCargo.

+ Here is the call graph for this function:

◆ cargoContractMarker:

- (NSDictionary *) cargoContractMarker: (OOSystemID) system

Provided by category PlayerEntity(ScriptMethods).

Definition at line 300 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

Referenced by markedDestinations.

+ Here is the caller graph for this function:

◆ cargoList

- (NSArray *) cargoList

Definition at line 8349 of file PlayerEntity.m.

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

References cargoList, cargoListForScripting, nil, and specialCargo.

Referenced by cargoList, roleWeights, PlayerEntity(Contracts)::setGuiToManifestScreen, and setUpAndConfirmOK:saveGame:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cargoListForScripting

- (NSArray *) cargoListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 8377 of file PlayerEntity.m.

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

References cargoListForScripting, ShipEntity::commodityAmount, ShipEntity::commodityType, OOCommodityMarket::count, OOCommodityMarket::goods, OOCommodityMarket::nameForGood:, and OOCommodityMarket::quantityForGood:.

Referenced by cargoList, cargoListForScripting, and ManifestGetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cargoQuantityForType:

- (OOCargoQuantity) cargoQuantityForType: (OOCommodityType) type

Definition at line 10714 of file PlayerEntity.m.

10714 :(OOCommodityType)type
10715{
10716 OOCargoQuantity amount = [shipCommodityData quantityForGood:type];
10717
10718 if ([self status] != STATUS_DOCKED)
10719 {
10720 NSInteger i;
10721 OOCommodityType co_type;
10722 ShipEntity *cargoItem = nil;
10723
10724 for (i = [cargo count] - 1; i >= 0 ; i--)
10725 {
10726 cargoItem = [cargo objectAtIndex:i];
10727 co_type = [cargoItem commodityType];
10728 if ([co_type isEqualToString:type])
10729 {
10730 amount += [cargoItem commodityAmount];
10731 }
10732 }
10733 }
10734
10735 return amount;
10736}

References ShipEntity::cargo, ShipEntity::commodityAmount, ShipEntity::commodityType, count, nil, OOCommodityMarket::quantityForGood:, and Entity::status.

Referenced by setCargoQuantityForType:amount:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cargoQuantityOnBoard

- (OOCargoQuantity) cargoQuantityOnBoard
implementation

Reimplemented from ShipEntity.

Definition at line 10794 of file PlayerEntity.m.

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

References ShipEntity::cargo, cargoQuantityOnBoard, GRAMS_PER_POD, KILOGRAMS_PER_POD, OOCommodityMarket::massUnitForGood:, MAX_GRAMS_IN_SAFE, MAX_KILOGRAMS_IN_SAFE, ShipEntity::maxAvailableCargoSpace, nil, OOCommodityMarket::quantityForGood:, shipCommodityData, specialCargo, UNITS_KILOGRAMS, and UNITS_TONS.

Referenced by PlayerEntity(Contracts)::awardContract:commodity:start:destination:eta:fee:premium:, calculateCurrentCargo, cargoQuantityOnBoard, setCommanderDataFromDictionary:, PlayerEntity(Contracts)::setGuiToManifestScreen, and setGuiToMarketScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changePassengerBerths:

- (BOOL) changePassengerBerths: (int) addRemove

Definition at line 10666 of file PlayerEntity.m.

10666 :(int) addRemove
10667{
10668 if (addRemove == 0) return NO;
10669 addRemove = (addRemove > 0) ? 1 : -1; // change only by one berth at a time!
10670 // NSFO!
10671 //unsigned passenger_space = [[OOEquipmentType equipmentTypeWithIdentifier:@"EQ_PASSENGER_BERTH"] requiredCargoSpace];
10672 //if (passenger_space == 0) passenger_space = PASSENGER_BERTH_SPACE;
10673 if ((max_passengers < 1 && addRemove == -1) || ([self maxAvailableCargoSpace] - current_cargo < PASSENGER_BERTH_SPACE && addRemove == 1)) return NO;
10674 max_passengers += addRemove;
10675 max_cargo -= PASSENGER_BERTH_SPACE * addRemove;
10676 return YES;
10677}

References current_cargo, ShipEntity::max_cargo, max_passengers, ShipEntity::maxAvailableCargoSpace, and PASSENGER_BERTH_SPACE.

Referenced by ShipAwardEquipment(), ShipRemoveEquipment(), and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chart_centre_coordinates

- (NSPoint) chart_centre_coordinates

◆ chart_zoom

- (OOScalar) chart_zoom

References chart_zoom.

◆ checkCustomEquipButtons:ignore:

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

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 316 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

References STICK_AXBUT, and STICK_NUMBER.

Referenced by PlayerEntity(StickMapper)::updateFunction:.

+ Here is the caller graph for this function:

◆ checkEntityForMassLock:withScanClass:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 3362 of file PlayerEntity.m.

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

References Entity::collision_radius, EXPECT, EXPECT_NOT, ShipEntity::isCloaked, Entity::isShip, Entity::isSun, SCANNER_MAX_RANGE2, STELLAR_TYPE_MINIATURE, and Entity::zero_distance.

Referenced by PlayerEntity(OOPrivate)::updateAlertConditionForNearbyEntities.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkForShips:

- (void) checkForShips: (NSString *) roleString

Provided by category PlayerEntity(Scripting).

Definition at line 1887 of file PlayerEntityLegacyScriptEngine.m.

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

◆ checkKeyPress:

◆ checkKeyPress:fKey_only:

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

Provided by category PlayerEntity(Controls).

Definition at line 619 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 631 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

Referenced by PlayerEntity(Controls)::checkKeyPress:, PlayerEntity(Controls)::checkKeyPress:fKey_only:, and PlayerEntity(Controls)::checkKeyPress:ignore_ctrl:.

+ Here is the caller graph for this function:

◆ checkKeyPress:ignore_ctrl:

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

Provided by category PlayerEntity(Controls).

Definition at line 625 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 600 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 167 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
StationEntity * dockedStation()
double ship_clock
OOSystemID system_id
float randf(void)

Referenced by docked.

+ Here is the caller graph for this function:

◆ checkScript

- (void) checkScript

Provided by category PlayerEntity(Scripting).

Definition at line 302 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 {
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)
NSString * name

Referenced by PlayerEntity(OOPrivate)::checkScriptsIfAppropriate, docked, PlayerEntity(OOPrivate)::performLaunchingUpdates:, PlayerEntity(OOPrivate)::performWitchspaceExitUpdates:, PlayerEntity(OOControlsPrivate)::pollDemoControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, ShipEntity(PureAI)::scriptActionOnTarget:, and setGuiToSystemDataScreenRefreshBackground:.

+ Here is the caller graph for this function:

◆ checkScriptsIfAppropriate

- (void) checkScriptsIfAppropriate
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3546 of file PlayerEntity.m.

3547{
3548 if (script_time <= script_time_check) return;
3549
3550 if ([self status] != STATUS_IN_FLIGHT)
3551 {
3552 switch (gui_screen)
3553 {
3554 // Screens where no world script tickles are performed
3555 case GUI_SCREEN_MAIN:
3556 case GUI_SCREEN_INTRO1:
3557 case GUI_SCREEN_SHIPLIBRARY:
3558 case GUI_SCREEN_KEYBOARD:
3559 case GUI_SCREEN_NEWGAME:
3560 case GUI_SCREEN_OXZMANAGER:
3561 case GUI_SCREEN_MARKET:
3562 case GUI_SCREEN_MARKETINFO:
3563 case GUI_SCREEN_OPTIONS:
3564 case GUI_SCREEN_GAMEOPTIONS:
3565 case GUI_SCREEN_LOAD:
3566 case GUI_SCREEN_SAVE:
3567 case GUI_SCREEN_SAVE_OVERWRITE:
3568 case GUI_SCREEN_STICKMAPPER:
3569 case GUI_SCREEN_STICKPROFILE:
3570 case GUI_SCREEN_MISSION:
3571 case GUI_SCREEN_REPORT:
3572 case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
3573 case GUI_SCREEN_KEYBOARD_CONFIG:
3574 case GUI_SCREEN_KEYBOARD_ENTRY:
3575 case GUI_SCREEN_KEYBOARD_LAYOUT:
3576 return;
3577
3578 // Screens from which it's safe to jump to the mission screen
3579// case GUI_SCREEN_CONTRACTS:
3580 case GUI_SCREEN_EQUIP_SHIP:
3581 case GUI_SCREEN_INTERFACES:
3582 case GUI_SCREEN_MANIFEST:
3583 case GUI_SCREEN_SHIPYARD:
3584 case GUI_SCREEN_LONG_RANGE_CHART:
3585 case GUI_SCREEN_SHORT_RANGE_CHART:
3586 case GUI_SCREEN_STATUS:
3587 case GUI_SCREEN_SYSTEM_DATA:
3588 // Test passed, we can run scripts. Nothing to do here.
3589 break;
3590 }
3591 }
3592
3593 // Test either passed or never ran, run scripts.
3594 [self checkScript];
3596}
double script_time_check
double script_time
double script_time_interval

References checkScript, and PlayerEntity(OOPrivate)::checkScriptsIfAppropriate.

Referenced by PlayerEntity(OOPrivate)::checkScriptsIfAppropriate, PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, and update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearAlertFlags

- (void) clearAlertFlags

Definition at line 5793 of file PlayerEntity.m.

5794{
5795 alertFlags = 0;
5796}
OOAlertFlags alertFlags

References alertFlags, and clearAlertFlags.

Referenced by clearAlertFlags, leaveDock:, specialCargo, and PlayerEntity(OOPrivate)::updateAlertConditionForNearbyEntities.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearedToDock

- (BOOL) clearedToDock

Definition at line 13172 of file PlayerEntity.m.

References clearedToDock, DOCKING_CLEARANCE_STATUS_NOT_REQUIRED, DOCKING_CLEARANCE_STATUS_REQUESTED, and dockingClearanceStatus.

Referenced by clearedToDock, docked, penaltyForUnauthorizedDocking, and scoopOverride.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearExtraGuiScreenKeys:key:

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

Definition at line 13397 of file PlayerEntity.m.

13397 :(OOGUIScreenID)gui key:(NSString *)key
13398{
13399 NSMutableArray *keydefs = [extraGuiScreenKeys objectForKey:[NSString stringWithFormat:@"%d",gui]];
13400 NSInteger i = [keydefs count];
13401 NSDictionary *def = nil;
13402 while (i--)
13403 {
13404 def = [keydefs objectAtIndex:i];
13405 if (def && [[def oo_stringForKey:@"name"] isEqualToString:key])
13406 {
13407 [keydefs removeObjectAtIndex:i];
13408 break;
13409 }
13410 }
13411 // do we have to put the array back, or does the reference update the source?
13412}
OOGUIScreenID

References nil.

Referenced by GlobalClearExtraGuiScreenKeys().

+ Here is the caller graph for this function:

◆ clearExtraMissionKeys

- (void) clearExtraMissionKeys

Definition at line 13377 of file PlayerEntity.m.

13378{
13379 [extraMissionKeys release];
13381}
NSDictionary * extraMissionKeys

References clearExtraMissionKeys, extraMissionKeys, and nil.

Referenced by clearExtraMissionKeys, customViewDescription, and MissionRunScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearMissionDescription

- (void) clearMissionDescription

Provided by category PlayerEntity(Scripting).

Definition at line 887 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clearMissionDescriptionForMission:

- (void) clearMissionDescriptionForMission: (NSString *) key

Provided by category PlayerEntity(Scripting).

Definition at line 893 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
NSMutableDictionary * mission_variables

Referenced by PlayerEntity(Scripting)::clearMissionDescription, and MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ clearMissionScreen

- (void) clearMissionScreen

Provided by category PlayerEntity(Scripting).

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

2448{
2449 [_missionScreenID release];
2451}
NSString * _missionScreenID

Referenced by PlayerEntity(Scripting)::endMissionScreenAndNoteOpportunity, and MissionRunScreen().

+ Here is the caller graph for this function:

◆ clearPlanetSearchString

- (void) clearPlanetSearchString

Provided by category PlayerEntity(Controls).

Definition at line 819 of file PlayerEntityControls.m.

820{
821 [[UNIVERSE gameView] resetTypedString];
822 if (planetSearchString) [planetSearchString release];
824}
NSString * planetSearchString

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and PlayerEntity(Controls)::targetNewSystem:whileTyping:.

+ Here is the caller graph for this function:

◆ clearRoleFromPlayer:

- (void) clearRoleFromPlayer: (BOOL) includingLongRange

Definition at line 5120 of file PlayerEntity.m.

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

References randf(), and Ranrot().

Referenced by leaveWitchspace.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearRolesFromPlayer:

- (void) clearRolesFromPlayer: (float) chance

Definition at line 5136 of file PlayerEntity.m.

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

References count, and randf().

Referenced by enterGalacticWitchspace, launchEscapeCapsule, and PlayerEntity(Contracts)::newShipCommonSetup:yardInfo:baseInfo:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearTargetMemory

- (void) clearTargetMemory

Definition at line 12341 of file PlayerEntity.m.

12342{
12343 NSUInteger memoryCount = [target_memory count];
12344 for (NSUInteger i = 0; i < PLAYER_TARGET_MEMORY_SIZE; i++)
12345 {
12346 if (i < memoryCount)
12347 {
12348 [target_memory replaceObjectAtIndex:i withObject:[NSNull null]];
12349 }
12350 else
12351 {
12352 [target_memory addObject:[NSNull null]];
12353 }
12354 }
12356}

References clearTargetMemory, PLAYER_TARGET_MEMORY_SIZE, and target_memory_index.

Referenced by clearTargetMemory, enterDock:, leaveDock:, leaveWitchspace, setUpAndConfirmOK:saveGame:, and suppressTargetLost.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clock_days_number

- (NSNumber *) clock_days_number

Provided by category PlayerEntity(Scripting).

Definition at line 1030 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 1024 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 1018 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 1006 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 1012 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clockAdjusting

- (BOOL) clockAdjusting

Definition at line 4896 of file PlayerEntity.m.

4897{
4898 return ship_clock_adjust > 0;
4899}

References clockAdjusting, and ship_clock_adjust.

Referenced by clockAdjusting, and hyperspeedFactor.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clockTime

- (double) clockTime

Definition at line 4884 of file PlayerEntity.m.

4885{
4886 return ship_clock;
4887}

References clockTime, and ship_clock.

Referenced by StationEntity::acceptDockingClearanceRequestFrom:, ClockGetProperty(), clockTime, hyperspeedFactor, and StationEntity::update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clockTimeAdjusted

- (double) clockTimeAdjusted

Definition at line 4890 of file PlayerEntity.m.

4891{
4893}

References clockTimeAdjusted, ship_clock, and ship_clock_adjust.

Referenced by addScannedWormhole:, clockTimeAdjusted, HeadUpDisplay::hudDrawReticleOnTarget, hyperspeedFactor, WormholeEntity::update:, PlayerEntity(OOPrivate)::updateTargeting, and PlayerEntity(OOPrivate)::updateWormholes.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ collectBountyFor:

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

Reimplemented from ShipEntity.

Definition at line 6864 of file PlayerEntity.m.

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

References ShipEntity::bounty, ShipEntity::commodityAmount, ShipEntity::countsAsKill, credits, ShipEntity::isCloaked, ShipEntity::isHulk, ShipEntity::isPolice, Entity::isSubEntity, markAsOffender:withReason:, nil, OOExpandKey, ShipEntity::scanClass, score, ship_kills, Entity::status, and UNIVERSE.

+ Here is the call graph for this function:

◆ commanderBountyAsString

- (NSString *) commanderBountyAsString

Provided by category PlayerEntity(ScriptMethods).

Definition at line 367 of file PlayerEntityScriptMethods.m.

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

◆ commanderDataDictionary

- (NSDictionary *) commanderDataDictionary

Definition at line 913 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
NSString * scenarioKey
HeadUpDisplay * hud
OOSystemID found_system_id
OOCommodityMarket * localMarket()
NSString * shipDataKey()
unsigned missiles
Definition ShipEntity.h:319
OOWeaponType aft_weapon_type
Definition ShipEntity.h:306
NSEnumerator * equipmentEnumerator()
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_)

References ShipEntity::aft_weapon_type, clear_checksum(), commanderDataDictionary, commanderName, commLog, count, ShipEntity::countEquipmentItem:, credits, currentSystemID, dockedStation, eqScripts, ShipEntity::equipmentEnumerator, escapePodRescueTime, fastEquipmentA, fastEquipmentB, ShipEntity::forward_weapon_type, found_system_id, ShipEntity::fuel, galaxy_coordinates, WormholeEntity::getDict, hud, OOEquipmentType::identifier, int(), lastsaveName, legalStatus, localMarket, market_rnd, ShipEntity::max_cargo, MAX_CONTRACT_REP, ShipEntity::max_missiles, missile_entity, ShipEntity::missiles, mission_variables, munge_checksum(), nil, ShipEntity::port_weapon_type, Entity::position, ShipEntity::primaryRole, primedEquipment, OOCommodityMarket::savePlayerAmounts, HeadUpDisplay::scannerZoom, scenarioKey, ShipEntity::serializeShipSubEntities, OOCache::setObject:forKey:, ship_kills, ShipEntity::shipClassName, ShipEntity::shipDataKey, ShipEntity::shipInfoDictionary, ShipEntity::shipUniqueName, specialCargo, ShipEntity::starboard_weapon_type, trumbleValue, UNIVERSE, and weaponsOnline.

Referenced by PlayerEntity(Contracts)::buySelectedShip, commanderDataDictionary, custom_chart_zoom, renovationCosts, PlayerEntity(Contracts)::replaceShipWithNamedShip:, PlayerEntity(ContractsPrivate)::tradeInValue, and PlayerEntity(OOLoadSavePrivate)::writePlayerToPath:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ commanderKillsAsString

- (NSString *) commanderKillsAsString

Provided by category PlayerEntity(ScriptMethods).

Definition at line 374 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 962 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 974 of file PlayerEntityLegacyScriptEngine.m.

975{
977}
NSString * OODisplayStringFromLegalStatus(int legalStatus)

◆ commanderName

- (NSString *) commanderName

Definition at line 13083 of file PlayerEntity.m.

13084{
13085 return _commanderName;
13086}
NSString * _commanderName

References _commanderName, and commanderName.

Referenced by commanderDataDictionary, commanderName, PlayerEntity(Scripting)::commanderName_string, PlayerEntity(OOEntityInspectorExtensions)::inspSecondaryIdentityLine, PlayerGetProperty(), setGuiToGameOptionsScreen, setGuiToLoadSaveScreen, setGuiToStatusScreen, setTrumbleValueFrom:, setUpTrumbles, and trumbleValue.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ commanderName_string

- (NSString *) commanderName_string

Provided by category PlayerEntity(Scripting).

Definition at line 1155 of file PlayerEntityLegacyScriptEngine.m.

1156{
1157 return [self commanderName];
1158}

◆ commanderRank_string

- (NSString *) commanderRank_string

Provided by category PlayerEntity(Scripting).

Definition at line 1161 of file PlayerEntityLegacyScriptEngine.m.

1162{
1164}
NSString * OODisplayRatingStringFromKillCount(unsigned kills)

◆ commanderSelector

- (NSString *) commanderSelector

Provided by category PlayerEntity(LoadSave).

Definition at line 362 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()
NSArray * n_key_gui_arrow_right
NSArray * n_key_gui_select
NSArray * n_key_gui_page_up
NSArray * n_key_gui_arrow_left
NSArray * n_key_gui_page_down

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ commanderShip_string

- (NSString *) commanderShip_string

Provided by category PlayerEntity(Scripting).

Definition at line 1167 of file PlayerEntityLegacyScriptEngine.m.

1168{
1169 return [self name];
1170}

◆ commanderShipDisplayName_string

- (NSString *) commanderShipDisplayName_string

Provided by category PlayerEntity(Scripting).

Definition at line 1173 of file PlayerEntityLegacyScriptEngine.m.

1174{
1175 return [self displayName];
1176}

◆ commLog

- (NSMutableArray *) commLog

References commLog.

◆ commodityScriptNamed:

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

Definition at line 12899 of file PlayerEntity.m.

12899 :(NSString *)scriptName
12900{
12901 if (scriptName == nil)
12902 {
12903 return nil;
12904 }
12905 OOScript *cscript = nil;
12906 if ((cscript = [commodityScripts objectForKey:scriptName]))
12907 {
12908 return cscript;
12909 }
12910 cscript = [OOScript jsScriptFromFileNamed:scriptName properties:nil];
12911 if (cscript != nil)
12912 {
12913 // storing it in here retains it
12914 [commodityScripts setObject:cscript forKey:scriptName];
12915 }
12916 else
12917 {
12918 OOLog(@"script.commodityScript.load",@"Could not load script %@",scriptName);
12919 }
12920 return cscript;
12921}
NSMutableDictionary * commodityScripts

References commodityScripts, OOScript::jsScriptFromFileNamed:properties:, nil, and OOLog.

+ Here is the call graph for this function:

◆ commsMessage:

- (void) commsMessage: (NSString *) valueString

Reimplemented from ShipEntity.

Provided by category PlayerEntity(Scripting).

Definition at line 1196 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by PlayerEntity(Scripting)::commsMessageByUnpiloted:.

+ Here is the caller graph for this function:

◆ commsMessageByUnpiloted:

- (void) commsMessageByUnpiloted: (NSString *) valueString

Reimplemented from ShipEntity.

Provided by category PlayerEntity(Scripting).

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

2494 :(Entity *)otherEntity
2495{
2496 return NSOrderedDescending; // always the most near
2497}

◆ compassMode

- (OOCompassMode) compassMode

References compassMode, setNextCompassMode, and setPrevCompassMode.

+ Here is the call graph for this function:

◆ compassTarget

- (Entity *) compassTarget

References compassTarget, compassTargetLabel, and validateCompassTarget.

+ Here is the call graph for this function:

◆ compassTargetLabel

- (NSString *) compassTargetLabel

Definition at line 5278 of file PlayerEntity.m.

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

References compassMode, compassTarget, compassTargetLabel, and DESC.

Referenced by compassTarget, and compassTargetLabel.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ completeSetUp

- (void) completeSetUp

Definition at line 2252 of file PlayerEntity.m.

2253{
2254 [self completeSetUpAndSetTarget:YES];
2255}

References completeSetUp, and completeSetUpAndSetTarget:.

Referenced by completeSetUp, Universe::initWithGameView:, and Universe::reinitAndShowDemo:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ completeSetUpAndSetTarget:

- (void) completeSetUpAndSetTarget: (BOOL) setTarget

Definition at line 2258 of file PlayerEntity.m.

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

References doWorldScriptEvent:inContext:withArguments:count:timeLimit:, OOJSAcquireContext(), OOJSRelinquishContext(), setDockedStation:, ShipEntity::setLastAegisLock:, OOSoundSource::stopAll, and validateCustomEquipActivationArray.

Referenced by completeSetUp, and PlayerEntity(LoadSave)::loadPlayerFromFile:asNew:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ consoleMessage3s:

- (void) consoleMessage3s: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 1211 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 1217 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 497 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}

Referenced by setGuiToMarketInfoScreen, tryBuyingCommodity:all:, and trySellingCommodity:all:.

+ Here is the caller graph for this function:

◆ contractList

- (NSArray *) contractList

Provided by category PlayerEntity(Contracts).

Definition at line 1095 of file PlayerEntityContracts.m.

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

Referenced by PlayerEntity(Scripting)::missionsList.

+ Here is the caller graph for this function:

◆ contractListForScripting

- (NSArray *) contractListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 8491 of file PlayerEntity.m.

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

References contractListForScripting, and contractsListForScriptingFromArray:forCargo:.

Referenced by contractListForScripting.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contractReputation

- (int) contractReputation

Provided by category PlayerEntity(Contracts).

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

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

Referenced by contractListForScripting, parcelListForScripting, and passengerListForScripting.

+ Here is the caller graph for this function:

◆ contractsListFromArray:forCargo:forParcels:

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

Provided by category PlayerEntity(ContractsPrivate).

Definition at line 1101 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)

References OOIntCredits().

Referenced by PlayerEntity(Contracts)::contractList, PlayerEntity(Contracts)::parcelList, and PlayerEntity(Contracts)::passengerList.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ countMissiles

- (unsigned) countMissiles

Definition at line 4949 of file PlayerEntity.m.

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

References countMissiles, ShipEntity::max_missiles, and missile_entity.

Referenced by countMissiles, setGuiToEquipShipScreen:selectingFacingFor:, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createCargoPodWithType:andAmount:

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

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

References OOLogERR, ShipEntity::setCommodity:andAmount:, Entity::setScanClass:, and ShipEntity::setStatus:.

Referenced by loadCargoPodsForType:fromManifest:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createDoppelganger

- (ProxyPlayerEntity *) createDoppelganger
implementation

Definition at line 6575 of file PlayerEntity.m.

6576{
6577 ProxyPlayerEntity *result = (ProxyPlayerEntity *)[[UNIVERSE newShipWithName:[self shipDataKey] usePlayerProxy:YES] autorelease];
6578
6579 if (result != nil)
6580 {
6581 [result setPosition:[self position]];
6582 [result setScanClass:CLASS_NEUTRAL];
6583 [result setOrientation:[self normalOrientation]];
6584 [result setVelocity:[self velocity]];
6585 [result setSpeed:[self flightSpeed]];
6586 [result setDesiredSpeed:[self flightSpeed]];
6587 [result setRoll:flightRoll];
6588 [result setBehaviour:BEHAVIOUR_IDLE];
6589 [result switchAITo:@"nullAI.plist"]; // fly straight on
6590 [result setTemperature:[self temperature]];
6591 [result copyValuesFromPlayer:self];
6592 }
6593
6594 return result;
6595}
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)

References createDoppelganger, ShipEntity::flightSpeed, nil, normalOrientation, Entity::position, Entity::setOrientation:, Entity::setPosition:, Entity::setScanClass:, Entity::setVelocity:, ShipEntity::shipDataKey, ShipEntity::temperature, UNIVERSE, and ShipEntity::velocity.

Referenced by createDoppelganger, and launchEscapeCapsule.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ creditBalance

- (double) creditBalance

Provided by category PlayerEntity(ScriptMethods).

Definition at line 52 of file PlayerEntityScriptMethods.m.

53{
54 return 0.1 * credits;
55}

Referenced by PlayerEntity(Scripting)::credits_number.

+ Here is the caller graph for this function:

◆ credits_number

- (NSNumber *) credits_number

Provided by category PlayerEntity(Scripting).

Definition at line 943 of file PlayerEntityLegacyScriptEngine.m.

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

◆ creditsFormattedForLegacySubstitution

- (NSString *) creditsFormattedForLegacySubstitution

Provided by category PlayerEntity(ScriptMethods).

Definition at line 356 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 344 of file PlayerEntityScriptMethods.m.

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

◆ currentGalaxyID

- (OOGalaxyID) currentGalaxyID

Provided by category PlayerEntity(ScriptMethods).

Definition at line 178 of file PlayerEntityScriptMethods.m.

179{
180 return galaxy_number;
181}
OOGalaxyID galaxy_number

Referenced by PlayerEntity(Scripting)::galaxy_number, SystemSetProperty(), and SystemToString().

+ Here is the caller graph for this function:

◆ currentLaserOffset

- (NSArray *) currentLaserOffset

Definition at line 6182 of file PlayerEntity.m.

6183{
6184 return [self laserPortOffset:currentWeaponFacing];
6185}

References currentLaserOffset, and ShipEntity::laserPortOffset:.

Referenced by alertCondition, currentLaserOffset, fireMainWeapon, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ currentPrimedEquipment

- (NSString *) currentPrimedEquipment

Definition at line 8225 of file PlayerEntity.m.

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

References currentPrimedEquipment, and primedEquipment.

Referenced by currentPrimedEquipment, PlayerShipGetProperty(), and roleWeights.

+ Here is the call graph for this function:
+ 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 184 of file PlayerEntityScriptMethods.m.

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

Referenced by commanderDataDictionary, enterGalacticWitchspace, enterWitchspace, enterWormhole:, leaveWitchspace, PlayerEntity(Scripting)::planet_number, Universe::setUpUniverseFromStation, SystemSetProperty(), SystemToString(), and updateSystemMemory.

+ Here is the caller graph for this function:

◆ currentWeapon

- (OOWeaponType) currentWeapon

Definition at line 6300 of file PlayerEntity.m.

6301{
6302 return [self weaponForFacing:currentWeaponFacing];
6303}

References currentWeapon, and weaponForFacing:.

Referenced by alertCondition, currentWeapon, currentWeaponStats, fireMainWeapon, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ currentWeaponStats

- (void) currentWeaponStats

Definition at line 6159 of file PlayerEntity.m.

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

References currentWeapon, currentWeaponStats, and ShipEntity::setWeaponDataFromType:.

Referenced by currentWeaponStats, fireMainWeapon, leaveDock:, setUpAndConfirmOK:saveGame:, showDemoShips, PlayerEntity(OOControlsPrivate)::switchToThisView:fromView:andProcessWeaponFacing:justNotify:, and PlayerEntity(OOPrivate)::witchStart.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cursor_coordinates

- (NSPoint) cursor_coordinates

References cursor_coordinates.

◆ custom_chart_centre_coordinates

- (NSPoint) custom_chart_centre_coordinates

◆ custom_chart_zoom

- (OOScalar) custom_chart_zoom

References adjusted_chart_centre, ANAMode, commanderDataDictionary, custom_chart_zoom, homeInfoSystem, infoSystemID, infoSystemOnRoute, jumpCause, nextHopTargetSystemID, nextInfoSystem, previousInfoSystem, previousSystemID, systemID, targetInfoSystem, targetSystemID, and validateCustomEquipActivationArray.

+ Here is the call graph for this function:

◆ customEquipmentActivation

- (NSMutableArray *) customEquipmentActivation

Definition at line 11590 of file PlayerEntity.m.

11591{
11592 return customEquipActivation;
11593}
NSMutableArray * customEquipActivation

References customEquipActivation, and customEquipmentActivation.

Referenced by customEquipmentActivation, and hyperspeedFactor.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewDescription

◆ customViewForwardVector

- (Vector) customViewForwardVector

◆ customViewMatrix

- (OOMatrix) customViewMatrix

References customViewMatrix.

◆ customViewOffset

- (Vector) customViewOffset

References customViewOffset.

◆ customViewPanDown:

- (void) customViewPanDown: (OOScalar) angle

Definition at line 12579 of file PlayerEntity.m.

12579 :(OOScalar) angle
12580{
12582 [self setCustomViewData];
12583 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12584}
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

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRightVector, customViewRotationCenter, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewPanLeft:

- (void) customViewPanLeft: (OOScalar) angle

Definition at line 12587 of file PlayerEntity.m.

12587 :(OOScalar) angle
12588{
12590 [self setCustomViewData];
12591 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12592}
Vector customViewUpVector

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRotationCenter, customViewUpVector, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewPanRight:

- (void) customViewPanRight: (OOScalar) angle

Definition at line 12595 of file PlayerEntity.m.

12595 :(OOScalar) angle
12596{
12598 [self setCustomViewData];
12599 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12600}

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRotationCenter, customViewUpVector, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewPanUp:

- (void) customViewPanUp: (OOScalar) angle

Definition at line 12571 of file PlayerEntity.m.

12571 :(OOScalar) angle
12572{
12574 [self setCustomViewData];
12575 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12576}

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRightVector, customViewRotationCenter, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewQuaternion

- (Quaternion) customViewQuaternion

References customViewQuaternion.

◆ customViewRightVector

- (Vector) customViewRightVector

References customViewRightVector.

◆ customViewRollLeft:

- (void) customViewRollLeft: (OOScalar) angle

Definition at line 12559 of file PlayerEntity.m.

12559 :(OOScalar) angle
12560{
12562 OOScalar m = magnitude(customViewOffset);
12564 [self setCustomViewData];
12566 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12568}

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRotationCenter, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewRollRight:

- (void) customViewRollRight: (OOScalar) angle

Definition at line 12547 of file PlayerEntity.m.

12547 :(OOScalar) angle
12548{
12550 OOScalar m = magnitude(customViewOffset);
12552 [self setCustomViewData];
12554 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12556}

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRotationCenter, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewRotateDown:

- (void) customViewRotateDown: (OOScalar) angle

Definition at line 12535 of file PlayerEntity.m.

12535 :(OOScalar) angle
12536{
12538 OOScalar m = magnitude(customViewOffset);
12540 [self setCustomViewData];
12542 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12544}

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRightVector, customViewRotationCenter, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewRotateLeft:

- (void) customViewRotateLeft: (OOScalar) angle

Definition at line 12499 of file PlayerEntity.m.

12499 :(OOScalar) angle
12500{
12502 OOScalar m = magnitude(customViewOffset);
12504 [self setCustomViewData];
12506 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12508}

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRotationCenter, customViewUpVector, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewRotateRight:

- (void) customViewRotateRight: (OOScalar) angle

Definition at line 12511 of file PlayerEntity.m.

12511 :(OOScalar) angle
12512{
12514 OOScalar m = magnitude(customViewOffset);
12516 [self setCustomViewData];
12518 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12520}

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRotationCenter, customViewUpVector, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewRotateUp:

- (void) customViewRotateUp: (OOScalar) angle

Definition at line 12523 of file PlayerEntity.m.

12523 :(OOScalar) angle
12524{
12526 OOScalar m = magnitude(customViewOffset);
12528 [self setCustomViewData];
12530 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12532}

References customViewForwardVector, customViewOffset, customViewQuaternion, customViewRightVector, customViewRotationCenter, quaternion_rotate_about_axis(), and setCustomViewData.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ customViewRotationCenter

- (Vector) customViewRotationCenter

◆ customViewUpVector

- (Vector) customViewUpVector

References customViewUpVector.

◆ customViewZoomIn:

- (void) customViewZoomIn: (OOScalar) rate

Definition at line 12473 of file PlayerEntity.m.

12473 :(OOScalar) rate
12474{
12476 customViewOffset = vector_multiply_scalar(customViewOffset, 1.0/rate);
12477 OOScalar m = magnitude(customViewOffset);
12479 {
12481 }
12483}
#define CUSTOM_VIEW_MAX_ZOOM_IN

References Entity::collision_radius, CUSTOM_VIEW_MAX_ZOOM_IN, customViewOffset, and customViewRotationCenter.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the caller graph for this function:

◆ customViewZoomOut:

- (void) customViewZoomOut: (OOScalar) rate

Definition at line 12486 of file PlayerEntity.m.

12486 :(OOScalar) rate
12487{
12489 customViewOffset = vector_multiply_scalar(customViewOffset, rate);
12490 OOScalar m = magnitude(customViewOffset);
12492 {
12494 }
12496}
#define CUSTOM_VIEW_MAX_ZOOM_OUT

References Entity::collision_radius, CUSTOM_VIEW_MAX_ZOOM_OUT, customViewOffset, and customViewRotationCenter.

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls.

+ Here is the caller graph for this function:

◆ cycleNextMultiFunctionDisplay:

- (void) cycleNextMultiFunctionDisplay: (NSUInteger) index

Definition at line 5576 of file PlayerEntity.m.

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

References activeMFD, count, hud, nil, OOJSAcquireContext(), OOJSRelinquishContext(), OOJSValueFromNativeObject(), setMultiFunctionDisplay:toKey:, and ShipScriptEvent.

Referenced by PlayerEntity(OOControlsPrivate)::pollViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cyclePreviousMultiFunctionDisplay:

- (void) cyclePreviousMultiFunctionDisplay: (NSUInteger) index

Definition at line 5613 of file PlayerEntity.m.

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

References activeMFD, count, hud, nil, OOJSAcquireContext(), OOJSRelinquishContext(), OOJSValueFromNativeObject(), setMultiFunctionDisplay:toKey:, and ShipScriptEvent.

Referenced by PlayerEntity(OOControlsPrivate)::pollViewControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ d100_number

- (NSNumber *) d100_number

Provided by category PlayerEntity(Scripting).

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

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

References deactivateCloakingDevice, ShipEntity::deactivateCloakingDevice, ShipEntity::hasCloakingDevice, and playCloakingDeviceOff.

Referenced by alertCondition, deactivateCloakingDevice, doBookkeeping:, fireMainWeapon, and fireMissile.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dealloc

- (void) dealloc
implementation

Reimplemented from ShipEntity.

Definition at line 2379 of file PlayerEntity.m.

2380{
2382 DESTROY(hud);
2386
2390
2393
2399
2401
2403
2417
2421
2425
2427
2430
2433
2435
2437
2438 [self destroySound];
2439
2442
2443 int i;
2444 for (i = 0; i < PLAYER_MAX_MISSILES; i++) DESTROY(missile_entity[i]);
2445 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++) DESTROY(trumble[i]);
2446
2453
2457
2459
2460 [super dealloc];
2461}
#define DESTROY(x)
Definition OOCocoa.h:77
#define PLAYER_MAX_MISSILES
NSMutableDictionary * roleWeightFlags
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
NSString * _lastsaveName
NSMutableArray * target_memory
NSMutableDictionary * reputation
NSArray * lastShot
NSDictionary * _equipScreenBackgroundDescriptor
NSMutableArray * commLog
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
NSMutableDictionary * extraGuiScreenKeys

References _commanderName, _customViews, _equipScreenBackgroundDescriptor, _fastEquipmentA, _fastEquipmentB, _jumpCause, _lastsaveName, _missionBackgroundDescriptor, _missionOverlayDescriptor, commLog, commodityScripts, compassTarget, contract_record, contracts, customActivatePressed, customDialSettings, customEquipActivation, customModePressed, dealloc, ShipEntity::dealloc, DESTROY, destroySound, dockingReport, eqScripts, extraGuiScreenKeys, hud, kbdLayouts, keyconfig2_settings, keyFunctions, keyMod1Text, keyMod2Text, keyShiftText, lastShot, lastTextKey, localVariables, marketSelectedCommodity, missile_entity, mission_variables, missionDestinations, multiFunctionDisplaySettings, multiFunctionDisplayText, parcel_record, parcels, passenger_record, passengers, PLAYER_MAX_MISSILES, PLAYER_MAX_TRUMBLES, reputation, roleSystemList, roleWeightFlags, roleWeights, save_path, scannedWormholes, scenarioKey, shipCommodityData, shipyard_record, specialCargo, stickFunctions, target_memory, trumble, worldScripts, worldScriptsRequiringTickle, and wormhole.

Referenced by dealloc.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ debugMessage:

- (void) debugMessage: (NSString *) args

Provided by category PlayerEntity(Scripting).

Definition at line 2425 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 2418 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 2411 of file PlayerEntityLegacyScriptEngine.m.

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

◆ deciCredits

- (OOCreditsQuantity) deciCredits

Definition at line 494 of file PlayerEntity.m.

495{
496 return credits;
497}

References credits, and deciCredits.

Referenced by PlayerEntity(ScriptMethods)::creditsFormattedForLegacySubstitution, deciCredits, and shipCommodityData.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ decreaseContractReputation:

- (void) decreaseContractReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

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

Referenced by PlayerEntity(Contracts)::checkPassengerContracts, and PlayerDecreaseContractReputation().

+ Here is the caller graph for this function:

◆ decreaseParcelReputation:

- (void) decreaseParcelReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

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

Referenced by PlayerEntity(Contracts)::checkPassengerContracts, and PlayerDecreaseParcelReputation().

+ Here is the caller graph for this function:

◆ decreasePassengerReputation:

- (void) decreasePassengerReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

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

Referenced by PlayerEntity(Contracts)::checkPassengerContracts, and PlayerDecreasePassengerReputation().

+ Here is the caller graph for this function:

◆ decrement:

- (void) decrement: (NSString *) missionVariableString

Provided by category PlayerEntity(Scripting).

Definition at line 1780 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 311 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 PlayerEntity(Scripting)::addMissionDestination:, initialiseMissionDestinations:andLegacy:, MissionMarkSystem(), and PlayerEntity(Scripting)::removeMissionDestination:.

+ Here is the caller graph for this function:

◆ deferredInit

- (void) deferredInit

Definition at line 1828 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

References afterburnerSoundLooping, compassMode, deferredInit, DESTROY, dockingReport, gOOPlayer, initControls, Entity::isPlayer, MAX_FOV, maxFieldOfView, missile_entity, nil, PLAYER_MAX_MISSILES, PLAYER_SHIP_DESC, HeadUpDisplay::resetGuis:, save_path, scoopsActive, ShipEntity::setStatus:, setUpAndConfirmOK:, and target_memory_index.

Referenced by deferredInit, and Universe::initWithGameView:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllKeySettings

- (void) deleteAllKeySettings
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 1700 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];
1710 OOEquipmentType *item = [OOEquipmentType equipmentTypeWithIdentifier:eq];
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}

References count, OOEquipmentType::defaultActivateKey, OOEquipmentType::defaultModeKey, PlayerEntity(KeyMapperInternal)::deleteAllKeySettings, OOEquipmentType::equipmentTypeWithIdentifier:, and initKeyConfigSettings.

Referenced by PlayerEntity(KeyMapperInternal)::deleteAllKeySettings, PlayerEntity(KeyMapper)::handleKeyMapperConfirmClearKeys:view:, and PlayerEntity(KeyMapperInternal)::resetKeyFunctions.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteKeySetting:

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

Provided by category PlayerEntity(KeyMapperInternal).

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

References getCustomEquipIndex:, getCustomEquipKeyDefType:, and initKeyConfigSettings.

Referenced by PlayerEntity(KeyMapper)::keyMapperInputHandler:view:, and PlayerEntity(KeyMapperInternal)::saveKeySetting:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ describeStickDict:

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

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 529 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

References MAX_REAL_BUTTONS, nil, and STICK_ISAXIS.

Referenced by PlayerEntity(StickMapperInternal)::displayFunctionList:skip:.

+ Here is the caller graph for this function:

◆ destroySound

- (void) destroySound

Provided by category PlayerEntity(Sound).

Definition at line 160 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

Referenced by dealloc, and PlayerEntity(Sound)::setUpSound.

+ Here is the caller graph for this function:

◆ dial_clock

- (NSString *) dial_clock

Definition at line 4919 of file PlayerEntity.m.

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

References ClockToString(), dial_clock, ship_clock, and ship_clock_adjust.

Referenced by dial_clock, and hyperspeedFactor.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dial_clock_adjusted

- (NSString *) dial_clock_adjusted

Definition at line 4925 of file PlayerEntity.m.

4926{
4928}

References ClockToString(), dial_clock_adjusted, ship_clock, and ship_clock_adjust.

Referenced by dial_clock_adjusted, hyperspeedFactor, and Universe::setUpUniverseFromWitchspace.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dial_fpsinfo

- (NSString *) dial_fpsinfo

Definition at line 4931 of file PlayerEntity.m.

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

References dial_fpsinfo, and fps_counter.

Referenced by dial_fpsinfo, and hyperspeedFactor.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dial_objinfo

- (NSString *) dial_objinfo

Definition at line 4938 of file PlayerEntity.m.

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

References dial_objinfo.

Referenced by dial_objinfo, and hyperspeedFactor.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialAftShield

- (GLfloat) dialAftShield

Definition at line 4787 of file PlayerEntity.m.

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

References aft_shield, dialAftShield, EXPECT_NOT, and maxAftShieldLevel.

Referenced by ProxyPlayerEntity::copyValuesFromPlayer:, dialAftShield, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialAltitude

- (GLfloat) dialAltitude

Definition at line 4866 of file PlayerEntity.m.

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

References Entity::collision_radius, dialAltitude, ShipEntity::findNearestStellarBody, isDocked, nil, PLAYER_DIAL_MAX_ALTITUDE, UNIVERSE, and Entity::zero_distance.

Referenced by dialAltitude, insideAtmosphereFraction, showDemoShips, and PlayerEntity(OOPrivate)::updateAlertConditionForNearbyEntities.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialCustomColor:

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

Definition at line 4621 of file PlayerEntity.m.

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

References OOColor::colorWithDescription:.

+ Here is the call graph for this function:

◆ dialCustomFloat:

- (float) dialCustomFloat: (NSString *) dialKey

Definition at line 4609 of file PlayerEntity.m.

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

◆ dialCustomString:

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

Definition at line 4615 of file PlayerEntity.m.

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

◆ dialEnergy

- (GLfloat) dialEnergy

Definition at line 4798 of file PlayerEntity.m.

4799{
4800 GLfloat result = energy / maxEnergy;
4801 return OOClamp_0_1_f(result);
4802}
GLfloat maxEnergy
Definition Entity.m:829
GLfloat energy
Definition Entity.m:817

References dialEnergy, Entity::energy, and Entity::maxEnergy.

Referenced by dialEnergy, HeadUpDisplay(Private)::drawEnergyGauge:, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialForwardShield

- (GLfloat) dialForwardShield

Definition at line 4776 of file PlayerEntity.m.

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

References dialForwardShield, EXPECT_NOT, forward_shield, and maxForwardShieldLevel.

Referenced by ProxyPlayerEntity::copyValuesFromPlayer:, dialForwardShield, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialFuel

- (GLfloat) dialFuel

Definition at line 4811 of file PlayerEntity.m.

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

References dialFuel, ShipEntity::fuel, and ShipEntity::fuelCapacity.

Referenced by dialFuel, GuiDisplayGen(Internal)::drawStarChart:x:y:z:alpha:, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialFuelScoopStatus

- (OOFuelScoopStatus) dialFuelScoopStatus

Definition at line 4988 of file PlayerEntity.m.

4989{
4990 // need to account for the different ways of calculating cargo on board when docked/in-flight
4991 OOCargoQuantity cargoOnBoard = [self status] == STATUS_DOCKED ? current_cargo : (OOCargoQuantity)[cargo count];
4992 if ([self hasScoop])
4993 {
4994 if (scoopsActive)
4995 return SCOOP_STATUS_ACTIVE;
4996 if (cargoOnBoard >= [self maxAvailableCargoSpace] || specialCargo)
4998 return SCOOP_STATUS_OKAY;
4999 }
5000 else
5001 {
5003 }
5004}
@ SCOOP_STATUS_FULL_HOLD
@ SCOOP_STATUS_NOT_INSTALLED
@ SCOOP_STATUS_ACTIVE
@ SCOOP_STATUS_OKAY
BOOL hasScoop()

References ShipEntity::cargo, count, current_cargo, dialFuelScoopStatus, ShipEntity::hasScoop, ShipEntity::maxAvailableCargoSpace, SCOOP_STATUS_ACTIVE, SCOOP_STATUS_FULL_HOLD, SCOOP_STATUS_NOT_INSTALLED, SCOOP_STATUS_OKAY, scoopsActive, specialCargo, and Entity::status.

Referenced by ProxyPlayerEntity::copyValuesFromPlayer:, dialFuelScoopStatus, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialHyperRange

- (GLfloat) dialHyperRange

Definition at line 4821 of file PlayerEntity.m.

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

References dialHyperRange, fuelRequiredForJump, PLAYER_MAX_FUEL, system_id, target_system_id, and UNIVERSE.

Referenced by dialHyperRange, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialHyperSpeed

- (GLfloat) dialHyperSpeed

Definition at line 4770 of file PlayerEntity.m.

4771{
4772 return flightSpeed / maxFlightSpeed;
4773}
GLfloat flightSpeed
GLfloat maxFlightSpeed

References dialHyperSpeed, ShipEntity::flightSpeed, and ShipEntity::maxFlightSpeed.

Referenced by dialHyperSpeed, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialIdentEngaged

- (BOOL) dialIdentEngaged

Definition at line 5469 of file PlayerEntity.m.

5470{
5471 return ident_engaged;
5472}

References dialIdentEngaged, and ident_engaged.

Referenced by activeMissile, ProxyPlayerEntity::copyValuesFromPlayer:, and dialIdentEngaged.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialMaxEnergy

- (GLfloat) dialMaxEnergy

Definition at line 4805 of file PlayerEntity.m.

4806{
4807 return maxEnergy;
4808}

References dialMaxEnergy, and Entity::maxEnergy.

Referenced by dialMaxEnergy, HeadUpDisplay(Private)::drawEnergyGauge:, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialMaxMissiles

- (NSUInteger) dialMaxMissiles

Definition at line 5463 of file PlayerEntity.m.

5464{
5465 return max_missiles;
5466}

References dialMaxMissiles, and ShipEntity::max_missiles.

Referenced by activeMissile, and dialMaxMissiles.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialMissileStatus

- (OOMissileStatus) dialMissileStatus

Definition at line 4962 of file PlayerEntity.m.

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

References dialMissileStatus, missile_status, MISSILE_STATUS_SAFE, OOLogERR, safeAllMissiles, and weaponsOnline.

Referenced by ProxyPlayerEntity::copyValuesFromPlayer:, dialMissileStatus, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialPitch

- (GLfloat) dialPitch

Definition at line 4741 of file PlayerEntity.m.

4742{
4743 GLfloat result = flightPitch / max_flight_pitch;
4744 if ((result < 1.0f)&&(result > -1.0f))
4745 return result;
4746 if (result > 0.0f)
4747 return 1.0f;
4748 return -1.0f;
4749}
GLfloat max_flight_pitch
Definition ShipEntity.h:241
GLfloat flightPitch

References dialPitch, ShipEntity::flightPitch, and ShipEntity::max_flight_pitch.

Referenced by dialPitch, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialRoll

- (GLfloat) dialRoll

Definition at line 4730 of file PlayerEntity.m.

4731{
4732 GLfloat result = flightRoll / max_flight_roll;
4733 if ((result < 1.0f)&&(result > -1.0f))
4734 return result;
4735 if (result > 0.0f)
4736 return 1.0f;
4737 return -1.0f;
4738}
GLfloat max_flight_roll
Definition ShipEntity.h:240
GLfloat flightRoll

References dialRoll, ShipEntity::flightRoll, and ShipEntity::max_flight_roll.

Referenced by dialRoll, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialSpeed

- (GLfloat) dialSpeed

Definition at line 4763 of file PlayerEntity.m.

4764{
4765 GLfloat result = flightSpeed / maxFlightSpeed;
4766 return OOClamp_0_1_f(result);
4767}

References dialSpeed, ShipEntity::flightSpeed, and ShipEntity::maxFlightSpeed.

Referenced by dialSpeed, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialTargetName

- (NSString *) dialTargetName

Definition at line 5487 of file PlayerEntity.m.

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

References DESC, dialTargetName, ShipEntity::identFromShip:, nil, and ShipEntity::primaryTarget.

Referenced by dialTargetName, and specialCargo.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dialYaw

- (GLfloat) dialYaw

Definition at line 4752 of file PlayerEntity.m.

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

References dialYaw, ShipEntity::flightYaw, and ShipEntity::max_flight_yaw.

Referenced by dialYaw, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disengageAutopilot

- (void) disengageAutopilot

Reimplemented from ShipEntity.

Definition at line 3703 of file PlayerEntity.m.

3704{
3706 {
3707 [self abortDocking]; // let the station know that you are no longer on approach
3708 behaviour = BEHAVIOUR_IDLE;
3709 frustration = 0.0;
3710 autopilot_engaged = NO;
3712 [self setTargetStation:nil];
3713 [self setStatus:STATUS_IN_FLIGHT];
3714 [self playAutopilotOff];
3715 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
3717 [self doScriptEvent:OOJSID("playerCancelledAutoPilot")];
3718
3719 [self resetAutopilotAI];
3720 }
3721}
OOMusicController * sharedController()
GLfloat frustration
OOWeakReference * _primaryTarget
Definition ShipEntity.h:437
OOBehaviour behaviour

References ShipEntity::_primaryTarget, ShipEntity::abortDocking, autopilot_engaged, ShipEntity::behaviour, DESTROY, disengageAutopilot, ShipEntity::doScriptEvent:, ShipEntity::frustration, playAutopilotOff, resetAutopilotAI, setDockingClearanceStatus:, ShipEntity::setStatus:, ShipEntity::setTargetStation:, OOMusicController::sharedController, and OOMusicController::stopDockingMusic.

Referenced by cancelDockingRequest:, disengageAutopilot, getDestroyedBy:damageType:, massLockable, performDockingRequest:, PlayerShipDisengageAutopilot(), PlayerEntity(OOControlsPrivate)::pollAutopilotControls:, and PlayerEntity(OOPrivate)::witchStart.

+ Here is the call graph for this function:
+ 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 394 of file PlayerEntityStickMapper.m.

394 :(GuiDisplayGen *)gui
395 skip:(NSUInteger)skip
396{
397 OOJoystickManager *stickHandler = [OOJoystickManager sharedStickHandler];
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()

References OOJoystickManager::axisFunctions, OOJoystickManager::buttonFunctions, CUSTOMEQUIP_BUTTONACTIVATE, CUSTOMEQUIP_BUTTONMODE, OOColor::cyanColor, describeStickDict:, OOColor::greenColor, GUI_ROW_FUNCSTART, HW_AXIS, HW_BUTTON, int(), KEY_HEADER, MAX_ROWS_FUNCTIONS, nil, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setSelectableRange:, OOJoystickManager::sharedStickHandler, and stickFunctionList.

Referenced by PlayerEntity(StickMapper)::setGuiToStickMapperScreen:resetCurrentRow:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayKeyboardLayoutList:skip:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 1300 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

References OOColor::greenColor, GUI_ROW_KC_FUNCSTART, int(), keyboardLayoutList, MAX_ROWS_KC_FUNCTIONS, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setKey:forRow:, and GuiDisplayGen::setSelectableRange:.

Referenced by PlayerEntity(KeyMapper)::setGuiToKeyboardLayoutScreen:resetCurrentRow:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayKeyFunctionList:skip:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 827 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

References CUSTOMEQUIP_KEYACTIVATE, CUSTOMEQUIP_KEYMODE, OOColor::cyanColor, OOEquipmentType::defaultActivateKey, OOEquipmentType::defaultModeKey, OOEquipmentType::equipmentTypeWithIdentifier:, getCustomEquipIndex:, getCustomEquipKeyDefType:, OOColor::greenColor, GUI_ROW_KC_FUNCSTART, int(), KEY_KC_HEADER, keyFunctionList, loadKeySettings, MAX_ROWS_KC_FUNCTIONS, nil, OOColor::orangeColor, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setSelectableRange:, and validateKey:checkKeys:.

Referenced by PlayerEntity(KeyMapper)::setGuiToKeyMapperScreen:resetCurrentRow:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

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

References aft_shield, aft_shot_time, ShipEntity::aft_weapon_temp, afterburner_engaged, ShipEntity::afterburner_rate, ShipEntity::afterburnerFactor, aftShieldRechargeRate, ALERT_FLAG_MASS_LOCK, alertFlags, autopilot_engaged, ShipEntity::becomeExplosion, Entity::boundingBox, bounty, ShipEntity::cloaking_device_active, CLOAKING_DEVICE_ENERGY_RATE, CLOAKING_DEVICE_MIN_ENERGY, Entity::collision_radius, ShipEntity::currentWeaponFacing, deactivateCloakingDevice, DESTROY, ShipEntity::doScriptEvent:, ECM_DURATION, ECM_ENERGY_DRAIN_FACTOR, ecm_in_operation, ecm_start_time, Entity::energy, ShipEntity::energyRechargeRate, enterDock:, ESCAPE_SEQUENCE_TIME, EXPECT_NOT, ShipEntity::findSubentityBoundingBox, ShipEntity::flightSpeed, forward_shield, forward_shot_time, ShipEntity::forward_weapon_temp, forwardShieldRechargeRate, ShipEntity::foundTarget, ShipEntity::fuel, ShipEntity::fuel_accumulator, fuel_leak_rate, ShipEntity::fuelCapacity, fuelChargeRate, galaxy_coordinates, galaxy_number, ShipEntity::hasCloakingDevice, ShipEntity::hasFuelScoop, ShipEntity::hasMilitaryJammer, ShipEntity::heatInsulation, hyperspeed_engaged, HYPERSPEED_FACTOR, hyperspeed_locked, info_system_id, Entity::isShip, Entity::isStation, lastShot, massLocked, MAX, ShipEntity::max_thrust, maxAftShieldLevel, Entity::maxEnergy, ShipEntity::maxFlightSpeed, maxForwardShieldLevel, ShipEntity::mesh, ShipEntity::military_jammer_active, MILITARY_JAMMER_ENERGY_RATE, MILITARY_JAMMER_MIN_ENERGY, MIN, MIN_FUEL, MyOpenGLView::mouseWheelDelta, nil, playJumpMassLocked, PointFromString(), port_shot_time, ShipEntity::port_weapon_temp, Entity::position, ShipEntity::primaryTarget, ShipEntity::removeTarget:, SCANNER_MAX_RANGE2, scanner_zoom_rate, scannerFuzziness, HeadUpDisplay::scannerZoom, scoopsActive, setBounty:withReason:, setDockTarget:, ShipEntity::setFuel:, ShipEntity::setMesh:, MyOpenGLView::setMouseWheelDelta:, HeadUpDisplay::setScannerZoom:, ShipEntity::setStatus:, SHIP_COOLING_FACTOR, SHIP_INSULATION_FACTOR, SHIP_MAX_CABIN_TEMP, SHIP_MIN_CABIN_TEMP, ShipEntity::ship_temperature, SHIP_THRUST_FACTOR, ShipEntity::shipDataKey, ShipEntity::shot_time, showGameOver, STAGE_TRACKING_BEGIN, STAGE_TRACKING_END, starboard_shot_time, ShipEntity::starboard_weapon_temp, Entity::status, ShipEntity::subEntities, SUN_TEMPERATURE, system_id, takeHeatDamage:, target_system_id, ShipEntity::thrust, ShipEntity::totalBoundingBox, travelling_at_hyperspeed, UNIVERSE, OOLaserShotEntity::update:, ShipEntity::update:, UPDATE_STAGE, validateCompassTarget, WEAPON_COOLING_FACTOR, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_NONE, WEAPON_FACING_PORT, WEAPON_FACING_STARBOARD, ShipEntity::weapon_temp, and Entity::zero_distance.

Referenced by PlayerEntity(OOPrivate)::performAutopilotUpdates:, PlayerEntity(OOPrivate)::performLaunchingUpdates:, PlayerEntity(OOPrivate)::performWitchspaceCountdownUpdates:, PlayerEntity(OOPrivate)::performWitchspaceExitUpdates:, and update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ docked

- (void) docked

Definition at line 7145 of file PlayerEntity.m.

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

References addMessageToReport:, addRoleToPlayer:, aft_shield, ShipEntity::being_fined, bounty, checkPassengerContracts, checkScript, clearedToDock, docked, dockedStation, ShipEntity::doScriptEvent:withArgument:, doWorldEventUntilMissionScreen:, Entity::energy, ShipEntity::flightPitch, ShipEntity::flightRoll, ShipEntity::flightSpeed, ShipEntity::flightYaw, OOCacheManager::flush, forward_shield, OOJavaScriptEngine::garbageCollectionOpportunity:, getFined, gui_screen, hyperspeed_engaged, hyperspeed_locked, StationEntity::initialiseLocalMarket, kOOJSLongTimeLimit, StationEntity::legalStatusOfManifest:export:, localMarket, loseTargetStatus, markAsOffender:withReason:, maxAftShieldLevel, Entity::maxEnergy, maxForwardShieldLevel, nil, OOJSStartTimeLimiterWithTimeLimit, OOJSStopTimeLimiter, penaltyForUnauthorizedDocking, OOMusicController::playDockedMusic, Entity::position, processEscapePods, setAlertFlag:to:, setGuiToStatusScreen, Entity::setOrientation:, Entity::setPosition:, ShipEntity::setStatus:, OOCacheManager::sharedCache, OOMusicController::sharedController, OOJavaScriptEngine::sharedEngine, ShipEntity::ship_temperature, Entity::status, OOMusicController::stopDockingMusic, UNIVERSE, unloadCargoPods, and ShipEntity::weapon_temp.

Referenced by docked, PlayerEntity(OOPrivate)::performDockingUpdates:, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dockedAtMainStation

- (BOOL) dockedAtMainStation

Provided by category PlayerEntity(ScriptMethods).

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

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

◆ dockedStation

◆ dockedStationDisplayName

- (NSString *) dockedStationDisplayName

Provided by category PlayerEntity(ScriptMethods).

Definition at line 70 of file PlayerEntityScriptMethods.m.

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

◆ dockedStationName

- (NSString *) dockedStationName

Provided by category PlayerEntity(ScriptMethods).

Definition at line 64 of file PlayerEntityScriptMethods.m.

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

Referenced by PlayerEntity(Scripting)::dockedStationName_string.

+ Here is the caller graph for this function:

◆ dockedStationName_string

- (NSString *) dockedStationName_string

Provided by category PlayerEntity(Scripting).

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

6309 :(HPVector)v0 :(HPVector)v1 :(ShipEntity **)hitEntity
6310{
6311 if (hitEntity)
6312 hitEntity[0] = (ShipEntity*)nil;
6313 Vector u0 = HPVectorToVector(HPvector_between(position, v0)); // relative to origin of model / octree
6314 Vector u1 = HPVectorToVector(HPvector_between(position, v1));
6315 Vector w0 = make_vector(dot_product(u0, v_right), dot_product(u0, v_up), dot_product(u0, v_forward)); // in ijk vectors
6316 Vector w1 = make_vector(dot_product(u1, v_right), dot_product(u1, v_up), dot_product(u1, v_forward));
6317 GLfloat hit_distance = [octree isHitByLine:w0 :w1];
6318 if (hit_distance)
6319 {
6320 if (hitEntity)
6321 hitEntity[0] = self;
6322 }
6323
6324 bool shields = false;
6325 if ((w0.z >= 0 && forward_shield > 1) || (w0.z <= 0 && aft_shield > 1))
6326 {
6327 shields = true;
6328 }
6329
6330 NSEnumerator *subEnum = nil;
6331 ShipEntity *se = nil;
6332 for (subEnum = [self shipSubEntityEnumerator]; (se = [subEnum nextObject]); )
6333 {
6334 HPVector p0 = [se absolutePositionForSubentity];
6335 Triangle ijk = [se absoluteIJKForSubentity];
6336 u0 = HPVectorToVector(HPvector_between(p0, v0));
6337 u1 = HPVectorToVector(HPvector_between(p0, v1));
6338 w0 = resolveVectorInIJK(u0, ijk);
6339 w1 = resolveVectorInIJK(u1, ijk);
6340
6341 GLfloat hitSub = [se->octree isHitByLine:w0 :w1];
6342 if (hitSub && (hit_distance == 0 || hit_distance > hitSub))
6343 {
6344 hit_distance = hitSub;
6345 if (hitEntity && !shields)
6346 {
6347 *hitEntity = se;
6348 }
6349 }
6350 }
6351
6352 return hit_distance;
6353}
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

References ShipEntity::absoluteIJKForSubentity, Entity::absolutePositionForSubentity, aft_shield, forward_shield, nil, Entity::position, ShipEntity::shipSubEntityEnumerator, ShipEntity::v_forward, ShipEntity::v_right, and ShipEntity::v_up.

+ Here is the call graph for this function:

◆ doGuiScreenResizeUpdates

- (void) doGuiScreenResizeUpdates

Definition at line 4118 of file PlayerEntity.m.

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

References doGuiScreenResizeUpdates, guiScreen, HeadUpDisplay::resetGuiPositions, setGuiToGameOptionsScreen, and setGuiToStatusScreen.

Referenced by doGuiScreenResizeUpdates, MyOpenGLView::pollControls, and wormhole.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doMissionCallback

- (void) doMissionCallback

Provided by category PlayerEntity(Scripting).

Definition at line 2439 of file PlayerEntityLegacyScriptEngine.m.

2440{
2441 // make sure we don't call the same callback twice
2444}
BOOL _missionWithCallback

Referenced by PlayerEntity(OOControlsPrivate)::handleMissionCallback, leaveDock:, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ doScriptEvent:inContext:withArguments:count:

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

Reimplemented from ShipEntity.

Definition at line 12924 of file PlayerEntity.m.

12924 :(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc
12925{
12926 [super doScriptEvent:message inContext:context withArguments:argv count:argc];
12927 [self doWorldScriptEvent:message inContext:context withArguments:argv count:argc timeLimit:0.0];
12928}

References ShipEntity::doScriptEvent:inContext:withArguments:count:, and doWorldScriptEvent:inContext:withArguments:count:timeLimit:.

+ Here is the call graph for this function:

◆ doTradeIn:forPriceFactor:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 10704 of file PlayerEntity.m.

10704 :(OOCreditsQuantity)tradeInValue forPriceFactor:(double)priceFactor
10705{
10706 if (tradeInValue != 0)
10707 {
10708 if (priceFactor < 1.0) tradeInValue *= priceFactor;
10710 }
10711}
OOCreditsQuantity tradeInValue()

Referenced by PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the caller graph for this function:

◆ doWorldEventUntilMissionScreen:

- (BOOL) doWorldEventUntilMissionScreen: (jsid) message

Definition at line 12931 of file PlayerEntity.m.

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

References OOScript::callMethod:inContext:withArguments:count:result:, dockedStation, dockingReport, gui_screen, isDocked, OOJSAcquireContext(), OOJSRelinquishContext(), and setGuiToDockingReportScreen.

Referenced by docked, PlayerEntity(Scripting)::endMissionScreenAndNoteOpportunity, PlayerEntity(OOControlsPrivate)::handleMissionCallback, leaveDock:, PlayerEntity(LoadSave)::loadPlayerFromFile:asNew:, PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and Universe::reinitAndShowDemo:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doWorldScriptEvent:inContext:withArguments:count:timeLimit:

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

Definition at line 12962 of file PlayerEntity.m.

12962 :(jsid)message inContext:(JSContext *)context withArguments:(jsval *)argv count:(uintN)argc timeLimit:(OOTimeDelta)limit
12963{
12964 NSParameterAssert(context != NULL && JS_IsInRequest(context));
12965
12966 NSEnumerator *scriptEnum = nil;
12967 OOScript *theScript = nil;
12968
12969 for (scriptEnum = [worldScripts objectEnumerator]; (theScript = [scriptEnum nextObject]); )
12970 {
12972 [theScript callMethod:message inContext:context withArguments:argv count:argc result:NULL];
12974 }
12975}
#define JS_IsInRequest(context)
double OOTimeDelta
Definition OOTypes.h:224

References OOScript::callMethod:inContext:withArguments:count:result:, JS_IsInRequest, nil, OOJSStartTimeLimiterWithTimeLimit, OOJSStopTimeLimiter, and worldScripts.

Referenced by completeSetUpAndSetTarget:, doScriptEvent:inContext:withArguments:count:, and startUpComplete.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawImmediate:translucent:

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

Reimplemented from ShipEntity.

Definition at line 4440 of file PlayerEntity.m.

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

References ShipEntity::drawImmediate:translucent:, Entity::status, and UNIVERSE.

+ Here is the call graph for this function:

◆ drawRotationMatrix

- (OOMatrix) drawRotationMatrix
implementation

Reimplemented from Entity.

Definition at line 4329 of file PlayerEntity.m.

4330{
4331 return playerRotMatrix;
4332}
OOMatrix playerRotMatrix

References drawRotationMatrix, and playerRotMatrix.

Referenced by drawRotationMatrix.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawTransformationMatrix

- (OOMatrix) drawTransformationMatrix
implementation

Reimplemented from Entity.

Definition at line 4335 of file PlayerEntity.m.

4336{
4337 OOMatrix result = playerRotMatrix;
4338 // HPVect: modify to use camera-relative positioning
4339 return OOMatrixTranslate(result, HPVectorToVector(position));
4340}

References drawTransformationMatrix, playerRotMatrix, and Entity::position.

Referenced by drawTransformationMatrix.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dumpCargo

- (OOCommodityType) dumpCargo
implementation

Reimplemented from ShipEntity.

Definition at line 6733 of file PlayerEntity.m.

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

References dumpCargo, ShipEntity::dumpCargo, ShipEntity::flightSpeed, ShipEntity::maxFlightSpeed, nil, and playCargoJettisioned.

Referenced by dumpCargo, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dumpSelfState

- (void) dumpSelfState
implementation

Reimplemented from ShipEntity.

Definition at line 13488 of file PlayerEntity.m.

13489{
13490 NSMutableArray *flags = nil;
13491 NSString *flagsString = nil;
13492
13493 [super dumpSelfState];
13494
13495 OOLog(@"dumpState.playerEntity", @"Script time: %g", script_time);
13496 OOLog(@"dumpState.playerEntity", @"Script time check: %g", script_time_check);
13497 OOLog(@"dumpState.playerEntity", @"Script time interval: %g", script_time_interval);
13498 OOLog(@"dumpState.playerEntity", @"Roll/pitch/yaw delta: %g, %g, %g", roll_delta, pitch_delta, yaw_delta);
13499 OOLog(@"dumpState.playerEntity", @"Shield: %g fore, %g aft", forward_shield, aft_shield);
13500 OOLog(@"dumpState.playerEntity", @"Alert level: %u, flags: %#x", alertFlags, alertCondition);
13501 OOLog(@"dumpState.playerEntity", @"Missile status: %i", missile_status);
13502 OOLog(@"dumpState.playerEntity", @"Energy unit: %@", EnergyUnitTypeToString([self installedEnergyUnitType]));
13503 OOLog(@"dumpState.playerEntity", @"Fuel leak rate: %g", fuel_leak_rate);
13504 OOLog(@"dumpState.playerEntity", @"Trumble count: %lu", trumbleCount);
13505
13506 flags = [NSMutableArray array];
13507 #define ADD_FLAG_IF_SET(x) if (x) { [flags addObject:@#x]; }
13531// ADD_FLAG_IF_SET(isSpeechOn);
13532 ADD_FLAG_IF_SET(keyboardRollOverride); // Handle keyboard roll...
13533 ADD_FLAG_IF_SET(keyboardPitchOverride); // ...and pitch override separately - (fix for BUG #17490)
13536 flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
13537 OOLog(@"dumpState.playerEntity", @"Flags: %@", flagsString);
13538}
#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

References ADD_FLAG_IF_SET, aft_shield, afterburner_engaged, afterburnerSoundLooping, alertCondition, alertFlags, autopilot_engaged, bomb_detonated, dumpSelfState, ShipEntity::dumpSelfState, ecm_in_operation, EnergyUnitTypeToString(), finished, forward_shield, found_equipment, fuel_leak_rate, galactic_witchjump, game_over, hyperspeed_engaged, hyperspeed_locked, ident_engaged, installedEnergyUnitType, keyboardPitchOverride, keyboardRollOverride, keyboardYawOverride, missile_status, mouse_control_on, nil, OOLog, pitch_delta, pitching, pollControls, roll_delta, rolling, scoopsActive, script_time, script_time_check, script_time_interval, show_info_flag, showDemoShips, suppressTargetLost, travelling_at_hyperspeed, trumbleCount, using_mining_laser, waitingForStickCallback, yaw_delta, and yawing.

Referenced by dumpSelfState.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ejectItem:

- (void) ejectItem: (NSString *) item_key

Provided by category PlayerEntity(Scripting).

Definition at line 1492 of file PlayerEntityLegacyScriptEngine.m.

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

◆ endMissionScreenAndNoteOpportunity

- (void) endMissionScreenAndNoteOpportunity

Provided by category PlayerEntity(Scripting).

Definition at line 2466 of file PlayerEntityLegacyScriptEngine.m.

2467{
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

Referenced by PlayerEntity(OOControlsPrivate)::handleMissionCallback, and PlayerEntity(OOControlsPrivate)::pollMissionInterruptControls.

+ Here is the caller graph for this function:

◆ endScenario:

- (BOOL) endScenario: (NSString *) key

Definition at line 7095 of file PlayerEntity.m.

7095 :(NSString *)key
7096{
7097 if (scenarioKey != nil && [key isEqualToString:scenarioKey])
7098 {
7099 [self setStatus:STATUS_RESTART_GAME];
7100 return YES;
7101 }
7102 return NO;
7103}

References nil, scenarioKey, and ShipEntity::setStatus:.

+ Here is the call graph for this function:

◆ energyUnitType

- (OOEnergyUnitType) energyUnitType

Definition at line 6149 of file PlayerEntity.m.

6150{
6151 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"]) return ENERGY_UNIT_NAVAL;
6152 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"]) return ENERGY_UNIT_NORMAL;
6153 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NAVAL_DAMAGED;
6154 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NORMAL_DAMAGED;
6155 return ENERGY_UNIT_NONE;
6156}
@ 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

References ENERGY_UNIT_NAVAL, ENERGY_UNIT_NAVAL_DAMAGED, ENERGY_UNIT_NONE, ENERGY_UNIT_NORMAL, ENERGY_UNIT_NORMAL_DAMAGED, and energyUnitType.

Referenced by alertCondition, and energyUnitType.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ engageAutopilotToStation:

- (BOOL) engageAutopilotToStation: (StationEntity *) stationForDocking

Definition at line 3668 of file PlayerEntity.m.

3668 :(StationEntity *)stationForDocking
3669{
3670 if (stationForDocking == nil) return NO;
3671 if ([self isDocked]) return NO;
3672
3673 if (autopilot_engaged && [self targetStation] == stationForDocking)
3674 {
3675 return YES;
3676 }
3677
3678 [self setTargetStation:stationForDocking];
3680 autopilot_engaged = YES;
3681 ident_engaged = NO;
3682 [self safeAllMissiles];
3684 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN) [self cancelWitchspaceCountdown]; // cancel witchspace countdown properly
3685 [self setStatus:STATUS_AUTOPILOT_ENGAGED];
3686 [self resetAutopilotAI];
3687 [shipAI setState:@"BEGIN_DOCKING"]; // reboot the AI
3688 [self playAutopilotOn];
3690 [self doScriptEvent:OOJSID("playerStartedAutoPilot") withArgument:stationForDocking];
3691 [self setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_GRANTED];
3692
3694 {
3696 if (afterburnerSoundLooping) [self stopAfterburnerSound];
3697 }
3698 return YES;
3699}
const Vector kZeroVector
Definition OOVector.m:28
Vector velocity
Definition Entity.m:763

References ShipEntity::_primaryTarget, afterburner_engaged, afterburnerSoundLooping, autopilot_engaged, cancelWitchspaceCountdown, DESTROY, ShipEntity::doScriptEvent:withArgument:, ident_engaged, isDocked, kZeroVector, nil, playAutopilotOn, OOMusicController::playDockingMusic, resetAutopilotAI, safeAllMissiles, setDockingClearanceStatus:, AI::setState:, ShipEntity::setStatus:, ShipEntity::setTargetStation:, OOMusicController::sharedController, Entity::status, stopAfterburnerSound, ShipEntity::targetStation, and ShipEntity::velocity.

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enterDock:

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

Reimplemented from ShipEntity.

Definition at line 7106 of file PlayerEntity.m.

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

References ShipEntity::_primaryTarget, afterburner_engaged, autopilot_engaged, breakPatternPosition, clearTargetMemory, ShipEntity::cloaking_device_active, DESTROY, ShipEntity::doScriptEvent:withArgument:, hud, hyperspeed_engaged, hyperspeed_locked, ident_engaged, nil, StationEntity::noteDockedShip:, playDockWithStation, resetAutopilotAI, safeAllMissiles, scanner_zoom_rate, setDockedStation:, Entity::setOrientation:, HeadUpDisplay::setScannerZoom:, ShipEntity::setStatus:, and Entity::status.

Referenced by doBookkeeping:, PlayerEntity(OOControlsPrivate)::handleAutopilotOn:, and StationDockPlayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enterGalacticWitchspace

- (void) enterGalacticWitchspace

Definition at line 7535 of file PlayerEntity.m.

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

References clearRolesFromPlayer:, contracts, currentSystemID, cursor_coordinates, enterGalacticWitchspace, ShipEntity::equipmentItemProviding:, EXPECT_NOT, galacticHyperspaceBehaviour, galaxy_number, info_system_id, jumpCause, missionDestinations, noteCompassLostTarget, OO_GALAXIES_AVAILABLE, OOJSAcquireContext(), OOJSRelinquishContext(), parcels, passengers, PointFromString(), removeEquipmentItem:, setBounty:withReason:, setJumpCause:, setPreviousSystemID:, ShipEntity::setStatus:, ship_kills, ShipScriptEvent, system_id, target_system_id, UNIVERSE, witchEnd, and witchStart.

Referenced by alertCondition, enterGalacticWitchspace, and PlayerEntity(OOPrivate)::performWitchspaceCountdownUpdates:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enterWitchspace

- (void) enterWitchspace
implementation

Reimplemented from ShipEntity.

Definition at line 7670 of file PlayerEntity.m.

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

References addRoleToPlayer:, addScannedWormhole:, ShipEntity::availableCargoSpace, currentSystemID, enterWitchspace, ShipEntity::flightPitch, ShipEntity::fuel, fuelRequiredForJump, jumpCause, legalStatusOfCargoList, ShipEntity::max_flight_pitch, ShipEntity::maxAvailableCargoSpace, nextHopTargetSystemID, noteCompassLostTarget, OOJSAcquireContext(), OOJSRelinquishContext(), OOJSSTR, playWitchjumpFailure, randf(), ranrot_rand, roleWeightFlags, ShipEntity::scriptedMisjump, ShipEntity::scriptedMisjumpRange, setFuelLeak:, setJumpCause:, WormholeEntity::setMisjumpWithRange:, setPreviousSystemID:, ShipEntity::setStatus:, ship_trade_in_factor, ShipScriptEvent, ShipScriptEventNoCx, takeInternalDamage, updateSystemMemory, witchJumpTo:misjump:, and wormhole.

Referenced by enterWitchspace, and PlayerEntity(OOPrivate)::performWitchspaceCountdownUpdates:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enterWormhole:

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

Reimplemented from ShipEntity.

Definition at line 7639 of file PlayerEntity.m.

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

References addScannedWormhole:, currentSystemID, ShipEntity::destination, WormholeEntity::destination, ShipEntity::flightPitch, jumpCause, ShipEntity::max_flight_pitch, OOJSAcquireContext(), OOJSRelinquishContext(), randf(), ShipEntity::scriptedMisjump, ShipEntity::scriptedMisjumpRange, setJumpCause:, WormholeEntity::setMisjumpWithRange:, setPreviousSystemID:, ShipEntity::setStatus:, ShipScriptEvent, Entity::status, witchJumpTo:misjump:, WormholeEntity::withMisjump, and wormhole.

+ Here is the call graph for this function:

◆ entryIsCustomEquip:

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

Provided by category PlayerEntity(KeyMapperInternal).

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

Referenced by PlayerEntity(KeyMapperInternal)::entryIsDictCustomEquip:, and PlayerEntity(KeyMapperInternal)::entryIsIndexCustomEquip:.

+ Here is the caller graph for this function:

◆ entryIsDictCustomEquip:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 322 of file PlayerEntityKeyMapper.m.

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

References entryIsCustomEquip:.

+ Here is the call graph for this function:

◆ entryIsEqualToDefault:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 1566 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

References count, kdic_check, and key_list.

◆ entryIsIndexCustomEquip:

- (BOOL) entryIsIndexCustomEquip: (NSUInteger) idx
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 316 of file PlayerEntityKeyMapper.m.

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

References entryIsCustomEquip:.

+ Here is the call graph for this function:

◆ eqScriptIndexForKey:

- (NSUInteger) eqScriptIndexForKey: (NSString *) eq_key

Provided by category PlayerEntity(Scripting).

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:, setCommanderDataFromDictionary:, and setPrimedEquipment:showMessage:.

+ Here is the caller graph for this function:

◆ equipmentList

- (NSArray *) equipmentList

Definition at line 8076 of file PlayerEntity.m.

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

References ShipEntity::aft_weapon_type, count, ShipEntity::countEquipmentItem:, OOEquipmentType::displayColor, equipmentList, OOEquipmentType::equipmentTypeWithIdentifier:, ShipEntity::forward_weapon_type, OOEquipmentType::identifier, ShipEntity::isVisible, isWeaponNone(), max_passengers, OOEquipmentType::name, nil, OOExpandKey, ShipEntity::port_weapon_type, ShipEntity::starboard_weapon_type, and GuiDisplayGen::userSettings.

Referenced by GuiDisplayGen::drawGUI:drawCursor:, equipmentList, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ equipScreenBackgroundDescriptor

- (NSDictionary *) equipScreenBackgroundDescriptor

Definition at line 12865 of file PlayerEntity.m.

12866{
12868}

References _equipScreenBackgroundDescriptor, and equipScreenBackgroundDescriptor.

Referenced by customViewDescription, equipScreenBackgroundDescriptor, and setGuiToEquipShipScreen:selectingFacingFor:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ erodeReputation

- (void) erodeReputation

Provided by category PlayerEntity(Contracts).

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

Referenced by Universe::carryPlayerOn:inWormhole:, and PlayerEntity(OOPrivate)::witchJumpTo:misjump:.

+ Here is the caller graph for this function:

◆ escapePodRescueTime

- (double) escapePodRescueTime

Definition at line 4908 of file PlayerEntity.m.

4909{
4911}
double escape_pod_rescue_time

References escape_pod_rescue_time, and escapePodRescueTime.

Referenced by commanderDataDictionary, escapePodRescueTime, and hyperspeedFactor.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ existingNativeSave:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1193 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 1181 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)
struct Random_Seed Random_Seed

References Random_Seed::a, Random_Seed::b, Random_Seed::c, Random_Seed::d, Random_Seed::e, Random_Seed::f, OOExpand, replaceVariablesInString:, and seed_RNG_only_for_planet_description().

Referenced by PlayerEntity(Scripting)::commsMessage:, PlayerEntity(Scripting)::consoleMessage3s:, and PlayerEntity(Scripting)::consoleMessage6s:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expandScriptRightHandSide:

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

Provided by category PlayerEntity(ScriptingPrivate).

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

References nil.

Referenced by PlayerEntity(ScriptingPrivate)::scriptTestCondition:.

+ Here is the caller graph for this function:

◆ fastEquipmentA

- (NSString *) fastEquipmentA

Definition at line 8286 of file PlayerEntity.m.

8287{
8288 return _fastEquipmentA;
8289}

References _fastEquipmentA, and fastEquipmentA.

Referenced by commanderDataDictionary, fastEquipmentA, PlayerShipGetProperty(), PlayerEntity(OOControlsPrivate)::pollFlightControls:, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fastEquipmentB

- (NSString *) fastEquipmentB

Definition at line 8292 of file PlayerEntity.m.

8293{
8294 return _fastEquipmentB;
8295}

References _fastEquipmentB, and fastEquipmentB.

Referenced by commanderDataDictionary, fastEquipmentB, PlayerShipGetProperty(), PlayerEntity(OOControlsPrivate)::pollFlightControls:, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findIndexOfCommander:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

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

Referenced by PlayerEntity(OOLoadSavePrivate)::lsCommanders:directory:pageNumber:highlightName:.

+ Here is the caller graph for this function:

◆ fireECM

- (BOOL) fireECM
implementation

Reimplemented from ShipEntity.

Definition at line 6126 of file PlayerEntity.m.

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

References ecm_in_operation, ecm_start_time, and fireECM.

Referenced by fireECM.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fireMainWeapon

- (BOOL) fireMainWeapon

Definition at line 6188 of file PlayerEntity.m.

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

References ShipEntity::_multiplyWeapons, aft_shot_time, ShipEntity::aft_weapon_temp, ShipEntity::cloaking_device_active, ShipEntity::cloakPassive, currentLaserOffset, currentWeapon, ShipEntity::currentWeaponFacing, currentWeaponStats, deactivateCloakingDevice, Entity::energy, ShipEntity::fireLaserShotInDirection:weaponIdentifier:, fireMainWeapon, forward_shot_time, ShipEntity::forward_weapon_temp, OOEquipmentType::identifier, OOEquipmentType::isMiningLaser, isWeaponNone(), ShipEntity::laserPortOffset:, PLAYER_MAX_WEAPON_TEMP, playWeaponOverheated:, port_shot_time, ShipEntity::port_weapon_temp, starboard_shot_time, ShipEntity::starboard_weapon_temp, using_mining_laser, WEAPON_COOLING_CUTOUT, ShipEntity::weapon_energy_use, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_NONE, WEAPON_FACING_PORT, WEAPON_FACING_STARBOARD, ShipEntity::weapon_shot_temperature, ShipEntity::weapon_temp, and weaponsOnline.

Referenced by alertCondition, and fireMainWeapon.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fireMissile

- (ShipEntity *) fireMissile
implementation

Reimplemented from ShipEntity.

Definition at line 5954 of file PlayerEntity.m.

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

References ShipEntity::cloaking_device_active, ShipEntity::cloakPassive, deactivateCloakingDevice, fireMissile, ShipEntity::fireMissileWithIdentifier:andTarget:, ShipEntity::isMine, launchingMissile, launchMine:, missile_entity, missile_status, MISSILE_STATUS_SAFE, MISSILE_STATUS_TARGET_LOCKED, ShipEntity::missileLaunchPosition, nil, playMineLaunched:weaponIdentifier:, playMissileLaunched:weaponIdentifier:, ShipEntity::primaryRole, ShipEntity::primaryTarget, removeFromPylon:, replacingMissile, and weaponsOnline.

Referenced by fireMissile, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fleeingStatus

- (OOPlayerFleeingStatus) fleeingStatus

Definition at line 5857 of file PlayerEntity.m.

5858{
5859 return fleeing_status;
5860}
OOPlayerFleeingStatus fleeing_status

References fleeing_status, and fleeingStatus.

Referenced by alertCondition, and fleeingStatus.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forwardShieldLevel

- (GLfloat) forwardShieldLevel

Definition at line 4693 of file PlayerEntity.m.

4694{
4695 return forward_shield;
4696}

References forward_shield, and forwardShieldLevel.

Referenced by forwardShieldLevel, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forwardShieldRechargeRate

- (float) forwardShieldRechargeRate

Definition at line 4657 of file PlayerEntity.m.

4658{
4660}
GLfloat forward_shield_recharge_rate

References forward_shield_recharge_rate, and forwardShieldRechargeRate.

Referenced by doBookkeeping:, forwardShieldRechargeRate, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ foundEquipment_bool

- (NSString *) foundEquipment_bool

Provided by category PlayerEntity(Scripting).

Definition at line 1049 of file PlayerEntityLegacyScriptEngine.m.

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

◆ fuelChargeRate

- (GLfloat) fuelChargeRate
implementation

Reimplemented from ShipEntity.

Definition at line 13043 of file PlayerEntity.m.

13044{
13045 GLfloat rate = 1.0; // Standard charge rate.
13046
13047 rate = [super fuelChargeRate];
13048
13049 // Experimental: the state of repair affects the fuel charge rate - more fuel needed for jumps, etc...
13051 {
13052 rate *= 2.0 - (ship_trade_in_factor / 100); // between 1.1x and 1.25x
13053 //OOLog(@"fuelPrices", @"\"%@\" - repair status: %d%%, adjusted rate to:%.2f)", [self shipDataKey], ship_trade_in_factor, rate);
13054 }
13055
13056 return rate;
13057}

References EXPECT, fuelChargeRate, ShipEntity::fuelChargeRate, and ship_trade_in_factor.

Referenced by doBookkeeping:, fuelChargeRate, setCommanderDataFromDictionary:, and setGuiToEquipShipScreen:selectingFacingFor:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fuelLeakRate

- (float) fuelLeakRate

Definition at line 5007 of file PlayerEntity.m.

5008{
5009 return fuel_leak_rate;
5010}

References fuel_leak_rate, and fuelLeakRate.

Referenced by ProxyPlayerEntity::copyValuesFromPlayer:, fuelLeakRate, PlayerEntity(Scripting)::fuelLeakRate_number, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fuelLeakRate_number

- (NSNumber *) fuelLeakRate_number

Provided by category PlayerEntity(Scripting).

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

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

References PlayerEntity(OOPrivate)::fuelRequiredForJump, PlayerEntity(OOPrivate)::hyperspaceJumpDistance, and MAX.

Referenced by dialHyperRange, enterWitchspace, PlayerEntity(OOPrivate)::fuelRequiredForJump, hasSufficientFuelForJump, and PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ galacticHyperspaceBehaviour

- (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour

◆ galacticHyperspaceFixedCoords

- (NSPoint) galacticHyperspaceFixedCoords

◆ galaxy_coordinates

- (NSPoint) galaxy_coordinates

References galaxy_coordinates.

◆ galaxyNumber

- (OOGalaxyID) galaxyNumber

Definition at line 512 of file PlayerEntity.m.

513{
514 return galaxy_number;
515}

References galaxy_number, and galaxyNumber.

Referenced by GuiDisplayGen(Internal)::drawStarChart:x:y:z:alpha:, galaxyNumber, noteGUIDidChangeFrom:to:refresh:, setGuiToSystemDataScreenRefreshBackground:, GuiDisplayGen::setStarChartTitle, Universe::setSystemTo:, Universe(OOPrivate)::setUpInitialUniverse, Universe::setUpUniverseFromStation, and shipCommodityData.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gameOverFadeToBW

- (void) gameOverFadeToBW
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3984 of file PlayerEntity.m.

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

References MyOpenGLView::adjustColorSaturation:, MyOpenGLView::colorSaturation, DETAIL_LEVEL_SHADERS, PlayerEntity(OOPrivate)::gameOverFadeToBW, kDeadResetTime, and UNIVERSE.

Referenced by PlayerEntity(OOPrivate)::gameOverFadeToBW, PlayerEntity(OOPrivate)::performDeadUpdates:, and PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCustomEquipArray:

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

Provided by category PlayerEntity(KeyMapperInternal).

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

References CUSTOMEQUIP_EQUIPKEY, CUSTOMEQUIP_KEYACTIVATE, CUSTOMEQUIP_KEYMODE, and nil.

Referenced by PlayerEntity(KeyMapper)::keyMapperInputHandler:view:.

+ Here is the caller graph for this function:

◆ getCustomEquipIndex:

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

Provided by category PlayerEntity(KeyMapperInternal).

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

References CUSTOMEQUIP_EQUIPKEY, and nil.

Referenced by PlayerEntity(KeyMapperInternal)::deleteKeySetting:, PlayerEntity(KeyMapperInternal)::displayKeyFunctionList:skip:, PlayerEntity(KeyMapper)::keyMapperInputHandler:view:, PlayerEntity(KeyMapperInternal)::saveKeySetting:, PlayerEntity(KeyMapperInternal)::searchArrayForMatch:key:checkKeys:, and PlayerEntity(KeyMapperInternal)::unsetKeySetting:.

+ Here is the caller graph for this function:

◆ getCustomEquipKeyDefType:

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

Provided by category PlayerEntity(KeyMapperInternal).

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

References CUSTOMEQUIP_KEYACTIVATE, and CUSTOMEQUIP_KEYMODE.

Referenced by PlayerEntity(KeyMapperInternal)::deleteKeySetting:, PlayerEntity(KeyMapperInternal)::displayKeyFunctionList:skip:, PlayerEntity(KeyMapperInternal)::saveKeySetting:, PlayerEntity(KeyMapperInternal)::searchArrayForMatch:key:checkKeys:, and PlayerEntity(KeyMapperInternal)::unsetKeySetting:.

+ Here is the caller graph for this function:

◆ getDestroyedBy:damageType:

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

Reimplemented from ShipEntity.

Definition at line 7027 of file PlayerEntity.m.

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

References afterburner_engaged, ShipEntity::becomeLargeExplosion:, disengageAutopilot, Entity::energy, ShipEntity::flightPitch, ShipEntity::flightRoll, ShipEntity::flightSpeed, ShipEntity::flightYaw, isDocked, kZeroVector, loseTargetStatus, moveForward:, ShipEntity::noteKilledBy:damageType:, OOLog, OOStringFromShipDamageType(), playGameOver, ShipEntity::removeAllEquipment, showGameOver, suppressTargetLost, UNIVERSE, and ShipEntity::velocity.

Referenced by takeEnergyDamage:from:becauseOf:weaponIdentifier:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDockingClearanceStatus

- (OODockingClearanceStatus) getDockingClearanceStatus

Definition at line 13200 of file PlayerEntity.m.

13201{
13203}

References dockingClearanceStatus, and getDockingClearanceStatus.

Referenced by StationEntity::dockingInstructionsForShip:, getDockingClearanceStatus, and scoopOverride.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFined

- (void) getFined

Definition at line 11886 of file PlayerEntity.m.

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

References addMessageToReport:, credits, getFined, int(), legalStatus, setBounty:withReason:, ship_clock_adjust, and UNIVERSE.

Referenced by docked, getFined, and isSpeechOn.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFirstKeyCode:

- (int) getFirstKeyCode: (NSArray*) key_def

Provided by category PlayerEntity(Controls).

Definition at line 656 of file PlayerEntityControls.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ getKeyBindingDescription:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 393 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

Referenced by PlayerEntity(ScriptMethods)::keyBindingDescription2:.

+ Here is the caller graph for this function:

◆ getMissionDestinations

- (NSMutableDictionary *) getMissionDestinations

Definition at line 13359 of file PlayerEntity.m.

13360{
13361 return missionDestinations;
13362}

References getMissionDestinations, and missionDestinations.

Referenced by getMissionDestinations, MissionGetProperty(), and wormhole.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTargetDockStation

- (StationEntity *) getTargetDockStation

Definition at line 4521 of file PlayerEntity.m.

4522{
4523 return targetDockStation;
4524}
StationEntity * targetDockStation

References getTargetDockStation, and targetDockStation.

Referenced by DockEntity::abortAllDockings, StationEntity::dockingInstructionsForShip:, getTargetDockStation, massLockable, StationEntity::noteDockedShip:, and StationEntity::update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gui_screen_string

- (NSString *) gui_screen_string

Provided by category PlayerEntity(Scripting).

Definition at line 919 of file PlayerEntityLegacyScriptEngine.m.

920{
922}
NSString * OOStringFromGUIScreenID(OOGUIScreenID screen) CONST_FUNC

◆ guiScreen

- (OOGUIScreenID) guiScreen

Definition at line 11363 of file PlayerEntity.m.

11364{
11365 return gui_screen;
11366}

References gui_screen, and guiScreen.

Referenced by doGuiScreenResizeUpdates, GlobalPauseGame(), guiScreen, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleAutopilotOn:

- (void) handleAutopilotOn: (BOOL) fastDocking
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 5511 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
BOOL withinStationAegis()
NSString * displayName
unsigned n_entities
Definition Universe.h:192
Entity * sortedEntities[UNIVERSE_MAX_ENTITIES+1]
Definition Universe.h:191

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ handleButtonIdent

- (void) handleButtonIdent
implementation

Provided by category PlayerEntity(OOControlsPrivate).

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

Referenced by PlayerEntity(OOControlsPrivate)::handleButtonTargetMissile, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ handleButtonTargetMissile

- (void) handleButtonTargetMissile
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 5655 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
5665 {
5666 [self noteLostTarget];
5667 }
5668
5669 // Arm missile and check for missile lock
5672 {
5673 if ([[self primaryTarget] isShip])
5674 {
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 }
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}

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ handleGameOptionsScreenKeys

- (void) handleGameOptionsScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 3400 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
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];
3582 {
3583 [UNIVERSE stopSpeaking];
3584 [UNIVERSE startSpeakingString:[UNIVERSE voiceName: voice_no]];
3585 }
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];
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 {
3627 OOMusicController *musicController = [OOMusicController sharedController];
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];
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"];
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
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
double fieldOfView
OOSpeechSettings isSpeechOn
float volume()

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ handleGUIUpDownArrowKeys

- (BOOL) handleGUIUpDownArrowKeys

Provided by category PlayerEntity(Controls).

Definition at line 716 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 {
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
743 }
744 }
745
746 if (arrow_up)
747 {
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
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

Referenced by PlayerEntity(OOControlsPrivate)::handleGameOptionsScreenKeys, PlayerEntity(KeyMapper)::handleKeyboardLayoutEntryKeys:view:, PlayerEntity(KeyMapper)::handleKeyConfigEntryKeys:view:, PlayerEntity(KeyMapper)::handleKeyConfigKeys:view:, PlayerEntity(KeyMapper)::handleKeyMapperConfirmClearKeys:view:, PlayerEntity(KeyMapper)::keyMapperInputHandler:view:, PlayerEntity(LoadSave)::overwriteCommanderInputHandler, PlayerEntity(OOControlsPrivate)::pollDemoControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollMarketScreenControls, PlayerEntity(StickMapper)::stickMapperInputHandler:view:, and PlayerEntity(StickProfile)::stickProfileInputHandler:view:.

+ Here is the caller graph for this function:

◆ handleKeyboardLayoutEntryKeys:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 1194 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

Referenced by PlayerEntity(OOControlsPrivate)::handleKeyboardLayoutKeys.

+ Here is the caller graph for this function:

◆ handleKeyboardLayoutKeys

- (void) handleKeyboardLayoutKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 3964 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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ handleKeyConfigEntryKeys:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 645 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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ handleKeyConfigKeys:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 551 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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ handleKeyMapperConfirmClearKeys:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 796 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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ handleKeyMapperScreenKeys

- (void) handleKeyMapperScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ handleMissionCallback

- (void) handleMissionCallback
implementation

Provided by category PlayerEntity(OOControlsPrivate).

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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:.

+ Here is the caller graph for this function:

◆ handleStickMapperScreenKeys

- (void) handleStickMapperScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ handleUndockControl

- (void) handleUndockControl
implementation

Provided by category PlayerEntity(OOControlsPrivate).

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

Referenced by PlayerEntity(OOControlsPrivate)::pollDockedControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ hasHostileTarget

- (BOOL) hasHostileTarget
implementation

Reimplemented from ShipEntity.

Definition at line 11867 of file PlayerEntity.m.

11868{
11869 ShipEntity *playersTarget = [self primaryTarget];
11870 return ([playersTarget isShip] && [playersTarget hasHostileTarget] && [playersTarget primaryTarget] == self);
11871}

References hasHostileTarget, Entity::isShip, and ShipEntity::primaryTarget.

Referenced by addRoleForAggression:, and hasHostileTarget.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasOneEquipmentItem:includeMissiles:

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

Definition at line 11759 of file PlayerEntity.m.

11759 :(NSString *)itemKey includeMissiles:(BOOL)includeMissiles
11760{
11761 // Check basic equipment the normal way.
11762 if ([super hasOneEquipmentItem:itemKey includeMissiles:NO whileLoading:NO]) return YES;
11763
11764 // Custom handling for player missiles.
11765 if (includeMissiles)
11766 {
11767 unsigned i;
11768 for (i = 0; i < max_missiles; i++)
11769 {
11770 if ([[self missileForPylon:i] hasPrimaryRole:itemKey]) return YES;
11771 }
11772 }
11773
11774 if ([itemKey isEqualToString:@"EQ_TRUMBLE"])
11775 {
11776 return [self trumbleCount] > 0;
11777 }
11778
11779 return NO;
11780}

References ShipEntity::max_missiles, and trumbleCount.

◆ hasPrimaryWeapon:

- (BOOL) hasPrimaryWeapon: (OOWeaponType) weaponType
implementation

Reimplemented from ShipEntity.

Definition at line 11783 of file PlayerEntity.m.

11783 :(OOWeaponType)weaponType
11784{
11785 if ([[forward_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11786 [[aft_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11787 [[port_weapon_type identifier] isEqualToString:[weaponType identifier]] ||
11788 [[starboard_weapon_type identifier] isEqualToString:[weaponType identifier]])
11789 {
11790 return YES;
11791 }
11792
11793 return [super hasPrimaryWeapon:weaponType];
11794}

References ShipEntity::aft_weapon_type, ShipEntity::forward_weapon_type, ShipEntity::hasPrimaryWeapon:, ShipEntity::port_weapon_type, and ShipEntity::starboard_weapon_type.

+ Here is the call graph for this function:

◆ hasSufficientFuelForJump

- (BOOL) hasSufficientFuelForJump

Definition at line 7514 of file PlayerEntity.m.

7515{
7516 return fuel >= [self fuelRequiredForJump];
7517}

References ShipEntity::fuel, fuelRequiredForJump, and hasSufficientFuelForJump.

Referenced by alertCondition, hasSufficientFuelForJump, and witchJumpChecklist:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ highlightEquipShipScreenKey:

- (void) highlightEquipShipScreenKey: (NSString *) key

Definition at line 9253 of file PlayerEntity.m.

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

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

Referenced by buySelectedItem.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ homeInfoSystem

- (void) homeInfoSystem

Definition at line 860 of file PlayerEntity.m.

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

References homeInfoSystem, and setInfoSystemID:moveChart:.

Referenced by custom_chart_zoom, homeInfoSystem, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hud

- (HeadUpDisplay *) hud

References hud, multiFunctionDisplayList, resetHud, selectNextMultiFunctionDisplay, and selectPreviousMultiFunctionDisplay.

+ Here is the call graph for this function:

◆ hwToString:

- (NSString *) hwToString: (int) hwFlags
implementation

Provided by category PlayerEntity(StickMapperInternal).

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

References HW_AXIS, and HW_BUTTON.

◆ hyperspaceJumpDistance

- (double) hyperspaceJumpDistance
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 7501 of file PlayerEntity.m.

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

References distanceBetweenPlanetPositions(), PlayerEntity(OOPrivate)::hyperspaceJumpDistance, PointFromString(), and UNIVERSE.

Referenced by PlayerEntity(OOPrivate)::fuelRequiredForJump, PlayerEntity(OOPrivate)::hyperspaceJumpDistance, PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, and witchJumpChecklist:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hyperspeedEngaged

- (BOOL) hyperspeedEngaged

Definition at line 3758 of file PlayerEntity.m.

3759{
3760 return hyperspeed_engaged;
3761}

References hyperspeed_engaged, and hyperspeedEngaged.

Referenced by hyperspeedEngaged, and hyperspeedFactor.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hyperspeedFactor

- (GLfloat) hyperspeedFactor

References clockAdjusting, clockTime, clockTimeAdjusted, customEquipmentActivation, dial_clock, dial_clock_adjusted, dial_fpsinfo, dial_objinfo, escapePodRescueTime, hyperspeedEngaged, hyperspeedFactor, and injectorsEngaged.

+ Here is the call graph for this function:

◆ increaseContractReputation:

- (void) increaseContractReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

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

Referenced by PlayerEntity(Contracts)::checkPassengerContracts, and PlayerIncreaseContractReputation().

+ Here is the caller graph for this function:

◆ increaseParcelReputation:

- (void) increaseParcelReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

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

Referenced by PlayerEntity(Contracts)::checkPassengerContracts, and PlayerIncreaseParcelReputation().

+ Here is the caller graph for this function:

◆ increasePassengerReputation:

- (void) increasePassengerReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

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

Referenced by PlayerEntity(Contracts)::checkPassengerContracts, and PlayerIncreasePassengerReputation().

+ Here is the caller graph for this function:

◆ increment:

- (void) increment: (NSString *) missionVariableString

Provided by category PlayerEntity(Scripting).

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

754{
755 return info_system_id;
756}

References info_system_id, and infoSystemID.

Referenced by custom_chart_zoom, GuiDisplayGen(Internal)::drawStarChart:x:y:z:alpha:, and infoSystemID.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoSystemOnRoute

- (BOOL) infoSystemOnRoute

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

References info_system_id, infoSystemOnRoute, and nil.

Referenced by custom_chart_zoom, and infoSystemOnRoute.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init

- (id) init
implementation

Reimplemented from ShipEntity.

Definition at line 1821 of file PlayerEntity.m.

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

References gOOPlayer, init, ShipEntity::initBypassForPlayer, and nil.

Referenced by init.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCheckingDictionary

- (void) initCheckingDictionary

Provided by category PlayerEntity(KeyMapper).

Definition at line 77 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)

Referenced by PlayerEntity(KeyMapper)::handleKeyboardLayoutEntryKeys:view:, and PlayerEntity(KeyMapper)::setGuiToKeyMapperScreen:resetCurrentRow:.

+ Here is the caller graph for this function:

◆ initControls

- (void) initControls

Provided by category PlayerEntity(Controls).

Definition at line 207 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}
NSDictionary * keyCodeLookups

Referenced by deferredInit, and Universe::reinitAndShowDemo:.

+ Here is the caller graph for this function:

◆ initialiseMissionDestinations:andLegacy:

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

Definition at line 13286 of file PlayerEntity.m.

13286 :(NSDictionary *)destinations andLegacy:(NSArray *)legacy
13287{
13288 NSEnumerator *keyEnum = nil;
13289 NSString *key = nil;
13290 id value = nil;
13291
13292 /* same need to make inner objects mutable as in localPlanetInfoOverrides */
13293
13294 [missionDestinations release];
13295 missionDestinations = [[NSMutableDictionary alloc] init];
13296
13297 for (keyEnum = [destinations keyEnumerator]; (key = [keyEnum nextObject]); )
13298 {
13299 value = [destinations objectForKey:key];
13300 if (value != nil)
13301 {
13302 if ([value isKindOfClass:[NSDictionary class]])
13303 {
13304 value = [value mutableCopy];
13305 [missionDestinations setObject:value forKey:key];
13306 [value release];
13307 }
13308 }
13309 }
13310
13311 if (legacy != nil)
13312 {
13313 OOSystemID dest;
13314 NSNumber *legacyMarker;
13315 for (keyEnum = [legacy objectEnumerator]; (legacyMarker = [keyEnum nextObject]); )
13316 {
13317 dest = [legacyMarker intValue];
13318 [self addMissionDestinationMarker:[self defaultMarker:dest]];
13319 }
13320 }
13321
13322}

References addMissionDestinationMarker:, defaultMarker:, missionDestinations, and nil.

Referenced by setCommanderDataFromDictionary:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initKeyConfigSettings

- (void) initKeyConfigSettings

Provided by category PlayerEntity(Controls).

Definition at line 297 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
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
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);
384
393
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);
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
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);
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);
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);
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);
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
484
485 LOAD_KEY_SETTING2(n_key_custom_view, 'v', NO, 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
NSArray * n_key_yaw_left
NSArray * n_key_activate_equipment
NSArray * n_key_gui_screen_interfaces
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_yaw_right
NSArray * n_key_custom_view_pan_down
NSArray * n_key_map_info
NSArray * n_key_view_forward
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_custom_view_zoom_out
NSArray * n_key_custom_view_roll_right
NSArray * n_key_dump_entity_list
NSArray * n_key_market_buy_one
NSArray * n_key_roll_right
NSArray * n_key_cycle_next_mfd
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
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
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_view_starboard
NSArray * n_key_pitch_back
NSArray * n_key_mouse_control_roll
NSArray * n_key_launch_ship
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_custom_view_rotate_down
NSArray * n_key_prime_next_equipment
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_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

Referenced by PlayerEntity(KeyMapperInternal)::deleteAllKeySettings, PlayerEntity(KeyMapperInternal)::deleteKeySetting:, PlayerEntity(KeyMapper)::handleKeyboardLayoutEntryKeys:view:, PlayerEntity(Controls)::initControls, PlayerEntity(KeyMapperInternal)::saveKeySetting:, and PlayerEntity(KeyMapperInternal)::unsetKeySetting:.

+ Here is the caller graph for this function:

◆ injectorsEngaged

- (BOOL) injectorsEngaged

Definition at line 3752 of file PlayerEntity.m.

3753{
3754 return afterburner_engaged;
3755}

References afterburner_engaged, and injectorsEngaged.

Referenced by hyperspeedFactor, and injectorsEngaged.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insideAtmosphereFraction

- (GLfloat) insideAtmosphereFraction

Definition at line 2589 of file PlayerEntity.m.

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

References ATMOSPHERE_DEPTH, dialAltitude, insideAtmosphereFraction, PLAYER_DIAL_MAX_ALTITUDE, and UNIVERSE.

Referenced by insideAtmosphereFraction, and wormhole.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inspCanBecomeTarget

- (BOOL) inspCanBecomeTarget
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOEntityInspectorExtensions).

Definition at line 218 of file OOEntityInspectorExtensions.m.

219{
220 return NO;
221}

◆ inspDescription

- (NSString *) inspDescription
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOEntityInspectorExtensions).

Definition at line 224 of file OOEntityInspectorExtensions.m.

225{
226 return @"Player";
227}

◆ inspSecondaryIdentityLine

- (NSString *) inspSecondaryIdentityLine
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOEntityInspectorExtensions).

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

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

References ENERGY_UNIT_NAVAL, ENERGY_UNIT_NONE, ENERGY_UNIT_NORMAL, and installedEnergyUnitType.

Referenced by alertCondition, dumpSelfState, installedEnergyUnitType, and setCommanderDataFromDictionary:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ interpretAIMessage:

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

Reimplemented from ShipEntity.

Definition at line 5865 of file PlayerEntity.m.

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

References ShipEntity::_primaryTarget, autopilot_engaged, compassMode, DESTROY, ShipEntity::doScriptEvent:, isDocked, nil, playAegisCloseToPlanet, playAegisCloseToStation, playDockingDenied, playHitByECMSound, playHoldFull, playIncomingMissile:, Entity::position, ShipEntity::primaryAggressor, resetAutopilotAI, setCompassMode:, ShipEntity::setStatus:, OOMusicController::sharedController, Entity::status, and OOMusicController::stopDockingMusic.

+ Here is the call graph for this function:

◆ isBeeping

- (BOOL) isBeeping

Provided by category PlayerEntity(Sound).

Definition at line 193 of file PlayerEntitySound.m.

194{
196}

◆ isDocked

- (BOOL) isDocked

Definition at line 13111 of file PlayerEntity.m.

13112{
13113 BOOL isDockedStatus = NO;
13114
13115 switch ([self status])
13116 {
13117 case STATUS_DOCKED:
13118 case STATUS_DOCKING:
13119 case STATUS_START_GAME:
13120 isDockedStatus = YES;
13121 break;
13122 // special case - can be either docked or not, so avoid safety check below
13123 case STATUS_RESTART_GAME:
13124 return NO;
13125 case STATUS_EFFECT:
13126 case STATUS_ACTIVE:
13127 case STATUS_COCKPIT_DISPLAY:
13128 case STATUS_TEST:
13129 case STATUS_INACTIVE:
13130 case STATUS_DEAD:
13131 case STATUS_IN_FLIGHT:
13132 case STATUS_AUTOPILOT_ENGAGED:
13133 case STATUS_LAUNCHING:
13134 case STATUS_WITCHSPACE_COUNTDOWN:
13135 case STATUS_ENTERING_WITCHSPACE:
13136 case STATUS_EXITING_WITCHSPACE:
13137 case STATUS_ESCAPE_SEQUENCE:
13138 case STATUS_IN_HOLD:
13139 case STATUS_BEING_SCOOPED:
13140 case STATUS_HANDLING_ERROR:
13141 break;
13142 //no default, so that we get notified by the compiler if something is missing
13143 }
13144
13145#ifndef NDEBUG
13146 // Sanity check
13147 if (isDockedStatus)
13148 {
13149 if ([self dockedStation] == nil)
13150 {
13151 //there are a number of possible current statuses, not just STATUS_DOCKED
13152 OOLogERR(kOOLogInconsistentState, @"status is %@, but dockedStation is nil; treating as not docked. %@", OOStringFromEntityStatus([self status]), @"This is an internal error, please report it.");
13153 [self setStatus:STATUS_IN_FLIGHT];
13154 isDockedStatus = NO;
13155 }
13156 }
13157 else
13158 {
13159 if ([self dockedStation] != nil && [self status] != STATUS_LAUNCHING)
13160 {
13161 OOLogERR(kOOLogInconsistentState, @"status is %@, but dockedStation is not nil; treating as docked. %@", OOStringFromEntityStatus([self status]), @"This is an internal error, please report it.");
13162 [self setStatus:STATUS_DOCKED];
13163 isDockedStatus = YES;
13164 }
13165 }
13166#endif
13167
13168 return isDockedStatus;
13169}
NSString * OOStringFromEntityStatus(OOEntityStatus status) CONST_FUNC
NSString *const kOOLogInconsistentState
Definition OOLogging.m:650

References dockedStation, isDocked, kOOLogInconsistentState, nil, OOLogERR, OOStringFromEntityStatus(), ShipEntity::setStatus:, and Entity::status.

Referenced by cancelDockingRequest:, dialAltitude, doWorldEventUntilMissionScreen:, engageAutopilotToStation:, getDestroyedBy:damageType:, interpretAIMessage:, isDocked, performDockingRequest:, PlayerEntity(OOControlsPrivate)::pollMarketScreenControls, setGuiToStatusScreen, tryBuyingCommodity:all:, trySellingCommodity:all:, unloadCargoPods, and update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMining

- (BOOL) isMining
implementation

Reimplemented from ShipEntity.

Definition at line 11524 of file PlayerEntity.m.

11525{
11526 return using_mining_laser;
11527}

References isMining, and using_mining_laser.

Referenced by isMining.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMouseControlOn

- (BOOL) isMouseControlOn

Definition at line 4724 of file PlayerEntity.m.

4725{
4726 return mouse_control_on;
4727}

References isMouseControlOn, and mouse_control_on.

Referenced by isMouseControlOn, leaveDock:, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPlayerLikeShip

- (BOOL) isPlayerLikeShip
implementation

Reimplemented from Entity.

Provided by category PlayerEntity(ProxyPlayer).

Definition at line 225 of file ProxyPlayerEntity.m.

226{
227 return YES;
228}

◆ isSpeechOn

- (OOSpeechSettings) isSpeechOn

References getFined, int(), isSpeechOn, renovationCosts, renovationFactor, setDefaultCustomViews, setDefaultViewOffsets, setUpTrumbles, tradeInFactor, trumbleArray, and weaponViewOffset.

+ Here is the call graph for this function:

◆ isValidTarget:

- (BOOL) isValidTarget: (Entity*) target

Reimplemented from ShipEntity.

Definition at line 4017 of file PlayerEntity.m.

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

References ShipEntity::hasMilitaryScannerFilter, ident_engaged, ShipEntity::isCloaked, ShipEntity::isJammingScanning, Entity::isShip, Entity::isWormhole, ShipEntity::scanClass, SCANNER_MAX_RANGE2, Entity::status, and Entity::zero_distance.

+ Here is the call graph for this function:

◆ javaScriptEngineWillReset:

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

Provided by category PlayerEntity(OOJavaScriptExtensions).

Definition at line 335 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}
struct JSObject * _jsSelf
Definition Entity.h:152

◆ jumpCause

- (NSString *) jumpCause

Definition at line 13069 of file PlayerEntity.m.

13070{
13071 return _jumpCause;
13072}

References _jumpCause, and jumpCause.

Referenced by Universe::carryPlayerOn:inWormhole:, custom_chart_zoom, enterGalacticWitchspace, enterWitchspace, enterWormhole:, jumpCause, leaveWitchspace, PlayerEntity(OOPrivate)::performWitchspaceExitUpdates:, and Universe::setUpUniverseFromStation.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keyBindingDescription2:

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

Provided by category PlayerEntity(ScriptMethods).

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

References ResourceManager::dictionaryFromFilesNamed:inFolder:mergeMode:cache:.

Referenced by PlayerEntity(KeyMapper)::keyboardLayoutList, and PlayerEntity(KeyMapper)::setGuiToKeyMapperScreen:resetCurrentRow:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keyboardLayoutList

- (NSArray *) keyboardLayoutList
implementation

Provided by category PlayerEntity(KeyMapper).

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

Referenced by PlayerEntity(KeyMapperInternal)::displayKeyboardLayoutList:skip:.

+ Here is the caller graph for this function:

◆ keyCodeDescription:

- (NSString *) keyCodeDescription: (OOKeyCode) code

Provided by category PlayerEntity(ScriptMethods).

Definition at line 415 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

Referenced by PlayerEntity(ScriptMethods)::getKeyBindingDescription:, PlayerEntity(KeyMapper)::setGuiToKeyConfigScreen:, and PlayerEntity(KeyMapperInternal)::updateShiftKeyDefinition:index:.

+ Here is the caller graph for this function:

◆ keyCodeDescriptionShort:

- (NSString *) keyCodeDescriptionShort: (OOKeyCode) code

Provided by category PlayerEntity(ScriptMethods).

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

Referenced by PlayerEntity(KeyMapper)::setGuiToKeyConfigEntryScreen.

+ Here is the caller graph for this function:

◆ keyConfig

- (NSDictionary *) keyConfig

Definition at line 4717 of file PlayerEntity.m.

4718{
4719 //return keyconfig_settings;
4720 return keyconfig2_settings;
4721}

References keyConfig, and keyconfig2_settings.

Referenced by keyConfig, and showDemoShips.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keyFunctionList

- (NSArray *) keyFunctionList
implementation

Provided by category PlayerEntity(KeyMapperInternal).

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

References count, PlayerEntity(KeyMapperInternal)::keyFunctionList, makeKeyGuiDict:keyDef:, and makeKeyGuiDictHeader:.

Referenced by PlayerEntity(KeyMapperInternal)::displayKeyFunctionList:skip:, and PlayerEntity(KeyMapperInternal)::keyFunctionList.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keyMapperInputHandler:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 198 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
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
285 OOEquipmentType *item = [OOEquipmentType equipmentTypeWithIdentifier:eq];
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
void setGuiToGameOptionsScreen()

Referenced by PlayerEntity(OOControlsPrivate)::handleKeyMapperScreenKeys.

+ Here is the caller graph for this function:

◆ laserHeatLevel

- (GLfloat) laserHeatLevel
implementation

Reimplemented from ShipEntity.

Definition at line 4828 of file PlayerEntity.m.

4829{
4830 GLfloat result = (GLfloat)weapon_temp / (GLfloat)PLAYER_MAX_WEAPON_TEMP;
4831 return OOClamp_0_1_f(result);
4832}

References laserHeatLevel, PLAYER_MAX_WEAPON_TEMP, and ShipEntity::weapon_temp.

Referenced by laserHeatLevel.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ laserHeatLevelAft

- (GLfloat) laserHeatLevelAft
implementation

Reimplemented from ShipEntity.

Definition at line 4835 of file PlayerEntity.m.

4836{
4837 GLfloat result = aft_weapon_temp / (GLfloat)PLAYER_MAX_WEAPON_TEMP;
4838 return OOClamp_0_1_f(result);
4839}

References ShipEntity::aft_weapon_temp, laserHeatLevelAft, and PLAYER_MAX_WEAPON_TEMP.

Referenced by laserHeatLevelAft.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ laserHeatLevelForward

- (GLfloat) laserHeatLevelForward
implementation

Reimplemented from ShipEntity.

Definition at line 4842 of file PlayerEntity.m.

4843{
4844 GLfloat result = forward_weapon_temp / (GLfloat)PLAYER_MAX_WEAPON_TEMP;
4845// no need to check subents here
4846 return OOClamp_0_1_f(result);
4847}

References ShipEntity::forward_weapon_temp, laserHeatLevelForward, and PLAYER_MAX_WEAPON_TEMP.

Referenced by laserHeatLevelForward.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ laserHeatLevelPort

- (GLfloat) laserHeatLevelPort
implementation

Reimplemented from ShipEntity.

Definition at line 4850 of file PlayerEntity.m.

4851{
4852 GLfloat result = port_weapon_temp / PLAYER_MAX_WEAPON_TEMP;
4853 return OOClamp_0_1_f(result);
4854}

References laserHeatLevelPort, PLAYER_MAX_WEAPON_TEMP, and ShipEntity::port_weapon_temp.

Referenced by laserHeatLevelPort.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ laserHeatLevelStarboard

- (GLfloat) laserHeatLevelStarboard
implementation

Reimplemented from ShipEntity.

Definition at line 4857 of file PlayerEntity.m.

4858{
4860 return OOClamp_0_1_f(result);
4861}

References laserHeatLevelStarboard, PLAYER_MAX_WEAPON_TEMP, and ShipEntity::starboard_weapon_temp.

Referenced by laserHeatLevelStarboard.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lastsaveName

- (NSString *) lastsaveName

Definition at line 13089 of file PlayerEntity.m.

13090{
13091 return _lastsaveName;
13092}

References _lastsaveName, and lastsaveName.

Referenced by PlayerEntity(LoadSave)::autosavePlayer, commanderDataDictionary, lastsaveName, and PlayerEntity(LoadSave)::savePlayer.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ launchEscapeCapsule

- (ShipEntity *) launchEscapeCapsule
implementation

Reimplemented from ShipEntity.

Definition at line 6598 of file PlayerEntity.m.

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

References aft_shot_time, Entity::boundingBox, bounty, clearRolesFromPlayer:, createDoppelganger, DOCKING_CLEARANCE_STATUS_NOT_REQUIRED, dockingClearanceStatus, ShipEntity::doScriptEvent:withArgument:, Entity::energy, ShipEntity::equipmentItemProviding:, escape_pod_rescue_time, ShipEntity::flightPitch, ShipEntity::flightRoll, ShipEntity::flightSpeed, ShipEntity::flightYaw, forward_shot_time, info_system_id, launchEscapeCapsule, ShipEntity::maxFlightSpeed, ShipEntity::mesh, nil, port_shot_time, Entity::position, ranrot_rand, removeEquipmentItem:, ShipEntity::resetShotTime, setBounty:withReason:, ShipEntity::setDesiredSpeed:, setDockTarget:, setFoundTarget:, ShipEntity::setMesh:, ShipEntity::setOwner:, ShipEntity::setRoll:, ShipEntity::setSpeed:, ShipEntity::setStatus:, ShipEntity::setThrust:, Entity::setVelocity:, ship_clock_adjust, ship_kills, starboard_shot_time, Entity::status, switchToMainView, system_id, target_system_id, ShipEntity::thrust, trumbleCount, UNIVERSE, ShipEntity::v_forward, ShipEntity::v_up, and ShipEntity::velocity.

Referenced by launchEscapeCapsule, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ launchFromStation

- (void) launchFromStation

Provided by category PlayerEntity(Scripting).

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

Referenced by PlayerEntity(OOControlsPrivate)::handleUndockControl, and PlayerShipLaunch().

+ Here is the caller graph for this function:

◆ launchMine:

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

Definition at line 6006 of file PlayerEntity.m.

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

References ShipEntity::doScriptEvent:withArgument:, ShipEntity::dumpItem:, nil, ShipEntity::setBehaviour:, ShipEntity::setOwner:, Entity::setScanClass:, Entity::setVelocity:, ShipEntity::v_forward, ShipEntity::velocity, and weaponsOnline.

Referenced by fireMissile.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leaveDock:

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

Reimplemented from ShipEntity.

Definition at line 7246 of file PlayerEntity.m.

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

References _missionWithCallback, addRoleToPlayer:, aft_shield, ShipEntity::aft_weapon_temp, StationEntity::autoDockShipsOnApproach, bounty, breakPatternPosition, ShipEntity::checkForAegis, clearAlertFlags, StationEntity::clearDockingCorridor, clearTargetMemory, ShipEntity::currentWeaponFacing, currentWeaponStats, demoShip, dockedStation, doMissionCallback, doWorldEventUntilMissionScreen:, ShipEntity::flightRoll, forward_shield, ShipEntity::forward_weapon_temp, gui_screen, hud, ident_engaged, isMouseControlOn, kZeroVector, launchRoll, StationEntity::launchShip:, StationEntity::legalStatusOfManifest:export:, loadCargoPods, markAsOffender:withReason:, maxAftShieldLevel, maxForwardShieldLevel, nil, noteGUIDidChangeFrom:to:, playLaunchFromStation, ShipEntity::port_weapon_temp, scanner_zoom_rate, setDockedStation:, setDockingClearanceStatus:, HeadUpDisplay::setScannerZoom:, setShowDemoShips:, OOMusicController::sharedController, ship_clock_adjust, ShipEntity::starboard_weapon_temp, OOMusicController::stop, ShipEntity::suppressAegisMessages, ShipEntity::velocity, and WEAPON_FACING_FORWARD.

Referenced by StationEntity::becomeExplosion, and PlayerEntity(Scripting)::launchFromStation.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leaveWitchspace

- (void) leaveWitchspace
implementation

Reimplemented from ShipEntity.

Definition at line 7832 of file PlayerEntity.m.

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

References WormholeEntity::arrivalTime, ShipEntity::being_fined, breakPatternPosition, clearRoleFromPlayer:, clearTargetMemory, count, currentSystemID, ShipEntity::doScriptEvent:withArgument:, WormholeEntity::exitSpeed, ShipEntity::flightPitch, ShipEntity::flightRoll, ShipEntity::flightSpeed, ShipEntity::flightYaw, ShipEntity::forwardVector, galactic_witchjump, OOJavaScriptEngine::garbageCollectionOpportunity:, gui_screen, HPvector_forward_from_quaternion(), jumpCause, kZeroVector, leaveWitchspace, ShipEntity::maxFlightSpeed, nil, playExitWitchspace, Entity::position, quaternion_set_random(), Ranrot(), roleSystemList, SCANNER_MAX_RANGE, WormholeEntity::setContainsPlayer:, WormholeEntity::setExitPosition:, WormholeEntity::setExitSpeed:, Entity::setOrientation:, setShowDemoShips:, ShipEntity::setStatus:, OOJavaScriptEngine::sharedEngine, ShipEntity::velocity, and wormhole.

Referenced by leaveWitchspace, Universe::setUpUniverseFromMisjump, and Universe::setUpUniverseFromWitchspace.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ legalStatusOfCargoList

- (unsigned) legalStatusOfCargoList

Definition at line 8421 of file PlayerEntity.m.

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

References OOCommodityMarket::exportLegalityForGood:, legalStatusOfCargoList, nil, OOCommodityMarket::quantityForGood:, and shipCommodityData.

Referenced by enterWitchspace, legalStatusOfCargoList, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadCargoPods

- (void) loadCargoPods

Definition at line 475 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

References calculateCurrentCargo, ShipEntity::cargo_dump_time, loadCargoPods, loadCargoPodsForType:fromManifest:, nil, and shipCommodityData.

Referenced by leaveDock:, and loadCargoPods.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadCargoPodsForType:amount:

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

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

References ShipEntity::cargo, count, GRAMS_PER_POD, KILOGRAMS_PER_POD, OOCommodityMarket::massUnitForGood:, MAX_GRAMS_IN_SAFE, MAX_KILOGRAMS_IN_SAFE, ShipEntity::maxAvailableCargoSpace, OOCommodityMarket::quantityForGood:, ShipEntity::setCommodity:andAmount:, OOCommodityMarket::setQuantity:forGood:, Entity::setScanClass:, ShipEntity::setStatus:, UNITS_GRAMS, UNITS_KILOGRAMS, and UNITS_TONS.

Referenced by setCargoQuantityForType:amount:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadCargoPodsForType:fromManifest:

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

Definition at line 337 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)

References createCargoPodWithType:andAmount:, GRAMS_PER_POD, KILOGRAMS_PER_POD, OOCommodityMarket::massUnitForGood:, MAX_GRAMS_IN_SAFE, MAX_KILOGRAMS_IN_SAFE, OOCommodityMarket::quantityForGood:, OOCommodityMarket::setQuantity:forGood:, UNITS_KILOGRAMS, and UNITS_TONS.

Referenced by loadCargoPods.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadKeySettings

- (NSDictionary *) loadKeySettings
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 1729 of file PlayerEntityKeyMapper.m.

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

References PlayerEntity(KeyMapperInternal)::loadKeySettings.

Referenced by PlayerEntity(KeyMapperInternal)::displayKeyFunctionList:skip:, PlayerEntity(KeyMapperInternal)::loadKeySettings, and PlayerEntity(KeyMapperInternal)::resetKeyFunctions.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadPlayer

- (BOOL) loadPlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 101 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 597 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];
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];
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)

Referenced by PlayerEntity(OOLoadSavePrivate)::loadPlayerWithPanel, PlayerEntity(OOControlsPrivate)::pollDemoControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and PlayerEntity(LoadSave)::startScenario.

+ Here is the caller graph for this function:

◆ loadPlayerWithPanel

- (BOOL) loadPlayerWithPanel
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

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

Referenced by PlayerEntity(LoadSave)::loadPlayer.

+ Here is the caller graph for this function:

◆ localMarket

- (OOCommodityMarket *) localMarket

Definition at line 10835 of file PlayerEntity.m.

10836{
10837 StationEntity *station = [self dockedStation];
10838 if (station == nil)
10839 {
10840 if ([[self primaryTarget] isStation] && [(StationEntity *)[self primaryTarget] marketBroadcast])
10841 {
10842 station = [self primaryTarget];
10843 }
10844 else
10845 {
10846 station = [UNIVERSE station];
10847 }
10848 if (station == nil)
10849 {
10850 // interstellar space or similar
10851 return nil;
10852 }
10853 }
10854 OOCommodityMarket *localMarket = [station localMarket];
10855 if (localMarket == nil)
10856 {
10858 }
10859
10860 return localMarket;
10861}
OOCommodityMarket * localMarket

References dockedStation, StationEntity::initialiseLocalMarket, Entity::isStation, localMarket, StationEntity::localMarket, nil, and ShipEntity::primaryTarget.

Referenced by commanderDataDictionary, docked, localMarket, PlayerEntity(OOControlsPrivate)::pollMarketScreenControls, roleWeights, setGuiToMarketInfoScreen, setGuiToMarketScreen, tryBuyingCommodity:all:, and trySellingCommodity:all:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ localVariableForKey:andMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 686 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by PlayerEntity(Scripting)::add:, PlayerEntity(Scripting)::decrement:, PlayerEntity(Scripting)::increment:, and PlayerEntity(Scripting)::subtract:.

+ Here is the caller graph for this function:

◆ localVariablesForMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 669 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, PlayerEntity(Scripting)::replaceVariablesInString:, PlayerEntity(ScriptingPrivate)::scriptTestCondition:, and PlayerEntity(Scripting)::setLocalVariable:forKey:andMission:.

+ Here is the caller graph for this function:

◆ longRangeChartMode

- (OOLongRangeChartMode) longRangeChartMode

References longRangeChartMode.

◆ lookingAtSunWithThresholdAngleCos:

- (GLfloat) lookingAtSunWithThresholdAngleCos: (GLfloat) thresholdAngleCos
implementation

Reimplemented from ShipEntity.

Definition at line 2506 of file PlayerEntity.m.

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

References customViewForwardVector, EXPECT, EXPECT_NOT, Entity::isPlanet, Entity::isPlayer, Entity::isShip, Entity::isSunlit, ShipEntity::isVisible, Entity::orientation, Entity::position, quaternion_rotate_vector(), Entity::relativePosition, shadowAtPointOcclusionToValue(), UNIVERSE, ShipEntity::v_forward, ShipEntity::v_right, and viewpointPosition.

+ Here is the call graph for this function:

◆ loseTargetStatus

- (void) loseTargetStatus

Definition at line 7066 of file PlayerEntity.m.

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

References Entity::isShip, loseTargetStatus, ShipEntity::noteLostTarget, ShipEntity::primaryTarget, and UNIVERSE.

Referenced by docked, getDestroyedBy:damageType:, loseTargetStatus, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 1008 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
NSMutableArray * cdrDetailArray
NSString * lastsaveName()

Referenced by PlayerEntity(LoadSave)::commanderSelector, PlayerEntity(LoadSave)::saveCommanderInputHandler, PlayerEntity(OOLoadSavePrivate)::setGuiToLoadCommanderScreen, and PlayerEntity(OOLoadSavePrivate)::setGuiToSaveCommanderScreen:.

+ Here is the caller graph for this function:

◆ makeKeyGuiDict:keyDef:

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

Provided by category PlayerEntity(KeyMapper).

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

Referenced by PlayerEntity(KeyMapperInternal)::keyFunctionList.

+ Here is the caller graph for this function:

◆ makeKeyGuiDictHeader:

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

Provided by category PlayerEntity(KeyMapper).

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

Referenced by PlayerEntity(KeyMapperInternal)::keyFunctionList.

+ Here is the caller graph for this function:

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

Referenced by PlayerEntity(StickMapperInternal)::stickFunctionList.

+ Here is the caller graph for this function:

◆ makeStickGuiDictHeader:

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

Provided by category PlayerEntity(StickMapper).

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

Referenced by PlayerEntity(StickMapperInternal)::stickFunctionList.

+ Here is the caller graph for this function:

◆ markAsOffender:

- (void) markAsOffender: (int) offence_value
implementation

Reimplemented from ShipEntity.

Definition at line 6836 of file PlayerEntity.m.

6836 :(int)offence_value
6837{
6838 [self markAsOffender:offence_value withReason:kOOLegalStatusReasonUnknown];
6839}

References markAsOffender:withReason:.

+ Here is the call graph for this function:

◆ markAsOffender:withReason:

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

Reimplemented from ShipEntity.

Definition at line 6842 of file PlayerEntity.m.

6842 :(int)offence_value withReason:(OOLegalStatusReason)reason
6843{
6844 if (![self isCloaked])
6845 {
6846 JSContext *context = OOJSAcquireContext();
6847
6848 jsval amountVal = JSVAL_VOID;
6849 int amountVal2 = (legalStatus | offence_value) - legalStatus;
6850 JS_NewNumberValue(context, amountVal2, &amountVal);
6851
6852 legalStatus |= offence_value; // can't set the new bounty until the size of the change is known
6853
6854 jsval reasonVal = OOJSValueFromLegalStatusReason(context, reason);
6855
6856 ShipScriptEvent(context, self, "shipBountyChanged", amountVal, reasonVal);
6857
6858 OOJSRelinquishContext(context);
6859
6860 }
6861}
OOINLINE jsval OOJSValueFromLegalStatusReason(JSContext *context, OOLegalStatusReason value)
OOLegalStatusReason
Definition OOTypes.h:157

References ShipEntity::isCloaked, legalStatus, OOJSAcquireContext(), OOJSRelinquishContext(), OOJSValueFromLegalStatusReason(), and ShipScriptEvent.

Referenced by collectBountyFor:, docked, leaveDock:, and markAsOffender:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markedDestinations

- (NSDictionary *) markedDestinations

Definition at line 8743 of file PlayerEntity.m.

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

References cargoContractMarker:, markedDestinations, missionDestinations, nil, parcelContractMarker:, and passengerContractMarker:.

Referenced by GuiDisplayGen(Internal)::drawStarChart:x:y:z:alpha:, markedDestinations, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markerKey:

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

Definition at line 13325 of file PlayerEntity.m.

13325 :(NSDictionary *)marker
13326{
13327 return [NSString stringWithFormat:@"%d-%@",[marker oo_intForKey:@"system"], [marker oo_stringForKey:@"name"]];
13328}

Referenced by addMissionDestinationMarker:, and removeMissionDestinationMarker:.

+ Here is the caller graph for this function:

◆ marketScreenTitle

- (NSString *) marketScreenTitle
implementation

Definition at line 11017 of file PlayerEntity.m.

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

References ShipEntity::displayName, dockedStation, Entity::isStation, marketScreenTitle, nil, OOExpandKey, ShipEntity::primaryTarget, and UNIVERSE.

Referenced by marketScreenTitle, and setGuiToMarketScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ massLockable

- (BOOL) massLockable

References atHyperspeed, disengageAutopilot, dockedStation, getTargetDockStation, massLockable, massLocked, occlusionLevel, resetAutopilotAI, and setDockedAtMainStation.

+ Here is the call graph for this function:

◆ massLocked

- (BOOL) massLocked

Definition at line 4471 of file PlayerEntity.m.

4472{
4473 return ((alertFlags & ALERT_FLAG_MASS_LOCK) != 0);
4474}

References ALERT_FLAG_MASS_LOCK, alertFlags, and massLocked.

Referenced by ProxyPlayerEntity::copyValuesFromPlayer:, doBookkeeping:, massLockable, massLocked, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maxAftShieldLevel

- (float) maxAftShieldLevel
implementation

Reimplemented from ShipEntity.

Definition at line 4651 of file PlayerEntity.m.

4652{
4653 return max_aft_shield;
4654}
GLfloat max_aft_shield

References max_aft_shield, and maxAftShieldLevel.

Referenced by dialAftShield, doBookkeeping:, docked, leaveDock:, maxAftShieldLevel, setAftShieldLevel:, setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maxForwardShieldLevel

- (float) maxForwardShieldLevel
implementation

Reimplemented from ShipEntity.

Definition at line 4645 of file PlayerEntity.m.

4646{
4647 return max_forward_shield;
4648}
GLfloat max_forward_shield

References max_forward_shield, and maxForwardShieldLevel.

Referenced by dialForwardShield, doBookkeeping:, docked, leaveDock:, maxForwardShieldLevel, setCommanderDataFromDictionary:, setForwardShieldLevel:, and setUpAndConfirmOK:saveGame:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maxPlayerRoles

- (NSUInteger) maxPlayerRoles

Definition at line 5149 of file PlayerEntity.m.

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

References maxPlayerRoles, and ship_kills.

Referenced by addRoleToPlayer:, addRoleToPlayer:inSlot:, maxPlayerRoles, roleWeights, and setCommanderDataFromDictionary:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ messageShipAIs:

- (void) messageShipAIs: (NSString *) roles_message

Provided by category PlayerEntity(Scripting).

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

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

References ShipEntity::max_missiles, missile_entity, and nil.

◆ missilesList

- (NSArray *) missilesList
implementation

Reimplemented from ShipEntity.

Definition at line 8342 of file PlayerEntity.m.

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

References missilesList, ShipEntity::missilesList, and tidyMissilePylons.

Referenced by missilesList.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ missingSubEntitiesAdjustment

- (NSInteger) missingSubEntitiesAdjustment

Provided by category PlayerEntity(Contracts).

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

Referenced by renovationCosts, and PlayerEntity(ContractsPrivate)::tradeInValue.

+ Here is the caller graph for this function:

◆ mission_string

- (NSString *) mission_string

Provided by category PlayerEntity(Scripting).

Definition at line 907 of file PlayerEntityLegacyScriptEngine.m.

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

◆ missionBackgroundDescriptor

- (NSDictionary *) missionBackgroundDescriptor

Definition at line 12729 of file PlayerEntity.m.

12730{
12732}

References _missionBackgroundDescriptor, and missionBackgroundDescriptor.

Referenced by customViewDescription, missionBackgroundDescriptor, missionBackgroundDescriptorOrDefault, and PlayerEntity(Scripting)::setGuiToMissionScreenWithCallback:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ missionBackgroundDescriptorOrDefault

- (NSDictionary *) missionBackgroundDescriptorOrDefault

Definition at line 12735 of file PlayerEntity.m.

12736{
12737 NSDictionary *result = [self missionBackgroundDescriptor];
12738 if (result == nil)
12739 {
12740 result = [UNIVERSE screenTextureDescriptorForKey:@"mission"];
12741 }
12742
12743 return result;
12744}

References missionBackgroundDescriptor, missionBackgroundDescriptorOrDefault, and nil.

Referenced by customViewDescription, missionBackgroundDescriptorOrDefault, and PlayerEntity(Scripting)::setGuiToMissionScreenWithCallback:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ missionBackgroundSpecial

- (OOGUIBackgroundSpecial) missionBackgroundSpecial

Definition at line 12757 of file PlayerEntity.m.

12758{
12760}

References _missionBackgroundSpecial, and missionBackgroundSpecial.

Referenced by customViewDescription, missionBackgroundSpecial, and PlayerEntity(Scripting)::setGuiToMissionScreenWithCallback:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ missionChoice_string

- (NSString *) missionChoice_string

Provided by category PlayerEntity(Scripting).

Definition at line 1067 of file PlayerEntityLegacyScriptEngine.m.

1068{
1069 return missionChoice;
1070}
NSString * missionChoice

◆ missionExitScreen

- (OOGUIScreenID) missionExitScreen

Definition at line 12859 of file PlayerEntity.m.

12860{
12861 return _missionExitScreen;
12862}
OOGUIScreenID _missionExitScreen

References _missionExitScreen, and missionExitScreen.

Referenced by customViewDescription, and missionExitScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ missionKeyPress_string

- (NSString *) missionKeyPress_string

Provided by category PlayerEntity(Scripting).

Definition at line 1073 of file PlayerEntityLegacyScriptEngine.m.

1074{
1075 return missionKeyPress;
1076}
NSString * missionKeyPress

◆ missionOverlayDescriptor

- (NSDictionary *) missionOverlayDescriptor

Definition at line 12694 of file PlayerEntity.m.

12695{
12697}

References _missionOverlayDescriptor, and missionOverlayDescriptor.

Referenced by customViewDescription, missionOverlayDescriptor, and missionOverlayDescriptorOrDefault.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ missionOverlayDescriptorOrDefault

- (NSDictionary *) missionOverlayDescriptorOrDefault

Definition at line 12700 of file PlayerEntity.m.

12701{
12702 NSDictionary *result = [self missionOverlayDescriptor];
12703 if (result == nil)
12704 {
12705 if ([[self missionTitle] length] == 0)
12706 {
12707 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_no_title"];
12708 }
12709 else
12710 {
12711 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_with_title"];
12712 }
12713 }
12714
12715 return result;
12716}

References missionOverlayDescriptor, missionOverlayDescriptorOrDefault, missionTitle, and nil.

Referenced by customViewDescription, missionOverlayDescriptorOrDefault, and PlayerEntity(Scripting)::setGuiToMissionScreenWithCallback:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ missionScreenID

- (NSString *) missionScreenID

Provided by category PlayerEntity(Scripting).

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

Referenced by PlayerEntity(Contracts)::setGuiToManifestScreen.

+ Here is the caller graph for this function:

◆ missionTitle

- (NSString *) missionTitle

Provided by category PlayerEntity(Scripting).

Definition at line 2173 of file PlayerEntityLegacyScriptEngine.m.

2174{
2175 return _missionTitle;
2176}
NSString * _missionTitle

Referenced by missionOverlayDescriptorOrDefault, and PlayerEntity(Scripting)::setGuiToMissionScreenWithCallback:.

+ Here is the caller graph for this function:

◆ missionVariableForKey:

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

Provided by category PlayerEntity(Scripting).

Definition at line 651 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 PlayerEntity(Scripting)::add:, PlayerEntity(Scripting)::decrement:, PlayerEntity(Scripting)::increment:, MissionVariablesGetProperty(), and PlayerEntity(Scripting)::subtract:.

+ Here is the caller graph for this function:

◆ missionVariables

- (NSDictionary *) missionVariables

Provided by category PlayerEntity(Scripting).

Definition at line 645 of file PlayerEntityLegacyScriptEngine.m.

646{
647 return mission_variables;
648}

◆ mountMissile:

- (BOOL) mountMissile: (ShipEntity *) missile

Definition at line 5926 of file PlayerEntity.m.

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

References OOEquipmentType::equipmentTypeWithIdentifier:, ShipEntity::max_missiles, missile_entity, ShipEntity::missile_list, ShipEntity::missiles, nil, ShipEntity::primaryRole, and setActiveMissile:.

Referenced by mountMissileWithRole:, and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mountMissileWithRole:

- (BOOL) mountMissileWithRole: (NSString *) role

Definition at line 5947 of file PlayerEntity.m.

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

References ShipEntity::missileCapacity, ShipEntity::missileCount, and mountMissile:.

Referenced by PlayerEntity(Scripting)::awardEquipment:, and ShipAwardEquipment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveForward:

- (void) moveForward: (double) amount
implementation

Reimplemented from Entity.

Definition at line 4355 of file PlayerEntity.m.

4355 :(double) amount
4356{
4357 distanceTravelled += (float)amount;
4358 [self setPosition:HPvector_add(position, vectorToHPVector(vector_multiply_scalar(v_forward, (float)amount)))];
4359}
GLfloat distanceTravelled
Definition Entity.m:775

References Entity::distanceTravelled, and Entity::setPosition:.

Referenced by getDestroyedBy:damageType:, and PlayerEntity(OOPrivate)::performInFlightUpdates:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveTargetMemoryBy:

- (BOOL) moveTargetMemoryBy: (NSInteger) delta

Definition at line 12364 of file PlayerEntity.m.

12364 :(NSInteger)delta
12365{
12366 unsigned i = 0;
12367 while (i++ < PLAYER_TARGET_MEMORY_SIZE) // limit loops
12368 {
12369 NSInteger idx = (NSInteger)target_memory_index + delta;
12370 while (idx < 0) idx += PLAYER_TARGET_MEMORY_SIZE;
12372 target_memory_index = idx;
12373
12374 id targ_id = [target_memory objectAtIndex:target_memory_index];
12375 if ([targ_id isProxy])
12376 {
12377 ShipEntity *potential_target = [(OOWeakReference *)targ_id weakRefUnderlyingObject];
12378
12379 if ((potential_target)&&(potential_target->isShip)&&([potential_target isInSpace]))
12380 {
12381 if (potential_target->zero_distance < SCANNER_MAX_RANGE2 && (![potential_target isCloaked]))
12382 {
12383 [super addTarget:potential_target];
12385 {
12387 {
12388 [missile_entity[activeMissile] addTarget:potential_target];
12390 [self printIdentLockedOnForMissile:YES];
12391 }
12392 else
12393 {
12395 [self playIdentLockedOn];
12396 [self printIdentLockedOnForMissile:NO];
12397 }
12398 }
12399 else
12400 {
12401 ident_engaged = YES;
12402 [self printIdentLockedOnForMissile:NO];
12403 }
12404 [self playTargetSwitched];
12405 return YES;
12406 }
12407 }
12408 else
12409 {
12410 [target_memory replaceObjectAtIndex:target_memory_index withObject:[NSNull null]];
12411 }
12412 }
12413 }
12414
12415 [self playNoTargetInMemory];
12416 return NO;
12417}
BOOL isInSpace()
Definition Entity.m:1120

References activeMissile, ShipEntity::addTarget:, ident_engaged, ShipEntity::isCloaked, Entity::isInSpace, ShipEntity::isMissile, Entity::isShip, missile_entity, missile_status, MISSILE_STATUS_ARMED, MISSILE_STATUS_SAFE, MISSILE_STATUS_TARGET_LOCKED, PLAYER_TARGET_MEMORY_SIZE, playIdentLockedOn, playNoTargetInMemory, playTargetSwitched, printIdentLockedOnForMissile:, SCANNER_MAX_RANGE2, target_memory_index, OOWeakReference::weakRefUnderlyingObject, and Entity::zero_distance.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ multiFunctionDisplayList

- (NSArray *) multiFunctionDisplayList

Definition at line 5508 of file PlayerEntity.m.

5509{
5511}

References multiFunctionDisplayList, and multiFunctionDisplaySettings.

Referenced by hud, multiFunctionDisplayList, and PlayerShipGetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ multiFunctionText:

- (NSString *) multiFunctionText: (NSUInteger) index

Definition at line 5514 of file PlayerEntity.m.

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

References nil.

◆ mungChecksumWithNSString:

- (void) mungChecksumWithNSString: (NSString *) str

Definition at line 12225 of file PlayerEntity.m.

12225 :(NSString *)str
12226{
12227 if (str == nil) return;
12228
12229 NSUInteger i, length = [str length];
12230 for (i = 0; i < length; i++)
12231 {
12232 munge_checksum([str characterAtIndex:i]);
12233 }
12234}

References munge_checksum(), and nil.

Referenced by setTrumbleValueFrom:, and trumbleValue.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nativeSavePlayer:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

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

Referenced by PlayerEntity(LoadSave)::overwriteCommanderInputHandler, and PlayerEntity(LoadSave)::saveCommanderInputHandler.

+ Here is the caller graph for this function:

◆ newShipCommonSetup:yardInfo:baseInfo:

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

Provided by category PlayerEntity(Contracts).

Definition at line 1883 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
1916
1917 if (available_facings & WEAPON_FACING_PORT)
1918 port_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy([shipDict oo_stringForKey:@"port_weapon_type"]);
1919 else
1921
1922 if (available_facings & WEAPON_FACING_STARBOARD)
1923 starboard_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy([shipDict oo_stringForKey:@"starboard_weapon_type"]);
1924 else
1926
1927 if (available_facings & WEAPON_FACING_FORWARD)
1928 forward_weapon_type = OOWeaponTypeFromEquipmentIdentifierSloppy([shipDict oo_stringForKey:@"forward_weapon_type"]);
1929 else
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
unsigned weapons_online

Referenced by PlayerEntity(Contracts)::buySelectedShip, and PlayerEntity(Contracts)::replaceShipWithNamedShip:.

+ Here is the caller graph for this function:

◆ nextHopTargetSystemID

- (OOSystemID) nextHopTargetSystemID

Definition at line 725 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

References ANA_mode, nextHopTargetSystemID, nil, OPTIMIZED_BY_NONE, system_id, and target_system_id.

Referenced by PlayerEntity(Controls)::beginWitchspaceCountdown:, custom_chart_zoom, enterWitchspace, nextHopTargetSystemID, PlayerEntity(OOPrivate)::performWitchspaceCountdownUpdates:, and setGuiToStatusScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nextInfoSystem

- (void) nextInfoSystem

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

References ANA_mode, count, info_system_id, nextInfoSystem, nil, OPTIMIZED_BY_NONE, and setInfoSystemID:moveChart:.

Referenced by custom_chart_zoom, nextInfoSystem, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normaliseReputation

- (void) normaliseReputation

Provided by category PlayerEntity(Contracts).

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

Referenced by setCommanderDataFromDictionary:.

+ Here is the caller graph for this function:

◆ normalOrientation

- (Quaternion) normalOrientation
implementation

Reimplemented from Entity.

Definition at line 4343 of file PlayerEntity.m.

4344{
4345 return make_quaternion(-orientation.w, orientation.x, orientation.y, orientation.z);
4346}

References normalOrientation, and Entity::orientation.

Referenced by createDoppelganger, Universe::firstEntityTargetedByPlayer, and normalOrientation.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noteCompassLostTarget

- (void) noteCompassLostTarget
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 7520 of file PlayerEntity.m.

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

References hud, PlayerEntity(OOPrivate)::noteCompassLostTarget, OOJSAcquireContext(), OOJSRelinquishContext(), OOJSValueFromCompassMode(), HeadUpDisplay::setCompassActive:, and ShipScriptEvent.

Referenced by enterGalacticWitchspace, enterWitchspace, PlayerEntity(OOPrivate)::noteCompassLostTarget, and PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noteGUIDidChangeFrom:to:

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

◆ noteGUIDidChangeFrom:to:refresh:

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

Definition at line 10162 of file PlayerEntity.m.

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

References OOColor::colorWithDescription:, demoShip, galaxyNumber, nil, OOJSAcquireContext(), OOJSRelinquishContext(), OOJSValueFromGUIScreenID(), ShipScriptEvent, and UNIVERSE.

Referenced by noteGUIDidChangeFrom:to:, and setGuiToSystemDataScreenRefreshBackground:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noteGUIWillChangeTo:

- (void) noteGUIWillChangeTo: (OOGUIScreenID) toScreen

Definition at line 10148 of file PlayerEntity.m.

10148 :(OOGUIScreenID)toScreen
10149{
10150 JSContext *context = OOJSAcquireContext();
10151 ShipScriptEvent(context, self, "guiScreenWillChange", OOJSValueFromGUIScreenID(context, toScreen), OOJSValueFromGUIScreenID(context, gui_screen));
10152 OOJSRelinquishContext(context);
10153}

References gui_screen, OOJSAcquireContext(), OOJSRelinquishContext(), OOJSValueFromGUIScreenID(), and ShipScriptEvent.

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, setGuiToInterfacesScreen:, PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen, and setGuiToStatusScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noteSwitchToView:fromView:

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

Provided by category PlayerEntity(Controls).

Definition at line 849 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 noteViewDidChangeFrom:toView:, PlayerShipResetCustomView(), PlayerShipSetCustomView(), and PlayerEntity(OOPrivate)::witchStart.

+ Here is the caller graph for this function:

◆ noteViewDidChangeFrom:toView:

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

Definition at line 10203 of file PlayerEntity.m.

10203 :(OOViewID)fromView toView:(OOViewID)toView
10204{
10205 [self noteSwitchToView:toView fromView:fromView];
10206}

References noteSwitchToView:fromView:.

+ Here is the call graph for this function:

◆ noticeECM

- (void) noticeECM
implementation

Reimplemented from ShipEntity.

Definition at line 6120 of file PlayerEntity.m.

6121{
6122 last_ecm_time = [UNIVERSE getTime];
6123}
double last_ecm_time

References last_ecm_time, and noticeECM.

Referenced by noticeECM.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ occlusionLevel

- (float) occlusionLevel

Definition at line 4483 of file PlayerEntity.m.

4484{
4485 return occlusion_dial;
4486}
float occlusion_dial

References occlusion_dial, and occlusionLevel.

Referenced by massLockable, and occlusionLevel.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOJavaScriptExtensions).

Definition at line 317 of file OOJSPlayerShip.m.

318{
319 return @"PlayerShip";
320}

◆ orientationChanged

- (void) orientationChanged
implementation

Reimplemented from ShipEntity.

Definition at line 4269 of file PlayerEntity.m.

4270{
4271 quaternion_normalize(&orientation);
4273 OOMatrixGetBasisVectors(rotMatrix, &v_right, &v_up, &v_forward);
4274
4275 orientation.w = -orientation.w;
4276 playerRotMatrix = OOMatrixForQuaternionRotation(orientation); // this is the rotation similar to ordinary ships
4277 orientation.w = -orientation.w;
4278}
OOMatrix OOMatrixForQuaternionRotation(Quaternion orientation)
Definition OOMatrix.m:65
OOMatrix rotMatrix
Definition Entity.h:138

References OOMatrixForQuaternionRotation(), Entity::orientation, orientationChanged, playerRotMatrix, Entity::rotMatrix, ShipEntity::v_forward, ShipEntity::v_right, and ShipEntity::v_up.

Referenced by applyRoll:andClimb:, applyYaw:, and orientationChanged.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

Referenced by PlayerEntity(KeyMapper)::setGuiToKeyConfigScreen:.

+ Here is the caller graph for this function:

◆ overwriteCommanderInputHandler

- (void) overwriteCommanderInputHandler

Provided by category PlayerEntity(LoadSave).

Definition at line 561 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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ parcelContractMarker:

- (NSDictionary *) parcelContractMarker: (OOSystemID) system

Provided by category PlayerEntity(ScriptMethods).

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

Referenced by markedDestinations.

+ Here is the caller graph for this function:

◆ parcelCount

- (NSUInteger) parcelCount
implementation

Reimplemented from ShipEntity.

Definition at line 11849 of file PlayerEntity.m.

11850{
11851 return [parcels count];
11852}

References parcelCount.

Referenced by parcelCount, and PlayerShipRemoveParcel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parcelList

- (NSArray *) parcelList

Provided by category PlayerEntity(Contracts).

Definition at line 1089 of file PlayerEntityContracts.m.

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

Referenced by PlayerEntity(Scripting)::missionsList.

+ Here is the caller graph for this function:

◆ parcelListForScripting

- (NSArray *) parcelListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 8485 of file PlayerEntity.m.

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

References contractsListForScriptingFromArray:forCargo:, and parcelListForScripting.

Referenced by parcelListForScripting.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parcelReputation

- (int) parcelReputation

Provided by category PlayerEntity(Contracts).

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

11862{
11863 return max_passengers;
11864}

References max_passengers, and passengerCapacity.

Referenced by passengerCapacity.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ passengerContractMarker:

- (NSDictionary *) passengerContractMarker: (OOSystemID) system

Provided by category PlayerEntity(ScriptMethods).

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

Referenced by markedDestinations.

+ Here is the caller graph for this function:

◆ passengerCount

- (NSUInteger) passengerCount
implementation

Reimplemented from ShipEntity.

Definition at line 11855 of file PlayerEntity.m.

11856{
11857 return [passengers count];
11858}

References passengerCount.

Referenced by passengerCount, and PlayerShipRemovePassenger().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ passengerList

- (NSArray *) passengerList

Provided by category PlayerEntity(Contracts).

Definition at line 1083 of file PlayerEntityContracts.m.

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

Referenced by PlayerEntity(Scripting)::missionsList, and PlayerEntity(Contracts)::setGuiToManifestScreen.

+ Here is the caller graph for this function:

◆ passengerListForScripting

- (NSArray *) passengerListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 8479 of file PlayerEntity.m.

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

References contractsListForScriptingFromArray:forCargo:, and passengerListForScripting.

Referenced by passengerListForScripting.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ passengerReputation

- (int) passengerReputation

Provided by category PlayerEntity(Contracts).

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

13207{
13208 OOCreditsQuantity amountToPay = 0;
13209 OOCreditsQuantity calculatedFine = credits * 0.05;
13210 OOCreditsQuantity maximumFine = 50000ULL;
13211
13212 if ([self clearedToDock])
13213 return;
13214
13215 amountToPay = MIN(maximumFine, calculatedFine);
13216 credits -= amountToPay;
13217 [self addMessageToReport:[NSString stringWithFormat:DESC(@"station-docking-clearance-fined-@-cr"), OOCredits(amountToPay)]];
13218}

References addMessageToReport:, clearedToDock, credits, MIN, and penaltyForUnauthorizedDocking.

Referenced by docked, penaltyForUnauthorizedDocking, and scoopOverride.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

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

References Entity::applyVelocity:, doBookkeeping:, and ShipEntity::processBehaviour:.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

3968 :(OOTimeDelta)delta_t
3969{
3970 [UNIVERSE terminatePostFX:OO_POSTFX_CLOAK];
3971 if ([UNIVERSE ECMVisualFXEnabled]) [UNIVERSE terminatePostFX:OO_POSTFX_CRTBADSIGNAL];
3972
3973 [self gameOverFadeToBW];
3974
3975 if ([self shotTime] > kDeadResetTime)
3976 {
3977 BOOL was_mouse_control_on = mouse_control_on;
3978 [UNIVERSE handleGameOver]; // we restart the UNIVERSE
3979 mouse_control_on = was_mouse_control_on;
3980 }
3981}

References gameOverFadeToBW, kDeadResetTime, and UNIVERSE.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performDockingRequest:

- (void) performDockingRequest: (StationEntity *) stationForDocking

Definition at line 3619 of file PlayerEntity.m.

3619 :(StationEntity *)stationForDocking
3620{
3621 if (stationForDocking == nil) return;
3622 if (![stationForDocking isStation] || ![stationForDocking isKindOfClass:[StationEntity class]]) return;
3623 if ([self isDocked]) return;
3624 if (autopilot_engaged && [self targetStation] == stationForDocking) return;
3625 if (autopilot_engaged && [self targetStation] != stationForDocking)
3626 {
3627 [self disengageAutopilot];
3628 }
3629 NSString *stationDockingClearanceStatus = [stationForDocking acceptDockingClearanceRequestFrom:self];
3630 if (stationDockingClearanceStatus != nil)
3631 {
3632 [self doScriptEvent:OOJSID("playerRequestedDockingClearance") withArgument:stationDockingClearanceStatus];
3633 if ([stationDockingClearanceStatus isEqualToString:@"DOCKING_CLEARANCE_GRANTED"])
3634 {
3635 [self doScriptEvent:OOJSID("playerDockingClearanceGranted")];
3636 }
3637 }
3638}

References StationEntity::acceptDockingClearanceRequestFrom:, autopilot_engaged, disengageAutopilot, ShipEntity::doScriptEvent:, ShipEntity::doScriptEvent:withArgument:, isDocked, Entity::isStation, nil, and ShipEntity::targetStation.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:, and requestDockingClearance:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performDockingUpdates:

- (void) performDockingUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3955 of file PlayerEntity.m.

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

References docked, and UNIVERSE.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performInFlightUpdates:

- (void) performInFlightUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3764 of file PlayerEntity.m.

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

References ShipEntity::afterburnerFactor, applyRoll:andClimb:, Entity::applyVelocity:, applyYaw:, HYPERSPEED_FACTOR, kZeroVector, moveForward:, STAGE_TRACKING_BEGIN, STAGE_TRACKING_END, UPDATE_STAGE, updateTargeting, VELOCITY_CLEANUP_FULL, VELOCITY_CLEANUP_MIN, and VELOCITY_CLEANUP_RATE.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performLaunchingUpdates:

- (void) performLaunchingUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3932 of file PlayerEntity.m.

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

References checkScript, doBookkeeping:, ShipEntity::doScriptEvent:withArgument:, setDockingClearanceStatus:, ShipEntity::setStatus:, and UNIVERSE.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

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

References doBookkeeping:, enterGalacticWitchspace, enterWitchspace, EXPECT_NOT, nextHopTargetSystemID, OOJSSTR, playHyperspaceAborted, ShipEntity::setStatus:, ShipScriptEventNoCx, STAGE_TRACKING_BEGIN, STAGE_TRACKING_END, and UPDATE_STAGE.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performWitchspaceExitUpdates:

- (void) performWitchspaceExitUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3889 of file PlayerEntity.m.

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

References checkScript, doBookkeeping:, ShipEntity::doScriptEvent:withArgument:, jumpCause, ShipEntity::resetExhaustPlumes, resetScriptTimer, ShipEntity::setScriptedMisjump:, ShipEntity::setScriptedMisjumpRange:, ShipEntity::setStatus:, and UNIVERSE.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ planet_number

- (NSNumber *) planet_number

Provided by category PlayerEntity(Scripting).

Definition at line 931 of file PlayerEntityLegacyScriptEngine.m.

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

◆ playAegisCloseToPlanet

- (void) playAegisCloseToPlanet

Provided by category PlayerEntity(Sound).

Definition at line 716 of file PlayerEntitySound.m.

717{
718 [sMiscSoundPool playSoundWithKey:@"[aegis-planet]" position:kInterfaceBeepPosition];
719}
void playSoundWithKey:position:(NSString *key,[position] Vector position)

Referenced by interpretAIMessage:.

+ Here is the caller graph for this function:

◆ playAegisCloseToStation

- (void) playAegisCloseToStation

Provided by category PlayerEntity(Sound).

Definition at line 722 of file PlayerEntitySound.m.

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

Referenced by interpretAIMessage:.

+ Here is the caller graph for this function:

◆ playAlertConditionRed

- (void) playAlertConditionRed

Provided by category PlayerEntity(Sound).

Definition at line 587 of file PlayerEntitySound.m.

588{
589 [sWarningSoundPool playSoundWithKey:@"[alert-condition-red]" priority:2 position:kInterfaceWarningPosition];
590}
void playSoundWithKey:priority:position:(NSString *key,[priority] float priority,[position] Vector position)

◆ playAutopilotCannotDockWithTarget

- (void) playAutopilotCannotDockWithTarget

Provided by category PlayerEntity(Sound).

Definition at line 299 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ playAutopilotOff

- (void) playAutopilotOff

Provided by category PlayerEntity(Sound).

Definition at line 283 of file PlayerEntitySound.m.

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

Referenced by disengageAutopilot.

+ Here is the caller graph for this function:

◆ playAutopilotOn

- (void) playAutopilotOn

Provided by category PlayerEntity(Sound).

Definition at line 277 of file PlayerEntitySound.m.

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

Referenced by engageAutopilotToStation:.

+ Here is the caller graph for this function:

◆ playAutopilotOutOfRange

- (void) playAutopilotOutOfRange

Provided by category PlayerEntity(Sound).

Definition at line 293 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ playBuyCommodity

- (void) playBuyCommodity

Provided by category PlayerEntity(Sound).

Definition at line 497 of file PlayerEntitySound.m.

498{
499 [sBuySellSourcePool playSoundWithKey:@"[buy-commodity]"];
500}
void playSoundWithKey:(NSString *key)

Referenced by buySelectedItem, and PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the caller graph for this function:

◆ playBuyShip

- (void) playBuyShip

Provided by category PlayerEntity(Sound).

Definition at line 503 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ playCantBuyCommodity

- (void) playCantBuyCommodity

Provided by category PlayerEntity(Sound).

Definition at line 515 of file PlayerEntitySound.m.

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

Referenced by buySelectedItem, and PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the caller graph for this function:

◆ playCantBuyShip

- (void) playCantBuyShip

Provided by category PlayerEntity(Sound).

Definition at line 527 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ playCantSellCommodity

- (void) playCantSellCommodity

Provided by category PlayerEntity(Sound).

Definition at line 521 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the caller graph for this function:

◆ playCargoJettisioned

- (void) playCargoJettisioned

Provided by category PlayerEntity(Sound).

Definition at line 271 of file PlayerEntitySound.m.

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

Referenced by dumpCargo.

+ Here is the caller graph for this function:

◆ playChangedOption

- (void) playChangedOption

Provided by category PlayerEntity(Sound).

Definition at line 423 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleGameOptionsScreenKeys, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ playCloakingDeviceInsufficientEnergy

- (void) playCloakingDeviceInsufficientEnergy

Provided by category PlayerEntity(Sound).

Definition at line 491 of file PlayerEntitySound.m.

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

Referenced by activateCloakingDevice.

+ Here is the caller graph for this function:

◆ playCloakingDeviceOff

- (void) playCloakingDeviceOff

Provided by category PlayerEntity(Sound).

Definition at line 375 of file PlayerEntitySound.m.

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

Referenced by deactivateCloakingDevice.

+ Here is the caller graph for this function:

◆ playCloakingDeviceOn

- (void) playCloakingDeviceOn

Provided by category PlayerEntity(Sound).

Definition at line 369 of file PlayerEntitySound.m.

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

Referenced by activateCloakingDevice.

+ Here is the caller graph for this function:

◆ playDirectHit:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

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

Referenced by takeEnergyDamage:from:becauseOf:weaponIdentifier:.

+ Here is the caller graph for this function:

◆ playDismissedMissionScreen

- (void) playDismissedMissionScreen

Provided by category PlayerEntity(Sound).

Definition at line 417 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:.

+ Here is the caller graph for this function:

◆ playDismissedReportScreen

- (void) playDismissedReportScreen

Provided by category PlayerEntity(Sound).

Definition at line 411 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ playDockingDenied

- (void) playDockingDenied

Provided by category PlayerEntity(Sound).

Definition at line 605 of file PlayerEntitySound.m.

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

Referenced by interpretAIMessage:.

+ Here is the caller graph for this function:

◆ playDockWithStation

- (void) playDockWithStation

Provided by category PlayerEntity(Sound).

Definition at line 569 of file PlayerEntitySound.m.

570{
571 [sBreakPatternSource playCustomSoundWithKey:@"[player-dock-with-station]"];
572}
void playCustomSoundWithKey:(NSString *key)
Definition Universe.m:11096

Referenced by enterDock:.

+ Here is the caller graph for this function:

◆ playEnergyLow

- (void) playEnergyLow

Provided by category PlayerEntity(Sound).

Definition at line 599 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 710 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 575 of file PlayerEntitySound.m.

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

Referenced by leaveWitchspace.

+ Here is the caller graph for this function:

◆ playFiredECMSound

- (void) playFiredECMSound

Provided by category PlayerEntity(Sound).

Definition at line 557 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playFuelLeak

- (void) playFuelLeak

Provided by category PlayerEntity(Sound).

Definition at line 641 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(Scripting)::setFuelLeak:.

+ Here is the caller graph for this function:

◆ playGalacticHyperspace

- (void) playGalacticHyperspace

Provided by category PlayerEntity(Sound).

Definition at line 539 of file PlayerEntitySound.m.

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

Referenced by PlayerShipBeginGalacticHyperspaceCountdown(), and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playGameOver

- (void) playGameOver

Provided by category PlayerEntity(Sound).

Definition at line 728 of file PlayerEntitySound.m.

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

Referenced by getDestroyedBy:damageType:.

+ Here is the caller graph for this function:

◆ playHitByECMSound

- (void) playHitByECMSound

Provided by category PlayerEntity(Sound).

Definition at line 551 of file PlayerEntitySound.m.

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

Referenced by interpretAIMessage:.

+ Here is the caller graph for this function:

◆ playHoldFull

- (void) playHoldFull

Provided by category PlayerEntity(Sound).

Definition at line 317 of file PlayerEntitySound.m.

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

Referenced by interpretAIMessage:.

+ Here is the caller graph for this function:

◆ playHostileWarning

- (void) playHostileWarning

Provided by category PlayerEntity(Sound).

Definition at line 581 of file PlayerEntitySound.m.

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

Referenced by warnAboutHostiles.

+ Here is the caller graph for this function:

◆ playHyperspaceAborted

- (void) playHyperspaceAborted

Provided by category PlayerEntity(Sound).

Definition at line 545 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(Controls)::cancelWitchspaceCountdown, and PlayerEntity(OOPrivate)::performWitchspaceCountdownUpdates:.

+ Here is the caller graph for this function:

◆ playHyperspaceBlocked

- (void) playHyperspaceBlocked

Provided by category PlayerEntity(Sound).

Definition at line 359 of file PlayerEntitySound.m.

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

◆ playHyperspaceDistanceTooGreat

- (void) playHyperspaceDistanceTooGreat

Provided by category PlayerEntity(Sound).

Definition at line 364 of file PlayerEntitySound.m.

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

Referenced by witchJumpChecklist:.

+ Here is the caller graph for this function:

◆ playHyperspaceNoFuel

- (void) playHyperspaceNoFuel

Provided by category PlayerEntity(Sound).

Definition at line 353 of file PlayerEntitySound.m.

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

Referenced by witchJumpChecklist:.

+ Here is the caller graph for this function:

◆ playHyperspaceNoTarget

- (void) playHyperspaceNoTarget

Provided by category PlayerEntity(Sound).

Definition at line 347 of file PlayerEntitySound.m.

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

Referenced by witchJumpChecklist:.

+ Here is the caller graph for this function:

◆ playIdentLockedOn

- (void) playIdentLockedOn

Provided by category PlayerEntity(Sound).

Definition at line 217 of file PlayerEntitySound.m.

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

Referenced by addTarget:, PlayerEntity(OOControlsPrivate)::handleButtonIdent, and moveTargetMemoryBy:.

+ Here is the caller graph for this function:

◆ playIdentOff

- (void) playIdentOff

Provided by category PlayerEntity(Sound).

Definition at line 211 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playIdentOn

- (void) playIdentOn

Provided by category PlayerEntity(Sound).

Definition at line 205 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleButtonIdent.

+ Here is the caller graph for this function:

◆ playIncomingMissile:

- (void) playIncomingMissile: (Vector) missileVector

Provided by category PlayerEntity(Sound).

Definition at line 593 of file PlayerEntitySound.m.

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

Referenced by interpretAIMessage:.

+ Here is the caller graph for this function:

◆ playInterfaceBeep:

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

Provided by category PlayerEntity(Sound).

Definition at line 184 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(Sound)::boop, PlayerEntity(Sound)::playAutopilotCannotDockWithTarget, PlayerEntity(Sound)::playAutopilotOff, PlayerEntity(Sound)::playAutopilotOn, PlayerEntity(Sound)::playAutopilotOutOfRange, PlayerEntity(Sound)::playCargoJettisioned, PlayerEntity(Sound)::playChangedOption, PlayerEntity(Sound)::playCloakingDeviceInsufficientEnergy, PlayerEntity(Sound)::playCloakingDeviceOff, PlayerEntity(Sound)::playCloakingDeviceOn, PlayerEntity(Sound)::playDismissedMissionScreen, PlayerEntity(Sound)::playDismissedReportScreen, PlayerEntity(Sound)::playHoldFull, PlayerEntity(Sound)::playHyperspaceBlocked, PlayerEntity(Sound)::playHyperspaceDistanceTooGreat, PlayerEntity(Sound)::playHyperspaceNoFuel, PlayerEntity(Sound)::playHyperspaceNoTarget, PlayerEntity(Sound)::playIdentLockedOn, PlayerEntity(Sound)::playIdentOff, PlayerEntity(Sound)::playIdentOn, PlayerEntity(Sound)::playJumpMassLocked, PlayerEntity(Sound)::playMenuNavigationDown, PlayerEntity(Sound)::playMenuNavigationNot, PlayerEntity(Sound)::playMenuNavigationUp, PlayerEntity(Sound)::playMenuPageNext, PlayerEntity(Sound)::playMenuPagePrevious, PlayerEntity(Sound)::playMineArmed, PlayerEntity(Sound)::playMissileArmed, PlayerEntity(Sound)::playMissileLockedOn, PlayerEntity(Sound)::playMissileSafe, PlayerEntity(Sound)::playNextEquipmentSelected, PlayerEntity(Sound)::playNextMissileSelected, PlayerEntity(Sound)::playNoTargetInMemory, PlayerEntity(Sound)::playSaveOverwriteNo, PlayerEntity(Sound)::playSaveOverwriteYes, PlayerEntity(Sound)::playTargetLost, PlayerEntity(Sound)::playTargetSwitched, PlayerEntity(Sound)::playWeaponsOffline, PlayerEntity(Sound)::playWeaponsOnline, and PlayerEntity(Sound)::updateFuelScoopSoundWithInterval:.

+ Here is the caller graph for this function:

◆ playJumpMassLocked

- (void) playJumpMassLocked

Provided by category PlayerEntity(Sound).

Definition at line 323 of file PlayerEntitySound.m.

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

Referenced by doBookkeeping:, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playLaserHit:offset:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

Definition at line 669 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}
void playSoundWithKey:priority:expiryTime:overlap:position:(NSString *key,[priority] float priority,[expiryTime] OOTimeDelta expiryTime,[overlap] BOOL overlap,[position] Vector position)
voidpf uLong offset
Definition ioapi.h:140

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playLaunchFromStation

- (void) playLaunchFromStation

Provided by category PlayerEntity(Sound).

Definition at line 563 of file PlayerEntitySound.m.

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

Referenced by leaveDock:.

+ Here is the caller graph for this function:

◆ playLegacyScriptSound:

- (void) playLegacyScriptSound: (NSString *) key

Provided by category PlayerEntity(Sound).

Definition at line 734 of file PlayerEntitySound.m.

734 :(NSString *)key
735{
737}
void playSoundWithKey:priority:(NSString *key,[priority] float priority)

Referenced by PlayerEntity(Scripting)::playSound:.

+ Here is the caller graph for this function:

◆ playMenuNavigationDown

- (void) playMenuNavigationDown

Provided by category PlayerEntity(Sound).

Definition at line 387 of file PlayerEntitySound.m.

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

Referenced by buySelectedItem, PlayerEntity(Controls)::handleGUIUpDownArrowKeys, and PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the caller graph for this function:

◆ playMenuNavigationNot

- (void) playMenuNavigationNot

Provided by category PlayerEntity(Sound).

Definition at line 393 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(Controls)::handleGUIUpDownArrowKeys.

+ Here is the caller graph for this function:

◆ playMenuNavigationUp

- (void) playMenuNavigationUp

Provided by category PlayerEntity(Sound).

Definition at line 381 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(Controls)::handleGUIUpDownArrowKeys, and PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the caller graph for this function:

◆ playMenuPageNext

- (void) playMenuPageNext

Provided by category PlayerEntity(Sound).

Definition at line 405 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(LoadSave)::commanderSelector, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the caller graph for this function:

◆ playMenuPagePrevious

- (void) playMenuPagePrevious

Provided by category PlayerEntity(Sound).

Definition at line 399 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(LoadSave)::commanderSelector, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the caller graph for this function:

◆ playMineArmed

- (void) playMineArmed

Provided by category PlayerEntity(Sound).

Definition at line 229 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleButtonTargetMissile.

+ Here is the caller graph for this function:

◆ playMineLaunched:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

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

Referenced by fireMissile.

+ Here is the caller graph for this function:

◆ playMissileArmed

- (void) playMissileArmed

Provided by category PlayerEntity(Sound).

Definition at line 223 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleButtonTargetMissile.

+ Here is the caller graph for this function:

◆ playMissileLaunched:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

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

Referenced by fireMissile.

+ Here is the caller graph for this function:

◆ playMissileLockedOn

- (void) playMissileLockedOn

Provided by category PlayerEntity(Sound).

Definition at line 241 of file PlayerEntitySound.m.

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

Referenced by addTarget:, and PlayerEntity(OOControlsPrivate)::handleButtonTargetMissile.

+ Here is the caller graph for this function:

◆ playMissileSafe

- (void) playMissileSafe

Provided by category PlayerEntity(Sound).

Definition at line 235 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playNextEquipmentSelected

- (void) playNextEquipmentSelected

Provided by category PlayerEntity(Sound).

Definition at line 247 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playNextMissileSelected

- (void) playNextMissileSelected

Provided by category PlayerEntity(Sound).

Definition at line 253 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playNoTargetInMemory

- (void) playNoTargetInMemory

Provided by category PlayerEntity(Sound).

Definition at line 335 of file PlayerEntitySound.m.

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

Referenced by moveTargetMemoryBy:.

+ Here is the caller graph for this function:

◆ playSaveOverwriteNo

- (void) playSaveOverwriteNo

Provided by category PlayerEntity(Sound).

Definition at line 311 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(LoadSave)::overwriteCommanderInputHandler.

+ Here is the caller graph for this function:

◆ playSaveOverwriteYes

- (void) playSaveOverwriteYes

Provided by category PlayerEntity(Sound).

Definition at line 305 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(LoadSave)::overwriteCommanderInputHandler.

+ Here is the caller graph for this function:

◆ playScrapeDamage:

- (void) playScrapeDamage: (Vector) attackVector

Provided by category PlayerEntity(Sound).

Definition at line 663 of file PlayerEntitySound.m.

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

Referenced by takeScrapeDamage:from:.

+ Here is the caller graph for this function:

◆ playSellCommodity

- (void) playSellCommodity

Provided by category PlayerEntity(Sound).

Definition at line 509 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the caller graph for this function:

◆ playShieldHit:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

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

Referenced by takeEnergyDamage:from:becauseOf:weaponIdentifier:.

+ Here is the caller graph for this function:

◆ playSound:

- (void) playSound: (NSString *) soundName

Provided by category PlayerEntity(Scripting).

Definition at line 2431 of file PlayerEntityLegacyScriptEngine.m.

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

◆ playStandardHyperspace

- (void) playStandardHyperspace

Provided by category PlayerEntity(Sound).

Definition at line 533 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(Controls)::beginWitchspaceCountdown:.

+ Here is the caller graph for this function:

◆ playTargetLost

- (void) playTargetLost

Provided by category PlayerEntity(Sound).

Definition at line 329 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOPrivate)::updateTargeting.

+ Here is the caller graph for this function:

◆ playTargetSwitched

- (void) playTargetSwitched

Provided by category PlayerEntity(Sound).

Definition at line 341 of file PlayerEntitySound.m.

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

Referenced by moveTargetMemoryBy:.

+ Here is the caller graph for this function:

◆ playWeaponOverheated:

- (void) playWeaponOverheated: (Vector) weaponOffset

Provided by category PlayerEntity(Sound).

Definition at line 688 of file PlayerEntitySound.m.

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

Referenced by fireMainWeapon.

+ Here is the caller graph for this function:

◆ playWeaponsOffline

- (void) playWeaponsOffline

Provided by category PlayerEntity(Sound).

Definition at line 265 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playWeaponsOnline

- (void) playWeaponsOnline

Provided by category PlayerEntity(Sound).

Definition at line 259 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ playWitchjumpBlocked

- (void) playWitchjumpBlocked

Provided by category PlayerEntity(Sound).

Definition at line 623 of file PlayerEntitySound.m.

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

Referenced by witchJumpChecklist:.

+ Here is the caller graph for this function:

◆ playWitchjumpDistanceTooGreat

- (void) playWitchjumpDistanceTooGreat

Provided by category PlayerEntity(Sound).

Definition at line 629 of file PlayerEntitySound.m.

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

Referenced by witchJumpChecklist:.

+ Here is the caller graph for this function:

◆ playWitchjumpFailure

- (void) playWitchjumpFailure

Provided by category PlayerEntity(Sound).

Definition at line 611 of file PlayerEntitySound.m.

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

Referenced by enterWitchspace.

+ Here is the caller graph for this function:

◆ playWitchjumpInsufficientFuel

- (void) playWitchjumpInsufficientFuel

Provided by category PlayerEntity(Sound).

Definition at line 635 of file PlayerEntitySound.m.

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

Referenced by witchJumpChecklist:.

+ Here is the caller graph for this function:

◆ playWitchjumpMisjump

- (void) playWitchjumpMisjump

Provided by category PlayerEntity(Sound).

Definition at line 617 of file PlayerEntitySound.m.

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

Referenced by PlayerEntity(OOPrivate)::witchJumpTo:misjump:.

+ Here is the caller graph for this function:

◆ pollApplicationControls

- (void) pollApplicationControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 915 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];
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.
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 {
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
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()

Referenced by PlayerEntity(Controls)::pollControls:.

+ Here is the caller graph for this function:

◆ pollAutopilotControls:

- (void) pollAutopilotControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4760 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 {
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
BOOL hasDockingComputer()

Referenced by PlayerEntity(Controls)::pollControls:.

+ Here is the caller graph for this function:

◆ pollControls:

- (void) pollControls: (double) delta_t

Provided by category PlayerEntity(Controls).

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

Referenced by update:.

+ Here is the caller graph for this function:

◆ pollCustomViewControls

- (void) pollCustomViewControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4043 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
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
NSUInteger _customViewIndex

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:, and PlayerEntity(OOControlsPrivate)::pollViewControls.

+ Here is the caller graph for this function:

◆ pollDemoControls:

- (void) pollDemoControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4943 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 }
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()
BOOL _missionTextEntry

Referenced by PlayerEntity(Controls)::pollControls:, PlayerEntity(OOControlsPrivate)::pollDockedControls:, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ pollDockedControls:

- (void) pollDockedControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

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

Referenced by PlayerEntity(Controls)::pollControls:.

+ Here is the caller graph for this function:

◆ pollFlightArrowKeyControls:

- (void) pollFlightArrowKeyControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4346 of file PlayerEntityControls.m.

4346 :(double)delta_t
4347{
4348 MyOpenGLView *gameView = [UNIVERSE gameView];
4349 OOJoystickManager *stickHandler = [OOJoystickManager sharedStickHandler];
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
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
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
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
4419 {
4420 if ([self checkNavKeyPress:n_key_roll_left] && [self checkNavKeyPress:n_key_roll_right])
4421 {
4423 flightRoll = 0.0;
4424 }
4425 else if ([self checkNavKeyPress:n_key_roll_left] && !capsLockCustomView)
4426 {
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 {
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)
4448 }
4449 if (flightRoll > stick_roll)
4450 {
4451 [self decrease_flight_roll:delta_t*roll_delta];
4452 if (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 {
4478 flightPitch = 0.0;
4479 }
4480 else if ([self checkNavKeyPress:n_key_pitch_back] && !capsLockCustomView)
4481 {
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 {
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;
4499 {
4500 [self increase_flight_pitch:delta_t*pitch_delta];
4503 }
4505 {
4506 [self decrease_flight_pitch:delta_t*pitch_delta];
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
4529 {
4530 if ([self checkNavKeyPress:n_key_yaw_left] && [self checkNavKeyPress:n_key_yaw_right])
4531 {
4533 flightYaw = 0.0;
4534 }
4535 else if ([self checkNavKeyPress:n_key_yaw_left] && !capsLockCustomView)
4536 {
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 {
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)
4560 }
4561 if (flightYaw > stick_yaw)
4562 {
4563 [self decrease_flight_yaw:delta_t*yaw_delta];
4564 if (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
GLfloat stick_pitch
Definition ShipEntity.h:209
GLfloat stick_yaw
Definition ShipEntity.h:210
GLfloat stick_roll
Definition ShipEntity.h:208

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ pollFlightControls:

- (void) pollFlightControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 1136 of file PlayerEntityControls.m.

1136 :(double)delta_t
1137{
1138 MyOpenGLView *gameView = [UNIVERSE gameView];
1139 OOJoystickManager *stickHandler = [OOJoystickManager sharedStickHandler];
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];
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] &&
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
1238
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])))
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
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];
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 {
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 {
1427 if (primedEquipment > c) primedEquipment = 0;
1428 }
1429 else
1430 {
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];
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 {
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 {
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];
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];
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 (!)
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);
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);
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);
1811 }
1812 if (fieldOfView > maxFieldOfView * reqFov)
1813 {
1814 fieldOfView /= pow(fov_delta, delta_t);
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 {
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];
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];
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:167
#define TIME_ACCELERATION_FACTOR_MIN
Definition Universe.h:165
void clearKey:(int theKey)
BOOL setDebugger:(id< OODebuggerInterface > debugger)
OODebugMonitor * sharedDebugMonitor()
double getAxisState:(int function)
void clearStickButtonState:(int stickButton)
BOOL hasFuelInjection()
BOOL hasEscapePod()
float weapon_recharge_rate
Definition ShipEntity.h:356

Referenced by PlayerEntity(OOControlsPrivate)::pollAutopilotControls:, and PlayerEntity(Controls)::pollControls:.

+ Here is the caller graph for this function:

◆ pollGameOverControls:

- (void) pollGameOverControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4739 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

Referenced by PlayerEntity(Controls)::pollControls:.

+ Here is the caller graph for this function:

◆ pollGuiArrowKeyControls:

- (void) pollGuiArrowKeyControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 2038 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 {
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];
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 {
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 {
2175 default: ANA_mode = OPTIMIZED_BY_NONE; break;
2176 }
2177 }
2178 else
2179 {
2180 switch (ANA_mode)
2181 {
2184 default: ANA_mode = OPTIMIZED_BY_NONE; break;
2185 }
2186 }
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 {
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];
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);
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);
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 {
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];
2261 }
2262 else
2263 {
2264 [gameView resetTypedString];
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];
2277 }
2278 if ([self checkKeyPress:n_key_map_zoom_in] || [gameView mouseWheelState] == gvMouseWheelDown)
2279 {
2283 }
2284 if ([self checkKeyPress:n_key_map_zoom_out] || [gameView mouseWheelState] == gvMouseWheelUp)
2285 {
2286 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
2287 {
2289 [self setGuiToShortRangeChartScreen];
2290 }
2292 if (target_chart_zoom < 1.0) target_chart_zoom = 1.0;
2294 //target_chart_centre = cursor_coordinates;
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];
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;
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];
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;
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 }
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 }
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 }
2416 {
2418 }
2420 {
2422 }
2424 {
2426 }
2428 {
2430 }
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 }
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 }
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 }
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 }
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 {
2814 {
2816 }
2817 else
2818 {
2820 }
2821 }
2822 else
2823 {
2825 {
2827 }
2828 else
2829 {
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 }
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 }
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 }
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 }
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 }
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 }
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
@ MARKET_FILTER_MODE_MAX
#define CHART_ZOOM_SHOW_LABELS
#define MANIFEST_SCREEN_ROW_BACK
#define CHART_ZOOM_SPEED_FACTOR
#define MANIFEST_SCREEN_ROW_NEXT
@ STATUS_EQUIPMENT_FIRST_ROW
@ STATUS_EQUIPMENT_MAX_ROWS
@ STATUS_EQUIPMENT_BIGGUI_EXTRA_ROWS
@ GUI_ROW_INTERFACES_START
@ GUI_MAX_ROWS_INTERFACES
@ MARKET_SORTER_MODE_MAX
void setStatusPage:(NSInteger pageNum)
void resetTypedString()
OOScalar saved_chart_zoom
NSPoint target_chart_focus
OOScalar target_chart_zoom
BOOL showingLongRangeChart
NSPoint target_chart_centre
BOOL infoSystemOnRoute()

Referenced by PlayerEntity(OOControlsPrivate)::pollAutopilotControls:, PlayerEntity(OOControlsPrivate)::pollDockedControls:, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ pollGuiScreenControls

- (void) pollGuiScreenControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4586 of file PlayerEntityControls.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollAutopilotControls:, PlayerEntity(OOControlsPrivate)::pollDockedControls:, PlayerEntity(OOControlsPrivate)::pollFlightControls:, and PlayerEntity(OOControlsPrivate)::pollMissionInterruptControls.

+ Here is the caller graph for this function:

◆ pollGuiScreenControlsWithFKeyAlias:

- (void) pollGuiScreenControlsWithFKeyAlias: (BOOL) fKeyAlias
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4592 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 {
4638 {
4640 }
4642 [self noteGUIWillChangeTo:GUI_SCREEN_LONG_RANGE_CHART];
4643 [self setGuiToLongRangeChartScreen];
4644 }
4645 else
4646 {
4648 {
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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControls, and PlayerEntity(OOControlsPrivate)::pollMissionInterruptControls.

+ Here is the caller graph for this function:

◆ pollMarketScreenControls

- (void) pollMarketScreenControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 3143 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];
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 {
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 }
3193 marketSelectedCommodity = [[goods oo_stringAtIndex:goodsIndex] retain];
3194 [self setGuiToMarketScreen];
3195 }
3196 }
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 {
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 }
3235 marketSelectedCommodity = [[goods oo_stringAtIndex:goodsIndex] retain];
3236 [self setGuiToMarketInfoScreen];
3237 }
3238 }
3239 upDownKeyPressed = YES;
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 {
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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ pollMissionInterruptControls

- (void) pollMissionInterruptControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 5331 of file PlayerEntityControls.m.

5332{
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}

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:.

+ Here is the caller graph for this function:

◆ pollViewControls

- (void) pollViewControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4189 of file PlayerEntityControls.m.

4190{
4191 if(!pollControls)
4192 return;
4193
4194 MyOpenGLView *gameView = [UNIVERSE gameView];
4195 OOJoystickManager *stickHandler = [OOJoystickManager sharedStickHandler];
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))
4244 }
4245 else
4246 {
4247 if (!zoom_pressed) // must release and re-press zoom to zoom back 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))
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)::pollAutopilotControls:, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

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

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

References nil.

◆ previousInfoSystem

- (void) previousInfoSystem

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

References ANA_mode, info_system_id, nil, OPTIMIZED_BY_NONE, previousInfoSystem, and setInfoSystemID:moveChart:.

Referenced by custom_chart_zoom, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and previousInfoSystem.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ previousSystemID

- (OOSystemID) previousSystemID

Definition at line 699 of file PlayerEntity.m.

700{
701 return previous_system_id;
702}
OOSystemID previous_system_id

References previous_system_id, and previousSystemID.

Referenced by custom_chart_zoom, and previousSystemID.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ priceForShipKey:

- (OOCreditsQuantity) priceForShipKey: (NSString *) key

Provided by category PlayerEntity(Contracts).

Definition at line 1446 of file PlayerEntityContracts.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ primedEquipmentCount

- (NSUInteger) primedEquipmentCount

Definition at line 8204 of file PlayerEntity.m.

8205{
8206 return [eqScripts count];
8207}

References primedEquipmentCount.

Referenced by primedEquipmentCount, primedEquipmentName:, and roleWeights.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ primedEquipmentName:

- (NSString *) primedEquipmentName: (NSInteger) offset

Definition at line 8210 of file PlayerEntity.m.

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

References DESC, OOEquipmentType::equipmentTypeWithIdentifier:, OOEquipmentType::name, primedEquipment, and primedEquipmentCount.

+ Here is the call graph for this function:

◆ printIdentLockedOnForMissile:

- (void) printIdentLockedOnForMissile: (BOOL) missile

Definition at line 12420 of file PlayerEntity.m.

12420 :(BOOL)missile
12421{
12422 if ([self primaryTarget] == nil) return;
12423
12424 NSString *fmt = missile ? @"missile-locked-onto-target" : @"ident-locked-onto-target";
12425 NSString *target = [[self primaryTarget] identFromShip:self];
12426 [UNIVERSE addMessage:OOExpandKey(fmt, target) forCount:4.5];
12427}

References nil, and ShipEntity::primaryTarget.

Referenced by addTarget:, PlayerEntity(OOControlsPrivate)::handleButtonIdent, PlayerEntity(OOControlsPrivate)::handleButtonTargetMissile, and moveTargetMemoryBy:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processEscapePods

- (NSString *) processEscapePods

Provided by category PlayerEntity(Contracts).

Definition at line 63 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()
OOJSScript * script
void setCrew:(NSArray *crewArray)
NSArray * crew

Referenced by docked.

+ Here is the caller graph for this function:

◆ processKeyCode:

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

Provided by category PlayerEntity(Controls).

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

Referenced by PlayerEntity(KeyMapper)::initCheckingDictionary, PlayerEntity(Controls)::initKeyConfigSettings, setExtraGuiScreenKeys:definition:, setExtraMissionKeys:, PlayerEntity(KeyMapperInternal)::updateKeyDefinition:index:, and PlayerEntity(KeyMapperInternal)::updateShiftKeyDefinition:index:.

+ Here is the caller graph for this function:

◆ processSceneDictionary:atOffset:

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

Provided by category PlayerEntity(Scripting).

Definition at line 2610 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)

Referenced by PlayerEntity(Scripting)::addScene:atOffset:.

+ Here is the caller graph for this function:

◆ processSceneString:atOffset:

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

Provided by category PlayerEntity(Scripting).

Definition at line 2648 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"] && [UNIVERSE sun])
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
Vector _sysInfoLight
double clockTimeAdjusted()
Vector positionOffsetForShipInRotationToAlignment(ShipEntity *ship, Quaternion q, NSString *align)
void setPitch:(double amount)

Referenced by PlayerEntity(Scripting)::addScene:atOffset:.

+ Here is the caller graph for this function:

◆ pseudoFixedD100_number

- (NSNumber *) pseudoFixedD100_number

Provided by category PlayerEntity(Scripting).

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

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

◆ quicksavePlayer

- (void) quicksavePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 185 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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ random_factor

- (int) random_factor

Definition at line 500 of file PlayerEntity.m.

501{
502 return market_rnd;
503}

References int(), market_rnd, and random_factor.

Referenced by random_factor, and shipCommodityData.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ realAlertCondition

- (OOAlertCondition) realAlertCondition
implementation

Reimplemented from ShipEntity.

Definition at line 5820 of file PlayerEntity.m.

5821{
5822 return [self alertCondition];
5823}

References alertCondition, and realAlertCondition.

Referenced by realAlertCondition.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ receiveCommsMessage:from:

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

Reimplemented from ShipEntity.

Definition at line 11874 of file PlayerEntity.m.

11874 :(NSString *) message_text from:(ShipEntity *) other
11875{
11876 if ([self status] == STATUS_DEAD || [self status] == STATUS_DOCKED)
11877 {
11878 // only when in flight
11879 return;
11880 }
11881 [UNIVERSE addCommsMessage:[NSString stringWithFormat:@"%@:\n %@", [other displayName], message_text] forCount:4.5];
11882 [super receiveCommsMessage:message_text from:other];
11883}

References ShipEntity::displayName, ShipEntity::receiveCommsMessage:from:, and Entity::status.

Referenced by ShipEntity::broadcastMessage:withUnpilotedOverride:, and ShipEntity::sendMessage:toShip:withUnpilotedOverride:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 2491 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)

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(Scripting)::setGuiToMissionScreenWithCallback:.

+ Here is the caller graph for this function:

◆ reloadPage

- (void) reloadPage
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 1737 of file PlayerEntityKeyMapper.m.

1738{
1739 // Update the GUI (this will refresh the function list).
1740 unsigned skip;
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}

References MAX_ROWS_KC_FUNCTIONS, PlayerEntity(KeyMapperInternal)::reloadPage, and setGuiToKeyMapperScreen:.

Referenced by PlayerEntity(KeyMapper)::handleKeyConfigKeys:view:, PlayerEntity(KeyMapper)::keyMapperInputHandler:view:, PlayerEntity(KeyMapperInternal)::reloadPage, PlayerEntity(KeyMapperInternal)::resetKeyFunctions, and PlayerEntity(KeyMapperInternal)::saveKeySetting:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAllCargo

- (void) removeAllCargo

Provided by category PlayerEntity(Scripting).

Definition at line 1387 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 1392 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
1430
1431 [self calculateCurrentCargo];
1432}
static NSString *const kOOLogRemoveAllCargoNotDocked
static NSString *const kOOLogNoteRemoveAllCargo

Referenced by PlayerEntity(Scripting)::removeAllCargo, setUpAndConfirmOK:saveGame:, and PlayerEntity(Scripting)::useSpecialCargo:.

+ Here is the caller graph for this function:

◆ removeContract:destination:

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

Provided by category PlayerEntity(Contracts).

Definition at line 1055 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}
OOCargoType cargoType()

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 2887 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}

Referenced by removeEquipmentItem:.

+ Here is the caller graph for this function:

◆ removeEquipment:

- (void) removeEquipment: (NSString *) equipString

Provided by category PlayerEntity(Scripting).

Definition at line 1277 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
NSUInteger extraCargo()

◆ removeEquipmentItem:

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

Reimplemented from ShipEntity.

Definition at line 11663 of file PlayerEntity.m.

11663 :(NSString *)equipmentKey
11664{
11665 if(![self hasEquipmentItemProviding:@"EQ_ADVANCED_COMPASS"] && [self compassMode] != COMPASS_MODE_BASIC)
11666 {
11667 [self setCompassMode:COMPASS_MODE_BASIC];
11668 }
11669 [super removeEquipmentItem:equipmentKey];
11670 if(![self hasEquipmentItem:equipmentKey]) {
11671 // removed the last one
11672 [self removeEqScriptForKey:equipmentKey];
11673 }
11674}

References compassMode, removeEqScriptForKey:, ShipEntity::removeEquipmentItem:, and setCompassMode:.

Referenced by addEquipmentFromCollection:, enterGalacticWitchspace, launchEscapeCapsule, PlayerEntity(Scripting)::removeEquipment:, takeInternalDamage, and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeExternalStore:

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

Reimplemented from ShipEntity.

Definition at line 11797 of file PlayerEntity.m.

11797 :(OOEquipmentType *)eqType
11798{
11799 NSString *identifier = [eqType identifier];
11800
11801 // Look for matching missile.
11802 unsigned i;
11803 for (i = 0; i < max_missiles; i++)
11804 {
11805 if ([[self missileForPylon:i] hasPrimaryRole:identifier])
11806 {
11807 [self removeFromPylon:i];
11808
11809 // Just remove one at a time.
11810 return YES;
11811 }
11812 }
11813 return NO;
11814}

References OOEquipmentType::identifier, ShipEntity::max_missiles, and removeFromPylon:.

+ Here is the call graph for this function:

◆ removeFromPylon:

- (BOOL) removeFromPylon: (NSUInteger) pylon

Definition at line 11817 of file PlayerEntity.m.

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

References activeMissile, OOEquipmentType::equipmentTypeWithIdentifier:, ShipEntity::max_missiles, missile_entity, ShipEntity::missiles, nil, ShipEntity::primaryRole, ShipEntity::removeExternalStore:, selectNextMissile, and tidyMissilePylons.

Referenced by fireMissile, and removeExternalStore:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeFunction:

- (void) removeFunction: (int) idx
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 339 of file PlayerEntityStickMapper.m.

339 :(int)idx
340{
341 OOJoystickManager *stickHandler = [OOJoystickManager sharedStickHandler];
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;
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)

References CUSTOMEQUIP_BUTTONACTIVATE, CUSTOMEQUIP_BUTTONMODE, MAX_ROWS_FUNCTIONS, OOJoystickManager::saveStickSettings, setGuiToStickMapperScreen:, OOJoystickManager::sharedStickHandler, OOJoystickManager::unsetAxisFunction:, and OOJoystickManager::unsetButtonFunction:.

Referenced by PlayerEntity(StickMapper)::stickMapperInputHandler:view:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeMissiles

- (OOCreditsQuantity) removeMissiles
implementation

Reimplemented from ShipEntity.

Definition at line 10680 of file PlayerEntity.m.

10681{
10682 [self safeAllMissiles];
10683 OOCreditsQuantity tradeIn = 0;
10684 unsigned i;
10685 for (i = 0; i < missiles; i++)
10686 {
10687 NSString *weapon_key = [missile_list[i] identifier];
10688
10689 if (weapon_key != nil)
10690 tradeIn += (int)[UNIVERSE getEquipmentPriceForKey:weapon_key];
10691 }
10692
10693 for (i = 0; i < max_missiles; i++)
10694 {
10695 [missile_entity[i] release];
10696 missile_entity[i] = nil;
10697 }
10698
10699 missiles = 0;
10700 return tradeIn;
10701}

References OOEquipmentType::identifier, int(), ShipEntity::max_missiles, missile_entity, ShipEntity::missiles, nil, removeMissiles, safeAllMissiles, and UNIVERSE.

Referenced by removeMissiles, ShipAwardEquipment(), and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeMissionDestination:

- (void) removeMissionDestination: (NSString *) destinations

Provided by category PlayerEntity(Scripting).

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

13343 :(NSDictionary *)marker
13344{
13345 NSDictionary *validated = [self validatedMarker:marker];
13346 if (validated == nil)
13347 {
13348 return NO;
13349 }
13350 BOOL result = NO;
13351 if ([missionDestinations objectForKey:[self markerKey:validated]] != nil) {
13352 result = YES;
13353 }
13354 [missionDestinations removeObjectForKey:[self markerKey:validated]];
13355 return result;
13356}

References markerKey:, missionDestinations, nil, and validatedMarker:.

Referenced by PlayerEntity(Scripting)::removeMissionDestination:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeParcel:

- (BOOL) removeParcel: (NSString*) Name

Provided by category PlayerEntity(Contracts).

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

12043 :(OOTrumble *)deadTrumble
12044{
12045 if (trumbleCount <= 0)
12046 {
12047 return;
12048 }
12049 NSUInteger trumble_index = NSNotFound;
12050 NSUInteger i;
12051
12052 for (i = 0; (trumble_index == NSNotFound)&&(i < trumbleCount); i++)
12053 {
12054 if (trumble[i] == deadTrumble)
12055 trumble_index = i;
12056 }
12057 if (trumble_index == NSNotFound)
12058 {
12059 OOLog(@"trumble.zombie", @"DEBUG can't get rid of inactive trumble %@", deadTrumble);
12060 return;
12061 }
12062 trumbleCount--; // reduce number of trumbles
12063 trumble[trumble_index] = trumble[trumbleCount]; // swap with the current last trumble
12064 trumble[trumbleCount] = deadTrumble; // swap with the current last trumble
12065}

References OOLog, trumble, and trumbleCount.

Referenced by OOTrumble::updatePop:.

+ Here is the caller graph for this function:

◆ renovationCosts

- (double) renovationCosts

Definition at line 11928 of file PlayerEntity.m.

11929{
11930 // 5% of value of ships wear + correction for missing subentities.
11931 OOCreditsQuantity shipValue = [UNIVERSE tradeInValueForCommanderDictionary:[self commanderDataDictionary]];
11932
11933 double costs = 0.005 * (100 - ship_trade_in_factor) * shipValue;
11934 costs += 0.01 * shipValue * [self missingSubEntitiesAdjustment];
11935 costs *= [self renovationFactor];
11936 return cunningFee(costs, 0.05);
11937}
NSInteger missingSubEntitiesAdjustment()
double cunningFee(double value, double precision)

References commanderDataDictionary, cunningFee(), missingSubEntitiesAdjustment, renovationCosts, renovationFactor, and ship_trade_in_factor.

Referenced by isSpeechOn, renovationCosts, setGuiToEquipShipScreen:selectingFacingFor:, and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renovationFactor

- (double) renovationFactor

Definition at line 11940 of file PlayerEntity.m.

11941{
11942 OOShipRegistry *registry = [OOShipRegistry sharedRegistry];
11943 NSDictionary *shipyardInfo = [registry shipyardInfoForKey:[self shipDataKey]];
11944 return [shipyardInfo oo_doubleForKey:KEY_RENOVATION_MULTIPLIER defaultValue:1.0];
11945}

References renovationFactor, OOShipRegistry::sharedRegistry, ShipEntity::shipDataKey, and OOShipRegistry::shipyardInfoForKey:.

Referenced by isSpeechOn, renovationCosts, and renovationFactor.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replaceShipWithNamedShip:

- (BOOL) replaceShipWithNamedShip: (NSString *) shipName

Provided by category PlayerEntity(Contracts).

Definition at line 1842 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 {
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 782 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

Referenced by PlayerEntity(Scripting)::addMissionText:, PlayerEntity(ScriptingPrivate)::expandMessage:, PlayerEntity(Scripting)::setMissionChoicesDictionary:, PlayerEntity(Scripting)::setMissionInstructions:forMission:, and PlayerEntity(Scripting)::setMissionInstructionsList:forMission:.

+ Here is the caller graph for this function:

◆ requestDockingClearance:

- (void) requestDockingClearance: (StationEntity *) stationForDocking

Definition at line 3640 of file PlayerEntity.m.

3640 :(StationEntity *)stationForDocking
3641{
3643 {
3644 [self performDockingRequest:stationForDocking];
3645 }
3646}

References DOCKING_CLEARANCE_STATUS_GRANTED, DOCKING_CLEARANCE_STATUS_REQUESTED, dockingClearanceStatus, and performDockingRequest:.

Referenced by PlayerShipRequestDockingClearance().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset:

- (void) reset: (NSString *) missionvariable

Provided by category PlayerEntity(Scripting).

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

3725{
3726 AI *myAI = [self getAI];
3727 // JSAI: will need changing if oolite-dockingAI.js written
3728 if (![[myAI name] isEqualToString:PLAYER_DOCKING_AI_NAME])
3729 {
3730 [self setAITo:PLAYER_DOCKING_AI_NAME ];
3731 }
3732 [myAI clearAllData];
3733 [myAI setState:@"GLOBAL"];
3734 [myAI setNextThinkTime:[UNIVERSE getTime] + 2];
3735 [myAI setOwner:self];
3736}
#define PLAYER_DOCKING_AI_NAME
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

References AI::clearAllData, ShipEntity::getAI, ShipEntity::name, PLAYER_DOCKING_AI_NAME, resetAutopilotAI, ShipEntity::setAITo:, AI::setNextThinkTime:, AI::setOwner:, and AI::setState:.

Referenced by disengageAutopilot, engageAutopilotToStation:, enterDock:, interpretAIMessage:, massLockable, resetAutopilotAI, and setUpAndConfirmOK:saveGame:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetCustomView

- (void) resetCustomView

Definition at line 12627 of file PlayerEntity.m.

12628{
12629 [self setCustomViewDataFromDictionary:[_customViews oo_dictionaryAtIndex:_customViewIndex] withScaling:NO];
12630}

References resetCustomView, and setCustomViewDataFromDictionary:withScaling:.

Referenced by customViewDescription, PlayerShipResetCustomView(), and resetCustomView.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetHud

- (void) resetHud

Definition at line 4533 of file PlayerEntity.m.

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

References resetHud, OOShipRegistry::sharedRegistry, ShipEntity::shipDataKey, OOShipRegistry::shipInfoForKey:, and switchHudTo:.

Referenced by hud, PlayerShipSetProperty(), resetHud, and setUpShipFromDictionary:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetKeyFunctions

- (void) resetKeyFunctions

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 115 of file PlayerEntityKeyMapper.m.

116{
117 [keyFunctions release];
119}

References PlayerEntity(KeyMapperInternal)::deleteAllKeySettings, PlayerEntity(KeyMapperInternal)::loadKeySettings, and PlayerEntity(KeyMapperInternal)::reloadPage.

Referenced by PlayerEntity(OOControlsPrivate)::handleGameOptionsScreenKeys.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetMissionChoice

- (void) resetMissionChoice

Provided by category PlayerEntity(Scripting).

Definition at line 2100 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by PlayerEntity(Scripting)::setMissionChoicesDictionary:, and setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ resetScannerZoom

- (void) resetScannerZoom

Provided by category PlayerEntity(ScriptMethods).

Definition at line 172 of file PlayerEntityScriptMethods.m.

Referenced by PlayerShipResetScannerZoom().

+ Here is the caller graph for this function:

◆ resetScriptTimer

- (void) resetScriptTimer

Provided by category PlayerEntity(Scripting).

Definition at line 1893 of file PlayerEntityLegacyScriptEngine.m.

1894{
1895 script_time = 0.0;
1898}
#define SCRIPT_TIMER_INTERVAL

Referenced by PlayerEntity(OOPrivate)::performWitchspaceExitUpdates:.

+ Here is the caller graph for this function:

◆ resetStickFunctions

- (void) resetStickFunctions

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 49 of file PlayerEntityStickMapper.m.

50{
51 [stickFunctions release];
53}

Referenced by PlayerEntity(OOControlsPrivate)::handleGameOptionsScreenKeys.

+ Here is the caller graph for this function:

◆ roleWeights

◆ rotateCargo

- (void) rotateCargo

Definition at line 6752 of file PlayerEntity.m.

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

References ShipEntity::cargo, ShipEntity::commodityType, and rotateCargo.

Referenced by alertCondition, PlayerEntity(OOControlsPrivate)::pollFlightControls:, and rotateCargo.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ runScriptActions:withContextName:forTarget:

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

Provided by category PlayerEntity(Scripting).

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

Referenced by PlayerEntity(Scripting)::runUnsanitizedScriptActions:allowingAIMethods:withContextName:forTarget:.

+ Here is the caller graph for this function:

◆ 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 392 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 PlayerEntity(Contracts)::processEscapePods, ShipEntity(PureAI)::safeScriptActionOnTarget:, ShipEntity(PureAI)::scriptActionOnTarget:, Universe::setUpWitchspaceBetweenSystem:andSystem:, and ShipRunLegacyScriptActions().

+ Here is the caller graph for this function:

◆ safeAllMissiles

- (void) safeAllMissiles

Definition at line 5695 of file PlayerEntity.m.

5696{
5697 // sets all missile targets to NO_TARGET
5698
5699 unsigned i;
5700 for (i = 0; i < max_missiles; i++)
5701 {
5703 [missile_entity[i] removeTarget:nil];
5704 }
5706}

References ShipEntity::max_missiles, missile_entity, missile_status, MISSILE_STATUS_SAFE, nil, ShipEntity::primaryTarget, ShipEntity::removeTarget:, and safeAllMissiles.

Referenced by dialMissileStatus, engageAutopilotToStation:, enterDock:, PlayerEntity(OOControlsPrivate)::handleAutopilotOn:, PlayerEntity(OOControlsPrivate)::handleButtonIdent, PlayerEntity(OOControlsPrivate)::pollFlightControls:, removeMissiles, safeAllMissiles, setUpAndConfirmOK:saveGame:, setUpShipFromDictionary:, setWeaponsOnline:, specialCargo, StationDockPlayer(), PlayerEntity(OOPrivate)::tryBuyingItem:, and PlayerEntity(OOPrivate)::witchStart.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCommanderInputHandler

- (void) saveCommanderInputHandler

Provided by category PlayerEntity(LoadSave).

Definition at line 459 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)
NSString * commanderNameString

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ saveKeySetting:

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

Provided by category PlayerEntity(KeyMapperInternal).

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

References count, deleteKeySetting:, getCustomEquipIndex:, getCustomEquipKeyDefType:, initKeyConfigSettings, key_list, and reloadPage.

Referenced by PlayerEntity(KeyMapper)::handleKeyConfigKeys:view:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePlayer

- (void) savePlayer

Provided by category PlayerEntity(LoadSave).

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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ savePlayerWithPanel

- (void) savePlayerWithPanel
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

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

Referenced by PlayerEntity(LoadSave)::savePlayer.

+ Here is the caller graph for this function:

◆ scannedWormholes

- (NSArray *) scannedWormholes

References scannedWormholes.

◆ scannerFuzziness

- (double) scannerFuzziness

Definition at line 6101 of file PlayerEntity.m.

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

References last_ecm_time, SCANNER_ECM_FUZZINESS, and scannerFuzziness.

Referenced by alertCondition, doBookkeeping:, and scannerFuzziness.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scoopOverride

- (BOOL) scoopOverride

References clearedToDock, getDockingClearanceStatus, penaltyForUnauthorizedDocking, and scoopOverride.

+ Here is the call graph for this function:

◆ score

- (unsigned) score

Provided by category PlayerEntity(ScriptMethods).

Definition at line 40 of file PlayerEntityScriptMethods.m.

41{
42 return ship_kills;
43}

Referenced by collectBountyFor:, PlayerEntity(ScriptMethods)::commanderKillsAsString, and PlayerEntity(Scripting)::score_number.

+ Here is the caller graph for this function:

◆ score_number

- (NSNumber *) score_number

Provided by category PlayerEntity(Scripting).

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

12237 :(unsigned)width height:(unsigned)height refreshRate:(float)refreshRate
12238{
12239 if (0.0f != refreshRate)
12240 {
12241 return OOExpandKey(@"gameoptions-fullscreen-with-refresh-rate", width, height, refreshRate);
12242 }
12243 else
12244 {
12245 return OOExpandKey(@"gameoptions-fullscreen", width, height);
12246 }
12247}

References OOExpandKey.

Referenced by PlayerEntity(OOControlsPrivate)::handleGameOptionsScreenKeys, and setGuiToGameOptionsScreen.

+ Here is the caller graph for this function:

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

12882{
12883 return worldScripts != nil && [worldScripts count] > 0;
12884}

References nil, scriptsLoaded, and worldScripts.

Referenced by customViewDescription, and scriptsLoaded.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scriptTarget

- (ShipEntity *) scriptTarget

Provided by category PlayerEntity(Scripting).

Definition at line 254 of file PlayerEntityLegacyScriptEngine.m.

255{
256 return scriptTarget;
257}

Referenced by ShipEntity(PureAI)::safeScriptActionOnTarget:, and ShipEntity(PureAI)::scriptActionOnTarget:.

+ Here is the caller graph for this function:

◆ scriptTestCondition:

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

Provided by category PlayerEntity(ScriptingPrivate).

Definition at line 421 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)

References COMPARISON_EQUAL, COMPARISON_GREATERTHAN, COMPARISON_LESSTHAN, COMPARISON_NOTEQUAL, COMPARISON_ONEOF, COMPARISON_UNDEFINED, count, DOUBLEVAL, expandScriptRightHandSide:, localVariablesForMission:, nil, OOComparisonTypeToString(), OOLog, OP_BOOL, OP_FALSE, OP_LOCAL_VAR, OP_MISSION_VAR, OP_NUMBER, OP_STRING, and sMissionStringValue.

+ Here is the call graph for this function:

◆ scriptTestConditions:

- (BOOL) scriptTestConditions: (NSArray *) array

Provided by category PlayerEntity(Scripting).

Definition at line 400 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 242 of file PlayerEntityScriptMethods.m.

243{
244 return script_time;
245}

Referenced by PlayerEntity(Scripting)::scriptTimer_number.

+ Here is the caller graph for this function:

◆ scriptTimer_number

- (NSNumber *) scriptTimer_number

Provided by category PlayerEntity(Scripting).

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

References getCustomEquipIndex:, getCustomEquipKeyDefType:, and nil.

Referenced by PlayerEntity(KeyMapper)::validateKey:checkKeys:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectNextMissile

- (void) selectNextMissile

Definition at line 5735 of file PlayerEntity.m.

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

References ShipEntity::_primaryTarget, activeMissile, addTarget:, ShipEntity::addTarget:, DESTROY, ShipEntity::isMissile, launchingMissile, ShipEntity::max_missiles, missile_entity, missile_status, MISSILE_STATUS_ARMED, MISSILE_STATUS_SAFE, MISSILE_STATUS_TARGET_LOCKED, nil, ShipEntity::noteLostTarget, ShipEntity::primaryTarget, ShipEntity::removeTarget:, selectNextMissile, setActiveMissile:, and weaponsOnline.

Referenced by assignToActivePylon:, PlayerEntity(OOControlsPrivate)::pollFlightControls:, removeFromPylon:, selectNextMissile, and specialCargo.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectNextMultiFunctionDisplay

- (void) selectNextMultiFunctionDisplay

Definition at line 5650 of file PlayerEntity.m.

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

References activeMFD, hud, OOJSAcquireContext(), OOJSRelinquishContext(), selectNextMultiFunctionDisplay, and ShipScriptEvent.

Referenced by hud, PlayerEntity(OOControlsPrivate)::pollViewControls, and selectNextMultiFunctionDisplay.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectPreviousMultiFunctionDisplay

- (void) selectPreviousMultiFunctionDisplay

Definition at line 5662 of file PlayerEntity.m.

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

References activeMFD, hud, HeadUpDisplay::mfdCount, OOJSAcquireContext(), OOJSRelinquishContext(), selectPreviousMultiFunctionDisplay, and ShipScriptEvent.

Referenced by hud, PlayerEntity(OOControlsPrivate)::pollViewControls, and selectPreviousMultiFunctionDisplay.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendAllShipsAway

- (void) sendAllShipsAway

Provided by category PlayerEntity(Scripting).

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

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

References sessionID.

Referenced by sessionID.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set:

- (void) set: (NSString *) missionvariable_value

Provided by category PlayerEntity(Scripting).

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

5457 :(NSUInteger)value
5458{
5459 activeMissile = value;
5460}

References activeMissile.

Referenced by mountMissile:, selectNextMissile, setCommanderDataFromDictionary:, setUpAndConfirmOK:saveGame:, setUpShipFromDictionary:, and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the caller graph for this function:

◆ setAftShieldLevel:

- (void) setAftShieldLevel: (GLfloat) level

Definition at line 4711 of file PlayerEntity.m.

4711 :(GLfloat)level
4712{
4713 aft_shield = OOClamp_0_max_f(level, [self maxAftShieldLevel]);
4714}

References aft_shield, and maxAftShieldLevel.

Referenced by PlayerShipSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAftShieldRechargeRate:

- (void) setAftShieldRechargeRate: (float) new

Definition at line 4687 of file PlayerEntity.m.

4687 :(float)new
4688{
4690}

References aft_shield_recharge_rate.

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setAlertFlag:to:

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

Definition at line 5805 of file PlayerEntity.m.

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

References alertFlags.

Referenced by docked, and PlayerEntity(OOPrivate)::updateAlertConditionForNearbyEntities.

+ Here is the caller graph for this function:

◆ setBackgroundFromDescriptionsKey:

- (void) setBackgroundFromDescriptionsKey: (NSString*) d_key

Provided by category PlayerEntity(Scripting).

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

Referenced by setGuiToSystemDataScreenRefreshBackground:.

+ Here is the caller graph for this function:

◆ setBounty:

- (void) setBounty: (OOCreditsQuantity) amount
implementation

Reimplemented from ShipEntity.

Definition at line 6793 of file PlayerEntity.m.

6793 :(OOCreditsQuantity) amount
6794{
6795 [self setBounty:amount withReason:kOOLegalStatusReasonUnknown];
6796}

References setBounty:withReason:.

+ Here is the call graph for this function:

◆ setBounty:withReason:

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

Reimplemented from ShipEntity.

Definition at line 6799 of file PlayerEntity.m.

6799 :(OOCreditsQuantity)amount withReason:(OOLegalStatusReason)reason
6800{
6801 NSString *nReason = OOStringFromLegalStatusReason(reason);
6802 [self setBounty:amount withReasonAsString:nReason];
6803}
NSString * OOStringFromLegalStatusReason(OOLegalStatusReason reason)

References OOStringFromLegalStatusReason(), and setBounty:withReasonAsString:.

Referenced by Universe::carryPlayerOn:inWormhole:, doBookkeeping:, enterGalacticWitchspace, getFined, launchEscapeCapsule, PlayerSetProperty(), setBounty:, and PlayerEntity(OOPrivate)::witchJumpTo:misjump:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBounty:withReasonAsString:

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

Reimplemented from ShipEntity.

Definition at line 6806 of file PlayerEntity.m.

6806 :(OOCreditsQuantity)amount withReasonAsString:(NSString *)reason
6807{
6808 JSContext *context = OOJSAcquireContext();
6809
6810 jsval amountVal = JSVAL_VOID;
6811 int amountVal2 = (int)amount-(int)legalStatus;
6812 JS_NewNumberValue(context, amountVal2, &amountVal);
6813
6814 legalStatus = (int)amount; // can't set the new bounty until the size of the change is known
6815
6816 jsval reasonVal = OOJSValueFromNativeObject(context,reason);
6817
6818 ShipScriptEvent(context, self, "shipBountyChanged", amountVal, reasonVal);
6819
6820 OOJSRelinquishContext(context);
6821}

References int(), legalStatus, OOJSAcquireContext(), OOJSRelinquishContext(), OOJSValueFromNativeObject(), and ShipScriptEvent.

Referenced by setBounty:withReason:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCargoQuantityForType:amount:

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

Definition at line 10739 of file PlayerEntity.m.

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

References ShipEntity::availableCargoSpace, calculateCurrentCargo, cargoQuantityForType:, GRAMS_PER_POD, KILOGRAMS_PER_POD, loadCargoPodsForType:amount:, OOCommodityMarket::massUnitForGood:, MAX_GRAMS_IN_SAFE, MAX_KILOGRAMS_IN_SAFE, OOCommodityMarket::quantityForGood:, OOCommodityMarket::setQuantity:forGood:, specialCargo, Entity::status, UNITS_GRAMS, UNITS_KILOGRAMS, UNITS_TONS, and unloadCargoPodsForType:amount:.

Referenced by ManifestSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCommanderDataFromDictionary:

- (BOOL) setCommanderDataFromDictionary: (NSDictionary *) dict

Definition at line 1192 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)
double fps_check_time
OOLongRangeChartMode longRangeChartMode
OOCargoQuantity cargoQuantityOnBoard()
OOScalar custom_chart_zoom
uint16_t entity_personality
Definition ShipEntity.h:430
OOCargoQuantity extra_cargo
Definition ShipEntity.h:296
BOOL hasExpandedCargoBay()

References _customViewIndex, _customViews, addEquipmentFromCollection:, addEquipmentItem:inContext:, aft_shield, aft_shield_recharge_rate, ShipEntity::aft_weapon_type, ANA_mode, BASELINE_SHIELD_LEVEL, CARGO_KEY_TYPE, cargoQuantityOnBoard, chart_centre_coordinates, chart_focus_coordinates, chart_zoom, commLog, compassMode, compassTarget, contract_record, contracts, count, credits, cursor_coordinates, custom_chart_centre_coordinates, custom_chart_zoom, customDialSettings, ShipEntity::deserializeShipSubEntitiesFrom:, DESTROY, ENERGY_UNIT_NONE, ShipEntity::entity_personality, eqScriptIndexForKey:, eqScripts, OOEquipmentType::equipmentTypeWithIdentifier:, escape_pod_rescue_time, EXPECT_NOT, ShipEntity::extra_cargo, forward_shield, forward_shield_recharge_rate, ShipEntity::forward_weapon_type, found_system_id, fps_check_time, ShipEntity::fuel, fuelChargeRate, galaxy_coordinates, galaxy_number, GRAMS_PER_POD, ShipEntity::hasExpandedCargoBay, hud, info_system_id, initialiseMissionDestinations:andLegacy:, installedEnergyUnitType, isSpeechOn, KILOGRAMS_PER_POD, OOCommodities::legacyCommodityType:, legalStatus, OOCommodityMarket::loadPlayerAmounts:, longRangeChartMode, market_rnd, OOCommodityMarket::massUnitForGood:, max_aft_shield, ShipEntity::max_cargo, max_forward_shield, MAX_GRAMS_IN_SAFE, MAX_KILOGRAMS_IN_SAFE, ShipEntity::max_missiles, max_passengers, maxAftShieldLevel, ShipEntity::maxAvailableCargoSpace, maxForwardShieldLevel, maxPlayerRoles, missile_entity, ShipEntity::missile_list, ShipEntity::missileCount, ShipEntity::missiles, mission_variables, multiFunctionDisplaySettings, multiFunctionDisplayText, ShipEntity::name, nil, normaliseReputation, OLD_ENERGY_UNIT_NAVAL, OLD_ENERGY_UNIT_NORMAL, OO_GALAXIES_AVAILABLE, OO_SYSTEMS_PER_GALAXY, OODeciCreditsFromObject(), OOLog, OOLogWARN, OOWeaponTypeFromEquipmentIdentifierLegacy(), OOWeaponTypeFromEquipmentIdentifierSloppy(), OPTIMIZED_BY_NONE, parcel_record, parcels, PASSENGER_BERTH_SPACE, passenger_record, passengers, PLAYER_MAX_MISSILES, ShipEntity::port_weapon_type, previous_system_id, primedEquipment, OOCommodityMarket::quantityForGood:, ShipEntity::removeAllEquipment, OOCommodityMarket::removeQuantity:forGood:, reputation, roleSystemList, roleWeightFlags, roleWeights, saved_chart_zoom, scannedWormholes, ScanTokensFromString(), SCENARIO_OXP_DEFINITION_ALL, SCENARIO_OXP_DEFINITION_NONE, setActiveMissile:, setCommanderName:, setFastEquipmentA:, setFastEquipmentB:, ShipEntity::setHeatInsulation:, setLastsaveName:, HeadUpDisplay::setScannerZoom:, ShipEntity::setShipClassName:, ShipEntity::setShipDataKey:, ShipEntity::setShipUniqueName:, setTrumbleValueFrom:, setUpTrumbles, ShipEntity::setWeaponDataFromType:, OOShipRegistry::sharedRegistry, ship_clock, ship_kills, ship_trade_in_factor, shipCommodityData, ShipEntity::shipDataKey, OOShipRegistry::shipInfoForKey:, shipyard_record, OOShipRegistry::shipyardInfoForKey:, specialCargo, ShipEntity::starboard_weapon_type, system_id, target_chart_centre, target_chart_focus, target_chart_zoom, target_system_id, UNITS_GRAMS, UNITS_KILOGRAMS, UNITS_TONS, UNIVERSE, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_PORT, WEAPON_FACING_STARBOARD, ShipEntity::weaponFacings, and weapons_online.

+ Here is the call graph for this function:

◆ setCommanderName:

- (void) setCommanderName: (NSString *) value

Definition at line 13095 of file PlayerEntity.m.

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

References _commanderName, and nil.

Referenced by PlayerSetProperty(), setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setCompassMode:

- (void) setCompassMode: (OOCompassMode) value

Definition at line 5314 of file PlayerEntity.m.

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

References compassMode.

Referenced by addEquipmentItem:withValidation:inContext:, interpretAIMessage:, PlayerShipSetProperty(), removeEquipmentItem:, setNextCompassMode, setPrevCompassMode, and validateCompassTarget.

+ Here is the caller graph for this function:

◆ setCompassTarget:

- (void) setCompassTarget: (Entity *) value

Definition at line 5206 of file PlayerEntity.m.

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

References compassTarget, and OOWeakRefObject::weakRetain.

Referenced by validateCompassTarget.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCreditBalance:

- (void) setCreditBalance: (double) value

Provided by category PlayerEntity(ScriptMethods).

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

583 :(NSPoint)coords
584{
587}

References custom_chart_centre_coordinates.

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setCustomChartZoom:

- (void) setCustomChartZoom: (OOScalar) zoom

Definition at line 571 of file PlayerEntity.m.

571 :(OOScalar)zoom
572{
573 custom_chart_zoom = zoom;
574}

References custom_chart_zoom.

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setCustomViewData

◆ setCustomViewDataFromDictionary:withScaling:

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

Definition at line 12644 of file PlayerEntity.m.

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

References ShipEntity::_scaleFactor, ShipEntity::currentWeaponFacing, customViewDescription, customViewForwardVector, customViewMatrix, customViewOffset, customViewQuaternion, customViewRotationCenter, kIdentityMatrix, kZeroVector, nil, setCustomViewData, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_PORT, and WEAPON_FACING_STARBOARD.

Referenced by PlayerShipSetCustomView(), PlayerEntity(OOControlsPrivate)::pollCustomViewControls, and resetCustomView.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCustomViewOffset:

- (void) setCustomViewOffset: (Vector) offset

Definition at line 12455 of file PlayerEntity.m.

12455 :(Vector) offset
12456{
12458}

References customViewOffset.

◆ setCustomViewQuaternion:

- (void) setCustomViewQuaternion: (Quaternion) q1

Definition at line 12436 of file PlayerEntity.m.

12436 :(Quaternion)q
12437{
12439 [self setCustomViewData];
12440}

References customViewQuaternion, and setCustomViewData.

+ Here is the call graph for this function:

◆ setCustomViewRotationCenter:

- (void) setCustomViewRotationCenter: (Vector) center

Definition at line 12467 of file PlayerEntity.m.

12467 :(Vector) center
12468{
12469 customViewRotationCenter = center;
12470}

References customViewRotationCenter.

◆ setDefaultCustomViews

- (void) setDefaultCustomViews

Definition at line 11961 of file PlayerEntity.m.

11962{
11963 NSArray *customViews = [[[OOShipRegistry sharedRegistry] shipInfoForKey:PLAYER_SHIP_DESC] oo_arrayForKey:@"custom_views"];
11964
11965 [_customViews release];
11966 _customViews = nil;
11967 _customViewIndex = 0;
11968 if (customViews != nil)
11969 {
11970 _customViews = [customViews retain];
11971 }
11972}

References _customViewIndex, _customViews, nil, setDefaultCustomViews, OOShipRegistry::sharedRegistry, and OOShipRegistry::shipInfoForKey:.

Referenced by isSpeechOn, setDefaultCustomViews, and setUpShipFromDictionary:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefaultViewOffsets

- (void) setDefaultViewOffsets

Definition at line 11948 of file PlayerEntity.m.

11949{
11950 float halfLength = 0.5f * (boundingBox.max.z - boundingBox.min.z);
11951 float halfWidth = 0.5f * (boundingBox.max.x - boundingBox.min.x);
11952
11953 forwardViewOffset = make_vector(0.0f, 0.0f, boundingBox.max.z - halfLength);
11954 aftViewOffset = make_vector(0.0f, 0.0f, boundingBox.min.z + halfLength);
11955 portViewOffset = make_vector(boundingBox.min.x + halfWidth, 0.0f, 0.0f);
11956 starboardViewOffset = make_vector(boundingBox.max.x - halfWidth, 0.0f, 0.0f);
11958}
Vector starboardViewOffset
Vector portViewOffset
Vector aftViewOffset

References aftViewOffset, Entity::boundingBox, customViewOffset, forwardViewOffset, kZeroVector, portViewOffset, setDefaultViewOffsets, and starboardViewOffset.

Referenced by isSpeechOn, setDefaultViewOffsets, and setUpShipFromDictionary:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDialCustom:forKey:

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

Definition at line 4627 of file PlayerEntity.m.

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

Referenced by PlayerShipSetCustomHUDDial().

+ Here is the caller graph for this function:

◆ setDialIdentEngaged:

- (void) setDialIdentEngaged: (BOOL) newValue

Definition at line 5475 of file PlayerEntity.m.

5475 :(BOOL)newValue
5476{
5477 ident_engaged = !!newValue;
5478}

References ident_engaged.

◆ setDockedAtMainStation

- (void) setDockedAtMainStation

Definition at line 4495 of file PlayerEntity.m.

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

References _dockedStation, nil, setDockedAtMainStation, setDockedStation:, and ShipEntity::setStatus:.

Referenced by PlayerEntity(OOControlsPrivate)::handleUndockControl, PlayerEntity(LoadSave)::loadPlayerFromFile:asNew:, massLockable, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, Universe::reinitAndShowDemo:, setDockedAtMainStation, setGuiToLoadSaveScreen, and PlayerEntity(OOLoadSavePrivate)::showCommanderShip:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDockedStation:

- (void) setDockedStation: (StationEntity *) station

Definition at line 4508 of file PlayerEntity.m.

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

References _dockedStation, and OOWeakRefObject::weakRetain.

Referenced by completeSetUpAndSetTarget:, enterDock:, leaveDock:, PlayerEntity(LoadSave)::loadPlayerFromFile:asNew:, setDockedAtMainStation, and setUpAndConfirmOK:saveGame:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDockingClearanceStatus:

- (void) setDockingClearanceStatus: (OODockingClearanceStatus) newValue

Definition at line 13178 of file PlayerEntity.m.

13178 :(OODockingClearanceStatus)newValue
13179{
13180 dockingClearanceStatus = newValue;
13182 {
13184 }
13186 {
13187 if ([[self primaryTarget] isStation])
13188 {
13189 targetDockStation = [self primaryTarget];
13190 }
13191 else
13192 {
13193 OOLog(@"player.badDockingTarget", @"Attempt to dock at %@.", [self primaryTarget]);
13196 }
13197 }
13198}
OODockingClearanceStatus
Definition OOTypes.h:167
@ DOCKING_CLEARANCE_STATUS_NONE
Definition OOTypes.h:168

References DOCKING_CLEARANCE_STATUS_NONE, DOCKING_CLEARANCE_STATUS_NOT_REQUIRED, DOCKING_CLEARANCE_STATUS_REQUESTED, dockingClearanceStatus, Entity::isStation, nil, OOLog, ShipEntity::primaryTarget, and targetDockStation.

Referenced by DockEntity::abortAllDockings, StationEntity::abortAllDockings, DockEntity::abortDockingForShip:, StationEntity::acceptDockingClearanceRequestFrom:, disengageAutopilot, engageAutopilotToStation:, PlayerEntity(OOControlsPrivate)::handleAutopilotOn:, leaveDock:, PlayerEntity(OOPrivate)::performLaunchingUpdates:, StationDockPlayer(), and StationEntity::update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDockTarget:

- (void) setDockTarget: (ShipEntity *) entity

Definition at line 13061 of file PlayerEntity.m.

13061 :(ShipEntity *)entity
13062{
13063if ([entity isStation]) _dockTarget = [entity universalID];
13064else _dockTarget = NO_TARGET;
13065 //_dockTarget = [entity isStation] ? [entity universalID]: NO_TARGET;
13066}
@ NO_TARGET
Definition OOTypes.h:194
OOUniversalID universalID
Definition Entity.m:552
OOUniversalID _dockTarget

References _dockTarget, Entity::isStation, NO_TARGET, and Entity::universalID.

Referenced by doBookkeeping:, launchEscapeCapsule, and PlayerSetEscapePodDestination().

+ Here is the caller graph for this function:

◆ setEquipScreenBackgroundDescriptor:

- (void) setEquipScreenBackgroundDescriptor: (NSDictionary *) descriptor

Definition at line 12871 of file PlayerEntity.m.

12871 :(NSDictionary *)descriptor
12872{
12873 if (descriptor != _equipScreenBackgroundDescriptor)
12874 {
12875 [_equipScreenBackgroundDescriptor autorelease];
12876 _equipScreenBackgroundDescriptor = [descriptor copy];
12877 }
12878}

References _equipScreenBackgroundDescriptor.

Referenced by setGuiToEquipShipScreen:selectingFacingFor:, and setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setEscapePodRescueTime:

- (void) setEscapePodRescueTime: (double) seconds

Definition at line 4914 of file PlayerEntity.m.

4914 :(double)seconds
4915{
4916 escape_pod_rescue_time = seconds;
4917}

References escape_pod_rescue_time.

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

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

References extraGuiScreenKeys, kOOLogException, ShipEntity::name, nil, OOLog, processKeyCode:, and OOJSGuiScreenKeyDefinition::registerKeys.

Referenced by GlobalSetExtraGuiScreenKeys().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setExtraMissionKeys:

- (void) setExtraMissionKeys: (NSDictionary *) keys

Definition at line 13384 of file PlayerEntity.m.

13384 :(NSDictionary *)keys
13385{
13386 NSString *key = nil;
13387 NSMutableDictionary *final = [[NSMutableDictionary alloc] init];
13388 foreach (key, [keys allKeys])
13389 {
13390 [final setObject:[self processKeyCode:[keys oo_arrayForKey:key]] forKey:key];
13391 }
13392 extraMissionKeys = [final copy];
13393 [final release];
13394}

References extraMissionKeys, nil, and processKeyCode:.

Referenced by MissionRunScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFastEquipmentA:

- (void) setFastEquipmentA: (NSString *) eqKey

Definition at line 8298 of file PlayerEntity.m.

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

References _fastEquipmentA.

Referenced by PlayerShipSetProperty(), setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setFastEquipmentB:

- (void) setFastEquipmentB: (NSString *) eqKey

Definition at line 8305 of file PlayerEntity.m.

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

References _fastEquipmentB.

Referenced by PlayerShipSetProperty(), setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setForwardShieldLevel:

- (void) setForwardShieldLevel: (GLfloat) level

Definition at line 4705 of file PlayerEntity.m.

4705 :(GLfloat)level
4706{
4707 forward_shield = OOClamp_0_max_f(level, [self maxForwardShieldLevel]);
4708}

References forward_shield, and maxForwardShieldLevel.

Referenced by PlayerShipSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setForwardShieldRechargeRate:

- (void) setForwardShieldRechargeRate: (float) new

Definition at line 4681 of file PlayerEntity.m.

4681 :(float)new
4682{
4684}

References forward_shield_recharge_rate.

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setFoundTarget:

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

Reimplemented from ShipEntity.

Definition at line 12263 of file PlayerEntity.m.

12263 :(Entity *) targetEntity
12264{
12265 /* Rare, but can happen, e.g. if a Q-mine goes off nearby during
12266 * the sequence */
12267 if ([self status] == STATUS_ESCAPE_SEQUENCE)
12268 {
12269 return;
12270 }
12271 [_foundTarget release];
12272 _foundTarget = [targetEntity weakRetain];
12273}
OOWeakReference * _foundTarget
Definition ShipEntity.h:440

References ShipEntity::_foundTarget, Entity::status, and OOWeakRefObject::weakRetain.

Referenced by launchEscapeCapsule.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFuelLeak:

- (void) setFuelLeak: (NSString *) value

Provided by category PlayerEntity(Scripting).

Definition at line 2216 of file PlayerEntityLegacyScriptEngine.m.

2216 :(NSString *)value
2217{
2218 if (scriptTarget != self)
2219 {
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

Referenced by enterWitchspace.

+ Here is the caller graph for this function:

◆ setFuelLeakRate:

- (void) setFuelLeakRate: (float) value

Definition at line 5013 of file PlayerEntity.m.

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

References fuel_leak_rate.

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceBehaviour:

- (void) setGalacticHyperspaceBehaviour: (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour

Definition at line 12978 of file PlayerEntity.m.

12978 :(OOGalacticHyperspaceBehaviour)inBehaviour
12979{
12980 if (GALACTIC_HYPERSPACE_BEHAVIOUR_UNKNOWN < inBehaviour && inBehaviour <= GALACTIC_HYPERSPACE_MAX)
12981 {
12982 galacticHyperspaceBehaviour = inBehaviour;
12983 }
12984}
OOGalacticHyperspaceBehaviour
@ GALACTIC_HYPERSPACE_MAX

References GALACTIC_HYPERSPACE_MAX, and galacticHyperspaceBehaviour.

Referenced by PlayerShipSetProperty(), and PlayerEntity(Scripting)::setGalacticHyperspaceBehaviourTo:.

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceBehaviourTo:

- (void) setGalacticHyperspaceBehaviourTo: (NSString *) galacticHyperspaceBehaviourString

Provided by category PlayerEntity(Scripting).

Definition at line 2954 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

Referenced by setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceFixedCoords:

- (void) setGalacticHyperspaceFixedCoords: (NSPoint) point

Definition at line 12993 of file PlayerEntity.m.

12993 :(NSPoint)point
12994{
12995 return [self setGalacticHyperspaceFixedCoordsX:OOClamp_0_max_f(round(point.x), 255.0f) y:OOClamp_0_max_f(round(point.y), 255.0f)];
12996}

References setGalacticHyperspaceFixedCoordsX:y:.

Referenced by PlayerShipSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGalacticHyperspaceFixedCoordsTo:

- (void) setGalacticHyperspaceFixedCoordsTo: (NSString *) galacticHyperspaceFixedCoordsString

Provided by category PlayerEntity(Scripting).

Definition at line 2966 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.");
2974 }
2975
2976 [self setGalacticHyperspaceFixedCoordsX:[coord_vals oo_unsignedCharAtIndex:0]
2977 y:[coord_vals oo_unsignedCharAtIndex:1]];
2978}
NSPoint galacticHyperspaceFixedCoords

Referenced by setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceFixedCoordsX:y:

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

Definition at line 12999 of file PlayerEntity.m.

12999 :(unsigned char)x y:(unsigned char)y
13000{
13003}

References galacticHyperspaceFixedCoords, x, and y.

Referenced by setGalacticHyperspaceFixedCoords:, and PlayerEntity(Scripting)::setGalacticHyperspaceFixedCoordsTo:.

+ Here is the caller graph for this function:

◆ setGalaxyCoordinates:

- (void) setGalaxyCoordinates: (NSPoint) newPosition

Definition at line 524 of file PlayerEntity.m.

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

References galaxy_coordinates.

Referenced by Universe::carryPlayerOn:inWormhole:.

+ Here is the caller graph for this function:

◆ setGuiToChartScreenFrom:

- (void) setGuiToChartScreenFrom: (OOGUIScreenID) oldScreen

Definition at line 8805 of file PlayerEntity.m.

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

References OOColor::cyanColor, found_system_id, gui_screen, noteGUIDidChangeFrom:to:, planetSearchString, GuiDisplayGen::refreshStarChart, GuiDisplayGen::setBackgroundTextureKey:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setCurrentRow:, GuiDisplayGen::setForegroundTextureKey:, setShowDemoShips:, GuiDisplayGen::setShowTextCursor:, GuiDisplayGen::setStarChartTitle, GuiDisplayGen::setText:forRow:, Entity::status, and target_system_id.

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, setGuiToLongRangeChartScreen, and setGuiToShortRangeChartScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToConfirmClearScreen

- (void) setGuiToConfirmClearScreen

Provided by category PlayerEntity(KeyMapper).

Definition at line 764 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)

Referenced by PlayerEntity(KeyMapper)::keyMapperInputHandler:view:.

+ Here is the caller graph for this function:

◆ setGuiToDockingReportScreen

- (void) setGuiToDockingReportScreen

Provided by category PlayerEntity(Contracts).

Definition at line 1368 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)

Referenced by doWorldEventUntilMissionScreen:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ setGuiToEquipShipScreen:

- (void) setGuiToEquipShipScreen: (int) skip

Definition at line 9695 of file PlayerEntity.m.

9695 :(int)skip
9696{
9697 [self setGuiToEquipShipScreen:skip selectingFacingFor:nil];
9698}

References setGuiToEquipShipScreen:selectingFacingFor:.

Referenced by buySelectedItem, highlightEquipShipScreenKey:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, and PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToEquipShipScreen:selectingFacingFor:

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

Definition at line 9311 of file PlayerEntity.m.

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

References ShipEntity::_multiplyWeapons, adjustPriceByScriptForEqKey:withCurrent:, AFT_FACING_STRING, ShipEntity::aft_weapon_type, chosen_weapon_facing, GuiDisplayGen::clearAndKeepBackground:, GuiDisplayGen::colorFromSetting:defaultValue:, OOColor::colorWithRed:green:blue:alpha:, count, countMissiles, OOEquipmentType::damagedIdentifier, OOEquipmentType::displayColor, dockedStation, OOEquipmentType::effectiveTechLevel, StationEntity::equipmentPriceFactor, OOEquipmentType::equipmentTypeWithIdentifier:, equipScreenBackgroundDescriptor, StationEntity::equivalentTechLevel, FORWARD_FACING_STRING, ShipEntity::forward_weapon_type, ShipEntity::fuel, fuelChargeRate, OOColor::greenColor, GUI_MAX_ROWS_EQUIPMENT, GUI_ROW_EQUIPMENT_START, gui_screen, OOEquipmentType::identifier, OOEquipmentType::installTime, isWeaponNone(), last_outfitting_key, ShipEntity::missiles, OOEquipmentType::name, nil, OOColor::orangeColor, GuiDisplayGen::overrideTabs:from:length:, PLAYER_MAX_FUEL, PORT_FACING_STRING, ShipEntity::port_weapon_type, OOEquipmentType::price, renovationCosts, OOEquipmentType::repairTime, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setBackgroundTextureDescriptor:, GuiDisplayGen::setColor:forRow:, setEquipScreenBackgroundDescriptor:, GuiDisplayGen::setForegroundTextureKey:, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setNoSelectedRow, GuiDisplayGen::setSelectableRange:, GuiDisplayGen::setSelectedRow:, setShowDemoShips:, GuiDisplayGen::setShowTextCursor:, GuiDisplayGen::setTabStops:, GuiDisplayGen::setText:forRow:, GuiDisplayGen::setText:forRow:align:, GuiDisplayGen::setTitle:, OOShipRegistry::sharedRegistry, ShipEntity::shipDataKey, OOShipRegistry::shipyardInfoForKey:, showInformationForSelectedUpgrade, showInformationForSelectedUpgradeWithFormatString:, STARBOARD_FACING_STRING, ShipEntity::starboard_weapon_type, system_id, UNIVERSE, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_NONE, WEAPON_FACING_PORT, WEAPON_FACING_STARBOARD, and ShipEntity::weaponFacings.

Referenced by setGuiToEquipShipScreen:, and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToGameOptionsScreen

- (void) setGuiToGameOptionsScreen

Definition at line 8873 of file PlayerEntity.m.

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

References GuiDisplayGen::clear, commanderName, count, DESC, GameController::displayModes, MyOpenGLView::fov:, MyOpenGLView::gammaValue, OOColor::grayColor, GUI_FIRST_ROW, GUI_ROW, GUI_ROW_INIT, gui_screen, GameController::indexOfCurrentDisplayMode, int(), MyOpenGLView::isRunningOnPrimaryDisplayDevice, isSpeechOn, OOSound::masterVolume, MAX_FOV_DEG, MAX_HDR_PAPERWHITE, MIN_FOV_DEG, MIN_HDR_PAPERWHITE, OOMusicController::mode, nil, OO_SETACCESSCONDITIONFORROW, OOExpand, OOExpandKey, OOLogWARN, OOSPEECHSETTINGS_ALL, OOSPEECHSETTINGS_COMMS, OOSPEECHSETTINGS_OFF, screenModeStringForWidth:height:refreshRate:, GuiDisplayGen::setBackgroundTextureKey:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setForegroundTextureKey:, setGuiToGameOptionsScreen, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setSelectableRange:, GuiDisplayGen::setSelectedRow:, setShowDemoShips:, GuiDisplayGen::setShowTextCursor:, GuiDisplayGen::setText:forRow:align:, GuiDisplayGen::setTitle:, OOMusicController::sharedController, Entity::status, UNIVERSE, and ShipEntity::volume.

Referenced by doGuiScreenResizeUpdates, PlayerEntity(OOControlsPrivate)::handleGameOptionsScreenKeys, PlayerEntity(OOControlsPrivate)::handleStickMapperScreenKeys, PlayerEntity(KeyMapper)::keyMapperInputHandler:view:, PlayerEntity(OOControlsPrivate)::pollDemoControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, roleWeights, and setGuiToGameOptionsScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToInterfacesScreen:

- (void) setGuiToInterfacesScreen: (int) skip

Definition at line 9743 of file PlayerEntity.m.

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

References OOJSInterfaceDefinition::category, GuiDisplayGen::clearAndKeepBackground:, GuiDisplayGen::colorFromSetting:defaultValue:, count, ShipEntity::displayName, dockedStation, OOColor::greenColor, GUI_MAX_ROWS_INTERFACES, GUI_ROW_INTERFACES_START, gui_screen, StationEntity::localInterfaces, noteGUIDidChangeFrom:to:, noteGUIWillChangeTo:, GuiDisplayGen::overrideTabs:from:length:, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setBackgroundTextureDescriptor:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setForegroundTextureKey:, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setNoSelectedRow, GuiDisplayGen::setSelectableRange:, GuiDisplayGen::setSelectedRow:, setShowDemoShips:, GuiDisplayGen::setShowTextCursor:, GuiDisplayGen::setTabStops:, GuiDisplayGen::setText:forRow:, GuiDisplayGen::setText:forRow:align:, GuiDisplayGen::setTitle:, showInformationForSelectedInterface, and OOJSInterfaceDefinition::title.

Referenced by activateSelectedInterface, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, and PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToKeyboardLayoutScreen:

- (void) setGuiToKeyboardLayoutScreen: (unsigned) skip

Provided by category PlayerEntity(KeyMapper).

Definition at line 1153 of file PlayerEntityKeyMapper.m.

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

Referenced by PlayerEntity(KeyMapper)::handleKeyboardLayoutEntryKeys:view:, and PlayerEntity(KeyMapper)::keyMapperInputHandler:view:.

+ Here is the caller graph for this function:

◆ setGuiToKeyboardLayoutScreen:resetCurrentRow:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 1159 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

Referenced by PlayerEntity(OOControlsPrivate)::handleKeyboardLayoutKeys, and PlayerEntity(KeyMapper)::setGuiToKeyboardLayoutScreen:.

+ Here is the caller graph for this function:

◆ setGuiToKeyConfigEntryScreen

- (void) setGuiToKeyConfigEntryScreen

Provided by category PlayerEntity(KeyMapper).

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

Referenced by PlayerEntity(KeyMapper)::handleKeyConfigKeys:view:.

+ Here is the caller graph for this function:

◆ setGuiToKeyConfigScreen

- (void) setGuiToKeyConfigScreen

Provided by category PlayerEntity(KeyMapper).

Definition at line 400 of file PlayerEntityKeyMapper.m.

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

Referenced by PlayerEntity(KeyMapper)::handleKeyConfigKeys:view:.

+ Here is the caller graph for this function:

◆ setGuiToKeyConfigScreen:

- (void) setGuiToKeyConfigScreen: (BOOL) resetSelectedRow

Provided by category PlayerEntity(KeyMapper).

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

Referenced by PlayerEntity(KeyMapper)::handleKeyConfigEntryKeys:view:, PlayerEntity(KeyMapper)::keyMapperInputHandler:view:, and PlayerEntity(KeyMapper)::setGuiToKeyConfigScreen.

+ Here is the caller graph for this function:

◆ setGuiToKeyMapperScreen:

- (void) setGuiToKeyMapperScreen: (unsigned) skip

Provided by category PlayerEntity(KeyMapper).

Definition at line 122 of file PlayerEntityKeyMapper.m.

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

Referenced by PlayerEntity(KeyMapper)::keyMapperInputHandler:view:, and PlayerEntity(KeyMapperInternal)::reloadPage.

+ Here is the caller graph for this function:

◆ setGuiToKeyMapperScreen:resetCurrentRow:

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

Provided by category PlayerEntity(KeyMapper).

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

Referenced by PlayerEntity(OOControlsPrivate)::handleGameOptionsScreenKeys, PlayerEntity(KeyMapper)::handleKeyboardLayoutEntryKeys:view:, PlayerEntity(KeyMapper)::handleKeyMapperConfirmClearKeys:view:, PlayerEntity(OOControlsPrivate)::handleKeyMapperScreenKeys, and PlayerEntity(KeyMapper)::setGuiToKeyMapperScreen:.

+ Here is the caller graph for this function:

◆ setGuiToLoadCommanderScreen

- (void) setGuiToLoadCommanderScreen
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

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

Referenced by PlayerEntity(LoadSave)::loadPlayer.

+ Here is the caller graph for this function:

◆ setGuiToLoadSaveScreen

- (void) setGuiToLoadSaveScreen

Definition at line 9149 of file PlayerEntity.m.

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

References StationEntity::allowsSaving, GuiDisplayGen::clear, commanderName, dockedStation, MyOpenGLView::gameController, OOColor::grayColor, GUI_ROW, GUI_ROW_INIT, gui_screen, nil, noteGUIDidChangeFrom:to:, GameController::playerFileToLoad, GuiDisplayGen::setBackgroundTextureKey:, GuiDisplayGen::setColor:forRow:, setDockedAtMainStation, setGuiToLoadSaveScreen, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setSelectableRange:, GuiDisplayGen::setSelectedRow:, setShowDemoShips:, GuiDisplayGen::setShowTextCursor:, GuiDisplayGen::setText:forRow:align:, GuiDisplayGen::setTitle:, Entity::status, and UNIVERSE.

Referenced by PlayerEntity(OOControlsPrivate)::handleGameOptionsScreenKeys, PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, roleWeights, and setGuiToLoadSaveScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToLongRangeChartScreen

- (void) setGuiToLongRangeChartScreen

Definition at line 8782 of file PlayerEntity.m.

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

References CHART_MAX_ZOOM, GuiDisplayGen::clearAndKeepBackground:, gui_screen, GuiDisplayGen::setBackgroundTextureKey:, setGuiToChartScreenFrom:, setGuiToLongRangeChartScreen, setMissionBackgroundSpecial:, and target_chart_zoom.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, roleWeights, setGuiToLongRangeChartScreen, and PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToManifestScreen

- (void) setGuiToManifestScreen

Provided by category PlayerEntity(Contracts).

Definition at line 1130 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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, and PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen.

+ Here is the caller graph for this function:

◆ setGuiToMarketInfoScreen

- (void) setGuiToMarketInfoScreen

Definition at line 11254 of file PlayerEntity.m.

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

References GuiDisplayGen::addLongText:startingAtRow:align:, applyMarketFilter:onMarket:, applyMarketSorter:onMarket:, GuiDisplayGen::clearAndKeepBackground:, GuiDisplayGen::colorFromSetting:defaultValue:, OOCommodityMarket::commentForGood:, ShipEntity::commodityAmount, ShipEntity::commodityType, contractedVolumeForGood:, OOCommodityMarket::count, DESTROY, EXPECT_NOT, OOCommodityMarket::goods, GUI_ROW_MARKET_START, gui_screen, localMarket, marketSelectedCommodity, OOCommodityMarket::massUnitForGood:, OOCommodityMarket::nameForGood:, nil, noteGUIDidChangeFrom:to:, OOCommodityMarket::quantityForGood:, GuiDisplayGen::setBackgroundTextureKey:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setForegroundTextureKey:, setGuiToMarketInfoScreen, setGuiToMarketScreen, setShowDemoShips:, GuiDisplayGen::setText:forRow:, GuiDisplayGen::setTitle:, showMarketCashAndLoadLine, showMarketScreenDataLine:forGood:inMarket:holdQuantity:, showMarketScreenHeaders, and Entity::status.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, PlayerEntity(OOControlsPrivate)::pollMarketScreenControls, roleWeights, setGuiToMarketInfoScreen, and PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToMarketScreen

- (void) setGuiToMarketScreen

Definition at line 11053 of file PlayerEntity.m.

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

References applyMarketFilter:onMarket:, applyMarketSorter:onMarket:, cargoQuantityOnBoard, GuiDisplayGen::clearAndKeepBackground:, GuiDisplayGen::colorFromSetting:defaultValue:, ShipEntity::commodityAmount, ShipEntity::commodityType, OOCommodityMarket::count, count, current_cargo, DESTROY, dockedStation, OOCommodityMarket::goods, OOColor::greenColor, GUI_ROW_MARKET_END, GUI_ROW_MARKET_LAST, GUI_ROW_MARKET_START, gui_screen, Entity::isStation, localMarket, marketFilterMode, marketOffset, marketScreenTitle, marketSelectedCommodity, marketSorterMode, ShipEntity::maxAvailableCargoSpace, nil, noteGUIDidChangeFrom:to:, OOExpand, OOExpandKey, ShipEntity::primaryTarget, OOCommodityMarket::quantityForGood:, GuiDisplayGen::selectedRow, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setBackgroundTextureKey:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setForegroundTextureKey:, setGuiToMarketScreen, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setSelectableRange:, GuiDisplayGen::setSelectedRow:, setShowDemoShips:, GuiDisplayGen::setShowTextCursor:, GuiDisplayGen::setText:forRow:, GuiDisplayGen::setTitle:, showMarketCashAndLoadLine, showMarketScreenDataLine:forGood:inMarket:holdQuantity:, showMarketScreenHeaders, Entity::status, and OOColor::yellowColor.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, PlayerEntity(OOControlsPrivate)::pollMarketScreenControls, roleWeights, setGuiToMarketInfoScreen, setGuiToMarketScreen, and PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToMissionEndScreen

- (void) setGuiToMissionEndScreen
implementation

Provided by category PlayerEntity(OOControlsPrivate).

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

Referenced by PlayerEntity(OOControlsPrivate)::handleMissionCallback.

+ Here is the caller graph for this function:

◆ setGuiToMissionScreen

- (void) setGuiToMissionScreen

Provided by category PlayerEntity(Scripting).

Definition at line 2479 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 2510 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;
2567 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
2568
2569}
BOOL setForegroundTextureDescriptor:(NSDictionary *descriptor)
void setBackgroundTextureSpecial:withBackground:(OOGUIBackgroundSpecial spec,[withBackground] BOOL withBackground)

Referenced by MissionRunScreen(), and PlayerEntity(Scripting)::setGuiToMissionScreen.

+ Here is the caller graph for this function:

◆ setGuiToOverwriteScreen:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

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

Referenced by PlayerEntity(LoadSave)::saveCommanderInputHandler.

+ Here is the caller graph for this function:

◆ setGuiToOXZManager

- (void) setGuiToOXZManager

Definition at line 10126 of file PlayerEntity.m.

10127{
10128
10129 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
10130 [[UNIVERSE gameView] clearMouse];
10131 [UNIVERSE removeDemoShips];
10132
10133 gui_screen = GUI_SCREEN_OXZMANAGER;
10134
10135 [[UNIVERSE gui] clearAndKeepBackground:NO];
10136
10138
10140 [[UNIVERSE gui] setBackgroundTextureKey:@"oxz-manager"];
10141 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
10142}

References OOOXZManager::gui, gui_screen, OOMusicController::playThemeMusic, setGuiToOXZManager, OOMusicController::sharedController, and OOOXZManager::sharedManager.

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, roleWeights, and setGuiToOXZManager.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToSaveCommanderScreen:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

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

Referenced by PlayerEntity(LoadSave)::overwriteCommanderInputHandler, and PlayerEntity(LoadSave)::savePlayer.

+ Here is the caller graph for this function:

◆ setGuiToScenarioScreen:

- (void) setGuiToScenarioScreen: (int) page

Provided by category PlayerEntity(LoadSave).

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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(LoadSave)::startScenario.

+ Here is the caller graph for this function:

◆ setGuiToShipyardScreen:

- (void) setGuiToShipyardScreen: (NSUInteger) skip

Provided by category PlayerEntity(Contracts).

Definition at line 1453 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)

Referenced by PlayerEntity(Contracts)::buySelectedShip, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, and PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen.

+ Here is the caller graph for this function:

◆ setGuiToShortRangeChartScreen

- (void) setGuiToShortRangeChartScreen

Definition at line 8794 of file PlayerEntity.m.

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

References GuiDisplayGen::clearAndKeepBackground:, gui_screen, GuiDisplayGen::setBackgroundTextureKey:, setGuiToChartScreenFrom:, setGuiToShortRangeChartScreen, and setMissionBackgroundSpecial:.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, roleWeights, PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen, and setGuiToShortRangeChartScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToStatusScreen

- (void) setGuiToStatusScreen

Definition at line 7934 of file PlayerEntity.m.

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

References ALERT_CONDITION_RED, alertCondition, GuiDisplayGen::clearAndKeepBackground:, GuiDisplayGen::colorFromSetting:defaultValue:, commanderName, credits, DESC, ShipEntity::displayName, dockedStation, ShipEntity::entityPersonalityInt, EXPECT_NOT, gui_screen, ShipEntity::hasHyperspaceMotor, isDocked, KillCountToRatingAndKillString(), lastTextKey, legalStatus, nextHopTargetSystemID, nil, noteGUIDidChangeFrom:to:, noteGUIWillChangeTo:, OO_SYSTEMCONCEALMENT_NONAME, OOCredits(), OODisplayStringFromAlertCondition(), OODisplayStringFromLegalStatus(), OOExpandKey, GuiDisplayGen::overrideTabs:from:length:, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setBackgroundTextureDescriptor:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setForegroundTextureDescriptor:, setGuiToStatusScreen, setShowDemoShips:, GuiDisplayGen::setShowTextCursor:, GuiDisplayGen::setStatusPage:, GuiDisplayGen::setTabStops:, GuiDisplayGen::setText:forRow:, GuiDisplayGen::setText:forRow:align:, GuiDisplayGen::setTitle:, ship_kills, ShipEntity::shipDataKey, showShipModelWithKey:shipData:personality:factorX:factorY:factorZ:inContext:, Entity::status, target_system_id, and UNIVERSE.

Referenced by PlayerEntity(LoadSave)::commanderSelector, docked, doGuiScreenResizeUpdates, PlayerEntity(LoadSave)::loadPlayerFromFile:asNew:, PlayerEntity(LoadSave)::overwriteCommanderInputHandler, PlayerEntity(OOControlsPrivate)::pollApplicationControls, PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, PlayerEntity(LoadSave)::quicksavePlayer, Universe::reinitAndShowDemo:, roleWeights, PlayerEntity(LoadSave)::saveCommanderInputHandler, PlayerEntity(OOLoadSavePrivate)::savePlayerWithPanel, PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen, setGuiToStatusScreen, and PlayerEntity(OOLoadSavePrivate)::writePlayerToPath:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToStickMapperScreen:

- (void) setGuiToStickMapperScreen: (unsigned) skip

Provided by category PlayerEntity(StickMapper).

Definition at line 56 of file PlayerEntityStickMapper.m.

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

Referenced by PlayerEntity(StickMapperInternal)::removeFunction:, PlayerEntity(StickMapper)::stickMapperInputHandler:view:, and PlayerEntity(StickMapper)::updateFunction:.

+ Here is the caller graph for this function:

◆ setGuiToStickMapperScreen:resetCurrentRow:

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

Provided by category PlayerEntity(StickMapper).

Definition at line 61 of file PlayerEntityStickMapper.m.

61 :(unsigned)skip resetCurrentRow: (BOOL) resetCurrentRow
62{
63 GuiDisplayGen *gui = [UNIVERSE gui];
64 OOJoystickManager *stickHandler = [OOJoystickManager sharedStickHandler];
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)

Referenced by PlayerEntity(OOControlsPrivate)::handleGameOptionsScreenKeys, PlayerEntity(OOControlsPrivate)::handleStickMapperScreenKeys, PlayerEntity(StickMapper)::setGuiToStickMapperScreen:, and PlayerEntity(StickProfile)::stickProfileInputHandler:view:.

+ Here is the caller graph for this function:

◆ setGuiToStickProfileScreen:

- (void) setGuiToStickProfileScreen: (GuiDisplayGen *) gui

Provided by category PlayerEntity(StickProfile).

Definition at line 69 of file PlayerEntityStickProfile.m.

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

Referenced by PlayerEntity(StickMapper)::stickMapperInputHandler:view:.

+ Here is the caller graph for this function:

◆ setGuiToSystemDataScreen

- (void) setGuiToSystemDataScreen

Definition at line 8496 of file PlayerEntity.m.

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

References setGuiToSystemDataScreen, and setGuiToSystemDataScreenRefreshBackground:.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, roleWeights, PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen, and setGuiToSystemDataScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGuiToSystemDataScreenRefreshBackground:

- (void) setGuiToSystemDataScreenRefreshBackground: (BOOL) refreshBackground

Definition at line 8501 of file PlayerEntity.m.

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

References GuiDisplayGen::addLongText:startingAtRow:align:, ANA_mode, checkScript, GuiDisplayGen::clearAndKeepBackground:, GuiDisplayGen::colorFromSetting:defaultValue:, count, currentRandomSeed(), distanceBetweenPlanetPositions(), galaxy_coordinates, galaxyNumber, OOColor::greenColor, gui_screen, info_system_id, lastTextKey, missionTextRow, nil, noteGUIDidChangeFrom:to:refresh:, OO_SYSTEMCONCEALMENT_NODATA, OO_SYSTEMCONCEALMENT_NONAME, OOExpandKeyWithSeed, OPTIMIZED_BY_NONE, GuiDisplayGen::overrideTabs:from:length:, RANROTGetFullSeed(), RANROTSetFullSeed(), GuiDisplayGen::setArray:forRow:, setBackgroundFromDescriptionsKey:, GuiDisplayGen::setBackgroundTextureKey:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setForegroundTextureKey:, setRandomSeed(), setShowDemoShips:, GuiDisplayGen::setShowTextCursor:, GuiDisplayGen::setTabStops:, GuiDisplayGen::setTitle:, Entity::status, and system_id.

Referenced by setGuiToSystemDataScreen, and setInfoSystemID:moveChart:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setInfoSystemID:moveChart:

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

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

References chart_centre_coordinates, chart_focus_coordinates, gui_screen, info_system_id, OOJSAcquireContext(), OOJSRelinquishContext(), setGuiToSystemDataScreenRefreshBackground:, ShipScriptEvent, target_chart_centre, and target_chart_focus.

Referenced by homeInfoSystem, nextInfoSystem, PlayerShipSetProperty(), PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, previousInfoSystem, targetInfoSystem, PlayerEntity(Controls)::targetNewSystem:whileTyping:, and PlayerEntity(OOPrivate)::witchJumpTo:misjump:.

+ Here is the call graph for this function:
+ 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 323 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 13075 of file PlayerEntity.m.

13075 :(NSString *)value
13076{
13077 NSParameterAssert(value != nil);
13078 [_jumpCause autorelease];
13079 _jumpCause = [value copy];
13080}

References _jumpCause, and nil.

Referenced by Universe::carryPlayerOn:inWormhole:, enterGalacticWitchspace, enterWitchspace, enterWormhole:, and Universe::setUpUniverseFromStation.

+ Here is the caller graph for this function:

◆ setJumpType:

- (void) setJumpType: (BOOL) isGalacticJump

Definition at line 7487 of file PlayerEntity.m.

7487 :(BOOL)isGalacticJump
7488{
7489 if (isGalacticJump)
7490 {
7491 galactic_witchjump = YES;
7492 }
7493 else
7494 {
7495 galactic_witchjump = NO;
7496 }
7497}

References galactic_witchjump.

Referenced by PlayerShipBeginGalacticHyperspaceCountdown(), and PlayerShipCancelHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ setLastsaveName:

- (void) setLastsaveName: (NSString *) value

Definition at line 13103 of file PlayerEntity.m.

13103 :(NSString *)value
13104{
13105 NSParameterAssert(value != nil);
13106 [_lastsaveName autorelease];
13107 _lastsaveName = [value copy];
13108}

References _lastsaveName, and nil.

Referenced by PlayerEntity(LoadSave)::autosavePlayer, PlayerEntity(OOLoadSavePrivate)::nativeSavePlayer:, setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setLastShot:

- (void) setLastShot: (NSArray *) shot

Definition at line 13371 of file PlayerEntity.m.

13371 :(NSArray *)shot
13372{
13373 lastShot = [shot retain];
13374}

References lastShot.

◆ setLegalStatus:

- (void) setLegalStatus: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

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

Referenced by PlayerEntity(Scripting)::add:, PlayerEntity(Scripting)::decrement:, PlayerEntity(Scripting)::increment:, PlayerEntity(Scripting)::reset:, PlayerEntity(Scripting)::set:, and PlayerEntity(Scripting)::subtract:.

+ Here is the caller graph for this function:

◆ setLongRangeChartMode:

- (void) setLongRangeChartMode: (OOLongRangeChartMode) mode

Definition at line 13023 of file PlayerEntity.m.

13024{
13026}

References longRangeChartMode.

Referenced by PlayerShipSetProperty(), and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ 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 1350 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 4458 of file PlayerEntity.m.

4458 :(BOOL)newValue
4459{
4460 massLockable = !!newValue;
4461 [self updateAlertCondition];
4462}
unsigned massLockable

References massLockable, and updateAlertCondition.

Referenced by PlayerShipSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMaxAftShieldLevel:

- (void) setMaxAftShieldLevel: (float) new

Definition at line 4675 of file PlayerEntity.m.

4675 :(float)new
4676{
4677 max_aft_shield = new;
4678}

References max_aft_shield.

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setMaxFlightPitch:

- (void) setMaxFlightPitch: (GLfloat) new
implementation

Reimplemented from ShipEntity.

Definition at line 3341 of file PlayerEntity.m.

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

References ShipEntity::max_flight_pitch, and pitch_delta.

◆ setMaxFlightRoll:

- (void) setMaxFlightRoll: (GLfloat) new
implementation

Reimplemented from ShipEntity.

Definition at line 3348 of file PlayerEntity.m.

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

References ShipEntity::max_flight_roll, and roll_delta.

◆ setMaxFlightYaw:

- (void) setMaxFlightYaw: (GLfloat) new
implementation

Reimplemented from ShipEntity.

Definition at line 3355 of file PlayerEntity.m.

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

References ShipEntity::max_flight_yaw, and yaw_delta.

◆ setMaxForwardShieldLevel:

- (void) setMaxForwardShieldLevel: (float) new

Definition at line 4669 of file PlayerEntity.m.

4669 :(float)new
4670{
4671 max_forward_shield = new;
4672}

References max_forward_shield.

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

12747 :(NSDictionary *)descriptor
12748{
12749 if (descriptor != _missionBackgroundDescriptor)
12750 {
12751 [_missionBackgroundDescriptor autorelease];
12752 _missionBackgroundDescriptor = [descriptor copy];
12753 }
12754}

References _missionBackgroundDescriptor.

Referenced by PlayerEntity(Scripting)::clearMissionScreen, MissionRunScreen(), PlayerEntity(Scripting)::setMissionBackground:, and setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setMissionBackgroundSpecial:

- (void) setMissionBackgroundSpecial: (NSString *) special

Definition at line 12763 of file PlayerEntity.m.

12763 :(NSString *)special
12764{
12765 if (special == nil) {
12767 }
12768 else if ([special isEqualToString:@"SHORT_RANGE_CHART"])
12769 {
12771 }
12772 else if ([special isEqualToString:@"SHORT_RANGE_CHART_SHORTEST"])
12773 {
12774 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12775 {
12777 }
12778 else
12779 {
12781 }
12782 }
12783 else if ([special isEqualToString:@"SHORT_RANGE_CHART_QUICKEST"])
12784 {
12785 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12786 {
12788 }
12789 else
12790 {
12792 }
12793 }
12794 else if ([special isEqualToString:@"CUSTOM_CHART"])
12795 {
12797 }
12798 else if ([special isEqualToString:@"CUSTOM_CHART_SHORTEST"])
12799 {
12800 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12801 {
12803 }
12804 else
12805 {
12807 }
12808 }
12809 else if ([special isEqualToString:@"CUSTOM_CHART_QUICKEST"])
12810 {
12811 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12812 {
12814 }
12815 else
12816 {
12818 }
12819 }
12820 else if ([special isEqualToString:@"LONG_RANGE_CHART"])
12821 {
12823 }
12824 else if ([special isEqualToString:@"LONG_RANGE_CHART_SHORTEST"])
12825 {
12826 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12827 {
12829 }
12830 else
12831 {
12833 }
12834 }
12835 else if ([special isEqualToString:@"LONG_RANGE_CHART_QUICKEST"])
12836 {
12837 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12838 {
12840 }
12841 else
12842 {
12844 }
12845 }
12846 else
12847 {
12849 }
12850}
@ GUI_BACKGROUND_SPECIAL_NONE

References _missionBackgroundSpecial, GUI_BACKGROUND_SPECIAL_CUSTOM, GUI_BACKGROUND_SPECIAL_CUSTOM_ANA_QUICKEST, GUI_BACKGROUND_SPECIAL_CUSTOM_ANA_SHORTEST, GUI_BACKGROUND_SPECIAL_LONG, GUI_BACKGROUND_SPECIAL_LONG_ANA_QUICKEST, GUI_BACKGROUND_SPECIAL_LONG_ANA_SHORTEST, GUI_BACKGROUND_SPECIAL_NONE, GUI_BACKGROUND_SPECIAL_SHORT, GUI_BACKGROUND_SPECIAL_SHORT_ANA_QUICKEST, GUI_BACKGROUND_SPECIAL_SHORT_ANA_SHORTEST, and nil.

Referenced by PlayerEntity(Scripting)::clearMissionScreen, MissionRunScreen(), setGuiToLongRangeChartScreen, PlayerEntity(Scripting)::setGuiToMissionScreen, setGuiToShortRangeChartScreen, and setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setMissionChoice:

- (void) setMissionChoice: (NSString *) newChoice

Provided by category PlayerEntity(ScriptMethods).

Definition at line 191 of file PlayerEntityScriptMethods.m.

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

Referenced by PlayerEntity(Scripting)::resetMissionChoice.

+ Here is the caller graph for this function:

◆ setMissionChoice:keyPress:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 203 of file PlayerEntityScriptMethods.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:.

+ Here is the caller graph for this function:

◆ setMissionChoice:keyPress:withEvent:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 209 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];
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(), PlayerEntity(ScriptMethods)::setMissionChoice:, PlayerEntity(ScriptMethods)::setMissionChoice:keyPress:, and PlayerEntity(ScriptMethods)::setMissionChoice:withEvent:.

+ 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 197 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 1934 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 1942 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 1953 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(), and PlayerEntity(Scripting)::setMissionChoices:.

+ Here is the caller graph for this function:

◆ setMissionDescription:

- (void) setMissionDescription: (NSString *) textKey

Provided by category PlayerEntity(Scripting).

Definition at line 825 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 831 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(), and PlayerEntity(Scripting)::setMissionDescription:.

+ Here is the caller graph for this function:

◆ setMissionExitScreen:

- (void) setMissionExitScreen: (OOGUIScreenID) screen

Definition at line 12853 of file PlayerEntity.m.

12853 :(OOGUIScreenID)screen
12854{
12855 _missionExitScreen = screen;
12856}

References _missionExitScreen.

Referenced by MissionRunScreen(), MissionSetProperty(), and PlayerEntity(Scripting)::setGuiToMissionScreen.

+ Here is the caller graph for this function:

◆ setMissionImage:

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

Provided by category PlayerEntity(Scripting).

Definition at line 2189 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 846 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(), and PlayerEntity(Scripting)::setMissionDescription:forMission:.

+ 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 861 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 2163 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 PlayerEntity(Scripting)::clearMissionScreen, and MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionOverlayDescriptor:

- (void) setMissionOverlayDescriptor: (NSDictionary *) descriptor

Definition at line 12719 of file PlayerEntity.m.

12719 :(NSDictionary *)descriptor
12720{
12721 if (descriptor != _missionOverlayDescriptor)
12722 {
12723 [_missionOverlayDescriptor autorelease];
12724 _missionOverlayDescriptor = [descriptor copy];
12725 }
12726}

References _missionOverlayDescriptor.

Referenced by PlayerEntity(Scripting)::clearMissionScreen, MissionRunScreen(), PlayerEntity(Scripting)::setMissionImage:, and setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setMissionScreenID:

- (void) setMissionScreenID: (NSString *) msid

Provided by category PlayerEntity(Scripting).

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

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

Referenced by PlayerEntity(Scripting)::clearMissionScreen, and 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 659 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 PlayerEntity(Scripting)::add:, PlayerEntity(Scripting)::decrement:, EquipmentInfoSetProperty(), PlayerEntity(Scripting)::increment:, MissionVariablesDeleteProperty(), MissionVariablesSetProperty(), PlayerEntity(Scripting)::reset:, PlayerEntity(Scripting)::set:, and PlayerEntity(Scripting)::subtract:.

+ Here is the caller graph for this function:

◆ setMultiFunctionDisplay:toKey:

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

Definition at line 5545 of file PlayerEntity.m.

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

References hud, and nil.

Referenced by cycleNextMultiFunctionDisplay:, cyclePreviousMultiFunctionDisplay:, and PlayerShipSetMultiFunctionDisplay().

+ Here is the caller graph for this function:

◆ setMultiFunctionText:forKey:

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

Definition at line 5526 of file PlayerEntity.m.

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

References multiFunctionDisplaySettings, and nil.

Referenced by PlayerShipSetMultiFunctionText().

+ Here is the caller graph for this function:

◆ setName:

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

Reimplemented from ShipEntity.

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

5390{
5391 OOAegisStatus aegis = AEGIS_NONE;
5392 Entity <OOBeaconEntity> *beacon = nil;
5393
5394 switch (compassMode)
5395 {
5396 case COMPASS_MODE_INACTIVE:
5397 case COMPASS_MODE_BASIC:
5398 case COMPASS_MODE_PLANET:
5399 aegis = [self checkForAegis];
5400 if ([UNIVERSE station] && (aegis == AEGIS_CLOSE_TO_MAIN_PLANET || aegis == AEGIS_IN_DOCKING_RANGE))
5401 {
5402 [self setCompassMode:COMPASS_MODE_STATION];
5403 }
5404 else
5405 {
5406 [self setCompassMode:COMPASS_MODE_SUN];
5407 }
5408 break;
5409
5410 case COMPASS_MODE_STATION:
5411 [self setCompassMode:COMPASS_MODE_SUN];
5412 break;
5413
5414 case COMPASS_MODE_SUN:
5415 if ([self primaryTarget])
5416 {
5417 [self setCompassMode:COMPASS_MODE_TARGET];
5418 break;
5419 }
5420 // else fall through to switch to beacon mode.
5421
5422 case COMPASS_MODE_TARGET:
5423 beacon = [UNIVERSE firstBeacon];
5424 while (beacon != nil && [beacon isJammingScanning])
5425 {
5426 beacon = [beacon nextBeacon];
5427 }
5428 [self setNextBeacon:beacon];
5429
5430 if (beacon != nil) [self setCompassMode:COMPASS_MODE_BEACONS];
5431 else [self setCompassMode:COMPASS_MODE_PLANET];
5432 break;
5433
5434 case COMPASS_MODE_BEACONS:
5435 beacon = [self nextBeacon];
5436 do
5437 {
5438 beacon = [beacon nextBeacon];
5439 } while (beacon != nil && [beacon isJammingScanning]);
5440 [self setNextBeacon:beacon];
5441
5442 if (beacon == nil)
5443 {
5444 [self setCompassMode:COMPASS_MODE_PLANET];
5445 }
5446 break;
5447 }
5448}
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

References AEGIS_CLOSE_TO_MAIN_PLANET, AEGIS_IN_DOCKING_RANGE, AEGIS_NONE, ShipEntity::checkForAegis, compassMode, ShipEntity::isJammingScanning, ShipEntity::nextBeacon, nil, ShipEntity::primaryTarget, setCompassMode:, ShipEntity::setNextBeacon:, setNextCompassMode, and UNIVERSE.

Referenced by compassMode, PlayerShipSetProperty(), PlayerEntity(OOControlsPrivate)::pollViewControls, and setNextCompassMode.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNormalOrientation:

- (void) setNormalOrientation: (Quaternion) quat
implementation

Reimplemented from Entity.

Definition at line 4349 of file PlayerEntity.m.

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

References Entity::setOrientation:.

+ Here is the call graph for this function:

◆ setOcclusionLevel:

- (void) setOcclusionLevel: (float) level

Definition at line 4489 of file PlayerEntity.m.

4489 :(float)level
4490{
4491 occlusion_dial = level;
4492}

References occlusion_dial.

Referenced by CollisionRegion::findShadowedEntities.

+ Here is the caller graph for this function:

◆ setPlanetinfo:

- (void) setPlanetinfo: (NSString *) key_valueString

Provided by category PlayerEntity(Scripting).

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

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

References AEGIS_CLOSE_TO_MAIN_PLANET, AEGIS_IN_DOCKING_RANGE, AEGIS_NONE, ShipEntity::checkForAegis, compassMode, ShipEntity::isJammingScanning, ShipEntity::nextBeacon, nil, ShipEntity::primaryTarget, setCompassMode:, ShipEntity::setNextBeacon:, and setPrevCompassMode.

Referenced by compassMode, PlayerEntity(OOControlsPrivate)::pollViewControls, and setPrevCompassMode.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPreviousSystemID:

- (void) setPreviousSystemID: (OOSystemID) sid

Definition at line 705 of file PlayerEntity.m.

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

References previous_system_id.

Referenced by Universe::carryPlayerOn:inWormhole:, enterGalacticWitchspace, enterWitchspace, enterWormhole:, and Universe::setUpUniverseFromStation.

+ Here is the caller graph for this function:

◆ setPrimedEquipment:showMessage:

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

Definition at line 8237 of file PlayerEntity.m.

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

References eqScriptIndexForKey:, OOEquipmentType::equipmentTypeWithIdentifier:, OOEquipmentType::name, and primedEquipment.

Referenced by PlayerShipSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRandom_factor:

- (void) setRandom_factor: (int) rf

Definition at line 506 of file PlayerEntity.m.

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

References market_rnd.

Referenced by Universe::carryPlayerOn:inWormhole:.

+ Here is the caller graph for this function:

◆ setScoopOverride:

- (void) setScoopOverride: (BOOL) newValue

Definition at line 13035 of file PlayerEntity.m.

13035 :(BOOL)newValue
13036{
13037 scoopOverride = !!newValue;
13038 if (scoopOverride) [self setScoopsActive];
13039}
unsigned scoopOverride

References scoopOverride, and setScoopsActive.

Referenced by PlayerShipSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setScoopsActive

- (void) setScoopsActive

Definition at line 12256 of file PlayerEntity.m.

12257{
12258 scoopsActive = YES;
12259}

References scoopsActive, and setScoopsActive.

Referenced by ShipEntity::behaviour_tractored:, setScoopOverride:, setScoopsActive, and suppressTargetLost.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setScore:

- (void) setScore: (unsigned) value

Provided by category PlayerEntity(ScriptMethods).

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

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

Referenced by PlayerEntity(Scripting)::checkScript, OOPlayerForScripting(), ShipEntity(PureAI)::safeScriptActionOnTarget:, ShipEntity::scoopUpProcess:processEvents:processMessages:, ShipEntity(PureAI)::scriptActionOnTarget:, setUpAndConfirmOK:saveGame:, ShipRunLegacyScriptActions(), and takeInternalDamage.

+ Here is the caller graph for this function:

◆ setShowDemoShips:

◆ setSpecificPlanetInfo:

- (void) setSpecificPlanetInfo: (NSString *) key_valueString

Provided by category PlayerEntity(Scripting).

Definition at line 1324 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 2240 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 690 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}

References chart_centre_coordinates, galaxy_coordinates, galaxy_number, PointFromString(), system_id, target_chart_centre, and UNIVERSE.

Referenced by Universe::carryPlayerOn:inWormhole:, setUpAndConfirmOK:saveGame:, Universe::setUpUniverseFromStation, and PlayerEntity(OOPrivate)::witchJumpTo:misjump:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTargetDockStationTo:

- (void) setTargetDockStationTo: (StationEntity *) value

Definition at line 4515 of file PlayerEntity.m.

4515 :(StationEntity *) value
4516{
4517 targetDockStation = value;
4518}

References targetDockStation.

◆ setTargetSystemID:

- (void) setTargetSystemID: (OOSystemID) sid

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

References cursor_coordinates, galaxy_number, PointFromString(), target_system_id, and UNIVERSE.

Referenced by PlayerSetEscapePodDestination(), and PlayerShipSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTrumbleAppetiteAccumulator:

- (void) setTrumbleAppetiteAccumulator: (float) value

Definition at line 12219 of file PlayerEntity.m.

12219 :(float)value
12220{
12222}
float _trumbleAppetiteAccumulator

References _trumbleAppetiteAccumulator.

Referenced by setUpTrumbles, and OOTrumble::updateTrumble:.

+ Here is the caller graph for this function:

◆ setTrumbleValueFrom:

- (void) setTrumbleValueFrom: (NSObject *) trumbleValue

Definition at line 12104 of file PlayerEntity.m.

12104 :(NSObject*) trumbleValue
12105{
12106 BOOL info_failed = NO;
12107 int trumbleHash;
12108 int putativeHash = 0;
12109 int putativeNTrumbles = 0;
12110 NSArray *putativeTrumbleArray = nil;
12111 int i;
12112 NSString *namekey = [NSString stringWithFormat:@"%@-humbletrash", [self commanderName]];
12113
12114 [self setUpTrumbles];
12115
12116 if (trumbleValue)
12117 {
12118 BOOL possible_cheat = NO;
12119 if (![trumbleValue isKindOfClass:[NSArray class]])
12120 info_failed = YES;
12121 else
12122 {
12123 NSArray* values = (NSArray*) trumbleValue;
12124 if ([values count] >= 1)
12125 putativeNTrumbles = [values oo_intAtIndex:0];
12126 if ([values count] >= 2)
12127 putativeHash = [values oo_intAtIndex:1];
12128 if ([values count] >= 3)
12129 putativeTrumbleArray = [values oo_arrayAtIndex:2];
12130 }
12131 // calculate a hash for the putative values
12133 [self mungChecksumWithNSString:[self commanderName]];
12136 trumbleHash = munge_checksum(putativeNTrumbles);
12137
12138 if (putativeHash != trumbleHash)
12139 info_failed = YES;
12140
12141 if (info_failed)
12142 {
12143 OOLog(@"cheat.tentative", @"%@", @"POSSIBLE CHEAT DETECTED");
12144 possible_cheat = YES;
12145 }
12146
12147 for (i = 1; (info_failed)&&(i < PLAYER_MAX_TRUMBLES); i++)
12148 {
12149 // try to determine trumbleCount from the key in the saved game
12151 [self mungChecksumWithNSString:[self commanderName]];
12154 trumbleHash = munge_checksum(i);
12155 if (putativeHash == trumbleHash)
12156 {
12157 info_failed = NO;
12158 putativeNTrumbles = i;
12159 }
12160 }
12161
12162 if (possible_cheat && !info_failed)
12163 OOLog(@"cheat.verified", @"%@", @"CHEAT DEFEATED - that's not the way to get rid of trumbles!");
12164 }
12165 else
12166 // if trumbleValue comes in as nil, then probably someone has toyed with the save file
12167 // by removing the entire trumbles array
12168 {
12169 OOLog(@"cheat.tentative", @"%@", @"POSSIBLE CHEAT DETECTED");
12170 info_failed = YES;
12171 }
12172
12173 if (info_failed && [[NSUserDefaults standardUserDefaults] objectForKey:namekey])
12174 {
12175 // try to determine trumbleCount from the key in user defaults
12176 putativeHash = (int)[[NSUserDefaults standardUserDefaults] integerForKey:namekey];
12177 for (i = 1; (info_failed)&&(i < PLAYER_MAX_TRUMBLES); i++)
12178 {
12180 [self mungChecksumWithNSString:[self commanderName]];
12183 trumbleHash = munge_checksum(i);
12184 if (putativeHash == trumbleHash)
12185 {
12186 info_failed = NO;
12187 putativeNTrumbles = i;
12188 }
12189 }
12190
12191 if (!info_failed)
12192 OOLog(@"cheat.verified", @"%@", @"CHEAT DEFEATED - that's not the way to get rid of trumbles!");
12193 }
12194 // at this stage we've done the best we can to stop cheaters
12195 trumbleCount = putativeNTrumbles;
12196
12197 if ((putativeTrumbleArray != nil) && ([putativeTrumbleArray count] == PLAYER_MAX_TRUMBLES))
12198 {
12199 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12200 [trumble[i] setFromDictionary:[putativeTrumbleArray oo_dictionaryAtIndex:i]];
12201 }
12202
12204 [self mungChecksumWithNSString:[self commanderName]];
12207 trumbleHash = munge_checksum(trumbleCount);
12208
12209 [[NSUserDefaults standardUserDefaults] setInteger:trumbleHash forKey:namekey];
12210}

References clear_checksum(), commanderName, count, credits, int(), mungChecksumWithNSString:, munge_checksum(), nil, OOLog, PLAYER_MAX_TRUMBLES, setUpTrumbles, ship_kills, trumble, trumbleCount, and trumbleValue.

Referenced by setCommanderDataFromDictionary:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUpAndConfirmOK:

- (BOOL) setUpAndConfirmOK: (BOOL) stopOnError

Definition at line 1868 of file PlayerEntity.m.

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

References setUpAndConfirmOK:saveGame:.

Referenced by deferredInit.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUpAndConfirmOK:saveGame:

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

Definition at line 1874 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 // make sure extraGuiScreenKeys is clear
1959
1960 [[GameController sharedController] logProgress:OOExpandKeyRandomized(@"loading-miscellany")];
1961
1962 // if there is cargo remaining from previously (e.g. a game restart), remove it
1963 if ([self cargoList] != nil)
1964 {
1965 [self removeAllCargo:YES]; // force removal of cargo
1966 }
1967
1968 [self setShipDataKey:PLAYER_SHIP_DESC];
1970
1971 // reset HUD & default commlog behaviour
1972 [UNIVERSE setAutoCommLog:YES];
1973 [UNIVERSE setPermanentCommLog:NO];
1974
1975 [multiFunctionDisplayText release];
1976 multiFunctionDisplayText = [[NSMutableDictionary alloc] init];
1977
1978 [multiFunctionDisplaySettings release];
1979 multiFunctionDisplaySettings = [[NSMutableArray alloc] init];
1980
1981 [customDialSettings release];
1982 customDialSettings = [[NSMutableDictionary alloc] init];
1983
1984 [self switchHudTo:@"hud.plist"];
1985 scanner_zoom_rate = 0.0f;
1986 longRangeChartMode = OOLRC_MODE_SUNCOLOR;
1987
1988 [mission_variables release];
1989 mission_variables = [[NSMutableDictionary alloc] init];
1990
1991 [localVariables release];
1992 localVariables = [[NSMutableDictionary alloc] init];
1993
1994 [self setScriptTarget:nil];
1995 [self resetMissionChoice];
1996 [[UNIVERSE gameView] resetTypedString];
1997 found_system_id = -1;
1998
1999 [reputation release];
2000 reputation = [[NSMutableDictionary alloc] initWithCapacity:6];
2001 [reputation oo_setInteger:0 forKey:CONTRACTS_GOOD_KEY];
2002 [reputation oo_setInteger:0 forKey:CONTRACTS_BAD_KEY];
2003 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:CONTRACTS_UNKNOWN_KEY];
2004 [reputation oo_setInteger:0 forKey:PASSAGE_GOOD_KEY];
2005 [reputation oo_setInteger:0 forKey:PASSAGE_BAD_KEY];
2006 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:PASSAGE_UNKNOWN_KEY];
2007 [reputation oo_setInteger:0 forKey:PARCEL_GOOD_KEY];
2008 [reputation oo_setInteger:0 forKey:PARCEL_BAD_KEY];
2009 [reputation oo_setInteger:MAX_CONTRACT_REP forKey:PARCEL_UNKNOWN_KEY];
2010
2012 roleWeights = [[NSMutableArray alloc] initWithCapacity:8];
2013 for (i = 0 ; i < 8 ; i++)
2014 {
2015 [roleWeights addObject:@"player-unknown"];
2016 }
2018 roleWeightFlags = [[NSMutableDictionary alloc] init];
2019
2021 roleSystemList = [[NSMutableArray alloc] initWithCapacity:32];
2022
2023 energy = 256;
2024 weapon_temp = 0.0f;
2025 forward_weapon_temp = 0.0f;
2026 aft_weapon_temp = 0.0f;
2027 port_weapon_temp = 0.0f;
2028 starboard_weapon_temp = 0.0f;
2029 lastShot = nil;
2034 ship_temperature = 60.0f;
2035 alertFlags = 0;
2036 hyperspeed_engaged = NO;
2037 autopilot_engaged = NO;
2039
2040 flightRoll = 0.0f;
2041 flightPitch = 0.0f;
2042 flightYaw = 0.0f;
2043
2044 max_passengers = 0;
2045 [passengers release];
2046 passengers = [[NSMutableArray alloc] init];
2047 [passenger_record release];
2048 passenger_record = [[NSMutableDictionary alloc] init];
2049
2050 [contracts release];
2051 contracts = [[NSMutableArray alloc] init];
2052 [contract_record release];
2053 contract_record = [[NSMutableDictionary alloc] init];
2054
2055 [parcels release];
2056 parcels = [[NSMutableArray alloc] init];
2057 [parcel_record release];
2058 parcel_record = [[NSMutableDictionary alloc] init];
2059
2060 [missionDestinations release];
2061 missionDestinations = [[NSMutableDictionary alloc] init];
2062
2063 [shipyard_record release];
2064 shipyard_record = [[NSMutableDictionary alloc] init];
2065
2066 [target_memory release];
2067 target_memory = [[NSMutableArray alloc] initWithCapacity:PLAYER_TARGET_MEMORY_SIZE];
2068 [self clearTargetMemory]; // also does first-time initialisation
2069
2070 [self setMissionOverlayDescriptor:nil];
2071 [self setMissionBackgroundDescriptor:nil];
2072 [self setMissionBackgroundSpecial:nil];
2073 [self setEquipScreenBackgroundDescriptor:nil];
2074 marketOffset = 0;
2076
2077 script_time = 0.0;
2080
2081 NSCalendarDate *nowDate = [NSCalendarDate calendarDate];
2083 ship_clock += [nowDate hourOfDay] * 3600.0;
2084 ship_clock += [nowDate minuteOfHour] * 60.0;
2085 ship_clock += [nowDate secondOfMinute];
2087 ship_clock_adjust = 0.0;
2089
2091#if OOLITE_ESPEAK
2092 voice_gender_m = YES;
2093 voice_no = [UNIVERSE setVoice:-1 withGenderM:voice_gender_m];
2094#endif
2095
2096 [_customViews release];
2097 _customViews = nil;
2098 _customViewIndex = 0;
2099
2100 mouse_control_on = NO;
2101
2102 // player commander data
2103 // Most of this is probably also set more than once
2104
2105 [self setCommanderName:PLAYER_DEFAULT_NAME];
2106 [self setLastsaveName:PLAYER_DEFAULT_NAME];
2107
2108 galaxy_coordinates = NSMakePoint(0x14,0xAD); // 20,173
2109
2110 credits = 1000;
2112 fuel_accumulator = 0.0f;
2113 fuel_leak_rate = 0.0f;
2114
2115 galaxy_number = 0;
2116 // will load real weapon data later
2122
2123 weapons_online = YES;
2124
2125 ecm_in_operation = NO;
2126 last_ecm_time = [UNIVERSE getTime];
2127 compassMode = COMPASS_MODE_BASIC;
2128 ident_engaged = NO;
2129
2130 max_cargo = 20; // will be reset later
2132
2134 shipCommodityData = [[[UNIVERSE commodities] generateManifestForPlayer] retain];
2135
2136 // set up missiles
2139
2140 [eqScripts release];
2141 eqScripts = [[NSMutableArray alloc] init];
2142 primedEquipment = 0;
2143 [self setFastEquipmentA:@"EQ_CLOAKING_DEVICE"];
2144 [self setFastEquipmentB:@"EQ_ENERGY_BOMB"]; // for compatibility purposes
2145
2146 [self setActiveMissile:0];
2147 for (i = 0; i < missiles; i++)
2148 {
2149 [missile_entity[i] release];
2150 missile_entity[i] = nil;
2151 }
2152 [self safeAllMissiles];
2153
2154 [self clearSubEntities];
2155
2156 legalStatus = 0;
2157
2158 market_rnd = 0;
2159 ship_kills = 0;
2165 chart_zoom = 1.0;
2166 target_chart_zoom = 1.0;
2167 saved_chart_zoom = 1.0;
2169
2170
2171 scripted_misjump = NO;
2173 scoopOverride = NO;
2174
2177
2180
2181 forward_shield = [self maxForwardShieldLevel];
2182 aft_shield = [self maxAftShieldLevel];
2183
2184 scanClass = CLASS_PLAYER;
2185
2186 [UNIVERSE clearGUIs];
2187
2190
2191 [self setDockedStation:[UNIVERSE station]];
2192
2193 [commLog release];
2194 commLog = nil;
2195
2196 [specialCargo release];
2197 specialCargo = nil;
2198
2199 // views
2205
2207 [self currentWeaponStats];
2208
2209 [save_path autorelease];
2210 save_path = nil;
2211
2212 [scannedWormholes release];
2213 scannedWormholes = [[NSMutableArray alloc] init];
2214
2215 [self setUpTrumbles];
2216
2217 suppressTargetLost = NO;
2218
2219 scoopsActive = NO;
2220
2221 [dockingReport release];
2222 dockingReport = [[NSMutableString alloc] init];
2223
2224 [shipAI release];
2225 shipAI = [[AI alloc] initWithStateMachine:PLAYER_DOCKING_AI_NAME andState:@"GLOBAL"];
2226 [self resetAutopilotAI];
2227
2228 lastScriptAlertCondition = [self alertCondition];
2229
2230 entity_personality = ranrot_rand() & 0x7FFF;
2231
2232 [self setSystemID:[UNIVERSE findSystemNumberAtCoords:[self galaxy_coordinates] withGalaxy:galaxy_number includingHidden:YES]];
2233 [UNIVERSE setGalaxyTo:galaxy_number];
2234 [UNIVERSE setSystemTo:system_id];
2235
2236 [self setUpWeaponSounds];
2237
2238 [self setGalacticHyperspaceBehaviourTo:[[UNIVERSE globalSettings] oo_stringForKey:@"galactic_hyperspace_behaviour" defaultValue:@"BEHAVIOUR_STANDARD"]];
2239 [self setGalacticHyperspaceFixedCoordsTo:[[UNIVERSE globalSettings] oo_stringForKey:@"galactic_hyperspace_fixed_coords" defaultValue:@"96 96"]];
2240
2242
2243 demoShip = nil;
2244
2246 [stickProfileScreen release];
2247 stickProfileScreen = [[StickProfileScreen alloc] init];
2248 return YES;
2249}
#define PLAYER_STARTING_MISSILES
#define PLAYER_SHIP_CLOCK_START
#define PLAYER_STARTING_MAX_MISSILES
Definition AI.h:38
GameController * sharedController()
void logProgress:(NSString *message)
NSArray * cargoList()
StickProfileScreen * stickProfileScreen
OOAlertCondition lastScriptAlertCondition
NSDictionary * loadScripts()
GLfloat _scriptedMisjumpRange
Definition ShipEntity.h:284
unsigned scripted_misjump
Definition ShipEntity.h:278
GLfloat scannerRange

References _customViewIndex, _customViews, ShipEntity::_scriptedMisjumpRange, aft_shield, aft_shield_recharge_rate, aft_shot_time, ShipEntity::aft_weapon_temp, ShipEntity::aft_weapon_type, aftViewOffset, alertCondition, alertFlags, ANA_mode, autopilot_engaged, BASELINE_SHIELD_LEVEL, cargoList, chart_centre_coordinates, chart_focus_coordinates, chart_zoom, ShipEntity::clearSubEntities, clearTargetMemory, ShipEntity::cloaking_device_active, commLog, commodityScripts, compassMode, contract_record, contracts, credits, ShipEntity::currentWeaponFacing, currentWeaponStats, cursor_coordinates, customDialSettings, customViewOffset, demoShip, DESTROY, DOCKING_CLEARANCE_STATUS_GRANTED, dockingClearanceStatus, dockingReport, ecm_in_operation, Entity::energy, ShipEntity::entity_personality, eqScripts, escape_pod_rescue_time, EXPECT_NOT, extraGuiScreenKeys, fieldOfView, ShipEntity::flightPitch, ShipEntity::flightRoll, ShipEntity::flightYaw, forward_shield, forward_shield_recharge_rate, forward_shot_time, ShipEntity::forward_weapon_temp, ShipEntity::forward_weapon_type, forwardViewOffset, found_system_id, fps_check_time, ShipEntity::fuel, ShipEntity::fuel_accumulator, fuel_leak_rate, galaxy_coordinates, galaxy_number, hyperspeed_engaged, ident_engaged, INITIAL_SHOT_TIME, isSpeechOn, OOScript::jsScriptFromFileNamed:properties:, OOMusicController::justStop, kDeadResetTime, kZeroVector, last_ecm_time, lastScriptAlertCondition, lastShot, legalStatus, ResourceManager::loadScripts, localVariables, GameController::logProgress:, longRangeChartMode, MARKET_FILTER_MODE_OFF, market_rnd, marketFilterMode, marketOffset, marketSelectedCommodity, max_aft_shield, ShipEntity::max_cargo, max_forward_shield, ShipEntity::max_missiles, max_passengers, maxAftShieldLevel, maxForwardShieldLevel, missile_entity, ShipEntity::missiles, mission_variables, missionDestinations, mouse_control_on, multiFunctionDisplaySettings, multiFunctionDisplayText, nil, OOScriptTimer::noteGameReset, OOLog, OOSPEECHSETTINGS_OFF, OPTIMIZED_BY_NONE, parcel_record, parcels, passenger_record, passengers, PLAYER_MAX_FUEL, PLAYER_SHIP_CLOCK_START, PLAYER_STARTING_MAX_MISSILES, PLAYER_STARTING_MISSILES, port_shot_time, ShipEntity::port_weapon_temp, ShipEntity::port_weapon_type, portViewOffset, primedEquipment, ranrot_rand, removeAllCargo:, reputation, resetAutopilotAI, resetMissionChoice, roleSystemList, roleWeightFlags, roleWeights, safeAllMissiles, save_path, saved_chart_zoom, ShipEntity::scanClass, scannedWormholes, SCANNER_MAX_RANGE, scanner_zoom_rate, ShipEntity::scannerRange, scoopOverride, scoopsActive, script_time, script_time_check, script_time_interval, SCRIPT_TIMER_INTERVAL, ShipEntity::scripted_misjump, setActiveMissile:, setCommanderName:, setDockedStation:, setEquipScreenBackgroundDescriptor:, setFastEquipmentA:, setFastEquipmentB:, setGalacticHyperspaceBehaviourTo:, setGalacticHyperspaceFixedCoordsTo:, setLastsaveName:, setMissionBackgroundDescriptor:, setMissionBackgroundSpecial:, setMissionOverlayDescriptor:, setScriptTarget:, ShipEntity::setShipDataKey:, ShipEntity::setStatus:, setSystemID:, setUpSound, setUpTrumbles, setUpWeaponSounds, GameController::sharedController, OOMusicController::sharedController, ship_clock, ship_clock_adjust, ship_kills, ShipEntity::ship_temperature, ship_trade_in_factor, ShipEntity::shipAI, shipCommodityData, shipyard_record, ShipEntity::shot_time, show_info_flag, showDemoShips, specialCargo, starboard_shot_time, ShipEntity::starboard_weapon_temp, ShipEntity::starboard_weapon_type, starboardViewOffset, GameController::startAnimationTimer, stickProfileScreen, GameController::stopAnimationTimer, suppressTargetLost, switchHudTo:, target_chart_centre, target_chart_focus, target_chart_zoom, target_memory, targetDockStation, OOScriptTimer::updateTimers, ShipEntity::velocity, WEAPON_FACING_FORWARD, ShipEntity::weapon_temp, weapons_online, worldScripts, and worldScriptsRequiringTickle.

Referenced by setUpAndConfirmOK:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUpShipFromDictionary:

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

Reimplemented from ShipEntity.

Definition at line 2280 of file PlayerEntity.m.

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

References _customViewIndex, _customViews, ShipEntity::_primaryTarget, ShipEntity::_scaleFactor, addEquipmentFromCollection:, aftViewOffset, ShipEntity::cargo, compassTarget, DESTROY, Entity::energy, OOEquipmentType::equipmentTypeWithIdentifier:, EXPECT, forwardViewOffset, OOScript::jsScriptFromFileNamed:properties:, massLockable, ShipEntity::max_flight_pitch, ShipEntity::max_flight_roll, ShipEntity::max_flight_yaw, ShipEntity::max_missiles, Entity::maxEnergy, missile_entity, ShipEntity::missile_list, ShipEntity::missiles, nil, pitch_delta, PLAYER_MAX_MISSILES, portViewOffset, ShipEntity::removeAllEquipment, resetHud, ShipEntity::roleSet, roll_delta, safeAllMissiles, SCANNER_MAX_RANGE, ShipEntity::scannerRange, ShipEntity::script, setActiveMissile:, setDefaultCustomViews, setDefaultViewOffsets, HeadUpDisplay::setHidden:, ShipEntity::setPrimaryRole:, starboardViewOffset, and yaw_delta.

Referenced by Universe(OOPrivate)::setUpInitialUniverse.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUpSound

- (void) setUpSound

Provided by category PlayerEntity(Sound).

Definition at line 73 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}
void setPosition:(Vector inPosition)
OOSound * ooSoundNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)

Referenced by setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setupStartScreenGui

- (void) setupStartScreenGui

Definition at line 9929 of file PlayerEntity.m.

9930{
9931 GuiDisplayGen *gui = [UNIVERSE gui];
9932 NSString *text = nil;
9933
9934 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9935
9936 [gui clear];
9937
9938 [gui setTitle:@"Oolite"];
9939
9940 text = DESC(@"game-copyright");
9941 [gui setText:text forRow:15 align:GUI_ALIGN_CENTER];
9942 [gui setColor:[OOColor whiteColor] forRow:15];
9943
9944 text = DESC(@"theme-music-credit");
9945 [gui setText:text forRow:17 align:GUI_ALIGN_CENTER];
9946 [gui setColor:[OOColor grayColor] forRow:17];
9947
9948 int initialRow = 22;
9949 int row = initialRow;
9950
9951 text = DESC(@"oolite-start-option-1");
9952 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9953 [gui setColor:[OOColor yellowColor] forRow:row];
9954 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9955
9956 ++row;
9957
9958 text = DESC(@"oolite-start-option-2");
9959 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9960 [gui setColor:[OOColor yellowColor] forRow:row];
9961 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9962
9963 ++row;
9964
9965 text = DESC(@"oolite-start-option-3");
9966 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9967 [gui setColor:[OOColor yellowColor] forRow:row];
9968 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9969
9970 ++row;
9971
9972 text = DESC(@"oolite-start-option-4");
9973 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9974 [gui setColor:[OOColor yellowColor] forRow:row];
9975 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9976
9977 ++row;
9978
9979 text = DESC(@"oolite-start-option-5");
9980 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9981 [gui setColor:[OOColor yellowColor] forRow:row];
9982 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9983
9984 ++row;
9985
9986 text = DESC(@"oolite-start-option-6");
9987 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9988 [gui setColor:[OOColor yellowColor] forRow:row];
9989 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9990
9991
9992 [gui setSelectableRange:NSMakeRange(initialRow, row - initialRow + 1)];
9993 [gui setSelectedRow:initialRow];
9994
9995 [gui setBackgroundTextureKey:@"intro"];
9996
9997}
OOColor * whiteColor()
Definition OOColor.m:256

References GuiDisplayGen::clear, DESC, OOColor::grayColor, nil, GuiDisplayGen::setBackgroundTextureKey:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setKey:forRow:, GuiDisplayGen::setSelectableRange:, GuiDisplayGen::setSelectedRow:, GuiDisplayGen::setText:forRow:align:, GuiDisplayGen::setTitle:, setupStartScreenGui, OOColor::whiteColor, and OOColor::yellowColor.

Referenced by roleWeights, setGuiToIntroFirstGo:, and setupStartScreenGui.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUpTrumbles

- (void) setUpTrumbles

Definition at line 11996 of file PlayerEntity.m.

11997{
11998 NSMutableString *trumbleDigrams = [NSMutableString stringWithCapacity:256];
11999 unichar xchar = (unichar)0;
12000 unichar digramchars[2];
12001
12002 while ([trumbleDigrams length] < PLAYER_MAX_TRUMBLES + 2)
12003 {
12004 NSString *commanderName = [self commanderName];
12005 if ([commanderName length] > 0)
12006 {
12007 [trumbleDigrams appendFormat:@"%@%@", commanderName, [[self mesh] modelName]];
12008 }
12009 else
12010 {
12011 [trumbleDigrams appendString:@"Some Random Text!"];
12012 }
12013 }
12014 int i;
12015 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12016 {
12017 digramchars[0] = ([trumbleDigrams characterAtIndex:i] & 0x007f) | 0x0020;
12018 digramchars[1] = (([trumbleDigrams characterAtIndex:i + 1] ^ xchar) & 0x007f) | 0x0020;
12019 xchar = digramchars[0];
12020 NSString *digramstring = [NSString stringWithCharacters:digramchars length:2];
12021 [trumble[i] release];
12022 trumble[i] = [[OOTrumble alloc] initForPlayer:self digram:digramstring];
12023 }
12024
12025 trumbleCount = 0;
12026
12027 [self setTrumbleAppetiteAccumulator:0.0f];
12028}
NSString * commanderName()

References commanderName, ShipEntity::mesh, OOMesh::modelName, PLAYER_MAX_TRUMBLES, setTrumbleAppetiteAccumulator:, setUpTrumbles, trumble, and trumbleCount.

Referenced by isSpeechOn, setCommanderDataFromDictionary:, setTrumbleValueFrom:, setUpAndConfirmOK:saveGame:, and setUpTrumbles.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUpWeaponSounds

- (void) setUpWeaponSounds

Provided by category PlayerEntity(Sound).

Definition at line 105 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()

Referenced by setUpAndConfirmOK:saveGame:.

+ Here is the caller graph for this function:

◆ setWeaponMount:toWeapon:

- (BOOL) setWeaponMount: (OOWeaponFacing) chosen_weapon_facing
toWeapon: (NSString *) eqKey 

Reimplemented from ShipEntity.

Definition at line 10610 of file PlayerEntity.m.

10610 :(OOWeaponFacing)facing toWeapon:(NSString *)eqKey
10611{
10612 return [self setWeaponMount:facing toWeapon:eqKey inContext:@"purchase"];
10613}
OOWeaponFacing
Definition OOTypes.h:228

References setWeaponMount:toWeapon:inContext:.

+ Here is the call graph for this function:

◆ setWeaponMount:toWeapon:inContext:

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

Definition at line 10616 of file PlayerEntity.m.

10616 :(OOWeaponFacing)facing toWeapon:(NSString *)eqKey inContext:(NSString *) context
10617{
10618
10619 NSDictionary *shipyardInfo = [[OOShipRegistry sharedRegistry] shipyardInfoForKey:[self shipDataKey]];
10620 unsigned available_facings = [shipyardInfo oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:[self weaponFacings]]; // use defaults explicitly
10621
10622 // facing exists?
10623 if (!(available_facings & facing))
10624 {
10625 return NO;
10626 }
10627
10628 // weapon allowed (or NONE)?
10629 if (![eqKey isEqualToString:@"EQ_WEAPON_NONE"])
10630 {
10631 if (![self canAddEquipment:eqKey inContext:context])
10632 {
10633 return NO;
10634 }
10635 }
10636
10637 // sets WEAPON_NONE if not recognised
10639
10640 switch (facing)
10641 {
10643 forward_weapon_type = chosen_weapon;
10644 break;
10645
10646 case WEAPON_FACING_AFT:
10647 aft_weapon_type = chosen_weapon;
10648 break;
10649
10650 case WEAPON_FACING_PORT:
10651 port_weapon_type = chosen_weapon;
10652 break;
10653
10655 starboard_weapon_type = chosen_weapon;
10656 break;
10657
10658 case WEAPON_FACING_NONE:
10659 break;
10660 }
10661
10662 return YES;
10663}
OOWeaponType OOWeaponTypeFromEquipmentIdentifierStrict(NSString *string) PURE_FUNC

References ShipEntity::aft_weapon_type, ShipEntity::forward_weapon_type, OOWeaponTypeFromEquipmentIdentifierStrict(), ShipEntity::port_weapon_type, OOShipRegistry::sharedRegistry, ShipEntity::shipDataKey, OOShipRegistry::shipyardInfoForKey:, ShipEntity::starboard_weapon_type, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_NONE, WEAPON_FACING_PORT, WEAPON_FACING_STARBOARD, and ShipEntity::weaponFacings.

Referenced by PlayerShipSetProperty(), setWeaponMount:toWeapon:, and ShipSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWeaponsOnline:

- (void) setWeaponsOnline: (BOOL) newValue

Definition at line 6175 of file PlayerEntity.m.

6175 :(BOOL)newValue
6176{
6177 weapons_online = !!newValue;
6178 if (!weapons_online) [self safeAllMissiles];
6179}

References safeAllMissiles, and weapons_online.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWitchspaceCountdown:

- (void) setWitchspaceCountdown: (int) spin_time

Definition at line 13012 of file PlayerEntity.m.

13012 :(int)spin_time
13013{
13014 witchspaceCountdown = spin_time;
13015}

References witchspaceCountdown.

Referenced by PlayerShipBeginGalacticHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ setWormhole:

- (void) setWormhole: (WormholeEntity *) newWormhole

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

References nil, and wormhole.

Referenced by Universe::carryPlayerOn:inWormhole:.

+ Here is the caller graph for this function:

◆ sharedPlayer

+ (PlayerEntity *) sharedPlayer

Definition at line 179 of file PlayerEntity.m.

180{
181 if (EXPECT_NOT(gOOPlayer == nil))
182 {
183 gOOPlayer = [[PlayerEntity alloc] init];
184 }
185 return gOOPlayer;
186}

References EXPECT_NOT, gOOPlayer, nil, and sharedPlayer.

Referenced by OODebugController::dumpPlayerStateAction:, OODebugController::hideShowHUD:, InitOOJSPlayerShip(), Universe::initWithGameView:, ShipEntity(OOEntityInspectorExtensions)::inspBecomeTarget, MyOpenGLView::pollControls, sharedPlayer, and OODebugController::validateMenuItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shipCommodityData

- (OOCommodityMarket *) shipCommodityData

References deciCredits, galaxyNumber, int(), random_factor, and shipCommodityData.

+ Here is the call graph for this function:

◆ shipsFound_number

- (NSNumber *) shipsFound_number

Provided by category PlayerEntity(Scripting).

Definition at line 956 of file PlayerEntityLegacyScriptEngine.m.

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

◆ shipyardRecord

- (NSMutableDictionary *) shipyardRecord

Definition at line 13365 of file PlayerEntity.m.

13366{
13367 return shipyard_record;
13368}

References shipyard_record, and shipyardRecord.

Referenced by shipyardRecord, and wormhole.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showCommanderShip:

- (void) showCommanderShip: (int) cdrArrayIndex
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1203 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}
static uint16_t PersonalityForCommanderDict(NSDictionary *dict)

Referenced by PlayerEntity(LoadSave)::commanderSelector, PlayerEntity(OOLoadSavePrivate)::lsCommanders:directory:pageNumber:highlightName:, and PlayerEntity(LoadSave)::saveCommanderInputHandler.

+ Here is the caller graph for this function:

◆ showDemoShips

- (BOOL) showDemoShips

◆ showGameOver

- (void) showGameOver
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 4056 of file PlayerEntity.m.

4057{
4058 [hud resetGuis:[NSDictionary dictionaryWithObject:[NSDictionary dictionary] forKey:@"message_gui"]];
4059 NSString *scoreMS = [NSString stringWithFormat:OOExpandKey(@"gameoverscreen-score-@"),
4060 KillCountToRatingAndKillString(ship_kills)];
4061
4062 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-game-over") forCount:kDeadResetTime];
4063 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4064 [UNIVERSE displayMessage:scoreMS forCount:kDeadResetTime];
4065 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4066 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-press-space") forCount:kDeadResetTime];
4067 [UNIVERSE displayMessage:@" " forCount:kDeadResetTime];
4068 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4069 [self resetShotTime];
4070}

References ShipEntity::resetShotTime, and PlayerEntity(OOPrivate)::showGameOver.

Referenced by doBookkeeping:, getDestroyedBy:damageType:, PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, and PlayerEntity(OOPrivate)::showGameOver.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showInfoFlag

- (BOOL) showInfoFlag

Definition at line 12688 of file PlayerEntity.m.

12689{
12690 return show_info_flag;
12691}

References show_info_flag, and showInfoFlag.

Referenced by customViewDescription, and showInfoFlag.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showInformationForSelectedInterface

- (void) showInformationForSelectedInterface

Definition at line 9869 of file PlayerEntity.m.

9870{
9871 GuiDisplayGen* gui = [UNIVERSE gui];
9872 NSString* interfaceKey = [gui selectedRowKey];
9873
9874 int i;
9875
9876 for (i = GUI_ROW_EQUIPMENT_DETAIL; i < GUI_MAX_ROWS; i++)
9877 {
9878 [gui setText:@"" forRow:i];
9879 [gui setColor:[gui colorFromSetting:kGuiInterfaceDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
9880 }
9881
9882 if (interfaceKey && ![interfaceKey hasPrefix:@"More:"])
9883 {
9884 NSDictionary *interfaces = [[self dockedStation] localInterfaces];
9885 OOJSInterfaceDefinition *definition = [interfaces objectForKey:interfaceKey];
9886 if (definition)
9887 {
9888 [gui addLongText:[definition summary] startingAtRow:GUI_ROW_INTERFACES_DETAIL align:GUI_ALIGN_LEFT];
9889 }
9890 }
9891
9892}
#define GUI_MAX_ROWS
@ GUI_ROW_EQUIPMENT_DETAIL

References GuiDisplayGen::addLongText:startingAtRow:align:, GuiDisplayGen::colorFromSetting:defaultValue:, dockedStation, OOColor::greenColor, GUI_MAX_ROWS, GUI_ROW_EQUIPMENT_DETAIL, StationEntity::localInterfaces, GuiDisplayGen::selectedRowKey, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setText:forRow:, showInformationForSelectedInterface, and OOJSInterfaceDefinition::summary.

Referenced by activateSelectedInterface, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, roleWeights, setGuiToInterfacesScreen:, and showInformationForSelectedInterface.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showInformationForSelectedUpgrade

- (void) showInformationForSelectedUpgrade

Definition at line 9701 of file PlayerEntity.m.

9702{
9703 [self showInformationForSelectedUpgradeWithFormatString:nil];
9704}

References showInformationForSelectedUpgrade, and showInformationForSelectedUpgradeWithFormatString:.

Referenced by buySelectedItem, highlightEquipShipScreenKey:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, roleWeights, setGuiToEquipShipScreen:selectingFacingFor:, and showInformationForSelectedUpgrade.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showInformationForSelectedUpgradeWithFormatString:

- (void) showInformationForSelectedUpgradeWithFormatString: (NSString *) extraString

Definition at line 9707 of file PlayerEntity.m.

9707 :(NSString *)formatString
9708{
9709 GuiDisplayGen* gui = [UNIVERSE gui];
9710 NSString* eqKey = [gui selectedRowKey];
9711 int i;
9712
9713 OOColor *descColor = [gui colorFromSetting:kGuiEquipmentDescriptionColor defaultValue:[OOColor greenColor]];
9714 for (i = GUI_ROW_EQUIPMENT_DETAIL; i < GUI_MAX_ROWS; i++)
9715 {
9716 [gui setText:@"" forRow:i];
9717 [gui setColor:descColor forRow:i];
9718 }
9719 if (eqKey)
9720 {
9721 if (![eqKey hasPrefix:@"More:"])
9722 {
9724 NSString* eq_key_damaged = [NSString stringWithFormat:@"%@_DAMAGED", eqKey];
9726 if ([self hasEquipmentItem:eq_key_damaged])
9727 {
9728 desc = [NSString stringWithFormat:DESC(@"upgradeinfo-@-price-is-for-repairing"), desc];
9729 }
9730 else
9731 {
9732 if([eqKey hasSuffix:@"ENERGY_UNIT"] && ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"] || [self hasEquipmentItem:@"EQ_ENERGY_UNIT"] || [self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]))
9733 desc = [NSString stringWithFormat:DESC(@"@-will-replace-other-energy"), desc];
9734 if (weight > 0) desc = [NSString stringWithFormat:DESC(@"upgradeinfo-@-weight-d-of-equipment"), desc, weight];
9735 }
9736 if (formatString) desc = [NSString stringWithFormat:formatString, desc];
9737 [gui addLongText:desc startingAtRow:GUI_ROW_EQUIPMENT_DETAIL align:GUI_ALIGN_LEFT];
9738 }
9739 }
9740}
OOCargoQuantity requiredCargoSpace()
NSString * descriptiveText()

References GuiDisplayGen::addLongText:startingAtRow:align:, GuiDisplayGen::colorFromSetting:defaultValue:, OOEquipmentType::descriptiveText, OOEquipmentType::equipmentTypeWithIdentifier:, OOColor::greenColor, GUI_MAX_ROWS, GUI_ROW_EQUIPMENT_DETAIL, OOEquipmentType::requiredCargoSpace, GuiDisplayGen::selectedRowKey, GuiDisplayGen::setColor:forRow:, and GuiDisplayGen::setText:forRow:.

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, setGuiToEquipShipScreen:selectingFacingFor:, and showInformationForSelectedUpgrade.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMarketCashAndLoadLine

- (void) showMarketCashAndLoadLine
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 11354 of file PlayerEntity.m.

11355{
11356 GuiDisplayGen *gui = [UNIVERSE gui];
11357 OOCargoQuantity currentCargo = current_cargo;
11358 OOCargoQuantity cargoCapacity = [self maxAvailableCargoSpace];
11359 [gui setText:OOExpandKey(@"market-cash-and-load", credits, currentCargo, cargoCapacity) forRow:GUI_ROW_MARKET_CASH];
11360 [gui setColor:[gui colorFromSetting:kGuiMarketCashColor defaultValue:[OOColor yellowColor]] forRow:GUI_ROW_MARKET_CASH];
11361}

References GuiDisplayGen::colorFromSetting:defaultValue:, ShipEntity::maxAvailableCargoSpace, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setText:forRow:, PlayerEntity(OOPrivate)::showMarketCashAndLoadLine, and OOColor::yellowColor.

Referenced by PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, setGuiToMarketInfoScreen, setGuiToMarketScreen, and PlayerEntity(OOPrivate)::showMarketCashAndLoadLine.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

10960 :(OOGUIRow)row forGood:(OOCommodityType)good inMarket:(OOCommodityMarket *)localMarket holdQuantity:(OOCargoQuantity)quantity
10961{
10962 GuiDisplayGen *gui = [UNIVERSE gui];
10963 NSString* desc = [NSString stringWithFormat:@" %@ ", [shipCommodityData nameForGood:good]];
10964 OOCargoQuantity available_units = [localMarket quantityForGood:good];
10965 OOCargoQuantity units_in_hold = quantity;
10966 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:good];
10967 OOMassUnit unit = [shipCommodityData massUnitForGood:good];
10968
10969 NSString *available = OOPadStringToEms(((available_units > 0) ? (NSString *)[NSString stringWithFormat:@"%d",available_units] : DESC(@"commodity-quantity-none")), 2.5);
10970
10971 NSUInteger priceDecimal = pricePerUnit % 10;
10972 NSString *price = [NSString stringWithFormat:@" %@.%lu ",OOPadStringToEms([NSString stringWithFormat:@"%lu",(unsigned long)(pricePerUnit/10)],2.5),priceDecimal];
10973
10974 // this works with up to 9999 tons of gemstones. Any more than that, they deserve the formatting they get! :)
10975
10976 NSString *owned = OOPadStringToEms((units_in_hold > 0) ? (NSString *)[NSString stringWithFormat:@"%d",units_in_hold] : DESC(@"commodity-quantity-none"), 4.5);
10977 NSString *units = DisplayStringForMassUnit(unit);
10978 NSString *units_available = [NSString stringWithFormat:@" %@ %@ ",available, units];
10979 NSString *units_owned = [NSString stringWithFormat:@" %@ %@ ",owned, units];
10980
10981 NSUInteger import_legality = [localMarket importLegalityForGood:good];
10982 NSUInteger export_legality = [localMarket exportLegalityForGood:good];
10983 NSString *legaldesc = nil;
10984 if (import_legality == 0)
10985 {
10986 if (export_legality == 0)
10987 {
10988 legaldesc = DESC(@"oolite-legality-clear");
10989 }
10990 else
10991 {
10992 legaldesc = DESC(@"oolite-legality-import");
10993 }
10994 }
10995 else
10996 {
10997 if (export_legality == 0)
10998 {
10999 legaldesc = DESC(@"oolite-legality-export");
11000 }
11001 else
11002 {
11003 legaldesc = DESC(@"oolite-legality-neither");
11004 }
11005 }
11006 legaldesc = [NSString stringWithFormat:@" %@ ",legaldesc];
11007
11008 NSString *extradesc = [shipCommodityData shortCommentForGood:good];
11009
11010 [gui setKey:good forRow:row];
11011 [gui setColor:[gui colorFromSetting:kGuiMarketCommodityColor defaultValue:nil] forRow:row];
11012 [gui setArray:[NSArray arrayWithObjects: desc, extradesc, price, units_available, units_owned, legaldesc, nil] forRow:row++];
11013
11014}
NSString * DisplayStringForMassUnit(OOMassUnit unit)
NSString * OOPadStringToEms(NSString *string, float numEms)
NSUInteger exportLegalityForGood:(OOCommodityType good)
NSUInteger importLegalityForGood:(OOCommodityType good)
OOCreditsQuantity priceForGood:(OOCommodityType good)

References GuiDisplayGen::colorFromSetting:defaultValue:, DESC, DisplayStringForMassUnit(), OOCommodityMarket::exportLegalityForGood:, OOCommodityMarket::importLegalityForGood:, nil, OOPadStringToEms(), OOCommodityMarket::priceForGood:, OOCommodityMarket::quantityForGood:, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setColor:forRow:, and GuiDisplayGen::setKey:forRow:.

Referenced by setGuiToMarketInfoScreen, and setGuiToMarketScreen.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMarketScreenHeaders

- (void) showMarketScreenHeaders
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 10938 of file PlayerEntity.m.

10939{
10940 GuiDisplayGen *gui = [UNIVERSE gui];
10941 OOGUITabSettings tab_stops;
10942 tab_stops[0] = 0;
10943 tab_stops[1] = 137;
10944 tab_stops[2] = 187;
10945 tab_stops[3] = 267;
10946 tab_stops[4] = 321;
10947 tab_stops[5] = 431;
10948 [gui overrideTabs:tab_stops from:kGuiMarketTabs length:6];
10949 [gui setTabStops:tab_stops];
10950
10951 [gui setColor:[gui colorFromSetting:kGuiMarketHeadingColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_KEY];
10952 [gui setArray:[NSArray arrayWithObjects: DESC(@"commodity-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10953 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];
10954 [gui setArray:[NSArray arrayWithObjects: DESC(@"commodity-column-title"), DESC(@"oolite-extras-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10955 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];
10956
10957}

References GuiDisplayGen::colorFromSetting:defaultValue:, OOColor::greenColor, GuiDisplayGen::overrideTabs:from:length:, GuiDisplayGen::setArray:forRow:, GuiDisplayGen::setColor:forRow:, GuiDisplayGen::setTabStops:, and PlayerEntity(OOPrivate)::showMarketScreenHeaders.

Referenced by PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, setGuiToMarketInfoScreen, setGuiToMarketScreen, and PlayerEntity(OOPrivate)::showMarketScreenHeaders.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showScenarioDetails

- (void) showScenarioDetails

Provided by category PlayerEntity(LoadSave).

Definition at line 284 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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(LoadSave)::setGuiToScenarioScreen:.

+ Here is the caller graph for this function:

◆ showShipModel:

- (void) showShipModel: (NSString *) shipKey

Provided by category PlayerEntity(Scripting).

Definition at line 2150 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

Referenced by PlayerEntity(Scripting)::clearMissionScreen.

+ Here is the caller graph for this function:

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

4073 :(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality factorX:(GLfloat)factorX factorY:(GLfloat)factorY factorZ:(GLfloat)factorZ inContext:(NSString *)context
4074{
4075 if (shipKey == nil) return;
4076 if (shipData == nil) shipData = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipKey];
4077 if (shipData == nil) return;
4078
4079 Quaternion q2 = { (GLfloat)M_SQRT1_2, (GLfloat)M_SQRT1_2, (GLfloat)0.0f, (GLfloat)0.0f };
4080 // MKW - retrieve last demo ships' orientation and release it
4081 if( demoShip != nil )
4082 {
4083 q2 = [demoShip orientation];
4084 [demoShip release];
4085 }
4086
4087 ShipEntity *ship = [[ProxyPlayerEntity alloc] initWithKey:shipKey definition:shipData];
4088 if (personality != ENTITY_PERSONALITY_INVALID) [ship setEntityPersonalityInt:personality];
4089
4090 [ship wasAddedToUniverse];
4091
4092 if (context) OOLog(@"script.debug.note.showShipModel", @"::::: showShipModel:'%@' in context: %@.", [ship name], context);
4093
4094 GLfloat cr = [ship collisionRadius];
4095 [ship setOrientation: q2];
4096 [ship setPositionX:factorX * cr y:factorY * cr z:factorZ * cr];
4097 [ship setScanClass: CLASS_NO_DRAW];
4098 [ship setDemoShip: 0.6];
4099 [ship setDemoStartTime: [UNIVERSE getTime]];
4100 if([ship pendingEscortCount] > 0) [ship setPendingEscortCount:0];
4101 [ship setAITo: @"nullAI.plist"];
4102 id subEntStatus = [shipData objectForKey:@"subentities_status"];
4103 // show missing subentities if there's a subentities_status key
4104 if (subEntStatus != nil) [ship deserializeShipSubEntitiesFrom:(NSString *)subEntStatus];
4105 [UNIVERSE addEntity: ship];
4106 // MKW - save demo ship for its rotation
4107 demoShip = [ship retain];
4108
4109 [ship setStatus: STATUS_COCKPIT_DISPLAY];
4110
4111 [ship release];
4112}
#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)

References Entity::collisionRadius, demoShip, ShipEntity::deserializeShipSubEntitiesFrom:, ENTITY_PERSONALITY_INVALID, M_SQRT1_2, ShipEntity::name, nil, OOLog, Entity::orientation, ShipEntity::pendingEscortCount, ShipEntity::setAITo:, ShipEntity::setDemoShip:, ShipEntity::setDemoStartTime:, ShipEntity::setEntityPersonalityInt:, Entity::setOrientation:, ShipEntity::setPendingEscortCount:, Entity::setPositionX:y:z:, Entity::setScanClass:, ShipEntity::setStatus:, OOShipRegistry::sharedRegistry, OOShipRegistry::shipInfoForKey:, and ShipEntity::wasAddedToUniverse.

Referenced by PlayerEntity(LoadSave)::addScenarioModel:, setGuiToStatusScreen, and PlayerEntity(Contracts)::showShipyardModel:shipData:personality:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showShipyardInfoForSelection

- (void) showShipyardInfoForSelection

Provided by category PlayerEntity(Contracts).

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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity(OOControlsPrivate)::pollGuiScreenControlsWithFKeyAlias:, PlayerEntity(OOControlsPrivate)::setGuiToMissionEndScreen, and PlayerEntity(Contracts)::setGuiToShipyardScreen:.

+ Here is the caller graph for this function:

◆ showShipyardModel:shipData:personality:

- (void) showShipyardModel: (NSString *) shipKey
shipData: (NSDictionary *) shipDict
personality: (uint16_t) personality 

Provided by category PlayerEntity(Contracts).

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

Referenced by PlayerEntity(OOLoadSavePrivate)::showCommanderShip:, and PlayerEntity(Contracts)::showShipyardInfoForSelection.

+ Here is the caller graph for this function:

◆ showTradeInInformationFooter

- (void) showTradeInInformationFooter

Provided by category PlayerEntity(Contracts).

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

Referenced by PlayerEntity(Contracts)::setGuiToShipyardScreen:, and PlayerEntity(Contracts)::showShipyardInfoForSelection.

+ Here is the caller graph for this function:

◆ SliderString

+ (static NSString *) SliderString (NSInteger) amountIn20ths
implementation

Definition at line 8865 of file PlayerEntity.m.

8866{
8867 NSString *filledSlider = [@"|||||||||||||||||||||||||" substringToIndex:amountIn20ths];
8868 NSString *emptySlider = [@"........................." substringToIndex:20 - amountIn20ths];
8869 return [NSString stringWithFormat:@"%@%@", filledSlider, emptySlider];
8870}

◆ sortCommanders

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 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 1678 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

References clearAlertFlags, dialTargetName, safeAllMissiles, selectNextMissile, specialCargo, and tidyMissilePylons.

+ Here is the call graph for this function:

◆ startAfterburnerSound

- (void) startAfterburnerSound

Provided by category PlayerEntity(Sound).

Definition at line 475 of file PlayerEntitySound.m.

476{
478 {
480 [self updateAfterburnerSound];
481 }
482}

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ startScenario

- (BOOL) startScenario

Provided by category PlayerEntity(LoadSave).

Definition at line 314 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)

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:.

+ Here is the caller graph for this function:

◆ startUpComplete

- (void) startUpComplete

Definition at line 2272 of file PlayerEntity.m.

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

References doWorldScriptEvent:inContext:withArguments:count:timeLimit:, OOJSAcquireContext(), OOJSRelinquishContext(), and startUpComplete.

Referenced by Universe::initWithGameView:, PlayerEntity(LoadSave)::loadPlayerFromFile:asNew:, Universe::reinitAndShowDemo:, and startUpComplete.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ status_string

- (NSString *) status_string

Provided by category PlayerEntity(Scripting).

Definition at line 913 of file PlayerEntityLegacyScriptEngine.m.

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

◆ stickFunctionList

- (NSArray *) stickFunctionList
implementation

Provided by category PlayerEntity(StickMapperInternal).

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

References count, makeStickGuiDict:allowable:axisfn:butfn:, makeStickGuiDictHeader:, and PlayerEntity(StickMapperInternal)::stickFunctionList.

Referenced by PlayerEntity(StickMapperInternal)::displayFunctionList:skip:, and PlayerEntity(StickMapperInternal)::stickFunctionList.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stickMapperInputHandler:view:

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

Provided by category PlayerEntity(StickMapper).

Definition at line 132 of file PlayerEntityStickMapper.m.

132 :(GuiDisplayGen *)gui
133 view:(MyOpenGLView *)gameView
134{
135 OOJoystickManager *stickHandler = [OOJoystickManager sharedStickHandler];
136
137 // Don't do anything if the user is supposed to be selecting
138 // a function - other than look for Escape.
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];
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
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];
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)

Referenced by PlayerEntity(OOControlsPrivate)::handleStickMapperScreenKeys.

+ Here is the caller graph for this function:

◆ stickProfileGraphAxisProfile:screenAt:screenSize:

- (void) stickProfileGraphAxisProfile: (GLfloat) alpha
screenAt: (Vector) screenAt
screenSize: (NSSize) screenSize 

Provided by category PlayerEntity(StickProfile).

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

Referenced by GuiDisplayGen::drawGUI:drawCursor:.

+ Here is the caller graph for this function:

◆ stickProfileInputHandler:view:

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

Provided by category PlayerEntity(StickProfile).

Definition at line 76 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

Referenced by PlayerEntity(OOControlsPrivate)::pollDemoControls:, and PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ stopAfterburnerSound

- (void) stopAfterburnerSound

Provided by category PlayerEntity(Sound).

Definition at line 485 of file PlayerEntitySound.m.

486{
487 // Do nothing, stop is detected in updateAfterburnerSound
488}

Referenced by engageAutopilotToStation:, and PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ subtract:

- (void) subtract: (NSString *) missionVariableString_value

Provided by category PlayerEntity(Scripting).

Definition at line 1847 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 1061 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 1055 of file PlayerEntityLegacyScriptEngine.m.

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

◆ suppressClangStuff

- (BOOL) suppressClangStuff
implementation

Definition at line 13548 of file PlayerEntity.m.

13549{
13550 return missionChoice &&
13553 currentPage &&
13585 n_key_ecm &&
13613 n_key_map_end &&
13663#if OO_FOV_INFLIGHT_CONTROL_ENABLED
13664 n_key_inc_field_of_view &&
13665 n_key_dec_field_of_view &&
13666#endif
13675 _sysInfoLight.x &&
13678 keyFunctions &&
13682 kbdLayouts &&
13686 _missionTitle &&
13688}
NSArray * n_key_info_next_system
NSArray * n_key_info_previous_system

References _missionAllowInterrupt, _missionScreenID, _missionTextEntry, _missionTitle, _sysInfoLight, cdrDetailArray, commanderNameString, currentPage, customActivatePressed, customEquipActivation, customModePressed, kbdLayouts, keyFunctions, missionChoice, n_key_activate_equipment, n_key_advanced_nav_array_next, n_key_advanced_nav_array_previous, n_key_autodock, n_key_autopilot, n_key_bloom_toggle, n_key_chart_highlight, n_key_comms_log, n_key_custom_view, n_key_custom_view_pan_down, n_key_custom_view_pan_left, n_key_custom_view_pan_right, n_key_custom_view_pan_up, n_key_custom_view_roll_left, n_key_custom_view_roll_right, n_key_custom_view_rotate_down, n_key_custom_view_rotate_left, n_key_custom_view_rotate_right, n_key_custom_view_rotate_up, n_key_custom_view_zoom_in, n_key_custom_view_zoom_out, n_key_cycle_next_mfd, n_key_cycle_previous_mfd, n_key_debug_bounding_boxes, n_key_debug_collision, n_key_debug_console_connect, n_key_debug_full, n_key_debug_off, n_key_debug_shaders, n_key_decrease_speed, n_key_docking_clearance_request, n_key_docking_music, n_key_dump_cargo, n_key_dump_entity_list, n_key_dump_target_state, n_key_ecm, n_key_fastactivate_equipment_a, n_key_fastactivate_equipment_b, n_key_fire_lasers, n_key_galactic_hyperspace, n_key_gui_arrow_down, n_key_gui_arrow_left, n_key_gui_arrow_right, n_key_gui_arrow_up, n_key_gui_chart_screens, n_key_gui_market, n_key_gui_page_down, n_key_gui_page_up, n_key_gui_screen_equipship, n_key_gui_screen_interfaces, n_key_gui_screen_options, n_key_gui_screen_status, n_key_gui_select, n_key_gui_system_data, n_key_hud_toggle, n_key_hyperspace, n_key_ident_system, n_key_increase_speed, n_key_info_next_system, n_key_info_previous_system, n_key_inject_fuel, n_key_jumpdrive, n_key_launch_escapepod, n_key_launch_missile, n_key_launch_ship, n_key_map_end, n_key_map_home, n_key_map_info, n_key_map_next_system, n_key_map_previous_system, n_key_map_zoom_in, n_key_map_zoom_out, n_key_market_buy_max, n_key_market_buy_one, n_key_market_filter_cycle, n_key_market_sell_max, n_key_market_sell_one, n_key_market_sorter_cycle, n_key_mode_equipment, n_key_mouse_control_roll, n_key_mouse_control_yaw, n_key_next_compass_mode, n_key_next_missile, n_key_next_target, n_key_oxzmanager_extract, n_key_oxzmanager_setfilter, n_key_oxzmanager_showinfo, n_key_pausebutton, n_key_pitch_back, n_key_pitch_forward, n_key_prev_compass_mode, n_key_previous_target, n_key_prime_next_equipment, n_key_prime_previous_equipment, n_key_roll_left, n_key_roll_right, n_key_rotate_cargo, n_key_scanner_unzoom, n_key_scanner_zoom, n_key_show_fps, n_key_snapshot, n_key_switch_next_mfd, n_key_switch_previous_mfd, n_key_system_end, n_key_system_home, n_key_system_next_system, n_key_system_previous_system, n_key_target_incoming_missile, n_key_target_missile, n_key_untarget_missile, n_key_view_aft, n_key_view_forward, n_key_view_port, n_key_view_starboard, n_key_weapons_online_toggle, n_key_yaw_left, n_key_yaw_right, selFunctionIdx, showingLongRangeChart, stickFunctions, and suppressClangStuff.

Referenced by suppressClangStuff.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ suppressTargetLost

- (void) suppressTargetLost

Reimplemented from ShipEntity.

References clearTargetMemory, setScoopsActive, suppressTargetLost, and targetMemory.

+ Here is the call graph for this function:

◆ switchHudTo:

- (BOOL) switchHudTo: (NSString *) hudFileName

Definition at line 4542 of file PlayerEntity.m.

4542 :(NSString *)hudFileName
4543{
4544 NSDictionary *hudDict = nil;
4545 BOOL wasHidden = NO;
4546 BOOL wasCompassActive = YES;
4547 double scannerZoom = 1.0;
4548 NSUInteger lastMFD = 0;
4549 NSUInteger i;
4550
4551 if (!hudFileName) return NO;
4552
4553 // is the HUD in the process of being rendered? If yes, set it to defer state and abort the switching now
4554 if (hud != nil && [hud isUpdating])
4555 {
4556 [hud setDeferredHudName:hudFileName];
4557 return NO;
4558 }
4559
4560 hudDict = [ResourceManager dictionaryFromFilesNamed:hudFileName inFolder:@"Config" andMerge:YES];
4561 // hud defined, but buggy?
4562 if (hudDict == nil)
4563 {
4564 OOLog(@"PlayerEntity.switchHudTo.failed", @"HUD dictionary file %@ to switch to not found or invalid.", hudFileName);
4565 return NO;
4566 }
4567
4568 if (hud != nil)
4569 {
4570 // remember these values
4571 wasHidden = [hud isHidden];
4572 wasCompassActive = [hud isCompassActive];
4573 scannerZoom = [hud scannerZoom];
4574 lastMFD = activeMFD;
4575 }
4576
4577 // buggy oxp could override hud.plist with a non-dictionary.
4578 if (hudDict != nil)
4579 {
4580 [hud setHidden:YES]; // hide the hud while rebuilding it.
4581 DESTROY(hud);
4582 hud = [[HeadUpDisplay alloc] initWithDictionary:hudDict inFile:hudFileName];
4583 [hud resetGuis:hudDict];
4584 // reset zoom & hidden to what they were before the swich
4585 [hud setScannerZoom:scannerZoom];
4586 [hud setCompassActive:wasCompassActive];
4587 [hud setHidden:wasHidden];
4588 activeMFD = 0;
4589 NSArray *savedMFDs = [NSArray arrayWithArray:multiFunctionDisplaySettings];
4590 [multiFunctionDisplaySettings removeAllObjects];
4591 for (i = 0; i < [hud mfdCount] ; i++)
4592 {
4593 if ([savedMFDs count] > i)
4594 {
4595 [multiFunctionDisplaySettings addObject:[savedMFDs objectAtIndex:i]];
4596 }
4597 else
4598 {
4599 [multiFunctionDisplaySettings addObject:[NSNull null]];
4600 }
4601 }
4602 if (lastMFD < [hud mfdCount]) activeMFD = lastMFD;
4603 }
4604
4605 return YES;
4606}
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)

References activeMFD, count, DESTROY, ResourceManager::dictionaryFromFilesNamed:inFolder:andMerge:, hud, HeadUpDisplay::isCompassActive, HeadUpDisplay::isHidden, HeadUpDisplay::mfdCount, nil, OOLog, HeadUpDisplay::resetGuis:, HeadUpDisplay::scannerZoom, HeadUpDisplay::setCompassActive:, HeadUpDisplay::setDeferredHudName:, HeadUpDisplay::setHidden:, and HeadUpDisplay::setScannerZoom:.

Referenced by Universe::drawUniverse, PlayerShipSetProperty(), resetHud, and setUpAndConfirmOK:saveGame:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ switchToMainView

- (void) switchToMainView

Provided by category PlayerEntity(Controls).

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

Referenced by launchEscapeCapsule, and PlayerEntity(OOControlsPrivate)::switchToThisView:fromView:andProcessWeaponFacing:justNotify:.

+ Here is the caller graph for this function:

◆ switchToThisView:

- (void) switchToThisView: (OOViewID) viewDirection
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 5447 of file PlayerEntityControls.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleMissionCallback, PlayerEntity(OOControlsPrivate)::pollFlightControls:, and PlayerEntity(OOControlsPrivate)::pollViewControls.

+ Here is the caller graph for this function:

◆ switchToThisView:andProcessWeaponFacing:

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

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 5453 of file PlayerEntityControls.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollCustomViewControls, and PlayerEntity(OOControlsPrivate)::switchToThisView:.

+ Here is the caller graph for this function:

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

Referenced by PlayerEntity(Controls)::noteSwitchToView:fromView:, and PlayerEntity(OOControlsPrivate)::switchToThisView:andProcessWeaponFacing:.

+ Here is the caller graph for this function:

◆ systemEconomy_number

- (NSNumber *) systemEconomy_number

Provided by category PlayerEntity(Scripting).

Definition at line 1127 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by PlayerEntity(Scripting)::systemEconomy_string.

+ Here is the caller graph for this function:

◆ systemEconomy_string

- (NSString *) systemEconomy_string

Provided by category PlayerEntity(Scripting).

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

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

Referenced by PlayerEntity(Scripting)::systemGovernment_string.

+ Here is the caller graph for this function:

◆ systemGovernment_string

- (NSString *) systemGovernment_string

Provided by category PlayerEntity(Scripting).

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

685{
686 return system_id;
687}

References system_id, and systemID.

Referenced by Universe::carryPlayerOn:inWormhole:, custom_chart_zoom, Universe(OOPrivate)::setUpInitialUniverse, and systemID.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ systemPopulation_number

- (NSNumber *) systemPopulation_number

Provided by category PlayerEntity(Scripting).

Definition at line 1141 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 1148 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 251 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)

Referenced by PlayerEntity(Scripting)::pseudoFixedD100_number.

+ Here is the caller graph for this function:

◆ systemPseudoRandom256

- (unsigned) systemPseudoRandom256

Provided by category PlayerEntity(ScriptMethods).

Definition at line 258 of file PlayerEntityScriptMethods.m.

259{
260 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
261 return gen_rnd_number();
262}

Referenced by PlayerEntity(Scripting)::pseudoFixedD256_number.

+ Here is the caller graph for this function:

◆ systemPseudoRandomFloat

- (double) systemPseudoRandomFloat

Provided by category PlayerEntity(ScriptMethods).

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

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

Referenced by PlayerEntity(Scripting)::dockedTechLevel_number.

+ Here is the caller graph for this function:

◆ takeEnergyDamage:from:becauseOf:weaponIdentifier:

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

Reimplemented from ShipEntity.

Definition at line 6357 of file PlayerEntity.m.

6357 :(double)amount from:(Entity *)ent becauseOf:(Entity *)other weaponIdentifier:(NSString *)weaponIdentifier
6358{
6359 HPVector rel_pos;
6360 OOScalar d_forward, d_right, d_up;
6361 BOOL internal_damage = NO; // base chance
6362
6363 OOLog(@"player.ship.damage", @"Player took damage from %@ becauseOf %@", ent, other);
6364
6365 if ([self status] == STATUS_DEAD) return;
6366 if ([self status] == STATUS_ESCAPE_SEQUENCE) return; // if the player has ejected, don't deal more damage
6367 if (amount == 0.0) return;
6368
6369 BOOL cascadeWeapon = [ent isCascadeWeapon];
6370 BOOL cascading = NO;
6371 if (cascadeWeapon)
6372 {
6373 cascading = [self cascadeIfAppropriateWithDamageAmount:amount cascadeOwner:[ent owner]];
6374 }
6375
6376 // make sure ent (& its position) is the attacking _ship_/missile !
6377 if (ent && [ent isSubEntity]) ent = [ent owner];
6378
6379 [[ent retain] autorelease];
6380 [[other retain] autorelease];
6381
6382 rel_pos = (ent != nil) ? [ent position] : kZeroHPVector;
6383 rel_pos = HPvector_subtract(rel_pos, position);
6384
6385 [self doScriptEvent:OOJSID("shipBeingAttacked") withArgument:ent];
6386 if ([ent isShip]) [(ShipEntity *)ent doScriptEvent:OOJSID("shipAttackedOther") withArgument:self];
6387
6388 d_forward = dot_product(HPVectorToVector(rel_pos), v_forward);
6389 d_right = dot_product(HPVectorToVector(rel_pos), v_right);
6390 d_up = dot_product(HPVectorToVector(rel_pos), v_up);
6391 Vector relative = make_vector(d_right,d_up,d_forward);
6392
6393 [self playShieldHit:relative weaponIdentifier:weaponIdentifier];
6394
6395 // firing on an innocent ship is an offence
6396 if ([other isShip])
6397 {
6398 [self broadcastHitByLaserFrom:(ShipEntity*) other];
6399 }
6400
6401 if (d_forward >= 0)
6402 {
6403 forward_shield -= amount;
6404 if (forward_shield < 0.0)
6405 {
6406 amount = -forward_shield;
6407 forward_shield = 0.0f;
6408 }
6409 else
6410 {
6411 amount = 0.0;
6412 }
6413 }
6414 else
6415 {
6416 aft_shield -= amount;
6417 if (aft_shield < 0.0)
6418 {
6419 amount = -aft_shield;
6420 aft_shield = 0.0f;
6421 }
6422 else
6423 {
6424 amount = 0.0;
6425 }
6426 }
6427
6428 OOShipDamageType damageType = cascadeWeapon ? kOODamageTypeCascadeWeapon : kOODamageTypeEnergy;
6429
6430 if (amount > 0.0)
6431 {
6432 energy -= amount;
6433 [self playDirectHit:relative weaponIdentifier:weaponIdentifier];
6435 {
6436 /* Heat increase from energy impacts will never directly cause
6437 * overheating - too easy for missile hits to cause an uncredited
6438 * death by overheating against NPCs, so same rules for player */
6441 {
6443 }
6444 }
6445 }
6446 [self noteTakingDamage:amount from:other type:damageType];
6447 if (cascading) energy = 0.0; // explicitly set energy to zero when cascading, in case an oxp raised the energy in noteTakingDamage.
6448
6449 if (energy <= 0.0) //use normal ship temperature calculations for heat damage
6450 {
6451 if ([other isShip])
6452 {
6454 }
6455
6456 [self getDestroyedBy:other damageType:damageType];
6457 }
6458 else
6459 {
6460 while (amount > 0.0)
6461 {
6462 internal_damage = ((ranrot_rand() & PLAYER_INTERNAL_DAMAGE_FACTOR) < amount); // base chance of damage to systems
6463 if (internal_damage)
6464 {
6465 [self takeInternalDamage];
6466 }
6467 amount -= (PLAYER_INTERNAL_DAMAGE_FACTOR + 1);
6468 }
6469 }
6470}
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
void noteTargetDestroyed:(ShipEntity *target)
void doScriptEvent:withArgument:(jsid message,[withArgument] id argument)

References aft_shield, ShipEntity::broadcastHitByLaserFrom:, ShipEntity::cascadeIfAppropriateWithDamageAmount:cascadeOwner:, ShipEntity::doScriptEvent:withArgument:, Entity::energy, forward_shield, getDestroyedBy:damageType:, ShipEntity::heatInsulation, Entity::isCascadeWeapon, Entity::isShip, Entity::isSubEntity, kZeroHPVector, nil, ShipEntity::noteTakingDamage:from:type:, ShipEntity::noteTargetDestroyed:, OOLog, Entity::owner, playDirectHit:weaponIdentifier:, PLAYER_INTERNAL_DAMAGE_FACTOR, playShieldHit:weaponIdentifier:, Entity::position, ranrot_rand, SHIP_ENERGY_DAMAGE_TO_HEAT_FACTOR, SHIP_MAX_CABIN_TEMP, ShipEntity::ship_temperature, Entity::status, takeInternalDamage, ShipEntity::v_forward, ShipEntity::v_right, and ShipEntity::v_up.

+ Here is the call graph for this function:

◆ takeHeatDamage:

- (void) takeHeatDamage: (double) amount
implementation

Reimplemented from ShipEntity.

Definition at line 6539 of file PlayerEntity.m.

6539 :(double) amount
6540{
6541 if ([self status] == STATUS_DEAD || amount < 0) return;
6542
6543 // hit the shields first!
6544 float fwd_amount = (float)(0.5 * amount);
6545 float aft_amount = (float)(0.5 * amount);
6546
6547 forward_shield -= fwd_amount;
6548 if (forward_shield < 0.0)
6549 {
6550 fwd_amount = -forward_shield;
6551 forward_shield = 0.0f;
6552 }
6553 else
6554 {
6555 fwd_amount = 0.0f;
6556 }
6557
6558 aft_shield -= aft_amount;
6559 if (aft_shield < 0.0)
6560 {
6561 aft_amount = -aft_shield;
6562 aft_shield = 0.0f;
6563 }
6564 else
6565 {
6566 aft_amount = 0.0f;
6567 }
6568
6569 double residual_amount = fwd_amount + aft_amount;
6570
6571 [super takeHeatDamage:residual_amount];
6572}

References aft_shield, forward_shield, Entity::status, and ShipEntity::takeHeatDamage:.

Referenced by doBookkeeping:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ takeInternalDamage

- (BOOL) takeInternalDamage

Definition at line 6924 of file PlayerEntity.m.

6925{
6926 unsigned n_cargo = [self maxAvailableCargoSpace];
6927 unsigned n_mass = [self mass] / 10000;
6928 unsigned n_considered = (n_cargo + n_mass) * ship_trade_in_factor / 100; // a lower value of n_considered means more vulnerable to damage.
6929 unsigned damage_to = n_considered ? (ranrot_rand() % n_considered) : 0; // n_considered can be 0 for small ships.
6930 BOOL result = NO;
6931 // cargo damage
6932 if (damage_to < [cargo count])
6933 {
6934 ShipEntity* pod = (ShipEntity*)[cargo objectAtIndex:damage_to];
6935 NSString* cargo_desc = [UNIVERSE displayNameForCommodity:[pod commodityType]];
6936 if (!cargo_desc)
6937 return NO;
6938 [UNIVERSE clearPreviousMessage];
6939 [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-destroyed"), cargo_desc] forCount:4.5];
6940 [cargo removeObject:pod];
6941 return YES;
6942 }
6943 else
6944 {
6945 damage_to = n_considered - (damage_to + 1); // reverse the die-roll
6946 }
6947 // equipment damage
6948 NSEnumerator *eqEnum = [self equipmentEnumerator];
6949 OOEquipmentType *eqType = nil;
6950 NSString *system_key;
6951 unsigned damageableCounter = 0;
6952 GLfloat damageableOdds = 0.0;
6953 while ((system_key = [eqEnum nextObject]) != nil)
6954 {
6955 eqType = [OOEquipmentType equipmentTypeWithIdentifier:system_key];
6956 if ([eqType canBeDamaged])
6957 {
6958 damageableCounter++;
6959 damageableOdds += [eqType damageProbability];
6960 }
6961 }
6962
6963 if (damage_to < damageableCounter)
6964 {
6965 GLfloat target = randf() * damageableOdds;
6966 GLfloat accumulator = 0.0;
6967 eqEnum = [self equipmentEnumerator];
6968 while ((system_key = [eqEnum nextObject]) != nil)
6969 {
6970 eqType = [OOEquipmentType equipmentTypeWithIdentifier:system_key];
6971 accumulator += [eqType damageProbability];
6972 if (accumulator > target)
6973 {
6974 [system_key retain];
6975 break;
6976 }
6977 }
6978 if (system_key == nil)
6979 {
6980 [system_key release];
6981 return NO;
6982 }
6983
6984 NSString *system_name = [eqType name];
6985 if (![eqType canBeDamaged] || system_name == nil)
6986 {
6987 [system_key release];
6988 return NO;
6989 }
6990
6991 // set the following so removeEquipment works on the right entity
6992 [self setScriptTarget:self];
6993 [UNIVERSE clearPreviousMessage];
6994 [self removeEquipmentItem:system_key];
6995
6996 NSString *damagedKey = [NSString stringWithFormat:@"%@_DAMAGED", system_key];
6997 [self addEquipmentItem:damagedKey withValidation: NO inContext:@"damage"]; // for possible future repair.
6998 [self doScriptEvent:OOJSID("equipmentDamaged") withArgument:system_key];
6999
7000 if (![self hasEquipmentItem:system_name] && [self hasEquipmentItem:damagedKey])
7001 {
7002 /*
7003 Display "foo damaged" message only if no script has
7004 repaired or removed the equipment item. (If a script does
7005 either of those and wants a message, it can write it
7006 itself.)
7007 */
7008 [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-damaged"), system_name] forCount:4.5];
7009 }
7010
7011 /* There used to be a check for docking computers here, but
7012 * that didn't cover other ways they might fail in flight, so
7013 * it has been moved to the removeEquipment method. */
7014 [system_key release];
7015 return YES;
7016 }
7017 //cosmetic damage
7018 if (((damage_to & 7) == 7)&&(ship_trade_in_factor > 75))
7019 {
7021 result = YES;
7022 }
7023 return result;
7024}

References addEquipmentItem:withValidation:inContext:, ShipEntity::cargo, ShipEntity::commodityType, count, OOEquipmentType::damageProbability, ShipEntity::doScriptEvent:withArgument:, ShipEntity::equipmentEnumerator, OOEquipmentType::equipmentTypeWithIdentifier:, Entity::mass, ShipEntity::maxAvailableCargoSpace, OOEquipmentType::name, nil, randf(), ranrot_rand, removeEquipmentItem:, setScriptTarget:, ship_trade_in_factor, and takeInternalDamage.

Referenced by alertCondition, enterWitchspace, PlayerShipTakeInternalDamage(), takeEnergyDamage:from:becauseOf:weaponIdentifier:, takeInternalDamage, and takeScrapeDamage:from:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ takeScrapeDamage:from:

- (void) takeScrapeDamage: (double) amount
from: (Entity *) ent 
implementation

Reimplemented from ShipEntity.

Definition at line 6473 of file PlayerEntity.m.

6473 :(double) amount from:(Entity *) ent
6474{
6475 HPVector rel_pos;
6476 OOScalar d_forward, d_right, d_up;
6477 BOOL internal_damage = NO; // base chance
6478
6479 if ([self status] == STATUS_DEAD) return;
6480
6481 if (amount < 0)
6482 {
6483 OOLog(@"player.ship.damage", @"Player took negative scrape damage %.3f so we made it positive", amount);
6484 amount = -amount;
6485 }
6486 OOLog(@"player.ship.damage", @"Player took %.3f scrape damage from %@", amount, ent);
6487
6488 [[ent retain] autorelease];
6489 rel_pos = ent ? [ent position] : kZeroHPVector;
6490 rel_pos = HPvector_subtract(rel_pos, position);
6491 // rel_pos is now small
6492 d_forward = dot_product(HPVectorToVector(rel_pos), v_forward);
6493 d_right = dot_product(HPVectorToVector(rel_pos), v_right);
6494 d_up = dot_product(HPVectorToVector(rel_pos), v_up);
6495 Vector relative = make_vector(d_right,d_up,d_forward);
6496
6497 [self playScrapeDamage:relative];
6498 if (d_forward >= 0)
6499 {
6500 forward_shield -= amount;
6501 if (forward_shield < 0.0)
6502 {
6503 amount = -forward_shield;
6504 forward_shield = 0.0f;
6505 }
6506 else
6507 {
6508 amount = 0.0;
6509 }
6510 }
6511 else
6512 {
6513 aft_shield -= amount;
6514 if (aft_shield < 0.0)
6515 {
6516 amount = -aft_shield;
6517 aft_shield = 0.0f;
6518 }
6519 else
6520 {
6521 amount = 0.0;
6522 }
6523 }
6524
6525 [super takeScrapeDamage:amount from:ent];
6526
6527 while (amount > 0.0)
6528 {
6529 internal_damage = ((ranrot_rand() & PLAYER_INTERNAL_DAMAGE_FACTOR) < amount); // base chance of damage to systems
6530 if (internal_damage)
6531 {
6532 [self takeInternalDamage];
6533 }
6534 amount -= (PLAYER_INTERNAL_DAMAGE_FACTOR + 1);
6535 }
6536}

References aft_shield, forward_shield, kZeroHPVector, OOLog, PLAYER_INTERNAL_DAMAGE_FACTOR, playScrapeDamage:, Entity::position, ranrot_rand, Entity::status, takeInternalDamage, ShipEntity::takeScrapeDamage:from:, ShipEntity::v_forward, ShipEntity::v_right, and ShipEntity::v_up.

+ Here is the call graph for this function:

◆ targetInfoSystem

- (void) targetInfoSystem

Definition at line 867 of file PlayerEntity.m.

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

References setInfoSystemID:moveChart:, and targetInfoSystem.

Referenced by custom_chart_zoom, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and targetInfoSystem.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ targetMemory

- (NSMutableArray *) targetMemory

Definition at line 12359 of file PlayerEntity.m.

12360{
12361 return target_memory;
12362}

References target_memory, and targetMemory.

Referenced by HeadUpDisplay(Private)::drawSecondaryTargetReticle:, suppressTargetLost, and targetMemory.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ targetNearestHostile

- (void) targetNearestHostile

Provided by category PlayerEntity(Scripting).

Definition at line 2928 of file PlayerEntityLegacyScriptEngine.m.

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

◆ targetNearestIncomingMissile

- (void) targetNearestIncomingMissile

Provided by category PlayerEntity(Scripting).

Definition at line 2941 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

+ Here is the caller graph for this function:

◆ targetNewSystem:

- (void) targetNewSystem: (int) direction

Provided by category PlayerEntity(Controls).

Definition at line 827 of file PlayerEntityControls.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:.

+ Here is the caller graph for this function:

◆ targetNewSystem:whileTyping:

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

Provided by category PlayerEntity(Controls).

Definition at line 804 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
811 if (!whileTyping)
812 {
813 [self clearPlanetSearchString];
814 }
815 cursor_moving = YES;
816}

Referenced by PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, and PlayerEntity(Controls)::targetNewSystem:.

+ Here is the caller graph for this function:

◆ targetSystemID

- (OOSystemID) targetSystemID

Definition at line 711 of file PlayerEntity.m.

712{
713 return target_system_id;
714}

References target_system_id, and targetSystemID.

Referenced by custom_chart_zoom, Universe::speakWithSubstitutions:, and targetSystemID.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testForEquipment:

- (void) testForEquipment: (NSString *) equipString

Provided by category PlayerEntity(Scripting).

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

5710{
5711 // Make sure there's no gaps between missiles, synchronise missile_entity & missile_list.
5712 int i, pylon = 0;
5713 OOLog(@"missile.tidying.debug",@"Tidying fitted %d of possible %d missiles",missiles,PLAYER_MAX_MISSILES);
5714 for(i = 0; i < PLAYER_MAX_MISSILES; i++)
5715 {
5716 OOLog(@"missile.tidying.debug",@"%d %@ %@",i,missile_entity[i],missile_list[i]);
5717 if(missile_entity[i] != nil)
5718 {
5719 missile_entity[pylon] = missile_entity[i];
5720 missile_list[pylon] = [OOEquipmentType equipmentTypeWithIdentifier:[missile_entity[i] primaryRole]];
5721 pylon++;
5722 }
5723 }
5724
5725 // Now clean up the remainder of the pylons.
5726 for(i = pylon; i < PLAYER_MAX_MISSILES; i++)
5727 {
5728 missile_entity[i] = nil;
5729 // not strictly needed, but helps clear things up
5730 missile_list[i] = nil;
5731 }
5732}

References OOEquipmentType::equipmentTypeWithIdentifier:, missile_entity, ShipEntity::missile_list, ShipEntity::missiles, nil, OOLog, PLAYER_MAX_MISSILES, ShipEntity::primaryRole, and tidyMissilePylons.

Referenced by missilesList, PlayerEntity(Contracts)::newShipCommonSetup:yardInfo:baseInfo:, removeFromPylon:, specialCargo, tidyMissilePylons, and PlayerEntity(OOPrivate)::tryBuyingItem:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tradeInFactor

- (int) tradeInFactor

Definition at line 11922 of file PlayerEntity.m.

11923{
11924 return ship_trade_in_factor;
11925}

References int(), ship_trade_in_factor, and tradeInFactor.

Referenced by ProxyPlayerEntity::copyValuesFromPlayer:, isSpeechOn, PlayerShipSetProperty(), and tradeInFactor.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tradeInValue

- (OOCreditsQuantity) tradeInValue
implementation

Provided by category PlayerEntity(ContractsPrivate).

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

References commanderDataDictionary, cunningFee(), missingSubEntitiesAdjustment, and PlayerEntity(ContractsPrivate)::tradeInValue.

Referenced by PlayerEntity(Contracts)::buySelectedShip, PlayerEntity(Contracts)::showTradeInInformationFooter, and PlayerEntity(ContractsPrivate)::tradeInValue.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ trumbleAppetiteAccumulator

- (float) trumbleAppetiteAccumulator

Definition at line 12213 of file PlayerEntity.m.

12214{
12216}

References _trumbleAppetiteAccumulator, and trumbleAppetiteAccumulator.

Referenced by trumbleAppetiteAccumulator, trumbleCount, and OOTrumble::updateTrumble:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ trumbleArray

- (OOTrumble **) trumbleArray

Definition at line 12068 of file PlayerEntity.m.

12069{
12070 return trumble;
12071}

References trumble, and trumbleArray.

Referenced by isSpeechOn, trumbleArray, trumbleValue, and PlayerEntity(OOPrivate)::updateTrumbles:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ trumbleCount

- (NSUInteger) trumbleCount

References trumbleAppetiteAccumulator, trumbleCount, and trumbleValue.

+ Here is the call graph for this function:

◆ trumbleValue

- (id) trumbleValue

Definition at line 12080 of file PlayerEntity.m.

12081{
12082 NSString *namekey = [NSString stringWithFormat:@"%@-humbletrash", [self commanderName]];
12083 int trumbleHash;
12084
12086 [self mungChecksumWithNSString:[self commanderName]];
12089 trumbleHash = munge_checksum(trumbleCount);
12090
12091 [[NSUserDefaults standardUserDefaults] setInteger:trumbleHash forKey:namekey];
12092
12093 int i;
12094 NSMutableArray *trumbleArray = [NSMutableArray arrayWithCapacity:PLAYER_MAX_TRUMBLES];
12095 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12096 {
12097 [trumbleArray addObject:[trumble[i] dictionary]];
12098 }
12099
12100 return [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInteger:trumbleCount], [NSNumber numberWithInt:trumbleHash], trumbleArray, nil];
12101}
OOTrumble ** trumbleArray()

References clear_checksum(), commanderName, credits, OOTrumble::dictionary, mungChecksumWithNSString:, munge_checksum(), PLAYER_MAX_TRUMBLES, ship_kills, trumbleArray, trumbleCount, and trumbleValue.

Referenced by commanderDataDictionary, setTrumbleValueFrom:, trumbleCount, and trumbleValue.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tryBuyingCommodity:all:

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

Definition at line 11369 of file PlayerEntity.m.

11369 :(OOCommodityType)index all:(BOOL)all
11370{
11371 if ([index isEqualToString:@"<<<"] || [index isEqualToString:@">>>"])
11372 {
11373 ++marketOffset;
11374 return NO;
11375 }
11376
11377 if (![self isDocked]) return NO; // can't buy if not docked.
11378
11379 OOCommodityMarket *localMarket = [self localMarket];
11380 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:index];
11381 OOMassUnit unit = [localMarket massUnitForGood:index];
11382
11383 if (specialCargo != nil && unit == UNITS_TONS)
11384 {
11385 return NO; // can't buy tons of stuff when carrying a specialCargo
11386 }
11387 int manifest_quantity = [shipCommodityData quantityForGood:index];
11388 int market_quantity = [localMarket quantityForGood:index];
11389
11390 int purchase = 1;
11391 if (all)
11392 {
11393 // if cargo contracts, put a break point on the contract volume
11394 int contracted = [self contractedVolumeForGood:index];
11395 if (manifest_quantity >= contracted)
11396 {
11397 purchase = [localMarket capacityForGood:index];
11398 }
11399 else
11400 {
11401 purchase = contracted-manifest_quantity;
11402 }
11403 }
11404 if (purchase > market_quantity)
11405 {
11406 purchase = market_quantity; // limit to what's available
11407 }
11408 if (purchase * pricePerUnit > credits)
11409 {
11410 purchase = floor (credits / pricePerUnit); // limit to what's affordable
11411 }
11412 // TODO - fix brokenness here...
11413 if (unit == UNITS_TONS && purchase + current_cargo > [self maxAvailableCargoSpace])
11414 {
11415 purchase = [self availableCargoSpace]; // limit to available cargo space
11416 }
11417 else
11418 {
11420 {
11421 // other cases are fine so long as buying is limited to <1000kg / <1000000g
11422 // but if this case is true, we need to see if there is more space in
11423 // the manifest (safe) or an already-accounted-for pod
11424 if (unit == UNITS_KILOGRAMS)
11425 {
11426 if (manifest_quantity % KILOGRAMS_PER_POD <= MAX_KILOGRAMS_IN_SAFE && (manifest_quantity + purchase) % KILOGRAMS_PER_POD > MAX_KILOGRAMS_IN_SAFE)
11427 {
11428 // going from < n500 to >= n500 would increase pods needed by 1
11429 purchase = MAX_KILOGRAMS_IN_SAFE - manifest_quantity; // max possible
11430 }
11431 }
11432 else // UNITS_GRAMS
11433 {
11434 if (manifest_quantity % GRAMS_PER_POD <= MAX_GRAMS_IN_SAFE && (manifest_quantity + purchase) % GRAMS_PER_POD > MAX_GRAMS_IN_SAFE)
11435 {
11436 // going from < n500000 to >= n500000 would increase pods needed by 1
11437 purchase = MAX_GRAMS_IN_SAFE - manifest_quantity; // max possible
11438 }
11439 }
11440 }
11441 }
11442 if (purchase <= 0)
11443 {
11444 return NO; // stop if that results in nothing to be bought
11445 }
11446
11447 [localMarket removeQuantity:purchase forGood:index];
11448 [shipCommodityData addQuantity:purchase forGood:index];
11449 credits -= pricePerUnit * purchase;
11450
11451 [self calculateCurrentCargo];
11452
11453 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11454
11455 [self doScriptEvent:OOJSID("playerBoughtCargo") withArguments:[NSArray arrayWithObjects:index, [NSNumber numberWithInt:purchase], [NSNumber numberWithUnsignedLongLong:pricePerUnit], nil]];
11456 if ([localMarket exportLegalityForGood:index] > 0)
11457 {
11458 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-illegal"];
11459 }
11460 else
11461 {
11462 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-legal"];
11463 }
11464
11465 return YES;
11466}
BOOL removeQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)
OOCargoQuantity capacityForGood:(OOCommodityType good)

References OOCommodityMarket::addQuantity:forGood:, ShipEntity::availableCargoSpace, calculateCurrentCargo, OOCommodityMarket::capacityForGood:, contractedVolumeForGood:, credits, current_cargo, ShipEntity::doScriptEvent:withArguments:, GRAMS_PER_POD, isDocked, KILOGRAMS_PER_POD, localMarket, marketOffset, OOCommodityMarket::massUnitForGood:, MAX_GRAMS_IN_SAFE, MAX_KILOGRAMS_IN_SAFE, ShipEntity::maxAvailableCargoSpace, nil, OOCommodityMarket::priceForGood:, OOCommodityMarket::quantityForGood:, OOCommodityMarket::removeQuantity:forGood:, specialCargo, UNITS_KILOGRAMS, UNITS_TONS, and UNIVERSE.

Referenced by PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tryBuyingItem:

- (BOOL) tryBuyingItem: (NSString *) eqKey
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 10344 of file PlayerEntity.m.

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

References addEquipmentItem:withValidation:inContext:, adjustPriceByScriptForEqKey:withCurrent:, changePassengerBerths:, ShipEntity::clearSubEntities, OOEquipmentType::damagedIdentifier, dockedStation, ShipEntity::doScriptEvent:withArgument:, doTradeIn:forPriceFactor:, ENERGY_UNIT_NAVAL, ENERGY_UNIT_NAVAL_DAMAGED, ENERGY_UNIT_NONE, ENERGY_UNIT_NORMAL, ENERGY_UNIT_NORMAL_DAMAGED, StationEntity::equipmentPriceFactor, OOEquipmentType::equipmentTypeWithIdentifier:, StationEntity::equivalentTechLevel, ShipEntity::fuel, ShipEntity::fuelCapacity, kOOLogBuyMountedFailed, kOOLogBuyMountedOK, mountMissile:, nil, OOLog, OOWeaponTypeFromEquipmentIdentifierStrict(), PASSENGER_BERTH_SPACE, OOEquipmentType::price, removeEquipmentItem:, removeMissiles, renovationCosts, safeAllMissiles, setActiveMissile:, setGuiToEquipShipScreen:selectingFacingFor:, ShipEntity::setUpSubEntities, tidyMissilePylons, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_NONE, WEAPON_FACING_PORT, and WEAPON_FACING_STARBOARD.

+ Here is the call graph for this function:

◆ trySellingCommodity:all:

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

Definition at line 11469 of file PlayerEntity.m.

11469 :(OOCommodityType)index all:(BOOL)all
11470{
11471 if ([index isEqualToString:@"<<<"] || [index isEqualToString:@">>>"])
11472 {
11473 --marketOffset;
11474 return NO;
11475 }
11476
11477 if (![self isDocked]) return NO; // can't sell if not docked.
11478
11479 OOCommodityMarket *localMarket = [self localMarket];
11480 int available_units = [shipCommodityData quantityForGood:index];
11481 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:index];
11482
11483 if (available_units == 0) return NO;
11484
11485 int market_quantity = [localMarket quantityForGood:index];
11486
11487 int capacity = [localMarket capacityForGood:index];
11488 int sell = 1;
11489 if (all)
11490 {
11491 // if cargo contracts, put a break point on the contract volume
11492 int contracted = [self contractedVolumeForGood:index];
11493 if (available_units <= contracted)
11494 {
11495 sell = capacity;
11496 }
11497 else
11498 {
11499 sell = available_units-contracted;
11500 }
11501 }
11502
11503 if (sell > available_units)
11504 sell = available_units; // limit to what's in the hold
11505 if (sell + market_quantity > capacity)
11506 sell = capacity - market_quantity; // avoid flooding the market
11507 if (sell <= 0)
11508 return NO; // stop if that results in nothing to be sold
11509
11510 [localMarket addQuantity:sell forGood:index];
11511 [shipCommodityData removeQuantity:sell forGood:index];
11512 credits += pricePerUnit * sell;
11513
11514 [self calculateCurrentCargo];
11515
11516 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11517
11518 [self doScriptEvent:OOJSID("playerSoldCargo") withArguments:[NSArray arrayWithObjects:index, [NSNumber numberWithInt:sell], [NSNumber numberWithUnsignedLongLong: pricePerUnit], nil]];
11519
11520 return YES;
11521}
BOOL addQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)

References OOCommodityMarket::addQuantity:forGood:, calculateCurrentCargo, OOCommodityMarket::capacityForGood:, contractedVolumeForGood:, credits, ShipEntity::doScriptEvent:withArguments:, isDocked, localMarket, marketOffset, OOCommodityMarket::priceForGood:, OOCommodityMarket::quantityForGood:, OOCommodityMarket::removeQuantity:forGood:, and UNIVERSE.

Referenced by PlayerEntity(Contracts)::buySelectedShip, and PlayerEntity(OOControlsPrivate)::pollMarketScreenControls.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unloadAllCargoPodsForType:toManifest:

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

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

References OOCommodityMarket::addQuantity:forGood:, ShipEntity::commodityAmount, ShipEntity::commodityType, nil, and OOLog.

Referenced by unloadCargoPods.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unloadCargoPods

- (void) unloadCargoPods

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

References calculateCurrentCargo, ShipEntity::cargo, count, isDocked, nil, OOLog, shipCommodityData, unloadAllCargoPodsForType:toManifest:, and unloadCargoPods.

Referenced by docked, and unloadCargoPods.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unloadCargoPodsForType:amount:

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

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

References ShipEntity::commodityAmount, ShipEntity::commodityType, nil, OOLog, OOCommodityMarket::removeQuantity:forGood:, and ShipEntity::setCommodity:andAmount:.

Referenced by setCargoQuantityForType:amount:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unsetKeySetting:

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

Provided by category PlayerEntity(KeyMapperInternal).

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

References getCustomEquipIndex:, getCustomEquipKeyDefType:, and initKeyConfigSettings.

Referenced by PlayerEntity(KeyMapper)::keyMapperInputHandler:view:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 2621 of file PlayerEntity.m.

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

References checkScriptsIfAppropriate, doBookkeeping:, EXPECT_NOT, gui_screen, isDocked, ShipEntity::manageCollisions, performAutopilotUpdates:, performDeadUpdates:, performDockingUpdates:, performInFlightUpdates:, performLaunchingUpdates:, performWitchspaceCountdownUpdates:, performWitchspaceExitUpdates:, pollControls:, setGuiToIntroFirstGo:, STAGE_TRACKING_BEGIN, STAGE_TRACKING_END, Entity::status, UPDATE_STAGE, updateAlertCondition, updateClocks:, updateFuelScoops:, updateMovementFlags, OOScriptTimer::updateTimers, updateTrumbles:, and updateWormholes.

+ Here is the call graph for this function:

◆ updateAfterburnerSound

- (void) updateAfterburnerSound
implementation

Provided by category PlayerEntity(Sound).

Definition at line 454 of file PlayerEntitySound.m.

455{
456 static uint8_t which = 0;
457
458 if (!afterburner_engaged) // end the loop cycle
459 {
461 }
462
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}

Referenced by PlayerEntity(Sound)::startAfterburnerSound.

+ Here is the caller graph for this function:

◆ updateAlertCondition

- (void) updateAlertCondition
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3426 of file PlayerEntity.m.

3427{
3428 [self updateAlertConditionForNearbyEntities];
3429 /* TODO: update alert condition once per frame. Tried this before, but
3430 there turned out to be complications. See mailing list archive.
3431 -- Ahruman 20070802
3432 */
3433 OOAlertCondition cond = [self alertCondition];
3434 OOTimeAbsolute t = [UNIVERSE getTime];
3435 if (cond != lastScriptAlertCondition)
3436 {
3437 ShipScriptEventNoCx(self, "alertConditionChanged", INT_TO_JSVAL(cond), INT_TO_JSVAL(lastScriptAlertCondition));
3439 }
3440 /* Update heuristic assessment of whether player is fleeing */
3442 {
3444 }
3446 {
3448 }
3450 {
3452 }
3453 else if (fleeing_status == PLAYER_FLEEING_MAYBE && last_shot_time + 10 > t)
3454 {
3456 }
3457 else if (fleeing_status == PLAYER_FLEEING_LIKELY && last_shot_time + 10 > t)
3458 {
3460 }
3462 {
3464 }
3466 {
3468 }
3469}
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

References ALERT_CONDITION_DOCKED, ALERT_CONDITION_GREEN, ALERT_CONDITION_RED, ALERT_CONDITION_YELLOW, alertCondition, PLAYER_FLEEING_CARGO, PLAYER_FLEEING_LIKELY, PLAYER_FLEEING_MAYBE, PLAYER_FLEEING_NONE, PLAYER_FLEEING_UNLIKELY, ShipScriptEventNoCx, PlayerEntity(OOPrivate)::updateAlertCondition, and updateAlertConditionForNearbyEntities.

Referenced by PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, setMassLockable:, update:, and PlayerEntity(OOPrivate)::updateAlertCondition.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateAlertConditionForNearbyEntities

- (void) updateAlertConditionForNearbyEntities
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3215 of file PlayerEntity.m.

3216{
3217 if (![self isInSpace] || [self status] == STATUS_DOCKING)
3218 {
3219 [self clearAlertFlags];
3220 // not needed while docked
3221 return;
3222 }
3223
3224 int i, ent_count = UNIVERSE->n_entities;
3225 Entity **uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
3226 Entity *my_entities[ent_count];
3227 Entity *scannedEntity = nil;
3228 for (i = 0; i < ent_count; i++)
3229 {
3230 my_entities[i] = [uni_entities[i] retain]; // retained
3231 }
3232 BOOL massLocked = NO;
3233 BOOL foundHostiles = NO;
3234#if OO_VARIABLE_TORUS_SPEED
3235 BOOL needHyperspeedNearest = YES;
3236 double hsnDistance = 0;
3237#endif
3238 for (i = 0; i < ent_count; i++) // scanner lollypops
3239 {
3240 scannedEntity = my_entities[i];
3241
3242#if OO_VARIABLE_TORUS_SPEED
3243 if (EXPECT_NOT(needHyperspeedNearest))
3244 {
3245 // not visual effects, waypoints, ships, etc.
3246 if (scannedEntity != self && [scannedEntity canCollide] && (![scannedEntity isShip] || ![self collisionExceptedFor:(ShipEntity *) scannedEntity]))
3247 {
3248 hsnDistance = sqrt(scannedEntity->zero_distance)-[scannedEntity collisionRadius];
3249 needHyperspeedNearest = NO;
3250 }
3251 }
3252 else if ([scannedEntity isStellarObject])
3253 {
3254 // planets, stars might be closest surface even if not
3255 // closest centre. That could be true of others, but the
3256 // error is negligible there.
3257 double thisHSN = sqrt(scannedEntity->zero_distance)-[scannedEntity collisionRadius];
3258 if (thisHSN < hsnDistance)
3259 {
3260 hsnDistance = thisHSN;
3261 }
3262 }
3263#endif
3264
3265 if (scannedEntity->zero_distance < SCANNER_MAX_RANGE2 || !scannedEntity->isShip)
3266 {
3267 int theirClass = [scannedEntity scanClass];
3268 // here we could also force masslock for higher than yellow alert, but
3269 // if we are going to hand over masslock control to scripting, might as well
3270 // hand it over fully
3271 if ([self massLockable] /*|| alertFlags > ALERT_FLAG_YELLOW_LIMIT*/)
3272 {
3273 massLocked |= [self checkEntityForMassLock:scannedEntity withScanClass:theirClass]; // we just need one masslocker..
3274 }
3275 if (theirClass != CLASS_NO_DRAW)
3276 {
3277 if (theirClass == CLASS_THARGOID || [scannedEntity isCascadeWeapon])
3278 {
3279 foundHostiles = YES;
3280 }
3281 else if ([scannedEntity isShip])
3282 {
3283 ShipEntity *ship = (ShipEntity *)scannedEntity;
3284 foundHostiles |= (([ship hasHostileTarget])&&([ship primaryTarget] == self));
3285 }
3286 }
3287 }
3288 }
3289#if OO_VARIABLE_TORUS_SPEED
3290 if (EXPECT_NOT(needHyperspeedNearest))
3291 {
3292 // this case should only occur in an otherwise empty
3293 // interstellar space - unlikely but possible
3295 }
3296 else
3297 {
3298 // once nearest object is >4x scanner range
3299 // start increasing torus speed
3300 double factor = hsnDistance/(4*SCANNER_MAX_RANGE);
3301 if (factor < 1.0)
3302 {
3304 }
3305 else
3306 {
3307 hyperspeedFactor = MIN_HYPERSPEED_FACTOR * sqrt(factor);
3309 {
3310 // caps out at ~10^8m from nearest object
3311 // which takes ~10 minutes of flying
3313 }
3314 }
3315 }
3316#endif
3317
3318 [self setAlertFlag:ALERT_FLAG_MASS_LOCK to:massLocked];
3319
3320 [self setAlertFlag:ALERT_FLAG_HOSTILES to:foundHostiles];
3321
3322 for (i = 0; i < ent_count; i++)
3323 {
3324 [my_entities[i] release]; // released
3325 }
3326
3327 BOOL energyCritical = NO;
3328 if (energy < 64 && energy < maxEnergy * 0.8)
3329 {
3330 energyCritical = YES;
3331 }
3332 [self setAlertFlag:ALERT_FLAG_ENERGY to:energyCritical];
3333
3334 [self setAlertFlag:ALERT_FLAG_TEMP to:([self hullHeatLevel] > .90)];
3335
3336 [self setAlertFlag:ALERT_FLAG_ALT to:([self dialAltitude] < .10)];
3337
3338}
#define MAX_HYPERSPEED_FACTOR
#define MIN_HYPERSPEED_FACTOR
GLfloat hyperspeedFactor
BOOL hasHostileTarget()

References checkEntityForMassLock:withScanClass:, clearAlertFlags, Entity::collisionRadius, dialAltitude, EXPECT_NOT, ShipEntity::hasHostileTarget, ShipEntity::hullHeatLevel, Entity::isShip, MAX_HYPERSPEED_FACTOR, MIN_HYPERSPEED_FACTOR, nil, ShipEntity::primaryTarget, Entity::scanClass, SCANNER_MAX_RANGE, SCANNER_MAX_RANGE2, setAlertFlag:to:, UNIVERSE, PlayerEntity(OOPrivate)::updateAlertConditionForNearbyEntities, and Entity::zero_distance.

Referenced by PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, PlayerEntity(OOPrivate)::updateAlertCondition, and PlayerEntity(OOPrivate)::updateAlertConditionForNearbyEntities.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateClocks:

- (void) updateClocks: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3486 of file PlayerEntity.m.

3486 :(OOTimeDelta)delta_t
3487{
3488 // shot time updates are still needed here for STATUS_DEAD!
3489 shot_time += delta_t;
3490 script_time += delta_t;
3491 unsigned prev_day = floor(ship_clock / 86400);
3492 ship_clock += delta_t;
3493 if (ship_clock_adjust > 0.0) // adjust for coming out of warp (add LY * LY hrs)
3494 {
3495 double fine_adjust = delta_t * 7200.0;
3496 if (ship_clock_adjust > 86400) // more than a day
3497 fine_adjust = delta_t * 115200.0; // 16 times faster
3498 if (ship_clock_adjust > 0)
3499 {
3500 if (fine_adjust > ship_clock_adjust)
3501 fine_adjust = ship_clock_adjust;
3502 ship_clock += fine_adjust;
3503 ship_clock_adjust -= fine_adjust;
3504 }
3505 else
3506 {
3507 if (fine_adjust < ship_clock_adjust)
3508 fine_adjust = ship_clock_adjust;
3509 ship_clock -= fine_adjust;
3510 ship_clock_adjust += fine_adjust;
3511 }
3512 }
3513 else
3514 ship_clock_adjust = 0.0;
3515
3516 unsigned now_day = floor(ship_clock / 86400.0);
3517 while (prev_day < now_day)
3518 {
3519 prev_day++;
3520 [self doScriptEvent:OOJSID("dayChanged") withArgument:[NSNumber numberWithUnsignedInt:prev_day]];
3521 // not impossible that at ultra-low frame rates two of these will
3522 // happen in a single update.
3523 }
3524
3525 //fps
3527 {
3528 if (![self clockAdjusting])
3529 {
3530 fps_counter = (int)([UNIVERSE timeAccelerationFactor] * floor([UNIVERSE framesDoneThisUpdate] / (fps_check_time - last_fps_check_time)));
3533 }
3534 else
3535 {
3536 // Good approximation for when the clock is adjusting and proper fps calculation
3537 // cannot be performed.
3538 fps_counter = (int)([UNIVERSE timeAccelerationFactor] * floor(1.0 / delta_t));
3540 }
3541 [UNIVERSE resetFramesDoneThisUpdate]; // Reset frame counter
3542 }
3543}
double last_fps_check_time

References ShipEntity::doScriptEvent:withArgument:, int(), MINIMUM_GAME_TICK, and UNIVERSE.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFuelScoops:

- (void) updateFuelScoops: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3472 of file PlayerEntity.m.

3472 :(OOTimeDelta)delta_t
3473{
3474 if (scoopsActive)
3475 {
3476 [self updateFuelScoopSoundWithInterval:delta_t];
3477 if (![self scoopOverride])
3478 {
3479 scoopsActive = NO;
3480 [self updateFuelScoopSoundWithInterval:delta_t];
3481 }
3482 }
3483}

References updateFuelScoopSoundWithInterval:.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFuelScoopSoundWithInterval:

- (void) updateFuelScoopSoundWithInterval: (OOTimeDelta) delta_t

Provided by category PlayerEntity(Sound).

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

Referenced by PlayerEntity(OOPrivate)::updateFuelScoops:.

+ Here is the caller graph for this function:

◆ updateFunction:

- (void) updateFunction: (NSDictionary *) hwDict

Provided by category PlayerEntity(StickMapper).

Definition at line 215 of file PlayerEntityStickMapper.m.

215 : (NSDictionary *)hwDict
216{
217 OOJoystickManager *stickHandler = [OOJoystickManager sharedStickHandler];
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;
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 678 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}

References count, KEY_KC_DEFINITION, key_list, last_shift, nav_keys, processKeyCode:, and selected_entry.

Referenced by PlayerEntity(KeyMapper)::handleKeyConfigEntryKeys:view:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateMovementFlags

- (void) updateMovementFlags
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3206 of file PlayerEntity.m.

3207{
3208 hasMoved = !HPvector_equal(position, lastPosition);
3209 hasRotated = !quaternion_equal(orientation, lastOrientation);
3212}
unsigned hasMoved
Definition Entity.h:96
HPVector lastPosition
Definition Entity.h:133

References PlayerEntity(OOPrivate)::updateMovementFlags.

Referenced by PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, update:, and PlayerEntity(OOPrivate)::updateMovementFlags.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateShiftKeyDefinition:index:

- (void) updateShiftKeyDefinition: (NSString *) key
index: (NSUInteger) index 
implementation

Provided by category PlayerEntity(KeyMapperInternal).

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

References count, key_list, keyCodeDescription:, and processKeyCode:.

Referenced by PlayerEntity(KeyMapper)::handleKeyConfigKeys:view:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSystemMemory

- (void) updateSystemMemory

Definition at line 5166 of file PlayerEntity.m.

5167{
5168 OOSystemID sys = [self currentSystemID];
5169 if (sys < 0)
5170 {
5171 return;
5172 }
5173 NSUInteger memory = 4;
5174 if (ship_kills >= 6400)
5175 {
5176 memory = 32;
5177 }
5178 else if (ship_kills >= 256)
5179 {
5180 memory = 16;
5181 }
5182 else if (ship_kills >= 64)
5183 {
5184 memory = 8;
5185 }
5186 if ([roleSystemList count] >= memory)
5187 {
5188 [roleSystemList removeObjectAtIndex:0];
5189 }
5190 [roleSystemList addObject:[NSNumber numberWithInt:sys]];
5191}

References count, currentSystemID, roleSystemList, ship_kills, and updateSystemMemory.

Referenced by enterWitchspace, roleWeights, and updateSystemMemory.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateTargeting

- (void) updateTargeting
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 4146 of file PlayerEntity.m.

4147{
4149
4150 // check for lost ident target and ensure the ident system is actually scanning
4151 UPDATE_STAGE(@"checking ident target");
4152 if (ident_engaged && [self primaryTarget] != nil)
4153 {
4154 if (![self isValidTarget:[self primaryTarget]])
4155 {
4156 if (!suppressTargetLost)
4157 {
4158 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4159 [self playTargetLost];
4160 [self noteLostTarget];
4161 }
4162 else
4163 {
4164 suppressTargetLost = NO;
4165 }
4166
4168 }
4169 }
4170
4171 // check each unlaunched missile's target still exists and is in-range
4172 UPDATE_STAGE(@"checking missile targets");
4174 {
4175 unsigned i;
4176 for (i = 0; i < max_missiles; i++)
4177 {
4178 if ([missile_entity[i] primaryTarget] != nil &&
4179 ![self isValidTarget:[missile_entity[i] primaryTarget]])
4180 {
4181 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4182 [self playTargetLost];
4183 [missile_entity[i] removeTarget:nil];
4184 if (i == activeMissile)
4185 {
4186 [self noteLostTarget];
4189 }
4190 } else if (i == activeMissile && [missile_entity[i] primaryTarget] == nil) {
4192 }
4193 }
4194 }
4195
4196 // if we don't have a primary target, and we're scanning, then check for a new
4197 // target to lock on to
4198 UPDATE_STAGE(@"looking for new target");
4199 if ([self primaryTarget] == nil &&
4201 ([self status] == STATUS_IN_FLIGHT || [self status] == STATUS_WITCHSPACE_COUNTDOWN))
4202 {
4203 Entity *target = [UNIVERSE firstEntityTargetedByPlayer];
4204 if ([self isValidTarget:target])
4205 {
4206 [self addTarget:target];
4207 }
4208 }
4209
4210 // If our primary target is a wormhole, check to see if we have additional
4211 // information
4212 UPDATE_STAGE(@"checking for additional wormhole information");
4213 if ([[self primaryTarget] isWormhole])
4214 {
4215 WormholeEntity *wh = [self primaryTarget];
4216 switch ([wh scanInfo])
4217 {
4218 case WH_SCANINFO_NONE:
4219 OOLog(kOOLogInconsistentState, @"%@", @"Internal Error - WH_SCANINFO_NONE reached in [PlayerEntity updateTargeting:]");
4220 [self dumpState];
4221 [wh dumpState];
4222 // Workaround a reported hit of the assert here. We really
4223 // should work out how/why this could happen though and fix
4224 // the underlying cause.
4225 // - MKW 2011.03.11
4226 //assert([wh scanInfo] != WH_SCANINFO_NONE);
4227 [wh setScannedAt:[self clockTimeAdjusted]];
4228 break;
4230 if ([self clockTimeAdjusted] > [wh scanTime] + 2)
4231 {
4232 [wh setScanInfo:WH_SCANINFO_COLLAPSE_TIME];
4233 //[UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-collapse-time-computed"),
4234 // [UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
4235 }
4236 break;
4238 if([self clockTimeAdjusted] > [wh scanTime] + 4)
4239 {
4240 [wh setScanInfo:WH_SCANINFO_ARRIVAL_TIME];
4241 [UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-arrival-time-computed-@"),
4242 ClockToString([wh estimatedArrivalTime], NO)] forCount:5.0];
4243 }
4244 break;
4246 if ([self clockTimeAdjusted] > [wh scanTime] + 7)
4247 {
4248 [wh setScanInfo:WH_SCANINFO_DESTINATION];
4249 [UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-destination-computed-@"),
4250 [UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
4251 }
4252 break;
4254 if ([self clockTimeAdjusted] > [wh scanTime] + 10)
4255 {
4256 [wh setScanInfo:WH_SCANINFO_SHIP];
4257 // TODO: Extract last ship from wormhole and display its name
4258 }
4259 break;
4260 case WH_SCANINFO_SHIP:
4261 break;
4262 }
4263 }
4264
4266}
@ 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 estimatedArrivalTime()
void setScannedAt:(double time)
void setScanInfo:(WORMHOLE_SCANINFO scanInfo)

References addTarget:, clockTimeAdjusted, WormholeEntity::destination, DESTROY, Entity::dumpState, WormholeEntity::estimatedArrivalTime, kOOLogInconsistentState, MISSILE_STATUS_ARMED, MISSILE_STATUS_SAFE, nil, ShipEntity::noteLostTarget, OOLog, playTargetLost, ShipEntity::primaryTarget, WormholeEntity::setScanInfo:, WormholeEntity::setScannedAt:, STAGE_TRACKING_BEGIN, STAGE_TRACKING_END, UPDATE_STAGE, PlayerEntity(OOPrivate)::updateTargeting, WH_SCANINFO_ARRIVAL_TIME, WH_SCANINFO_COLLAPSE_TIME, WH_SCANINFO_DESTINATION, WH_SCANINFO_NONE, WH_SCANINFO_SCANNED, and WH_SCANINFO_SHIP.

Referenced by PlayerEntity(OOPrivate)::performInFlightUpdates:, PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, and PlayerEntity(OOPrivate)::updateTargeting.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateTrumbles:

- (void) updateTrumbles: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 3599 of file PlayerEntity.m.

3599 :(OOTimeDelta)delta_t
3600{
3601 OOTrumble **trumbles = [self trumbleArray];
3602 NSUInteger i;
3603
3604 for (i = [self trumbleCount] ; i > 0; i--)
3605 {
3606 OOTrumble* trum = trumbles[i - 1];
3607 [trum updateTrumble:delta_t];
3608 }
3609}
void updateTrumble:(double delta_t)
Definition OOTrumble.m:494

References trumbleArray, and OOTrumble::updateTrumble:.

Referenced by update:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateWormholes

- (void) updateWormholes
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13243 of file PlayerEntity.m.

13244{
13245 assert(scannedWormholes != nil);
13246
13247 if ([scannedWormholes count] == 0)
13248 return;
13249
13250 double now = [self clockTimeAdjusted];
13251
13252 NSMutableArray * savedWormholes = [[NSMutableArray alloc] initWithCapacity:[scannedWormholes count]];
13253 NSEnumerator * wormholes = [scannedWormholes objectEnumerator];
13254 WormholeEntity *wh;
13255
13256 while ((wh = (WormholeEntity*)[wormholes nextObject]))
13257 {
13258 // TODO: Start drawing wormhole exit a few seconds before the first
13259 // ship is disgorged.
13260 if ([wh arrivalTime] > now)
13261 {
13262 [savedWormholes addObject:wh];
13263 }
13264 else if (NSEqualPoints(galaxy_coordinates, [wh destinationCoordinates]))
13265 {
13266 [wh disgorgeShips];
13267 if ([[wh shipsInTransit] count] > 0)
13268 {
13269 [savedWormholes addObject:wh];
13270 }
13271 }
13272 // Else wormhole has expired in another system, let it expire
13273 }
13274
13275 [scannedWormholes release];
13276 scannedWormholes = savedWormholes;
13277}

References clockTimeAdjusted, count, WormholeEntity::disgorgeShips, nil, and PlayerEntity(OOPrivate)::updateWormholes.

Referenced by PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, update:, and PlayerEntity(OOPrivate)::updateWormholes.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ useSpecialCargo:

- (void) useSpecialCargo: (NSString *) descriptionString

Provided by category PlayerEntity(Scripting).

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

References nil, PlayerEntity(KeyMapperInternal)::validateAllKeys, and validateKey:checkKeys:.

Referenced by PlayerEntity(KeyMapperInternal)::validateAllKeys.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateCompassTarget

- (void) validateCompassTarget

Definition at line 5213 of file PlayerEntity.m.

5214{
5215 OOSunEntity *the_sun = [UNIVERSE sun];
5216 OOPlanetEntity *the_planet = [UNIVERSE planet];
5217 StationEntity *the_station = [UNIVERSE station];
5218 Entity *the_target = [self primaryTarget];
5219 Entity <OOBeaconEntity> *beacon = [self nextBeacon];
5220 if ([self isInSpace] && the_sun && the_planet // be in a system
5221 && ![the_sun goneNova]) // and the system has not been novabombed
5222 {
5223 Entity *new_target = nil;
5224 OOAegisStatus aegis = [self checkForAegis];
5225
5226 switch ([self compassMode])
5227 {
5228 case COMPASS_MODE_INACTIVE:
5229 break;
5230
5231 case COMPASS_MODE_BASIC:
5232 if ((aegis == AEGIS_CLOSE_TO_MAIN_PLANET || aegis == AEGIS_IN_DOCKING_RANGE) && the_station)
5233 {
5234 new_target = the_station;
5235 }
5236 else
5237 {
5238 new_target = the_planet;
5239 }
5240 break;
5241
5242 case COMPASS_MODE_PLANET:
5243 new_target = the_planet;
5244 break;
5245
5246 case COMPASS_MODE_STATION:
5247 new_target = the_station;
5248 break;
5249
5250 case COMPASS_MODE_SUN:
5251 new_target = the_sun;
5252 break;
5253
5254 case COMPASS_MODE_TARGET:
5255 new_target = the_target;
5256 break;
5257
5258 case COMPASS_MODE_BEACONS:
5259 new_target = beacon;
5260 break;
5261 }
5262
5263 if (new_target == nil || [new_target status] < STATUS_ACTIVE || [new_target status] == STATUS_IN_HOLD)
5264 {
5265 [self setCompassMode:COMPASS_MODE_PLANET];
5266 new_target = the_planet;
5267 }
5268
5269 if (EXPECT_NOT(new_target != [self compassTarget]))
5270 {
5271 [self setCompassTarget:new_target];
5272 [self doScriptEvent:OOJSID("compassTargetChanged") withArguments:[NSArray arrayWithObjects:new_target, OOStringFromCompassMode([self compassMode]), nil]];
5273 }
5274 }
5275}

References AEGIS_CLOSE_TO_MAIN_PLANET, AEGIS_IN_DOCKING_RANGE, ShipEntity::checkForAegis, compassMode, compassTarget, ShipEntity::doScriptEvent:withArguments:, EXPECT_NOT, Entity::isInSpace, ShipEntity::nextBeacon, nil, ShipEntity::primaryTarget, setCompassMode:, setCompassTarget:, Entity::status, and validateCompassTarget.

Referenced by compassTarget, doBookkeeping:, PlayerShipSetProperty(), and validateCompassTarget.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateCustomEquipActivationArray

- (void) validateCustomEquipActivationArray

Definition at line 11640 of file PlayerEntity.m.

11641{
11642 int i;
11643 bool update = NO;
11644 NSString *equipmentKey;
11645 if ([customEquipActivation count] == 0) return;
11646 for (i = [customEquipActivation count] - 1; i >= 0; i--) {
11647 equipmentKey = [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY];
11648 OOEquipmentType *eq = [OOEquipmentType equipmentTypeWithIdentifier:equipmentKey];
11649 if (!eq) {
11650 [customEquipActivation removeObjectAtIndex:i];
11651 [customActivatePressed removeObjectAtIndex:i];
11652 [customModePressed removeObjectAtIndex:i];
11653 update = YES;
11654 }
11655 }
11656 if (update) {
11657 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
11658 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
11659 }
11660}

References count, customEquipActivation, OOEquipmentType::equipmentTypeWithIdentifier:, and validateCustomEquipActivationArray.

Referenced by completeSetUpAndSetTarget:, custom_chart_zoom, and validateCustomEquipActivationArray.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validatedMarker:

- (NSDictionary *) validatedMarker: (NSDictionary *) marker

Provided by category PlayerEntity(ScriptMethods).

Definition at line 322 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
OOShipGroup * group()

Referenced by addMissionDestinationMarker:, and removeMissionDestinationMarker:.

+ Here is the caller graph for this function:

◆ validateKey:checkKeys:

- (NSString *) validateKey: (NSString*) key
checkKeys: (NSArray*) check_keys 

Provided by category PlayerEntity(KeyMapper).

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

Referenced by PlayerEntity(KeyMapperInternal)::displayKeyFunctionList:skip:, PlayerEntity(KeyMapper)::setGuiToKeyConfigScreen:, and PlayerEntity(KeyMapperInternal)::validateAllKeys.

+ Here is the caller graph for this function:

◆ validForAddToUniverse

- (BOOL) validForAddToUniverse
implementation

Reimplemented from ShipEntity.

Definition at line 2500 of file PlayerEntity.m.

2501{
2502 return YES;
2503}

References validForAddToUniverse.

Referenced by validForAddToUniverse.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ viewpointOffset

- (Vector) viewpointOffset

Definition at line 4368 of file PlayerEntity.m.

4369{
4370// if ([UNIVERSE breakPatternHide])
4371// return kZeroVector; // center view for break pattern
4372 // now done by positioning break pattern correctly
4373
4374 switch ([UNIVERSE viewDirection])
4375 {
4376 case VIEW_FORWARD:
4377 return forwardViewOffset;
4378 case VIEW_AFT:
4379 return aftViewOffset;
4380 case VIEW_PORT:
4381 return portViewOffset;
4382 case VIEW_STARBOARD:
4383 return starboardViewOffset;
4384 /* GILES custom viewpoints */
4385 case VIEW_CUSTOM:
4386 return customViewOffset;
4387 /* -- */
4388
4389 default:
4390 break;
4391 }
4392
4393 return kZeroVector;
4394}

References aftViewOffset, customViewOffset, forwardViewOffset, kZeroVector, portViewOffset, starboardViewOffset, UNIVERSE, and viewpointOffset.

Referenced by customViewDescription, Universe::drawUniverse, viewpointOffset, and viewpointPosition.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ viewpointOffsetAft

- (Vector) viewpointOffsetAft

Definition at line 4397 of file PlayerEntity.m.

4398{
4399 return aftViewOffset;
4400}

References aftViewOffset, and viewpointOffsetAft.

Referenced by customViewDescription, and viewpointOffsetAft.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ viewpointOffsetForward

- (Vector) viewpointOffsetForward

Definition at line 4402 of file PlayerEntity.m.

4403{
4404 return forwardViewOffset;
4405}

References forwardViewOffset, and viewpointOffsetForward.

Referenced by customViewDescription, and viewpointOffsetForward.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ viewpointOffsetPort

- (Vector) viewpointOffsetPort

Definition at line 4407 of file PlayerEntity.m.

4408{
4409 return portViewOffset;
4410}

References portViewOffset, and viewpointOffsetPort.

Referenced by customViewDescription, and viewpointOffsetPort.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ viewpointOffsetStarboard

- (Vector) viewpointOffsetStarboard

Definition at line 4412 of file PlayerEntity.m.

4413{
4414 return starboardViewOffset;
4415}

References starboardViewOffset, and viewpointOffsetStarboard.

Referenced by customViewDescription, and viewpointOffsetStarboard.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ viewpointPosition

- (HPVector) viewpointPosition

Definition at line 4420 of file PlayerEntity.m.

4421{
4422 HPVector viewpoint = position;
4423 if (showDemoShips)
4424 {
4425 viewpoint = kZeroHPVector;
4426 }
4427 Vector offset = [self viewpointOffset];
4428
4429 // FIXME: this ought to be done with matrix or quaternion functions.
4430 OOMatrix r = rotMatrix;
4431
4432 viewpoint.x += offset.x * r.m[0][0]; viewpoint.y += offset.x * r.m[1][0]; viewpoint.z += offset.x * r.m[2][0];
4433 viewpoint.x += offset.y * r.m[0][1]; viewpoint.y += offset.y * r.m[1][1]; viewpoint.z += offset.y * r.m[2][1];
4434 viewpoint.x += offset.z * r.m[0][2]; viewpoint.y += offset.z * r.m[1][2]; viewpoint.z += offset.z * r.m[2][2];
4435
4436 return viewpoint;
4437}

References kZeroHPVector, Entity::position, Entity::rotMatrix, showDemoShips, viewpointOffset, and viewpointPosition.

Referenced by customViewDescription, lookingAtSunWithThresholdAngleCos:, SkyEntity::update:, and viewpointPosition.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ warnAboutHostiles

- (void) warnAboutHostiles

Reimplemented from Entity.

Definition at line 2471 of file PlayerEntity.m.

2472{
2473 [self playHostileWarning];
2474}

References playHostileWarning, and warnAboutHostiles.

Referenced by StationEntity::becomeExplosion, and warnAboutHostiles.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ weaponForFacing:

- (OOWeaponType) weaponForFacing: (OOWeaponFacing) facing

Definition at line 6277 of file PlayerEntity.m.

6277 :(OOWeaponFacing)facing
6278{
6279 switch (facing)
6280 {
6282 return forward_weapon_type;
6283
6284 case WEAPON_FACING_AFT:
6285 return aft_weapon_type;
6286
6287 case WEAPON_FACING_PORT:
6288 return port_weapon_type;
6289
6291 return starboard_weapon_type;
6292
6293 case WEAPON_FACING_NONE:
6294 break;
6295 }
6296 return nil;
6297}

References ShipEntity::aft_weapon_type, ShipEntity::forward_weapon_type, nil, ShipEntity::port_weapon_type, ShipEntity::starboard_weapon_type, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_NONE, WEAPON_FACING_PORT, and WEAPON_FACING_STARBOARD.

Referenced by currentWeapon.

+ Here is the caller graph for this function:

◆ weaponsOnline

- (BOOL) weaponsOnline

Definition at line 6169 of file PlayerEntity.m.

6170{
6171 return weapons_online;
6172}

References weapons_online, and weaponsOnline.

Referenced by addTarget:, alertCondition, commanderDataDictionary, dialMissileStatus, fireMainWeapon, fireMissile, launchMine:, PlayerEntity(OOControlsPrivate)::pollFlightControls:, selectNextMissile, and weaponsOnline.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ weaponTypeForFacing:strict:

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

Reimplemented from ShipEntity.

Definition at line 8312 of file PlayerEntity.m.

8312 :(OOWeaponFacing)facing strict:(BOOL)strict
8313{
8314 OOWeaponType weaponType = nil;
8315
8316 switch (facing)
8317 {
8319 weaponType = forward_weapon_type;
8320 break;
8321
8322 case WEAPON_FACING_AFT:
8323 weaponType = aft_weapon_type;
8324 break;
8325
8326 case WEAPON_FACING_PORT:
8327 weaponType = port_weapon_type;
8328 break;
8329
8331 weaponType = starboard_weapon_type;
8332 break;
8333
8334 case WEAPON_FACING_NONE:
8335 break;
8336 }
8337
8338 return weaponType;
8339}

References ShipEntity::aft_weapon_type, ShipEntity::forward_weapon_type, nil, ShipEntity::port_weapon_type, ShipEntity::starboard_weapon_type, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_NONE, WEAPON_FACING_PORT, and WEAPON_FACING_STARBOARD.

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ weaponViewOffset

- (Vector) weaponViewOffset

Definition at line 11975 of file PlayerEntity.m.

11976{
11977 switch (currentWeaponFacing)
11978 {
11980 return forwardViewOffset;
11981 case WEAPON_FACING_AFT:
11982 return aftViewOffset;
11983 case WEAPON_FACING_PORT:
11984 return portViewOffset;
11986 return starboardViewOffset;
11987
11988 case WEAPON_FACING_NONE:
11989 // N.b.: this case should never happen.
11990 return customViewOffset;
11991 }
11992 return kZeroVector;
11993}

References aftViewOffset, ShipEntity::currentWeaponFacing, customViewOffset, forwardViewOffset, kZeroVector, portViewOffset, starboardViewOffset, WEAPON_FACING_AFT, WEAPON_FACING_FORWARD, WEAPON_FACING_NONE, WEAPON_FACING_PORT, WEAPON_FACING_STARBOARD, and weaponViewOffset.

Referenced by Universe::firstEntityTargetedByPlayer, isSpeechOn, and weaponViewOffset.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ witchEnd

- (void) witchEnd
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 7393 of file PlayerEntity.m.

7394{
7395 [UNIVERSE setSystemTo:system_id];
7396 galaxy_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:system_id inGalaxy:galaxy_number];
7397
7398 [UNIVERSE setUpUniverseFromWitchspace];
7399 [[UNIVERSE planet] update: 2.34375 * market_rnd]; // from 0..10 minutes
7400 [[UNIVERSE station] update: 2.34375 * market_rnd]; // from 0..10 minutes
7401
7404}

References PlayerEntity(OOPrivate)::witchEnd.

Referenced by enterGalacticWitchspace, PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, PlayerEntity(OOPrivate)::witchEnd, and PlayerEntity(OOPrivate)::witchJumpTo:misjump:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ witchJumpChecklist:

- (BOOL) witchJumpChecklist: (BOOL) isGalacticJump

Definition at line 7407 of file PlayerEntity.m.

7407 :(BOOL)isGalacticJump
7408{
7409 // Perform this check only when doing the actual jump
7410 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7411 {
7412 // check nearby masses
7413 //UPDATE_STAGE(@"checking for mass blockage");
7414 ShipEntity* blocker = [UNIVERSE entityForUniversalID:[self checkShipsInVicinityForWitchJumpExit]];
7415 if (blocker)
7416 {
7417 [UNIVERSE clearPreviousMessage];
7418 NSString *blockerName = [blocker name];
7419 [UNIVERSE addMessage:OOExpandKey(@"witch-blocked", blockerName) forCount:4.5];
7420 [self playWitchjumpBlocked];
7421 [self setStatus:STATUS_IN_FLIGHT];
7422 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("blocked"));
7423 return NO;
7424 }
7425 }
7426
7427 // For galactic hyperspace jumps we skip the remaining checks
7428 if (isGalacticJump)
7429 {
7430 return YES;
7431 }
7432
7433 // Check we're not jumping into the current system
7434 if (![UNIVERSE inInterstellarSpace] && system_id == target_system_id)
7435 {
7436 //dont allow player to hyperspace to current location.
7437 //Note interstellar space will have a system_seed place we came from
7438 [UNIVERSE clearPreviousMessage];
7439 [UNIVERSE addMessage:OOExpandKey(@"witch-no-target") forCount: 4.5];
7440 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7441 {
7442 [self playWitchjumpInsufficientFuel];
7443 [self setStatus:STATUS_IN_FLIGHT];
7444 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("no target"));
7445 }
7446 else [self playHyperspaceNoTarget];
7447
7448 return NO;
7449 }
7450
7451 // check max distance permitted
7453 {
7454 [UNIVERSE clearPreviousMessage];
7455 [UNIVERSE addMessage:DESC(@"witch-too-far") forCount: 4.5];
7456 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7457 {
7458 [self playWitchjumpDistanceTooGreat];
7459 [self setStatus:STATUS_IN_FLIGHT];
7460 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("too far"));
7461 }
7462 else [self playHyperspaceDistanceTooGreat];
7463
7464 return NO;
7465 }
7466
7467 // check fuel level
7468 if (![self hasSufficientFuelForJump])
7469 {
7470 [UNIVERSE clearPreviousMessage];
7471 [UNIVERSE addMessage:DESC(@"witch-no-fuel") forCount: 4.5];
7472 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7473 {
7474 [self playWitchjumpInsufficientFuel];
7475 [self setStatus:STATUS_IN_FLIGHT];
7476 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("insufficient fuel"));
7477 }
7478 else [self playHyperspaceNoFuel];
7479
7480 return NO;
7481 }
7482
7483 // All checks passed
7484 return YES;
7485}
BOOL hasSufficientFuelForJump()
double maxHyperspaceDistance()

References ShipEntity::checkShipsInVicinityForWitchJumpExit, hasSufficientFuelForJump, hyperspaceJumpDistance, ShipEntity::maxHyperspaceDistance, ShipEntity::name, OOJSSTR, playHyperspaceDistanceTooGreat, playHyperspaceNoFuel, playHyperspaceNoTarget, playWitchjumpBlocked, playWitchjumpDistanceTooGreat, playWitchjumpInsufficientFuel, ShipEntity::setStatus:, ShipScriptEventNoCx, Entity::status, system_id, target_system_id, and UNIVERSE.

+ Here is the call graph for this function:

◆ witchJumpTo:misjump:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 7775 of file PlayerEntity.m.

7775 :(OOSystemID)sTo misjump:(BOOL)misjump
7776{
7777 [self witchStart];
7779 {
7780 [self setInfoSystemID: sTo moveChart: YES];
7781 }
7782 //wear and tear on all jumps (inc misjumps, failures, and wormholes)
7784 {
7785 // every eight jumps or so drop the price down towards 75%
7786 [self adjustTradeInFactorBy:-(1 + (market_rnd & 3))];
7787 }
7788
7789 // set clock after "playerWillEnterWitchspace" and before removeAllEntitiesExceptPlayer, to allow escorts time to follow their mother.
7790 NSPoint destCoords = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:sTo inGalaxy:galaxy_number]);
7791 double distance = distanceBetweenPlanetPositions(destCoords.x,destCoords.y,galaxy_coordinates.x,galaxy_coordinates.y);
7792
7793 // if we just escaped a system gone nova, make sure all nova parameters are reset
7794 OOSunEntity *theSun = [UNIVERSE sun];
7795 if (theSun && [theSun goneNova])
7796 {
7797 [theSun resetNova];
7798 }
7799
7800 [UNIVERSE removeAllEntitiesExceptPlayer];
7801 if (!misjump)
7802 {
7803 ship_clock_adjust += distance * distance * 3600.0;
7804 [self setSystemID:sTo];
7805 [self setBounty:(legalStatus/2) withReason:kOOLegalStatusReasonNewSystem]; // 'another day, another system'
7806 [self witchEnd];
7807 if (market_rnd < 8) [self erodeReputation]; // every 32 systems or so, drop back towards 'unknown'
7808 }
7809 else
7810 {
7811 // Misjump: move halfway there!
7812 // misjumps do not change legal status.
7813 if (randf() < 0.1) [self erodeReputation]; // once every 10 misjumps - should be much rarer than successful jumps!
7814
7815 [wormhole setMisjump];
7816 // just in case, but this has usually been set already
7817
7818 // and now the wormhole has travel time and coordinates calculated
7819 // so rather than duplicate the calculation we'll just ask it...
7820 NSPoint dest = [wormhole destinationCoordinates];
7821 galaxy_coordinates.x = dest.x;
7822 galaxy_coordinates.y = dest.y;
7823
7824 ship_clock_adjust += [wormhole travelTime];
7825
7826 [self playWitchjumpMisjump];
7827 [UNIVERSE setUpUniverseFromMisjump];
7828 }
7829}

References adjustTradeInFactorBy:, distanceBetweenPlanetPositions(), erodeReputation, playWitchjumpMisjump, PointFromString(), randf(), OOSunEntity::resetNova, setBounty:withReason:, setInfoSystemID:moveChart:, setSystemID:, UNIVERSE, witchEnd, and witchStart.

Referenced by enterWitchspace, and enterWormhole:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ witchStart

- (void) witchStart
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 7348 of file PlayerEntity.m.

7349{
7350 // chances of entering witchspace with autopilot on are very low, but as Berlios bug #18307 has shown us, entirely possible
7351 // so in such cases we need to ensure that at least the docking music stops playing
7352 if (autopilot_engaged) [self disengageAutopilot];
7353
7354 if (![hud nonlinearScanner])
7355 {
7356 [hud setScannerZoom: 1.0];
7357 }
7358 [self safeAllMissiles];
7359
7360 OOViewID previousViewDirection = [UNIVERSE viewDirection];
7361 [UNIVERSE setViewDirection:VIEW_FORWARD];
7362 [self noteSwitchToView:VIEW_FORWARD fromView:previousViewDirection]; // notifies scripts of the switch
7363
7365 [self currentWeaponStats];
7366
7367 [self transitionToAegisNone];
7369 hyperspeed_engaged = NO;
7370
7371 if ([self primaryTarget] != nil)
7372 {
7373 [self noteLostTarget]; // losing target? Fire lost target event!
7375 }
7376
7377 scanner_zoom_rate = 0.0f;
7378 [UNIVERSE setDisplayText:NO];
7379
7380 if ( ![self wormhole] && !galactic_witchjump) // galactic hyperspace does not generate a wormhole
7381 {
7382 OOLog(kOOLogInconsistentState, @"%@", @"Internal Error : Player entering witchspace with no wormhole.");
7383 }
7384 [UNIVERSE allShipsDoScriptEvent:OOJSID("playerWillEnterWitchspace") andReactToAIMessage:@"PLAYER WITCHSPACE"];
7385
7386 // set the new market seed now!
7387 // reseeding the RNG should be completely unnecessary here
7388// ranrot_srand((uint32_t)[[NSDate date] timeIntervalSince1970]); // seed randomiser by time
7389 market_rnd = ranrot_rand() & 255; // random factor for market values is reset
7390}

References currentWeaponStats, DESTROY, disengageAutopilot, kOOLogInconsistentState, nil, ShipEntity::noteLostTarget, noteSwitchToView:fromView:, OOLog, ranrot_rand, safeAllMissiles, ShipEntity::transitionToAegisNone, WEAPON_FACING_FORWARD, and PlayerEntity(OOPrivate)::witchStart.

Referenced by enterGalacticWitchspace, PlayerEntity(OOPrivate)::setExtraEquipmentFromFlags, PlayerEntity(OOPrivate)::witchJumpTo:misjump:, and PlayerEntity(OOPrivate)::witchStart.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ worldScriptNames

- (NSArray *) worldScriptNames

Definition at line 12887 of file PlayerEntity.m.

12888{
12889 return [worldScripts allKeys];
12890}

References worldScriptNames.

Referenced by customViewDescription, worldScriptNames, and WorldScriptsEnumerate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ worldScriptsByName

- (NSDictionary *) worldScriptsByName

Definition at line 12893 of file PlayerEntity.m.

12894{
12895 return [[worldScripts copy] autorelease];
12896}

References worldScriptsByName.

Referenced by customViewDescription, worldScriptsByName, and WorldScriptsGetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wormhole

- (WormholeEntity *) wormhole

References doGuiScreenResizeUpdates, getMissionDestinations, INLINE_CONST_FUNC, insideAtmosphereFraction, OOINLINE, shipyardRecord, and wormhole.

+ Here is the call graph for this function:

◆ writePlayerToPath:

- (void) writePlayerToPath: (NSString *) path
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

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

Referenced by PlayerEntity(LoadSave)::autosavePlayer, PlayerEntity(OOLoadSavePrivate)::nativeSavePlayer:, PlayerEntity(LoadSave)::quicksavePlayer, and PlayerEntity(OOLoadSavePrivate)::savePlayerWithPanel.

+ Here is the caller graph for this function:

Member Data Documentation

◆ _commanderName

- (NSString*) _commanderName
private

Definition at line 517 of file PlayerEntity.h.

Referenced by commanderName, dealloc, and setCommanderName:.

◆ _customViewIndex

- (NSUInteger) _customViewIndex
private

◆ _customViews

- (NSArray*) _customViews
private

◆ _dockedStation

- (OOWeakReference*) _dockedStation
private

Definition at line 460 of file PlayerEntity.h.

Referenced by setDockedAtMainStation, and setDockedStation:.

◆ _dockTarget

- (OOUniversalID) _dockTarget
private

Definition at line 527 of file PlayerEntity.h.

Referenced by setDockTarget:.

◆ _equipScreenBackgroundDescriptor

- (NSDictionary*) _equipScreenBackgroundDescriptor
private

◆ _fastEquipmentA

- (NSString*) _fastEquipmentA
private

Definition at line 493 of file PlayerEntity.h.

Referenced by dealloc, fastEquipmentA, and setFastEquipmentA:.

◆ _fastEquipmentB

- (NSString*) _fastEquipmentB
private

Definition at line 494 of file PlayerEntity.h.

Referenced by dealloc, fastEquipmentB, and setFastEquipmentB:.

◆ _jumpCause

- (NSString*) _jumpCause
private

Definition at line 514 of file PlayerEntity.h.

Referenced by dealloc, jumpCause, and setJumpCause:.

◆ _lastsaveName

- (NSString*) _lastsaveName
private

Definition at line 518 of file PlayerEntity.h.

Referenced by dealloc, lastsaveName, and setLastsaveName:.

◆ _missionAllowInterrupt

- (BOOL) _missionAllowInterrupt
private

Definition at line 390 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ _missionBackgroundDescriptor

- (NSDictionary*) _missionBackgroundDescriptor
private

Definition at line 401 of file PlayerEntity.h.

Referenced by dealloc, missionBackgroundDescriptor, and setMissionBackgroundDescriptor:.

◆ _missionBackgroundSpecial

- (OOGUIBackgroundSpecial) _missionBackgroundSpecial
private

◆ _missionExitScreen

- (OOGUIScreenID) _missionExitScreen
private

Definition at line 392 of file PlayerEntity.h.

Referenced by missionExitScreen, and setMissionExitScreen:.

◆ _missionOverlayDescriptor

- (NSDictionary*) _missionOverlayDescriptor
private

Definition at line 400 of file PlayerEntity.h.

Referenced by dealloc, missionOverlayDescriptor, and setMissionOverlayDescriptor:.

◆ _missionScreenID

- (NSString*) _missionScreenID
private

Definition at line 404 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ _missionTextEntry

- (BOOL) _missionTextEntry
private

Definition at line 391 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ _missionTitle

- (NSString*) _missionTitle
private

Definition at line 385 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ _missionWithCallback

- (BOOL) _missionWithCallback
private

Definition at line 389 of file PlayerEntity.h.

Referenced by leaveDock:.

◆ _sysInfoLight

- (Vector) _sysInfoLight
private

Definition at line 711 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ _trumbleAppetiteAccumulator

- (float) _trumbleAppetiteAccumulator
private

Definition at line 716 of file PlayerEntity.h.

Referenced by setTrumbleAppetiteAccumulator:, and trumbleAppetiteAccumulator.

◆ activeMFD

- (NSUInteger) activeMFD
private

◆ activeMissile

- (NSUInteger) activeMissile
private

◆ aft_shield

◆ aft_shield_recharge_rate

- (GLfloat) aft_shield_recharge_rate
private

◆ aft_shot_time

- (OOTimeDelta) aft_shot_time
private

◆ afterburner_engaged

- (unsigned) afterburner_engaged
private

◆ afterburnerSoundLooping

- (unsigned) afterburnerSoundLooping
private

Definition at line 747 of file PlayerEntity.h.

Referenced by deferredInit, dumpSelfState, and engageAutopilotToStation:.

◆ aftViewOffset

- (Vector) aftViewOffset
private

◆ alertCondition

- (OOAlertCondition) alertCondition
private

Definition at line 5826 of file PlayerEntity.m.

5827{
5828 OOAlertCondition old_alert_condition = alertCondition;
5830
5831 [self setAlertFlag:ALERT_FLAG_DOCKED to:[self status] == STATUS_DOCKED];
5832
5834 {
5836 }
5837 else
5838 {
5839 if (alertFlags != 0)
5840 {
5842 }
5844 {
5846 }
5847 }
5848 if ((alertCondition == ALERT_CONDITION_RED)&&(old_alert_condition < ALERT_CONDITION_RED))
5849 {
5851 }
5852
5853 return alertCondition;
5854}
@ ALERT_FLAG_DOCKED
@ ALERT_FLAG_YELLOW_LIMIT

Referenced by alertCondition, ProxyPlayerEntity::copyValuesFromPlayer:, dumpSelfState, realAlertCondition, setGuiToStatusScreen, setUpAndConfirmOK:saveGame:, and PlayerEntity(OOPrivate)::updateAlertCondition.

◆ alertFlags

- (int) alertFlags
private

Definition at line 5799 of file PlayerEntity.m.

5800{
5801 return alertFlags;
5802}

Referenced by alertFlags, clearAlertFlags, doBookkeeping:, dumpSelfState, massLocked, setAlertFlag:to:, and setUpAndConfirmOK:saveGame:.

◆ ANA_mode

◆ autopilot_engaged

◆ bomb_detonated

- (unsigned) bomb_detonated
private

Definition at line 743 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ cdrDetailArray

- (NSMutableArray*) cdrDetailArray
private

Definition at line 450 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ chart_centre_coordinates

- (NSPoint) chart_centre_coordinates
private

◆ chart_focus_coordinates

- (NSPoint) chart_focus_coordinates
private

◆ chart_zoom

◆ chosen_weapon_facing

- (OOWeaponFacing) chosen_weapon_facing
private

Definition at line 480 of file PlayerEntity.h.

Referenced by buySelectedItem, and setGuiToEquipShipScreen:selectingFacingFor:.

◆ commanderNameString

- (NSString*) commanderNameString
private

Definition at line 449 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ commLog

- (NSMutableArray *) commLog
private

Definition at line 5019 of file PlayerEntity.m.

5020{
5022
5023 if (commLog != nil)
5024 {
5025 NSUInteger count = [commLog count];
5027 {
5028 [commLog removeObjectsInRange:NSMakeRange(0, count - kCommLogTrimSize)];
5029 }
5030 }
5031 else
5032 {
5033 commLog = [[NSMutableArray alloc] init];
5034 }
5035
5036 return commLog;
5037}
@ kCommLogTrimSize
@ kCommLogTrimThreshold

Referenced by Universe::addCommsMessage:forCount:andShowComms:logOnly:, commanderDataDictionary, commLog, dealloc, setCommanderDataFromDictionary:, setUpAndConfirmOK:saveGame:, and Universe::setUpUniverseFromWitchspace.

◆ commodityScripts

- (NSMutableDictionary*) commodityScripts
private

Definition at line 382 of file PlayerEntity.h.

Referenced by commodityScriptNamed:, dealloc, and setUpAndConfirmOK:saveGame:.

◆ compassMode

◆ compassTarget

- (Entity *) compassTarget
private

Definition at line 5194 of file PlayerEntity.m.

5195{
5196 Entity *result = [compassTarget weakRefUnderlyingObject];
5197 if (result == nil)
5198 {
5200 return nil;
5201 }
5202 return result;
5203}

Referenced by compassTarget, compassTargetLabel, dealloc, PlayerShipGetProperty(), PlayerShipSetProperty(), setCommanderDataFromDictionary:, setCompassTarget:, setUpShipFromDictionary:, and validateCompassTarget.

◆ contract_record

- (NSMutableDictionary*) contract_record
private

Definition at line 418 of file PlayerEntity.h.

Referenced by dealloc, setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

◆ contracts

- (NSMutableArray*) contracts
private

◆ credits

◆ current_cargo

◆ currentPage

- (int) currentPage
private

Definition at line 451 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ cursor_coordinates

◆ custom_chart_centre_coordinates

- (NSPoint) custom_chart_centre_coordinates
private

◆ custom_chart_zoom

- (OOScalar) custom_chart_zoom
private

Definition at line 566 of file PlayerEntity.m.

567{
568 return custom_chart_zoom;
569}

Referenced by custom_chart_zoom, setCommanderDataFromDictionary:, and setCustomChartZoom:.

◆ customActivatePressed

- (NSMutableArray*) customActivatePressed
private

Definition at line 697 of file PlayerEntity.h.

Referenced by dealloc, and suppressClangStuff.

◆ customDialSettings

- (NSMutableDictionary*) customDialSettings
private

Definition at line 471 of file PlayerEntity.h.

Referenced by dealloc, setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

◆ customEquipActivation

- (NSMutableArray*) customEquipActivation
private

◆ customModePressed

- (NSMutableArray*) customModePressed
private

Definition at line 698 of file PlayerEntity.h.

Referenced by dealloc, and suppressClangStuff.

◆ customViewDescription

- (NSString *) customViewDescription
private

Definition at line 12621 of file PlayerEntity.m.

12622{
12623 return customViewDescription;
12624}

Referenced by customViewDescription, and setCustomViewDataFromDictionary:withScaling:.

◆ customViewForwardVector

◆ customViewMatrix

- (OOMatrix) customViewMatrix
private

◆ customViewOffset

◆ customViewQuaternion

◆ customViewRightVector

◆ customViewRotationCenter

◆ customViewUpVector

◆ demoShip

◆ dockingClearanceStatus

◆ dockingReport

- (NSMutableString*) dockingReport
private

◆ ecm_in_operation

- (unsigned) ecm_in_operation
private

Definition at line 757 of file PlayerEntity.h.

Referenced by doBookkeeping:, dumpSelfState, fireECM, and setUpAndConfirmOK:saveGame:.

◆ ecm_start_time

- (double) ecm_start_time
private

Definition at line 482 of file PlayerEntity.h.

Referenced by doBookkeeping:, and fireECM.

◆ eqScripts

◆ escape_pod_rescue_time

- (double) escape_pod_rescue_time
private

◆ extraGuiScreenKeys

- (NSMutableDictionary*) extraGuiScreenKeys
private

◆ extraMissionKeys

- (NSDictionary*) extraMissionKeys
private

Definition at line 701 of file PlayerEntity.h.

Referenced by clearExtraMissionKeys, and setExtraMissionKeys:.

◆ fieldOfView

- (double) fieldOfView
private

Definition at line 814 of file PlayerEntity.h.

Referenced by setUpAndConfirmOK:saveGame:.

◆ finished

- (unsigned) finished
private

Definition at line 742 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ fleeing_status

- (OOPlayerFleeingStatus) fleeing_status
private

Definition at line 489 of file PlayerEntity.h.

Referenced by fleeingStatus.

◆ forward_shield

◆ forward_shield_recharge_rate

- (GLfloat) forward_shield_recharge_rate
private

◆ forward_shot_time

- (OOTimeDelta) forward_shot_time
private

◆ forwardViewOffset

◆ found_equipment

- (BOOL) found_equipment
private

Definition at line 406 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ found_system_id

◆ fps_check_time

- (double) fps_check_time
private

Definition at line 438 of file PlayerEntity.h.

Referenced by setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

◆ fps_counter

- (int) fps_counter
private

Definition at line 439 of file PlayerEntity.h.

Referenced by dial_fpsinfo.

◆ fuel_leak_rate

- (GLfloat) fuel_leak_rate
private

◆ galactic_witchjump

- (unsigned) galactic_witchjump
private

Definition at line 755 of file PlayerEntity.h.

Referenced by dumpSelfState, leaveWitchspace, and setJumpType:.

◆ galacticHyperspaceBehaviour

- (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour
private

◆ galacticHyperspaceFixedCoords

- (NSPoint) galacticHyperspaceFixedCoords
private

Definition at line 13006 of file PlayerEntity.m.

13007{
13009}

Referenced by galacticHyperspaceFixedCoords, and setGalacticHyperspaceFixedCoordsX:y:.

◆ galaxy_coordinates

◆ galaxy_number

◆ game_over

- (unsigned) game_over
private

Definition at line 741 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ gui_screen

◆ hud

◆ hyperspeed_engaged

- (unsigned) hyperspeed_engaged
private

◆ hyperspeed_locked

- (unsigned) hyperspeed_locked
private

Definition at line 751 of file PlayerEntity.h.

Referenced by doBookkeeping:, docked, dumpSelfState, and enterDock:.

◆ hyperspeedFactor

- (GLfloat) hyperspeedFactor
private

Definition at line 3745 of file PlayerEntity.m.

3746{
3747 return hyperspeedFactor;
3748}

Referenced by hyperspeedFactor.

◆ ident_engaged

◆ info_system_id

◆ isSpeechOn

- (OOSpeechSettings) isSpeechOn
private

Definition at line 11530 of file PlayerEntity.m.

11531{
11532 return isSpeechOn;
11533}

Referenced by isSpeechOn, setCommanderDataFromDictionary:, setGuiToGameOptionsScreen, and setUpAndConfirmOK:saveGame:.

◆ kbdLayouts

- (NSArray*) kbdLayouts
private

Definition at line 790 of file PlayerEntity.h.

Referenced by dealloc, and suppressClangStuff.

◆ keyboardPitchOverride

- (unsigned) keyboardPitchOverride
private

Definition at line 769 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ keyboardRollOverride

- (unsigned) keyboardRollOverride
private

Definition at line 768 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ keyboardYawOverride

- (unsigned) keyboardYawOverride
private

Definition at line 770 of file PlayerEntity.h.

Referenced by dumpSelfState.

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

Referenced by dealloc, and keyConfig.

◆ keyFunctions

- (NSArray*) keyFunctions
private

Definition at line 789 of file PlayerEntity.h.

Referenced by dealloc, and suppressClangStuff.

◆ keyMod1Text

- (NSString*) keyMod1Text
private

Definition at line 792 of file PlayerEntity.h.

Referenced by dealloc.

◆ keyMod2Text

- (NSString*) keyMod2Text
private

Definition at line 793 of file PlayerEntity.h.

Referenced by dealloc.

◆ keyShiftText

- (NSString*) keyShiftText
private

Definition at line 791 of file PlayerEntity.h.

Referenced by dealloc.

◆ last_ecm_time

- (double) last_ecm_time
private

Definition at line 483 of file PlayerEntity.h.

Referenced by noticeECM, scannerFuzziness, and setUpAndConfirmOK:saveGame:.

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

Referenced by setUpAndConfirmOK:saveGame:.

◆ lastShot

- (NSArray*) lastShot
private

Definition at line 809 of file PlayerEntity.h.

Referenced by dealloc, doBookkeeping:, setLastShot:, and setUpAndConfirmOK:saveGame:.

◆ lastTextKey

- (NSString*) lastTextKey
private

◆ launchingMissile

- (unsigned) launchingMissile
private

Definition at line 775 of file PlayerEntity.h.

Referenced by assignToActivePylon:, fireMissile, and selectNextMissile.

◆ launchRoll

- (GLfloat) launchRoll
private

Definition at line 474 of file PlayerEntity.h.

Referenced by leaveDock:.

◆ legalStatus

◆ localVariables

- (NSMutableDictionary*) localVariables
private

Definition at line 384 of file PlayerEntity.h.

Referenced by dealloc, and setUpAndConfirmOK:saveGame:.

◆ longRangeChartMode

◆ market_rnd

◆ marketFilterMode

- (OOMarketFilterMode) marketFilterMode
private

◆ marketOffset

- (NSInteger) marketOffset
private

◆ marketSelectedCommodity

- (OOCommodityType) marketSelectedCommodity
private

◆ marketSorterMode

- (OOMarketSorterMode) marketSorterMode
private

Definition at line 458 of file PlayerEntity.h.

Referenced by applyMarketSorter:onMarket:, and setGuiToMarketScreen.

◆ massLockable

- (BOOL) massLockable
private

Definition at line 4465 of file PlayerEntity.m.

4466{
4467 return massLockable;
4468}

Referenced by massLockable, setMassLockable:, and setUpShipFromDictionary:.

◆ max_aft_shield

- (GLfloat) max_aft_shield
private

◆ max_forward_shield

- (GLfloat) max_forward_shield
private

◆ max_passengers

- (unsigned) max_passengers
private

◆ maxFieldOfView

- (double) maxFieldOfView
private

Definition at line 813 of file PlayerEntity.h.

Referenced by deferredInit.

◆ missile_entity

◆ missile_status

- (OOMissileStatus) missile_status
private

◆ mission_variables

- (NSMutableDictionary*) mission_variables
private

◆ missionChoice

- (NSString*) missionChoice
private

Definition at line 387 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ missionDestinations

◆ missionKeyPress

- (NSString*) missionKeyPress
private

Definition at line 388 of file PlayerEntity.h.

◆ missionTextRow

- (NSInteger) missionTextRow
private

Definition at line 386 of file PlayerEntity.h.

Referenced by setGuiToSystemDataScreenRefreshBackground:.

◆ mouse_control_on

- (unsigned) mouse_control_on
private

Definition at line 766 of file PlayerEntity.h.

Referenced by dumpSelfState, isMouseControlOn, and setUpAndConfirmOK:saveGame:.

◆ multiFunctionDisplaySettings

- (NSMutableArray*) multiFunctionDisplaySettings
private

◆ multiFunctionDisplayText

- (NSMutableDictionary*) multiFunctionDisplayText
private

Definition at line 468 of file PlayerEntity.h.

Referenced by dealloc, setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

◆ n_key_activate_equipment

- (NSArray*) n_key_activate_equipment
private

Definition at line 586 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_advanced_nav_array_next

- (NSArray*) n_key_advanced_nav_array_next
private

Definition at line 614 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_advanced_nav_array_previous

- (NSArray*) n_key_advanced_nav_array_previous
private

Definition at line 615 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_autodock

- (NSArray*) n_key_autodock
private

Definition at line 609 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_autopilot

- (NSArray*) n_key_autopilot
private

Definition at line 608 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_bloom_toggle

- (NSArray*) n_key_bloom_toggle
private

Definition at line 633 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_chart_highlight

- (NSArray*) n_key_chart_highlight
private

Definition at line 642 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_comms_log

- (NSArray*) n_key_comms_log
private

Definition at line 638 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view

- (NSArray*) n_key_custom_view
private

Definition at line 653 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_pan_down

- (NSArray*) n_key_custom_view_pan_down
private

Definition at line 663 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_pan_left

- (NSArray*) n_key_custom_view_pan_left
private

Definition at line 657 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_pan_right

- (NSArray*) n_key_custom_view_pan_right
private

Definition at line 659 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_pan_up

- (NSArray*) n_key_custom_view_pan_up
private

Definition at line 661 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_roll_left

- (NSArray*) n_key_custom_view_roll_left
private

Definition at line 656 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_roll_right

- (NSArray*) n_key_custom_view_roll_right
private

Definition at line 658 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_rotate_down

- (NSArray*) n_key_custom_view_rotate_down
private

Definition at line 662 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_rotate_left

- (NSArray*) n_key_custom_view_rotate_left
private

Definition at line 664 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_rotate_right

- (NSArray*) n_key_custom_view_rotate_right
private

Definition at line 665 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_rotate_up

- (NSArray*) n_key_custom_view_rotate_up
private

Definition at line 660 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_zoom_in

- (NSArray*) n_key_custom_view_zoom_in
private

Definition at line 655 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_custom_view_zoom_out

- (NSArray*) n_key_custom_view_zoom_out
private

Definition at line 654 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_cycle_next_mfd

- (NSArray*) n_key_cycle_next_mfd
private

Definition at line 670 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_cycle_previous_mfd

- (NSArray*) n_key_cycle_previous_mfd
private

Definition at line 671 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_debug_bounding_boxes

- (NSArray*) n_key_debug_bounding_boxes
private

Definition at line 690 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_debug_collision

- (NSArray*) n_key_debug_collision
private

Definition at line 688 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_debug_console_connect

- (NSArray*) n_key_debug_console_connect
private

Definition at line 689 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_debug_full

- (NSArray*) n_key_debug_full
private

Definition at line 687 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_debug_off

- (NSArray*) n_key_debug_off
private

Definition at line 692 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_debug_shaders

- (NSArray*) n_key_debug_shaders
private

Definition at line 691 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_decrease_speed

- (NSArray*) n_key_decrease_speed
private

Definition at line 576 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_docking_clearance_request

- (NSArray*) n_key_docking_clearance_request
private

Definition at line 667 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_docking_music

- (NSArray*) n_key_docking_music
private

Definition at line 612 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_dump_cargo

- (NSArray*) n_key_dump_cargo
private

Definition at line 605 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_dump_entity_list

- (NSArray*) n_key_dump_entity_list
private

Definition at line 686 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_dump_target_state

- (NSArray*) n_key_dump_target_state
private

Definition at line 685 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_ecm

- (NSArray*) n_key_ecm
private

Definition at line 582 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_fastactivate_equipment_a

- (NSArray*) n_key_fastactivate_equipment_a
private

Definition at line 588 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_fastactivate_equipment_b

- (NSArray*) n_key_fastactivate_equipment_b
private

Definition at line 589 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_fire_lasers

- (NSArray*) n_key_fire_lasers
private

Definition at line 579 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_galactic_hyperspace

- (NSArray*) n_key_galactic_hyperspace
private

Definition at line 601 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_arrow_down

- (NSArray*) n_key_gui_arrow_down
private

Definition at line 570 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_arrow_left

- (NSArray*) n_key_gui_arrow_left
private

Definition at line 567 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_arrow_right

- (NSArray*) n_key_gui_arrow_right
private

Definition at line 568 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_arrow_up

- (NSArray*) n_key_gui_arrow_up
private

Definition at line 569 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_chart_screens

- (NSArray*) n_key_gui_chart_screens
private

Definition at line 563 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_market

- (NSArray*) n_key_gui_market
private

Definition at line 565 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_page_down

- (NSArray*) n_key_gui_page_down
private

Definition at line 572 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_page_up

- (NSArray*) n_key_gui_page_up
private

Definition at line 571 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_screen_equipship

- (NSArray*) n_key_gui_screen_equipship
private

Definition at line 560 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_screen_interfaces

- (NSArray*) n_key_gui_screen_interfaces
private

Definition at line 561 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_screen_options

- (NSArray*) n_key_gui_screen_options
private

Definition at line 559 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_screen_status

- (NSArray*) n_key_gui_screen_status
private

Definition at line 562 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_select

- (NSArray*) n_key_gui_select
private

Definition at line 573 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_gui_system_data

- (NSArray*) n_key_gui_system_data
private

Definition at line 564 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_hud_toggle

- (NSArray*) n_key_hud_toggle
private

Definition at line 636 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_hyperspace

- (NSArray*) n_key_hyperspace
private

Definition at line 602 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_ident_system

- (NSArray*) n_key_ident_system
private

Definition at line 594 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_increase_speed

- (NSArray*) n_key_increase_speed
private

Definition at line 575 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_info_next_system

- (NSArray*) n_key_info_next_system
private

Definition at line 616 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_info_previous_system

- (NSArray*) n_key_info_previous_system
private

Definition at line 617 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_inject_fuel

- (NSArray*) n_key_inject_fuel
private

Definition at line 577 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_jumpdrive

- (NSArray*) n_key_jumpdrive
private

Definition at line 603 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_launch_escapepod

- (NSArray*) n_key_launch_escapepod
private

Definition at line 599 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_launch_missile

- (NSArray*) n_key_launch_missile
private

Definition at line 580 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_launch_ship

- (NSArray*) n_key_launch_ship
private

Definition at line 558 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_map_end

- (NSArray*) n_key_map_end
private

Definition at line 619 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_map_home

- (NSArray*) n_key_map_home
private

Definition at line 618 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_map_info

- (NSArray*) n_key_map_info
private

Definition at line 622 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_map_next_system

- (NSArray*) n_key_map_next_system
private

Definition at line 620 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_map_previous_system

- (NSArray*) n_key_map_previous_system
private

Definition at line 621 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_map_zoom_in

- (NSArray*) n_key_map_zoom_in
private

Definition at line 623 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_map_zoom_out

- (NSArray*) n_key_map_zoom_out
private

Definition at line 624 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_market_buy_max

- (NSArray*) n_key_market_buy_max
private

Definition at line 647 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_market_buy_one

- (NSArray*) n_key_market_buy_one
private

Definition at line 645 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_market_filter_cycle

- (NSArray*) n_key_market_filter_cycle
private

Definition at line 643 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_market_sell_max

- (NSArray*) n_key_market_sell_max
private

Definition at line 648 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_market_sell_one

- (NSArray*) n_key_market_sell_one
private

Definition at line 646 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_market_sorter_cycle

- (NSArray*) n_key_market_sorter_cycle
private

Definition at line 644 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_mode_equipment

- (NSArray*) n_key_mode_equipment
private

Definition at line 587 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_mouse_control_roll

- (NSArray*) n_key_mouse_control_roll
private

Definition at line 634 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_mouse_control_yaw

- (NSArray*) n_key_mouse_control_yaw
private

Definition at line 635 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_next_compass_mode

- (NSArray*) n_key_next_compass_mode
private

Definition at line 640 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_next_missile

- (NSArray*) n_key_next_missile
private

Definition at line 581 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_next_target

- (NSArray*) n_key_next_target
private

Definition at line 650 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_oxzmanager_extract

- (NSArray*) n_key_oxzmanager_extract
private

Definition at line 677 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_oxzmanager_setfilter

- (NSArray*) n_key_oxzmanager_setfilter
private

Definition at line 675 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_oxzmanager_showinfo

- (NSArray*) n_key_oxzmanager_showinfo
private

Definition at line 676 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_pausebutton

- (NSArray*) n_key_pausebutton
private

Definition at line 631 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_pitch_back

- (NSArray*) n_key_pitch_back
private

Definition at line 549 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_pitch_forward

- (NSArray*) n_key_pitch_forward
private

Definition at line 548 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_prev_compass_mode

- (NSArray*) n_key_prev_compass_mode
private

Definition at line 639 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_previous_target

- (NSArray*) n_key_previous_target
private

Definition at line 651 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_prime_next_equipment

- (NSArray*) n_key_prime_next_equipment
private

Definition at line 584 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_prime_previous_equipment

- (NSArray*) n_key_prime_previous_equipment
private

Definition at line 585 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_roll_left

- (NSArray*) n_key_roll_left
private

Definition at line 546 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_roll_right

- (NSArray*) n_key_roll_right
private

Definition at line 547 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_rotate_cargo

- (NSArray*) n_key_rotate_cargo
private

Definition at line 606 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_scanner_unzoom

- (NSArray*) n_key_scanner_unzoom
private

Definition at line 597 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_scanner_zoom

- (NSArray*) n_key_scanner_zoom
private

Definition at line 596 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_show_fps

- (NSArray*) n_key_show_fps
private

Definition at line 632 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_snapshot

- (NSArray*) n_key_snapshot
private

Definition at line 611 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_switch_next_mfd

- (NSArray*) n_key_switch_next_mfd
private

Definition at line 672 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_switch_previous_mfd

- (NSArray*) n_key_switch_previous_mfd
private

Definition at line 673 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_system_end

- (NSArray*) n_key_system_end
private

Definition at line 627 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_system_home

- (NSArray*) n_key_system_home
private

Definition at line 626 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_system_next_system

- (NSArray*) n_key_system_next_system
private

Definition at line 628 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_system_previous_system

- (NSArray*) n_key_system_previous_system
private

Definition at line 629 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_target_incoming_missile

- (NSArray*) n_key_target_incoming_missile
private

Definition at line 593 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_target_missile

- (NSArray*) n_key_target_missile
private

Definition at line 591 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_untarget_missile

- (NSArray*) n_key_untarget_missile
private

Definition at line 592 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_view_aft

- (NSArray*) n_key_view_aft
private

Definition at line 554 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_view_forward

- (NSArray*) n_key_view_forward
private

Definition at line 553 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_view_port

- (NSArray*) n_key_view_port
private

Definition at line 555 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_view_starboard

- (NSArray*) n_key_view_starboard
private

Definition at line 556 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_weapons_online_toggle

- (NSArray*) n_key_weapons_online_toggle
private

Definition at line 668 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_yaw_left

- (NSArray*) n_key_yaw_left
private

Definition at line 550 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ n_key_yaw_right

- (NSArray*) n_key_yaw_right
private

Definition at line 551 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ occlusion_dial

- (float) occlusion_dial
private

Definition at line 375 of file PlayerEntity.h.

Referenced by occlusionLevel, and setOcclusionLevel:.

◆ parcel_record

- (NSMutableDictionary*) parcel_record
private

Definition at line 415 of file PlayerEntity.h.

Referenced by dealloc, setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

◆ parcels

- (NSMutableArray*) parcels
private

◆ passenger_record

- (NSMutableDictionary*) passenger_record
private

Definition at line 412 of file PlayerEntity.h.

Referenced by dealloc, setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

◆ passengers

- (NSMutableArray*) passengers
private

◆ pitch_delta

- (GLfloat) pitch_delta
private

Definition at line 473 of file PlayerEntity.h.

Referenced by dumpSelfState, setMaxFlightPitch:, and setUpShipFromDictionary:.

◆ pitching

- (unsigned) pitching
private

Definition at line 763 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ planetSearchString

- (NSString*) planetSearchString
private

Definition at line 442 of file PlayerEntity.h.

Referenced by setGuiToChartScreenFrom:.

◆ playerRotMatrix

- (OOMatrix) playerRotMatrix
private

Definition at line 444 of file PlayerEntity.h.

Referenced by drawRotationMatrix, drawTransformationMatrix, and orientationChanged.

◆ pollControls

- (BOOL) pollControls
private

Definition at line 452 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ port_shot_time

- (OOTimeDelta) port_shot_time
private

◆ portViewOffset

- (Vector) portViewOffset
private

◆ previous_system_id

- (OOSystemID) previous_system_id
private

◆ primedEquipment

◆ replacingMissile

- (unsigned) replacingMissile
private

Definition at line 776 of file PlayerEntity.h.

Referenced by assignToActivePylon:, and fireMissile.

◆ reputation

- (NSMutableDictionary*) reputation
private

◆ roleSystemList

- (NSMutableArray*) roleSystemList
private

◆ roleWeightFlags

- (NSMutableDictionary*) roleWeightFlags
private

◆ roleWeights

- (NSMutableArray *) roleWeights
private

◆ roll_delta

- (GLfloat) roll_delta
private

Definition at line 473 of file PlayerEntity.h.

Referenced by dumpSelfState, setMaxFlightRoll:, and setUpShipFromDictionary:.

◆ rolling

- (unsigned) rolling
private

Definition at line 763 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ save_path

- (NSString*) save_path
private

Definition at line 706 of file PlayerEntity.h.

Referenced by dealloc, deferredInit, and setUpAndConfirmOK:saveGame:.

◆ saved_chart_zoom

- (OOScalar) saved_chart_zoom
private

Definition at line 510 of file PlayerEntity.h.

Referenced by setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

◆ scannedWormholes

- (NSArray *) scannedWormholes
private

Definition at line 13280 of file PlayerEntity.m.

13281{
13282 return [NSArray arrayWithArray:scannedWormholes];
13283}

Referenced by addScannedWormhole:, dealloc, scannedWormholes, setCommanderDataFromDictionary:, and setUpAndConfirmOK:saveGame:.

◆ scanner_zoom_rate

- (GLfloat) scanner_zoom_rate
private

Definition at line 719 of file PlayerEntity.h.

Referenced by doBookkeeping:, enterDock:, leaveDock:, and setUpAndConfirmOK:saveGame:.

◆ scenarioKey

- (NSString*) scenarioKey
private

Definition at line 707 of file PlayerEntity.h.

Referenced by commanderDataDictionary, dealloc, and endScenario:.

◆ scoopOverride

- (BOOL) scoopOverride
private

Definition at line 13029 of file PlayerEntity.m.

13030{
13031 return scoopOverride;
13032}

Referenced by scoopOverride, setScoopOverride:, and setUpAndConfirmOK:saveGame:.

◆ scoopsActive

- (unsigned) scoopsActive
private

◆ script_time

- (double) script_time
private

Definition at line 428 of file PlayerEntity.h.

Referenced by dumpSelfState, and setUpAndConfirmOK:saveGame:.

◆ script_time_check

- (double) script_time_check
private

Definition at line 429 of file PlayerEntity.h.

Referenced by dumpSelfState, and setUpAndConfirmOK:saveGame:.

◆ script_time_interval

- (double) script_time_interval
private

Definition at line 430 of file PlayerEntity.h.

Referenced by dumpSelfState, and setUpAndConfirmOK:saveGame:.

◆ selFunctionIdx

- (int) selFunctionIdx
private

Definition at line 787 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ ship_clock

- (double) ship_clock
private

◆ ship_clock_adjust

◆ ship_kills

◆ ship_trade_in_factor

◆ shipCommodityData

◆ shipyard_record

- (NSMutableDictionary*) shipyard_record
private

◆ show_info_flag

- (unsigned) show_info_flag
private

Definition at line 759 of file PlayerEntity.h.

Referenced by dumpSelfState, setUpAndConfirmOK:saveGame:, and showInfoFlag.

◆ showDemoShips

- (BOOL) showDemoShips
private

◆ showingLongRangeChart

- (BOOL) showingLongRangeChart
private

Definition at line 446 of file PlayerEntity.h.

Referenced by suppressClangStuff.

◆ specialCargo

◆ starboard_shot_time

- (OOTimeDelta) starboard_shot_time
private

◆ starboardViewOffset

- (Vector) starboardViewOffset
private

◆ stickFunctions

- (NSArray*) stickFunctions
private

Definition at line 788 of file PlayerEntity.h.

Referenced by dealloc, and suppressClangStuff.

◆ stickProfileScreen

- (StickProfileScreen*) stickProfileScreen
private

Definition at line 811 of file PlayerEntity.h.

Referenced by setUpAndConfirmOK:saveGame:.

◆ suppressTargetLost

- (void) suppressTargetLost
private

Definition at line 12250 of file PlayerEntity.m.

12251{
12252 suppressTargetLost = YES;
12253}

Referenced by dumpSelfState, getDestroyedBy:damageType:, setUpAndConfirmOK:saveGame:, and suppressTargetLost.

◆ system_id

◆ target_chart_centre

- (NSPoint) target_chart_centre
private

◆ target_chart_focus

- (NSPoint) target_chart_focus
private

◆ target_chart_zoom

- (OOScalar) target_chart_zoom
private

◆ target_memory

- (NSMutableArray*) target_memory
private

Definition at line 723 of file PlayerEntity.h.

Referenced by dealloc, setUpAndConfirmOK:saveGame:, and targetMemory.

◆ target_memory_index

- (NSUInteger) target_memory_index
private

Definition at line 724 of file PlayerEntity.h.

Referenced by addTarget:, clearTargetMemory, deferredInit, and moveTargetMemoryBy:.

◆ target_system_id

◆ targetDockStation

- (StationEntity*) targetDockStation
private

◆ travelling_at_hyperspeed

- (unsigned) travelling_at_hyperspeed
private

Definition at line 750 of file PlayerEntity.h.

Referenced by atHyperspeed, doBookkeeping:, and dumpSelfState.

◆ trumble

- (OOTrumble* trumble[PLAYER_MAX_TRUMBLES])
private

◆ trumbleCount

◆ using_mining_laser

- (unsigned) using_mining_laser
private

Definition at line 764 of file PlayerEntity.h.

Referenced by dumpSelfState, fireMainWeapon, and isMining.

◆ waitingForStickCallback

- (unsigned) waitingForStickCallback
private

Definition at line 771 of file PlayerEntity.h.

Referenced by dumpSelfState.

◆ weapons_online

- (unsigned) weapons_online
private

◆ witchspaceCountdown

- (OOTimeDelta) witchspaceCountdown
private

Definition at line 512 of file PlayerEntity.h.

Referenced by setWitchspaceCountdown:.

◆ worldScripts

- (NSDictionary*) worldScripts
private

◆ worldScriptsRequiringTickle

- (NSDictionary*) worldScriptsRequiringTickle
private

◆ wormhole

- (WormholeEntity *) wormhole
private

Definition at line 893 of file PlayerEntity.m.

894{
895 return wormhole;
896}

Referenced by dealloc, enterWitchspace, enterWormhole:, leaveWitchspace, setWormhole:, and wormhole.

◆ yaw_delta

- (GLfloat) yaw_delta
private

Definition at line 473 of file PlayerEntity.h.

Referenced by dumpSelfState, setMaxFlightYaw:, and setUpShipFromDictionary:.

◆ yawing

- (unsigned) yawing
private

Definition at line 763 of file PlayerEntity.h.

Referenced by dumpSelfState.


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