Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
PlayerEntity Class Reference

#include <PlayerEntity.h>

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

Instance Methods

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

Class Methods

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

Private Attributes

OOSystemID system_id
 
OOSystemID target_system_id
 
OOSystemID info_system_id
 
OOSystemID previous_system_id
 
float occlusion_dial
 
OOSystemID found_system_id
 
int ship_trade_in_factor
 
NSDictionary * worldScripts
 
NSDictionary * worldScriptsRequiringTickle
 
NSMutableDictionary * commodityScripts
 
NSMutableDictionary * mission_variables
 
NSMutableDictionary * localVariables
 
NSString * _missionTitle
 
NSInteger missionTextRow
 
NSString * missionChoice
 
NSString * missionKeyPress
 
BOOL _missionWithCallback
 
BOOL _missionAllowInterrupt
 
BOOL _missionTextEntry
 
OOGUIScreenID _missionExitScreen
 
NSString * specialCargo
 
NSMutableArray * commLog
 
NSMutableArray * eqScripts
 
NSDictionary * _missionOverlayDescriptor
 
NSDictionary * _missionBackgroundDescriptor
 
OOGUIBackgroundSpecial _missionBackgroundSpecial
 
NSDictionary * _equipScreenBackgroundDescriptor
 
NSString * _missionScreenID
 
BOOL found_equipment
 
NSMutableDictionary * reputation
 
unsigned max_passengers
 
NSMutableArray * passengers
 
NSMutableDictionary * passenger_record
 
NSMutableArray * parcels
 
NSMutableDictionary * parcel_record
 
NSMutableArray * contracts
 
NSMutableDictionary * contract_record
 
NSMutableDictionary * shipyard_record
 
NSMutableDictionary * missionDestinations
 
NSMutableArray * roleWeights
 
NSMutableDictionary * roleWeightFlags
 
NSMutableArray * roleSystemList
 
double script_time
 
double script_time_check
 
double script_time_interval
 
NSString * lastTextKey
 
double ship_clock
 
double ship_clock_adjust
 
double escape_pod_rescue_time
 
double fps_check_time
 
int fps_counter
 
double last_fps_check_time
 
NSString * planetSearchString
 
OOMatrix playerRotMatrix
 
BOOL showingLongRangeChart
 
NSString * commanderNameString
 
NSMutableArray * cdrDetailArray
 
int currentPage
 
BOOL pollControls
 
NSInteger marketOffset
 
OOCommodityType marketSelectedCommodity
 
OOMarketFilterMode marketFilterMode
 
OOMarketSorterMode marketSorterMode
 
OOWeakReference_dockedStation
 
StationEntitytargetDockStation
 
HeadUpDisplayhud
 
NSMutableDictionary * multiFunctionDisplayText
 
NSMutableArray * multiFunctionDisplaySettings
 
NSUInteger activeMFD
 
NSMutableDictionary * customDialSettings
 
GLfloat roll_delta
 
GLfloat pitch_delta
 
GLfloat yaw_delta
 
GLfloat launchRoll
 
GLfloat forward_shield
 
GLfloat aft_shield
 
GLfloat max_forward_shield
 
GLfloat max_aft_shield
 
GLfloat forward_shield_recharge_rate
 
GLfloat aft_shield_recharge_rate
 
OOTimeDelta forward_shot_time
 
OOTimeDelta aft_shot_time
 
OOTimeDelta port_shot_time
 
OOTimeDelta starboard_shot_time
 
OOWeaponFacing chosen_weapon_facing
 
double ecm_start_time
 
double last_ecm_time
 
OOGUIScreenID gui_screen
 
OOAlertFlags alertFlags
 
OOAlertCondition alertCondition
 
OOAlertCondition lastScriptAlertCondition
 
OOPlayerFleeingStatus fleeing_status
 
OOMissileStatus missile_status
 
NSUInteger activeMissile
 
NSUInteger primedEquipment
 
NSString * _fastEquipmentA
 
NSString * _fastEquipmentB
 
OOCargoQuantity current_cargo
 
NSPoint cursor_coordinates
 
NSPoint chart_focus_coordinates
 
NSPoint chart_centre_coordinates
 
NSPoint custom_chart_centre_coordinates
 
NSPoint target_chart_centre
 
NSPoint target_chart_focus
 
OOScalar chart_zoom
 
OOScalar custom_chart_zoom
 
OOScalar target_chart_zoom
 
OOScalar saved_chart_zoom
 
OORouteType ANA_mode
 
OOTimeDelta witchspaceCountdown
 
NSString * _jumpCause
 
NSString * _commanderName
 
NSString * _lastsaveName
 
NSPoint galaxy_coordinates
 
OOCreditsQuantity credits
 
OOGalaxyID galaxy_number
 
OOCommodityMarketshipCommodityData
 
ShipEntitymissile_entity [PLAYER_MAX_MISSILES]
 
OOUniversalID _dockTarget
 
int legalStatus
 
int market_rnd
 
unsigned ship_kills
 
OOCompassMode compassMode
 
OOWeakReferencecompassTarget
 
GLfloat fuel_leak_rate
 
GLfloat hyperspeedFactor
 
NSDictionary * keyconfig2_settings
 
NSDictionary * keyCodeLookups
 
NSArray * n_key_roll_left
 
NSArray * n_key_roll_right
 
NSArray * n_key_pitch_forward
 
NSArray * n_key_pitch_back
 
NSArray * n_key_yaw_left
 
NSArray * n_key_yaw_right
 
NSArray * n_key_view_forward
 
NSArray * n_key_view_aft
 
NSArray * n_key_view_port
 
NSArray * n_key_view_starboard
 
NSArray * n_key_launch_ship
 
NSArray * n_key_gui_screen_options
 
NSArray * n_key_gui_screen_equipship
 
NSArray * n_key_gui_screen_interfaces
 
NSArray * n_key_gui_screen_status
 
NSArray * n_key_gui_chart_screens
 
NSArray * n_key_gui_system_data
 
NSArray * n_key_gui_market
 
NSArray * n_key_gui_arrow_left
 
NSArray * n_key_gui_arrow_right
 
NSArray * n_key_gui_arrow_up
 
NSArray * n_key_gui_arrow_down
 
NSArray * n_key_gui_page_up
 
NSArray * n_key_gui_page_down
 
NSArray * n_key_gui_select
 
NSArray * n_key_increase_speed
 
NSArray * n_key_decrease_speed
 
NSArray * n_key_inject_fuel
 
NSArray * n_key_fire_lasers
 
NSArray * n_key_launch_missile
 
NSArray * n_key_next_missile
 
NSArray * n_key_ecm
 
NSArray * n_key_prime_next_equipment
 
NSArray * n_key_prime_previous_equipment
 
NSArray * n_key_activate_equipment
 
NSArray * n_key_mode_equipment
 
NSArray * n_key_fastactivate_equipment_a
 
NSArray * n_key_fastactivate_equipment_b
 
NSArray * n_key_target_missile
 
NSArray * n_key_untarget_missile
 
NSArray * n_key_target_incoming_missile
 
NSArray * n_key_ident_system
 
NSArray * n_key_scanner_zoom
 
NSArray * n_key_scanner_unzoom
 
NSArray * n_key_launch_escapepod
 
NSArray * n_key_galactic_hyperspace
 
NSArray * n_key_hyperspace
 
NSArray * n_key_jumpdrive
 
NSArray * n_key_dump_cargo
 
NSArray * n_key_rotate_cargo
 
NSArray * n_key_autopilot
 
NSArray * n_key_autodock
 
NSArray * n_key_snapshot
 
NSArray * n_key_docking_music
 
NSArray * n_key_advanced_nav_array_next
 
NSArray * n_key_advanced_nav_array_previous
 
NSArray * n_key_info_next_system
 
NSArray * n_key_info_previous_system
 
NSArray * n_key_map_home
 
NSArray * n_key_map_end
 
NSArray * n_key_map_next_system
 
NSArray * n_key_map_previous_system
 
NSArray * n_key_map_info
 
NSArray * n_key_map_zoom_in
 
NSArray * n_key_map_zoom_out
 
NSArray * n_key_system_home
 
NSArray * n_key_system_end
 
NSArray * n_key_system_next_system
 
NSArray * n_key_system_previous_system
 
NSArray * n_key_pausebutton
 
NSArray * n_key_show_fps
 
NSArray * n_key_bloom_toggle
 
NSArray * n_key_mouse_control_roll
 
NSArray * n_key_mouse_control_yaw
 
NSArray * n_key_hud_toggle
 
NSArray * n_key_comms_log
 
NSArray * n_key_prev_compass_mode
 
NSArray * n_key_next_compass_mode
 
NSArray * n_key_chart_highlight
 
NSArray * n_key_market_filter_cycle
 
NSArray * n_key_market_sorter_cycle
 
NSArray * n_key_market_buy_one
 
NSArray * n_key_market_sell_one
 
NSArray * n_key_market_buy_max
 
NSArray * n_key_market_sell_max
 
NSArray * n_key_next_target
 
NSArray * n_key_previous_target
 
NSArray * n_key_custom_view
 
NSArray * n_key_custom_view_zoom_out
 
NSArray * n_key_custom_view_zoom_in
 
NSArray * n_key_custom_view_roll_left
 
NSArray * n_key_custom_view_pan_left
 
NSArray * n_key_custom_view_roll_right
 
NSArray * n_key_custom_view_pan_right
 
NSArray * n_key_custom_view_rotate_up
 
NSArray * n_key_custom_view_pan_up
 
NSArray * n_key_custom_view_rotate_down
 
NSArray * n_key_custom_view_pan_down
 
NSArray * n_key_custom_view_rotate_left
 
NSArray * n_key_custom_view_rotate_right
 
NSArray * n_key_docking_clearance_request
 
NSArray * n_key_weapons_online_toggle
 
NSArray * n_key_cycle_next_mfd
 
NSArray * n_key_cycle_previous_mfd
 
NSArray * n_key_switch_next_mfd
 
NSArray * n_key_switch_previous_mfd
 
NSArray * n_key_oxzmanager_setfilter
 
NSArray * n_key_oxzmanager_showinfo
 
NSArray * n_key_oxzmanager_extract
 
NSArray * n_key_dump_target_state
 
NSArray * n_key_dump_entity_list
 
NSArray * n_key_debug_full
 
NSArray * n_key_debug_collision
 
NSArray * n_key_debug_console_connect
 
NSArray * n_key_debug_bounding_boxes
 
NSArray * n_key_debug_shaders
 
NSArray * n_key_debug_off
 
NSMutableArray * customEquipActivation
 
NSMutableArray * customActivatePressed
 
NSMutableArray * customModePressed
 
NSDictionary * extraMissionKeys
 
NSMutableDictionary * extraGuiScreenKeys
 
NSString * save_path
 
NSString * scenarioKey
 
Vector forwardViewOffset
 
Vector aftViewOffset
 
Vector portViewOffset
 
Vector starboardViewOffset
 
Vector _sysInfoLight
 
NSUInteger trumbleCount
 
OOTrumbletrumble [PLAYER_MAX_TRUMBLES]
 
float _trumbleAppetiteAccumulator
 
GLfloat scanner_zoom_rate
 
NSMutableArray * target_memory
 
NSUInteger target_memory_index
 
Quaternion customViewQuaternion
 
OOMatrix customViewMatrix
 
Vector customViewOffset
 
Vector customViewForwardVector
 
Vector customViewUpVector
 
Vector customViewRightVector
 
Vector customViewRotationCenter
 
NSString * customViewDescription
 
NSMutableString * dockingReport
 
unsigned suppressTargetLost: 1
 
unsigned scoopsActive: 1
 
unsigned scoopOverride: 1
 
unsigned game_over: 1
 
unsigned finished: 1
 
unsigned bomb_detonated: 1
 
unsigned autopilot_engaged: 1
 
unsigned afterburner_engaged: 1
 
unsigned afterburnerSoundLooping: 1
 
unsigned hyperspeed_engaged: 1
 
unsigned travelling_at_hyperspeed: 1
 
unsigned hyperspeed_locked: 1
 
unsigned ident_engaged: 1
 
unsigned galactic_witchjump: 1
 
unsigned ecm_in_operation: 1
 
unsigned show_info_flag: 1
 
unsigned showDemoShips: 1
 
unsigned rolling
 
unsigned pitching
 
unsigned yawing: 1
 
unsigned using_mining_laser: 1
 
unsigned mouse_control_on: 1
 
unsigned keyboardRollOverride: 1
 
unsigned keyboardPitchOverride: 1
 
unsigned keyboardYawOverride: 1
 
unsigned waitingForStickCallback: 1
 
unsigned weapons_online: 1
 
unsigned launchingMissile: 1
 
unsigned replacingMissile: 1
 
unsigned massLockable: 1
 
OOSpeechSettings isSpeechOn
 
int selFunctionIdx
 
NSArray * stickFunctions
 
NSArray * keyFunctions
 
NSArray * kbdLayouts
 
NSString * keyShiftText
 
NSString * keyMod1Text
 
NSString * keyMod2Text
 
OOGalacticHyperspaceBehaviour galacticHyperspaceBehaviour
 
NSPoint galacticHyperspaceFixedCoords
 
OOLongRangeChartMode longRangeChartMode
 
NSArray * _customViews
 
NSUInteger _customViewIndex
 
OODockingClearanceStatus dockingClearanceStatus
 
NSMutableArray * scannedWormholes
 
WormholeEntitywormhole
 
ShipEntitydemoShip
 
NSArray * lastShot
 
StickProfileScreenstickProfileScreen
 
double maxFieldOfView
 
double fieldOfView
 

Additional Inherited Members

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

Detailed Description

Definition at line 367 of file PlayerEntity.h.

Method Documentation

◆ activateCloakingDevice

- (BOOL) activateCloakingDevice

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

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

+ Here is the call graph for this function:

◆ activatePrimableEquipment:withMode:

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

Definition at line 13735 of file PlayerEntity.m.

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

◆ activateSelectedInterface

- (void) activateSelectedInterface

Definition at line 9247 of file PlayerEntity.m.

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

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

+ Here is the call graph for this function:

◆ activeMFD

- (NSUInteger) activeMFD

◆ activeMissile

- (NSUInteger) activeMissile

◆ add:

- (void) add: (NSString *) missionVariableString_value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addEqScriptForKey:

- (BOOL) addEqScriptForKey: (NSString *) eq_key

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addEquipmentFromCollection:

- (void) addEquipmentFromCollection: (id) equipment

Definition at line 9247 of file PlayerEntity.m.

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

◆ addEquipmentItem:inContext:

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

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

11545 :(NSString *)equipmentKey inContext:(NSString *)context
11546{
11547 return [self addEquipmentItem:equipmentKey withValidation:YES inContext:context];
11548}

◆ addEquipmentItem:withValidation:inContext:

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

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

Referenced by ShipAwardEquipment().

+ Here is the caller graph for this function:

◆ addEquipmentWithScriptToCustomKeyArray:

- (void) addEquipmentWithScriptToCustomKeyArray: (NSString *) equipmentKey

Definition at line 9247 of file PlayerEntity.m.

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

◆ addLiteralMissionText:

- (void) addLiteralMissionText: (NSString *) text

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionAddMessageText(), and MissionRunScreen().

+ Here is the caller graph for this function:

◆ addMessageToReport:

- (void) addMessageToReport: (NSString*) report

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

Referenced by PlayerAddMessageToArrivalReport().

+ Here is the caller graph for this function:

◆ addMissionDestination:

- (void) addMissionDestination: (NSString *) destinations

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addMissionDestinationMarker:

- (void) addMissionDestinationMarker: (NSDictionary *) marker

Definition at line 9247 of file PlayerEntity.m.

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

Referenced by MissionMarkSystem().

+ Here is the caller graph for this function:

◆ addMissionText:

- (void) addMissionText: (NSString *) textKey

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ addMoon:

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

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

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

Referenced by PlayerShipAddParcel().

+ Here is the caller graph for this function:

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

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

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

Referenced by PlayerShipAddPassenger().

+ Here is the caller graph for this function:

◆ addPlanet:

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

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by SystemAddPlanet().

+ Here is the caller graph for this function:

◆ addRoleForAggression:

- (void) addRoleForAggression: (ShipEntity *) victim

Definition at line 13735 of file PlayerEntity.m.

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

◆ addRoleForMining

- (void) addRoleForMining

Definition at line 13735 of file PlayerEntity.m.

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

◆ addRoleToPlayer:

- (void) addRoleToPlayer: (NSString *) role

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerSetPlayerRole().

+ Here is the caller graph for this function:

◆ addRoleToPlayer:inSlot:

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

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerSetPlayerRole().

+ Here is the caller graph for this function:

◆ addScannedWormhole:

- (void) addScannedWormhole: (WormholeEntity*) wormhole

Definition at line 9247 of file PlayerEntity.m.

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

◆ addScenarioModel:

- (void) addScenarioModel: (NSString *) shipKey

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ addScene:atOffset:

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

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addShips:

- (void) addShips: (NSString *) roles_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addShipsAt:

- (void) addShipsAt: (NSString *) roles_number_system_x_y_z

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by SystemLegacyAddShipsAt().

+ Here is the caller graph for this function:

◆ addShipsAtPrecisely:

- (void) addShipsAtPrecisely: (NSString *) roles_number_system_x_y_z

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by SystemLegacyAddShipsAtPrecisely().

+ Here is the caller graph for this function:

◆ addShipsWithinRadius:

- (void) addShipsWithinRadius: (NSString *) roles_number_system_x_y_z_r

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by SystemLegacyAddShipsWithinRadius().

+ Here is the caller graph for this function:

◆ addSystemShips:

- (void) addSystemShips: (NSString *) roles_number_position

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ addTarget:

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

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ addToAdjustTime:

- (void) addToAdjustTime: (double) seconds

Definition at line 13735 of file PlayerEntity.m.

4899 :(double)seconds
4900{
4901 ship_clock_adjust += seconds;
4902}
double ship_clock_adjust

Referenced by PlayerSetEscapePodDestination().

+ Here is the caller graph for this function:

◆ addTrumble:

- (void) addTrumble: (OOTrumble *) papaTrumble

Definition at line 9247 of file PlayerEntity.m.

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

◆ adjusted_chart_centre

- (NSPoint) adjusted_chart_centre

Definition at line 13735 of file PlayerEntity.m.

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

◆ adjustPriceByScriptForEqKey:withCurrent:

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

Definition at line 9247 of file PlayerEntity.m.

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

◆ adjustTradeInFactorBy:

- (void) adjustTradeInFactorBy: (int) value

Definition at line 9247 of file PlayerEntity.m.

11911 :(int)value
11912{
11913 ship_trade_in_factor += value;
11916}
int ship_trade_in_factor
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ aftShieldLevel

- (GLfloat) aftShieldLevel

Definition at line 13735 of file PlayerEntity.m.

4697{
4698 return aft_shield;
4699}
GLfloat aft_shield

◆ aftShieldRechargeRate

- (float) aftShieldRechargeRate

Definition at line 13735 of file PlayerEntity.m.

4661{
4663}
GLfloat aft_shield_recharge_rate

◆ alertCondition

- (OOAlertCondition) alertCondition

Reimplemented from ShipEntity.

◆ alertFlags

- (int) alertFlags

◆ allowMissionInterrupt

- (void) allowMissionInterrupt

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

237{
238 _missionAllowInterrupt = YES;
239}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ ANAMode

- (OORouteType) ANAMode

Definition at line 13735 of file PlayerEntity.m.

679{
680 return ANA_mode;
681}
OORouteType ANA_mode

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ applyAttitudeChanges:

- (void) applyAttitudeChanges: (double) delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4278 :(double) delta_t
4279{
4280 [self applyRoll:flightRoll*delta_t andClimb:flightPitch*delta_t];
4281 [self applyYaw:flightYaw*delta_t];
4282}

◆ applyMarketFilter:onMarket:

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

Definition at line 9247 of file PlayerEntity.m.

10861 :(NSArray *)goods onMarket:(OOCommodityMarket *)market
10862{
10864 {
10865 return goods;
10866 }
10867 NSMutableArray *filteredGoods = [NSMutableArray arrayWithCapacity:[goods count]];
10868 OOCommodityType good = nil;
10869 foreach (good, goods)
10870 {
10871 switch (marketFilterMode)
10872 {
10874 // never reached, but keeps compiler happy
10875 [filteredGoods addObject:good];
10876 break;
10878 if ([market quantityForGood:good] > 0 || [self cargoQuantityForType:good] > 0)
10879 {
10880 [filteredGoods addObject:good];
10881 }
10882 break;
10884 if ([self cargoQuantityForType:good] > 0)
10885 {
10886 [filteredGoods addObject:good];
10887 }
10888 break;
10890 if ([market quantityForGood:good] > 0)
10891 {
10892 [filteredGoods addObject:good];
10893 }
10894 break;
10896 if ([market exportLegalityForGood:good] == 0 && [market importLegalityForGood:good] == 0)
10897 {
10898 [filteredGoods addObject:good];
10899 }
10900 break;
10902 if ([market exportLegalityForGood:good] > 0 || [market importLegalityForGood:good] > 0)
10903 {
10904 [filteredGoods addObject:good];
10905 }
10906 break;
10907 }
10908 }
10909 return [[filteredGoods copy] autorelease];
10910}
NSString * OOCommodityType
Definition OOTypes.h:106
@ MARKET_FILTER_MODE_HOLD
@ MARKET_FILTER_MODE_RESTRICTED
@ MARKET_FILTER_MODE_STOCK
@ MARKET_FILTER_MODE_TRADE
@ MARKET_FILTER_MODE_OFF
@ MARKET_FILTER_MODE_LEGAL
OOMarketFilterMode marketFilterMode

◆ applyMarketSorter:onMarket:

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

Definition at line 9247 of file PlayerEntity.m.

10913 :(NSArray *)goods onMarket:(OOCommodityMarket *)market
10914{
10915 switch (marketSorterMode)
10916 {
10918 return [goods sortedArrayUsingFunction:marketSorterByName context:market];
10920 return [goods sortedArrayUsingFunction:marketSorterByPrice context:market];
10922 return [goods sortedArrayUsingFunction:marketSorterByQuantity context:market];
10924 return [goods sortedArrayUsingFunction:marketSorterByQuantity context:shipCommodityData];
10926 return [goods sortedArrayUsingFunction:marketSorterByMassUnit context:market];
10928 // keep default sort order
10929 break;
10930 }
10931 return goods;
10932}
@ MARKET_SORTER_MODE_PRICE
@ MARKET_SORTER_MODE_OFF
@ MARKET_SORTER_MODE_STOCK
@ MARKET_SORTER_MODE_ALPHA
@ MARKET_SORTER_MODE_UNIT
@ MARKET_SORTER_MODE_HOLD
OOMarketSorterMode marketSorterMode

◆ applyRoll:andClimb:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4285 :(GLfloat) roll1 andClimb:(GLfloat) climb1
4286{
4287 if (roll1 == 0.0 && climb1 == 0.0 && hasRotated == NO)
4288 return;
4289
4290 if (roll1)
4292 if (climb1)
4294
4295 /* Bugginess may put us in a state where the orientation quat is all
4296 zeros, at which point it’s impossible to move.
4297 */
4298 if (EXPECT_NOT(quaternion_equal(orientation, kZeroQuaternion)))
4299 {
4300 if (!quaternion_equal(lastOrientation, kZeroQuaternion))
4301 {
4303 }
4304 else
4305 {
4307 }
4308 }
4309
4310 [self orientationChanged];
4311}
#define EXPECT_NOT(x)
void quaternion_rotate_about_x(Quaternion *quat, OOScalar angle)
void quaternion_rotate_about_z(Quaternion *quat, OOScalar angle)
const Quaternion kIdentityQuaternion
const Quaternion kZeroQuaternion
unsigned hasRotated
Definition Entity.h:97
Quaternion orientation
Definition Entity.h:114
Quaternion lastOrientation
Definition Entity.h:134

◆ applyYaw:

- (void) applyYaw: (GLfloat) yaw

Definition at line 13735 of file PlayerEntity.m.

4318 :(GLfloat) yaw
4319{
4321
4322 [self orientationChanged];
4323}
void quaternion_rotate_about_y(Quaternion *quat, OOScalar angle)

◆ assignToActivePylon:

- (BOOL) assignToActivePylon: (NSString *) identifierKey

Definition at line 13735 of file PlayerEntity.m.

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

◆ atHyperspeed

- (BOOL) atHyperspeed

Definition at line 13735 of file PlayerEntity.m.

4475{
4477}
unsigned travelling_at_hyperspeed

◆ autosavePlayer

- (void) autosavePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ availableFacings

- (OOWeaponFacingSet) availableFacings

Definition at line 9247 of file PlayerEntity.m.

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

◆ awardCargo:

- (void) awardCargo: (NSString *) amount_typeString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ awardCommodityType:amount:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

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

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

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

Referenced by PlayerShipAwardContract().

+ Here is the caller graph for this function:

◆ awardCredits:

- (void) awardCredits: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ awardEquipment:

- (void) awardEquipment: (NSString *) equipString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ awardFuel:

- (void) awardFuel: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ awardShipKills:

- (void) awardShipKills: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ baseMass

- (GLfloat) baseMass

Definition at line 13735 of file PlayerEntity.m.

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

◆ beginWitchspaceCountdown

- (void) beginWitchspaceCountdown

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ beginWitchspaceCountdown:

- (void) beginWitchspaceCountdown: (int) spin_time

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

Referenced by PlayerShipBeginHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ blowUpStation

- (void) blowUpStation

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ boop

- (void) boop
implementation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ bounty

- (OOCreditsQuantity) bounty
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6822{
6823 return legalStatus;
6824}

◆ breakPatternPosition

- (HPVector) breakPatternPosition

Definition at line 13735 of file PlayerEntity.m.

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

◆ buySelectedItem

- (void) buySelectedItem

Definition at line 9247 of file PlayerEntity.m.

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

◆ buySelectedShip

- (BOOL) buySelectedShip

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

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

◆ calculateCurrentCargo

- (void) calculateCurrentCargo

Definition at line 9247 of file PlayerEntity.m.

10786{
10787 current_cargo = [self cargoQuantityOnBoard];
10788}
OOCargoQuantity current_cargo

◆ canAddEquipment:inContext:

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

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ cancelDockingRequest:

- (void) cancelDockingRequest: (StationEntity *) stationForDocking

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerShipCancelDockingRequest().

+ Here is the caller graph for this function:

◆ cancelWitchspaceCountdown

- (void) cancelWitchspaceCountdown

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

Referenced by PlayerShipCancelHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ canScoop:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4978 :(ShipEntity *)other
4979{
4980 if (specialCargo) return NO;
4981 return [super canScoop:other];
4982}
NSString * specialCargo

◆ cargoContractMarker:

- (NSDictionary *) cargoContractMarker: (OOSystemID) system

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ cargoList

- (NSArray *) cargoList

Definition at line 13735 of file PlayerEntity.m.

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

◆ cargoListForScripting

- (NSArray *) cargoListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by ManifestGetProperty().

+ Here is the caller graph for this function:

◆ cargoQuantityForType:

- (OOCargoQuantity) cargoQuantityForType: (OOCommodityType) type

Definition at line 9247 of file PlayerEntity.m.

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

◆ cargoQuantityOnBoard

- (OOCargoQuantity) cargoQuantityOnBoard
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ changePassengerBerths:

- (BOOL) changePassengerBerths: (int) addRemove

Definition at line 9247 of file PlayerEntity.m.

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

Referenced by ShipAwardEquipment().

+ Here is the caller graph for this function:

◆ chart_centre_coordinates

- (NSPoint) chart_centre_coordinates

◆ chart_zoom

- (OOScalar) chart_zoom

◆ checkCustomEquipButtons:ignore:

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

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ checkEntityForMassLock:withScanClass:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ checkForShips:

- (void) checkForShips: (NSString *) roleString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ checkKeyPress:

- (BOOL) checkKeyPress: (NSArray*) key_def

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ checkKeyPress:fKey_only:

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

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ checkKeyPress:fKey_only:ignore_ctrl:

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

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ checkKeyPress:ignore_ctrl:

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

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ checkNavKeyPress:

- (BOOL) checkNavKeyPress: (NSArray*) key_def

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ checkPassengerContracts

- (NSString *) checkPassengerContracts

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ checkScript

- (void) checkScript

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ checkScriptsIfAppropriate

- (void) checkScriptsIfAppropriate
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ clearAlertFlags

- (void) clearAlertFlags

Definition at line 13735 of file PlayerEntity.m.

5791{
5792 alertFlags = 0;
5793}
OOAlertFlags alertFlags

◆ clearedToDock

- (BOOL) clearedToDock

Definition at line 9247 of file PlayerEntity.m.

◆ clearExtraGuiScreenKeys:key:

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

Definition at line 9247 of file PlayerEntity.m.

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

Referenced by GlobalClearExtraGuiScreenKeys().

+ Here is the caller graph for this function:

◆ clearExtraMissionKeys

- (void) clearExtraMissionKeys

Definition at line 9247 of file PlayerEntity.m.

13375{
13376 [extraMissionKeys release];
13378}
NSDictionary * extraMissionKeys

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ clearMissionDescription

- (void) clearMissionDescription

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clearMissionDescriptionForMission:

- (void) clearMissionDescriptionForMission: (NSString *) key

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ clearMissionScreen

- (void) clearMissionScreen

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clearMissionScreenID

- (void) clearMissionScreenID

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ clearPlanetSearchString

- (void) clearPlanetSearchString

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ clearRoleFromPlayer:

- (void) clearRoleFromPlayer: (BOOL) includingLongRange

Definition at line 13735 of file PlayerEntity.m.

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

◆ clearRolesFromPlayer:

- (void) clearRolesFromPlayer: (float) chance

Definition at line 13735 of file PlayerEntity.m.

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

◆ clearTargetMemory

- (void) clearTargetMemory

Definition at line 9247 of file PlayerEntity.m.

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

◆ clock_days_number

- (NSNumber *) clock_days_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clock_hours_number

- (NSNumber *) clock_hours_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clock_mins_number

- (NSNumber *) clock_mins_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clock_number

- (NSNumber *) clock_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clock_secs_number

- (NSNumber *) clock_secs_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ clockAdjusting

- (BOOL) clockAdjusting

Definition at line 13735 of file PlayerEntity.m.

4894{
4895 return ship_clock_adjust > 0;
4896}

◆ clockTime

- (double) clockTime

Definition at line 13735 of file PlayerEntity.m.

4882{
4883 return ship_clock;
4884}
double ship_clock

Referenced by ClockGetProperty().

+ Here is the caller graph for this function:

◆ clockTimeAdjusted

- (double) clockTimeAdjusted

Definition at line 13735 of file PlayerEntity.m.

4888{
4890}

Referenced by HeadUpDisplay::hudDrawReticleOnTarget.

+ Here is the caller graph for this function:

◆ collectBountyFor:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ commanderBountyAsString

- (NSString *) commanderBountyAsString

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ commanderDataDictionary

- (NSDictionary *) commanderDataDictionary

Definition at line 13735 of file PlayerEntity.m.

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

◆ commanderKillsAsString

- (NSString *) commanderKillsAsString

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ commanderLegalStatus_number

- (NSNumber *) commanderLegalStatus_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ commanderLegalStatus_string

- (NSString *) commanderLegalStatus_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ commanderName

- (NSString *) commanderName

Definition at line 9247 of file PlayerEntity.m.

13081{
13082 return _commanderName;
13083}
NSString * _commanderName

Referenced by PlayerGetProperty().

+ Here is the caller graph for this function:

◆ commanderName_string

- (NSString *) commanderName_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1156{
1157 return [self commanderName];
1158}

◆ commanderRank_string

- (NSString *) commanderRank_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ commanderSelector

- (NSString *) commanderSelector

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ commanderShip_string

- (NSString *) commanderShip_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1168{
1169 return [self name];
1170}

◆ commanderShipDisplayName_string

- (NSString *) commanderShipDisplayName_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1174{
1175 return [self displayName];
1176}

◆ commLog

- (NSMutableArray *) commLog

◆ commodityScriptNamed:

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

Definition at line 9247 of file PlayerEntity.m.

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

◆ commsMessage:

- (void) commsMessage: (NSString *) valueString

Reimplemented from ShipEntity.

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ commsMessageByUnpiloted:

- (void) commsMessageByUnpiloted: (NSString *) valueString

Reimplemented from ShipEntity.

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ compareKeyEntries:second:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ compareZeroDistance:

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

Reimplemented from Entity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ compassMode

- (OOCompassMode) compassMode

◆ compassTarget

- (Entity *) compassTarget

◆ compassTargetLabel

- (NSString *) compassTargetLabel

Definition at line 13735 of file PlayerEntity.m.

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

◆ completeSetUp

- (void) completeSetUp

Definition at line 13735 of file PlayerEntity.m.

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

◆ completeSetUpAndSetTarget:

- (void) completeSetUpAndSetTarget: (BOOL) setTarget

Definition at line 13735 of file PlayerEntity.m.

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

◆ consoleMessage3s:

- (void) consoleMessage3s: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ consoleMessage6s:

- (void) consoleMessage6s: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ contractedVolumeForGood:

- (OOCargoQuantity) contractedVolumeForGood: (OOCommodityType) good

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ contractList

- (NSArray *) contractList

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ contractListForScripting

- (NSArray *) contractListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

8489{
8490 return [self contractsListForScriptingFromArray:contracts forCargo:YES];
8491}

◆ contractReputation

- (int) contractReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ contractsListForScriptingFromArray:forCargo:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ contractsListFromArray:forCargo:forParcels:

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

Provided by category PlayerEntity(ContractsPrivate).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ countMissiles

- (unsigned) countMissiles

Definition at line 13735 of file PlayerEntity.m.

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

◆ createCargoPodWithType:andAmount:

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

Definition at line 13735 of file PlayerEntity.m.

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

◆ createDoppelganger

- (ProxyPlayerEntity *) createDoppelganger
implementation

Definition at line 13735 of file PlayerEntity.m.

6573{
6574 ProxyPlayerEntity *result = (ProxyPlayerEntity *)[[UNIVERSE newShipWithName:[self shipDataKey] usePlayerProxy:YES] autorelease];
6575
6576 if (result != nil)
6577 {
6578 [result setPosition:[self position]];
6579 [result setScanClass:CLASS_NEUTRAL];
6580 [result setOrientation:[self normalOrientation]];
6581 [result setVelocity:[self velocity]];
6582 [result setSpeed:[self flightSpeed]];
6583 [result setDesiredSpeed:[self flightSpeed]];
6584 [result setRoll:flightRoll];
6585 [result setBehaviour:BEHAVIOUR_IDLE];
6586 [result switchAITo:@"nullAI.plist"]; // fly straight on
6587 [result setTemperature:[self temperature]];
6588 [result copyValuesFromPlayer:self];
6589 }
6590
6591 return result;
6592}
void setVelocity:(Vector vel)
Definition Entity.m:757
void setOrientation:(Quaternion quat)
Definition Entity.m:725
void setPosition:(HPVector posn)
Definition Entity.m:647
void copyValuesFromPlayer:(PlayerEntity *player)
void setDesiredSpeed:(double amount)
void setRoll:(double amount)
void setSpeed:(double amount)
void setTemperature:(GLfloat value)
void setBehaviour:(OOBehaviour cond)
void switchAITo:(NSString *aiString)

◆ creditBalance

- (double) creditBalance

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

53{
54 return 0.1 * credits;
55}

◆ credits_number

- (NSNumber *) credits_number

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ creditsFormattedForLegacySubstitution

- (NSString *) creditsFormattedForLegacySubstitution

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ creditsFormattedForSubstitution

- (NSString *) creditsFormattedForSubstitution

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ currentGalaxyID

- (OOGalaxyID) currentGalaxyID

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

179{
180 return galaxy_number;
181}

Referenced by SystemSetProperty(), and SystemToString().

+ Here is the caller graph for this function:

◆ currentLaserOffset

- (NSArray *) currentLaserOffset

Definition at line 13735 of file PlayerEntity.m.

6180{
6181 return [self laserPortOffset:currentWeaponFacing];
6182}

◆ currentPrimedEquipment

- (NSString *) currentPrimedEquipment

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ CurrentScriptDesc(void)

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

Provided by category PlayerEntity(Scripting).

Definition at line 129 of file PlayerEntityLegacyScriptEngine.m.

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

◆ CurrentScriptNameOr

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

Provided by category PlayerEntity(Scripting).

Definition at line 119 of file PlayerEntityLegacyScriptEngine.m.

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

◆ currentSystemID

- (OOSystemID) currentSystemID

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

Referenced by SystemSetProperty(), and SystemToString().

+ Here is the caller graph for this function:

◆ currentWeapon

- (OOWeaponType) currentWeapon

Definition at line 13735 of file PlayerEntity.m.

6298{
6299 return [self weaponForFacing:currentWeaponFacing];
6300}

◆ currentWeaponStats

- (void) currentWeaponStats

Definition at line 13735 of file PlayerEntity.m.

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

◆ cursor_coordinates

- (NSPoint) cursor_coordinates

◆ custom_chart_centre_coordinates

- (NSPoint) custom_chart_centre_coordinates

◆ custom_chart_zoom

- (OOScalar) custom_chart_zoom

◆ customEquipmentActivation

- (NSMutableArray *) customEquipmentActivation

Definition at line 9247 of file PlayerEntity.m.

11588{
11589 return customEquipActivation;
11590}
NSMutableArray * customEquipActivation

◆ customViewDescription

- (NSString *) customViewDescription

◆ customViewForwardVector

- (Vector) customViewForwardVector

◆ customViewMatrix

- (OOMatrix) customViewMatrix

◆ customViewOffset

- (Vector) customViewOffset

◆ customViewPanDown:

- (void) customViewPanDown: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

12576 :(OOScalar) angle
12577{
12579 [self setCustomViewData];
12580 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12581}
GLfloat OOScalar
Definition OOMaths.h:64
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle)
Quaternion customViewQuaternion
Vector customViewRightVector
Vector customViewOffset
Vector customViewForwardVector
Vector customViewRotationCenter

◆ customViewPanLeft:

- (void) customViewPanLeft: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

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

◆ customViewPanRight:

- (void) customViewPanRight: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

12592 :(OOScalar) angle
12593{
12595 [self setCustomViewData];
12596 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12597}

◆ customViewPanUp:

- (void) customViewPanUp: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

12568 :(OOScalar) angle
12569{
12571 [self setCustomViewData];
12572 customViewRotationCenter = vector_subtract(customViewOffset, vector_multiply_scalar(customViewForwardVector, dot_product(customViewOffset, customViewForwardVector)));
12573}

◆ customViewQuaternion

- (Quaternion) customViewQuaternion

◆ customViewRightVector

- (Vector) customViewRightVector

◆ customViewRollLeft:

- (void) customViewRollLeft: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

12556 :(OOScalar) angle
12557{
12559 OOScalar m = magnitude(customViewOffset);
12561 [self setCustomViewData];
12563 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12565}

◆ customViewRollRight:

- (void) customViewRollRight: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

12544 :(OOScalar) angle
12545{
12547 OOScalar m = magnitude(customViewOffset);
12549 [self setCustomViewData];
12551 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12553}

◆ customViewRotateDown:

- (void) customViewRotateDown: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

