Repository navigation
bugfix(worldbuilder): Reject lossy retail cliff saves #3454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -666,6 +666,11 @@ BOOL CWorldBuilderDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace) | |
| // if 'bReplace' is TRUE will change file name if successful (SaveAs) | ||
| // if 'bReplace' is FALSE will not change path name (SaveCopyAs) | ||
| { | ||
| if (m_heightMap && !m_heightMap->canSaveCliffState()) { | ||
| ::AfxMessageBox("Cannot save: the retail Generals map format cannot store cliff flags at the right edge of this map. Adjust the map width before saving."); | ||
| return FALSE; | ||
| } | ||
|
|
||
| CString newName = lpszPathName; | ||
| if (newName.IsEmpty()) | ||
| { | ||
|
|
@@ -796,6 +801,10 @@ Bool CWorldBuilderDoc::ParseWaypointData(DataChunkInput &file, DataChunkInfo *in | |
|
|
||
| void CWorldBuilderDoc::autoSave() | ||
| { | ||
| if (m_heightMap && !m_heightMap->canSaveCliffState()) { | ||
| return; | ||
|
Comment on lines
+804
to
+805
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When |
||
| } | ||
|
|
||
| // srj sez: put autosave into our user data folder, not the ap dir | ||
| AsciiString autosave1 = TheGlobalData->getPath_UserData(); | ||
| AsciiString autosave2 = TheGlobalData->getPath_UserData(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an existing retail Generals map with a nonzero omitted cliff byte is launched through Ctrl+J, this new
FALSEreturn reachesOnJumpToGame, whose call toDoFileSave()at line 620 ignores the result and still executes_spawnlat line 628. The editor therefore launches the previous on-disk map immediately after reporting that the current state cannot be saved, so a playtest can run against stale terrain; make that caller abort when the save fails.Useful? React with 👍 / 👎.