[Gcblue-commits] gcb_wx/src/graphics tc3DViewer.cpp,1.17,1.18 tcFlightPortGui.cpp,1.1,1.2 tcGameView
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-06-22 01:22:24
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2354/src/graphics Modified Files: tc3DViewer.cpp tcFlightPortGui.cpp tcGameView.cpp tcLauncherContainerItem.cpp tcMapView.cpp tcPlatformGui.cpp tcScenarioSelectView.cpp tcStoresContainerItem.cpp tcStoresGui.cpp Log Message: Misc housekeeping, updates for infrared and anti-radiation seekers, more info for multiplayer airfield units, icon gui enhancements Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcMapView.cpp 11 Jun 2005 21:01:44 -0000 1.27 --- tcMapView.cpp 22 Jun 2005 01:22:08 -0000 1.28 *************** *** 436,447 **** void tcTacticalMapView::DrawScaleBar() { ! float fKmPerPel, fKmScale; ! int nScaleBarWidth, nBarX1, nBarX2; - fKmPerPel = mfScaleX_radppel*C_RADTOKM; - // calculate closest power of 10 km dist that corresponds to (about) 100 pixels - fKmScale = expf(logf(10.0f)*floorf(log10f(fKmPerPel*120.0f))); - nScaleBarWidth = (int)(fKmScale*C_KMTORAD*mfScaleX_pelprad); tcString sText; --- 436,460 ---- void tcTacticalMapView::DrawScaleBar() { ! float fKmPerPel; ! int nBarX1, nBarX2; ! ! // faster, but this only works if only one tcTacticalMapView is instantiated ! // Move to private members ! static float lastScaleX = 0; ! static float fKmScale; ! static int nScaleBarWidth; ! ! if (mfScaleX_radppel != lastScaleX) ! { ! fKmPerPel = mfScaleX_radppel*C_RADTOKM; ! // calculate closest power of 10 km dist that corresponds to (about) 100 pixels ! fKmScale = expf(logf(10.0f)*floorf(log10f(fKmPerPel*180.0f))); ! nScaleBarWidth = (int)(fKmScale*C_KMTORAD*mfScaleX_pelprad); ! ! lastScaleX = mfScaleX_radppel; ! } ! tcString sText; Index: tcFlightPortGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcFlightPortGui.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcFlightPortGui.cpp 11 Jun 2005 21:01:44 -0000 1.1 --- tcFlightPortGui.cpp 22 Jun 2005 01:22:08 -0000 1.2 *************** *** 36,39 **** --- 36,40 ---- #include "tcPlatformGui.h" #include "tcPlatformObject.h" + #include "tcSimState.h" #ifdef _DEBUG *************** *** 50,54 **** tcGameObject* tcEntityContainerItem::GetEntity() const { ! return entity; } --- 51,63 ---- tcGameObject* tcEntityContainerItem::GetEntity() const { ! if (hostId == -1) ! { ! return tcSimState::Get()->GetObject(platformId); ! } ! ! tcGameObject* parent = tcSimState::Get()->GetObject(hostId); ! if (parent == 0) return 0; ! ! return parent->GetChildById(platformId); } *************** *** 63,74 **** } ! void tcEntityContainerItem::SetEntity(tcGameObject* obj) { ! entity = obj; } tcEntityContainerItem::tcEntityContainerItem() : description(""), ! entity(0) { } --- 72,85 ---- } ! void tcEntityContainerItem::SetEntity(long id, long host) { ! platformId = id; ! hostId = host; } tcEntityContainerItem::tcEntityContainerItem() : description(""), ! platformId(-1), ! hostId(-1) { } *************** *** 97,101 **** item->SetDescription(airState->obj->mzClass.mz); ! item->SetEntity(airState->obj); item->SetIcon(icon); item->SetId(reinterpret_cast<long>(airState)); --- 108,112 ---- item->SetDescription(airState->obj->mzClass.mz); ! item->SetEntity(airState->obj->mnID, platformId); item->SetIcon(icon); item->SetId(reinterpret_cast<long>(airState)); *************** *** 131,138 **** void tcFlightPortGui::Draw() { - if (FinishDestroy()) return; - if (drawCount++ % 4 != 0) return; // update draw every 4th frame UpdateGui(); --- 142,151 ---- void tcFlightPortGui::Draw() { if (drawCount++ % 4 != 0) return; // update draw every 4th frame + tcFlightPort* flightPort = GetFlightPort(); + if (flightPort == 0) DestroyGui(); + if (FinishDestroy()) return; + UpdateGui(); *************** *** 207,214 **** DrawBorder(); ! HideUnusedObjects(); } void tcFlightPortGui::HandleDrop(size_t slotIdx, tcContainerItem* item) { --- 220,236 ---- DrawBorder(); ! FinishDraw(); } + tcFlightPort* tcFlightPortGui::GetFlightPort() + { + tcFlightOpsObject* flightOps = + dynamic_cast<tcFlightOpsObject*>(tcSimState::Get()->GetObject(platformId)); + if (flightOps == 0) return 0; + + return flightOps->GetFlightPort(); + } + void tcFlightPortGui::HandleDrop(size_t slotIdx, tcContainerItem* item) { *************** *** 219,222 **** --- 241,247 ---- if (entityItem == 0) return; // only handle entity items + tcFlightPort* flightPort = GetFlightPort(); + if (flightPort == 0) return; + tcGameObject* entity = entityItem->GetEntity(); int unitIdx = flightPort->FindAirState(entity); *************** *** 242,247 **** void tcFlightPortGui::InitializeGui() { wxASSERT(flightPort); ! tcFlightportDBObject* databaseObj = flightPort->GetDatabaseObject(); wxASSERT(databaseObj); --- 267,274 ---- void tcFlightPortGui::InitializeGui() { + tcFlightPort* flightPort = GetFlightPort(); wxASSERT(flightPort); ! if (flightPort == 0) return; ! tcFlightportDBObject* databaseObj = flightPort->GetDatabaseObject(); wxASSERT(databaseObj); *************** *** 301,304 **** --- 328,334 ---- void tcFlightPortGui::OnRButtonDown(wxMouseEvent& event) { + tcFlightPort* flightPort = GetFlightPort(); + if (flightPort == 0) return; + wxPoint point = event.GetPosition(); *************** *** 351,355 **** wxPoint pos = wxWindow::GetPosition(); wxSize size = wxWindow::GetSize(); ! tcPlatformGui* gui = new tcPlatformGui(platform, wxPoint(pos.x, pos.y + size.GetHeight() + 10), "xml/platform_gui_default.xml"); wxASSERT(item); --- 381,385 ---- wxPoint pos = wxWindow::GetPosition(); wxSize size = wxWindow::GetSize(); ! tcPlatformGui* gui = new tcPlatformGui(platform->mnID, platformId, wxPoint(pos.x, pos.y + size.GetHeight() + 10), "xml/platform_gui_default.xml"); wxASSERT(item); *************** *** 420,423 **** --- 450,454 ---- } + /** * Update slot items based on flightPort state *************** *** 425,428 **** --- 456,462 ---- void tcFlightPortGui::UpdateGui() { + tcFlightPort* flightPort = GetFlightPort(); + if (flightPort == 0) return; + // mark all slots not updated for (size_t n=0; n<slots.size(); n++) *************** *** 432,437 **** size_t nextHangarIdx = hangarOffset; // slot idx for next hangar unit ! ! wxASSERT(flightPort); size_t nUnits = flightPort->GetCount(); for (size_t n=0; n<nUnits; n++) --- 466,470 ---- size_t nextHangarIdx = hangarOffset; // slot idx for next hangar unit ! size_t nUnits = flightPort->GetCount(); for (size_t n=0; n<nUnits; n++) *************** *** 508,521 **** * */ ! tcFlightPortGui::tcFlightPortGui(tcFlightPort* obj, const wxPoint& pos, const wxString& configFile) ! : tcContainerGui(pos, configFile, "FlightPortGui"), flightPort(obj) { ReadGuiParameters(); InitializeGui(); - - - SetActive(true); --- 541,552 ---- * */ ! tcFlightPortGui::tcFlightPortGui(long id, const wxPoint& pos, const wxString& configFile) ! : tcContainerGui(pos, configFile, "FlightPortGui"), ! platformId(id) { ReadGuiParameters(); InitializeGui(); SetActive(true); *************** *** 526,531 **** #endif - - } --- 557,560 ---- Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tc3DViewer.cpp 1 Jun 2005 00:13:30 -0000 1.17 --- tc3DViewer.cpp 22 Jun 2005 01:22:08 -0000 1.18 *************** *** 1157,1161 **** wxASSERT(track); ! tc3DModel* model = track->GetModel(); if (model) { --- 1157,1161 ---- wxASSERT(track); ! tc3DModel* model = (track != 0) ? track->GetModel() : 0; if (model) { Index: tcScenarioSelectView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcScenarioSelectView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcScenarioSelectView.cpp 8 May 2005 23:28:58 -0000 1.10 --- tcScenarioSelectView.cpp 22 Jun 2005 01:22:08 -0000 1.11 *************** *** 181,185 **** DrawTextR(item.caption.c_str(), item.drawBox.x + xIndent, item.drawBox.y + item.drawBox.height - 3, defaultFont.get(), ! color, 12.0f, LEFT_BASE_LINE); if (item.showChildren) --- 181,185 ---- DrawTextR(item.caption.c_str(), item.drawBox.x + xIndent, item.drawBox.y + item.drawBox.height - 3, defaultFont.get(), ! color, fontSizeDirectory, LEFT_BASE_LINE); if (item.showChildren) *************** *** 192,196 **** DrawTextR(item.caption.c_str(), item.drawBox.x, item.drawBox.y + item.drawBox.height - 3, ! defaultFont.get(), color, 11.0f, LEFT_BASE_LINE); } --- 192,196 ---- DrawTextR(item.caption.c_str(), item.drawBox.x, item.drawBox.y + item.drawBox.height - 3, ! defaultFont.get(), color, fontSizeScenario, LEFT_BASE_LINE); } *************** *** 484,490 **** xStart(55), xWidth(120), ! yHeight(16), ! yHeightDir(24), yStart(220), basePosition(xStart, yStart), loadedScenarioCaption("") --- 484,492 ---- xStart(55), xWidth(120), ! yHeight(24), ! yHeightDir(32), yStart(220), + fontSizeDirectory(15.0), + fontSizeScenario(13.0), basePosition(xStart, yStart), loadedScenarioCaption("") Index: tcStoresGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcStoresGui.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcStoresGui.cpp 12 Jun 2005 20:46:58 -0000 1.2 --- tcStoresGui.cpp 22 Jun 2005 01:22:08 -0000 1.3 *************** *** 36,39 **** --- 36,40 ---- #include "tcLauncherContainerItem.h" #include "tcLauncher.h" + #include "tcSimState.h" #ifdef _DEBUG *************** *** 47,52 **** */ void tcStoresGui::AddOrUpdateItem(tcContainerSlot& slot, const std::string& itemName, ! unsigned int quantity) { tcStoresContainerItem* item = dynamic_cast<tcStoresContainerItem*>(slot.GetItem()); --- 48,55 ---- */ void tcStoresGui::AddOrUpdateItem(tcContainerSlot& slot, const std::string& itemName, ! unsigned int quantity, tcStores* stores) { + wxASSERT(stores); + tcStoresContainerItem* item = dynamic_cast<tcStoresContainerItem*>(slot.GetItem()); *************** *** 67,71 **** item->SetItemName(itemName); item->SetQuantity(quantity); ! item->SetStores(stores); } else --- 70,74 ---- item->SetItemName(itemName); item->SetQuantity(quantity); ! item->SetStores(platformId, hostId, storesIdx); } else *************** *** 80,86 **** void tcStoresGui::Draw() { if (FinishDestroy()) return; - if (drawCount++ % 4 != 0) return; // update draw every 4th frame UpdateGui(); --- 83,92 ---- void tcStoresGui::Draw() { + if (drawCount++ % 4 != 0) return; // update draw every 4th frame + + tcStores* stores = GetStores(); + if (stores == 0) DestroyGui(); if (FinishDestroy()) return; UpdateGui(); *************** *** 154,162 **** DrawBorder(); ! HideUnusedObjects(); } /** * Handles two cases: * - Transfer of item from one tcStores to this tcStores --- 160,193 ---- DrawBorder(); ! FinishDraw(); } /** + * @return pointer to stores object + * This is done dynamically to handle case where object is deleted + */ + tcStores* tcStoresGui::GetStores() + { + tcPlatformObject* platform = 0; + + if (hostId == -1) + { + platform = dynamic_cast<tcPlatformObject*> + (tcSimState::Get()->GetObject(platformId)); + } + else + { + tcGameObject* parent = tcSimState::Get()->GetObject(hostId); + if (parent == 0) return 0; + platform = dynamic_cast<tcPlatformObject*>(parent->GetChildById(platformId)); + } + + if (platform == 0) return 0; + + return platform->GetMagazine(storesIdx); + } + + /** * Handles two cases: * - Transfer of item from one tcStores to this tcStores *************** *** 165,168 **** --- 196,202 ---- void tcStoresGui::HandleDrop(size_t slotIdx, tcContainerItem* item) { + tcStores* stores = GetStores(); + if (stores == 0) return; + tcStoresContainerItem* storesItem = dynamic_cast<tcStoresContainerItem*>(item); if (storesItem) *************** *** 187,192 **** void tcStoresGui::InitializeGui() { wxASSERT(stores); ! tcStoresDBObject* databaseObj = stores->GetDatabaseObject(); wxASSERT(databaseObj); --- 221,228 ---- void tcStoresGui::InitializeGui() { + tcStores* stores = GetStores(); wxASSERT(stores); ! if (stores == 0) return; ! tcStoresDBObject* databaseObj = stores->GetDatabaseObject(); wxASSERT(databaseObj); *************** *** 270,273 **** --- 306,312 ---- void tcStoresGui::UpdateGui() { + tcStores* stores = GetStores(); + if (stores == 0) return; + // mark all slots not updated for (size_t n=0; n<slots.size(); n++) *************** *** 276,280 **** } ! wxASSERT(stores); size_t nTypes = stores->GetNumberItemTypes(); for (size_t n=0; (n<nTypes)&&(n<slots.size()); n++) --- 315,319 ---- } ! size_t nTypes = stores->GetNumberItemTypes(); for (size_t n=0; (n<nTypes)&&(n<slots.size()); n++) *************** *** 285,289 **** unsigned int itemQuantity = stores->CurrentItemQuantity(itemName); ! AddOrUpdateItem(slot, itemName, itemQuantity); slot.SetUpdated(true); } --- 324,328 ---- unsigned int itemQuantity = stores->CurrentItemQuantity(itemName); ! AddOrUpdateItem(slot, itemName, itemQuantity, stores); slot.SetUpdated(true); } *************** *** 303,316 **** * */ ! tcStoresGui::tcStoresGui(tcStores* obj, const wxPoint& pos, const wxString& configFile) ! : tcContainerGui(pos, configFile, "StoresGui"), stores(obj) { ReadGuiParameters(); InitializeGui(); - - - SetActive(true); --- 342,355 ---- * */ ! tcStoresGui::tcStoresGui(long id, long host, unsigned int idx, const wxPoint& pos, const wxString& configFile) ! : tcContainerGui(pos, configFile, "StoresGui"), ! platformId(id), ! hostId(host), ! storesIdx(idx) { ReadGuiParameters(); InitializeGui(); SetActive(true); Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcGameView.cpp 1 Jun 2005 00:13:30 -0000 1.10 --- tcGameView.cpp 22 Jun 2005 01:22:08 -0000 1.11 *************** *** 502,508 **** } } ! else if ((pMissileObj != NULL)&&(pMissileObj->GetAlliance() == nOwnAlliance)) { ! bShowTarget = mpSS->GetSeekerTrack(mnHookID,track) != 0; } --- 502,512 ---- } } ! else if ((pMissileObj != 0)&&(pMissileObj->GetAlliance() == nOwnAlliance)) { ! tcSensorState* sensor = pMissileObj->GetSeekerSensor(); ! if (sensor != 0) ! { ! bShowTarget = sensor->GetTrack(track); ! } } Index: tcPlatformGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcPlatformGui.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcPlatformGui.cpp 12 Jun 2005 20:46:58 -0000 1.2 --- tcPlatformGui.cpp 22 Jun 2005 01:22:08 -0000 1.3 *************** *** 38,41 **** --- 38,42 ---- #include "tcLauncher.h" #include "tcLauncherContainerItem.h" + #include "tcSimState.h" #include "tcStoresContainerItem.h" #include "tcStoresGui.h" *************** *** 72,76 **** std::string itemName = child->mzClass.mz; item->SetItemName(itemName); ! item->SetLauncher(launcher, launcherIdx); item->SetQuantity(quantity); --- 73,77 ---- std::string itemName = child->mzClass.mz; item->SetItemName(itemName); ! item->SetLauncher(platformId, hostId, launcherIdx); item->SetQuantity(quantity); *************** *** 96,103 **** void tcPlatformGui::Draw() { - if (FinishDestroy()) return; - if (drawCount++ % 4 != 0) return; // update draw every 4th frame UpdateGui(); --- 97,106 ---- void tcPlatformGui::Draw() { if (drawCount++ % 4 != 0) return; // update draw every 4th frame + tcPlatformObject* platform = GetPlatform(); + if (platform == 0) DestroyGui(); + if (FinishDestroy()) return; + UpdateGui(); *************** *** 161,165 **** else if (n < nLaunchers) { ! GetLauncherCompatibilityCaption(n, caption); } else --- 164,168 ---- else if (n < nLaunchers) { ! GetLauncherCompatibilityCaption(n, caption, platform); } else *************** *** 214,225 **** DrawBorder(); ! HideUnusedObjects(); } /** * Creates caption that describes compatible items for launcher */ ! void tcPlatformGui::GetLauncherCompatibilityCaption(unsigned int launcherIdx, wxString& caption) { caption = ""; --- 217,233 ---- DrawBorder(); ! FinishDraw(); } + tcFlightOpsObject* tcPlatformGui::GetFlightOps() + { + return dynamic_cast<tcFlightOpsObject*>(tcSimState::Get()->GetObject(platformId)); + } + /** * Creates caption that describes compatible items for launcher */ ! void tcPlatformGui::GetLauncherCompatibilityCaption(unsigned int launcherIdx, wxString& caption, tcPlatformObject* platform) { caption = ""; *************** *** 237,240 **** --- 245,261 ---- } + tcPlatformObject* tcPlatformGui::GetPlatform() + { + if (hostId == -1) + { + return dynamic_cast<tcPlatformObject*>(tcSimState::Get()->GetObject(platformId)); + } + + tcGameObject* parent = tcSimState::Get()->GetObject(hostId); + if (parent == 0) return 0; + + return dynamic_cast<tcPlatformObject*>(parent->GetChildById(platformId)); + } + void tcPlatformGui::HandleDrop(size_t slotIdx, tcContainerItem* item) { *************** *** 248,251 **** --- 269,275 ---- } + tcPlatformObject* platform = GetPlatform(); + if (platform == 0) return; + if (slotIdx >= nLaunchers) return; // only accept drops to launchers *************** *** 254,260 **** tcStores* magazine = storesItem->GetStores(); ! magazine->LoadLauncher(slotIdx, storesItem->GetItemName(), platform); ! tcSound::Get()->PlayEffect("Thuck"); } --- 278,287 ---- tcStores* magazine = storesItem->GetStores(); ! if (magazine) ! { ! magazine->LoadLauncher(slotIdx, storesItem->GetItemName(), platform); ! tcSound::Get()->PlayEffect("Thuck"); ! } } *************** *** 266,272 **** tcStores* stores = item->GetStores(); - wxASSERT(stores); if (stores == 0) return; stores->LoadOther(itemName, platform); --- 293,301 ---- tcStores* stores = item->GetStores(); if (stores == 0) return; + tcPlatformObject* platform = GetPlatform(); + if (platform == 0) return; + stores->LoadOther(itemName, platform); *************** *** 276,280 **** --- 305,311 ---- void tcPlatformGui::InitializeGui() { + tcPlatformObject* platform = GetPlatform(); wxASSERT(platform); + if (platform == 0) return; // add launcher slots *************** *** 302,306 **** // add flightport slot if applicable ! flightOps = dynamic_cast<tcFlightOpsObject*>(platform); flightPortIdx = nLaunchers + nMagazines; if (flightOps != 0) --- 333,337 ---- // add flightport slot if applicable ! tcFlightOpsObject* flightOps = GetFlightOps(); flightPortIdx = nLaunchers + nMagazines; if (flightOps != 0) *************** *** 393,403 **** void tcPlatformGui::OpenFlightPortGui(tcContainerItem* item) { if (flightOps == 0) return; tcFlightPort* flightPort = flightOps->GetFlightPort(); if (flightPort == 0) return; wxPoint pos = wxWindow::GetPosition(); wxSize size = wxWindow::GetSize(); ! tcFlightPortGui* gui = new tcFlightPortGui(flightPort, wxPoint(pos.x, pos.y + size.GetHeight() + 10), "xml/flightport_gui_default.xml"); wxASSERT(item); --- 424,439 ---- void tcPlatformGui::OpenFlightPortGui(tcContainerItem* item) { + tcFlightOpsObject* flightOps = GetFlightOps(); if (flightOps == 0) return; tcFlightPort* flightPort = flightOps->GetFlightPort(); if (flightPort == 0) return; + tcPlatformObject* platform = GetPlatform(); + wxASSERT(platform != 0); + if (platform == 0) return; + wxPoint pos = wxWindow::GetPosition(); wxSize size = wxWindow::GetSize(); ! tcFlightPortGui* gui = new tcFlightPortGui(platform->mnID, wxPoint(pos.x, pos.y + size.GetHeight() + 10), "xml/flightport_gui_default.xml"); wxASSERT(item); *************** *** 411,414 **** --- 447,453 ---- void tcPlatformGui::OpenMagazineGui(unsigned int idx, tcContainerItem* item) { + tcPlatformObject* platform = GetPlatform(); + if (platform == 0) return; + tcStores* magazine = platform->GetMagazine(idx); if (magazine) *************** *** 416,420 **** wxPoint pos = wxWindow::GetPosition(); wxSize size = wxWindow::GetSize(); ! tcStoresGui* gui = new tcStoresGui(magazine, wxPoint(pos.x + size.GetWidth() + 10, pos.y), "xml/stores_gui_default.xml"); wxASSERT(item); --- 455,459 ---- wxPoint pos = wxWindow::GetPosition(); wxSize size = wxWindow::GetSize(); ! tcStoresGui* gui = new tcStoresGui(platformId, hostId, idx, wxPoint(pos.x + size.GetWidth() + 10, pos.y), "xml/stores_gui_default.xml"); wxASSERT(item); *************** *** 503,506 **** --- 542,548 ---- void tcPlatformGui::UpdateGui() { + tcPlatformObject* platform = GetPlatform(); + if (platform == 0) return; + // mark all slots not updated for (size_t n=0; n<slots.size(); n++) *************** *** 598,604 **** * */ ! tcPlatformGui::tcPlatformGui(tcPlatformObject* obj, const wxPoint& pos, const wxString& configFile) ! : tcContainerGui(pos, configFile, "PlatformGui"), platform(obj) { ReadGuiParameters(); --- 640,648 ---- * */ ! tcPlatformGui::tcPlatformGui(long id, long host, const wxPoint& pos, const wxString& configFile) ! : tcContainerGui(pos, configFile, "PlatformGui"), ! platformId(id), ! hostId(host) { ReadGuiParameters(); Index: tcStoresContainerItem.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcStoresContainerItem.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcStoresContainerItem.cpp 11 Jun 2005 21:01:44 -0000 1.1 --- tcStoresContainerItem.cpp 22 Jun 2005 01:22:08 -0000 1.2 *************** *** 28,32 **** #include "tcStoresContainerItem.h" ! #ifdef _DEBUG --- 28,33 ---- #include "tcStoresContainerItem.h" ! #include "tcSimState.h" ! #include "tcPlatformObject.h" #ifdef _DEBUG *************** *** 35,51 **** ! tcStores* tcStoresContainerItem::GetStores() const { ! return parent; } ! void tcStoresContainerItem::SetStores(tcStores* stores) { ! parent = stores; } tcStoresContainerItem::tcStoresContainerItem() ! : parent(0) { } --- 36,75 ---- ! /** ! * @return pointer to stores object ! * This is done dynamically to handle case where object is deleted ! */ tcStores* tcStoresContainerItem::GetStores() const { ! tcPlatformObject* platform = 0; ! ! if (hostId == -1) ! { ! platform = dynamic_cast<tcPlatformObject*> ! (tcSimState::Get()->GetObject(platformId)); ! } ! else ! { ! tcGameObject* parent = tcSimState::Get()->GetObject(hostId); ! if (parent == 0) return 0; ! platform = dynamic_cast<tcPlatformObject*>(parent->GetChildById(platformId)); ! } ! ! if (platform == 0) return 0; ! ! return platform->GetMagazine(storesIdx); } ! void tcStoresContainerItem::SetStores(long id, long host, unsigned int idx) { ! platformId = id; ! hostId = host; ! storesIdx = idx; } tcStoresContainerItem::tcStoresContainerItem() ! : platformId(-1), ! hostId(-1), ! storesIdx(0) { } Index: tcLauncherContainerItem.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcLauncherContainerItem.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcLauncherContainerItem.cpp 11 Jun 2005 21:01:44 -0000 1.1 --- tcLauncherContainerItem.cpp 22 Jun 2005 01:22:08 -0000 1.2 *************** *** 28,32 **** #include "tcLauncherContainerItem.h" ! #ifdef _DEBUG --- 28,33 ---- #include "tcLauncherContainerItem.h" ! #include "tcPlatformObject.h" ! #include "tcSimState.h" #ifdef _DEBUG *************** *** 37,41 **** tcLauncher* tcLauncherContainerItem::GetLauncher() const { ! return parent; } --- 38,58 ---- tcLauncher* tcLauncherContainerItem::GetLauncher() const { ! tcPlatformObject* platform = 0; ! ! if (hostId == -1) ! { ! platform = dynamic_cast<tcPlatformObject*> ! (tcSimState::Get()->GetObject(platformId)); ! } ! else ! { ! tcGameObject* parent = tcSimState::Get()->GetObject(hostId); ! if (parent == 0) return 0; ! platform = dynamic_cast<tcPlatformObject*>(parent->GetChildById(platformId)); ! } ! ! if (platform == 0) return 0; ! ! return platform->GetLauncher(launcherIdx); } *************** *** 45,51 **** } ! void tcLauncherContainerItem::SetLauncher(tcLauncher* launcher, unsigned int idx) { ! parent = launcher; launcherIdx = idx; } --- 62,69 ---- } ! void tcLauncherContainerItem::SetLauncher(long id, long host, unsigned int idx) { ! platformId = id; ! hostId = host; launcherIdx = idx; } *************** *** 53,57 **** tcLauncherContainerItem::tcLauncherContainerItem() ! : parent(0), launcherIdx(0) { --- 71,76 ---- tcLauncherContainerItem::tcLauncherContainerItem() ! : platformId(-1), ! hostId(-1), launcherIdx(0) { |