Mechanized Assault & eXploration Reloaded



#11 Jan 05, 2012 2:46 pm
Nix Offline
Mitglied
Registered since: Dec 17, 2007
Posts: 26


Subject: Re: Couple of questions
I think I got the sentry thing working decently:

Replaced
Quote:
if (sentryActive || data.canAttack)
in unit.cpp file lines 319, 475 and 748 to
Quote:
if ((sentryActive || (isBuilding () == false && !data.canDisable && isUnitBuildingABuilding () == false) || (isBuilding () && data.canAttack))

Considering I'm not a programming person at all, I'm pretty proud of that change Wink

There's still something wrong though. The shortcut for sentry works on removing sentry on all the "support" units (surveyors, engineers, minelayers etc.), but you can't set them to sentry with the shortcut, but only with the mouse menu. Any idea what's going on in there? :O
This post has been edited 2 times. Last edit on Jan 05, 2012 2:48 pm by Nix. ↑  ↓

#12 Jan 05, 2012 9:57 pm
Nix Offline
Mitglied
Registered since: Dec 17, 2007
Posts: 26


Subject: Re: Couple of questions
I made a similar function to GetNextVehicle (basically the "Next unit" button), that browses idle production buildings. Any hints how this could be merged to the "Next unit" button? I think I'll add an extra button for the time being Smiling

Quote:

//--------------------------------------------------
------------------------
/** Returns the next building that is in "waiting" status with empty queue -Nixx */
//--------------------------------------------------
------------------------
cBuilding *cPlayer::GetNextBuilding ()
{
    cBuilding *b, *start;
    bool next = false;
    if ( Client->gameGUI.getSelBuilding() && Client->gameGUI.getSelBuilding()->owner == this )
    {
        start = Client->gameGUI.getSelBuilding();
        next = true;
    }
    else
        start = BuildingList;

    if ( !start )
        return NULL;
    b = start;
    do
    {
        if ( !next && !b->IsWorking && b->BuildList)
            return b;
        next = false;
        if ( b->next )
            b = b->next;
        else
            b = BuildingList;
    }
    while ( b != start );
    return NULL;
}
↑  ↓

#13 Jan 05, 2012 10:29 pm
Toranaga Toranaga Offline
Developer
Registered since: Dec 28, 2005
Posts: 232


Subject: Re: Couple of questions
Hi Nix,
you're no programming person? But looks like it Smiling
At least you find your way in code and know how to compile something. And your solution for the sentry looks good (and you found all relevant places). Respect

For the "next/prev unit" function, that combines vehicles and buildings: Maybe two functions "getNextUnit/getPrevUnit" would be better suited. Else it might be difficult to merge the buildings and the vehicles lists in a consistent way. When you put it in one function, you could for example first search the vehicles list, then when its end is reached continue with the buildings. Just an idea...

Do you plan to send your code as patch to someone who can put it in the svn? Or is it mainly for your own use? Smiling
Anyway I would like to look at that unit-cycle topic (I didn't use that feature myself before, but now I like it) and implement it completely (also the "done" functionality) when I have time for it. But if you do all the changes, it would be ok for me.
Paul Grathwohl (pagra)
↑  ↓

#14 Jan 06, 2012 1:39 am
Nix Offline
Mitglied
Registered since: Dec 17, 2007
Posts: 26


Subject: Re: Couple of questions
Quote by Toranaga:
Hi Nix,
you're no programming person? But looks like it Smiling
At least you find your way in code and know how to compile something. And your solution for the sentry looks good (and you found all relevant places). Respect

For the "next/prev unit" function, that combines vehicles and buildings: Maybe two functions "getNextUnit/getPrevUnit" would be better suited. Else it might be difficult to merge the buildings and the vehicles lists in a consistent way. When you put it in one function, you could for example first search the vehicles list, then when its end is reached continue with the buildings. Just an idea...

Do you plan to send your code as patch to someone who can put it in the svn? Or is it mainly for your own use? Smiling
Anyway I would like to look at that unit-cycle topic (I didn't use that feature myself before, but now I like it) and implement it completely (also the "done" functionality) when I have time for it. But if you do all the changes, it would be ok for me.

Well I know the programming basics and know how to get around and look for stuff (and copy paste :)).

You (or any of the devs) can use my sentry line and add it to SVN if you want? It's basically only that change I mentioned above, nothing else. I'd appreciate if someone with some C++ experience would try to figure why the "S" shortcut doesn't work on non-combat units to activate sentry. Sentry deactivation works with shortcut and activation works through mouse menu only on my solution. It's a minor nuisance but would be cool if it worked like the real thing Smiling

Next/Prev unit and Done: I was thinking also about merging the "GetNextVehicle" with buildings to GetNextUnit function, but not sure if my copy/paste skills work with that kind of task any more... I was thinking that the "Done" state could be implemented with tagging units with "IsDone" or something like that, and GetNextUnit/GetPrevUnit checks that tag/status and skips the unit if "IsDone == true".

I might actually get kinda hooked on programming here, I've browsed the source files all day today (was on sick leave) Smiling

Oh one question: my compiled maxr.exe works fine on my comp, but when I sent it to my friend it didn't work because of some missing MSVCP100D.dll libraries. Alzis SVN exe worked fine on him. What's different on my compiled .exe?

While we're at it, a second question! Do I remember right that in original MAX, units stopped when a new enemy entered their scan range? I didn't find a ticket on this issue. This could be slipped somehow into "cVehicle::makeDetection()", I guess?
This post has been edited 2 times. Last edit on Jan 06, 2012 1:49 am by Nix. ↑  ↓

#15 Jan 06, 2012 10:55 am
Nix Offline
Mitglied
Registered since: Dec 17, 2007
Posts: 26


Subject: Re: Couple of questions
So glad I'm on sick leave Wink

I think I got the "Done" button working now. It doesn't execute move command paths (should be easy to fix I guess), but removes vehicles from GetNextVehicle cycle until they're selected again or turn ends.

I also added builder units that have finished building to the GetNextVehicle cycle, very important thing imo.

I'm working on adding the idle production buildings to GetNextVehicle cycle now. I also have a temproary solution, an extra button to scroll through those, I think that'd be even better idea than merging the lists, if it was made a bit more visually pleasing Smiling
↑  ↓

#16 Jan 06, 2012 11:41 am
ness Offline
Developer
Registered since: Nov 12, 2010
Posts: 59


Subject: Re: Couple of questions
Quote by Nix:

Oh one question: my compiled maxr.exe works fine on my comp, but when I sent it to my friend it didn't work because of some missing MSVCP100D.dll libraries. Alzis SVN exe worked fine on him. What's different on my compiled .exe?

You should have build in debug mode. Try to rebuild in release Smiling
↑  ↓

#17 Jan 06, 2012 12:06 pm
Nix Offline
Mitglied
Registered since: Dec 17, 2007
Posts: 26


Subject: Re: Couple of questions
Quote by ness:
Quote by Nix:

Oh one question: my compiled maxr.exe works fine on my comp, but when I sent it to my friend it didn't work because of some missing MSVCP100D.dll libraries. Alzis SVN exe worked fine on him. What's different on my compiled .exe?

You should have build in debug mode. Try to rebuild in release Smiling

Of course! Thanks for the answer Smiling
↑  ↓

#18 Jan 06, 2012 1:20 pm
alzi alzi Offline
Developer, Moderator
Registered since: Aug 12, 2007
Posts: 339


Subject: Re: Couple of questions
Quote by ness:
Quote by Nix:

Oh one question: my compiled maxr.exe works fine on my comp, but when I sent it to my friend it didn't work because of some missing MSVCP100D.dll libraries. Alzis SVN exe worked fine on him. What's different on my compiled .exe?

You should have build in debug mode. Try to rebuild in release Smiling

It's not about debug or release here. This comes because you link your application against the dynamic Visual C++ runtime libraries but any other computer that has not installed Visual Studio does not have them. There are two ways of fixing this: The first one is to install the runtime on the computer of your friend. You can get it here.
The other way is to link your application against the runtime statically (that's what I do). To do this you have to go into the preferences of your project, select C/C++ -> Code Generation and then change "Runtime Library" from "Multithreaded Debug DLL" to the same without "DLL" (and for the release mode of course without Debug). The problem with this is that all the libraries you use have to be build with the same setting, what for maxr means that you may have to rebuild the SDL libraries as well.
Albert Ziegenhagel
This post has been edited 1 times. Last edit on Jan 06, 2012 1:21 pm by alzi. ↑  ↓

#19 Jan 06, 2012 2:28 pm
Nix Offline
Mitglied
Registered since: Dec 17, 2007
Posts: 26


Subject: Re: Couple of questions
Quote by alzi:
The problem with this is that all the libraries you use have to be build with the same setting, what for maxr means that you may have to rebuild the SDL libraries as well.

Can you give me a hint how do I rebuild the SDL libraries and what do I do with them? :O
↑  ↓

#20 Jan 06, 2012 5:22 pm
alzi alzi Offline
Developer, Moderator
Registered since: Aug 12, 2007
Posts: 339


Subject: Re: Couple of questions
Quote by Nix:

Can you give me a hint how do I rebuild the SDL libraries and what do I do with them? :O


Yes I can Wink But it is quite some work. First you have to download the SDL source code from here. In the ZIP file there should be another ZIP file called "VisualC" (or "VisualCE" for the Express Edition). Extract this as well and you should have simple Visual Studio project that you can use (they may will be for an older version of Visual Studio but the version converter should do his work). The next problem when building SDL for windows is that you will need the DirectX-SDK. It's a huge file that you can get here. After downloading and installing it (make sure all Visual Studio is not running during the installation) you now can open the SDL project solution and change the Multi-threading thing in all the project. Then hit rebuild solution and if I did not forget anything it should work ^^ I think building in release mode should be enough since you do not necessarily need the debug information of SDL. After that you have to change the include and library paths to the new folder where they have been build to. You may have to copy the generated files (SDLmain.lib and SDL.lib to a lib directory first, because they will be generated into the Release folder by default iirc).
The same procedure has to be done for SDL_mixer and SDL_net afterwards.

This was just a short description and I hope I could explain everything sufficient.
Maybe I will extend the Visual Studio How-To when I have time for it.

Edit: Just found a much more easy way: I zipped the libs that I build for myself and uploaded them here Wink
Albert Ziegenhagel
This post has been edited 1 times. Last edit on Jan 06, 2012 5:29 pm by alzi. ↑  ↓

Pages (4): 1, 2, 3, 4

All times are GMT +02:00. Current time: 4:43 am.