mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 19:20:38 +00:00
Lunatic-m32: save command input history.
git-svn-id: https://svn.eduke32.com/eduke32@3062 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5b311f98cc
commit
3a7b697a32
1 changed files with 29 additions and 23 deletions
|
@ -9184,6 +9184,32 @@ static int32_t osdcmd_tint(const osdfuncparm_t *parm)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void SaveInHistory(const char *commandstr)
|
||||||
|
{
|
||||||
|
int32_t i, idx, dosave=1;
|
||||||
|
|
||||||
|
for (i=1; i<=4; i++)
|
||||||
|
{
|
||||||
|
idx = (scripthistend-i)&(SCRIPTHISTSIZ-1);
|
||||||
|
if (!scripthist[idx])
|
||||||
|
break;
|
||||||
|
else if (!Bstrcmp(scripthist[idx], commandstr))
|
||||||
|
{
|
||||||
|
dosave = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dosave)
|
||||||
|
{
|
||||||
|
if (scripthist[scripthistend])
|
||||||
|
Bfree(scripthist[scripthistend]);
|
||||||
|
scripthist[scripthistend] = Bstrdup(commandstr);
|
||||||
|
scripthistend++;
|
||||||
|
scripthistend %= SCRIPTHISTSIZ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef LUNATIC
|
#ifdef LUNATIC
|
||||||
static int32_t osdcmd_lua(const osdfuncparm_t *parm)
|
static int32_t osdcmd_lua(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
|
@ -9205,6 +9231,8 @@ static int32_t osdcmd_lua(const osdfuncparm_t *parm)
|
||||||
ret = Em_RunStringOnce(g_EmState, parm->parms[0]);
|
ret = Em_RunStringOnce(g_EmState, parm->parms[0]);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
OSD_Printf("Error running the Lua code (error code %d)\n", ret);
|
OSD_Printf("Error running the Lua code (error code %d)\n", ret);
|
||||||
|
else
|
||||||
|
SaveInHistory(parm->raw);
|
||||||
|
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
@ -9324,30 +9352,8 @@ static int32_t osdcmd_do(const osdfuncparm_t *parm)
|
||||||
M32_PostScriptExec();
|
M32_PostScriptExec();
|
||||||
|
|
||||||
if (!(vm.flags&VMFLAG_ERROR) && !dontsavehist)
|
if (!(vm.flags&VMFLAG_ERROR) && !dontsavehist)
|
||||||
{
|
SaveInHistory(parm->raw);
|
||||||
int32_t idx, dosave=1;
|
|
||||||
|
|
||||||
for (i=1; i<=4; i++)
|
|
||||||
{
|
|
||||||
idx = (scripthistend-i)&(SCRIPTHISTSIZ-1);
|
|
||||||
if (!scripthist[idx])
|
|
||||||
break;
|
|
||||||
else if (!Bstrcmp(scripthist[idx], parm->raw))
|
|
||||||
{
|
|
||||||
dosave = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dosave)
|
|
||||||
{
|
|
||||||
if (scripthist[scripthistend])
|
|
||||||
Bfree(scripthist[scripthistend]);
|
|
||||||
scripthist[scripthistend] = Bstrdup(parm->raw);
|
|
||||||
scripthistend++;
|
|
||||||
scripthistend %= SCRIPTHISTSIZ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// asksave = 1; // handled in Access(Sprite|Sector|Wall)
|
// asksave = 1; // handled in Access(Sprite|Sector|Wall)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue