diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-09 00:49:38 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-09 00:49:38 +0000 |
commit | ef008fd94916820f82d765a48d8502cbba974ce1 (patch) | |
tree | dc2b61021b521ea9745b795aa632b37cc9d80519 | |
parent | 780c68710e643b16c3751793d89433264152f21f (diff) | |
download | hercules-ef008fd94916820f82d765a48d8502cbba974ce1.tar.gz hercules-ef008fd94916820f82d765a48d8502cbba974ce1.tar.bz2 hercules-ef008fd94916820f82d765a48d8502cbba974ce1.tar.xz hercules-ef008fd94916820f82d765a48d8502cbba974ce1.zip |
- Crash-protections in the mail-checking function.
- Changed a bunch of msg_table use into msg_txt in atcommand.c, there's still a lot left... am not feeling inspired to finish this >.<
- Some additional parenthesis on equipment check in pc_equipitem, seems to have fixed the mid/lower headgear-sprites not showing up.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8195 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 3 | ||||
-rw-r--r-- | src/map/atcommand.c | 72 | ||||
-rw-r--r-- | src/map/mail.c | 17 | ||||
-rw-r--r-- | src/map/pc.c | 4 |
4 files changed, 48 insertions, 48 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 0cf66568d..28206f9c5 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/08/08
+ * Crash-protections in the mail-checking function. [Skotlex]
+ * Some additional parenthesis on equipment check in pc_equipitem, seems to
+ have fixed the mid/lower headgear-sprites not showing up. [Skotlex]
* Added back missing state set to prevent Ankle-Snare from being retrieved
after the target dies. [Skotlex]
* Fixed compilation warning [Toms]
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 1da8be43b..b740c4675 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -809,7 +809,7 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int if (map[sd->bl.m].flag.nocommand &&
(gmlvl > 0? gmlvl:pc_isGM(sd)) < battle_config.gm_skilluncond)
{ //Command not allowed on this map.
- sprintf(atcmd_output, msg_table[143]);
+ sprintf(atcmd_output, msg_txt(143));
clif_displaymessage(fd, atcmd_output);
return AtCommand_None;
}
@@ -828,12 +828,12 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int p++;
if (type == AtCommand_Unknown || info.proc == NULL) {
- sprintf(atcmd_output, msg_table[153], command); // %s is Unknown Command.
+ sprintf(atcmd_output, msg_txt(153), command); // %s is Unknown Command.
clif_displaymessage(fd, atcmd_output);
} else {
if (info.proc(fd, sd, command, p) != 0) {
// Command can not be executed
- sprintf(atcmd_output, msg_table[154], command); // %s failed.
+ sprintf(atcmd_output, msg_txt(154), command); // %s failed.
clif_displaymessage(fd, atcmd_output);
}
}
@@ -1267,10 +1267,10 @@ int atcommand_send( }
}
- sprintf (atcmd_output, msg_table[258], type, type);
+ sprintf (atcmd_output, msg_txt(258), type, type);
clif_displaymessage(fd, atcmd_output);
} else {
- clif_displaymessage(fd, msg_table[259]);
+ clif_displaymessage(fd, msg_txt(259));
}
return 0;
@@ -1310,26 +1310,26 @@ int atcommand_rura( m = map_mapindex2mapid(mapindex);
if (!mapindex || m < 0) {
- clif_displaymessage(fd, msg_table[1]); // Map not found.
+ clif_displaymessage(fd, msg_txt(1)); // Map not found.
return -1;
}
if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS)) {
- clif_displaymessage(fd, msg_table[2]);
+ clif_displaymessage(fd, msg_txt(2));
x = y = 0; //Invalid cell, use random spot.
}
if (map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
- clif_displaymessage(fd, msg_table[247]);
+ clif_displaymessage(fd, msg_txt(247));
return -1;
}
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
- clif_displaymessage(fd, msg_table[248]);
+ clif_displaymessage(fd, msg_txt(248));
return -1;
}
if (pc_setpos(sd, mapindex, x, y, 3) == 0)
- clif_displaymessage(fd, msg_table[0]); // Warped.
+ clif_displaymessage(fd, msg_txt(0)); // Warped.
else {
- clif_displaymessage(fd, msg_table[1]); // Map not found.
+ clif_displaymessage(fd, msg_txt(1)); // Map not found.
return -1;
}
@@ -1405,18 +1405,18 @@ int atcommand_jumpto( if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) {
if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
- clif_displaymessage(fd, msg_table[247]);
+ clif_displaymessage(fd, msg_txt(247));
return -1;
}
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
- clif_displaymessage(fd, msg_table[248]);
+ clif_displaymessage(fd, msg_txt(248));
return -1;
}
pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, 3);
- sprintf(atcmd_output, msg_table[4], atcmd_player_name); // Jump to %s
+ sprintf(atcmd_output, msg_txt(4), atcmd_player_name); // Jump to %s
clif_displaymessage(fd, atcmd_output);
} else {
- clif_displaymessage(fd, msg_table[3]); // Character not found.
+ clif_displaymessage(fd, msg_txt(3)); // Character not found.
return -1;
}
@@ -1444,11 +1444,11 @@ int atcommand_jump( if (y <= 0)
y = -1;
if (sd->bl.m >= 0 && (map[sd->bl.m].flag.nowarp || map[sd->bl.m].flag.nowarpto) && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
- clif_displaymessage(fd, msg_table[248]);
+ clif_displaymessage(fd, msg_txt(248));
return -1;
}
pc_setpos(sd, sd->mapindex, x, y, 3);
- sprintf(atcmd_output, msg_table[5], sd->bl.x, sd->bl.y); // Jump to %d %d
+ sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jump to %d %d
clif_displaymessage(fd, atcmd_output);
return 0;
}
@@ -1517,11 +1517,11 @@ int atcommand_who3( }
if (count == 0)
- clif_displaymessage(fd, msg_table[28]); // No player found.
+ clif_displaymessage(fd, msg_txt(28)); // No player found.
else if (count == 1)
- clif_displaymessage(fd, msg_table[29]); // 1 player found.
+ clif_displaymessage(fd, msg_txt(29)); // 1 player found.
else {
- sprintf(atcmd_output, msg_table[30], count); // %d players found.
+ sprintf(atcmd_output, msg_txt(30), count); // %d players found.
clif_displaymessage(fd, atcmd_output);
}
@@ -1787,11 +1787,11 @@ int atcommand_whomap2( }
if (count == 0)
- sprintf(atcmd_output, msg_table[54], map[map_id].name); // No player found in map '%s'.
+ sprintf(atcmd_output, msg_txt(54), map[map_id].name); // No player found in map '%s'.
else if (count == 1)
- sprintf(atcmd_output, msg_table[55], map[map_id].name); // 1 player found in map '%s'.
+ sprintf(atcmd_output, msg_txt(55), map[map_id].name); // 1 player found in map '%s'.
else {
- sprintf(atcmd_output, msg_table[56], count, map[map_id].name); // %d players found in map '%s'.
+ sprintf(atcmd_output, msg_txt(56), count, map[map_id].name); // %d players found in map '%s'.
}
clif_displaymessage(fd, atcmd_output);
@@ -1942,11 +1942,11 @@ int atcommand_whogm( }
if (count == 0)
- clif_displaymessage(fd, msg_table[150]); // No GM found.
+ clif_displaymessage(fd, msg_txt(150)); // No GM found.
else if (count == 1)
- clif_displaymessage(fd, msg_table[151]); // 1 GM found.
+ clif_displaymessage(fd, msg_txt(151)); // 1 GM found.
else {
- sprintf(atcmd_output, msg_table[152], count); // %d GMs found.
+ sprintf(atcmd_output, msg_txt(152), count); // %d GMs found.
clif_displaymessage(fd, atcmd_output);
}
@@ -1979,7 +1979,7 @@ int atcommand_whozeny( pl_allsd = map_getallusers(&users);
if (users < 1)
{
- clif_displaymessage(fd, msg_table[28]); // No player found.
+ clif_displaymessage(fd, msg_txt(28)); // No player found.
return 0;
}
zeny = (int *)aMallocA(users*sizeof(int));
@@ -2016,11 +2016,11 @@ int atcommand_whozeny( }
if (count == 0)
- clif_displaymessage(fd, msg_table[28]); // No player found.
+ clif_displaymessage(fd, msg_txt(28)); // No player found.
else if (count == 1)
- clif_displaymessage(fd, msg_table[29]); // 1 player found.
+ clif_displaymessage(fd, msg_txt(29)); // 1 player found.
else {
- sprintf(atcmd_output, msg_table[30], count); // %d players found.
+ sprintf(atcmd_output, msg_txt(30), count); // %d players found.
clif_displaymessage(fd, atcmd_output);
}
@@ -2071,7 +2071,7 @@ int atcommand_save( chrif_save(sd,0);
- clif_displaymessage(fd, msg_table[6]); // Character data respawn point saved.
+ clif_displaymessage(fd, msg_txt(6)); // Character data respawn point saved.
return 0;
}
@@ -2090,16 +2090,16 @@ int atcommand_load( m = map_mapindex2mapid(sd->status.save_point.map);
if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
- clif_displaymessage(fd, msg_table[249]);
+ clif_displaymessage(fd, msg_txt(249));
return -1;
}
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
- clif_displaymessage(fd, msg_table[248]);
+ clif_displaymessage(fd, msg_txt(248));
return -1;
}
pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 0);
- clif_displaymessage(fd, msg_table[7]); // Warping to respawn point.
+ clif_displaymessage(fd, msg_txt(7)); // Warping to respawn point.
return 0;
}
@@ -2128,7 +2128,7 @@ int atcommand_speed( if (speed >= MIN_WALK_SPEED && speed <= MAX_WALK_SPEED) {
sd->base_status.speed = speed;
status_calc_bl(&sd->bl, SCB_SPEED);
- clif_displaymessage(fd, msg_table[8]); // Speed changed.
+ clif_displaymessage(fd, msg_txt(8)); // Speed changed.
} else {
sprintf(atcmd_output, "Please, enter a valid speed value (usage: @speed <%d-%d>).", MIN_WALK_SPEED, MAX_WALK_SPEED);
clif_displaymessage(fd, atcmd_output);
@@ -6681,7 +6681,7 @@ int atcommand_jailtime( //Get remaining jail time
get_jail_time(sd->sc.data[SC_JAILED].val1,&year,&month,&day,&hour,&minute);
- sprintf(atcmd_output,msg_table[402],"You will remain",year,month,day,hour,minute); // You will remain in jail for %d years, %d months, %d days, %d hours and %d minutes
+ sprintf(atcmd_output,msg_txt(402),"You will remain",year,month,day,hour,minute); // You will remain in jail for %d years, %d months, %d days, %d hours and %d minutes
clif_displaymessage(fd, atcmd_output);
diff --git a/src/map/mail.c b/src/map/mail.c index 353ddd2d6..316bc9c18 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -43,7 +43,7 @@ int mail_timer; int mail_check(struct map_session_data *sd,int type)
{
int i = 0, new_ = 0, priority = 0;
- char message[50];
+ char message[80];
nullpo_retr (0, sd);
@@ -82,20 +82,17 @@ int mail_check(struct map_session_data *sd,int type) priority++;
if(type==2 || type==3) {
if(atoi(mail_row[4])) {
- //sprintf(message, "%d - From : %s (New - Priority)", i, mail_row[2]);
- sprintf(message, msg_txt(511), i, mail_row[2]);
-
- clif_displaymessage(sd->fd, jstrescape(message));
+ snprintf(message, 80, msg_txt(511), i, mail_row[2]);
+ clif_displaymessage(sd->fd, message);
} else {
//sprintf(message, "%d - From : %s (New)", i, mail_row[2]);
- sprintf(message, msg_txt(512), i, mail_row[2]);
- clif_displaymessage(sd->fd, jstrescape(message));
+ snprintf(message, 80, msg_txt(512), i, mail_row[2]);
+ clif_displaymessage(sd->fd, message);
}
}
} else if(type==2){
- //sprintf(message, "%d - From : %s", i, mail_row[2]);
- sprintf(message, msg_txt(513), i, mail_row[2]);
- clif_displaymessage(sd->fd, jstrescape(message));
+ snprintf(message, 80, msg_txt(513), i, mail_row[2]);
+ clif_displaymessage(sd->fd, message);
}
}
diff --git a/src/map/pc.c b/src/map/pc.c index 4c5046b4d..657254906 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6299,7 +6299,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) //Added check to prevent sending the same look on multiple slots -> //causes client to redraw item on top of itself. (suggested by Lupus) if(pos & EQP_HEAD_LOW) { - if(sd->inventory_data[n] && !pos&(EQP_HEAD_TOP|EQP_HEAD_MID)) + if(sd->inventory_data[n] && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID))) sd->status.head_bottom = sd->inventory_data[n]->look; else sd->status.head_bottom = 0; @@ -6313,7 +6313,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); } if(pos & EQP_HEAD_MID) { - if(sd->inventory_data[n] && !pos&EQP_HEAD_TOP) + if(sd->inventory_data[n] && !(pos&EQP_HEAD_TOP)) sd->status.head_mid = sd->inventory_data[n]->look; else sd->status.head_mid = 0; |