<commit_before>/* bzflag
* Copyright (c) 1993 - 2004 <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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/

#ifdef _MSC_VER
#pragma warning( 4: 4786 )
#endif

#include "3DOptionsManager.h"
#include "TextureManager.h"
#include "StateDatabase.h"

/*const int NO_VARIANT = (-1); */

// initialize the singleton
template <>
OptionsManager* Singleton<OptionsManager>::_instance = (OptionsManager*)0;

void  OptionsManager::init ( void )
{
  int textureMode = BZDB.evalInt("texture");
  if (textureMode == 0)
    options.textures[0] = options.textures[1] = options.textures[2] = false;
  else
  {
   options.textures[0] = BZDB.isTrue("objectTextures");
   options.textures[1] = BZDB.isTrue("worldTextures");
   options.textures[2] = BZDB.isTrue("environmentTextures");
   options.filterMode = (textureFilterModes)((int)BZDB.eval("texture")-1);
  }

  options.blending = BZDB.isTrue("blend");
  options.dither = BZDB.isTrue("dither");
  options.smoothing = BZDB.isTrue("smooth");
  options.dethBuffer = BZDB.isTrue("zbuffer");
  options.quality  = (renderQuality)BZDB.evalInt("useQuality");
  options.shadows  = BZDB.isTrue("shadows");
  options.lighting  = BZDB.isTrue("lighting");
}

void  OptionsManager::save ( void )
{
  int textureMode = 0;
  if (options.textures)
    textureMode = options.filterMode+1;

  BZDB.setInt("texture",textureMode);

  BZDB.setBool("blend", options.blending );
  BZDB.setBool("dither", options.dither );<commit_msg>no need to eval a bzdb var twice when we store the value anyway<commit_after>/* bzflag
* Copyright (c) 1993 - 2004 <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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/

#ifdef _MSC_VER
#pragma warning( 4: 4786 )
#endif

#include "3DOptionsManager.h"
#include "TextureManager.h"
#include "StateDatabase.h"

/*const int NO_VARIANT = (-1); */

// initialize the singleton
template <>
OptionsManager* Singleton<OptionsManager>::_instance = (OptionsManager*)0;

void  OptionsManager::init ( void )
{
  int textureMode = BZDB.evalInt("texture");
  if (textureMode == 0) {
    options.textures[0] = options.textures[1] = options.textures[2] = false;
  } else {
    options.textures[0] = BZDB.isTrue("objectTextures");
    options.textures[1] = BZDB.isTrue("worldTextures");
    options.textures[2] = BZDB.isTrue("environmentTextures");
    options.filterMode = (textureFilterModes)(textureMode - 1);
  }

  options.blending = BZDB.isTrue("blend");
  options.dither = BZDB.isTrue("dither");
  options.smoothing = BZDB.isTrue("smooth");
  options.dethBuffer = BZDB.isTrue("zbuffer");
  options.quality  = (renderQuality)BZDB.evalInt("useQuality");
  options.shadows  = BZDB.isTrue("shadows");
  options.lighting  = BZDB.isTrue("lighting");
}

void  OptionsManager::save ( void )
{
  int textureMode = 0;
  if (options.textures)
    textureMode = options.filterMode+1;

  BZDB.setInt("texture",textureMode);

  BZDB.setBool("blend", options.blending );
  BZDB.setBool("dither", options.dither );
{'fraction_non_alphanumeric': 0.13434903047091412, 'fraction_numerical': 0.014404432132963989, 'mean_word_length': 4.814814814814815, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4909806', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1190, 'n_words': 292}