~widelands-dev/widelands/trunk

« back to all changes in this revision

Viewing changes to src/map_io/widelands_map_buildingdata_data_packet.cc

  • Committer: fios at foramnagaidhlig
  • Date: 2014-07-29 22:01:31 UTC
  • mto: This revision was merged to the branch mainline in revision 7161.
  • Revision ID: fios@foramnagaidhlig.net-20140729220131-1syk3u5esbep57if
Changed ProductionSite char m_result_buffer[213] to private std::string          m_production_result and added getter/setters

Show diffs side-by-side

added added

removed removed

Lines of Context:
1041
1041
                                                         sizeof(productionsite.m_statistics_buffer) - 1,
1042
1042
                                                         statistics_string, statistics_string_length);
1043
1043
                                }
1044
 
                                if (4 <= packet_version) {
 
1044
                                {
1045
1045
                                        char const * const result_string        = fr.CString();
1046
 
                                        size_t       const result_string_length =
1047
 
                                                snprintf
1048
 
                                                        (productionsite.m_result_buffer,
1049
 
                                                         sizeof(productionsite.m_result_buffer),
1050
 
                                                         "%s", result_string);
1051
 
                                        if
1052
 
                                                (sizeof(productionsite.m_result_buffer)
1053
 
                                                 <=
1054
 
                                                 result_string_length)
 
1046
                                        size_t       const result_string_length = productionsite.production_result().size();
 
1047
                                        if (sizeof(result_string) <= result_string_length)
1055
1048
                                                log
1056
1049
                                                        ("WARNING: productionsite result string can be at "
1057
1050
                                                         "most %" PRIuS " characters but a loaded building has the "
1058
1051
                                                         "string \"%s\" of length %" PRIuS "\n",
1059
 
                                                         sizeof(productionsite.m_result_buffer) - 1,
1060
 
                                                         result_string, result_string_length);
 
1052
                                                         sizeof(result_string) - 1,
 
1053
                                                         productionsite.production_result().c_str(), result_string_length);
1061
1054
                                }
1062
1055
                        }
1063
1056
                } else
1556
1549
                fw.Unsigned8(productionsite.m_statistics[i]);
1557
1550
        fw.Unsigned8(productionsite.m_statistics_changed);
1558
1551
        fw.String(productionsite.m_statistics_buffer);
1559
 
        fw.String(productionsite.m_result_buffer);
 
1552
        fw.String(productionsite.production_result());
1560
1553
}
1561
1554
 
1562
1555
/*