necropotame / teeworlds-infclass

Infection Mod with a class system for TeeWorlds
Other
38 stars 27 forks source link

Double command execution #217

Closed bretonium closed 5 years ago

bretonium commented 5 years ago
  1. Login as moderator/aministrator
  2. Execute command "status"

Expected: the command is executed once Actual: the command is executed twice

In commit 09e02021 the following lines were added: ` diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp index c8711f9..2d7398b 100644 --- a/src/engine/shared/console.cpp +++ b/src/engine/shared/console.cpp @@ -372,6 +372,10 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID, bo Print(OUTPUT_LEVEL_STANDARD, "Console", "Invalid arguments."); Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf); }

This leads to double execution of commands in console. Any idea why it was added? Can we remove it?

bretonium commented 5 years ago

Oh well.

diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp
index c8711f9..2d7398b 100644
--- a/src/engine/shared/console.cpp
+++ b/src/engine/shared/console.cpp
@@ -372,6 +372,10 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID, bo
                                                        Print(OUTPUT_LEVEL_STANDARD, "Console", "Invalid arguments.");
                                                        Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
                                                }
+                                               else
+                                               pCommand->m_pfnCallback(&Result, pCommand->m_pUserData);
+
+                                               return;
                                        }
                                }
                        }
progval commented 5 years ago

So that's what was causing that bug! Thanks! Fixed in 1e9d7be9a.