12532 :(OOScalar) angle
12533{
12535 OOScalar m = magnitude(customViewOffset);
12537 [self setCustomViewData];
12539 scale_vector(&customViewOffset, m / magnitude(customViewOffset));
12541}

◆ customViewRotateLeft:

- (void) customViewRotateLeft: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

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

◆ customViewRotateRight:

- (void) customViewRotateRight: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

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

◆ customViewRotateUp:

- (void) customViewRotateUp: (OOScalar) angle

Definition at line 9247 of file PlayerEntity.m.

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

◆ customViewRotationCenter

- (Vector) customViewRotationCenter

◆ customViewUpVector

- (Vector) customViewUpVector

◆ customViewZoomIn:

- (void) customViewZoomIn: (OOScalar) rate

Definition at line 9247 of file PlayerEntity.m.

12470 :(OOScalar) rate
12471{
12473 customViewOffset = vector_multiply_scalar(customViewOffset, 1.0/rate);
12474 OOScalar m = magnitude(customViewOffset);
12476 {
12478 }
12480}
#define CUSTOM_VIEW_MAX_ZOOM_IN

◆ customViewZoomOut:

- (void) customViewZoomOut: (OOScalar) rate

Definition at line 9247 of file PlayerEntity.m.

12483 :(OOScalar) rate
12484{
12486 customViewOffset = vector_multiply_scalar(customViewOffset, rate);
12487 OOScalar m = magnitude(customViewOffset);
12489 {
12491 }
12493}
#define CUSTOM_VIEW_MAX_ZOOM_OUT

◆ cycleNextMultiFunctionDisplay:

- (void) cycleNextMultiFunctionDisplay: (NSUInteger) index

Definition at line 13735 of file PlayerEntity.m.

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

◆ cyclePreviousMultiFunctionDisplay:

- (void) cyclePreviousMultiFunctionDisplay: (NSUInteger) index

Definition at line 13735 of file PlayerEntity.m.

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

◆ d100_number

- (NSNumber *) d100_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ d256_number

- (NSNumber *) d256_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ deactivateCloakingDevice

- (void) deactivateCloakingDevice

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ dealloc

- (void) dealloc
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

2377{
2379 DESTROY(hud);
2383
2387
2390
2396
2398
2400
2414
2418
2422
2424
2427
2430
2432
2434
2435 [self destroySound];
2436
2439
2440 int i;
2441 for (i = 0; i < PLAYER_MAX_MISSILES; i++) DESTROY(missile_entity[i]);
2442 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++) DESTROY(trumble[i]);
2443
2450
2454
2456
2457 [super dealloc];
2458}
#define DESTROY(x)
Definition OOCocoa.h:77
#define PLAYER_MAX_MISSILES
NSMutableDictionary * roleWeightFlags
NSMutableDictionary * passenger_record
NSString * _jumpCause
NSDictionary * keyconfig2_settings
NSMutableDictionary * missionDestinations
NSMutableArray * parcels
NSArray * kbdLayouts
NSMutableArray * contracts
NSArray * _customViews
NSMutableDictionary * localVariables
NSString * keyShiftText
NSMutableDictionary * customDialSettings
OOWeakReference * compassTarget
NSDictionary * _missionOverlayDescriptor
NSString * _fastEquipmentB
NSMutableArray * roleSystemList
NSMutableDictionary * contract_record
NSMutableString * dockingReport
NSString * _lastsaveName
NSMutableArray * target_memory
NSMutableArray * passengers
NSMutableDictionary * reputation
NSArray * lastShot
NSDictionary * _equipScreenBackgroundDescriptor
NSMutableArray * commLog
NSString * lastTextKey
NSString * keyMod1Text
NSString * keyMod2Text
NSArray * stickFunctions
NSDictionary * worldScriptsRequiringTickle
NSMutableDictionary * parcel_record
NSDictionary * _missionBackgroundDescriptor
NSArray * keyFunctions
NSMutableDictionary * multiFunctionDisplayText
NSMutableArray * multiFunctionDisplaySettings
NSString * _fastEquipmentA
NSMutableDictionary * shipyard_record
NSMutableArray * customModePressed
NSDictionary * worldScripts
WormholeEntity * wormhole
NSMutableArray * customActivatePressed
OOCommodityType marketSelectedCommodity
NSString * save_path
NSMutableDictionary * extraGuiScreenKeys

◆ debugMessage:

- (void) debugMessage: (NSString *) args

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ debugOff

- (void) debugOff

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ debugOn

- (void) debugOn

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ deciCredits

- (OOCreditsQuantity) deciCredits

Definition at line 13735 of file PlayerEntity.m.

495{
496 return credits;
497}

◆ decreaseContractReputation:

- (void) decreaseContractReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ decreaseParcelReputation:

- (void) decreaseParcelReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ decreasePassengerReputation:

- (void) decreasePassengerReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ decrement:

- (void) decrement: (NSString *) missionVariableString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ defaultMarker:

- (NSDictionary *) defaultMarker: (OOSystemID) system

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

Referenced by MissionMarkSystem().

+ Here is the caller graph for this function:

◆ deferredInit

- (void) deferredInit

Definition at line 13735 of file PlayerEntity.m.

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

◆ deleteAllKeySettings

- (void) deleteAllKeySettings
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ deleteKeySetting:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ describeStickDict:

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

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ destroySound

- (void) destroySound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ dial_clock

- (NSString *) dial_clock

Definition at line 13735 of file PlayerEntity.m.

4917{
4919}
NSString * ClockToString(double clock, BOOL adjusting)

◆ dial_clock_adjusted

- (NSString *) dial_clock_adjusted

Definition at line 13735 of file PlayerEntity.m.

4923{
4925}

◆ dial_fpsinfo

- (NSString *) dial_fpsinfo

Definition at line 13735 of file PlayerEntity.m.

4929{
4930 unsigned fpsVal = fps_counter;
4931 return [NSString stringWithFormat:@"FPS: %3d", fpsVal];
4932}

◆ dial_objinfo

- (NSString *) dial_objinfo

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialAftShield

- (GLfloat) dialAftShield

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialAltitude

- (GLfloat) dialAltitude

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialCustomColor:

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

Definition at line 13735 of file PlayerEntity.m.

4618 :(NSString *)dialKey
4619{
4620 return [OOColor colorWithDescription:[customDialSettings objectForKey:dialKey]];
4621}
OOColor * colorWithDescription:(id description)
Definition OOColor.m:127

◆ dialCustomFloat:

- (float) dialCustomFloat: (NSString *) dialKey

Definition at line 13735 of file PlayerEntity.m.

4606 :(NSString *)dialKey
4607{
4608 return [customDialSettings oo_floatForKey:dialKey defaultValue:0.0];
4609}

◆ dialCustomString:

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

Definition at line 13735 of file PlayerEntity.m.

4612 :(NSString *)dialKey
4613{
4614 return [customDialSettings oo_stringForKey:dialKey defaultValue:@""];
4615}

◆ dialEnergy

- (GLfloat) dialEnergy

Definition at line 13735 of file PlayerEntity.m.

4796{
4797 GLfloat result = energy / maxEnergy;
4798 return OOClamp_0_1_f(result);
4799}
GLfloat maxEnergy
Definition Entity.h:143
GLfloat energy
Definition Entity.h:142

◆ dialForwardShield

- (GLfloat) dialForwardShield

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialFuel

- (GLfloat) dialFuel

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialFuelScoopStatus

- (OOFuelScoopStatus) dialFuelScoopStatus

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialHyperRange

- (GLfloat) dialHyperRange

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialHyperSpeed

- (GLfloat) dialHyperSpeed

Definition at line 13735 of file PlayerEntity.m.

4768{
4769 return flightSpeed / maxFlightSpeed;
4770}
GLfloat flightSpeed
Definition ShipEntity.h:368
GLfloat maxFlightSpeed
Definition ShipEntity.h:239

◆ dialIdentEngaged

- (BOOL) dialIdentEngaged

Definition at line 13735 of file PlayerEntity.m.

5467{
5468 return ident_engaged;
5469}

◆ dialMaxEnergy

- (GLfloat) dialMaxEnergy

Definition at line 13735 of file PlayerEntity.m.

4803{
4804 return maxEnergy;
4805}

◆ dialMaxMissiles

- (NSUInteger) dialMaxMissiles

Definition at line 13735 of file PlayerEntity.m.

5461{
5462 return max_missiles;
5463}

◆ dialMissileStatus

- (OOMissileStatus) dialMissileStatus

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialPitch

- (GLfloat) dialPitch

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialRoll

- (GLfloat) dialRoll

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialSpeed

- (GLfloat) dialSpeed

Definition at line 13735 of file PlayerEntity.m.

4761{
4762 GLfloat result = flightSpeed / maxFlightSpeed;
4763 return OOClamp_0_1_f(result);
4764}

◆ dialTargetName

- (NSString *) dialTargetName

Definition at line 13735 of file PlayerEntity.m.

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

◆ dialYaw

- (GLfloat) dialYaw

Definition at line 13735 of file PlayerEntity.m.

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

◆ disengageAutopilot

- (void) disengageAutopilot

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ displayFunctionList:skip:

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

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ displayKeyboardLayoutList:skip:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ displayKeyFunctionList:skip:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ doBookkeeping:

- (void) doBookkeeping: (double) delta_t

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

Definition at line 13735 of file PlayerEntity.m.

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

◆ docked

- (void) docked

Definition at line 13735 of file PlayerEntity.m.

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

◆ dockedAtMainStation

- (BOOL) dockedAtMainStation

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ dockedAtMainStation_bool

- (NSString *) dockedAtMainStation_bool

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ dockedStation

- (StationEntity *) dockedStation

Definition at line 13735 of file PlayerEntity.m.

4500{
4501 return [_dockedStation weakRefUnderlyingObject];
4502}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ dockedStationDisplayName

- (NSString *) dockedStationDisplayName

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ dockedStationName

- (NSString *) dockedStationName

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ dockedStationName_string

- (NSString *) dockedStationName_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ dockedTechLevel_number

- (NSNumber *) dockedTechLevel_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ doesHitLine:v0:v1:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ doGuiScreenResizeUpdates

- (void) doGuiScreenResizeUpdates

Definition at line 13735 of file PlayerEntity.m.

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

◆ doMissionCallback

- (void) doMissionCallback

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ doScriptEvent:inContext:withArguments:count:

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

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ doTradeIn:forPriceFactor:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 9247 of file PlayerEntity.m.

10701 :(OOCreditsQuantity)tradeInValue forPriceFactor:(double)priceFactor
10702{
10703 if (tradeInValue != 0)
10704 {
10705 if (priceFactor < 1.0) tradeInValue *= priceFactor;
10707 }
10708}
OOCreditsQuantity tradeInValue()

◆ doWorldEventUntilMissionScreen:

- (BOOL) doWorldEventUntilMissionScreen: (jsid) message

Definition at line 9247 of file PlayerEntity.m.

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

◆ doWorldScriptEvent:inContext:withArguments:count:timeLimit:

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

Definition at line 9247 of file PlayerEntity.m.

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

◆ drawImmediate:translucent:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ drawRotationMatrix

- (OOMatrix) drawRotationMatrix
implementation

Reimplemented from Entity.

Definition at line 13735 of file PlayerEntity.m.

4327{
4328 return playerRotMatrix;
4329}
OOMatrix playerRotMatrix

◆ drawTransformationMatrix

- (OOMatrix) drawTransformationMatrix
implementation

Reimplemented from Entity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ dumpCargo

- (OOCommodityType) dumpCargo
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ dumpSelfState

- (void) dumpSelfState
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ ejectItem:

- (void) ejectItem: (NSString *) item_key

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ endMissionScreenAndNoteOpportunity

- (void) endMissionScreenAndNoteOpportunity

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ endScenario:

- (BOOL) endScenario: (NSString *) key

Definition at line 13735 of file PlayerEntity.m.

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

◆ energyUnitType

- (OOEnergyUnitType) energyUnitType

Definition at line 13735 of file PlayerEntity.m.

6147{
6148 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"]) return ENERGY_UNIT_NAVAL;
6149 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"]) return ENERGY_UNIT_NORMAL;
6150 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NAVAL_DAMAGED;
6151 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"]) return ENERGY_UNIT_NORMAL_DAMAGED;
6152 return ENERGY_UNIT_NONE;
6153}
@ ENERGY_UNIT_NORMAL
Definition OOTypes.h:137
@ ENERGY_UNIT_NAVAL_DAMAGED
Definition OOTypes.h:134
@ ENERGY_UNIT_NAVAL
Definition OOTypes.h:138
@ ENERGY_UNIT_NONE
Definition OOTypes.h:132
@ ENERGY_UNIT_NORMAL_DAMAGED
Definition OOTypes.h:133

◆ engageAutopilotToStation:

- (BOOL) engageAutopilotToStation: (StationEntity *) stationForDocking

Definition at line 13735 of file PlayerEntity.m.

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

◆ enterDock:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by StationDockPlayer().

+ Here is the caller graph for this function:

◆ enterGalacticWitchspace

- (void) enterGalacticWitchspace

Definition at line 13735 of file PlayerEntity.m.

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

◆ enterWitchspace

- (void) enterWitchspace
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ enterWormhole:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ entryIsCustomEquip:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ entryIsDictCustomEquip:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ entryIsEqualToDefault:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ entryIsIndexCustomEquip:

- (BOOL) entryIsIndexCustomEquip: (NSUInteger) idx
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ eqScriptIndexForKey:

- (NSUInteger) eqScriptIndexForKey: (NSString *) eq_key

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ equipmentList

- (NSArray *) equipmentList

Definition at line 13735 of file PlayerEntity.m.

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

◆ equipScreenBackgroundDescriptor

- (NSDictionary *) equipScreenBackgroundDescriptor

Definition at line 9247 of file PlayerEntity.m.

12863{
12865}

◆ erodeReputation

- (void) erodeReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ escapePodRescueTime

- (double) escapePodRescueTime

Definition at line 13735 of file PlayerEntity.m.

4906{
4908}
double escape_pod_rescue_time

◆ existingNativeSave:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1003 of file PlayerEntityLoadSave.m.

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

◆ expandMessage:

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

Provided by category PlayerEntity(ScriptingPrivate).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ expandScriptRightHandSide:

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

Provided by category PlayerEntity(ScriptingPrivate).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ fastEquipmentA

- (NSString *) fastEquipmentA

Definition at line 13735 of file PlayerEntity.m.

8284{
8285 return _fastEquipmentA;
8286}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ fastEquipmentB

- (NSString *) fastEquipmentB

Definition at line 13735 of file PlayerEntity.m.

8290{
8291 return _fastEquipmentB;
8292}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ findIndexOfCommander:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1003 of file PlayerEntityLoadSave.m.

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

◆ fireECM

- (BOOL) fireECM
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ fireMainWeapon

- (BOOL) fireMainWeapon

Definition at line 13735 of file PlayerEntity.m.

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

◆ fireMissile

- (ShipEntity *) fireMissile
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ fleeingStatus

- (OOPlayerFleeingStatus) fleeingStatus

Definition at line 13735 of file PlayerEntity.m.

5855{
5856 return fleeing_status;
5857}
OOPlayerFleeingStatus fleeing_status

◆ forwardShieldLevel

- (GLfloat) forwardShieldLevel

Definition at line 13735 of file PlayerEntity.m.

4691{
4692 return forward_shield;
4693}

◆ forwardShieldRechargeRate

- (float) forwardShieldRechargeRate

Definition at line 13735 of file PlayerEntity.m.

4655{
4657}
GLfloat forward_shield_recharge_rate

◆ foundEquipment_bool

- (NSString *) foundEquipment_bool

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ fuelChargeRate

- (GLfloat) fuelChargeRate
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ fuelLeakRate

- (float) fuelLeakRate

Definition at line 13735 of file PlayerEntity.m.

5005{
5006 return fuel_leak_rate;
5007}

◆ fuelLeakRate_number

- (NSNumber *) fuelLeakRate_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ fuelLevel_number

- (NSNumber *) fuelLevel_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ fuelRequiredForJump

- (OOFuelQuantity) fuelRequiredForJump
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

7506{
7507 return 10.0 * MAX(0.1, [self hyperspaceJumpDistance]);
7508}
double hyperspaceJumpDistance()

◆ galacticHyperspaceBehaviour

