Codefix: Avoid type-casting function pointer with incorrect type. (#12929)

Make `AutolengthProc` take `int` instead of `void *`, avoiding pointer parameters.
This commit is contained in:
Peter Nelson
2024-09-12 06:49:45 +01:00
committed by GitHub
parent 9631c68ce6
commit 7f5a3eaf83
4 changed files with 8 additions and 8 deletions

View File

@@ -41,9 +41,9 @@ static const SaveLoad _ai_running_desc[] = {
SLEG_CONDVAR("running_version", _ai_saveload_version, SLE_UINT32, SLV_AI_LOCAL_CONFIG, SL_MAX_VERSION),
};
static void SaveReal_AIPL(int *index_ptr)
static void SaveReal_AIPL(int arg)
{
CompanyID index = (CompanyID)*index_ptr;
CompanyID index = static_cast<CompanyID>(arg);
AIConfig *config = AIConfig::GetConfig(index, AIConfig::SSS_FORCE_GAME);
if (config->HasScript()) {
@@ -162,7 +162,7 @@ struct AIPLChunkHandler : ChunkHandler {
for (int i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
SlSetArrayIndex(i);
SlAutolength((AutolengthProc *)SaveReal_AIPL, &i);
SlAutolength(SaveReal_AIPL, i);
}
}
};