Skip to content

Commit 2011135

Browse files
authored
Fix formatting messages with player number
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.
1 parent 9d129de commit 2011135

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/xmoto/GameEvents.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2828
#include "xmscene/Camera.h"
2929
#include "xmscene/Level.h"
3030
#include <sstream>
31+
#include <string>
3132

3233
SceneEvent::SceneEvent(int p_eventTime) {
3334
m_eventTime = p_eventTime;
@@ -1073,7 +1074,7 @@ GameEventType MGE_SetPlayerPosition::getType() {
10731074
}
10741075

10751076
std::string MGE_SetPlayerPosition::toString() {
1076-
return "Teleportation of the player " + m_player;
1077+
return "Teleportation of the player " + std::to_string(m_player);
10771078
}
10781079

10791080
//////////////////////////////
@@ -2126,7 +2127,7 @@ GameEventType MGE_AddForceToPlayer::getType() {
21262127
}
21272128

21282129
std::string MGE_AddForceToPlayer::toString() {
2129-
return "Add force to the player " + m_player;
2130+
return "Add force to the player " + std::to_string(m_player);
21302131
}
21312132

21322133
//////////////////////////////

0 commit comments

Comments
 (0)