- (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour

◆ galacticHyperspaceFixedCoords

- (NSPoint) galacticHyperspaceFixedCoords

◆ galaxy_coordinates

- (NSPoint) galaxy_coordinates

◆ galaxyNumber

- (OOGalaxyID) galaxyNumber

Definition at line 13735 of file PlayerEntity.m.

513{
514 return galaxy_number;
515}

◆ gameOverFadeToBW

- (void) gameOverFadeToBW
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ getCustomEquipArray:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ getCustomEquipIndex:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ getCustomEquipKeyDefType:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ getDestroyedBy:damageType:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ getDockingClearanceStatus

- (OODockingClearanceStatus) getDockingClearanceStatus

Definition at line 9247 of file PlayerEntity.m.

13198{
13200}

◆ getFined

- (void) getFined

Definition at line 9247 of file PlayerEntity.m.

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

◆ getFirstKeyCode:

- (int) getFirstKeyCode: (NSArray*) key_def

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ getKeyBindingDescription:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ getMissionDestinations

- (NSMutableDictionary *) getMissionDestinations

Definition at line 9247 of file PlayerEntity.m.

13357{
13358 return missionDestinations;
13359}

Referenced by MissionGetProperty().

+ Here is the caller graph for this function:

◆ getTargetDockStation

- (StationEntity *) getTargetDockStation

Definition at line 13735 of file PlayerEntity.m.

4519{
4520 return targetDockStation;
4521}
StationEntity * targetDockStation

◆ gui_screen_string

- (NSString *) gui_screen_string

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ guiScreen

- (OOGUIScreenID) guiScreen

Definition at line 9247 of file PlayerEntity.m.

11361{
11362 return gui_screen;
11363}

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

+ Here is the caller graph for this function:

◆ handleAutopilotOn:

- (void) handleAutopilotOn: (BOOL) fastDocking
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ handleButtonIdent

- (void) handleButtonIdent
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ handleButtonTargetMissile

- (void) handleButtonTargetMissile
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ handleGameOptionsScreenKeys

- (void) handleGameOptionsScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ handleGUIUpDownArrowKeys

- (BOOL) handleGUIUpDownArrowKeys

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ handleKeyboardLayoutEntryKeys:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ handleKeyboardLayoutKeys

- (void) handleKeyboardLayoutKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ handleKeyConfigEntryKeys:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ handleKeyConfigKeys:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ handleKeyMapperConfirmClearKeys:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ handleKeyMapperScreenKeys

- (void) handleKeyMapperScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ handleMissionCallback

- (void) handleMissionCallback
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ handleStickMapperScreenKeys

- (void) handleStickMapperScreenKeys
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ handleUndockControl

- (void) handleUndockControl
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ hasHostileTarget

- (BOOL) hasHostileTarget
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

11865{
11866 ShipEntity *playersTarget = [self primaryTarget];
11867 return ([playersTarget isShip] && [playersTarget hasHostileTarget] && [playersTarget primaryTarget] == self);
11868}

◆ hasOneEquipmentItem:includeMissiles:

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

Definition at line 9247 of file PlayerEntity.m.

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

◆ hasPrimaryWeapon:

- (BOOL) hasPrimaryWeapon: (OOWeaponType) weaponType
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ hasSufficientFuelForJump

- (BOOL) hasSufficientFuelForJump

Definition at line 13735 of file PlayerEntity.m.

7512{
7513 return fuel >= [self fuelRequiredForJump];
7514}

◆ highlightEquipShipScreenKey:

- (void) highlightEquipShipScreenKey: (NSString *) key

Definition at line 9247 of file PlayerEntity.m.

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

◆ homeInfoSystem

- (void) homeInfoSystem

Definition at line 13735 of file PlayerEntity.m.

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

◆ hud

- (HeadUpDisplay *) hud

◆ hwToString:

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

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ hyperspaceJumpDistance

- (double) hyperspaceJumpDistance
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ hyperspeedEngaged

- (BOOL) hyperspeedEngaged

Definition at line 13735 of file PlayerEntity.m.

3756{
3757 return hyperspeed_engaged;
3758}

◆ hyperspeedFactor

- (GLfloat) hyperspeedFactor

◆ increaseContractReputation:

- (void) increaseContractReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ increaseParcelReputation:

- (void) increaseParcelReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ increasePassengerReputation:

- (void) increasePassengerReputation: (unsigned) amount

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ increment:

- (void) increment: (NSString *) missionVariableString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ infoSystemID

- (OOSystemID) infoSystemID

Definition at line 13735 of file PlayerEntity.m.

754{
755 return info_system_id;
756}

◆ infoSystemOnRoute

- (BOOL) infoSystemOnRoute

Definition at line 13735 of file PlayerEntity.m.

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

◆ init

- (id) init
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ initCheckingDictionary

- (void) initCheckingDictionary

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ initControls

- (void) initControls

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ initialiseMissionDestinations:andLegacy:

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

Definition at line 9247 of file PlayerEntity.m.

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

◆ initKeyConfigSettings

- (void) initKeyConfigSettings

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ injectorsEngaged

- (BOOL) injectorsEngaged

Definition at line 13735 of file PlayerEntity.m.

3750{
3751 return afterburner_engaged;
3752}

◆ insideAtmosphereFraction

- (GLfloat) insideAtmosphereFraction

Definition at line 13735 of file PlayerEntity.m.

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

◆ inspCanBecomeTarget

- (BOOL) inspCanBecomeTarget
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

219{
220 return NO;
221}

◆ inspDescription

- (NSString *) inspDescription
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

225{
226 return @"Player";
227}

◆ inspSecondaryIdentityLine

- (NSString *) inspSecondaryIdentityLine
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

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

◆ installedEnergyUnitType

- (OOEnergyUnitType) installedEnergyUnitType

Definition at line 13735 of file PlayerEntity.m.

6139{
6140 if ([self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT"]) return ENERGY_UNIT_NAVAL;
6141 if ([self hasEquipmentItem:@"EQ_ENERGY_UNIT"]) return ENERGY_UNIT_NORMAL;
6142 return ENERGY_UNIT_NONE;
6143}

◆ interpretAIMessage:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ isBeeping

- (BOOL) isBeeping

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

194{
195 return [sInterfaceBeepSource isPlaying];
196}

◆ isDocked

- (BOOL) isDocked

Definition at line 9247 of file PlayerEntity.m.

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

◆ isMining

- (BOOL) isMining
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

11522{
11523 return using_mining_laser;
11524}

◆ isMouseControlOn

- (BOOL) isMouseControlOn

Definition at line 13735 of file PlayerEntity.m.

4722{
4723 return mouse_control_on;
4724}

◆ isPlayerLikeShip

- (BOOL) isPlayerLikeShip
implementation

Reimplemented from Entity.

Provided by category PlayerEntity(ProxyPlayer).

Definition at line 1 of file ProxyPlayerEntity.m.

226{
227 return YES;
228}

◆ isSpeechOn

- (OOSpeechSettings) isSpeechOn

◆ isValidTarget:

- (BOOL) isValidTarget: (Entity*) target

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ javaScriptEngineWillReset:

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

Provided by category PlayerEntity(OOJavaScriptExtensions).

Definition at line 1860 of file OOJSPlayerShip.m.

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

◆ jumpCause

- (NSString *) jumpCause

Definition at line 9247 of file PlayerEntity.m.

13067{
13068 return _jumpCause;
13069}

◆ keyBindingDescription2:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

Referenced by GlobalKeyBindingDescription().

+ Here is the caller graph for this function:

◆ keyboardDescription:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ keyboardLayoutList

- (NSArray *) keyboardLayoutList
implementation

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ keyCodeDescription:

- (NSString *) keyCodeDescription: (OOKeyCode) code

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ keyCodeDescriptionShort:

- (NSString *) keyCodeDescriptionShort: (OOKeyCode) code

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ keyConfig

- (NSDictionary *) keyConfig

Definition at line 13735 of file PlayerEntity.m.

4715{
4716 //return keyconfig_settings;
4717 return keyconfig2_settings;
4718}

◆ keyFunctionList

- (NSArray *) keyFunctionList
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ keyMapperInputHandler:view:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ laserHeatLevel

- (GLfloat) laserHeatLevel
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4826{
4827 GLfloat result = (GLfloat)weapon_temp / (GLfloat)PLAYER_MAX_WEAPON_TEMP;
4828 return OOClamp_0_1_f(result);
4829}

◆ laserHeatLevelAft

- (GLfloat) laserHeatLevelAft
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4833{
4834 GLfloat result = aft_weapon_temp / (GLfloat)PLAYER_MAX_WEAPON_TEMP;
4835 return OOClamp_0_1_f(result);
4836}

◆ laserHeatLevelForward

- (GLfloat) laserHeatLevelForward
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4840{
4841 GLfloat result = forward_weapon_temp / (GLfloat)PLAYER_MAX_WEAPON_TEMP;
4842// no need to check subents here
4843 return OOClamp_0_1_f(result);
4844}

◆ laserHeatLevelPort

- (GLfloat) laserHeatLevelPort
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4848{
4849 GLfloat result = port_weapon_temp / PLAYER_MAX_WEAPON_TEMP;
4850 return OOClamp_0_1_f(result);
4851}

◆ laserHeatLevelStarboard

- (GLfloat) laserHeatLevelStarboard
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4855{
4857 return OOClamp_0_1_f(result);
4858}

◆ lastsaveName

- (NSString *) lastsaveName

Definition at line 9247 of file PlayerEntity.m.

13087{
13088 return _lastsaveName;
13089}

◆ launchEscapeCapsule

- (ShipEntity *) launchEscapeCapsule
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ launchFromStation

- (void) launchFromStation

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ launchMine:

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

Definition at line 13735 of file PlayerEntity.m.

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

◆ leaveDock:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ leaveWitchspace

- (void) leaveWitchspace
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ legalStatusOfCargoList

- (unsigned) legalStatusOfCargoList

Definition at line 13735 of file PlayerEntity.m.

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

◆ loadCargoPods

- (void) loadCargoPods

Definition at line 13735 of file PlayerEntity.m.

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

◆ loadCargoPodsForType:amount:

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

Definition at line 13735 of file PlayerEntity.m.

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

◆ loadCargoPodsForType:fromManifest:

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

Definition at line 13735 of file PlayerEntity.m.

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

◆ loadKeySettings

- (NSDictionary *) loadKeySettings
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ loadPlayer

- (BOOL) loadPlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ loadPlayerFromFile:asNew:

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

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ loadPlayerWithPanel

- (BOOL) loadPlayerWithPanel
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ localMarket

- (OOCommodityMarket *) localMarket

Definition at line 9247 of file PlayerEntity.m.

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

◆ localVariableForKey:andMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ localVariablesForMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by PlayerEntity(Scripting)::PerformActionStatment.

+ Here is the caller graph for this function:

◆ longRangeChartMode

- (OOLongRangeChartMode) longRangeChartMode

◆ lookingAtSunWithThresholdAngleCos:

- (GLfloat) lookingAtSunWithThresholdAngleCos: (GLfloat) thresholdAngleCos
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ loseTargetStatus

- (void) loseTargetStatus

Definition at line 13735 of file PlayerEntity.m.

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

◆ lsCommanders:directory:pageNumber:highlightName:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1003 of file PlayerEntityLoadSave.m.

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

◆ makeKeyGuiDict:keyDef:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ makeKeyGuiDictHeader:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ makeStickGuiDict:allowable:axisfn:butfn:

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

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ makeStickGuiDictHeader:

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

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ markAsOffender:

- (void) markAsOffender: (int) offence_value
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6833 :(int)offence_value
6834{
6835 [self markAsOffender:offence_value withReason:kOOLegalStatusReasonUnknown];
6836}

◆ markAsOffender:withReason:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6839 :(int)offence_value withReason:(OOLegalStatusReason)reason
6840{
6841 if (![self isCloaked])
6842 {
6843 JSContext *context = OOJSAcquireContext();
6844
6845 jsval amountVal = JSVAL_VOID;
6846 int amountVal2 = (legalStatus | offence_value) - legalStatus;
6847 JS_NewNumberValue(context, amountVal2, &amountVal);
6848
6849 legalStatus |= offence_value; // can't set the new bounty until the size of the change is known
6850
6851 jsval reasonVal = OOJSValueFromLegalStatusReason(context, reason);
6852
6853 ShipScriptEvent(context, self, "shipBountyChanged", amountVal, reasonVal);
6854
6855 OOJSRelinquishContext(context);
6856
6857 }
6858}
OOINLINE jsval OOJSValueFromLegalStatusReason(JSContext *context, OOLegalStatusReason value)
OOLegalStatusReason
Definition OOTypes.h:157

◆ markedDestinations

- (NSDictionary *) markedDestinations

Definition at line 13735 of file PlayerEntity.m.

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

◆ markerKey:

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

Definition at line 9247 of file PlayerEntity.m.

13322 :(NSDictionary *)marker
13323{
13324 return [NSString stringWithFormat:@"%d-%@",[marker oo_intForKey:@"system"], [marker oo_stringForKey:@"name"]];
13325}

◆ marketScreenTitle

- (NSString *) marketScreenTitle
implementation

Definition at line 9247 of file PlayerEntity.m.

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

◆ massLockable

- (BOOL) massLockable

◆ massLocked

- (BOOL) massLocked

Definition at line 13735 of file PlayerEntity.m.

4469{
4470 return ((alertFlags & ALERT_FLAG_MASS_LOCK) != 0);
4471}

◆ maxAftShieldLevel

- (float) maxAftShieldLevel
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4649{
4650 return max_aft_shield;
4651}
GLfloat max_aft_shield

◆ maxForwardShieldLevel

- (float) maxForwardShieldLevel
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4643{
4644 return max_forward_shield;
4645}
GLfloat max_forward_shield

◆ maxPlayerRoles

- (NSUInteger) maxPlayerRoles

Definition at line 13735 of file PlayerEntity.m.

5147{
5148 if (ship_kills >= 6400)
5149 {
5150 return 32;
5151 }
5152 else if (ship_kills >= 128)
5153 {
5154 return 16;
5155 }
5156 else
5157 {
5158 return 8;
5159 }
5160}

◆ messageShipAIs:

- (void) messageShipAIs: (NSString *) roles_message

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ missileForPylon:

- (ShipEntity *) missileForPylon: (NSUInteger) value

Definition at line 13735 of file PlayerEntity.m.

5684 :(NSUInteger)value
5685{
5686 if (value < max_missiles) return missile_entity[value];
5687 return nil;
5688}

◆ missilesList

- (NSArray *) missilesList
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

8340{
8341 [self tidyMissilePylons]; // just in case.
8342 return [super missilesList];
8343}

◆ missingSubEntitiesAdjustment

- (NSInteger) missingSubEntitiesAdjustment

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

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

◆ mission_string

- (NSString *) mission_string

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ missionBackgroundDescriptor

- (NSDictionary *) missionBackgroundDescriptor

Definition at line 9247 of file PlayerEntity.m.

12727{
12729}

◆ missionBackgroundDescriptorOrDefault

- (NSDictionary *) missionBackgroundDescriptorOrDefault

Definition at line 9247 of file PlayerEntity.m.

12733{
12734 NSDictionary *result = [self missionBackgroundDescriptor];
12735 if (result == nil)
12736 {
12737 result = [UNIVERSE screenTextureDescriptorForKey:@"mission"];
12738 }
12739
12740 return result;
12741}

◆ missionBackgroundSpecial

- (OOGUIBackgroundSpecial) missionBackgroundSpecial

Definition at line 9247 of file PlayerEntity.m.

12755{
12757}

◆ missionChoice_string

- (NSString *) missionChoice_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1068{
1069 return missionChoice;
1070}

◆ missionExitScreen

- (OOGUIScreenID) missionExitScreen

Definition at line 9247 of file PlayerEntity.m.

12857{
12858 return _missionExitScreen;
12859}
OOGUIScreenID _missionExitScreen

◆ missionKeyPress_string

- (NSString *) missionKeyPress_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1074{
1075 return missionKeyPress;
1076}

◆ missionOverlayDescriptor

- (NSDictionary *) missionOverlayDescriptor

Definition at line 9247 of file PlayerEntity.m.

12692{
12694}

◆ missionOverlayDescriptorOrDefault

- (NSDictionary *) missionOverlayDescriptorOrDefault

Definition at line 9247 of file PlayerEntity.m.

12698{
12699 NSDictionary *result = [self missionOverlayDescriptor];
12700 if (result == nil)
12701 {
12702 if ([[self missionTitle] length] == 0)
12703 {
12704 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_no_title"];
12705 }
12706 else
12707 {
12708 result = [UNIVERSE screenTextureDescriptorForKey:@"mission_overlay_with_title"];
12709 }
12710 }
12711
12712 return result;
12713}

◆ missionScreenID

- (NSString *) missionScreenID

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2461{
2462 return _missionScreenID;
2463}

Referenced by MissionGetProperty().

+ Here is the caller graph for this function:

◆ missionsList

- (NSArray *) missionsList

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ missionTitle

- (NSString *) missionTitle

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2174{
2175 return _missionTitle;
2176}

◆ missionVariableForKey:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionVariablesGetProperty().

+ Here is the caller graph for this function:

◆ missionVariables

- (NSDictionary *) missionVariables

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

646{
647 return mission_variables;
648}

◆ mountMissile:

- (BOOL) mountMissile: (ShipEntity *) missile

Definition at line 13735 of file PlayerEntity.m.

5923 :(ShipEntity *)missile
5924{
5925 if (missile == nil) return NO;
5926
5927 unsigned i;
5928 for (i = 0; i < max_missiles; i++)
5929 {
5930 if (missile_entity[i] == nil)
5931 {
5932 missile_entity[i] = [missile retain];
5934 missiles++;
5935 if (missiles == 1) [self setActiveMissile:0]; // auto select the first purchased missile
5936 return YES;
5937 }
5938 }
5939
5940 return NO;
5941}

◆ mountMissileWithRole:

- (BOOL) mountMissileWithRole: (NSString *) role

Definition at line 13735 of file PlayerEntity.m.

5944 :(NSString *)role
5945{
5946 if ([self missileCount] >= [self missileCapacity]) return NO;
5947 return [self mountMissile:[[UNIVERSE newShipWithRole:role] autorelease]];
5948}
NSUInteger missileCount()
NSUInteger missileCapacity()

Referenced by ShipAwardEquipment().

+ Here is the caller graph for this function:

◆ moveForward:

- (void) moveForward: (double) amount
implementation

Reimplemented from Entity.

Definition at line 13735 of file PlayerEntity.m.

4352 :(double) amount
4353{
4354 distanceTravelled += (float)amount;
4355 [self setPosition:HPvector_add(position, vectorToHPVector(vector_multiply_scalar(v_forward, (float)amount)))];
4356}
GLfloat distanceTravelled
Definition Entity.h:136

◆ moveTargetMemoryBy:

- (BOOL) moveTargetMemoryBy: (NSInteger) delta

Definition at line 9247 of file PlayerEntity.m.

12361 :(NSInteger)delta
12362{
12363 unsigned i = 0;
12364 while (i++ < PLAYER_TARGET_MEMORY_SIZE) // limit loops
12365 {
12366 NSInteger idx = (NSInteger)target_memory_index + delta;
12367 while (idx < 0) idx += PLAYER_TARGET_MEMORY_SIZE;
12369 target_memory_index = idx;
12370
12371 id targ_id = [target_memory objectAtIndex:target_memory_index];
12372 if ([targ_id isProxy])
12373 {
12374 ShipEntity *potential_target = [(OOWeakReference *)targ_id weakRefUnderlyingObject];
12375
12376 if ((potential_target)&&(potential_target->isShip)&&([potential_target isInSpace]))
12377 {
12378 if (potential_target->zero_distance < SCANNER_MAX_RANGE2 && (![potential_target isCloaked]))
12379 {
12380 [super addTarget:potential_target];
12382 {
12384 {
12385 [missile_entity[activeMissile] addTarget:potential_target];
12387 [self printIdentLockedOnForMissile:YES];
12388 }
12389 else
12390 {
12392 [self playIdentLockedOn];
12393 [self printIdentLockedOnForMissile:NO];
12394 }
12395 }
12396 else
12397 {
12398 ident_engaged = YES;
12399 [self printIdentLockedOnForMissile:NO];
12400 }
12401 [self playTargetSwitched];
12402 return YES;
12403 }
12404 }
12405 else
12406 {
12407 [target_memory replaceObjectAtIndex:target_memory_index withObject:[NSNull null]];
12408 }
12409 }
12410 }
12411
12412 [self playNoTargetInMemory];
12413 return NO;
12414}
BOOL isInSpace()
Definition Entity.m:1120

◆ multiFunctionDisplayList

- (NSArray *) multiFunctionDisplayList

Definition at line 13735 of file PlayerEntity.m.

5506{
5508}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ multiFunctionText:

- (NSString *) multiFunctionText: (NSUInteger) index

Definition at line 13735 of file PlayerEntity.m.

5511 :(NSUInteger)i
5512{
5513 NSString *key = [multiFunctionDisplaySettings oo_stringAtIndex:i defaultValue:nil];
5514 if (key == nil)
5515 {
5516 return nil;
5517 }
5518 NSString *text = [multiFunctionDisplayText oo_stringForKey:key defaultValue:nil];
5519 return text;
5520}

◆ mungChecksumWithNSString:

- (void) mungChecksumWithNSString: (NSString *) str

Definition at line 9247 of file PlayerEntity.m.

12222 :(NSString *)str
12223{
12224 if (str == nil) return;
12225
12226 NSUInteger i, length = [str length];
12227 for (i = 0; i < length; i++)
12228 {
12229 munge_checksum([str characterAtIndex:i]);
12230 }
12231}

◆ nativeSavePlayer:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ newShipCommonSetup:yardInfo:baseInfo:

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

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

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

◆ nextHopTargetSystemID

- (OOSystemID) nextHopTargetSystemID

Definition at line 13735 of file PlayerEntity.m.

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

◆ nextInfoSystem

- (void) nextInfoSystem

Definition at line 13735 of file PlayerEntity.m.

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

◆ normaliseReputation

- (void) normaliseReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ normalOrientation

- (Quaternion) normalOrientation
implementation

Reimplemented from Entity.

Definition at line 13735 of file PlayerEntity.m.

4341{
4342 return make_quaternion(-orientation.w, orientation.x, orientation.y, orientation.z);
4343}

◆ noteCompassLostTarget

- (void) noteCompassLostTarget
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ noteGUIDidChangeFrom:to:

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

Definition at line 9247 of file PlayerEntity.m.

10153 :(OOGUIScreenID)fromScreen to:(OOGUIScreenID)toScreen
10154{
10155 [self noteGUIDidChangeFrom: fromScreen to: toScreen refresh: NO];
10156}

◆ noteGUIDidChangeFrom:to:refresh:

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

Definition at line 9247 of file PlayerEntity.m.

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

◆ noteGUIWillChangeTo:

- (void) noteGUIWillChangeTo: (OOGUIScreenID) toScreen

Definition at line 9247 of file PlayerEntity.m.

10145 :(OOGUIScreenID)toScreen
10146{
10147 JSContext *context = OOJSAcquireContext();
10148 ShipScriptEvent(context, self, "guiScreenWillChange", OOJSValueFromGUIScreenID(context, toScreen), OOJSValueFromGUIScreenID(context, gui_screen));
10149 OOJSRelinquishContext(context);
10150}

◆ noteSwitchToView:fromView:

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

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

Referenced by PlayerShipResetCustomView(), and PlayerShipSetCustomView().

+ Here is the caller graph for this function:

◆ noteViewDidChangeFrom:toView:

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

Definition at line 9247 of file PlayerEntity.m.

10200 :(OOViewID)fromView toView:(OOViewID)toView
10201{
10202 [self noteSwitchToView:toView fromView:fromView];
10203}

◆ noticeECM

- (void) noticeECM
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6118{
6119 last_ecm_time = [UNIVERSE getTime];
6120}
double last_ecm_time

◆ occlusionLevel

- (float) occlusionLevel

Definition at line 13735 of file PlayerEntity.m.

4481{
4482 return occlusion_dial;
4483}
float occlusion_dial

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Reimplemented from ShipEntity.

Provided by category PlayerEntity(OOJavaScriptExtensions).

Definition at line 1860 of file OOJSPlayerShip.m.

318{
319 return @"PlayerShip";
320}

◆ orientationChanged

- (void) orientationChanged
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

4267{
4268 quaternion_normalize(&orientation);
4270 OOMatrixGetBasisVectors(rotMatrix, &v_right, &v_up, &v_forward);
4271
4272 orientation.w = -orientation.w;
4273 playerRotMatrix = OOMatrixForQuaternionRotation(orientation); // this is the rotation similar to ordinary ships
4274 orientation.w = -orientation.w;
4275}
OOMatrix OOMatrixForQuaternionRotation(Quaternion orientation)
Definition OOMatrix.m:65
OOMatrix rotMatrix
Definition Entity.h:138

◆ outputKeyDefinition:shift:mod1:mod2:skiprows:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ overwriteCommanderInputHandler

- (void) overwriteCommanderInputHandler

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ parcelContractMarker:

- (NSDictionary *) parcelContractMarker: (OOSystemID) system

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ parcelCount

- (NSUInteger) parcelCount
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

11847{
11848 return [parcels count];
11849}

Referenced by PlayerShipRemoveParcel().

+ Here is the caller graph for this function:

◆ parcelList

- (NSArray *) parcelList

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ parcelListForScripting

- (NSArray *) parcelListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

8483{
8484 return [self contractsListForScriptingFromArray:parcels forCargo:NO];
8485}

◆ parcelReputation

- (int) parcelReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ passengerCapacity

- (NSUInteger) passengerCapacity
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

11859{
11860 return max_passengers;
11861}

◆ passengerContractMarker:

- (NSDictionary *) passengerContractMarker: (OOSystemID) system

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ passengerCount

- (NSUInteger) passengerCount
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

11853{
11854 return [passengers count];
11855}

Referenced by PlayerShipRemovePassenger().

+ Here is the caller graph for this function:

◆ passengerList

- (NSArray *) passengerList

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ passengerListForScripting

- (NSArray *) passengerListForScripting
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

8477{
8478 return [self contractsListForScriptingFromArray:passengers forCargo:NO];
8479}

◆ passengerReputation

- (int) passengerReputation

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ penaltyForUnauthorizedDocking

- (void) penaltyForUnauthorizedDocking

Definition at line 9247 of file PlayerEntity.m.

13204{
13205 OOCreditsQuantity amountToPay = 0;
13206 OOCreditsQuantity calculatedFine = credits * 0.05;
13207 OOCreditsQuantity maximumFine = 50000ULL;
13208
13209 if ([self clearedToDock])
13210 return;
13211
13212 amountToPay = MIN(maximumFine, calculatedFine);
13213 credits -= amountToPay;
13214 [self addMessageToReport:[NSString stringWithFormat:DESC(@"station-docking-clearance-fined-@-cr"), OOCredits(amountToPay)]];
13215}

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

3609 :(OOTimeDelta)delta_t
3610{
3611 [self processBehaviour:delta_t];
3612 [self applyVelocity:delta_t];
3613 [self doBookkeeping:delta_t];
3614}

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

3965 :(OOTimeDelta)delta_t
3966{
3967 [UNIVERSE terminatePostFX:OO_POSTFX_CLOAK];
3968 if ([UNIVERSE ECMVisualFXEnabled]) [UNIVERSE terminatePostFX:OO_POSTFX_CRTBADSIGNAL];
3969
3970 [self gameOverFadeToBW];
3971
3972 if ([self shotTime] > kDeadResetTime)
3973 {
3974 BOOL was_mouse_control_on = mouse_control_on;
3975 [UNIVERSE handleGameOver]; // we restart the UNIVERSE
3976 mouse_control_on = was_mouse_control_on;
3977 }
3978}

◆ performDockingRequest:

- (void) performDockingRequest: (StationEntity *) stationForDocking

Definition at line 13735 of file PlayerEntity.m.

3616 :(StationEntity *)stationForDocking
3617{
3618 if (stationForDocking == nil) return;
3619 if (![stationForDocking isStation] || ![stationForDocking isKindOfClass:[StationEntity class]]) return;
3620 if ([self isDocked]) return;
3621 if (autopilot_engaged && [self targetStation] == stationForDocking) return;
3622 if (autopilot_engaged && [self targetStation] != stationForDocking)
3623 {
3624 [self disengageAutopilot];
3625 }
3626 NSString *stationDockingClearanceStatus = [stationForDocking acceptDockingClearanceRequestFrom:self];
3627 if (stationDockingClearanceStatus != nil)
3628 {
3629 [self doScriptEvent:OOJSID("playerRequestedDockingClearance") withArgument:stationDockingClearanceStatus];
3630 if ([stationDockingClearanceStatus isEqualToString:@"DOCKING_CLEARANCE_GRANTED"])
3631 {
3632 [self doScriptEvent:OOJSID("playerDockingClearanceGranted")];
3633 }
3634 }
3635}

◆ performDockingUpdates:

- (void) performDockingUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ performInFlightUpdates:

- (void) performInFlightUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ performLaunchingUpdates:

- (void) performLaunchingUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

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

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

◆ performWitchspaceExitUpdates:

- (void) performWitchspaceExitUpdates: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ planet_number

- (NSNumber *) planet_number

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ playAegisCloseToPlanet

- (void) playAegisCloseToPlanet

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playAegisCloseToStation

- (void) playAegisCloseToStation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playAlertConditionRed

- (void) playAlertConditionRed

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playAutopilotCannotDockWithTarget

- (void) playAutopilotCannotDockWithTarget

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playAutopilotOff

- (void) playAutopilotOff

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playAutopilotOn

- (void) playAutopilotOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playAutopilotOutOfRange

- (void) playAutopilotOutOfRange

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playBuyCommodity

- (void) playBuyCommodity

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playBuyShip

- (void) playBuyShip

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playCantBuyCommodity

- (void) playCantBuyCommodity

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playCantBuyShip

- (void) playCantBuyShip

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playCantSellCommodity

- (void) playCantSellCommodity

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playCargoJettisioned

- (void) playCargoJettisioned

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playChangedOption

- (void) playChangedOption

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playCloakingDeviceInsufficientEnergy

- (void) playCloakingDeviceInsufficientEnergy

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playCloakingDeviceOff

- (void) playCloakingDeviceOff

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playCloakingDeviceOn

- (void) playCloakingDeviceOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playDirectHit:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playDismissedMissionScreen

- (void) playDismissedMissionScreen

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playDismissedReportScreen

- (void) playDismissedReportScreen

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playDockingDenied

- (void) playDockingDenied

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playDockWithStation

- (void) playDockWithStation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playEnergyLow

- (void) playEnergyLow

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playEscapePodScooped

- (void) playEscapePodScooped

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playExitWitchspace

- (void) playExitWitchspace

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playFiredECMSound

- (void) playFiredECMSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playFuelLeak

- (void) playFuelLeak

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playGalacticHyperspace

- (void) playGalacticHyperspace

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

Referenced by PlayerShipBeginGalacticHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ playGameOver

- (void) playGameOver

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playHitByECMSound

- (void) playHitByECMSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playHoldFull

- (void) playHoldFull

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playHostileWarning

- (void) playHostileWarning

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playHyperspaceAborted

- (void) playHyperspaceAborted

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playHyperspaceBlocked

- (void) playHyperspaceBlocked

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playHyperspaceDistanceTooGreat

- (void) playHyperspaceDistanceTooGreat

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playHyperspaceNoFuel

- (void) playHyperspaceNoFuel

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playHyperspaceNoTarget

- (void) playHyperspaceNoTarget

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playIdentLockedOn

- (void) playIdentLockedOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playIdentOff

- (void) playIdentOff

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playIdentOn

- (void) playIdentOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playIncomingMissile:

- (void) playIncomingMissile: (Vector) missileVector

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playInterfaceBeep:

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

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playJumpMassLocked

- (void) playJumpMassLocked

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playLaserHit:offset:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playLaunchFromStation

- (void) playLaunchFromStation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playLegacyScriptSound:

- (void) playLegacyScriptSound: (NSString *) key

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMenuNavigationDown

- (void) playMenuNavigationDown

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMenuNavigationNot

- (void) playMenuNavigationNot

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMenuNavigationUp

- (void) playMenuNavigationUp

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMenuPageNext

- (void) playMenuPageNext

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMenuPagePrevious

- (void) playMenuPagePrevious

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMineArmed

- (void) playMineArmed

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMineLaunched:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMissileArmed

- (void) playMissileArmed

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMissileLaunched:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMissileLockedOn

- (void) playMissileLockedOn

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playMissileSafe

- (void) playMissileSafe

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playNextEquipmentSelected

- (void) playNextEquipmentSelected

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playNextMissileSelected

- (void) playNextMissileSelected

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playNoTargetInMemory

- (void) playNoTargetInMemory

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playSaveOverwriteNo

- (void) playSaveOverwriteNo

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playSaveOverwriteYes

- (void) playSaveOverwriteYes

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playScrapeDamage:

- (void) playScrapeDamage: (Vector) attackVector

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playSellCommodity

- (void) playSellCommodity

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playShieldHit:weaponIdentifier:

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

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playSound:

- (void) playSound: (NSString *) soundName

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ playStandardHyperspace

- (void) playStandardHyperspace

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playTargetLost

- (void) playTargetLost

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playTargetSwitched

- (void) playTargetSwitched

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playWeaponOverheated:

- (void) playWeaponOverheated: (Vector) weaponOffset

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playWeaponsOffline

- (void) playWeaponsOffline

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playWeaponsOnline

- (void) playWeaponsOnline

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playWitchjumpBlocked

- (void) playWitchjumpBlocked

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playWitchjumpDistanceTooGreat

- (void) playWitchjumpDistanceTooGreat

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playWitchjumpFailure

- (void) playWitchjumpFailure

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playWitchjumpInsufficientFuel

- (void) playWitchjumpInsufficientFuel

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ playWitchjumpMisjump

- (void) playWitchjumpMisjump

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

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

◆ pollApplicationControls

- (void) pollApplicationControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ pollAutopilotControls:

- (void) pollAutopilotControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ pollControls:

- (void) pollControls: (double) delta_t

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ pollCustomViewControls

- (void) pollCustomViewControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ pollDemoControls:

- (void) pollDemoControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ pollDockedControls:

- (void) pollDockedControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ pollFlightArrowKeyControls:

- (void) pollFlightArrowKeyControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ pollFlightControls:

- (void) pollFlightControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ pollGameOverControls:

- (void) pollGameOverControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ pollGuiArrowKeyControls:

- (void) pollGuiArrowKeyControls: (double) delta_t
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ pollGuiScreenControls

- (void) pollGuiScreenControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ pollGuiScreenControlsWithFKeyAlias:

- (void) pollGuiScreenControlsWithFKeyAlias: (BOOL) fKeyAlias
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ pollMarketScreenControls

- (void) pollMarketScreenControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ pollMissionInterruptControls

- (void) pollMissionInterruptControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ pollViewControls

- (void) pollViewControls
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 167 of file PlayerEntityControls.m.

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

Referenced by PlayerEntity(OOControlsPrivate)::handleAutopilotOn:.

+ Here is the caller graph for this function:

◆ prepareMarkedDestination:markers:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

8724 :(NSMutableDictionary *)markers :(NSDictionary *)marker
8725{
8726 NSNumber *key = [NSNumber numberWithInt:[marker oo_intForKey:@"system"]];
8727 NSMutableArray *list = [markers objectForKey:key];
8728 if (list == nil)
8729 {
8730 list = [NSMutableArray arrayWithObject:marker];
8731 }
8732 else
8733 {
8734 [list addObject:marker];
8735 }
8736 [markers setObject:list forKey:key];
8737}

◆ previousInfoSystem

- (void) previousInfoSystem

Definition at line 13735 of file PlayerEntity.m.

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

◆ previousSystemID

- (OOSystemID) previousSystemID

Definition at line 13735 of file PlayerEntity.m.

700{
701 return previous_system_id;
702}
OOSystemID previous_system_id

◆ priceForShipKey:

- (OOCreditsQuantity) priceForShipKey: (NSString *) key

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

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

◆ primedEquipmentCount

- (NSUInteger) primedEquipmentCount

Definition at line 13735 of file PlayerEntity.m.

8202{
8203 return [eqScripts count];
8204}

◆ primedEquipmentName:

- (NSString *) primedEquipmentName: (NSInteger) offset

Definition at line 13735 of file PlayerEntity.m.

8207 :(NSInteger)offset
8208{
8209 NSUInteger c = [self primedEquipmentCount];
8210 NSUInteger idx = (primedEquipment+(c+1)+offset)%(c+1);
8211 if (idx == c)
8212 {
8213 return DESC(@"equipment-primed-none-hud-label");
8214 }
8215 else
8216 {
8217 return [[OOEquipmentType equipmentTypeWithIdentifier:[[eqScripts oo_arrayAtIndex:idx] oo_stringAtIndex:0]] name];
8218 }
8219}

◆ printIdentLockedOnForMissile:

- (void) printIdentLockedOnForMissile: (BOOL) missile

Definition at line 9247 of file PlayerEntity.m.

12417 :(BOOL)missile
12418{
12419 if ([self primaryTarget] == nil) return;
12420
12421 NSString *fmt = missile ? @"missile-locked-onto-target" : @"ident-locked-onto-target";
12422 NSString *target = [[self primaryTarget] identFromShip:self];
12423 [UNIVERSE addMessage:OOExpandKey(fmt, target) forCount:4.5];
12424}

◆ processEscapePods

- (NSString *) processEscapePods

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ processKeyCode:

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

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ processSceneDictionary:atOffset:

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

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ processSceneString:atOffset:

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

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ pseudoFixedD100_number

- (NSNumber *) pseudoFixedD100_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ pseudoFixedD256_number

- (NSNumber *) pseudoFixedD256_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ quicksavePlayer

- (void) quicksavePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ random_factor

- (int) random_factor

Definition at line 13735 of file PlayerEntity.m.

501{
502 return market_rnd;
503}

◆ realAlertCondition

- (OOAlertCondition) realAlertCondition
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

5818{
5819 return [self alertCondition];
5820}

◆ receiveCommsMessage:from:

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

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ RecursiveRemapStatus

- (OOINLINE OOEntityStatus) RecursiveRemapStatus (OOEntityStatus) status
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 260 of file PlayerEntityLegacyScriptEngine.m.

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

◆ refreshMissionScreenTextEntry

- (void) refreshMissionScreenTextEntry

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ reloadPage

- (void) reloadPage
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ removeAllCargo

- (void) removeAllCargo

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by PlayerShipRemoveAllCargo().

+ Here is the caller graph for this function:

◆ removeAllCargo:

- (void) removeAllCargo: (BOOL) forceRemoval

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ removeContract:destination:

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

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

Referenced by PlayerShipRemoveContract().

+ Here is the caller graph for this function:

◆ removeEqScriptForKey:

- (void) removeEqScriptForKey: (NSString *) eq_key

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ removeEquipment:

- (void) removeEquipment: (NSString *) equipString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ removeEquipmentItem:

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

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

11660 :(NSString *)equipmentKey
11661{
11662 if(![self hasEquipmentItemProviding:@"EQ_ADVANCED_COMPASS"] && [self compassMode] != COMPASS_MODE_BASIC)
11663 {
11664 [self setCompassMode:COMPASS_MODE_BASIC];
11665 }
11666 [super removeEquipmentItem:equipmentKey];
11667 if(![self hasEquipmentItem:equipmentKey]) {
11668 // removed the last one
11669 [self removeEqScriptForKey:equipmentKey];
11670 }
11671}

◆ removeExternalStore:

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

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ removeFromPylon:

- (BOOL) removeFromPylon: (NSUInteger) pylon

Definition at line 9247 of file PlayerEntity.m.

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

◆ removeFunction:

- (void) removeFunction: (int) idx
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ removeMissiles

- (OOCreditsQuantity) removeMissiles
implementation

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

10678{
10679 [self safeAllMissiles];
10680 OOCreditsQuantity tradeIn = 0;
10681 unsigned i;
10682 for (i = 0; i < missiles; i++)
10683 {
10684 NSString *weapon_key = [missile_list[i] identifier];
10685
10686 if (weapon_key != nil)
10687 tradeIn += (int)[UNIVERSE getEquipmentPriceForKey:weapon_key];
10688 }
10689
10690 for (i = 0; i < max_missiles; i++)
10691 {
10692 [missile_entity[i] release];
10693 missile_entity[i] = nil;
10694 }
10695
10696 missiles = 0;
10697 return tradeIn;
10698}

Referenced by ShipAwardEquipment().

+ Here is the caller graph for this function:

◆ removeMissionDestination:

- (void) removeMissionDestination: (NSString *) destinations

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ removeMissionDestinationMarker:

- (BOOL) removeMissionDestinationMarker: (NSDictionary *) marker

Definition at line 9247 of file PlayerEntity.m.

13340 :(NSDictionary *)marker
13341{
13342 NSDictionary *validated = [self validatedMarker:marker];
13343 if (validated == nil)
13344 {
13345 return NO;
13346 }
13347 BOOL result = NO;
13348 if ([missionDestinations objectForKey:[self markerKey:validated]] != nil) {
13349 result = YES;
13350 }
13351 [missionDestinations removeObjectForKey:[self markerKey:validated]];
13352 return result;
13353}

◆ removeParcel:

- (BOOL) removeParcel: (NSString*) Name

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

Referenced by PlayerShipRemoveParcel().

+ Here is the caller graph for this function:

◆ removePassenger:

- (BOOL) removePassenger: (NSString*) Name

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

Referenced by PlayerShipRemovePassenger().

+ Here is the caller graph for this function:

◆ removeTrumble:

- (void) removeTrumble: (OOTrumble *) deadTrumble

Definition at line 9247 of file PlayerEntity.m.

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

◆ renovationCosts

- (double) renovationCosts

Definition at line 9247 of file PlayerEntity.m.

11926{
11927 // 5% of value of ships wear + correction for missing subentities.
11928 OOCreditsQuantity shipValue = [UNIVERSE tradeInValueForCommanderDictionary:[self commanderDataDictionary]];
11929
11930 double costs = 0.005 * (100 - ship_trade_in_factor) * shipValue;
11931 costs += 0.01 * shipValue * [self missingSubEntitiesAdjustment];
11932 costs *= [self renovationFactor];
11933 return cunningFee(costs, 0.05);
11934}
NSInteger missingSubEntitiesAdjustment()
double cunningFee(double value, double precision)

◆ renovationFactor

- (double) renovationFactor

Definition at line 9247 of file PlayerEntity.m.

11938{
11940 NSDictionary *shipyardInfo = [registry shipyardInfoForKey:[self shipDataKey]];
11941 return [shipyardInfo oo_doubleForKey:KEY_RENOVATION_MULTIPLIER defaultValue:1.0];
11942}

◆ replaceShipWithNamedShip:

- (BOOL) replaceShipWithNamedShip: (NSString *) shipName

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

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

Referenced by PlayerReplaceShip().

+ Here is the caller graph for this function:

◆ replaceVariablesInString:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ requestDockingClearance:

- (void) requestDockingClearance: (StationEntity *) stationForDocking

Definition at line 13735 of file PlayerEntity.m.

3637 :(StationEntity *)stationForDocking
3638{
3640 {
3641 [self performDockingRequest:stationForDocking];
3642 }
3643}

Referenced by PlayerShipRequestDockingClearance().

+ Here is the caller graph for this function:

◆ reset:

- (void) reset: (NSString *) missionvariable

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ resetAutopilotAI

- (void) resetAutopilotAI

Definition at line 13735 of file PlayerEntity.m.

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

◆ resetCustomView

- (void) resetCustomView

Definition at line 9247 of file PlayerEntity.m.

12625{
12626 [self setCustomViewDataFromDictionary:[_customViews oo_dictionaryAtIndex:_customViewIndex] withScaling:NO];
12627}

Referenced by PlayerShipResetCustomView().

+ Here is the caller graph for this function:

◆ resetHud

- (void) resetHud

Definition at line 13735 of file PlayerEntity.m.

4531{
4532 // set up defauld HUD for the ship
4533 NSDictionary *shipDict = [[OOShipRegistry sharedRegistry] shipInfoForKey:[self shipDataKey]];
4534 NSString *hud_desc = [shipDict oo_stringForKey:@"hud" defaultValue:@"hud.plist"];
4535 if (![self switchHudTo:hud_desc]) [self switchHudTo:@"hud.plist"]; // ensure we have a HUD to fall back to
4536}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ resetKeyFunctions

- (void) resetKeyFunctions

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ resetMissionChoice

- (void) resetMissionChoice

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ resetScannerZoom

- (void) resetScannerZoom

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

173{
174 scanner_zoom_rate = SCANNER_ZOOM_RATE_DOWN;
175}

Referenced by PlayerShipResetScannerZoom().

+ Here is the caller graph for this function:

◆ resetScriptTimer

- (void) resetScriptTimer

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ resetStickFunctions

- (void) resetStickFunctions

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ roleWeights

- (NSMutableArray *) roleWeights

◆ rotateCargo

- (void) rotateCargo

Definition at line 13735 of file PlayerEntity.m.

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

◆ runScriptActions:withContextName:forTarget:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ runUnsanitizedScriptActions:allowingAIMethods:withContextName:forTarget:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by ShipRunLegacyScriptActions().

+ Here is the caller graph for this function:

◆ safeAllMissiles

- (void) safeAllMissiles

Definition at line 13735 of file PlayerEntity.m.

5693{
5694 // sets all missile targets to NO_TARGET
5695
5696 unsigned i;
5697 for (i = 0; i < max_missiles; i++)
5698 {
5700 [missile_entity[i] removeTarget:nil];
5701 }
5703}

Referenced by StationDockPlayer().

+ Here is the caller graph for this function:

◆ saveCommanderInputHandler

- (void) saveCommanderInputHandler

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ saveKeySetting:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ savePlayer

- (void) savePlayer

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ savePlayerWithPanel

- (void) savePlayerWithPanel
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ scannedWormholes

- (NSArray *) scannedWormholes

◆ scannerFuzziness

- (double) scannerFuzziness

Definition at line 13735 of file PlayerEntity.m.

6099{
6100 double fuzz = 0.0;
6101
6102 /* Fuzziness from ECM bursts */
6103 if (last_ecm_time > 0.0)
6104 {
6105 double since = [UNIVERSE getTime] - last_ecm_time;
6106 if (since < SCANNER_ECM_FUZZINESS)
6107 {
6108 fuzz += (SCANNER_ECM_FUZZINESS - since) * (SCANNER_ECM_FUZZINESS - since) * 500.0;
6109 }
6110 }
6111 /* Other causes could go here */
6112
6113 return fuzz;
6114}
#define SCANNER_ECM_FUZZINESS

◆ scoopOverride

- (BOOL) scoopOverride

◆ score

- (unsigned) score

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

41{
42 return ship_kills;
43}

◆ score_number

- (NSNumber *) score_number

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ screenModeStringForWidth:height:refreshRate:

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

Definition at line 9247 of file PlayerEntity.m.

12234 :(unsigned)width height:(unsigned)height refreshRate:(float)refreshRate
12235{
12236 if (0.0f != refreshRate)
12237 {
12238 return OOExpandKey(@"gameoptions-fullscreen-with-refresh-rate", width, height, refreshRate);
12239 }
12240 else
12241 {
12242 return OOExpandKey(@"gameoptions-fullscreen", width, height);
12243 }
12244}

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

12879{
12880 return worldScripts != nil && [worldScripts count] > 0;
12881}

◆ scriptTarget

- (ShipEntity *) scriptTarget

Provided by category PlayerEntity(Scripting).

Definition at line 233 of file PlayerEntityLegacyScriptEngine.m.

255{
256 return scriptTarget;
257}

◆ scriptTestCondition:

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

Provided by category PlayerEntity(ScriptingPrivate).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ scriptTestConditions:

- (BOOL) scriptTestConditions: (NSArray *) array

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ scriptTimer

- (OOTimeDelta) scriptTimer

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

243{
244 return script_time;
245}

◆ scriptTimer_number

- (NSNumber *) scriptTimer_number

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ searchArrayForMatch:key:checkKeys:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ selectNextMissile

- (void) selectNextMissile

Definition at line 13735 of file PlayerEntity.m.

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

◆ selectNextMultiFunctionDisplay

- (void) selectNextMultiFunctionDisplay

Definition at line 13735 of file PlayerEntity.m.

5648{
5649 if ([[self hud] mfdCount] == 0) return;
5650 activeMFD = (activeMFD + 1) % [[self hud] mfdCount];
5651 NSUInteger mfdID = activeMFD + 1;
5652 [UNIVERSE addMessage:OOExpandKey(@"mfd-N-selected", mfdID) forCount:3.0 ];
5653 JSContext *context = OOJSAcquireContext();
5654 ShipScriptEvent(context, self, "selectedMFDChanged", INT_TO_JSVAL(activeMFD));
5655 OOJSRelinquishContext(context);
5656}

◆ selectPreviousMultiFunctionDisplay

- (void) selectPreviousMultiFunctionDisplay

Definition at line 13735 of file PlayerEntity.m.

5660{
5661 if ([[self hud] mfdCount] == 0) return;
5662 if (activeMFD == 0)
5663 {
5664 activeMFD = ([[self hud] mfdCount] - 1);
5665 }
5666 else
5667 {
5668 activeMFD = (activeMFD - 1);
5669 }
5670 NSUInteger mfdID = activeMFD + 1;
5671 [UNIVERSE addMessage:OOExpandKey(@"mfd-N-selected", mfdID) forCount:3.0 ];
5672 JSContext *context = OOJSAcquireContext();
5673 ShipScriptEvent(context, self, "selectedMFDChanged", INT_TO_JSVAL(activeMFD));
5674 OOJSRelinquishContext(context);
5675}

◆ sendAllShipsAway

- (void) sendAllShipsAway

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by SystemSendAllShipsAway().

+ Here is the caller graph for this function:

◆ sessionID

- (NSUInteger) sessionID
implementation

Reimplemented from Entity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ set:

- (void) set: (NSString *) missionvariable_value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setActiveMissile:

- (void) setActiveMissile: (NSUInteger) value

Definition at line 13735 of file PlayerEntity.m.

5454 :(NSUInteger)value
5455{
5456 activeMissile = value;
5457}

◆ setAftShieldLevel:

- (void) setAftShieldLevel: (GLfloat) level

Definition at line 13735 of file PlayerEntity.m.

4708 :(GLfloat)level
4709{
4710 aft_shield = OOClamp_0_max_f(level, [self maxAftShieldLevel]);
4711}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setAftShieldRechargeRate:

- (void) setAftShieldRechargeRate: (float) new

Definition at line 13735 of file PlayerEntity.m.

4684 :(float)new
4685{
4687}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setAlertFlag:to:

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

Definition at line 13735 of file PlayerEntity.m.

5802 :(int)flag to:(BOOL)value
5803{
5804 if (value)
5805 {
5806 alertFlags |= flag;
5807 }
5808 else
5809 {
5810 int comp = ~flag;
5811 alertFlags &= comp;
5812 }
5813}

◆ setBackgroundFromDescriptionsKey:

- (void) setBackgroundFromDescriptionsKey: (NSString*) d_key

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setBounty:

- (void) setBounty: (OOCreditsQuantity) amount
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6790 :(OOCreditsQuantity) amount
6791{
6792 [self setBounty:amount withReason:kOOLegalStatusReasonUnknown];
6793}

◆ setBounty:withReason:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6796 :(OOCreditsQuantity)amount withReason:(OOLegalStatusReason)reason
6797{
6798 NSString *nReason = OOStringFromLegalStatusReason(reason);
6799 [self setBounty:amount withReasonAsString:nReason];
6800}
NSString * OOStringFromLegalStatusReason(OOLegalStatusReason reason)

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setBounty:withReasonAsString:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6803 :(OOCreditsQuantity)amount withReasonAsString:(NSString *)reason
6804{
6805 JSContext *context = OOJSAcquireContext();
6806
6807 jsval amountVal = JSVAL_VOID;
6808 int amountVal2 = (int)amount-(int)legalStatus;
6809 JS_NewNumberValue(context, amountVal2, &amountVal);
6810
6811 legalStatus = (int)amount; // can't set the new bounty until the size of the change is known
6812
6813 jsval reasonVal = OOJSValueFromNativeObject(context,reason);
6814
6815 ShipScriptEvent(context, self, "shipBountyChanged", amountVal, reasonVal);
6816
6817 OOJSRelinquishContext(context);
6818}

◆ setCargoQuantityForType:amount:

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

Definition at line 9247 of file PlayerEntity.m.

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

Referenced by ManifestSetProperty().

+ Here is the caller graph for this function:

◆ setCommanderDataFromDictionary:

- (BOOL) setCommanderDataFromDictionary: (NSDictionary *) dict

Definition at line 13735 of file PlayerEntity.m.

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

◆ setCommanderName:

- (void) setCommanderName: (NSString *) value

Definition at line 9247 of file PlayerEntity.m.

13092 :(NSString *)value
13093{
13094 NSParameterAssert(value != nil);
13095 [_commanderName autorelease];
13096 _commanderName = [value copy];
13097}

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setCompassMode:

- (void) setCompassMode: (OOCompassMode) value

Definition at line 13735 of file PlayerEntity.m.

5311 :(OOCompassMode) value
5312{
5313 compassMode = value;
5314}
OOCompassMode
Definition OOTypes.h:145

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setCompassTarget:

- (void) setCompassTarget: (Entity *) value

Definition at line 13735 of file PlayerEntity.m.

5203 :(Entity *)value
5204{
5205 [compassTarget release];
5206 compassTarget = [value weakRetain];
5207}

◆ setCreditBalance:

- (void) setCreditBalance: (double) value

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setCustomChartCentre:

- (void) setCustomChartCentre: (NSPoint) coords

Definition at line 13735 of file PlayerEntity.m.

583 :(NSPoint)coords
584{
587}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setCustomChartZoom:

- (void) setCustomChartZoom: (OOScalar) zoom

Definition at line 13735 of file PlayerEntity.m.

571 :(OOScalar)zoom
572{
573 custom_chart_zoom = zoom;
574}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setCustomViewData

◆ setCustomViewDataFromDictionary:withScaling:

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

Definition at line 9247 of file PlayerEntity.m.

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

Referenced by PlayerShipSetCustomView().

+ Here is the caller graph for this function:

◆ setCustomViewOffset:

- (void) setCustomViewOffset: (Vector) offset

Definition at line 9247 of file PlayerEntity.m.

12452 :(Vector) offset
12453{
12455}

◆ setCustomViewQuaternion:

- (void) setCustomViewQuaternion: (Quaternion) q1

Definition at line 9247 of file PlayerEntity.m.

12433 :(Quaternion)q
12434{
12436 [self setCustomViewData];
12437}

◆ setCustomViewRotationCenter:

- (void) setCustomViewRotationCenter: (Vector) center

Definition at line 9247 of file PlayerEntity.m.

12464 :(Vector) center
12465{
12466 customViewRotationCenter = center;
12467}

◆ setDefaultCustomViews

- (void) setDefaultCustomViews

Definition at line 9247 of file PlayerEntity.m.

11959{
11960 NSArray *customViews = [[[OOShipRegistry sharedRegistry] shipInfoForKey:PLAYER_SHIP_DESC] oo_arrayForKey:@"custom_views"];
11961
11962 [_customViews release];
11963 _customViews = nil;
11964 _customViewIndex = 0;
11965 if (customViews != nil)
11966 {
11967 _customViews = [customViews retain];
11968 }
11969}

◆ setDefaultViewOffsets

- (void) setDefaultViewOffsets

Definition at line 9247 of file PlayerEntity.m.

11946{
11947 float halfLength = 0.5f * (boundingBox.max.z - boundingBox.min.z);
11948 float halfWidth = 0.5f * (boundingBox.max.x - boundingBox.min.x);
11949
11950 forwardViewOffset = make_vector(0.0f, 0.0f, boundingBox.max.z - halfLength);
11951 aftViewOffset = make_vector(0.0f, 0.0f, boundingBox.min.z + halfLength);
11952 portViewOffset = make_vector(boundingBox.min.x + halfWidth, 0.0f, 0.0f);
11953 starboardViewOffset = make_vector(boundingBox.max.x - halfWidth, 0.0f, 0.0f);
11955}
Vector starboardViewOffset
Vector portViewOffset
Vector aftViewOffset

◆ setDialCustom:forKey:

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

Definition at line 13735 of file PlayerEntity.m.

4624 :(id)value forKey:(NSString *)dialKey
4625{
4626 [customDialSettings setObject:value forKey:dialKey];
4627}

Referenced by PlayerShipSetCustomHUDDial().

+ Here is the caller graph for this function:

◆ setDialIdentEngaged:

- (void) setDialIdentEngaged: (BOOL) newValue

Definition at line 13735 of file PlayerEntity.m.

5472 :(BOOL)newValue
5473{
5474 ident_engaged = !!newValue;
5475}

◆ setDockedAtMainStation

- (void) setDockedAtMainStation

Definition at line 13735 of file PlayerEntity.m.

4493{
4494 [self setDockedStation:[UNIVERSE station]];
4495 if (_dockedStation != nil) [self setStatus:STATUS_DOCKED];
4496}
OOWeakReference * _dockedStation

◆ setDockedStation:

- (void) setDockedStation: (StationEntity *) station

Definition at line 13735 of file PlayerEntity.m.

4505 :(StationEntity *)station
4506{
4507 [_dockedStation release];
4508 _dockedStation = [station weakRetain];
4509}

◆ setDockingClearanceStatus:

- (void) setDockingClearanceStatus: (OODockingClearanceStatus) newValue

Definition at line 9247 of file PlayerEntity.m.

13175 :(OODockingClearanceStatus)newValue
13176{
13177 dockingClearanceStatus = newValue;
13179 {
13181 }
13183 {
13184 if ([[self primaryTarget] isStation])
13185 {
13186 targetDockStation = [self primaryTarget];
13187 }
13188 else
13189 {
13190 OOLog(@"player.badDockingTarget", @"Attempt to dock at %@.", [self primaryTarget]);
13193 }
13194 }
13195}
OODockingClearanceStatus
Definition OOTypes.h:167
@ DOCKING_CLEARANCE_STATUS_NONE
Definition OOTypes.h:168

Referenced by StationDockPlayer().

+ Here is the caller graph for this function:

◆ setDockTarget:

- (void) setDockTarget: (ShipEntity *) entity

Definition at line 9247 of file PlayerEntity.m.

13058 :(ShipEntity *)entity
13059{
13060if ([entity isStation]) _dockTarget = [entity universalID];
13061else _dockTarget = NO_TARGET;
13062 //_dockTarget = [entity isStation] ? [entity universalID]: NO_TARGET;
13063}
@ NO_TARGET
Definition OOTypes.h:194
OOUniversalID universalID
Definition Entity.h:89
OOUniversalID _dockTarget

Referenced by PlayerSetEscapePodDestination().

+ Here is the caller graph for this function:

◆ setEquipScreenBackgroundDescriptor:

- (void) setEquipScreenBackgroundDescriptor: (NSDictionary *) descriptor

Definition at line 9247 of file PlayerEntity.m.

12868 :(NSDictionary *)descriptor
12869{
12870 if (descriptor != _equipScreenBackgroundDescriptor)
12871 {
12872 [_equipScreenBackgroundDescriptor autorelease];
12873 _equipScreenBackgroundDescriptor = [descriptor copy];
12874 }
12875}

◆ setEscapePodRescueTime:

- (void) setEscapePodRescueTime: (double) seconds

Definition at line 13735 of file PlayerEntity.m.

4911 :(double)seconds
4912{
4913 escape_pod_rescue_time = seconds;
4914}

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

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

Referenced by GlobalSetExtraGuiScreenKeys().

+ Here is the caller graph for this function:

◆ setExtraMissionKeys:

- (void) setExtraMissionKeys: (NSDictionary *) keys

Definition at line 9247 of file PlayerEntity.m.

13381 :(NSDictionary *)keys
13382{
13383 NSString *key = nil;
13384 NSMutableDictionary *final = [[NSMutableDictionary alloc] init];
13385 foreach (key, [keys allKeys])
13386 {
13387 [final setObject:[self processKeyCode:[keys oo_arrayForKey:key]] forKey:key];
13388 }
13389 extraMissionKeys = [final copy];
13390 [final release];
13391}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setFastEquipmentA:

- (void) setFastEquipmentA: (NSString *) eqKey

Definition at line 13735 of file PlayerEntity.m.

8295 :(NSString *)eqKey
8296{
8297 [_fastEquipmentA release];
8298 _fastEquipmentA = [eqKey copy];
8299}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setFastEquipmentB:

- (void) setFastEquipmentB: (NSString *) eqKey

Definition at line 13735 of file PlayerEntity.m.

8302 :(NSString *)eqKey
8303{
8304 [_fastEquipmentB release];
8305 _fastEquipmentB = [eqKey copy];
8306}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setForwardShieldLevel:

- (void) setForwardShieldLevel: (GLfloat) level

Definition at line 13735 of file PlayerEntity.m.

4702 :(GLfloat)level
4703{
4704 forward_shield = OOClamp_0_max_f(level, [self maxForwardShieldLevel]);
4705}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setForwardShieldRechargeRate:

- (void) setForwardShieldRechargeRate: (float) new

Definition at line 13735 of file PlayerEntity.m.

4678 :(float)new
4679{
4681}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setFoundTarget:

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

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

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

◆ setFuelLeak:

- (void) setFuelLeak: (NSString *) value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setFuelLeakRate:

- (void) setFuelLeakRate: (float) value

Definition at line 13735 of file PlayerEntity.m.

5010 :(float)value
5011{
5012 fuel_leak_rate = fmax(value, 0.0f);
5013}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceBehaviour:

- (void) setGalacticHyperspaceBehaviour: (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour

Definition at line 9247 of file PlayerEntity.m.

12975 :(OOGalacticHyperspaceBehaviour)inBehaviour
12976{
12977 if (GALACTIC_HYPERSPACE_BEHAVIOUR_UNKNOWN < inBehaviour && inBehaviour <= GALACTIC_HYPERSPACE_MAX)
12978 {
12979 galacticHyperspaceBehaviour = inBehaviour;
12980 }
12981}
OOGalacticHyperspaceBehaviour
@ GALACTIC_HYPERSPACE_MAX

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceBehaviourTo:

- (void) setGalacticHyperspaceBehaviourTo: (NSString *) galacticHyperspaceBehaviourString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setGalacticHyperspaceFixedCoords:

- (void) setGalacticHyperspaceFixedCoords: (NSPoint) point

Definition at line 9247 of file PlayerEntity.m.

12990 :(NSPoint)point
12991{
12992 return [self setGalacticHyperspaceFixedCoordsX:OOClamp_0_max_f(round(point.x), 255.0f) y:OOClamp_0_max_f(round(point.y), 255.0f)];
12993}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setGalacticHyperspaceFixedCoordsTo:

- (void) setGalacticHyperspaceFixedCoordsTo: (NSString *) galacticHyperspaceFixedCoordsString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setGalacticHyperspaceFixedCoordsX:y:

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

Definition at line 9247 of file PlayerEntity.m.

12996 :(unsigned char)x y:(unsigned char)y
12997{
13000}
NSPoint galacticHyperspaceFixedCoords

◆ setGalaxyCoordinates:

- (void) setGalaxyCoordinates: (NSPoint) newPosition

Definition at line 13735 of file PlayerEntity.m.

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

◆ setGuiToChartScreenFrom:

- (void) setGuiToChartScreenFrom: (OOGUIScreenID) oldScreen

Definition at line 13735 of file PlayerEntity.m.

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

◆ setGuiToConfirmClearScreen

- (void) setGuiToConfirmClearScreen

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ setGuiToDockingReportScreen

- (void) setGuiToDockingReportScreen

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ setGuiToEquipShipScreen:

- (void) setGuiToEquipShipScreen: (int) skip

Definition at line 9247 of file PlayerEntity.m.

9692 :(int)skip
9693{
9694 [self setGuiToEquipShipScreen:skip selectingFacingFor:nil];
9695}

Referenced by activateSelectedInterface.

+ Here is the caller graph for this function:

◆ setGuiToEquipShipScreen:selectingFacingFor:

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

Definition at line 9247 of file PlayerEntity.m.

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

◆ setGuiToGameOptionsScreen

- (void) setGuiToGameOptionsScreen

Definition at line 8862 of file PlayerEntity.m.

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

◆ setGuiToInterfacesScreen:

- (void) setGuiToInterfacesScreen: (int) skip

Definition at line 9247 of file PlayerEntity.m.

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

◆ setGuiToKeyboardLayoutScreen:

- (void) setGuiToKeyboardLayoutScreen: (unsigned) skip

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ setGuiToKeyboardLayoutScreen:resetCurrentRow:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ setGuiToKeyConfigEntryScreen

- (void) setGuiToKeyConfigEntryScreen

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ setGuiToKeyConfigScreen

- (void) setGuiToKeyConfigScreen

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ setGuiToKeyConfigScreen:

- (void) setGuiToKeyConfigScreen: (BOOL) resetSelectedRow

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ setGuiToKeyMapperScreen:

- (void) setGuiToKeyMapperScreen: (unsigned) skip

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ setGuiToKeyMapperScreen:resetCurrentRow:

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

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

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

◆ setGuiToLoadCommanderScreen

- (void) setGuiToLoadCommanderScreen
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ setGuiToLoadSaveScreen

- (void) setGuiToLoadSaveScreen

Definition at line 8862 of file PlayerEntity.m.

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

◆ setGuiToLongRangeChartScreen

- (void) setGuiToLongRangeChartScreen

Definition at line 13735 of file PlayerEntity.m.

8780{
8781 OOGUIScreenID oldScreen = gui_screen;
8782 GuiDisplayGen *gui = [UNIVERSE gui];
8783 [gui clearAndKeepBackground:NO];
8784 [gui setBackgroundTextureKey:@"short_range_chart"];
8785 [self setMissionBackgroundSpecial: nil];
8786 gui_screen = GUI_SCREEN_LONG_RANGE_CHART;
8788 [self setGuiToChartScreenFrom: oldScreen];
8789}

◆ setGuiToManifestScreen

- (void) setGuiToManifestScreen

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ setGuiToMarketInfoScreen

- (void) setGuiToMarketInfoScreen

Definition at line 9247 of file PlayerEntity.m.

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

◆ setGuiToMarketScreen

- (void) setGuiToMarketScreen

Definition at line 9247 of file PlayerEntity.m.

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

◆ setGuiToMissionEndScreen

- (void) setGuiToMissionEndScreen
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ setGuiToMissionScreen

- (void) setGuiToMissionScreen

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setGuiToMissionScreenWithCallback:

- (void) setGuiToMissionScreenWithCallback: (BOOL) callback

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setGuiToOverwriteScreen:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ setGuiToOXZManager

- (void) setGuiToOXZManager

Definition at line 9247 of file PlayerEntity.m.

10124{
10125
10126 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:NO];
10127 [[UNIVERSE gameView] clearMouse];
10128 [UNIVERSE removeDemoShips];
10129
10130 gui_screen = GUI_SCREEN_OXZMANAGER;
10131
10132 [[UNIVERSE gui] clearAndKeepBackground:NO];
10133
10135
10137 [[UNIVERSE gui] setBackgroundTextureKey:@"oxz-manager"];
10138 [UNIVERSE enterGUIViewModeWithMouseInteraction:YES];
10139}

◆ setGuiToSaveCommanderScreen:

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ setGuiToScenarioScreen:

- (void) setGuiToScenarioScreen: (int) page

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

◆ setGuiToShipyardScreen:

- (void) setGuiToShipyardScreen: (NSUInteger) skip

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

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

◆ setGuiToShortRangeChartScreen

- (void) setGuiToShortRangeChartScreen

Definition at line 13735 of file PlayerEntity.m.

8792{
8793 OOGUIScreenID oldScreen = gui_screen;
8794 GuiDisplayGen *gui = [UNIVERSE gui];
8795 [gui clearAndKeepBackground:NO];
8796 [gui setBackgroundTextureKey:@"short_range_chart"];
8797 [self setMissionBackgroundSpecial: nil];
8798 gui_screen = GUI_SCREEN_SHORT_RANGE_CHART;
8799 [self setGuiToChartScreenFrom: oldScreen];
8800}

◆ setGuiToStatusScreen

- (void) setGuiToStatusScreen

Definition at line 13735 of file PlayerEntity.m.

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

◆ setGuiToStickMapperScreen:

- (void) setGuiToStickMapperScreen: (unsigned) skip

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ setGuiToStickMapperScreen:resetCurrentRow:

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

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ setGuiToStickProfileScreen:

- (void) setGuiToStickProfileScreen: (GuiDisplayGen *) gui

Provided by category PlayerEntity(StickProfile).

Definition at line 43 of file PlayerEntityStickProfile.m.

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

◆ setGuiToSystemDataScreen

- (void) setGuiToSystemDataScreen

Definition at line 13735 of file PlayerEntity.m.

8494{
8495 [self setGuiToSystemDataScreenRefreshBackground: NO];
8496}

◆ setGuiToSystemDataScreenRefreshBackground:

- (void) setGuiToSystemDataScreenRefreshBackground: (BOOL) refreshBackground

Definition at line 13735 of file PlayerEntity.m.

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

◆ setInfoSystemID:moveChart:

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

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setJSSelf:context:

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

Provided by category PlayerEntity(OOJavaScriptExtensions).

Definition at line 1860 of file OOJSPlayerShip.m.

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

Referenced by InitOOJSPlayerShip().

+ Here is the caller graph for this function:

◆ setJumpCause:

- (void) setJumpCause: (NSString *) value

Definition at line 9247 of file PlayerEntity.m.

13072 :(NSString *)value
13073{
13074 NSParameterAssert(value != nil);
13075 [_jumpCause autorelease];
13076 _jumpCause = [value copy];
13077}

◆ setJumpType:

- (void) setJumpType: (BOOL) isGalacticJump

Definition at line 13735 of file PlayerEntity.m.

7484 :(BOOL)isGalacticJump
7485{
7486 if (isGalacticJump)
7487 {
7488 galactic_witchjump = YES;
7489 }
7490 else
7491 {
7492 galactic_witchjump = NO;
7493 }
7494}

Referenced by PlayerShipBeginGalacticHyperspaceCountdown(), and PlayerShipCancelHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ setLastsaveName:

- (void) setLastsaveName: (NSString *) value

Definition at line 9247 of file PlayerEntity.m.

13100 :(NSString *)value
13101{
13102 NSParameterAssert(value != nil);
13103 [_lastsaveName autorelease];
13104 _lastsaveName = [value copy];
13105}

◆ setLastShot:

- (void) setLastShot: (NSArray *) shot

Definition at line 9247 of file PlayerEntity.m.

13368 :(NSArray *)shot
13369{
13370 lastShot = [shot retain];
13371}

◆ setLegalStatus:

- (void) setLegalStatus: (NSString *) valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setLocalVariable:forKey:andMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setLongRangeChartMode:

- (void) setLongRangeChartMode: (OOLongRangeChartMode) mode

Definition at line 9247 of file PlayerEntity.m.

13021{
13023}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

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

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

Provided by category PlayerEntity(Contracts).

Definition at line 1998 of file PlayerEntityContracts.m.

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

◆ setMassLockable:

- (void) setMassLockable: (BOOL) newValue

Definition at line 13735 of file PlayerEntity.m.

4455 :(BOOL)newValue
4456{
4457 massLockable = !!newValue;
4458 [self updateAlertCondition];
4459}
unsigned massLockable

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setMaxAftShieldLevel:

- (void) setMaxAftShieldLevel: (float) new

Definition at line 13735 of file PlayerEntity.m.

4672 :(float)new
4673{
4674 max_aft_shield = new;
4675}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setMaxFlightPitch:

- (void) setMaxFlightPitch: (GLfloat) new
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

3338 :(GLfloat)new
3339{
3340 max_flight_pitch = new;
3341 pitch_delta = 2.0 * new;
3342}

◆ setMaxFlightRoll:

- (void) setMaxFlightRoll: (GLfloat) new
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

3345 :(GLfloat)new
3346{
3347 max_flight_roll = new;
3348 roll_delta = 2.0 * new;
3349}

◆ setMaxFlightYaw:

- (void) setMaxFlightYaw: (GLfloat) new
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

3352 :(GLfloat)new
3353{
3354 max_flight_yaw = new;
3355 yaw_delta = 2.0 * new;
3356}

◆ setMaxForwardShieldLevel:

- (void) setMaxForwardShieldLevel: (float) new

Definition at line 13735 of file PlayerEntity.m.

4666 :(float)new
4667{
4668 max_forward_shield = new;
4669}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setMissionBackground:

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

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setMissionBackgroundDescriptor:

- (void) setMissionBackgroundDescriptor: (NSDictionary *) descriptor

Definition at line 9247 of file PlayerEntity.m.

12744 :(NSDictionary *)descriptor
12745{
12746 if (descriptor != _missionBackgroundDescriptor)
12747 {
12748 [_missionBackgroundDescriptor autorelease];
12749 _missionBackgroundDescriptor = [descriptor copy];
12750 }
12751}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionBackgroundSpecial:

- (void) setMissionBackgroundSpecial: (NSString *) special

Definition at line 9247 of file PlayerEntity.m.

12760 :(NSString *)special
12761{
12762 if (special == nil) {
12764 }
12765 else if ([special isEqualToString:@"SHORT_RANGE_CHART"])
12766 {
12768 }
12769 else if ([special isEqualToString:@"SHORT_RANGE_CHART_SHORTEST"])
12770 {
12771 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12772 {
12774 }
12775 else
12776 {
12778 }
12779 }
12780 else if ([special isEqualToString:@"SHORT_RANGE_CHART_QUICKEST"])
12781 {
12782 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12783 {
12785 }
12786 else
12787 {
12789 }
12790 }
12791 else if ([special isEqualToString:@"CUSTOM_CHART"])
12792 {
12794 }
12795 else if ([special isEqualToString:@"CUSTOM_CHART_SHORTEST"])
12796 {
12797 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12798 {
12800 }
12801 else
12802 {
12804 }
12805 }
12806 else if ([special isEqualToString:@"CUSTOM_CHART_QUICKEST"])
12807 {
12808 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12809 {
12811 }
12812 else
12813 {
12815 }
12816 }
12817 else if ([special isEqualToString:@"LONG_RANGE_CHART"])
12818 {
12820 }
12821 else if ([special isEqualToString:@"LONG_RANGE_CHART_SHORTEST"])
12822 {
12823 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12824 {
12826 }
12827 else
12828 {
12830 }
12831 }
12832 else if ([special isEqualToString:@"LONG_RANGE_CHART_QUICKEST"])
12833 {
12834 if ([self hasEquipmentItemProviding:@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
12835 {
12837 }
12838 else
12839 {
12841 }
12842 }
12843 else
12844 {
12846 }
12847}
@ GUI_BACKGROUND_SPECIAL_NONE

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionChoice:

- (void) setMissionChoice: (NSString *) newChoice

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ setMissionChoice:keyPress:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ setMissionChoice:keyPress:withEvent:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

Referenced by MissionRunCallback().

+ Here is the caller graph for this function:

◆ setMissionChoice:withEvent:

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

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

◆ setMissionChoiceByTextEntry:

- (void) setMissionChoiceByTextEntry: (BOOL) enable

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionChoices:

- (void) setMissionChoices: (NSString *) choicesKey

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionChoicesDictionary:

- (void) setMissionChoicesDictionary: (NSDictionary *) choicesDict

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionDescription:

- (void) setMissionDescription: (NSString *) textKey

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setMissionDescription:forMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ setMissionExitScreen:

- (void) setMissionExitScreen: (OOGUIScreenID) screen

Definition at line 9247 of file PlayerEntity.m.

12850 :(OOGUIScreenID)screen
12851{
12852 _missionExitScreen = screen;
12853}

Referenced by MissionRunScreen(), and MissionSetProperty().

+ Here is the caller graph for this function:

◆ setMissionImage:

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

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setMissionInstructions:forMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ setMissionInstructionsList:forMission:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionSetInstructionsInternal().

+ Here is the caller graph for this function:

◆ setMissionMusic:

- (void) setMissionMusic: (NSString *) value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionOverlayDescriptor:

- (void) setMissionOverlayDescriptor: (NSDictionary *) descriptor

Definition at line 9247 of file PlayerEntity.m.

12716 :(NSDictionary *)descriptor
12717{
12718 if (descriptor != _missionOverlayDescriptor)
12719 {
12720 [_missionOverlayDescriptor autorelease];
12721 _missionOverlayDescriptor = [descriptor copy];
12722 }
12723}

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionScreenID:

- (void) setMissionScreenID: (NSString *) msid

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionTitle:

- (void) setMissionTitle: (NSString *) value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionRunScreen().

+ Here is the caller graph for this function:

◆ setMissionVariable:forKey:

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

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by MissionVariablesDeleteProperty(), and MissionVariablesSetProperty().

+ Here is the caller graph for this function:

◆ setMultiFunctionDisplay:toKey:

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

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerShipSetMultiFunctionDisplay().

+ Here is the caller graph for this function:

◆ setMultiFunctionText:forKey:

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

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerShipSetMultiFunctionText().

+ Here is the caller graph for this function:

◆ setName:

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

Reimplemented from ShipEntity.

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

5387{
5388 OOAegisStatus aegis = AEGIS_NONE;
5389 Entity <OOBeaconEntity> *beacon = nil;
5390
5391 switch (compassMode)
5392 {
5393 case COMPASS_MODE_INACTIVE:
5394 case COMPASS_MODE_BASIC:
5395 case COMPASS_MODE_PLANET:
5396 aegis = [self checkForAegis];
5397 if ([UNIVERSE station] && (aegis == AEGIS_CLOSE_TO_MAIN_PLANET || aegis == AEGIS_IN_DOCKING_RANGE))
5398 {
5399 [self setCompassMode:COMPASS_MODE_STATION];
5400 }
5401 else
5402 {
5403 [self setCompassMode:COMPASS_MODE_SUN];
5404 }
5405 break;
5406
5407 case COMPASS_MODE_STATION:
5408 [self setCompassMode:COMPASS_MODE_SUN];
5409 break;
5410
5411 case COMPASS_MODE_SUN:
5412 if ([self primaryTarget])
5413 {
5414 [self setCompassMode:COMPASS_MODE_TARGET];
5415 break;
5416 }
5417 // else fall through to switch to beacon mode.
5418
5419 case COMPASS_MODE_TARGET:
5420 beacon = [UNIVERSE firstBeacon];
5421 while (beacon != nil && [beacon isJammingScanning])
5422 {
5423 beacon = [beacon nextBeacon];
5424 }
5425 [self setNextBeacon:beacon];
5426
5427 if (beacon != nil) [self setCompassMode:COMPASS_MODE_BEACONS];
5428 else [self setCompassMode:COMPASS_MODE_PLANET];
5429 break;
5430
5431 case COMPASS_MODE_BEACONS:
5432 beacon = [self nextBeacon];
5433 do
5434 {
5435 beacon = [beacon nextBeacon];
5436 } while (beacon != nil && [beacon isJammingScanning]);
5437 [self setNextBeacon:beacon];
5438
5439 if (beacon == nil)
5440 {
5441 [self setCompassMode:COMPASS_MODE_PLANET];
5442 }
5443 break;
5444 }
5445}
OOAegisStatus
Definition OOTypes.h:60
@ AEGIS_IN_DOCKING_RANGE
Definition OOTypes.h:64
@ AEGIS_CLOSE_TO_MAIN_PLANET
Definition OOTypes.h:63
@ AEGIS_NONE
Definition OOTypes.h:61

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setNormalOrientation:

- (void) setNormalOrientation: (Quaternion) quat
implementation

Reimplemented from Entity.

Definition at line 13735 of file PlayerEntity.m.

4346 :(Quaternion) quat
4347{
4348 [self setOrientation:make_quaternion(-quat.w, quat.x, quat.y, quat.z)];
4349}

◆ setOcclusionLevel:

- (void) setOcclusionLevel: (float) level

Definition at line 13735 of file PlayerEntity.m.

4486 :(float)level
4487{
4488 occlusion_dial = level;
4489}

◆ setPlanetinfo:

- (void) setPlanetinfo: (NSString *) key_valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setPrevCompassMode

- (void) setPrevCompassMode

Definition at line 13735 of file PlayerEntity.m.

5318{
5319 OOAegisStatus aegis = AEGIS_NONE;
5320 Entity <OOBeaconEntity> *beacon = nil;
5321
5322 switch (compassMode)
5323 {
5324 case COMPASS_MODE_INACTIVE:
5325 case COMPASS_MODE_BASIC:
5326 case COMPASS_MODE_PLANET:
5327 beacon = [UNIVERSE lastBeacon];
5328 while (beacon != nil && [beacon isJammingScanning])
5329 {
5330 beacon = [beacon prevBeacon];
5331 }
5332 [self setNextBeacon:beacon];
5333
5334 if (beacon != nil)
5335 {
5336 [self setCompassMode:COMPASS_MODE_BEACONS];
5337 break;
5338 }
5339 // else fall through to switch to target mode.
5340
5341 case COMPASS_MODE_BEACONS:
5342 beacon = [self nextBeacon];
5343 do
5344 {
5345 beacon = [beacon prevBeacon];
5346 } while (beacon != nil && [beacon isJammingScanning]);
5347 [self setNextBeacon:beacon];
5348
5349 if (beacon == nil)
5350 {
5351 if ([self primaryTarget])
5352 {
5353 [self setCompassMode:COMPASS_MODE_TARGET];
5354 }
5355 else
5356 {
5357 [self setCompassMode:COMPASS_MODE_SUN];
5358 }
5359 break;
5360 }
5361 break;
5362
5363 case COMPASS_MODE_TARGET:
5364 [self setCompassMode:COMPASS_MODE_SUN];
5365 break;
5366
5367 case COMPASS_MODE_SUN:
5368 aegis = [self checkForAegis];
5369 if (aegis == AEGIS_CLOSE_TO_MAIN_PLANET || aegis == AEGIS_IN_DOCKING_RANGE)
5370 {
5371 [self setCompassMode:COMPASS_MODE_STATION];
5372 }
5373 else
5374 {
5375 [self setCompassMode:COMPASS_MODE_PLANET];
5376 }
5377 break;
5378
5379 case COMPASS_MODE_STATION:
5380 [self setCompassMode:COMPASS_MODE_PLANET];
5381 break;
5382 }
5383}

◆ setPreviousSystemID:

- (void) setPreviousSystemID: (OOSystemID) sid

Definition at line 13735 of file PlayerEntity.m.

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

◆ setPrimedEquipment:showMessage:

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

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setRandom_factor:

- (void) setRandom_factor: (int) rf

Definition at line 13735 of file PlayerEntity.m.

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

◆ setScoopOverride:

- (void) setScoopOverride: (BOOL) newValue

Definition at line 9247 of file PlayerEntity.m.

13032 :(BOOL)newValue
13033{
13034 scoopOverride = !!newValue;
13035 if (scoopOverride) [self setScoopsActive];
13036}
unsigned scoopOverride

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setScoopsActive

- (void) setScoopsActive

Definition at line 9247 of file PlayerEntity.m.

12254{
12255 scoopsActive = YES;
12256}

◆ setScore:

- (void) setScore: (unsigned) value

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

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

Referenced by PlayerSetProperty().

+ Here is the caller graph for this function:

◆ setScriptTarget:

- (void) setScriptTarget: (ShipEntity *) ship

Provided by category PlayerEntity(Scripting).

Definition at line 233 of file PlayerEntityLegacyScriptEngine.m.

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

Referenced by OOPlayerForScripting(), and ShipRunLegacyScriptActions().

+ Here is the caller graph for this function:

◆ setShowDemoShips:

- (void) setShowDemoShips: (BOOL) value

Definition at line 13735 of file PlayerEntity.m.

4630 :(BOOL)value
4631{
4632 showDemoShips = value;
4633}

◆ setSpecificPlanetInfo:

- (void) setSpecificPlanetInfo: (NSString *) key_valueString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setSunNovaIn:

- (void) setSunNovaIn: (NSString *) time_value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ setSystemID:

- (void) setSystemID: (OOSystemID) sid

Definition at line 13735 of file PlayerEntity.m.

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

◆ setTargetDockStationTo:

- (void) setTargetDockStationTo: (StationEntity *) value

Definition at line 13735 of file PlayerEntity.m.

4512 :(StationEntity *) value
4513{
4514 targetDockStation = value;
4515}

◆ setTargetSystemID:

- (void) setTargetSystemID: (OOSystemID) sid

Definition at line 13735 of file PlayerEntity.m.

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

Referenced by PlayerSetEscapePodDestination(), and PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ setTrumbleAppetiteAccumulator:

- (void) setTrumbleAppetiteAccumulator: (float) value

Definition at line 9247 of file PlayerEntity.m.

12216 :(float)value
12217{
12219}
float _trumbleAppetiteAccumulator

◆ setTrumbleValueFrom:

- (void) setTrumbleValueFrom: (NSObject *) trumbleValue

Definition at line 9247 of file PlayerEntity.m.

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

◆ setUpAndConfirmOK:

- (BOOL) setUpAndConfirmOK: (BOOL) stopOnError

Definition at line 13735 of file PlayerEntity.m.

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

◆ setUpAndConfirmOK:saveGame:

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

Definition at line 13735 of file PlayerEntity.m.

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

◆ setUpShipFromDictionary:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ setUpSound

- (void) setUpSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

74{
75 [self destroySound];
76
77 sInterfaceBeepSource = [[OOSoundSource alloc] init];
78 [sInterfaceBeepSource setPosition:kInterfaceBeepPosition];
79
80 sBreakPatternSource = [[OOSoundSource alloc] init];
81 [sBreakPatternSource setPosition:kBreakPatternPosition];
82
83 sEcmSource = [[OOSoundSource alloc] init];
84 [sEcmSource setPosition:kEcmPosition];
85
87 [sHyperspaceSoundSource setPosition:kWitchspacePosition];
88
89 sBuySellSourcePool = [[OOSoundSourcePool alloc] initWithCount:kBuySellSourcePoolSize minRepeatTime:0.0];
90 sWarningSoundPool = [[OOSoundSourcePool alloc] initWithCount:kWarningPoolSize minRepeatTime:0.0];
91 sWeaponSoundPool = [[OOSoundSourcePool alloc] initWithCount:kWeaponPoolSize minRepeatTime:0.0];
92 sDamageSoundPool = [[OOSoundSourcePool alloc] initWithCount:kDamagePoolSize minRepeatTime:0.1]; // Repeat time limit is to avoid playing a scrape sound every frame on glancing scrapes. This does limit the number of laser hits that can be played in a furrball, though; maybe lasers and scrapes should use different pools.
93 sMiscSoundPool = [[OOSoundSourcePool alloc] initWithCount:kMiscPoolSize minRepeatTime:0.0];
94
95 // Two sources with the same sound are used to simulate looping.
96 OOSound *afterburnerSound = [ResourceManager ooSoundNamed:@"afterburner1.ogg" inFolder:@"Sounds"];
97 sAfterburnerSources[0] = [[OOSoundSource alloc] initWithSound:afterburnerSound];
98 [sAfterburnerSources[0] setPosition:kAfterburner1Position];
99 sAfterburnerSources[1] = [[OOSoundSource alloc] initWithSound:afterburnerSound];
100 [sAfterburnerSources[1] setPosition:kAfterburner2Position];
101}
OOSound * ooSoundNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)

◆ setupStartScreenGui

- (void) setupStartScreenGui

Definition at line 9247 of file PlayerEntity.m.

9927{
9928 GuiDisplayGen *gui = [UNIVERSE gui];
9929 NSString *text = nil;
9930
9931 [[UNIVERSE gameController] setMouseInteractionModeForUIWithMouseInteraction:YES];
9932
9933 [gui clear];
9934
9935 [gui setTitle:@"Oolite"];
9936
9937 text = DESC(@"game-copyright");
9938 [gui setText:text forRow:15 align:GUI_ALIGN_CENTER];
9939 [gui setColor:[OOColor whiteColor] forRow:15];
9940
9941 text = DESC(@"theme-music-credit");
9942 [gui setText:text forRow:17 align:GUI_ALIGN_CENTER];
9943 [gui setColor:[OOColor grayColor] forRow:17];
9944
9945 int initialRow = 22;
9946 int row = initialRow;
9947
9948 text = DESC(@"oolite-start-option-1");
9949 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9950 [gui setColor:[OOColor yellowColor] forRow:row];
9951 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9952
9953 ++row;
9954
9955 text = DESC(@"oolite-start-option-2");
9956 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9957 [gui setColor:[OOColor yellowColor] forRow:row];
9958 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9959
9960 ++row;
9961
9962 text = DESC(@"oolite-start-option-3");
9963 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9964 [gui setColor:[OOColor yellowColor] forRow:row];
9965 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9966
9967 ++row;
9968
9969 text = DESC(@"oolite-start-option-4");
9970 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9971 [gui setColor:[OOColor yellowColor] forRow:row];
9972 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9973
9974 ++row;
9975
9976 text = DESC(@"oolite-start-option-5");
9977 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9978 [gui setColor:[OOColor yellowColor] forRow:row];
9979 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9980
9981 ++row;
9982
9983 text = DESC(@"oolite-start-option-6");
9984 [gui setText:text forRow:row align:GUI_ALIGN_CENTER];
9985 [gui setColor:[OOColor yellowColor] forRow:row];
9986 [gui setKey:[NSString stringWithFormat:@"Start:%d", row] forRow:row];
9987
9988
9989 [gui setSelectableRange:NSMakeRange(initialRow, row - initialRow + 1)];
9990 [gui setSelectedRow:initialRow];
9991
9992 [gui setBackgroundTextureKey:@"intro"];
9993
9994}
OOColor * whiteColor()
Definition OOColor.m:256

◆ setUpTrumbles

- (void) setUpTrumbles

Definition at line 9247 of file PlayerEntity.m.

11994{
11995 NSMutableString *trumbleDigrams = [NSMutableString stringWithCapacity:256];
11996 unichar xchar = (unichar)0;
11997 unichar digramchars[2];
11998
11999 while ([trumbleDigrams length] < PLAYER_MAX_TRUMBLES + 2)
12000 {
12001 NSString *commanderName = [self commanderName];
12002 if ([commanderName length] > 0)
12003 {
12004 [trumbleDigrams appendFormat:@"%@%@", commanderName, [[self mesh] modelName]];
12005 }
12006 else
12007 {
12008 [trumbleDigrams appendString:@"Some Random Text!"];
12009 }
12010 }
12011 int i;
12012 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12013 {
12014 digramchars[0] = ([trumbleDigrams characterAtIndex:i] & 0x007f) | 0x0020;
12015 digramchars[1] = (([trumbleDigrams characterAtIndex:i + 1] ^ xchar) & 0x007f) | 0x0020;
12016 xchar = digramchars[0];
12017 NSString *digramstring = [NSString stringWithCharacters:digramchars length:2];
12018 [trumble[i] release];
12019 trumble[i] = [[OOTrumble alloc] initForPlayer:self digram:digramstring];
12020 }
12021
12022 trumbleCount = 0;
12023
12024 [self setTrumbleAppetiteAccumulator:0.0f];
12025}
NSString * commanderName()

◆ setUpWeaponSounds

- (void) setUpWeaponSounds

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

106{
107 NSArray *eqTypes = [OOEquipmentType allEquipmentTypes];
108 NSMutableDictionary *shotMissSounds = [NSMutableDictionary dictionary];
109 NSMutableDictionary *shotHitSounds = [NSMutableDictionary dictionary];
110 NSMutableDictionary *shieldHitSounds = [NSMutableDictionary dictionary];
111 NSMutableDictionary *unshieldedHitSounds = [NSMutableDictionary dictionary];
112 NSMutableDictionary *weaponLaunchedSounds = [NSMutableDictionary dictionary];
113 NSEnumerator *eqTypeEnum = nil;
114 OOEquipmentType *eqType = nil;
115
116 // special case: turrets aren't defined with a "EQ_WEAPON" prefix, and plasma shots don't have a matching equipment item,
117 // so add a unique entry here. this could be overridden if an OXP creates an equipment item with this key.
118 // plasma shots don't make a sound when fired, so we only need to provide for the hit player sound keys.
119 [shieldHitSounds setObject:@"[player-hit-by-weapon]" forKey:@"EQ_WEAPON_PLASMA_SHOT"];
120 [unshieldedHitSounds setObject:@"[player-direct-hit]" forKey:@"EQ_WEAPON_PLASMA_SHOT"];
121 // grab a local copy of the sound identifiers for weapons to make the process of looking up a sound ref as fast as possible
122 // but we must ensure that no nil values are used for setObject
123 #define OO_ASSIGN_SOUNDSTR_TO_SOUNDS(soundStr, sounds) do { \
124 fxString = [eqType soundStr]; \
125 if (!fxString) fxString = @""; \
126 [sounds setObject:fxString forKey:[eqType identifier]]; \
127 } while(0)
128
129 for (eqTypeEnum = [eqTypes objectEnumerator]; (eqType = [eqTypeEnum nextObject]); )
130 {
131 NSString *fxString = nil;
132 if ([[eqType identifier] hasPrefix:@"EQ_WEAPON"])
133 {
134 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxShotMissName, shotMissSounds);
135 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxShotHitName, shotHitSounds);
136 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxShieldHitName, shieldHitSounds);
137 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxUnshieldedHitName, unshieldedHitSounds);
138 }
139 if ([eqType isMissileOrMine])
140 {
141 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxWeaponLaunchedName, weaponLaunchedSounds);
142 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxShieldHitName, shieldHitSounds);
143 OO_ASSIGN_SOUNDSTR_TO_SOUNDS(fxUnshieldedHitName, unshieldedHitSounds);
144 }
145 }
146
152
153 weaponShotMiss = [[NSDictionary alloc] initWithDictionary:shotMissSounds];
154 weaponShotHit = [[NSDictionary alloc] initWithDictionary:shotHitSounds];
155 weaponShieldHit = [[NSDictionary alloc] initWithDictionary:shieldHitSounds];
156 weaponUnshieldedHit = [[NSDictionary alloc] initWithDictionary:unshieldedHitSounds];
157 weaponLaunched = [[NSDictionary alloc] initWithDictionary:weaponLaunchedSounds];
158}
#define OO_ASSIGN_SOUNDSTR_TO_SOUNDS(soundStr, sounds)
NSArray * allEquipmentTypes()

