@@ -99,6 +99,8 @@ public class Game {
9999 private Text .Size textSize = Text .Size .Default ;
100100 private boolean latcom = true ;
101101
102+ public final SideEffectQueue sideEffects = new SideEffectQueue ();
103+
102104 Game (ClientData clientData ) {
103105 this .clientData = clientData ;
104106 }
@@ -305,37 +307,6 @@ void onFrame(final int frame) {
305307 getAllUnits ().forEach (u -> u .updatePosition (frame ));
306308 }
307309
308- void addUnitCommand (final int type , final int unit , final int target , final int x , final int y , final int extra ) {
309- ClientData .UnitCommand unitCommand = GameDataUtils .addUnitCommand (gameData ());
310- unitCommand .setTid (type );
311- unitCommand .setUnitIndex (unit );
312- unitCommand .setTargetIndex (target );
313- unitCommand .setX (x );
314- unitCommand .setY (y );
315- unitCommand .setExtra (extra );
316- }
317-
318- void addCommand (final CommandType type , final int value1 , final int value2 ) {
319- Command command = GameDataUtils .addCommand (gameData ());
320- command .setType (type );
321- command .setValue1 (value1 );
322- command .setValue2 (value2 );
323- }
324-
325- 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 ) {
326- Shape shape = GameDataUtils .addShape (gameData ());
327- shape .setType (type );
328- shape .setCtype (coordType );
329- shape .setX1 (x1 );
330- shape .setY1 (y1 );
331- shape .setX2 (x2 );
332- shape .setY2 (y2 );
333- shape .setExtra1 (extra1 );
334- shape .setExtra2 (extra2 );
335- shape .setColor (color );
336- shape .setIsSolid (isSolid );
337- }
338-
339310 /**
340311 * Retrieves the set of all teams/forces. Forces are commonly seen in @UMS
341312 * game types and some others such as @TvB and the team versions of game types.
@@ -2688,4 +2659,25 @@ public int getDamageTo(final UnitType toType, final UnitType fromType, final Pla
26882659 public int getRandomSeed () {
26892660 return randomSeed ;
26902661 }
2662+
2663+ /**
2664+ * Convenience method for adding a unit command from raw arguments.
2665+ */
2666+ void addUnitCommand (final int type , final int unit , final int target , final int x , final int y , final int extra ) {
2667+ sideEffects .enqueue (SideEffect .addUnitCommand (type , unit , target , x , y , extra ));
2668+ }
2669+
2670+ /**
2671+ * Convenience method for adding a game command from raw arguments.
2672+ */
2673+ void addCommand (final CommandType type , final int value1 , final int value2 ) {
2674+ sideEffects .enqueue (SideEffect .addCommand (type , value1 , value2 ));
2675+ }
2676+
2677+ /**
2678+ * Convenience method for adding a shape from raw arguments.
2679+ */
2680+ 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 ) {
2681+ sideEffects .enqueue (SideEffect .addShape (type , coordType , x1 , y1 , x2 , y2 , extra1 , extra2 , color , isSolid ));
2682+ }
26912683}
0 commit comments