diff --git a/.github/workflows/makeobj.yml b/.github/workflows/makeobj.yml index 3a654d325..72e880001 100644 --- a/.github/workflows/makeobj.yml +++ b/.github/workflows/makeobj.yml @@ -19,7 +19,7 @@ jobs: install: base-devel mingw-w64-i686-toolchain mingw-w64-i686-gcc mingw-w64-i686-libpng - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: build shell: msys2 {0} diff --git a/cmake/SimutransRevision.cmake b/cmake/SimutransRevision.cmake index d907625c6..58e076660 100644 --- a/cmake/SimutransRevision.cmake +++ b/cmake/SimutransRevision.cmake @@ -84,6 +84,38 @@ if (SIMUTRANS_WC_REVISION) # reduces needless rebuilds execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different revision.h.txt "${SOURCE_DIR}/src/simutrans/revision.h") + # gather informations to update flatpak and Android creation files + STRING(STRIP ${SIMUTRANS_WC_REVISION} SIMUTRANS_WC_REVISION) + + file(READ "${SOURCE_DIR}/src/simutrans/simversion.h" FILE_CONTENT) + string(REGEX MATCH "#define SIM_VERSION_MAJOR[ ]+([0-9]*)" _ ${FILE_CONTENT}) + set(ver_major ${CMAKE_MATCH_1}) + string(REGEX MATCH "#define SIM_VERSION_MINOR[ ]+([0-9]*)" _ ${FILE_CONTENT}) + set(ver_minor ${CMAKE_MATCH_1}) + string(REGEX MATCH "#define SIM_VERSION_PATCH[ ]+([0-9]*)" _ ${FILE_CONTENT}) + set(ver_patch ${CMAKE_MATCH_1}) + string(REGEX MATCH "#define[ ]+SIM_VERSION_BUILD[ ]+SIM_BUILD_RELEASE[\r\n]+" RELEASE_FLAG ${FILE_CONTENT}) + + string(TIMESTAMP TODAY "%Y-%m-%d") + + # finally, update flatpak xml + file(READ "${SOURCE_DIR}/src/linux/com.simutrans.Simutrans.metainfo.xml" FILE_CONTENT) + if(RELEASE_FLAG STREQUAL "") + string(REGEX REPLACE "" "" FILE_CONTENT "${FILE_CONTENT}" ) + else () + string(REGEX REPLACE "" "" FILE_CONTENT "${FILE_CONTENT}" ) + endif () + file(WRITE "${SOURCE_DIR}/src/linux/com.simutrans.Simutrans.metainfo.xml" "${FILE_CONTENT}") + + # and Android files + file(READ "${SOURCE_DIR}/src/android/AndroidAppSettings.cfg" FILE_CONTENT) + if(RELEASE_FLAG STREQUAL "") + string(REGEX REPLACE "AppVersionName=\"[0-9.]+-[A-z]+[a-z]+\"" "AppVersionName=\"${ver_major}.${ver_minor}.${ver_patch}-Nightly\"" FILE_CONTENT "${FILE_CONTENT}" ) + else () + string(REGEX REPLACE "AppVersionName=\"[0-9.]+-[A-z]+[a-z]+\"" "AppVersionName=\"${ver_major}.${ver_minor}.${ver_patch}-Release\"" FILE_CONTENT "${FILE_CONTENT}" ) + endif () + file(WRITE "${SOURCE_DIR}/src/android/AndroidAppSettings.cfg" "${FILE_CONTENT}") + else () message(WARNING "Could not find revision information because this repository " "is neither a Subversion nor a Git repository. Revision information " diff --git a/revision.h b/revision.h index cde8a5e60..62b0c5467 100644 --- a/revision.h +++ b/revision.h @@ -1 +1 @@ -#define REVISION 11438 +#define REVISION 11440 diff --git a/src/simutrans/revision.h b/src/simutrans/revision.h index cde8a5e60..62b0c5467 100644 --- a/src/simutrans/revision.h +++ b/src/simutrans/revision.h @@ -1 +1 @@ -#define REVISION 11438 +#define REVISION 11440 diff --git a/tests/tests/test_city.nut b/tests/tests/test_city.nut index d04b8ac3b..37f72f160 100644 --- a/tests/tests/test_city.nut +++ b/tests/tests/test_city.nut @@ -29,12 +29,17 @@ function test_city_add_by_public_player() ASSERT_EQUAL(command_x(tool_add_city).work(player_x(1), coord3d(7, 8, 0)), null) ASSERT_TRUE(tile_x(7, 8, 0).find_object(mo_building) != null) + ASSERT_TRUE(tile_x(6, 9, 0).get_way(wt_road) != null) ASSERT_TRUE(tile_x(7, 9, 0).get_way(wt_road) != null) + ASSERT_TRUE(tile_x(8, 9, 0).get_way(wt_road) != null) } // clean up ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(7, 8, 0)), null) + // street + ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(6, 9, 0)), null) ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(7, 9, 0)), null) + ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(8, 9, 0)), null) RESET_ALL_PLAYER_FUNDS() } @@ -49,7 +54,10 @@ function test_city_add_on_existing_townhall() // clean up ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(7, 8, 0)), null) + // street + ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(6, 9, 0)), null) ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(7, 9, 0)), null) + ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(8, 9, 0)), null) RESET_ALL_PLAYER_FUNDS() } @@ -61,11 +69,14 @@ function test_city_add_near_map_border() ASSERT_TRUE(tile_x(0, 14, 0).find_object(mo_building) != null) ASSERT_TRUE(tile_x(0, 15, 0).get_way(wt_road) != null) + ASSERT_TRUE(tile_x(1, 15, 0).get_way(wt_road) != null) } // clean up ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(0, 14, 0)), null) + // street ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(0, 15, 0)), null) + ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(1, 15, 0)), null) RESET_ALL_PLAYER_FUNDS() } @@ -143,6 +154,10 @@ function test_city_change_size_to_minimum() // clean up ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(1, 1, 0)), null) + // street + ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(0, 2, 0)), null) ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(1, 2, 0)), null) + ASSERT_EQUAL(command_x(tool_remover).work(player_x(1), coord3d(2, 2, 0)), null) + RESET_ALL_PLAYER_FUNDS() }