X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmaterial.cpp;h=c1c3c3c27545653737f2865ef193d04ef8f44b55;hp=442dab56089729aaa72c4cdfcf9a76883253d163;hb=b58ecb85c73e31e3fec5d1ea983642864038a5b3;hpb=cc8e915ed5fa95fc9cde500e7aac3c4dfe7d2daa diff --git a/src/material.cpp b/src/material.cpp index 442dab56..c1c3c3c2 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -1,7 +1,7 @@ /* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008 Marco Costalba + Copyright (C) 2008-2009 Marco Costalba Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +29,7 @@ #include "material.h" +using std::string; //// //// Local definitions @@ -59,9 +60,9 @@ public: EndgameScalingFunctionBase* getESF(Key key, Color* c) const; private: - void add(const std::string& keyCode, EndgameEvaluationFunctionBase* f); - void add(const std::string& keyCode, Color c, EndgameScalingFunctionBase* f); - Key buildKey(const std::string& keyCode); + void add(const string& keyCode, EndgameEvaluationFunctionBase* f); + void add(const string& keyCode, Color c, EndgameScalingFunctionBase* f); + Key buildKey(const string& keyCode); struct ScalingInfo { @@ -90,7 +91,7 @@ MaterialInfoTable::MaterialInfoTable(unsigned int numOfEntries) { { std::cerr << "Failed to allocate " << (numOfEntries * sizeof(MaterialInfo)) << " bytes for material hash table." << std::endl; - exit(EXIT_FAILURE); + Application::exit_with_failure(); } clear(); } @@ -352,7 +353,7 @@ EndgameFunctions::EndgameFunctions() { add("KRPKRPP", BLACK, &ScaleKRPKRPP); } -Key EndgameFunctions::buildKey(const std::string& keyCode) { +Key EndgameFunctions::buildKey(const string& keyCode) { assert(keyCode.length() > 0 && keyCode[0] == 'K'); assert(keyCode.length() < 8); @@ -373,12 +374,12 @@ Key EndgameFunctions::buildKey(const std::string& keyCode) { return Position(s.str()).get_material_key(); } -void EndgameFunctions::add(const std::string& keyCode, EndgameEvaluationFunctionBase* f) { +void EndgameFunctions::add(const string& keyCode, EndgameEvaluationFunctionBase* f) { EEFmap.insert(std::pair(buildKey(keyCode), f)); } -void EndgameFunctions::add(const std::string& keyCode, Color c, EndgameScalingFunctionBase* f) { +void EndgameFunctions::add(const string& keyCode, Color c, EndgameScalingFunctionBase* f) { ScalingInfo s = {c, f}; ESFmap.insert(std::pair(buildKey(keyCode), s));