Esempio n. 1
0
  public static void Error(int code, String fmt, Vargs vargs) throws LongJmpException {
    // va_list argptr;
    // static char msg[MAXPRINTMSG];

    if (recursive) {
      Sys.Error("recursive error after: " + msg);
    }
    recursive = true;

    msg = sprintf(fmt, vargs);

    if (code == Constants.ERR_DISCONNECT) {
      Client.drop();
      recursive = false;
      throw new LongJmpException();
    } else if (code == Constants.ERR_DROP) {
      Com.Printf("********************\nERROR: " + msg + "\n********************\n");
      ServerMain.SV_Shutdown("Server crashed: " + msg + "\n", false);
      Client.drop();
      recursive = false;
      throw new LongJmpException();
    } else {
      ServerMain.SV_Shutdown("Server fatal crashed: %s" + msg + "\n", false);
      Client.shutdown();
    }

    Sys.Error(msg);
  }
Esempio n. 2
0
  // See GameSpanw.ED_ParseEdict() to see how to use it now.
  public static String Parse(ParseHelp hlp) {
    int c;
    int len = 0;

    if (hlp.data == null) {
      return "";
    }

    while (true) {
      //	   skip whitespace
      hlp.skipwhites();
      if (hlp.isEof()) {
        hlp.data = null;
        return "";
      }

      //	   skip // comments
      if (hlp.getchar() == '/') {
        if (hlp.nextchar() == '/') {
          hlp.skiptoeol();
          // goto skip whitespace
          continue;
        } else {
          hlp.prevchar();
          break;
        }
      } else break;
    }

    //	   handle quoted strings specially
    if (hlp.getchar() == '\"') {
      hlp.nextchar();
      while (true) {
        c = hlp.getchar();
        hlp.nextchar();
        if (c == '\"' || c == 0) {
          return new String(com_token, 0, len);
        }
        if (len < Constants.MAX_TOKEN_CHARS) {
          com_token[len] = (char) c;
          len++;
        }
      }
    }

    //	   parse a regular word
    c = hlp.getchar();
    do {
      if (len < Constants.MAX_TOKEN_CHARS) {
        com_token[len] = (char) c;
        len++;
      }
      c = hlp.nextchar();
    } while (c > 32);

    if (len == Constants.MAX_TOKEN_CHARS) {
      Com.Printf("Token exceeded " + Constants.MAX_TOKEN_CHARS + " chars, discarded.\n");
      len = 0;
    }

    return new String(com_token, 0, len);
  }