Changed almost all instances of sprintf() to snprintf().
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14563 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
f6d95be1f9
commit
ca53ef6f4a
@ -1,6 +1,7 @@
|
|||||||
Date Added
|
Date Added
|
||||||
|
|
||||||
2010/12/07
|
2010/12/07
|
||||||
|
* Changed almost all instances of sprintf() to snprintf(). [Paradox924X]
|
||||||
* Further corrections to doc/item_bonus.txt (bugreport:4624). [Ai4rei]
|
* Further corrections to doc/item_bonus.txt (bugreport:4624). [Ai4rei]
|
||||||
- Added documentation for bUnbreakableGarment, bUnbreakableWeapon, bUnbreakableArmor, bUnbreakableHelm, bUnbreakableShield, bUnbreakableShoes, bBreakWeaponRate and bBreakArmorRate (follow up to r485, r915, r1116, r13819).
|
- Added documentation for bUnbreakableGarment, bUnbreakableWeapon, bUnbreakableArmor, bUnbreakableHelm, bUnbreakableShield, bUnbreakableShoes, bBreakWeaponRate and bBreakArmorRate (follow up to r485, r915, r1116, r13819).
|
||||||
- Fixed bIgnoreDefEle having race constants listed instead of element constants (since r12804).
|
- Fixed bIgnoreDefEle having race constants listed instead of element constants (since r12804).
|
||||||
|
@ -358,7 +358,7 @@ int char_log(char *fmt, ...)
|
|||||||
else {
|
else {
|
||||||
time(&raw_time);
|
time(&raw_time);
|
||||||
strftime(tmpstr, 24, "%d-%m-%Y %H:%M:%S", localtime(&raw_time));
|
strftime(tmpstr, 24, "%d-%m-%Y %H:%M:%S", localtime(&raw_time));
|
||||||
sprintf(tmpstr + 19, ": %s", fmt);
|
snprintf(tmpstr + 19, sizeof (tmpstr + 19), ": %s", fmt);
|
||||||
vfprintf(logfp, tmpstr, ap);
|
vfprintf(logfp, tmpstr, ap);
|
||||||
}
|
}
|
||||||
fclose(logfp);
|
fclose(logfp);
|
||||||
@ -440,11 +440,11 @@ int mmo_friends_list_data_str(char *str, struct mmo_charstatus *p)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *str_p = str;
|
char *str_p = str;
|
||||||
str_p += sprintf(str_p, "%d", p->char_id);
|
str_p += snprintf(str_p, sizeof str_p, "%d", p->char_id);
|
||||||
|
|
||||||
for (i=0;i<MAX_FRIENDS;i++){
|
for (i=0;i<MAX_FRIENDS;i++){
|
||||||
if (p->friends[i].account_id > 0 && p->friends[i].char_id > 0 && p->friends[i].name[0])
|
if (p->friends[i].account_id > 0 && p->friends[i].char_id > 0 && p->friends[i].name[0])
|
||||||
str_p += sprintf(str_p, ",%d,%d,%s", p->friends[i].account_id, p->friends[i].char_id, p->friends[i].name);
|
str_p += snprintf(str_p, sizeof str_p, ",%d,%d,%s", p->friends[i].account_id, p->friends[i].char_id, p->friends[i].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
str_p += '\0';
|
str_p += '\0';
|
||||||
@ -460,9 +460,9 @@ int mmo_hotkeys_tostr(char *str, struct mmo_charstatus *p)
|
|||||||
#ifdef HOTKEY_SAVING
|
#ifdef HOTKEY_SAVING
|
||||||
int i;
|
int i;
|
||||||
char *str_p = str;
|
char *str_p = str;
|
||||||
str_p += sprintf(str_p, "%d", p->char_id);
|
str_p += snprintf(str_p, sizeof str_p, "%d", p->char_id);
|
||||||
for (i=0;i<MAX_HOTKEYS;i++)
|
for (i=0;i<MAX_HOTKEYS;i++)
|
||||||
str_p += sprintf(str_p, ",%d,%d,%d", p->hotkeys[i].type, p->hotkeys[i].id, p->hotkeys[i].lv);
|
str_p += snprintf(str_p, sizeof str_p, ",%d,%d,%d", p->hotkeys[i].type, p->hotkeys[i].id, p->hotkeys[i].lv);
|
||||||
str_p += '\0';
|
str_p += '\0';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p, struct global_reg *reg,
|
|||||||
int i,j;
|
int i,j;
|
||||||
char *str_p = str;
|
char *str_p = str;
|
||||||
|
|
||||||
str_p += sprintf(str_p,
|
str_p += snprintf(str_p, sizeof str_p,
|
||||||
"%d\t%d,%d\t%s\t%d,%d,%d\t%u,%u,%d" //Up to Zeny field
|
"%d\t%d,%d\t%s\t%d,%d,%d\t%u,%u,%d" //Up to Zeny field
|
||||||
"\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d" //Up to Skill Point
|
"\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d" //Up to Skill Point
|
||||||
"\t%d,%d,%d\t%d,%d,%d,%d" //Up to hom id
|
"\t%d,%d,%d\t%d,%d,%d,%d" //Up to hom id
|
||||||
@ -499,41 +499,41 @@ int mmo_char_tostr(char *str, struct mmo_charstatus *p, struct global_reg *reg,
|
|||||||
p->partner_id,p->father,p->mother,p->child,p->fame);
|
p->partner_id,p->father,p->mother,p->child,p->fame);
|
||||||
for(i = 0; i < MAX_MEMOPOINTS; i++)
|
for(i = 0; i < MAX_MEMOPOINTS; i++)
|
||||||
if (p->memo_point[i].map) {
|
if (p->memo_point[i].map) {
|
||||||
str_p += sprintf(str_p, "%d,%d,%d ", p->memo_point[i].map, p->memo_point[i].x, p->memo_point[i].y);
|
str_p += snprintf(str_p, sizeof str_p, "%d,%d,%d ", p->memo_point[i].map, p->memo_point[i].x, p->memo_point[i].y);
|
||||||
}
|
}
|
||||||
*(str_p++) = '\t';
|
*(str_p++) = '\t';
|
||||||
|
|
||||||
for(i = 0; i < MAX_INVENTORY; i++)
|
for(i = 0; i < MAX_INVENTORY; i++)
|
||||||
if (p->inventory[i].nameid) {
|
if (p->inventory[i].nameid) {
|
||||||
str_p += sprintf(str_p,"%d,%d,%d,%d,%d,%d,%d",
|
str_p += snprintf(str_p,sizeof str_p,"%d,%d,%d,%d,%d,%d,%d",
|
||||||
p->inventory[i].id,p->inventory[i].nameid,p->inventory[i].amount,p->inventory[i].equip,
|
p->inventory[i].id,p->inventory[i].nameid,p->inventory[i].amount,p->inventory[i].equip,
|
||||||
p->inventory[i].identify,p->inventory[i].refine,p->inventory[i].attribute);
|
p->inventory[i].identify,p->inventory[i].refine,p->inventory[i].attribute);
|
||||||
for(j=0; j<MAX_SLOTS; j++)
|
for(j=0; j<MAX_SLOTS; j++)
|
||||||
str_p += sprintf(str_p,",%d",p->inventory[i].card[j]);
|
str_p += snprintf(str_p,sizeof str_p,",%d",p->inventory[i].card[j]);
|
||||||
str_p += sprintf(str_p," ");
|
str_p += snprintf(str_p,sizeof str_p," ");
|
||||||
}
|
}
|
||||||
*(str_p++) = '\t';
|
*(str_p++) = '\t';
|
||||||
|
|
||||||
for(i = 0; i < MAX_CART; i++)
|
for(i = 0; i < MAX_CART; i++)
|
||||||
if (p->cart[i].nameid) {
|
if (p->cart[i].nameid) {
|
||||||
str_p += sprintf(str_p,"%d,%d,%d,%d,%d,%d,%d",
|
str_p += snprintf(str_p,sizeof str_p,"%d,%d,%d,%d,%d,%d,%d",
|
||||||
p->cart[i].id,p->cart[i].nameid,p->cart[i].amount,p->cart[i].equip,
|
p->cart[i].id,p->cart[i].nameid,p->cart[i].amount,p->cart[i].equip,
|
||||||
p->cart[i].identify,p->cart[i].refine,p->cart[i].attribute);
|
p->cart[i].identify,p->cart[i].refine,p->cart[i].attribute);
|
||||||
for(j=0; j<MAX_SLOTS; j++)
|
for(j=0; j<MAX_SLOTS; j++)
|
||||||
str_p += sprintf(str_p,",%d",p->cart[i].card[j]);
|
str_p += snprintf(str_p,sizeof str_p,",%d",p->cart[i].card[j]);
|
||||||
str_p += sprintf(str_p," ");
|
str_p += snprintf(str_p,sizeof str_p," ");
|
||||||
}
|
}
|
||||||
*(str_p++) = '\t';
|
*(str_p++) = '\t';
|
||||||
|
|
||||||
for(i = 0; i < MAX_SKILL; i++)
|
for(i = 0; i < MAX_SKILL; i++)
|
||||||
if (p->skill[i].id && p->skill[i].flag != 1) {
|
if (p->skill[i].id && p->skill[i].flag != 1) {
|
||||||
str_p += sprintf(str_p, "%d,%d ", p->skill[i].id, (p->skill[i].flag == 0) ? p->skill[i].lv : p->skill[i].flag-2);
|
str_p += snprintf(str_p, sizeof str_p, "%d,%d ", p->skill[i].id, (p->skill[i].flag == 0) ? p->skill[i].lv : p->skill[i].flag-2);
|
||||||
}
|
}
|
||||||
*(str_p++) = '\t';
|
*(str_p++) = '\t';
|
||||||
|
|
||||||
for(i = 0; i < reg_num; i++)
|
for(i = 0; i < reg_num; i++)
|
||||||
if (reg[i].str[0])
|
if (reg[i].str[0])
|
||||||
str_p += sprintf(str_p, "%s,%s ", reg[i].str, reg[i].value);
|
str_p += snprintf(str_p, sizeof str_p, "%s,%s ", reg[i].str, reg[i].value);
|
||||||
*(str_p++) = '\t';
|
*(str_p++) = '\t';
|
||||||
|
|
||||||
*str_p = '\0';
|
*str_p = '\0';
|
||||||
@ -1496,7 +1496,7 @@ void create_online_files(void)
|
|||||||
// get time
|
// get time
|
||||||
time(&time_server); // get time in seconds since 1/1/1970
|
time(&time_server); // get time in seconds since 1/1/1970
|
||||||
datetime = localtime(&time_server); // convert seconds in structure
|
datetime = localtime(&time_server); // convert seconds in structure
|
||||||
strftime(temp, sizeof(temp), "%d %b %Y %X", datetime); // like sprintf, but only for date/time (05 dec 2003 15:12:52)
|
strftime(temp, sizeof(temp), "%d %b %Y %X", datetime); // like snprintf, but only for date/time (05 dec 2003 15:12:52)
|
||||||
// write heading
|
// write heading
|
||||||
fprintf(fp2, "<HTML>\n");
|
fprintf(fp2, "<HTML>\n");
|
||||||
fprintf(fp2, " <META http-equiv=\"Refresh\" content=\"%d\">\n", online_refresh_html); // update on client explorer every x seconds
|
fprintf(fp2, " <META http-equiv=\"Refresh\" content=\"%d\">\n", online_refresh_html); // update on client explorer every x seconds
|
||||||
|
@ -42,14 +42,14 @@ int inter_guild_tostr(char* str, struct guild* g)
|
|||||||
int i, c, len;
|
int i, c, len;
|
||||||
|
|
||||||
// save guild base info
|
// save guild base info
|
||||||
len = sprintf(str, "%d\t%s\t%s\t%d,%d,%"PRIu64",%d,%d\t%s#\t%s#\t",
|
len = snprintf(str, sizeof str, "%d\t%s\t%s\t%d,%d,%"PRIu64",%d,%d\t%s#\t%s#\t",
|
||||||
g->guild_id, g->name, g->master, g->guild_lv, g->max_member, g->exp, g->skill_point, 0, g->mes1, g->mes2);
|
g->guild_id, g->name, g->master, g->guild_lv, g->max_member, g->exp, g->skill_point, 0, g->mes1, g->mes2);
|
||||||
|
|
||||||
// save guild member info
|
// save guild member info
|
||||||
for(i = 0; i < g->max_member; i++)
|
for(i = 0; i < g->max_member; i++)
|
||||||
{
|
{
|
||||||
struct guild_member *m = &g->member[i];
|
struct guild_member *m = &g->member[i];
|
||||||
len += sprintf(str + len, "%d,%d,%d,%d,%d,%d,%d,%"PRIu64",%d,%d\t%s\t",
|
len += snprintf(str + len, sizeof (str + len), "%d,%d,%d,%d,%d,%d,%d,%"PRIu64",%d,%d\t%s\t",
|
||||||
m->account_id, m->char_id,
|
m->account_id, m->char_id,
|
||||||
m->hair, m->hair_color, m->gender,
|
m->hair, m->hair_color, m->gender,
|
||||||
m->class_, m->lv, m->exp, m->exp_payper, m->position,
|
m->class_, m->lv, m->exp, m->exp_payper, m->position,
|
||||||
@ -59,26 +59,26 @@ int inter_guild_tostr(char* str, struct guild* g)
|
|||||||
// save guild position info
|
// save guild position info
|
||||||
for(i = 0; i < MAX_GUILDPOSITION; i++) {
|
for(i = 0; i < MAX_GUILDPOSITION; i++) {
|
||||||
struct guild_position *p = &g->position[i];
|
struct guild_position *p = &g->position[i];
|
||||||
len += sprintf(str + len, "%d,%d\t%s#\t", p->mode, p->exp_mode, p->name);
|
len += snprintf(str + len, sizeof (str + len), "%d,%d\t%s#\t", p->mode, p->exp_mode, p->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save guild emblem
|
// save guild emblem
|
||||||
len += sprintf(str + len, "%d,%d,", g->emblem_len, g->emblem_id);
|
len += snprintf(str + len, sizeof (str + len), "%d,%d,", g->emblem_len, g->emblem_id);
|
||||||
for(i = 0; i < g->emblem_len; i++) {
|
for(i = 0; i < g->emblem_len; i++) {
|
||||||
len += sprintf(str + len, "%02x", (unsigned char)(g->emblem_data[i]));
|
len += snprintf(str + len, sizeof (str + len), "%02x", (unsigned char)(g->emblem_data[i]));
|
||||||
}
|
}
|
||||||
len += sprintf(str + len, "$\t");
|
len += snprintf(str + len, sizeof (str + len), "$\t");
|
||||||
|
|
||||||
// save guild alliance info
|
// save guild alliance info
|
||||||
c = 0;
|
c = 0;
|
||||||
for(i = 0; i < MAX_GUILDALLIANCE; i++)
|
for(i = 0; i < MAX_GUILDALLIANCE; i++)
|
||||||
if (g->alliance[i].guild_id > 0)
|
if (g->alliance[i].guild_id > 0)
|
||||||
c++;
|
c++;
|
||||||
len += sprintf(str + len, "%d\t", c);
|
len += snprintf(str + len, sizeof (str + len), "%d\t", c);
|
||||||
for(i = 0; i < MAX_GUILDALLIANCE; i++) {
|
for(i = 0; i < MAX_GUILDALLIANCE; i++) {
|
||||||
struct guild_alliance *a = &g->alliance[i];
|
struct guild_alliance *a = &g->alliance[i];
|
||||||
if (a->guild_id > 0)
|
if (a->guild_id > 0)
|
||||||
len += sprintf(str + len, "%d,%d\t%s\t", a->guild_id, a->opposition, a->name);
|
len += snprintf(str + len, sizeof (str + len), "%d,%d\t%s\t", a->guild_id, a->opposition, a->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save guild expulsion info
|
// save guild expulsion info
|
||||||
@ -86,19 +86,19 @@ int inter_guild_tostr(char* str, struct guild* g)
|
|||||||
for(i = 0; i < MAX_GUILDEXPULSION; i++)
|
for(i = 0; i < MAX_GUILDEXPULSION; i++)
|
||||||
if (g->expulsion[i].account_id > 0)
|
if (g->expulsion[i].account_id > 0)
|
||||||
c++;
|
c++;
|
||||||
len += sprintf(str + len, "%d\t", c);
|
len += snprintf(str + len, sizeof (str + len), "%d\t", c);
|
||||||
for(i = 0; i < MAX_GUILDEXPULSION; i++) {
|
for(i = 0; i < MAX_GUILDEXPULSION; i++) {
|
||||||
struct guild_expulsion *e = &g->expulsion[i];
|
struct guild_expulsion *e = &g->expulsion[i];
|
||||||
if (e->account_id > 0)
|
if (e->account_id > 0)
|
||||||
len += sprintf(str + len, "%d,%d,%d,%d\t%s\t%s\t%s#\t",
|
len += snprintf(str + len, sizeof (str + len), "%d,%d,%d,%d\t%s\t%s\t%s#\t",
|
||||||
e->account_id, 0, 0, 0, e->name, "#", e->mes );
|
e->account_id, 0, 0, 0, e->name, "#", e->mes );
|
||||||
}
|
}
|
||||||
|
|
||||||
// save guild skill info
|
// save guild skill info
|
||||||
for(i = 0; i < MAX_GUILDSKILL; i++) {
|
for(i = 0; i < MAX_GUILDSKILL; i++) {
|
||||||
len += sprintf(str + len, "%d,%d ", g->skill[i].id, g->skill[i].lv);
|
len += snprintf(str + len, sizeof (str + len), "%d,%d ", g->skill[i].id, g->skill[i].lv);
|
||||||
}
|
}
|
||||||
len += sprintf(str + len, "\t");
|
len += snprintf(str + len, sizeof (str + len), "\t");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ int inter_guildcastle_tostr(char *str, struct guild_castle *gc)
|
|||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = sprintf(str, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
|
len = snprintf(str, sizeof str, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
|
||||||
gc->castle_id, gc->guild_id, gc->economy, gc->defense, gc->triggerE,
|
gc->castle_id, gc->guild_id, gc->economy, gc->defense, gc->triggerE,
|
||||||
gc->triggerD, gc->nextTime, gc->payTime, gc->createTime, gc->visibleC,
|
gc->triggerD, gc->nextTime, gc->payTime, gc->createTime, gc->visibleC,
|
||||||
gc->guardian[0].visible, gc->guardian[1].visible, gc->guardian[2].visible, gc->guardian[3].visible,
|
gc->guardian[0].visible, gc->guardian[1].visible, gc->guardian[2].visible, gc->guardian[3].visible,
|
||||||
@ -369,7 +369,7 @@ int inter_guild_readdb(void)
|
|||||||
char line[1024];
|
char line[1024];
|
||||||
char path[1024];
|
char path[1024];
|
||||||
|
|
||||||
sprintf(path, "%s%s", db_path, "/exp_guild.txt");
|
snprintf(path, sizeof path, "%s%s", db_path, "/exp_guild.txt");
|
||||||
fp = fopen(path, "r");
|
fp = fopen(path, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
ShowError("can't read db/exp_guild.txt\n");
|
ShowError("can't read db/exp_guild.txt\n");
|
||||||
@ -999,7 +999,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_mem
|
|||||||
strcpy(g->position[ 0].name, "GuildMaster");
|
strcpy(g->position[ 0].name, "GuildMaster");
|
||||||
strcpy(g->position[MAX_GUILDPOSITION-1].name, "Newbie");
|
strcpy(g->position[MAX_GUILDPOSITION-1].name, "Newbie");
|
||||||
for(i = 1; i < MAX_GUILDPOSITION-1; i++)
|
for(i = 1; i < MAX_GUILDPOSITION-1; i++)
|
||||||
sprintf(g->position[i].name, "Position %d", i + 1);
|
snprintf(g->position[i].name, sizeof g->position[i].name, "Position %d", i + 1);
|
||||||
|
|
||||||
// ここでギルド情報計算が必要と思われる
|
// ここでギルド情報計算が必要と思われる
|
||||||
g->max_member = 16;
|
g->max_member = 16;
|
||||||
|
@ -24,7 +24,7 @@ int inter_homun_tostr(char *str,struct s_homunculus *p)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
str+=sprintf(str,"%d,%d\t%s\t%d,%d,%d,%d,%d,"
|
str+=snprintf(str, sizeof str, "%d,%d\t%s\t%d,%d,%d,%d,%d,"
|
||||||
"%u,%d,%d,%d,"
|
"%u,%d,%d,%d,"
|
||||||
"%u,%d,%d,"
|
"%u,%d,%d,"
|
||||||
"%d,%d,%d,%d,%d,%d\t",
|
"%d,%d,%d,%d,%d,%d\t",
|
||||||
@ -37,7 +37,7 @@ int inter_homun_tostr(char *str,struct s_homunculus *p)
|
|||||||
for (i = 0; i < MAX_HOMUNSKILL; i++)
|
for (i = 0; i < MAX_HOMUNSKILL; i++)
|
||||||
{
|
{
|
||||||
if (p->hskill[i].id && !p->hskill[i].flag)
|
if (p->hskill[i].id && !p->hskill[i].flag)
|
||||||
str+=sprintf(str,"%d,%d,", p->hskill[i].id, p->hskill[i].lv);
|
str+=snprintf(str, sizeof str, "%d,%d,", p->hskill[i].id, p->hskill[i].lv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -107,10 +107,10 @@ static void int_party_calc_state(struct party_data *p)
|
|||||||
int inter_party_tostr(char *str, struct party *p) {
|
int inter_party_tostr(char *str, struct party *p) {
|
||||||
int i, len;
|
int i, len;
|
||||||
|
|
||||||
len = sprintf(str, "%d\t%s\t%d,%d\t", p->party_id, p->name, p->exp, p->item);
|
len = snprintf(str, sizeof str, "%d\t%s\t%d,%d\t", p->party_id, p->name, p->exp, p->item);
|
||||||
for(i = 0; i < MAX_PARTY; i++) {
|
for(i = 0; i < MAX_PARTY; i++) {
|
||||||
struct party_member *m = &p->member[i];
|
struct party_member *m = &p->member[i];
|
||||||
len += sprintf(str + len, "%d,%d,%d\t", m->account_id, m->char_id, m->leader);
|
len += snprintf(str + len, sizeof (str + len), "%d,%d,%d\t", m->account_id, m->char_id, m->leader);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -34,7 +34,7 @@ int inter_pet_tostr(char *str,struct s_pet *p)
|
|||||||
else if(p->intimate > 1000)
|
else if(p->intimate > 1000)
|
||||||
p->intimate = 1000;
|
p->intimate = 1000;
|
||||||
|
|
||||||
len=sprintf(str,"%d,%d,%s\t%d,%d,%d,%d,%d,%d,%d,%d,%d",
|
len=snprintf(str,sizeof str,"%d,%d,%s\t%d,%d,%d,%d,%d,%d,%d,%d,%d",
|
||||||
p->pet_id,p->class_,p->name,p->account_id,p->char_id,p->level,p->egg_id,
|
p->pet_id,p->class_,p->name,p->account_id,p->char_id,p->level,p->egg_id,
|
||||||
p->equip,p->intimate,p->hungry,p->rename_flag,p->incuvate);
|
p->equip,p->intimate,p->hungry,p->rename_flag,p->incuvate);
|
||||||
|
|
||||||
|
@ -52,9 +52,9 @@ static void inter_status_tostr(char* line, struct scdata *sc_data)
|
|||||||
{
|
{
|
||||||
int i, len;
|
int i, len;
|
||||||
|
|
||||||
len = sprintf(line, "%d,%d,%d\t", sc_data->account_id, sc_data->char_id, sc_data->count);
|
len = snprintf(line, sizeof line, "%d,%d,%d\t", sc_data->account_id, sc_data->char_id, sc_data->count);
|
||||||
for(i = 0; i < sc_data->count; i++) {
|
for(i = 0; i < sc_data->count; i++) {
|
||||||
len += sprintf(line + len, "%d,%ld,%ld,%ld,%ld,%ld\t", sc_data->data[i].type, sc_data->data[i].tick,
|
len += snprintf(line + len, sizeof (line + len), "%d,%ld,%ld,%ld,%ld,%ld\t", sc_data->data[i].type, sc_data->data[i].tick,
|
||||||
sc_data->data[i].val1, sc_data->data[i].val2, sc_data->data[i].val3, sc_data->data[i].val4);
|
sc_data->data[i].val1, sc_data->data[i].val2, sc_data->data[i].val3, sc_data->data[i].val4);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -31,17 +31,17 @@ bool storage_tostr(char* str, int account_id, struct storage_data* p)
|
|||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
char *str_p = str;
|
char *str_p = str;
|
||||||
str_p += sprintf(str_p, "%d,%d\t", account_id, p->storage_amount);
|
str_p += snprintf(str_p, sizeof str_p, "%d,%d\t", account_id, p->storage_amount);
|
||||||
|
|
||||||
for( i = 0; i < MAX_STORAGE; i++ )
|
for( i = 0; i < MAX_STORAGE; i++ )
|
||||||
if( p->items[i].nameid > 0 && p->items[i].amount > 0 )
|
if( p->items[i].nameid > 0 && p->items[i].amount > 0 )
|
||||||
{
|
{
|
||||||
str_p += sprintf(str_p, "%d,%d,%d,%d,%d,%d,%d",
|
str_p += snprintf(str_p, sizeof str_p, "%d,%d,%d,%d,%d,%d,%d",
|
||||||
p->items[i].id,p->items[i].nameid,p->items[i].amount,p->items[i].equip,
|
p->items[i].id,p->items[i].nameid,p->items[i].amount,p->items[i].equip,
|
||||||
p->items[i].identify,p->items[i].refine,p->items[i].attribute);
|
p->items[i].identify,p->items[i].refine,p->items[i].attribute);
|
||||||
for(j=0; j<MAX_SLOTS; j++)
|
for(j=0; j<MAX_SLOTS; j++)
|
||||||
str_p += sprintf(str_p,",%d",p->items[i].card[j]);
|
str_p += snprintf(str_p,sizeof str_p,",%d",p->items[i].card[j]);
|
||||||
str_p += sprintf(str_p," ");
|
str_p += snprintf(str_p,sizeof str_p," ");
|
||||||
}
|
}
|
||||||
|
|
||||||
*(str_p++)='\t';
|
*(str_p++)='\t';
|
||||||
@ -98,16 +98,16 @@ int guild_storage_tostr(char *str,struct guild_storage *p)
|
|||||||
{
|
{
|
||||||
int i,j,f=0;
|
int i,j,f=0;
|
||||||
char *str_p = str;
|
char *str_p = str;
|
||||||
str_p+=sprintf(str,"%d,%d\t",p->guild_id,p->storage_amount);
|
str_p+=snprintf(str,sizeof str,"%d,%d\t",p->guild_id,p->storage_amount);
|
||||||
|
|
||||||
for(i=0;i<MAX_GUILD_STORAGE;i++)
|
for(i=0;i<MAX_GUILD_STORAGE;i++)
|
||||||
if( (p->storage_[i].nameid) && (p->storage_[i].amount) ){
|
if( (p->storage_[i].nameid) && (p->storage_[i].amount) ){
|
||||||
str_p += sprintf(str_p,"%d,%d,%d,%d,%d,%d,%d",
|
str_p += snprintf(str_p,sizeof str_p,"%d,%d,%d,%d,%d,%d,%d",
|
||||||
p->storage_[i].id,p->storage_[i].nameid,p->storage_[i].amount,p->storage_[i].equip,
|
p->storage_[i].id,p->storage_[i].nameid,p->storage_[i].amount,p->storage_[i].equip,
|
||||||
p->storage_[i].identify,p->storage_[i].refine,p->storage_[i].attribute);
|
p->storage_[i].identify,p->storage_[i].refine,p->storage_[i].attribute);
|
||||||
for(j=0; j<MAX_SLOTS; j++)
|
for(j=0; j<MAX_SLOTS; j++)
|
||||||
str_p += sprintf(str_p,",%d",p->storage_[i].card[j]);
|
str_p += snprintf(str_p,sizeof str_p,",%d",p->storage_[i].card[j]);
|
||||||
str_p += sprintf(str_p," ");
|
str_p += snprintf(str_p,sizeof str_p," ");
|
||||||
f++;
|
f++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,9 +78,9 @@ int inter_accreg_tostr(char *str, struct accreg *reg) {
|
|||||||
int j;
|
int j;
|
||||||
char *p = str;
|
char *p = str;
|
||||||
|
|
||||||
p += sprintf(p, "%d\t", reg->account_id);
|
p += snprintf(p, sizeof p, "%d\t", reg->account_id);
|
||||||
for(j = 0; j < reg->reg_num; j++) {
|
for(j = 0; j < reg->reg_num; j++) {
|
||||||
p += sprintf(p,"%s,%s ", reg->reg[j].str, reg->reg[j].value);
|
p += snprintf(p, sizeof p, "%s,%s ", reg->reg[j].str, reg->reg[j].value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -652,7 +652,7 @@ int inter_guild_ReadEXP(void)
|
|||||||
char line[1024];
|
char line[1024];
|
||||||
for (i=0;i<100;i++) guild_exp[i]=0;
|
for (i=0;i<100;i++) guild_exp[i]=0;
|
||||||
|
|
||||||
sprintf(line, "%s/exp_guild.txt", db_path);
|
snprintf(line, sizeof line, "%s/exp_guild.txt", db_path);
|
||||||
fp=fopen(line,"r");
|
fp=fopen(line,"r");
|
||||||
if(fp==NULL){
|
if(fp==NULL){
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
@ -1278,7 +1278,7 @@ int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member
|
|||||||
strcpy(g->position[MAX_GUILDPOSITION-1].name,"Newbie");
|
strcpy(g->position[MAX_GUILDPOSITION-1].name,"Newbie");
|
||||||
g->position[0].modified = g->position[MAX_GUILDPOSITION-1].modified = GS_POSITION_MODIFIED;
|
g->position[0].modified = g->position[MAX_GUILDPOSITION-1].modified = GS_POSITION_MODIFIED;
|
||||||
for(i=1;i<MAX_GUILDPOSITION-1;i++) {
|
for(i=1;i<MAX_GUILDPOSITION-1;i++) {
|
||||||
sprintf(g->position[i].name,"Position %d",i+1);
|
snprintf(g->position[i].name,sizeof g->position[i].name,"Position %d",i+1);
|
||||||
g->position[i].modified = GS_POSITION_MODIFIED;
|
g->position[i].modified = GS_POSITION_MODIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ int grfio_size(char* fname)
|
|||||||
FILELIST lentry;
|
FILELIST lentry;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
sprintf(lfname, "%s%s", data_dir, fname);
|
snprintf(lfname, sizeof lfname, "%s%s", data_dir, fname);
|
||||||
|
|
||||||
for (p = &lfname[0]; *p != 0; p++)
|
for (p = &lfname[0]; *p != 0; p++)
|
||||||
if (*p=='\\') *p = '/';
|
if (*p=='\\') *p = '/';
|
||||||
@ -431,7 +431,7 @@ void* grfio_reads(char* fname, int* size)
|
|||||||
char lfname[256], *p;
|
char lfname[256], *p;
|
||||||
FILELIST lentry;
|
FILELIST lentry;
|
||||||
|
|
||||||
sprintf(lfname, "%s%s", data_dir, fname);
|
snprintf(lfname, sizeof lfname, "%s%s", data_dir, fname);
|
||||||
|
|
||||||
for (p = &lfname[0]; *p != 0; p++)
|
for (p = &lfname[0]; *p != 0; p++)
|
||||||
if (*p == '\\') *p = '/';
|
if (*p == '\\') *p = '/';
|
||||||
@ -694,7 +694,7 @@ static void grfio_resourcecheck(void)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
// read resnametable from data directory and return if successful
|
// read resnametable from data directory and return if successful
|
||||||
sprintf(restable, "%sdata\\resnametable.txt", data_dir);
|
snprintf(restable, sizeof restable, "%sdata\\resnametable.txt", data_dir);
|
||||||
for (ptr = &restable[0]; *ptr != 0; ptr++)
|
for (ptr = &restable[0]; *ptr != 0; ptr++)
|
||||||
if (*ptr == '\\') *ptr = '/';
|
if (*ptr == '\\') *ptr = '/';
|
||||||
|
|
||||||
@ -706,8 +706,8 @@ static void grfio_resourcecheck(void)
|
|||||||
// we only need the maps' GAT and RSW files
|
// we only need the maps' GAT and RSW files
|
||||||
(strstr(w2, ".gat") || strstr(w2, ".rsw")))
|
(strstr(w2, ".gat") || strstr(w2, ".rsw")))
|
||||||
{
|
{
|
||||||
sprintf(src, "data\\%s", w1);
|
snprintf(src, sizeof src, "data\\%s", w1);
|
||||||
sprintf(dst, "data\\%s", w2);
|
snprintf(dst, sizeof dst, "data\\%s", w2);
|
||||||
entry = filelist_find(dst);
|
entry = filelist_find(dst);
|
||||||
// create new entries reusing the original's info
|
// create new entries reusing the original's info
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
@ -735,8 +735,8 @@ static void grfio_resourcecheck(void)
|
|||||||
if (sscanf(ptr, "%[^#]#%[^#]#", w1, w2) == 2 &&
|
if (sscanf(ptr, "%[^#]#%[^#]#", w1, w2) == 2 &&
|
||||||
(strstr(w2, ".gat") || strstr(w2, ".rsw")))
|
(strstr(w2, ".gat") || strstr(w2, ".rsw")))
|
||||||
{
|
{
|
||||||
sprintf(src, "data\\%s", w1);
|
snprintf(src, sizeof src, "data\\%s", w1);
|
||||||
sprintf(dst, "data\\%s", w2);
|
snprintf(dst, sizeof dst, "data\\%s", w2);
|
||||||
entry = filelist_find(dst);
|
entry = filelist_find(dst);
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
FILELIST fentry;
|
FILELIST fentry;
|
||||||
|
@ -25,7 +25,7 @@ FILE* lock_fopen (const char* filename, int *info) {
|
|||||||
|
|
||||||
// 安全なファイル名を得る(手抜き)
|
// 安全なファイル名を得る(手抜き)
|
||||||
do {
|
do {
|
||||||
sprintf(newfile, "%s_%04d.tmp", filename, ++no);
|
snprintf(newfile, sizeof newfile, "%s_%04d.tmp", filename, ++no);
|
||||||
} while(exists(newfile) && no < 9999);
|
} while(exists(newfile) && no < 9999);
|
||||||
*info = no;
|
*info = no;
|
||||||
return fopen(newfile,"w");
|
return fopen(newfile,"w");
|
||||||
@ -38,8 +38,8 @@ int lock_fclose (FILE *fp, const char* filename, int *info) {
|
|||||||
char oldfile[512];
|
char oldfile[512];
|
||||||
if (fp != NULL) {
|
if (fp != NULL) {
|
||||||
ret = fclose(fp);
|
ret = fclose(fp);
|
||||||
sprintf(newfile, "%s_%04d.tmp", filename, *info);
|
snprintf(newfile, sizeof newfile, "%s_%04d.tmp", filename, *info);
|
||||||
sprintf(oldfile, "%s.bak", filename); // old backup file
|
snprintf(oldfile, sizeof oldfile, "%s.bak", filename); // old backup file
|
||||||
|
|
||||||
if (exists(oldfile)) remove(oldfile); // remove backup file if it already exists
|
if (exists(oldfile)) remove(oldfile); // remove backup file if it already exists
|
||||||
rename (filename, oldfile); // backup our older data instead of deleting it
|
rename (filename, oldfile); // backup our older data instead of deleting it
|
||||||
|
@ -602,7 +602,7 @@ static void memmgr_final (void)
|
|||||||
char* ptr = (char *)head + sizeof(struct unit_head) - sizeof(long);
|
char* ptr = (char *)head + sizeof(struct unit_head) - sizeof(long);
|
||||||
#ifdef LOG_MEMMGR
|
#ifdef LOG_MEMMGR
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
sprintf (buf,
|
snprintf (buf, sizeof buf,
|
||||||
"%04d : %s line %d size %lu address 0x%p\n", ++count,
|
"%04d : %s line %d size %lu address 0x%p\n", ++count,
|
||||||
head->file, head->line, (unsigned long)head->size, ptr);
|
head->file, head->line, (unsigned long)head->size, ptr);
|
||||||
memmgr_log (buf);
|
memmgr_log (buf);
|
||||||
@ -619,7 +619,7 @@ static void memmgr_final (void)
|
|||||||
struct unit_head_large *large2;
|
struct unit_head_large *large2;
|
||||||
#ifdef LOG_MEMMGR
|
#ifdef LOG_MEMMGR
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
sprintf (buf,
|
snprintf (buf, sizeof buf,
|
||||||
"%04d : %s line %d size %lu address 0x%p\n", ++count,
|
"%04d : %s line %d size %lu address 0x%p\n", ++count,
|
||||||
large->unit_head.file, large->unit_head.line, (unsigned long)large->size, &large->unit_head.checksum);
|
large->unit_head.file, large->unit_head.line, (unsigned long)large->size, &large->unit_head.checksum);
|
||||||
memmgr_log (buf);
|
memmgr_log (buf);
|
||||||
@ -642,7 +642,7 @@ static void memmgr_final (void)
|
|||||||
static void memmgr_init (void)
|
static void memmgr_init (void)
|
||||||
{
|
{
|
||||||
#ifdef LOG_MEMMGR
|
#ifdef LOG_MEMMGR
|
||||||
sprintf(memmer_logfile, "log/%s.leaks", SERVER_NAME);
|
snprintf(memmer_logfile, sizeof memmer_logfile, "log/%s.leaks", SERVER_NAME);
|
||||||
ShowStatus("Memory manager initialised: "CL_WHITE"%s"CL_RESET"\n", memmer_logfile);
|
ShowStatus("Memory manager initialised: "CL_WHITE"%s"CL_RESET"\n", memmer_logfile);
|
||||||
memset(hash_unfill, 0, sizeof(hash_unfill));
|
memset(hash_unfill, 0, sizeof(hash_unfill));
|
||||||
#endif /* LOG_MEMMGR */
|
#endif /* LOG_MEMMGR */
|
||||||
|
@ -222,7 +222,7 @@ void MD5_String(const char * string, char * output)
|
|||||||
unsigned char digest[16];
|
unsigned char digest[16];
|
||||||
|
|
||||||
MD5_String2binary(string,digest);
|
MD5_String2binary(string,digest);
|
||||||
sprintf(output, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
snprintf(output, sizeof output, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||||
digest[ 0], digest[ 1], digest[ 2], digest[ 3],
|
digest[ 0], digest[ 1], digest[ 2], digest[ 3],
|
||||||
digest[ 4], digest[ 5], digest[ 6], digest[ 7],
|
digest[ 4], digest[ 5], digest[ 6], digest[ 7],
|
||||||
digest[ 8], digest[ 9], digest[10], digest[11],
|
digest[ 8], digest[ 9], digest[10], digest[11],
|
||||||
|
@ -320,7 +320,7 @@ static int plugins_config_read(const char *cfgName)
|
|||||||
auto_search = atoi(w2);
|
auto_search = atoi(w2);
|
||||||
} else if( strcmpi(w1,"plugin") == 0 ){
|
} else if( strcmpi(w1,"plugin") == 0 ){
|
||||||
char filename[128];
|
char filename[128];
|
||||||
sprintf(filename, "plugins/%s%s", w2, DLL_EXT);
|
snprintf(filename, sizeof filename, "plugins/%s%s", w2, DLL_EXT);
|
||||||
plugin_load(filename);
|
plugin_load(filename);
|
||||||
} else if( strcmpi(w1,"import") == 0 )
|
} else if( strcmpi(w1,"import") == 0 )
|
||||||
plugins_config_read(w2);
|
plugins_config_read(w2);
|
||||||
|
@ -104,7 +104,7 @@ void findfile(const char *p, const char *pat, void (func)(const char*))
|
|||||||
if (strcmp(FindFileData.cFileName, "..") == 0)
|
if (strcmp(FindFileData.cFileName, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sprintf(tmppath,"%s%c%s",path,PATHSEP,FindFileData.cFileName);
|
snprintf(tmppath,sizeof tmppath,"%s%c%s",path,PATHSEP,FindFileData.cFileName);
|
||||||
|
|
||||||
if (FindFileData.cFileName && strstr(FindFileData.cFileName, pattern)) {
|
if (FindFileData.cFileName && strstr(FindFileData.cFileName, pattern)) {
|
||||||
func( tmppath );
|
func( tmppath );
|
||||||
@ -166,7 +166,7 @@ void findfile(const char *p, const char *pat, void (func)(const char*))
|
|||||||
if (strcmp(entry->d_name, "..") == 0)
|
if (strcmp(entry->d_name, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sprintf(tmppath,"%s%c%s",path, PATHSEP, entry->d_name);
|
snprintf(tmppath,sizeof tmppath,"%s%c%s",path, PATHSEP, entry->d_name);
|
||||||
|
|
||||||
// check if the pattern matchs.
|
// check if the pattern matchs.
|
||||||
if (entry->d_name && strstr(entry->d_name, pattern)) {
|
if (entry->d_name && strstr(entry->d_name, pattern)) {
|
||||||
|
@ -250,7 +250,7 @@ int ladmin_log(char *fmt, ...)
|
|||||||
else {
|
else {
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
strftime(tmpstr, 24, date_format, localtime(&t));
|
strftime(tmpstr, 24, date_format, localtime(&t));
|
||||||
sprintf(tmpstr + strlen(tmpstr), ": %s", fmt);
|
snprintf(tmpstr + strlen(tmpstr), sizeof (tmpstr + strlen(tmpstr)), ": %s", fmt);
|
||||||
vfprintf(logfp, tmpstr, ap);
|
vfprintf(logfp, tmpstr, ap);
|
||||||
}
|
}
|
||||||
fclose(logfp);
|
fclose(logfp);
|
||||||
@ -2523,7 +2523,7 @@ int parse_fromlogin(int fd)
|
|||||||
ladmin_log("Account [%s] state changing failed. Account doesn't exist.\n", RFIFOP(fd,6));
|
ladmin_log("Account [%s] state changing failed. Account doesn't exist.\n", RFIFOP(fd,6));
|
||||||
} else {
|
} else {
|
||||||
char tmpstr[256];
|
char tmpstr[256];
|
||||||
sprintf(tmpstr, "Account [%s] state successfully changed in [", RFIFOP(fd,6));
|
snprintf(tmpstr, sizeof tmpstr, "Account [%s] state successfully changed in [", RFIFOP(fd,6));
|
||||||
switch(RFIFOL(fd,30)) {
|
switch(RFIFOL(fd,30)) {
|
||||||
case 0:
|
case 0:
|
||||||
strcat(tmpstr, "0: Account OK");
|
strcat(tmpstr, "0: Account OK");
|
||||||
|
@ -558,14 +558,14 @@ static bool mmo_auth_tostr(const struct mmo_account* a, char* str)
|
|||||||
int i;
|
int i;
|
||||||
char* str_p = str;
|
char* str_p = str;
|
||||||
|
|
||||||
str_p += sprintf(str_p, "%d\t%s\t%s\t%c\t%s\t%u\t%u\t%ld\t%ld\t%u\t%s\t%s\t",
|
str_p += snprintf(str_p, sizeof str_p, "%d\t%s\t%s\t%c\t%s\t%u\t%u\t%ld\t%ld\t%u\t%s\t%s\t",
|
||||||
a->account_id, a->userid, a->pass, a->sex, a->email, a->level,
|
a->account_id, a->userid, a->pass, a->sex, a->email, a->level,
|
||||||
a->state, (long)a->unban_time, (long)a->expiration_time,
|
a->state, (long)a->unban_time, (long)a->expiration_time,
|
||||||
a->logincount, a->lastlogin, a->last_ip);
|
a->logincount, a->lastlogin, a->last_ip);
|
||||||
|
|
||||||
for( i = 0; i < a->account_reg2_num; ++i )
|
for( i = 0; i < a->account_reg2_num; ++i )
|
||||||
if( a->account_reg2[i].str[0] )
|
if( a->account_reg2[i].str[0] )
|
||||||
str_p += sprintf(str_p, "%s,%s ", a->account_reg2[i].str, a->account_reg2[i].value);
|
str_p += snprintf(str_p, sizeof str_p, "%s,%s ", a->account_reg2[i].str, a->account_reg2[i].value);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -934,11 +934,11 @@ int mmo_auth(struct login_session_data* sd)
|
|||||||
bool matched = false;
|
bool matched = false;
|
||||||
uint8* sin_addr = (uint8*)&session[sd->fd]->client_addr;
|
uint8* sin_addr = (uint8*)&session[sd->fd]->client_addr;
|
||||||
|
|
||||||
sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]);
|
snprintf(r_ip, sizeof r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]);
|
||||||
|
|
||||||
for( dnsbl_serv = strtok(login_config.dnsbl_servs,","); !matched && dnsbl_serv != NULL; dnsbl_serv = strtok(NULL,",") )
|
for( dnsbl_serv = strtok(login_config.dnsbl_servs,","); !matched && dnsbl_serv != NULL; dnsbl_serv = strtok(NULL,",") )
|
||||||
{
|
{
|
||||||
sprintf(ip_dnsbl, "%s.%s", r_ip, dnsbl_serv);
|
snprintf(ip_dnsbl, sizeof ip_dnsbl, "%s.%s", r_ip, dnsbl_serv);
|
||||||
if( host2ip(ip_dnsbl) )
|
if( host2ip(ip_dnsbl) )
|
||||||
matched = true;
|
matched = true;
|
||||||
}
|
}
|
||||||
@ -1383,7 +1383,7 @@ int parse_login(int fd)
|
|||||||
RFIFOSKIP(fd,86);
|
RFIFOSKIP(fd,86);
|
||||||
|
|
||||||
ShowInfo("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n", server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip);
|
ShowInfo("Connection request of the char-server '%s' @ %u.%u.%u.%u:%u (account: '%s', pass: '%s', ip: '%s')\n", server_name, CONVIP(server_ip), server_port, sd->userid, sd->passwd, ip);
|
||||||
sprintf(message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port);
|
snprintf(message, sizeof message, "charserver - %s@%u.%u.%u.%u:%u", server_name, CONVIP(server_ip), server_port);
|
||||||
login_log(session[fd]->client_addr, sd->userid, 100, message);
|
login_log(session[fd]->client_addr, sd->userid, 100, message);
|
||||||
|
|
||||||
result = mmo_auth(sd);
|
result = mmo_auth(sd);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -127,9 +127,9 @@ int bg_team_leave(struct map_session_data *sd, int flag)
|
|||||||
bg->count--;
|
bg->count--;
|
||||||
|
|
||||||
if( flag )
|
if( flag )
|
||||||
sprintf(output, "Server : %s has quit the game...", sd->status.name);
|
snprintf(output, sizeof output, "Server : %s has quit the game...", sd->status.name);
|
||||||
else
|
else
|
||||||
sprintf(output, "Server : %s is leaving the battlefield...", sd->status.name);
|
snprintf(output, sizeof output, "Server : %s is leaving the battlefield...", sd->status.name);
|
||||||
clif_bg_message(bg, "Server", output, strlen(output) + 1);
|
clif_bg_message(bg, "Server", output, strlen(output) + 1);
|
||||||
|
|
||||||
if( bg->logout_event[0] && flag )
|
if( bg->logout_event[0] && flag )
|
||||||
|
@ -806,10 +806,10 @@ static void chrif_char_ask_name_answer(int acc, const char* player_name, uint16
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch( answer ) {
|
switch( answer ) {
|
||||||
case 0 : sprintf(output, "Login-server has been asked to %s the player '%.*s'.", action, NAME_LENGTH, player_name); break;
|
case 0 : snprintf(output, sizeof output, "Login-server has been asked to %s the player '%.*s'.", action, NAME_LENGTH, player_name); break;
|
||||||
case 1 : sprintf(output, "The player '%.*s' doesn't exist.", NAME_LENGTH, player_name); break;
|
case 1 : snprintf(output, sizeof output, "The player '%.*s' doesn't exist.", NAME_LENGTH, player_name); break;
|
||||||
case 2 : sprintf(output, "Your GM level don't authorise you to %s the player '%.*s'.", action, NAME_LENGTH, player_name); break;
|
case 2 : snprintf(output, sizeof output, "Your GM level don't authorise you to %s the player '%.*s'.", action, NAME_LENGTH, player_name); break;
|
||||||
case 3 : sprintf(output, "Login-server is offline. Impossible to %s the player '%.*s'.", action, NAME_LENGTH, player_name); break;
|
case 3 : snprintf(output, sizeof output, "Login-server is offline. Impossible to %s the player '%.*s'.", action, NAME_LENGTH, player_name); break;
|
||||||
default: output[0] = '\0'; break;
|
default: output[0] = '\0'; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7843,11 +7843,11 @@ int clif_charnameack (int fd, struct block_list *bl)
|
|||||||
char mobhp[50], *str_p = mobhp;
|
char mobhp[50], *str_p = mobhp;
|
||||||
WBUFW(buf, 0) = cmd = 0x195;
|
WBUFW(buf, 0) = cmd = 0x195;
|
||||||
if( battle_config.show_mob_info&4 )
|
if( battle_config.show_mob_info&4 )
|
||||||
str_p += sprintf(str_p, "Lv. %d | ", md->level);
|
str_p += snprintf(str_p, sizeof str_p, "Lv. %d | ", md->level);
|
||||||
if( battle_config.show_mob_info&1 )
|
if( battle_config.show_mob_info&1 )
|
||||||
str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp);
|
str_p += snprintf(str_p, sizeof str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp);
|
||||||
if( battle_config.show_mob_info&2 )
|
if( battle_config.show_mob_info&2 )
|
||||||
str_p += sprintf(str_p, "HP: %d%% | ", get_percentage(md->status.hp, md->status.max_hp));
|
str_p += snprintf(str_p, sizeof str_p, "HP: %d%% | ", get_percentage(md->status.hp, md->status.max_hp));
|
||||||
//Even thought mobhp ain't a name, we send it as one so the client
|
//Even thought mobhp ain't a name, we send it as one so the client
|
||||||
//can parse it. [Skotlex]
|
//can parse it. [Skotlex]
|
||||||
if( str_p != mobhp )
|
if( str_p != mobhp )
|
||||||
@ -8727,7 +8727,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
|
|||||||
if( map[sd->bl.m].flag.allowks && !map_flag_ks(sd->bl.m) )
|
if( map[sd->bl.m].flag.allowks && !map_flag_ks(sd->bl.m) )
|
||||||
{
|
{
|
||||||
char output[128];
|
char output[128];
|
||||||
sprintf(output, "[ Kill Steal Protection Disable. KS is allowed in this map ]");
|
snprintf(output, sizeof output, "[ Kill Steal Protection Disable. KS is allowed in this map ]");
|
||||||
clif_broadcast(&sd->bl, output, strlen(output) + 1, 0x10, SELF);
|
clif_broadcast(&sd->bl, output, strlen(output) + 1, 0x10, SELF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8932,7 +8932,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
|
|||||||
pc_isGM(sd) < battle_config.hack_info_GM_level
|
pc_isGM(sd) < battle_config.hack_info_GM_level
|
||||||
) {
|
) {
|
||||||
char gm_msg[256];
|
char gm_msg[256];
|
||||||
sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target (id: %d).\n", sd->status.name, sd->status.account_id, id);
|
snprintf(gm_msg, sizeof gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target (id: %d).\n", sd->status.name, sd->status.account_id, id);
|
||||||
ShowWarning(gm_msg);
|
ShowWarning(gm_msg);
|
||||||
// information is sent to all online GMs
|
// information is sent to all online GMs
|
||||||
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
|
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
|
||||||
@ -9005,7 +9005,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
|
|||||||
break;
|
break;
|
||||||
case 1: {
|
case 1: {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, msg_txt(505), sd->status.name);
|
snprintf(buf, sizeof buf, msg_txt(505), sd->status.name);
|
||||||
if( strstr(message, buf) ) // "My name is %s, and I'm a Super Novice~"
|
if( strstr(message, buf) ) // "My name is %s, and I'm a Super Novice~"
|
||||||
sd->state.snovice_call_flag++;
|
sd->state.snovice_call_flag++;
|
||||||
}
|
}
|
||||||
@ -9049,11 +9049,11 @@ void clif_parse_MapMove(int fd, struct map_session_data *sd)
|
|||||||
|
|
||||||
map_name = (char*)RFIFOP(fd,2);
|
map_name = (char*)RFIFOP(fd,2);
|
||||||
map_name[MAP_NAME_LENGTH_EXT-1]='\0';
|
map_name[MAP_NAME_LENGTH_EXT-1]='\0';
|
||||||
sprintf(output, "%s %d %d", map_name, RFIFOW(fd,18), RFIFOW(fd,20));
|
snprintf(output, sizeof output, "%s %d %d", map_name, RFIFOW(fd,18), RFIFOW(fd,20));
|
||||||
atcommand_mapmove(fd, sd, "@mapmove", output);
|
atcommand_mapmove(fd, sd, "@mapmove", output);
|
||||||
if( log_config.gm && get_atcommand_level(atcommand_mapmove) >= log_config.gm )
|
if( log_config.gm && get_atcommand_level(atcommand_mapmove) >= log_config.gm )
|
||||||
{
|
{
|
||||||
sprintf(message, "/mm %s", output);
|
snprintf(message, sizeof message, "/mm %s", output);
|
||||||
log_atcommand(sd, message);
|
log_atcommand(sd, message);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -9326,11 +9326,11 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
|
|||||||
|
|
||||||
for( i = 0; i < 10; ++i )
|
for( i = 0; i < 10; ++i )
|
||||||
{
|
{
|
||||||
sprintf(output, "@whispervar%d$", i);
|
snprintf(output, sizeof output, "@whispervar%d$", i);
|
||||||
set_var(sd,output,(char *) split_data[i]);
|
set_var(sd,output,(char *) split_data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(output, "%s::OnWhisperGlobal", npc->name);
|
snprintf(output, sizeof output, "%s::OnWhisperGlobal", npc->name);
|
||||||
npc_event(sd,output,0); // Calls the NPC label
|
npc_event(sd,output,0); // Calls the NPC label
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -9390,7 +9390,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
|
|||||||
if( dstsd->state.autotrade == 1 )
|
if( dstsd->state.autotrade == 1 )
|
||||||
{
|
{
|
||||||
char output[256];
|
char output[256];
|
||||||
sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name);
|
snprintf(output, sizeof output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name);
|
||||||
clif_wis_message(fd, wisp_server_name, output, strlen(output) + 1);
|
clif_wis_message(fd, wisp_server_name, output, strlen(output) + 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -9402,12 +9402,12 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
|
|||||||
if(dstsd->away_message[0] != '\0')
|
if(dstsd->away_message[0] != '\0')
|
||||||
{
|
{
|
||||||
char output[256];
|
char output[256];
|
||||||
sprintf(output, "%s %s", message, msg_txt(543)); // "(Automessage has been sent)"
|
snprintf(output, sizeof output, "%s %s", message, msg_txt(543)); // "(Automessage has been sent)"
|
||||||
clif_wis_message(dstsd->fd, sd->status.name, output, strlen(output) + 1);
|
clif_wis_message(dstsd->fd, sd->status.name, output, strlen(output) + 1);
|
||||||
if(dstsd->state.autotrade)
|
if(dstsd->state.autotrade)
|
||||||
sprintf(output, msg_txt(544), dstsd->away_message); // "Away [AT] - "%s""
|
snprintf(output, sizeof output, msg_txt(544), dstsd->away_message); // "Away [AT] - "%s""
|
||||||
else
|
else
|
||||||
sprintf(output, msg_txt(545), dstsd->away_message); // "Away - "%s""
|
snprintf(output, sizeof output, msg_txt(545), dstsd->away_message); // "Away - "%s""
|
||||||
clif_wis_message(fd, dstsd->status.name, output, strlen(output) + 1);
|
clif_wis_message(fd, dstsd->status.name, output, strlen(output) + 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -9438,7 +9438,7 @@ void clif_parse_Broadcast(int fd, struct map_session_data* sd)
|
|||||||
|
|
||||||
if(log_config.gm && lv >= log_config.gm) {
|
if(log_config.gm && lv >= log_config.gm) {
|
||||||
char logmsg[CHAT_SIZE_MAX+4];
|
char logmsg[CHAT_SIZE_MAX+4];
|
||||||
sprintf(logmsg, "/b %s", msg);
|
snprintf(logmsg, sizeof logmsg, "/b %s", msg);
|
||||||
log_atcommand(sd, logmsg);
|
log_atcommand(sd, logmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10528,7 +10528,7 @@ void clif_parse_LocalBroadcast(int fd, struct map_session_data* sd)
|
|||||||
|
|
||||||
if( log_config.gm && lv >= log_config.gm ) {
|
if( log_config.gm && lv >= log_config.gm ) {
|
||||||
char logmsg[CHAT_SIZE_MAX+5];
|
char logmsg[CHAT_SIZE_MAX+5];
|
||||||
sprintf(logmsg, "/lb %s", msg);
|
snprintf(logmsg, sizeof logmsg, "/lb %s", msg);
|
||||||
log_atcommand(sd, logmsg);
|
log_atcommand(sd, logmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11443,7 +11443,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
|
|||||||
|
|
||||||
if(log_config.gm && lv >= log_config.gm) {
|
if(log_config.gm && lv >= log_config.gm) {
|
||||||
char message[256];
|
char message[256];
|
||||||
sprintf(message, "/kick %s (%d)", tsd->status.name, tsd->status.char_id);
|
snprintf(message, sizeof message, "/kick %s (%d)", tsd->status.name, tsd->status.char_id);
|
||||||
log_atcommand(sd, message);
|
log_atcommand(sd, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11461,7 +11461,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
|
|||||||
|
|
||||||
if(log_config.gm && lv >= log_config.gm) {
|
if(log_config.gm && lv >= log_config.gm) {
|
||||||
char message[256];
|
char message[256];
|
||||||
sprintf(message, "/kick %s (%d)", status_get_name(target), status_get_class(target));
|
snprintf(message, sizeof message, "/kick %s (%d)", status_get_name(target), status_get_class(target));
|
||||||
log_atcommand(sd, message);
|
log_atcommand(sd, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11480,7 +11480,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
|
|||||||
|
|
||||||
if( log_config.gm && lv >= log_config.gm ) {
|
if( log_config.gm && lv >= log_config.gm ) {
|
||||||
char message[256];
|
char message[256];
|
||||||
sprintf(message, "/kick %s (%d)", status_get_name(target), status_get_class(target));
|
snprintf(message, sizeof message, "/kick %s (%d)", status_get_name(target), status_get_class(target));
|
||||||
log_atcommand(sd, message);
|
log_atcommand(sd, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11521,7 +11521,7 @@ void clif_parse_GMShift(int fd, struct map_session_data *sd)
|
|||||||
atcommand_jumpto(fd, sd, "@jumpto", player_name); // as @jumpto
|
atcommand_jumpto(fd, sd, "@jumpto", player_name); // as @jumpto
|
||||||
if( log_config.gm && lv >= log_config.gm ) {
|
if( log_config.gm && lv >= log_config.gm ) {
|
||||||
char message[NAME_LENGTH+7];
|
char message[NAME_LENGTH+7];
|
||||||
sprintf(message, "/shift %s", player_name);
|
snprintf(message, sizeof message, "/shift %s", player_name);
|
||||||
log_atcommand(sd, message);
|
log_atcommand(sd, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11545,7 +11545,7 @@ void clif_parse_GMRecall(int fd, struct map_session_data *sd)
|
|||||||
atcommand_recall(fd, sd, "@recall", player_name); // as @recall
|
atcommand_recall(fd, sd, "@recall", player_name); // as @recall
|
||||||
if( log_config.gm && lv >= log_config.gm ) {
|
if( log_config.gm && lv >= log_config.gm ) {
|
||||||
char message[NAME_LENGTH+8];
|
char message[NAME_LENGTH+8];
|
||||||
sprintf(message, "/recall %s", player_name);
|
snprintf(message, sizeof message, "/recall %s", player_name);
|
||||||
log_atcommand(sd, message);
|
log_atcommand(sd, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11584,7 +11584,7 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
|
|||||||
atcommand_item(fd, sd, "@item", monster_item_name); // as @item
|
atcommand_item(fd, sd, "@item", monster_item_name); // as @item
|
||||||
if( log_config.gm && level >= log_config.gm )
|
if( log_config.gm && level >= log_config.gm )
|
||||||
{ //Log action. [Skotlex]
|
{ //Log action. [Skotlex]
|
||||||
sprintf(message, "@item %s", monster_item_name);
|
snprintf(message, sizeof message, "@item %s", monster_item_name);
|
||||||
log_atcommand(sd, message);
|
log_atcommand(sd, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11760,7 +11760,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data* sd)
|
|||||||
// Bot-check...
|
// Bot-check...
|
||||||
if (strcmp(wisp_server_name, nick) == 0)
|
if (strcmp(wisp_server_name, nick) == 0)
|
||||||
{ // to find possible bot users who automaticaly ignore people
|
{ // to find possible bot users who automaticaly ignore people
|
||||||
sprintf(output, "Character '%s' (account: %d) has tried to block wisps from '%s' (wisp name of the server). Bot user?", sd->status.name, sd->status.account_id, wisp_server_name);
|
snprintf(output, sizeof output, "Character '%s' (account: %d) has tried to block wisps from '%s' (wisp name of the server). Bot user?", sd->status.name, sd->status.account_id, wisp_server_name);
|
||||||
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, output);
|
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, output);
|
||||||
WFIFOB(fd,3) = 1; // fail
|
WFIFOB(fd,3) = 1; // fail
|
||||||
WFIFOSET(fd, packet_len(0x0d1));
|
WFIFOSET(fd, packet_len(0x0d1));
|
||||||
@ -12566,7 +12566,7 @@ void clif_Mail_refreshinbox(struct map_session_data *sd)
|
|||||||
if( md->full )
|
if( md->full )
|
||||||
{
|
{
|
||||||
char output[100];
|
char output[100];
|
||||||
sprintf(output, "Inbox is full (Max %d). Delete some mails.", MAIL_MAX_INBOX);
|
snprintf(output, sizeof output, "Inbox is full (Max %d). Delete some mails.", MAIL_MAX_INBOX);
|
||||||
clif_disp_onlyself(sd, output, strlen(output));
|
clif_disp_onlyself(sd, output, strlen(output));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14625,7 +14625,7 @@ static int packetdb_readdb(void)
|
|||||||
for( i = 0; i < ARRAYLENGTH(packet_len_table); ++i )
|
for( i = 0; i < ARRAYLENGTH(packet_len_table); ++i )
|
||||||
packet_len(i) = packet_len_table[i];
|
packet_len(i) = packet_len_table[i];
|
||||||
|
|
||||||
sprintf(line, "%s/packet_db.txt", db_path);
|
snprintf(line, sizeof line, "%s/packet_db.txt", db_path);
|
||||||
if( (fp=fopen(line,"r"))==NULL ){
|
if( (fp=fopen(line,"r"))==NULL ){
|
||||||
ShowFatalError("can't read %s\n", line);
|
ShowFatalError("can't read %s\n", line);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -110,7 +110,7 @@ int guild_read_guildskill_tree_db(void)
|
|||||||
char line[1024],*p;
|
char line[1024],*p;
|
||||||
|
|
||||||
memset(guild_skill_tree,0,sizeof(guild_skill_tree));
|
memset(guild_skill_tree,0,sizeof(guild_skill_tree));
|
||||||
sprintf(line, "%s/guild_skill_tree.txt", db_path);
|
snprintf(line, sizeof line, "%s/guild_skill_tree.txt", db_path);
|
||||||
if( (fp=fopen(line,"r"))==NULL){
|
if( (fp=fopen(line,"r"))==NULL){
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
return -1;
|
return -1;
|
||||||
@ -176,7 +176,7 @@ static int guild_read_castledb(void)
|
|||||||
char *str[32],*p;
|
char *str[32],*p;
|
||||||
struct guild_castle *gc;
|
struct guild_castle *gc;
|
||||||
|
|
||||||
sprintf(line, "%s/castle_db.txt", db_path);
|
snprintf(line, sizeof line, "%s/castle_db.txt", db_path);
|
||||||
if( (fp=fopen(line,"r"))==NULL){
|
if( (fp=fopen(line,"r"))==NULL){
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -259,7 +259,7 @@ int merc_hom_levelup(struct homun_data *hd)
|
|||||||
hom->luk += growth_luk;
|
hom->luk += growth_luk;
|
||||||
|
|
||||||
if ( battle_config.homunculus_show_growth ) {
|
if ( battle_config.homunculus_show_growth ) {
|
||||||
sprintf(output,
|
snprintf(output, sizeof output,
|
||||||
"Growth: hp:%d sp:%d str(%.2f) agi(%.2f) vit(%.2f) int(%.2f) dex(%.2f) luk(%.2f) ",
|
"Growth: hp:%d sp:%d str(%.2f) agi(%.2f) vit(%.2f) int(%.2f) dex(%.2f) luk(%.2f) ",
|
||||||
growth_max_hp, growth_max_sp,
|
growth_max_hp, growth_max_sp,
|
||||||
growth_str/10.0, growth_agi/10.0, growth_vit/10.0,
|
growth_str/10.0, growth_agi/10.0, growth_vit/10.0,
|
||||||
@ -889,7 +889,7 @@ int read_homunculusdb(void)
|
|||||||
memset(homunculus_db,0,sizeof(homunculus_db));
|
memset(homunculus_db,0,sizeof(homunculus_db));
|
||||||
for(i = 0; i<2; i++)
|
for(i = 0; i<2; i++)
|
||||||
{
|
{
|
||||||
sprintf(line, "%s/%s", db_path, filename[i]);
|
snprintf(line, sizeof line, "%s/%s", db_path, filename[i]);
|
||||||
fp = fopen(line,"r");
|
fp = fopen(line,"r");
|
||||||
if(!fp){
|
if(!fp){
|
||||||
if(i != 0)
|
if(i != 0)
|
||||||
@ -1040,7 +1040,7 @@ int read_homunculus_skilldb(void)
|
|||||||
char *split[15];
|
char *split[15];
|
||||||
|
|
||||||
memset(hskill_tree,0,sizeof(hskill_tree));
|
memset(hskill_tree,0,sizeof(hskill_tree));
|
||||||
sprintf(line, "%s/homun_skill_tree.txt", db_path);
|
snprintf(line, sizeof line, "%s/homun_skill_tree.txt", db_path);
|
||||||
fp=fopen(line,"r");
|
fp=fopen(line,"r");
|
||||||
if(fp==NULL){
|
if(fp==NULL){
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
@ -1108,7 +1108,7 @@ void read_homunculus_expdb(void)
|
|||||||
|
|
||||||
memset(hexptbl,0,sizeof(hexptbl));
|
memset(hexptbl,0,sizeof(hexptbl));
|
||||||
for(i=0; i<2; i++){
|
for(i=0; i<2; i++){
|
||||||
sprintf(line, "%s/%s", db_path, filename[i]);
|
snprintf(line, sizeof line, "%s/%s", db_path, filename[i]);
|
||||||
fp=fopen(line,"r");
|
fp=fopen(line,"r");
|
||||||
if(fp == NULL){
|
if(fp == NULL){
|
||||||
if(i != 0)
|
if(i != 0)
|
||||||
|
@ -262,8 +262,8 @@ int intif_regtostr(char* str, struct global_reg *reg, int qty)
|
|||||||
int len =0, i;
|
int len =0, i;
|
||||||
|
|
||||||
for (i = 0; i < qty; i++) {
|
for (i = 0; i < qty; i++) {
|
||||||
len+= sprintf(str+len, "%s", reg[i].str)+1; //We add 1 to consider the '\0' in place.
|
len+= snprintf(str+len, sizeof (str+len), "%s", reg[i].str)+1; //We add 1 to consider the '\0' in place.
|
||||||
len+= sprintf(str+len, "%s", reg[i].value)+1;
|
len+= snprintf(str+len, sizeof (str+len), "%s", reg[i].value)+1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@ -1471,7 +1471,7 @@ int intif_parse_Mail_inboxreceived(int fd)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char output[128];
|
char output[128];
|
||||||
sprintf(output, msg_txt(510), sd->mail.inbox.unchecked, sd->mail.inbox.unread + sd->mail.inbox.unchecked);
|
snprintf(output, sizeof output, msg_txt(510), sd->mail.inbox.unchecked, sd->mail.inbox.unread + sd->mail.inbox.unchecked);
|
||||||
clif_disp_onlyself(sd, output, strlen(output));
|
clif_disp_onlyself(sd, output, strlen(output));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -478,7 +478,7 @@ static int itemdb_read_itemavail (void)
|
|||||||
char line[1024], *str[10], *p;
|
char line[1024], *str[10], *p;
|
||||||
struct item_data *id;
|
struct item_data *id;
|
||||||
|
|
||||||
sprintf(line, "%s/item_avail.txt", db_path);
|
snprintf(line, sizeof line, "%s/item_avail.txt", db_path);
|
||||||
if ((fp = fopen(line,"r")) == NULL) {
|
if ((fp = fopen(line,"r")) == NULL) {
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
return -1;
|
return -1;
|
||||||
@ -600,7 +600,7 @@ static int itemdb_read_noequip(void)
|
|||||||
char *str[32],*p;
|
char *str[32],*p;
|
||||||
struct item_data *id;
|
struct item_data *id;
|
||||||
|
|
||||||
sprintf(line, "%s/item_noequip.txt", db_path);
|
snprintf(line, sizeof line, "%s/item_noequip.txt", db_path);
|
||||||
if( (fp=fopen(line,"r"))==NULL ){
|
if( (fp=fopen(line,"r"))==NULL ){
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
return -1;
|
return -1;
|
||||||
@ -644,7 +644,7 @@ static int itemdb_read_itemtrade(void)
|
|||||||
char line[1024], *str[10], *p;
|
char line[1024], *str[10], *p;
|
||||||
struct item_data *id;
|
struct item_data *id;
|
||||||
|
|
||||||
sprintf(line, "%s/item_trade.txt", db_path);
|
snprintf(line, sizeof line, "%s/item_trade.txt", db_path);
|
||||||
if ((fp = fopen(line,"r")) == NULL) {
|
if ((fp = fopen(line,"r")) == NULL) {
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
return -1;
|
return -1;
|
||||||
@ -690,7 +690,7 @@ static int itemdb_read_itemdelay(void)
|
|||||||
char line[1024], *str[10], *p;
|
char line[1024], *str[10], *p;
|
||||||
struct item_data *id;
|
struct item_data *id;
|
||||||
|
|
||||||
sprintf(line, "%s/item_delay.txt", db_path);
|
snprintf(line, sizeof line, "%s/item_delay.txt", db_path);
|
||||||
if ((fp = fopen(line,"r")) == NULL) {
|
if ((fp = fopen(line,"r")) == NULL) {
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
return -1;
|
return -1;
|
||||||
@ -880,7 +880,7 @@ static int itemdb_readdb(void)
|
|||||||
char path[256];
|
char path[256];
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
|
|
||||||
sprintf(path, "%s/%s", db_path, filename[fi]);
|
snprintf(path, sizeof path, "%s/%s", db_path, filename[fi]);
|
||||||
fp = fopen(path, "r");
|
fp = fopen(path, "r");
|
||||||
if( fp == NULL )
|
if( fp == NULL )
|
||||||
{
|
{
|
||||||
|
@ -2825,7 +2825,7 @@ int map_waterheight(char* mapname)
|
|||||||
char *rsw, *found;
|
char *rsw, *found;
|
||||||
|
|
||||||
//Look up for the rsw
|
//Look up for the rsw
|
||||||
sprintf(fn, "data\\%s.rsw", mapname);
|
snprintf(fn, sizeof fn, "data\\%s.rsw", mapname);
|
||||||
|
|
||||||
found = grfio_find_file(fn);
|
found = grfio_find_file(fn);
|
||||||
if (found) strcpy(fn, found); // replace with real name
|
if (found) strcpy(fn, found); // replace with real name
|
||||||
@ -2852,7 +2852,7 @@ int map_readgat (struct map_data* m)
|
|||||||
int water_height;
|
int water_height;
|
||||||
size_t xy, off, num_cells;
|
size_t xy, off, num_cells;
|
||||||
|
|
||||||
sprintf(filename, "data\\%s.gat", m->name);
|
snprintf(filename, sizeof filename, "data\\%s.gat", m->name);
|
||||||
|
|
||||||
gat = (uint8 *) grfio_read(filename);
|
gat = (uint8 *) grfio_read(filename);
|
||||||
if (gat == NULL)
|
if (gat == NULL)
|
||||||
|
@ -411,7 +411,7 @@ int read_mercenarydb(void)
|
|||||||
struct s_mercenary_db *db;
|
struct s_mercenary_db *db;
|
||||||
struct status_data *status;
|
struct status_data *status;
|
||||||
|
|
||||||
sprintf(line, "%s/%s", db_path, "mercenary_db.txt");
|
snprintf(line, sizeof line, "%s/%s", db_path, "mercenary_db.txt");
|
||||||
memset(mercenary_db,0,sizeof(mercenary_db));
|
memset(mercenary_db,0,sizeof(mercenary_db));
|
||||||
|
|
||||||
fp = fopen(line, "r");
|
fp = fopen(line, "r");
|
||||||
@ -505,7 +505,7 @@ int read_mercenary_skilldb(void)
|
|||||||
int i, j = 0, k = 0, class_;
|
int i, j = 0, k = 0, class_;
|
||||||
int skillid, skilllv;
|
int skillid, skilllv;
|
||||||
|
|
||||||
sprintf(line, "%s/%s", db_path, "mercenary_skill_db.txt");
|
snprintf(line, sizeof line, "%s/%s", db_path, "mercenary_skill_db.txt");
|
||||||
fp = fopen(line, "r");
|
fp = fopen(line, "r");
|
||||||
if( !fp )
|
if( !fp )
|
||||||
{
|
{
|
||||||
|
@ -343,7 +343,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
|
|||||||
// Message to KS
|
// Message to KS
|
||||||
if( DIFF_TICK(sd->ks_floodprotect_tick, tick) <= 0 )
|
if( DIFF_TICK(sd->ks_floodprotect_tick, tick) <= 0 )
|
||||||
{
|
{
|
||||||
sprintf(output, "[KS Warning!! - Owner : %s]", pl_sd->status.name);
|
snprintf(output, sizeof output, "[KS Warning!! - Owner : %s]", pl_sd->status.name);
|
||||||
clif_disp_onlyself(sd, output, strlen(output));
|
clif_disp_onlyself(sd, output, strlen(output));
|
||||||
|
|
||||||
sd->ks_floodprotect_tick = tick + 2000;
|
sd->ks_floodprotect_tick = tick + 2000;
|
||||||
@ -352,7 +352,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
|
|||||||
// Message to Owner
|
// Message to Owner
|
||||||
if( DIFF_TICK(pl_sd->ks_floodprotect_tick, tick) <= 0 )
|
if( DIFF_TICK(pl_sd->ks_floodprotect_tick, tick) <= 0 )
|
||||||
{
|
{
|
||||||
sprintf(output, "[Watch out! %s is trying to KS you!]", sd->status.name);
|
snprintf(output, sizeof output, "[Watch out! %s is trying to KS you!]", sd->status.name);
|
||||||
clif_disp_onlyself(pl_sd, output, strlen(output));
|
clif_disp_onlyself(pl_sd, output, strlen(output));
|
||||||
|
|
||||||
pl_sd->ks_floodprotect_tick = tick + 2000;
|
pl_sd->ks_floodprotect_tick = tick + 2000;
|
||||||
@ -2234,7 +2234,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
|
|||||||
struct item_data *i_data;
|
struct item_data *i_data;
|
||||||
char message[128];
|
char message[128];
|
||||||
i_data = itemdb_search(ditem->item_data.nameid);
|
i_data = itemdb_search(ditem->item_data.nameid);
|
||||||
sprintf (message, msg_txt(541), mvp_sd->status.name, md->name, i_data->jname, (float)drop_rate/100);
|
snprintf (message, sizeof message, msg_txt(541), mvp_sd->status.name, md->name, i_data->jname, (float)drop_rate/100);
|
||||||
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
|
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
|
||||||
intif_broadcast(message,strlen(message)+1,0);
|
intif_broadcast(message,strlen(message)+1,0);
|
||||||
}
|
}
|
||||||
@ -2360,7 +2360,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
|
|||||||
struct item_data *i_data;
|
struct item_data *i_data;
|
||||||
char message[128];
|
char message[128];
|
||||||
i_data = itemdb_exists(item.nameid);
|
i_data = itemdb_exists(item.nameid);
|
||||||
sprintf (message, msg_txt(541), mvp_sd->status.name, md->name, i_data->jname, temp/100.);
|
snprintf (message, sizeof message, msg_txt(541), mvp_sd->status.name, md->name, i_data->jname, temp/100.);
|
||||||
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
|
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
|
||||||
intif_broadcast(message,strlen(message)+1,0);
|
intif_broadcast(message,strlen(message)+1,0);
|
||||||
}
|
}
|
||||||
@ -3354,9 +3354,9 @@ static int mob_makedummymobdb(int class_)
|
|||||||
}
|
}
|
||||||
//Initialize dummy data.
|
//Initialize dummy data.
|
||||||
mob_dummy = (struct mob_db*)aCalloc(1, sizeof(struct mob_db)); //Initializing the dummy mob.
|
mob_dummy = (struct mob_db*)aCalloc(1, sizeof(struct mob_db)); //Initializing the dummy mob.
|
||||||
sprintf(mob_dummy->sprite,"DUMMY");
|
snprintf(mob_dummy->sprite,sizeof mob_dummy->sprite,"DUMMY");
|
||||||
sprintf(mob_dummy->name,"Dummy");
|
snprintf(mob_dummy->name,sizeof mob_dummy->name,"Dummy");
|
||||||
sprintf(mob_dummy->jname,"Dummy");
|
snprintf(mob_dummy->jname,sizeof mob_dummy->jname,"Dummy");
|
||||||
mob_dummy->lv=1;
|
mob_dummy->lv=1;
|
||||||
mob_dummy->status.max_hp=1000;
|
mob_dummy->status.max_hp=1000;
|
||||||
mob_dummy->status.max_sp=1;
|
mob_dummy->status.max_sp=1;
|
||||||
@ -3650,7 +3650,7 @@ static void mob_readdb(void)
|
|||||||
|
|
||||||
if(fi > 0)
|
if(fi > 0)
|
||||||
{
|
{
|
||||||
sprintf(path, "%s/%s", db_path, filename[fi]);
|
snprintf(path, sizeof path, "%s/%s", db_path, filename[fi]);
|
||||||
if(!exists(path))
|
if(!exists(path))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -3780,7 +3780,7 @@ static int mob_read_randommonster(void)
|
|||||||
for( i = 0; i < ARRAYLENGTH(mobfile) && i < MAX_RANDOMMONSTER; i++ )
|
for( i = 0; i < ARRAYLENGTH(mobfile) && i < MAX_RANDOMMONSTER; i++ )
|
||||||
{
|
{
|
||||||
mob_db_data[0]->summonper[i] = 1002; // Default fallback value, in case the database does not provide one
|
mob_db_data[0]->summonper[i] = 1002; // Default fallback value, in case the database does not provide one
|
||||||
sprintf(line, "%s/%s", db_path, mobfile[i]);
|
snprintf(line, sizeof line, "%s/%s", db_path, mobfile[i]);
|
||||||
fp=fopen(line,"r");
|
fp=fopen(line,"r");
|
||||||
if(fp==NULL){
|
if(fp==NULL){
|
||||||
ShowError("can't read %s\n",line);
|
ShowError("can't read %s\n",line);
|
||||||
@ -3894,7 +3894,7 @@ static void mob_readchatdb(void)
|
|||||||
char line[1024], path[256];
|
char line[1024], path[256];
|
||||||
int i, tmp=0;
|
int i, tmp=0;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
sprintf(path, "%s/%s", db_path, arc);
|
snprintf(path, sizeof path, "%s/%s", db_path, arc);
|
||||||
fp=fopen(path, "r");
|
fp=fopen(path, "r");
|
||||||
if(fp == NULL)
|
if(fp == NULL)
|
||||||
{
|
{
|
||||||
@ -4218,7 +4218,7 @@ static void mob_readskilldb(void)
|
|||||||
|
|
||||||
if(fi > 0)
|
if(fi > 0)
|
||||||
{
|
{
|
||||||
sprintf(path, "%s/%s", db_path, filename[fi]);
|
snprintf(path, sizeof path, "%s/%s", db_path, filename[fi]);
|
||||||
if(!exists(path))
|
if(!exists(path))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -368,19 +368,19 @@ int npc_event_do_clock(int tid, unsigned int tick, int id, intptr data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (t->tm_min != ev_tm_b.tm_min ) {
|
if (t->tm_min != ev_tm_b.tm_min ) {
|
||||||
sprintf(buf,"OnMinute%02d",t->tm_min);
|
snprintf(buf,sizeof buf,"OnMinute%02d",t->tm_min);
|
||||||
c+=npc_event_doall(buf);
|
c+=npc_event_doall(buf);
|
||||||
sprintf(buf,"OnClock%02d%02d",t->tm_hour,t->tm_min);
|
snprintf(buf,sizeof buf,"OnClock%02d%02d",t->tm_hour,t->tm_min);
|
||||||
c+=npc_event_doall(buf);
|
c+=npc_event_doall(buf);
|
||||||
sprintf(buf,"On%s%02d%02d",day,t->tm_hour,t->tm_min);
|
snprintf(buf,sizeof buf,"On%s%02d%02d",day,t->tm_hour,t->tm_min);
|
||||||
c+=npc_event_doall(buf);
|
c+=npc_event_doall(buf);
|
||||||
}
|
}
|
||||||
if (t->tm_hour!= ev_tm_b.tm_hour) {
|
if (t->tm_hour!= ev_tm_b.tm_hour) {
|
||||||
sprintf(buf,"OnHour%02d",t->tm_hour);
|
snprintf(buf,sizeof buf,"OnHour%02d",t->tm_hour);
|
||||||
c+=npc_event_doall(buf);
|
c+=npc_event_doall(buf);
|
||||||
}
|
}
|
||||||
if (t->tm_mday!= ev_tm_b.tm_mday) {
|
if (t->tm_mday!= ev_tm_b.tm_mday) {
|
||||||
sprintf(buf,"OnDay%02d%02d",t->tm_mon+1,t->tm_mday);
|
snprintf(buf,sizeof buf,"OnDay%02d%02d",t->tm_mon+1,t->tm_mday);
|
||||||
c+=npc_event_doall(buf);
|
c+=npc_event_doall(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
40
src/map/pc.c
40
src/map/pc.c
@ -939,7 +939,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
|
|||||||
|
|
||||||
if (battle_config.display_version == 1){
|
if (battle_config.display_version == 1){
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, "eAthena SVN version: %s", get_svn_revision());
|
snprintf(buf, sizeof buf, "eAthena SVN version: %s", get_svn_revision());
|
||||||
clif_displaymessage(sd->fd, buf);
|
clif_displaymessage(sd->fd, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3255,7 +3255,7 @@ void pc_paycash(struct map_session_data *sd, int price, int points)
|
|||||||
|
|
||||||
pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints - cash);
|
pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints - cash);
|
||||||
pc_setaccountreg(sd,"#KAFRAPOINTS",sd->kafraPoints - points);
|
pc_setaccountreg(sd,"#KAFRAPOINTS",sd->kafraPoints - points);
|
||||||
sprintf(output, "Used %d kafra points and %d cash points. %d kafra and %d cash points remaining.", points, cash, sd->kafraPoints, sd->cashPoints);
|
snprintf(output, sizeof output, "Used %d kafra points and %d cash points. %d kafra and %d cash points remaining.", points, cash, sd->kafraPoints, sd->cashPoints);
|
||||||
clif_disp_onlyself(sd, output, strlen(output));
|
clif_disp_onlyself(sd, output, strlen(output));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3268,7 +3268,7 @@ void pc_getcash(struct map_session_data *sd, int cash, int points)
|
|||||||
{
|
{
|
||||||
pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints + cash);
|
pc_setaccountreg(sd,"#CASHPOINTS",sd->cashPoints + cash);
|
||||||
|
|
||||||
sprintf(output, "Gained %d cash points. Total %d points", cash, sd->cashPoints);
|
snprintf(output, sizeof output, "Gained %d cash points. Total %d points", cash, sd->cashPoints);
|
||||||
clif_disp_onlyself(sd, output, strlen(output));
|
clif_disp_onlyself(sd, output, strlen(output));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3276,7 +3276,7 @@ void pc_getcash(struct map_session_data *sd, int cash, int points)
|
|||||||
{
|
{
|
||||||
pc_setaccountreg(sd,"#KAFRAPOINTS",sd->kafraPoints + points);
|
pc_setaccountreg(sd,"#KAFRAPOINTS",sd->kafraPoints + points);
|
||||||
|
|
||||||
sprintf(output, "Gained %d kafra points. Total %d points", points, sd->kafraPoints);
|
snprintf(output, sizeof output, "Gained %d kafra points. Total %d points", points, sd->kafraPoints);
|
||||||
clif_disp_onlyself(sd, output, strlen(output));
|
clif_disp_onlyself(sd, output, strlen(output));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3300,7 +3300,7 @@ int pc_getzeny(struct map_session_data *sd,int zeny)
|
|||||||
if( zeny > 0 && sd->state.showzeny )
|
if( zeny > 0 && sd->state.showzeny )
|
||||||
{
|
{
|
||||||
char output[255];
|
char output[255];
|
||||||
sprintf(output, "Gained %dz.", zeny);
|
snprintf(output, sizeof output, "Gained %dz.", zeny);
|
||||||
clif_disp_onlyself(sd,output,strlen(output));
|
clif_disp_onlyself(sd,output,strlen(output));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3922,9 +3922,9 @@ int pc_show_steal(struct block_list *bl,va_list ap)
|
|||||||
itemid=va_arg(ap,int);
|
itemid=va_arg(ap,int);
|
||||||
|
|
||||||
if((item=itemdb_exists(itemid))==NULL)
|
if((item=itemdb_exists(itemid))==NULL)
|
||||||
sprintf(output,"%s stole an Unknown Item (id: %i).",sd->status.name, itemid);
|
snprintf(output,sizeof output,"%s stole an Unknown Item (id: %i).",sd->status.name, itemid);
|
||||||
else
|
else
|
||||||
sprintf(output,"%s stole %s.",sd->status.name,item->jname);
|
snprintf(output,sizeof output,"%s stole %s.",sd->status.name,item->jname);
|
||||||
clif_displaymessage( ((struct map_session_data *)bl)->fd, output);
|
clif_displaymessage( ((struct map_session_data *)bl)->fd, output);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -4006,7 +4006,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv)
|
|||||||
struct item_data *i_data;
|
struct item_data *i_data;
|
||||||
char message[128];
|
char message[128];
|
||||||
i_data = itemdb_search(itemid);
|
i_data = itemdb_search(itemid);
|
||||||
sprintf (message, msg_txt(542), (sd->status.name != NULL)?sd->status.name :"GM", md->db->jname, i_data->jname, (float)md->db->dropitem[i].p/100);
|
snprintf(message, sizeof message, msg_txt(542), (sd->status.name != NULL)?sd->status.name :"GM", md->db->jname, i_data->jname, (float)md->db->dropitem[i].p/100);
|
||||||
//MSG: "'%s' stole %s's %s (chance: %0.02f%%)"
|
//MSG: "'%s' stole %s's %s (chance: %0.02f%%)"
|
||||||
intif_broadcast(message,strlen(message)+1,0);
|
intif_broadcast(message,strlen(message)+1,0);
|
||||||
}
|
}
|
||||||
@ -4938,7 +4938,7 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
|
|||||||
#endif
|
#endif
|
||||||
if(sd->state.showexp) {
|
if(sd->state.showexp) {
|
||||||
char output[256];
|
char output[256];
|
||||||
sprintf(output,
|
snprintf(output, sizeof output,
|
||||||
"Experience Gained Base:%u (%.2f%%) Job:%u (%.2f%%)",base_exp,nextbp*(float)100,job_exp,nextjp*(float)100);
|
"Experience Gained Base:%u (%.2f%%) Job:%u (%.2f%%)",base_exp,nextbp*(float)100,job_exp,nextjp*(float)100);
|
||||||
clif_disp_onlyself(sd,output,strlen(output));
|
clif_disp_onlyself(sd,output,strlen(output));
|
||||||
}
|
}
|
||||||
@ -7730,7 +7730,7 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
|
|||||||
|
|
||||||
if (sd->duel_group != ssd->duel_group) return 0;
|
if (sd->duel_group != ssd->duel_group) return 0;
|
||||||
|
|
||||||
sprintf(output, " %d. %s", ++(*p), sd->status.name);
|
snprintf(output, sizeof output, " %d. %s", ++(*p), sd->status.name);
|
||||||
clif_disp_onlyself(ssd, output, strlen(output));
|
clif_disp_onlyself(ssd, output, strlen(output));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -7741,13 +7741,13 @@ int duel_showinfo(const unsigned int did, struct map_session_data* sd)
|
|||||||
char output[256];
|
char output[256];
|
||||||
|
|
||||||
if(duel_list[did].max_players_limit > 0)
|
if(duel_list[did].max_players_limit > 0)
|
||||||
sprintf(output, msg_txt(370), //" -- Duels: %d/%d, Members: %d/%d, Max players: %d --"
|
snprintf(output, sizeof output, msg_txt(370), //" -- Duels: %d/%d, Members: %d/%d, Max players: %d --"
|
||||||
did, duel_count,
|
did, duel_count,
|
||||||
duel_list[did].members_count,
|
duel_list[did].members_count,
|
||||||
duel_list[did].members_count + duel_list[did].invites_count,
|
duel_list[did].members_count + duel_list[did].invites_count,
|
||||||
duel_list[did].max_players_limit);
|
duel_list[did].max_players_limit);
|
||||||
else
|
else
|
||||||
sprintf(output, msg_txt(371), //" -- Duels: %d/%d, Members: %d/%d --"
|
snprintf(output, sizeof output, msg_txt(371), //" -- Duels: %d/%d, Members: %d/%d --"
|
||||||
did, duel_count,
|
did, duel_count,
|
||||||
duel_list[did].members_count,
|
duel_list[did].members_count,
|
||||||
duel_list[did].members_count + duel_list[did].invites_count);
|
duel_list[did].members_count + duel_list[did].invites_count);
|
||||||
@ -7784,14 +7784,14 @@ int duel_invite(const unsigned int did, struct map_session_data* sd, struct map_
|
|||||||
char output[256];
|
char output[256];
|
||||||
|
|
||||||
// " -- Player %s invites %s to duel --"
|
// " -- Player %s invites %s to duel --"
|
||||||
sprintf(output, msg_txt(373), sd->status.name, target_sd->status.name);
|
snprintf(output, sizeof output, msg_txt(373), sd->status.name, target_sd->status.name);
|
||||||
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
|
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
|
||||||
|
|
||||||
target_sd->duel_invite = did;
|
target_sd->duel_invite = did;
|
||||||
duel_list[did].invites_count++;
|
duel_list[did].invites_count++;
|
||||||
|
|
||||||
// "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
|
// "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
|
||||||
sprintf(output, msg_txt(374), sd->status.name);
|
snprintf(output, sizeof output, msg_txt(374), sd->status.name);
|
||||||
clif_broadcast((struct block_list *)target_sd, output, strlen(output)+1, 0x10, SELF);
|
clif_broadcast((struct block_list *)target_sd, output, strlen(output)+1, 0x10, SELF);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -7809,7 +7809,7 @@ int duel_leave(const unsigned int did, struct map_session_data* sd)
|
|||||||
char output[256];
|
char output[256];
|
||||||
|
|
||||||
// " <- Player %s has left duel --"
|
// " <- Player %s has left duel --"
|
||||||
sprintf(output, msg_txt(375), sd->status.name);
|
snprintf(output, sizeof output, msg_txt(375), sd->status.name);
|
||||||
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
|
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
|
||||||
|
|
||||||
duel_list[did].members_count--;
|
duel_list[did].members_count--;
|
||||||
@ -7835,7 +7835,7 @@ int duel_accept(const unsigned int did, struct map_session_data* sd)
|
|||||||
sd->duel_invite = 0;
|
sd->duel_invite = 0;
|
||||||
|
|
||||||
// " -> Player %s has accepted duel --"
|
// " -> Player %s has accepted duel --"
|
||||||
sprintf(output, msg_txt(376), sd->status.name);
|
snprintf(output, sizeof output, msg_txt(376), sd->status.name);
|
||||||
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
|
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
|
||||||
|
|
||||||
clif_set0199(sd, 1);
|
clif_set0199(sd, 1);
|
||||||
@ -7848,7 +7848,7 @@ int duel_reject(const unsigned int did, struct map_session_data* sd)
|
|||||||
char output[256];
|
char output[256];
|
||||||
|
|
||||||
// " -- Player %s has rejected duel --"
|
// " -- Player %s has rejected duel --"
|
||||||
sprintf(output, msg_txt(377), sd->status.name);
|
snprintf(output, sizeof output, msg_txt(377), sd->status.name);
|
||||||
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
|
clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
|
||||||
|
|
||||||
duel_list[did].invites_count--;
|
duel_list[did].invites_count--;
|
||||||
@ -7977,7 +7977,7 @@ int pc_readdb(void)
|
|||||||
// •K—v??’l?‚Ý?‚Ý
|
// •K—v??’l?‚Ý?‚Ý
|
||||||
memset(exp_table,0,sizeof(exp_table));
|
memset(exp_table,0,sizeof(exp_table));
|
||||||
memset(max_level,0,sizeof(max_level));
|
memset(max_level,0,sizeof(max_level));
|
||||||
sprintf(line, "%s/exp.txt", db_path);
|
snprintf(line, sizeof line, "%s/exp.txt", db_path);
|
||||||
fp=fopen(line, "r");
|
fp=fopen(line, "r");
|
||||||
if(fp==NULL){
|
if(fp==NULL){
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
@ -8067,7 +8067,7 @@ int pc_readdb(void)
|
|||||||
for(k=0;k<ELE_MAX;k++)
|
for(k=0;k<ELE_MAX;k++)
|
||||||
attr_fix_table[i][j][k]=100;
|
attr_fix_table[i][j][k]=100;
|
||||||
|
|
||||||
sprintf(line, "%s/attr_fix.txt", db_path);
|
snprintf(line, sizeof line, "%s/attr_fix.txt", db_path);
|
||||||
fp=fopen(line,"r");
|
fp=fopen(line,"r");
|
||||||
if(fp==NULL){
|
if(fp==NULL){
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
@ -8115,7 +8115,7 @@ int pc_readdb(void)
|
|||||||
// ƒXƒLƒ‹ƒcƒŠ?
|
// ƒXƒLƒ‹ƒcƒŠ?
|
||||||
memset(statp,0,sizeof(statp));
|
memset(statp,0,sizeof(statp));
|
||||||
i=1;
|
i=1;
|
||||||
sprintf(line, "%s/statpoint.txt", db_path);
|
snprintf(line, sizeof line, "%s/statpoint.txt", db_path);
|
||||||
fp=fopen(line,"r");
|
fp=fopen(line,"r");
|
||||||
if(fp == NULL){
|
if(fp == NULL){
|
||||||
ShowStatus("Can't read '"CL_WHITE"%s"CL_RESET"'... Generating DB.\n",line);
|
ShowStatus("Can't read '"CL_WHITE"%s"CL_RESET"'... Generating DB.\n",line);
|
||||||
|
@ -1222,7 +1222,7 @@ int read_petdb()
|
|||||||
char line[1024];
|
char line[1024];
|
||||||
int lines;
|
int lines;
|
||||||
|
|
||||||
sprintf(line, "%s/%s", db_path, filename[i]);
|
snprintf(line, sizeof line, "%s/%s", db_path, filename[i]);
|
||||||
fp=fopen(line,"r");
|
fp=fopen(line,"r");
|
||||||
if( fp == NULL )
|
if( fp == NULL )
|
||||||
{
|
{
|
||||||
|
@ -306,7 +306,7 @@ int quest_read_db(void)
|
|||||||
int i,j,k = 0;
|
int i,j,k = 0;
|
||||||
char *str[20],*p,*np;
|
char *str[20],*p,*np;
|
||||||
|
|
||||||
sprintf(line, "%s/quest_db.txt", db_path);
|
snprintf(line, sizeof line, "%s/quest_db.txt", db_path);
|
||||||
if( (fp=fopen(line,"r"))==NULL ){
|
if( (fp=fopen(line,"r"))==NULL ){
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1166,32 +1166,32 @@ const char* parse_curly_close(const char* p)
|
|||||||
char label[256];
|
char label[256];
|
||||||
int l;
|
int l;
|
||||||
// 一時変数を消す
|
// 一時変数を消す
|
||||||
sprintf(label,"set $@__SW%x_VAL,0;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"set $@__SW%x_VAL,0;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// 無条件で終了ポインタに移動
|
// 無条件で終了ポインタに移動
|
||||||
sprintf(label,"goto __SW%x_FIN;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __SW%x_FIN;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// 現在地のラベルを付ける
|
// 現在地のラベルを付ける
|
||||||
sprintf(label,"__SW%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
snprintf(label,sizeof label,"__SW%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos, p);
|
set_label(l,script_pos, p);
|
||||||
|
|
||||||
if(syntax.curly[pos].flag) {
|
if(syntax.curly[pos].flag) {
|
||||||
// default が存在する
|
// default が存在する
|
||||||
sprintf(label,"goto __SW%x_DEF;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __SW%x_DEF;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 終了ラベルを付ける
|
// 終了ラベルを付ける
|
||||||
sprintf(label,"__SW%x_FIN",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__SW%x_FIN",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos, p);
|
set_label(l,script_pos, p);
|
||||||
linkdb_final(&syntax.curly[pos].case_label); // free the list of case label
|
linkdb_final(&syntax.curly[pos].case_label); // free the list of case label
|
||||||
@ -1219,16 +1219,16 @@ const char* parse_syntax(const char* p)
|
|||||||
int pos = syntax.curly_count - 1;
|
int pos = syntax.curly_count - 1;
|
||||||
while(pos >= 0) {
|
while(pos >= 0) {
|
||||||
if(syntax.curly[pos].type == TYPE_DO) {
|
if(syntax.curly[pos].type == TYPE_DO) {
|
||||||
sprintf(label,"goto __DO%x_FIN;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __DO%x_FIN;",syntax.curly[pos].index);
|
||||||
break;
|
break;
|
||||||
} else if(syntax.curly[pos].type == TYPE_FOR) {
|
} else if(syntax.curly[pos].type == TYPE_FOR) {
|
||||||
sprintf(label,"goto __FR%x_FIN;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __FR%x_FIN;",syntax.curly[pos].index);
|
||||||
break;
|
break;
|
||||||
} else if(syntax.curly[pos].type == TYPE_WHILE) {
|
} else if(syntax.curly[pos].type == TYPE_WHILE) {
|
||||||
sprintf(label,"goto __WL%x_FIN;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __WL%x_FIN;",syntax.curly[pos].index);
|
||||||
break;
|
break;
|
||||||
} else if(syntax.curly[pos].type == TYPE_SWITCH) {
|
} else if(syntax.curly[pos].type == TYPE_SWITCH) {
|
||||||
sprintf(label,"goto __SW%x_FIN;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __SW%x_FIN;",syntax.curly[pos].index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pos--;
|
pos--;
|
||||||
@ -1262,13 +1262,13 @@ const char* parse_syntax(const char* p)
|
|||||||
char *np;
|
char *np;
|
||||||
if(syntax.curly[pos].count != 1) {
|
if(syntax.curly[pos].count != 1) {
|
||||||
// FALLTHRU 用のジャンプ
|
// FALLTHRU 用のジャンプ
|
||||||
sprintf(label,"goto __SW%x_%xJ;",syntax.curly[pos].index,syntax.curly[pos].count);
|
snprintf(label,sizeof label,"goto __SW%x_%xJ;",syntax.curly[pos].index,syntax.curly[pos].count);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// 現在地のラベルを付ける
|
// 現在地のラベルを付ける
|
||||||
sprintf(label,"__SW%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
snprintf(label,sizeof label,"__SW%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos, p);
|
set_label(l,script_pos, p);
|
||||||
}
|
}
|
||||||
@ -1299,7 +1299,7 @@ const char* parse_syntax(const char* p)
|
|||||||
p = skip_space(p);
|
p = skip_space(p);
|
||||||
if(*p != ':')
|
if(*p != ':')
|
||||||
disp_error_message("parse_syntax: expect ':'",p);
|
disp_error_message("parse_syntax: expect ':'",p);
|
||||||
sprintf(label,"if(%d != $@__SW%x_VAL) goto __SW%x_%x;",
|
snprintf(label,sizeof label,"if(%d != $@__SW%x_VAL) goto __SW%x_%x;",
|
||||||
v,syntax.curly[pos].index,syntax.curly[pos].index,syntax.curly[pos].count+1);
|
v,syntax.curly[pos].index,syntax.curly[pos].index,syntax.curly[pos].count+1);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
// 2回parse しないとダメ
|
// 2回parse しないとダメ
|
||||||
@ -1308,7 +1308,7 @@ const char* parse_syntax(const char* p)
|
|||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
if(syntax.curly[pos].count != 1) {
|
if(syntax.curly[pos].count != 1) {
|
||||||
// FALLTHRU 終了後のラベル
|
// FALLTHRU 終了後のラベル
|
||||||
sprintf(label,"__SW%x_%xJ",syntax.curly[pos].index,syntax.curly[pos].count);
|
snprintf(label,sizeof label,"__SW%x_%xJ",syntax.curly[pos].index,syntax.curly[pos].count);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
}
|
}
|
||||||
@ -1317,7 +1317,7 @@ const char* parse_syntax(const char* p)
|
|||||||
disp_error_message("parse_syntax: dup 'case'",p);
|
disp_error_message("parse_syntax: dup 'case'",p);
|
||||||
linkdb_insert(&syntax.curly[pos].case_label, (void*)v, (void*)1);
|
linkdb_insert(&syntax.curly[pos].case_label, (void*)v, (void*)1);
|
||||||
|
|
||||||
sprintf(label,"set $@__SW%x_VAL,0;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"set $@__SW%x_VAL,0;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
|
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
@ -1331,14 +1331,14 @@ const char* parse_syntax(const char* p)
|
|||||||
int pos = syntax.curly_count - 1;
|
int pos = syntax.curly_count - 1;
|
||||||
while(pos >= 0) {
|
while(pos >= 0) {
|
||||||
if(syntax.curly[pos].type == TYPE_DO) {
|
if(syntax.curly[pos].type == TYPE_DO) {
|
||||||
sprintf(label,"goto __DO%x_NXT;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __DO%x_NXT;",syntax.curly[pos].index);
|
||||||
syntax.curly[pos].flag = 1; // continue 用のリンク張るフラグ
|
syntax.curly[pos].flag = 1; // continue 用のリンク張るフラグ
|
||||||
break;
|
break;
|
||||||
} else if(syntax.curly[pos].type == TYPE_FOR) {
|
} else if(syntax.curly[pos].type == TYPE_FOR) {
|
||||||
sprintf(label,"goto __FR%x_NXT;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __FR%x_NXT;",syntax.curly[pos].index);
|
||||||
break;
|
break;
|
||||||
} else if(syntax.curly[pos].type == TYPE_WHILE) {
|
} else if(syntax.curly[pos].type == TYPE_WHILE) {
|
||||||
sprintf(label,"goto __WL%x_NXT;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __WL%x_NXT;",syntax.curly[pos].index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pos--;
|
pos--;
|
||||||
@ -1375,18 +1375,18 @@ const char* parse_syntax(const char* p)
|
|||||||
if(*p != ':') {
|
if(*p != ':') {
|
||||||
disp_error_message("parse_syntax: need ':'",p);
|
disp_error_message("parse_syntax: need ':'",p);
|
||||||
}
|
}
|
||||||
sprintf(label,"__SW%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
snprintf(label,sizeof label,"__SW%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
|
|
||||||
// 無条件で次のリンクに飛ばす
|
// 無条件で次のリンクに飛ばす
|
||||||
sprintf(label,"goto __SW%x_%x;",syntax.curly[pos].index,syntax.curly[pos].count+1);
|
snprintf(label,sizeof label,"goto __SW%x_%x;",syntax.curly[pos].index,syntax.curly[pos].count+1);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// default のラベルを付ける
|
// default のラベルを付ける
|
||||||
sprintf(label,"__SW%x_DEF",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__SW%x_DEF",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
|
|
||||||
@ -1404,7 +1404,7 @@ const char* parse_syntax(const char* p)
|
|||||||
syntax.curly[syntax.curly_count].index = syntax.index++;
|
syntax.curly[syntax.curly_count].index = syntax.index++;
|
||||||
syntax.curly[syntax.curly_count].flag = 0;
|
syntax.curly[syntax.curly_count].flag = 0;
|
||||||
// 現在地のラベル形成する
|
// 現在地のラベル形成する
|
||||||
sprintf(label,"__DO%x_BGN",syntax.curly[syntax.curly_count].index);
|
snprintf(label,sizeof label,"__DO%x_BGN",syntax.curly[syntax.curly_count].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
syntax.curly_count++;
|
syntax.curly_count++;
|
||||||
@ -1435,7 +1435,7 @@ const char* parse_syntax(const char* p)
|
|||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// 条件判断開始のラベル形成する
|
// 条件判断開始のラベル形成する
|
||||||
sprintf(label,"__FR%x_J",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__FR%x_J",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
|
|
||||||
@ -1445,7 +1445,7 @@ const char* parse_syntax(const char* p)
|
|||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
// 条件が偽なら終了地点に飛ばす
|
// 条件が偽なら終了地点に飛ばす
|
||||||
sprintf(label,"__FR%x_FIN",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__FR%x_FIN",syntax.curly[pos].index);
|
||||||
add_scriptl(add_str("jump_zero"));
|
add_scriptl(add_str("jump_zero"));
|
||||||
add_scriptc(C_ARG);
|
add_scriptc(C_ARG);
|
||||||
p=parse_expr(p);
|
p=parse_expr(p);
|
||||||
@ -1458,13 +1458,13 @@ const char* parse_syntax(const char* p)
|
|||||||
p++;
|
p++;
|
||||||
|
|
||||||
// ループ開始に飛ばす
|
// ループ開始に飛ばす
|
||||||
sprintf(label,"goto __FR%x_BGN;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __FR%x_BGN;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// 次のループへのラベル形成する
|
// 次のループへのラベル形成する
|
||||||
sprintf(label,"__FR%x_NXT",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__FR%x_NXT",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
|
|
||||||
@ -1477,13 +1477,13 @@ const char* parse_syntax(const char* p)
|
|||||||
parse_syntax_for_flag = 0;
|
parse_syntax_for_flag = 0;
|
||||||
|
|
||||||
// 条件判定処理に飛ばす
|
// 条件判定処理に飛ばす
|
||||||
sprintf(label,"goto __FR%x_J;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __FR%x_J;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// ループ開始のラベル付け
|
// ループ開始のラベル付け
|
||||||
sprintf(label,"__FR%x_BGN",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__FR%x_BGN",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
return p;
|
return p;
|
||||||
@ -1520,7 +1520,7 @@ const char* parse_syntax(const char* p)
|
|||||||
++syntax.curly_count;
|
++syntax.curly_count;
|
||||||
|
|
||||||
// Jump over the function code
|
// Jump over the function code
|
||||||
sprintf(label, "goto __FN%x_FIN;", syntax.curly[syntax.curly_count-1].index);
|
snprintf(label,sizeof label, "goto __FN%x_FIN;", syntax.curly[syntax.curly_count-1].index);
|
||||||
syntax.curly[syntax.curly_count].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count].type = TYPE_NULL;
|
||||||
++syntax.curly_count;
|
++syntax.curly_count;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
@ -1554,7 +1554,7 @@ const char* parse_syntax(const char* p)
|
|||||||
syntax.curly[syntax.curly_count].count = 1;
|
syntax.curly[syntax.curly_count].count = 1;
|
||||||
syntax.curly[syntax.curly_count].index = syntax.index++;
|
syntax.curly[syntax.curly_count].index = syntax.index++;
|
||||||
syntax.curly[syntax.curly_count].flag = 0;
|
syntax.curly[syntax.curly_count].flag = 0;
|
||||||
sprintf(label,"__IF%x_%x",syntax.curly[syntax.curly_count].index,syntax.curly[syntax.curly_count].count);
|
snprintf(label,sizeof label,"__IF%x_%x",syntax.curly[syntax.curly_count].index,syntax.curly[syntax.curly_count].count);
|
||||||
syntax.curly_count++;
|
syntax.curly_count++;
|
||||||
add_scriptl(add_str("jump_zero"));
|
add_scriptl(add_str("jump_zero"));
|
||||||
add_scriptc(C_ARG);
|
add_scriptc(C_ARG);
|
||||||
@ -1578,7 +1578,7 @@ const char* parse_syntax(const char* p)
|
|||||||
syntax.curly[syntax.curly_count].count = 1;
|
syntax.curly[syntax.curly_count].count = 1;
|
||||||
syntax.curly[syntax.curly_count].index = syntax.index++;
|
syntax.curly[syntax.curly_count].index = syntax.index++;
|
||||||
syntax.curly[syntax.curly_count].flag = 0;
|
syntax.curly[syntax.curly_count].flag = 0;
|
||||||
sprintf(label,"$@__SW%x_VAL",syntax.curly[syntax.curly_count].index);
|
snprintf(label,sizeof label,"$@__SW%x_VAL",syntax.curly[syntax.curly_count].index);
|
||||||
syntax.curly_count++;
|
syntax.curly_count++;
|
||||||
add_scriptl(add_str("set"));
|
add_scriptl(add_str("set"));
|
||||||
add_scriptc(C_ARG);
|
add_scriptc(C_ARG);
|
||||||
@ -1606,12 +1606,12 @@ const char* parse_syntax(const char* p)
|
|||||||
syntax.curly[syntax.curly_count].index = syntax.index++;
|
syntax.curly[syntax.curly_count].index = syntax.index++;
|
||||||
syntax.curly[syntax.curly_count].flag = 0;
|
syntax.curly[syntax.curly_count].flag = 0;
|
||||||
// 条件判断開始のラベル形成する
|
// 条件判断開始のラベル形成する
|
||||||
sprintf(label,"__WL%x_NXT",syntax.curly[syntax.curly_count].index);
|
snprintf(label,sizeof label,"__WL%x_NXT",syntax.curly[syntax.curly_count].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
|
|
||||||
// 条件が偽なら終了地点に飛ばす
|
// 条件が偽なら終了地点に飛ばす
|
||||||
sprintf(label,"__WL%x_FIN",syntax.curly[syntax.curly_count].index);
|
snprintf(label,sizeof label,"__WL%x_FIN",syntax.curly[syntax.curly_count].index);
|
||||||
syntax.curly_count++;
|
syntax.curly_count++;
|
||||||
add_scriptl(add_str("jump_zero"));
|
add_scriptl(add_str("jump_zero"));
|
||||||
add_scriptc(C_ARG);
|
add_scriptc(C_ARG);
|
||||||
@ -1653,13 +1653,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
|
|||||||
const char *bp = p;
|
const char *bp = p;
|
||||||
const char *p2;
|
const char *p2;
|
||||||
// if 最終場所へ飛ばす
|
// if 最終場所へ飛ばす
|
||||||
sprintf(label,"goto __IF%x_FIN;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __IF%x_FIN;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// 現在地のラベルを付ける
|
// 現在地のラベルを付ける
|
||||||
sprintf(label,"__IF%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
snprintf(label,sizeof label,"__IF%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
|
|
||||||
@ -1676,7 +1676,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
|
|||||||
if(*p != '(') {
|
if(*p != '(') {
|
||||||
disp_error_message("need '('",p);
|
disp_error_message("need '('",p);
|
||||||
}
|
}
|
||||||
sprintf(label,"__IF%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
snprintf(label,sizeof label,"__IF%x_%x",syntax.curly[pos].index,syntax.curly[pos].count);
|
||||||
add_scriptl(add_str("jump_zero"));
|
add_scriptl(add_str("jump_zero"));
|
||||||
add_scriptc(C_ARG);
|
add_scriptc(C_ARG);
|
||||||
p=parse_expr(p);
|
p=parse_expr(p);
|
||||||
@ -1697,7 +1697,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
|
|||||||
// if 閉じ
|
// if 閉じ
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
// 最終地のラベルを付ける
|
// 最終地のラベルを付ける
|
||||||
sprintf(label,"__IF%x_FIN",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__IF%x_FIN",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
if(syntax.curly[pos].flag == 1) {
|
if(syntax.curly[pos].flag == 1) {
|
||||||
@ -1712,7 +1712,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
|
|||||||
|
|
||||||
if(syntax.curly[pos].flag) {
|
if(syntax.curly[pos].flag) {
|
||||||
// 現在地のラベル形成する(continue でここに来る)
|
// 現在地のラベル形成する(continue でここに来る)
|
||||||
sprintf(label,"__DO%x_NXT",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__DO%x_NXT",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
}
|
}
|
||||||
@ -1727,7 +1727,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
|
|||||||
if(*p != '(') {
|
if(*p != '(') {
|
||||||
disp_error_message("need '('",p);
|
disp_error_message("need '('",p);
|
||||||
}
|
}
|
||||||
sprintf(label,"__DO%x_FIN",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__DO%x_FIN",syntax.curly[pos].index);
|
||||||
add_scriptl(add_str("jump_zero"));
|
add_scriptl(add_str("jump_zero"));
|
||||||
add_scriptc(C_ARG);
|
add_scriptc(C_ARG);
|
||||||
p=parse_expr(p);
|
p=parse_expr(p);
|
||||||
@ -1736,13 +1736,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
|
|||||||
add_scriptc(C_FUNC);
|
add_scriptc(C_FUNC);
|
||||||
|
|
||||||
// 開始地点に飛ばす
|
// 開始地点に飛ばす
|
||||||
sprintf(label,"goto __DO%x_BGN;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __DO%x_BGN;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// 条件終了地点のラベル形成する
|
// 条件終了地点のラベル形成する
|
||||||
sprintf(label,"__DO%x_FIN",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__DO%x_FIN",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
p = skip_space(p);
|
p = skip_space(p);
|
||||||
@ -1755,26 +1755,26 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
|
|||||||
return p;
|
return p;
|
||||||
} else if(syntax.curly[pos].type == TYPE_FOR) {
|
} else if(syntax.curly[pos].type == TYPE_FOR) {
|
||||||
// 次のループに飛ばす
|
// 次のループに飛ばす
|
||||||
sprintf(label,"goto __FR%x_NXT;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __FR%x_NXT;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// for 終了のラベル付け
|
// for 終了のラベル付け
|
||||||
sprintf(label,"__FR%x_FIN",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__FR%x_FIN",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
return p;
|
return p;
|
||||||
} else if(syntax.curly[pos].type == TYPE_WHILE) {
|
} else if(syntax.curly[pos].type == TYPE_WHILE) {
|
||||||
// while 条件判断へ飛ばす
|
// while 条件判断へ飛ばす
|
||||||
sprintf(label,"goto __WL%x_NXT;",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"goto __WL%x_NXT;",syntax.curly[pos].index);
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// while 終了のラベル付け
|
// while 終了のラベル付け
|
||||||
sprintf(label,"__WL%x_FIN",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__WL%x_FIN",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
@ -1784,13 +1784,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
|
|||||||
char label[256];
|
char label[256];
|
||||||
int l;
|
int l;
|
||||||
// 戻す
|
// 戻す
|
||||||
sprintf(label,"return;");
|
snprintf(label,sizeof label,"return;");
|
||||||
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
syntax.curly[syntax.curly_count++].type = TYPE_NULL;
|
||||||
parse_line(label);
|
parse_line(label);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
|
|
||||||
// 現在地のラベルを付ける
|
// 現在地のラベルを付ける
|
||||||
sprintf(label,"__FN%x_FIN",syntax.curly[pos].index);
|
snprintf(label,sizeof label,"__FN%x_FIN",syntax.curly[pos].index);
|
||||||
l=add_str(label);
|
l=add_str(label);
|
||||||
set_label(l,script_pos,p);
|
set_label(l,script_pos,p);
|
||||||
syntax.curly_count--;
|
syntax.curly_count--;
|
||||||
@ -1844,7 +1844,7 @@ static void read_constdb(void)
|
|||||||
char line[1024],name[1024],val[1024];
|
char line[1024],name[1024],val[1024];
|
||||||
int n,type;
|
int n,type;
|
||||||
|
|
||||||
sprintf(line, "%s/const.txt", db_path);
|
snprintf(line, sizeof line, "%s/const.txt", db_path);
|
||||||
fp=fopen(line, "r");
|
fp=fopen(line, "r");
|
||||||
if(fp==NULL){
|
if(fp==NULL){
|
||||||
ShowError("can't read %s\n", line);
|
ShowError("can't read %s\n", line);
|
||||||
@ -10603,7 +10603,7 @@ BUILDIN_FUNC(getinventorylist)
|
|||||||
pc_setreg(sd,add_str("@inventorylist_attribute")+(j<<24),sd->status.inventory[i].attribute);
|
pc_setreg(sd,add_str("@inventorylist_attribute")+(j<<24),sd->status.inventory[i].attribute);
|
||||||
for (k = 0; k < MAX_SLOTS; k++)
|
for (k = 0; k < MAX_SLOTS; k++)
|
||||||
{
|
{
|
||||||
sprintf(card_var, "@inventorylist_card%d",k+1);
|
snprintf(card_var, sizeof card_var, "@inventorylist_card%d",k+1);
|
||||||
pc_setreg(sd,add_str(card_var)+(j<<24),sd->status.inventory[i].card[k]);
|
pc_setreg(sd,add_str(card_var)+(j<<24),sd->status.inventory[i].card[k]);
|
||||||
}
|
}
|
||||||
pc_setreg(sd,add_str("@inventorylist_expire")+(j<<24),sd->status.inventory[i].expire_time);
|
pc_setreg(sd,add_str("@inventorylist_expire")+(j<<24),sd->status.inventory[i].expire_time);
|
||||||
|
@ -194,9 +194,9 @@ int impossible_trade_check(struct map_session_data *sd)
|
|||||||
index = sd->deal.item[i].index;
|
index = sd->deal.item[i].index;
|
||||||
if (inventory[index].amount < sd->deal.item[i].amount)
|
if (inventory[index].amount < sd->deal.item[i].amount)
|
||||||
{ // if more than the player have -> hack
|
{ // if more than the player have -> hack
|
||||||
sprintf(message_to_gm, msg_txt(538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has.
|
snprintf(message_to_gm, sizeof message_to_gm, msg_txt(538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has.
|
||||||
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message_to_gm);
|
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message_to_gm);
|
||||||
sprintf(message_to_gm, msg_txt(539), inventory[index].amount, inventory[index].nameid, sd->deal.item[i].amount); // This player has %d of a kind of item (id: %d), and try to trade %d of them.
|
snprintf(message_to_gm, sizeof message_to_gm, msg_txt(539), inventory[index].amount, inventory[index].nameid, sd->deal.item[i].amount); // This player has %d of a kind of item (id: %d), and try to trade %d of them.
|
||||||
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message_to_gm);
|
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message_to_gm);
|
||||||
// if we block people
|
// if we block people
|
||||||
if (battle_config.ban_hack_trade < 0) {
|
if (battle_config.ban_hack_trade < 0) {
|
||||||
@ -209,7 +209,7 @@ int impossible_trade_check(struct map_session_data *sd)
|
|||||||
chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, 0, battle_config.ban_hack_trade, 0); // type: 2 - ban (year, month, day, hour, minute, second)
|
chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, 0, battle_config.ban_hack_trade, 0); // type: 2 - ban (year, month, day, hour, minute, second)
|
||||||
set_eof(sd->fd); // forced to disconnect because of the hack
|
set_eof(sd->fd); // forced to disconnect because of the hack
|
||||||
// message about the ban
|
// message about the ban
|
||||||
sprintf(message_to_gm, msg_txt(507), battle_config.ban_hack_trade); // This player has been banned for %d minute(s).
|
snprintf(message_to_gm, sizeof message_to_gm, msg_txt(507), battle_config.ban_hack_trade); // This player has been banned for %d minute(s).
|
||||||
} else
|
} else
|
||||||
// message about the ban
|
// message about the ban
|
||||||
strcpy(message_to_gm, msg_txt(508)); // This player hasn't been banned (Ban option is disabled).
|
strcpy(message_to_gm, msg_txt(508)); // This player hasn't been banned (Ban option is disabled).
|
||||||
|
@ -180,7 +180,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int cid, const ui
|
|||||||
if( battle_config.buyer_name )
|
if( battle_config.buyer_name )
|
||||||
{
|
{
|
||||||
char temp[256];
|
char temp[256];
|
||||||
sprintf(temp, msg_txt(265), sd->status.name);
|
snprintf(temp, sizeof temp, msg_txt(265), sd->status.name);
|
||||||
clif_disp_onlyself(vsd,temp,strlen(temp));
|
clif_disp_onlyself(vsd,temp,strlen(temp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1753,13 +1753,13 @@ Dhp__CreateFiles(
|
|||||||
#endif
|
#endif
|
||||||
timestamp[LEN_TIMESTAMP] = '\0';
|
timestamp[LEN_TIMESTAMP] = '\0';
|
||||||
|
|
||||||
sprintf(out_logFileName, "%s%s.rpt", baseFileName, timestamp);
|
snprintf(out_logFileName, sizeof out_logFileName, "%s%s.rpt", baseFileName, timestamp);
|
||||||
fp = fopen(out_logFileName, "w");
|
fp = fopen(out_logFileName, "w");
|
||||||
if( fp == NULL )
|
if( fp == NULL )
|
||||||
return FALSE; // failed to create log file
|
return FALSE; // failed to create log file
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
sprintf(out_dmpFileName, "%s%s.dmp", baseFileName, timestamp);
|
snprintf(out_dmpFileName, sizeof out_dmpFileName, "%s%s.dmp", baseFileName, timestamp);
|
||||||
fp = fopen(out_dmpFileName, "w");
|
fp = fopen(out_dmpFileName, "w");
|
||||||
if( fp == NULL)
|
if( fp == NULL)
|
||||||
return FALSE; // failed to create dump file
|
return FALSE; // failed to create dump file
|
||||||
|
@ -104,7 +104,7 @@ void sig_dump(int sn)
|
|||||||
crash_flag = 1;
|
crash_flag = 1;
|
||||||
// search for a usable filename
|
// search for a usable filename
|
||||||
do {
|
do {
|
||||||
sprintf (file, "log/%s%04d.stackdump", server_name, ++no);
|
snprintf(file, sizeof file, "log/%s%04d.stackdump", server_name, ++no);
|
||||||
} while((fp = fopen(file,"r")) && (fclose(fp), no < 9999));
|
} while((fp = fopen(file,"r")) && (fclose(fp), no < 9999));
|
||||||
// dump the trace into the file
|
// dump the trace into the file
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ int grfio_size(char* fname)
|
|||||||
FILELIST lentry;
|
FILELIST lentry;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
sprintf(lfname, "%s%s", data_dir, fname);
|
snprintf(lfname, sizeof lfname, "%s%s", data_dir, fname);
|
||||||
|
|
||||||
for (p = &lfname[0]; *p != 0; p++)
|
for (p = &lfname[0]; *p != 0; p++)
|
||||||
if (*p=='\\') *p = '/';
|
if (*p=='\\') *p = '/';
|
||||||
@ -435,7 +435,7 @@ void* grfio_reads(char* fname, int* size)
|
|||||||
char lfname[256], *p;
|
char lfname[256], *p;
|
||||||
FILELIST lentry;
|
FILELIST lentry;
|
||||||
|
|
||||||
sprintf(lfname, "%s%s", data_dir, fname);
|
snprintf(lfname, sizeof lfname, "%s%s", data_dir, fname);
|
||||||
|
|
||||||
for (p = &lfname[0]; *p != 0; p++)
|
for (p = &lfname[0]; *p != 0; p++)
|
||||||
if (*p == '\\') *p = '/';
|
if (*p == '\\') *p = '/';
|
||||||
@ -697,7 +697,7 @@ static void grfio_resourcecheck(void)
|
|||||||
FILE* fp;
|
FILE* fp;
|
||||||
|
|
||||||
// read resnametable from data directory and return if successful
|
// read resnametable from data directory and return if successful
|
||||||
sprintf(restable, "%sdata\\resnametable.txt", data_dir);
|
snprintf(restable, sizeof restable, "%sdata\\resnametable.txt", data_dir);
|
||||||
for (ptr = &restable[0]; *ptr != 0; ptr++)
|
for (ptr = &restable[0]; *ptr != 0; ptr++)
|
||||||
if (*ptr == '\\') *ptr = '/';
|
if (*ptr == '\\') *ptr = '/';
|
||||||
|
|
||||||
@ -709,8 +709,8 @@ static void grfio_resourcecheck(void)
|
|||||||
// we only need the maps' GAT and RSW files
|
// we only need the maps' GAT and RSW files
|
||||||
(strstr(w2, ".gat") || strstr(w2, ".rsw")))
|
(strstr(w2, ".gat") || strstr(w2, ".rsw")))
|
||||||
{
|
{
|
||||||
sprintf(src, "data\\%s", w1);
|
snprintf(src, sizeof src, "data\\%s", w1);
|
||||||
sprintf(dst, "data\\%s", w2);
|
snprintf(dst, sizeof dst, "data\\%s", w2);
|
||||||
entry = filelist_find(dst);
|
entry = filelist_find(dst);
|
||||||
// create new entries reusing the original's info
|
// create new entries reusing the original's info
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
@ -736,8 +736,8 @@ static void grfio_resourcecheck(void)
|
|||||||
if (sscanf(ptr, "%[^#]#%[^#]#", w1, w2) == 2 &&
|
if (sscanf(ptr, "%[^#]#%[^#]#", w1, w2) == 2 &&
|
||||||
(strstr(w2, ".gat") || strstr(w2, ".rsw")))
|
(strstr(w2, ".gat") || strstr(w2, ".rsw")))
|
||||||
{
|
{
|
||||||
sprintf(src, "data\\%s", w1);
|
snprintf(src, sizeof src, "data\\%s", w1);
|
||||||
sprintf(dst, "data\\%s", w2);
|
snprintf(dst, sizeof dst, "data\\%s", w2);
|
||||||
entry = filelist_find(dst);
|
entry = filelist_find(dst);
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
FILELIST fentry;
|
FILELIST fentry;
|
||||||
|
@ -112,13 +112,13 @@ int read_map(char *name, struct map_data *m)
|
|||||||
uint32 type;
|
uint32 type;
|
||||||
|
|
||||||
// Open map GAT
|
// Open map GAT
|
||||||
sprintf(filename,"data\\%s.gat", name);
|
snprintf(filename,sizeof filename,"data\\%s.gat", name);
|
||||||
gat = (unsigned char *)grfio_read(filename);
|
gat = (unsigned char *)grfio_read(filename);
|
||||||
if (gat == NULL)
|
if (gat == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Open map RSW
|
// Open map RSW
|
||||||
sprintf(filename,"data\\%s.rsw", name);
|
snprintf(filename,sizeof filename,"data\\%s.rsw", name);
|
||||||
rsw = (unsigned char *)grfio_read(filename);
|
rsw = (unsigned char *)grfio_read(filename);
|
||||||
|
|
||||||
// Read water height
|
// Read water height
|
||||||
|
Loading…
x
Reference in New Issue
Block a user