MegaMek Discussion Board
Where do I find the repair bay code? - Printable Version

+- MegaMek Discussion Board (https://forum.megamek.org)
+-- Forum: Related Applications (https://forum.megamek.org/forum-5.html)
+--- Forum: MekHQ (https://forum.megamek.org/forum-17.html)
+--- Thread: Where do I find the repair bay code? (/thread-1435.html)



Where do I find the repair bay code? - pheonixstorm - 05-14-2014

Looking to start fiddling with the zero tech and assigned tech at top ideas but need to see how the whole repair code is setup to see if I can.


Re: Where do I find the repair bay code? - pheonixstorm - 05-14-2014

I think I found part of what I was looking for... So, when repairing a mech does it use fixPart(IPartWork partWork, Person tech) (line 1455 from campaign.java)? For the tech list does it call getTech (line 979)? What I can't seem to find is where the techs are sorted. I know at some point it has to call the compare function from techsorter but i can't seem to find this.

If I'm right I should be able to modify getTech to drop the 0 minute techs (provided if refreshes each time a new mech is selected or after each repair) but that still leaves the function that handles the refresh I guess.


Re: Where do I find the repair bay code? - pheonixstorm - 05-14-2014

Ok, got my 0 minute techs out of the way but it causes an annoying bug. If I try to bring my astech teams up to full strength while some techs has no time left I cannot get the proper amount. It just doesn't count the techs toward the needed number of astech. So, off I go trying to chase down where getTech is called to figure the number of needed astechs.

Does eclipse has a nice find function that will search the ENTIRE project for something? Limiting my search to whatever page has focus is tedious. I miss that from visual studio.. Sad


Re: Where do I find the repair bay code? - Arlith - 05-14-2014

Right click -> References -> Workspace will show you everywhere in your work space references whatever symbol your cursor is on (variable, method, etc).

Right click -> Declarations -> Workspace will show you everywhere in your work space that declares whatever symbol your cursor is on. 

These two are ridiculously powerful.  Ctrl-Shft-G for References, Ctrl-G for Declarations (the context menu tells you the short cuts to).


Re: Where do I find the repair bay code? - pheonixstorm - 05-14-2014

I tried the first two in the branch but it didn't work. Should have thought about using it on trunk (which DOES work) but never gave it another thought.

Thanks for the reminder or i never would have thought to try it on trunk after it failed on the branch.

After looking around earlier though I see a lot of places that call getTechs() so I will have to find where the repair bay calls it so I can add a second function or find a way to cleanly alter the original. Fun fun.


Re: Where do I find the repair bay code? - pheonixstorm - 07-27-2014

I am trying to get a patch started to finish #162 Repair Bay: Assigned Tech at top of list but I can't seem to find where the damaged part is located in the code. I keep going in circles looking for the selected part and how it pulls up the list of techs. getTechs() and its cousins go nowhere as does refreshTechList and several other functions. Help!


Re: Where do I find the repair bay code? - pheonixstorm - 07-31-2014

Thought I might have had it nailed down in filtertechs() but it turned out to be a dead end. There isn't much in the way of labels for the repair bay tab but the code is so confusing it is difficult to tell what applies to what and where I should look to update the tech list to include the units assigned tech at the top rather than entirely sorted by experience. I know if you click on the unit it brings up a list of parts for repair. Click on a part and it brings up the list of techs.


Re: Where do I find the repair bay code? - ralgith - 07-31-2014

Just FYI... the code for this is already in my latest work that hasn't been committed. You're way off on what you're doing Wink


Re: Where do I find the repair bay code? - pheonixstorm - 07-31-2014

Gee thanks lol At least when you do put it up I can kick myself for being so far off base.

The best I could find was getSelectedTech and filterTechs()... I did however manage to get my assigned tech to the top of the "Assign all Tasks" list Smile was wasn't a complete loss.

*EDIT* Just saw that the code was up. I had thought about going for the techsorter code but dismissed it since getTechs was setup to handle the UUID by Deric. Thought that was the proper route so just went with it. Hence, the going around in circles Sad Oh well, its done and will probably make the AtB crowd happy as well as a great many others.


Re: Where do I find the repair bay code? - pheonixstorm - 08-01-2014

Umm... your code didn't work

*runs*


Re: Where do I find the repair bay code? - ralgith - 08-01-2014

(08-01-2014, 12:19 AM)pheonixstorm link Wrote:Umm... your code didn't work

*runs*

Worked just fine for me... make sure you're checking out the trunk and not my branch. I haven't merged into the branch yet and wont until I'm actually ready to do a release.


Re: Where do I find the repair bay code? - pheonixstorm - 08-01-2014

I did, though that was also only using the first commit. Did not notice the other two until just now.


Re: Where do I find the repair bay code? - ralgith - 08-01-2014

(08-01-2014, 12:42 AM)pheonixstorm link Wrote:I did, though that was also only using the first commit. Did not notice the other two until just now.

Well, I literally just fixed the bug, so... yeah lol.