LCOV - code coverage report
Current view: top level - Core - OOShipLibraryDescriptions.m (source / functions) Hit Total Coverage
Test: coverxygen.info Lines: 0 12 0.0 %
Date: 2025-05-28 07:50:54 Functions: 0 0 -

          Line data    Source code
       1           0 : /*
       2             : 
       3             : OOShipLibraryDescriptions.m
       4             : 
       5             : Oolite
       6             : Copyright (C) 2004-2013 Giles C Williams and contributors
       7             : 
       8             : This program is free software; you can redistribute it and/or
       9             : modify it under the terms of the GNU General Public License
      10             : as published by the Free Software Foundation; either version 2
      11             : of the License, or (at your option) any later version.
      12             : 
      13             : This program is distributed in the hope that it will be useful,
      14             : but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             : GNU General Public License for more details.
      17             : 
      18             : You should have received a copy of the GNU General Public License
      19             : along with this program; if not, write to the Free Software
      20             : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
      21             : MA 02110-1301, USA.
      22             : 
      23             : */
      24             : 
      25             : #import "OOShipLibraryDescriptions.h"
      26             : #import "OOStringExpander.h"
      27             : #import "Universe.h"
      28             : 
      29           0 : NSString *OOShipLibraryCategorySingular(NSString *category)
      30             : {
      31             :         return OOExpandKey(OOExpand(@"oolite-ship-library-category-[category]", category));
      32             : }
      33             : 
      34             : 
      35           0 : NSString *OOShipLibraryCategoryPlural(NSString *category)
      36             : {
      37             :         return OOExpandKey(OOExpand(@"oolite-ship-library-category-plural-[category]", category));
      38             : }
      39             : 
      40             : 
      41           0 : NSString *OOShipLibrarySpeed (ShipEntity *demo_ship)
      42             : {
      43             :         GLfloat param = [demo_ship maxFlightSpeed];
      44             :         NSString *result = nil;
      45             :         if (param <= 1)
      46             :         {
      47             :                 result = DESC(@"oolite-ship-library-speed-stationary");
      48             :         }
      49             :         else if (param <= 150)
      50             :         {
      51             :                 result = DESC(@"oolite-ship-library-speed-veryslow");
      52             :         }
      53             :         else if (param <= 250)
      54             :         {
      55             :                 result = DESC(@"oolite-ship-library-speed-slow");
      56             :         }
      57             :         else if (param <= 325)
      58             :         {
      59             :                 result = DESC(@"oolite-ship-library-speed-average");
      60             :         }
      61             :         else if (param <= 425)
      62             :         {
      63             :                 result = DESC(@"oolite-ship-library-speed-fast");
      64             :         }
      65             :         else
      66             :         {
      67             :                 result = DESC(@"oolite-ship-library-speed-veryfast");
      68             :         }
      69             :         return result;
      70             : }
      71             : 
      72             : 
      73           0 : NSString *OOShipLibraryTurnRate (ShipEntity *demo_ship)
      74             : {
      75             :         GLfloat param = [demo_ship maxFlightRoll] + (2*[demo_ship maxFlightPitch]);
      76             :         NSString *result = nil;
      77             :         if (param <= 2)
      78             :         {
      79             :                 result = DESC(@"oolite-ship-library-turn-veryslow");
      80             :         }
      81             :         else if (param <= 2.75)
      82             :         {
      83             :                 result = DESC(@"oolite-ship-library-turn-slow");
      84             :         }
      85             :         else if (param <= 4.5)
      86             :         {
      87             :                 result = DESC(@"oolite-ship-library-turn-average");
      88             :         }
      89             :         else if (param <= 6)
      90             :         {
      91             :                 result = DESC(@"oolite-ship-library-turn-fast");
      92             :         }
      93             :         else
      94             :         {
      95             :                 result = DESC(@"oolite-ship-library-turn-veryfast");
      96             :         }
      97             :         return result;
      98             : }
      99             : 
     100             : 
     101           0 : NSString *OOShipLibraryCargo (ShipEntity *demo_ship)
     102             : {
     103             :         OOCargoQuantity param = [demo_ship maxAvailableCargoSpace];
     104             :         NSString *result = nil;
     105             :         if (param == 0)
     106             :         {
     107             :                 result = DESC(@"oolite-ship-library-cargo-none");
     108             :         }
     109             :         else 
     110             :         {
     111             :                 result = [NSString stringWithFormat:DESC(@"oolite-ship-library-cargo-carried-u"),param];
     112             :         }
     113             :         return result;
     114             : }
     115             : 
     116             : 
     117           0 : NSString *OOShipLibraryGenerator (ShipEntity *demo_ship)
     118             : {
     119             :         float rate = [demo_ship energyRechargeRate];
     120             :         NSString *result = nil;
     121             :         if (rate < 2.5)
     122             :         {
     123             :                 result = DESC(@"oolite-ship-library-generator-weak");
     124             :         }
     125             :         else if (rate < 3.75)
     126             :         {
     127             :                 result = DESC(@"oolite-ship-library-generator-average");
     128             :         }
     129             :         else
     130             :         {
     131             :                 result = DESC(@"oolite-ship-library-generator-strong");
     132             :         }
     133             :         return result;
     134             : }
     135             : 
     136             : 
     137           0 : NSString *OOShipLibraryShields (ShipEntity *demo_ship)
     138             : {
     139             :         // when NPCs have actual shields, add those on as well
     140             :         float shields = [demo_ship maxEnergy];
     141             :         NSString *result = nil;
     142             :         if (shields < 128)
     143             :         {
     144             :                 result = DESC(@"oolite-ship-library-shields-veryweak");
     145             :         }
     146             :         else if (shields < 192)
     147             :         {
     148             :                 result = DESC(@"oolite-ship-library-shields-weak");
     149             :         }
     150             :         else if (shields < 256)
     151             :         {
     152             :                 result = DESC(@"oolite-ship-library-shields-average");
     153             :         }
     154             :         else if (shields < 320)
     155             :         {
     156             :                 result = DESC(@"oolite-ship-library-shields-strong");
     157             :         }
     158             :         else
     159             :         {
     160             :                 result = DESC(@"oolite-ship-library-shields-verystrong");
     161             :         }
     162             :         return result;
     163             : }
     164             : 
     165             : 
     166           0 : NSString *OOShipLibraryWitchspace (ShipEntity *demo_ship)
     167             : {
     168             :         if ([demo_ship hasHyperspaceMotor])
     169             :         {
     170             :                 return DESC(@"oolite-ship-library-witchspace-yes");
     171             :         }
     172             :         else
     173             :         {
     174             :                 return DESC(@"oolite-ship-library-witchspace-no");
     175             :         }
     176             : }
     177             : 
     178             : 
     179           0 : NSString *OOShipLibraryWeapons (ShipEntity *demo_ship)
     180             : {
     181             :         OOWeaponFacingSet facings = [demo_ship weaponFacings]; 
     182             :         NSUInteger fixed = (facings&1)+(facings&2)/2+(facings&4)/4+(facings&8)/8;
     183             :         NSUInteger pylons = [demo_ship missileCapacity];
     184             :         if (fixed == 0 && pylons == 0)
     185             :         {
     186             :                 return DESC(@"oolite-ship-library-weapons-none");
     187             :         }
     188             :         return [NSString stringWithFormat:DESC(@"oolite-ship-library-weapons-u-u"),fixed,pylons];
     189             : }
     190             : 
     191             : 
     192           0 : NSString *OOShipLibraryTurrets (ShipEntity *demo_ship)
     193             : {
     194             :         NSUInteger turretCount = [demo_ship turretCount];
     195             :         if (turretCount > 0) 
     196             :         {
     197             :                 return [NSString stringWithFormat:DESC(@"oolite-ship-library-turrets-u"), turretCount];
     198             :         }
     199             :         else 
     200             :         {
     201             :                 return @"";
     202             :         }
     203             : }
     204             : 
     205             : 
     206           0 : NSString *OOShipLibrarySize (ShipEntity *demo_ship)
     207             : {
     208             :         BoundingBox bb = [demo_ship totalBoundingBox];
     209             :         return [NSString stringWithFormat:DESC(@"oolite-ship-library-size-u-u-u"),(unsigned)(bb.max.x-bb.min.x),(unsigned)(bb.max.y-bb.min.y),(unsigned)(bb.max.z-bb.min.z)];
     210             : }

Generated by: LCOV version 1.14