Skip to content

Commit

Permalink
Fix formatting messages with player number
Browse files Browse the repository at this point in the history
The current implementation behaves incorrectly, effectively trimming start of message string by a number of characters equal to player number. Explicitly stringify player number to fix the behavior.
  • Loading branch information
AMDmi3 authored Jun 2, 2020
1 parent 9d129de commit 2011135
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/xmoto/GameEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "xmscene/Camera.h"
#include "xmscene/Level.h"
#include <sstream>
#include <string>

SceneEvent::SceneEvent(int p_eventTime) {
m_eventTime = p_eventTime;
Expand Down Expand Up @@ -1073,7 +1074,7 @@ GameEventType MGE_SetPlayerPosition::getType() {
}

std::string MGE_SetPlayerPosition::toString() {
return "Teleportation of the player " + m_player;
return "Teleportation of the player " + std::to_string(m_player);
}

//////////////////////////////
Expand Down Expand Up @@ -2126,7 +2127,7 @@ GameEventType MGE_AddForceToPlayer::getType() {
}

std::string MGE_AddForceToPlayer::toString() {
return "Add force to the player " + m_player;
return "Add force to the player " + std::to_string(m_player);
}

//////////////////////////////
Expand Down

0 comments on commit 2011135

Please sign in to comment.