bool EnemyRadarPowerUp::isRadarActive() { if ( radarActive && radarTimer.isTimeOut() ) { radarActive = false; } return radarActive; }
bool DedicatedGameManager::mainLoop() { if ( heartbeat ) heartbeat->checkHeartbeat(); static NTimer aktimer(10000); //all 10 sec only if (aktimer.isTimeOut()) { aktimer.reset(); PlayerState * player = 0; unsigned long max_players; max_players = PlayerInterface::getMaxPlayers(); for (unsigned long i = 0; i < max_players; i++) { player = PlayerInterface::getPlayer((unsigned short) i); if ( player->isActive() ) { if ( player->checkAutokick() ) { char chat_string[256]; sprintf(chat_string, "Server kicked '%s' due to inactivity",player->getName().c_str()); LOGGER.info("DED: %s", chat_string); ChatInterface::serversay(chat_string); SERVER->kickClient((PlayerID)i); } } } if (VoteManager::checkVoteTimer()) { VoteManager::checkPlayersVote(); } } return BaseGameManager::mainLoop(); }
void WorldInputCmdProcessor::evalRightMButtonEvents(const MouseEvent& event) { static NTimer mtimer(75); if (event.event == MouseEvent::EVENT_DOWN ) { right_mouse_scroll=true; right_mouse_scroll_moved = false; right_mouse_scroll_pos=event.pos; right_mouse_scrolled_pos.x=right_mouse_scrolled_pos.y=0; mtimer.reset(); } if (right_mouse_scroll && event.event == MouseEvent::EVENT_UP ) { right_mouse_scroll=false; if ( ! right_mouse_scroll_moved && mtimer.isTimeOut() ) { // simple right click on the same position after timeout working_list.unGroup(); } return; } }
void WorldInputCmdProcessor::evalLeftMButtonEvents(const MouseEvent &event) { iXY world_pos; unsigned char click_status; WorldViewInterface::clientXYtoWorldXY(world_win, event.pos, &world_pos); if ( (manual_control_state == true) || KeyboardInterface::getKeyState( SDLK_LCTRL ) || KeyboardInterface::getKeyState( SDLK_RCTRL ) ) { if (event.event == MouseEvent::EVENT_DOWN ) { sendManualFireCommand( world_pos ); } } else if (event.event == MouseEvent::EVENT_DOWN) { Objective *objective = 0; click_status = ObjectiveInterface::quearyObjectiveLocationStatus( world_pos, PlayerInterface::getLocalPlayerIndex(), &objective); if ( click_status == _player_occupied_objective_found ) { selection_box_active = false; outpost_goal_selection = objective->objective_state.ID; output_pos_press = objective->objective_state.location; } else { box_press = world_pos; box_release = world_pos; selection_box_active = true; } } else if(event.event == MouseEvent::EVENT_UP) { if (selection_box_active) { selection_box_active = false; box_release = world_pos; if(abs(box_release.x - box_press.x) > 3 && abs(box_release.y - box_press.y) > 3) { return; } } if (outpost_goal_selection != OBJECTIVE_NONE ) { Objective *objective = 0; int cs = ObjectiveInterface::quearyObjectiveLocationStatus( world_pos, PlayerInterface::getLocalPlayerIndex(), &objective); if ( (cs == _player_occupied_objective_found) && outpost_goal_selection == objective->objective_state.ID ) { // we've let go of the mouse on the building so we're // not changing the spawn point selected_objective_id = objective->objective_state.ID; activateVehicleSelectionView( selected_objective_id ); } else { TerminalOutpostOutputLocRequest term_mesg; term_mesg.output_loc_request.set( outpost_goal_selection, world_pos); CLIENT->sendMessage(&term_mesg, sizeof(TerminalOutpostOutputLocRequest)); if ( NetworkState::status == _network_state_client ) { ObjectiveInterface::sendMessage( &(term_mesg.output_loc_request) ); } } outpost_goal_selection = OBJECTIVE_NONE; return; } click_status = getCursorStatus(world_pos); switch(click_status) { case _cursor_player_unit: { static NTimer dclick_timer(200); static int click_times = 0; bool addunits = false; if( (KeyboardInterface::getKeyState(SDLK_LSHIFT) == true) || (KeyboardInterface::getKeyState(SDLK_RSHIFT) == true)) { addunits = true; } if ( ! dclick_timer.isTimeOut() ) { if ( click_times ) { iRect wr; WorldViewInterface::getViewWindow(&wr); working_list.selectBounded(wr, addunits); click_times=0; } else { working_list.selectSameTypeVisible(world_pos,addunits); dclick_timer.reset(); click_times++; } break; } else if (addunits) { working_list.addUnit(world_pos); } else { working_list.selectUnit(world_pos ); } current_selection_list_bits=0; current_selection_list_index = 0xFFFF; if (working_list.unit_list.size() > 0) { UnitBase *unit = UnitInterface::getUnit( working_list.unit_list[0]); if(unit) unit->soundSelected(); } dclick_timer.reset(); click_times=0; break; } case _cursor_move: case _cursor_blocked: if(outpost_goal_selection == OBJECTIVE_NONE) sendMoveCommand(world_pos); break; case _cursor_enemy_unit: sendAttackCommand(world_pos); break; case _cursor_make_allie: sendAllianceRequest(world_pos, true); break; case _cursor_break_allie: sendAllianceRequest(world_pos, false); break; } } }