From 097bd1888c676fade516770021c380067beb0f24 Mon Sep 17 00:00:00 2001 From: dvincent Date: Tue, 16 Apr 2024 22:20:39 +0200 Subject: [PATCH] manage default value for old save game --- src/building/construction_building.c | 4 +++- src/building/state.c | 8 ++++++++ src/translation/english.c | 4 ++-- src/translation/french.c | 2 ++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/building/construction_building.c b/src/building/construction_building.c index b00a7ed196..91610ca08f 100644 --- a/src/building/construction_building.c +++ b/src/building/construction_building.c @@ -262,6 +262,7 @@ static void add_to_map(int type, building *b, int size, int orientation, int wat building_monument_set_phase(b, MONUMENT_START); if (type == BUILDING_GRAND_TEMPLE_MARS) { b->accepted_goods[RESOURCE_WEAPONS] = 1; + b->accepted_goods[RESOURCE_NONE] = 1; } break; case BUILDING_MESS_HALL: @@ -300,7 +301,8 @@ static void add_to_map(int type, building *b, int size, int orientation, int wat add_building(b); break; case BUILDING_BARRACKS: - b->accepted_goods[RESOURCE_WEAPONS] = 1; + b->accepted_goods[RESOURCE_WEAPONS] = 1; + b->accepted_goods[RESOURCE_NONE] = 1; add_building(b); break; diff --git a/src/building/state.c b/src/building/state.c index 78fc44689f..326df7f687 100644 --- a/src/building/state.c +++ b/src/building/state.c @@ -673,6 +673,14 @@ void building_state_load_from_buffer(buffer *buf, building *b, int building_buf_ b->figure_id2 = 0; } + // Old save barracks and temple of mars should accept weapons by default + if (b->type == BUILDING_BARRACKS || b->type == BUILDING_GRAND_TEMPLE_MARS) { + if (!b->accepted_goods[RESOURCE_NONE]) { + b->accepted_goods[RESOURCE_NONE] = 1; // set RESOURCE_NONE to 1 to mark this as a new save compatibility + b->accepted_goods[RESOURCE_WEAPONS] = 1; + } + } + // The following code should only be executed if the savegame includes building information that is not // supported on this specific version of Augustus. The extra bytes in the buffer must be skipped in order // to prevent reading bogus data for the next building diff --git a/src/translation/english.c b/src/translation/english.c index 2c8690e34b..dfe22d0bb3 100644 --- a/src/translation/english.c +++ b/src/translation/english.c @@ -1393,8 +1393,8 @@ static translation_string all_strings[] = { {TR_WINDOW_ADVISOR_MILITARY_INFANTRY, "Infantrymen"}, {TR_TOOLTIP_BUTTON_ROADBLOCK_ORDER_ACCEPT_ALL, "Accept all walkers"}, {TR_TOOLTIP_BUTTON_ROADBLOCK_ORDER_REJECT_ALL, "Refuse all walkers"}, - {TR_TOOLTIP_BUTTON_STORAGE_ORDER_ACCEPT_ALL, "Accept all goods" }, - {TR_TOOLTIP_BUTTON_STORAGE_ORDER_REJECT_ALL, "Refuse all goods" }, + {TR_TOOLTIP_BUTTON_STORAGE_ORDER_ACCEPT_ALL, "Accept all goods"}, + {TR_TOOLTIP_BUTTON_STORAGE_ORDER_REJECT_ALL, "Refuse all goods"}, {TR_FIGURE_TYPE_BEGGAR, "Beggar"}, {TR_BUILDING_ARMOURY, "Armory" }, {TR_BUILDING_ARMOURY_NO_EMPLOYEES, "Without access to employees, the armory cannot deliver weapons to our soldiers. May Mars protect us, because the unarmed legions certainly will not!"}, diff --git a/src/translation/french.c b/src/translation/french.c index 24083d70ac..750644fe66 100644 --- a/src/translation/french.c +++ b/src/translation/french.c @@ -1377,6 +1377,8 @@ static translation_string all_strings[] = { {TR_WINDOW_ADVISOR_MILITARY_INFANTRY, "Fantassins"}, {TR_TOOLTIP_BUTTON_ROADBLOCK_ORDER_ACCEPT_ALL, "Autoriser tous les marcheurs"}, {TR_TOOLTIP_BUTTON_ROADBLOCK_ORDER_REJECT_ALL, "Refuser tous les marcheurs"}, + {TR_TOOLTIP_BUTTON_STORAGE_ORDER_ACCEPT_ALL, "Autoriser toutes les marchandises"}, + {TR_TOOLTIP_BUTTON_STORAGE_ORDER_REJECT_ALL, "Refuser toutes les marchandises"}, {TR_FIGURE_TYPE_BEGGAR, "Mendiant"}, {TR_BUILDING_ARMOURY, "Armurerie" }, {TR_BUILDING_ARMOURY_NO_EMPLOYEES, "L'armurerie n'ayant pas de main-d'œuvre, aucune arme n'est livrée aux soldats. Puisse Mars nous protéger à la place de nos légions !"},