Skip to content

Commit

Permalink
initializeObjectSchemeLogic flip if-else conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloreck committed Jun 19, 2023
1 parent 7acf99b commit 9d6ca46
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/engine/core/utils/scheme/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export function enableObjectGenericSchemes(
/**
* todo;
* todo;
* todo;
* todo; Move to initialize.ts file.
*/
export function initializeObjectSchemeLogic(
object: ClientObject,
Expand All @@ -439,7 +439,22 @@ export function initializeObjectSchemeLogic(
): void {
logger.info("Initialize object:", object.name(), ESchemeType[schemeType], isLoaded);

if (!isLoaded) {
if (isLoaded) {
const iniFilename: Optional<TName> = state.loaded_ini_filename;

if (iniFilename) {
const iniFile: IniFile = configureObjectSchemes(
object,
getObjectLogicIniConfig(object, iniFilename),
iniFilename,
schemeType,
state.loaded_section_logic as TSection,
state.loaded_gulag_name
);

activateSchemeBySection(object, iniFile, state.loaded_active_section as TSection, state.loaded_gulag_name, true);
}
} else {
const iniFilename: TName = "<customdata>";
const iniFile: IniFile = configureObjectSchemes(
object,
Expand Down Expand Up @@ -475,21 +490,6 @@ export function initializeObjectSchemeLogic(
if (sympathy !== null) {
object.set_sympathy(sympathy);
}
} else {
const iniFilename: Optional<TName> = state.loaded_ini_filename;

if (iniFilename !== null) {
const iniFile: IniFile = configureObjectSchemes(
object,
getObjectLogicIniConfig(object, iniFilename),
iniFilename,
schemeType,
state.loaded_section_logic as TSection,
state.loaded_gulag_name
);

activateSchemeBySection(object, iniFile, state.loaded_active_section as TSection, state.loaded_gulag_name, true);
}
}
}

Expand Down

0 comments on commit 9d6ca46

Please sign in to comment.