@@ -1480,117 +1480,142 @@ void RecorderClass::appendNextCommand() {
14801480}
14811481
14821482void RecorderClass::readArgument (GameMessageArgumentDataType type, GameMessage *msg) {
1483- if (type == ARGUMENTDATATYPE_INTEGER) {
1484- Int theint;
1485- m_file->read (&theint, sizeof (theint));
1486- msg->appendIntegerArgument (theint);
1483+ switch (type) {
1484+ case ARGUMENTDATATYPE_INTEGER: {
1485+ Int theint;
1486+ m_file->read (&theint, sizeof (theint));
1487+ msg->appendIntegerArgument (theint);
14871488#ifdef DEBUG_LOGGING
1488- if (m_doingAnalysis)
1489- {
1490- DEBUG_LOG ((" Integer argument: %d (%8.8X)" , theint, theint));
1491- }
1489+ if (m_doingAnalysis)
1490+ {
1491+ DEBUG_LOG ((" Integer argument: %d (%8.8X)" , theint, theint));
1492+ }
14921493#endif
1493- } else if (type == ARGUMENTDATATYPE_REAL) {
1494- Real thereal;
1495- m_file->read (&thereal, sizeof (thereal));
1496- msg->appendRealArgument (thereal);
1497- #ifdef DEBUG_LOGGING
1498- if (m_doingAnalysis)
1499- {
1500- DEBUG_LOG ((" Real argument: %g (%8.8X)" , thereal, *(int *)&thereal));
1494+ break ;
15011495 }
1502- #endif
1503- } else if (type == ARGUMENTDATATYPE_BOOLEAN) {
1504- Bool thebool;
1505- m_file->read (&thebool, sizeof (thebool));
1506- msg->appendBooleanArgument (thebool);
1496+ case ARGUMENTDATATYPE_REAL: {
1497+ Real thereal;
1498+ m_file->read (&thereal, sizeof (thereal));
1499+ msg->appendRealArgument (thereal);
15071500#ifdef DEBUG_LOGGING
1508- if (m_doingAnalysis)
1509- {
1510- DEBUG_LOG ((" Bool argument: %d " , thebool ));
1511- }
1501+ if (m_doingAnalysis)
1502+ {
1503+ DEBUG_LOG ((" Real argument: %g (%8.8X) " , thereal, *( int *)&thereal ));
1504+ }
15121505#endif
1513- } else if (type == ARGUMENTDATATYPE_OBJECTID) {
1514- ObjectID theid;
1515- m_file->read (&theid, sizeof (theid));
1516- msg->appendObjectIDArgument (theid);
1517- #ifdef DEBUG_LOGGING
1518- if (m_doingAnalysis)
1519- {
1520- DEBUG_LOG ((" Object ID argument: %d" , theid));
1506+ break ;
15211507 }
1522- #endif
1523- } else if (type == ARGUMENTDATATYPE_DRAWABLEID) {
1524- DrawableID theid;
1525- m_file->read (&theid, sizeof (theid));
1526- msg->appendDrawableIDArgument (theid);
1508+ case ARGUMENTDATATYPE_BOOLEAN: {
1509+ Bool thebool;
1510+ m_file->read (&thebool, sizeof (thebool));
1511+ msg->appendBooleanArgument (thebool);
15271512#ifdef DEBUG_LOGGING
1528- if (m_doingAnalysis)
1529- {
1530- DEBUG_LOG ((" Drawable ID argument: %d" , theid ));
1531- }
1513+ if (m_doingAnalysis)
1514+ {
1515+ DEBUG_LOG ((" Bool argument: %d" , thebool ));
1516+ }
15321517#endif
1533- } else if (type == ARGUMENTDATATYPE_TEAMID) {
1534- UnsignedInt theid;
1535- m_file->read (&theid, sizeof (theid));
1536- msg->appendTeamIDArgument (theid);
1537- #ifdef DEBUG_LOGGING
1538- if (m_doingAnalysis)
1539- {
1540- DEBUG_LOG ((" Team ID argument: %d" , theid));
1518+ break ;
15411519 }
1542- #endif
1543- } else if (type == ARGUMENTDATATYPE_LOCATION) {
1544- Coord3D loc;
1545- m_file->read (&loc, sizeof (loc));
1546- msg->appendLocationArgument (loc);
1520+ case ARGUMENTDATATYPE_OBJECTID: {
1521+ ObjectID theid;
1522+ m_file->read (&theid, sizeof (theid));
1523+ msg->appendObjectIDArgument (theid);
15471524#ifdef DEBUG_LOGGING
1548- if (m_doingAnalysis)
1549- {
1550- DEBUG_LOG ((" Coord3D argument: %g %g %g (%8.8X %8.8X %8.8X)" , loc.x , loc.y , loc.z ,
1551- *(int *)&loc.x , *(int *)&loc.y , *(int *)&loc.z ));
1552- }
1525+ if (m_doingAnalysis)
1526+ {
1527+ DEBUG_LOG ((" Object ID argument: %d" , theid));
1528+ }
15531529#endif
1554- } else if (type == ARGUMENTDATATYPE_PIXEL) {
1555- ICoord2D pixel;
1556- m_file->read (&pixel, sizeof (pixel));
1557- msg->appendPixelArgument (pixel);
1558- #ifdef DEBUG_LOGGING
1559- if (m_doingAnalysis)
1560- {
1561- DEBUG_LOG ((" Pixel argument: %d,%d" , pixel.x , pixel.y ));
1530+ break ;
15621531 }
1532+ case ARGUMENTDATATYPE_DRAWABLEID: {
1533+ DrawableID theid;
1534+ m_file->read (&theid, sizeof (theid));
1535+ msg->appendDrawableIDArgument (theid);
1536+ #ifdef DEBUG_LOGGING
1537+ if (m_doingAnalysis)
1538+ {
1539+ DEBUG_LOG ((" Drawable ID argument: %d" , theid));
1540+ }
15631541#endif
1564- } else if (type == ARGUMENTDATATYPE_PIXELREGION) {
1565- IRegion2D reg;
1566- m_file->read (®, sizeof (reg));
1567- msg->appendPixelRegionArgument (reg);
1542+ break ;
1543+ }
1544+ case ARGUMENTDATATYPE_TEAMID: {
1545+ UnsignedInt theid;
1546+ m_file->read (&theid, sizeof (theid));
1547+ msg->appendTeamIDArgument (theid);
15681548#ifdef DEBUG_LOGGING
1569- if (m_doingAnalysis)
1570- {
1571- DEBUG_LOG ((" Pixel Region argument: %d,%d -> %d,%d" , reg.lo .x , reg.lo .y , reg.hi .x , reg.hi .y ));
1549+ if (m_doingAnalysis)
1550+ {
1551+ DEBUG_LOG ((" Team ID argument: %d" , theid));
1552+ }
1553+ #endif
1554+ break ;
15721555 }
1556+ case ARGUMENTDATATYPE_LOCATION: {
1557+ Coord3D loc;
1558+ m_file->read (&loc, sizeof (loc));
1559+ msg->appendLocationArgument (loc);
1560+ #ifdef DEBUG_LOGGING
1561+ if (m_doingAnalysis)
1562+ {
1563+ DEBUG_LOG ((" Coord3D argument: %g %g %g (%8.8X %8.8X %8.8X)" , loc.x , loc.y , loc.z ,
1564+ *(int *)&loc.x , *(int *)&loc.y , *(int *)&loc.z ));
1565+ }
15731566#endif
1574- } else if (type == ARGUMENTDATATYPE_TIMESTAMP) { // Not to be confused with Terrance Stamp... Kneel before Zod!!!
1575- UnsignedInt stamp;
1576- m_file->read (&stamp, sizeof (stamp));
1577- msg->appendTimestampArgument (stamp);
1567+ break ;
1568+ }
1569+ case ARGUMENTDATATYPE_PIXEL: {
1570+ ICoord2D pixel;
1571+ m_file->read (&pixel, sizeof (pixel));
1572+ msg->appendPixelArgument (pixel);
15781573#ifdef DEBUG_LOGGING
1579- if (m_doingAnalysis)
1580- {
1581- DEBUG_LOG ((" Timestamp argument: %d" , stamp));
1574+ if (m_doingAnalysis)
1575+ {
1576+ DEBUG_LOG ((" Pixel argument: %d,%d" , pixel.x , pixel.y ));
1577+ }
1578+ #endif
1579+ break ;
15821580 }
1581+ case ARGUMENTDATATYPE_PIXELREGION: {
1582+ IRegion2D reg;
1583+ m_file->read (®, sizeof (reg));
1584+ msg->appendPixelRegionArgument (reg);
1585+ #ifdef DEBUG_LOGGING
1586+ if (m_doingAnalysis)
1587+ {
1588+ DEBUG_LOG ((" Pixel Region argument: %d,%d -> %d,%d" , reg.lo .x , reg.lo .y , reg.hi .x , reg.hi .y ));
1589+ }
15831590#endif
1584- } else if (type == ARGUMENTDATATYPE_WIDECHAR) {
1585- WideChar theid;
1586- m_file->read (&theid, sizeof (theid));
1587- msg->appendWideCharArgument (theid);
1591+ break ;
1592+ }
1593+ case ARGUMENTDATATYPE_TIMESTAMP: { // Not to be confused with Terrance Stamp... Kneel before Zod!!!
1594+ UnsignedInt stamp;
1595+ m_file->read (&stamp, sizeof (stamp));
1596+ msg->appendTimestampArgument (stamp);
15881597#ifdef DEBUG_LOGGING
1589- if (m_doingAnalysis)
1590- {
1591- DEBUG_LOG ((" WideChar argument: %d (%lc)" , theid, theid));
1598+ if (m_doingAnalysis)
1599+ {
1600+ DEBUG_LOG ((" Timestamp argument: %d" , stamp));
1601+ }
1602+ #endif
1603+ break ;
15921604 }
1605+ case ARGUMENTDATATYPE_WIDECHAR: {
1606+ WideChar theid;
1607+ m_file->read (&theid, sizeof (theid));
1608+ msg->appendWideCharArgument (theid);
1609+ #ifdef DEBUG_LOGGING
1610+ if (m_doingAnalysis)
1611+ {
1612+ DEBUG_LOG ((" WideChar argument: %d (%lc)" , theid, theid));
1613+ }
15931614#endif
1615+ break ;
1616+ }
1617+ default :
1618+ break ;
15941619 }
15951620}
15961621
0 commit comments