Move NewGRF analysis to separate files

This commit is contained in:
Jonathan G Rennison
2022-08-14 22:06:02 +01:00
parent 9c18835bd0
commit e584ef7bba
7 changed files with 374 additions and 336 deletions

56
src/newgrf_analysis.h Normal file
View File

@@ -0,0 +1,56 @@
/*
* This file is part of OpenTTD.
* OpenTTD 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, version 2.
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file newgrf_analysis.h NewGRF analysis. */
#ifndef NEWGRF_ANALYSIS_H
#define NEWGRF_ANALYSIS_H
#include "newgrf_commons.h"
#include "3rdparty/cpp-btree/btree_set.h"
struct SpriteGroup;
enum AnalyseCallbackOperationMode : uint8 {
ACOM_CB_VAR,
ACOM_CB36_PROP,
ACOM_FIND_CB_RESULT,
ACOM_CB36_SPEED,
ACOM_INDUSTRY_TILE,
ACOM_CB_REFIT_CAPACITY,
};
struct AnalyseCallbackOperationIndustryTileData;
enum AnalyseCallbackOperationResultFlags : uint8 {
ACORF_NONE = 0,
ACORF_CB_RESULT_FOUND = 1 << 0,
ACORF_CB_REFIT_CAP_NON_WHITELIST_FOUND = 1 << 1,
ACORF_CB_REFIT_CAP_SEEN_VAR_47 = 1 << 2,
};
DECLARE_ENUM_AS_BIT_SET(AnalyseCallbackOperationResultFlags)
struct AnalyseCallbackOperation {
struct FindCBResultData {
uint16 callback;
bool check_var_10;
uint8 var_10_value;
};
btree::btree_set<const SpriteGroup *> seen;
AnalyseCallbackOperationMode mode = ACOM_CB_VAR;
SpriteGroupCallbacksUsed callbacks_used = SGCU_NONE;
AnalyseCallbackOperationResultFlags result_flags = ACORF_NONE;
uint64 properties_used = 0;
union {
FindCBResultData cb_result;
AnalyseCallbackOperationIndustryTileData *indtile;
} data;
};
#endif /* NEWGRF_ANALYSIS_H */