Added OP_POW to cdebug.c; refactored cosmoV_registerProtoObject

- cosmoV_registerProtoObject now walks the object list and updates the proto's for objects of the objType which have a NULL proto.
- misc. comment changes in cvm.h as well.
This commit is contained in:
2021-02-13 20:08:35 -06:00
parent 1fff6c7fe9
commit 5c71efbe40
3 changed files with 23 additions and 5 deletions

View File

@@ -427,6 +427,17 @@ COSMO_API CObjObject* cosmoV_makeObject(CState *state, int pairs) {
COSMO_API bool cosmoV_registerProtoObject(CState *state, CObjType objType, CObjObject *obj) {
bool replaced = state->protoObjects[objType] != NULL;
state->protoObjects[objType] = obj;
// walk through the object list
CObj *curr = state->objects;
while (curr != NULL) {
// update the proto
if (curr->type == objType && curr->proto != NULL) {
curr->proto = obj;
}
curr = curr->next;
}
return replaced;
}