Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
base_util.cpp
Go to the documentation of this file.
1 #include <Python.h>
2 #include "python/python_class.h"
3 #include <string>
4 #include <stdlib.h>
5 #include "audiolib.h"
6 #include "base.h"
7 #include "base_util.h"
8 #include "universe_util.h"
9 #include "basecomputer.h"
10 #include "main_loop.h"
11 #include "music.h"
12 
13 #include <boost/version.hpp>
14 #if BOOST_VERSION != 102800
15 #include <boost/python.hpp>
16 typedef boost::python::dict BoostPythonDictionary;
17 #else
18 #include <boost/python/objects.hpp>
19 typedef boost::python::dictionary BoostPythonDictionary;
20 #endif
21 
22 #if BOOST_VERSION != 102800
23 #include <boost/python/object.hpp>
24 #include <boost/python/dict.hpp>
25 #else
26 #include <boost/python/objects.hpp>
27 #endif
28 
29 #include "in_kb.h"
30 
31 
32 #include "audio/SceneManager.h"
33 #include "audio/Sound.h"
34 #include "audio/Source.h"
35 #include "audio/SourceListener.h"
36 #include "audio/Renderer.h"
37 #include "audio/Scene.h"
38 
39 extern float getFontHeight();
40 
41 using Audio::Source;
42 using Audio::Sound;
45 using Audio::LVector3;
46 using Audio::Vector3;
47 
48 
49 namespace BaseUtil
50 {
51 inline BaseInterface::Room * CheckRoom( int room )
52 {
53  if (!BaseInterface::CurrentBase) return 0;
54  if ( room < 0 || room >= static_cast<int>(BaseInterface::CurrentBase->rooms.size()) ) return 0;
55  return BaseInterface::CurrentBase->rooms[room];
56 }
57 
58 
59 /*
60  * Ad-hoc listener used to trigger end-of-stream behavior
61  */
62 
64 {
65  int sourceRoom;
66  std::string index;
67 
68 public:
69  VideoAudioStreamListener(int sourceRoom, const std::string &index)
70  {
71  // Just play events
72  events.attach =
73  events.update = 0;
74  events.play = 1;
75 
76  this->sourceRoom = sourceRoom;
77  this->index = index;
78  }
79 
80  virtual void onPreAttach(Source &source, bool detach) {};
81  virtual void onPostAttach(Source &source, bool detach) {};
82  virtual void onPrePlay(Source &source, bool stop) {};
83  virtual void onPostPlay(Source &source, bool stop) {};
84  virtual void onUpdate(Source &source, int updateFlags) {};
85 
86  virtual void onEndOfStream(Source &source)
87  {
88  // Verify context before switching rooms
89  if (BaseInterface::CurrentBase != NULL) {
90  if (BaseUtil::GetCurRoom() == sourceRoom) {
91  // We're in the right context, switch to target room
92  BaseInterface::Room *room = CheckRoom( sourceRoom );
93 
94  if (!room)
95  return;
96 
97  for (size_t i = 0; i < room->objs.size(); i++) {
98  if (room->objs[i]) {
99  if (room->objs[i]->index == index) {
100  //FIXME: Will crash if not a Movie object.
102  dynamic_cast< BaseInterface::Room::BaseVSMovie* > (room->objs[i]);
103 
104  if (!movie->getCallback().empty()) {
105  RunPython(movie->getCallback().c_str());
106  break;
107  }
108  }
109  }
110  }
111  }
112  }
113  };
114 };
115 
116 
117 int Room( std::string text )
118 {
119  if (!BaseInterface::CurrentBase) return -1;
121  BaseInterface::CurrentBase->rooms.back()->deftext = text;
122  return BaseInterface::CurrentBase->rooms.size()-1;
123 }
124 void Texture( int room, std::string index, std::string file, float x, float y )
125 {
126  BaseInterface::Room *newroom = CheckRoom( room );
127  if (!newroom) return;
128  newroom->objs.push_back( new BaseInterface::Room::BaseVSSprite( file.c_str(), index ) );
129 #ifdef BASE_MAKER
130  ( (BaseInterface::Room::BaseVSSprite*) newroom->objs.back() )->texfile = file;
131 #endif
132  float tx = 0, ty = 0;
133  static bool addspritepos = XMLSupport::parse_bool( vs_config->getVariable( "graphics", "offset_sprites_by_pos", "true" ) );
134  if (addspritepos)
135  ( (BaseInterface::Room::BaseVSSprite*) newroom->objs.back() )->spr.GetPosition( tx, ty );
136  dynamic_cast< BaseInterface::Room::BaseVSSprite* > ( newroom->objs.back() )->spr.SetPosition( x+tx, y+ty );
137 }
138 
139 SharedPtr<Source> CreateVideoSoundStream( const std::string &afile, const std::string &scene )
140 {
141  SharedPtr<Sound> sound = SceneManager::getSingleton()->getRenderer()->getSound(
142  afile,
144  true);
145 
146  SharedPtr<Source> source = SceneManager::getSingleton()->createSource(
147  sound,
148  false);
149 
150  source->setAttenuated(false);
151  source->setRelative(true);
152  source->setPosition(LVector3(0,0,1));
153  source->setDirection(Vector3(0,0,-1));
154  source->setVelocity(Vector3(0,0,0));
155  source->setRadius(1.0);
156  source->setGain(1.0);
157 
158  SceneManager::getSingleton()->getScene(scene)->add(source);
159 
160  return source;
161 }
162 
163 void DestroyVideoSoundStream( SharedPtr<Source> source, const std::string &scene )
164 {
165  if (source->isPlaying())
166  source->stopPlaying();
167  SceneManager::getSingleton()->getScene(scene)->remove(source);
168 }
169 
170 bool Video( int room, std::string index, std::string vfile, std::string afile, float x, float y )
171 {
172  BaseInterface::Room *newroom = CheckRoom( room );
173  if (!newroom) return false;
174  BaseUtil::Texture( room, index, vfile, x, y );
175 
176  BaseInterface::Room::BaseVSSprite *baseSprite = dynamic_cast< BaseInterface::Room::BaseVSSprite* > ( newroom->objs.back() );
177 
178  if (!afile.empty()) {
179  if (g_game.sound_enabled) {
180  try {
181  baseSprite->soundscene = "video";
182  baseSprite->soundsource = CreateVideoSoundStream( afile, baseSprite->soundscene );
183  baseSprite->spr.SetTimeSource( baseSprite->soundsource );
184  } catch(Audio::FileOpenException e) {
185  baseSprite->spr.Reset();
186  } catch(VidFile::FileOpenException e) {
187  baseSprite->spr.Reset();
188  }
189  } else {
190  baseSprite->spr.Reset();
191  }
192  }
193 
194  return true;
195 }
196 bool VideoStream( int room, std::string index, std::string streamfile, float x, float y, float w, float h )
197 {
198  BaseInterface::Room *newroom = CheckRoom( room );
199  if (!newroom) {
200  fprintf(stderr, "ERROR: Room not found!!\n");
201  return false;
202  }
203 
204  BaseInterface::Room::BaseVSMovie *newobj = new BaseInterface::Room::BaseVSMovie( streamfile, index );
205  newobj->SetPos( x, y );
206  newobj->SetSize( w, h );
207 
208 #ifdef BASE_MAKER
209  newobj->texfile = file;
210 #endif
211 
212  if (newobj->spr.LoadSuccess()) {
213  fprintf(stdout, "INFO: Added video stream %s\n", streamfile.c_str());
214  newroom->objs.push_back( newobj );
215  } else {
216  fprintf(stdout, "INFO: Missing video stream %s\n", streamfile.c_str());
217  delete newobj;
218  return false;
219  }
220 
221  return true;
222 }
223 void SetVideoCallback( int room, std::string index, std::string callback)
224 {
225  BaseInterface::Room *newroom = CheckRoom( room );
226  if (!newroom) return;
227  for (size_t i = 0; i < newroom->objs.size(); i++) {
228  if (newroom->objs[i]) {
229  if (newroom->objs[i]->index == index) {
230  //FIXME: Will crash if not a Sprite object.
232  dynamic_cast< BaseInterface::Room::BaseVSMovie* > (newroom->objs[i]);
233  movie->setCallback(callback);
234 
235  if (movie->soundsource.get() != NULL) {
236  SharedPtr<SourceListener> transitionListener(
237  new VideoAudioStreamListener(room, index) );
238 
239  movie->soundsource->setSourceListener(transitionListener);
240  }
241  }
242  }
243  }
244 }
245 void SetTexture( int room, std::string index, std::string file )
246 {
247  BaseInterface::Room *newroom = CheckRoom( room );
248  if (!newroom) return;
249  for (size_t i = 0; i < newroom->objs.size(); i++)
250  if (newroom->objs[i]) {
251  if (newroom->objs[i]->index == index)
252  //FIXME: Will crash if not a Sprite object.
253  dynamic_cast< BaseInterface::Room::BaseVSSprite* > (newroom->objs[i])->SetSprite( file );
254  }
255 }
256 void SetTextureSize( int room, std::string index, float w, float h )
257 {
258  BaseInterface::Room *newroom = CheckRoom( room );
259  if (!newroom) return;
260  for (size_t i = 0; i < newroom->objs.size(); i++)
261  if (newroom->objs[i]) {
262  if (newroom->objs[i]->index == index)
263  //FIXME: Will crash if not a Sprite object.
264  dynamic_cast< BaseInterface::Room::BaseVSSprite* > (newroom->objs[i])->SetSize( w, h );
265  }
266 }
267 void SetTexturePos( int room, std::string index, float x, float y )
268 {
269  BaseInterface::Room *newroom = CheckRoom( room );
270  if (!newroom) return;
271  for (size_t i = 0; i < newroom->objs.size(); i++)
272  if (newroom->objs[i]) {
273  if (newroom->objs[i]->index == index)
274  //FIXME: Will crash if not a Sprite object.
275  dynamic_cast< BaseInterface::Room::BaseVSSprite* > (newroom->objs[i])->SetPos( x, y );
276  }
277 }
278 void PlayVideo( int room, std::string index )
279 {
280  BaseInterface::Room *newroom = CheckRoom( room );
281  if (!newroom) return;
282  for (size_t i = 0; i < newroom->objs.size(); i++)
283  if (newroom->objs[i]) {
284  if (newroom->objs[i]->index == index) {
285  //FIXME: Will crash if not a Sprite object.
286  SharedPtr<Source> source = dynamic_cast< BaseInterface::Room::BaseVSSprite* > (newroom->objs[i])->soundsource;
287  if (source.get() != NULL) {
288  if (!source->isPlaying())
289  source->startPlaying();
290  }
291  }
292  }
293 }
294 void StopVideo( int room, std::string index )
295 {
296  BaseInterface::Room *newroom = CheckRoom( room );
297  if (!newroom) return;
298  for (size_t i = 0; i < newroom->objs.size(); i++)
299  if (newroom->objs[i]) {
300  if (newroom->objs[i]->index == index) {
301  //FIXME: Will crash if not a Sprite object.
302  SharedPtr<Source> source = dynamic_cast< BaseInterface::Room::BaseVSSprite* > (newroom->objs[i])->soundsource;
303  if (source.get() != NULL) {
304  if (source->isPlaying())
305  source->stopPlaying();
306  }
307  }
308  }
309 }
310 void SetDJEnabled( bool enabled )
311 {
313  if (!enabled)
314  Music::Stop();
315 }
316 void Ship( int room, std::string index, QVector pos, Vector Q, Vector R )
317 {
318  BaseInterface::Room *newroom = CheckRoom( room );
319  if (!newroom) return;
320  Vector P = R.Cross( Q );
321  P.Normalize();
322  newroom->objs.push_back( new BaseInterface::Room::BaseShip( P.i, P.j, P.k, Q.i, Q.j, Q.k, R.i, R.j, R.k, pos, index ) );
323 }
324 void RunScript( int room, std::string ind, std::string pythonfile, float time )
325 {
326  BaseInterface::Room *newroom = CheckRoom( room );
327  if (!newroom) return;
328  newroom->objs.push_back( new BaseInterface::Room::BasePython( ind, pythonfile, time ) );
329 }
330 void TextBox( int room,
331  std::string ind,
332  std::string text,
333  float x,
334  float y,
335  Vector widheimult,
336  Vector backcol,
337  float backalp,
338  Vector forecol )
339 {
340  BaseInterface::Room *newroom = CheckRoom( room );
341  if (!newroom) return;
342  newroom->objs.push_back( new BaseInterface::Room::BaseText( text, x, y, widheimult.i, widheimult.j, widheimult.k,
343  GFXColor( backcol, backalp ), GFXColor( forecol ), ind ) );
344 }
345 void SetTextBoxText( int room, std::string index, std::string text )
346 {
347  BaseInterface::Room *newroom = CheckRoom( room );
348  if (!newroom) return;
349  for (size_t i = 0; i < newroom->objs.size(); i++)
350  if (newroom->objs[i]) {
351  if (newroom->objs[i]->index == index)
352  //FIXME: Will crash if not a Text object.
353  dynamic_cast< BaseInterface::Room::BaseText* > (newroom->objs[i])->SetText( text );
354  }
355 }
356 void SetLinkArea( int room, std::string index, float x, float y, float wid, float hei )
357 {
358  BaseInterface::Room *newroom = CheckRoom( room );
359  if (!newroom) return;
360  for (size_t i = 0; i < newroom->links.size(); i++)
361  if (newroom->links[i]) {
362  if (newroom->links[i]->index == index) {
363  newroom->links[i]->x = x;
364  newroom->links[i]->y = y;
365  newroom->links[i]->wid = wid;
366  newroom->links[i]->hei = hei;
367  }
368  }
369 }
370 void SetLinkText( int room, std::string index, std::string text )
371 {
372  BaseInterface::Room *newroom = CheckRoom( room );
373  if (!newroom) return;
374  for (size_t i = 0; i < newroom->links.size(); i++)
375  if (newroom->links[i])
376  if (newroom->links[i]->index == index)
377  newroom->links[i]->text = text;
378 }
379 void SetLinkPython( int room, std::string index, std::string python )
380 {
381  BaseInterface::Room *newroom = CheckRoom( room );
382  if (!newroom) return;
383  for (size_t i = 0; i < newroom->links.size(); i++)
384  if (newroom->links[i])
385  if (newroom->links[i]->index == index)
386  newroom->links[i]->Relink( python );
387 }
388 void SetLinkRoom( int room, std::string index, int to )
389 {
390  BaseInterface::Room *newroom = CheckRoom( room );
391  if (!newroom) return;
392  for (size_t i = 0; i < newroom->links.size(); i++)
393  if (newroom->links[i]) {
394  if (newroom->links[i]->index == index)
395  //FIXME: Will crash if not a Goto object.
396  dynamic_cast< BaseInterface::Room::Goto* > (newroom->links[i])->index = to;
397  }
398 }
399 void SetLinkEventMask( int room, std::string index, std::string maskdef )
400 {
401  size_t i;
402  //c=click, u=up, d=down, e=enter, l=leave, m=move
403  unsigned int mask = 0;
404  for (i = 0; i < maskdef.length(); ++i) {
405  switch (maskdef[i])
406  {
407  case 'c':
408  case 'C':
410  break;
411  case 'u':
412  case 'U':
414  break;
415  case 'd':
416  case 'D':
418  break;
419  case 'e':
420  case 'E':
422  break;
423  case 'l':
424  case 'L':
426  break;
427  case 'm':
428  case 'M':
429  fprintf( stderr, "%s: WARNING: Ignoring request for movement event mask.\n", __FILE__ );
430  break;
431  }
432  }
433  BaseInterface::Room *newroom = CheckRoom( room );
434  if (!newroom) return;
435  for (i = 0; i < newroom->links.size(); i++)
436  if (newroom->links[i]) {
437  if (newroom->links[i]->index == index)
438  //FIXME: Will crash if not a Goto object.
439  newroom->links[i]->setEventMask( mask );
440  }
441 }
442 static void BaseLink( BaseInterface::Room *room, float x, float y, float wid, float hei, std::string text, bool reverse = false )
443 {
445  if (reverse)
446  lnk = room->links.front();
447  else
448  lnk = room->links.back();
449  lnk->x = x;
450  lnk->y = y;
451  lnk->wid = wid;
452  lnk->hei = hei;
453  lnk->text = text;
454 }
455 void Link( int room, std::string index, float x, float y, float wid, float hei, std::string text, int to )
456 {
457  LinkPython( room, index, "", x, y, wid, hei, text, to );
458 }
459 void LinkPython( int room,
460  std::string index,
461  std::string pythonfile,
462  float x,
463  float y,
464  float wid,
465  float hei,
466  std::string text,
467  int to )
468 {
469  BaseInterface::Room *newroom = CheckRoom( room );
470  if (!newroom) return;
471  newroom->links.push_back( new BaseInterface::Room::Goto( index, pythonfile ) );
472  BaseLink( newroom, x, y, wid, hei, text );
473  ( (BaseInterface::Room::Goto*) newroom->links.back() )->index = to;
474 }
475 void Launch( int room, std::string index, float x, float y, float wid, float hei, std::string text )
476 {
477  LaunchPython( room, index, "", x, y, wid, hei, text );
478 }
479 void LaunchPython( int room,
480  std::string index,
481  std::string pythonfile,
482  float x,
483  float y,
484  float wid,
485  float hei,
486  std::string text )
487 {
488  BaseInterface::Room *newroom = CheckRoom( room );
489  if (!newroom) return;
490  newroom->links.push_back( new BaseInterface::Room::Launch( index, pythonfile ) );
491  BaseLink( newroom, x, y, wid, hei, text );
492 }
493 void EjectPython( int room, std::string index, std::string pythonfile, float x, float y, float wid, float hei, std::string text )
494 {
495  BaseInterface::Room *newroom = CheckRoom( room );
496  if (!newroom) return;
497  newroom->links.push_back( new BaseInterface::Room::Eject( index, pythonfile ) );
498  BaseLink( newroom, x, y, wid, hei, text );
499 }
500 void Comp( int room, std::string index, float x, float y, float wid, float hei, std::string text, std::string modes )
501 {
502  CompPython( room, index, "", x, y, wid, hei, text, modes );
503 }
504 void CompPython( int room,
505  std::string index,
506  std::string pythonfile,
507  float x,
508  float y,
509  float wid,
510  float hei,
511  std::string text,
512  std::string modes )
513 {
514  BaseInterface::Room *newroom = CheckRoom( room );
515  if (!newroom) return;
516  BaseInterface::Room::Comp *newcomp = new BaseInterface::Room::Comp( index, pythonfile );
517  newroom->links.push_back( newcomp );
518  BaseLink( newroom, x, y, wid, hei, text );
519  static const EnumMap::Pair modelist[] = {
521  EnumMap::Pair( "Upgrade", BaseComputer::UPGRADE ),
522  EnumMap::Pair( "ShipDealer", BaseComputer::SHIP_DEALER ),
523  EnumMap::Pair( "Missions", BaseComputer::MISSIONS ),
526  EnumMap::Pair( "LoadSave", BaseComputer::LOADSAVE ),
527  EnumMap::Pair( "Network", BaseComputer::NETWORK ),
529  };
530  static const EnumMap modemap( modelist, sizeof (modelist)/sizeof (*modelist) );
531  const char *newmode = modes.c_str();
532  int newlen = modes.size();
533  char *curmode = new char[newlen+1];
534  for (int i = 0; i < newlen;) {
535  int j;
536  for (j = 0; newmode[i] != ' ' && newmode[i] != '\0'; i++, j++)
537  curmode[j] = newmode[i];
538  while (newmode[i] == ' ')
539  i++;
540  if (j == 0)
541  continue;
542  //in otherwords, if j is 0 then the 0th index will become null
543  //EnumMap crashes if the string is empty.
544  curmode[j] = '\0';
545  int modearg = modemap.lookup( curmode );
546  if (modearg < BaseComputer::DISPLAY_MODE_COUNT)
547  newcomp->modes.push_back( (BaseComputer::DisplayMode) (modearg) );
548  else
549  VSFileSystem::vs_fprintf( stderr, "WARNING: Unknown computer mode %s found in python script...\n", curmode );
550  }
551  delete[] curmode;
552 }
553 void Python( int room,
554  std::string index,
555  float x,
556  float y,
557  float wid,
558  float hei,
559  std::string text,
560  std::string pythonfile,
561  bool front )
562 {
563  //instead of "Talk"/"Say" tags
564  BaseInterface::Room *newroom = CheckRoom( room );
565  if (!newroom) return;
566  BaseInterface::Room::Python *tmp = new BaseInterface::Room::Python( index, pythonfile );
567  if (front)
568  newroom->links.insert( newroom->links.begin(), tmp );
569  else
570  newroom->links.push_back( tmp );
571  BaseLink( newroom, x, y, wid, hei, text, front );
572 }
573 
574 void GlobalKeyPython( std::string pythonfile )
575 {
578 }
579 
580 void MessageToRoom( int room, std::string text )
581 {
582  if (!BaseInterface::CurrentBase) return;
583  BaseInterface::CurrentBase->rooms[room]->objs.push_back( new BaseInterface::Room::BaseTalk( text, "currentmsg", true ) );
584 }
585 void EnqueueMessageToRoom( int room, std::string text )
586 {
587  if (!BaseInterface::CurrentBase) return;
588  BaseInterface::CurrentBase->rooms[room]->objs.push_back( new BaseInterface::Room::BaseTalk( text, "currentmsg", false ) );
589 }
590 void Message( std::string text )
591 {
592  if (!BaseInterface::CurrentBase) return;
593  MessageToRoom( BaseInterface::CurrentBase->curroom, text );
594 }
595 void EnqueueMessage( std::string text )
596 {
597  if (!BaseInterface::CurrentBase) return;
599 }
600 void EraseLink( int room, std::string index )
601 {
602  BaseInterface::Room *newroom = CheckRoom( room );
603  if (!newroom) return;
604  for (int i = 0; i < (int) newroom->links.size(); i++)
605  if (newroom->links[i]) {
606  if (newroom->links[i]->index == index) {
607  newroom->links.erase( newroom->links.begin()+i );
608  i--;
609 //break;
610  }
611  }
612 }
613 void EraseObj( int room, std::string index )
614 {
615  BaseInterface::Room *newroom = CheckRoom( room );
616  if (!newroom) return;
617  for (int i = 0; i < (int) newroom->objs.size(); i++)
618  if (newroom->objs[i]) {
619  if (newroom->objs[i]->index == index) {
620  newroom->objs.erase( newroom->objs.begin()+i );
621  i--;
622 //break;
623  }
624  }
625 }
627 {
628  if (!BaseInterface::CurrentBase) return -1;
630 }
631 void SetCurRoom( int room )
632 {
633  BaseInterface::Room *newroom = CheckRoom( room );
634  if (!newroom) return;
635  if (!BaseInterface::CurrentBase) return;
637 }
639 {
640  if (!BaseInterface::CurrentBase) return -1;
641  return BaseInterface::CurrentBase->rooms.size();
642 }
643 bool BuyShip( std::string name, bool my_fleet, bool force_base_inventory )
644 {
647  return ::buyShip( base, un, name, my_fleet, force_base_inventory, NULL );
648 }
649 bool SellShip( std::string name )
650 {
653  return ::sellShip( base, un, name, NULL );
654 }
655 
657 {
658  static BoostPythonDictionary data;
659  return data;
660 }
661 
663 {
664  _GetEventData() = data;
665 }
666 
667 void SetMouseEventData( std::string type, float x, float y, int buttonMask )
668 {
670 
671  //Event type
672  data["type"] = type;
673 
674  //Mouse data
675  data["mousex"] = x;
676  data["mousey"] = y;
677  data["mousebuttons"] = buttonMask;
678 
680 }
681 
682 void SetKeyStatusEventData( unsigned int modmask )
683 {
685  //Keyboard modifiers (for kb+mouse)
686  if (modmask == UINT_MAX )
687  modmask = pullActiveModifiers();
688  data["modifiers"] = modmask;
689  data["alt"] = ( (modmask&KB_MOD_ALT) != 0 );
690  data["shift"] = ( (modmask&KB_MOD_SHIFT) != 0 );
691  data["ctrl"] = ( (modmask&KB_MOD_CTRL) != 0 );
692 }
693 
694 void SetKeyEventData( std::string type, unsigned int keycode, unsigned int modmask )
695 {
697 
698  //Event type
699  data["type"] = type;
700 
701  //Keycode
702  data["key"] = keycode;
703  if ( (keycode > 0x20) && (keycode < 0xff) )
704  data["char"] = string( 1, keycode );
705 
706  else
707  data["char"] = string();
708  SetKeyStatusEventData( modmask );
709 }
710 
712 {
713  return _GetEventData();
714 }
715 
716 float GetTextHeight( std::string text, Vector widheimult )
717 {
718  static bool force_highquality = true;
719  static bool use_bit = force_highquality
720  || XMLSupport::parse_bool( vs_config->getVariable( "graphics", "high_quality_font", "false" ) );
721  static float font_point = XMLSupport::parse_float( vs_config->getVariable( "graphics", "font_point", "16" ) );
722  return use_bit ? getFontHeight() : (font_point*2/g_game.y_resolution);
723 }
724 
725 float GetTextWidth( std::string text, Vector widheimult )
726 {
727  //Unsupported for now
728  return 0;
729 }
730 
731 void LoadBaseInterface( string name )
732 {
734 }
735 
736 void LoadBaseInterfaceAtDock( string name, Unit *dockat, Unit *dockee )
737 {
740  BaseInterface *base = new BaseInterface( name.c_str(), dockat, dockee );
741  base->InitCallbacks();
742 }
743 
744 void refreshBaseComputerUI( const Cargo *carg )
745 {
746  if (carg)
747  //BaseComputer::draw() used dirty to determine what to recalculate.
748  BaseComputer::dirty = 1; //everything.
749  else
750  BaseComputer::dirty = 2; //only title.
751 }
752 
753 void ExitGame()
754 {
756 }
757 }
758