Skip to content

Commit

Permalink
Immobile Monsters Can't Wander (CleverRaven#59421)
Browse files Browse the repository at this point in the history
* Immobile Monsters Can't Wander

This adds a check for the immobile flag to ensure immobile monsters (like the trapped tendril) won't get picked up in hordes.

* Astyle fixes

Someone else didn't run astyle~
  • Loading branch information
a-chancey authored Jul 20, 2022
1 parent df15035 commit d7c60e9
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 74 deletions.
9 changes: 4 additions & 5 deletions object_creator/creator_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ int main( int argc, char *argv[] )
PATH_INFO::set_standard_filenames();

MAP_SHARING::setDefaults();

QSettings settings( QSettings::IniFormat, QSettings::UserScope,
"CleverRaven", "Cataclysm - DDA" );
"CleverRaven", "Cataclysm - DDA" );


cli_opts cli;

Expand Down Expand Up @@ -149,8 +149,7 @@ int main( int argc, char *argv[] )
mods.push_back( mod_id( "dda" ) );
if( settings.contains( "mods/include" ) ) {
QStringList modlist = settings.value( "mods/include" ).value<QStringList>();
for( const QString& i : modlist )
{
for( const QString &i : modlist ) {
mods.push_back( mod_id( i.toStdString() ) );
}
}
Expand Down
24 changes: 12 additions & 12 deletions object_creator/creator_main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int creator::main_window::execute( QApplication &app )
{
const int default_text_box_height = 20;
const int default_text_box_width = 100;
const QSize default_text_box_size(default_text_box_width, default_text_box_height);
const QSize default_text_box_size( default_text_box_width, default_text_box_height );

int row = 0;
int col = 0;
Expand All @@ -45,7 +45,7 @@ int creator::main_window::execute( QApplication &app )
//Does nothing on it's own but once settings.setvalue() is called it will create
//an ini file in C:\Users\User\AppData\Roaming\CleverRaven or equivalent directory
QSettings settings( QSettings::IniFormat, QSettings::UserScope,
"CleverRaven", "Cataclysm - DDA" );
"CleverRaven", "Cataclysm - DDA" );


// =========================================================================================
Expand All @@ -54,14 +54,14 @@ int creator::main_window::execute( QApplication &app )
QLabel mods_label;
mods_label.setParent( &title_menu );
mods_label.setText( QString( "Select mods (restart required):" ) );
mods_label.resize( default_text_box_size*2 );
mods_label.resize( default_text_box_size * 2 );
mods_label.move( QPoint( col * default_text_box_width, row++ * default_text_box_height ) );
mods_label.show();
row++;

//We always load 'dda' so we exclude it from the mods list
QStringList all_mods;
for( const mod_id& e : world_generator->get_mod_manager().all_mods() ) {
for( const mod_id &e : world_generator->get_mod_manager().all_mods() ) {
if( !e->obsolete && e->ident.str() != "dda" ) {
all_mods.append( e->ident.c_str() );
}
Expand All @@ -75,8 +75,8 @@ int creator::main_window::execute( QApplication &app )
mods_box.show();
//The user's mod selection gets saved to a file
QObject::connect( &mods_box, &dual_list_box::pressed, [&]() {
settings.setValue( "mods/include", mods_box.get_included() );
});
settings.setValue( "mods/include", mods_box.get_included() );
} );

//A previous selection of mods is loaded from disk and applied to the modlist widget
if( settings.contains( "mods/include" ) ) {
Expand All @@ -89,10 +89,10 @@ int creator::main_window::execute( QApplication &app )
QPushButton spell_button( _( "Spell Creator" ), &title_menu );
spell_button.move( QPoint( col * default_text_box_width, row * default_text_box_height ) );
QObject::connect( &spell_button, &QPushButton::released,
[&]() {
title_menu.hide();
spell_editor.show();
});
[&]() {
title_menu.hide();
spell_editor.show();
} );



Expand All @@ -103,8 +103,8 @@ int creator::main_window::execute( QApplication &app )
col += 6;
max_row = std::max( max_row, row );
max_col = std::max( max_col, col );
title_menu.resize( QSize( ( max_col + 1) * default_text_box_width,
( max_row )*default_text_box_height ) );
title_menu.resize( QSize( ( max_col + 1 ) * default_text_box_width,
( max_row )*default_text_box_height ) );


return app.exec();
Expand Down
6 changes: 3 additions & 3 deletions object_creator/dual_list_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ void creator::dual_list_box::include_selected()
}
excluded_box.clear();
excluded_box.addItems( excluded );
if ( excluded.isEmpty() ) {
if( excluded.isEmpty() ) {
return;
}
if ( index > excluded_box.count() - 1 ) {
if( index > excluded_box.count() - 1 ) {
index = excluded_box.count() - 1;
}
excluded_box.item( index )->setSelected( true );
Expand Down Expand Up @@ -164,7 +164,7 @@ QStringList creator::dual_list_box::get_included() const

void creator::dual_list_box::set_included( const QStringList ret )
{
if( included_box.count() > 0 ){
if( included_box.count() > 0 ) {
exclude_all();
}
for( int y = 0; y < ret.count(); y++ ) {
Expand Down
Loading

0 comments on commit d7c60e9

Please sign in to comment.