summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char_sql/char.c15
-rw-r--r--src/map/atcommand.c5
-rw-r--r--src/map/battle.c5
-rw-r--r--src/map/charsave.c4
-rw-r--r--src/map/chrif.c2
-rw-r--r--src/map/map.c2
6 files changed, 13 insertions, 20 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 682a2c7d0..e390cd4e8 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -2613,19 +2613,16 @@ int parse_frommap(int fd) {
RFIFOSKIP(fd,size);
break;
}
- //Check account
- if (
+ //Check account only if this ain't final save. Final-save goes through because of the char-map reconnect
+ if (RFIFOB(fd,12) || (
(character = idb_get(online_char_db, aid)) != NULL &&
- character->char_id == cid)
- ; //Temporary debug. Set chars online and save.
- else {
- ShowWarning("parse_from_map (save-char): Received data for non-existant/offline character (%d:%d). Setting char online.\n", aid, cid);
- set_char_online(id, cid, aid);
- }
-
+ character->char_id == cid))
{
memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus));
mmo_char_tosql(cid, &char_dat);
+ } else { //This may be valid on char-server reconnection, when re-sending characters that already logged off.
+ ShowError("parse_from_map (save-char): Received data for non-existant/offline character (%d:%d).\n", aid, cid);
+ set_char_online(id, cid, aid);
}
if (RFIFOB(fd,12))
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 4f1fb2a68..9a333892b 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2569,10 +2569,9 @@ int atcommand_item(
item_id = item_data->nameid;
get_count = number;
//Check if it's stackable.
- if (item_data->type == 4 || item_data->type == 5 ||
- item_data->type == 7 || item_data->type == 8) {
+ if (itemdb_isstackable2(item_data))
get_count = 1;
- }
+
for (i = 0; i < number; i += get_count) {
// if not pet egg
if (!pet_create_egg(sd, item_id)) {
diff --git a/src/map/battle.c b/src/map/battle.c
index e47490ee6..280d4df77 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -761,7 +761,6 @@ static struct Damage battle_calc_weapon_attack(
short i;
struct map_session_data *sd, *tsd;
- struct homun_data *hd; //[orn]
struct Damage wd;
struct status_change *sc = status_get_sc(src);
struct status_change *tsc = status_get_sc(target);
@@ -814,7 +813,6 @@ static struct Damage battle_calc_weapon_attack(
BL_CAST(BL_PC, src, sd);
BL_CAST(BL_PC, target, tsd);
- BL_CAST(BL_HOMUNCULUS, src, hd); //[orn]
if(sd) {
if (sd->skillblown[0].id != 0)
@@ -1181,7 +1179,8 @@ static struct Damage battle_calc_weapon_attack(
break;
}
case HFLI_SBR44: //[orn]
- if(hd){
+ if(src->type == BL_HOMUNCULUS){
+ TBL_HOMUNCULUS *hd = (TBL_HOMUNCULUS*)src;
wd.damage = hd->master->homunculus.intimacy ;
wd.damage2 = hd->master->homunculus.intimacy ;
hd->master->homunculus.intimacy = 200;
diff --git a/src/map/charsave.c b/src/map/charsave.c
index 41a3293e4..4dcb59ecc 100644
--- a/src/map/charsave.c
+++ b/src/map/charsave.c
@@ -26,8 +26,8 @@ struct mmo_charstatus *charsave_loadchar(int charid){
char *str_p;
friends = 0;
- ShowDebug("charsave_loadchar : charid = %d | hd->master->status.char_id = %d\n", charid) ;
- c = (struct mmo_charstatus *)aCalloc(1,sizeof(struct mmo_charstatus));
+// ShowDebug("charsave_loadchar : charid = %d | hd->master->status.char_id = %d\n", charid) ;
+ c = (struct mmo_charstatus *)aCalloc(1,sizeof(struct mmo_charstatus));
if(charid <= 0){
ShowError("charsave_loadchar() charid <= 0! (%d)", charid);
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 6f7415099..b8990f87e 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -86,7 +86,7 @@ static const int packet_len_table[0x3d] = {
//2b21: Incomming, chrif_save_ack. Returned after a character has been "final saved" on the char-server. [Skotlex]
//2b22-2b27: FREE
-int chrif_connected;
+int chrif_connected = 0;
int char_fd = 0; //Using 0 instead of -1 is safer against crashes. [Skotlex]
int srvinfo;
static char char_ip_str[128];
diff --git a/src/map/map.c b/src/map/map.c
index e1662fd71..bdf147082 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3788,8 +3788,6 @@ int do_init(int argc, char *argv[]) {
MSG_CONF_NAME = "conf/msg_athena.conf";
GRF_PATH_FILENAME = "conf/grf-files.txt";
- chrif_connected = 0;
-
srand(gettick());
for (i = 1; i < argc ; i++) {