unitsync.dll: GetMapCount() returns 0 unexpectedly

unitsync.dll: GetMapCount() returns 0 unexpectedly

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
Chimro
Posts: 7
Joined: 07 Jul 2008, 00:08

unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by Chimro »

When I call GetMapCount() I always get a return value of 0 even though I have already called Init(false, 0) and received a success value of 1. I assume there is some other method I need to call before GetMapCount() however, I haven't been able to find it yet in the TASClient source code.

Any help would be appreciated, thank you.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by trepan »

You might want to look at:
https://springrts.com/svn/spring ... t/test.cpp

The Init() function?
Chimro
Posts: 7
Joined: 07 Jul 2008, 00:08

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by Chimro »

trepan, thank you for your prompt reply and the link to the test code.

As I mentioned in my original post, I'd already called Init() with the proper parameters; however, GetMapCount() still returns zero.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by trepan »

Sorry, I completely glazed over your Init() remark. Other than
Init(), it doesn't look like anything else should be required.
Silly question: do you have any maps? ;-)
Chimro
Posts: 7
Joined: 07 Jul 2008, 00:08

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by Chimro »

trepan wrote:do you have any maps? ;-)
Yes, tons; well over 400.

I looked at the C++ test code and it used InitArchiveScanner(), but even when I invoke this before GetMapCount() the latter function still returns zero. I've also tried using AddAllArchives("C:\\Program Files\\Spring\\maps\\") and both combinations of InitArchiveScanner() and AddAllArchives("C:\\Program Files\\Spring\\maps\\"), but nothing seems to work.
Chimro
Posts: 7
Joined: 07 Jul 2008, 00:08

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by Chimro »

Alright, I've gotten it work. For some reason it only works when the executable file is in the Spring directory, even through the DLL doing the actual work is always in the Spring directory. :P

Does anyone know of a way around this?
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by aegis »

change the working directory to the spring directory before init'ing unitsync
Chimro
Posts: 7
Joined: 07 Jul 2008, 00:08

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by Chimro »

aegis wrote:change the working directory to the spring directory before init'ing unitsync
Thanks. How would I go about doing that?
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by aegis »

what language are you using?
Chimro
Posts: 7
Joined: 07 Jul 2008, 00:08

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by Chimro »

aegis wrote:what language are you using?
C#
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: unitsync.dll: GetMapCount() returns 0 unexpectedly

Post by Licho »

There is set of classes in C# for unitsync handling in springie and in cadownloader and in other utils.
Springie is in spring svn, other stuff in caspring.org svn.

If you want multiplatform one, grab the one from cadownloader, that works on linux too.
Post Reply

Return to “Engine”