Просмотр исходного кода

match username before updating

jblanked 9 месяцев назад
Родитель
Сommit
919f7e3799
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      game/enemy.c

+ 9 - 0
game/enemy.c

@@ -458,6 +458,15 @@ static void pvp_position(GameContext *game_context, EntityContext *enemy)
 
         // FuriStrings are probably safer but we already last_response as a char*
 
+        // match username
+        char *u = get_json_value("u", game_context->fhttp->last_response);
+        if (!u || !is_str(u, enemy->username))
+        {
+            if (u)
+                free(u);
+            return;
+        }
+
         // we need the health, elapsed attack timer, direction, and position
         char *h = get_json_value("h", game_context->fhttp->last_response);
         char *eat = get_json_value("eat", game_context->fhttp->last_response);