use saner format for screenshot names by default

master
lsalzman 2013-04-24 13:32:47 +03:00
parent 7ded0d7b37
commit 78fc836372
3 changed files with 25 additions and 2 deletions

View File

@ -2960,8 +2960,25 @@ void screenshot(char *filename)
}
else
{
defformatstring(name)("screenshot_%d", totalmillis);
concatstring(buf, name);
string sstime;
time_t t = time(NULL);
size_t len = strftime(sstime, sizeof(sstime), "%Y-%m-%d_%H.%M.%S", localtime(&t));
sstime[min(len, sizeof(sstime)-1)] = '\0';
concatstring(buf, sstime);
const char *map = game::getclientmap(), *ssinfo = game::getscreenshotinfo();
if(map && map[0])
{
concatstring(buf, "_");
concatstring(buf, map);
}
if(ssinfo && ssinfo[0])
{
concatstring(buf, "_");
concatstring(buf, ssinfo);
}
for(char *s = buf; *s; s++) if(iscubespace(*s)) *s = '-';
}
if(format < 0)
{

View File

@ -562,6 +562,11 @@ namespace game
return showmodeinfo && m_valid(gamemode) ? gamemodes[gamemode - STARTGAMEMODE].info : NULL;
}
const char *getscreenshotinfo()
{
return server::modename(gamemode, NULL);
}
void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material)
{
if (waterlevel>0) { if(material!=MAT_LAVA) playsound(S_SPLASH1, d==player1 ? NULL : &d->o); }

View File

@ -58,6 +58,7 @@ namespace game
extern void dynentcollide(physent *d, physent *o, const vec &dir);
extern const char *getclientmap();
extern const char *getmapinfo();
extern const char *getscreenshotinfo();
extern void resetgamestate();
extern void suicide(physent *d);
extern void newmap(int size);