Skip to content

Commit

Permalink
fixed the tutorials not working due to incorrect return value checks …
Browse files Browse the repository at this point in the history
…(API change)
  • Loading branch information
myT committed Oct 17, 2017
1 parent c893007 commit 2e1c9e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 5 additions & 6 deletions UDT_DLL/src/apps/tut_multi_rail.cpp
Expand Up @@ -145,13 +145,11 @@ struct Obituary

static bool IsObituaryEvent(Obituary& obituary, const idEntityStateBase& entity, udtProtocol::Id protocol)
{
// Ideally, you should get and test those once before parsing instead of
// querying those values and over.

// Should get these values once before parsing instead of over and over during parsing.
s32 obituaryEvtId;
s32 eventTypeId;
if(!udtGetIdMagicNumber(&obituaryEvtId, udtMagicNumberType::EntityEvent, (u32)udtEntityEvent::Obituary, protocol, udtMod::None) ||
!udtGetIdMagicNumber(&eventTypeId, udtMagicNumberType::EntityType, (u32)udtEntityType::Event, protocol, udtMod::None))
if(udtGetIdMagicNumber(&obituaryEvtId, udtMagicNumberType::EntityEvent, (u32)udtEntityEvent::Obituary, protocol, udtMod::None) != udtErrorCode::None ||
udtGetIdMagicNumber(&eventTypeId, udtMagicNumberType::EntityType, (u32)udtEntityType::Event, protocol, udtMod::None) != udtErrorCode::None)
{
return false;
}
Expand All @@ -177,8 +175,9 @@ static bool IsObituaryEvent(Obituary& obituary, const idEntityStateBase& entity,
attackerIdx = -1;
}

// Should get this value once before parsing instead of over and over during parsing.
s32 udtMod;
if(!udtGetUDTMagicNumber(&udtMod, (u32)udtMagicNumberType::MeanOfDeath, entity.eventParm, (u32)protocol, (u32)udtMod::None))
if(udtGetUDTMagicNumber(&udtMod, (u32)udtMagicNumberType::MeanOfDeath, entity.eventParm, (u32)protocol, (u32)udtMod::None) != udtErrorCode::None)
{
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion UDT_DLL/src/apps/tut_players.cpp
Expand Up @@ -267,7 +267,8 @@ struct PlayerPrinter
const u32 protocol = udtGetProtocolByFilePath(filePath);

s32 firstPlayerIdx;
if(!udtGetIdMagicNumber(&firstPlayerIdx, (u32)udtMagicNumberType::ConfigStringIndex, (s32)udtConfigStringIndex::FirstPlayer, protocol, (u32)udtMod::None))
if(udtGetIdMagicNumber(&firstPlayerIdx, (u32)udtMagicNumberType::ConfigStringIndex, (s32)udtConfigStringIndex::FirstPlayer, protocol, (u32)udtMod::None) !=
udtErrorCode::None)
{
PrintError("Failed to get the index of the first player config string");
return false;
Expand Down

0 comments on commit 2e1c9e2

Please sign in to comment.