File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
libopenage/gamestate/activity/condition Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 11add_sources(libopenage
22 command_in_queue.cpp
3+ next_command_switch.cpp
34 next_command.cpp
45)
Original file line number Diff line number Diff line change 1+ // Copyright 2024-2024 the openage authors. See copying.md for legal info.
2+
3+ #include " next_command_switch.h"
4+
5+ #include " gamestate/component/internal/command_queue.h"
6+ #include " gamestate/game_entity.h"
7+
8+
9+ namespace openage ::gamestate::activity {
10+
11+ int next_command_switch (const time::time_t &time,
12+ const std::shared_ptr<gamestate::GameEntity> &entity) {
13+ auto command_queue = std::dynamic_pointer_cast<component::CommandQueue>(
14+ entity->get_component (component::component_t ::COMMANDQUEUE));
15+
16+ if (command_queue->get_queue ().empty (time)) {
17+ return -1 ;
18+ }
19+
20+ auto command = command_queue->get_queue ().front (time);
21+
22+ return static_cast <int >(command->get_type ());
23+ }
24+
25+ } // namespace openage::gamestate::activity
Original file line number Diff line number Diff line change 1+ // Copyright 2024-2024 the openage authors. See copying.md for legal info.
2+
3+ #pragma once
4+
5+ #include < cstddef>
6+ #include < memory>
7+
8+ #include " time/time.h"
9+
10+
11+ namespace openage ::gamestate {
12+ class GameEntity ;
13+
14+ namespace activity {
15+
16+ /* *
17+ * Returns true if the next command in the queue is an idle command.
18+ */
19+ int next_command_switch (const time::time_t &time,
20+ const std::shared_ptr<gamestate::GameEntity> &entity);
21+
22+ } // namespace activity
23+ } // namespace openage::gamestate
You can’t perform that action at this time.
0 commit comments