Editor-level service responsible for overworld entity mutations. More...
#include <entity_mutation_service.h>

Classes | |
| struct | MutationResult |
Public Member Functions | |
| EntityMutationService (zelda3::Overworld &overworld) | |
| MutationResult | InsertEntity (const std::string &type, ImVec2 pos, int map_id, int game_state, uint8_t item_id=0) |
| Dispatches entity insertion based on type string. | |
| MutationResult | InsertEntity (const std::string &type, const OverworldContextTarget &target, uint8_t item_id=0) |
| MutationResult | DeleteItem (const zelda3::OverworldItem &item_identity) |
| MutationResult | DeleteSprite (zelda3::Sprite *sprite, int game_state) |
| MutationResult | DeleteEntrance (zelda3::OverworldEntrance *entrance) |
| MutationResult | DeleteExit (zelda3::OverworldExit *exit) |
| MutationResult | DuplicateItem (const zelda3::OverworldItem &source, int offset_x, int offset_y) |
| zelda3::OverworldItem * | ResolveNextSelection (const zelda3::OverworldItem &anchor_identity) |
| Resolves the best next item to select after a deletion. | |
Private Attributes | |
| zelda3::Overworld & | overworld_ |
Editor-level service responsible for overworld entity mutations.
This service coordinates high-level entity changes (insertion, deletion, duplication) that involve both domain mutation and UI-related dispatch.
Definition at line 31 of file entity_mutation_service.h.
|
explicit |
Definition at line 11 of file entity_mutation_service.cc.
| EntityMutationService::MutationResult yaze::editor::EntityMutationService::InsertEntity | ( | const std::string & | type, |
| ImVec2 | pos, | ||
| int | map_id, | ||
| int | game_state, | ||
| uint8_t | item_id = 0 ) |
Dispatches entity insertion based on type string.
Definition at line 31 of file entity_mutation_service.cc.
References yaze::editor::EntityMutationService::MutationResult::entity, yaze::editor::EntityMutationService::MutationResult::error_message, yaze::editor::InsertEntrance(), yaze::editor::InsertExit(), yaze::editor::InsertItem(), yaze::editor::InsertSprite(), overworld_, and yaze::editor::EntityMutationService::MutationResult::status.
Referenced by InsertEntity(), and yaze::editor::OverworldEntityWorkbench::ProcessPendingInsertion().

| EntityMutationService::MutationResult yaze::editor::EntityMutationService::InsertEntity | ( | const std::string & | type, |
| const OverworldContextTarget & | target, | ||
| uint8_t | item_id = 0 ) |
Definition at line 14 of file entity_mutation_service.cc.
References yaze::editor::EntityMutationService::MutationResult::error_message, yaze::editor::OverworldContextTarget::game_state, yaze::editor::GetParentMapId(), InsertEntity(), yaze::zelda3::Overworld::is_loaded(), yaze::editor::OverworldContextTarget::map_id, overworld_, yaze::zelda3::Overworld::overworld_map(), yaze::editor::OverworldContextTarget::parent_map_id, yaze::editor::EntityMutationService::MutationResult::status, yaze::editor::OverworldContextTarget::valid(), and yaze::editor::OverworldContextTarget::world_position.
| EntityMutationService::MutationResult yaze::editor::EntityMutationService::DeleteItem | ( | const zelda3::OverworldItem & | item_identity | ) |
Definition at line 103 of file entity_mutation_service.cc.
References yaze::editor::EntityMutationService::MutationResult::error_message, overworld_, yaze::editor::RemoveItemByIdentity(), and yaze::editor::EntityMutationService::MutationResult::status.

| EntityMutationService::MutationResult yaze::editor::EntityMutationService::DeleteSprite | ( | zelda3::Sprite * | sprite, |
| int | game_state ) |
Definition at line 114 of file entity_mutation_service.cc.
References yaze::zelda3::Overworld::mutable_sprites(), overworld_, and yaze::editor::EntityMutationService::MutationResult::status.

| EntityMutationService::MutationResult yaze::editor::EntityMutationService::DeleteEntrance | ( | zelda3::OverworldEntrance * | entrance | ) |
Definition at line 136 of file entity_mutation_service.cc.
References yaze::zelda3::OverworldEntrance::deleted, and yaze::editor::EntityMutationService::MutationResult::status.
| EntityMutationService::MutationResult yaze::editor::EntityMutationService::DeleteExit | ( | zelda3::OverworldExit * | exit | ) |
Definition at line 147 of file entity_mutation_service.cc.
References yaze::zelda3::OverworldExit::deleted_, and yaze::editor::EntityMutationService::MutationResult::status.
| EntityMutationService::MutationResult yaze::editor::EntityMutationService::DuplicateItem | ( | const zelda3::OverworldItem & | source, |
| int | offset_x, | ||
| int | offset_y ) |
Definition at line 88 of file entity_mutation_service.cc.
References yaze::editor::DuplicateItemByIdentity(), yaze::editor::EntityMutationService::MutationResult::entity, yaze::editor::EntityMutationService::MutationResult::error_message, overworld_, and yaze::editor::EntityMutationService::MutationResult::status.

| zelda3::OverworldItem * yaze::editor::EntityMutationService::ResolveNextSelection | ( | const zelda3::OverworldItem & | anchor_identity | ) |
Resolves the best next item to select after a deletion.
Definition at line 158 of file entity_mutation_service.cc.
References yaze::editor::FindNearestItemForSelection(), and overworld_.

|
private |
Definition at line 67 of file entity_mutation_service.h.
Referenced by DeleteItem(), DeleteSprite(), DuplicateItem(), InsertEntity(), InsertEntity(), and ResolveNextSelection().