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
universe_util_server.cpp
Go to the documentation of this file.
1 #include "cmd/script/mission.h"
2 #include "universe_util.h"
3 #include "universe_generic.h"
4 #include "cmd/unit_generic.h"
5 #include "cmd/unit_factory.h" //for UnitFactory::getMasterPartList()
6 #include "cmd/collection.h"
7 #include "networking/netserver.h"
8 #include "star_system_generic.h"
9 #include <string>
10 #include "lin_time.h"
11 #include "load_mission.h"
12 #include "configxml.h"
13 #include "vs_globals.h"
14 
15 void SetStarSystemLoading( bool value ) {}
16 
17 using std::string;
18 
19 //less to write
20 #define activeSys _Universe->activeStarSystem()
21 void ClientServerSetLightContext( int lc ) {}
22 
23 namespace UniverseUtil
24 {
25 void playVictoryTune() {}
26 int musicAddList( string str )
27 {
28  return 0;
29 }
30 void musicLayerPlaySong( string str, int layer ) {}
31 void addParticle( QVector loc, Vector velocity, Vector color, float size )
32 {}
33 void musicLayerPlayList( int which, int layer ) {}
34 void musicLayerLoopList( int numloops, int layer ) {}
35 void musicLayerSetSoftVolume( float vol, float latency_override, int layer ) {}
36 void musicLayerSetHardVolume( float vol, int layer ) {}
37 void musicSetSoftVolume( float vol, float latency_override ) {}
38 void musicSetHardVolume( float vol ) {}
39 
40 void musicMute( bool stopSound ) {}
41 void playSound( string soundName, QVector loc, Vector speed ) {}
42 void playSoundCockpit( string soundName ) {}
43 void cacheAnimation( string aniName ) {}
44 void playAnimation( string aniName, QVector loc, float size ) {}
45 void playAnimationGrow( string aniName, QVector loc, float size, float growpercent ) {}
46 unsigned int getCurrentPlayer()
47 {
48  return _Universe->CurrentCockpit();
49 }
50 void musicLayerSkip( int layer ) {}
51 void musicLayerStop( int layer ) {}
52 void StopAllSounds( void ) {}
53 void loadGame( const string &savename )
54 {
55  unsigned int num = 0;
56  sscanf( savename.c_str(), "%u", &num );
57  if ( num != UINT_MAX && num < _Universe->numPlayers() ) {
58  Unit *un = _Universe->AccessCockpit( num )->GetParent();
59  if (un) {
60  un->hull = 0;
61  un->Destroy();
62  }
63  }
64 }
65 void saveGame( const string &savename )
66 {
67  unsigned int num = 0;
68  sscanf( savename.c_str(), "%u", &num );
69  if ( num != UINT_MAX && num < _Universe->numPlayers() ) {
70  if (SERVER) VSServer->saveAccount( num );
71  } else if (num == 0 && SERVER) {
72  cout<<">>> Manually Saving server status..."<<endl;
73  VSServer->save();
74  cout<<"<<< Finished saving."<<endl;
75  }
76 }
77 
78 void showSplashScreen( const string &filename ) {}
79 void showSplashMessage( const string &text ) {}
80 void showSplashProgress( float progress ) {}
81 void hideSplashScreen() {}
83 {
84  return false;
85 }
86 void startMenuInterface( bool firstTime, string error )
87 {
88  //Critical game error... enough to bring you back to the game menu!
89  printf( "GAME ERROR: %s\n", error.c_str() );
90 }
91 
92 void sendCustom( int cp, string cmd, string args, string id )
93 {
94  if ( cp < 0 || (unsigned int) cp >= _Universe->numPlayers() ) {
95  fprintf( stderr, "sendCustom %s with invalid player %d\n", cmd.c_str(), cp );
96  return;
97  }
98  VSServer->sendCustom( cp, cmd, args, id );
99 }
100 }
101 
102 #undef activeSys
103