Show git revision on Blades of Exile title screen and in scenario editor

This commit is contained in:
2015-08-17 12:46:09 -04:00
parent 8c33a0738d
commit 8008ff6dac
6 changed files with 68 additions and 13 deletions

View File

@@ -19,6 +19,7 @@
914701A618F62A52008A6DC9 /* Copy Fonts */,
914B2BB718E8BF99007B6799 /* Validate Dialog Definitions */,
914B2B9518E8008A007B6799 /* Copy Dialog Definitions */,
91C2A6E01B823C7B00346948 /* Generate Git Revision Information */,
);
dependencies = (
);
@@ -736,6 +737,8 @@
91BFA3D91902ADD5001686E4 /* tarball.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = tarball.hpp; sourceTree = "<group>"; };
91BFA3DE19033E01001686E4 /* gzstream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gzstream.cpp; sourceTree = "<group>"; };
91BFA3DF19033E01001686E4 /* gzstream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gzstream.h; sourceTree = "<group>"; };
91C2A6E11B823CCD00346948 /* gitrev.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = gitrev.sh; sourceTree = "<group>"; };
91C2A6E21B8244F700346948 /* gitrev.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = gitrev.hpp; sourceTree = "<group>"; };
91C688E60FD702B9000F6D01 /* cursors.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cursors.hpp; sourceTree = "<group>"; };
91C688E70FD702B9000F6D01 /* cursors.mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cursors.mac.mm; sourceTree = "<group>"; };
91C749B71A2D6432008E0E10 /* strings */ = {isa = PBXFileReference; lastKnownFileType = folder; path = strings; sourceTree = "<group>"; };
@@ -1086,6 +1089,7 @@
children = (
91C688E60FD702B9000F6D01 /* cursors.hpp */,
91E5C7A50F9F615400C21460 /* fileio.hpp */,
91C2A6E21B8244F700346948 /* gitrev.hpp */,
91B3F1090F9779C300BF5B67 /* graphtool.hpp */,
915E09071A316D6A008BDF00 /* map_parse.hpp */,
91B3F11D0F97801F00BF5B67 /* mathutil.hpp */,
@@ -1272,6 +1276,7 @@
91B3F0FF0F97797200BF5B67 /* tools */ = {
isa = PBXGroup;
children = (
91C2A6E11B823CCD00346948 /* gitrev.sh */,
91BFA3DC19033E00001686E4 /* gzstream */,
912DFE8718E24B0B00B00D75 /* resmgr */,
910BBA130FB8BE66001E34EA /* dialogxml */,
@@ -1677,6 +1682,21 @@
shellPath = /bin/sh;
shellScript = ./fix_dylibs.sh;
};
91C2A6E01B823C7B00346948 /* Generate Git Revision Information */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Generate Git Revision Information";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = ./tools/gitrev.sh;
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */

View File

@@ -28,6 +28,7 @@
#include "restypes.hpp"
#include "boe.menus.hpp"
#include "winutil.hpp"
#include "gitrev.hpp"
extern sf::RenderWindow mainPtr;
extern short stat_window;
@@ -426,15 +427,23 @@ void draw_startup_stats() {
}
}
std::ostringstream sout;
sout << "Copyright 1997, All Rights Reserved, v" << oboeVersionString();
#if defined(GIT_REVISION) && defined(GIT_TAG_REVISION)
if(strcmp(GIT_REVISION, GIT_TAG_REVISION) != 0) {
sout << " [" << GIT_REVISION << "]";
}
#endif
std::string copyright = sout.str();
style.font = FONT_BOLD;
style.pointSize = 10;
pc_rect = startup_from[0];
pc_rect.offset(5,5);
pc_rect.top = pc_rect.bottom - 25;
pc_rect.left = pc_rect.right - 270;
pc_rect.left = pc_rect.right - string_length(copyright, style) - 45;
// TODO: Should replace this with a more appropriate copyright string
// Windows replaced it with "That is not dead which can eternally lie..." - I don't think that's quite appropriate though.
win_draw_string(mainPtr,pc_rect,"Copyright 1997, All Rights Reserved, v" + oboeVersionString(),eTextMode::WRAP,style,ul);
win_draw_string(mainPtr, pc_rect, copyright, eTextMode::WRAP, style, ul);
}

View File

