Home » MODDING HQ 1.13 » v1.13 General Development Talk » Code cleanups, how to contribute
Code cleanups, how to contribute[message #358918] Mon, 03 February 2020 13:38 Go to next message
CptMoore

 
Messages:224
Registered:March 2009
Hi there,

want to contribute by cleaning up some code.

It is mostly code related to new/old traits, I just created a SoldiersTraits class / file and applied some composition. Didn't move everything there yet until I know the official stance/way of such contribtions.

See https://github.com/CptMoore/ja2-1.13-source-mirror/pull/1/files

Would changes like that be welcome?

Just want to prepare the code for potential changes via http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=24318 in case enough feedback gets in.

Greetings,
CptMoore

Report message to a moderator

Sergeant 1st Class
Re: Code cleanups, how to contribute[message #358929 is a reply to message #358918] Tue, 04 February 2020 19:42 Go to previous messageGo to next message
CptMoore

 
Messages:224
Registered:March 2009
I have done some more refactorings and I am confident that the new class(es) and moving stuff there is helpful in remove code clones.

Already touched 34 files.

I want to basically move all
if (gGameOptions.fNewTraitSystem)
checks into the new SoldierTraits and ProfileTraits classes. That declutters a lot already and remove code clones since it's easier to share code now.

Report message to a moderator

Sergeant 1st Class
Re: Code cleanups, how to contribute[message #358948 is a reply to message #358918] Fri, 07 February 2020 03:31 Go to previous messageGo to next message
CptMoore

 
Messages:224
Registered:March 2009
Here is a patch that introduces VS2019 files and a script that can quickly create new VS files (prepare-vs-files.sh can be run using git bash on windows).

Quote:
https://patch-diff.githubusercontent.com/raw/CptMoore/ja2-1.13-source-mirror/pull/2.patch
After that, one can try applying the first batch of code cleanups, includes the new traits file that is added to all VS project files. (only tested VS2019 variant)

Quote:
https://patch-diff.githubusercontent.com/raw/CptMoore/ja2-1.13-source-mirror/pull/1.patch
After googling, those github-generated patches might not be subversion compatible, so after an hour of pain I have create 2 hopefully-subversion-compatible patches one can download here:

Quote:
https://github.com/CptMoore/ja2patches

The code cleanups are far from finished as one can always improve things, but the general idea of how to consolidate code is already implemented (traits file, 2 classes, naming conventions, patterns on how to use those classes)

Report message to a moderator

Sergeant 1st Class
Re: Code cleanups, how to contribute[message #359270 is a reply to message #358948] Thu, 26 March 2020 20:23 Go to previous messageGo to next message
wanne (aka RoWa21) is currently offline wanne (aka RoWa21)

 
Messages:1961
Registered:October 2005
Location: Austria
Did someone already put the code to svn?

Report message to a moderator

Sergeant Major

Re: Code cleanups, how to contribute[message #359272 is a reply to message #359270] Thu, 26 March 2020 21:19 Go to previous messageGo to next message
CptMoore

 
Messages:224
Registered:March 2009
Not that I know

Report message to a moderator

Sergeant 1st Class
Re: Code cleanups, how to contribute[message #359273 is a reply to message #359272] Fri, 27 March 2020 09:15 Go to previous messageGo to next message
wanne (aka RoWa21) is currently offline wanne (aka RoWa21)

 
Messages:1961
Registered:October 2005
Location: Austria
CptMoore wrote on Thu, 26 March 2020 19:19
Not that I know
I can put the code to svn, as long as it does not break anything. So its just refactoring?

Report message to a moderator

Sergeant Major

Re: Code cleanups, how to contribute[message #359294 is a reply to message #359273] Sat, 28 March 2020 23:07 Go to previous messageGo to next message
CptMoore

 
Messages:224
Registered:March 2009
I didnt test all the code the refactorings touched, so there might be stuff breaking, but I also fixed some bugs by removing code cloned that were forgotten when fixing those bugs.

The problem is merging the VS2019 files I also added, might be better to just ignore those and kick em out (or re-create them using the prepare-vs-files.sh script from one of the patches).

Report message to a moderator

Sergeant 1st Class
Re: Code cleanups, how to contribute[message #359412 is a reply to message #359294] Sun, 05 April 2020 00:23 Go to previous message
CptMoore

 
Messages:224
Registered:March 2009
I just saw after was told by the guy who did it, that another VS2019 was already added.
Probably not compatible with how I did it.

Anyway I wouldn't apply my changes anymore.

For this project to allow refactorings, smaller/quicker change cycles would be necessary and that would require some fundamental changes of the project structure to make them go smooth:
- Switch to something like cmake to support VS2005 to VS2019 without having to add new files to each VS project file manually and hoping it somehow works. Right now nobody wants to add files because its a hassle to add them to all VS project files separately (there are project files for 2005, 2008, 2010, 2013, 2017, 2019). That then means some few files grow and grow and grow instead of being split nicely.
- Addition of Continuous Integration (CI), checks if the code properly compiles outside of my dev machine. That way many small refactorings can be more confidently merged, shorting the refactoring cycles even more.
- Switch to git. If someone can use VS to directly commit to github without using extra tools like TortoiseSVN, where a free CI-build system can compile my code before merging into master, then the cycle is even more tightly done and refactorings can be done even more often.

After talking on Discord about it, I see many of the JA 1.13 dev-cycle problems already solved by ja2-stracciatella, so using their git+(travis/)appveyor+cmake setup (https://github.com/ja2-stracciatella/ja2-stracciatella) as a base provides a quick and efficient dev cycle that would benefit everyone.

Sry for this rambling, this is more for the archive if anyone will ever wonder.

Report message to a moderator

Sergeant 1st Class
Previous Topic: ja2MapTool
Next Topic: Jagged Alliance 2 v1.13 mercenaries details API
Goto Forum:
  


Current Time: Mon Jan 20 20:54:07 GMT+2 2025

Total time taken to generate the page: 0.00979 seconds