Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/libsurvive/survive_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ SURVIVE_EXPORT bool survive_simple_object_charging(const SurviveSimpleObject *sa
/**
* @return The object charge percent from 0 to 100
*/
SURVIVE_EXPORT uint8_t survive_simple_object_charge_percent(const SurviveSimpleObject *sao);

/**
* @deprecated Misspelled name kept for backwards compatibility; use
* survive_simple_object_charge_percent() instead.
*/
SURVIVE_EXPORT uint8_t survive_simple_object_charge_percet(const SurviveSimpleObject *sao);

/**
Expand Down
7 changes: 6 additions & 1 deletion src/survive_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ SURVIVE_EXPORT bool survive_simple_object_charging(const SurviveSimpleObject *sa
}
}

SURVIVE_EXPORT uint8_t survive_simple_object_charge_percet(const SurviveSimpleObject *sao) {
SURVIVE_EXPORT uint8_t survive_simple_object_charge_percent(const SurviveSimpleObject *sao) {
switch (sao->type) {
case SurviveSimpleObject_LIGHTHOUSE: {
return 100;
Expand All @@ -494,6 +494,11 @@ SURVIVE_EXPORT uint8_t survive_simple_object_charge_percet(const SurviveSimpleOb
}
}

// Deprecated: backwards compatibility with the old misspelled name.
SURVIVE_EXPORT uint8_t survive_simple_object_charge_percet(const SurviveSimpleObject *sao) {
return survive_simple_object_charge_percent(sao);
}

const char *survive_simple_object_name(const SurviveSimpleObject *sao) { return sao->name; }
const char *survive_simple_serial_number(const SurviveSimpleObject *sao) {
switch (sao->type) {
Expand Down