summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-22 18:19:11 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-22 18:19:11 +0000
commit86419b56c3c04ee10b6c58906124a471b9853d8b (patch)
tree4c5e26d179d09370318bcf4ac0cad45e4927008b /src
parent93344af48f44a7a3e535831318fe9c991a015ed4 (diff)
downloadhercules-86419b56c3c04ee10b6c58906124a471b9853d8b.tar.gz
hercules-86419b56c3c04ee10b6c58906124a471b9853d8b.tar.bz2
hercules-86419b56c3c04ee10b6c58906124a471b9853d8b.tar.xz
hercules-86419b56c3c04ee10b6c58906124a471b9853d8b.zip
* Removed code in socket.c that tries to avoid send buffer overloading, as there is a scenario (many players and charserver disconnect) where mass char saving produces huge ammounts of data to send (see r11503)
* Cleaned up player respawning code (bugreport:1022) * Increased the max amount of different autocast skills from 5 to 10 * Added a missing function declaration, for real this time (followup to r12229) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12232 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/common/socket.c12
-rw-r--r--src/map/clif.c18
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/pc.c73
5 files changed, 45 insertions, 61 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index 995aabedb..b7d99fd6f 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -528,7 +528,6 @@ static int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseF
session[fd]->func_send = func_send;
session[fd]->func_parse = func_parse;
session[fd]->rdata_tick = last_tick;
- session[fd]->session_data = NULL;
return 0;
}
@@ -584,17 +583,6 @@ int realloc_writefifo(int fd, size_t addition)
else // no change
return 0;
- // crash prevention for bugs that cause the send queue to fill up in an infinite loop
- if( newsize > 5*1024*1024 ) // 5 MB is way beyond reasonable
- {
- ShowError("realloc_writefifo: session #%d's send buffer was overloaded! Disconnecting...\n", fd);
- // drop all data (but the space will still be available)
- session[fd]->wdata_size = 0;
- // request disconnect
- set_eof(fd);
- return 0;
- }
-
RECREATE(session[fd]->wdata, unsigned char, newsize);
session[fd]->max_wdata = newsize;
diff --git a/src/map/clif.c b/src/map/clif.c
index a2dfe6b35..a71cc132e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -642,8 +642,8 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd)
* id : the id of the unit
* type: 0 - moved out of sight
* 1 - died
- * 2 - logged out
- * 3 - teleported / winged away
+ * 2 - respawned
+ * 3 - teleported / logged out
* fd : the target client
*------------------------------------------*/
int clif_clearunit_single(int id, uint8 type, int fd)
@@ -661,8 +661,8 @@ int clif_clearunit_single(int id, uint8 type, int fd)
* make a unit (char, npc, mob, homun) disappear to all clients in area
* type: 0 - moved out of sight
* 1 - died
- * 2 - logged out
- * 3 - teleported / winged away
+ * 2 - respawned
+ * 3 - teleported / logged out
*------------------------------------------*/
int clif_clearunit_area(struct block_list* bl, uint8 type)
{
@@ -7187,8 +7187,7 @@ int clif_charnameack (int fd, struct block_list *bl)
if (battle_config.show_mob_info&1)
str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp);
if (battle_config.show_mob_info&2)
- str_p += sprintf(str_p, "HP: %d%% | ",
- status_calc_life(md->status.hp, md->status.max_hp));
+ str_p += sprintf(str_p, "HP: %d%% | ", status_calc_life(md->status.hp, md->status.max_hp));
//Even thought mobhp ain't a name, we send it as one so the client
//can parse it. [Skotlex]
if (str_p != mobhp) {
@@ -8362,12 +8361,7 @@ void clif_parse_Restart(int fd, struct map_session_data *sd)
{
switch(RFIFOB(fd,2)) {
case 0x00:
- if (!pc_isdead(sd))
- break;
- pc_setstand(sd);
- pc_setrestartvalue(sd, 3);
- if (pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 2))
- clif_resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet.
+ pc_respawn(sd,2);
break;
case 0x01:
/* Rovert's Prevent logout option - Fixed [Valaris] */
diff --git a/src/map/clif.h b/src/map/clif.h
index bc255097f..0cd72580b 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -295,6 +295,7 @@ int clif_hpmeter(struct map_session_data *sd);
// guild
int clif_guild_created(struct map_session_data *sd,int flag);
int clif_guild_belonginfo(struct map_session_data *sd,struct guild *g);
+int clif_guild_masterormember(struct map_session_data *sd);
int clif_guild_basicinfo(struct map_session_data *sd);
int clif_guild_allianceinfo(struct map_session_data *sd);
int clif_guild_memberlist(struct map_session_data *sd);
diff --git a/src/map/map.h b/src/map/map.h
index 269319ab8..6dcdb9ba2 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -674,7 +674,7 @@ struct map_session_data {
struct s_autoscript {
unsigned short rate, flag;
struct script_code *script;
- } autoscript[5], autoscript2[5]; //Auto script on attack, when attacked
+ } autoscript[10], autoscript2[10]; //Auto script on attack, when attacked
// manually zeroed structures end here.
// zeroed vars start here.
int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
diff --git a/src/map/pc.c b/src/map/pc.c
index 57f68f201..24e7be3b9 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4735,17 +4735,21 @@ int pc_skillheal_bonus(struct map_session_data *sd, int skill_num)
return 0;
}
-static int pc_respawn(int tid,unsigned int tick,int id,int data)
+void pc_respawn(struct map_session_data* sd, uint8 clrtype)
{
- struct map_session_data *sd = map_id2sd(id);
- if (sd && pc_isdead(sd))
- { //Auto-respawn [Skotlex]
- pc_setstand(sd);
- pc_setrestartvalue(sd,3);
- if(pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 0))
- clif_resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet.
+ if( !pc_isdead(sd) )
+ return; // not applicable
- }
+ pc_setstand(sd);
+ pc_setrestartvalue(sd,3);
+ if(pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, clrtype))
+ clif_resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet.
+}
+
+static int pc_respawn_timer(int tid,unsigned int tick,int id,int data)
+{
+ struct map_session_data *sd = map_id2sd(id);
+ pc_respawn(sd,0);
return 0;
}
@@ -5064,13 +5068,13 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
}
if( sd->pvp_point < 0 ){
sd->pvp_point=0;
- add_timer(tick+1000, pc_respawn,sd->bl.id,0);
+ add_timer(tick+1000, pc_respawn_timer,sd->bl.id,0);
return 1;
}
}
//GvG
if(map_flag_gvg(sd->bl.m)){
- add_timer(tick+1000, pc_respawn,sd->bl.id,0);
+ add_timer(tick+1000, pc_respawn_timer,sd->bl.id,0);
return 1;
}
@@ -6807,41 +6811,38 @@ int pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y)
}
/*==========================================
- * 自動セ?ブ 各クライアント
- *------------------------------------------*/
-static int last_save_id=0,save_flag=0;
-static int pc_autosave_sub(DBKey key,void * data,va_list ap)
-{
- struct map_session_data *sd = (TBL_PC*)data;
-
- if(sd->bl.id == last_save_id && save_flag != 1) {
- save_flag = 1;
- return 1;
- }
-
- if(save_flag != 1) //Not our turn to save yet.
- return 0;
-
- //Save char.
- last_save_id = sd->bl.id;
- save_flag=2;
-
- chrif_save(sd,0);
- return 1;
-}
-
-/*==========================================
* 自動セ?ブ (timer??)
*------------------------------------------*/
int pc_autosave(int tid,unsigned int tick,int id,int data)
{
int interval;
+ struct s_mapiterator* iter;
+ struct map_session_data* sd;
+ static int last_save_id = 0, save_flag = 0;
if(save_flag == 2) //Someone was saved on last call, normal cycle
save_flag = 0;
else
save_flag = 1; //Noone was saved, so save first found char.
- map_foreachpc(pc_autosave_sub);
+
+ iter = mapit_getallusers();
+ for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
+ {
+ if(sd->bl.id == last_save_id) {
+ save_flag = 1;
+ continue;
+ }
+
+ if(save_flag != 1) //Not our turn to save yet.
+ continue;
+
+ //Save char.
+ last_save_id = sd->bl.id;
+ save_flag = 2;
+
+ chrif_save(sd,0);
+ }
+ mapit_free(iter);
interval = autosave_interval/(clif_countusers()+1);
if(interval < minsave_interval)