本文整理汇总了C++中ShowStatus函数的典型用法代码示例。如果您正苦于以下问题:C++ ShowStatus函数的具体用法?C++ ShowStatus怎么用?C++ ShowStatus使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ShowStatus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: chrif_recvmap
// receive maps from some other map-server (relayed via char-server)
int chrif_recvmap(int fd) {
int i, j;
uint32 ip = ntohl(RFIFOL(fd,4));
uint16 port = ntohs(RFIFOW(fd,8));
for(i = 10, j = 0; i < RFIFOW(fd,2); i += 4, j++) {
map_setipport(RFIFOW(fd,i), ip, port);
}
if (battle_config.etc_log)
ShowStatus("Received maps from %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j);
other_mapserver_count++;
return 0;
}
示例2: logchrif_parse_upd_global_accreg
/**
* We receive account_reg2 from a char-server, and we send them to other char-servers.
* @param fd: fd to parse from (char-serv)
* @param id: id of char-serv
* @param ip: char-serv ip (used for info)
* @return 0 not enough info transmitted, 1 success
*/
int logchrif_parse_upd_global_accreg(int fd, int id, char* ip){
if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) )
return 0;
else{
struct mmo_account acc;
AccountDB* accounts = login_get_accounts_db();
uint32 account_id = RFIFOL(fd,4);
if( !accounts->load_num(accounts, &acc, account_id) )
ShowStatus("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n", ch_server[id].name, account_id, ip);
else
mmo_save_global_accreg(accounts,fd,account_id,RFIFOL(fd, 8));
RFIFOSKIP(fd,RFIFOW(fd,2));
}
return 1;
}
示例3: login_lan_config_read
/**
* Reading Lan Support configuration.
* @param lancfgName: Name of the lan configuration (could be fullpath)
* @return 0:success, 1:failure (file not found|readable)
*/
int login_lan_config_read(const char *lancfgName) {
FILE *fp;
int line_num = 0, s_subnet=ARRAYLENGTH(subnet);
char line[1024], w1[64], w2[64], w3[64], w4[64];
if((fp = fopen(lancfgName, "r")) == NULL) {
ShowWarning("LAN Support configuration file is not found: %s\n", lancfgName);
return 1;
}
while(fgets(line, sizeof(line), fp))
{
line_num++;
if ((line[0] == '/' && line[1] == '/') || line[0] == '\n' || line[1] == '\n')
continue;
if(sscanf(line,"%63[^:]: %63[^:]:%63[^:]:%63[^\r\n]", w1, w2, w3, w4) != 4)
{
ShowWarning("Error syntax of configuration file %s in line %d.\n", lancfgName, line_num);
continue;
}
if( strcmpi(w1, "subnet") == 0 ){
if(subnet_count>=s_subnet) { //We skip instead of break in case we want to add other conf in that file.
ShowError("%s: Too many subnets defined, skipping line %d...\n", lancfgName, line_num);
continue;
}
subnet[subnet_count].mask = str2ip(w2);
subnet[subnet_count].char_ip = str2ip(w3);
subnet[subnet_count].map_ip = str2ip(w4);
if( (subnet[subnet_count].char_ip & subnet[subnet_count].mask) != (subnet[subnet_count].map_ip & subnet[subnet_count].mask) )
{
ShowError("%s: Configuration Error: The char server (%s) and map server (%s) belong to different subnetworks!\n", lancfgName, w3, w4);
continue;
}
subnet_count++;
}
}
if( subnet_count > 1 ) /* only useful if there is more than 1 available */
ShowStatus("Read information about %d subnetworks.\n", subnet_count);
fclose(fp);
return 0;
}
示例4: guild_read_castledb
static int guild_read_castledb(void)
{
FILE *fp;
char line[1024];
int j,ln=0;
char *str[32],*p;
struct guild_castle *gc;
sprintf(line, "%s/castle_db.txt", db_path);
if( (fp=fopen(line,"r"))==NULL){
ShowError("can't read %s\n", line);
return -1;
}
while(fgets(line, sizeof(line), fp))
{
if(line[0]=='/' && line[1]=='/')
continue;
memset(str,0,sizeof(str));
for(j=0,p=line;j<6 && p;j++){
str[j]=p;
p=strchr(p,',');
if(p) *p++=0;
}
if (j < 4) //Insufficient data for castle. [Skotlex]
{
ShowError("castle_db.txt: invalid line '%s'\n", line);
continue;
}
gc=(struct guild_castle *)aCalloc(1,sizeof(struct guild_castle));
gc->castle_id=atoi(str[0]);
gc->mapindex = mapindex_name2id(str[1]);
safestrncpy(gc->castle_name,str[2],NAME_LENGTH);
safestrncpy(gc->castle_event,str[3],NAME_LENGTH);
idb_put(castle_db,gc->castle_id,gc);
//intif_guild_castle_info(gc->castle_id);
ln++;
}
fclose(fp);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",ln,"castle_db.txt");
return 0;
}
示例5: do_init
int do_init(int argc, char **argv)
{
ShowMessage("===============================================================================\n");
ShowStatus("Starting tests.\n");
TEST("CONFIG_TRUE and CONFIG_FALSE", test_libconfig_truefalse);
TEST("libconfig availability", test_libconfig_defaults);
TEST("libconfig->init and libconfig->destroy", test_libconfig_init_destroy);
TEST("libconfig->read_file_src", test_libconfig_read_file_src);
TEST("libconfig->read", test_libconfig_read);
TEST("libconfig->load_file", test_libconfig_load_file);
(void)test_libconfig_write; //TEST("libconfig->write", test_libconfig_write);
(void)test_libconfig_write_file; //TEST("libconfig->write_file", test_libconfig_write_file);
TEST("libconfig->read_string", test_libconfig_read_string);
TEST("libconfig syntax", test_libconfig_syntax);
(void)test_libconfig_set_include_dir; //TEST("libconfig->set_include_dir", test_libconfig_set_include_dir);
//int (*setting_set_format) (struct config_setting_t *setting, short format);
//short (*setting_get_format) (const struct config_setting_t *setting);
//struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value);
//struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value);
//struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value);
//struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value);
//struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value);
//struct config_setting_t * (*setting_add) (struct config_setting_t *parent, const char *name, int type);
//int (*setting_remove) (struct config_setting_t *parent, const char *name);
//int (*setting_remove_elem) (struct config_setting_t *parent, unsigned int idx);
//void (*setting_set_hook) (struct config_setting_t *setting, void *hook);
//void (*set_destructor) (struct config_t *config, void (*destructor)(void *));
TEST("libconfig->lookup_*", test_libconfig_lookup);
TEST("libconfig->setting_get_*", test_libconfig_setting_get);
(void)test_libconfig_set; //TEST("libconfig->setting_set_*", test_libconfig_setting_set);
TEST("libconfig->setting_lookup_*", test_libconfig_setting_lookup);
TEST("setting types", test_libconfig_setting_types);
//void (*setting_copy_simple) (struct config_setting_t *parent, const struct config_setting_t *src);
//void (*setting_copy_elem) (struct config_setting_t *parent, const struct config_setting_t *src);
//void (*setting_copy_aggregate) (struct config_setting_t *parent, const struct config_setting_t *src);
//int (*setting_copy) (struct config_setting_t *parent, const struct config_setting_t *src);
TEST("values", test_libconfig_values);
TEST("path lookup", test_libconfig_path_lookup);
TEST("setting key names", test_libconfig_setting_names);
TEST("duplicate keys", test_libconfig_duplicate_keys);
TEST("special string syntax", test_libconfig_special_string_syntax);
core->runflag = CORE_ST_STOP;
return EXIT_SUCCESS;
}
示例6: SetPosition
void FileViewer::Show()
{
if (FullScreen)
{
if (Opt.ViOpt.ShowKeyBar)
{
ViewKeyBar.SetPosition(0,ScrY,ScrX,ScrY);
ViewKeyBar.Redraw();
}
SetPosition(0,0,ScrX,ScrY-(Opt.ViOpt.ShowKeyBar?1:0));
View.SetPosition(0,(Opt.ViOpt.ShowTitleBar?1:0),ScrX,ScrY-(Opt.ViOpt.ShowKeyBar?1:0));
}
ScreenObject::Show();
ShowStatus();
}
示例7: itemdb_read_sqldb
/*======================================
* item_db table reading
*======================================*/
static int itemdb_read_sqldb(void)
{
#if REMODE
const char* item_db_name[] = { item_db_db, item_db_re_db, item_db2_db };
#else
const char* item_db_name[] = { item_db_db, item_db2_db };
#endif
int fi;
for( fi = 0; fi < ARRAYLENGTH(item_db_name); ++fi )
{
uint32 lines = 0, count = 0;
// retrieve all rows from the item database
if( SQL_ERROR == Sql_Query(mmysql_handle, "SELECT * FROM `%s`", item_db_name[fi]) )
{
Sql_ShowDebug(mmysql_handle);
continue;
}
// process rows one by one
while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) )
{// wrap the result into a TXT-compatible format
char* str[22];
char* dummy = "";
int i;
++lines;
for( i = 0; i < 22; ++i )
{
Sql_GetData(mmysql_handle, i, &str[i], NULL);
if( str[i] == NULL ) str[i] = dummy; // get rid of NULL columns
}
if (!itemdb_parse_dbrow(str, item_db_name[fi], lines, SCRIPT_IGNORE_EXTERNAL_BRACKETS))
continue;
++count;
}
// free the query result
Sql_FreeResult(mmysql_handle);
ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, item_db_name[fi]);
}
return 0;
}
示例8: convert_pet_db
// Converte o arquivo pet_db.txt para SQL.
void convert_pet_db(void)
{
FILE *fread, *fwrite;
char line[1024], path[256];
int count = 0, i;
sprintf(path, "%s", "db/pet_db.txt");
if (!(fread = fopen(path, "r")))
return;
fwrite = fopen("sql/conversor/pet_db.sql", "w+");
while (fgets(line, sizeof(line), fread) != NULL) {
char *token, **script, buf[1024], write[1024], *pos = buf;
if ((line[0] == '/' && line[1] == '/') || line[0] == '\n')
continue;
line[strlen(line)-1] = '\0';
explode(&script, (char *)line, '{');
token = strtok(line, ",");
for (i = 0; i < 22; i++) {
if (i) {
pos += sprintf(pos, ",");
}
if (i < 20)
pos += ((i == 1 || i == 2)) ? sprintf(pos, "'%s'", escape_str(token)) : sprintf(pos, "%s", token);
else
pos += (i == 21) ? sprintf(pos, "'{%s'", escape_str(script[2])) : sprintf(pos, "'{%s'", replace_str(escape_str(script[1]), "},", "}"));
token = strtok(NULL, ",");
}
snprintf(write, sizeof(write), "REPLACE INTO pet_db VALUES(%s);\n", buf);
fprintf(fwrite, write);
count++;
}
ShowStatus("Arquivo %s convertido com sucesso! linhas afetadas: %d\n", path, count);
fclose(fread);
fclose(fwrite);
file_count++;
}
示例9: _T
bool CServer::CreateListenSocket()
{
CStdString ports = (m_pOptions ? m_pOptions->GetOption(OPTION_SERVERPORT) : _T("21"));
bool success = CreateListenSocket(ports, false);
bool ssl_enabled = m_pOptions && m_pOptions->GetOptionVal(OPTION_ENABLETLS) != 0;
if (ssl_enabled) {
ports = m_pOptions->GetOption(OPTION_TLSPORTS);
success &= CreateListenSocket(ports, true);
}
if (success && m_ListenSocketList.empty()) {
ShowStatus(_T("No listen ports set in settings"), 1);
}
return !m_ListenSocketList.empty();
}
示例10: convert_mob_skill_db
// Converte o arquivo mob_skill_db.txt para SQL.
void convert_mob_skill_db(void)
{
FILE *fread, *fwrite;
char line[1024], path[256];
int count = 0, i;
sprintf(path, "%s", "db/mob_skill_db.txt");
if (!(fread = fopen(path, "r")))
return;
fwrite = fopen("sql/conversor/mob_skill_db.sql", "w+");
while (fgets(line, sizeof(line), fread) != NULL) {
char *token, buf[1024], write[1024], *pos = buf;
if ((line[0] == '/' && line[1] == '/') || line[0] == '\n')
continue;
line[strlen(line)-1] = '\0';
token = strtok(line, ",");
for (i = 0; i < 19; i++) {
if (i) {
pos += sprintf(pos, ",");
}
if (i > 0)
pos += (token == NULL) ? sprintf(pos, "%s", "NULL") : sprintf(pos, "'%s'", escape_str(token));
else
pos += sprintf(pos, "%d", atoi(token));
token = strtok(NULL, ",");
}
snprintf(write, sizeof(write), "REPLACE INTO mob_skill_db VALUES(%s);\n", buf);
fprintf(fwrite, write);
count++;
}
ShowStatus("Arquivo %s convertido com sucesso! linhas afetadas: %d\n", path, count);
fclose(fread);
fclose(fwrite);
file_count++;
}
示例11: itemdb_read_customrates
/*==========================================
* [Zephyrus] DB de Items con Drop Alterado
*------------------------------------------*/
static int itemdb_read_customrates(void)
{
FILE *fp;
char line[1024];
int ln=0;
int nameid,j;
char *str[3],*p;
struct item_data *id;
sprintf(line, "%s/item_customrates.txt", db_path);
if( (fp = fopen(line,"r")) == NULL )
{
ShowError("can't read %s\n", line);
return -1;
}
while( fgets(line, sizeof(line), fp) )
{
if( line[0] == '/' && line[1] == '/' )
continue;
memset(str, 0, sizeof(str));
for( j = 0, p = line; j < 3 && p; j++ )
{
str[j] = p;
p = strchr(p,',');
if( p ) *p++=0;
}
if( str[0] == NULL )
continue;
nameid = atoi(str[0]);
if( nameid <= 0 || !(id = itemdb_exists(nameid)) )
continue;
id->dropRate = atoi(str[1]);
id->add_dropRate = atoi(str[2]);
ln++;
}
fclose(fp);
if( ln > 0 )
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",ln,"item_customrates.txt");
return 0;
}
示例12: ShowStatus
void CSearchingDialog::OnCancel()
{
if (m_State != Cancelled)
{
m_nPort = -1;
m_lSpeed = 0;
CString csStatus;
Util::SafeLoadString(IDS_CANCEL_ORDER, csStatus);
ShowStatus(csStatus);
SetState(Cancelled);
if (m_pModem != NULL)
{
m_pModem->Abort();
}
}
}
示例13: chrif_on_ready
/// Called when all the connection steps are completed.
void chrif_on_ready(void)
{
ShowStatus("Map Server is now online.\n");
chrif_state = 2;
chrif_check_shutdown();
//If there are players online, send them to the char-server. [Skotlex]
send_users_tochar();
//Auth db reconnect handling
auth_db->foreach(auth_db,chrif_reconnect);
//Re-save any storages that were modified in the disconnection time. [Skotlex]
do_reconnect_storage();
//Re-save any guild castles that were modified in the disconnection time.
guild_castle_reconnect(-1, 0, 0);
}
示例14: inter_party_sql_init
int inter_party_sql_init(void)
{
//memory alloc
inter_party->db = idb_alloc(DB_OPT_RELEASE_DATA);
inter_party->pt = (struct party_data*)aCalloc(sizeof(struct party_data), 1);
if (!inter_party->pt) {
ShowFatalError("inter_party->sql_init: Out of Memory!\n");
exit(EXIT_FAILURE);
}
#if 0 // Enable if you want to do a party_db cleanup (remove parties with no members) on startup.[Skotlex]
ShowStatus("cleaning party table...\n");
if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` USING `%s` LEFT JOIN `%s` ON `%s`.leader_id =`%s`.account_id AND `%s`.leader_char = `%s`.char_id WHERE `%s`.account_id IS NULL",
party_db, party_db, char_db, party_db, char_db, party_db, char_db, char_db) )
Sql_ShowDebug(inter->sql_handle);
#endif // 0
return 0;
}
示例15: IsBehindIPv4Nat
void CServer::VerifyPassiveModeSettings(CAdminSocket *pAdminSocket)
{
bool nat = IsBehindIPv4Nat();
bool listensIPv4 = false;
auto passiveIPType = m_pOptions->GetOptionVal(OPTION_CUSTOMPASVIPTYPE);
for (auto const& s : m_ListenSocketList) {
auto family = s->GetFamily();
if (family == AF_INET || family == AF_UNSPEC) {
listensIPv4 = true;
}
}
if (listensIPv4 && nat && !passiveIPType) {
CStdString error = _T("You appear to be behind a NAT router. Please configure the passive mode settings and forward a range of ports in your router.");
ShowStatus(error, 1, pAdminSocket);
}
}