◆ setWeaponMount:toWeapon:

- (BOOL) setWeaponMount: (OOWeaponFacing) chosen_weapon_facing
toWeapon: (NSString *) eqKey 

Reimplemented from ShipEntity.

Definition at line 9247 of file PlayerEntity.m.

10607 :(OOWeaponFacing)facing toWeapon:(NSString *)eqKey
10608{
10609 return [self setWeaponMount:facing toWeapon:eqKey inContext:@"purchase"];
10610}
OOWeaponFacing
Definition OOTypes.h:228

◆ setWeaponMount:toWeapon:inContext:

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

Definition at line 9247 of file PlayerEntity.m.

10613 :(OOWeaponFacing)facing toWeapon:(NSString *)eqKey inContext:(NSString *) context
10614{
10615
10616 NSDictionary *shipyardInfo = [[OOShipRegistry sharedRegistry] shipyardInfoForKey:[self shipDataKey]];
10617 unsigned available_facings = [shipyardInfo oo_unsignedIntForKey:KEY_WEAPON_FACINGS defaultValue:[self weaponFacings]]; // use defaults explicitly
10618
10619 // facing exists?
10620 if (!(available_facings & facing))
10621 {
10622 return NO;
10623 }
10624
10625 // weapon allowed (or NONE)?
10626 if (![eqKey isEqualToString:@"EQ_WEAPON_NONE"])
10627 {
10628 if (![self canAddEquipment:eqKey inContext:context])
10629 {
10630 return NO;
10631 }
10632 }
10633
10634 // sets WEAPON_NONE if not recognised
10636
10637 switch (facing)
10638 {
10640 forward_weapon_type = chosen_weapon;
10641 break;
10642
10643 case WEAPON_FACING_AFT:
10644 aft_weapon_type = chosen_weapon;
10645 break;
10646
10647 case WEAPON_FACING_PORT:
10648 port_weapon_type = chosen_weapon;
10649 break;
10650
10652 starboard_weapon_type = chosen_weapon;
10653 break;
10654
10655 case WEAPON_FACING_NONE:
10656 break;
10657 }
10658
10659 return YES;
10660}
OOWeaponType OOWeaponTypeFromEquipmentIdentifierStrict(NSString *string) PURE_FUNC

Referenced by PlayerShipSetProperty(), and ShipSetProperty().

+ Here is the caller graph for this function:

◆ setWeaponsOnline:

- (void) setWeaponsOnline: (BOOL) newValue

Definition at line 13735 of file PlayerEntity.m.

6172 :(BOOL)newValue
6173{
6174 weapons_online = !!newValue;
6175 if (!weapons_online) [self safeAllMissiles];
6176}

◆ setWitchspaceCountdown:

- (void) setWitchspaceCountdown: (int) spin_time

Definition at line 9247 of file PlayerEntity.m.

13009 :(int)spin_time
13010{
13011 witchspaceCountdown = spin_time;
13012}

Referenced by PlayerShipBeginGalacticHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ setWormhole:

- (void) setWormhole: (WormholeEntity *) newWormhole

Definition at line 13735 of file PlayerEntity.m.

899 :(WormholeEntity*)newWormhole
900{
901 [wormhole release];
902 if (newWormhole != nil)
903 {
904 wormhole = [newWormhole retain];
905 }
906 else
907 {
908 wormhole = nil;
909 }
910}

◆ sharedPlayer

+ (PlayerEntity *) sharedPlayer

Definition at line 13735 of file PlayerEntity.m.

180{
181 if (EXPECT_NOT(gOOPlayer == nil))
182 {
183 gOOPlayer = [[PlayerEntity alloc] init];
184 }
185 return gOOPlayer;
186}

Referenced by InitOOJSPlayerShip().

+ Here is the caller graph for this function:

◆ shipCommodityData

- (OOCommodityMarket *) shipCommodityData

◆ shipsFound_number

- (NSNumber *) shipsFound_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ shipyardRecord

- (NSMutableDictionary *) shipyardRecord

Definition at line 9247 of file PlayerEntity.m.

13363{
13364 return shipyard_record;
13365}

◆ showCommanderShip:

- (void) showCommanderShip: (int) cdrArrayIndex
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1003 of file PlayerEntityLoadSave.m.

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

◆ showDemoShips

- (BOOL) showDemoShips

◆ showGameOver

- (void) showGameOver
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

4054{
4055 [hud resetGuis:[NSDictionary dictionaryWithObject:[NSDictionary dictionary] forKey:@"message_gui"]];
4056 NSString *scoreMS = [NSString stringWithFormat:OOExpandKey(@"gameoverscreen-score-@"),
4057 KillCountToRatingAndKillString(ship_kills)];
4058
4059 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-game-over") forCount:kDeadResetTime];
4060 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4061 [UNIVERSE displayMessage:scoreMS forCount:kDeadResetTime];
4062 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4063 [UNIVERSE displayMessage:OOExpandKey(@"gameoverscreen-press-space") forCount:kDeadResetTime];
4064 [UNIVERSE displayMessage:@" " forCount:kDeadResetTime];
4065 [UNIVERSE displayMessage:@"" forCount:kDeadResetTime];
4066 [self resetShotTime];
4067}

◆ showInfoFlag

- (BOOL) showInfoFlag

Definition at line 9247 of file PlayerEntity.m.

12686{
12687 return show_info_flag;
12688}

◆ showInformationForSelectedInterface

- (void) showInformationForSelectedInterface

Definition at line 9247 of file PlayerEntity.m.

