(svn r15324) -Codechange: unify the class used for comparing of strings for std::map

This commit is contained in:
smatz
2009-02-03 18:08:07 +00:00
parent 00222c6881
commit 16d1904e70
10 changed files with 34 additions and 28 deletions

View File

@@ -7,11 +7,9 @@
#include "api/ai_event_types.hpp"
#include "../date_type.h"
#include "../core/string_compare_type.hpp"
#ifndef AI_CONFIG_HPP
struct ltstr { bool operator()(const char *s1, const char *s2) const { return strcmp(s1, s2) < 0; } };
#endif /* AI_CONFIG_HPP */
typedef std::map<const char *, class AIInfo *, ltstr> AIInfoList;
typedef std::map<const char *, class AIInfo *, StringCompare> AIInfoList;
void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2);

View File

@@ -7,14 +7,11 @@
#include <map>
#include "ai_info.hpp"
#ifndef AI_HPP
struct ltstr { bool operator()(const char *s1, const char *s2) const { return strcmp(s1, s2) < 0; } };
#endif /* AI_HPP */
#include "../core/string_compare_type.hpp"
class AIConfig {
private:
typedef std::map<const char *, int, ltstr> SettingValueList;
typedef std::map<const char *, int, StringCompare> SettingValueList;
public:
AIConfig() :

View File

@@ -5,6 +5,7 @@
#ifndef AI_SCANNER_HPP
#define AI_SCANNER_HPP
#include "../core/string_compare_type.hpp"
#include <map>
class AIScanner {
@@ -73,7 +74,7 @@ public:
bool HasAI(const struct ContentInfo *ci, bool md5sum);
#endif
private:
typedef std::map<const char *, class AILibrary *, ltstr> AILibraryList;
typedef std::map<const char *, class AILibrary *, StringCompare> AILibraryList;
/**
* Scan the AI dir for scripts.

View File

@@ -5,10 +5,8 @@
#ifndef AI_CONTROLLER_HPP
#define AI_CONTROLLER_HPP
#include "../../core/string_compare_type.hpp"
#include <map>
#ifndef AI_HPP
struct ltstr { bool operator()(const char *s1, const char *s2) const { return strcmp(s1, s2) < 0; } };
#endif /* AI_HPP */
/**
* The Controller, the class each AI should extend. It creates the AI, makes
@@ -85,7 +83,7 @@ public:
static void Print(bool error_msg, const char *message);
private:
typedef std::map<const char *, const char *, ltstr> LoadedLibraryList;
typedef std::map<const char *, const char *, StringCompare> LoadedLibraryList;
uint ticks;
LoadedLibraryList loaded_library;