summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-26 09:44:10 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-26 09:44:10 +0000
commit5514b1d63acfbe0fa0e51a855679769d4f013e35 (patch)
tree6c7e084b8b95398e2e35d9ca867a6d3e2af674e5
parentcece111a565a6d53790248eaa01bf68615d3a4b1 (diff)
downloadhercules-5514b1d63acfbe0fa0e51a855679769d4f013e35.tar.gz
hercules-5514b1d63acfbe0fa0e51a855679769d4f013e35.tar.bz2
hercules-5514b1d63acfbe0fa0e51a855679769d4f013e35.tar.xz
hercules-5514b1d63acfbe0fa0e51a855679769d4f013e35.zip
Some random cleaning
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12141 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--npc/merchants/shops.txt8
-rw-r--r--npc/warps/cities/comodo.txt2
-rw-r--r--npc/warps/dungeons/odin.txt2
-rw-r--r--npc/warps/dungeons/xmas_dun.txt2
-rw-r--r--src/map/atcommand.c8
-rw-r--r--src/map/clif.c31
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/map.c59
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/party.c2
10 files changed, 44 insertions, 75 deletions
diff --git a/npc/merchants/shops.txt b/npc/merchants/shops.txt
index 57a2ca825..80438b83c 100644
--- a/npc/merchants/shops.txt
+++ b/npc/merchants/shops.txt
@@ -114,9 +114,9 @@ geffen,193,152,4 shop Pet Groomer#gef 124,537:-1,643:-1,10013:-1,10014:-1
//=======================================================
// Gonryun
//=======================================================
-gonryun,147,84,5 shop Tool Dealer 777,1750:-1,1770:-1,611:-1,501:-1,502:-1,503:-1,504:-1,506:-1,645:-1,656:-1,601:-1,602:-1,1065:-1
-gonryun,174,101,3 shop Weapon Dealer 774,1207:-1,1216:-1,1107:-1,1122:-1,1116:-1,1154:-1,1407:-1,1457:-1,1354:-1,1519:-1
-gonryun,173,84,3 shop Armor Dealer 770,2211:-1,2401:-1,2403:-1,2501:-1,2503:-1,2101:-1,2103:-1,2305:-1,2321:-1,2332:-1,2328:-1,2627:-1
+gonryun,147,84,5 shop Tool Dealer#gon 777,1750:-1,1770:-1,611:-1,501:-1,502:-1,503:-1,504:-1,506:-1,645:-1,656:-1,601:-1,602:-1,1065:-1
+gonryun,174,101,3 shop Weapon Dealer#gon 774,1207:-1,1216:-1,1107:-1,1122:-1,1116:-1,1154:-1,1407:-1,1457:-1,1354:-1,1519:-1
+gonryun,173,84,3 shop Armor Dealer#gon 770,2211:-1,2401:-1,2403:-1,2501:-1,2503:-1,2101:-1,2103:-1,2305:-1,2321:-1,2332:-1,2328:-1,2627:-1
//=======================================================
// Hugel
@@ -136,7 +136,7 @@ izlude_in,60,127,4 shop Weapon Dealer#iz 72,1750:-1,1751:-1,1701:-1,1601:-1,1201
izlude_in,70,127,4 shop Armor Dealer#iz 62,2103:-1,2105:-1,2403:-1,2405:-1,2503:-1,2505:-1,2226:-1,2228:-1,2303:-1,2305:-1,2328:-1,2307:-1,2309:-1,2312:-1,2314:-1,2316:-1,2628:-1
izlude_in,115,61,0 shop Tool Dealer#iz 47,611:-1,501:-1,502:-1,503:-1,504:-1,506:-1,645:-1,656:-1,601:-1,602:-1,1065:-1,1750:-1
izlude,105,99,0 shop Butcher#iz 54,517:-1
-izlude,94,98,4 shop Fruit Gardene#izr 53,512:-1,513:-1,515:-1,516:-1
+izlude,94,98,4 shop Fruit Gardene#iz 53,512:-1,513:-1,515:-1,516:-1
izlude,105,92,7 shop Vendor from Milk Ranch#i 90,519:-1
izlude,164,138,4 shop Pet Groomer#iz 124,537:-1,643:-1,10013:-1,10014:-1
diff --git a/npc/warps/cities/comodo.txt b/npc/warps/cities/comodo.txt
index 5c7993dae..72ff8aa11 100644
--- a/npc/warps/cities/comodo.txt
+++ b/npc/warps/cities/comodo.txt
@@ -42,4 +42,4 @@ cmd_in02,74,21,0 warp cmd_casino4-2 1,1,comodo,140,86
cmd_in02,168,113,0 warp cmd_casino5-1 1,1,cmd_in02,63,73
cmd_in02,58,74,0 warp cmd_casino5-2 1,1,cmd_in02,166,116
cmd_in02,187,78,0 warp cmd_casino6-1 1,1,cmd_in02,84,37
-cmd_in02,90,37,0 warp cmd_casino6-2 1,1,cmd_in02,191,77 \ No newline at end of file
+cmd_in02,90,37,0 warp cmd_casino6-2 1,1,cmd_in02,191,77
diff --git a/npc/warps/dungeons/odin.txt b/npc/warps/dungeons/odin.txt
index 478c3cad7..d9791115b 100644
--- a/npc/warps/dungeons/odin.txt
+++ b/npc/warps/dungeons/odin.txt
@@ -24,4 +24,4 @@ odin_tem02,21,334,0 warp odin04 1,1,odin_tem01,379,334
odin_tem02,153,349,0 warp odin05 1,1,odin_tem03,120,54
odin_tem03,121,49,0 warp odin06 1,1,odin_tem02,154,345
odin_tem02,261,377,0 warp odin07 1,1,odin_tem03,247,40
-odin_tem03,247,34,0 warp odin08 1,1,odin_tem02,263,372 \ No newline at end of file
+odin_tem03,247,34,0 warp odin08 1,1,odin_tem02,263,372
diff --git a/npc/warps/dungeons/xmas_dun.txt b/npc/warps/dungeons/xmas_dun.txt
index fbcb6b511..d797e074e 100644
--- a/npc/warps/dungeons/xmas_dun.txt
+++ b/npc/warps/dungeons/xmas_dun.txt
@@ -16,4 +16,4 @@
xmas,143,314,0 warp xmas_dun1-1 1,1,xmas_dun01,205,16
xmas_dun01,205,13,0 warp xmas_dun1-2 1,1,xmas,143,311
xmas_dun01,129,130,0 warp xmas_dun2-1 1,1,xmas_dun02,131,130
-xmas_dun02,129,130,0 warp xmas_dun2-2 1,1,xmas_dun01,132,130 \ No newline at end of file
+xmas_dun02,129,130,0 warp xmas_dun2-2 1,1,xmas_dun01,132,130
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index ea8a1d163..fcba7b5dd 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3663,7 +3663,7 @@ int atcommand_kick(const int fd, struct map_session_data* sd, const char* comman
return -1;
}
- clif_GM_kick(sd, pl_sd, 1);
+ clif_GM_kick(sd, pl_sd);
return 0;
}
@@ -3682,7 +3682,7 @@ int atcommand_kickall(const int fd, struct map_session_data* sd, const char* com
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i]) && pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can kick only lower or same gm level
if (sd->status.account_id != pl_sd->status.account_id)
- clif_GM_kick(sd, pl_sd, 0);
+ clif_GM_kick(NULL, pl_sd);
}
}
@@ -3899,9 +3899,9 @@ int atcommand_mapexit(const int fd, struct map_session_data* sd, const char* com
pl_allsd = map_getallusers(&users);
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i]) && sd->status.account_id != pl_sd->status.account_id)
- clif_GM_kick(sd, pl_sd, 0);
+ clif_GM_kick(NULL, pl_sd);
}
- clif_GM_kick(sd, sd, 0);
+ clif_GM_kick(NULL, sd);
flush_fifos();
diff --git a/src/map/clif.c b/src/map/clif.c
index fd8b2e076..5700aa435 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -3434,9 +3434,9 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
TBL_PC* tsd = (TBL_PC*)bl;
clif_getareachar_pc(sd, tsd);
if(tsd->state.size==2) // tiny/big players [Valaris]
- clif_specialeffect_single(bl, 423, sd->fd);
+ clif_specialeffect_single(bl,423,sd->fd);
else if(tsd->state.size==1)
- clif_specialeffect_single(bl, 421, sd->fd);
+ clif_specialeffect_single(bl,421,sd->fd);
}
break;
case BL_NPC:
@@ -3450,9 +3450,9 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
{
TBL_MOB* md = (TBL_MOB*)bl;
if(md->special_state.size==2) // tiny/big mobs [Valaris]
- clif_specialeffect_single(bl, 423, sd->fd);
+ clif_specialeffect_single(bl,423,sd->fd);
else if(md->special_state.size==1)
- clif_specialeffect_single(bl, 421, sd->fd);
+ clif_specialeffect_single(bl,421,sd->fd);
}
break;
case BL_PET:
@@ -6880,7 +6880,7 @@ int clif_GM_kickack(struct map_session_data *sd, int id)
return 0;
}
-int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int type)
+void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd)
{
int fd = tsd->fd;
@@ -6889,10 +6889,8 @@ int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int ty
else
map_quit(tsd);
- if( type )
+ if( sd )
clif_GM_kickack(sd,tsd->status.account_id);
-
- return 0;
}
/// Displays various manner-related status messages
@@ -9046,14 +9044,11 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
type = (int)RFIFOW(fd,2);
- if( (type == 5 && sd->status.base_level <= 90) ||
- (type == 4 && sd->status.base_level <= 80) ||
- (type == 3 && sd->status.base_level <= 65) ||
- (type == 2 && sd->status.base_level <= 40) ||
- pc_setcart(sd,type) )
- {
- LOG_SUSPICIOUS(sd,"clif_parse_ChangeCart");
- }
+ if( (type == 5 && sd->status.base_level > 90) ||
+ (type == 4 && sd->status.base_level > 80) ||
+ (type == 3 && sd->status.base_level > 65) ||
+ (type == 2 && sd->status.base_level > 40) )
+ pc_setcart(sd,type);
}
/*==========================================
@@ -9403,7 +9398,7 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd)
select = RFIFOB(fd,6);
if((select > sd->npc_menu && select != 0xff) || !select){
ShowWarning("Hack on NPC Select Menu: %s (AID: %d)!\n",sd->status.name,sd->bl.id);
- clif_GM_kick(sd,sd,0);
+ clif_GM_kick(NULL,sd);
} else {
sd->npc_menu=select;
npc_scriptcont(sd,RFIFOL(fd,2));
@@ -10258,7 +10253,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
clif_GM_kickack(sd, 0);
return;
}
- clif_GM_kick(sd, tsd, 1);
+ clif_GM_kick(sd, tsd);
if(log_config.gm && lv >= log_config.gm) {
char message[256];
sprintf(message, "/kick %s (%d)", tsd->status.name, tsd->status.char_id);
diff --git a/src/map/clif.h b/src/map/clif.h
index b93321985..8a0cd10a9 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -362,7 +362,7 @@ void clif_specialeffect_single(struct block_list* bl, int type, int fd);
int clif_message(struct block_list *bl, const char* msg); // messages (from mobs/npcs) [Valaris]
int clif_GM_kickack(struct map_session_data *sd,int id);
-int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int type);
+void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd);
void clif_manner_message(struct map_session_data* sd, uint32 type);
void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type);
int clif_timedout(struct map_session_data *sd);
diff --git a/src/map/map.c b/src/map/map.c
index e713b7d4a..3900247fe 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1770,17 +1770,19 @@ struct map_session_data** map_getallusers(int *users)
all_count = pc_db->size(pc_db); //This is the real number of chars in the db, better use this than the actual "online" count.
if (all_count < 1)
all_count = 10; //Allow room for at least 10 chars.
- all_sd = aCalloc(all_count, sizeof(struct map_session_data*)); //it's actually just the size of a pointer.
+ CREATE(all_sd, struct map_session_data*, all_count);
}
if (all_count < pc_db->size(pc_db))
{
all_count = pc_db->size(pc_db)+10; //Give some room to prevent doing reallocs often.
- all_sd = aRealloc(all_sd, all_count*sizeof(struct map_session_data*));
+ RECREATE(all_sd, struct map_session_data*, all_count);
}
+
*users = pc_db->getall(pc_db,(void**)all_sd,all_count,map_getallpc_sub);
if (*users > (signed int)all_count) //Which should be impossible...
*users = all_count;
+
return all_sd;
}
@@ -1819,18 +1821,18 @@ int map_foreachiddb(int (*func)(DBKey,void*,va_list),...)
int map_addnpc(int m,struct npc_data *nd)
{
int i;
- if(m<0 || m>=map_num)
+ if( m < 0 || m >= map_num )
return -1;
- for(i=0;i<map[m].npc_num && i<MAX_NPC_PER_MAP;i++)
- if(map[m].npc[i]==NULL)
- break;
- if(i==MAX_NPC_PER_MAP){
+
+ ARR_FIND( 0, MAX_NPC_PER_MAP, i, map[m].npc[i] == NULL );
+ if( i == MAX_NPC_PER_MAP )
+ {
ShowWarning("too many NPCs in one map %s\n",map[m].name);
return -1;
}
- if(i==map[m].npc_num){
+
+ if( i == map[m].npc_num )
map[m].npc_num++;
- }
nullpo_retr(0, nd);
@@ -1841,44 +1843,19 @@ int map_addnpc(int m,struct npc_data *nd)
return i;
}
-void map_removenpc(void)
-{
- int i,m,n=0;
-
- for(m=0;m<map_num;m++) {
- for(i=0;i<map[m].npc_num && i<MAX_NPC_PER_MAP;i++) {
- if(map[m].npc[i]!=NULL) {
- clif_clearunit_area(&map[m].npc[i]->bl,2);
- map_delblock(&map[m].npc[i]->bl);
- idb_remove(id_db,map[m].npc[i]->bl.id);
- if(map[m].npc[i]->subtype==SCRIPT) {
- aFree(map[m].npc[i]->u.scr.script);
- aFree(map[m].npc[i]->u.scr.label_list);
- }
- aFree(map[m].npc[i]);
- map[m].npc[i] = NULL;
- n++;
- }
- }
- }
-
- ShowStatus("Successfully removed and freed from memory '"CL_WHITE"%d"CL_RESET"' NPCs.\n",n);
-}
-
/*=========================================
* Dynamic Mobs [Wizputer]
*-----------------------------------------*/
-// allocates a struct when it there is place free in the cache,
-// and returns NULL otherwise
-// -- i'll just leave the old code in case it's needed ^^;
+// Stores the spawn data entry in the mob list.
+// Returns the index of successful, or -1 if the list was full.
int map_addmobtolist(unsigned short m, struct spawn_data *spawn)
{
size_t i;
- for (i = 0; i < MAX_MOB_LIST_PER_MAP; i++) {
- if (map[m].moblist[i] == NULL) {
- map[m].moblist[i] = spawn;
- return i;
- }
+ ARR_FIND( 0, MAX_MOB_LIST_PER_MAP, i, map[m].moblist[i] == NULL );
+ if( i < MAX_MOB_LIST_PER_MAP )
+ {
+ map[m].moblist[i] = spawn;
+ return i;
}
return -1;
}
diff --git a/src/map/map.h b/src/map/map.h
index 0ae13ad95..fc67a5387 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -503,9 +503,6 @@ struct homunculus_db; //[orn]
struct item_data;
struct square;
-// The player performed a suspicious action (not used right now) [FlavioJS]
-#define LOG_SUSPICIOUS(sd,msg)
-
struct map_session_data {
struct block_list bl;
struct unit_data ud;
diff --git a/src/map/party.c b/src/map/party.c
index 1b3a9eaf7..0f042db89 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -145,7 +145,7 @@ int party_check_member(struct party *p)
nullpo_retr(0, p);
all_sd = map_getallusers(&users);
-
+
for(i=0;i<users;i++)
{
sd = all_sd[i];