noxworld-dev / opennox

OpenNox main repository.
GNU General Public License v3.0
440 stars 23 forks source link

Separate timer and dialog package out from legacy #706

Closed blmarket closed 2 days ago

blmarket commented 1 week ago

Hey, I'm not sure it aligns with overall direction you may want, so just created this PR to explain what I think. Feel free to give your opinion on it.

Motivation: Encapsulate dialog package so we can have unit test and integration test available for it without initiating whole legacy package.

Next steps:

Required sign-off

blmarket commented 1 week ago

Seems now it goes a bit more wilder than I thought, but just giving a try.

blmarket commented 4 days ago

Looks good to me!

Would you allow me to shuffle files around a bit? Since there's no C in tests now, the tests can be in the same package as the dialog, for example.

Also, I got an idea about the NewDialog. I was thinking maybe I can move all the function export variables like Sub_413890 and GetStringManager to a function argument of NewDialog. Less global state - the better.

Sure, sounds like a good idea. Seems it will be a big refactoring if we have to move all dependencies into a module.

dennwc commented 3 days ago

@blmarket Done! I moved all function to methods on Dialog and also removed the global state. Ready to merge, if all is good here.

blmarket commented 2 days ago

@blmarket Done! I moved all function to methods on Dialog and also removed the global state. Ready to merge, if all is good here.

Looks great to me as well! Thanks for the help! Will try to use similar structure for the future works. Passed all my manual in-game tests.

dennwc commented 2 days ago

@blmarket I had to squash all the commits, unfortunately. Initially I wanted to only group them (e.g. squash minor fixes only), but that Nox data file was in the middle of the commit log.