bool CPlayGameVorticon::init() { CVorticonMapLoaderWithPlayer MapLoader( mMap, m_Player, mSpriteObjectContainer ); MapLoader.m_checkpointset = m_checkpointset; // load level map if( !MapLoader.load( m_Episode, m_Level, m_Gamepath ) ) return false; gpSaveGameController->setLevel(m_Level); //// If those worked fine, continue the initialization // draw level map mMap->drawAll(); // Now Scroll to the position of the player and center him mMap->gotoPos( 32, 64 ); // Assure that the edges are never seen setupPlayers(); // Well, all players are living because they were newly spawn. g_pTimer->ResetSecondsTimer(); g_pInput->flushAll(); // Initialize the AI mpObjectAI.reset( new CVorticonSpriteObjectAI(mMap.get(), mSpriteObjectContainer, m_Player, m_NumPlayers, m_Episode, m_Level, mMap->m_Dark) ); // Check if Player meets the conditions to show a cutscene. This also happens, when finale of episode has reached verifyFinales(); // When Level starts it's never dark! g_pGfxEngine->Palette.setdark(false); if(m_level_command == GOTO_FINALE) createFinale(); else if(m_showKeensLeft) g_pSound->playSound(SOUND_KEENSLEFT, PLAY_NOW); // In the case that we are in Episode 3 last Level, show Mortimer Messages if( m_Episode == 3 && m_Level == 16 ) { std::unique_ptr<CMessageBoxVort> msg1(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER"),false, true)); std::unique_ptr<CMessageBoxVort> msg2(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER2"),false, true)); std::unique_ptr<CMessageBoxVort> msg3(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER3"),false, true)); std::unique_ptr<CMessageBoxVort> msg4(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER4"),false, true)); std::unique_ptr<CMessageBoxVort> msg5(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER5"),false, true)); std::unique_ptr<CMessageBoxVort> msg6(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER6"),false, true)); mMessageBoxes.push_back(move(msg1)); mMessageBoxes.push_back(move(msg2)); mMessageBoxes.push_back(move(msg3)); mMessageBoxes.push_back(move(msg4)); mMessageBoxes.push_back(move(msg5)); mMessageBoxes.push_back(move(msg6)); g_pSound->playSound(SOUND_MORTIMER); } return true; }
TEST(Serialization, WriteBitsEasy) { QByteArray msg(1, 'a'); QBitArray bits(1, false); Serialization::WriteBitArray(bits, msg, 0); EXPECT_EQ((char)0x00, (char)msg[0]); QByteArray msg1(1, 'a'); QBitArray bits1(0, false); Serialization::WriteBitArray(bits1, msg1, 0); EXPECT_EQ((char)0x00, (char)msg1[0]); QByteArray msg2(1, 'a'); QBitArray bits2(1, true); Serialization::WriteBitArray(bits2, msg2, 0); EXPECT_EQ((char)0x01, (char)msg2[0]); QByteArray msg3(2, 'a'); QBitArray bits3(8, true); Serialization::WriteBitArray(bits3, msg3, 0); EXPECT_EQ((char)0xFF, (char)msg3[0]); EXPECT_EQ((char)'a', (char)msg3[1]); QByteArray msg4(2, 'a'); QBitArray bits4(8, true); Serialization::WriteBitArray(bits4, msg4, 1); EXPECT_EQ((char)'a', (char)msg4[0]); EXPECT_EQ((char)0xFF, (char)msg4[1]); QByteArray msg5(2, 'a'); QBitArray bits5(9, true); Serialization::WriteBitArray(bits5, msg5, 0); EXPECT_EQ((char)0xFF, (char)msg5[0]); EXPECT_EQ((char)0x01, (char)msg5[1]); QByteArray msg6(2, 'a'); QBitArray bits6(10, true); Serialization::WriteBitArray(bits6, msg6, 0); EXPECT_EQ((char)0xFF, (char)msg6[0]); EXPECT_EQ((char)0x03, (char)msg6[1]); }
static const response* chkdns_helo(str* hostname, str* capabilities) { str dbltxt; /* hack, don't check numeric, guess from first character */ if(hostname->s[0] >= '0' && hostname->s[0] <= '9') return 0; if(dblchk(hostname, &dbltxt)) { session_setenv("RBLSMTPD", dbltxt.s, 0); session_setnum("dblhelo", 1); session_setnum("sump", 1); msg4("HELO ", hostname->s, " in DBL ",dbltxt.s); if(getenv("DBLREJECT")) { resp_baddbl.message = dbltxt.s; return &resp_baddbl; } } return 0; (void) capabilities; }
bool CPlayGameVorticon::init() { const GsRect<Uint16> gameRect = gVideoDriver.getVidConfig().m_GameRect; gVideoDriver.setNativeResolution(gameRect); // Create the special merge effect (Fadeout) CColorMerge *pColorMergeFX = new CColorMerge(8); gEffectController.setupEffect(pColorMergeFX); CVorticonMapLoaderWithPlayer MapLoader( mMap, m_Player, mSpriteObjectContainer ); MapLoader.m_checkpointset = m_checkpointset; const int numPlayers = g_pBehaviorEngine->mPlayers; // load level map if( !MapLoader.load( m_Episode, m_Level, m_Gamepath ) ) return false; gpSaveGameController->setLevel(m_Level); mMap->setLevel(m_Level); //// If those worked fine, continue the initialization // draw level map mMap->drawAll(); // Now Scroll to the position of the player and center him mMap->gotoPos( 32, 64 ); // Ensure that the edges are never seen setupPlayers(); // Well, all players are living because they were newly spawn. gTimer.ResetSecondsTimer(); gInput.flushAll(); // Initialize the AI mpObjectAI.reset( new CVorticonSpriteObjectAI(mMap.get(), mSpriteObjectContainer, m_Player, numPlayers, m_Episode, m_Level, mMap->m_Dark) ); // Check if Player meets the conditions to show a cutscene. This also happens, when finale of episode is reached verifyFinales(); // When Level starts it's never dark! gGraphics.Palette.setdark(false); const std::string finaleStr = gArgs.getValue("finale"); if(finaleStr == "on") { createFinale(); gArgs.removeTag("finale"); } if(m_showKeensLeft) g_pSound->playSound(SOUND_KEENSLEFT, PLAY_NOW); // In the case that we are in Episode 3 last Level, show Mortimer Messages if( m_Episode == 3 && m_Level == 16 ) { std::unique_ptr<CMessageBoxVort> msg1(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER"),false, true)); std::unique_ptr<CMessageBoxVort> msg2(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER2"),false, true)); std::unique_ptr<CMessageBoxVort> msg3(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER3"),false, true)); std::unique_ptr<CMessageBoxVort> msg4(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER4"),false, true)); std::unique_ptr<CMessageBoxVort> msg5(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER5"),false, true)); std::unique_ptr<CMessageBoxVort> msg6(new CMessageBoxVort(g_pBehaviorEngine->getString("EP3_MORTIMER6"),false, true)); mMessageBoxes.push_back(move(msg1)); mMessageBoxes.push_back(move(msg2)); mMessageBoxes.push_back(move(msg3)); mMessageBoxes.push_back(move(msg4)); mMessageBoxes.push_back(move(msg5)); mMessageBoxes.push_back(move(msg6)); g_pSound->playSound(SOUND_MORTIMER); } return true; }
// used for collation result reporting, defined here for convenience // (maybe moved later) void IntlTestCollator::reportCResult( const UnicodeString &source, const UnicodeString &target, CollationKey &sourceKey, CollationKey &targetKey, Collator::EComparisonResult compareResult, Collator::EComparisonResult keyResult, Collator::EComparisonResult incResult, Collator::EComparisonResult expectedResult ) { if (expectedResult < -1 || expectedResult > 1) { errln("***** invalid call to reportCResult ****"); return; } UBool ok1 = (compareResult == expectedResult); UBool ok2 = (keyResult == expectedResult); UBool ok3 = (incResult == expectedResult); if (ok1 && ok2 && ok3 && !verbose) { // Keep non-verbose, passing tests fast return; } else { UnicodeString msg1(ok1 ? "Ok: compare(" : "FAIL: compare("); UnicodeString msg2(", "), msg3(") returned "), msg4("; expected "); UnicodeString prettySource, prettyTarget, sExpect, sResult; IntlTest::prettify(source, prettySource); IntlTest::prettify(target, prettyTarget); appendCompareResult(compareResult, sResult); appendCompareResult(expectedResult, sExpect); if (ok1) { logln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult); } else { errln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult + msg4 + sExpect); } msg1 = UnicodeString(ok2 ? "Ok: key(" : "FAIL: key("); msg2 = ").compareTo(key("; msg3 = ")) returned "; appendCompareResult(keyResult, sResult); if (ok2) { logln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult); } else { errln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult + msg4 + sExpect); msg1 = " "; msg2 = " vs. "; prettify(sourceKey, prettySource); prettify(targetKey, prettyTarget); errln(msg1 + prettySource + msg2 + prettyTarget); } msg1 = UnicodeString (ok3 ? "Ok: incCompare(" : "FAIL: incCompare("); msg2 = ", "; msg3 = ") returned "; appendCompareResult(incResult, sResult); if (ok3) { logln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult); } else { errln(msg1 + prettySource + msg2 + prettyTarget + msg3 + sResult + msg4 + sExpect); } } }