Page 1 of 1
UnitSync :: about function
Posted: 08 Sep 2011, 10:15
by danil_kalina
Where could I find out more information about functions in that library ?
I need a function that returns the state of map's existence.
GetMapArchiveCount ???
Re: Unitsync.dll, about function
Posted: 08 Sep 2011, 10:37
by koshi
Re: Unitsync.dll, about function
Posted: 08 Sep 2011, 13:18
by danil_kalina
We do have a such function for Mods, but for Maps doesn't:
GetPrimaryModIndex(const char* name)
For all downloaded maps "GetMapArchiveCount" returns "2"
For nonexistent maps "GetMapArchiveCount" returns "1"
Re: Unitsync.dll, about function
Posted: 08 Sep 2011, 13:31
by koshi
You're not making much sense to me. I suggest you read the api docs again or maybe have a look at one of the unitsync users like SpringLobby or Tasclient.
Re: Unitsync.dll, about function
Posted: 08 Sep 2011, 23:33
by danil_kalina
SpringLobby loads "MapNameList" and "ModNameList" through iterating all the maps and mods. If we want to find any map we just need to verify it in the list.
I thought of a such way. so no other way exists I think.
Re: Unitsync.dll, about function
Posted: 09 Sep 2011, 00:52
by Andrej
I think you can check for existence of a single map like this:
If you get a '0' return value from calling GetMapInfo with the map's name and GetNextError returns a string starting with "Could not find a map" after the call, that means the map doesn't exist.
(See the 'throw' statement in GetMapFile inside unitsync.cpp for the exact wording on error message)
The way the check is implemented internally in ArchiveScanner is by iterating through all maps:
Code: Select all
for (std::map<std::string, ArchiveInfo>::const_iterator aii = archiveInfo.begin(); aii != archiveInfo.end(); ++aii) {
if (s == aii->second.archiveData.name) {
return aii->second.archiveData.mapfile;
}
}
So I assume it's not very fast.
Re: Unitsync.dll, about function
Posted: 28 Oct 2011, 23:46
by danil_kalina
GetSides
GetSideName(int side)
How we could retrieve Icon for side(faction) ?
Icon for ARM and CORE
Re: Unitsync.dll, about function
Posted: 13 Jan 2012, 15:14
by abma
(i know its an old thread, but the question is still unanswerd)
this should help:
http://springrts.com/wiki/Mod_Development:Sidepics
and maybe
http://answers.springlobby.info/ is a better place for such questions.
Re: Unitsync.dll, about function
Posted: 13 Jan 2012, 16:17
by danil_kalina
thanks
have to extract the game, then take pictures. not good, but it is ok.
but the icon is in .bmp format and also not fully transparent, WTF ?
why not .png ?
Re: Unitsync.dll, about function
Posted: 13 Jan 2012, 16:30
by koshi
danil_kalina wrote:have to extract the game
Uhm, are you not aware of spring's vfs? Or is that what you mean?
danil_kalina wrote:but the icon is in .bmp format and also not fully transparent, WTF ?
why not .png ?
SpringLobby has been supporting png for a very long time, it's up to the game dev to actually use png.
Re: UnitSync :: about function
Posted: 13 Jan 2012, 19:33
by PicassoCT
Yeah, yeah.. its always them gamedevs fault.

Re: Unitsync.dll, about function
Posted: 03 Feb 2012, 14:42
by danil_kalina
koshi wrote:Uhm, are you not aware of spring's vfs? Or is that what you mean?
Not aware of VFS
Re: Unitsync.dll, about function
Posted: 04 Feb 2012, 04:56
by Axiomatic
danil_kalina wrote:Not aware of VFS
Here's a simple example without error checking.
Code: Select all
//load mod
const char *modName = "Balanced Annihilation V7.63";
Init();
GetPrimaryModCount();
int modIndex = GetPrimaryModIndex(modName);
GetPrimaryModArchiveCount(modIndex);
AddAllArchives(GetPrimaryModArchive(modIndex));
const char *sidePath = "SidePics/ARM.png";
int fd = OpenFileVFS(sidePath);
if (!fd) {
sidePath = "SidePics/ARM.bmp";
fd = OpenFileVFS(vfsPath);
}
size_t fileSize = FileSizeVFS(fd);
uint8_t buff[fileSize];
ReadFileVFS(fd, buff, sizeof(buff));
CloseFileVFS(fd);
The sidepic can be BMP or PNG. If its BMP then white is used for transparency.
Re: UnitSync :: about function
Posted: 04 Feb 2012, 11:28
by danil_kalina
Thanks a lot. Very nice example
