~widelands-dev/widelands/trunk

« back to all changes in this revision

Viewing changes to src/map_io/map_buildingdata_packet.cc

  • Committer: The Widelands Bunnybot
  • Date: 2022-12-11 18:41:23 UTC
  • Revision ID: bunnybot@widelands.org-20221211184123-80vg1pt6fc1fbrmr
Allow letting individual productionsites produce indefinitely (#4961)

(by hessenfarmer)
0fc809d0dc979de59640116300dfbe8cdb1bc942

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
constexpr uint16_t kCurrentPacketVersionConstructionsite = 5;
63
63
constexpr uint16_t kCurrentPacketPFBuilding = 2;
64
64
constexpr uint16_t kCurrentPacketVersionMilitarysite = 7;
65
 
constexpr uint16_t kCurrentPacketVersionProductionsite = 9;
 
65
constexpr uint16_t kCurrentPacketVersionProductionsite = 10;
66
66
constexpr uint16_t kCurrentPacketVersionTrainingsite = 7;
67
67
 
68
68
void MapBuildingdataPacket::read(FileSystem& fs,
644
644
                                                MapObjectLoader& mol) {
645
645
        try {
646
646
                uint16_t const packet_version = fr.unsigned_16();
647
 
                if (packet_version == kCurrentPacketVersionProductionsite) {
 
647
                if (packet_version >= 9 && packet_version <= kCurrentPacketVersionProductionsite) {
648
648
                        const auto& wp_begin = productionsite.working_positions_.begin();
649
649
                        const ProductionSiteDescr& pr_descr = productionsite.descr();
650
650
                        const BillOfMaterials& working_positions = pr_descr.working_positions();
807
807
                                }
808
808
                        }
809
809
 
 
810
                        // TODO(Nordfriese): Savegame compatibility
 
811
                        productionsite.infinite_production_ = packet_version >= 10 && fr.unsigned_8() > 0;
 
812
 
810
813
                        productionsite.actual_percent_ = fr.unsigned_32();
811
814
                        productionsite.statistics_string_on_changed_statistics_ = fr.c_string();
812
815
                        productionsite.production_result_ = fr.c_string();
1357
1360
                }
1358
1361
        }
1359
1362
 
 
1363
        fw.unsigned_8(productionsite.infinite_production_ ? 1 : 0);
1360
1364
        fw.unsigned_32(productionsite.actual_percent_);
1361
1365
        fw.string(productionsite.statistics_string_on_changed_statistics_);
1362
1366
        fw.string(productionsite.production_result());