diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index a6b4f5df8d..0000000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,132 +0,0 @@ -include_directories(.) - -if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") -endif() - -function(except_file var excluded_file) - set(list_var "") - foreach(f ${ARGN}) - if(NOT ${f} MATCHES ".*${excluded_file}") - list(APPEND list_var ${f}) - endif() - endforeach(f) - set(${var} "${list_var}" PARENT_SCOPE) -endfunction(except_file) - -# Replace some source files with stubs -except_file(TEST_CORE_FILES "core/image.c" ${CORE_FILES}) -except_file(TEST_CORE_FILES "core/lang.c" ${TEST_CORE_FILES}) -except_file(TEST_CORE_FILES "core/speed.c" ${TEST_CORE_FILES}) -except_file(TEST_BUILDING_FILES "building/model.c" ${BUILDING_FILES}) - -add_executable(translationcheck - translation/check.c - stub/log.c - ${PROJECT_SOURCE_DIR}/src/core/encoding.c - ${PROJECT_SOURCE_DIR}/src/core/encoding_japanese.c - ${PROJECT_SOURCE_DIR}/src/core/encoding_korean.c - ${PROJECT_SOURCE_DIR}/src/core/encoding_simp_chinese.c - ${PROJECT_SOURCE_DIR}/src/core/encoding_trad_chinese.c - ${PROJECT_SOURCE_DIR}/src/core/string.c - ${TRANSLATION_FILES} -) - -add_executable(compare - sav/compare.c - sav/sav_compare.c - stub/log.c - ${PROJECT_SOURCE_DIR}/src/core/zip.c -) - -add_executable(autopilot - sav/sav_compare.c - sav/run.c - stub/image.c - stub/input.c - stub/lang.c - stub/log.c - stub/model.c - stub/sound_device.c - stub/ui.c - stub/video.c - ${PROJECT_SOURCE_DIR}/src/platform/file_manager.c - ${TEST_CORE_FILES} - ${TEST_BUILDING_FILES} - ${CITY_FILES} - ${EMPIRE_FILES} - ${FIGURE_FILES} - ${FIGURETYPE_FILES} - ${GAME_FILES} - ${MAP_FILES} - ${SCENARIO_FILES} - ${SOUND_FILES} - ${EDITOR_FILES} -) - -file(COPY data/c3.emp DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY data/c32.emp DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - -function(add_integration_test name input_sav compare_sav ticks) - string(REPLACE ".sav" "-actual.sav" output_sav ${compare_sav}) - file(COPY data/${input_sav} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY data/${compare_sav} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - add_test(NAME ${name} COMMAND autopilot ${input_sav} ${output_sav} ${compare_sav} ${ticks}) -endfunction(add_integration_test) - -add_integration_test(sav_tower tower.sav tower2.sav 1785) -add_integration_test(sav_request1 request_start.sav request_orig.sav 908) -add_integration_test(sav_request2 request_start.sav request_orig2.sav 6556) - -# Caesar invasion plus ballista -add_integration_test(sav_caesar1 kknight.sav kknight2.sav 686) -add_integration_test(sav_caesar2 kknight.sav kknight3.sav 1087) -add_integration_test(sav_caesar3 kknight.sav kknight4.sav 1287) -add_integration_test(sav_caesar4 kknight.sav kknight5.sav 1494) - -# Invasion -add_integration_test(sav_invasion1 inv0.sav inv1.sav 1973) -add_integration_test(sav_invasion2 inv0.sav inv2.sav 3521) -add_integration_test(sav_invasion3 inv0.sav inv3.sav 5105) -add_integration_test(sav_invasion4 inv0.sav inv4.sav 6777) -add_integration_test(sav_invasion5 inv0.sav inv5.sav 8563) - -# Distant battle -add_integration_test(sav_distantbattle1 db-fort1.sav db-fort1-done.sav 6328) -add_integration_test(sav_distantbattle2 db-fort2.sav db-fort2-done.sav 6335) -add_integration_test(sav_distantbattle3 db-fort2.sav db-fort2-done2.sav 11197) - -# Routing table full kills figures -add_integration_test(sav_routing_full routing-full.sav routing-full-kill.sav 7) - -# God curses -add_integration_test(sav_curses1 curses.sav curses-done.sav 13350) -add_integration_test(sav_curses2 mars-wrath.sav mars-wrath-after.sav 1016) - -# Earthquake destroying buildings -add_integration_test(sav_earthquake0 earthquake.sav earthquake-start.sav 371) -add_integration_test(sav_earthquake1 earthquake.sav earthquake-during1.sav 551) -add_integration_test(sav_earthquake2 earthquake.sav earthquake-during2.sav 1071) -add_integration_test(sav_earthquake3 earthquake.sav earthquake-during3.sav 1602) -add_integration_test(sav_earthquake4 earthquake.sav earthquake-during4.sav 2155) -add_integration_test(sav_earthquake5 earthquake.sav earthquake-after.sav 3748) - -# Testing map with tile offsets >127 -add_integration_test(sav_edge1 edge-start.sav edge-battle-before.sav 835) -add_integration_test(sav_edge2 edge-start.sav edge-battle-start.sav 1278) -add_integration_test(sav_edge3 edge-start.sav edge-battle-during.sav 1513) -add_integration_test(sav_edge4 edge-start.sav edge-battle-after.sav 1890) - -# Test with bigger cities -add_integration_test(sav_massilia1 brugle-massilia-start.sav brugle-massilia-1.sav 4) -add_integration_test(sav_massilia2 brugle-massilia-start.sav brugle-massilia-2.sav 57) -add_integration_test(sav_massilia3 brugle-massilia-start.sav brugle-massilia-3.sav 391) - -add_integration_test(sav_valentia1 valentia57.sav valentia57-after.sav 1026) -add_integration_test(sav_lugdunum1 brugle-lugdunum.sav brugle-lugdunum-after.sav 1176) - -add_integration_test(sav_native1 brugle-lugdunum-native.sav brugle-lugdunum-native-after.sav 1678) -add_integration_test(sav_native2 cicero-lugdunum-trade.sav cicero-lugdunum-trade-after.sav 926) - -add_integration_test(sav_palace1 brugle-palacepeaks.sav brugle-palacepeaks-2.sav 2562) diff --git a/test/data/brugle-lugdunum-after.sav b/test/data/brugle-lugdunum-after.sav deleted file mode 100644 index 5a75cf89c0..0000000000 Binary files a/test/data/brugle-lugdunum-after.sav and /dev/null differ diff --git a/test/data/brugle-lugdunum-native-after.sav b/test/data/brugle-lugdunum-native-after.sav deleted file mode 100644 index af889a141b..0000000000 Binary files a/test/data/brugle-lugdunum-native-after.sav and /dev/null differ diff --git a/test/data/brugle-lugdunum-native.sav b/test/data/brugle-lugdunum-native.sav deleted file mode 100644 index 5f43242a2e..0000000000 Binary files a/test/data/brugle-lugdunum-native.sav and /dev/null differ diff --git a/test/data/brugle-lugdunum.sav b/test/data/brugle-lugdunum.sav deleted file mode 100644 index 41b421ee10..0000000000 Binary files a/test/data/brugle-lugdunum.sav and /dev/null differ diff --git a/test/data/brugle-massilia-1.sav b/test/data/brugle-massilia-1.sav deleted file mode 100644 index 82f1cb9a5b..0000000000 Binary files a/test/data/brugle-massilia-1.sav and /dev/null differ diff --git a/test/data/brugle-massilia-2.sav b/test/data/brugle-massilia-2.sav deleted file mode 100644 index a95d1e0040..0000000000 Binary files a/test/data/brugle-massilia-2.sav and /dev/null differ diff --git a/test/data/brugle-massilia-3.sav b/test/data/brugle-massilia-3.sav deleted file mode 100644 index f37996d2a6..0000000000 Binary files a/test/data/brugle-massilia-3.sav and /dev/null differ diff --git a/test/data/brugle-massilia-start.sav b/test/data/brugle-massilia-start.sav deleted file mode 100644 index 5f1b83aa55..0000000000 Binary files a/test/data/brugle-massilia-start.sav and /dev/null differ diff --git a/test/data/brugle-palacepeaks-2.sav b/test/data/brugle-palacepeaks-2.sav deleted file mode 100644 index f7a83a68c9..0000000000 Binary files a/test/data/brugle-palacepeaks-2.sav and /dev/null differ diff --git a/test/data/brugle-palacepeaks.sav b/test/data/brugle-palacepeaks.sav deleted file mode 100644 index 688dd20f21..0000000000 Binary files a/test/data/brugle-palacepeaks.sav and /dev/null differ diff --git a/test/data/c3.emp b/test/data/c3.emp deleted file mode 100644 index 33e7dc94c0..0000000000 Binary files a/test/data/c3.emp and /dev/null differ diff --git a/test/data/c32.emp b/test/data/c32.emp deleted file mode 100644 index 7a341a5bdc..0000000000 Binary files a/test/data/c32.emp and /dev/null differ diff --git a/test/data/cicero-lugdunum-trade-after.sav b/test/data/cicero-lugdunum-trade-after.sav deleted file mode 100644 index a0ddbd8b63..0000000000 Binary files a/test/data/cicero-lugdunum-trade-after.sav and /dev/null differ diff --git a/test/data/cicero-lugdunum-trade.sav b/test/data/cicero-lugdunum-trade.sav deleted file mode 100644 index 300dbd5302..0000000000 Binary files a/test/data/cicero-lugdunum-trade.sav and /dev/null differ diff --git a/test/data/curses-done.sav b/test/data/curses-done.sav deleted file mode 100644 index c031ea21a0..0000000000 Binary files a/test/data/curses-done.sav and /dev/null differ diff --git a/test/data/curses.sav b/test/data/curses.sav deleted file mode 100644 index b051d6a303..0000000000 Binary files a/test/data/curses.sav and /dev/null differ diff --git a/test/data/db-fort1-done.sav b/test/data/db-fort1-done.sav deleted file mode 100644 index fa4832a6a2..0000000000 Binary files a/test/data/db-fort1-done.sav and /dev/null differ diff --git a/test/data/db-fort1.sav b/test/data/db-fort1.sav deleted file mode 100644 index 93b84a344f..0000000000 Binary files a/test/data/db-fort1.sav and /dev/null differ diff --git a/test/data/db-fort2-done.sav b/test/data/db-fort2-done.sav deleted file mode 100644 index a6a7cbaacf..0000000000 Binary files a/test/data/db-fort2-done.sav and /dev/null differ diff --git a/test/data/db-fort2-done2.sav b/test/data/db-fort2-done2.sav deleted file mode 100644 index 2d30f200d4..0000000000 Binary files a/test/data/db-fort2-done2.sav and /dev/null differ diff --git a/test/data/db-fort2.sav b/test/data/db-fort2.sav deleted file mode 100644 index 8b9b611781..0000000000 Binary files a/test/data/db-fort2.sav and /dev/null differ diff --git a/test/data/earthquake-after.sav b/test/data/earthquake-after.sav deleted file mode 100644 index d145c83862..0000000000 Binary files a/test/data/earthquake-after.sav and /dev/null differ diff --git a/test/data/earthquake-during1.sav b/test/data/earthquake-during1.sav deleted file mode 100644 index 65055e6fc8..0000000000 Binary files a/test/data/earthquake-during1.sav and /dev/null differ diff --git a/test/data/earthquake-during2.sav b/test/data/earthquake-during2.sav deleted file mode 100644 index 11fb50711e..0000000000 Binary files a/test/data/earthquake-during2.sav and /dev/null differ diff --git a/test/data/earthquake-during3.sav b/test/data/earthquake-during3.sav deleted file mode 100644 index 57f0fbbe12..0000000000 Binary files a/test/data/earthquake-during3.sav and /dev/null differ diff --git a/test/data/earthquake-during4.sav b/test/data/earthquake-during4.sav deleted file mode 100644 index b9475258d7..0000000000 Binary files a/test/data/earthquake-during4.sav and /dev/null differ diff --git a/test/data/earthquake-start.sav b/test/data/earthquake-start.sav deleted file mode 100644 index 617ab3b205..0000000000 Binary files a/test/data/earthquake-start.sav and /dev/null differ diff --git a/test/data/earthquake.sav b/test/data/earthquake.sav deleted file mode 100644 index a849a15750..0000000000 Binary files a/test/data/earthquake.sav and /dev/null differ diff --git a/test/data/edge-battle-after.sav b/test/data/edge-battle-after.sav deleted file mode 100644 index 85fb257c9e..0000000000 Binary files a/test/data/edge-battle-after.sav and /dev/null differ diff --git a/test/data/edge-battle-before.sav b/test/data/edge-battle-before.sav deleted file mode 100644 index be68707a32..0000000000 Binary files a/test/data/edge-battle-before.sav and /dev/null differ diff --git a/test/data/edge-battle-during.sav b/test/data/edge-battle-during.sav deleted file mode 100644 index 58a1675ec5..0000000000 Binary files a/test/data/edge-battle-during.sav and /dev/null differ diff --git a/test/data/edge-battle-start.sav b/test/data/edge-battle-start.sav deleted file mode 100644 index 68d4798971..0000000000 Binary files a/test/data/edge-battle-start.sav and /dev/null differ diff --git a/test/data/edge-start.sav b/test/data/edge-start.sav deleted file mode 100644 index dd474083b7..0000000000 Binary files a/test/data/edge-start.sav and /dev/null differ diff --git a/test/data/inv0.sav b/test/data/inv0.sav deleted file mode 100644 index 05802d2839..0000000000 Binary files a/test/data/inv0.sav and /dev/null differ diff --git a/test/data/inv1.sav b/test/data/inv1.sav deleted file mode 100644 index 2eb6f4a73c..0000000000 Binary files a/test/data/inv1.sav and /dev/null differ diff --git a/test/data/inv2.sav b/test/data/inv2.sav deleted file mode 100644 index b14a448a88..0000000000 Binary files a/test/data/inv2.sav and /dev/null differ diff --git a/test/data/inv3.sav b/test/data/inv3.sav deleted file mode 100644 index 5d007f8569..0000000000 Binary files a/test/data/inv3.sav and /dev/null differ diff --git a/test/data/inv4.sav b/test/data/inv4.sav deleted file mode 100644 index a06815b741..0000000000 Binary files a/test/data/inv4.sav and /dev/null differ diff --git a/test/data/inv5.sav b/test/data/inv5.sav deleted file mode 100644 index 91eafc4852..0000000000 Binary files a/test/data/inv5.sav and /dev/null differ diff --git a/test/data/kknight.sav b/test/data/kknight.sav deleted file mode 100644 index 3349435879..0000000000 Binary files a/test/data/kknight.sav and /dev/null differ diff --git a/test/data/kknight2.sav b/test/data/kknight2.sav deleted file mode 100644 index e8fd32dbfd..0000000000 Binary files a/test/data/kknight2.sav and /dev/null differ diff --git a/test/data/kknight3.sav b/test/data/kknight3.sav deleted file mode 100644 index 84abc29dd4..0000000000 Binary files a/test/data/kknight3.sav and /dev/null differ diff --git a/test/data/kknight4.sav b/test/data/kknight4.sav deleted file mode 100644 index 9891b712d4..0000000000 Binary files a/test/data/kknight4.sav and /dev/null differ diff --git a/test/data/kknight5.sav b/test/data/kknight5.sav deleted file mode 100644 index 197d3c6405..0000000000 Binary files a/test/data/kknight5.sav and /dev/null differ diff --git a/test/data/mars-wrath-after.sav b/test/data/mars-wrath-after.sav deleted file mode 100644 index bde9901c70..0000000000 Binary files a/test/data/mars-wrath-after.sav and /dev/null differ diff --git a/test/data/mars-wrath.sav b/test/data/mars-wrath.sav deleted file mode 100644 index ce7b318a21..0000000000 Binary files a/test/data/mars-wrath.sav and /dev/null differ diff --git a/test/data/request_orig.sav b/test/data/request_orig.sav deleted file mode 100644 index 5e3f6dc438..0000000000 Binary files a/test/data/request_orig.sav and /dev/null differ diff --git a/test/data/request_orig2.sav b/test/data/request_orig2.sav deleted file mode 100644 index 2bccda8557..0000000000 Binary files a/test/data/request_orig2.sav and /dev/null differ diff --git a/test/data/request_start.sav b/test/data/request_start.sav deleted file mode 100644 index b985ae4472..0000000000 Binary files a/test/data/request_start.sav and /dev/null differ diff --git a/test/data/routing-full-kill.sav b/test/data/routing-full-kill.sav deleted file mode 100644 index f0451a268b..0000000000 Binary files a/test/data/routing-full-kill.sav and /dev/null differ diff --git a/test/data/routing-full.sav b/test/data/routing-full.sav deleted file mode 100644 index 6fcf511b4d..0000000000 Binary files a/test/data/routing-full.sav and /dev/null differ diff --git a/test/data/tower.sav b/test/data/tower.sav deleted file mode 100644 index 4f18331c8f..0000000000 Binary files a/test/data/tower.sav and /dev/null differ diff --git a/test/data/tower2.sav b/test/data/tower2.sav deleted file mode 100644 index 8b78af9c59..0000000000 Binary files a/test/data/tower2.sav and /dev/null differ diff --git a/test/data/valentia57-after.sav b/test/data/valentia57-after.sav deleted file mode 100644 index 956cc53944..0000000000 Binary files a/test/data/valentia57-after.sav and /dev/null differ diff --git a/test/data/valentia57.sav b/test/data/valentia57.sav deleted file mode 100644 index 930be59342..0000000000 Binary files a/test/data/valentia57.sav and /dev/null differ diff --git a/test/sav/compare.c b/test/sav/compare.c deleted file mode 100644 index bb9d013381..0000000000 --- a/test/sav/compare.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "sav_compare.h" - -#include - -int main(int argc, char **argv) -{ - if (argc != 3) { - printf("Usage: %s FILE1 FILE2\n", argv[0]); - return 1; - } - return compare_files(argv[1], argv[2]); -} diff --git a/test/sav/run.c b/test/sav/run.c deleted file mode 100644 index 857b2db3a6..0000000000 --- a/test/sav/run.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "core/backtrace.h" -#include "core/time.h" -#include "game/file.h" -#include "game/game.h" -#include "game/settings.h" - -#ifdef _MSC_VER -#include -#define chdir _chdir -#define getcwd _getcwd -#elif !defined(__vita__) -#include -#endif - -#include -#include -#include -#include "sav_compare.h" - -static void handler(int sig) -{ - fprintf(stderr, "Oops, crashed with signal %d :(", sig); - backtrace_print(); - exit(1); -} - -static void run_ticks(int ticks) -{ - setting_reset_speeds(500, setting_scroll_speed()); - time_set_millis(0); - for (int i = 1; i <= ticks; i++) { - time_set_millis(2 * i); - game_run(); - } -} - -static int run_autopilot(const char *input_saved_game, const char *output_saved_game, int ticks_to_run) -{ - printf("Running autopilot: %s --> %s in %d ticks\n", input_saved_game, output_saved_game, ticks_to_run); - signal(SIGSEGV, handler); - - if (!game_pre_init()) { - printf("Unable to run Game_preInit\n"); - return 1; - } - - if (!game_init()) { - printf("Unable to run Game_init\n"); - return 2; - } - - if (!game_file_load_saved_game(input_saved_game)) { - char wd[500]; - if (getcwd(wd, 500)) { - printf("Unable to load saved game from %s\n", wd); - } else { - printf("Unable to load saved game\n"); - } - return 3; - } - run_ticks(ticks_to_run); - printf("Saving game to %s\n", output_saved_game); - game_file_write_saved_game(output_saved_game); - printf("Done\n"); - - game_exit(); - - return 0; -} - -int main(int argc, char **argv) -{ - if (argc != 5) { - printf("Incorrect number of arguments (%d)\n", argc); - return -1; - } - const char *input = argv[1]; - const char *output = argv[2]; - const char *expected = argv[3]; - int ticks = atoi(argv[4]); - if (run_autopilot(input, output, ticks) == 0) { - return compare_files(expected, output); - } else { - return 1; - } -} diff --git a/test/sav/sav_compare.c b/test/sav/sav_compare.c deleted file mode 100644 index 43546bedc8..0000000000 --- a/test/sav/sav_compare.c +++ /dev/null @@ -1,591 +0,0 @@ -#include "sav_compare.h" - -#include "../src/core/zip.h" -#include "../src/figure/type.h" -#include "../src/map/grid.h" - -#include -#include - -#define COMPRESS_BUFFER_SIZE 600000 -#define UNCOMPRESSED 0x80000000 - -struct game_file_part { - int compressed; - int length_in_bytes; - char name[100]; - int record_length; -}; - -static struct game_file_part save_game_parts[] = { - {0, 4, "scenario_campaign_mission"}, - {0, 4, "file_version"}, - {1, 52488, "image_grid", 2}, - {1, 26244, "edge_grid"}, - {1, 52488, "building_grid", 2}, - {1, 52488, "terrain_grid", 2}, - {1, 26244, "aqueduct_grid"}, - {1, 52488, "figure_grid", 2}, - {1, 26244, "bitfields_grid"}, - {1, 26244, "sprite_grid"}, - {0, 26244, "random_grid"}, - {1, 26244, "desirability_grid"}, - {1, 26244, "elevation_grid"}, - {1, 26244, "building_damage_grid"}, - {1, 26244, "aqueduct_backup_grid"}, - {1, 26244, "sprite_backup_grid"}, - {1, 128000, "figures", 128}, - {1, 1200, "route_figures", 2}, - {1, 300000, "route_paths", 500}, - {1, 6400, "formations", 128}, - {0, 12, "formation_totals"}, - {1, 36136, "city_data", 17908}, - {0, 2, "city_faction_unknown"}, - {0, 64, "player_name"}, - {0, 4, "city_faction"}, - {1, 256000, "buildings", 128}, - {0, 4, "city_view_orientation"}, - {0, 4, "game_time.tick"}, - {0, 4, "game_time.day"}, - {0, 4, "game_time.month"}, - {0, 4, "game_time.year"}, - {0, 4, "game_time.total_days"}, - {0, 8, "building_extra_highest_id_ever"}, - {0, 8, "random_iv"}, - {0, 8, "camera"}, - {0, 4, "building_count.theater.total"}, - {0, 4, "building_count.theater.working"}, - {0, 4, "building_count.amphitheater.total"}, - {0, 4, "building_count.amphitheater.working"}, - {0, 4, "building_count.colosseum.total"}, - {0, 4, "building_count.colosseum.working"}, - {0, 4, "building_count.hippodrome.total"}, - {0, 4, "building_count.hippodrome.working"}, - {0, 4, "building_count.school.total"}, - {0, 4, "building_count.school.working"}, - {0, 4, "building_count.library.total"}, - {0, 4, "building_count.library.working"}, - {0, 4, "building_count.academy.total"}, - {0, 4, "building_count.academy.working"}, - {0, 4, "building_count.barber.total"}, - {0, 4, "building_count.barber.working"}, - {0, 4, "building_count.bathhouse.total"}, - {0, 4, "building_count.bathhouse.working"}, - {0, 4, "building_count.clinic.total"}, - {0, 4, "building_count.clinic.working"}, - {0, 4, "building_count.hospital.total"}, - {0, 4, "building_count.hospital.working"}, - {0, 4, "building_count.smallTempleCeres.total"}, - {0, 4, "building_count.smallTempleNeptune.total"}, - {0, 4, "building_count.smallTempleMercury.total"}, - {0, 4, "building_count.smallTempleMars.total"}, - {0, 4, "building_count.smallTempleVenus.total"}, - {0, 4, "building_count.largeTempleCeres.total"}, - {0, 4, "building_count.largeTempleNeptune.total"}, - {0, 4, "building_count.largeTempleMercury.total"}, - {0, 4, "building_count.largeTempleMars.total"}, - {0, 4, "building_count.largeTempleVenus.total"}, - {0, 4, "building_count.oracle.total"}, - {0, 8, "city_graph_order"}, - {0, 8, "emperor_change_time"}, - {0, 4, "empire.scroll_x"}, - {0, 4, "empire.scroll_y"}, - {0, 4, "empire.selected_object"}, - {1, 2706, "empire_cities"}, - {0, 64, "building_count_industry.total"}, - {0, 64, "building_count_industry.active"}, - {0, 128, "trade_prices"}, - {0, 4, "figure_names.citizen_male"}, - {0, 4, "figure_names.patrician"}, - {0, 4, "figure_names.citizen_female"}, - {0, 4, "figure_names.tax_collector"}, - {0, 4, "figure_names.engineer"}, - {0, 4, "figure_names.prefect"}, - {0, 4, "figure_names.javelin_thrower"}, - {0, 4, "figure_names.cavalry"}, - {0, 4, "figure_names.legionary"}, - {0, 4, "figure_names.actor"}, - {0, 4, "figure_names.gladiator"}, - {0, 4, "figure_names.lion_tamer"}, - {0, 4, "figure_names.charioteer"}, - {0, 4, "figure_names.barbarian"}, - {0, 4, "figure_names.enemy_greek"}, - {0, 4, "figure_names.enemy_egyptian"}, - {0, 4, "figure_names.enemy_arabian"}, - {0, 4, "figure_names.trader"}, - {0, 4, "figure_names.ship"}, - {0, 4, "figure_names.warship"}, - {0, 4, "figure_names.enemy_warship"}, - {0, 4, "culture_coverage.theater"}, - {0, 4, "culture_coverage.amphitheater"}, - {0, 4, "culture_coverage.colosseum"}, - {0, 4, "culture_coverage.hospital"}, - {0, 4, "culture_coverage.hippodrome"}, - {0, 4, "culture_coverage.religion_ceres"}, - {0, 4, "culture_coverage.religion_neptune"}, - {0, 4, "culture_coverage.religion_mercury"}, - {0, 4, "culture_coverage.religion_mars"}, - {0, 4, "culture_coverage.religion_venus"}, - {0, 4, "culture_coverage.oracle"}, - {0, 4, "culture_coverage.school"}, - {0, 4, "culture_coverage.library"}, - {0, 4, "culture_coverage.academy"}, - {0, 4, "culture_coverage.hospital"}, - {0, 1720, "scenario"}, - {0, 4, "max_game_year"}, - {0, 4, "earthquake.game_year"}, - {0, 4, "earthquake.month"}, - {0, 4, "earthquake.state"}, - {0, 4, "earthquake.duration"}, - {0, 4, "earthquake.max_duration"}, - {0, 4, "earthquake.max_delay"}, - {0, 4, "earthquake.delay"}, - {0, 32, "earthquake.expand"}, - {0, 4, "emperor_change_state"}, - {1, 16000, "messages"}, - {0, 4, "message_extra.next_message_sequence"}, - {0, 4, "message_extra.total_messages"}, - {0, 4, "message_extra.current_message_id"}, - {0, 10, "population_messages"}, - {0, 80, "message_counts"}, - {0, 80, "message_delays"}, - {0, 4, "building_list_burning_totals.total"}, - {0, 4, "building_list_burning_totals.size"}, - {0, 4, "figure_sequence"}, - {0, 12, "scenario_settings"}, - {1, 3232, "invasion_warnings"}, - {0, 4, "scenario_is_custom"}, - {0, 8960, "city_sounds", 128}, - {0, 4, "building_extra_highest_id"}, - {0, 4800, "figure_traders"}, - {0, 4, "figure_traders.next_trader_id"}, - {1, 1000, "building_list_burning"}, - {1, 1000, "building_list_small"}, - {1, 4000, "building_list_large"}, - {0, 4, "tutorial_part1.tutorial1.fire"}, - {0, 4, "tutorial_part1.tutorial1.crime"}, - {0, 4, "tutorial_part1.tutorial1.collapse"}, - {0, 4, "tutorial_part1.tutorial2.granaryBuilt"}, - {0, 4, "tutorial_part1.tutorial2.population250Reached"}, - {0, 4, "tutorial_part1.tutorial1.senateBuilt"}, - {0, 4, "tutorial_part1.tutorial2.population450Reached"}, - {0, 4, "tutorial_part1.tutorial2.potteryMade"}, - {0, 4, "building_count.militaryAcademy.total"}, - {0, 4, "building_count.militaryAcademy.working"}, - {0, 4, "building_count.barracks.total"}, - {0, 4, "building_count.barracks.working"}, - {0, 4, "enemy_army_totals.enemy_formations"}, - {0, 4, "enemy_army_totals.enemy_strength"}, - {0, 4, "enemy_army_totals.legion_formations"}, - {0, 4, "enemy_army_totals.legion_strength"}, - {0, 4, "enemy_army_totals.days_since_roman_influence_calculation"}, - {0, 6400, "building_storages"}, - {0, 4, "building_count.actorColony.total"}, - {0, 4, "building_count.actorColony.working"}, - {0, 4, "building_count.gladiatorSchool.total"}, - {0, 4, "building_count.gladiatorSchool.working"}, - {0, 4, "building_count.lionHouse.total"}, - {0, 4, "building_count.lionHouse.working"}, - {0, 4, "building_count.chariotMaker.total"}, - {0, 4, "building_count.chariotMaker.working"}, - {0, 4, "building_count.market.total"}, - {0, 4, "building_count.market.working"}, - {0, 4, "building_count.reservoir.total"}, - {0, 4, "building_count.reservoir.working"}, - {0, 4, "building_count.fountain.total"}, - {0, 4, "building_count.fountain.working"}, - {0, 4, "tutorial_part2"}, - {0, 4, "gladiator_revolt.gameYear"}, - {0, 4, "gladiator_revolt.month"}, - {0, 4, "gladiator_revolt.endMonth"}, - {0, 4, "gladiator_revolt.state"}, - {1, 1280, "trade_route_limit"}, - {1, 1280, "trade_route_traded"}, - {0, 4, "building_barracks_tower_sentry"}, - {0, 4, "building_extra_sequence"}, - {0, 4, "routing_counters.unknown"}, - {0, 4, "routing_counters.enemy_routes_calculated"}, - {0, 4, "routing_counters.total_routes_calculated"}, - {0, 4, "routing_counters.unknown"}, - {0, 4, "building_count.smallTempleCeres.working"}, - {0, 4, "building_count.smallTempleNeptune.working"}, - {0, 4, "building_count.smallTempleMercury.working"}, - {0, 4, "building_count.smallTempleMars.working"}, - {0, 4, "building_count.smallTempleVenus.working"}, - {0, 4, "building_count.largeTempleCeres.working"}, - {0, 4, "building_count.largeTempleNeptune.working"}, - {0, 4, "building_count.largeTempleMercury.working"}, - {0, 4, "building_count.largeTempleMars.working"}, - {0, 4, "building_count.largeTempleVenus.working"}, - {0, 100, "enemy_armies.formation_id"}, - {0, 100, "enemy_armies.home_x"}, - {0, 100, "enemy_armies.home_y"}, - {0, 100, "enemy_armies.layout"}, - {0, 100, "enemy_armies.destination_x"}, - {0, 100, "enemy_armies.destination_y"}, - {0, 100, "enemy_armies.destination_building_id"}, - {0, 100, "enemy_armies.num_legions"}, - {0, 100, "enemy_armies.ignore_roman_soldiers"}, - {0, 16, "city_entry_exit_xy"}, - {0, 2, "last_invasion_id"}, - {0, 8, "building_extra_corrupt_houses"}, - {0, 65, "scenario_name"}, - {0, 32, "bookmarks"}, - {0, 4, "tutorial_part3"}, - {0, 8, "city_entry_exit_grid_offset"}, - {0, 0, ""}, -}; - -static char compress_buffer[COMPRESS_BUFFER_SIZE]; -static unsigned char file1_data[1300000]; -static unsigned char file2_data[1300000]; - -static unsigned int to_uint(const unsigned char *buffer) -{ - return buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24); -} - -static unsigned int to_ushort(const unsigned char *buffer) -{ - return buffer[0] | (buffer[1] << 8); -} - -static int index_of_part(const char *part_name) -{ - for (int i = 0; save_game_parts[i].length_in_bytes; i++) { - if (strcmp(part_name, save_game_parts[i].name) == 0) { - return i; - } - } - printf("WARN: part %s not found\n", part_name); - return -1; -} - -static int offset_of_part(const char *part_name) -{ - int total_offset = 0; - for (int i = 0; save_game_parts[i].length_in_bytes; i++) { - if (strcmp(part_name, save_game_parts[i].name) == 0) { - return total_offset; - } - total_offset += save_game_parts[i].length_in_bytes; - } - printf("WARN: part %s not found\n", part_name); - return -1; -} - -static int read_compressed_chunk(FILE *fp, void *buffer, int bytes_to_read) -{ - if (bytes_to_read > COMPRESS_BUFFER_SIZE) { - return 0; - } - unsigned int input_size = bytes_to_read; - unsigned char intbuf[4]; - if (fread(&intbuf, 1, 4, fp) == 4) { - input_size = to_uint(intbuf); - } - if (input_size == UNCOMPRESSED) { - if (fread(buffer, 1, bytes_to_read, fp) != bytes_to_read) { - return 0; - } - } else { - if (fread(compress_buffer, 1, input_size, fp) != input_size || - !zip_decompress(compress_buffer, input_size, buffer, bytes_to_read)) { - return 0; - } - } - return 1; -} - -static int unpack(const char *filename, unsigned char *buffer) -{ - FILE *fp = fopen(filename, "rb"); - if (!fp) { - printf("Unable to open file %s\n", filename); - return 0; - } - int offset = 0; - for (int i = 0; save_game_parts[i].length_in_bytes; i++) { - int result = 0; - if (save_game_parts[i].compressed) { - result = read_compressed_chunk(fp, &buffer[offset], save_game_parts[i].length_in_bytes); - } else { - result = fread(&buffer[offset], 1, save_game_parts[i].length_in_bytes, fp) == save_game_parts[i].length_in_bytes; - } - offset += save_game_parts[i].length_in_bytes; - if (!result) { - printf("Error while loading file %s\n", filename); - fclose(fp); - return 0; - } - } - fclose(fp); - return offset; -} - -static int has_adjacent_terrain_type(int part_offset, int terrain_type) -{ - int grid_offset = part_offset / 2; - const int adjacent_tiles[] = {-162, 1, 162, -1}; - - for (int i = 0; i < 4; ++i) { - int adjacent_offset = grid_offset + adjacent_tiles[i]; - if (adjacent_offset < 0 || adjacent_offset >= 162 * 162) { - continue; - } - int type = to_ushort(&file1_data[offset_of_part("terrain_grid") + adjacent_offset * 2]); - if (type & terrain_type) { - return 1; - } - } - return 0; -} - -static int has_adjacent_building_type(int part_offset, int building_type) -{ - int grid_offset = part_offset / 2; - const int adjacent_tiles[] = {-162, 1, 162, -1}; - - for (int i = 0; i < 4; ++i) { - int adjacent_offset = grid_offset + adjacent_tiles[i]; - if (adjacent_offset < 0 || adjacent_offset >= 162 * 162) { - continue; - } - int building_id = to_ushort(&file1_data[offset_of_part("building_grid") + adjacent_offset * 2]); - int building_offset = offset_of_part("buildings") + building_id * 128; - int type = to_ushort(&file1_data[building_offset + 10]); - if (type == building_type) { - return 1; - } - } - return 0; -} - -static int is_between(unsigned int value, unsigned int range_from, unsigned int range_to) -{ - return value >= range_from && value <= range_to; -} - -static int both_between(unsigned int value1, unsigned int value2, unsigned int range_from, unsigned int range_to) -{ - return is_between(value1, range_from, range_to) && is_between(value2, range_from, range_to); -} - -static int is_exception_cityinfo(int global_offset, int part_offset) -{ - if (part_offset == 35160) { - // Bug fixed compared to C3: caesar invasion and barbarian invasion - // influence on peace rating are switched - if (file1_data[global_offset] == 7 && file2_data[global_offset] == 8) { - return 1; - } - if (file1_data[global_offset] == 8 && file2_data[global_offset] == 7) { - return 1; - } - } - return 0; -} - -static int is_exception_image_grid(int global_offset, int part_offset) -{ - unsigned int v1 = to_ushort(&file1_data[global_offset & ~1]); - unsigned int v2 = to_ushort(&file2_data[global_offset & ~1]); - // water: depends on animation timer - if (both_between(v1, v2, 364, 369)) { - return 1; - } - // burning tent: fix in julius to use its own graphic - if ((v1 == 734 && is_between(v2, 743, 770)) || (v2 == 734 && is_between(v1, 743, 770))) { - return 1; - } - // Exception for roads next to an access ramp: in julius the dirt roads and paved roads lead - // into the access ramp, while in Caesar 3 they do not. Therefore we do not check roads that - // are adjacent to an access ramp (terrain type 1024). - if (both_between(v1, v2, 591, 657) && has_adjacent_terrain_type(part_offset, 1024)) { - return 1; - } - // Exception for roads next to a granary: in julius the dirt roads and paved roads lead - // into the granary, while in Caesar 3 they do not. Therefore we do not check roads that - // are adjacent to a granary (building type 71). - if (both_between(v1, v2, 591, 657) && has_adjacent_building_type(part_offset, 71)) { - return 1; - } - return 0; -} - -static int is_exception_buildings(int global_offset, int part_offset) -{ - int building_offset = (global_offset - part_offset) + 128 * (part_offset / 128); - int difference_offset = global_offset - building_offset; - int type = to_ushort(&file1_data[building_offset + 10]); - if (type == 99 && is_between(difference_offset, 0x4A, 0x73)) { // burning ruin extra data - return 1; - } - return 0; -} - -static int is_exception_building_grid(int global_offset, int part_offset) -{ - int grid_offset = part_offset / 2; - // Exception for earthquake tiles: Caesar 3 does not clear the building ID when - // a building gets destroyed by an earthquake, resulting in visual artifacts; - // Julius does clear the building ID from the grid. - // Earthquake tile is defined as: - // - 0x80 bit is set in bitfields_grid - // - 0x0002 bit is set in terrain_grid - int is_earthquake = (file1_data[offset_of_part("bitfields_grid") + grid_offset] & 0x80) && - (file1_data[offset_of_part("terrain_grid") + 2 * grid_offset] & 0x02); - if (is_earthquake) { - unsigned int v1 = to_ushort(&file1_data[global_offset & ~1]); - unsigned int v2 = to_ushort(&file2_data[global_offset & ~1]); - if (v1 == 0 || v2 == 0) { - return 1; - } - } - return 0; -} - -static int is_exception_figures(int global_offset, int part_offset) -{ - // herd animals have a bug where their destination_x/y can get set outside - // the map bounds - int figures_start = global_offset - part_offset; - int figure_num = part_offset / 128; - int figure_offset = figure_num * 128 + figures_start; - int type = to_ushort(&file1_data[figure_offset + 10]); - if (type < FIGURE_SHEEP || type > FIGURE_ZEBRA) { - return 0; - } - int figure_part_offset = part_offset % 128; - if (figure_part_offset != 28 && figure_part_offset != 29) { - return 0; - } - unsigned char old_val = file1_data[global_offset]; - if (old_val < GRID_SIZE) { - return 0; - } - return 1; -} - -static int is_exception(int index, int global_offset, int part_offset) -{ - if (index == index_of_part("city_sounds")) { - return 1; - } - if (index == index_of_part("sprite_backup_grid")) { - return 1; - } - if (index == index_of_part("camera")) { - return 1; - } - if (index == index_of_part("image_grid")) { - return is_exception_image_grid(global_offset, part_offset); - } - if (index == index_of_part("sprite_grid")) { - // don't care about sprite + building = animation - int building_offset = global_offset - 8 * 162 * 162 + part_offset; - if (file1_data[building_offset] || file1_data[building_offset + 1]) { - return 1; - } - } - if (index == index_of_part("city_data")) { - return is_exception_cityinfo(global_offset, part_offset); - } - if (index == index_of_part("buildings")) { - return is_exception_buildings(global_offset, part_offset); - } - if (index == index_of_part("building_grid")) { - return is_exception_building_grid(global_offset, part_offset); - } - if (index == index_of_part("building_list_burning_totals.size")) { - // We use it for burning size in Julius, while C3 writes the index used to loop over the buildings, - // which is either 0 (no prefects in the city) or the burning size - // So: we ignore this variable if one of them is zero - if (to_uint(&file1_data[global_offset - part_offset]) == 0 || to_uint(&file2_data[global_offset - part_offset]) == 0) { - return 1; - } - } - if (index == index_of_part("figures")) { - return is_exception_figures(global_offset, part_offset); - } - return 0; -} - -static int compare_part(int index, int offset) -{ - int different = 0; - int length = save_game_parts[index].length_in_bytes; - for (int i = 0; i < length; i++) { - if (file1_data[offset + i] != file2_data[offset + i] && !is_exception(index, offset + i, i)) { - different = 1; - printf("Part %d [%s] (%d) ", index, save_game_parts[index].name, i); - if (save_game_parts[index].record_length) { - printf("record %d offset 0x%X", i / save_game_parts[index].record_length, i % save_game_parts[index].record_length); - if (index == index_of_part("buildings")) { - int record_length = save_game_parts[index].record_length; - int type_offset = (i / record_length) * record_length + 10; - printf(" (type: %d)", to_ushort(&file1_data[offset + type_offset])); - } else if (index == index_of_part("figures")) { - int record_length = save_game_parts[index].record_length; - int type_offset = (i / record_length) * record_length + 10; - printf(" (type: %d)", file1_data[offset + type_offset]); - } - } else { - printf("offset %d", i); - } - printf(": %d <-> %d\n", file1_data[offset + i], file2_data[offset + i]); - } - } - return different; -} - -static void print_game_time(unsigned char *data) -{ - int offset_tick = 1200222; - unsigned int tick = to_uint(&data[offset_tick]); - unsigned int day = to_uint(&data[offset_tick + 4]); - unsigned int month = to_uint(&data[offset_tick + 8]); - int year = (int) to_uint(&data[offset_tick + 12]); - unsigned int total_days = to_uint(&data[offset_tick + 16]); - - printf("%d.%u.%u.%u (%u)\n", year, month, day, tick, total_days); -} - -static void compare_game_time(void) -{ - int offset_tick = 1200222; - int offset_days = offset_tick + 16; - unsigned int ticks1 = to_uint(&file1_data[offset_tick]) + 50 * to_uint(&file1_data[offset_days]); - unsigned int ticks2 = to_uint(&file2_data[offset_tick]) + 50 * to_uint(&file2_data[offset_days]); - if (ticks1 != ticks2) { - printf("WARN: ticks not in sync: %u <--> %u (%d)\n", ticks1, ticks2, ticks1 - ticks2); - printf("File 1: "); - print_game_time(file1_data); - printf("File 2: "); - print_game_time(file2_data); - } -} - -static int compare(void) -{ - compare_game_time(); - int offset = 0; - int different = 0; - for (int i = 0; save_game_parts[i].length_in_bytes; i++) { - different |= compare_part(i, offset); - offset += save_game_parts[i].length_in_bytes; - } - return different; -} - -int compare_files(const char *file1, const char *file2) -{ - int length1 = unpack(file1, file1_data); - int length2 = unpack(file2, file2_data); - if (length1 && length1 == length2) { - return compare(); - } else { - printf("WARN: lengths are different: %d <--> %d\n", length1, length2); - return 1; - } -} diff --git a/test/sav/sav_compare.h b/test/sav/sav_compare.h deleted file mode 100644 index 499d631a01..0000000000 --- a/test/sav/sav_compare.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SAV_COMPARE_H -#define SAV_COMPARE_H - -int compare_files(const char *file1, const char *file2); - -#endif // SAV_COMPARE_H diff --git a/test/stub/image.c b/test/stub/image.c deleted file mode 100644 index 8755225a8f..0000000000 --- a/test/stub/image.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "core/image.h" - -static int groups[] = { - 0, 245, 254, 246, 274, 364, 444, 476, 534, 201, - 306, 871, 886, 949, 1438, 892, 1439, 696, 2780, 666, - 548, 733, 2872, 2830, 699, 2863, 2779, 2785, 2791, 2797, - 2803, 2809, 2813, 2817, 2819, 2821, 2823, 2883, 2914, 2925, - 2932, 2954, 2955, 2956, 2957, 3039, 3051, 7972, 3074, 3089, - 3100, 3119, 3129, 2831, 2839, 2847, 2855, 3410, 3140, 3148, - 3024, 3155, 3158, 3164, 3165, 2943, 3176, 3183, 3184, 3185, - 3208, 3209, 3211, 3213, 3215, 3217, 3219, 3226, 3230, 3277, - 7777, 3281, 3319, 3337, 3338, 2824, 2825, 2826, 3514, 955, - 967, 3618, 993, 1104, 1108, 7737, 1109, 4650, 3722, 3011, - 2884, 3826, 5354, 5362, 4026, 4130, 4234, 4338, 4442, 3930, - 4546, 5579, 591, 5777, 658, 5929, 6041, 6193, 6489, 734, - 743, 6345, 2970, 2979, 2988, 3003, 5374, 5422, 1125, 1186, - 4794, 4778, 1205, 1349, 1398, 581, 7776, 1053, 262, 5432, - 5440, 7798, 7806, 7810, 7814, 7816, 7820, 7824, 7825, 7829, - 7834, 7835, 7837, 5446, 5452, 5457, 5462, 945, 926, 7839, - 7969, 7970, 7971, 6609, 3292, 4890, 3181, 4922, 3242, 3254, - 3266, 3306, 7973, 7982, 8003, 8010, 8017, 8031, 8039, 8071, - 8073, 8090, 8098, 2827, 3318, 3196, 8126, 8127, 8128, 1414, - 8129, 3073, 3050, 3088, 6705, 7763, 681, 7764, 5467, 1150, - 5515, 3182, 6849, 7049, 7161, 821, 779, 825, 1417, 5018, - 3029, 3197, 3207, 7780, 7789, 8192, 845, 5122, 5186, 5250, - 5258, 3163, 1433, 8024, 8055, 1204, 4914, 5571, 7425, 7321, - 7529, 7633, 8376, 8528, 8640, 8800, 7001, 5266, 3402, 849, - 863, 5401, 5572, 8000, 8953, 8954, 8966, 7953, 5577, 8944, - 8288, 9008, 8967, 7772, 8963, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -int image_init(void) -{ - return 1; -} - -int image_load_climate(int climate_id, int is_editor, int force_reload) -{ - return 1; -} - -int image_load_fonts(encoding_type encoding) -{ - return 1; -} - -int image_load_enemy(int enemy_id) -{ - return 1; -} - -int image_group(int group) -{ - return groups[group]; -} - -const image *image_get(int id) -{ - return 0; -} diff --git a/test/stub/input.c b/test/stub/input.c deleted file mode 100644 index f0872737c4..0000000000 --- a/test/stub/input.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "game/system.h" -#include "input/hotkey.h" -#include "input/keys.h" -#include "input/mouse.h" -#include "input/scroll.h" - -void hotkey_install_mapping(hotkey_mapping *mappings, int num_mappings) -{ -} - -const char *key_combination_name(key_type key, key_modifier_type modifiers) -{ - return ""; -} - -int key_combination_from_name(const char *name, key_type *key, key_modifier_type *modifiers) -{ - return 0; -} - -key_type system_keyboard_key_for_symbol(const char *name) -{ - return KEY_TYPE_NONE; -} - -void mouse_reset_up_state(void) -{ -} - -int scroll_in_progress(void) -{ - return 0; -} - -int scroll_is_smooth(void) -{ - return 0; -} diff --git a/test/stub/lang.c b/test/stub/lang.c deleted file mode 100644 index 84513cb476..0000000000 --- a/test/stub/lang.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "core/encoding.h" -#include "core/lang.h" -#include "graphics/font.h" -#include "translation/translation.h" - -static uint8_t EMPTY[] = {0}; - -static lang_message msg; - -int lang_load(int is_editor) -{ - return 1; -} - -const uint8_t *lang_get_string(int group, int index) -{ - return EMPTY; -} - -const lang_message *lang_get_message(int id) -{ - msg.content.text = EMPTY; - return &msg; -} - -void font_set_encoding(encoding_type encoding) -{} - -void translation_load(language_type language) -{} diff --git a/test/stub/log.c b/test/stub/log.c deleted file mode 100644 index 92612d4d3d..0000000000 --- a/test/stub/log.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "core/log.h" - -#include - -static void print_message(const char *msg, const char *param_str, int param_int) -{ - printf("%s", msg); - if (param_str) { - printf(" %s", param_str); - } - if (param_int) { - printf(" %d", param_int); - } - printf("\n"); -} - -void log_info(const char *msg, const char *param_str, int param_int) -{ - printf("INFO: "); - print_message(msg, param_str, param_int); -} - -void log_error(const char *msg, const char *param_str, int param_int) -{ - printf("ERROR: "); - print_message(msg, param_str, param_int); -} diff --git a/test/stub/model.c b/test/stub/model.c deleted file mode 100644 index a50307f070..0000000000 --- a/test/stub/model.c +++ /dev/null @@ -1,171 +0,0 @@ -#include "building/model.h" - -static model_building buildings[] = { -{0, 0, 0, 0, 0, 0}, -{1, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{4, 0, 0, 0, 0, 0}, -{12, 0, 0, 0, 0, 0}, -{30, 0, 0, 0, 0, 0}, -{8, -2, 1, 1, 2, 0}, -{2, 0, 0, 0, 0, 0}, -{10, -3, 1, 1, 3, 0}, -{0, -3, 1, 1, 3, 0}, -{0, -2, 1, 1, 2, 0}, -{0, -2, 1, 1, 2, 0}, -{0, -2, 1, 1, 2, 0}, -{0, -2, 1, 1, 2, 0}, -{0, -1, 1, 1, 1, 0}, -{0, -1, 1, 1, 1, 0}, -{0, 0, 1, 1, 1, 0}, -{0, 0, 1, 1, 1, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 1, 2, -1, 2, 0}, -{0, 1, 2, -1, 2, 0}, -{0, 2, 2, -2, 2, 0}, -{0, 2, 2, -2, 2, 0}, -{0, 3, 2, -1, 6, 0}, -{0, 3, 2, -1, 6, 0}, -{0, 4, 2, -1, 6, 0}, -{0, 4, 2, -1, 6, 0}, -{100, 4, 1, -1, 4, 12}, -{50, 2, 1, -1, 2, 8}, -{2500, -3, 1, 1, 3, 150}, -{500, -3, 1, 1, 3, 25}, -{75, -3, 1, 1, 3, 8}, -{75, -3, 1, 1, 3, 8}, -{50, 2, 1, -1, 2, 5}, -{75, -3, 1, 1, 3, 10}, -{15, 4, 1, -2, 2, 0}, -{12, 3, 1, -1, 3, 0}, -{1000, -20, 2, 2, 8, 16}, -{12, 3, 1, -1, 3, 0}, -{60, 10, 1, -2, 4, 0}, -{150, 14, 2, -2, 5, 0}, -{1000, -20, 2, 2, 8, 16}, -{1000, -20, 2, 2, 8, 16}, -{30, 0, 0, 0, 0, 5}, -{300, -1, 2, 1, 2, 30}, -{50, 4, 1, -1, 4, 10}, -{25, 2, 1, -1, 2, 2}, -{0, 0, 0, 0, 0, 0}, -{50, -2, 1, 1, 2, 10}, -{100, 4, 1, 1, 4, 30}, -{75, 4, 1, -1, 4, 20}, -{0, 0, 0, 0, 0, 0}, -{30, -2, 1, 1, 2, 6}, -{0, 18, 2, 3, 5, 0}, -{250, -20, 2, 2, 8, 16}, -{100, -4, 1, 1, 3, 3}, -{150, -8, 1, 2, 3, 6}, -{50, 4, 2, -1, 6, 2}, -{50, 4, 2, -1, 6, 2}, -{50, 4, 2, -1, 6, 2}, -{50, 4, 2, -1, 6, 2}, -{50, 4, 2, -1, 6, 2}, -{150, 8, 2, -1, 8, 5}, -{150, 8, 2, -1, 8, 5}, -{150, 8, 2, -1, 8, 5}, -{150, 8, 2, -1, 8, 5}, -{150, 8, 2, -1, 8, 5}, -{40, -2, 1, 1, 6, 5}, -{100, -4, 1, 2, 2, 6}, -{70, -5, 2, 2, 3, 6}, -{0, 0, 0, 0, 0, 0}, -{100, -8, 2, 2, 3, 10}, -{100, -8, 2, 2, 3, 12}, -{60, -8, 2, 2, 3, 6}, -{150, 12, 2, -2, 3, 0}, -{400, 20, 2, -3, 4, 0}, -{700, 28, 2, -4, 5, 0}, -{100, -3, 1, 1, 2, 20}, -{30, 0, 1, 1, 1, 5}, -{40, 0, 0, 0, 0, 0}, -{100, 0, 0, 0, 0, 0}, -{250, 8, 2, -2, 2, 20}, -{400, 8, 2, -1, 8, 30}, -{75, 3, 2, -1, 2, 6}, -{125, 3, 2, -1, 2, 8}, -{50, 0, 0, 0, 0, 0}, -{50, 0, 0, 0, 0, 0}, -{80, -6, 1, 2, 3, 0}, -{15, 0, 0, 0, 0, 4}, -{5, -1, 1, 2, 1, 1}, -{0, 0, 0, 0, 0, 0}, -{1000, -3, 1, 1, 3, 20}, -{150, -6, 1, 1, 3, 10}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{200, 8, 2, -1, 6, 0}, -{0, -1, 1, 1, 2, 0}, -{40, -2, 1, 1, 2, 10}, -{40, -2, 1, 1, 2, 10}, -{40, 2, 1, 1, 2, 10}, -{40, 2, 1, 1, 2, 10}, -{40, 2, 1, 1, 2, 10}, -{40, -2, 1, 1, 2, 10}, -{50, -6, 1, 1, 4, 10}, -{50, -6, 1, 1, 4, 10}, -{40, -4, 1, 1, 3, 10}, -{40, -3, 1, 1, 2, 10}, -{45, -1, 1, 1, 1, 10}, -{50, -4, 1, 1, 2, 10}, -{50, -4, 1, 1, 2, 10}, -{40, -4, 1, 1, 2, 10}, -{40, -4, 1, 1, 2, 10}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -{0, 0, 0, 0, 0, 0}, -}; -static model_house houses[] = { -{-99, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 1}, -{-12, -5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1}, -{-7, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 15, 9, 1}, -{-2, 4, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 20, 11, 1}, -{2, 8, 0, 2, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 25, 13, 2}, -{6, 12, 10, 2, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 30, 15, 2}, -{10, 16, 10, 2, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 35, 17, 2}, -{14, 20, 10, 2, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 45, 19, 2}, -{18, 25, 25, 2, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 50, 19, 3}, -{22, 32, 25, 2, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 58, 20, 3}, -{29, 40, 25, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 0, 65, 84, 3}, -{37, 48, 35, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 0, 80, 84, 4}, -{45, 53, 35, 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 150, 40, 9}, -{50, 58, 40, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 180, 42, 10}, -{55, 63, 45, 2, 2, 3, 1, 1, 2, 2, 1, 1, 1, 1, 400, 90, 11}, -{60, 68, 50, 2, 3, 3, 1, 1, 2, 3, 1, 1, 1, 1, 600, 100, 11}, -{65, 74, 55, 2, 3, 3, 1, 1, 2, 3, 1, 1, 1, 2, 700, 106, 12}, -{70, 80, 60, 2, 4, 3, 1, 1, 2, 3, 1, 1, 1, 2, 900, 112, 12}, -{76, 90, 70, 2, 4, 3, 1, 1, 2, 3, 1, 1, 1, 2, 1500, 190, 15}, -{85, 100, 80, 2, 4, 3, 1, 1, 2, 3, 1, 1, 1, 2, 1750, 200, 16}, -}; - -int model_load(void) -{ - return 1; -} - -const model_building *model_get_building(building_type type) -{ - return &buildings[type]; -} - -const model_house *model_get_house(house_level level) -{ - return &houses[level]; -} diff --git a/test/stub/sound_device.c b/test/stub/sound_device.c deleted file mode 100644 index f891c7c625..0000000000 --- a/test/stub/sound_device.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "sound/device.h" - -void sound_device_open(void) -{} - -void sound_device_close(void) -{} - -void sound_device_init_channels(void) -{} - -void sound_device_set_music_volume(int volume_pct) -{} - -void sound_device_set_volume_for_type(int channel, int volume_pct) -{} - -int sound_device_play_music(const char *filename, int volume_pct, int loop) -{ - return 0; -} - -void sound_device_play_file_on_channel(const char *filename, int channel, int volume_pct) -{} - -void sound_device_play_channel(int channel, int volume_pct) -{} - -void sound_device_play_channel_panned(int channel, int volume_pct, int left_pct, int right_pct) -{} - -void sound_device_stop_music(void) -{} - -void sound_device_stop_type(sound_type type) -{} diff --git a/test/stub/ui.c b/test/stub/ui.c deleted file mode 100644 index d4d36688b6..0000000000 --- a/test/stub/ui.c +++ /dev/null @@ -1,78 +0,0 @@ -#include "graphics/window.h" -#include "widget/minimap.h" -#include "window/building_info.h" -#include "window/editor/map.h" -#include "window/logo.h" -#include "window/main_menu.h" -#include "window/message_dialog.h" -#include "window/popup_dialog.h" -#include "window/mission_end.h" -#include "window/victory_dialog.h" - -#include "city/victory.h" - -int window_is(window_id id) -{ - return id == WINDOW_CITY; -} - -void window_invalidate(void) -{} - -void window_request_refresh(void) -{} - -void window_logo_show(int show_patch_message) -{} - -void window_main_menu_show(int restart_music) -{} - -void window_mission_end_show_fired(void) -{} - -void window_mission_end_show_won(void) -{} - -void window_victory_dialog_show(void) -{ - city_victory_continue_governing(60); - city_victory_reset(); -} - -void window_editor_map_show(void) -{} - -window_id window_get_id(void) -{ - return WINDOW_CITY; -} - -int window_is_invalid(void) -{ - return 0; -} - -void window_draw(int force) -{} - -void window_message_dialog_show_city_message(int text_id, int year, int month, - int param1, int param2, int message_advisor, int use_popup) -{} - -void window_popup_dialog_show(popup_dialog_type type, void (*okFunc)(int), int hasOkCancelButtons) -{} - -void widget_minimap_invalidate(void) -{} - -int window_building_info_get_building_type(void) -{ - return 0; -} - -void window_city_show(void) -{} - -void window_console_show(int type, int dialog_type) -{} diff --git a/test/stub/video.c b/test/stub/video.c deleted file mode 100644 index e79d6d9619..0000000000 --- a/test/stub/video.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "graphics/video.h" - -void video_shutdown(void) -{} diff --git a/test/translation/check.c b/test/translation/check.c deleted file mode 100644 index 1993bfcce7..0000000000 --- a/test/translation/check.c +++ /dev/null @@ -1,29 +0,0 @@ -#include - -#include "core/locale.h" -#include "core/log.h" -#include "translation/translation.h" - -static void check_language(const char *name, language_type language) -{ - log_info("Checking language:", name, 0); - translation_load(language); -} - -int main(void) -{ - check_language("French", LANGUAGE_FRENCH); - check_language("German", LANGUAGE_GERMAN); - check_language("Italian", LANGUAGE_ITALIAN); - check_language("Spanish", LANGUAGE_SPANISH); - check_language("Japanese", LANGUAGE_JAPANESE); - check_language("Korean", LANGUAGE_KOREAN); - check_language("Polish", LANGUAGE_POLISH); - check_language("Portuguese", LANGUAGE_PORTUGUESE); - check_language("Russian", LANGUAGE_RUSSIAN); - check_language("Swedish", LANGUAGE_SWEDISH); - check_language("Simplified Chinese", LANGUAGE_SIMPLIFIED_CHINESE); - check_language("Traditional Chinese", LANGUAGE_TRADITIONAL_CHINESE); - check_language("Czech", LANGUAGE_CZECH); - return 0; -} \ No newline at end of file