forked from github/server
new version numbering in version.h
eliminate buildno.h TODO: update build scripts
This commit is contained in:
parent
c352ab9f8e
commit
e200952e87
|
@ -1,3 +0,0 @@
|
|||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 10
|
||||
#define VERSION_BUILD 0
|
|
@ -9,6 +9,7 @@ without prior permission by the authors of Eressea.
|
|||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/version.h>
|
||||
#include "buildno.h"
|
||||
#include "creport.h"
|
||||
#include "seen.h"
|
||||
|
@ -1515,7 +1516,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset)
|
|||
fprintf(F, "%d;Basis\n", 36);
|
||||
fprintf(F, "%d;Runde\n", turn);
|
||||
fprintf(F, "%d;Zeitalter\n", era);
|
||||
fprintf(F, "\"%d.%d.%d\";Build\n", VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
|
||||
fprintf(F, "\"%s\";Build\n", ERESSEA_VERSION);
|
||||
if (mailto != NULL) {
|
||||
fprintf(F, "\"%s\";mailto\n", mailto);
|
||||
fprintf(F, "\"%s\";mailcmd\n", LOC(f->locale, "mailcmd"));
|
||||
|
|
|
@ -18,6 +18,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/version.h>
|
||||
#include "save.h"
|
||||
|
||||
#include <buildno.h>
|
||||
|
@ -1859,6 +1860,12 @@ static void clear_npc_orders(faction *f)
|
|||
}
|
||||
}
|
||||
|
||||
int version_no(const char *str) {
|
||||
int maj = 0, min = 0, bld = 0;
|
||||
sscanf(str, "%d.%d.%d", &maj, &min, &bld);
|
||||
return (maj << 16) | (min << 8) | bld;
|
||||
}
|
||||
|
||||
int writegame(const char *filename)
|
||||
{
|
||||
int n;
|
||||
|
@ -1889,7 +1896,7 @@ int writegame(const char *filename)
|
|||
fstream_init(&strm, F);
|
||||
binstore_init(&store, &strm);
|
||||
|
||||
WRITE_INT(&store, VERSION_BUILD);
|
||||
WRITE_INT(&store, version_no(ERESSEA_VERSION));
|
||||
n = write_game(&gdata);
|
||||
binstore_done(&store);
|
||||
fstream_done(&strm);
|
||||
|
|
|
@ -79,6 +79,7 @@ extern "C" {
|
|||
|
||||
int write_game(struct gamedata *data);
|
||||
int read_game(struct gamedata *data);
|
||||
int version_no(const char *str);
|
||||
|
||||
/* test-only functions that give access to internal implementation details (BAD) */
|
||||
void _test_write_password(struct gamedata *data, const struct faction *f);
|
||||
|
|
|
@ -312,6 +312,12 @@ static void test_read_password_external(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_version_no(CuTest *tc) {
|
||||
CuAssertIntEquals(tc, 0, version_no("0.0.0-devel"));
|
||||
CuAssertIntEquals(tc, 0x10000, version_no("1.0.0-test"));
|
||||
CuAssertIntEquals(tc, 0x10203, version_no("1.2.3-what.is.42"));
|
||||
}
|
||||
|
||||
CuSuite *get_save_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
|
@ -324,5 +330,7 @@ CuSuite *get_save_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_readwrite_dead_faction_group);
|
||||
SUITE_ADD_TEST(suite, test_read_password);
|
||||
SUITE_ADD_TEST(suite, test_read_password_external);
|
||||
SUITE_ADD_TEST(suite, test_version_no);
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
|
|
@ -8,5 +8,9 @@
|
|||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef ERESSEA_VERSION
|
||||
// the version number, if it was not passed to make with -D
|
||||
#define ERESSEA_VERSION "3.10.0-devel"
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/log.h>
|
||||
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/version.h>
|
||||
#include <kernel/save.h>
|
||||
#include <util/filereader.h>
|
||||
#include <util/language.h>
|
||||
|
@ -165,8 +166,8 @@ static int parse_args(int argc, char **argv, int *exitcode)
|
|||
if (strcmp(argi + 2, "version") == 0) {
|
||||
printf("\n%s PBEM host\n"
|
||||
"Copyright (C) 1996-2005 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n"
|
||||
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %d.%d.%d\n\n",
|
||||
game_name(), VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
|
||||
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %s\n\n",
|
||||
game_name(), ERESSEA_VERSION);
|
||||
#ifdef USE_CURSES
|
||||
}
|
||||
else if (strcmp(argi + 2, "color") == 0) {
|
||||
|
|
Loading…
Reference in New Issue