Add MAJOR.MINOR.PATCH versioning to the binary.

This also modified the output format for the gamestatefile so AI's will have to be updated
This commit is contained in:
mdiluzio 2014-12-20 16:14:35 +00:00
parent ec7ed601a3
commit fec9c8dad7
6 changed files with 43 additions and 8 deletions

View file

@ -8,8 +8,8 @@ include_directories(
../game
)
# Add the sources
set( SOURCES
# Add the sources
set( SOURCES
main.cpp
)
@ -22,8 +22,8 @@ target_link_libraries( ${PROJECT_NAME} game )
install( TARGETS ${PROJECT_NAME} DESTINATION bin )
# Run the gen_usage script to generate our usage header
add_custom_target(
add_custom_target(
gen_ttrts_usage
cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_SOURCE_DIR}/scripts/gen_usage.sh "${CMAKE_CURRENT_BINARY_DIR}/usage.h"
)
add_dependencies(${PROJECT_NAME} gen_ttrts_usage)
add_dependencies(${PROJECT_NAME} gen_ttrts_usage)

View file

@ -29,18 +29,20 @@
## OPTIONS
MAPFILE - File to read in the initial game state from
-------------------------------------------------------------------------------
--------------------------------------------------------------
## GAMESTATE FILE FORMAT
### Name
Turn_{TURN_NUMBER}.txt
### Contents
===== {GAME_NAME} =====
===== ttrts v{MAJOR}.{MINOR}.{PATCH} =====
NAME:{GAMENAME}
SIZE:[{X},{Y}]
TURN:{TURN_NUMBER}
... {any extra properties could go here}
~~~~
UNIT:{ID} tm:{TEAM} vs:{VIS} dr:{DIR(NESW)} ps:[{X},{Y}]
...
... {continue for all units}
## ORDER FILE FORMAT
### Name

View file

@ -6,6 +6,7 @@
#include <stdio.h>
#include "game.h"
#include "version.h"
static const char* sk_usage =
#include "usage.h"
@ -40,6 +41,13 @@ bool OutputGameStateFile(CTTRTSGame &game, std::string &gameDir)
// Output the turn description
std::string turnDescriptor = game.GetStateAsString();
// Append the version number
turnDescriptor = std::string("==== ttrts v")
+ sk_ttrts_version_string
+ std::string(" ====")
+ turnDescriptor;
turnFile<<turnDescriptor;
turnFile.close();

9
source/ttrts/version.h Normal file
View file

@ -0,0 +1,9 @@
#ifndef _TTRTS_VERSION_H_
#define _TTRTS_VERSION_H_
static const int sk_ttrts_version_major = TTRTS_VERSION_MAJOR;
static const int sk_ttrts_version_minor = TTRTS_VERSION_MINOR;
static const int sk_ttrts_version_patch = TTRTS_VERSION_PATCH;
static const char* sk_ttrts_version_string = TTRTS_VERSION_STRING;
#endif //_TTRTS_VERSION_H_