Initial commit

This commit is contained in:
2026-06-13 19:45:36 +10:00
commit 284b08b12a
56 changed files with 1546 additions and 0 deletions

31
src/Struct/addField.c Normal file
View File

@@ -0,0 +1,31 @@
#include "../../include/ground.h"
void _GroundStructAddField(GroundStruct* gs, const char* id, GroundValue value) {
GroundObjectField* field;
HASH_FIND_STR(gs->fields, id, field);
if (field != NULL) {
Ground.Free.Value(field->value);
*field->value = Ground.Copy.Value(&value);
strncpy(field->name, id, 2047);
} else {
field = malloc(sizeof(GroundObjectField));
if (field == NULL) {
Ground.Flags.error = true;
return;
}
field->value = malloc(sizeof(GroundValue));
if (field->value == NULL) {
Ground.Flags.error = true;
return;
}
*field->value = Ground.Copy.Value(&value);
strncpy(field->name, id, 2047);
}
}