@@ -1445,117 +1445,153 @@ void RecorderClass::appendNextCommand() {
14451445}
14461446
14471447void RecorderClass::readArgument (GameMessageArgumentDataType type, GameMessage *msg) {
1448- if (type == ARGUMENTDATATYPE_INTEGER) {
1449- Int theint;
1450- m_file->read (&theint, sizeof (theint));
1451- msg->appendIntegerArgument (theint);
1448+ switch (type) {
1449+ case ARGUMENTDATATYPE_INTEGER: {
1450+ Int theint;
1451+ m_file->read (&theint, sizeof (theint));
1452+ msg->appendIntegerArgument (theint);
14521453#ifdef DEBUG_LOGGING
1453- if (m_doingAnalysis)
1454- {
1455- DEBUG_LOG ((" Integer argument: %d (%8.8X)" , theint, theint));
1456- }
1454+ if (m_doingAnalysis)
1455+ {
1456+ DEBUG_LOG ((" Integer argument: %d (%8.8X)" , theint, theint));
1457+ }
14571458#endif
1458- } else if (type == ARGUMENTDATATYPE_REAL) {
1459- Real thereal;
1460- m_file->read (&thereal, sizeof (thereal));
1461- msg->appendRealArgument (thereal);
1462- #ifdef DEBUG_LOGGING
1463- if (m_doingAnalysis)
1464- {
1465- DEBUG_LOG ((" Real argument: %g (%8.8X)" , thereal, *(int *)&thereal));
1459+ break ;
14661460 }
1467- # endif
1468- } else if (type == ARGUMENTDATATYPE_BOOLEAN) {
1469- Bool thebool ;
1470- m_file->read (&thebool , sizeof (thebool ));
1471- msg->appendBooleanArgument (thebool );
1461+
1462+ case ARGUMENTDATATYPE_REAL: {
1463+ Real thereal ;
1464+ m_file->read (&thereal , sizeof (thereal ));
1465+ msg->appendRealArgument (thereal );
14721466#ifdef DEBUG_LOGGING
1473- if (m_doingAnalysis)
1474- {
1475- DEBUG_LOG ((" Bool argument: %d " , thebool ));
1476- }
1467+ if (m_doingAnalysis)
1468+ {
1469+ DEBUG_LOG ((" Real argument: %g (%8.8X) " , thereal, *( int *)&thereal ));
1470+ }
14771471#endif
1478- } else if (type == ARGUMENTDATATYPE_OBJECTID) {
1479- ObjectID theid;
1480- m_file->read (&theid, sizeof (theid));
1481- msg->appendObjectIDArgument (theid);
1482- #ifdef DEBUG_LOGGING
1483- if (m_doingAnalysis)
1484- {
1485- DEBUG_LOG ((" Object ID argument: %d" , theid));
1472+ break ;
14861473 }
1487- # endif
1488- } else if (type == ARGUMENTDATATYPE_DRAWABLEID) {
1489- DrawableID theid ;
1490- m_file->read (&theid , sizeof (theid ));
1491- msg->appendDrawableIDArgument (theid );
1474+
1475+ case ARGUMENTDATATYPE_BOOLEAN: {
1476+ Bool thebool ;
1477+ m_file->read (&thebool , sizeof (thebool ));
1478+ msg->appendBooleanArgument (thebool );
14921479#ifdef DEBUG_LOGGING
1493- if (m_doingAnalysis)
1494- {
1495- DEBUG_LOG ((" Drawable ID argument: %d" , theid ));
1496- }
1480+ if (m_doingAnalysis)
1481+ {
1482+ DEBUG_LOG ((" Bool argument: %d" , thebool ));
1483+ }
14971484#endif
1498- } else if (type == ARGUMENTDATATYPE_TEAMID) {
1499- UnsignedInt theid;
1500- m_file->read (&theid, sizeof (theid));
1501- msg->appendTeamIDArgument (theid);
1502- #ifdef DEBUG_LOGGING
1503- if (m_doingAnalysis)
1504- {
1505- DEBUG_LOG ((" Team ID argument: %d" , theid));
1485+ break ;
15061486 }
1507- # endif
1508- } else if (type == ARGUMENTDATATYPE_LOCATION) {
1509- Coord3D loc ;
1510- m_file->read (&loc , sizeof (loc ));
1511- msg->appendLocationArgument (loc );
1487+
1488+ case ARGUMENTDATATYPE_OBJECTID: {
1489+ ObjectID theid ;
1490+ m_file->read (&theid , sizeof (theid ));
1491+ msg->appendObjectIDArgument (theid );
15121492#ifdef DEBUG_LOGGING
1513- if (m_doingAnalysis)
1514- {
1515- DEBUG_LOG ((" Coord3D argument: %g %g %g (%8.8X %8.8X %8.8X)" , loc.x , loc.y , loc.z ,
1516- *(int *)&loc.x , *(int *)&loc.y , *(int *)&loc.z ));
1517- }
1493+ if (m_doingAnalysis)
1494+ {
1495+ DEBUG_LOG ((" Object ID argument: %d" , theid));
1496+ }
15181497#endif
1519- } else if (type == ARGUMENTDATATYPE_PIXEL) {
1520- ICoord2D pixel;
1521- m_file->read (&pixel, sizeof (pixel));
1522- msg->appendPixelArgument (pixel);
1523- #ifdef DEBUG_LOGGING
1524- if (m_doingAnalysis)
1525- {
1526- DEBUG_LOG ((" Pixel argument: %d,%d" , pixel.x , pixel.y ));
1498+ break ;
15271499 }
1500+
1501+ case ARGUMENTDATATYPE_DRAWABLEID: {
1502+ DrawableID theid;
1503+ m_file->read (&theid, sizeof (theid));
1504+ msg->appendDrawableIDArgument (theid);
1505+ #ifdef DEBUG_LOGGING
1506+ if (m_doingAnalysis)
1507+ {
1508+ DEBUG_LOG ((" Drawable ID argument: %d" , theid));
1509+ }
15281510#endif
1529- } else if (type == ARGUMENTDATATYPE_PIXELREGION) {
1530- IRegion2D reg;
1531- m_file->read (®, sizeof (reg));
1532- msg->appendPixelRegionArgument (reg);
1511+ break ;
1512+ }
1513+
1514+ case ARGUMENTDATATYPE_TEAMID: {
1515+ UnsignedInt theid;
1516+ m_file->read (&theid, sizeof (theid));
1517+ msg->appendTeamIDArgument (theid);
15331518#ifdef DEBUG_LOGGING
1534- if (m_doingAnalysis)
1535- {
1536- DEBUG_LOG ((" Pixel Region argument: %d,%d -> %d,%d" , reg.lo .x , reg.lo .y , reg.hi .x , reg.hi .y ));
1519+ if (m_doingAnalysis)
1520+ {
1521+ DEBUG_LOG ((" Team ID argument: %d" , theid));
1522+ }
1523+ #endif
1524+ break ;
15371525 }
1526+
1527+ case ARGUMENTDATATYPE_LOCATION: {
1528+ Coord3D loc;
1529+ m_file->read (&loc, sizeof (loc));
1530+ msg->appendLocationArgument (loc);
1531+ #ifdef DEBUG_LOGGING
1532+ if (m_doingAnalysis)
1533+ {
1534+ DEBUG_LOG ((" Coord3D argument: %g %g %g (%8.8X %8.8X %8.8X)" , loc.x , loc.y , loc.z ,
1535+ *(int *)&loc.x , *(int *)&loc.y , *(int *)&loc.z ));
1536+ }
15381537#endif
1539- } else if (type == ARGUMENTDATATYPE_TIMESTAMP) { // Not to be confused with Terrance Stamp... Kneel before Zod!!!
1540- UnsignedInt stamp;
1541- m_file->read (&stamp, sizeof (stamp));
1542- msg->appendTimestampArgument (stamp);
1538+ break ;
1539+ }
1540+
1541+ case ARGUMENTDATATYPE_PIXEL: {
1542+ ICoord2D pixel;
1543+ m_file->read (&pixel, sizeof (pixel));
1544+ msg->appendPixelArgument (pixel);
15431545#ifdef DEBUG_LOGGING
1544- if (m_doingAnalysis)
1545- {
1546- DEBUG_LOG ((" Timestamp argument: %d" , stamp));
1546+ if (m_doingAnalysis)
1547+ {
1548+ DEBUG_LOG ((" Pixel argument: %d,%d" , pixel.x , pixel.y ));
1549+ }
1550+ #endif
1551+ break ;
15471552 }
1553+
1554+ case ARGUMENTDATATYPE_PIXELREGION: {
1555+ IRegion2D reg;
1556+ m_file->read (®, sizeof (reg));
1557+ msg->appendPixelRegionArgument (reg);
1558+ #ifdef DEBUG_LOGGING
1559+ if (m_doingAnalysis)
1560+ {
1561+ DEBUG_LOG ((" Pixel Region argument: %d,%d -> %d,%d" , reg.lo .x , reg.lo .y , reg.hi .x , reg.hi .y ));
1562+ }
15481563#endif
1549- } else if (type == ARGUMENTDATATYPE_WIDECHAR) {
1550- WideChar theid;
1551- m_file->read (&theid, sizeof (theid));
1552- msg->appendWideCharArgument (theid);
1564+ break ;
1565+ }
1566+
1567+ case ARGUMENTDATATYPE_TIMESTAMP: { // Not to be confused with Terrance Stamp... Kneel before Zod!!!
1568+ UnsignedInt stamp;
1569+ m_file->read (&stamp, sizeof (stamp));
1570+ msg->appendTimestampArgument (stamp);
15531571#ifdef DEBUG_LOGGING
1554- if (m_doingAnalysis)
1555- {
1556- DEBUG_LOG ((" WideChar argument: %d (%lc)" , theid, theid));
1572+ if (m_doingAnalysis)
1573+ {
1574+ DEBUG_LOG ((" Timestamp argument: %d" , stamp));
1575+ }
1576+ #endif
1577+ break ;
15571578 }
1579+
1580+ case ARGUMENTDATATYPE_WIDECHAR: {
1581+ WideChar theid;
1582+ m_file->read (&theid, sizeof (theid));
1583+ msg->appendWideCharArgument (theid);
1584+ #ifdef DEBUG_LOGGING
1585+ if (m_doingAnalysis)
1586+ {
1587+ DEBUG_LOG ((" WideChar argument: %d (%lc)" , theid, theid));
1588+ }
15581589#endif
1590+ break ;
1591+ }
1592+
1593+ default :
1594+ break ;
15591595 }
15601596}
15611597
0 commit comments