9867{
9868 GuiDisplayGen* gui = [UNIVERSE gui];
9869 NSString* interfaceKey = [gui selectedRowKey];
9870
9871 int i;
9872
9873 for (i = GUI_ROW_EQUIPMENT_DETAIL; i < GUI_MAX_ROWS; i++)
9874 {
9875 [gui setText:@"" forRow:i];
9876 [gui setColor:[gui colorFromSetting:kGuiInterfaceDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
9877 }
9878
9879 if (interfaceKey && ![interfaceKey hasPrefix:@"More:"])
9880 {
9881 NSDictionary *interfaces = [[self dockedStation] localInterfaces];
9882 OOJSInterfaceDefinition *definition = [interfaces objectForKey:interfaceKey];
9883 if (definition)
9884 {
9885 [gui addLongText:[definition summary] startingAtRow:GUI_ROW_INTERFACES_DETAIL align:GUI_ALIGN_LEFT];
9886 }
9887 }
9888
9889}
#define GUI_MAX_ROWS
@ GUI_ROW_EQUIPMENT_DETAIL

◆ showInformationForSelectedUpgrade

- (void) showInformationForSelectedUpgrade

Definition at line 9247 of file PlayerEntity.m.

9699{
9700 [self showInformationForSelectedUpgradeWithFormatString:nil];
9701}

Referenced by activateSelectedInterface.

+ Here is the caller graph for this function:

◆ showInformationForSelectedUpgradeWithFormatString:

- (void) showInformationForSelectedUpgradeWithFormatString: (NSString *) extraString

Definition at line 9247 of file PlayerEntity.m.

9704 :(NSString *)formatString
9705{
9706 GuiDisplayGen* gui = [UNIVERSE gui];
9707 NSString* eqKey = [gui selectedRowKey];
9708 int i;
9709
9710 OOColor *descColor = [gui colorFromSetting:kGuiEquipmentDescriptionColor defaultValue:[OOColor greenColor]];
9711 for (i = GUI_ROW_EQUIPMENT_DETAIL; i < GUI_MAX_ROWS; i++)
9712 {
9713 [gui setText:@"" forRow:i];
9714 [gui setColor:descColor forRow:i];
9715 }
9716 if (eqKey)
9717 {
9718 if (![eqKey hasPrefix:@"More:"])
9719 {
9721 NSString* eq_key_damaged = [NSString stringWithFormat:@"%@_DAMAGED", eqKey];
9723 if ([self hasEquipmentItem:eq_key_damaged])
9724 {
9725 desc = [NSString stringWithFormat:DESC(@"upgradeinfo-@-price-is-for-repairing"), desc];
9726 }
9727 else
9728 {
9729 if([eqKey hasSuffix:@"ENERGY_UNIT"] && ([self hasEquipmentItem:@"EQ_ENERGY_UNIT_DAMAGED"] || [self hasEquipmentItem:@"EQ_ENERGY_UNIT"] || [self hasEquipmentItem:@"EQ_NAVAL_ENERGY_UNIT_DAMAGED"]))
9730 desc = [NSString stringWithFormat:DESC(@"@-will-replace-other-energy"), desc];
9731 if (weight > 0) desc = [NSString stringWithFormat:DESC(@"upgradeinfo-@-weight-d-of-equipment"), desc, weight];
9732 }
9733 if (formatString) desc = [NSString stringWithFormat:formatString, desc];
9734 [gui addLongText:desc startingAtRow:GUI_ROW_EQUIPMENT_DETAIL align:GUI_ALIGN_LEFT];
9735 }
9736 }
9737}
OOCargoQuantity requiredCargoSpace()
NSString * descriptiveText()

◆ showMarketCashAndLoadLine

- (void) showMarketCashAndLoadLine
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9247 of file PlayerEntity.m.

11352{
11353 GuiDisplayGen *gui = [UNIVERSE gui];
11354 OOCargoQuantity currentCargo = current_cargo;
11355 OOCargoQuantity cargoCapacity = [self maxAvailableCargoSpace];
11356 [gui setText:OOExpandKey(@"market-cash-and-load", credits, currentCargo, cargoCapacity) forRow:GUI_ROW_MARKET_CASH];
11357 [gui setColor:[gui colorFromSetting:kGuiMarketCashColor defaultValue:[OOColor yellowColor]] forRow:GUI_ROW_MARKET_CASH];
11358}

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

10957 :(OOGUIRow)row forGood:(OOCommodityType)good inMarket:(OOCommodityMarket *)localMarket holdQuantity:(OOCargoQuantity)quantity
10958{
10959 GuiDisplayGen *gui = [UNIVERSE gui];
10960 NSString* desc = [NSString stringWithFormat:@" %@ ", [shipCommodityData nameForGood:good]];
10961 OOCargoQuantity available_units = [localMarket quantityForGood:good];
10962 OOCargoQuantity units_in_hold = quantity;
10963 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:good];
10964 OOMassUnit unit = [shipCommodityData massUnitForGood:good];
10965
10966 NSString *available = OOPadStringToEms(((available_units > 0) ? (NSString *)[NSString stringWithFormat:@"%d",available_units] : DESC(@"commodity-quantity-none")), 2.5);
10967
10968 NSUInteger priceDecimal = pricePerUnit % 10;
10969 NSString *price = [NSString stringWithFormat:@" %@.%lu ",OOPadStringToEms([NSString stringWithFormat:@"%lu",(unsigned long)(pricePerUnit/10)],2.5),priceDecimal];
10970
10971 // this works with up to 9999 tons of gemstones. Any more than that, they deserve the formatting they get! :)
10972
10973 NSString *owned = OOPadStringToEms((units_in_hold > 0) ? (NSString *)[NSString stringWithFormat:@"%d",units_in_hold] : DESC(@"commodity-quantity-none"), 4.5);
10974 NSString *units = DisplayStringForMassUnit(unit);
10975 NSString *units_available = [NSString stringWithFormat:@" %@ %@ ",available, units];
10976 NSString *units_owned = [NSString stringWithFormat:@" %@ %@ ",owned, units];
10977
10978 NSUInteger import_legality = [localMarket importLegalityForGood:good];
10979 NSUInteger export_legality = [localMarket exportLegalityForGood:good];
10980 NSString *legaldesc = nil;
10981 if (import_legality == 0)
10982 {
10983 if (export_legality == 0)
10984 {
10985 legaldesc = DESC(@"oolite-legality-clear");
10986 }
10987 else
10988 {
10989 legaldesc = DESC(@"oolite-legality-import");
10990 }
10991 }
10992 else
10993 {
10994 if (export_legality == 0)
10995 {
10996 legaldesc = DESC(@"oolite-legality-export");
10997 }
10998 else
10999 {
11000 legaldesc = DESC(@"oolite-legality-neither");
11001 }
11002 }
11003 legaldesc = [NSString stringWithFormat:@" %@ ",legaldesc];
11004
11005 NSString *extradesc = [shipCommodityData shortCommentForGood:good];
11006
11007 [gui setKey:good forRow:row];
11008 [gui setColor:[gui colorFromSetting:kGuiMarketCommodityColor defaultValue:nil] forRow:row];
11009 [gui setArray:[NSArray arrayWithObjects: desc, extradesc, price, units_available, units_owned, legaldesc, nil] forRow:row++];
11010
11011}
NSString * DisplayStringForMassUnit(OOMassUnit unit)
NSString * OOPadStringToEms(NSString *string, float numEms)
NSUInteger exportLegalityForGood:(OOCommodityType good)
NSUInteger importLegalityForGood:(OOCommodityType good)
OOCreditsQuantity priceForGood:(OOCommodityType good)

◆ showMarketScreenHeaders

- (void) showMarketScreenHeaders
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9247 of file PlayerEntity.m.

10936{
10937 GuiDisplayGen *gui = [UNIVERSE gui];
10938 OOGUITabSettings tab_stops;
10939 tab_stops[0] = 0;
10940 tab_stops[1] = 137;
10941 tab_stops[2] = 187;
10942 tab_stops[3] = 267;
10943 tab_stops[4] = 321;
10944 tab_stops[5] = 431;
10945 [gui overrideTabs:tab_stops from:kGuiMarketTabs length:6];
10946 [gui setTabStops:tab_stops];
10947
10948 [gui setColor:[gui colorFromSetting:kGuiMarketHeadingColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_KEY];
10949 [gui setArray:[NSArray arrayWithObjects: DESC(@"commodity-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10950 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];
10951 [gui setArray:[NSArray arrayWithObjects: DESC(@"commodity-column-title"), DESC(@"oolite-extras-column-title"), OOPadStringToEms(DESC(@"price-column-title"),3.5),
10952 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];
10953
10954}

◆ showScenarioDetails

- (void) showScenarioDetails

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

285{
286 GuiDisplayGen* gui = [UNIVERSE gui];
287 NSString* key = [gui selectedRowKey];
288 [UNIVERSE removeDemoShips];
289
290 if ([key hasPrefix:@"Scenario"])
291 {
292 int item = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
293 NSDictionary *scenario = [[UNIVERSE scenarios] objectAtIndex:item];
294 [self setShowDemoShips:NO];
295 for (NSUInteger i=GUI_ROW_SCENARIOS_DETAIL;i<=27;i++)
296 {
297 [gui setText:@"" forRow:i];
298 }
299 if (scenario)
300 {
301 [gui addLongText:OOExpand([scenario oo_stringForKey:@"description"]) startingAtRow:GUI_ROW_SCENARIOS_DETAIL align:GUI_ALIGN_LEFT];
302 NSString *shipKey = [scenario oo_stringForKey:@"model"];
303 if (shipKey != nil)
304 {
305 [self addScenarioModel:shipKey];
306 [self setShowDemoShips:YES];
307 }
308 }
309
310 }
311}
@ GUI_ROW_SCENARIOS_DETAIL

◆ showShipModel:

- (void) showShipModel: (NSString *) shipKey

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

2150 :(NSString *)role
2151{
2152 if ([role isEqualToString:@"none"] || [role length] == 0)
2153 {
2154 [UNIVERSE removeDemoShips];
2155 return;
2156 }
2157
2158 ShipEntity *ship = [UNIVERSE makeDemoShipWithRole:role spinning:YES];
2159 OOLog(kOOLogNoteShowShipModel, @"::::: showShipModel:'%@' (%@) (%@)", role, ship, [ship name]);
2160}
static NSString *const kOOLogNoteShowShipModel

◆ showShipModelWithKey:shipData:personality:factorX:factorY:factorZ:inContext:

- (void) showShipModelWithKey: (NSString *) shipKey
shipData: (NSDictionary *) shipData
personality: (uint16_t) personality
factorX: (GLfloat) factorX
factorY: (GLfloat) factorY
factorZ: (GLfloat) factorZ
inContext: (NSString *) context 

Definition at line 13735 of file PlayerEntity.m.

4070 :(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality factorX:(GLfloat)factorX factorY:(GLfloat)factorY factorZ:(GLfloat)factorZ inContext:(NSString *)context
4071{
4072 if (shipKey == nil) return;
4073 if (shipData == nil) shipData = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipKey];
4074 if (shipData == nil) return;
4075
4076 Quaternion q2 = { (GLfloat)M_SQRT1_2, (GLfloat)M_SQRT1_2, (GLfloat)0.0f, (GLfloat)0.0f };
4077 // MKW - retrieve last demo ships' orientation and release it
4078 if( demoShip != nil )
4079 {
4080 q2 = [demoShip orientation];
4081 [demoShip release];
4082 }
4083
4084 ShipEntity *ship = [[ProxyPlayerEntity alloc] initWithKey:shipKey definition:shipData];
4085 if (personality != ENTITY_PERSONALITY_INVALID) [ship setEntityPersonalityInt:personality];
4086
4087 [ship wasAddedToUniverse];
4088
4089 if (context) OOLog(@"script.debug.note.showShipModel", @"::::: showShipModel:'%@' in context: %@.", [ship name], context);
4090
4091 GLfloat cr = [ship collisionRadius];
4092 [ship setOrientation: q2];
4093 [ship setPositionX:factorX * cr y:factorY * cr z:factorZ * cr];
4094 [ship setScanClass: CLASS_NO_DRAW];
4095 [ship setDemoShip: 0.6];
4096 [ship setDemoStartTime: [UNIVERSE getTime]];
4097 if([ship pendingEscortCount] > 0) [ship setPendingEscortCount:0];
4098 [ship setAITo: @"nullAI.plist"];
4099 id subEntStatus = [shipData objectForKey:@"subentities_status"];
4100 // show missing subentities if there's a subentities_status key
4101 if (subEntStatus != nil) [ship deserializeShipSubEntitiesFrom:(NSString *)subEntStatus];
4102 [UNIVERSE addEntity: ship];
4103 // MKW - save demo ship for its rotation
4104 demoShip = [ship retain];
4105
4106 [ship setStatus: STATUS_COCKPIT_DISPLAY];
4107
4108 [ship release];
4109}
#define M_SQRT1_2
Definition OOMaths.h:94
#define ENTITY_PERSONALITY_INVALID
Definition ShipEntity.h:111
GLfloat collisionRadius()
Definition Entity.m:905
void setPositionX:y:z:(OOHPScalar x,[y] OOHPScalar y,[z] OOHPScalar z)
Definition Entity.m:654
void setDemoStartTime:(OOTimeAbsolute time)
void wasAddedToUniverse()
uint8_t pendingEscortCount()
void setDemoShip:(OOScalar demoRate)

◆ showShipyardInfoForSelection

- (void) showShipyardInfoForSelection

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1597{
1598 NSUInteger i;
1599 GuiDisplayGen *gui = [UNIVERSE gui];
1600 OOGUIRow sel_row = [gui selectedRow];
1601
1602 if (sel_row <= 0) return;
1603
1604 NSMutableArray *row_info = [NSMutableArray arrayWithArray:(NSArray*)[gui objectForRow:GUI_ROW_SHIPYARD_LABELS]];
1605 while ([row_info count] < 4)
1606 {
1607 [row_info addObject:@""];
1608 }
1609
1610 NSString *key = [gui keyForRow:sel_row];
1611
1612 NSDictionary *info = [currentShipyard oo_dictionaryForKey:key];
1613
1614 // clean up the display ready for the newly-selected ship (if there is one)
1615 [row_info replaceObjectAtIndex:2 withObject:@""];
1616 [row_info replaceObjectAtIndex:3 withObject:@""];
1617 for (i = GUI_ROW_SHIPYARD_INFO_START; i < GUI_ROW_MARKET_CASH - 1; i++)
1618 {
1619 [gui setText:@"" forRow:i];
1620 [gui setColor:[gui colorFromSetting:kGuiShipyardDescriptionColor defaultValue:[OOColor greenColor]] forRow:i];
1621 }
1622 [UNIVERSE removeDemoShips];
1623
1624 if (info)
1625 {
1626 // the key is a particular ship - show the details
1627 NSString *salesPitch = [info oo_stringForKey:KEY_SHORT_DESCRIPTION];
1628 NSDictionary *shipDict = [info oo_dictionaryForKey:SHIPYARD_KEY_SHIP];
1629
1630 int cargoRating = [shipDict oo_intForKey:@"max_cargo"];
1631 int cargo_extra;
1632 cargo_extra = [shipDict oo_intForKey:@"extra_cargo" defaultValue:15];
1633 float speedRating = 0.001 * [shipDict oo_intForKey:@"max_flight_speed"];
1634
1635 NSArray *shipExtras = [info oo_arrayForKey:KEY_EQUIPMENT_EXTRAS];
1636 for (i = 0; i < [shipExtras count]; i++)
1637 {
1638 if ([[shipExtras oo_stringAtIndex:i] isEqualToString:@"EQ_CARGO_BAY"])
1639 {
1640 cargoRating += cargo_extra;
1641 }
1642 else if ([[shipExtras oo_stringAtIndex:i] isEqualToString:@"EQ_PASSENGER_BERTH"])
1643 {
1644 cargoRating -= PASSENGER_BERTH_SPACE;
1645 }
1646 }
1647
1648 [row_info replaceObjectAtIndex:2 withObject:OOExpandKey(@"shipyard-cargo-value", cargoRating)];
1649 [row_info replaceObjectAtIndex:3 withObject:OOExpandKey(@"shipyard-speed-value", speedRating)];
1650
1651 // Show footer first. It'll be overwritten by the sales_pitch if that text is longer than usual.
1652 [self showTradeInInformationFooter];
1653 i = [gui addLongText:salesPitch startingAtRow:GUI_ROW_SHIPYARD_INFO_START align:GUI_ALIGN_LEFT];
1654 if (i - 1 >= GUI_ROW_MARKET_CASH - 1)
1655 {
1656 [gui setColor:[gui colorFromSetting:kGuiShipyardDescriptionColor defaultValue:[OOColor greenColor]] forRow:i - 1];
1657 [gui setColor:[gui colorFromSetting:kGuiShipyardDescriptionColor defaultValue:[OOColor greenColor]] forRow:GUI_ROW_MARKET_CASH - 1];
1658 }
1659
1660 // now display the ship
1661 [self showShipyardModel:[info oo_stringForKey:SHIPYARD_KEY_SHIPDATA_KEY]
1662 shipData:shipDict
1663 personality:[info oo_unsignedShortForKey:SHIPYARD_KEY_PERSONALITY]];
1664 }
1665 else
1666 {
1667 // the key is a particular model of ship which we must expand...
1668 // build an array from the entries for that model in the currentShipyard TODO
1669 //
1670 }
1671
1672 [gui setArray:[NSArray arrayWithArray:row_info] forRow:GUI_ROW_SHIPYARD_LABELS];
1673}

◆ showShipyardModel:shipData:personality:

- (void) showShipyardModel: (NSString *) shipKey
shipData: (NSDictionary *) shipDict
personality: (uint16_t) personality 

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1690 :(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality
1691{
1692 if (shipKey == nil || [self dockedStation] == nil) return;
1693 [self showShipModelWithKey:shipKey shipData:shipData personality:personality factorX:1.2 factorY:0.8 factorZ:6.4 inContext:@"shipyard"];
1694}

◆ showTradeInInformationFooter

- (void) showTradeInInformationFooter

Provided by category PlayerEntity(Contracts).

Definition at line 1443 of file PlayerEntityContracts.m.

1677{
1678 GuiDisplayGen *gui = [UNIVERSE gui];
1679 OOCreditsQuantity tradeIn = [self tradeInValue];
1680 OOCreditsQuantity total = tradeIn + credits;
1681 NSString *shipType = [self displayName];
1682
1683 [gui setColor:[gui colorFromSetting:kGuiShipyardTradeinColor defaultValue:nil] forRow:GUI_ROW_MARKET_CASH - 1];
1684 [gui setColor:[gui colorFromSetting:kGuiShipyardTradeinColor defaultValue:nil] forRow:GUI_ROW_MARKET_CASH];
1685 [gui setText:OOExpandKey(@"shipyard-trade-in-value", shipType, tradeIn) forRow: GUI_ROW_MARKET_CASH - 1];
1686 [gui setText:OOExpandKey(@"shipyard-total-available-with-trade-in", shipType, total, credits, tradeIn) forRow: GUI_ROW_MARKET_CASH];
1687}

◆ SliderString

+ (static NSString *) SliderString (NSInteger) amountIn20ths
implementation

Definition at line 8862 of file PlayerEntity.m.

8863{
8864 NSString *filledSlider = [@"|||||||||||||||||||||||||" substringToIndex:amountIn20ths];
8865 NSString *emptySlider = [@"........................." substringToIndex:20 - amountIn20ths];
8866 return [NSString stringWithFormat:@"%@%@", filledSlider, emptySlider];
8867}

◆ sortCommanders

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

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1003 of file PlayerEntityLoadSave.m.

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

◆ spawnShip:

- (void) spawnShip: (NSString *) ship_key

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ specialCargo

- (NSString *) specialCargo

◆ startAfterburnerSound

- (void) startAfterburnerSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

476{
477 if (!afterburnerSoundLooping)
478 {
479 afterburnerSoundLooping = YES;
480 [self updateAfterburnerSound];
481 }
482}

◆ startScenario

- (BOOL) startScenario

Provided by category PlayerEntity(LoadSave).

Definition at line 1412 of file PlayerEntityLoadSave.m.

315{
316 GuiDisplayGen* gui = [UNIVERSE gui];
317 NSString* key = [gui selectedRowKey];
318
319 if ([key isEqualToString:@"exit"])
320 {
321 // intended to return to main menu
322 return NO;
323 }
324 if ([key hasPrefix:@"__page"])
325 {
326 int page = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
327 [self setGuiToScenarioScreen:page];
328 return YES;
329 }
330 int selection = [[key componentsSeparatedByString:@":"] oo_intAtIndex:1];
331
332 NSDictionary *scenario = [[UNIVERSE scenarios] objectAtIndex:selection];
333 NSString *file = [scenario oo_stringForKey:@"file" defaultValue:nil];
334 if (file == nil)
335 {
336 OOLog(@"scenario.init.error", @"%@", @"No file entry found for scenario");
337 return NO;
338 }
339 NSString *path = [ResourceManager pathForFileNamed:file inFolder:@"Scenarios"];
340 if (path == nil)
341 {
342 OOLog(@"scenario.init.error", @"Game file not found for scenario %@",file);
343 return NO;
344 }
345 BOOL result = [self loadPlayerFromFile:path asNew:YES];
346 if (!result)
347 {
348 return NO;
349 }
350 [scenarioKey release];
351 scenarioKey = [[scenario oo_stringForKey:@"scenario" defaultValue:nil] retain];
352
353 // don't drop the save game directory in
354 return YES;
355}
NSString * pathForFileNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)

◆ startUpComplete

- (void) startUpComplete

Definition at line 13735 of file PlayerEntity.m.

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

◆ status_string

- (NSString *) status_string

Provided by category PlayerEntity(Scripting).

Definition at line 278 of file PlayerEntityLegacyScriptEngine.m.

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

◆ stickFunctionList

- (NSArray *) stickFunctionList
implementation

Provided by category PlayerEntity(StickMapperInternal).

Definition at line 1 of file PlayerEntityStickMapper.m.

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

◆ stickMapperInputHandler:view:

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

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

132 :(GuiDisplayGen *)gui
133 view:(MyOpenGLView *)gameView
134{
136
137 // Don't do anything if the user is supposed to be selecting
138 // a function - other than look for Escape.
139 if(waitingForStickCallback)
140 {
141 if([gameView isDown: 27])
142 {
143 [stickHandler clearCallback];
144 [gui setArray: [NSArray arrayWithObjects:
145 @"Function setting aborted.", nil]
146 forRow: GUI_ROW_INSTRUCT];
147 waitingForStickCallback=NO;
148 }
149
150 // Break out now.
151 return;
152 }
153
154 [self handleGUIUpDownArrowKeys];
155
156 if ([gui selectedRow] == GUI_ROW_STICKPROFILE && [gameView isDown: 13])
157 {
158 [self setGuiToStickProfileScreen: gui];
159 return;
160 }
161
162 NSString* key = [gui keyForRow: [gui selectedRow]];
163 if ([key hasPrefix:@"Index:"])
164 selFunctionIdx=[[[key componentsSeparatedByString:@":"] objectAtIndex: 1] intValue];
165 else
166 selFunctionIdx=-1;
167
168 if([gameView isDown: 13])
169 {
170 if ([key hasPrefix:@"More:"])
171 {
172 int from_function = [[[key componentsSeparatedByString:@":"] objectAtIndex: 1] intValue];
173 if (from_function < 0) from_function = 0;
174
175 [self setGuiToStickMapperScreen:from_function];
176 if ([[UNIVERSE gui] selectedRow] < 0)
177 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART];
178 if (from_function == 0)
179 [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART + MAX_ROWS_FUNCTIONS - 1];
180 return;
181 }
182
183 NSDictionary *entry=[stickFunctions objectAtIndex: selFunctionIdx];
184 int hw=[(NSNumber *)[entry objectForKey: KEY_ALLOWABLE] intValue];
185 [stickHandler setCallback: @selector(updateFunction:)
186 object: self
187 hardware: hw];
188
189 // Print instructions
190 NSString *instructions;
191 switch(hw)
192 {
193 case HW_AXIS:
194 instructions = @"Fully deflect the axis you want to use for this function. Esc aborts.";
195 break;
196 case HW_BUTTON:
197 instructions = @"Press the button you want to use for this function. Esc aborts.";
198 break;
199 default:
200 instructions = @"Press the button or deflect the axis you want to use for this function.";
201 }
202 [gui setArray: [NSArray arrayWithObjects: instructions, nil] forRow: GUI_ROW_INSTRUCT];
203 waitingForStickCallback=YES;
204 }
205
206 if([gameView isDown: 'u'])
207 {
208 if (selFunctionIdx >= 0) [self removeFunction: selFunctionIdx];
209 }
210}
#define GUI_ROW_STICKPROFILE
void setCallback:object:hardware:(SEL selector,[object] id obj,[hardware] char hwflags)

◆ stickProfileGraphAxisProfile:screenAt:screenSize:

- (void) stickProfileGraphAxisProfile: (GLfloat) alpha
screenAt: (Vector) screenAt
screenSize: (NSSize) screenSize 

Provided by category PlayerEntity(StickProfile).

Definition at line 43 of file PlayerEntityStickProfile.m.

225 : (GLfloat) alpha screenAt: (Vector) screenAt screenSize: (NSSize) screenSize
226{
227
228 [stickProfileScreen graphProfile: alpha at: make_vector(screenAt.x - 110.0, screenAt.y - 100, screenAt.z) size: NSMakeSize(220,220)];
229 return;
230}

◆ stickProfileInputHandler:view:

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

Provided by category PlayerEntity(StickProfile).

Definition at line 43 of file PlayerEntityStickProfile.m.

76 : (GuiDisplayGen *) gui
77 view: (MyOpenGLView *) gameView
78{
79 if ([gameView isDown: gvMouseLeftButton])
80 {
81 NSPoint mouse_position = NSMakePoint(
82 [gameView virtualJoystickPosition].x * [gui size].width,
83 [gameView virtualJoystickPosition].y * [gui size].height );
84 [stickProfileScreen mouseDown: mouse_position];
85 }
86 else
87 {
88 [stickProfileScreen mouseUp];
89 }
90 if ([gameView isDown: gvDeleteKey])
91 {
92 [stickProfileScreen deleteSelected];
93 }
94 [self handleGUIUpDownArrowKeys];
95
96 if ([self checkKeyPress:n_key_gui_select] && [gui selectedRow] == GUI_ROW_STICKPROFILE_BACK)
97 {
98 [stickProfileScreen saveSettings];
99 [self setGuiToStickMapperScreen: 0 resetCurrentRow: YES];
100 }
101 switch ([gui selectedRow])
102 {
104 if ([self checkKeyPress:n_key_gui_arrow_left])
105 {
106 if (!stickProfileArrow_pressed && ![self checkKeyPress:n_key_gui_arrow_right])
107 {
108 [stickProfileScreen previousAxis];
110 }
111 }
112 else if ([self checkKeyPress: n_key_gui_arrow_right])
113 {
114 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
115 {
116 [stickProfileScreen nextAxis];
118 }
119 }
120 else
121 {
123 }
124 break;
125
127 if ([self checkKeyPress:n_key_gui_arrow_left])
128 {
129 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_right])
130 {
131 [stickProfileScreen decreaseDeadzone];
133 }
134 }
135 else if ([self checkKeyPress: n_key_gui_arrow_right])
136 {
137 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
138 {
139 [stickProfileScreen increaseDeadzone];
141 }
142 }
143 else
144 {
146 }
147 break;
148
150 if ([self checkKeyPress:n_key_gui_arrow_left])
151 {
152 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_right])
153 {
154 [stickProfileScreen previousProfileType];
156 }
157 }
158 else if ([self checkKeyPress: n_key_gui_arrow_right])
159 {
160 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
161 {
162 [stickProfileScreen nextProfileType];
164 }
165 }
166 else
167 {
169 }
170 break;
171 }
172
173 if (![stickProfileScreen currentProfileIsSpline])
174 {
175 if ([gui selectedRow] == GUI_ROW_STICKPROFILE_POWER)
176 {
177 if ([self checkKeyPress:n_key_gui_arrow_left])
178 {
179 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_right])
180 {
181 [stickProfileScreen DecreasePower];
183 }
184 }
185 else if ([self checkKeyPress: n_key_gui_arrow_right])
186 {
187 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
188 {
189 [stickProfileScreen IncreasePower];
191 }
192 }
193 else
194 {
196 }
197 }
198 else if ([gui selectedRow] == GUI_ROW_STICKPROFILE_PARAM)
199 {
200 if ([self checkKeyPress:n_key_gui_arrow_left])
201 {
202 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_right])
203 {
204 [stickProfileScreen DecreaseParam];
206 }
207 }
208 else if ([self checkKeyPress: n_key_gui_arrow_right])
209 {
210 if (!stickProfileArrow_pressed && ![self checkKeyPress: n_key_gui_arrow_left])
211 {
212 [stickProfileScreen IncreaseParam];
214 }
215 }
216 else
217 {
219 }
220 }
221 }
222 return;
223}
#define GUI_ROW_STICKPROFILE_PARAM
static BOOL stickProfileArrow_pressed
#define GUI_ROW_STICKPROFILE_AXIS
#define GUI_ROW_STICKPROFILE_BACK
#define GUI_ROW_STICKPROFILE_DEADZONE
#define GUI_ROW_STICKPROFILE_PROFILE_TYPE
#define GUI_ROW_STICKPROFILE_POWER
voidpf void uLong size
Definition ioapi.h:134

◆ stopAfterburnerSound

- (void) stopAfterburnerSound

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

486{
487 // Do nothing, stop is detected in updateAfterburnerSound
488}

◆ subtract:

- (void) subtract: (NSString *) missionVariableString_value

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ sunGoneNova_bool

- (NSString *) sunGoneNova_bool

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ sunWillGoNova_bool

- (NSString *) sunWillGoNova_bool

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ suppressClangStuff

- (BOOL) suppressClangStuff
implementation

Definition at line 9247 of file PlayerEntity.m.

13545{
13546 return missionChoice &&
13549 currentPage &&
13581 n_key_ecm &&
13609 n_key_map_end &&
13659#if OO_FOV_INFLIGHT_CONTROL_ENABLED
13660 n_key_inc_field_of_view &&
13661 n_key_dec_field_of_view &&
13662#endif
13671 _sysInfoLight.x &&
13674 keyFunctions &&
13678 kbdLayouts &&
13682 _missionTitle &&
13684}
NSArray * n_key_yaw_left
NSArray * n_key_activate_equipment
NSArray * n_key_gui_screen_interfaces
NSArray * n_key_gui_arrow_right
NSArray * n_key_scanner_zoom
NSArray * n_key_debug_shaders
NSArray * n_key_next_target
NSArray * n_key_docking_clearance_request
NSArray * n_key_market_buy_max
NSArray * n_key_rotate_cargo
NSArray * n_key_custom_view_rotate_left
NSArray * n_key_untarget_missile
NSArray * n_key_gui_screen_status
NSArray * n_key_oxzmanager_extract
NSArray * n_key_map_next_system
NSArray * n_key_custom_view_pan_left
NSArray * n_key_info_next_system
NSArray * n_key_yaw_right
NSArray * n_key_custom_view_pan_down
NSArray * n_key_map_info
NSArray * n_key_view_forward
NSString * _missionScreenID
BOOL _missionAllowInterrupt
NSArray * n_key_debug_off
NSArray * n_key_galactic_hyperspace
NSArray * n_key_autopilot
NSArray * n_key_weapons_online_toggle
NSArray * n_key_pausebutton
NSArray * n_key_ecm
NSArray * n_key_dump_target_state
NSArray * n_key_gui_select
NSArray * n_key_custom_view_zoom_out
NSArray * n_key_custom_view_roll_right
NSArray * n_key_dump_entity_list
NSMutableArray * cdrDetailArray
NSArray * n_key_market_buy_one
NSArray * n_key_roll_right
NSArray * n_key_cycle_next_mfd
NSString * _missionTitle
NSArray * n_key_advanced_nav_array_previous
NSArray * n_key_gui_chart_screens
NSArray * n_key_system_previous_system
NSArray * n_key_snapshot
NSArray * n_key_gui_arrow_up
NSArray * n_key_debug_full
NSArray * n_key_gui_arrow_down
NSArray * n_key_custom_view
NSArray * n_key_autodock
NSString * commanderNameString
NSArray * n_key_gui_page_up
NSArray * n_key_prev_compass_mode
NSArray * n_key_jumpdrive
NSArray * n_key_cycle_previous_mfd
NSArray * n_key_market_sell_max
NSArray * n_key_bloom_toggle
NSArray * n_key_roll_left
NSArray * n_key_system_home
NSArray * n_key_custom_view_zoom_in
NSArray * n_key_chart_highlight
NSArray * n_key_mode_equipment
NSArray * n_key_inject_fuel
NSArray * n_key_hyperspace
NSArray * n_key_custom_view_rotate_up
NSString * missionChoice
NSArray * n_key_increase_speed
NSArray * n_key_system_next_system
NSArray * n_key_show_fps
NSArray * n_key_system_end
NSArray * n_key_debug_bounding_boxes
NSArray * n_key_market_sell_one
NSArray * n_key_custom_view_rotate_right
NSArray * n_key_market_sorter_cycle
NSArray * n_key_scanner_unzoom
NSArray * n_key_gui_arrow_left
NSArray * n_key_view_starboard
NSArray * n_key_pitch_back
BOOL showingLongRangeChart
NSArray * n_key_mouse_control_roll
NSArray * n_key_launch_ship
Vector _sysInfoLight
NSArray * n_key_gui_market
NSArray * n_key_launch_missile
NSArray * n_key_gui_system_data
NSArray * n_key_gui_screen_equipship
NSArray * n_key_debug_console_connect
NSArray * n_key_info_previous_system
NSArray * n_key_custom_view_rotate_down
NSArray * n_key_prime_next_equipment
BOOL _missionTextEntry
NSArray * n_key_map_end
NSArray * n_key_custom_view_pan_up
NSArray * n_key_ident_system
NSArray * n_key_oxzmanager_setfilter
NSArray * n_key_gui_page_down
NSArray * n_key_decrease_speed
NSArray * n_key_target_incoming_missile
NSArray * n_key_next_missile
NSArray * n_key_gui_screen_options
NSArray * n_key_prime_previous_equipment
NSArray * n_key_oxzmanager_showinfo
NSArray * n_key_comms_log
NSArray * n_key_view_port
NSArray * n_key_market_filter_cycle
NSArray * n_key_target_missile
NSArray * n_key_map_zoom_out
NSArray * n_key_switch_next_mfd
NSArray * n_key_advanced_nav_array_next
NSArray * n_key_pitch_forward
NSArray * n_key_fire_lasers
NSArray * n_key_mouse_control_yaw
NSArray * n_key_map_home
NSArray * n_key_view_aft
NSArray * n_key_fastactivate_equipment_b
NSArray * n_key_debug_collision
NSArray * n_key_docking_music
NSArray * n_key_custom_view_pan_right
NSArray * n_key_dump_cargo
NSArray * n_key_launch_escapepod
NSArray * n_key_custom_view_roll_left
NSArray * n_key_map_previous_system
NSArray * n_key_fastactivate_equipment_a
NSArray * n_key_hud_toggle
NSArray * n_key_switch_previous_mfd
NSArray * n_key_previous_target
NSArray * n_key_map_zoom_in
NSArray * n_key_next_compass_mode

◆ suppressTargetLost

- (void) suppressTargetLost

Reimplemented from ShipEntity.

◆ switchHudTo:

- (BOOL) switchHudTo: (NSString *) hudFileName

Definition at line 13735 of file PlayerEntity.m.

4539 :(NSString *)hudFileName
4540{
4541 NSDictionary *hudDict = nil;
4542 BOOL wasHidden = NO;
4543 BOOL wasCompassActive = YES;
4544 double scannerZoom = 1.0;
4545 NSUInteger lastMFD = 0;
4546 NSUInteger i;
4547
4548 if (!hudFileName) return NO;
4549
4550 // is the HUD in the process of being rendered? If yes, set it to defer state and abort the switching now
4551 if (hud != nil && [hud isUpdating])
4552 {
4553 [hud setDeferredHudName:hudFileName];
4554 return NO;
4555 }
4556
4557 hudDict = [ResourceManager dictionaryFromFilesNamed:hudFileName inFolder:@"Config" andMerge:YES];
4558 // hud defined, but buggy?
4559 if (hudDict == nil)
4560 {
4561 OOLog(@"PlayerEntity.switchHudTo.failed", @"HUD dictionary file %@ to switch to not found or invalid.", hudFileName);
4562 return NO;
4563 }
4564
4565 if (hud != nil)
4566 {
4567 // remember these values
4568 wasHidden = [hud isHidden];
4569 wasCompassActive = [hud isCompassActive];
4570 scannerZoom = [hud scannerZoom];
4571 lastMFD = activeMFD;
4572 }
4573
4574 // buggy oxp could override hud.plist with a non-dictionary.
4575 if (hudDict != nil)
4576 {
4577 [hud setHidden:YES]; // hide the hud while rebuilding it.
4578 DESTROY(hud);
4579 hud = [[HeadUpDisplay alloc] initWithDictionary:hudDict inFile:hudFileName];
4580 [hud resetGuis:hudDict];
4581 // reset zoom & hidden to what they were before the swich
4582 [hud setScannerZoom:scannerZoom];
4583 [hud setCompassActive:wasCompassActive];
4584 [hud setHidden:wasHidden];
4585 activeMFD = 0;
4586 NSArray *savedMFDs = [NSArray arrayWithArray:multiFunctionDisplaySettings];
4587 [multiFunctionDisplaySettings removeAllObjects];
4588 for (i = 0; i < [hud mfdCount] ; i++)
4589 {
4590 if ([savedMFDs count] > i)
4591 {
4592 [multiFunctionDisplaySettings addObject:[savedMFDs objectAtIndex:i]];
4593 }
4594 else
4595 {
4596 [multiFunctionDisplaySettings addObject:[NSNull null]];
4597 }
4598 }
4599 if (lastMFD < [hud mfdCount]) activeMFD = lastMFD;
4600 }
4601
4602 return YES;
4603}
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ switchToMainView

- (void) switchToMainView

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ switchToThisView:

- (void) switchToThisView: (OOViewID) viewDirection
implementation

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ switchToThisView:andProcessWeaponFacing:

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

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ switchToThisView:fromView:andProcessWeaponFacing:justNotify:

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

Provided by category PlayerEntity(OOControlsPrivate).

Definition at line 4758 of file PlayerEntityControls.m.

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

◆ systemEconomy_number

- (NSNumber *) systemEconomy_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ systemEconomy_string

- (NSString *) systemEconomy_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ systemGovernment_number

- (NSNumber *) systemGovernment_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ systemGovernment_string

- (NSString *) systemGovernment_string

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ systemID

- (OOSystemID) systemID

Definition at line 13735 of file PlayerEntity.m.

685{
686 return system_id;
687}

◆ systemPopulation_number

- (NSNumber *) systemPopulation_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ systemProductivity_number

- (NSNumber *) systemProductivity_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ systemPseudoRandom100

- (unsigned) systemPseudoRandom100

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

252{
253 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
254 return (gen_rnd_number() * 256 + gen_rnd_number()) % 100;
255}
int gen_rnd_number(void)

◆ systemPseudoRandom256

- (unsigned) systemPseudoRandom256

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

259{
260 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
261 return gen_rnd_number();
262}

◆ systemPseudoRandomFloat

- (double) systemPseudoRandomFloat

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

266{
267 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
268 unsigned a = gen_rnd_number();
269 unsigned b = gen_rnd_number();
270 unsigned c = gen_rnd_number();
271
272 a = (a << 16) | (b << 8) | c;
273 return (double)a / (double)0x01000000;
274
275}

◆ systemTechLevel_number

