/*
* Copyright (C) 2023 Christopher J. Howard
*
* This file is part of Antkeeper source code.
*
* Antkeeper source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Antkeeper source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Antkeeper source code. If not, see .
*/
#include "game/ant/genes/ant-gaster-gene.hpp"
#include "game/ant/genes/ant-gene-loader.hpp"
#include
#include
#include
namespace {
void load_ant_gaster_phene(ant_gaster_phene& phene, ::resource_manager& resource_manager, deserialize_context& ctx)
{
ctx.read32(reinterpret_cast(&phene.phragmosis), 1);
std::uint8_t model_filename_length{0};
ctx.read8(reinterpret_cast(&model_filename_length), 1);
std::string model_filename(model_filename_length, '\0');
ctx.read8(reinterpret_cast(model_filename.data()), model_filename_length);
phene.model = resource_manager.load(model_filename);
}
} // namespace
template <>
std::unique_ptr resource_loader::load(::resource_manager& resource_manager, deserialize_context& ctx)
{
std::unique_ptr gene = std::make_unique();
load_ant_gene(*gene, resource_manager, ctx, &load_ant_gaster_phene);
return gene;
}