Update of /cvsroot/gcblue/gcb_wx/src/graphics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17986/src/graphics
Modified Files:
tcMapObject.cpp tcMapOverlay.cpp tcScenarioSelectView.cpp
Log Message:
Landing bug fix, changed /gm create to require starting coords, added fuel to air update
Index: tcMapOverlay.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapOverlay.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tcMapOverlay.cpp 31 Mar 2005 03:51:13 -0000 1.1
--- tcMapOverlay.cpp 8 May 2005 23:28:58 -0000 1.2
***************
*** 31,34 ****
--- 31,36 ----
#include "tcMapObject.h"
#include "tcMapObject.h"
+ #include "common/tcStream.h"
+ #include "common/tcObjStream.h"
#ifdef _DEBUG
***************
*** 36,39 ****
--- 38,101 ----
#endif
+
+ /**
+ * Loads state from stream
+ */
+ tcUpdateStream& tcMapOverlay::operator<<(tcUpdateStream& stream)
+ {
+ overlayObjects.clear();
+ unsigned int nObjects;
+ stream >> nObjects;
+
+ for (unsigned int n=0; n<nObjects; n++)
+ {
+ unsigned char typeCode;
+ stream >> typeCode;
+
+ if (typeCode == 1)
+ {
+ tcMapObject* obj = new tcMapTextObject();
+ obj->operator<<(stream);
+
+ AddMapObject(obj);
+ }
+ else
+ {
+ fprintf(stderr, "tcMapOverlay::operator<< -- unrecognized type code\n");
+ wxASSERT(false);
+ }
+ }
+
+ return stream;
+ }
+
+ /**
+ * Saves state to stream
+ */
+ tcUpdateStream& tcMapOverlay::operator>>(tcUpdateStream& stream)
+ {
+ unsigned int nObjects = overlayObjects.size();
+ stream << nObjects;
+
+ for (unsigned int n=0; n<nObjects; n++)
+ {
+ unsigned char typeCode = 0;
+ tcMapObject* obj = overlayObjects[n];
+ if (dynamic_cast<tcMapTextObject*>(obj))
+ {
+ typeCode = 1;
+ stream << typeCode;
+ overlayObjects[n]->operator>>(stream);
+ }
+ else
+ {
+ typeCode = 0;
+ stream << typeCode;
+ }
+ }
+
+ return stream;
+ }
+
void tcMapOverlay::AddMapObject(tcMapObject *obj)
{
Index: tcMapObject.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapObject.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** tcMapObject.cpp 31 Mar 2005 03:51:12 -0000 1.7
--- tcMapObject.cpp 8 May 2005 23:28:58 -0000 1.8
***************
*** 33,36 ****
--- 33,39 ----
#include "simmath.h"
#include <osg/Geometry>
+ #include "common/tcStream.h"
+ #include "common/tcObjStream.h"
+
#ifdef _DEBUG
***************
*** 44,47 ****
--- 47,88 ----
osg::ref_ptr<osg::Geometry> tcMapObject::marker;
+ /**
+ * Loads state from stream
+ */
+ tcUpdateStream& tcMapObject::operator<<(tcUpdateStream& stream)
+ {
+ stream >> color._v[0];
+ stream >> color._v[1];
+ stream >> color._v[2];
+ stream >> color._v[3];
+
+ stream >> isActive;
+ stream >> markerEnabled;
+ stream >> useRelativeCoords;
+ stream >> _x;
+ stream >> _y;
+
+ return stream;
+ }
+
+ /**
+ * Saves state to stream
+ */
+ tcUpdateStream& tcMapObject::operator>>(tcUpdateStream& stream)
+ {
+ stream << color._v[0];
+ stream << color._v[1];
+ stream << color._v[2];
+ stream << color._v[3];
+
+ stream << isActive;
+ stream << markerEnabled;
+ stream << useRelativeCoords;
+ stream << _x;
+ stream << _y;
+
+ return stream;
+ }
+
void tcMapObject::LoadMarker()
{
***************
*** 170,173 ****
--- 211,240 ----
/********** tcMapTextObject **************/
+ /**
+ * Loads state from stream
+ */
+ tcUpdateStream& tcMapTextObject::operator<<(tcUpdateStream& stream)
+ {
+ tcMapObject::operator<<(stream);
+
+ stream >> caption;
+
+ return stream;
+ }
+
+
+ /**
+ * Saves state to stream
+ */
+ tcUpdateStream& tcMapTextObject::operator>>(tcUpdateStream& stream)
+ {
+ tcMapObject::operator>>(stream);
+
+ stream << caption;
+
+ return stream;
+ }
+
+
void tcMapTextObject::Draw(tc3DWindow* host)
{
Index: tcScenarioSelectView.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcScenarioSelectView.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** tcScenarioSelectView.cpp 27 Jan 2005 01:01:50 -0000 1.9
--- tcScenarioSelectView.cpp 8 May 2005 23:28:58 -0000 1.10
***************
*** 37,40 ****
--- 37,41 ----
#include "tcSimPythonInterface.h"
#include "common/tinyxml.h"
+ #include "network/tcMultiplayerInterface.h"
#ifdef _DEBUG
***************
*** 203,206 ****
--- 204,209 ----
void tcScenarioSelectView::LoadScenario(std::string filePath, std::string caption)
{
+ using network::tcMultiplayerInterface;
+
std::string totalPath = SCENARIO_PATH;
totalPath += "\\"; // generalize this for Linux?
***************
*** 222,225 ****
--- 225,233 ----
tcOptions::Get()->SetOptionString("LastScenarioPath", filePath.c_str());
tcOptions::Get()->SetOptionString("LastScenarioName", caption.c_str());
+
+ if (mpSimState->IsMultiplayerServer())
+ {
+ tcMultiplayerInterface::Get()->BroadcastScenarioInfo();
+ }
}
else
|