summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/command.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-11 06:57:43 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-11 06:57:43 +0000
commite65d4ee999e6673244c26ae7278665d6fe241a5e (patch)
tree55fd8f976876d95a8de5fb4fae73f311a96a5284 /crawl-ref/source/command.cc
parent46ed610698d1401308402dfc9e00331c4d1b088a (diff)
downloadcrawl-ref-e65d4ee999e6673244c26ae7278665d6fe241a5e.tar.gz
crawl-ref-e65d4ee999e6673244c26ae7278665d6fe241a5e.zip
Remove #define SHUT_LABYRINTH because I don't think it's needed anymore.
Add more information to the version command. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5729 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/command.cc')
-rw-r--r--crawl-ref/source/command.cc88
1 files changed, 86 insertions, 2 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 3d6f26c32c..f9c1650513 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -109,7 +109,7 @@ static std::string _get_version_information(void)
static std::string _get_version_features(void)
{
- std::string result = "FEATURES" EOL;
+ std::string result = "<w>FEATURES</w>" EOL;
result += "--------" EOL;
for (unsigned int i = 0; i < ARRAYSZ(features); i++)
@@ -118,7 +118,7 @@ static std::string _get_version_features(void)
result += features[i];
result += EOL;
}
- result += "\n\n";
+ result += "\n";
return (result);
}
@@ -127,6 +127,89 @@ static void _add_file_to_scroller(FILE* fp, formatted_scroller& m,
int first_hotkey = 0,
bool auto_hotkeys = false);
+static std::string _get_version_changes(void)
+{
+ std::string result = "";
+
+ bool start = false;
+ // Attempts to print "Highlights" of the latest version.
+ FILE* fp = fopen(datafile_path("changes.stone_soup", true).c_str(), "r");
+ if (fp)
+ {
+ char buf[200];
+ std::string help;
+ bool skip_lines = true;
+ while (fgets(buf, sizeof buf, fp))
+ {
+ // Remove trailing spaces.
+ for (int i = strlen(buf) - 1; i >= 0; i++)
+ {
+ if (isspace( buf[i] ))
+ buf[i] = 0;
+ else
+ break;
+ }
+ help = buf;
+ // Give up if you encountered the second set of underliners
+ // and still haven't found Highlights.
+ if (help.find("---") != std::string::npos)
+ {
+ if (skip_lines)
+ {
+ skip_lines = false;
+ continue;
+ }
+ else if (!start)
+ break;
+ }
+
+ if (help.find("Highlights") != std::string::npos)
+ {
+ // Highlight the Highlights, so to speak.
+ std::string text = "<w>";
+ text += buf;
+ text += "</w>";
+ text += EOL;
+ result += text;
+ // And start printing from now on.
+ start = true;
+ }
+ else if (!start)
+ continue;
+ else if (buf[0] == 0)
+ {
+ // Stop reading and copying text with the first empty line
+ // following the Highlights section.
+ break;
+ }
+ else
+ {
+ result += buf;
+ result += EOL;
+ }
+ }
+ }
+ fclose(fp);
+
+ // Did we ever get to print the Highlights?
+ if (start)
+ {
+ result += EOL;
+ result += "For a more complete list of changes, see changes.stone_soup "
+ "in the /docs " EOL
+ "folder.";
+ }
+ else
+ {
+ result += "For a list of changes, see changes.stone_soup in the /docs "
+ "folder.";
+ }
+
+ result += "\n\n";
+
+ return (result);
+}
+
void print_version(void)
{
formatted_scroller cmd_version;
@@ -144,6 +227,7 @@ void print_version(void)
cmd_version.add_text(_get_version_information());
cmd_version.add_text(_get_version_features());
+ cmd_version.add_text(_get_version_changes());
// Read in information about changed in comparison to the latest version.
FILE* fp = fopen(datafile_path("034_changes.txt", true).c_str(), "r");