Update to 1.10.0-beta1

This commit is contained in:
dP
2019-10-31 22:24:28 +03:00
parent b84a475e14
commit 599ccf0c2b
1470 changed files with 354219 additions and 16795 deletions

View File

@@ -68,7 +68,7 @@ static Engine* CallocEngine()
*/
static void FreeEngine(Engine *e)
{
if (e != NULL) {
if (e != nullptr) {
e->~Engine();
free(e);
}
@@ -141,7 +141,7 @@ void CopyTempEngineData()
e->preview_wait = se->preview_wait;
e->company_avail = se->company_avail;
e->company_hidden = se->company_hidden;
if (se->name != NULL) e->name = stredup(se->name);
if (se->name != nullptr) e->name = stredup(se->name);
}
/* Get rid of temporary data */
@@ -177,26 +177,27 @@ static const SaveLoad _engine_id_mapping_desc[] = {
static void Save_EIDS()
{
const EngineIDMapping *end = _engine_mngr.End();
uint index = 0;
for (EngineIDMapping *eid = _engine_mngr.Begin(); eid != end; eid++, index++) {
for (EngineIDMapping &eid : _engine_mngr) {
SlSetArrayIndex(index);
SlObject(eid, _engine_id_mapping_desc);
SlObject(&eid, _engine_id_mapping_desc);
index++;
}
}
static void Load_EIDS()
{
_engine_mngr.Clear();
_engine_mngr.clear();
while (SlIterateArray() != -1) {
EngineIDMapping *eid = _engine_mngr.Append();
/*C++17: EngineIDMapping *eid = &*/ _engine_mngr.emplace_back();
EngineIDMapping *eid = &_engine_mngr.back();
SlObject(eid, _engine_id_mapping_desc);
}
}
extern const ChunkHandler _engine_chunk_handlers[] = {
{ 'EIDS', Save_EIDS, Load_EIDS, NULL, NULL, CH_ARRAY },
{ 'ENGN', Save_ENGN, Load_ENGN, NULL, NULL, CH_ARRAY },
{ 'ENGS', NULL, Load_ENGS, NULL, NULL, CH_RIFF | CH_LAST },
{ 'EIDS', Save_EIDS, Load_EIDS, nullptr, nullptr, CH_ARRAY },
{ 'ENGN', Save_ENGN, Load_ENGN, nullptr, nullptr, CH_ARRAY },
{ 'ENGS', nullptr, Load_ENGS, nullptr, nullptr, CH_RIFF | CH_LAST },
};