Skip to content

Commit

Permalink
T: OH:
Browse files Browse the repository at this point in the history
CMyMutex:
timeout is now 5s instead of 4s. Added comments.

CPokerTrackerThread:
- Fix to prevent an error making it sleeps 2weeks instead of 10s (fix the consequence not the cause: clock() inconsistency ?)
- Small tweak and more verbose name for minimum name length to skip lev distance check when we've found exactly one name in the DB. (10 chars instead of 14)

PokerChat:
Added messages 20,21,(22 test): \o/ , /o\ , &é#"@
  • Loading branch information
fqfq committed Apr 29, 2015
1 parent e8cd134 commit 2ff40fd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion OpenHoldem/CMyMutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
#include "CPreferences.h"

CMyMutex::CMyMutex() : _mutex(false, preferences.mutex_name()) {
if (_mutex.Lock(4000)) {
// We want a long timeout to let OHs instances act in FIFO order.
// But we can't wait forever because events can happen. Popups, table timeout...
if (_mutex.Lock(5000)) {
_locked = TRUE;
} else {
_locked = FALSE;
Expand Down
4 changes: 2 additions & 2 deletions OpenHoldem/CPokerTrackerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ bool CPokerTrackerThread::QueryName(const char * query_name, const char * scrape
{
char *found_name = PQgetvalue(res, 0, 0);
lev_dist = myLD.LD(scraped_name, found_name);
if ( strlen(found_name) >= 14
if ( strlen(found_name) >= k_min_name_length_to_skip_lev_dist
|| lev_dist <= (int)strlen(found_name) * Levenshtein_distance_matching_factor )
{
strncpy_s(best_name, k_max_length_of_playername, found_name, _TRUNCATE);
Expand Down Expand Up @@ -775,7 +775,7 @@ UINT CPokerTrackerThread::PokertrackerThreadFunction(LPVOID pParam)
iterEnd = clock();
iterDurationMS = (int) ((double)(iterEnd - iterStart));
write_log(preferences.debug_pokertracker(), "[PokerTracker] PTthread iteration [%d] had ended, duration time in ms: [%d]\n", ++iteration, iterDurationMS);
if (iterDurationMS <= 10000)
if ( (iterDurationMS <= 10000) && (iterDurationMS > 0) )
{
write_log(preferences.debug_pokertracker(), "[PokerTracker] sleeping [%d] ms because iteration was too quick.\n", 10000 - iterDurationMS);
if (LightSleep(10000 - iterDurationMS, pParent))
Expand Down
1 change: 1 addition & 0 deletions OpenHoldem/CPokerTrackerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

const int k_advanced_stat_update_every = 5;
const int k_min_hands_for_slower_updates = 1000;
const int k_min_name_length_to_skip_lev_dist = 10;

struct SPlayerData
{
Expand Down
6 changes: 5 additions & 1 deletion OpenHoldem/PokerChat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ char _message_table[][max_length_of_simple_messages] =
"hello\0",
"bye\0",
":)\0",
":(\0"
":(\0",
"\\o/\0",
"/o\\\0",
"&é#\"@\0",

};


Expand Down
9 changes: 6 additions & 3 deletions OpenHoldem/PokerChat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ enum
simple_chat_hi,
simple_chat_hello,
simple_chat_bye,
simple_chat_happy, // Message: ":)"
simple_chat_sad, // Message: ":("
last_chat_message = simple_chat_sad
simple_chat_happy, // Message: ":)" 18
simple_chat_sad, // Message: ":(" 19
simple_chat_win, // Message: "\o/" 20
simple_chat_lose, // Message: "/o\" 21
simple_chat_test, // Message: "&é#"@" 22
last_chat_message = simple_chat_test
};


Expand Down

0 comments on commit 2ff40fd

Please sign in to comment.