Hide cut short key in dashes.
authorCMDR furrycat <elite@furrycat.net>
Mon, 13 Jun 2016 09:38:55 +0000 (05:38 -0400)
committerCMDR furrycat <elite@furrycat.net>
Mon, 13 Jun 2016 09:38:55 +0000 (05:38 -0400)
lib/race.php
propel/build/classes/buckyball/Entry.php

index 0ab11ff..695dcff 100644 (file)
       echo "<td style=\"vertical-align: top\">\n";
       echo "<table>\n";
       foreach ($endorsements as $e) {
-        if (Entry::EndorsementHidden($e)) continue;
+        if (Entry::EndorsementHidden($e, $race->getAllottedTime())) continue;
         $description = Entry::EndorsementDescription($e);
         echo "<tr><td>$e</td><td>$description</td></tr>\n";
       }
       echo "[td]\n";
       echo "[table]\n";
       foreach ($endorsements as $e) {
-        if (Entry::EndorsementHidden($e)) continue;
+        if (Entry::EndorsementHidden($e, $race->getAllottedTime())) continue;
         $description = Entry::EndorsementDescription($e);
         echo "[tr]";
         echo "[td]";
index d32af6c..749e283 100644 (file)
  */
 class Entry extends BaseEntry
 {
+  /* key => (description, hidden, time limited only, value) */
   private static $ENDORSEMENTS = array(
-    'c' => array('entry cut short', false, 1 << 0),
-    'd' => array('docking computer', false, 1 << 1),
-    'f' => array('FSD injection', false, 1 << 2),
-    'j' => array('joker card', false, 1 << 3),
-    'x' => array('excluded from ranking', false, 1 << 4),
-    'm' => array('missing evidence', false, 1 << 5),
-    's' => array('shields', true, 1 << 6),
-    't' => array('tuned', false, 1 << 7)
+    'c' => array('entry cut short', false, true, 1 << 0),
+    'd' => array('docking computer', false, false, 1 << 1),
+    'f' => array('FSD injection', false, false, 1 << 2),
+    'j' => array('joker card', false, false, 1 << 3),
+    'x' => array('excluded from ranking', false, false, 1 << 4),
+    'm' => array('missing evidence', false, false, 1 << 5),
+    's' => array('shields', true, false, 1 << 6),
+    't' => array('tuned', false, false, 1 << 7)
   );
 
   function Endorsements() {
@@ -42,12 +43,18 @@ class Entry extends BaseEntry
     return self::Endorsement($e)[0];
   }
 
-  function EndorsementHidden($e) {
-    return self::Endorsement($e)[1];
+  function EndorsementTimeLimited($e) {
+    return self::Endorsement($e)[2];
+  }
+
+  function EndorsementHidden($e, $time_limited = false) {
+    if (self::Endorsement($e)[1]) return true;
+    if (self::EndorsementTimeLimited($e) && ! $time_limited) return true;
+    return false;
   }
 
   function EndorsementValue($e) {
-    return self::Endorsement($e)[2];
+    return self::Endorsement($e)[3];
   }
 
   function Sort($a, $b, $method, $reverse = false) {