Skip to content

Commit 0c2c94f

Browse files
committed
Remove random bad asserts
1 parent 69b1bbe commit 0c2c94f

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

plugins/autolabor.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,10 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
590590
if (labor == df::enums::unit_labor::NONE)
591591
continue;
592592

593+
/*
593594
assert(labor >= 0);
594595
assert(labor < ARRAY_COUNT(labor_infos));
596+
*/
595597

596598
if (labor_infos[labor].is_exclusive && dwarfs[dwarf]->status.labors[labor])
597599
dwarf_info[dwarf].mastery_penalty -= 100;
@@ -636,8 +638,10 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
636638
{
637639
int job = dwarfs[dwarf]->job.current_job->job_type;
638640

641+
/*
639642
assert(job >= 0);
640643
assert(job < ARRAY_COUNT(dwarf_states));
644+
*/
641645

642646
dwarf_info[dwarf].state = dwarf_states[job];
643647
}
@@ -656,8 +660,10 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
656660
int labor = ENUM_ATTR(job_skill, labor, skill);
657661
if (labor != df::enums::unit_labor::NONE)
658662
{
663+
/*
659664
assert(labor >= 0);
660665
assert(labor < ARRAY_COUNT(labor_to_skill));
666+
*/
661667

662668
labor_to_skill[labor] = skill;
663669
}
@@ -670,8 +676,10 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
670676
if (labor == df::enums::unit_labor::NONE)
671677
continue;
672678

679+
/*
673680
assert(labor >= 0);
674681
assert(labor < ARRAY_COUNT(labor_infos));
682+
*/
675683

676684
labors.push_back(labor);
677685
}
@@ -684,8 +692,10 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
684692
{
685693
auto labor = *lp;
686694

695+
/*
687696
assert(labor >= 0);
688697
assert(labor < ARRAY_COUNT(labor_infos));
698+
*/
689699

690700
df::job_skill skill = labor_to_skill[labor];
691701

@@ -864,8 +874,10 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
864874
if (labor == df::enums::unit_labor::NONE)
865875
continue;
866876

877+
/*
867878
assert(labor >= 0);
868879
assert(labor < ARRAY_COUNT(labor_infos));
880+
*/
869881

870882
if (labor_infos[labor].mode != HAULERS)
871883
continue;

plugins/mode.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ void printCurrentModes(t_gamemodes gm, Console & con)
9595

9696
command_result mode (color_ostream &out_, vector <string> & parameters)
9797
{
98-
assert(out_.is_console());
98+
if(!out_.is_console())
99+
return CR_FAILURE;
99100
Console &out = static_cast<Console&>(out_);
100101

101102
string command = "";

plugins/tiletypes.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ command_result df_tiletypes (color_ostream &out, vector <string> & parameters)
524524
}
525525
}
526526

527-
assert(out.is_console());
527+
if(!out.is_console())
528+
return CR_FAILURE;
528529
Console &con = static_cast<Console&>(out);
529530

530531
TileType filter, paint;

0 commit comments

Comments
 (0)