void audio_hall::check_have_room(uint room_id) { auto it1=rooms_.find(room_id); if(it1 == rooms_.end()) { MY_THROW(NO_ROOM); } }
void audio_hall::check_not_have_room(uint room_id) { auto it1=rooms_.find(room_id); if(it1 != rooms_.end()) { MY_THROW(ROOM_HAVE_EXIST); } }
void audio_hall::check_not_login_in(uint client_id) { auto it =players_.find(client_id); if(it != players_.end()) { MY_THROW(HAVE_LOGIN); } }
void audio_hall::check_room_have_player(uint room_id) { auto it1 = rooms_.find(room_id); uint size = it1->second->get_player_count(); if(size >0) { // MY_THROW(ROOM_HAVE_PLAYER); // } }
void CDictionary::readFile(crstring fname) { CHECK_TIME("Reading dictionary file"); int totalReadCount = 0; ifstream file(fname); if(!file) MY_THROW("Critical error: Cannot open file with dictionary: " + fname); while(file) { //pierwszego bajtu nie ruszamy, chcemy miec wiodacy NULL (zeby pierwsze slowo tez z obu stron bylo otoczone NULL-ami) char * const whereToPutFile = &memory[totalReadCount] + 1; const int MAX_BYTES_TO_READ = memory.size() - 2; //wlasciwe czytanie file.read(whereToPutFile, MAX_BYTES_TO_READ); totalReadCount += (int)file.gcount(); } memory.resize(totalReadCount + 2); //pozbywamy sie zbednej przestrzeni z konca }