@@ -1485,7 +1485,7 @@ static String formatString(final String string, final Text... colors) {
14851485 */
14861486 public void printf (final String string , final Text ... colors ) {
14871487 final String formatted = formatString (string , colors );
1488- addCommand (Printf , GameDataUtils . addString ( gameData (), formatted ) , 0 );
1488+ addCommand (Printf , formatted , 0 );
14891489 }
14901490
14911491 /**
@@ -1510,7 +1510,7 @@ public void sendText(final String string, final Text... colors) {
15101510 */
15111511 public void sendTextEx (final boolean toAllies , final String string , final Text ... colors ) {
15121512 final String formatted = formatString (string , colors );
1513- addCommand (SendText , GameDataUtils . addString ( gameData (), formatted ) , toAllies ? 1 : 0 );
1513+ addCommand (SendText , formatted , toAllies ? 1 : 0 );
15141514 }
15151515
15161516 /**
@@ -1719,8 +1719,7 @@ public List<Player> observers() {
17191719
17201720 public void drawText (final CoordinateType ctype , final int x , final int y , final String string , final Text ... colors ) {
17211721 final String formatted = formatString (string , colors );
1722- final int stringId = GameDataUtils .addString (gameData (), formatted );
1723- addShape (ShapeType .Text , ctype , x , y , 0 , 0 , stringId , textSize .id , 0 , false );
1722+ addShape (ShapeType .Text , ctype , x , y , 0 , 0 , formatted , textSize .id , 0 , false );
17241723 }
17251724
17261725 public void drawTextMap (final int x , final int y , final String string , final Text ... colors ) {
@@ -2335,7 +2334,7 @@ public boolean setMap(final String mapFileName) {
23352334 return false ;
23362335 }
23372336
2338- addCommand (CommandType .SetMap , GameDataUtils . addString ( gameData (), mapFileName ) , 0 );
2337+ addCommand (CommandType .SetMap , mapFileName , 0 );
23392338 return true ;
23402339 }
23412340
@@ -2674,10 +2673,25 @@ void addCommand(final CommandType type, final int value1, final int value2) {
26742673 sideEffects .enqueue (SideEffect .addCommand (type , value1 , value2 ));
26752674 }
26762675
2676+
2677+ /**
2678+ * Convenience method for adding a game command from raw arguments.
2679+ */
2680+ void addCommand (final CommandType type , final String value1 , final int value2 ) {
2681+ sideEffects .enqueue (SideEffect .addCommand (type , value1 , value2 ));
2682+ }
2683+
26772684 /**
26782685 * Convenience method for adding a shape from raw arguments.
26792686 */
26802687 void addShape (final ShapeType type , final CoordinateType coordType , final int x1 , final int y1 , final int x2 , final int y2 , final int extra1 , final int extra2 , final int color , final boolean isSolid ) {
26812688 sideEffects .enqueue (SideEffect .addShape (type , coordType , x1 , y1 , x2 , y2 , extra1 , extra2 , color , isSolid ));
26822689 }
2690+
2691+ /**
2692+ * Convenience method for adding a shape from raw arguments.
2693+ */
2694+ void addShape (final ShapeType type , final CoordinateType coordType , final int x1 , final int y1 , final int x2 , final int y2 , final String text , final int extra2 , final int color , final boolean isSolid ) {
2695+ sideEffects .enqueue (SideEffect .addShape (type , coordType , x1 , y1 , x2 , y2 , text , extra2 , color , isSolid ));
2696+ }
26832697}
0 commit comments