The new functions now clear junk from the output buffer, this simplifies the code a bit.
Added a TODO for one emblem loading problem/crash. git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10969 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
45824e44b5
commit
bc31c68ad5
@ -3,6 +3,8 @@ Date Added
|
|||||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
|
2007/08/09
|
||||||
|
* The new functions now clear junk from the output buffer [ultramage]
|
||||||
2007/08/08
|
2007/08/08
|
||||||
* Moved damage logging to mob_log_damage, now non-damage targetted (or
|
* Moved damage logging to mob_log_damage, now non-damage targetted (or
|
||||||
splash) skills also get logged into the monster's 'damage history' which
|
splash) skills also get logged into the monster's 'damage history' which
|
||||||
|
@ -3451,7 +3451,7 @@ int parse_char(int fd)
|
|||||||
WFIFOHEAD(fd,28);
|
WFIFOHEAD(fd,28);
|
||||||
WFIFOW(fd,0) = 0x71;
|
WFIFOW(fd,0) = 0x71;
|
||||||
WFIFOL(fd,2) = cd->char_id;
|
WFIFOL(fd,2) = cd->char_id;
|
||||||
safestrncpy((char*)WFIFOP(fd,6), mapindex_getmapname_ext(mapindex_id2name(cd->last_point.map),NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(mapindex_id2name(cd->last_point.map), (char*)WFIFOP(fd,6));
|
||||||
{
|
{
|
||||||
// Advanced subnet check [LuzZza]
|
// Advanced subnet check [LuzZza]
|
||||||
uint32 subnet_map_ip;
|
uint32 subnet_map_ip;
|
||||||
|
@ -3187,7 +3187,7 @@ int parse_char(int fd)
|
|||||||
WFIFOHEAD(fd,28);
|
WFIFOHEAD(fd,28);
|
||||||
WFIFOW(fd,0) = 0x71;
|
WFIFOW(fd,0) = 0x71;
|
||||||
WFIFOL(fd,2) = char_dat.char_id;
|
WFIFOL(fd,2) = char_dat.char_id;
|
||||||
safestrncpy((char*)WFIFOP(fd,6), mapindex_getmapname_ext(mapindex_id2name(char_dat.last_point.map),NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(mapindex_id2name(char_dat.last_point.map), (char*)WFIFOP(fd,6));
|
||||||
{
|
{
|
||||||
// Advanced subnet check [LuzZza]
|
// Advanced subnet check [LuzZza]
|
||||||
uint32 subnet_map_ip;
|
uint32 subnet_map_ip;
|
||||||
|
@ -441,6 +441,7 @@ struct guild * inter_guild_fromsql(int guild_id)
|
|||||||
strncpy(g->mes2,sql_row[10],119);
|
strncpy(g->mes2,sql_row[10],119);
|
||||||
g->emblem_len=atoi(sql_row[11]);
|
g->emblem_len=atoi(sql_row[11]);
|
||||||
g->emblem_id=atoi(sql_row[12]);
|
g->emblem_id=atoi(sql_row[12]);
|
||||||
|
//FIXME: check for sql_row[13]==NULL, just in case
|
||||||
for(i=0,pstr=sql_row[13],pEmblemData=g->emblem_data; i < g->emblem_len; i++,pstr+=2){
|
for(i=0,pstr=sql_row[13],pEmblemData=g->emblem_data; i < g->emblem_len; i++,pstr+=2){
|
||||||
int c1=pstr[0],c2=pstr[1],x1=0,x2=0;
|
int c1=pstr[0],c2=pstr[1],x1=0,x2=0;
|
||||||
if(c1>='0' && c1<='9')
|
if(c1>='0' && c1<='9')
|
||||||
|
@ -39,7 +39,8 @@ const char* mapindex_getmapname(const char* string, char* output)
|
|||||||
len -= 4; // strip .gat extension
|
len -= 4; // strip .gat extension
|
||||||
|
|
||||||
len = min(len, MAP_NAME_LENGTH-1);
|
len = min(len, MAP_NAME_LENGTH-1);
|
||||||
safestrncpy(dest, string, len+1);
|
strncpy(dest, string, len+1);
|
||||||
|
memset(&dest[len], '\0', MAP_NAME_LENGTH-len);
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
@ -57,12 +58,14 @@ const char* mapindex_getmapname_ext(const char* string, char* output)
|
|||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
safestrncpy(dest, string, len+1);
|
strncpy(dest, string, len+1);
|
||||||
|
|
||||||
if (len < 4 || stricmp(&dest[len-4], ".gat") != 0) {
|
if (len < 4 || stricmp(&dest[len-4], ".gat") != 0) {
|
||||||
strcpy(&dest[len], ".gat");
|
strcpy(&dest[len], ".gat");
|
||||||
len += 4; // add .gat extension
|
len += 4; // add .gat extension
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(&dest[len], '\0', MAP_NAME_LENGTH_EXT-len);
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,6 @@ int chrif_changemapserver(struct map_session_data* sd, short map, int x, int y,
|
|||||||
/// R 2b06 <account_id>.L <login_id1>.L <login_id2>.L <char_id>.L <map_index>.W <x>.W <y>.W <ip>.L <port>.W
|
/// R 2b06 <account_id>.L <login_id1>.L <login_id2>.L <char_id>.L <map_index>.W <x>.W <y>.W <ip>.L <port>.W
|
||||||
int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port)
|
int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct map_session_data *sd;
|
struct map_session_data *sd;
|
||||||
sd = map_id2sd(account_id);
|
sd = map_id2sd(account_id);
|
||||||
|
|
||||||
|
@ -1189,19 +1189,19 @@ static void clif_spiritball_single(int fd, struct map_session_data *sd)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
static void clif_set0192(int fd, int m, int x, int y, int type)
|
static void clif_set0192(int fd, int m, int x, int y, int type)
|
||||||
{
|
{
|
||||||
WFIFOHEAD(fd, packet_len(0x192));
|
WFIFOHEAD(fd,packet_len(0x192));
|
||||||
WFIFOW(fd,0) = 0x192;
|
WFIFOW(fd,0) = 0x192;
|
||||||
WFIFOW(fd,2) = x;
|
WFIFOW(fd,2) = x;
|
||||||
WFIFOW(fd,4) = y;
|
WFIFOW(fd,4) = y;
|
||||||
WFIFOW(fd,6) = type;
|
WFIFOW(fd,6) = type;
|
||||||
safestrncpy((char*)WFIFOP(fd,8), mapindex_getmapname_ext(map[m].name,NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(map[m].name, (char*)WFIFOP(fd,8));
|
||||||
WFIFOSET(fd,packet_len(0x192));
|
WFIFOSET(fd,packet_len(0x192));
|
||||||
}
|
}
|
||||||
|
|
||||||
// new and improved weather display [Valaris]
|
// new and improved weather display [Valaris]
|
||||||
static void clif_weather_sub(int fd, int id, int type)
|
static void clif_weather_sub(int fd, int id, int type)
|
||||||
{
|
{
|
||||||
WFIFOHEAD(fd, packet_len(0x1f3));
|
WFIFOHEAD(fd,packet_len(0x1f3));
|
||||||
WFIFOW(fd,0) = 0x1f3;
|
WFIFOW(fd,0) = 0x1f3;
|
||||||
WFIFOL(fd,2) = id;
|
WFIFOL(fd,2) = id;
|
||||||
WFIFOL(fd,6) = type;
|
WFIFOL(fd,6) = type;
|
||||||
@ -1650,12 +1650,12 @@ void clif_changemap(struct map_session_data *sd, short map, int x, int y)
|
|||||||
nullpo_retv(sd);
|
nullpo_retv(sd);
|
||||||
fd = sd->fd;
|
fd = sd->fd;
|
||||||
|
|
||||||
WFIFOHEAD(fd, packet_len(0x91));
|
WFIFOHEAD(fd,packet_len(0x91));
|
||||||
WFIFOW(fd,0) = 0x91;
|
WFIFOW(fd,0) = 0x91;
|
||||||
safestrncpy((char*)WFIFOP(fd,2), mapindex_getmapname_ext(mapindex_id2name(map),NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(mapindex_id2name(map), (char*)WFIFOP(fd,2));
|
||||||
WFIFOW(fd,18) = x;
|
WFIFOW(fd,18) = x;
|
||||||
WFIFOW(fd,20) = y;
|
WFIFOW(fd,20) = y;
|
||||||
WFIFOSET(fd, packet_len(0x91));
|
WFIFOSET(fd,packet_len(0x91));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
@ -1667,15 +1667,14 @@ void clif_changemapserver(struct map_session_data* sd, unsigned short map_index,
|
|||||||
nullpo_retv(sd);
|
nullpo_retv(sd);
|
||||||
fd = sd->fd;
|
fd = sd->fd;
|
||||||
|
|
||||||
WFIFOHEAD(fd, packet_len(0x92));
|
WFIFOHEAD(fd,packet_len(0x92));
|
||||||
WFIFOW(fd,0) = 0x92;
|
WFIFOW(fd,0) = 0x92;
|
||||||
safestrncpy((char*)WFIFOP(fd,2), mapindex_getmapname_ext(mapindex_id2name(map_index),NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(mapindex_id2name(map_index), (char*)WFIFOP(fd,2));
|
||||||
WFIFOB(fd,17) = 0; //Null terminator for mapname
|
|
||||||
WFIFOW(fd,18) = x;
|
WFIFOW(fd,18) = x;
|
||||||
WFIFOW(fd,20) = y;
|
WFIFOW(fd,20) = y;
|
||||||
WFIFOL(fd,22) = htonl(ip);
|
WFIFOL(fd,22) = htonl(ip);
|
||||||
WFIFOW(fd,26) = ntows(htons(port)); // [!] LE byte order here [!]
|
WFIFOW(fd,26) = ntows(htons(port)); // [!] LE byte order here [!]
|
||||||
WFIFOSET(fd, packet_len(0x92));
|
WFIFOSET(fd,packet_len(0x92));
|
||||||
}
|
}
|
||||||
|
|
||||||
int clif_blown(struct block_list *bl)
|
int clif_blown(struct block_list *bl)
|
||||||
@ -4710,11 +4709,11 @@ void clif_skill_warppoint(struct map_session_data* sd, int skill_num, int skill_
|
|||||||
WFIFOW(fd,0) = 0x11c;
|
WFIFOW(fd,0) = 0x11c;
|
||||||
WFIFOW(fd,2) = skill_num;
|
WFIFOW(fd,2) = skill_num;
|
||||||
memset(WFIFOP(fd,4), 0x00, 4*MAP_NAME_LENGTH_EXT);
|
memset(WFIFOP(fd,4), 0x00, 4*MAP_NAME_LENGTH_EXT);
|
||||||
if (map1 == -1) safestrncpy((char*)WFIFOP(fd, 4), "Random", MAP_NAME_LENGTH_EXT);
|
if (map1 == -1) strcpy((char*)WFIFOP(fd,4), "Random");
|
||||||
if (map1 > 0) safestrncpy((char*)WFIFOP(fd, 4), mapindex_getmapname_ext(mapindex_id2name(map1),NULL), MAP_NAME_LENGTH_EXT);
|
if (map1 > 0) mapindex_getmapname_ext(mapindex_id2name(map1), (char*)WFIFOP(fd,4));
|
||||||
if (map2 > 0) safestrncpy((char*)WFIFOP(fd,20), mapindex_getmapname_ext(mapindex_id2name(map2),NULL), MAP_NAME_LENGTH_EXT);
|
if (map2 > 0) mapindex_getmapname_ext(mapindex_id2name(map2), (char*)WFIFOP(fd,20));
|
||||||
if (map3 > 0) safestrncpy((char*)WFIFOP(fd,36), mapindex_getmapname_ext(mapindex_id2name(map3),NULL), MAP_NAME_LENGTH_EXT);
|
if (map3 > 0) mapindex_getmapname_ext(mapindex_id2name(map3), (char*)WFIFOP(fd,36));
|
||||||
if (map4 > 0) safestrncpy((char*)WFIFOP(fd,52), mapindex_getmapname_ext(mapindex_id2name(map4),NULL), MAP_NAME_LENGTH_EXT);
|
if (map4 > 0) mapindex_getmapname_ext(mapindex_id2name(map4), (char*)WFIFOP(fd,52));
|
||||||
WFIFOSET(fd,packet_len(0x11c));
|
WFIFOSET(fd,packet_len(0x11c));
|
||||||
|
|
||||||
sd->menuskill_id = skill_num;
|
sd->menuskill_id = skill_num;
|
||||||
@ -5695,7 +5694,7 @@ int clif_party_member_info(struct party_data *p, struct map_session_data *sd)
|
|||||||
WBUFB(buf,14) = 0; //Unconfirmed byte, could be online/offline.
|
WBUFB(buf,14) = 0; //Unconfirmed byte, could be online/offline.
|
||||||
memcpy(WBUFP(buf,15), p->party.name, NAME_LENGTH);
|
memcpy(WBUFP(buf,15), p->party.name, NAME_LENGTH);
|
||||||
memcpy(WBUFP(buf,39), sd->status.name, NAME_LENGTH);
|
memcpy(WBUFP(buf,39), sd->status.name, NAME_LENGTH);
|
||||||
safestrncpy((char*)WBUFP(buf,63), mapindex_getmapname_ext(mapindex_id2name(sd->mapindex),NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(mapindex_id2name(sd->mapindex), (char*)WBUFP(buf,63));
|
||||||
WBUFB(buf,79) = (p->party.item&1)?1:0;
|
WBUFB(buf,79) = (p->party.item&1)?1:0;
|
||||||
WBUFB(buf,80) = (p->party.item&2)?1:0;
|
WBUFB(buf,80) = (p->party.item&2)?1:0;
|
||||||
clif_send(buf,packet_len(0x1e9),&sd->bl,PARTY);
|
clif_send(buf,packet_len(0x1e9),&sd->bl,PARTY);
|
||||||
@ -5726,7 +5725,7 @@ int clif_party_info(struct party_data* p, struct map_session_data *sd)
|
|||||||
|
|
||||||
WBUFL(buf,28+c*46) = m->account_id;
|
WBUFL(buf,28+c*46) = m->account_id;
|
||||||
memcpy(WBUFP(buf,28+c*46+4), m->name, NAME_LENGTH);
|
memcpy(WBUFP(buf,28+c*46+4), m->name, NAME_LENGTH);
|
||||||
safestrncpy((char*)WBUFP(buf,28+c*46+28), mapindex_getmapname_ext(mapindex_id2name(m->map),NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(mapindex_id2name(m->map), (char*)WBUFP(buf,28+c*46+28));
|
||||||
WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1;
|
WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1;
|
||||||
WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1;
|
WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1;
|
||||||
c++;
|
c++;
|
||||||
@ -6005,7 +6004,7 @@ void clif_party_move(struct party* p, struct map_session_data* sd, int online)
|
|||||||
WBUFB(buf,14) = !online;
|
WBUFB(buf,14) = !online;
|
||||||
memcpy(WBUFP(buf,15),p->name, NAME_LENGTH);
|
memcpy(WBUFP(buf,15),p->name, NAME_LENGTH);
|
||||||
memcpy(WBUFP(buf,39),sd->status.name, NAME_LENGTH);
|
memcpy(WBUFP(buf,39),sd->status.name, NAME_LENGTH);
|
||||||
safestrncpy((char*)WBUFP(buf,63), mapindex_getmapname_ext(map[sd->bl.m].name,NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(map[sd->bl.m].name, (char*)WBUFP(buf,63));
|
||||||
clif_send(buf,packet_len(0x104),&sd->bl,PARTY);
|
clif_send(buf,packet_len(0x104),&sd->bl,PARTY);
|
||||||
}
|
}
|
||||||
/*==========================================
|
/*==========================================
|
||||||
@ -6394,7 +6393,7 @@ void clif_changemapcell(short m, short x, short y, int cell_type, int type)
|
|||||||
WBUFW(buf,2) = x;
|
WBUFW(buf,2) = x;
|
||||||
WBUFW(buf,4) = y;
|
WBUFW(buf,4) = y;
|
||||||
WBUFW(buf,6) = cell_type;
|
WBUFW(buf,6) = cell_type;
|
||||||
safestrncpy((char*)WBUFP(buf,8), mapindex_getmapname_ext(map[m].name,NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(map[m].name,(char*)WBUFP(buf,8));
|
||||||
clif_send(buf,packet_len(0x192),&bl,(!type)?AREA:ALL_SAMEMAP);
|
clif_send(buf,packet_len(0x192),&bl,(!type)?AREA:ALL_SAMEMAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7754,7 +7753,7 @@ void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsig
|
|||||||
|
|
||||||
WFIFOHEAD(fd,packet_len(0x20e));
|
WFIFOHEAD(fd,packet_len(0x20e));
|
||||||
WFIFOW(fd,0) = 0x20e;
|
WFIFOW(fd,0) = 0x20e;
|
||||||
safestrncpy((char*)WFIFOP(fd,2), mapindex_getmapname_ext(mapindex_id2name(sd->feel_map[feel_level].index),NULL), MAP_NAME_LENGTH_EXT);
|
mapindex_getmapname_ext(mapindex_id2name(sd->feel_map[feel_level].index), (char*)WFIFOP(fd,2));
|
||||||
WFIFOL(fd,26) = sd->bl.id;
|
WFIFOL(fd,26) = sd->bl.id;
|
||||||
WFIFOB(fd,30) = feel_level;
|
WFIFOB(fd,30) = feel_level;
|
||||||
WFIFOB(fd,31) = type?1:0;
|
WFIFOB(fd,31) = type?1:0;
|
||||||
|
@ -185,7 +185,7 @@ static int guild_read_castledb(void)
|
|||||||
|
|
||||||
gc=(struct guild_castle *)aCalloc(1,sizeof(struct guild_castle));
|
gc=(struct guild_castle *)aCalloc(1,sizeof(struct guild_castle));
|
||||||
gc->castle_id=atoi(str[0]);
|
gc->castle_id=atoi(str[0]);
|
||||||
safestrncpy(gc->map_name,mapindex_getmapname(str[1],NULL),MAP_NAME_LENGTH);
|
mapindex_getmapname(str[1],gc->map_name);
|
||||||
safestrncpy(gc->castle_name,str[2],NAME_LENGTH);
|
safestrncpy(gc->castle_name,str[2],NAME_LENGTH);
|
||||||
safestrncpy(gc->castle_event,str[3],NAME_LENGTH);
|
safestrncpy(gc->castle_event,str[3],NAME_LENGTH);
|
||||||
|
|
||||||
|
@ -9650,10 +9650,11 @@ BUILDIN_FUNC(getcastledata)
|
|||||||
|
|
||||||
BUILDIN_FUNC(setcastledata)
|
BUILDIN_FUNC(setcastledata)
|
||||||
{
|
{
|
||||||
int index=script_getnum(st,3);
|
const char* mapname = mapindex_getmapname(script_getstr(st,2),NULL);
|
||||||
int value=script_getnum(st,4);
|
int index = script_getnum(st,3);
|
||||||
|
int value = script_getnum(st,4);
|
||||||
|
|
||||||
struct guild_castle* gc = guild_mapname2gc( mapindex_getmapname(script_getstr(st,2),NULL) );
|
struct guild_castle* gc = guild_mapname2gc(mapname);
|
||||||
|
|
||||||
if(gc) {
|
if(gc) {
|
||||||
// Save Data byself First
|
// Save Data byself First
|
||||||
|
Loading…
x
Reference in New Issue
Block a user