home · contact · privacy
Add command to let the AI decide player's next move.
[plomrogue] / src / server / run.c
index 3ae71757fe6ec0568a3bc6f937608846a129db4e..8c1297d1da1172a51a802578c5d01c5ce99f016a 100644 (file)
@@ -86,12 +86,20 @@ static uint8_t player_commands_allowed()
 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())
         {
-            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;