<commit_before>/* bzflag
 * Copyright (c) 1993 - 2006 <NAME>
 *
 * This package is free software;  you can redistribute it and/or
 * modify it under the terms of the license found in the file
 * named COPYING that should have accompanied this file.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

/* interface header */
#include "CustomWorld.h"

/* system implementation headers */
#include <string.h>

/* common implementation headers */
#include "StateDatabase.h"
#include "BZDBCache.h"
#include "TextUtils.h"


CustomWorld::CustomWorld()
{
  // initialize with database defaults
  _size = BZDBCache::worldSize;
  _fHeight = BZDB.eval(StateDatabase::BZDB_FLAGHEIGHT);
}


bool CustomWorld::read(const char *cmd, std::istream& input)
{
  if (strcasecmp(cmd, "size") == 0) {
    input >> _size;
    _size *= 2.0;
    BZDB.set(StateDatabase::BZDB_WORLDSIZE, TextUtils::format("%f", _size));
  } else if (strcasecmp(cmd, "flagHeight") == 0) {
    input >> _fHeight;
    BZDB.set(StateDatabase::BZDB_FLAGHEIGHT, TextUtils::format("%f", _fHeight));
  } else if (strcasecmp(cmd, "noWalls") == 0) {
    BZDB.setBool("noWalls", true);
  } else if (strcasecmp(cmd, "freeCtfSpawns") == 0) {
    BZDB.setBool("freeCtfSpawns", true);
  } else {
    return WorldFileObject::read(cmd, input);
  }
  return true;
}


void CustomWorld::writeToWorld(WorldInfo*) const
{
}<commit_msg>make the bzdb vars we save at world read time be default ( from <NAME> <EMAIL> )<commit_after>/* bzflag
 * Copyright (c) 1993 - 2006 <NAME>
 *
 * This package is free software;  you can redistribute it and/or
 * modify it under the terms of the license found in the file
 * named COPYING that should have accompanied this file.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

/* interface header */
#include "CustomWorld.h"

/* system implementation headers */
#include <string.h>

/* common implementation headers */
#include "StateDatabase.h"
#include "BZDBCache.h"
#include "TextUtils.h"


CustomWorld::CustomWorld()
{
  // initialize with database defaults
  _size = BZDBCache::worldSize;
  _fHeight = BZDB.eval(StateDatabase::BZDB_FLAGHEIGHT);
}


bool CustomWorld::read(const char *cmd, std::istream& input)
{
  BZDB.setSaveDefault(true);
  if (strcasecmp(cmd, "size") == 0) {
    input >> _size;
    _size *= 2.0;
    BZDB.set(StateDatabase::BZDB_WORLDSIZE, TextUtils::format("%f", _size));
  } else if (strcasecmp(cmd, "flagHeight") == 0) {
    input >> _fHeight;
    BZDB.set(StateDatabase::BZDB_FLAGHEIGHT, TextUtils::format("%f", _fHeight));
  } else if (strcasecmp(cmd, "noWalls") == 0) {
    BZDB.setBool("noWalls", true);
  } else if (strcasecmp(cmd, "freeCtfSpawns") == 0) {
    BZDB.setBool("freeCtfSpawns", true);
  } else {
    return WorldFileObject::read(cmd, input);
  }
  BZDB.setSaveDefault(false);
  return true;
}


void CustomWorld::writeToWorld(WorldInfo*) const
{
}
{'fraction_non_alphanumeric': 0.1350502512562814, 'fraction_numerical': 0.008793969849246231, 'mean_word_length': 4.444444444444445, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4500747', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1058, 'n_words': 299}