Commit MetaInfo

Revision97e4cb549dd5b048e54c1b7ab3681550180da79a (tree)
Time2009-08-18 15:51:35
AuthorFace
CommiterFace

Log Message

Finished PAX tunnel to UMmuBase.

Change Summary

Incremental Difference

diff -r c4d7ddd3a5c6 -r 97e4cb549dd5 Orbitersdk/samples/UMMUFB/PAX.cpp
--- a/Orbitersdk/samples/UMMUFB/PAX.cpp Sat Aug 15 20:14:06 2009 +0200
+++ b/Orbitersdk/samples/UMMUFB/PAX.cpp Tue Aug 18 08:51:35 2009 +0200
@@ -65,41 +65,67 @@
6565 GetObject(GetCurrentObject(hDC, OBJ_PEN), sizeof(LOGPEN), &pen);
6666 middleGreen=pen.lopnColor;
6767 }
68- GetLandedPad(vessel, base, pad);
69- if (pad>0)
68+ if (IsUMmuBase(vessel))
7069 {
7170 SetTextColor(hDC, RGB(255,255,255));
72- sprintf(line[0], "WELCOME AT GATE %d OF", pad);
73- oapiGetObjectName(base, line[1], MFD_LINELENGTH);
71+ sprintf(line[0], "WELCOME AT TOWER OF", pad);
72+ char *vesselName=vessel->GetName();
73+ strncpy(line[1], vesselName, min(MFD_LINELENGTH, strlen(vesselName)));
7474 CenterTextOut(hDC, 7, line[0]);
75- CenterTextOut(hDC, 9, line[1], -1, true);
76- if (GetPAX(vessel))
75+ CenterTextOut(hDC, 9, line[1], -1, true);
76+ DOCKHANDLE port=vessel->GetDockHandle(0);
77+ OBJHANDLE pax=vessel->GetDockStatus(port);
78+ VESSEL *paxv=NULL;
79+ if (pax!=NULL) paxv=oapiGetVesselInterface(pax);
80+ if (paxv!=NULL)
7781 {
78- double time=oapiGetSimTime();
79- if ((time-lastTime)>0.5)
80- {
81- blink=!blink;
82- lastTime=time;
83- }
84- if (blink) SetTextColor(hDC, RGB(255,255,0));
85- else SetTextColor(hDC, middleGreen);
86- CenterTextOut(hDC, 13, "Ready for PAX");
87- SelectDefaultFont (hDC, 1);
88- SetTextColor(hDC, middleGreen);
89- CenterTextOut(hDC, 26, "Press PAX again after boarding completed", 1);
82+ SetTextColor(hDC, RGB(255,255,0));
83+ CenterTextOut(hDC, 13, vessel->GetName());
9084 }
9185 else
92- {
93- SelectDefaultFont (hDC, 1);
86+ {
9487 SetTextColor(hDC, middleGreen);
95- CenterTextOut(hDC, 26, "Press PAX for passenger operations", 1);
88+ CenterTextOut(hDC, 13, "No PAX");
9689 }
9790 }
9891 else
9992 {
100- DelPAX(vessel);
101- SetTextColor(hDC, middleGreen);
102- CenterTextOut(hDC, 13, "NO SERVICE");
93+ GetLandedPad(vessel, base, pad);
94+ if (pad>0)
95+ {
96+ SetTextColor(hDC, RGB(255,255,255));
97+ sprintf(line[0], "WELCOME AT GATE %d OF", pad);
98+ oapiGetObjectName(base, line[1], MFD_LINELENGTH);
99+ CenterTextOut(hDC, 7, line[0]);
100+ CenterTextOut(hDC, 9, line[1], -1, true);
101+ if (GetPAX(vessel))
102+ {
103+ double time=oapiGetSimTime();
104+ if ((time-lastTime)>0.5)
105+ {
106+ blink=!blink;
107+ lastTime=time;
108+ }
109+ if (blink) SetTextColor(hDC, RGB(255,255,0));
110+ else SetTextColor(hDC, middleGreen);
111+ CenterTextOut(hDC, 13, "Ready for PAX");
112+ SelectDefaultFont (hDC, 1);
113+ SetTextColor(hDC, middleGreen);
114+ CenterTextOut(hDC, 26, "Press PAX again after boarding completed", 1);
115+ }
116+ else
117+ {
118+ SelectDefaultFont (hDC, 1);
119+ SetTextColor(hDC, middleGreen);
120+ CenterTextOut(hDC, 26, "Press PAX for passenger operations", 1);
121+ }
122+ }
123+ else
124+ {
125+ DelPAX(vessel);
126+ SetTextColor(hDC, middleGreen);
127+ CenterTextOut(hDC, 13, "NO SERVICE");
128+ }
103129 }
104130 }
105131
diff -r c4d7ddd3a5c6 -r 97e4cb549dd5 Orbitersdk/samples/UMMUFB/UMMUFB.cpp
--- a/Orbitersdk/samples/UMMUFB/UMMUFB.cpp Sat Aug 15 20:14:06 2009 +0200
+++ b/Orbitersdk/samples/UMMUFB/UMMUFB.cpp Tue Aug 18 08:51:35 2009 +0200
@@ -86,13 +86,15 @@
8686 OBJHANDLE _stdcall GetDockStatus(VESSEL *vessel, DOCKHANDLE dock)
8787 {
8888 //Do my own GetDockStatus
89- if (BaseByVessel().find(vessel)!=BaseByVessel().end())
89+ std::map<VESSEL *, OBJHANDLE>::iterator el=BaseByVessel().find(vessel);
90+ if (el!=BaseByVessel().end())
9091 {
92+ if (IsUMmuBase(vessel)) return el->second;
9193 OBJHANDLE base;
9294 DWORD port;
9395 GetLandedPad(vessel, base, port);
94- if (port>0) return BaseByVessel()[vessel];
95- else BaseByVessel().erase(vessel);
96+ if (port>0) return el->second;
97+ else DelPAX(vessel);
9698 }
9799 //Original function content
98100 return *(OBJHANDLE *)(void *)((char *)dock+DOCKSTRUCTOFFSET_CURRENTDOCKOBJECT);
@@ -166,13 +168,16 @@
166168
167169 void SetPAX(VESSEL *vessel)
168170 {
171+ OBJHANDLE me=vessel->GetHandle();
169172 for (int i=0;i<oapiGetVesselCount();i++)
170173 {
171174 OBJHANDLE base=oapiGetVesselByIndex(i);
172- char *className=oapiGetVesselInterface(base)->GetClassName();
173- if (className!=NULL) if (strncmp(className, "UMmuBase", strlen(className))==0)
175+ VESSEL *baseVessel=oapiGetVesselInterface(base);
176+ if (base!=me)
177+ if (IsUMmuBase(baseVessel))
174178 {
175179 BaseByVessel()[vessel]=base;
180+ BaseByVessel()[baseVessel]=vessel->GetHandle();
176181 break;
177182 }
178183 }
@@ -185,5 +190,17 @@
185190
186191 void DelPAX(VESSEL *vessel)
187192 {
188- BaseByVessel().erase(vessel);
193+ std::map<VESSEL *, OBJHANDLE>::iterator el=BaseByVessel().find(vessel);
194+ if (el!=BaseByVessel().end())
195+ {
196+ BaseByVessel().erase(oapiGetVesselInterface(el->second));
197+ BaseByVessel().erase(el->first);
198+ }
199+}
200+
201+bool IsUMmuBase(VESSEL *vessel)
202+{
203+ char *className=vessel->GetClassName();
204+ if (className!=NULL) if (strcmp(className, "UMmuBase")==0) return true;
205+ return false;
189206 }
\ No newline at end of file
diff -r c4d7ddd3a5c6 -r 97e4cb549dd5 Orbitersdk/samples/UMMUFB/UMMUFB.h
--- a/Orbitersdk/samples/UMMUFB/UMMUFB.h Sat Aug 15 20:14:06 2009 +0200
+++ b/Orbitersdk/samples/UMMUFB/UMMUFB.h Tue Aug 18 08:51:35 2009 +0200
@@ -4,3 +4,4 @@
44 void SetPAX(VESSEL*);
55 void DelPAX(VESSEL*);
66 bool GetPAX(VESSEL*);
7+bool IsUMmuBase(VESSEL*);
Show on old repository browser