54 bool ignore_occupied_areas,
62 displayname.
col = col;
63 static float background_alpha =
65 int length = text.size();
66 float offset = (
float(length)*0.005);
67 if (ignore_occupied_areas) {
68 displayname.
SetPos( (x_-offset), y_ );
73 bool automatte = (0 == tpbg.
a);
74 if (automatte) displayname.
bgcol =
GFXColor( 0, 0, 0, background_alpha );
75 displayname.
Draw( text, 0,
true,
false, automatte );
76 displayname.
bgcol = tpbg;
79 displayname.
SetPos( (x_-offset), new_y );
83 bool automatte = (0 == tpbg.
a);
84 if (automatte) displayname.
bgcol =
GFXColor( 0, 0, 0, background_alpha );
85 displayname.
Draw( text, 0,
true,
false, automatte );
86 displayname.
bgcol = tpbg;
97 return k == 2 ?
'm' :
'?';
110 bool mouseover =
false,
111 bool willclick =
false,
112 string insector =
"" )
117 if (willclick ==
true && mouseover ==
false)
120 static bool inited =
false;
121 static GFXColor highlighted_tail_col;
122 static GFXColor highlighted_tail_text;
124 float col1[4] = {1, .3, .3, .8};
126 highlighted_tail_col =
GFXColor( col1[0], col1[1], col1[2], col1[3] );
128 float col2[4] = {1, 1, .7, 1};
130 highlighted_tail_text =
GFXColor( col2[0], col2[1], col2[2], col2[3] );
137 race = highlighted_tail_col;
147 if ( (!mouseover) || (willclick) ) {
151 race = highlighted_tail_text;
152 nam = tsector+
" / "+nam;
154 if ( willclick || !( insector.compare(
"" ) ) || !( insector.compare( tsector ) ) )
181 return a.source < b.source;
185 return a.source == b.source;
205 , screenoccupation( so )
217 , screenoccupation( NULL )
220 void draw(
bool mouseover =
false,
bool willclick =
false )
222 DrawNode( type, size, x, y, source, screenoccupation, moused, race, mouseover, willclick );
242 vstack.push_back( current_system );
243 visited[current_system] =
true;
249 return which >= vstack.size();
256 string currentsystem = (**this);
259 if ( xyz.size() && (sscanf( xyz.c_str(),
"%lf %lf %lf", &pos.i, &pos.j, &pos.k ) >= 3) ) {
263 float ratio = ( (
float) count )/maxcount;
264 float locatio = ( (
float) which )/vstack.size();
266 std::string::const_iterator
start = vstack[which].begin();
267 std::string::const_iterator end = vstack[which].end();
268 for (; start != end; start++)
278 if ( which < vstack.size() )
279 return vstack[which];
291 if (dontbothervisiting) {
294 string key(
string(
"visited_" )+n );
305 if ( which >= vstack.size() ) {
306 vector< string >newsys;
307 for (
unsigned int i = 0;
i < vstack.size(); ++
i) {
309 for (
int j = 0;
j < nas; ++
j) {
313 newsys.push_back( n );
317 vstack.swap( newsys );
320 if (count > maxcount)
340 col =
GFXColor( tcol[0], tcol[1], tcol[2], tcol[3] );
348 const std::vector< std::string > &destinations,
351 , position( position )
352 , part_of_path( false )
357 for (
size_t i = 0;
i < destinations.size(); ++
i)
358 for (
size_t j = 0;
j < csi->systems.size(); ++
j)
359 if ( (*csi)[
j].name == destinations[
i] ) {
362 i ) == (*csi)[
j].lowerdestinations.end() )
363 (*csi)[
j].lowerdestinations.push_back(
i );
375 , part_of_path( false ) {}
381 if ( xyz.size() && (sscanf( xyz.c_str(),
"%lf %lf %lf", &pos.i, &pos.j, &pos.k ) >= 3) ) {
392 for (
size_t i = 0;
i < destinations.size(); ++
i)
393 if (index_table->count( destinations[
i] ) != 0)
394 lowerdestinations.push_back( (*index_table)[destinations[i]] );
403 map< string, unsigned > index_table;
404 std::deque< std::string >frontier;
405 frontier.push_back( current_system );
406 systems.push_back(
SystemInfo( current_system ) );
407 index_table[current_system] = 0;
408 while ( !frontier.empty() ) {
409 sys = frontier.front();
410 frontier.pop_front();
413 for (
int j = 0;
j < nas && count < max_systems; ++
j) {
415 if (index_table.count( n ) == 0) {
416 frontier.push_back( n );
417 index_table[n] = systems.size();
422 systems[index_table[sys]].loadData( &index_table );
430 init( current_system, max_systems );
434 systems( other.systems )
435 , currentPosition( other.currentPosition ) {}
439 if ( position < systems.size() ) {
440 currentPosition = position;
449 return currentPosition;
454 return systems.size();
459 return currentPosition >= systems.size();
463 std::vector< std::string > (), NULL );
484 return systems[currentPosition];
491 return systems[currentPosition];
498 return &systems[currentPosition];
505 return &systems[currentPosition];
535 return lowerdestinations[
index];
540 return lowerdestinations.size();
545 static unsigned long lastupdate = 0;
546 lastupdate += 1299811;
547 lastupdate %= 104729;
592 return subsystems[
index];
597 return subsystems.size();
602 subsystems.push_back( index );
614 map< string, unsigned >index_table;
617 string sys, csector, csystem;
621 while ( !systemIter.
done() ) {
624 if (index_table.count( csector ) == 0) {
625 index_table[csector] = sectors.size();
628 index = index_table[csector];
635 sectors( other.sectors )
636 , currentPosition( other.currentPosition ) {}
640 if ( position < sectors.size() ) {
641 currentPosition = position;
650 return currentPosition;
655 return sectors.size();
660 return currentPosition >= sectors.size();
684 return sectors[currentPosition];
691 return sectors[currentPosition];
698 return §ors[currentPosition];
705 return §ors[currentPosition];
729 return x > y ? x :
y;
738 string csector, csystem;
744 string systemnamestring =
"Current System : "+csystem+
" in the "+csector+
" Sector.";
749 systemname.
SetPos( screenskipby4[0], screenskipby4[3] );
751 systemname.
SetText( systemnamestring );
759 float zdistance = 0.0;
763 Adjust3dTransformation( galaxy_view == VIEW_3D, 0 );
765 float center_nav_x = ( (screenskipby4[0]+screenskipby4[1])/2 );
766 float center_nav_y = ( (screenskipby4[2]+screenskipby4[3])/2 );
769 glEnable( GL_ALPHA );
785 systemIter.
seek( focusedsystemindex );
790 max_x = (
float) pos.i;
791 min_x = (
float) pos.i;
792 max_y = (
float) pos.j;
793 min_y = (
float) pos.j;
794 max_z = (
float) pos.k;
795 min_z = (
float) pos.k;
807 for (
unsigned i = 0;
i < destsize; ++
i) {
809 ReplaceAxes( posoth );
812 RecordMinAndMax( posoth, min_x, max_x, min_y, max_y, min_z, max_z, themaxvalue );
836 #define SQRT3 1.7320508
843 float half_x =
vsmax( max_x-center_x, center_x-min_x );
844 float half_y =
vsmax( max_y-center_y, center_y-min_y );
845 float half_z =
vsmax( max_z-center_z, center_z-min_z );
851 camera_z =
sqrt( (half_x*half_x)+(half_y*half_y)+(half_z*half_z) );
861 DrawOriginOrientationTri( center_nav_x, center_nav_y, 0 );
866 while ( !systemIter.
done() ) {
878 unsigned temp = systemIter.
getIndex();
892 float the_x, the_y, the_x_flat, the_y_flat, system_item_scale_temp;
893 TranslateCoordinates( pos,
904 system_item_scale_temp,
908 float tmp = ( 1-(zoom/
MAXZOOM) );
909 alphaadd = (tmp*tmp)-.5;
915 col.
a = (system_item_scale_temp-minimumitemscaledown)/(maximumitemscaleup-minimumitemscaledown)+alphaadd;
920 || ( !
TestIfInRange( screenskipby4[0], screenskipby4[1], screenskipby4[2], screenskipby4[3], the_x, the_y ) ) ) {
929 if (path_view != PATH_OFF) {
931 for (std::set< NavPath* >::iterator paths = systemIter->
paths.begin();
932 paths != systemIter->
paths.end();
934 if ( (*paths)->getVisible() ) {
943 if (!isPath && path_view == PATH_ONLY) {
951 if ( system_item_scale_temp > (system_item_scale*3) )
952 system_item_scale_temp = (system_item_scale*3);
953 insert_size *= system_item_scale_temp/3;
954 if (currentsystemindex == temp)
956 if (destinationsystemindex == temp)
958 if (systemselectionindex == temp)
961 DrawNode( insert_type, insert_size, the_x, the_y,
962 (*systemIter).GetName(), screenoccupation, moused, isPath ? pathcol : col,
false,
false,
963 isPath ?
"" : csector );
964 if (std::fabs(zdistance) < 2.0f * camera_z)
966 DisplayOrientationLines( the_x, the_y, the_x_flat, the_y_flat, 0 );
968 if (
TestIfInRangeRad( the_x, the_y, insert_size, mouse_x_current, mouse_y_current ) ) {
969 mouselist.push_back(
systemdrawnode( insert_type, insert_size, the_x, the_y, (*systemIter).GetName(),
970 systemIter.
getIndex(), screenoccupation,
false, isPath ? pathcol : col ) );
978 for (
unsigned i = 0;
i < destsize; ++
i) {
982 ReplaceAxes( posoth );
983 Vector oldposoth = posoth;
984 float the_new_x, the_new_y, new_system_item_scale_temp, the_new_x_flat, the_new_y_flat;
986 TranslateCoordinates( posoth,
997 new_system_item_scale_temp,
1001 (new_system_item_scale_temp
1002 -minimumitemscaledown)/(maximumitemscaleup-minimumitemscaledown)+alphaadd;
1006 bool isConnectionPath =
false;
1007 if (path_view != PATH_OFF) {
1009 for (std::set< NavPath* >::iterator paths = systemIter->
paths.begin();
1010 paths != systemIter->
paths.end();
1012 if ( (*paths)->getVisible() ) {
1014 isConnectionPath =
true;
1024 if (!isConnectionPath && path_view != PATH_ONLY) {
1041 if (mouselist.size() > 0) {
1043 if (mouse_wentdown[2] == 1)
1046 if ( rotations >= static_cast<int>(mouselist.size()) )
1049 int siz = mouselist.size();
1050 for (l = 0; l < siz; ++l)
1051 tmpv.push_back( mouselist[( (
unsigned int) (l+rotations) )%( (
unsigned int) siz )] );
1052 mouselist.swap( tmpv );
1056 if (mouselist.size() > 0) {
1058 if (mouse_wentdown[0] == 1) {
1060 unsigned oldselection = systemselectionindex;
1061 systemselectionindex = mouselist.back().getIndex();
1063 if (systemselectionindex == oldselection)
1064 setFocusedSystemIndex( systemselectionindex );
1072 for (systemdrawlist::iterator it = mouselist.begin(); it != mouselist.end(); ++it)
1073 (*it).draw(
true, &(*it) == &mouselist.back() );