void Gateway::new_request ( uint16_t request ) { ::fcgi_owire_new_request(&myOWire, request, 1); // lookup the response object for the request ID. mySelection = myResponses.find(request); // might be the first use of this request ID. if ( mySelection == myResponses.end() ) { mySelection = myResponses.insert (Mapping(request, Response(request))).first; } }
static void DoRescue (RESPONSE_REF R) { SIZE dx, dy; COUNT fuel_required; (void) R; // ignored dx = LOGX_TO_UNIVERSE (GLOBAL_SIS (log_x)) - SOL_X; dy = LOGY_TO_UNIVERSE (GLOBAL_SIS (log_y)) - SOL_Y; fuel_required = square_root ( (DWORD)((long)dx * dx + (long)dy * dy) ) + (2 * FUEL_TANK_SCALE); if (StripShip (fuel_required)) { Response (take_it, ExitConversation); Response (leave_it, ExitConversation); } }
static void NormalUmgah (RESPONSE_REF R) { if (PLAYER_SAID (R, whats_up_pre_zombie)) { NPCPhrase (GENERAL_INFO_PRE_ZOMBIE); DISABLE_PHRASE (whats_up_pre_zombie); } else if (PLAYER_SAID (R, want_to_defeat_urquan)) { NPCPhrase (FINE_BY_US); DISABLE_PHRASE (want_to_defeat_urquan); } if (!GET_GAME_STATE (UMGAH_EVIL_BLOBBIES)) Response (evil_blobbies_give_up, CombatIsInevitable); else Response (evil_blobbies_must_die, CombatIsInevitable); if (PHRASE_ENABLED (whats_up_pre_zombie)) Response (whats_up_pre_zombie, NormalUmgah); if (PHRASE_ENABLED (want_to_defeat_urquan)) Response (want_to_defeat_urquan, NormalUmgah); switch (GET_GAME_STATE (UMGAH_MENTIONED_TRICKS)) { case 0: Response (can_we_be_friends, CombatIsInevitable); break; } Response (bye_pre_zombie, CombatIsInevitable); }
uint_8 CmtSpiSdCard::ReadBlock( uint32 *dest, uint32 block ) { uint_16 Checksum; CCHLOCK(mSpi,CMTE_FAIL); mSpi->Select(); /* clear SPI SSEL */ block <<= mSdFactor; // sector <<= 9; MMCCmd[0] = 0x51; MMCCmd[1] = block >> 24; MMCCmd[2] = block >> 16; MMCCmd[3] = block >> 8; MMCCmd[4] = block; /* checksum is no longer required but we always send 0xFF */ MMCCmd[5] = 0xFF; mSpi->WriteBlock( MMCCmd, MMC_CMD_SIZE, mBreak ); /* if mmc_response returns 1 then we failed to get a 0x00 response */ if( Response( mSpi, 0x00 ) != CMTE_OK ) { mSpi->UnSelect(); /* set SPI SSEL */ CUNLOCK(mSpi); return CMTE_SD_READ_BLOCK_TIMEOUT; } /* wait for data token */ if( Response( mSpi, 0xFE ) != CMTE_OK ) { mSpi->UnSelect(); /* set SPI SSEL */ CUNLOCK(mSpi); return CMTE_SD_BLOCK_DATA_TOKEN_MISSING; } /* Get the block of data based on the length */ memset( dest, 0xff, MMC_DATA_SIZE ); mSpi->ReadBlock( dest, MMC_DATA_SIZE, mBreak ); /* CRC bytes that are not needed */ Checksum = 0xffff; mSpi->Transfer( &Checksum, &Checksum, 2, mBreak ); mSpi->UnSelect(); /* set SPI SSEL */ Checksum = 0xffff; mSpi->WriteBlock( &Checksum, 1, mBreak ); CUNLOCK(mSpi); if( mBreak && mBreak->IsSignaled() ) return CMTE_BREAK; return fnIsConnect(); }
// 每一帧,按照小球所处的碰撞状态修改小球速度,并更新小球位置 // @n 小球数量 // @r 小球半径 // @X Y 小球当前位置数组 // @VX VY 小球当前速度数组 // @elapseTime 两帧之间的时间间隔 void UpdateBalls(int n, int r, int X[], int Y[], int VX[], int VY[], int elapseTime) { if(n > BALLS_NUM) return; for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { int v1xy[2], v2xy[2], u[2]; // 两个小球的初速度和碰撞方向向量 // 1 小球是否发生相互碰撞 // 目前的碰撞检测和反应都只是最简单的计算方法,会出现以下的问题: // a.小球之间可能出现粘连 // b.小球速度过快时,可能检测碰撞时已经错过了 int dist2 = (X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j]); if(dist2 <= 4*r*r) { u[0] = X[j] - X[i]; u[1] = Y[j] - Y[i]; v1xy[0] = VX[i]; v1xy[1] = VY[i]; v2xy[0] = VX[j]; v2xy[1] = VY[j]; // 如果小球相碰,则修改小球的速度 if(Response(v1xy, v2xy, u)) { VX[i] = v1xy[0]; // 碰撞后两小球的速度的改变 VY[i] = v1xy[1]; VX[j] = v2xy[0]; VY[j] = v2xy[1]; } } } } // 2 处理小球和屏幕边界的碰撞 for (int i = 0; i < n; i++) { if((X[i] - r) <= 0) // 左边界 VX[i] = abs(VX[i]); else if((X[i] + r) >= wndWidth) // 右边界 VX[i] = -abs(VX[i]); if ((Y[i] + r) >= wndHeight) // 下边界 VY[i] = -abs(VY[i]); else if ((Y[i] - r) <= 0) // 上边界 VY[i] = abs(VY[i]); } // 按照速度更新小球的位置,以便产生动画 for (int i = 0; i < n; i++) { X[i] += VX[i] * elapseTime; Y[i] += VY[i] * elapseTime; } }
static void SpathiFriendly (RESPONSE_REF R) { if (R == 0) { BYTE NumVisits; NumVisits = GET_GAME_STATE (SPATHI_VISITS); switch (NumVisits++) { case 0: NPCPhrase (INIT_FRIENDLY_HELLO_SPACE); break; case 1: NPCPhrase (SUBSEQUENT_FRIENDLY_HELLO_SPACE); --NumVisits; break; } SET_GAME_STATE (SPATHI_VISITS, NumVisits); } else if (PLAYER_SAID (R, since_friendly_give_stuff)) { NPCPhrase (GIVE_ADVICE); DISABLE_PHRASE (since_friendly_give_stuff); } else if (PLAYER_SAID (R, whats_up_space_1)) { NPCPhrase (GENERAL_INFO_SPACE_1); DISABLE_PHRASE (whats_up_space_1); } if (PHRASE_ENABLED (whats_up_space_1)) Response (whats_up_space_1, SpathiFriendly); if (PHRASE_ENABLED (since_friendly_give_stuff)) Response (since_friendly_give_stuff, SpathiFriendly); Response (bye_friendly_space, ExitConversation); }
static void Trade (RESPONSE_REF R) { if (!PLAYER_SAID (R, whats_the_sphere_again)) { NPCPhrase (TRADE_FOR_SPHERE); LastResponse = R; } else { NPCPhrase (SPHERE_IS); DISABLE_PHRASE (whats_the_sphere_again); } Response (no_way, Sell); Response (way, Sell); if (PHRASE_ENABLED (whats_the_sphere_again)) { Response (whats_the_sphere_again, Trade); } }
static void OfferAlliance (RESPONSE_REF R) { if (PLAYER_SAID (R, seem_like_nice_guys)) NPCPhrase (ARE_NICE_WANT_ALLY); else if (PLAYER_SAID (R, talk_about_alliance)) NPCPhrase (OK_TALK_ALLIANCE); else if (PLAYER_SAID (R, why_so_trusting)) { NPCPhrase (TRUSTING_BECAUSE); SET_GAME_STATE (ORZ_STACK1, 1); } Response (no_alliance, OrzNeutral); Response (decide_later, OrzNeutral); if (GET_GAME_STATE (ORZ_STACK1) == 0) { Response (why_so_trusting, OfferAlliance); } Response (yes_alliance, ExitConversation); }
void Fifth_Check_Reserved(void) { if (rd[SN_Reserved]==Reserved) { if(rd[SN_ID_H] == PCX && rd[SN_ID_L] == PCX && rd[SN_Order] != Order_wr_ID) { Response(Error); } else if(rd[SN_ID_H] == PCX && rd[SN_ID_L] == PCX && rd[SN_Order] == Order_wr_ID) { wr_ID(); } else { Sixth_Check_Color(); } } else { Response(Error_Check_Reserved); } }
static void SpathiPassword (RESPONSE_REF R) { if (R == 0) { BYTE NumVisits; NumVisits = GET_GAME_STATE (SPATHI_HOME_VISITS); switch (NumVisits++) { default: NPCPhrase (WHAT_IS_PASSWORD); NumVisits = 1; break; case 1: NPCPhrase (WHAT_IS_PASSWORD_AGAIN); --NumVisits; break; } SET_GAME_STATE (SPATHI_HOME_VISITS, NumVisits); } else if (PLAYER_SAID (R, what_do_i_get)) { NPCPhrase (YOU_GET_TO_LIVE); DISABLE_PHRASE (what_do_i_get); } if (GET_GAME_STATE (FOUND_PLUTO_SPATHI) || GET_GAME_STATE (KNOW_SPATHI_PASSWORD)) { Response (good_password, SpathiCouncil); if (PHRASE_ENABLED (what_do_i_get)) { Response (what_do_i_get, SpathiPassword); } } else { construct_response (shared_phrase_buf, we_are_vindicator0, GLOBAL_SIS (CommanderName), we_are_vindicator1, GLOBAL_SIS (ShipName), we_are_vindicator2, (UNICODE*)NULL); DoResponsePhrase (we_are_vindicator0, ExitConversation, shared_phrase_buf); Response (gort_merenga, ExitConversation); Response (guph_florp, ExitConversation); Response (wagngl_fthagn, ExitConversation); Response (pleeese, ExitConversation); Response (screw_password, ExitConversation); } }
static void ConsoleShofixti (RESPONSE_REF R) { if (PLAYER_SAID (R, dont_do_it)) { NPCPhrase (YES_I_DO_IT); DISABLE_PHRASE (dont_do_it); } else NPCPhrase (VERY_SAD_KILL_SELF); if (GET_GAME_STATE (MAIDENS_ON_SHIP)) { Response (important_duty, GiveMaidens); } if (PHRASE_ENABLED (dont_do_it)) { Response (dont_do_it, ConsoleShofixti); } Response (need_you_for_duty, ExitConversation); Response (go_ahead, ExitConversation); }
PRInt32 nsHttpPipeline::PipelinePosition() { nsAHttpTransaction *trans = Response(0); if (trans) return trans->PipelinePosition(); // The response queue is empty, so return oldest request if (mRequestQ.Length()) return Request(mRequestQ.Length() - 1)->PipelinePosition(); // No transactions in the pipeline return 0; }
void MetaEngine::lastFmResponse(const QString &html, const QString &lang) { DBUG << html.isEmpty() << lang.isEmpty(); if (constBlankResp==responses[Wiki].html) { // Wikipedia failed, so use last.fm response... DBUG << "Wiki failed, so use last.fm"; emit searchResult(html, lang); responses.clear(); } else if (responses[Wiki].html.isEmpty()) { // No Wikipedia response yet, so save last.fm response... DBUG << "No wiki response, save last.fm"; responses[LastFm]=Response(html.isEmpty() ? constBlankResp : html, lang); } }
bool NetworkInterfaceMockWithMap::addResponse( const ReplicationExecutor::RemoteCommandRequest& request, const StatusWith<BSONObj>& response, bool isBlocked) { boost::lock_guard<boost::mutex> lk(_mutex); return _responses.insert(std::make_pair(request, BlockableResponseStatus( !response.isOK() ? ResponseStatus(response.getStatus()) : ResponseStatus(Response( response.getValue(), Milliseconds(0))) , isBlocked))).second; }
static void IlwrathHome (RESPONSE_REF R) { if (R == 0) { BYTE NumVisits; NumVisits = GET_GAME_STATE (ILWRATH_HOME_VISITS); switch (NumVisits++) { case 0: NPCPhrase (INIT_HOME_HELLO); break; case 1: NPCPhrase (SUBSEQUENT_HOME_HELLO); --NumVisits; break; } SET_GAME_STATE (ILWRATH_HOME_VISITS, NumVisits); } else if (PLAYER_SAID (R, enough_gods)) NPCPhrase (OK_ENOUGH_GODS); else if (PLAYER_SAID (R, enough_ilwrath)) NPCPhrase (OK_ENOUGH_ILWRATH); if (PHRASE_ENABLED (want_info_on_gods)) { Response (want_info_on_gods, IlwrathGods); } if (PHRASE_ENABLED (want_info_on_ilwrath)) { Response (want_info_on_ilwrath, IlwrathInfo); } Response (want_peace, CombatIsInevitable); Response (want_alliance, CombatIsInevitable); Response (bye_homeworld, CombatIsInevitable); }
void FindSeeder(struct file_info* file, int chunk, char* request, int requester) { //fprintf(stderr, "[DBG] %s, %d, %d, %d\n", file->name, file->chunks, chunk, file->seeders); struct seeder_info* p; if (chunk > file->chunks) { Response(requester, CHNK_ERR, request); } for (p = &(file->seeders)[chunk]; p != NULL; p = p->next) { if (p->busy == false) { break; } } if (p == NULL) { Response(requester, NO_SEED, request); } else { char peerID[INT_LEN]; memset(peerID, '\0', INT_LEN); itoa(requester, peerID); strncpy(request+REQ_LEN+NAME_SIZE+INT_LEN, peerID, INT_LEN); if (RequestPort(p, request) != 0) { p->busy = true; Response(requester, NO_SEED, request); } else { p->busy = true; p->nextBusy = busyChunks->nextBusy; busyChunks->nextBusy = p; } } }
static void SpathiNeutral (RESPONSE_REF R) { if (R == 0) { BYTE NumVisits; NumVisits = GET_GAME_STATE (SPATHI_VISITS); switch (NumVisits++) { case 0: NPCPhrase (INIT_NEUTRAL_HELLO_SPACE); break; case 1: NPCPhrase (SUBSEQUENT_NEUTRAL_HELLO_SPACE); --NumVisits; break; } SET_GAME_STATE (SPATHI_VISITS, NumVisits); } else if (PLAYER_SAID (R, look_weird)) { NPCPhrase (YOU_LOOK_WEIRD); SET_GAME_STATE (SPATHI_STACK0, 1); } else if (PLAYER_SAID (R, no_look_really_weird)) { NPCPhrase (NO_YOU_LOOK_REALLY_WEIRD); SET_GAME_STATE (SPATHI_STACK0, 2); } switch (GET_GAME_STATE (SPATHI_STACK0)) { case 0: Response (look_weird, SpathiNeutral); break; case 1: Response (no_look_really_weird, SpathiNeutral); break; } if (GET_GAME_STATE (SPATHI_STACK1) == 0) { Response (come_in_peace, SpathiBefriend); } if (GET_GAME_STATE (SPATHI_STACK2) == 0) { Response (prepare_to_die, SpathiAntagonize); } else { Response (attack_you_now, ExitConversation); } Response (part_in_peace, ExitConversation); }
bool nsHttpPipeline::IsDone() { bool done = true; PRUint32 i, count = mRequestQ.Length(); for (i = 0; done && (i < count); i++) done = Request(i)->IsDone(); count = mResponseQ.Length(); for (i = 0; done && (i < count); i++) done = Response(i)->IsDone(); return done; }
Response get_statist_info(Request& request) { std::vector<std::string> times; Json::Value root; Json::Value json_data; std::vector<std::string> cms = get_cmds(times); LOG_DEBUG("get cmds size:%d", cms.size()); send_commands(cms, times, json_data); Json::ArrayIndex index = 0; root["JSChart"]["datasets"][index]["type"] = "line"; root["JSChart"]["datasets"][index]["data"] = json_data; return Response(STATUS_OK, root); };
PRUint32 nsHttpPipeline::CancelPipeline(nsresult originalReason) { PRUint32 i, reqLen, respLen, total; nsAHttpTransaction *trans; reqLen = mRequestQ.Length(); respLen = mResponseQ.Length(); total = reqLen + respLen; // don't count the first response, if presnet if (respLen) total--; if (!total) return 0; // any pending requests can ignore this error and be restarted // unless it is during a CONNECT tunnel request for (i = 0; i < reqLen; ++i) { trans = Request(i); if (mConnection && mConnection->IsProxyConnectInProgress()) trans->Close(originalReason); else trans->Close(NS_ERROR_NET_RESET); NS_RELEASE(trans); } mRequestQ.Clear(); // any pending responses can be restarted except for the first one, // that we might want to finish on this pipeline or cancel individually. // Higher levels of callers ensure that we don't process non-idempotent // tranasction with the NS_HTTP_ALLOW_PIPELINING bit set for (i = 1; i < respLen; ++i) { trans = Response(i); trans->Close(NS_ERROR_NET_RESET); NS_RELEASE(trans); } if (respLen > 1) mResponseQ.TruncateLength(1); DontReuse(); Classify(nsAHttpTransaction::CLASS_SOLO); return total; }
void nsHttpPipeline::Close(nsresult reason) { LOG(("nsHttpPipeline::Close [this=%p reason=%x]\n", this, reason)); if (mClosed) { LOG((" already closed\n")); return; } // the connection is going away! mStatus = reason; mClosed = true; nsRefPtr<nsHttpConnectionInfo> ci; GetConnectionInfo(getter_AddRefs(ci)); uint32_t numRescheduled = CancelPipeline(reason); // numRescheduled can be 0 if there is just a single response in the // pipeline object. That isn't really a meaningful pipeline that // has been forced to be rescheduled so it does not need to generate // negative feedback. if (ci && numRescheduled) gHttpHandler->ConnMgr()->PipelineFeedbackInfo( ci, nsHttpConnectionMgr::RedCanceledPipeline, nullptr, 0); nsAHttpTransaction *trans = Response(0); if (!trans) return; // The current transaction can be restarted via reset // if the response has not started to arrive and the reason // for failure is innocuous (e.g. not an SSL error) if (!mResponseIsPartial && (reason == NS_ERROR_NET_RESET || reason == NS_OK || reason == NS_ERROR_NET_TIMEOUT || reason == NS_BASE_STREAM_CLOSED)) { trans->Close(NS_ERROR_NET_RESET); } else { trans->Close(reason); } NS_RELEASE(trans); mResponseQ.Clear(); }
static void SpathiQuest (RESPONSE_REF R) { if (R == 0) { if (!GET_GAME_STATE (LIED_ABOUT_CREATURES)) NPCPhrase (HOW_GO_EFFORTS); else NPCPhrase (YOU_LIED_1); } else if (PLAYER_SAID (R, little_mistake)) { NPCPhrase (BIG_MISTAKE); DISABLE_PHRASE (little_mistake); } else if (PLAYER_SAID (R, talk_test)) { NPCPhrase (TEST_AGAIN); DISABLE_PHRASE (talk_test); } else if (PLAYER_SAID (R, zapped_a_few)) { NPCPhrase (YOU_FORTUNATE); DISABLE_PHRASE (zapped_a_few); } if (!GET_GAME_STATE (LIED_ABOUT_CREATURES)) Response (killed_them_all_1, ExitConversation); else { if (PHRASE_ENABLED (little_mistake)) { Response (little_mistake, SpathiQuest); } Response (killed_them_all_2, ExitConversation); } if (!GET_GAME_STATE (SPATHI_CREATURES_ELIMINATED)) { if (PHRASE_ENABLED (talk_test)) { Response (talk_test, SpathiQuest); } if (PHRASE_ENABLED (zapped_a_few) && GET_GAME_STATE (SPATHI_CREATURES_EXAMINED)) { Response (zapped_a_few, SpathiQuest); } Response (bye_before_party, ExitConversation); } }
void nsHttpPipeline::GetSecurityCallbacks(nsIInterfaceRequestor **result) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); // depending on timing this could be either the request or the response // that is needed - but they both go to the same host. A request for these // callbacks directly in nsHttpTransaction would not make a distinction // over whether the the request had been transmitted yet. nsAHttpTransaction *trans = Request(0); if (!trans) trans = Response(0); if (trans) trans->GetSecurityCallbacks(result); else { *result = nullptr; } }
Response MockConnection::Request( const std::string & method, const std::string & url, const HeaderMap & header ) { std::string mockResponse = "HTTP/1.1 200 OK\r\n" "Content-Type: text/html\r\n" "Last-Modified: Sun, 25 Jul 2010 03:44:38 GMT\r\n" "Accept-Ranges: bytes\r\n" "ETag: \"f7b3acb4ab2bcb1:0\"\r\n" "Server: Microsoft-IIS/7.5\r\n" "X-Powered-By: ASP.NET\r\n" "Date: Wed, 18 Aug 2010 13:28:20 GMT\r\n" "Connection: close\r\n" "Content-Length: 9415\r\n" "\r\n" "This is a test string\r\n"; return Response( mockResponse ); }
void RpcHandler::HandleData(const QSharedPointer<ISender> &from, const QVariantList &container) { if(container.size() < 2) { return; } QString type = container.at(0).toString(); if(type == Request::RequestType || type == Request::NotificationType) { HandleRequest(Request(_responder, from, container)); } else if(type == Response::ResponseType) { HandleResponse(Response(from, container)); } else { qDebug() << "Received an unknown Rpc type:" << type; } }
void SmallTalk1 (RESPONSE_REF R) { if (PLAYER_SAID (R, enough_alliance)) { NPCPhrase (ENOUGH_ALLIANCE_OK); } if (PLAYER_SAID (R, how_are_things)) { NPCPhrase (HAPPY_ORZ); DISABLE_PHRASE (how_are_things); } else if (PLAYER_SAID (R, any_news)) { NPCPhrase (ORZ_NEWS); DISABLE_PHRASE (any_news); } else if (PLAYER_SAID (R, discuss_alliance_matters)) { NPCPhrase (HAPPY_TO_DISCUSS); DISABLE_PHRASE (discuss_alliance_matters); } else if (PLAYER_SAID (R, tell_of_nature)) { NPCPhrase (ORZ_TELL_1); DISABLE_PHRASE (tell_of_nature); SET_GAME_STATE(ORZ_STACK0, 1); } if (PHRASE_ENABLED (how_are_things)) Response (how_are_things, SmallTalk1); if (PHRASE_ENABLED (any_news)) Response (any_news, SmallTalk1); if (PHRASE_ENABLED (discuss_alliance_matters)) Response (discuss_alliance_matters, AllianceMatters); switch (GET_GAME_STATE(ORZ_STACK0)) { case 0: if (PHRASE_ENABLED (tell_of_nature)) Response (tell_of_nature, SmallTalk1); break; case 1: if (PHRASE_ENABLED (tell_buddies)) Response (tell_buddies, AnnoyOrz); break; default: break; } Response (goodbye_orz, ExitConversation); }
Response Response::fromJson(const Json::Value &root) { Response retval; try { retval.message = getJsonOrFail<std::string>(root, _messageKey); const auto code = getJsonOrFail<int>(root, _codeKey); if (code > Code::RESPONSE_NUM_ITEMS) throw std::runtime_error("Error code out of range"); retval.code = static_cast<Code>(code); } catch (const std::exception &ex) { throw Response(Response::Code::JsonError, ex.what()); } return retval; }
void HandleNewTransactionEvent(struct Dialog *dialog, int event, MESSAGE *message) { struct Dialog *matched = MatchMessage2Dialog(message); SIP_METHOD method = MessageGetMethod(message); if (matched == NULL) { int account = FindMessageDestAccount(message); struct UserAgent *ua = AddUa(account); struct Dialog *d = AddDialog(NULL, ua); if (method == SIP_METHOD_INVITE) { DialogNewTransaction(d, message, TRANSACTION_TYPE_SERVER_INVITE); } else { struct Transaction *t = DialogNewTransaction(d, message, TRANSACTION_TYPE_SERVER_NON_INVITE); Response(t,TRANSACTION_SEND_OK); } } else { DialogReceiveBye(matched, message); } }
static void Intro (void) { if (GET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER)) { NPCPhrase (VERY_IMPRESSIVE); Response (cook_their_butts, ByeBye); Response (overthrow_evil_aliens, ByeBye); Response (annihilate_those_monsters, ByeBye); } else if (GET_GAME_STATE (STARBASE_VISITED)) { if (GET_GAME_STATE (RADIOACTIVES_PROVIDED)) { if (GET_GAME_STATE (MOONBASE_DESTROYED) == 0) { TellMoonBase (0); } else { BaseDestroyed (0); } } else { CommData.AlienColorMap = SetAbsColorMapIndex (CommData.AlienColorMap, 1); NPCPhrase (DO_YOU_HAVE_RADIO_THIS_TIME); if (GLOBAL_SIS (ElementAmounts[RADIOACTIVE])) GiveRadios (0); else AskAfterRadios (0); } } else /* first visit */ { CommData.AlienColorMap = SetAbsColorMapIndex (CommData.AlienColorMap, 1); SET_GAME_STATE (STARBASE_VISITED, 1); NPCPhrase (ARE_YOU_SUPPLY_SHIP); Response (no_but_well_help, NoRadioactives); Response (yes_this_is_supply_ship, NoRadioactives); Response (what_slave_planet, NoRadioactives); } }
void Fourth_Check_Bit(void) { int ByteNum; uint8_t CheckSum = 0x00; for(ByteNum=1; ByteNum<rd[SN_DataLen]+7; ByteNum++) { CheckSum = rd[ByteNum]^CheckSum; } if(rd[SN_CheckBit] == CheckSum) { Fifth_Check_Reserved(); ByteNum = 0; CheckSum = 0x00; } else { Response(Error_Check_Bit); } }