Skip to content

Commit 7b2fd48

Browse files
"Upgraded Script Window to be extendable | reloadPlayer doesnt collapse folders anymore"
1 parent c44bba4 commit 7b2fd48

5 files changed

Lines changed: 333 additions & 45 deletions

File tree

GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,7 @@ class ScriptList : public MemoryPoolObject, public Snapshot
12641264

12651265
static ScriptList *s_readLists[MAX_PLAYER_COUNT];
12661266
static Int s_numInReadList;
1267+
std::vector<ScriptGroup*> m_markedChildrenForMove;
12671268

12681269
public:
12691270
ScriptList();

GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -660,17 +660,27 @@ void ScriptList::deleteGroup(ScriptGroup *pGrp)
660660
return;
661661
}
662662

663+
std::vector<std::vector<Int>> children(count);
664+
for (Int i = 0; i < count; ++i) {
665+
Int parent = groups[i]->getParentIndex();
666+
if (parent >= 0 && parent < count) {
667+
children[parent].push_back(i);
668+
}
669+
}
670+
663671
// Mark all groups that are in the subtree rooted at targetIndex for deletion.
664672
std::vector<char> toDelete(count, 0);
673+
std::vector<Int> stack;
674+
stack.push_back(targetIndex);
665675
toDelete[targetIndex] = 1;
666-
for (Int i = 0; i < count; ++i) {
667-
if (toDelete[i]) continue;
668-
Int cur = i;
669-
while (cur != -1) {
670-
Int parent = groups[cur]->getParentIndex();
671-
if (parent == targetIndex) { toDelete[i] = 1; break; }
672-
if (parent < 0 || parent >= count) break;
673-
cur = parent;
676+
while (!stack.empty()) {
677+
Int cur = stack.back();
678+
stack.pop_back();
679+
for (Int child : children[cur]) {
680+
if (!toDelete[child]) {
681+
toDelete[child] = 1;
682+
stack.push_back(child);
683+
}
674684
}
675685
}
676686

GeneralsMD/Code/Tools/WorldBuilder/include/ScriptDialog.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,27 @@ class ScriptDialog : public CDialog
166166

167167
afx_msg void OnMoveUp();
168168
afx_msg void OnMoveDown();
169+
afx_msg void OnSize(UINT nType, int cx, int cy);
170+
void OnGetMinMaxInfo(MINMAXINFO * lpMMI);
171+
169172
//}}AFX_MSG
170173
DECLARE_MESSAGE_MAP()
174+
struct CtrlInfo {
175+
int id;
176+
CRect rc; // initial rect in client coords (left,top,right,bottom)
177+
int offsetRight; // initial clientWidth - rc.right
178+
int offsetBottom; // initial clientHeight - rc.bottom
179+
180+
bool anchorRight;
181+
bool stretchH;
182+
bool stretchV;
183+
bool anchorBottom;
184+
};
185+
std::vector<CtrlInfo> m_ctrlInfo;
186+
CRect m_initialClientRect;
187+
int m_rightColumnLeft;
188+
int m_rightColumnWidth;
189+
bool m_layoutInited;
171190
};
172191

173192
//{{AFX_INSERT_LOCATION}}

GeneralsMD/Code/Tools/WorldBuilder/res/WorldBuilder.rc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,8 @@ BEGIN
935935
END
936936

937937
IDD_ScriptDialog DIALOGEX 0, 0, 460, 327
938-
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
938+
//STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
939+
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_THICKFRAME
939940
CAPTION "Scripts"
940941
FONT 8, "MS Sans Serif", 0, 0, 0x1
941942
BEGIN
@@ -946,7 +947,7 @@ BEGIN
946947
PUSHBUTTON "Up",IDC_MOVE_UP,403,118,25,14
947948
PUSHBUTTON "Down",IDC_MOVE_DOWN,428,118,25,14
948949

949-
PUSHBUTTON "&Copy Script",IDC_COPY_SCRIPT,403,136,50,14
950+
PUSHBUTTON "&Duplicate",IDC_COPY_SCRIPT,403,136,50,14
950951
PUSHBUTTON "&Delete",IDC_DELETE,403,152,50,14
951952
PUSHBUTTON "Import Scripts...",IDC_LOAD,386,309,60,14
952953
PUSHBUTTON "Export Script(s)...",IDC_SAVE,317,309,60,14

0 commit comments

Comments
 (0)