summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-04-23 21:16:58 +0000
committerrubidium <rubidium@openttd.org>2014-04-23 21:16:58 +0000
commita5274117bdc323aedc95dbecea6014a308b9a9a0 (patch)
tree65c485894dbc677cfbc5473f549312498435249b /src/game
parent5b82822c12e014771dceaf9d909e1c0f3653c5a9 (diff)
downloadopenttd-a5274117bdc323aedc95dbecea6014a308b9a9a0.tar.xz
(svn r26487) -Codechange: use lastof instead of lengthof/sizeof for script names
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game_scanner.cpp8
-rw-r--r--src/game/game_scanner.hpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/game/game_scanner.cpp b/src/game/game_scanner.cpp
index a251f3386..bc02f6afd 100644
--- a/src/game/game_scanner.cpp
+++ b/src/game/game_scanner.cpp
@@ -23,9 +23,9 @@ void GameScannerInfo::Initialize()
ScriptScanner::Initialize("GSScanner");
}
-void GameScannerInfo::GetScriptName(ScriptInfo *info, char *name, int len)
+void GameScannerInfo::GetScriptName(ScriptInfo *info, char *name, const char *last)
{
- snprintf(name, len, "%s", info->GetName());
+ seprintf(name, last, "%s", info->GetName());
}
void GameScannerInfo::RegisterAPI(class Squirrel *engine)
@@ -86,10 +86,10 @@ void GameScannerLibrary::Initialize()
ScriptScanner::Initialize("GSScanner");
}
-void GameScannerLibrary::GetScriptName(ScriptInfo *info, char *name, int len)
+void GameScannerLibrary::GetScriptName(ScriptInfo *info, char *name, const char *last)
{
GameLibrary *library = static_cast<GameLibrary *>(info);
- snprintf(name, len, "%s.%s", library->GetCategory(), library->GetInstanceName());
+ seprintf(name, last, "%s.%s", library->GetCategory(), library->GetInstanceName());
}
void GameScannerLibrary::RegisterAPI(class Squirrel *engine)
diff --git a/src/game/game_scanner.hpp b/src/game/game_scanner.hpp
index f1d334f0f..071d19d38 100644
--- a/src/game/game_scanner.hpp
+++ b/src/game/game_scanner.hpp
@@ -28,7 +28,7 @@ public:
class GameInfo *FindInfo(const char *nameParam, int versionParam, bool force_exact_match);
protected:
- /* virtual */ void GetScriptName(ScriptInfo *info, char *name, int len);
+ /* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
/* virtual */ const char *GetFileName() const { return PATHSEP "info.nut"; }
/* virtual */ Subdirectory GetDirectory() const { return GAME_DIR; }
/* virtual */ const char *GetScannerName() const { return "Game Scripts"; }
@@ -49,7 +49,7 @@ public:
class GameLibrary *FindLibrary(const char *library, int version);
protected:
- /* virtual */ void GetScriptName(ScriptInfo *info, char *name, int len);
+ /* virtual */ void GetScriptName(ScriptInfo *info, char *name, const char *last);
/* virtual */ const char *GetFileName() const { return PATHSEP "library.nut"; }
/* virtual */ Subdirectory GetDirectory() const { return GAME_LIBRARY_DIR; }
/* virtual */ const char *GetScannerName() const { return "GS Libraries"; }