2022-08-14 21:06:02 +00:00
|
|
|
/*
|
|
|
|
* 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;
|
2022-08-21 17:43:55 +00:00
|
|
|
AnalyseCallbackOperationMode mode;
|
2022-08-14 21:06:02 +00:00
|
|
|
SpriteGroupCallbacksUsed callbacks_used = SGCU_NONE;
|
|
|
|
AnalyseCallbackOperationResultFlags result_flags = ACORF_NONE;
|
|
|
|
uint64 properties_used = 0;
|
|
|
|
union {
|
|
|
|
FindCBResultData cb_result;
|
|
|
|
AnalyseCallbackOperationIndustryTileData *indtile;
|
|
|
|
} data;
|
2022-08-21 17:43:55 +00:00
|
|
|
|
|
|
|
AnalyseCallbackOperation(AnalyseCallbackOperationMode mode) :
|
|
|
|
mode(mode) {}
|
2022-08-14 21:06:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* NEWGRF_ANALYSIS_H */
|