summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-15 17:13:04 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-15 17:13:04 +0000
commitc25d6f5e6c3f092f70bf28cb0a3ac71e2ab89ead (patch)
treeb55395038c48dc99235e7385fbd43df5645e464a /src/map/atcommand.c
parent86b35597e549392cf2db3974fc140a50e021b5a0 (diff)
downloadhercules-c25d6f5e6c3f092f70bf28cb0a3ac71e2ab89ead.tar.gz
hercules-c25d6f5e6c3f092f70bf28cb0a3ac71e2ab89ead.tar.bz2
hercules-c25d6f5e6c3f092f70bf28cb0a3ac71e2ab89ead.tar.xz
hercules-c25d6f5e6c3f092f70bf28cb0a3ac71e2ab89ead.zip
* Some serious code cleanups
- adjusted @reloadbattleconf to not depend on variable ordering - changed all battle vars to 'int' (removes pointless duplicit coding) - added min, max and default columns to battle config data structure - added properly bounded values for these columns (or at least tried to) - battle-conf loading will now complain if it finds unknown settings, and will reject values that are outside of the allowed range - added CHATROOM_TITLE_SIZE and CHATROOM_PASS_SIZE - partially cleaned up chatroom manipulation code * Fixed 'Job_Professer' typo in mage jobchange quest git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11017 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c85
1 files changed, 37 insertions, 48 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 5b512a85c..c179451d8 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1977,23 +1977,13 @@ int atcommand_speed(const int fd, struct map_session_data* sd, const char* comma
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if (!message || !*message) {
+ if (!message || !*message || sscanf(message, "%d", &speed) < 1) {
sprintf(atcmd_output, "Please, enter a speed value (usage: @speed <%d-%d>).", MIN_WALK_SPEED, MAX_WALK_SPEED);
clif_displaymessage(fd, atcmd_output);
return -1;
}
- speed = atoi(message);
- if (speed < MIN_WALK_SPEED)
- {
- speed = MIN_WALK_SPEED;
- }
- else if (speed > MAX_WALK_SPEED)
- {
- speed = MAX_WALK_SPEED;
- }
-
- sd->base_status.speed = speed;
+ sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
status_calc_bl(&sd->bl, SCB_SPEED);
clif_displaymessage(fd, msg_txt(8)); // Speed changed.
return 0;
@@ -2101,11 +2091,12 @@ int atcommand_hide(const int fd, struct map_session_data* sd, const char* comman
*------------------------------------------*/
int atcommand_jobchange(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
+ //FIXME: redundancy, potentially wrong code, should use job_name() or similar instead of hardcoding the table
int job = 0, upper = 0;
nullpo_retr(-1, sd);
- if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) {
-
+ if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1)
+ {
int i, found = 0;
const struct { char name[16]; int id; } jobs[] = {
{ "novice", 0 },
@@ -5073,37 +5064,35 @@ int atcommand_reloadbattleconf(const int fd, struct map_session_data* sd, const
battle_config_read(BATTLE_CONF_FILENAME);
- if (memcmp(&prev_config.item_rate_mvp,
- &battle_config.item_rate_mvp,
- sizeof(battle_config.item_rate_mvp)+
- sizeof(battle_config.item_rate_common)+
- sizeof(battle_config.item_rate_common_boss)+
- sizeof(battle_config.item_rate_card)+
- sizeof(battle_config.item_rate_card_boss)+
- sizeof(battle_config.item_rate_equip)+
- sizeof(battle_config.item_rate_equip_boss)+
- sizeof(battle_config.item_rate_heal)+
- sizeof(battle_config.item_rate_heal_boss)+
- sizeof(battle_config.item_rate_use)+
- sizeof(battle_config.item_rate_use_boss)+
- sizeof(battle_config.item_rate_treasure)+
- sizeof(battle_config.item_rate_adddrop)+
- sizeof(battle_config.logarithmic_drops)+
- sizeof(battle_config.item_drop_common_min)+
- sizeof(battle_config.item_drop_common_max)+
- sizeof(battle_config.item_drop_card_min)+
- sizeof(battle_config.item_drop_card_max)+
- sizeof(battle_config.item_drop_equip_min)+
- sizeof(battle_config.item_drop_equip_max)+
- sizeof(battle_config.item_drop_mvp_min)+
- sizeof(battle_config.item_drop_mvp_max)+
- sizeof(battle_config.item_drop_heal_min)+
- sizeof(battle_config.item_drop_heal_max)+
- sizeof(battle_config.item_drop_use_min)+
- sizeof(battle_config.item_drop_use_max)+
- sizeof(battle_config.item_drop_treasure_min)+
- sizeof(battle_config.item_drop_treasure_max)
- ) != 0)
+ if( prev_config.item_rate_mvp != battle_config.item_rate_mvp
+ || prev_config.item_rate_common != battle_config.item_rate_common
+ || prev_config.item_rate_common_boss != battle_config.item_rate_common_boss
+ || prev_config.item_rate_card != battle_config.item_rate_card
+ || prev_config.item_rate_card_boss != battle_config.item_rate_card_boss
+ || prev_config.item_rate_equip != battle_config.item_rate_equip
+ || prev_config.item_rate_equip_boss != battle_config.item_rate_equip_boss
+ || prev_config.item_rate_heal != battle_config.item_rate_heal
+ || prev_config.item_rate_heal_boss != battle_config.item_rate_heal_boss
+ || prev_config.item_rate_use != battle_config.item_rate_use
+ || prev_config.item_rate_use_boss != battle_config.item_rate_use_boss
+ || prev_config.item_rate_treasure != battle_config.item_rate_treasure
+ || prev_config.item_rate_adddrop != battle_config.item_rate_adddrop
+ || prev_config.logarithmic_drops != battle_config.logarithmic_drops
+ || prev_config.item_drop_common_min != battle_config.item_drop_common_min
+ || prev_config.item_drop_common_max != battle_config.item_drop_common_max
+ || prev_config.item_drop_card_min != battle_config.item_drop_card_min
+ || prev_config.item_drop_card_max != battle_config.item_drop_card_max
+ || prev_config.item_drop_equip_min != battle_config.item_drop_equip_min
+ || prev_config.item_drop_equip_max != battle_config.item_drop_equip_max
+ || prev_config.item_drop_mvp_min != battle_config.item_drop_mvp_min
+ || prev_config.item_drop_mvp_max != battle_config.item_drop_mvp_max
+ || prev_config.item_drop_heal_min != battle_config.item_drop_heal_min
+ || prev_config.item_drop_heal_max != battle_config.item_drop_heal_max
+ || prev_config.item_drop_use_min != battle_config.item_drop_use_min
+ || prev_config.item_drop_use_max != battle_config.item_drop_use_max
+ || prev_config.item_drop_treasure_min != battle_config.item_drop_treasure_min
+ || prev_config.item_drop_treasure_max != battle_config.item_drop_treasure_max
+ )
{ //Drop rates changed.
mob_reload(); //Needed as well so rate changes take effect.
#ifndef TXT_ONLY
@@ -7372,7 +7361,7 @@ int atcommand_pettalk(const int fd, struct map_session_data* sd, const char* com
}
}
- snprintf(temp, sizeof temp ,"%s: %s",pd->pet.name,mes);
+ snprintf(temp, sizeof temp ,"%s : %s", pd->pet.name, mes);
clif_message(&pd->bl, temp);
return 0;
@@ -8324,7 +8313,7 @@ int atcommand_homevolution(const int fd, struct map_session_data* sd, const char
return 0;
}
- clif_displaymessage(fd, "Your homunculus doesn't evove.");
+ clif_displaymessage(fd, "Your homunculus doesn't evolve.");
return -1;
}
@@ -8441,7 +8430,7 @@ int atcommand_homtalk(const int fd, struct map_session_data* sd, const char* com
return -1;
}
- snprintf(temp, sizeof temp ,"%s: %s",sd->hd->homunculus.name,mes);
+ snprintf(temp, sizeof temp ,"%s : %s", sd->hd->homunculus.name, mes);
clif_message(&sd->hd->bl, temp);
return 0;