mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Huge overhaul of the entire MapgenParams system
MapgenParams is no longer a polymorphic class, eliminating the need for messy and bug-prone reallocations. Separation between the common and mapgen-specific parameters is now strongly defined. Mapgen parameters objects are now properly encapsulated within the proper subsystems.
This commit is contained in:
@@ -26,12 +26,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
struct MapgenMathParams : public MapgenV7Params {
|
||||
|
||||
MapgenMathParams() {
|
||||
}
|
||||
MapgenMathParams() {}
|
||||
~MapgenMathParams() {}
|
||||
|
||||
Json::Value params;
|
||||
|
||||
bool readParams(Settings *settings);
|
||||
void readParams(Settings *settings);
|
||||
void writeParams(Settings *settings);
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ class MapgenMath : public MapgenV7 {
|
||||
public:
|
||||
MapgenMathParams * mg_params;
|
||||
|
||||
MapgenMath(int mapgenid, MapgenMathParams *mg_params, EmergeManager *emerge);
|
||||
MapgenMath(int mapgenid, MapgenParams *mg_params, EmergeManager *emerge);
|
||||
~MapgenMath();
|
||||
|
||||
int generateTerrain();
|
||||
@@ -57,10 +57,10 @@ class MapgenMath : public MapgenV7 {
|
||||
|
||||
struct MapgenFactoryMath : public MapgenFactory {
|
||||
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
|
||||
return new MapgenMath(mgid, (MapgenMathParams *)params, emerge);
|
||||
return new MapgenMath(mgid, params, emerge);
|
||||
};
|
||||
|
||||
MapgenParams *createMapgenParams() {
|
||||
MapgenSpecificParams *createMapgenParams() {
|
||||
return new MapgenMathParams();
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user