(svn r23936) -Feature [FS#5047]: readme/licence/changelog viewer for AI and game scripts (LordAro)

This commit is contained in:
rubidium
2012-02-12 10:58:18 +00:00
parent 592752e48a
commit 35415e1a3f
7 changed files with 75 additions and 1 deletions

View File

@@ -180,6 +180,7 @@ void SQGSWindow_Register(Squirrel *engine)
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CHANGE, "WID_AIC_CHANGE");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CONFIGURE, "WID_AIC_CONFIGURE");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CLOSE, "WID_AIC_CLOSE");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_TEXTFILE, "WID_AIC_TEXTFILE");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CONTENT_DOWNLOAD, "WID_AIC_CONTENT_DOWNLOAD");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_VIEW, "WID_AID_VIEW");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_NAME_TEXT, "WID_AID_NAME_TEXT");

View File

@@ -843,6 +843,7 @@ public:
WID_AIC_CHANGE = ::WID_AIC_CHANGE, ///< Select another AI button.
WID_AIC_CONFIGURE = ::WID_AIC_CONFIGURE, ///< Change AI settings button.
WID_AIC_CLOSE = ::WID_AIC_CLOSE, ///< Close window button.
WID_AIC_TEXTFILE = ::WID_AIC_TEXTFILE, ///< Open Script readme, changelog (+1) or license (+2).
WID_AIC_CONTENT_DOWNLOAD = ::WID_AIC_CONTENT_DOWNLOAD, ///< Download content button.
};

View File

@@ -13,6 +13,7 @@
#include "../settings_type.h"
#include "../core/random_func.hpp"
#include "script_info.hpp"
#include "../textfile_gui.h"
void ScriptConfig::Change(const char *name, int version, bool force_exact_match, bool is_random)
{
@@ -198,3 +199,10 @@ void ScriptConfig::SettingsToString(char *string, size_t size) const
size_t len = strlen(string);
if (len > 0) string[len - 1] = '\0';
}
const char *ScriptConfig::GetTextfile(TextfileType type, CompanyID slot) const
{
if (slot == INVALID_COMPANY || this->GetInfo() == NULL) return NULL;
return ::GetTextfile(type, (slot == OWNER_DEITY) ? GAME_DIR : AI_DIR, this->GetInfo()->GetMainScript());
}

View File

@@ -16,6 +16,8 @@
#include <list>
#include "../core/smallmap_type.hpp"
#include "../core/string_compare_type.hpp"
#include "../company_type.h"
#include "../textfile_gui.h"
/** Bitmask of flags for Script settings. */
enum ScriptConfigFlags {
@@ -161,6 +163,14 @@ public:
*/
void SettingsToString(char *string, size_t size) const;
/**
* Search a textfile file next to this script.
* @param type The type of the textfile to search for.
* @param slot #CompanyID to check status of.
* @return The filename for the textfile, \c NULL otherwise.
*/
const char *GetTextfile(TextfileType type, CompanyID slot) const;
protected:
const char *name; ///< Name of the Script
int version; ///< Version of the Script