Skip to content

Commit 793fa59

Browse files
committed
mod manager remove assign
It's kinda weird that this uses assign, but use optional/mandatory instead. These could all probably just be jo.read( "foo", foo );
1 parent 079429d commit 793fa59

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/mod_manager.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#include <queue>
1010
#include <stdexcept>
1111

12-
#include "assign.h"
1312
#include "cata_utility.h"
1413
#include "debug.h"
1514
#include "dependency_tree.h"
1615
#include "filesystem.h"
1716
#include "flexbuffer_json.h"
17+
#include "generic_factory.h"
1818
#include "input_context.h"
1919
#include "json.h"
2020
#include "localized_comparator.h"
@@ -280,21 +280,22 @@ void mod_manager::load_modfile( const JsonObject &jo, const cata_path &path )
280280
modfile.category = p_cat;
281281

282282
std::string mod_json_path;
283-
if( assign( jo, "path", mod_json_path ) ) {
283+
if( jo.has_member( "path" ) ) {
284+
optional( jo, false, "path", mod_json_path );
284285
modfile.path = path / mod_json_path;
285286
} else {
286287
modfile.path = path;
287288
}
288289

289-
assign( jo, "authors", modfile.authors );
290-
assign( jo, "maintainers", modfile.maintainers );
291-
assign( jo, "description", modfile.description );
292-
assign( jo, "version", modfile.version );
293-
assign( jo, "dependencies", modfile.dependencies );
294-
assign( jo, "conflicts", modfile.conflicts );
295-
assign( jo, "core", modfile.core );
296-
assign( jo, "obsolete", modfile.obsolete );
297-
assign( jo, "loading_images", modfile.loading_images );
290+
optional( jo, false, "authors", modfile.authors );
291+
optional( jo, false, "maintainers", modfile.maintainers );
292+
optional( jo, false, "description", modfile.description );
293+
optional( jo, false, "version", modfile.version );
294+
optional( jo, false, "dependencies", modfile.dependencies );
295+
optional( jo, false, "conflicts", modfile.conflicts );
296+
optional( jo, false, "core", modfile.core, false );
297+
optional( jo, false, "obsolete", modfile.obsolete, false );
298+
optional( jo, false, "loading_images", modfile.loading_images );
298299

299300
if( std::find( modfile.dependencies.begin(), modfile.dependencies.end(),
300301
modfile.ident ) != modfile.dependencies.end() ) {

0 commit comments

Comments
 (0)