home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8877665
)
Add command to let the AI decide player's next move.
author
Christian Heller
<c.heller@plomlompom.de>
Sun, 3 Aug 2014 03:49:23 +0000
(
05:49
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sun, 3 Aug 2014 03:49:23 +0000
(
05:49
+0200)
SERVER_COMMANDS
patch
|
blob
|
history
confclient/commands
patch
|
blob
|
history
confclient/interface_conf
patch
|
blob
|
history
confclient/single_wins/info
patch
|
blob
|
history
confclient/single_wins/inventory
patch
|
blob
|
history
confclient/single_wins/log
patch
|
blob
|
history
confclient/single_wins/map
patch
|
blob
|
history
src/server/hardcoded_strings.c
patch
|
blob
|
history
src/server/hardcoded_strings.h
patch
|
blob
|
history
src/server/run.c
patch
|
blob
|
history
diff --git
a/SERVER_COMMANDS
b/SERVER_COMMANDS
index e31d3312e81fcc6cfc410b5ce5a0de662b90c8c8..50ac853fe343e84a065304e021a9c85c6e950064 100644
(file)
--- a/
SERVER_COMMANDS
+++ b/
SERVER_COMMANDS
@@
-54,6
+54,9
@@
Shut down server.
Player commands
---------------
Player commands
---------------
+ai
+Do what the AI would do.
+
wait
Make player character wait one turn.
wait
Make player character wait one turn.
diff --git
a/confclient/commands
b/confclient/commands
index e4efa8a4b832a681f2a3cd1229a748c8d074b31e..c5f94d12fe4dda75a483c801b02b51b0c5e4fad3 100644
(file)
--- a/
confclient/commands
+++ b/
confclient/commands
@@
-1,3
+1,8
@@
+COMMAND ai
+DESCRIPTION 'let AI decide move'
+SERVER_COMMAND ai
+SERVER_ARGUMENT 0
+
COMMAND wait
DESCRIPTION 'wait / next turn'
SERVER_COMMAND wait
COMMAND wait
DESCRIPTION 'wait / next turn'
SERVER_COMMAND wait
diff --git
a/confclient/interface_conf
b/confclient/interface_conf
index 8a4a36fd910339937311035872a2dcb295f2af55..9b97af383113cad2bc13ad6bef1aedf8e8f7afcc 100644
(file)
--- a/
confclient/interface_conf
+++ b/
confclient/interface_conf
@@
-87,6
+87,7
@@
NAME 'Map'
BREAK 0
WIDTH -42
HEIGHT 0
BREAK 0
WIDTH -42
HEIGHT 0
+KEY 97 ai
KEY 112 pick
KEY 58 wait
KEY 101 move_e
KEY 112 pick
KEY 58 wait
KEY 101 move_e
diff --git
a/confclient/single_wins/info
b/confclient/single_wins/info
index 80343ef125e7345a7cd30eb46f7d8acc6cfc632b..636f5fa9abbb615e0c60627a7e3371e51cfadc8c 100644
(file)
--- a/
confclient/single_wins/info
+++ b/
confclient/single_wins/info
@@
-15,6
+15,7
@@
KEY 262 scrl_l
KEY 360 scrl_r
KEY 82 reload_conf
KEY 67 save_conf
KEY 360 scrl_r
KEY 82 reload_conf
KEY 67 save_conf
+KEY 97 ai
KEY 112 pick
KEY 58 wait
KEY 101 move_e
KEY 112 pick
KEY 58 wait
KEY 101 move_e
diff --git
a/confclient/single_wins/inventory
b/confclient/single_wins/inventory
index c9e893093226adc2532e6d1f8ce6ba374c583b49..c664b3e5cdc0314b915e3e476edafed8abd99367 100644
(file)
--- a/
confclient/single_wins/inventory
+++ b/
confclient/single_wins/inventory
@@
-15,6
+15,7
@@
KEY 262 scrl_l
KEY 360 scrl_r
KEY 82 reload_conf
KEY 67 save_conf
KEY 360 scrl_r
KEY 82 reload_conf
KEY 67 save_conf
+KEY 97 ai
KEY 112 pick
KEY 58 wait
KEY 101 move_e
KEY 112 pick
KEY 58 wait
KEY 101 move_e
diff --git
a/confclient/single_wins/log
b/confclient/single_wins/log
index 9944687a2a9846e272c60bafc59692733ac96250..be5408c0efd9aa1b731a69524b3b657ada694444 100644
(file)
--- a/
confclient/single_wins/log
+++ b/
confclient/single_wins/log
@@
-15,6
+15,7
@@
KEY 262 scrl_l
KEY 360 scrl_r
KEY 82 reload_conf
KEY 67 save_conf
KEY 360 scrl_r
KEY 82 reload_conf
KEY 67 save_conf
+KEY 97 ai
KEY 112 pick
KEY 58 wait
KEY 101 move_e
KEY 112 pick
KEY 58 wait
KEY 101 move_e
diff --git
a/confclient/single_wins/map
b/confclient/single_wins/map
index d3a48bbdd94d2b04700e2ce0fa9071b293ab80d5..e9283d9b2964efc1c141bbd2721e3564919d4ffb 100644
(file)
--- a/
confclient/single_wins/map
+++ b/
confclient/single_wins/map
@@
-15,6
+15,7
@@
KEY 262 scrl_l
KEY 360 scrl_r
KEY 82 reload_conf
KEY 67 save_conf
KEY 360 scrl_r
KEY 82 reload_conf
KEY 67 save_conf
+KEY 97 ai
KEY 112 pick
KEY 58 wait
KEY 101 move_e
KEY 112 pick
KEY 58 wait
KEY 101 move_e
diff --git
a/src/server/hardcoded_strings.c
b/src/server/hardcoded_strings.c
index 4e801cfb3476646fd6125a948697e39b0e669dda..82f7a3ebf462dde84a1d96e02ac8f8099f763925 100644
(file)
--- a/
src/server/hardcoded_strings.c
+++ b/
src/server/hardcoded_strings.c
@@
-4,7
+4,7
@@
-char * s[
39
];
+char * s[
40
];
@@
-37,6
+37,7
@@
extern void init_strings()
s[S_CMD_T_HP] = "T_LIFEPOINTS";
s[S_CMD_T_CARRIES] = "T_CARRIES";
s[S_CMD_T_MEMMAP] = "T_MEMMAP";
s[S_CMD_T_HP] = "T_LIFEPOINTS";
s[S_CMD_T_CARRIES] = "T_CARRIES";
s[S_CMD_T_MEMMAP] = "T_MEMMAP";
+ s[S_CMD_AI] = "ai";
s[S_CMD_WAIT] = "wait";
s[S_CMD_MOVE] = "move";
s[S_CMD_PICKUP] = "pick_up";
s[S_CMD_WAIT] = "wait";
s[S_CMD_MOVE] = "move";
s[S_CMD_PICKUP] = "pick_up";
diff --git
a/src/server/hardcoded_strings.h
b/src/server/hardcoded_strings.h
index 3c8dd8161d96c742974d186e3bd5a4dfbf05a06c..ebfa0799528dc2dad2767afad7bf178e8bf1b4f3 100644
(file)
--- a/
src/server/hardcoded_strings.h
+++ b/
src/server/hardcoded_strings.h
@@
-37,6
+37,7
@@
enum string_num
S_CMD_T_HP,
S_CMD_T_CARRIES,
S_CMD_T_MEMMAP,
S_CMD_T_HP,
S_CMD_T_CARRIES,
S_CMD_T_MEMMAP,
+ S_CMD_AI,
S_CMD_WAIT,
S_CMD_MOVE,
S_CMD_PICKUP,
S_CMD_WAIT,
S_CMD_MOVE,
S_CMD_PICKUP,
@@
-53,7
+54,7
@@
enum string_num
extern void init_strings();
extern void init_strings();
-extern char * s[
39
];
+extern char * s[
40
];
diff --git
a/src/server/run.c
b/src/server/run.c
index 3ae71757fe6ec0568a3bc6f937608846a129db4e..8c1297d1da1172a51a802578c5d01c5ce99f016a 100644
(file)
--- a/
src/server/run.c
+++ b/
src/server/run.c
@@
-86,12
+86,20
@@
static uint8_t player_commands_allowed()
static uint8_t parse_player_command_0arg(char * tok0)
{
struct Thing * player = get_player();
static uint8_t parse_player_command_0arg(char * tok0)
{
struct Thing * player = get_player();
- if (!strcmp(tok0, s[S_CMD_WAIT]) || !strcmp(tok0, s[S_CMD_PICKUP]))
+ if ( !strcmp(tok0, s[S_CMD_WAIT]) || !strcmp(tok0, s[S_CMD_PICKUP])
+ || !strcmp(tok0, s[S_CMD_AI]))
{
if (player_commands_allowed())
{
{
if (player_commands_allowed())
{
- player->command = get_thing_action_id_by_name(tok0);
- player->arg = 0;
+ if (!strcmp(tok0, s[S_CMD_AI]))
+ {
+ ai(player);
+ }
+ else
+ {
+ player->command = get_thing_action_id_by_name(tok0);
+ player->arg = 0;
+ }
turn_over();
}
return 1;
turn_over();
}
return 1;