- (NSNumber *) systemTechLevel_number

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ takeEnergyDamage:from:becauseOf:weaponIdentifier:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6354 :(double)amount from:(Entity *)ent becauseOf:(Entity *)other weaponIdentifier:(NSString *)weaponIdentifier
6355{
6356 HPVector rel_pos;
6357 OOScalar d_forward, d_right, d_up;
6358 BOOL internal_damage = NO; // base chance
6359
6360 OOLog(@"player.ship.damage", @"Player took damage from %@ becauseOf %@", ent, other);
6361
6362 if ([self status] == STATUS_DEAD) return;
6363 if ([self status] == STATUS_ESCAPE_SEQUENCE) return; // if the player has ejected, don't deal more damage
6364 if (amount == 0.0) return;
6365
6366 BOOL cascadeWeapon = [ent isCascadeWeapon];
6367 BOOL cascading = NO;
6368 if (cascadeWeapon)
6369 {
6370 cascading = [self cascadeIfAppropriateWithDamageAmount:amount cascadeOwner:[ent owner]];
6371 }
6372
6373 // make sure ent (& its position) is the attacking _ship_/missile !
6374 if (ent && [ent isSubEntity]) ent = [ent owner];
6375
6376 [[ent retain] autorelease];
6377 [[other retain] autorelease];
6378
6379 rel_pos = (ent != nil) ? [ent position] : kZeroHPVector;
6380 rel_pos = HPvector_subtract(rel_pos, position);
6381
6382 [self doScriptEvent:OOJSID("shipBeingAttacked") withArgument:ent];
6383 if ([ent isShip]) [(ShipEntity *)ent doScriptEvent:OOJSID("shipAttackedOther") withArgument:self];
6384
6385 d_forward = dot_product(HPVectorToVector(rel_pos), v_forward);
6386 d_right = dot_product(HPVectorToVector(rel_pos), v_right);
6387 d_up = dot_product(HPVectorToVector(rel_pos), v_up);
6388 Vector relative = make_vector(d_right,d_up,d_forward);
6389
6390 [self playShieldHit:relative weaponIdentifier:weaponIdentifier];
6391
6392 // firing on an innocent ship is an offence
6393 if ([other isShip])
6394 {
6395 [self broadcastHitByLaserFrom:(ShipEntity*) other];
6396 }
6397
6398 if (d_forward >= 0)
6399 {
6400 forward_shield -= amount;
6401 if (forward_shield < 0.0)
6402 {
6403 amount = -forward_shield;
6404 forward_shield = 0.0f;
6405 }
6406 else
6407 {
6408 amount = 0.0;
6409 }
6410 }
6411 else
6412 {
6413 aft_shield -= amount;
6414 if (aft_shield < 0.0)
6415 {
6416 amount = -aft_shield;
6417 aft_shield = 0.0f;
6418 }
6419 else
6420 {
6421 amount = 0.0;
6422 }
6423 }
6424
6425 OOShipDamageType damageType = cascadeWeapon ? kOODamageTypeCascadeWeapon : kOODamageTypeEnergy;
6426
6427 if (amount > 0.0)
6428 {
6429 energy -= amount;
6430 [self playDirectHit:relative weaponIdentifier:weaponIdentifier];
6432 {
6433 /* Heat increase from energy impacts will never directly cause
6434 * overheating - too easy for missile hits to cause an uncredited
6435 * death by overheating against NPCs, so same rules for player */
6438 {
6440 }
6441 }
6442 }
6443 [self noteTakingDamage:amount from:other type:damageType];
6444 if (cascading) energy = 0.0; // explicitly set energy to zero when cascading, in case an oxp raised the energy in noteTakingDamage.
6445
6446 if (energy <= 0.0) //use normal ship temperature calculations for heat damage
6447 {
6448 if ([other isShip])
6449 {
6450 [(ShipEntity *)other noteTargetDestroyed:self];
6451 }
6452
6453 [self getDestroyedBy:other damageType:damageType];
6454 }
6455 else
6456 {
6457 while (amount > 0.0)
6458 {
6459 internal_damage = ((ranrot_rand() & PLAYER_INTERNAL_DAMAGE_FACTOR) < amount); // base chance of damage to systems
6460 if (internal_damage)
6461 {
6462 [self takeInternalDamage];
6463 }
6464 amount -= (PLAYER_INTERNAL_DAMAGE_FACTOR + 1);
6465 }
6466 }
6467}
const HPVector kZeroHPVector
Definition OOHPVector.m:28
#define PLAYER_INTERNAL_DAMAGE_FACTOR
#define SHIP_ENERGY_DAMAGE_TO_HEAT_FACTOR
Definition ShipEntity.h:65
id owner()
Definition Entity.m:583

◆ takeHeatDamage:

- (void) takeHeatDamage: (double) amount
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6536 :(double) amount
6537{
6538 if ([self status] == STATUS_DEAD || amount < 0) return;
6539
6540 // hit the shields first!
6541 float fwd_amount = (float)(0.5 * amount);
6542 float aft_amount = (float)(0.5 * amount);
6543
6544 forward_shield -= fwd_amount;
6545 if (forward_shield < 0.0)
6546 {
6547 fwd_amount = -forward_shield;
6548 forward_shield = 0.0f;
6549 }
6550 else
6551 {
6552 fwd_amount = 0.0f;
6553 }
6554
6555 aft_shield -= aft_amount;
6556 if (aft_shield < 0.0)
6557 {
6558 aft_amount = -aft_shield;
6559 aft_shield = 0.0f;
6560 }
6561 else
6562 {
6563 aft_amount = 0.0f;
6564 }
6565
6566 double residual_amount = fwd_amount + aft_amount;
6567
6568 [super takeHeatDamage:residual_amount];
6569}

◆ takeInternalDamage

- (BOOL) takeInternalDamage

Definition at line 13735 of file PlayerEntity.m.

6922{
6923 unsigned n_cargo = [self maxAvailableCargoSpace];
6924 unsigned n_mass = [self mass] / 10000;
6925 unsigned n_considered = (n_cargo + n_mass) * ship_trade_in_factor / 100; // a lower value of n_considered means more vulnerable to damage.
6926 unsigned damage_to = n_considered ? (ranrot_rand() % n_considered) : 0; // n_considered can be 0 for small ships.
6927 BOOL result = NO;
6928 // cargo damage
6929 if (damage_to < [cargo count])
6930 {
6931 ShipEntity* pod = (ShipEntity*)[cargo objectAtIndex:damage_to];
6932 NSString* cargo_desc = [UNIVERSE displayNameForCommodity:[pod commodityType]];
6933 if (!cargo_desc)
6934 return NO;
6935 [UNIVERSE clearPreviousMessage];
6936 [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-destroyed"), cargo_desc] forCount:4.5];
6937 [cargo removeObject:pod];
6938 return YES;
6939 }
6940 else
6941 {
6942 damage_to = n_considered - (damage_to + 1); // reverse the die-roll
6943 }
6944 // equipment damage
6945 NSEnumerator *eqEnum = [self equipmentEnumerator];
6946 OOEquipmentType *eqType = nil;
6947 NSString *system_key;
6948 unsigned damageableCounter = 0;
6949 GLfloat damageableOdds = 0.0;
6950 while ((system_key = [eqEnum nextObject]) != nil)
6951 {
6952 eqType = [OOEquipmentType equipmentTypeWithIdentifier:system_key];
6953 if ([eqType canBeDamaged])
6954 {
6955 damageableCounter++;
6956 damageableOdds += [eqType damageProbability];
6957 }
6958 }
6959
6960 if (damage_to < damageableCounter)
6961 {
6962 GLfloat target = randf() * damageableOdds;
6963 GLfloat accumulator = 0.0;
6964 eqEnum = [self equipmentEnumerator];
6965 while ((system_key = [eqEnum nextObject]) != nil)
6966 {
6967 eqType = [OOEquipmentType equipmentTypeWithIdentifier:system_key];
6968 accumulator += [eqType damageProbability];
6969 if (accumulator > target)
6970 {
6971 [system_key retain];
6972 break;
6973 }
6974 }
6975 if (system_key == nil)
6976 {
6977 [system_key release];
6978 return NO;
6979 }
6980
6981 NSString *system_name = [eqType name];
6982 if (![eqType canBeDamaged] || system_name == nil)
6983 {
6984 [system_key release];
6985 return NO;
6986 }
6987
6988 // set the following so removeEquipment works on the right entity
6989 [self setScriptTarget:self];
6990 [UNIVERSE clearPreviousMessage];
6991 [self removeEquipmentItem:system_key];
6992
6993 NSString *damagedKey = [NSString stringWithFormat:@"%@_DAMAGED", system_key];
6994 [self addEquipmentItem:damagedKey withValidation: NO inContext:@"damage"]; // for possible future repair.
6995 [self doScriptEvent:OOJSID("equipmentDamaged") withArgument:system_key];
6996
6997 if (![self hasEquipmentItem:system_name] && [self hasEquipmentItem:damagedKey])
6998 {
6999 /*
7000 Display "foo damaged" message only if no script has
7001 repaired or removed the equipment item. (If a script does
7002 either of those and wants a message, it can write it
7003 itself.)
7004 */
7005 [UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-damaged"), system_name] forCount:4.5];
7006 }
7007
7008 /* There used to be a check for docking computers here, but
7009 * that didn't cover other ways they might fail in flight, so
7010 * it has been moved to the removeEquipment method. */
7011 [system_key release];
7012 return YES;
7013 }
7014 //cosmetic damage
7015 if (((damage_to & 7) == 7)&&(ship_trade_in_factor > 75))
7016 {
7018 result = YES;
7019 }
7020 return result;
7021}

Referenced by PlayerShipTakeInternalDamage().

+ Here is the caller graph for this function:

◆ takeScrapeDamage:from:

- (void) takeScrapeDamage: (double) amount
from: (Entity *) ent 
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

6470 :(double) amount from:(Entity *) ent
6471{
6472 HPVector rel_pos;
6473 OOScalar d_forward, d_right, d_up;
6474 BOOL internal_damage = NO; // base chance
6475
6476 if ([self status] == STATUS_DEAD) return;
6477
6478 if (amount < 0)
6479 {
6480 OOLog(@"player.ship.damage", @"Player took negative scrape damage %.3f so we made it positive", amount);
6481 amount = -amount;
6482 }
6483 OOLog(@"player.ship.damage", @"Player took %.3f scrape damage from %@", amount, ent);
6484
6485 [[ent retain] autorelease];
6486 rel_pos = ent ? [ent position] : kZeroHPVector;
6487 rel_pos = HPvector_subtract(rel_pos, position);
6488 // rel_pos is now small
6489 d_forward = dot_product(HPVectorToVector(rel_pos), v_forward);
6490 d_right = dot_product(HPVectorToVector(rel_pos), v_right);
6491 d_up = dot_product(HPVectorToVector(rel_pos), v_up);
6492 Vector relative = make_vector(d_right,d_up,d_forward);
6493
6494 [self playScrapeDamage:relative];
6495 if (d_forward >= 0)
6496 {
6497 forward_shield -= amount;
6498 if (forward_shield < 0.0)
6499 {
6500 amount = -forward_shield;
6501 forward_shield = 0.0f;
6502 }
6503 else
6504 {
6505 amount = 0.0;
6506 }
6507 }
6508 else
6509 {
6510 aft_shield -= amount;
6511 if (aft_shield < 0.0)
6512 {
6513 amount = -aft_shield;
6514 aft_shield = 0.0f;
6515 }
6516 else
6517 {
6518 amount = 0.0;
6519 }
6520 }
6521
6522 [super takeScrapeDamage:amount from:ent];
6523
6524 while (amount > 0.0)
6525 {
6526 internal_damage = ((ranrot_rand() & PLAYER_INTERNAL_DAMAGE_FACTOR) < amount); // base chance of damage to systems
6527 if (internal_damage)
6528 {
6529 [self takeInternalDamage];
6530 }
6531 amount -= (PLAYER_INTERNAL_DAMAGE_FACTOR + 1);
6532 }
6533}

◆ targetInfoSystem

- (void) targetInfoSystem

Definition at line 13735 of file PlayerEntity.m.

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

◆ targetMemory

- (NSMutableArray *) targetMemory

Definition at line 9247 of file PlayerEntity.m.

12357{
12358 return target_memory;
12359}

◆ targetNearestHostile

- (void) targetNearestHostile

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ targetNearestIncomingMissile

- (void) targetNearestIncomingMissile

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ targetNewSystem:

- (void) targetNewSystem: (int) direction

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ targetNewSystem:whileTyping:

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

Provided by category PlayerEntity(Controls).

Definition at line 167 of file PlayerEntityControls.m.

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

◆ targetSystemID

- (OOSystemID) targetSystemID

Definition at line 13735 of file PlayerEntity.m.

712{
713 return target_system_id;
714}

◆ testForEquipment:

- (void) testForEquipment: (NSString *) equipString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

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

◆ TestScriptConditions

+ (static BOOL) TestScriptConditions (NSArray *) conditions
implementation

Provided by category PlayerEntity(Scripting).

Definition at line 233 of file PlayerEntityLegacyScriptEngine.m.

234{
235 NSEnumerator *condEnum = nil;
236 NSArray *condition = nil;
237 PlayerEntity *player = PLAYER;
238
239 for (condEnum = [conditions objectEnumerator]; (condition = [condEnum nextObject]); )
240 {
241 if (![player scriptTestCondition:condition]) return NO;
242 }
243
244 return YES;
245}

◆ tidyMissilePylons

- (void) tidyMissilePylons

Definition at line 13735 of file PlayerEntity.m.

5707{
5708 // Make sure there's no gaps between missiles, synchronise missile_entity & missile_list.
5709 int i, pylon = 0;
5710 OOLog(@"missile.tidying.debug",@"Tidying fitted %d of possible %d missiles",missiles,PLAYER_MAX_MISSILES);
5711 for(i = 0; i < PLAYER_MAX_MISSILES; i++)
5712 {
5713 OOLog(@"missile.tidying.debug",@"%d %@ %@",i,missile_entity[i],missile_list[i]);
5714 if(missile_entity[i] != nil)
5715 {
5716 missile_entity[pylon] = missile_entity[i];
5717 missile_list[pylon] = [OOEquipmentType equipmentTypeWithIdentifier:[missile_entity[i] primaryRole]];
5718 pylon++;
5719 }
5720 }
5721
5722 // Now clean up the remainder of the pylons.
5723 for(i = pylon; i < PLAYER_MAX_MISSILES; i++)
5724 {
5725 missile_entity[i] = nil;
5726 // not strictly needed, but helps clear things up
5727 missile_list[i] = nil;
5728 }
5729}

◆ tradeInFactor

- (int) tradeInFactor

Definition at line 9247 of file PlayerEntity.m.

11920{
11921 return ship_trade_in_factor;
11922}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ tradeInValue

- (OOCreditsQuantity) tradeInValue
implementation

Provided by category PlayerEntity(ContractsPrivate).

Definition at line 1443 of file PlayerEntityContracts.m.

1706{
1707 // returns down to ship_trade_in_factor% of the full credit value of your ship
1708
1709 /* FIXME: the trade-in value can be more than the sale value, and
1710 ship_trade_in_factor starts at 100%, so it can be profitable to sit
1711 and buy the same ship over and over again. This bug predates Oolite
1712 1.65.
1713 Partial fix: make effective trade-in value 75% * ship_trade_in_factor%
1714 of the "raw" trade-in value. This still allows profitability! A better
1715 solution would be to unify the price calculation for trade-in and
1716 for-sale ships.
1717 -- Ahruman 20070707, fix applied 20070708
1718 */
1719 unsigned long long value = [UNIVERSE tradeInValueForCommanderDictionary:[self commanderDataDictionary]];
1720 value -= value * 0.006 * [self missingSubEntitiesAdjustment]; // TODO: 0.006 might need rethinking.
1721 value = cunningFee(((value * 75 * ship_trade_in_factor) + 5000) / 10000, 0.005); // Multiply by two percentages, divide by 100*100. The +5000 is to get normal rounding.
1722 return value * 10;
1723}

◆ trumbleAppetiteAccumulator

- (float) trumbleAppetiteAccumulator

Definition at line 9247 of file PlayerEntity.m.

12211{
12213}

◆ trumbleArray

- (OOTrumble **) trumbleArray

Definition at line 9247 of file PlayerEntity.m.

12066{
12067 return trumble;
12068}

◆ trumbleCount

- (NSUInteger) trumbleCount

◆ trumbleValue

- (id) trumbleValue

Definition at line 9247 of file PlayerEntity.m.

12078{
12079 NSString *namekey = [NSString stringWithFormat:@"%@-humbletrash", [self commanderName]];
12080 int trumbleHash;
12081
12083 [self mungChecksumWithNSString:[self commanderName]];
12086 trumbleHash = munge_checksum(trumbleCount);
12087
12088 [[NSUserDefaults standardUserDefaults] setInteger:trumbleHash forKey:namekey];
12089
12090 int i;
12091 NSMutableArray *trumbleArray = [NSMutableArray arrayWithCapacity:PLAYER_MAX_TRUMBLES];
12092 for (i = 0; i < PLAYER_MAX_TRUMBLES; i++)
12093 {
12094 [trumbleArray addObject:[trumble[i] dictionary]];
12095 }
12096
12097 return [NSArray arrayWithObjects:[NSNumber numberWithUnsignedInteger:trumbleCount], [NSNumber numberWithInt:trumbleHash], trumbleArray, nil];
12098}
OOTrumble ** trumbleArray()

◆ tryBuyingCommodity:all:

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

Definition at line 9247 of file PlayerEntity.m.

11366 :(OOCommodityType)index all:(BOOL)all
11367{
11368 if ([index isEqualToString:@"<<<"] || [index isEqualToString:@">>>"])
11369 {
11370 ++marketOffset;
11371 return NO;
11372 }
11373
11374 if (![self isDocked]) return NO; // can't buy if not docked.
11375
11376 OOCommodityMarket *localMarket = [self localMarket];
11377 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:index];
11378 OOMassUnit unit = [localMarket massUnitForGood:index];
11379
11380 if (specialCargo != nil && unit == UNITS_TONS)
11381 {
11382 return NO; // can't buy tons of stuff when carrying a specialCargo
11383 }
11384 int manifest_quantity = [shipCommodityData quantityForGood:index];
11385 int market_quantity = [localMarket quantityForGood:index];
11386
11387 int purchase = 1;
11388 if (all)
11389 {
11390 // if cargo contracts, put a break point on the contract volume
11391 int contracted = [self contractedVolumeForGood:index];
11392 if (manifest_quantity >= contracted)
11393 {
11394 purchase = [localMarket capacityForGood:index];
11395 }
11396 else
11397 {
11398 purchase = contracted-manifest_quantity;
11399 }
11400 }
11401 if (purchase > market_quantity)
11402 {
11403 purchase = market_quantity; // limit to what's available
11404 }
11405 if (purchase * pricePerUnit > credits)
11406 {
11407 purchase = floor (credits / pricePerUnit); // limit to what's affordable
11408 }
11409 // TODO - fix brokenness here...
11410 if (unit == UNITS_TONS && purchase + current_cargo > [self maxAvailableCargoSpace])
11411 {
11412 purchase = [self availableCargoSpace]; // limit to available cargo space
11413 }
11414 else
11415 {
11417 {
11418 // other cases are fine so long as buying is limited to <1000kg / <1000000g
11419 // but if this case is true, we need to see if there is more space in
11420 // the manifest (safe) or an already-accounted-for pod
11421 if (unit == UNITS_KILOGRAMS)
11422 {
11423 if (manifest_quantity % KILOGRAMS_PER_POD <= MAX_KILOGRAMS_IN_SAFE && (manifest_quantity + purchase) % KILOGRAMS_PER_POD > MAX_KILOGRAMS_IN_SAFE)
11424 {
11425 // going from < n500 to >= n500 would increase pods needed by 1
11426 purchase = MAX_KILOGRAMS_IN_SAFE - manifest_quantity; // max possible
11427 }
11428 }
11429 else // UNITS_GRAMS
11430 {
11431 if (manifest_quantity % GRAMS_PER_POD <= MAX_GRAMS_IN_SAFE && (manifest_quantity + purchase) % GRAMS_PER_POD > MAX_GRAMS_IN_SAFE)
11432 {
11433 // going from < n500000 to >= n500000 would increase pods needed by 1
11434 purchase = MAX_GRAMS_IN_SAFE - manifest_quantity; // max possible
11435 }
11436 }
11437 }
11438 }
11439 if (purchase <= 0)
11440 {
11441 return NO; // stop if that results in nothing to be bought
11442 }
11443
11444 [localMarket removeQuantity:purchase forGood:index];
11445 [shipCommodityData addQuantity:purchase forGood:index];
11446 credits -= pricePerUnit * purchase;
11447
11448 [self calculateCurrentCargo];
11449
11450 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11451
11452 [self doScriptEvent:OOJSID("playerBoughtCargo") withArguments:[NSArray arrayWithObjects:index, [NSNumber numberWithInt:purchase], [NSNumber numberWithUnsignedLongLong:pricePerUnit], nil]];
11453 if ([localMarket exportLegalityForGood:index] > 0)
11454 {
11455 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-illegal"];
11456 }
11457 else
11458 {
11459 [roleWeightFlags setObject:[NSNumber numberWithInt:1] forKey:@"bought-legal"];
11460 }
11461
11462 return YES;
11463}
BOOL removeQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)
OOCargoQuantity capacityForGood:(OOCommodityType good)

◆ tryBuyingItem:

- (BOOL) tryBuyingItem: (NSString *) eqKey
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9247 of file PlayerEntity.m.

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

◆ trySellingCommodity:all:

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

Definition at line 9247 of file PlayerEntity.m.

11466 :(OOCommodityType)index all:(BOOL)all
11467{
11468 if ([index isEqualToString:@"<<<"] || [index isEqualToString:@">>>"])
11469 {
11470 --marketOffset;
11471 return NO;
11472 }
11473
11474 if (![self isDocked]) return NO; // can't sell if not docked.
11475
11476 OOCommodityMarket *localMarket = [self localMarket];
11477 int available_units = [shipCommodityData quantityForGood:index];
11478 OOCreditsQuantity pricePerUnit = [localMarket priceForGood:index];
11479
11480 if (available_units == 0) return NO;
11481
11482 int market_quantity = [localMarket quantityForGood:index];
11483
11484 int capacity = [localMarket capacityForGood:index];
11485 int sell = 1;
11486 if (all)
11487 {
11488 // if cargo contracts, put a break point on the contract volume
11489 int contracted = [self contractedVolumeForGood:index];
11490 if (available_units <= contracted)
11491 {
11492 sell = capacity;
11493 }
11494 else
11495 {
11496 sell = available_units-contracted;
11497 }
11498 }
11499
11500 if (sell > available_units)
11501 sell = available_units; // limit to what's in the hold
11502 if (sell + market_quantity > capacity)
11503 sell = capacity - market_quantity; // avoid flooding the market
11504 if (sell <= 0)
11505 return NO; // stop if that results in nothing to be sold
11506
11507 [localMarket addQuantity:sell forGood:index];
11508 [shipCommodityData removeQuantity:sell forGood:index];
11509 credits += pricePerUnit * sell;
11510
11511 [self calculateCurrentCargo];
11512
11513 if ([UNIVERSE autoSave]) [UNIVERSE setAutoSaveNow:YES];
11514
11515 [self doScriptEvent:OOJSID("playerSoldCargo") withArguments:[NSArray arrayWithObjects:index, [NSNumber numberWithInt:sell], [NSNumber numberWithUnsignedLongLong: pricePerUnit], nil]];
11516
11517 return YES;
11518}
BOOL addQuantity:forGood:(OOCargoQuantity quantity,[forGood] OOCommodityType good)

◆ unloadAllCargoPodsForType:toManifest:

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

Definition at line 13735 of file PlayerEntity.m.

217 :(OOCommodityType)type toManifest:(OOCommodityMarket *) manifest
218{
219 NSInteger i, cargoCount = [cargo count];
220 if (cargoCount == 0) return;
221
222 // step through the cargo pods adding in the quantities
223 for (i = cargoCount - 1; i >= 0 ; i--)
224 {
225 ShipEntity *cargoItem = [cargo objectAtIndex:i];
226 NSString * commodityType = [cargoItem commodityType];
227 if (commodityType == nil || [commodityType isEqualToString:type])
228 {
229 if ([commodityType isEqualToString:type])
230 {
231 // transfer
232 [manifest addQuantity:[cargoItem commodityAmount] forGood:type];
233 }
234 else // undefined
235 {
236 OOLog(@"player.badCargoPod", @"Cargo pod %@ has bad commodity type, rejecting.", cargoItem);
237 continue;
238 }
239 [cargo removeObjectAtIndex:i];
240 }
241 }
242}

◆ unloadCargoPods

- (void) unloadCargoPods

Definition at line 13735 of file PlayerEntity.m.

295{
296 NSAssert([self isDocked], @"Cannot unload cargo pods unless docked.");
297
298 /* loads commodities from the cargo pods onto the ship's manifest */
299 NSString *good = nil;
300 foreach (good, [shipCommodityData goods])
301 {
302 [self unloadAllCargoPodsForType:good toManifest:shipCommodityData];
303 }
304#ifndef NDEBUG
305 if ([cargo count] > 0)
306 {
307 OOLog(@"player.unloadCargo",@"Cargo remains in pods after unloading - %@",cargo);
308 }
309#endif
310
311 [self calculateCurrentCargo]; // work out the correct value for current_cargo
312}

◆ unloadCargoPodsForType:amount:

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

Definition at line 13735 of file PlayerEntity.m.

245 :(OOCommodityType)type amount:(OOCargoQuantity)quantity
246{
247 NSInteger i, n_cargo = [cargo count];
248 if (n_cargo == 0) return;
249
250 ShipEntity *cargoItem = nil;
251 OOCommodityType co_type;
252 OOCargoQuantity amount;
253 OOCargoQuantity cargoToGo = quantity;
254
255 // step through the cargo pods removing pods or quantities
256 for (i = n_cargo - 1; (i >= 0 && cargoToGo > 0) ; i--)
257 {
258 cargoItem = [cargo objectAtIndex:i];
259 co_type = [cargoItem commodityType];
260 if (co_type == nil || [co_type isEqualToString:type])
261 {
262 if ([co_type isEqualToString:type])
263 {
264 amount = [cargoItem commodityAmount];
265 if (amount <= cargoToGo)
266 {
267 [cargo removeObjectAtIndex:i];
268 cargoToGo -= amount;
269 }
270 else
271 {
272 // we only need to remove a part of the cargo to meet our target
273 [cargoItem setCommodity:co_type andAmount:(amount - cargoToGo)];
274 cargoToGo = 0;
275
276 }
277 }
278 else // undefined
279 {
280 OOLog(@"player.badCargoPod", @"Cargo pod %@ has bad commodity type (COMMODITY_UNDEFINED), rejecting.", cargoItem);
281 continue;
282 }
283 }
284 }
285
286 // now check if we are ready. When not, proceed with quantities in the manifest.
287 if (cargoToGo > 0)
288 {
289 [shipCommodityData removeQuantity:cargoToGo forGood:type];
290 }
291}

◆ unsetKeySetting:

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

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1656 :(NSString*)key
1657{
1658 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1659 if (![self entryIsCustomEquip:key])
1660 {
1661 NSMutableDictionary *keyconf = [NSMutableDictionary dictionaryWithDictionary:[defaults objectForKey:KEYCONFIG_OVERRIDES]];
1662 NSMutableArray *empty = [[NSMutableArray alloc] init];
1663 [keyconf setObject:empty forKey:key];
1664 [defaults setObject:keyconf forKey:KEYCONFIG_OVERRIDES];
1665 [empty release];
1666 }
1667 else
1668 {
1669 NSString *custkey = [self getCustomEquipKeyDefType:key];
1670 [[customEquipActivation objectAtIndex:[self getCustomEquipIndex:key]] removeObjectForKey:custkey];
1671 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1672 }
1673 // reload settings
1674 [self initKeyConfigSettings];
1675}

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

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

◆ updateAfterburnerSound

- (void) updateAfterburnerSound
implementation

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

455{
456 static uint8_t which = 0;
457
458 if (!afterburner_engaged) // end the loop cycle
459 {
460 afterburnerSoundLooping = NO;
461 }
462
463 if (afterburnerSoundLooping)
464 {
465 [sAfterburnerSources[which] play];
466 which = !which;
467
468 [self performSelector:@selector(updateAfterburnerSound)
469 withObject:NULL
470 afterDelay:1.25]; // and swap sounds in 1.25s time
471 }
472}

◆ updateAlertCondition

- (void) updateAlertCondition
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

3424{
3425 [self updateAlertConditionForNearbyEntities];
3426 /* TODO: update alert condition once per frame. Tried this before, but
3427 there turned out to be complications. See mailing list archive.
3428 -- Ahruman 20070802
3429 */
3430 OOAlertCondition cond = [self alertCondition];
3431 OOTimeAbsolute t = [UNIVERSE getTime];
3432 if (cond != lastScriptAlertCondition)
3433 {
3434 ShipScriptEventNoCx(self, "alertConditionChanged", INT_TO_JSVAL(cond), INT_TO_JSVAL(lastScriptAlertCondition));
3436 }
3437 /* Update heuristic assessment of whether player is fleeing */
3439 {
3441 }
3443 {
3445 }
3447 {
3449 }
3450 else if (fleeing_status == PLAYER_FLEEING_MAYBE && last_shot_time + 10 > t)
3451 {
3453 }
3454 else if (fleeing_status == PLAYER_FLEEING_LIKELY && last_shot_time + 10 > t)
3455 {
3457 }
3459 {
3461 }
3463 {
3465 }
3466}
double OOTimeAbsolute
Definition OOTypes.h:223
@ PLAYER_FLEEING_MAYBE
@ PLAYER_FLEEING_LIKELY
@ PLAYER_FLEEING_NONE
@ PLAYER_FLEEING_CARGO
@ PLAYER_FLEEING_UNLIKELY
OOAlertCondition
Definition ShipEntity.h:172
@ ALERT_CONDITION_GREEN
Definition ShipEntity.h:176
@ ALERT_CONDITION_YELLOW
Definition ShipEntity.h:177
@ ALERT_CONDITION_DOCKED
Definition ShipEntity.h:175
OOTimeAbsolute last_shot_time
Definition ShipEntity.h:359

◆ updateAlertConditionForNearbyEntities

- (void) updateAlertConditionForNearbyEntities
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

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

◆ updateClocks:

- (void) updateClocks: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

3483 :(OOTimeDelta)delta_t
3484{
3485 // shot time updates are still needed here for STATUS_DEAD!
3486 shot_time += delta_t;
3487 script_time += delta_t;
3488 unsigned prev_day = floor(ship_clock / 86400);
3489 ship_clock += delta_t;
3490 if (ship_clock_adjust > 0.0) // adjust for coming out of warp (add LY * LY hrs)
3491 {
3492 double fine_adjust = delta_t * 7200.0;
3493 if (ship_clock_adjust > 86400) // more than a day
3494 fine_adjust = delta_t * 115200.0; // 16 times faster
3495 if (ship_clock_adjust > 0)
3496 {
3497 if (fine_adjust > ship_clock_adjust)
3498 fine_adjust = ship_clock_adjust;
3499 ship_clock += fine_adjust;
3500 ship_clock_adjust -= fine_adjust;
3501 }
3502 else
3503 {
3504 if (fine_adjust < ship_clock_adjust)
3505 fine_adjust = ship_clock_adjust;
3506 ship_clock -= fine_adjust;
3507 ship_clock_adjust += fine_adjust;
3508 }
3509 }
3510 else
3511 ship_clock_adjust = 0.0;
3512
3513 unsigned now_day = floor(ship_clock / 86400.0);
3514 while (prev_day < now_day)
3515 {
3516 prev_day++;
3517 [self doScriptEvent:OOJSID("dayChanged") withArgument:[NSNumber numberWithUnsignedInt:prev_day]];
3518 // not impossible that at ultra-low frame rates two of these will
3519 // happen in a single update.
3520 }
3521
3522 //fps
3524 {
3525 if (![self clockAdjusting])
3526 {
3527 fps_counter = (int)([UNIVERSE timeAccelerationFactor] * floor([UNIVERSE framesDoneThisUpdate] / (fps_check_time - last_fps_check_time)));
3530 }
3531 else
3532 {
3533 // Good approximation for when the clock is adjusting and proper fps calculation
3534 // cannot be performed.
3535 fps_counter = (int)([UNIVERSE timeAccelerationFactor] * floor(1.0 / delta_t));
3537 }
3538 [UNIVERSE resetFramesDoneThisUpdate]; // Reset frame counter
3539 }
3540}
double last_fps_check_time

◆ updateFuelScoops:

- (void) updateFuelScoops: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

3469 :(OOTimeDelta)delta_t
3470{
3471 if (scoopsActive)
3472 {
3473 [self updateFuelScoopSoundWithInterval:delta_t];
3474 if (![self scoopOverride])
3475 {
3476 scoopsActive = NO;
3477 [self updateFuelScoopSoundWithInterval:delta_t];
3478 }
3479 }
3480}

◆ updateFuelScoopSoundWithInterval:

- (void) updateFuelScoopSoundWithInterval: (OOTimeDelta) delta_t

Provided by category PlayerEntity(Sound).

Definition at line 69 of file PlayerEntitySound.m.

429 :(OOTimeDelta)delta_t
430{
431 static double scoopSoundPlayTime = 0.0;
432 scoopSoundPlayTime -= delta_t;
433 if (scoopSoundPlayTime < 0.0)
434 {
435 if(![sInterfaceBeepSource isPlaying])
436 {
437 /* TODO: this should use the scoop position, not the standard
438 * interface beep position */
439 [self playInterfaceBeep:@"[scoop]"];
440 scoopSoundPlayTime = 0.5;
441 }
442 else scoopSoundPlayTime = 0.0;
443 }
444 if (![self scoopOverride])
445 {
446 scoopSoundPlayTime = 0.0;
447 }
448}

◆ updateFunction:

- (void) updateFunction: (NSDictionary *) hwDict

Provided by category PlayerEntity(StickMapper).

Definition at line 1 of file PlayerEntityStickMapper.m.

215 : (NSDictionary *)hwDict
216{
218 waitingForStickCallback = NO;
219
220 // Right time and the right place?
221 if(gui_screen != GUI_SCREEN_STICKMAPPER)
222 {
223 OOLog(@"joystick.configure.error", @"%s called when not on stick mapper screen.", __PRETTY_FUNCTION__);
224 return;
225 }
226
227 // What moved?
228 int function;
229 NSDictionary *entry = [stickFunctions objectAtIndex:selFunctionIdx];
230 if([hwDict oo_boolForKey:STICK_ISAXIS])
231 {
232 function=[entry oo_intForKey: KEY_AXISFN];
233 if (function == AXIS_THRUST)
234 {
235 [stickHandler unsetButtonFunction:BUTTON_INCTHRUST];
236 [stickHandler unsetButtonFunction:BUTTON_DECTHRUST];
237 }
238#if OO_FOV_INFLIGHT_CONTROL_ENABLED
239 if (function == AXIS_FIELD_OF_VIEW)
240 {
241 [stickHandler unsetButtonFunction:BUTTON_INC_FIELD_OF_VIEW];
242 [stickHandler unsetButtonFunction:BUTTON_DEC_FIELD_OF_VIEW];
243 }
244#endif
245 if (function == AXIS_VIEWX)
246 {
247 [stickHandler unsetButtonFunction:BUTTON_VIEWPORT];
248 [stickHandler unsetButtonFunction:BUTTON_VIEWSTARBOARD];
249 }
250 if (function == AXIS_VIEWY)
251 {
252 [stickHandler unsetButtonFunction:BUTTON_VIEWFORWARD];
253 [stickHandler unsetButtonFunction:BUTTON_VIEWAFT];
254 }
255 }
256 else
257 {
258 function = [entry oo_intForKey:KEY_BUTTONFN];
259 if (function == BUTTON_INCTHRUST || function == BUTTON_DECTHRUST)
260 {
261 [stickHandler unsetAxisFunction:AXIS_THRUST];
262 }
263#if OO_FOV_INFLIGHT_CONTROL_ENABLED
264 if (function == BUTTON_INC_FIELD_OF_VIEW || function == BUTTON_DEC_FIELD_OF_VIEW)
265 {
266 [stickHandler unsetAxisFunction:AXIS_FIELD_OF_VIEW];
267 }
268#endif
269 if (function == BUTTON_VIEWPORT || function == BUTTON_VIEWSTARBOARD)
270 {
271 [stickHandler unsetAxisFunction:AXIS_VIEWX];
272 }
273 if (function == BUTTON_VIEWFORWARD || function == BUTTON_VIEWAFT)
274 {
275 [stickHandler unsetAxisFunction:AXIS_VIEWY];
276 }
277 }
278 // special case for OXP equipment buttons
279 if (function >= 10000)
280 {
281 NSString *key = CUSTOMEQUIP_BUTTONACTIVATE;
282 function -= 10000;
283 if (function >= 10000)
284 {
285 function -= 10000;
287 }
288 [[customEquipActivation objectAtIndex:function] setObject:hwDict forKey:key];
289 [self checkCustomEquipButtons:hwDict ignore:function];
290
291 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
292 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
293 }
294 else
295 {
296 [stickHandler setFunction:function withDict:hwDict];
297 [self checkCustomEquipButtons:hwDict ignore:-1];
298 [stickHandler saveStickSettings];
299 }
300
301 // Update the GUI (this will refresh the function list).
302 unsigned skip;
303 if (selFunctionIdx < MAX_ROWS_FUNCTIONS - 1)
304 {
305 skip = 0;
306 }
307 else
308 {
309 skip = ((selFunctionIdx - 1) / (MAX_ROWS_FUNCTIONS - 2)) * (MAX_ROWS_FUNCTIONS - 2) + 1;
310 }
311
312 [self setGuiToStickMapperScreen:skip];
313}
@ AXIS_VIEWX
@ AXIS_THRUST
@ AXIS_VIEWY
void setFunction:withDict:(int function,[withDict] NSDictionary *stickFn)

◆ updateKeyDefinition:index:

- (void) updateKeyDefinition: (NSString *) keystring
index: (NSUInteger) index 
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

678 :(NSString *)keystring index:(NSUInteger)index
679{
680 NSMutableDictionary *key_def = [[NSMutableDictionary alloc] initWithDictionary:(NSDictionary *)[key_list objectAtIndex:index] copyItems:YES];
681 [key_def setObject:keystring forKey:@"key"];
682 // auto=turn on shift if the entered key was shifted
683
684 if (last_shift && [keystring length] == 1 && ![nav_keys containsObject:[selected_entry objectForKey: KEY_KC_DEFINITION]])
685 {
686 [key_def setObject:[NSNumber numberWithBool:YES] forKey:@"shift"];
687 }
688 if (!last_shift && [keystring length] == 1)
689 {
690 [key_def setObject:[NSNumber numberWithBool:NO] forKey:@"shift"];
691 }
692 last_shift = NO;
693 if (index > [key_list count] - 1)
694 {
695 [key_list insertObject:key_def atIndex:index];
696 }
697 else
698 {
699 [key_list replaceObjectAtIndex:index withObject:key_def];
700 }
701 [key_def release];
702 NSArray *new_array = [self processKeyCode:key_list];
703 [key_list release];
704 key_list = [[NSMutableArray alloc] initWithArray:new_array copyItems:YES];
705 [new_array release];
706}

◆ updateMovementFlags

- (void) updateMovementFlags
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

3204{
3205 hasMoved = !HPvector_equal(position, lastPosition);
3206 hasRotated = !quaternion_equal(orientation, lastOrientation);
3209}
unsigned hasMoved
Definition Entity.h:96
HPVector lastPosition
Definition Entity.h:133

◆ updateShiftKeyDefinition:index:

- (void) updateShiftKeyDefinition: (NSString *) key
index: (NSUInteger) index 
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

