@@ -1448,117 +1448,153 @@ void RecorderClass::appendNextCommand() {
14481448}
14491449
14501450void RecorderClass::readArgument (GameMessageArgumentDataType type, GameMessage *msg) {
1451- if (type == ARGUMENTDATATYPE_INTEGER) {
1452- Int theint;
1453- m_file->read (&theint, sizeof (theint));
1454- msg->appendIntegerArgument (theint);
1451+ switch (type) {
1452+ case ARGUMENTDATATYPE_INTEGER: {
1453+ Int theint;
1454+ m_file->read (&theint, sizeof (theint));
1455+ msg->appendIntegerArgument (theint);
14551456#ifdef DEBUG_LOGGING
1456- if (m_doingAnalysis)
1457- {
1458- DEBUG_LOG ((" Integer argument: %d (%8.8X)" , theint, theint));
1459- }
1457+ if (m_doingAnalysis)
1458+ {
1459+ DEBUG_LOG ((" Integer argument: %d (%8.8X)" , theint, theint));
1460+ }
14601461#endif
1461- } else if (type == ARGUMENTDATATYPE_REAL) {
1462- Real thereal;
1463- m_file->read (&thereal, sizeof (thereal));
1464- msg->appendRealArgument (thereal);
1465- #ifdef DEBUG_LOGGING
1466- if (m_doingAnalysis)
1467- {
1468- DEBUG_LOG ((" Real argument: %g (%8.8X)" , thereal, *(int *)&thereal));
1462+ break ;
14691463 }
1470- # endif
1471- } else if (type == ARGUMENTDATATYPE_BOOLEAN) {
1472- Bool thebool ;
1473- m_file->read (&thebool , sizeof (thebool ));
1474- msg->appendBooleanArgument (thebool );
1464+
1465+ case ARGUMENTDATATYPE_REAL: {
1466+ Real thereal ;
1467+ m_file->read (&thereal , sizeof (thereal ));
1468+ msg->appendRealArgument (thereal );
14751469#ifdef DEBUG_LOGGING
1476- if (m_doingAnalysis)
1477- {
1478- DEBUG_LOG ((" Bool argument: %d " , thebool ));
1479- }
1470+ if (m_doingAnalysis)
1471+ {
1472+ DEBUG_LOG ((" Real argument: %g (%8.8X) " , thereal, *( int *)&thereal ));
1473+ }
14801474#endif
1481- } else if (type == ARGUMENTDATATYPE_OBJECTID) {
1482- ObjectID theid;
1483- m_file->read (&theid, sizeof (theid));
1484- msg->appendObjectIDArgument (theid);
1485- #ifdef DEBUG_LOGGING
1486- if (m_doingAnalysis)
1487- {
1488- DEBUG_LOG ((" Object ID argument: %d" , theid));
1475+ break ;
14891476 }
1490- # endif
1491- } else if (type == ARGUMENTDATATYPE_DRAWABLEID) {
1492- DrawableID theid ;
1493- m_file->read (&theid , sizeof (theid ));
1494- msg->appendDrawableIDArgument (theid );
1477+
1478+ case ARGUMENTDATATYPE_BOOLEAN: {
1479+ Bool thebool ;
1480+ m_file->read (&thebool , sizeof (thebool ));
1481+ msg->appendBooleanArgument (thebool );
14951482#ifdef DEBUG_LOGGING
1496- if (m_doingAnalysis)
1497- {
1498- DEBUG_LOG ((" Drawable ID argument: %d" , theid ));
1499- }
1483+ if (m_doingAnalysis)
1484+ {
1485+ DEBUG_LOG ((" Bool argument: %d" , thebool ));
1486+ }
15001487#endif
1501- } else if (type == ARGUMENTDATATYPE_TEAMID) {
1502- UnsignedInt theid;
1503- m_file->read (&theid, sizeof (theid));
1504- msg->appendTeamIDArgument (theid);
1505- #ifdef DEBUG_LOGGING
1506- if (m_doingAnalysis)
1507- {
1508- DEBUG_LOG ((" Team ID argument: %d" , theid));
1488+ break ;
15091489 }
1510- # endif
1511- } else if (type == ARGUMENTDATATYPE_LOCATION) {
1512- Coord3D loc ;
1513- m_file->read (&loc , sizeof (loc ));
1514- msg->appendLocationArgument (loc );
1490+
1491+ case ARGUMENTDATATYPE_OBJECTID: {
1492+ ObjectID theid ;
1493+ m_file->read (&theid , sizeof (theid ));
1494+ msg->appendObjectIDArgument (theid );
15151495#ifdef DEBUG_LOGGING
1516- if (m_doingAnalysis)
1517- {
1518- DEBUG_LOG ((" Coord3D argument: %g %g %g (%8.8X %8.8X %8.8X)" , loc.x , loc.y , loc.z ,
1519- *(int *)&loc.x , *(int *)&loc.y , *(int *)&loc.z ));
1520- }
1496+ if (m_doingAnalysis)
1497+ {
1498+ DEBUG_LOG ((" Object ID argument: %d" , theid));
1499+ }
15211500#endif
1522- } else if (type == ARGUMENTDATATYPE_PIXEL) {
1523- ICoord2D pixel;
1524- m_file->read (&pixel, sizeof (pixel));
1525- msg->appendPixelArgument (pixel);
1526- #ifdef DEBUG_LOGGING
1527- if (m_doingAnalysis)
1528- {
1529- DEBUG_LOG ((" Pixel argument: %d,%d" , pixel.x , pixel.y ));
1501+ break ;
15301502 }
1503+
1504+ case ARGUMENTDATATYPE_DRAWABLEID: {
1505+ DrawableID theid;
1506+ m_file->read (&theid, sizeof (theid));
1507+ msg->appendDrawableIDArgument (theid);
1508+ #ifdef DEBUG_LOGGING
1509+ if (m_doingAnalysis)
1510+ {
1511+ DEBUG_LOG ((" Drawable ID argument: %d" , theid));
1512+ }
15311513#endif
1532- } else if (type == ARGUMENTDATATYPE_PIXELREGION) {
1533- IRegion2D reg;
1534- m_file->read (®, sizeof (reg));
1535- msg->appendPixelRegionArgument (reg);
1514+ break ;
1515+ }
1516+
1517+ case ARGUMENTDATATYPE_TEAMID: {
1518+ UnsignedInt theid;
1519+ m_file->read (&theid, sizeof (theid));
1520+ msg->appendTeamIDArgument (theid);
15361521#ifdef DEBUG_LOGGING
1537- if (m_doingAnalysis)
1538- {
1539- DEBUG_LOG ((" Pixel Region argument: %d,%d -> %d,%d" , reg.lo .x , reg.lo .y , reg.hi .x , reg.hi .y ));
1522+ if (m_doingAnalysis)
1523+ {
1524+ DEBUG_LOG ((" Team ID argument: %d" , theid));
1525+ }
1526+ #endif
1527+ break ;
15401528 }
1529+
1530+ case ARGUMENTDATATYPE_LOCATION: {
1531+ Coord3D loc;
1532+ m_file->read (&loc, sizeof (loc));
1533+ msg->appendLocationArgument (loc);
1534+ #ifdef DEBUG_LOGGING
1535+ if (m_doingAnalysis)
1536+ {
1537+ DEBUG_LOG ((" Coord3D argument: %g %g %g (%8.8X %8.8X %8.8X)" , loc.x , loc.y , loc.z ,
1538+ *(int *)&loc.x , *(int *)&loc.y , *(int *)&loc.z ));
1539+ }
15411540#endif
1542- } else if (type == ARGUMENTDATATYPE_TIMESTAMP) { // Not to be confused with Terrance Stamp... Kneel before Zod!!!
1543- UnsignedInt stamp;
1544- m_file->read (&stamp, sizeof (stamp));
1545- msg->appendTimestampArgument (stamp);
1541+ break ;
1542+ }
1543+
1544+ case ARGUMENTDATATYPE_PIXEL: {
1545+ ICoord2D pixel;
1546+ m_file->read (&pixel, sizeof (pixel));
1547+ msg->appendPixelArgument (pixel);
15461548#ifdef DEBUG_LOGGING
1547- if (m_doingAnalysis)
1548- {
1549- DEBUG_LOG ((" Timestamp argument: %d" , stamp));
1549+ if (m_doingAnalysis)
1550+ {
1551+ DEBUG_LOG ((" Pixel argument: %d,%d" , pixel.x , pixel.y ));
1552+ }
1553+ #endif
1554+ break ;
15501555 }
1556+
1557+ case ARGUMENTDATATYPE_PIXELREGION: {
1558+ IRegion2D reg;
1559+ m_file->read (®, sizeof (reg));
1560+ msg->appendPixelRegionArgument (reg);
1561+ #ifdef DEBUG_LOGGING
1562+ if (m_doingAnalysis)
1563+ {
1564+ DEBUG_LOG ((" Pixel Region argument: %d,%d -> %d,%d" , reg.lo .x , reg.lo .y , reg.hi .x , reg.hi .y ));
1565+ }
15511566#endif
1552- } else if (type == ARGUMENTDATATYPE_WIDECHAR) {
1553- WideChar theid;
1554- m_file->read (&theid, sizeof (theid));
1555- msg->appendWideCharArgument (theid);
1567+ break ;
1568+ }
1569+
1570+ case ARGUMENTDATATYPE_TIMESTAMP: { // Not to be confused with Terrance Stamp... Kneel before Zod!!!
1571+ UnsignedInt stamp;
1572+ m_file->read (&stamp, sizeof (stamp));
1573+ msg->appendTimestampArgument (stamp);
15561574#ifdef DEBUG_LOGGING
1557- if (m_doingAnalysis)
1558- {
1559- DEBUG_LOG ((" WideChar argument: %d (%lc)" , theid, theid));
1575+ if (m_doingAnalysis)
1576+ {
1577+ DEBUG_LOG ((" Timestamp argument: %d" , stamp));
1578+ }
1579+ #endif
1580+ break ;
15601581 }
1582+
1583+ case ARGUMENTDATATYPE_WIDECHAR: {
1584+ WideChar theid;
1585+ m_file->read (&theid, sizeof (theid));
1586+ msg->appendWideCharArgument (theid);
1587+ #ifdef DEBUG_LOGGING
1588+ if (m_doingAnalysis)
1589+ {
1590+ DEBUG_LOG ((" WideChar argument: %d (%lc)" , theid, theid));
1591+ }
15611592#endif
1593+ break ;
1594+ }
1595+
1596+ default :
1597+ break ;
15621598 }
15631599}
15641600
0 commit comments