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:
parent
ec7ed601a3
commit
fec9c8dad7
6 changed files with 43 additions and 8 deletions
|
@ -1,5 +1,11 @@
|
||||||
cmake_minimum_required( VERSION 2.8.7 )
|
cmake_minimum_required( VERSION 2.8.7 )
|
||||||
|
|
||||||
|
# Set version information
|
||||||
|
set( TTRTS_VERSION_MAJOR 0 )
|
||||||
|
set( TTRTS_VERSION_MINOR 0 )
|
||||||
|
set( TTRTS_VERSION_PATCH 1 )
|
||||||
|
set( TTRTS_VERSION_STRING "${TTRTS_VERSION_MAJOR}.${TTRTS_VERSION_MINOR}.${TTRTS_VERSION_PATCH}")
|
||||||
|
|
||||||
# Use c++1y (14)
|
# Use c++1y (14)
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++1y" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++1y" )
|
||||||
|
|
||||||
|
@ -9,10 +15,20 @@ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-reorder" )
|
||||||
# Turn off reorder warnings as they're kind of irrelevant
|
# Turn off reorder warnings as they're kind of irrelevant
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder" )
|
||||||
|
|
||||||
|
# This shouldn't be needed, but it looks like IDE's like clion can forget to set -g for Debug
|
||||||
if( CMAKE_BUILD_TYPE MATCHES "Debug" )
|
if( CMAKE_BUILD_TYPE MATCHES "Debug" )
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Add definitions for the version number
|
||||||
|
add_definitions(
|
||||||
|
-DTTRTS_VERSION_MAJOR=${TTRTS_VERSION_MAJOR}
|
||||||
|
-DTTRTS_VERSION_MINOR=${TTRTS_VERSION_MINOR}
|
||||||
|
-DTTRTS_VERSION_PATCH=${TTRTS_VERSION_PATCH}
|
||||||
|
-DTTRTS_VERSION_STRING=\"${DTTRTS_VERSION_STRING}\"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Subprojects
|
# Subprojects
|
||||||
add_subdirectory( ttrts )
|
add_subdirectory( ttrts )
|
||||||
add_subdirectory( game )
|
add_subdirectory( game )
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "gametypes.h"
|
#include "gametypes.h"
|
||||||
#include "order.h"
|
#include "order.h"
|
||||||
|
|
||||||
#define GAME_HEADER_FORMATTER "===== %s =====\nSIZE:[%u,%u]\nTURN:%u"
|
#define GAME_HEADER_FORMATTER "NAME:%s\nSIZE:[%u,%u]\nTURN:%u"
|
||||||
#define GAME_HEADER_DELIMITER "~~~~\n"
|
#define GAME_HEADER_DELIMITER "~~~~\n"
|
||||||
|
|
||||||
// Type for order and unit pairs
|
// Type for order and unit pairs
|
||||||
|
|
|
@ -29,18 +29,20 @@
|
||||||
## OPTIONS
|
## OPTIONS
|
||||||
MAPFILE - File to read in the initial game state from
|
MAPFILE - File to read in the initial game state from
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
## GAMESTATE FILE FORMAT
|
## GAMESTATE FILE FORMAT
|
||||||
### Name
|
### Name
|
||||||
Turn_{TURN_NUMBER}.txt
|
Turn_{TURN_NUMBER}.txt
|
||||||
### Contents
|
### Contents
|
||||||
===== {GAME_NAME} =====
|
===== ttrts v{MAJOR}.{MINOR}.{PATCH} =====
|
||||||
|
NAME:{GAMENAME}
|
||||||
SIZE:[{X},{Y}]
|
SIZE:[{X},{Y}]
|
||||||
TURN:{TURN_NUMBER}
|
TURN:{TURN_NUMBER}
|
||||||
|
... {any extra properties could go here}
|
||||||
~~~~
|
~~~~
|
||||||
UNIT:{ID} tm:{TEAM} vs:{VIS} dr:{DIR(NESW)} ps:[{X},{Y}]
|
UNIT:{ID} tm:{TEAM} vs:{VIS} dr:{DIR(NESW)} ps:[{X},{Y}]
|
||||||
...
|
... {continue for all units}
|
||||||
|
|
||||||
## ORDER FILE FORMAT
|
## ORDER FILE FORMAT
|
||||||
### Name
|
### Name
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
static const char* sk_usage =
|
static const char* sk_usage =
|
||||||
#include "usage.h"
|
#include "usage.h"
|
||||||
|
@ -40,6 +41,13 @@ bool OutputGameStateFile(CTTRTSGame &game, std::string &gameDir)
|
||||||
|
|
||||||
// Output the turn description
|
// Output the turn description
|
||||||
std::string turnDescriptor = game.GetStateAsString();
|
std::string turnDescriptor = game.GetStateAsString();
|
||||||
|
|
||||||
|
// Append the version number
|
||||||
|
turnDescriptor = std::string("==== ttrts v")
|
||||||
|
+ sk_ttrts_version_string
|
||||||
|
+ std::string(" ====")
|
||||||
|
+ turnDescriptor;
|
||||||
|
|
||||||
turnFile<<turnDescriptor;
|
turnFile<<turnDescriptor;
|
||||||
turnFile.close();
|
turnFile.close();
|
||||||
|
|
||||||
|
|
9
source/ttrts/version.h
Normal file
9
source/ttrts/version.h
Normal 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_
|
Loading…
Add table
Reference in a new issue