make object fields public and fixup compile errors
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
7be1675180
commit
8dd53b4597
13 changed files with 258 additions and 216 deletions
|
|
@ -51,15 +51,15 @@ cppbase::Result<IkarusPropertyType, sqlitecpp::SingleQueryError> IkarusProperty:
|
|||
IKA_API void ikarus_property_delete(IkarusProperty * property) {
|
||||
LOG_INFO("deleting property");
|
||||
|
||||
LOG_VERBOSE("project={};property={}", property->get_project()->get_path().c_str(), property->get_id());
|
||||
LOG_VERBOSE("project={};property={}", property->project->get_path().c_str(), property->id);
|
||||
|
||||
auto * ctx = property->get_project()->get_function_context();
|
||||
auto * ctx = property->project->get_function_context();
|
||||
|
||||
TRYRV(
|
||||
,
|
||||
property->get_project()
|
||||
property->project
|
||||
->get_db()
|
||||
->execute("DELETE FROM `objects` WHERE `id` = ?", property->get_id())
|
||||
->execute("DELETE FROM `objects` WHERE `id` = ?", property->id)
|
||||
.on_error([ctx](auto const& err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to delete property from objects table: {}", err),
|
||||
|
|
@ -72,7 +72,7 @@ IKA_API void ikarus_property_delete(IkarusProperty * property) {
|
|||
|
||||
LOG_VERBOSE("property was successfully deleted from database, freeing");
|
||||
|
||||
property->get_project()->uncache_property(property);
|
||||
property->project->uncache(property);
|
||||
|
||||
LOG_VERBOSE("successfully deleted property");
|
||||
}
|
||||
|
|
@ -80,23 +80,23 @@ IKA_API void ikarus_property_delete(IkarusProperty * property) {
|
|||
IkarusPropertyType ikarus_property_get_type(IkarusProperty const * property) {
|
||||
LOG_VERBOSE("fetching property type");
|
||||
|
||||
return IkarusProperty::get_property_type(property->get_project(), property->get_id())
|
||||
return IkarusProperty::get_property_type(property->project, property->id)
|
||||
.unwrap_value_or(IkarusPropertyType_Toggle);
|
||||
}
|
||||
|
||||
IkarusPropertySource const * ikarus_property_get_source(IkarusProperty const * property) {
|
||||
LOG_VERBOSE("fetching property source");
|
||||
|
||||
LOG_VERBOSE("project={};property={}", property->get_project()->get_path().c_str(), property->get_id());
|
||||
LOG_VERBOSE("project={};property={}", property->project->get_path().c_str(), property->id);
|
||||
|
||||
auto * ctx = property->get_project()->get_function_context();
|
||||
auto * ctx = property->project->get_function_context();
|
||||
|
||||
VTRYRV(
|
||||
auto const source,
|
||||
nullptr,
|
||||
property->get_project()
|
||||
property->project
|
||||
->get_db()
|
||||
->query_one<int>("SELECT `source` FROM `properties` WHERE `id` = ?", property->get_id())
|
||||
->query_one<int>("SELECT `source` FROM `properties` WHERE `id` = ?", property->id)
|
||||
.on_error([ctx](auto const& err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to fetch property's source: {}", err),
|
||||
|
|
@ -108,8 +108,8 @@ IkarusPropertySource const * ikarus_property_get_source(IkarusProperty const * p
|
|||
);
|
||||
|
||||
switch (ikarus_id_get_object_type(source)) {
|
||||
case IkarusObjectType_Blueprint: return new IkarusPropertySource{property->get_project()->get_blueprint(source)};
|
||||
case IkarusObjectType_Entity: return new IkarusPropertySource{property->get_project()->get_entity(source)};
|
||||
case IkarusObjectType_Blueprint: return new IkarusPropertySource{property->project->get_blueprint(source)};
|
||||
case IkarusObjectType_Entity: return new IkarusPropertySource{property->project->get_entity(source)};
|
||||
default: {
|
||||
ctx->set_error(
|
||||
fmt::format("PropertySource is neither blueprint nor entity"),
|
||||
|
|
@ -126,16 +126,16 @@ IkarusPropertySource const * ikarus_property_get_source(IkarusProperty const * p
|
|||
IkarusValue * ikarus_property_get_default_value(IkarusProperty const * property) {
|
||||
LOG_VERBOSE("fetching property default value");
|
||||
|
||||
LOG_VERBOSE("project={};property={}", property->get_project()->get_path().c_str(), property->get_id());
|
||||
LOG_VERBOSE("project={};property={}", property->project->get_path().c_str(), property->id);
|
||||
|
||||
auto * ctx = property->get_project()->get_function_context();
|
||||
auto * ctx = property->project->get_function_context();
|
||||
|
||||
VTRYRV(
|
||||
auto const value,
|
||||
nullptr,
|
||||
property->get_project()
|
||||
property->project
|
||||
->get_db()
|
||||
->query_one<int>("SELECT `default_value` FROM `properties` WHERE `id` = ?", property->get_id())
|
||||
->query_one<int>("SELECT `default_value` FROM `properties` WHERE `id` = ?", property->id)
|
||||
.on_error([ctx](auto const& err) {
|
||||
ctx->set_error(
|
||||
fmt::format("failed to fetch property's default value: {}", err),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue