Spellforce-Spell-framework
Toggle main menu visibility
Loading...
Searching...
No Matches
sf_building_entry_hook.c
Go to the documentation of this file.
1
#include "
sf_building_entry_hook.h
"
2
#include "
../../handlers/sf_worker_building_entry_handlers.h
"
3
4
typedef
void (__thiscall *
fun006c3ca0_ptr
)(
void
*autoclass30, uint16_t param_1, uint16_t owner,
5
SF_CGdTargetData
*source,
SF_CGdTargetData
*target);
6
7
extern
BuildingFunctions
buildingAPI
;
8
9
bool
isBuildingDamaged
(
SF_CGdBuilding
*_this, uint16_t building_id)
10
{
11
return
(_this->
buildings
[building_id].
health_current
!= _this->
buildings
[building_id].
life_current_max
);
12
}
13
extern
fun006c3ca0_ptr
fun006c3ca0
;
14
15
void
__thiscall
job_start_working_at_building_hook
(
SF_CGdFigureJobs
*_this, uint16_t figure_id)
16
{
17
uint16_t building_id = _this->
CGdFigure
->
figures
[figure_id].
building
;
18
if
(((_this->
CGdBuilding
->
buildings
[building_id].
flags
& 0x1) == 0) ||
19
(
isBuildingDamaged
(_this->
CGdBuilding
, building_id) &&
20
(_this->
CGdFigure
->
figures
[figure_id].
current_job
.
flags
& 0x4000) == 0))
21
{
22
building_repair
(_this,figure_id, building_id);
23
return
;
24
}
25
_this->
CGdFigure
->
figures
[figure_id].
current_job
.
flags
&= ~(0x4000);
26
uint16_t owner = _this->
CGdFigure
->
figures
[figure_id].
owner
;
27
SF_CGdTargetData
source = {0, 0, {0, 0}};
28
SF_CGdTargetData
target;
29
target.
entity_index
= figure_id;
30
target.
entity_type
= 1;
31
target.
position
= {0, 0};
32
fun006c3ca0
(_this->
AutoClass30
, 0x24, owner, &source, &target);
33
uint8_t building_type = _this->
CGdBuilding
->
buildings
[building_id].
type
;
34
building_entry_handler_ptr
handler =
get_building_entry_handler
(building_type);
35
handler(_this, figure_id, building_id);
36
}
buildingAPI
BuildingFunctions buildingAPI
Definition
sf_hooks.c:47
fun006c3ca0
fun006c3ca0_ptr fun006c3ca0
Definition
sf_building_done_hook.c:20
fun006c3ca0_ptr
void(__thiscall * fun006c3ca0_ptr)(void *autoclass30, uint16_t param_1, uint16_t owner, SF_CGdTargetData *source, SF_CGdTargetData *target)
Definition
sf_building_done_hook.c:11
job_start_working_at_building_hook
void __thiscall job_start_working_at_building_hook(SF_CGdFigureJobs *_this, uint16_t figure_id)
Definition
sf_building_entry_hook.c:15
fun006c3ca0
fun006c3ca0_ptr fun006c3ca0
Definition
sf_building_done_hook.c:20
isBuildingDamaged
bool isBuildingDamaged(SF_CGdBuilding *_this, uint16_t building_id)
Definition
sf_building_entry_hook.c:9
sf_building_entry_hook.h
get_building_entry_handler
building_entry_handler_ptr get_building_entry_handler(uint8_t building_type)
Definition
sf_building_entry_registry.cpp:23
building_entry_handler_ptr
void(__thiscall * building_entry_handler_ptr)(SF_CGdFigureJobs *_this, uint16_t figure_id, uint16_t building_id)
Definition
sf_registration_structures.h:26
building_repair
void __thiscall building_repair(SF_CGdFigureJobs *_this, uint16_t figure_id, uint16_t building_id)
Definition
sf_worker_building_entry_handlers.cpp:16
sf_worker_building_entry_handlers.h
BuildingFunctions
Definition
sf_building_functions.h:61
FigureJobData::flags
uint16_t flags
Definition
sf_figure_structures.h:58
GdBuilding::health_current
uint16_t health_current
Definition
sf_building_structures.h:44
GdBuilding::type
uint8_t type
Definition
sf_building_structures.h:39
GdBuilding::life_current_max
uint16_t life_current_max
Definition
sf_building_structures.h:45
GdBuilding::flags
uint8_t flags
Definition
sf_building_structures.h:41
GdFigure::building
uint16_t building
Definition
sf_figure_structures.h:80
GdFigure::current_job
FigureJobData current_job
Definition
sf_figure_structures.h:134
GdFigure::owner
uint16_t owner
Definition
sf_figure_structures.h:84
SF_CGdBuilding
Definition
sf_building_structures.h:58
SF_CGdBuilding::buildings
GdBuilding buildings[1000]
Definition
sf_building_structures.h:60
SF_CGdFigure::figures
GdFigure figures[2000]
Definition
sf_figure_structures.h:151
SF_CGdFigureJobs
Definition
sf_figure_structures.h:155
SF_CGdFigureJobs::CGdFigure
SF_CGdFigure * CGdFigure
Definition
sf_figure_structures.h:164
SF_CGdFigureJobs::CGdBuilding
SF_CGdBuilding * CGdBuilding
Definition
sf_figure_structures.h:159
SF_CGdFigureJobs::AutoClass30
uint32_t * AutoClass30
Definition
sf_figure_structures.h:163
SF_CGdTargetData
Definition
sf_general_structures.h:948
SF_CGdTargetData::entity_type
uint8_t entity_type
Definition
sf_general_structures.h:949
SF_CGdTargetData::position
SF_Coord position
Definition
sf_general_structures.h:951
SF_CGdTargetData::entity_index
uint16_t entity_index
Definition
sf_general_structures.h:950
src
internal
core
hooks
sf_building_entry_hook.c
Generated by
1.17.0