int Log_Imp::run() { int i_count=0; LogThreadCache *cache=NULL; while(m_bStop==false) { i_count=0; for(int i =0;i<LOG_MAXCACHE;i++) { cache=(LogThreadCache *)getCacheObj(i); if(cache==NULL) continue; if(cache->getSize()<=0) continue; i_count++; cache->lock(); if(BIT_ENABLED(m_outFlag,LOGOUT_SCREEN)) cout<<cache->basePtr()<<endl; if(BIT_ENABLED(m_outFlag,LOGOUT_FILE)) m_logFile.log(cache->basePtr(),cache->getSize()); cache->reset(); cache->unlock(); } if(i_count <10) Pubc::uSleep(10); if(i_count == 0) Pubc::uSleep(100); } return 0; }
void player_obj::on_remove_buff(buff_obj *bo) { if (BIT_ENABLED(bo->bits_, buff_obj::BF_BIT_SHOW_TO_SELF)) { out_stream os(client::send_buf, client::send_buf_len); os << bo->id_; this->send_request(NTF_CHAR_DEL_BUFF, &os); } char_obj::on_remove_buff(bo); }
void player_obj::on_modify_buff(buff_obj *bo) { if (BIT_ENABLED(bo->bits_, buff_obj::BF_BIT_SHOW_TO_SELF)) { out_stream os(client::send_buf, client::send_buf_len); os << bo->id_ << bo->left_time_ << bo->left_value_; this->send_request(NTF_CHAR_ADD_BUFF, &os); } char_obj::on_modify_buff(bo); }
void buff_module::do_remove_buff_by_bits(char_obj *co, const int bits) { int size = co->buff_obj_list_.size(); for (int i = 0; i < size; ++i) { buff_obj *bo = co->buff_obj_list_.pop_front(); if (BIT_ENABLED(bo->bits_, bits)) { co->on_remove_buff(bo); co->buff_effect_cnt_[bo->effect_] -= 1; bo->remove(); } else co->buff_obj_list_.push_back(bo); } }
void buff_module::on_char_dead(char_obj *co) { if (co->buff_obj_list_.empty()) return ; int size = co->buff_obj_list_.size(); for (int i = 0; i < size; ++i) { buff_obj *bo = co->buff_obj_list_.pop_front(); if (BIT_ENABLED(bo->bits_, buff_obj::BF_BIT_DEAD_CLR)) { co->on_remove_buff(bo); co->buff_effect_cnt_[bo->effect_] -= 1; bo->remove(); } else co->buff_obj_list_.push_back(bo); } }
void buff_module::on_char_logout(player_obj *player) { if (player->buff_obj_list_.empty()) return ; int size = player->buff_obj_list_.size(); for (int i = 0; i < size; ++i) { buff_obj *bo = player->buff_obj_list_.pop_front(); if (BIT_ENABLED(bo->bits_, buff_obj::BF_BIT_OFFLINE_CLR)) { player->buff_effect_cnt_[bo->effect_] -= 1; bo->release(); } else player->buff_obj_list_.push_back(bo); } // save db player->db_save_buff(); }
int vlayer_map::draw(const int ) { // clean static WINDOW *win = panel_window(this->panel_); for(int i = 1; i <= this->ncols_; ++i) { for(int j = 1; j <= this->nlines_; ++j) { const int color = this->to_get_view_color(i, j, NULL); wattron(win, COLOR_PAIR(color)); mvwprintw(win, j, i, " "); wattroff(win, COLOR_PAIR(color)); } } // other int su_vx = 0; int su_vy = 0; player *leader = director::instance()->leader(); std::map<int, scene_unit_obj* >::iterator itor = leader->scene_unit_map_.begin(); for (; itor != leader->scene_unit_map_.end(); ++itor) { scene_unit_obj *su = itor->second; this->to_fetch_su_vpos(su, su_vx, su_vy); if (su->id_ == leader->id_) continue; int color = this->to_get_view_color(su_vx, su_vy, su); if (BIT_ENABLED(su->status_, OBJ_DEAD)) color = COLOR_PLY_DEAD; wattron(win, COLOR_PAIR(color)); mvwprintw(win, su_vy, su_vx, "%s", su->name()); wattroff(win, COLOR_PAIR(color)); } // leader wattron(win, COLOR_PAIR(COLOR_PLY_CM)); mvwprintw(win, this->leader_vy(), this->leader_vx(), "%s", leader->name()); this->do_draw_leader_dir(); wattroff(win, COLOR_PAIR(COLOR_PLY_CM)); // skill draw this->do_draw_skill(); return 0; }
void char_obj::on_remove_buff(buff_obj *bo) { if (BIT_ENABLED(bo->bits_, buff_obj::BF_BIT_SHOW_TO_OTHER)) this->broadcast_del_buff(bo); }
//------------------------------------------------------------------ void bian_shen_buff::remove() { if (BIT_ENABLED(this->bits_, buff_obj::BF_BIT_ACTIVED)) this->do_update_attr(false); super::remove(); }