Directory: | source/ |
---|---|
File: | source/world.c |
Date: | 2023-12-18 09:27:49 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 13 | 13 | 100.0% |
Branches: | 7 | 8 | 87.5% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Filename: world.c | ||
3 | * Path: source | ||
4 | * Created Date: Wednesday, December 21st 2022, 8:20:21 am | ||
5 | * Author: osvegn | ||
6 | * | ||
7 | * Copyright (c) 2023 ECS | ||
8 | */ | ||
9 | |||
10 | #include "world.h" | ||
11 | #include "world_logger.h" | ||
12 | #include <stddef.h> | ||
13 | |||
14 | 5 | int world_run_systems(world_t *world) | |
15 | { | ||
16 | 5 | vector_t *systems = &world->system_list; | |
17 | 5 | system_t *system = NULL; | |
18 | 5 | unsigned int size = systems->size(systems); | |
19 | 5 | int rvalue = 0; | |
20 | |||
21 | 5 | log_info("Running systems"); | |
22 |
3/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
9 | for (unsigned int i = 0; i < size && rvalue == 0; i++) { |
23 | 4 | system = systems->at(systems, i); | |
24 |
4/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
|
4 | if (system && system->run) |
25 | 2 | rvalue = system->run((void *)world); | |
26 | else | ||
27 | 2 | rvalue = -1; | |
28 | } | ||
29 | 5 | log_info("Systems stopped"); | |
30 | 5 | return rvalue; | |
31 | } | ||
32 |