PDA

View Full Version : Problem with manymaps



agribilos
5th February 2021, 12:37
I got a problem with manymaps. The problem is that it deletes some iwd files even though they are not links. My server is setup on ubuntu 18.04.5 LTS. At the moment i run 2 cod2 servers and each one has its own fs_game folder. In each fs_game i have a Library folder with the custom maps i use. Inside fs_game i also have 2 iwd files needed at all times by the client. They are 000empty.iwd and zzzmod.iwd (client part of my mod). Each fs_game is represented by its own folder on my apache server. So far so good no problem it works ok. The problem begun when i tried to use symlinks so i don't have to keep multiple copies of the same files. So i created o folder on my apache server with all the required files(lets call it maps). I linked the maps folder to the Library folder on each fs_game folder and i also linked maps folder to fs_game on apache. So far not an issue. Each cod server sees the maps fine. If i put 000empty.iwd and zzzmod.iwd in the maps folder then the physical copies in the server fs_game folder get deleted when i start the cod2 servers. I tried to mess with permissions and ownerships without any luck. Any suggestions?

IzNoGoD
5th February 2021, 14:08
>If i put 000empty.iwd and zzzmod.iwd in the maps folder then the physical copies in the server fs_game folder get deleted when i start the cod2 servers

Please specify this a bit. Are you putting your mod.iwd and empty.iwd in your Library folder? Why?

kung foo man
5th February 2021, 14:24
Please always say which version you are using, since manymaps differs:

https://github.com/kungfooman/libcod/blob/master/libcod.cpp#L2082
https://github.com/voron00/libcod/blob/master/libcod.cpp#L1171

The original version (my repo) ignores .iwd's which contain either "zzz_" or "Empty", but I don't see this is a problem in your case anyway (since it seemed to work before and your symlinks are causing the issue).

The code is not checking if it deletes a symlink or real file (simple access(file, F_OK) != -1; in both repos)

So you could add a symlink check, if that's the problem

IzNoGoD
5th February 2021, 15:49
tl;dr:

https://github.com/voron00/libcod/blob/master/libcod.cpp#L1230

Voron's libcod deletes anything that's inside your library folder. So, dont put your mod in your library folder (nor your empty.iwd file)

agribilos
5th February 2021, 18:35
Sorry for not specifying the version. I thought that they functioned the same way. I use voron's version. I actually put my 000empty.iwd and zzzmod.iwd in the maps folder. The maps folder is then linked to fs_game within apache. So when the client tries to download, the server redirects to fs_game in apache. If they don't exist there then fast download fails and goes back to slow (server) mode. But it only does this check once during my tests. So if a client connects for the first time and there is a custom map running then the map will be downloaded at slow speed and the client will probably go away. I tried to change ownership to root to prevent it from deleting and chmod 444 but it still deletes the files. Libcod is run from a normal non root account. I can't understand how it is possible to get permission to delete. I guess i will have to go with multiple copies for the moment until i find a solution.

IzNoGoD
5th February 2021, 19:08
Sorry for not specifying the version. I thought that they functioned the same way. I use voron's version. I actually put my 000empty.iwd and zzzmod.iwd in the maps folder. The maps folder is then linked to fs_game within apache. So when the client tries to download, the server redirects to fs_game in apache. If they don't exist there then fast download fails and goes back to slow (server) mode. But it only does this check once during my tests. So if a client connects for the first time and there is a custom map running then the map will be downloaded at slow speed and the client will probably go away. I tried to change ownership to root to prevent it from deleting and chmod 444 but it still deletes the files. Libcod is run from a normal non root account. I can't understand how it is possible to get permission to delete. I guess i will have to go with multiple copies for the moment until i find a solution.

I use something like this for my download url:



<?php
if(substr($_GET["file"], 0, strlen('/JumpersHeaven')) === '/JumpersHeaven')
{
if(substr($_GET["file"], 0, strlen('/JumpersHeaven/zzz_')) === '/JumpersHeaven/zzz_' || substr($_GET["file"], 0, strlen('/JumpersHeaven/000')) === '/JumpersHeaven/000') //cod2 mod files
$url = $url . '/mods/cod2' . substr($_GET["file"], strlen('/JumpersHeaven'));
else
$url = $url . '/maps/cod2' . substr($_GET["file"], strlen('/JumpersHeaven')); //cod2 map files
}
else if(substr($_GET["file"], 0, strlen('/usermaps')) === '/usermaps') //cod4 map files
$url = $url . '/maps/cod4' . substr($_GET["file"], strlen('/usermaps'));
else if(substr($_GET["file"], 0, strlen('/mods/jh')) === '/mods/jh') //cod4 mod files
$url = $url . '/mods/cod4' . substr($_GET["file"], strlen('/mods/jh'));
else
$url = $url . $_GET["file"];
header('Location: '. $url, true, 302);
die();
?>

as "index.php", with wwwbaseurl set to "mydomain.com/index.php?file="

agribilos
5th February 2021, 19:17
Thanks i will give it a try probably tomorrow. Seems like a good solution.

agribilos
6th February 2021, 11:52
It finally works as intended! Thank you again!!