コード例 #1
0
  /** CheckNeedPass. */
  public static void CheckNeedPass() {
    int need;

    // if password or spectator_password has changed, update needpass
    // as needed
    if (password.modified || spectator_password.modified) {
      password.modified = spectator_password.modified = false;

      need = 0;

      if ((password.string.length() > 0) && 0 != Lib.Q_stricmp(password.string, "none")) need |= 1;
      if ((spectator_password.string.length() > 0)
          && 0 != Lib.Q_stricmp(spectator_password.string, "none")) need |= 2;

      ConsoleVariables.Set("needpass", "" + need);
    }
  }
コード例 #2
0
  public static Entity G_PickTarget(String targetname) {
    int num_choices = 0;
    Entity choice[] = new Entity[MAXCHOICES];

    if (targetname == null) {
      ServerGame.PF_dprintf("G_PickTarget called with null targetname\n");
      return null;
    }

    EntityIterator es = null;

    while ((es = G_Find(es, findByTarget, targetname)) != null) {
      choice[num_choices++] = es.o;
      if (num_choices == MAXCHOICES) break;
    }

    if (num_choices == 0) {
      ServerGame.PF_dprintf("G_PickTarget: target " + targetname + " not found\n");
      return null;
    }

    return choice[Lib.rand() % num_choices];
  }