1
0
mirror of https://github.com/NevermindZZT/letter-shell.git synced 2025-01-21 10:02:54 +08:00

优化 游戏模块

This commit is contained in:
Letter 2021-08-08 11:50:31 +08:00
parent 5425dbef84
commit 4432d2e0ad
3 changed files with 5 additions and 5 deletions

View File

@ -24,7 +24,7 @@ Shell *shell2048 = NULL;
char shellGetChar(Shell *shell) {
char data;
if (shell->read(&data, 1) == 1) {
if (shell->read && shell->read(&data, 1) == 1) {
return data;
} else {
return -1;
@ -421,5 +421,3 @@ int main_2048(int argc, char *argv[]) {
return EXIT_SUCCESS;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
2048, main_2048, game 2048\n2048 [param]\nParam: blackwhite bluered or null);

View File

@ -22,4 +22,6 @@ ShellCommand gameGroup[] =
pushbox, main_pushbox, game pushbox),
SHELL_CMD_GROUP_END()
};
SHELL_EXPORT_CMD_GROUP(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), game, gameGroup, games);
SHELL_EXPORT_CMD_GROUP(
SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_DISABLE_RETURN,
game, gameGroup, games);

View File

@ -14,7 +14,7 @@ Shell *shellPushbox = NULL;
static char shellGetChar(Shell *shell) {
char data;
if (shell->read(&data, 1) == 1) {
if (shell->read && shell->read(&data, 1) == 1) {
return data;
} else {
return -1;