* Added use dynamic allocation when loading the msg_table

* Refresh the client when day comes to get rid of the night effect
* Changed @refresh to fake map loading, but without teleporting side effect
* Updated SQL file for the item_db

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1307 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
celest 2005-03-27 10:36:30 +00:00
parent c61d7fd127
commit 1717d644dd
8 changed files with 1867 additions and 1781 deletions

View File

@ -1,12 +1,26 @@
Date Added
03/27
* Moved guardian hostility checking and monster_ignore_gm check to battle.c --
processed earlier, and more appropiate [celest]
* Fixed a SQL syntax crash when logging character names with "'" in them
[celest]
* Added use dynamic allocation when loading the msg_table [celest]
* Fixed some memory leaks with the new timer changes [celest]
* Refresh the client when day comes to get rid of the night effect (if
night_darkness_level was used) [celest]
* Changed @refresh to fake map loading, but without teleporting side effect
(skill delays reset, extra load on server etc)[celest]
* Updated SQL file for the item_db, thanks to Zoc
* Fixed the 'show_mob_hp' option not updating when a monster is healed, thanks
to leinsirk10
* Added flexible Filter to the Monster Drops logging [Lupus]
- Now you can choose what types of items either to log or not.
- You can also log expensive items (you can set the min logging price)
* Optimized a bit ATCommands.c functions (inspired by Freya) [Lupus]
* Added missing parenthesis in my Improve Dodge code, not giving +4/lv to proper jobs [DracoRPG]
* Added all released cards into monsters drops and Old Card Album [Lupus]
03/25
* Fixed a typo in my fix for Stalk / Tunnel Drive increasing instead of decreasing speed, sorry [DracoRPG]
* Rewrote a little bit Improve Dodge [DracoRPG]

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,8 @@
static char command_symbol = '@'; // first char of the commands (by [Yor])
char msg_table[1000][256]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
#define MAX_MSG 1000
char *msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others)
#define ACMD_FUNC(x) int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message)
ACMD_FUNC(broadcast);
@ -660,7 +661,7 @@ int lowtohigh_compare (const void * a, const void * b)
// Return the message string of the specified number by [Yor]
//-----------------------------------------------------------
char * msg_txt(int msg_number) {
if (msg_number >= 0 && msg_number < (int)(sizeof(msg_table) / sizeof(msg_table[0])) &&
if (msg_number >= 0 && msg_number < MAX_MSG &&
msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0')
return msg_table[msg_number];
@ -910,12 +911,15 @@ int msg_config_read(const char *cfgName) {
int msg_number;
char line[1024], w1[1024], w2[1024];
FILE *fp;
static int called = 1;
if ((fp = fopen(cfgName, "r")) == NULL) {
printf("Messages file not found: %s\n", cfgName);
return 1;
}
if ((--called) == 0)
memset(&msg_table[0], 0, sizeof(msg_table[0]) * MAX_MSG);
while(fgets(line, sizeof(line)-1, fp)) {
if (line[0] == '/' && line[1] == '/')
continue;
@ -924,9 +928,13 @@ int msg_config_read(const char *cfgName) {
msg_config_read(w2);
} else {
msg_number = atoi(w1);
if (msg_number >= 0 && msg_number < (int)(sizeof(msg_table) / sizeof(msg_table[0])))
strcpy(msg_table[msg_number], w2);
if (msg_number >= 0 && msg_number < MAX_MSG) {
if (msg_table[msg_number] != NULL)
aFree(msg_table[msg_number]);
msg_table[msg_number] = (char *)aCalloc(strlen(w2) + 1, sizeof (char));
strcpy(msg_table[msg_number],w2);
// printf("message #%d: '%s'.\n", msg_number, msg_table[msg_number]);
}
}
}
}
@ -935,6 +943,17 @@ int msg_config_read(const char *cfgName) {
return 0;
}
/*==========================================
* Cleanup Message Data
*------------------------------------------
*/
void do_final_msg () {
int i;
for (i = 0; i < MAX_MSG; i++)
aFree(msg_table[i]);
return;
}
/*==========================================
*
*------------------------------------------
@ -4495,8 +4514,12 @@ int atcommand_day(
night_flag = 0; // 0=day, 1=night [Yor]
for(i = 0; i < fd_max; i++) {
if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) {
pl_sd->opt2 &= ~STATE_BLIND;
clif_changeoption(&pl_sd->bl);
if (battle_config.night_darkness_level > 0)
clif_refresh (pl_sd);
else {
pl_sd->opt2 &= ~STATE_BLIND;
clif_changeoption(&pl_sd->bl);
}
clif_displaymessage(pl_sd->fd, msg_table[60]); // Day has arrived.
}
}
@ -8104,7 +8127,8 @@ int atcommand_refresh(
const char* command, const char* message)
{
nullpo_retr(-1, sd);
pc_setpos(sd, sd->mapname, sd->bl.x, sd->bl.y, 3);
//pc_setpos(sd, sd->mapname, sd->bl.x, sd->bl.y, 3);
clif_refresh(sd);
return 0;
}

View File

@ -275,6 +275,7 @@ int atcommand_recall(const int fd, struct map_session_data* sd, const char* comm
int atcommand_config_read(const char *cfgName);
int msg_config_read(const char *cfgName);
void do_final_msg();
char *estr_lower(char *str);

View File

@ -7318,6 +7318,14 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) {
return 0;
}
// refresh the client's screen, getting rid of any effects
int clif_refresh(struct map_session_data *sd) {
nullpo_retr(-1, sd);
clif_changemap(sd,sd->mapname,sd->bl.x,sd->bl.y);
return 0;
}
// ------------
// clif_parse_*
// ------------

View File

@ -102,6 +102,7 @@ int clif_changechatowner(struct chat_data*,struct map_session_data*); // chat
int clif_clearchat(struct chat_data*,int); // area or fd
int clif_leavechat(struct chat_data*,struct map_session_data*); // chat
int clif_changechatstatus(struct chat_data*); // chat
int clif_refresh(struct map_session_data*); // self
void clif_emotion(struct block_list *bl,int type);
void clif_talkiebox(struct block_list *bl,char* talkie);

View File

@ -3185,6 +3185,7 @@ void do_final(void) {
do_final_party();
do_final_pc();
do_final_pet();
do_final_msg();
for (i=0; i<map_num; i++) {
if(map[i].gat) aFree(map[i].gat);

View File

@ -7014,8 +7014,12 @@ int map_day_timer(int tid, unsigned int tick, int id, int data) { // by [yor]
night_flag = 0; // 0=day, 1=night [Yor]
for(i = 0; i < fd_max; i++) {
if (session[i] && (pl_sd = (struct map_session_data *) session[i]->session_data) && pl_sd->state.auth) {
pl_sd->opt2 &= ~STATE_BLIND;
clif_changeoption(&pl_sd->bl);
if (battle_config.night_darkness_level > 0)
clif_refresh (pl_sd);
else {
pl_sd->opt2 &= ~STATE_BLIND;
clif_changeoption(&pl_sd->bl);
}
clif_wis_message(pl_sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1);
}
}