710 :(NSString *)key index:(NSUInteger)index
711{
712 NSMutableDictionary *key_def = [[NSMutableDictionary alloc] initWithDictionary:(NSDictionary *)[key_list objectAtIndex:index] copyItems:YES];
713 BOOL current = [[key_def objectForKey:key] boolValue];
714 BOOL keycode_changed = NO;
715 current = !current;
716 [key_def setObject:[NSNumber numberWithBool:current] forKey:key];
717 if ([key isEqualToString:@"shift"])
718 {
719 // force the key into upper or lower case, to limit invalid key combos as much as possible
720 NSString* keycode = [key_def objectForKey:@"key"];
721 NSInteger k_int = (OOKeyCode)[keycode integerValue];
722 if (k_int > 0)
723 {
724 NSString* keystring = [self keyCodeDescription:k_int];
725 NSString* newstring;
726 if ([keystring length] == 1)
727 {
728 // try switching the case. for characters that can't be switched (eg 1,2,3,etc), this should do nothing
729 if (current)
730 {
731 newstring = [keystring uppercaseString];
732 }
733 else
734 {
735 newstring = [keystring lowercaseString];
736 }
737 if (![newstring isEqualToString:keystring])
738 {
739 [key_def setObject:newstring forKey:@"key"];
740 keycode_changed = YES;
741 }
742 }
743 }
744 }
745 if (index > [key_list count] - 1)
746 {
747 [key_list insertObject:key_def atIndex:index];
748 }
749 else
750 {
751 [key_list replaceObjectAtIndex:index withObject:key_def];
752 }
753 [key_def release];
754 if (keycode_changed)
755 {
756 NSArray *new_array = [self processKeyCode:key_list];
757 [key_list release];
758 key_list = [[NSMutableArray alloc] initWithArray:new_array copyItems:YES];
759 [new_array release];
760 }
761}

◆ updateSystemMemory

- (void) updateSystemMemory

Definition at line 13735 of file PlayerEntity.m.

5164{
5165 OOSystemID sys = [self currentSystemID];
5166 if (sys < 0)
5167 {
5168 return;
5169 }
5170 NSUInteger memory = 4;
5171 if (ship_kills >= 6400)
5172 {
5173 memory = 32;
5174 }
5175 else if (ship_kills >= 256)
5176 {
5177 memory = 16;
5178 }
5179 else if (ship_kills >= 64)
5180 {
5181 memory = 8;
5182 }
5183 if ([roleSystemList count] >= memory)
5184 {
5185 [roleSystemList removeObjectAtIndex:0];
5186 }
5187 [roleSystemList addObject:[NSNumber numberWithInt:sys]];
5188}

◆ updateTargeting

- (void) updateTargeting
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

4144{
4146
4147 // check for lost ident target and ensure the ident system is actually scanning
4148 UPDATE_STAGE(@"checking ident target");
4149 if (ident_engaged && [self primaryTarget] != nil)
4150 {
4151 if (![self isValidTarget:[self primaryTarget]])
4152 {
4153 if (!suppressTargetLost)
4154 {
4155 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4156 [self playTargetLost];
4157 [self noteLostTarget];
4158 }
4159 else
4160 {
4161 suppressTargetLost = NO;
4162 }
4163
4165 }
4166 }
4167
4168 // check each unlaunched missile's target still exists and is in-range
4169 UPDATE_STAGE(@"checking missile targets");
4171 {
4172 unsigned i;
4173 for (i = 0; i < max_missiles; i++)
4174 {
4175 if ([missile_entity[i] primaryTarget] != nil &&
4176 ![self isValidTarget:[missile_entity[i] primaryTarget]])
4177 {
4178 [UNIVERSE addMessage:DESC(@"target-lost") forCount:3.0];
4179 [self playTargetLost];
4180 [missile_entity[i] removeTarget:nil];
4181 if (i == activeMissile)
4182 {
4183 [self noteLostTarget];
4186 }
4187 } else if (i == activeMissile && [missile_entity[i] primaryTarget] == nil) {
4189 }
4190 }
4191 }
4192
4193 // if we don't have a primary target, and we're scanning, then check for a new
4194 // target to lock on to
4195 UPDATE_STAGE(@"looking for new target");
4196 if ([self primaryTarget] == nil &&
4198 ([self status] == STATUS_IN_FLIGHT || [self status] == STATUS_WITCHSPACE_COUNTDOWN))
4199 {
4200 Entity *target = [UNIVERSE firstEntityTargetedByPlayer];
4201 if ([self isValidTarget:target])
4202 {
4203 [self addTarget:target];
4204 }
4205 }
4206
4207 // If our primary target is a wormhole, check to see if we have additional
4208 // information
4209 UPDATE_STAGE(@"checking for additional wormhole information");
4210 if ([[self primaryTarget] isWormhole])
4211 {
4212 WormholeEntity *wh = [self primaryTarget];
4213 switch ([wh scanInfo])
4214 {
4215 case WH_SCANINFO_NONE:
4216 OOLog(kOOLogInconsistentState, @"%@", @"Internal Error - WH_SCANINFO_NONE reached in [PlayerEntity updateTargeting:]");
4217 [self dumpState];
4218 [wh dumpState];
4219 // Workaround a reported hit of the assert here. We really
4220 // should work out how/why this could happen though and fix
4221 // the underlying cause.
4222 // - MKW 2011.03.11
4223 //assert([wh scanInfo] != WH_SCANINFO_NONE);
4224 [wh setScannedAt:[self clockTimeAdjusted]];
4225 break;
4227 if ([self clockTimeAdjusted] > [wh scanTime] + 2)
4228 {
4229 [wh setScanInfo:WH_SCANINFO_COLLAPSE_TIME];
4230 //[UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-collapse-time-computed"),
4231 // [UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
4232 }
4233 break;
4235 if([self clockTimeAdjusted] > [wh scanTime] + 4)
4236 {
4237 [wh setScanInfo:WH_SCANINFO_ARRIVAL_TIME];
4238 [UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-arrival-time-computed-@"),
4239 ClockToString([wh estimatedArrivalTime], NO)] forCount:5.0];
4240 }
4241 break;
4243 if ([self clockTimeAdjusted] > [wh scanTime] + 7)
4244 {
4245 [wh setScanInfo:WH_SCANINFO_DESTINATION];
4246 [UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-destination-computed-@"),
4247 [UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
4248 }
4249 break;
4251 if ([self clockTimeAdjusted] > [wh scanTime] + 10)
4252 {
4253 [wh setScanInfo:WH_SCANINFO_SHIP];
4254 // TODO: Extract last ship from wormhole and display its name
4255 }
4256 break;
4257 case WH_SCANINFO_SHIP:
4258 break;
4259 }
4260 }
4261
4263}
@ WH_SCANINFO_NONE
@ WH_SCANINFO_SCANNED
@ WH_SCANINFO_SHIP
@ WH_SCANINFO_ARRIVAL_TIME
@ WH_SCANINFO_DESTINATION
@ WH_SCANINFO_COLLAPSE_TIME
void dumpState()
Definition Entity.m:996
double clockTimeAdjusted()
double estimatedArrivalTime()
void setScannedAt:(double time)
void setScanInfo:(WORMHOLE_SCANINFO scanInfo)

◆ updateTrumbles:

- (void) updateTrumbles: (OOTimeDelta) delta_t
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

3596 :(OOTimeDelta)delta_t
3597{
3598 OOTrumble **trumbles = [self trumbleArray];
3599 NSUInteger i;
3600
3601 for (i = [self trumbleCount] ; i > 0; i--)
3602 {
3603 OOTrumble* trum = trumbles[i - 1];
3604 [trum updateTrumble:delta_t];
3605 }
3606}
void updateTrumble:(double delta_t)
Definition OOTrumble.m:494

◆ updateWormholes

- (void) updateWormholes
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 9247 of file PlayerEntity.m.

13241{
13242 assert(scannedWormholes != nil);
13243
13244 if ([scannedWormholes count] == 0)
13245 return;
13246
13247 double now = [self clockTimeAdjusted];
13248
13249 NSMutableArray * savedWormholes = [[NSMutableArray alloc] initWithCapacity:[scannedWormholes count]];
13250 NSEnumerator * wormholes = [scannedWormholes objectEnumerator];
13251 WormholeEntity *wh;
13252
13253 while ((wh = (WormholeEntity*)[wormholes nextObject]))
13254 {
13255 // TODO: Start drawing wormhole exit a few seconds before the first
13256 // ship is disgorged.
13257 if ([wh arrivalTime] > now)
13258 {
13259 [savedWormholes addObject:wh];
13260 }
13261 else if (NSEqualPoints(galaxy_coordinates, [wh destinationCoordinates]))
13262 {
13263 [wh disgorgeShips];
13264 if ([[wh shipsInTransit] count] > 0)
13265 {
13266 [savedWormholes addObject:wh];
13267 }
13268 }
13269 // Else wormhole has expired in another system, let it expire
13270 }
13271
13272 [scannedWormholes release];
13273 scannedWormholes = savedWormholes;
13274}

◆ useSpecialCargo:

- (void) useSpecialCargo: (NSString *) descriptionString

Provided by category PlayerEntity(Scripting).

Definition at line 955 of file PlayerEntityLegacyScriptEngine.m.

1435 :(NSString *)descriptionString
1436{
1437 if (scriptTarget != self) return;
1438
1439 [self removeAllCargo:YES];
1440 OOLog(kOOLogNoteUseSpecialCargo, @"Going to useSpecialCargo:'%@'", descriptionString);
1441 specialCargo = [OOExpand(descriptionString) retain];
1442}
static NSString *const kOOLogNoteUseSpecialCargo

Referenced by PlayerShipUseSpecialCargo().

+ Here is the caller graph for this function:

◆ validateAllKeys

- (NSArray *) validateAllKeys
implementation

Provided by category PlayerEntity(KeyMapperInternal).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1372{
1373 NSMutableArray *failed = [[NSMutableArray alloc] init];
1374 NSString *validate = nil;
1375 NSUInteger i;
1376
1377 for (i = 0; i < [keyFunctions count]; i++)
1378 {
1379 NSDictionary *entry = [keyFunctions objectAtIndex:i];
1380 validate = [self validateKey:[entry objectForKey:KEY_KC_DEFINITION] checkKeys:(NSArray *)[keyconfig2_settings objectForKey:[entry objectForKey:KEY_KC_DEFINITION]]];
1381 if (validate)
1382 {
1383 [failed addObject:validate];
1384 }
1385 }
1386 return [failed copy];
1387}

◆ validateCompassTarget

- (void) validateCompassTarget

Definition at line 13735 of file PlayerEntity.m.

5211{
5212 OOSunEntity *the_sun = [UNIVERSE sun];
5213 OOPlanetEntity *the_planet = [UNIVERSE planet];
5214 StationEntity *the_station = [UNIVERSE station];
5215 Entity *the_target = [self primaryTarget];
5216 Entity <OOBeaconEntity> *beacon = [self nextBeacon];
5217 if ([self isInSpace] && the_sun && the_planet // be in a system
5218 && ![the_sun goneNova]) // and the system has not been novabombed
5219 {
5220 Entity *new_target = nil;
5221 OOAegisStatus aegis = [self checkForAegis];
5222
5223 switch ([self compassMode])
5224 {
5225 case COMPASS_MODE_INACTIVE:
5226 break;
5227
5228 case COMPASS_MODE_BASIC:
5229 if ((aegis == AEGIS_CLOSE_TO_MAIN_PLANET || aegis == AEGIS_IN_DOCKING_RANGE) && the_station)
5230 {
5231 new_target = the_station;
5232 }
5233 else
5234 {
5235 new_target = the_planet;
5236 }
5237 break;
5238
5239 case COMPASS_MODE_PLANET:
5240 new_target = the_planet;
5241 break;
5242
5243 case COMPASS_MODE_STATION:
5244 new_target = the_station;
5245 break;
5246
5247 case COMPASS_MODE_SUN:
5248 new_target = the_sun;
5249 break;
5250
5251 case COMPASS_MODE_TARGET:
5252 new_target = the_target;
5253 break;
5254
5255 case COMPASS_MODE_BEACONS:
5256 new_target = beacon;
5257 break;
5258 }
5259
5260 if (new_target == nil || [new_target status] < STATUS_ACTIVE || [new_target status] == STATUS_IN_HOLD)
5261 {
5262 [self setCompassMode:COMPASS_MODE_PLANET];
5263 new_target = the_planet;
5264 }
5265
5266 if (EXPECT_NOT(new_target != [self compassTarget]))
5267 {
5268 [self setCompassTarget:new_target];
5269 [self doScriptEvent:OOJSID("compassTargetChanged") withArguments:[NSArray arrayWithObjects:new_target, OOStringFromCompassMode([self compassMode]), nil]];
5270 }
5271 }
5272}

Referenced by PlayerShipSetProperty().

+ Here is the caller graph for this function:

◆ validateCustomEquipActivationArray

- (void) validateCustomEquipActivationArray

Definition at line 9247 of file PlayerEntity.m.

11638{
11639 int i;
11640 bool update = NO;
11641 NSString *equipmentKey;
11642 if ([customEquipActivation count] == 0) return;
11643 for (i = [customEquipActivation count] - 1; i >= 0; i--) {
11644 equipmentKey = [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY];
11646 if (!eq) {
11647 [customEquipActivation removeObjectAtIndex:i];
11648 [customActivatePressed removeObjectAtIndex:i];
11649 [customModePressed removeObjectAtIndex:i];
11650 update = YES;
11651 }
11652 }
11653 if (update) {
11654 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
11655 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
11656 }
11657}

◆ validatedMarker:

- (NSDictionary *) validatedMarker: (NSDictionary *) marker

Provided by category PlayerEntity(ScriptMethods).

Definition at line 623 of file PlayerEntityScriptMethods.m.

322 :(NSDictionary *)marker
323{
324 OOSystemID dest = [marker oo_intForKey:@"system"];
325// FIXME: parameters
326 if (dest < 0 || dest > kOOMaximumSystemID)
327 {
328 return nil;
329 }
330 NSString *group = [marker oo_stringForKey:@"name" defaultValue:MISSION_DEST_LEGACY];
331
332 return [[[NSDictionary dictionaryWithObjectsAndKeys:
333 [NSNumber numberWithInt:dest], @"system",
334 group, @"name",
335 [marker oo_stringForKey:@"markerColor" defaultValue:@"redColor"], @"markerColor",
336 [marker oo_stringForKey:@"markerShape" defaultValue:@"MARKER_X"], @"markerShape",
337 [NSNumber numberWithFloat:[marker oo_floatForKey:@"markerScale" defaultValue:1.0]], @"markerScale",
338 nil] retain] autorelease];
339
340}
@ kOOMaximumSystemID
Definition OOTypes.h:217

◆ validateKey:checkKeys:

- (NSString *) validateKey: (NSString*) key
checkKeys: (NSArray*) check_keys 

Provided by category PlayerEntity(KeyMapper).

Definition at line 44 of file PlayerEntityKeyMapper.m.

1391 :(NSString *)key checkKeys:(NSArray *)check_keys
1392{
1393 NSString *result = nil;
1394
1395 // need to group keys into validation groups
1396 NSArray *gui_keys = [NSArray arrayWithObjects:@"key_gui_arrow_left", @"key_gui_arrow_right", @"key_gui_arrow_up", @"key_gui_arrow_down", @"key_gui_page_up",
1397 @"key_gui_page_down", @"key_gui_select", nil];
1398
1399 if ([gui_keys containsObject:key])
1400 {
1401 result = [self searchArrayForMatch:gui_keys key:key checkKeys:check_keys];
1402 if (result) return result;
1403 }
1404
1405 NSArray *debug_keys = [NSArray arrayWithObjects:
1406 @"key_dump_target_state", @"key_dump_entity_list", @"key_debug_full", @"key_debug_collision", @"key_debug_console_connect", @"key_debug_bounding_boxes",
1407 @"key_debug_shaders", @"key_debug_off", nil];
1408
1409 if ([debug_keys containsObject:key])
1410 {
1411 result = [self searchArrayForMatch:debug_keys key:key checkKeys:check_keys];
1412 if (result) return result;
1413 }
1414
1415 NSArray *customview_keys = [NSArray arrayWithObjects:
1416 @"key_custom_view", @"key_custom_view_zoom_out", @"key_custom_view_zoom_in", @"key_custom_view_roll_left", @"key_custom_view_pan_left",
1417 @"key_custom_view_roll_right", @"key_custom_view_pan_right", @"key_custom_view_rotate_up", @"key_custom_view_pan_up", @"key_custom_view_rotate_down",
1418 @"key_custom_view_pan_down", @"key_custom_view_rotate_left", @"key_custom_view_rotate_right", nil];
1419
1420 if ([customview_keys containsObject:key])
1421 {
1422 result = [self searchArrayForMatch:customview_keys key:key checkKeys:check_keys];
1423 if (result) return result;
1424 }
1425
1426 NSMutableArray *inflight_keys = [NSMutableArray arrayWithObjects:
1427 @"key_roll_left", @"key_roll_right", @"key_pitch_forward", @"key_pitch_back", @"key_yaw_left", @"key_yaw_right", @"key_view_forward", @"key_view_aft",
1428 @"key_view_port", @"key_view_starboard", @"key_increase_speed", @"key_decrease_speed", @"key_inject_fuel", @"key_fire_lasers", @"key_weapons_online_toggle",
1429 @"key_launch_missile", @"key_next_missile", @"key_ecm", @"key_prime_next_equipment", @"key_prime_previous_equipment", @"key_activate_equipment",
1430 @"key_mode_equipment", @"key_fastactivate_equipment_a", @"key_fastactivate_equipment_b", @"key_target_incoming_missile", @"key_target_missile",
1431 @"key_untarget_missile", @"key_ident_system", @"key_scanner_zoom", @"key_scanner_unzoom", @"key_launch_escapepod", @"key_galactic_hyperspace",
1432 @"key_hyperspace", @"key_jumpdrive", @"key_dump_cargo", @"key_rotate_cargo", @"key_autopilot", @"key_autodock", @"key_docking_clearance_request",
1433 @"key_snapshot", @"key_cycle_next_mfd", @"key_cycle_previous_mfd", @"key_switch_next_mfd", @"key_switch_previous_mfd",
1434 @"key_next_target", @"key_previous_target", @"key_comms_log", @"key_prev_compass_mode", @"key_next_compass_mode", @"key_custom_view",
1435#if OO_FOV_INFLIGHT_CONTROL_ENABLED
1436 @"key_inc_field_of_view", @"key_dec_field_of_view",
1437#endif
1438 @"key_pausebutton", @"key_dump_target_state", nil];
1439
1440 if ([self entryIsCustomEquip:key]) {
1441 NSUInteger i;
1442 for (i = 0; i < [customEquipActivation count]; i++)
1443 {
1444 [inflight_keys addObject:[NSString stringWithFormat:@"activate_%@", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]]];
1445 [inflight_keys addObject:[NSString stringWithFormat:@"mode_%@", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]]];
1446 }
1447 }
1448
1449 if ([inflight_keys containsObject:key])
1450 {
1451 result = [self searchArrayForMatch:inflight_keys key:key checkKeys:check_keys];
1452 if (result) return result;
1453 }
1454
1455 NSArray *docking_keys = [NSArray arrayWithObjects:
1456 @"key_docking_music", @"key_autopilot", @"key_pausebutton", nil];
1457
1458 if ([docking_keys containsObject:key])
1459 {
1460 result = [self searchArrayForMatch:docking_keys key:key checkKeys:check_keys];
1461 if (result) return result;
1462 }
1463
1464 NSArray *docked_keys = [
1465 [NSArray arrayWithObjects:@"key_launch_ship", @"key_gui_screen_options", @"key_gui_screen_equipship", @"key_gui_screen_interfaces", @"key_gui_screen_status",
1466 @"key_gui_chart_screens", @"key_gui_system_data", @"key_gui_market", nil]
1467 arrayByAddingObjectsFromArray:gui_keys];
1468
1469 if ([docked_keys containsObject:key])
1470 {
1471 result = [self searchArrayForMatch:docked_keys key:key checkKeys:check_keys];
1472 if (result) return result;
1473 }
1474
1475 NSArray *paused_keys = [[
1476 [NSArray arrayWithObjects:@"key_pausebutton", @"key_gui_screen_options", @"key_hud_toggle", @"key_show_fps", @"key_mouse_control_roll",
1477 @"key_mouse_control_yaw", nil]
1478 arrayByAddingObjectsFromArray:debug_keys]
1479 arrayByAddingObjectsFromArray:customview_keys];
1480
1481 if ([paused_keys containsObject:key])
1482 {
1483 result = [self searchArrayForMatch:paused_keys key:key checkKeys:check_keys];
1484 if (result) return result;
1485 }
1486
1487 NSArray *chart_keys = [NSArray arrayWithObjects:
1488 @"key_advanced_nav_array_next", @"key_advanced_nav_array_previous", @"key_map_home", @"key_map_end", @"key_map_info",
1489 @"key_map_zoom_in", @"key_map_zoom_out", @"key_map_next_system", @"key_map_previous_system", @"key_chart_highlight",
1490 @"key_launch_ship", @"key_gui_screen_options", @"key_gui_screen_equipship", @"key_gui_screen_interfaces", @"key_gui_screen_status",
1491 @"key_gui_chart_screens", @"key_gui_system_data", @"key_gui_market", nil];
1492
1493 if ([chart_keys containsObject:key])
1494 {
1495 result = [self searchArrayForMatch:chart_keys key:key checkKeys:check_keys];
1496 if (result) return result;
1497 }
1498
1499 NSArray *sysinfo_keys = [NSArray arrayWithObjects:
1500 @"key_system_home", @"key_system_end", @"key_system_next_system", @"key_system_previous_system",
1501 @"key_launch_ship", @"key_gui_screen_options", @"key_gui_screen_equipship", @"key_gui_screen_interfaces", @"key_gui_screen_status",
1502 @"key_gui_chart_screens", @"key_gui_system_data", @"key_gui_market", nil];
1503
1504 if ([sysinfo_keys containsObject:key])
1505 {
1506 result = [self searchArrayForMatch:sysinfo_keys key:key checkKeys:check_keys];
1507 if (result) return result;
1508 }
1509
1510 NSArray *market_keys = [NSArray arrayWithObjects:
1511 @"key_market_filter_cycle", @"key_market_sorter_cycle", @"key_market_buy_one", @"key_market_sell_one", @"key_market_buy_max",
1512 @"key_market_sell_max", @"key_launch_ship", @"key_gui_screen_options", @"key_gui_screen_equipship", @"key_gui_screen_interfaces", @"key_gui_screen_status",
1513 @"key_gui_chart_screens", @"key_gui_system_data", @"key_gui_market", @"key_gui_arrow_up", @"key_gui_arrow_down", @"key_gui_page_up",
1514 @"key_gui_page_down", @"key_gui_select", nil];
1515
1516 if ([market_keys containsObject:key])
1517 {
1518 result = [self searchArrayForMatch:market_keys key:key checkKeys:check_keys];
1519 if (result) return result;
1520 }
1521
1522 // if we get here, we should be good
1523 return nil;
1524}

◆ validForAddToUniverse

- (BOOL) validForAddToUniverse
implementation

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

2498{
2499 return YES;
2500}

◆ viewpointOffset

- (Vector) viewpointOffset

Definition at line 13735 of file PlayerEntity.m.

4366{
4367// if ([UNIVERSE breakPatternHide])
4368// return kZeroVector; // center view for break pattern
4369 // now done by positioning break pattern correctly
4370
4371 switch ([UNIVERSE viewDirection])
4372 {
4373 case VIEW_FORWARD:
4374 return forwardViewOffset;
4375 case VIEW_AFT:
4376 return aftViewOffset;
4377 case VIEW_PORT:
4378 return portViewOffset;
4379 case VIEW_STARBOARD:
4380 return starboardViewOffset;
4381 /* GILES custom viewpoints */
4382 case VIEW_CUSTOM:
4383 return customViewOffset;
4384 /* -- */
4385
4386 default:
4387 break;
4388 }
4389
4390 return kZeroVector;
4391}

◆ viewpointOffsetAft

- (Vector) viewpointOffsetAft

Definition at line 13735 of file PlayerEntity.m.

4395{
4396 return aftViewOffset;
4397}

◆ viewpointOffsetForward

- (Vector) viewpointOffsetForward

Definition at line 13735 of file PlayerEntity.m.

4400{
4401 return forwardViewOffset;
4402}

◆ viewpointOffsetPort

- (Vector) viewpointOffsetPort

Definition at line 13735 of file PlayerEntity.m.

4405{
4406 return portViewOffset;
4407}

◆ viewpointOffsetStarboard

- (Vector) viewpointOffsetStarboard

Definition at line 13735 of file PlayerEntity.m.

4410{
4411 return starboardViewOffset;
4412}

◆ viewpointPosition

- (HPVector) viewpointPosition

Definition at line 13735 of file PlayerEntity.m.

4418{
4419 HPVector viewpoint = position;
4420 if (showDemoShips)
4421 {
4422 viewpoint = kZeroHPVector;
4423 }
4424 Vector offset = [self viewpointOffset];
4425
4426 // FIXME: this ought to be done with matrix or quaternion functions.
4427 OOMatrix r = rotMatrix;
4428
4429 viewpoint.x += offset.x * r.m[0][0]; viewpoint.y += offset.x * r.m[1][0]; viewpoint.z += offset.x * r.m[2][0];
4430 viewpoint.x += offset.y * r.m[0][1]; viewpoint.y += offset.y * r.m[1][1]; viewpoint.z += offset.y * r.m[2][1];
4431 viewpoint.x += offset.z * r.m[0][2]; viewpoint.y += offset.z * r.m[1][2]; viewpoint.z += offset.z * r.m[2][2];
4432
4433 return viewpoint;
4434}

◆ warnAboutHostiles

- (void) warnAboutHostiles

Reimplemented from Entity.

Definition at line 13735 of file PlayerEntity.m.

2469{
2470 [self playHostileWarning];
2471}

◆ weaponForFacing:

- (OOWeaponType) weaponForFacing: (OOWeaponFacing) facing

Definition at line 13735 of file PlayerEntity.m.

6274 :(OOWeaponFacing)facing
6275{
6276 switch (facing)
6277 {
6279 return forward_weapon_type;
6280
6281 case WEAPON_FACING_AFT:
6282 return aft_weapon_type;
6283
6284 case WEAPON_FACING_PORT:
6285 return port_weapon_type;
6286
6288 return starboard_weapon_type;
6289
6290 case WEAPON_FACING_NONE:
6291 break;
6292 }
6293 return nil;
6294}

◆ weaponsOnline

- (BOOL) weaponsOnline

Definition at line 13735 of file PlayerEntity.m.

6167{
6168 return weapons_online;
6169}

◆ weaponTypeForFacing:strict:

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

Reimplemented from ShipEntity.

Definition at line 13735 of file PlayerEntity.m.

8309 :(OOWeaponFacing)facing strict:(BOOL)strict
8310{
8311 OOWeaponType weaponType = nil;
8312
8313 switch (facing)
8314 {
8316 weaponType = forward_weapon_type;
8317 break;
8318
8319 case WEAPON_FACING_AFT:
8320 weaponType = aft_weapon_type;
8321 break;
8322
8323 case WEAPON_FACING_PORT:
8324 weaponType = port_weapon_type;
8325 break;
8326
8328 weaponType = starboard_weapon_type;
8329 break;
8330
8331 case WEAPON_FACING_NONE:
8332 break;
8333 }
8334
8335 return weaponType;
8336}

Referenced by PlayerShipGetProperty().

+ Here is the caller graph for this function:

◆ weaponViewOffset

- (Vector) weaponViewOffset

Definition at line 9247 of file PlayerEntity.m.

11973{
11974 switch (currentWeaponFacing)
11975 {
11977 return forwardViewOffset;
11978 case WEAPON_FACING_AFT:
11979 return aftViewOffset;
11980 case WEAPON_FACING_PORT:
11981 return portViewOffset;
11983 return starboardViewOffset;
11984
11985 case WEAPON_FACING_NONE:
11986 // N.b.: this case should never happen.
11987 return customViewOffset;
11988 }
11989 return kZeroVector;
11990}

◆ witchEnd

- (void) witchEnd
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

7391{
7392 [UNIVERSE setSystemTo:system_id];
7393 galaxy_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:system_id inGalaxy:galaxy_number];
7394
7395 [UNIVERSE setUpUniverseFromWitchspace];
7396 [[UNIVERSE planet] update: 2.34375 * market_rnd]; // from 0..10 minutes
7397 [[UNIVERSE station] update: 2.34375 * market_rnd]; // from 0..10 minutes
7398
7401}

◆ witchJumpChecklist:

- (BOOL) witchJumpChecklist: (BOOL) isGalacticJump

Definition at line 13735 of file PlayerEntity.m.

7404 :(BOOL)isGalacticJump
7405{
7406 // Perform this check only when doing the actual jump
7407 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7408 {
7409 // check nearby masses
7410 //UPDATE_STAGE(@"checking for mass blockage");
7411 ShipEntity* blocker = [UNIVERSE entityForUniversalID:[self checkShipsInVicinityForWitchJumpExit]];
7412 if (blocker)
7413 {
7414 [UNIVERSE clearPreviousMessage];
7415 NSString *blockerName = [blocker name];
7416 [UNIVERSE addMessage:OOExpandKey(@"witch-blocked", blockerName) forCount:4.5];
7417 [self playWitchjumpBlocked];
7418 [self setStatus:STATUS_IN_FLIGHT];
7419 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("blocked"));
7420 return NO;
7421 }
7422 }
7423
7424 // For galactic hyperspace jumps we skip the remaining checks
7425 if (isGalacticJump)
7426 {
7427 return YES;
7428 }
7429
7430 // Check we're not jumping into the current system
7431 if (![UNIVERSE inInterstellarSpace] && system_id == target_system_id)
7432 {
7433 //dont allow player to hyperspace to current location.
7434 //Note interstellar space will have a system_seed place we came from
7435 [UNIVERSE clearPreviousMessage];
7436 [UNIVERSE addMessage:OOExpandKey(@"witch-no-target") forCount: 4.5];
7437 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7438 {
7439 [self playWitchjumpInsufficientFuel];
7440 [self setStatus:STATUS_IN_FLIGHT];
7441 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("no target"));
7442 }
7443 else [self playHyperspaceNoTarget];
7444
7445 return NO;
7446 }
7447
7448 // check max distance permitted
7450 {
7451 [UNIVERSE clearPreviousMessage];
7452 [UNIVERSE addMessage:DESC(@"witch-too-far") forCount: 4.5];
7453 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7454 {
7455 [self playWitchjumpDistanceTooGreat];
7456 [self setStatus:STATUS_IN_FLIGHT];
7457 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("too far"));
7458 }
7459 else [self playHyperspaceDistanceTooGreat];
7460
7461 return NO;
7462 }
7463
7464 // check fuel level
7465 if (![self hasSufficientFuelForJump])
7466 {
7467 [UNIVERSE clearPreviousMessage];
7468 [UNIVERSE addMessage:DESC(@"witch-no-fuel") forCount: 4.5];
7469 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN)
7470 {
7471 [self playWitchjumpInsufficientFuel];
7472 [self setStatus:STATUS_IN_FLIGHT];
7473 ShipScriptEventNoCx(self, "playerJumpFailed", OOJSSTR("insufficient fuel"));
7474 }
7475 else [self playHyperspaceNoFuel];
7476
7477 return NO;
7478 }
7479
7480 // All checks passed
7481 return YES;
7482}
BOOL hasSufficientFuelForJump()
double maxHyperspaceDistance()

◆ witchJumpTo:misjump:

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

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

7772 :(OOSystemID)sTo misjump:(BOOL)misjump
7773{
7774 [self witchStart];
7776 {
7777 [self setInfoSystemID: sTo moveChart: YES];
7778 }
7779 //wear and tear on all jumps (inc misjumps, failures, and wormholes)
7781 {
7782 // every eight jumps or so drop the price down towards 75%
7783 [self adjustTradeInFactorBy:-(1 + (market_rnd & 3))];
7784 }
7785
7786 // set clock after "playerWillEnterWitchspace" and before removeAllEntitiesExceptPlayer, to allow escorts time to follow their mother.
7787 NSPoint destCoords = PointFromString([[UNIVERSE systemManager] getProperty:@"coordinates" forSystem:sTo inGalaxy:galaxy_number]);
7788 double distance = distanceBetweenPlanetPositions(destCoords.x,destCoords.y,galaxy_coordinates.x,galaxy_coordinates.y);
7789
7790 // if we just escaped a system gone nova, make sure all nova parameters are reset
7791 OOSunEntity *theSun = [UNIVERSE sun];
7792 if (theSun && [theSun goneNova])
7793 {
7794 [theSun resetNova];
7795 }
7796
7797 [UNIVERSE removeAllEntitiesExceptPlayer];
7798 if (!misjump)
7799 {
7800 ship_clock_adjust += distance * distance * 3600.0;
7801 [self setSystemID:sTo];
7802 [self setBounty:(legalStatus/2) withReason:kOOLegalStatusReasonNewSystem]; // 'another day, another system'
7803 [self witchEnd];
7804 if (market_rnd < 8) [self erodeReputation]; // every 32 systems or so, drop back towards 'unknown'
7805 }
7806 else
7807 {
7808 // Misjump: move halfway there!
7809 // misjumps do not change legal status.
7810 if (randf() < 0.1) [self erodeReputation]; // once every 10 misjumps - should be much rarer than successful jumps!
7811
7812 [wormhole setMisjump];
7813 // just in case, but this has usually been set already
7814
7815 // and now the wormhole has travel time and coordinates calculated
7816 // so rather than duplicate the calculation we'll just ask it...
7817 NSPoint dest = [wormhole destinationCoordinates];
7818 galaxy_coordinates.x = dest.x;
7819 galaxy_coordinates.y = dest.y;
7820
7821 ship_clock_adjust += [wormhole travelTime];
7822
7823 [self playWitchjumpMisjump];
7824 [UNIVERSE setUpUniverseFromMisjump];
7825 }
7826}

◆ witchStart

- (void) witchStart
implementation

Provided by category PlayerEntity(OOPrivate).

Definition at line 13735 of file PlayerEntity.m.

7346{
7347 // chances of entering witchspace with autopilot on are very low, but as Berlios bug #18307 has shown us, entirely possible
7348 // so in such cases we need to ensure that at least the docking music stops playing
7349 if (autopilot_engaged) [self disengageAutopilot];
7350
7351 if (![hud nonlinearScanner])
7352 {
7353 [hud setScannerZoom: 1.0];
7354 }
7355 [self safeAllMissiles];
7356
7357 OOViewID previousViewDirection = [UNIVERSE viewDirection];
7358 [UNIVERSE setViewDirection:VIEW_FORWARD];
7359 [self noteSwitchToView:VIEW_FORWARD fromView:previousViewDirection]; // notifies scripts of the switch
7360
7362 [self currentWeaponStats];
7363
7364 [self transitionToAegisNone];
7366 hyperspeed_engaged = NO;
7367
7368 if ([self primaryTarget] != nil)
7369 {
7370 [self noteLostTarget]; // losing target? Fire lost target event!
7372 }
7373
7374 scanner_zoom_rate = 0.0f;
7375 [UNIVERSE setDisplayText:NO];
7376
7377 if ( ![self wormhole] && !galactic_witchjump) // galactic hyperspace does not generate a wormhole
7378 {
7379 OOLog(kOOLogInconsistentState, @"%@", @"Internal Error : Player entering witchspace with no wormhole.");
7380 }
7381 [UNIVERSE allShipsDoScriptEvent:OOJSID("playerWillEnterWitchspace") andReactToAIMessage:@"PLAYER WITCHSPACE"];
7382
7383 // set the new market seed now!
7384 // reseeding the RNG should be completely unnecessary here
7385// ranrot_srand((uint32_t)[[NSDate date] timeIntervalSince1970]); // seed randomiser by time
7386 market_rnd = ranrot_rand() & 255; // random factor for market values is reset
7387}

◆ worldScriptNames

- (NSArray *) worldScriptNames

Definition at line 9247 of file PlayerEntity.m.

12885{
12886 return [worldScripts allKeys];
12887}

◆ worldScriptsByName

- (NSDictionary *) worldScriptsByName

Definition at line 9247 of file PlayerEntity.m.

12891{
12892 return [[worldScripts copy] autorelease];
12893}

Referenced by WorldScriptsGetProperty().

+ Here is the caller graph for this function:

◆ wormhole

- (WormholeEntity *) wormhole

◆ writePlayerToPath:

- (void) writePlayerToPath: (NSString *) path
implementation

Provided by category PlayerEntity(OOLoadSavePrivate).

Definition at line 1412 of file PlayerEntityLoadSave.m.

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

Member Data Documentation

◆ _commanderName

- (NSString*) _commanderName
private

Definition at line 517 of file PlayerEntity.h.

◆ _customViewIndex

- (NSUInteger) _customViewIndex
private

Definition at line 801 of file PlayerEntity.h.

◆ _customViews

- (NSArray*) _customViews
private

Definition at line 800 of file PlayerEntity.h.

◆ _dockedStation

- (OOWeakReference*) _dockedStation
private

Definition at line 460 of file PlayerEntity.h.

◆ _dockTarget

- (OOUniversalID) _dockTarget
private

Definition at line 527 of file PlayerEntity.h.

◆ _equipScreenBackgroundDescriptor

- (NSDictionary*) _equipScreenBackgroundDescriptor
private

Definition at line 403 of file PlayerEntity.h.

◆ _fastEquipmentA

- (NSString*) _fastEquipmentA
private

Definition at line 493 of file PlayerEntity.h.

◆ _fastEquipmentB

- (NSString*) _fastEquipmentB
private

Definition at line 494 of file PlayerEntity.h.

◆ _jumpCause

- (NSString*) _jumpCause
private

Definition at line 514 of file PlayerEntity.h.

◆ _lastsaveName

- (NSString*) _lastsaveName
private

Definition at line 518 of file PlayerEntity.h.

◆ _missionAllowInterrupt

- (BOOL) _missionAllowInterrupt
private

Definition at line 390 of file PlayerEntity.h.

◆ _missionBackgroundDescriptor

- (NSDictionary*) _missionBackgroundDescriptor
private

Definition at line 401 of file PlayerEntity.h.

◆ _missionBackgroundSpecial

- (OOGUIBackgroundSpecial) _missionBackgroundSpecial
private

Definition at line 402 of file PlayerEntity.h.

◆ _missionExitScreen

- (OOGUIScreenID) _missionExitScreen
private

Definition at line 392 of file PlayerEntity.h.

◆ _missionOverlayDescriptor

- (NSDictionary*) _missionOverlayDescriptor
private

Definition at line 400 of file PlayerEntity.h.

◆ _missionScreenID

- (NSString*) _missionScreenID
private

Definition at line 404 of file PlayerEntity.h.

◆ _missionTextEntry

- (BOOL) _missionTextEntry
private

Definition at line 391 of file PlayerEntity.h.

◆ _missionTitle

- (NSString*) _missionTitle
private

Definition at line 385 of file PlayerEntity.h.

◆ _missionWithCallback

- (BOOL) _missionWithCallback
private

Definition at line 389 of file PlayerEntity.h.

◆ _sysInfoLight