@@ -21,6 +21,7 @@
#include "cursors.hpp"
#include "scrollbar.hpp"
#include "dlogutil.hpp"
#include "gitrev.hpp"
#include "scen.btnmg.hpp"
@@ -2371,6 +2372,21 @@ void town_entry(location spot_hit) {
}
}
static std::string version() {
static std::string version;
if(version.empty()) {
std::ostringstream sout;
sout << "Version " << oboeVersionString();
#if defined(GIT_REVISION) && defined(GIT_TAG_REVISION)
if(strcmp(GIT_REVISION, GIT_TAG_REVISION) != 0) {
sout << " [" << GIT_REVISION << "]";
}
#endif
version = sout.str();
}
return version;
}
// is slot >= 0, force that slot
// if -1, use 1st free slot
void set_up_start_screen() {
@@ -2383,11 +2399,12 @@ void set_up_start_screen() {
set_lb(7,LB_TEXT,LB_NO_ACTION,"To find out how to use the");
set_lb(8,LB_TEXT,LB_NO_ACTION,"editor, select Getting Started ");
set_lb(9,LB_TEXT,LB_NO_ACTION,"from the Help menu.");
set_lb(NLS - 5,LB_TEXT,LB_NO_ACTION,"Be sure to read the file Blades");
set_lb(NLS - 4,LB_TEXT,LB_NO_ACTION,"of Exile License. Using this");
set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"program implies that you agree ");
set_lb(NLS - 2,LB_TEXT,LB_NO_ACTION,"with the terms of the license.");
set_lb(NLS - 1,LB_TEXT,LB_NO_ACTION,"Copyright 1997, All rights reserved.");
set_lb(NLS - 6,LB_TEXT,LB_NO_ACTION,"Be sure to read the file Blades");
set_lb(NLS - 5,LB_TEXT,LB_NO_ACTION,"of Exile License. Using this");
set_lb(NLS - 4,LB_TEXT,LB_NO_ACTION,"program implies that you agree ");
set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"with the terms of the license.");
set_lb(NLS - 2,LB_TEXT,LB_NO_ACTION,"Copyright 1997, All rights reserved.");
set_lb(NLS - 1,LB_TEXT,LB_NO_ACTION,version());
}
void set_up_main_screen() {
@@ -2419,7 +2436,8 @@ void set_up_main_screen() {
set_lb(-1,LB_TEXT,LB_LOAD_TOWN,"Load Another Town");
set_lb(-1,LB_TEXT,LB_EDIT_TOWN,"Edit Town Terrain");
set_lb(-1,LB_TEXT,LB_EDIT_TALK,"Edit Town Dialogue");
set_lb(NLS - 1,LB_TEXT,LB_NO_ACTION,"Copyright 1997, All rights reserved.");
set_lb(NLS - 2,LB_TEXT,LB_NO_ACTION,"Copyright 1997, All rights reserved.");
set_lb(NLS - 1,LB_TEXT,LB_NO_ACTION,version());
overall_mode = MODE_MAIN_SCREEN;
right_sbar->show();
pal_sbar->hide();
@@ -2438,8 +2456,8 @@ void start_town_edit() {
strb << "Editing Town " << cur_town;
set_lb(0,LB_TITLE,LB_NO_ACTION,strb.str());
set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,town->town_name);
set_lb(NLS - 2,LB_TEXT,LB_NO_ACTION,"(Click border to scroll view.)");
set_lb(NLS - 1,LB_TEXT,LB_RETURN,"Back to Main Menu");
set_lb(NLS - 2,LB_TEXT,LB_RETURN,"Back to Main Menu");
set_lb(NLS - 1,LB_TEXT,LB_NO_ACTION,"(Click border to scroll view.)");
overall_mode = MODE_DRAWING;
editing_town = true;
set_up_terrain_buttons(true);
@@ -2468,8 +2486,8 @@ void start_out_edit() {
strb << "Editing outdoors (" << cur_out.x << ',' << cur_out.y << ")";
set_lb(0,LB_TITLE,LB_NO_ACTION,strb.str());
set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,current_terrain->out_name);
set_lb(NLS - 2,LB_TEXT,LB_NO_ACTION,"(Click border to scroll view.)");
set_lb(NLS - 1,LB_TEXT,LB_RETURN,"Back to Main Menu");
set_lb(NLS - 2,LB_TEXT,LB_RETURN,"Back to Main Menu");
set_lb(NLS - 1,LB_TEXT,LB_NO_ACTION,"(Click border to scroll view.)");
overall_mode = MODE_DRAWING;
draw_mode = DRAW_TERRAIN;
editing_town = false;

View File

@@ -12,7 +12,7 @@
#define NUM_DLOG_B 53
#define NLS 25
#define NLS 26
// number of left slots for buttons
#define NRS right_button_status.size()
// number of right slots for scrolling list

7
src/tools/gitrev.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
REVID=`/opt/local/bin/git rev-parse HEAD`;
export FULLTAG=`/opt/local/bin/git tag --sort=v:refname | tail -n1`;
TAGREV=`/opt/local/bin/git rev-parse $FULLTAG`;
echo -e "\n#define GIT_REVISION \"${REVID:0:7}\"\n#define GIT_TAG \"$FULLTAG\"\n#define GIT_TAG_REVISION \"${TAGREV:0:7}\"\n" > tools/gitrev.hpp