Skip to content

Commit 39dc9dd

Browse files
committed
Fix random map generation
1 parent b7992fe commit 39dc9dd

4 files changed

Lines changed: 23 additions & 13 deletions

File tree

Source/OFED.cpp

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -998,15 +998,27 @@ void cOFED::Create_NewMap(const std::string& pTileSet, const std::string& pTileS
998998

999999
CursorReset();
10001000

1001-
sMapParams Params;
1002-
Params.mTileType = TileType.mType;
1003-
Params.mTileSub = (eTileSub) mMapSub;
1004-
Params.mWidth = pWidth;
1005-
Params.mHeight = pHeight;
1006-
Params.mRandom = pRandom;
1007-
1008-
g_Fodder->Map_Create(Params);
1009-
g_Fodder->mWindow->FrameEnd();
1001+
sMapParams Params(pWidth, pHeight, TileType.mType, (eTileSub)mMapSub);
1002+
Params.mRandom.setSeed(g_Fodder->mRandom.get());
1003+
1004+
if (pRandom) {
1005+
g_Fodder->mParams->mScriptRun = "mapeditor.js";
1006+
g_Fodder->CreateRandom(Params);
1007+
1008+
} else
1009+
g_Fodder->Map_Create(Params);
1010+
1011+
// Editor needs to render the surface now
1012+
// Draw the tiles
1013+
g_Fodder->MapTiles_Draw();
1014+
1015+
g_Fodder->Mission_Sprites_Handle();
1016+
1017+
// Refresh the palette
1018+
g_Fodder->mGraphics->PaletteSet(g_Fodder->mSurface);
1019+
g_Fodder->mSurface->surfaceSetToPaletteNew();
1020+
1021+
g_Fodder->mWindow->FrameEnd();
10101022

10111023
// Update the Toolboxes
10121024
mToolboxSprites->RenderSprites();

Source/WindowQT.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ cWindowQT::cWindowQT(QWidget* pParent) : QWidget(pParent), cWindow() {
4040

4141
// Mouse inside widget callback
4242
connect(&mMouseInTimer, &QTimer::timeout, this, &cWindowQT::CameraUpdate);
43-
44-
4543
}
4644

4745
void cWindowQT::FrameEnd() {

Source/gitver.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const char* gitversion="437af4d";
1+
const char* gitversion="b7992fe";

0 commit comments

Comments
 (0)