LRESULT COpenHoldemHopperCommunication::OnIsReadyMessage(WPARAM, LPARAM)
{
	write_log(Preferences()->debug_hopper_messages(), "[COpenHoldemHopperCommunication] Received 0x8007: OnIsReadyMessage\n");
	// 0 = Not ready, because of either
	//   * no formula
	//   * no tablemap
	if (p_function_collection->FormulaName() == "" 
		|| p_formula_parser->IsParsing()
		|| p_tablemap_loader->NumberOfTableMapsLoaded() < 1)
	{
		write_log(Preferences()->debug_hopper_messages(), 
			"[COpenHoldemHopperCommunication] OnIsReadyMessage() not ready\n");
		return 0;
	}
	// Otherwise:
	// 1 = ready and not connected
	// 2 = ready, but already connected
	else if (p_autoconnector->attached_hwnd() == NULL)
	{
		write_log(Preferences()->debug_hopper_messages(), 
			"[COpenHoldemHopperCommunication] OnIsReadyMessage() ready\n");
		return 1;
	}
	else
	{
		write_log(Preferences()->debug_hopper_messages(), 
			"[COpenHoldemHopperCommunication] OnIsReadyMessage() already connected\n");
		return 2;
	}
}
void CFileSystemMonitor::InitMonitor() {
  _scraper_directory_on_a_network_drive = false;
  // http://msdn.microsoft.com/de-de/library/windows/desktop/bb773640%28v=vs.85%29.aspx
  if (PathIsNetworkPath(absolute_path_to_scraper_directory)) {
    // Network mapped drives are unsupported
    // and can lead to crashes.
    // http://www.maxinmontreal.com/forums/viewtopic.php?f=114&t=17677&p=122925#p122925
    write_log(Preferences()->debug_filesystem_monitor(), "[CFileSystemMonitor] Unsupported network mapped drive\n");
    _scraper_directory_on_a_network_drive = true;
    return;
  }
	int changes_to_monitor = FILE_NOTIFY_CHANGE_FILE_NAME
		| FILE_NOTIFY_CHANGE_SIZE
		| FILE_NOTIFY_CHANGE_LAST_WRITE;
  // Since OpenHoldem 13.0 we support a nested scraper-directory,
  // even with some "official" maps for real-world-casinos.
  const bool watch_subtree = TRUE;
	dwChangeHandle = FindFirstChangeNotification(
		absolute_path_to_scraper_directory,
    watch_subtree,	
		changes_to_monitor);
	if ((dwChangeHandle == INVALID_HANDLE_VALUE) || (dwChangeHandle == NULL)) {
		write_log(Preferences()->debug_filesystem_monitor(), "[CFileSystemMonitor] InitMonitor() failed.\n");
		write_log(Preferences()->debug_filesystem_monitor(), "[CFileSystemMonitor] Going to terminate...\n");
		ExitProcess(GetLastError()); 
	}
}
Esempio n. 3
0
void CSharedMem::RememberTimeOfLastFailedAttemptToConnect() {
	ENT;
	time(&last_failed_attempt_to_connect);
	write_log(Preferences()->debug_autoconnector(), "[CSharedMem] Set last_failed_attempt_to_connect %d\n", last_failed_attempt_to_connect);
	session_ID_of_last_instance_that_failed_to_connect = p_sessioncounter->session_id();
	write_log(Preferences()->debug_autoconnector(), "[CSharedMem] Instance %d failed to connect\n", session_ID_of_last_instance_that_failed_to_connect);
}
double AdjustedBetsize(double amount_to_raise_to) {
	double original_amount_to_raise_to = amount_to_raise_to;
  write_log(Preferences()->debug_betsize_adjustment(),
    "[BetsizeAdjustment] Rounding to beautiful numbers\n");
  // Rounding to beautiful numbers but only if enabled
  amount_to_raise_to = RoundToBeautifulBetsize(amount_to_raise_to);
  double minimum;
  if (p_engine_container->symbol_engine_casino()->ConnectedToDDPoker()) {
    write_log(Preferences()->debug_betsize_adjustment(),
      "[BetsizeAdjustment] Special adjustment for DDPoker needed.\n");
	  minimum = min(MinimumBetsizeDueToPreviousRaise(), MaximumBetsizeDueToMaxOppStack() );
  } else {
	  minimum = MinimumBetsizeDueToPreviousRaise();
  }
	AdaptValueToMinMaxRange(&amount_to_raise_to, minimum, amount_to_raise_to);
	AdaptValueToMinMaxRange(&amount_to_raise_to, amount_to_raise_to, MaximumBetsizeForGameType());
	AdaptValueToMinMaxRange(&amount_to_raise_to, amount_to_raise_to, MaximumPossibleBetsizeBecauseOfBalance());
  // Rounding to beautiful numbers (here full dollars)
  AdaptValueToMinMaxRange(&amount_to_raise_to, amount_to_raise_to, RoundedBetsizeForTournaments(amount_to_raise_to));
  // Special handling for DDPoker
  // http://www.maxinmontreal.com/forums/viewtopic.php?f=120&t=19185&hilit=ddpoker
  if(p_engine_container->symbol_engine_casino()->ConnectedToDDPoker()){
    //!!?? Duplicate to ZeeZooLaas code above?
		AdaptValueToMinMaxRange(&amount_to_raise_to, amount_to_raise_to, MaximumBetsizeDueToMaxOppStack());
	}
  AdaptValueToMinMaxRange(&amount_to_raise_to, 0, SwagAmountAjustedToCasino(amount_to_raise_to));
	return amount_to_raise_to; 
}
Esempio n. 5
0
bool CScraper::ProcessRegion(RMapCI r_iter) {
  write_log(Preferences()->debug_scraper(),
    "[CScraper] ProcessRegion %s (%i, %i, %i, %i)\n",
    r_iter->first, r_iter->second.left, r_iter->second.top,
    r_iter->second.right, r_iter->second.bottom);
  write_log(Preferences()->debug_scraper(),
    "[CScraper] ProcessRegion color %i radius %i transform %s\n",
    r_iter->second.color, r_iter->second.radius, r_iter->second.transform);
	__HDC_HEADER
	// Get "current" bitmap
	old_bitmap = (HBITMAP) SelectObject(hdcCompatible, r_iter->second.cur_bmp);
	BitBlt(hdcCompatible, 0, 0, r_iter->second.right - r_iter->second.left + 1, 
							    r_iter->second.bottom - r_iter->second.top + 1, 
								hdc, r_iter->second.left, r_iter->second.top, SRCCOPY);
	SelectObject(hdcCompatible, old_bitmap);

	// If the bitmaps are different, then continue on
	if (!BitmapsAreEqual(r_iter->second.last_bmp, r_iter->second.cur_bmp)) {
    // Copy into "last" bitmap
		old_bitmap = (HBITMAP) SelectObject(hdcCompatible, r_iter->second.last_bmp);
		BitBlt(hdcCompatible, 0, 0, r_iter->second.right - r_iter->second.left + 1, 
									r_iter->second.bottom - r_iter->second.top + 1, 
									hdc, r_iter->second.left, r_iter->second.top, SRCCOPY);
		SelectObject(hdcCompatible, old_bitmap);  
		__HDC_FOOTER_ATTENTION_HAS_TO_BE_CALLED_ON_EVERY_FUNCTION_EXIT_OTHERWISE_MEMORY_LEAK
		return true;
	}
bool BetSizeIsAllin(double amount_to_raise_to_in_dollars_and_cents) {
	double maximum_betsize = MaximumPossibleBetsizeBecauseOfBalance();
	write_log(Preferences()->debug_betsize_adjustment(), "[BetsizeAdjustment] BetSizeIsAllin() desired betsize: %.2f\n",
		amount_to_raise_to_in_dollars_and_cents);
	write_log(Preferences()->debug_betsize_adjustment(), "[BetsizeAdjustment] BetSizeIsAllin() maximum betsize: %.2f\n",
		maximum_betsize);
	return (amount_to_raise_to_in_dollars_and_cents >= maximum_betsize);
}
BOOL CDlgSAPrefs9::OnInitDialog()
{
  CSAPrefsSubDlg::OnInitDialog();
  m_use_auto_starter.SetCheck(Preferences()->use_auto_starter() ? BST_CHECKED : BST_UNCHECKED);
  m_use_auto_shutdown.SetCheck(Preferences()->use_auto_shutdown() ? BST_CHECKED : BST_UNCHECKED);
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
void CSymbolEngineReplayFrameController::UpdateAfterAutoplayerAction(int autoplayer_action_code) {
  if (Preferences()->replay_record() == kShootReplyFramesOnMyTurn) {
    // Replay-frame already in scraper memory, it only needs to be stored.
    // Therefore it does not matter if we shoot "after" action.
    write_log(Preferences()->debug_replayframes(), "[CSymbolEngineReplayFrameController] Replay required (on my turn and time to act)\n");
    ShootReplayFrameIfNotYetDone();
  }
}
CFileSystemMonitor::CFileSystemMonitor() {
	write_log(Preferences()->debug_filesystem_monitor(), "[CFileSystemMonitor] executing constructor.)\n");
	absolute_path_to_scraper_directory = ScraperDirectory();
	write_log(Preferences()->debug_filesystem_monitor(), "[CFileSystemMonitor] Scraper folder: %s\n", 
		absolute_path_to_scraper_directory);
	// Create directory in case it does not exist (mainly debug sessions).
	CreateDirectory(absolute_path_to_scraper_directory, NULL);
	InitMonitor();
}
bool CRebuyManagement::OcclusionCheck() {
	if (!Preferences()->rebuy_condition_heuristic_check_for_occlusion()) {
		return true;
	}	else if (p_occlusioncheck->UserBalanceOccluded()) {
		write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] OcclusionCheck: false (occluded)\n");
		return false;
	}
  write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] OcclusionCheck: true (not occluded)\n");
	return true;
}
Esempio n. 11
0
bool CAllinSlider::SlideAllin() {
  if (!SlideAllinPossible()) {
   write_log(Preferences()->debug_autoplayer(), "[AllinSlider] ...ending DoSlider early (i3handle or i3slider are not defined in the tablemap)\n");
    return false;
  }
 write_log(Preferences()->debug_autoplayer(), "[AllinSlider] Starting DoSlider...\n");
  if ((_position.x == kUndefined) || (_position.y == kUndefined)) {
   write_log(Preferences()->debug_autoplayer(), "[AllinSlider] ...ending DoSlider early (handle not found - i3handle must use a transform that resolves to either 'handle' or 'true')\n");
    return false;
  }
  // Click and drag handle
  RECT drag_region;
  GetSliderRegions();
  drag_region.left = _position.x + ((_i3_handle.right - _i3_handle.left) / 2);
  drag_region.top = _position.y + ((_i3_handle.bottom - _i3_handle.top) / 2);
  drag_region.right = _position.x + (_i3_slider.right - _i3_slider.left);
  drag_region.bottom = drag_region.top;

  write_log(Preferences()->debug_autoplayer(), "[AllinSlider] Slider : Calling mouse.dll to jam from %d,%d to %d,%d\n", drag_region.left, drag_region.top, drag_region.right, drag_region.bottom);
  // Not really (0, 0), but (-1, -1), out of the screen
  POINT	point_null = { kUndefined, kUndefined };
  (theApp._dll_mouse_click_drag) (p_autoconnector->attached_hwnd(), drag_region);

  write_log(Preferences()->debug_autoplayer(), "[AllinSlider] Sleeping %d ms\n.", Preferences()->swag_delay_3());
  Sleep(Preferences()->swag_delay_3());

  // Click confirmation button 
  p_casino_interface->_betsize_input_box.Confirm();
  write_log(Preferences()->debug_autoplayer(), "[AllinSlider] Jam complete: %d,%d,%d,%d\n", drag_region.left, drag_region.top, drag_region.right, drag_region.bottom);
  write_log(Preferences()->debug_autoplayer(), "[AllinSlider] ...ending DoSlider.\n");
  return true;
}
bool CRebuyManagement::RebuyPossible() {
	if (MinimumDelayElapsed()
      && ChangeInHandNumber()
		  && NoCards()
		  && OcclusionCheck()) {
		write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] RebuyPossible: true\n");
		return true;
	}	else {
		write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] RebuyPossible: false\n");
		return false;
	}
}
bool CRebuyManagement::MinimumDelayElapsed() {
	unsigned int MinimumTimeDifference = Preferences()->rebuy_minimum_time_to_next_try();
	// Make sure, we don't try to rebuy too often in a short time
	time(&CurrentTime);
	double RebuyTimeDifference = difftime(CurrentTime, RebuyLastTime);
  write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] Time since last rebuy %.2f\n", RebuyTimeDifference);
	if (RebuyTimeDifference < MinimumTimeDifference) {
		write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] MinimumDelayElapsed(): false\n");
		return false;
	}
	return true;
}
Esempio n. 14
0
void CIteratorThread::RestartPrWinComputations() {
  if (p_engine_container->symbol_engine_isomaha()->isomaha()) {
    write_log(Preferences()->debug_prwin(), "[PrWinThread] Not restarting prwin computations, PrWin is Hold'em only\n");
    return;
  }
	write_log(Preferences()->debug_prwin(), "[PrWinThread] Restarting prwin computations.\n");
  assert(p_iterator_thread != NULL);
  assert(IteratorThreadWorking() == false);
  InitIteratorLoop();
  ResetIteratorVars();
	ResetGlobalVariables();
}
Esempio n. 15
0
void CIteratorThread::StandardDealingAlgorithmForUpTo13Opponents(int nopponents)
{
	unsigned int	card = 0;

	write_log(Preferences()->debug_prwin(), "[PrWinThread] Using random algorithm, as f$prwin_number_of_opponents <= 13\n");
	// random replacement algorithm
	// opponent cards
	if (nopponents < 1) {
		write_log(Preferences()->debug_prwin(), "[PrWinThread] No opponents. Auto-adapting to 1.\n");
    nopponents = 1;
	}
	for (int i=0; 
		i<nopponents*NumberOfCardsPerPlayer(); 
		i+=NumberOfCardsPerPlayer())
	{
		temp_usedCards=usedCards;
		do
		{
			usedCards = temp_usedCards; //reset the card mask to clear settings from failed card assignments

			for (int j=0; j<NumberOfCardsPerPlayer(); j++)
			{
				card = GetRandomCard();
				CardMask_SET(usedCards, card);
				ocard[i+j] = card;
			}

			if (!_willplay)
			{
				write_log(Preferences()->debug_prwin(), "[PrWinThread] Weighting disabled. Willplay is 0.\n");
				break; //0 disables weighting
			}

			//put break for i=0 and opponent unraised BB case (cannot assume anything about his cards)
			//In round 1 we should really do an analysis of chairs to find out how many have still to
			//place a bet. Not implemented since accuracy of prwin pre-flop is less critical.
			//
      // bblimp and special handling for checking players removed in OH 9.2.8
      // as it was broken and we consider it useless / even harmful.
      // http://www.maxinmontreal.com/forums/viewtopic.php?f=156&t=19064
		} while (!IsHandInWeightedRange(ocard[i], ocard[i+1],
			_willplay, _wontplay, 
			_topclip, _mustplay));
	}
	// additional common cards
	CardMask_RESET(addlcomCards);
	for (int i=0; i<(kNumberOfCommunityCards - _ncomCards); i++)
	{
		card = GetRandomCard();
		CardMask_SET(usedCards, card);
		CardMask_SET(addlcomCards, card);
	}
}
void CHeartbeatThread::AutoConnect() {
  write_log(Preferences()->debug_alltherest(), "[CHeartbeatThread] location Johnny_D\n");
	assert(!p_autoconnector->IsConnectedToAnything());
	if (Preferences()->autoconnector_when_to_connect() == k_AutoConnector_Connect_Permanent) {
		if (p_autoconnector->SecondsSinceLastFailedAttemptToConnect() > 1 /* seconds */) {
			write_log(Preferences()->debug_autoconnector(), "[CHeartbeatThread] going to call Connect()\n");
			p_autoconnector->Connect(NULL);
		}	else {
			write_log(Preferences()->debug_autoconnector(), "[CHeartbeatThread] Reconnection blocked. Other instance failed previously.\n");
		}
	}
}
void CSymbolEngineReplayFrameController::ShootReplayFrameIfNotYetDone() {
  int heartbeat_counter = p_heartbeat_thread->heartbeat_counter();
  // Don't shoot replay-frames twice per heartbeat
  if (_heartbeat_of_last_replay_frame == heartbeat_counter) {
    write_log(Preferences()->debug_replayframes(), "[CSymbolEngineReplayFrameController] Not shooting a replay-frame, because we already shot one this heartbeat\n");
    return;
  }
  write_log(Preferences()->debug_replayframes(), "[CSymbolEngineReplayFrameController] Going to shooting a replay-frame\n");
  CReplayFrame crf;
  crf.CreateReplayFrame();
  _heartbeat_of_last_replay_frame = heartbeat_counter;
}
Esempio n. 18
0
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) {
	if ( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;

	int			max_x = 0, max_y = 0;

	WNDCLASS wnd;
	HINSTANCE hInst = AfxGetInstanceHandle();

	// Set class name
	if (!(::GetClassInfo(hInst, Preferences()->window_class_name(), &wnd))) {
		wnd.style			    = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
		wnd.lpfnWndProc		= ::DefWindowProc;
		wnd.cbClsExtra		= wnd.cbWndExtra = 0;
		wnd.hInstance		  = hInst;
		wnd.hIcon			    = AfxGetApp()->LoadIcon(IDI_ICON1);
		wnd.hCursor			  = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
		wnd.hbrBackground	= (HBRUSH) (COLOR_3DFACE + 1);
		wnd.lpszMenuName	= NULL;
		wnd.lpszClassName	= Preferences()->window_class_name();
    // Fixed size window, not resizable 
    // Because bad-sized windows are annoying
    // and because of potential support for a 4th user-card ;-)
    // http://arstechnica.com/civis/viewtopic.php?f=20&t=848676
    // http://msdn.microsoft.com/en-us/library/aa925944.aspx
    cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
	  cs.style &= (0xFFFFFFFF ^ WS_SIZEBOX);
	  cs.style |= WS_BORDER;
	  cs.style &= (0xFFFFFFFF ^ WS_MAXIMIZEBOX);

		AfxRegisterClass( &wnd );
	}
	cs.lpszClass = Preferences()->window_class_name();

	// Restore window location and size
  // -32 to avoid placement directly under the taskbar,
  // so that at least a little bit is visible
  // if the values in the ini-file are out of range.
	max_x = GetSystemMetrics(SM_CXSCREEN) - GetSystemMetrics(SM_CXICON - 32);
	max_y = GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYICON - 32);
  // Make sure that our coordinates are not out of screen
  // (too large or even negative)
	cs.x = min(Preferences()->main_x(), max_x);
	cs.y = min(Preferences()->main_y(), max_y);
  cs.x = max(cs.x, 0);
  cs.y = max(cs.y, 0);
  // GUI size
	cs.cx = kMainSizeX;
	cs.cy = kMainSizeY;

	return true;
}
Esempio n. 19
0
CIteratorThread::CIteratorThread() {
	write_log(Preferences()->debug_prwin(), "[PrWinThread] Iterator Thread starting.\n");

	// Create events
	_m_stop_thread = CreateEvent(0, TRUE, FALSE, 0);
	_m_wait_thread = CreateEvent(0, TRUE, FALSE, 0);

	// Initialize variables
	InitHandranktTableForPrwin();
	AfxBeginThread(IteratorThreadFunction, this);

	write_log(Preferences()->debug_prwin(), "[PrWinThread] Iterator Thread started.\n");
}
bool CRebuyManagement::ChangeInHandNumber() {
  if (!Preferences()->rebuy_condition_change_in_handnumber()) {
    return true;
  }
  write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] handnumber %s\n", PreviousRebuyHandNumber);
  write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] handnumber %s\n", p_handreset_detector->GetHandNumber());
  if (p_handreset_detector->GetHandNumber() > PreviousRebuyHandNumber) {
    write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] ChangeInHandNumber(): true\n");
		return true;
	}
	write_log(Preferences()->debug_rebuy(), "[CRebuyManagement] ChangeInHandNumber(): false\n");
	return false;
}
Esempio n. 21
0
int CSharedMem::NBotsPresent() {
  Dump();
  write_log(Preferences()->debug_sharedmem(), "[CSharedMem] NBotsPresent()\n");
  int result = 0;
  for (int i = 0; i < MAX_SESSION_IDS; ++i) {
    if (openholdem_PIDs[i] != 0) {
      write_log(Preferences()->debug_sharedmem(), "[CSharedMem] ID %i running\n", i);
      ++result;
    }
  }
  write_log(Preferences()->debug_sharedmem(), "[CSharedMem] NBotsPresent: %i\n", result);
  return result;
}
void CSymbolEngineReplayFrameController::UpdateOnHeartbeat() {
	if(p_engine_container->symbol_engine_casino()->ConnectedToOHReplay()){
    // No point in shooting frames when connected to OHReplay
    write_log(Preferences()->debug_replayframes(), "[CSymbolEngineReplayFrameController] No replay required, as connected to OHReplay\n");
		return;	
	}
	if (p_lazyscraper->IsIdenticalScrape()) {
	  // There is no benefit in duplicate frames, so we abort
	  write_log(Preferences()->debug_replayframes(), "[CSymbolEngineReplayFrameController] No replay required, as identical scrape\n");
	  return;
	}  
	if ((Preferences()->replay_record() == kShootReplyFramesOnEveryChangeWhilePlaying)	
		  && p_table_state->User()->HasKnownCards()) {
		write_log(Preferences()->debug_replayframes(), "[CSymbolEngineReplayFrameController] Replay required (on change while in hand)\n");
	  ShootReplayFrameIfNotYetDone();
	  return;
	}
	if (Preferences()->replay_record() == kShootReplyFramesOnEveryChange) {
	  write_log(Preferences()->debug_replayframes(), "[CSymbolEngineReplayFrameController] Replay required (on every change in table-state)\n");
	  ShootReplayFrameIfNotYetDone();
	  return;
	}
  bool shoot_replay_frame_by_formula = p_function_collection->Evaluate(
    k_standard_function_names[k_standard_function_shoot_replay_frame], 
    Preferences()->log_hopper_functions());
  if (shoot_replay_frame_by_formula) {
    write_log(Preferences()->debug_replayframes(), "[CSymbolEngineReplayFrameController] Replay required by f$shoot_replay_frame\n");
    ShootReplayFrameIfNotYetDone();
    return;
  }
}
double CParseTreeTerminalNodeNumber::Evaluate(bool log /* = false */){
 write_log(Preferences()->debug_formula(), 
    "[CParseTreeTerminalNode] Evaluating node type %i %s\n", 
		_node_type, TokenString(_node_type));
  p_autoplayer_trace->SetLastEvaluatedRelativeLineNumber(_relative_line_number);
	if (_node_type == kTokenNumber)	{
		write_log(Preferences()->debug_formula(), 
      "[CParseTreeTerminalNode] Number evaluates to %6.3f\n",
			_constant_value);
		return _constant_value;
	}
	// This must not happen for a terminal node
	assert(false);
	return kUndefined;
}
Esempio n. 24
0
void COpenHoldemView::OnTimer(UINT_PTR nIDEvent) {
  write_log(Preferences()->debug_timers(), "[GUI] COpenHoldemView::OnTimer()\n");
	if (nIDEvent == DISPLAY_UPDATE_TIMER) 
	{
		// Only do this if we are not in the middle of a scraper/symbol update
		if (TryEnterCriticalSection(&p_heartbeat_thread->cs_update_in_progress))
		{
			UpdateDisplay(false);
      write_log(Preferences()->debug_alltherest(), "[GUI] location Johnny_2\n");
			LeaveCriticalSection(&p_heartbeat_thread->cs_update_in_progress);
		}
	}
	// Otherwise: continue with parent class
	CView::OnTimer(nIDEvent);
}
double BetPotFactor(int betpot_action_code) {
  assert(betpot_action_code >= k_autoplayer_function_betpot_2_1);
  assert(betpot_action_code <= k_autoplayer_function_betpot_1_4);
  double betpot_factor = 1.0;
  switch (betpot_action_code) {
    case k_autoplayer_function_betpot_2_1:
      betpot_factor = 2.0;
      break;
    case k_autoplayer_function_betpot_1_1:
      betpot_factor = 1.0;
      break;
    case k_autoplayer_function_betpot_3_4:
      betpot_factor = 0.75;
      break;
    case k_autoplayer_function_betpot_2_3:
      betpot_factor = 0.667;
      break;
    case k_autoplayer_function_betpot_1_2:
      betpot_factor = 0.5;
      break;
    case k_autoplayer_function_betpot_1_3:
      betpot_factor = 0.333;
      break;
    case k_autoplayer_function_betpot_1_4:
      betpot_factor = 0.25;
      break;
    default:
      betpot_factor = 1.0;
  }
  write_log(Preferences()->debug_autoplayer(), "[AutoPlayer] betpot-factor: %.3f\n",
    betpot_factor);
  return betpot_factor;
}
Esempio n. 26
0
double SwagAmountAjustedToCasino(double amount_to_raise_to) {
	int userchair = p_engine_container->symbol_engine_userchair()->userchair();
	assert(amount_to_raise_to >= 0);
	double swag_amount_ajusted_to_casino = amount_to_raise_to;
	// WinHoldems f$srai should return, what we want to add to (call + currentbet)
	// so we have to calculate our adjustment the other way.
	// http://www.winholdem.net/help/help-formula.html
	// http://forum.winholdem.net/wbb/viewtopic.php?t=1849
	if (p_tablemap->swagtextmethod() == 2) {
		// Old adjustment: call, so currentbet is too much
		swag_amount_ajusted_to_casino = amount_to_raise_to - p_table_state->User()->_bet.GetValue();
	}	else if (p_tablemap->swagtextmethod() == 3)	{
		// Old adjustment: call + currentbet.
		// Everything fine, nothing to do.
	}	else {
		// Default: swagtextmethod == 1
		// Old adjustment: 0, currentbet and call are too much.
		swag_amount_ajusted_to_casino = amount_to_raise_to 
			- p_table_state->User()->_bet.GetValue()
			- p_engine_container->symbol_engine_chip_amounts()->call();
	}
	write_log(Preferences()->debug_betsize_adjustment(), "[BetsizeAdjustment] SwagAmountAjustedToCasino %.2f\n",
		swag_amount_ajusted_to_casino);
	return swag_amount_ajusted_to_casino;
}
Esempio n. 27
0
incidentWorkbench::incidentWorkbench(QWidget* parent, const char* name, Qt::WFlags fl)
    : QMainWindow(parent, name, fl)
{
  setupUi(this);

  connect(_autoUpdate,	SIGNAL(toggled(bool)),	this,	SLOT(sHandleAutoUpdate(bool)));
  connect(_edit,	SIGNAL(clicked()),	this,	SLOT(sEdit()));
  connect(_new,		SIGNAL(clicked()),	this,	SLOT(sNew()));
  connect(_print,	SIGNAL(clicked()),	this,	SLOT(sPrint()));
  connect(_query,	SIGNAL(clicked()),	this,	SLOT(sFillList()));
  connect(_reset,	SIGNAL(clicked()),	this,	SLOT(sReset()));
  connect(_view,	SIGNAL(clicked()),	this,	SLOT(sView()));

  _incdt->addColumn(tr("Number"),      _itemColumn, Qt::AlignLeft );
  _incdt->addColumn(tr("Account"),     _itemColumn, Qt::AlignLeft );
  _incdt->addColumn(tr("Status"),      _itemColumn, Qt::AlignLeft );
  _incdt->addColumn(tr("Assigned To"), _userColumn, Qt::AlignLeft ); 
  _incdt->addColumn(tr("Summary"),     -1,          Qt::AlignLeft );

  _createdDates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
  _createdDates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE);
  _createdDates->setStartCaption(tr("First Creation Date:"));
  _createdDates->setEndCaption(tr("Last Creation Date:"));

  Preferences _pref = Preferences(omfgThis->username());
  if (_pref.boolean("XCheckBox/forgetful"))
  {
    _statusFeedback->setChecked(true);
    _statusConfirmed->setChecked(true);
    _statusNew->setChecked(true);
    _statusAssigned->setChecked(true);
  }

  _assignedTo->setType(User);
}
Esempio n. 28
0
printShippingForms::printShippingForms(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_shipformNumOfCopies, SIGNAL(valueChanged(int)), this, SLOT(sHandleShippingFormCopies(int)));
  connect(_shipformWatermarks, SIGNAL(itemSelected(int)), this, SLOT(sEditShippingFormWatermark()));

  _captive = FALSE;

  _shipformWatermarks->addColumn( tr("Copy #"),      _dateColumn, Qt::AlignCenter );
  _shipformWatermarks->addColumn( tr("Watermark"),   -1,          Qt::AlignLeft   );
  _shipformWatermarks->addColumn( tr("Show Prices"), _dateColumn, Qt::AlignCenter );

  _shipformNumOfCopies->setValue(_metrics->value("ShippingFormCopies").toInt());
  if (_shipformNumOfCopies->value())
  {
    for (int i = 0; i < _shipformWatermarks->topLevelItemCount(); i++)
    {
      _shipformWatermarks->topLevelItem(i)->setText(1, _metrics->value(QString("ShippingFormWatermark%1").arg(i)));
      _shipformWatermarks->topLevelItem(i)->setText(2, ((_metrics->boolean(QString("ShippingFormShowPrices%1").arg(i))) ? tr("Yes") : tr("No")));
    }
  }

  Preferences _pref = Preferences(omfgThis->username());
  if (_pref.boolean("XCheckBox/forgetful"))
  {
    _printNew->setChecked(true);
    _printDirty->setChecked(true);
  }
}
Esempio n. 29
0
TInt CSTTorrentManager::OpenTorrent2L(CSTTorrent* aTorrent, TBool aStart)
{
	TInt loadResult = KErrNone;

	// checks if the torrent is already opened
	for (TInt i=0; i<iTorrents.Count(); i++)
	{			
		if (iTorrents[i]->InfoHash() == aTorrent->InfoHash())				
		{
			loadResult = KErrAlreadyOpened;
			break;
		}
	}

	if (loadResult == KErrNone)
	{
		User::LeaveIfError(iTorrents.Append(aTorrent));
		CleanupStack::Pop(); // torrent

	//	NotifyObserverInsertL(aTorrent);
		
		NotifyTorrentObserverL(aTorrent, ESTEventTorrentOpened);

		if (aStart)
			aTorrent->StartL();
		
		Preferences()->SaveSettingsL(); // New torrent added -> save to the settings file
	}

	return loadResult;
}
Esempio n. 30
0
dspCountTagsByWarehouse::dspCountTagsByWarehouse(QWidget* parent, const char* name, Qt::WFlags fl)
    : QMainWindow(parent, name, fl)
{
  setupUi(this);

  (void)statusBar();

  connect(_cnttag, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));

  _dates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
  _dates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE);

  _cnttag->addColumn(tr("Tag #"),        -1,           Qt::AlignLeft   );
  _cnttag->addColumn(tr("Whs."),         _whsColumn,   Qt::AlignCenter );
  _cnttag->addColumn(tr("Item"),         _itemColumn,  Qt::AlignLeft   );
  _cnttag->addColumn(tr("Created (By)"), _dateColumn,  Qt::AlignCenter );
  _cnttag->addColumn(tr("Entered (By)"), _dateColumn,  Qt::AlignCenter );
  _cnttag->addColumn(tr("Posted (By)"),  _dateColumn,  Qt::AlignCenter );
  _cnttag->addColumn(tr("QOH Before"),   _qtyColumn,   Qt::AlignRight  );
  _cnttag->addColumn(tr("Qty. Counted"), _qtyColumn,   Qt::AlignRight  );
  _cnttag->addColumn(tr("Variance"),     _qtyColumn,   Qt::AlignRight  );
  _cnttag->addColumn(tr("%"),            _prcntColumn, Qt::AlignRight  );

  Preferences _pref = Preferences(omfgThis->username());
  if (_pref.boolean("XCheckBox/forgetful"))
    _showUnposted->setChecked(true);
  
  sFillList();
}