- (Vector) _sysInfoLight
private

Definition at line 711 of file PlayerEntity.h.

◆ _trumbleAppetiteAccumulator

- (float) _trumbleAppetiteAccumulator
private

Definition at line 716 of file PlayerEntity.h.

◆ activeMFD

- (NSUInteger) activeMFD
private

Definition at line 470 of file PlayerEntity.h.

◆ activeMissile

- (NSUInteger) activeMissile
private

Definition at line 491 of file PlayerEntity.h.

◆ aft_shield

- (GLfloat) aft_shield
private

Definition at line 476 of file PlayerEntity.h.

◆ aft_shield_recharge_rate

- (GLfloat) aft_shield_recharge_rate
private

Definition at line 477 of file PlayerEntity.h.

◆ aft_shot_time

- (OOTimeDelta) aft_shot_time
private

Definition at line 478 of file PlayerEntity.h.

◆ afterburner_engaged

- (unsigned) afterburner_engaged
private

Definition at line 746 of file PlayerEntity.h.

◆ afterburnerSoundLooping

- (unsigned) afterburnerSoundLooping
private

Definition at line 747 of file PlayerEntity.h.

◆ aftViewOffset

- (Vector) aftViewOffset
private

Definition at line 710 of file PlayerEntity.h.

◆ alertCondition

- (OOAlertCondition) alertCondition
private

Definition at line 487 of file PlayerEntity.h.

◆ alertFlags

- (int) alertFlags
private

Definition at line 486 of file PlayerEntity.h.

◆ ANA_mode

- (OORouteType) ANA_mode
private

Definition at line 511 of file PlayerEntity.h.

◆ autopilot_engaged

- (unsigned) autopilot_engaged
private

Definition at line 744 of file PlayerEntity.h.

◆ bomb_detonated

- (unsigned) bomb_detonated
private

Definition at line 743 of file PlayerEntity.h.

◆ cdrDetailArray

- (NSMutableArray*) cdrDetailArray
private

Definition at line 450 of file PlayerEntity.h.

◆ chart_centre_coordinates

- (NSPoint) chart_centre_coordinates
private

Definition at line 500 of file PlayerEntity.h.

◆ chart_focus_coordinates

- (NSPoint) chart_focus_coordinates
private

Definition at line 499 of file PlayerEntity.h.

◆ chart_zoom

- (OOScalar) chart_zoom
private

Definition at line 507 of file PlayerEntity.h.

◆ chosen_weapon_facing

- (OOWeaponFacing) chosen_weapon_facing
private

Definition at line 480 of file PlayerEntity.h.

◆ commanderNameString

- (NSString*) commanderNameString
private

Definition at line 449 of file PlayerEntity.h.

◆ commLog

- (NSMutableArray *) commLog
private

Definition at line 396 of file PlayerEntity.h.

◆ commodityScripts

- (NSMutableDictionary*) commodityScripts
private

Definition at line 382 of file PlayerEntity.h.

◆ compassMode

- (OOCompassMode) compassMode
private

Definition at line 533 of file PlayerEntity.h.

Referenced by PlayerShipGetProperty().

◆ compassTarget

- (Entity *) compassTarget
private

Definition at line 534 of file PlayerEntity.h.

Referenced by PlayerShipGetProperty(), and PlayerShipSetProperty().

◆ contract_record

- (NSMutableDictionary*) contract_record
private

Definition at line 418 of file PlayerEntity.h.

◆ contracts

- (NSMutableArray*) contracts
private

Definition at line 417 of file PlayerEntity.h.

◆ credits

- (OOCreditsQuantity) credits
private

Definition at line 521 of file PlayerEntity.h.

◆ current_cargo

- (OOCargoQuantity) current_cargo
private

Definition at line 496 of file PlayerEntity.h.

◆ currentPage

- (int) currentPage
private

Definition at line 451 of file PlayerEntity.h.

◆ cursor_coordinates

- (NSPoint) cursor_coordinates
private

Definition at line 498 of file PlayerEntity.h.

◆ custom_chart_centre_coordinates

- (NSPoint) custom_chart_centre_coordinates
private

Definition at line 501 of file PlayerEntity.h.

◆ custom_chart_zoom

- (OOScalar) custom_chart_zoom
private

Definition at line 508 of file PlayerEntity.h.

◆ customActivatePressed

- (NSMutableArray*) customActivatePressed
private

Definition at line 697 of file PlayerEntity.h.

◆ customDialSettings

- (NSMutableDictionary*) customDialSettings
private

Definition at line 471 of file PlayerEntity.h.

◆ customEquipActivation

- (NSMutableArray*) customEquipActivation
private

Definition at line 696 of file PlayerEntity.h.

◆ customModePressed

- (NSMutableArray*) customModePressed
private

Definition at line 698 of file PlayerEntity.h.

◆ customViewDescription

- (NSString *) customViewDescription
private

Definition at line 730 of file PlayerEntity.h.

◆ customViewForwardVector

- (Vector) customViewForwardVector
private

Definition at line 729 of file PlayerEntity.h.

Referenced by HeadUpDisplay::hudRotateViewpointForVirtualDepth.

◆ customViewMatrix

- (OOMatrix) customViewMatrix
private

Definition at line 728 of file PlayerEntity.h.

◆ customViewOffset

- (Vector) customViewOffset
private

Definition at line 729 of file PlayerEntity.h.

◆ customViewQuaternion

- (Quaternion) customViewQuaternion
private

Definition at line 727 of file PlayerEntity.h.

◆ customViewRightVector

- (Vector) customViewRightVector
private

Definition at line 729 of file PlayerEntity.h.

◆ customViewRotationCenter

- (Vector) customViewRotationCenter
private

Definition at line 729 of file PlayerEntity.h.

◆ customViewUpVector

- (Vector) customViewUpVector
private

Definition at line 729 of file PlayerEntity.h.

Referenced by HeadUpDisplay::hudRotateViewpointForVirtualDepth.

◆ demoShip

- (ShipEntity*) demoShip
private

Definition at line 808 of file PlayerEntity.h.

◆ dockingClearanceStatus

- (OODockingClearanceStatus) dockingClearanceStatus
private

Definition at line 803 of file PlayerEntity.h.

◆ dockingReport

- (NSMutableString*) dockingReport
private

Definition at line 734 of file PlayerEntity.h.

◆ ecm_in_operation

- (unsigned) ecm_in_operation
private

Definition at line 757 of file PlayerEntity.h.

◆ ecm_start_time

- (double) ecm_start_time
private

Definition at line 482 of file PlayerEntity.h.

◆ eqScripts

- (NSMutableArray*) eqScripts
private

Definition at line 398 of file PlayerEntity.h.

◆ escape_pod_rescue_time

- (double) escape_pod_rescue_time
private

Definition at line 436 of file PlayerEntity.h.

◆ extraGuiScreenKeys

- (NSMutableDictionary*) extraGuiScreenKeys
private

Definition at line 703 of file PlayerEntity.h.

◆ extraMissionKeys

- (NSDictionary*) extraMissionKeys
private

Definition at line 701 of file PlayerEntity.h.

◆ fieldOfView

- (double) fieldOfView
private

Definition at line 814 of file PlayerEntity.h.

◆ finished

- (unsigned) finished
private

Definition at line 742 of file PlayerEntity.h.

◆ fleeing_status

- (OOPlayerFleeingStatus) fleeing_status
private

Definition at line 489 of file PlayerEntity.h.

◆ forward_shield

- (GLfloat) forward_shield
private

Definition at line 476 of file PlayerEntity.h.

◆ forward_shield_recharge_rate

- (GLfloat) forward_shield_recharge_rate
private

Definition at line 477 of file PlayerEntity.h.

◆ forward_shot_time

- (OOTimeDelta) forward_shot_time
private

Definition at line 478 of file PlayerEntity.h.

◆ forwardViewOffset

- (Vector) forwardViewOffset
private

Definition at line 710 of file PlayerEntity.h.

◆ found_equipment

- (BOOL) found_equipment
private

Definition at line 406 of file PlayerEntity.h.

◆ found_system_id

- (OOSystemID) found_system_id
private

Definition at line 377 of file PlayerEntity.h.

◆ fps_check_time

- (double) fps_check_time
private

Definition at line 438 of file PlayerEntity.h.

◆ fps_counter

- (int) fps_counter
private

Definition at line 439 of file PlayerEntity.h.

◆ fuel_leak_rate

- (GLfloat) fuel_leak_rate
private

Definition at line 536 of file PlayerEntity.h.

◆ galactic_witchjump

- (unsigned) galactic_witchjump
private

Definition at line 755 of file PlayerEntity.h.

◆ galacticHyperspaceBehaviour

- (OOGalacticHyperspaceBehaviour) galacticHyperspaceBehaviour
private

Definition at line 795 of file PlayerEntity.h.

◆ galacticHyperspaceFixedCoords

- (NSPoint) galacticHyperspaceFixedCoords
private

Definition at line 796 of file PlayerEntity.h.

◆ galaxy_coordinates

- (NSPoint) galaxy_coordinates
private

Definition at line 519 of file PlayerEntity.h.

Referenced by MissionRunScreen().

◆ galaxy_number

- (OOGalaxyID) galaxy_number
private

Provided by category PlayerEntity(Scripting).

Definition at line 522 of file PlayerEntity.h.

◆ game_over

- (unsigned) game_over
private

Definition at line 741 of file PlayerEntity.h.

◆ gui_screen

- (OOGUIScreenID) gui_screen
private

Definition at line 485 of file PlayerEntity.h.

◆ hud

◆ hyperspeed_engaged

- (unsigned) hyperspeed_engaged
private

Definition at line 749 of file PlayerEntity.h.

◆ hyperspeed_locked

- (unsigned) hyperspeed_locked
private

Definition at line 751 of file PlayerEntity.h.

◆ hyperspeedFactor

- (GLfloat) hyperspeedFactor
private

Definition at line 539 of file PlayerEntity.h.

◆ ident_engaged

- (unsigned) ident_engaged
private

Definition at line 753 of file PlayerEntity.h.

◆ info_system_id

- (OOSystemID) info_system_id
private

Definition at line 372 of file PlayerEntity.h.

◆ isSpeechOn

- (OOSpeechSettings) isSpeechOn
private

Definition at line 783 of file PlayerEntity.h.

◆ kbdLayouts

- (NSArray*) kbdLayouts
private

Definition at line 790 of file PlayerEntity.h.

◆ keyboardPitchOverride

- (unsigned) keyboardPitchOverride
private

Definition at line 769 of file PlayerEntity.h.

◆ keyboardRollOverride

- (unsigned) keyboardRollOverride
private

Definition at line 768 of file PlayerEntity.h.

◆ keyboardYawOverride

- (unsigned) keyboardYawOverride
private

Definition at line 770 of file PlayerEntity.h.

◆ keyCodeLookups

- (NSDictionary*) keyCodeLookups
private

Definition at line 544 of file PlayerEntity.h.

◆ keyconfig2_settings

- (NSDictionary*) keyconfig2_settings
private

Definition at line 543 of file PlayerEntity.h.

◆ keyFunctions

- (NSArray*) keyFunctions
private

Definition at line 789 of file PlayerEntity.h.

◆ keyMod1Text

- (NSString*) keyMod1Text
private

Definition at line 792 of file PlayerEntity.h.

◆ keyMod2Text

- (NSString*) keyMod2Text
private

Definition at line 793 of file PlayerEntity.h.

◆ keyShiftText

- (NSString*) keyShiftText
private

Definition at line 791 of file PlayerEntity.h.

◆ last_ecm_time

- (double) last_ecm_time
private

Definition at line 483 of file PlayerEntity.h.

◆ last_fps_check_time

- (double) last_fps_check_time
private

Definition at line 440 of file PlayerEntity.h.

◆ lastScriptAlertCondition

- (OOAlertCondition) lastScriptAlertCondition
private

Definition at line 488 of file PlayerEntity.h.

◆ lastShot

- (NSArray*) lastShot
private

Definition at line 809 of file PlayerEntity.h.

◆ lastTextKey

- (NSString*) lastTextKey
private

Definition at line 431 of file PlayerEntity.h.

◆ launchingMissile

- (unsigned) launchingMissile
private

Definition at line 775 of file PlayerEntity.h.

◆ launchRoll

- (GLfloat) launchRoll
private

Definition at line 474 of file PlayerEntity.h.

◆ legalStatus

- (int) legalStatus
private

Definition at line 529 of file PlayerEntity.h.

◆ localVariables

- (NSMutableDictionary*) localVariables
private

Definition at line 384 of file PlayerEntity.h.

◆ longRangeChartMode

- (OOLongRangeChartMode) longRangeChartMode
private

Definition at line 798 of file PlayerEntity.h.

Referenced by PlayerShipSetProperty().

◆ market_rnd

- (int) market_rnd
private

Definition at line 530 of file PlayerEntity.h.

◆ marketFilterMode

- (OOMarketFilterMode) marketFilterMode
private

Definition at line 457 of file PlayerEntity.h.

◆ marketOffset

- (NSInteger) marketOffset
private

Definition at line 455 of file PlayerEntity.h.

◆ marketSelectedCommodity

- (OOCommodityType) marketSelectedCommodity
private

Definition at line 456 of file PlayerEntity.h.

◆ marketSorterMode

- (OOMarketSorterMode) marketSorterMode
private

Definition at line 458 of file PlayerEntity.h.

◆ massLockable

- (BOOL) massLockable
private

Definition at line 778 of file PlayerEntity.h.

◆ max_aft_shield

- (GLfloat) max_aft_shield
private

Definition at line 477 of file PlayerEntity.h.

◆ max_forward_shield

- (GLfloat) max_forward_shield
private

Definition at line 477 of file PlayerEntity.h.

◆ max_passengers

- (unsigned) max_passengers
private

Definition at line 410 of file PlayerEntity.h.

◆ maxFieldOfView

- (double) maxFieldOfView
private

Definition at line 813 of file PlayerEntity.h.

◆ missile_entity

- (ShipEntity* missile_entity[PLAYER_MAX_MISSILES])
private

Definition at line 526 of file PlayerEntity.h.

◆ missile_status

- (OOMissileStatus) missile_status
private

Definition at line 490 of file PlayerEntity.h.

◆ mission_variables

- (NSMutableDictionary*) mission_variables
private

Definition at line 383 of file PlayerEntity.h.

◆ missionChoice

- (NSString*) missionChoice
private

Definition at line 387 of file PlayerEntity.h.

◆ missionDestinations

- (NSMutableDictionary*) missionDestinations
private

Definition at line 422 of file PlayerEntity.h.

◆ missionKeyPress

- (NSString*) missionKeyPress
private

Definition at line 388 of file PlayerEntity.h.

◆ missionTextRow

- (NSInteger) missionTextRow
private

Definition at line 386 of file PlayerEntity.h.

◆ mouse_control_on

- (unsigned) mouse_control_on
private

Definition at line 766 of file PlayerEntity.h.

◆ multiFunctionDisplaySettings

- (NSMutableArray*) multiFunctionDisplaySettings
private

Definition at line 469 of file PlayerEntity.h.

◆ multiFunctionDisplayText

- (NSMutableDictionary*) multiFunctionDisplayText
private

Definition at line 468 of file PlayerEntity.h.

◆ n_key_activate_equipment

- (NSArray*) n_key_activate_equipment
private

Definition at line 586 of file PlayerEntity.h.

◆ n_key_advanced_nav_array_next

- (NSArray*) n_key_advanced_nav_array_next
private

Definition at line 614 of file PlayerEntity.h.

◆ n_key_advanced_nav_array_previous

- (NSArray*) n_key_advanced_nav_array_previous
private

Definition at line 615 of file PlayerEntity.h.

◆ n_key_autodock

- (NSArray*) n_key_autodock
private

Definition at line 609 of file PlayerEntity.h.

◆ n_key_autopilot

- (NSArray*) n_key_autopilot
private

Definition at line 608 of file PlayerEntity.h.

◆ n_key_bloom_toggle

- (NSArray*) n_key_bloom_toggle
private

Definition at line 633 of file PlayerEntity.h.

◆ n_key_chart_highlight

- (NSArray*) n_key_chart_highlight
private

Definition at line 642 of file PlayerEntity.h.

◆ n_key_comms_log

- (NSArray*) n_key_comms_log
private

Definition at line 638 of file PlayerEntity.h.

◆ n_key_custom_view

- (NSArray*) n_key_custom_view
private

Definition at line 653 of file PlayerEntity.h.

◆ n_key_custom_view_pan_down

- (NSArray*) n_key_custom_view_pan_down
private

Definition at line 663 of file PlayerEntity.h.

◆ n_key_custom_view_pan_left

- (NSArray*) n_key_custom_view_pan_left
private

Definition at line 657 of file PlayerEntity.h.

◆ n_key_custom_view_pan_right

- (NSArray*) n_key_custom_view_pan_right
private

Definition at line 659 of file PlayerEntity.h.

◆ n_key_custom_view_pan_up

- (NSArray*) n_key_custom_view_pan_up
private

Definition at line 661 of file PlayerEntity.h.

◆ n_key_custom_view_roll_left

- (NSArray*) n_key_custom_view_roll_left
private

Definition at line 656 of file PlayerEntity.h.

◆ n_key_custom_view_roll_right

- (NSArray*) n_key_custom_view_roll_right
private

Definition at line 658 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_down

- (NSArray*) n_key_custom_view_rotate_down
private

Definition at line 662 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_left

- (NSArray*) n_key_custom_view_rotate_left
private

Definition at line 664 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_right

- (NSArray*) n_key_custom_view_rotate_right
private

Definition at line 665 of file PlayerEntity.h.

◆ n_key_custom_view_rotate_up

- (NSArray*) n_key_custom_view_rotate_up
private

Definition at line 660 of file PlayerEntity.h.

◆ n_key_custom_view_zoom_in

- (NSArray*) n_key_custom_view_zoom_in
private

Definition at line 655 of file PlayerEntity.h.

◆ n_key_custom_view_zoom_out

- (NSArray*) n_key_custom_view_zoom_out
private

Definition at line 654 of file PlayerEntity.h.

◆ n_key_cycle_next_mfd

- (NSArray*) n_key_cycle_next_mfd
private

Definition at line 670 of file PlayerEntity.h.

◆ n_key_cycle_previous_mfd

- (NSArray*) n_key_cycle_previous_mfd
private

Definition at line 671 of file PlayerEntity.h.

◆ n_key_debug_bounding_boxes

- (NSArray*) n_key_debug_bounding_boxes
private

Definition at line 690 of file PlayerEntity.h.

◆ n_key_debug_collision

- (NSArray*) n_key_debug_collision
private

Definition at line 688 of file PlayerEntity.h.

◆ n_key_debug_console_connect

- (NSArray*) n_key_debug_console_connect
private

Definition at line 689 of file PlayerEntity.h.

◆ n_key_debug_full

- (NSArray*) n_key_debug_full
private

Definition at line 687 of file PlayerEntity.h.

◆ n_key_debug_off

- (NSArray*) n_key_debug_off
private

Definition at line 692 of file PlayerEntity.h.

◆ n_key_debug_shaders

- (NSArray*) n_key_debug_shaders
private

Definition at line 691 of file PlayerEntity.h.

◆ n_key_decrease_speed

- (NSArray*) n_key_decrease_speed
private

Definition at line 576 of file PlayerEntity.h.

◆ n_key_docking_clearance_request

- (NSArray*) n_key_docking_clearance_request
private

Definition at line 667 of file PlayerEntity.h.

◆ n_key_docking_music

- (NSArray*) n_key_docking_music
private

Definition at line 612 of file PlayerEntity.h.

◆ n_key_dump_cargo

- (NSArray*) n_key_dump_cargo
private

Definition at line 605 of file PlayerEntity.h.

◆ n_key_dump_entity_list

- (NSArray*) n_key_dump_entity_list
private

Definition at line 686 of file PlayerEntity.h.

◆ n_key_dump_target_state

- (NSArray*) n_key_dump_target_state
private

Definition at line 685 of file PlayerEntity.h.

◆ n_key_ecm

- (NSArray*) n_key_ecm
private

Definition at line 582 of file PlayerEntity.h.

◆ n_key_fastactivate_equipment_a

- (NSArray*) n_key_fastactivate_equipment_a
private

Definition at line 588 of file PlayerEntity.h.

◆ n_key_fastactivate_equipment_b

- (NSArray*) n_key_fastactivate_equipment_b
private

Definition at line 589 of file PlayerEntity.h.

◆ n_key_fire_lasers

- (NSArray*) n_key_fire_lasers
private

Definition at line 579 of file PlayerEntity.h.

◆ n_key_galactic_hyperspace

- (NSArray*) n_key_galactic_hyperspace
private

Definition at line 601 of file PlayerEntity.h.

◆ n_key_gui_arrow_down

- (NSArray*) n_key_gui_arrow_down
private

Definition at line 570 of file PlayerEntity.h.

◆ n_key_gui_arrow_left

- (NSArray*) n_key_gui_arrow_left
private

Definition at line 567 of file PlayerEntity.h.

◆ n_key_gui_arrow_right

- (NSArray*) n_key_gui_arrow_right
private

Definition at line 568 of file PlayerEntity.h.

◆ n_key_gui_arrow_up

- (NSArray*) n_key_gui_arrow_up
private

Definition at line 569 of file PlayerEntity.h.

◆ n_key_gui_chart_screens

- (NSArray*) n_key_gui_chart_screens
private

Definition at line 563 of file PlayerEntity.h.

◆ n_key_gui_market

- (NSArray*) n_key_gui_market
private

Definition at line 565 of file PlayerEntity.h.

◆ n_key_gui_page_down

- (NSArray*) n_key_gui_page_down
private

Definition at line 572 of file PlayerEntity.h.

◆ n_key_gui_page_up

- (NSArray*) n_key_gui_page_up
private

Definition at line 571 of file PlayerEntity.h.

◆ n_key_gui_screen_equipship

- (NSArray*) n_key_gui_screen_equipship
private

Definition at line 560 of file PlayerEntity.h.

◆ n_key_gui_screen_interfaces

- (NSArray*) n_key_gui_screen_interfaces
private

Definition at line 561 of file PlayerEntity.h.

◆ n_key_gui_screen_options

- (NSArray*) n_key_gui_screen_options
private

Definition at line 559 of file PlayerEntity.h.

◆ n_key_gui_screen_status

- (NSArray*) n_key_gui_screen_status
private

Definition at line 562 of file PlayerEntity.h.

◆ n_key_gui_select

- (NSArray*) n_key_gui_select
private

Definition at line 573 of file PlayerEntity.h.

◆ n_key_gui_system_data

- (NSArray*) n_key_gui_system_data
private

Definition at line 564 of file PlayerEntity.h.

◆ n_key_hud_toggle

- (NSArray*) n_key_hud_toggle
private

Definition at line 636 of file PlayerEntity.h.

◆ n_key_hyperspace

- (NSArray*) n_key_hyperspace
private

Definition at line 602 of file PlayerEntity.h.

◆ n_key_ident_system

- (NSArray*) n_key_ident_system
private

Definition at line 594 of file PlayerEntity.h.

◆ n_key_increase_speed

- (NSArray*) n_key_increase_speed
private

Definition at line 575 of file PlayerEntity.h.

◆ n_key_info_next_system

- (NSArray*) n_key_info_next_system
private

Definition at line 616 of file PlayerEntity.h.

◆ n_key_info_previous_system

- (NSArray*) n_key_info_previous_system
private

Definition at line 617 of file PlayerEntity.h.

◆ n_key_inject_fuel

- (NSArray*) n_key_inject_fuel
private

Definition at line 577 of file PlayerEntity.h.

◆ n_key_jumpdrive

- (NSArray*) n_key_jumpdrive
private

Definition at line 603 of file PlayerEntity.h.

◆ n_key_launch_escapepod

- (NSArray*) n_key_launch_escapepod
private

Definition at line 599 of file PlayerEntity.h.

◆ n_key_launch_missile

- (NSArray*) n_key_launch_missile
private

Definition at line 580 of file PlayerEntity.h.

◆ n_key_launch_ship

- (NSArray*) n_key_launch_ship
private

Definition at line 558 of file PlayerEntity.h.

◆ n_key_map_end

- (NSArray*) n_key_map_end
private

Definition at line 619 of file PlayerEntity.h.

◆ n_key_map_home

- (NSArray*) n_key_map_home
private

Definition at line 618 of file PlayerEntity.h.

◆ n_key_map_info

- (NSArray*) n_key_map_info
private

Definition at line 622 of file PlayerEntity.h.

◆ n_key_map_next_system

- (NSArray*) n_key_map_next_system
private

Definition at line 620 of file PlayerEntity.h.

◆ n_key_map_previous_system

- (NSArray*) n_key_map_previous_system
private

Definition at line 621 of file PlayerEntity.h.

◆ n_key_map_zoom_in

- (NSArray*) n_key_map_zoom_in
private

Definition at line 623 of file PlayerEntity.h.

◆ n_key_map_zoom_out

- (NSArray*) n_key_map_zoom_out
private

Definition at line 624 of file PlayerEntity.h.

◆ n_key_market_buy_max

- (NSArray*) n_key_market_buy_max
private

Definition at line 647 of file PlayerEntity.h.

◆ n_key_market_buy_one

- (NSArray*) n_key_market_buy_one
private

Definition at line 645 of file PlayerEntity.h.

◆ n_key_market_filter_cycle

- (NSArray*) n_key_market_filter_cycle
private

Definition at line 643 of file PlayerEntity.h.

◆ n_key_market_sell_max

- (NSArray*) n_key_market_sell_max
private

Definition at line 648 of file PlayerEntity.h.

◆ n_key_market_sell_one

- (NSArray*) n_key_market_sell_one
private

Definition at line 646 of file PlayerEntity.h.

◆ n_key_market_sorter_cycle

- (NSArray*) n_key_market_sorter_cycle
private

Definition at line 644 of file PlayerEntity.h.

◆ n_key_mode_equipment

- (NSArray*) n_key_mode_equipment
private

Definition at line 587 of file PlayerEntity.h.

◆ n_key_mouse_control_roll

- (NSArray*) n_key_mouse_control_roll
private

Definition at line 634 of file PlayerEntity.h.

◆ n_key_mouse_control_yaw

- (NSArray*) n_key_mouse_control_yaw
private

Definition at line 635 of file PlayerEntity.h.

◆ n_key_next_compass_mode

- (NSArray*) n_key_next_compass_mode
private

Definition at line 640 of file PlayerEntity.h.

◆ n_key_next_missile

- (NSArray*) n_key_next_missile
private

Definition at line 581 of file PlayerEntity.h.

◆ n_key_next_target

- (NSArray*) n_key_next_target
private

Definition at line 650 of file PlayerEntity.h.

◆ n_key_oxzmanager_extract

- (NSArray*) n_key_oxzmanager_extract
private

Definition at line 677 of file PlayerEntity.h.

◆ n_key_oxzmanager_setfilter

- (NSArray*) n_key_oxzmanager_setfilter
private

Definition at line 675 of file PlayerEntity.h.

◆ n_key_oxzmanager_showinfo

- (NSArray*) n_key_oxzmanager_showinfo
private

Definition at line 676 of file PlayerEntity.h.

◆ n_key_pausebutton

- (NSArray*) n_key_pausebutton
private

Definition at line 631 of file PlayerEntity.h.

◆ n_key_pitch_back

- (NSArray*) n_key_pitch_back
private

Definition at line 549 of file PlayerEntity.h.

◆ n_key_pitch_forward

- (NSArray*) n_key_pitch_forward
private

Definition at line 548 of file PlayerEntity.h.

◆ n_key_prev_compass_mode

- (NSArray*) n_key_prev_compass_mode
private

Definition at line 639 of file PlayerEntity.h.

◆ n_key_previous_target

- (NSArray*) n_key_previous_target
private

Definition at line 651 of file PlayerEntity.h.

◆ n_key_prime_next_equipment

- (NSArray*) n_key_prime_next_equipment
private

Definition at line 584 of file PlayerEntity.h.

◆ n_key_prime_previous_equipment

- (NSArray*) n_key_prime_previous_equipment
private

Definition at line 585 of file PlayerEntity.h.

◆ n_key_roll_left

- (NSArray*) n_key_roll_left
private

Definition at line 546 of file PlayerEntity.h.

◆ n_key_roll_right

- (NSArray*) n_key_roll_right
private

Definition at line 547 of file PlayerEntity.h.

◆ n_key_rotate_cargo

- (NSArray*) n_key_rotate_cargo
private

Definition at line 606 of file PlayerEntity.h.

◆ n_key_scanner_unzoom

- (NSArray*) n_key_scanner_unzoom
private

Definition at line 597 of file PlayerEntity.h.

◆ n_key_scanner_zoom

- (NSArray*) n_key_scanner_zoom
private

Definition at line 596 of file PlayerEntity.h.

◆ n_key_show_fps

- (NSArray*) n_key_show_fps
private

Definition at line 632 of file PlayerEntity.h.

◆ n_key_snapshot

- (NSArray*) n_key_snapshot
private

Definition at line 611 of file PlayerEntity.h.

◆ n_key_switch_next_mfd

- (NSArray*) n_key_switch_next_mfd
private

Definition at line 672 of file PlayerEntity.h.

◆ n_key_switch_previous_mfd

- (NSArray*) n_key_switch_previous_mfd
private

Definition at line 673 of file PlayerEntity.h.

◆ n_key_system_end

- (NSArray*) n_key_system_end
private

Definition at line 627 of file PlayerEntity.h.

◆ n_key_system_home

- (NSArray*) n_key_system_home
private

Definition at line 626 of file PlayerEntity.h.

◆ n_key_system_next_system

- (NSArray*) n_key_system_next_system
private

Definition at line 628 of file PlayerEntity.h.

◆ n_key_system_previous_system

- (NSArray*) n_key_system_previous_system
private

Definition at line 629 of file PlayerEntity.h.

◆ n_key_target_incoming_missile

- (NSArray*) n_key_target_incoming_missile
private

Definition at line 593 of file PlayerEntity.h.

◆ n_key_target_missile

- (NSArray*) n_key_target_missile
private

Definition at line 591 of file PlayerEntity.h.

◆ n_key_untarget_missile

- (NSArray*) n_key_untarget_missile
private

Definition at line 592 of file PlayerEntity.h.

◆ n_key_view_aft

- (NSArray*) n_key_view_aft
private

Definition at line 554 of file PlayerEntity.h.

◆ n_key_view_forward

- (NSArray*) n_key_view_forward
private

Definition at line 553 of file PlayerEntity.h.

◆ n_key_view_port

- (NSArray*) n_key_view_port
private

Definition at line 555 of file PlayerEntity.h.

◆ n_key_view_starboard

- (NSArray*) n_key_view_starboard
private

Definition at line 556 of file PlayerEntity.h.

◆ n_key_weapons_online_toggle

- (NSArray*) n_key_weapons_online_toggle
private

Definition at line 668 of file PlayerEntity.h.

◆ n_key_yaw_left

- (NSArray*) n_key_yaw_left
private

Definition at line 550 of file PlayerEntity.h.

◆ n_key_yaw_right

- (NSArray*) n_key_yaw_right
private

Definition at line 551 of file PlayerEntity.h.

◆ occlusion_dial

- (float) occlusion_dial
private

Definition at line 375 of file PlayerEntity.h.

◆ parcel_record

- (NSMutableDictionary*) parcel_record
private

Definition at line 415 of file PlayerEntity.h.

◆ parcels

- (NSMutableArray*) parcels
private

Definition at line 414 of file PlayerEntity.h.

◆ passenger_record

- (NSMutableDictionary*) passenger_record
private

Definition at line 412 of file PlayerEntity.h.

◆ passengers

- (NSMutableArray*) passengers
private

Definition at line 411 of file PlayerEntity.h.

◆ pitch_delta

- (GLfloat) pitch_delta
private

Definition at line 473 of file PlayerEntity.h.

◆ pitching

- (unsigned) pitching
private

Definition at line 763 of file PlayerEntity.h.

◆ planetSearchString

- (NSString*) planetSearchString
private

Definition at line 442 of file PlayerEntity.h.

◆ playerRotMatrix

- (OOMatrix) playerRotMatrix
private

Definition at line 444 of file PlayerEntity.h.

◆ pollControls

- (BOOL) pollControls
private

Definition at line 452 of file PlayerEntity.h.

◆ port_shot_time

- (OOTimeDelta) port_shot_time
private

Definition at line 478 of file PlayerEntity.h.

◆ portViewOffset

- (Vector) portViewOffset
private

Definition at line 710 of file PlayerEntity.h.

◆ previous_system_id

- (OOSystemID) previous_system_id
private

Definition at line 373 of file PlayerEntity.h.

◆ primedEquipment

- (NSUInteger) primedEquipment
private

Definition at line 492 of file PlayerEntity.h.

◆ replacingMissile

- (unsigned) replacingMissile
private

Definition at line 776 of file PlayerEntity.h.

◆ reputation

- (NSMutableDictionary*) reputation
private

Provided by category PlayerEntity(Contracts).

Definition at line 408 of file PlayerEntity.h.

◆ roleSystemList

- (NSMutableArray*) roleSystemList
private

Definition at line 426 of file PlayerEntity.h.

◆ roleWeightFlags

- (NSMutableDictionary*) roleWeightFlags
private

Definition at line 425 of file PlayerEntity.h.

◆ roleWeights

- (NSMutableArray *) roleWeights
private

Definition at line 423 of file PlayerEntity.h.

Referenced by PlayerGetProperty().

◆ roll_delta

- (GLfloat) roll_delta
private

Definition at line 473 of file PlayerEntity.h.

◆ rolling

- (unsigned) rolling
private

Definition at line 763 of file PlayerEntity.h.

◆ save_path

- (NSString*) save_path
private

Definition at line 706 of file PlayerEntity.h.

◆ saved_chart_zoom

- (OOScalar) saved_chart_zoom
private

Definition at line 510 of file PlayerEntity.h.

◆ scannedWormholes

- (NSArray *) scannedWormholes
private

Definition at line 805 of file PlayerEntity.h.

◆ scanner_zoom_rate

- (GLfloat) scanner_zoom_rate
private

Definition at line 719 of file PlayerEntity.h.

◆ scenarioKey

- (NSString*) scenarioKey
private

Definition at line 707 of file PlayerEntity.h.

◆ scoopOverride

- (BOOL) scoopOverride
private

Definition at line 740 of file PlayerEntity.h.

◆ scoopsActive

- (unsigned) scoopsActive
private

Definition at line 738 of file PlayerEntity.h.

◆ script_time

- (double) script_time
private

Definition at line 428 of file PlayerEntity.h.

◆ script_time_check

- (double) script_time_check
private

Definition at line 429 of file PlayerEntity.h.

◆ script_time_interval

- (double) script_time_interval
private

Definition at line 430 of file PlayerEntity.h.

◆ selFunctionIdx

- (int) selFunctionIdx
private

Definition at line 787 of file PlayerEntity.h.

◆ ship_clock

- (double) ship_clock
private

Definition at line 433 of file PlayerEntity.h.

◆ ship_clock_adjust

- (double) ship_clock_adjust
private

Definition at line 434 of file PlayerEntity.h.

◆ ship_kills

- (unsigned) ship_kills
private

Definition at line 531 of file PlayerEntity.h.

◆ ship_trade_in_factor

- (int) ship_trade_in_factor
private

Definition at line 378 of file PlayerEntity.h.

◆ shipCommodityData

- (OOCommodityMarket *) shipCommodityData
private

Definition at line 524 of file PlayerEntity.h.

◆ shipyard_record

- (NSMutableDictionary*) shipyard_record
private

Definition at line 420 of file PlayerEntity.h.

◆ show_info_flag

- (unsigned) show_info_flag
private

Definition at line 759 of file PlayerEntity.h.

◆ showDemoShips

- (BOOL) showDemoShips
private

Definition at line 761 of file PlayerEntity.h.

◆ showingLongRangeChart

- (BOOL) showingLongRangeChart
private

Definition at line 446 of file PlayerEntity.h.

◆ specialCargo

- (NSString *) specialCargo
private

Definition at line 394 of file PlayerEntity.h.

Referenced by PlayerShipGetProperty().

◆ starboard_shot_time

- (OOTimeDelta) starboard_shot_time
private

Definition at line 478 of file PlayerEntity.h.

◆ starboardViewOffset

- (Vector) starboardViewOffset
private

Definition at line 710 of file PlayerEntity.h.

◆ stickFunctions

- (NSArray*) stickFunctions
private

Definition at line 788 of file PlayerEntity.h.

◆ stickProfileScreen

- (StickProfileScreen*) stickProfileScreen
private

Definition at line 811 of file PlayerEntity.h.

◆ suppressTargetLost

- (void) suppressTargetLost
private

Definition at line 737 of file PlayerEntity.h.

◆ system_id

- (OOSystemID) system_id
private

Definition at line 370 of file PlayerEntity.h.

◆ target_chart_centre

- (NSPoint) target_chart_centre
private

Definition at line 503 of file PlayerEntity.h.

◆ target_chart_focus

- (NSPoint) target_chart_focus
private

Definition at line 504 of file PlayerEntity.h.

◆ target_chart_zoom

- (OOScalar) target_chart_zoom
private

Definition at line 509 of file PlayerEntity.h.

◆ target_memory

- (NSMutableArray*) target_memory
private

Definition at line 723 of file PlayerEntity.h.

◆ target_memory_index

- (NSUInteger) target_memory_index
private

Definition at line 724 of file PlayerEntity.h.

◆ target_system_id

- (OOSystemID) target_system_id
private

Definition at line 371 of file PlayerEntity.h.

◆ targetDockStation

- (StationEntity*) targetDockStation
private

Definition at line 465 of file PlayerEntity.h.

◆ travelling_at_hyperspeed

- (unsigned) travelling_at_hyperspeed
private

Definition at line 750 of file PlayerEntity.h.

◆ trumble

- (OOTrumble* trumble[PLAYER_MAX_TRUMBLES])
private

Definition at line 715 of file PlayerEntity.h.

◆ trumbleCount

- (NSUInteger) trumbleCount
private

Definition at line 714 of file PlayerEntity.h.

◆ using_mining_laser

- (unsigned) using_mining_laser
private

Definition at line 764 of file PlayerEntity.h.

◆ waitingForStickCallback

- (unsigned) waitingForStickCallback
private

Definition at line 771 of file PlayerEntity.h.

◆ weapons_online

- (unsigned) weapons_online
private

Definition at line 773 of file PlayerEntity.h.

◆ witchspaceCountdown

- (OOTimeDelta) witchspaceCountdown
private

Definition at line 512 of file PlayerEntity.h.

◆ worldScripts

- (NSDictionary*) worldScripts
private

Definition at line 380 of file PlayerEntity.h.

◆ worldScriptsRequiringTickle

- (NSDictionary*) worldScriptsRequiringTickle
private

Provided by category PlayerEntity(Scripting).

Definition at line 381 of file PlayerEntity.h.

◆ wormhole

- (WormholeEntity *) wormhole
private

Definition at line 806 of file PlayerEntity.h.

◆ yaw_delta

- (GLfloat) yaw_delta
private

Definition at line 473 of file PlayerEntity.h.

◆ yawing

- (unsigned) yawing
private

Definition at line 763 of file PlayerEntity.h.


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