Skip to content

Commit

Permalink
mission screen: proxy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Piglit committed Aug 30, 2024
1 parent 2531b18 commit c88b9ef
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/screens/missionControlScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ MissionControlScreen::MissionControlScreen(RenderLayer* render_layer, glm::vec2
// Spawn a ship of the selected template near 0,0 and give it a random
// heading.
ship_create_button = new GuiButton(ship_content, "CREATE_SHIP_BUTTON", tr("Create ship"), [this]() {
if ((!gameGlobalInfo->allow_new_player_ships) || (my_spaceship))
return;
string callsign = PreferencesManager::get("shipname", "");
if (game_server) {
if ((!gameGlobalInfo->allow_new_player_ships) || (my_spaceship))
return;
string callsign = PreferencesManager::get("shipname", "");
P<PlayerSpaceship> ship = new PlayerSpaceship();
string templ = ship_template_selector->getSelectionValue();
if (ship)
Expand Down Expand Up @@ -167,7 +167,7 @@ MissionControlScreen::MissionControlScreen(RenderLayer* render_layer, glm::vec2
ship_create_button->setPosition(20, 20, sp::Alignment::TopLeft)->setSize(GuiElement::GuiSizeMax, 50);


if (!my_spaceship) {
if (!my_spaceship && game_server) {
int index = gameGlobalInfo->getPlayerShipIndexByName(callsign); // -1 if not found
if (index >= 0) {
auto ship = gameGlobalInfo->getPlayerShip(index);
Expand Down Expand Up @@ -214,18 +214,19 @@ MissionControlScreen::MissionControlScreen(RenderLayer* render_layer, glm::vec2
void MissionControlScreen::update(float delta)
{

unsigned int seconds = gameGlobalInfo->elapsed_time;
unsigned int minutes = (seconds / 60) % 60;
unsigned int hours = (seconds / 60 / 60) % 24;
seconds = seconds % 60;
char buf[9];
std::snprintf(buf, 9, "%02d:%02d:%02d", hours, minutes, seconds);
if (game_server)
unsigned int seconds = gameGlobalInfo->elapsed_time;
unsigned int minutes = (seconds / 60) % 60;
unsigned int hours = (seconds / 60 / 60) % 24;
seconds = seconds % 60;
char buf[9];
std::snprintf(buf, 9, "%02d:%02d:%02d", hours, minutes, seconds);

// Update mission clock
clock->setValue(string(buf));

// Update mission clock
clock->setValue(string(buf));
// Update pause button

// Update pause button
if (game_server)
pause_button->setValue(engine->getGameSpeed() == 0.0f);

// States of dynamic panel:
Expand All @@ -239,7 +240,7 @@ void MissionControlScreen::update(float delta)
*/

// set my_spaceship
if (!my_spaceship) {
if (!my_spaceship && game_server) {
string callsign = PreferencesManager::get("shipname", "");
int index = gameGlobalInfo->getPlayerShipIndexByName(callsign); // -1 if not found
if (index >= 0) {
Expand Down Expand Up @@ -288,7 +289,10 @@ void MissionControlScreen::update(float delta)
// !my_spaceship
// ship was probably destroyed or has never existed
//station_content->hide();
ship_content->setVisible(!!gameGlobalInfo->allow_new_player_ships);
if (game_server)
ship_content->setVisible(!!gameGlobalInfo->allow_new_player_ships);
else
ship_content->hide();
ship_infos->hide();
}
}
Expand Down

0 comments on commit c88b9ef

Please sign in to comment.