@@ -1004,7 +1004,7 @@ static void storage_config_read_additional_fields(struct config_setting_t* t, st
1004
1004
* @param imported Whether the current config is imported from another file.
1005
1005
* @retval false in case of error.
1006
1006
*/
1007
- bool storage_config_read (const char * filename , bool imported )
1007
+ bool storage_config_read (const char * filename , bool imported )
1008
1008
{
1009
1009
nullpo_retr (false, filename );
1010
1010
@@ -1054,24 +1054,29 @@ bool storage_config_read(const char* filename, bool imported)
1054
1054
continue ;
1055
1055
}
1056
1056
1057
- if (libconfig -> setting_lookup_string (t , "Constant" , & constant ) == CONFIG_FALSE ) {
1058
- ShowError ("storage_config_read: Constant field not found for storage configuration (Id: %d) in '%s'. Skipping...\n" , s_conf .uid , filename );
1059
- continue ;
1060
- } else {
1061
- script -> set_constant (constant , s_conf .uid , false, false);
1062
- }
1063
-
1064
1057
/* Capacity */
1065
1058
if (libconfig -> setting_lookup_int (t , "Capacity" , & s_conf .capacity ) == CONFIG_FALSE ) {
1066
1059
ShowError ("storage_config_read: Capacity field not found for storage configuration (Id: %d) in '%s'. Skipping...\n" , s_conf .uid , filename );
1067
1060
continue ;
1068
1061
}
1069
1062
1063
+ if (s_conf .capacity < 1 ) {
1064
+ ShowWarning ("storage_config_read: Invalid capacity for Storage #%d ('%s'). Skipping...\n" , s_conf .uid , s_conf .name );
1065
+ continue ;
1066
+ }
1067
+
1070
1068
if (s_conf .capacity > MAX_STORAGE ) {
1071
1069
ShowWarning ("storage_config_read: Capacity for Storage #%d ('%s') is over MAX_STORAGE. Capping to %d.\n" , s_conf .uid , s_conf .name , MAX_STORAGE );
1072
1070
s_conf .capacity = min (s_conf .capacity , MAX_STORAGE );
1073
1071
}
1074
1072
1073
+ if (libconfig -> setting_lookup_string (t , "Constant" , & constant ) == CONFIG_FALSE ) {
1074
+ ShowError ("storage_config_read: Constant field not found for storage configuration (Id: %d) in '%s'. Skipping...\n" , s_conf .uid , filename );
1075
+ continue ;
1076
+ }
1077
+
1078
+ script -> set_constant (constant , s_conf .uid , false, false);
1079
+
1075
1080
/* Additional Fields */
1076
1081
storage -> config_read_additional_fields (t , & s_conf , filename );
1077
1082
@@ -1089,7 +1094,7 @@ bool storage_config_read(const char* filename, bool imported)
1089
1094
const char * import = NULL ;
1090
1095
if (libconfig -> lookup_string (& stor_libconf , "import" , & import ) == CONFIG_TRUE ) {
1091
1096
if (strcmp (import , filename ) == 0 || strcmp (import , map -> STORAGE_CONF_FILENAME ) == 0 ) {
1092
- ShowWarning ("battle_config_read : Loop detected! Skipping 'import'...\n" );
1097
+ ShowWarning ("storage_config_read : Loop detected! Skipping 'import'...\n" );
1093
1098
libconfig -> destroy (& stor_libconf );
1094
1099
return false;
1095
1100
} else if (storage -> config_read (import , true) == false) {
0 commit comments