Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,8 @@ static char *get_input(const char *prompt)
printf("\n%s", prompt); fflush(stdout);
input[0] = 0;
p = fgets(input, sizeof(input), stdin);
if (p && *p) {
if (p)
p[strcspn(p, "\n\r")] = 0;
}
if (opt_echo && p)
printf("%s\n", p);
return p;
Expand Down Expand Up @@ -341,7 +340,7 @@ int main(int argc, const char **argv)
SetConsoleCP(opt_codepage);
#endif
if (!game) {
printf("instead-cli %s (by Peter Kosyh '2021-2022)\n", VERSION);
printf("instead-cli %s (by Peter Kosyh '2021-2025)\n", VERSION);
fprintf(stdout, "Usage: %s [-d<file>] [-w<width>] [-i<script>] [-l<log>] [-a] <game>\n", argv[0]);
exit(1);
}
Expand Down Expand Up @@ -406,6 +405,8 @@ int main(int argc, const char **argv)
char *p;
int cmd_mode = 0;
p = get_input("> ");
if (p && *p != '/')
p = trim(p);
if (!p || !strcmp(p, "/quit")) {
printf("\n");
break;
Expand Down Expand Up @@ -439,7 +440,11 @@ int main(int argc, const char **argv)
}
if (rc) { /* try act */
free(str);
snprintf(cmd, sizeof(cmd), "act %s", p);
if (!*p) /* empty? */
cmd[0] = 0;
else
snprintf(cmd, sizeof(cmd), "act %s", p);

str = instead_cmd(cmd, &rc);
}
if (str) {
Expand Down
10 changes: 10 additions & 0 deletions tiny.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@
if API == 'stead3' then
require 'tiny3'
require "ext/sound"
LANG='en'
local instead = std '@instead'
local iface = std '@iface'
instead.music_callback = function() end
instead.restart = instead_restart
instead.menu = instead_menu
instead.savepath = function() return "./" end
std.savepath = instead.savepath
local iface_cmd = iface.cmd
function iface:cmd(inp)
local a = std.split(inp, " ,")
if a[1] == 'use' and #a == 3 then -- use a b -> use a,b
std.table.remove(a, 1)
return iface_cmd(self, 'use '..std.join(a, ','))
end
return iface_cmd(self, inp)
end
function iface:em(str)
if type(str) == 'string' then
return '/'..str..'/'
Expand Down