Page MenuHomeWildfire Games

Slight AddObjectType cleanup
AbandonedPublic

Authored by wraitii on Jun 14 2020, 3:27 PM.

Details

Reviewers
Itms
Summary

This refactors slightly how object types are added to the GUI factory function.

it lets the xml name be defined in the class instead of in the ObjectType.h header, which seems neater.


Taken from D2768

Test Plan

Agree with the change

Event Timeline

wraitii created this revision.Jun 14 2020, 3:27 PM
wraitii edited the summary of this revision. (Show Details)

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2433/display/redirect

Itms added a reviewer: Itms.Jun 23 2020, 3:22 PM
Itms added a subscriber: Itms.

I am not sure I like this change... ? I feel like grouping the association between XML names and C++ classes in a single place is neater.

This patch increases the complexity of the macro, so it sounds like we are hiding some code there. We are actually hiding some code by creating a macro with the same name as the actual function, which is very confusing.

IMHO we should not commit this.

This patch adds a new GetObjectType, so I assume this was the original aim of the new code?

In D2817#121283, @Itms wrote:

I am not sure I like this change... ? I feel like grouping the association between XML names and C++ classes in a single place is neater.

I think it depends on your POV, but I think if we move towards more JS/C++ integration in the future (which sounds like the direction we are taking) it makes sense.

We are actually hiding some code by creating a macro with the same name as the actual function, which is very confusing.

Not sure what you mean here?

This patch adds a new GetObjectType, so I assume this was the original aim of the new code?

It's required in D2768 for the GUI Object to know which factory object to use (since JS objects can now be different for each GUI Object). There are other possible design patterns, ofc.

wraitii abandoned this revision.Jul 14 2020, 9:46 AM