17 Commits

Author SHA1 Message Date
c76e897e06 Fixes #3: Crash when APM toggled in intro screen 2024-06-04 20:54:54 +01:00
chucky-n-ice
349322cad0 fix: redrawing admin company buttons; hang windows to parent window; code reworked 2024-06-03 21:02:07 +02:00
chucky-n-ice
a52c2f1413 Add: join last server from intro menue 2024-06-02 18:43:06 +02:00
chucky-n-ice
15475d644d Adjusting of the code. 2024-06-02 12:57:53 +02:00
dP
472cac5e15 Fix polyrail endpoint update when removing 2024-05-16 20:20:00 +02:00
chucky-n-ice
a4c524dd06 Add: admin company buttons 2024-05-15 19:48:17 +02:00
chucky-n-ice
ab587a163a Fix: merge error (ninja build stopped) 2024-05-06 20:54:44 +02:00
chucky-n-ice
b11f5a76a9 Update branch 2024-05-06 20:21:26 +02:00
chucky-n-ice
f9a2f4e8a2 Add: Admin login for n-ice/btpro 2024-05-06 20:06:32 +02:00
e776135d7d fix: Login uri was impossible to change 2024-04-26 21:46:35 +02:00
Chucky
93871cc260 Merge branch 'citymania-org:master' into origin_14.x 2024-04-26 21:32:05 +02:00
chucky-n-ice
c7daaa1f0d Feature: login window for identified community 2024-04-23 22:06:07 +02:00
Chucky
5782b849a6 Merge branch 'citymania-org:master' into origin_14.x 2024-04-20 10:26:17 +02:00
Chucky
6603de47ff Merge branch 'citymania-org:master' into origin_14.x 2024-04-19 20:41:53 +02:00
chucky-n-ice
6afde1cb7d Fix: visual studio include error 2024-04-19 19:47:00 +02:00
d165533e9a Fix: Use Md5 new interface, and fmt 2024-04-19 19:46:36 +02:00
chucky-n-ice
269a557c6f Fault: creation of md5salt from given password 2024-04-19 19:43:44 +02:00
10 changed files with 784 additions and 223 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,11 @@ namespace citymania {
void ShowCommandsToolbar(); void ShowCommandsToolbar();
void ShowLoginWindow(); void ShowLoginWindow();
void CheckAdmin();
void ShowAdminCompanyButtons(int left, int top, int width, int company2, bool draw, bool redraw);
void JoinLastServer(int left, int top, int height);
bool GetAdmin();
} // namespace citymania } // namespace citymania

View File

@@ -49,9 +49,12 @@
#include "citymania/cm_hotkeys.hpp" #include "citymania/cm_hotkeys.hpp"
#include "citymania/cm_main.hpp" #include "citymania/cm_main.hpp"
#include "citymania/cm_commands_gui.hpp"
#include "safeguards.h" #include "safeguards.h"
/* Admin company buttons */
bool Show_ACB[15];
/** Company GUI constants. */ /** Company GUI constants. */
static void DoSelectCompanyManagerFace(Window *parent); static void DoSelectCompanyManagerFace(Window *parent);
@@ -2196,6 +2199,10 @@ static constexpr NWidgetPart _nested_company_widgets[] = {
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_C_RELOCATE_HQ), SetDataTip(STR_COMPANY_VIEW_RELOCATE_HQ, STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS), NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_C_RELOCATE_HQ), SetDataTip(STR_COMPANY_VIEW_RELOCATE_HQ, STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS),
NWidget(NWID_SPACER), NWidget(NWID_SPACER),
EndContainer(), EndContainer(),
/* Admin company buttons */
NWidget(NWID_SELECTION, INVALID_COLOUR, CM_WID_C_SELECT_ADMINBUTTONS),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CM_WID_C_ADMINBUTTONS), SetDataTip(CM_STR_ACB_COMPANY_ADMIN_BUTTON, CM_STR_ACB_COMPANY_ADMIN_BUTTON_TOOLTIP),
EndContainer(),
EndContainer(), EndContainer(),
EndContainer(), EndContainer(),
@@ -2225,15 +2232,7 @@ static constexpr NWidgetPart _nested_company_widgets[] = {
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_PASSWORD), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_PASSWORD), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_JOIN), SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_JOIN), SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP),
EndContainer(), EndContainer(),
// NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_MOD), EndContainer(),
// NWidget(NWID_SPACER), SetMinimalSize(0, 0), SetFill(0, 1),
// NWidget(NWID_VERTICAL), SetPIP(4, 2, 4),
// NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_MOD_COMPANY_JOIN), SetFill(1, 0), SetDataTip(STR_MOD_COMPANY_JOIN_BUTTON, STR_NULL),
// NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_C_MOD_COMPANY_TOGGLE_LOCK), SetFill(1, 0), SetDataTip(STR_MOD_TOGGLE_LOCK_BUTTON, STR_NULL),
// NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_C_MOD_COMPANY_RESET), SetFill(1, 0), SetDataTip(STR_MOD_COMPANY_RESET_BUTTON, STR_NULL),
// EndContainer(),
// EndContainer(),
EndContainer(),
EndContainer(), EndContainer(),
EndContainer(), EndContainer(),
EndContainer(), EndContainer(),
@@ -2257,14 +2256,6 @@ static const StringID _company_view_vehicle_count_strings[] = {
/** /**
* Window with general information about a company * Window with general information about a company
*/ */
static void ResetCallback(Window *w, bool confirmed)
{
if (confirmed) {
CompanyID company2 = (CompanyID)w->window_number;
citymania::NetworkClientSendChatToServer(fmt::format("!reset {}", company2 + 1));
}
}
struct CompanyWindow : Window struct CompanyWindow : Window
{ {
CompanyWidgets query_widget; CompanyWidgets query_widget;
@@ -2302,6 +2293,10 @@ struct CompanyWindow : Window
/* Button bar selection. */ /* Button bar selection. */
reinit |= this->GetWidget<NWidgetStacked>(WID_C_SELECT_BUTTONS)->SetDisplayedPlane(local ? 0 : SZSP_NONE); reinit |= this->GetWidget<NWidgetStacked>(WID_C_SELECT_BUTTONS)->SetDisplayedPlane(local ? 0 : SZSP_NONE);
/* Admin company buttons: show/hide admin menue button from param of citymania.cfg */
citymania::CheckAdmin();
reinit |= this->GetWidget<NWidgetStacked>(CM_WID_C_SELECT_ADMINBUTTONS)->SetDisplayedPlane(citymania::GetAdmin() ? 0 : SZSP_NONE);
/* Build HQ button handling. */ /* Build HQ button handling. */
reinit |= this->GetWidget<NWidgetStacked>(WID_C_SELECT_VIEW_BUILD_HQ)->SetDisplayedPlane((local && c->location_of_HQ == INVALID_TILE) ? CWP_VB_BUILD : CWP_VB_VIEW); reinit |= this->GetWidget<NWidgetStacked>(WID_C_SELECT_VIEW_BUILD_HQ)->SetDisplayedPlane((local && c->location_of_HQ == INVALID_TILE) ? CWP_VB_BUILD : CWP_VB_VIEW);
@@ -2321,17 +2316,13 @@ struct CompanyWindow : Window
if (reinit) { if (reinit) {
this->ReInit(); this->ReInit();
/* Admin company buttons: recall buttons while join/leave company */
if (Show_ACB[this->window_number]) citymania::ShowAdminCompanyButtons(this->left, this->top, this->width, this->window_number + 1, Show_ACB[this->window_number], true);
return; return;
} }
} }
/* Admin company buttons: recall buttons while moving company window */
// if(!_networking) { if (Show_ACB[this->window_number]) citymania::ShowAdminCompanyButtons(this->left, this->top, this->width, this->window_number + 1, Show_ACB[this->window_number], false);
// this->SetWidgetDisabledState(CW_WIDGET_COMPANY_RESUME, true);
// this->SetWidgetDisabledState(CW_WIDGET_COMPANY_SUSPEND, true);
// this->SetWidgetDisabledState(CW_WIDGET_COMPANY_RESET, true);
// this->SetWidgetDisabledState(CW_WIDGET_COMPANY_JOIN2, true);
// }
this->DrawWidgets(); this->DrawWidgets();
} }
@@ -2389,19 +2380,14 @@ struct CompanyWindow : Window
size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_GIVE_MONEY_BUTTON).width); size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_GIVE_MONEY_BUTTON).width);
size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_HOSTILE_TAKEOVER_BUTTON).width); size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_HOSTILE_TAKEOVER_BUTTON).width);
size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_PASSWORD).width); size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_PASSWORD).width);
size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_JOIN).width);
size->width += padding.width; size->width += padding.width;
break; break;
// case CW_WIDGET_COMPANY_RESUME: /* Admin company buttons */
// case CW_WIDGET_COMPANY_SUSPEND: case CM_WID_C_ADMINBUTTONS:
// case CW_WIDGET_COMPANY_RESET: size->width = std::max(size->width, GetStringBoundingBox(CM_STR_ACB_COMPANY_ADMIN_BUTTON).width);
// case CW_WIDGET_COMPANY_JOIN2:
// if(!_novarole){
// size->width = 0;
// size->height = 0;
// }
// break;
case WID_C_HAS_PASSWORD: case WID_C_HAS_PASSWORD:
if (_networking) *size = maxdim(*size, GetSpriteSize(SPR_LOCK)); if (_networking) *size = maxdim(*size, GetSpriteSize(SPR_LOCK));
break; break;
@@ -2624,28 +2610,13 @@ struct CompanyWindow : Window
MarkWholeScreenDirty(); MarkWholeScreenDirty();
break; break;
} }
/* Admin company buttons: show/hide buttons */
case WID_C_MOD_COMPANY_JOIN: { case CM_WID_C_ADMINBUTTONS: {
if (!_novarole) return;
CompanyID company2 = (CompanyID)this->window_number; CompanyID company2 = (CompanyID)this->window_number;
// this->query_widget = WID_C_MOD_COMPANY_JOIN; if (!Show_ACB[company2]) Show_ACB[company2] = true;
citymania::NetworkClientSendChatToServer(fmt::format("!move {}", company2 + 1)); else Show_ACB[company2] = false;
MarkWholeScreenDirty(); citymania::ShowAdminCompanyButtons(this->left, this->top, this->width,company2 + 1, Show_ACB[company2], false);
break; break;
}
case WID_C_MOD_COMPANY_RESET: {
if (!_networking) return;
this->query_widget = WID_C_MOD_COMPANY_RESET;
ShowQuery(CM_STR_XI_RESET_CAPTION, CM_STR_XI_REALY_RESET, this, ResetCallback);
MarkWholeScreenDirty();
break;
}
case WID_C_MOD_COMPANY_TOGGLE_LOCK: {
if (!_novarole) return;
CompanyID company2 = (CompanyID)this->window_number;
citymania::NetworkClientSendChatToServer(fmt::format("!lockp {}", company2 + 1));
MarkWholeScreenDirty();
break;
} }
} }
} }

View File

@@ -41,6 +41,7 @@
#include "table/sprites.h" #include "table/sprites.h"
#include "citymania/cm_hotkeys.hpp" #include "citymania/cm_hotkeys.hpp"
#include "citymania/cm_commands_gui.hpp"
#include "safeguards.h" #include "safeguards.h"
@@ -297,6 +298,8 @@ struct SelectGameWindow : public Window {
DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_INTRO_TRANSLATION, TC_FROMSTRING, SA_CENTER); DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_INTRO_TRANSLATION, TC_FROMSTRING, SA_CENTER);
break; break;
} }
/* last server widget */
citymania::JoinLastServer(this->left, this->top, this->height);
} }
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override

View File

@@ -5951,6 +5951,8 @@ CM_STR_TOOLBAR_COMMANDS_HINT_CAPTION :{BLACK}CB Hint
CM_STR_TOOLBAR_COMMANDS_HINT_TOOLTIP :{BLACK}Send !hint command to server(Shows town demand in CB mode). CM_STR_TOOLBAR_COMMANDS_HINT_TOOLTIP :{BLACK}Send !hint command to server(Shows town demand in CB mode).
CM_STR_TOOLBAR_COMMANDS_LOGIN_CAPTION :{BLACK}Login CM_STR_TOOLBAR_COMMANDS_LOGIN_CAPTION :{BLACK}Login
CM_STR_TOOLBAR_COMMANDS_LOGIN_TOOLTIP :{BLACK}Send !login command to server. CM_STR_TOOLBAR_COMMANDS_LOGIN_TOOLTIP :{BLACK}Send !login command to server.
CM_STR_TOOLBAR_COMMANDS_LOGOUT_CAPTION :{BLACK}Logout
CM_STR_TOOLBAR_COMMANDS_LOGOUT_TOOLTIP :{BLACK}Send !logout command to server.
CM_STR_TOOLBAR_COMMANDS_TIMELEFT_CAPTION :{BLACK}Timeleft CM_STR_TOOLBAR_COMMANDS_TIMELEFT_CAPTION :{BLACK}Timeleft
CM_STR_TOOLBAR_COMMANDS_TIMELEFT_TOOLTIP :{BLACK}Send !timeleft command to server. CM_STR_TOOLBAR_COMMANDS_TIMELEFT_TOOLTIP :{BLACK}Send !timeleft command to server.
CM_STR_TOOLBAR_COMMANDS_NS_CAPTION :{BLACK}CM{NUM} CM_STR_TOOLBAR_COMMANDS_NS_CAPTION :{BLACK}CM{NUM}
@@ -6204,8 +6206,11 @@ CM_STR_LOGIN_WINDOW_NICE :{BLACK}N-ice
CM_STR_LOGIN_WINDOW_BTPRO :{BLACK}BTPro CM_STR_LOGIN_WINDOW_BTPRO :{BLACK}BTPro
CM_STR_LOGIN_ERROR_SIGN_IN_FAILED :{WHITE}Failed to connect CM_STR_LOGIN_ERROR_SIGN_IN_FAILED :{WHITE}Failed to connect
CM_STR_LOGIN_ERROR_BAD_INPUT :{WHITE}Bad username or password CM_STR_LOGIN_ERROR_BAD_INPUT :{WHITE}Bad username or password
CM_STR_LOGIN_WINDOW_USERNAME :{WHITE}Username CM_STR_LOGIN_WINDOW_USERNAME :{WHITE}Username:
CM_STR_LOGIN_WINDOW_PASSWORD :{WHITE}Password CM_STR_LOGIN_WINDOW_PASSWORD :{WHITE}Password:
CM_STR_LOGIN_WINDOW_ADMIN_LOGIN :{BLACK}A-Login
CM_STR_LOGIN_WINDOW_ADMIN_LOGOUT :{BLACK}A-Logout
CM_STR_LOGIN_WINDOW_ADMIN_PASSWORD :{WHITE}Admin:
CM_STR_LOGIN_WINDOW_SET :{WHITE}Set CM_STR_LOGIN_WINDOW_SET :{WHITE}Set
CM_STR_LOGIN_WINDOW_NOT_SET :{WHITE}Not Set CM_STR_LOGIN_WINDOW_NOT_SET :{WHITE}Not Set
CM_STR_LOGIN_WINDOW_CHANGE_USERNAME :{WHITE}Change username CM_STR_LOGIN_WINDOW_CHANGE_USERNAME :{WHITE}Change username
@@ -6215,6 +6220,7 @@ CM_STR_LOGIN_WINDOW_CHANGE_PASSWORD_HELPTEXT :{BLACK}Change p
CM_STR_LOGIN_WINDOW_SIGN_IN_HELPTEXT :{BLACK}Sign in (you must be on the correct community server) CM_STR_LOGIN_WINDOW_SIGN_IN_HELPTEXT :{BLACK}Sign in (you must be on the correct community server)
CM_STR_LOGIN_WINDOW_USERNAME_DISPLAY :{WHITE}{RAW_STRING} CM_STR_LOGIN_WINDOW_USERNAME_DISPLAY :{WHITE}{RAW_STRING}
CM_STR_LOGIN_WINDOW_PASSWORD_DISPLAY :{WHITE}{STRING} CM_STR_LOGIN_WINDOW_PASSWORD_DISPLAY :{WHITE}{STRING}
CM_STR_LOGIN_WINDOW_WELCOME :{BLACK}Welcome to {STRING} community !
CM_STR_NETWORK_COMPANY_LIST_NEW_COMPANY :New company CM_STR_NETWORK_COMPANY_LIST_NEW_COMPANY :New company
CM_STR_NETWORK_COMPANY_LIST_SPECTATE :Spectate CM_STR_NETWORK_COMPANY_LIST_SPECTATE :Spectate
@@ -6297,7 +6303,7 @@ CM_STR_CONFIG_SETTING_TYPE_DROPDOWN_CITYMANIA :CityMania patch
CM_BUILDING_PREVIEW_COST_ENOUGH :Cost CM_BUILDING_PREVIEW_COST_ENOUGH :Cost
CM_STR_NO_BLUEPRINT_IN_SLOT :{WHITE}No blueprint in slot {NUM} CM_STR_NO_BLUEPRINT_IN_SLOT :{WHITE}No blueprint in slot {NUM}
CM_STR_ABOUT_MENU_LOGIN_WINDOW :CityMania server login CM_STR_ABOUT_MENU_LOGIN_WINDOW :Community tools
CM_STR_BUILD_INFO_OVERLAY_COST_OK :{WHITE}Cost: {CURRENCY_LONG} CM_STR_BUILD_INFO_OVERLAY_COST_OK :{WHITE}Cost: {CURRENCY_LONG}
CM_STR_BUILD_INFO_OVERLAY_COST_NO_MONEY :{RED}Cost: {CURRENCY_LONG} CM_STR_BUILD_INFO_OVERLAY_COST_NO_MONEY :{RED}Cost: {CURRENCY_LONG}
CM_STR_BUILD_INFO_OVERLAY_STATION_ACCEPTS :{WHITE}Accepts: CM_STR_BUILD_INFO_OVERLAY_STATION_ACCEPTS :{WHITE}Accepts:
@@ -6312,7 +6318,58 @@ CM_STR_CONFIG_SETTING_TOOLBAR_DROPDOWN_CLOSE :Toolbar dropdow
CM_STR_CONFIG_SETTING_TOOLBAR_DROPDOWN_CLOSE_HELPTEXT :Control whether the main toolbar dropdowns activate their default function when the mouse button is released. If not enabled then the dropdown menu will stay open so a selection can be made. CM_STR_CONFIG_SETTING_TOOLBAR_DROPDOWN_CLOSE_HELPTEXT :Control whether the main toolbar dropdowns activate their default function when the mouse button is released. If not enabled then the dropdown menu will stay open so a selection can be made.
###length VEHICLE_TYPES ###length VEHICLE_TYPES
CM_STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN :{BLACK}Show hidden ({NUM}) CM_STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN :{BLACK}Show hidden ({NUM})
CM_STR_SHOW_HIDDEN_ENGINES_VEHICLE_ROAD_VEHICLE :{BLACK}Show hidden ({NUM}) CM_STR_SHOW_HIDDEN_ENGINES_VEHICLE_ROAD_VEHICLE :{BLACK}Show hidden ({NUM})
CM_STR_SHOW_HIDDEN_ENGINES_VEHICLE_SHIP :{BLACK}Show hidden ({NUM}) CM_STR_SHOW_HIDDEN_ENGINES_VEHICLE_SHIP :{BLACK}Show hidden ({NUM})
CM_STR_SHOW_HIDDEN_ENGINES_VEHICLE_AIRCRAFT :{BLACK}Show hidden ({NUM}) CM_STR_SHOW_HIDDEN_ENGINES_VEHICLE_AIRCRAFT :{BLACK}Show hidden ({NUM})
### Admin Company Buttons ###
CM_STR_ACB_COMPANY_ADMIN_CAPTION :{WHITE}Admin buttons #{NUM}
CM_STR_ACB_COMPANY_ADMIN_BUTTON :{WHITE}Admin buttons
CM_STR_ACB_COMPANY_ADMIN_BUTTON_TOOLTIP :{BLACK}Show / hide the admin buttons.
CM_STR_ACB_LOCK :{BLACK}Lock
CM_STR_ACB_LOCK_TOOLTIP :{BLACK}Lock Company. All players on it will be sent to spectators.
CM_STR_ACB_UNLOCK :{BLACK}Unlock
CM_STR_ACB_UNLOCK_TOOLTIP :{BLACK}Unlock Company making possible player(s) joining it again.
CM_STR_ACB_KNOWN :{BLACK}Known
CM_STR_ACB_KNOWN_TOOLTIP :{BLACK}Show the known player(s) of company.
CM_STR_ACB_RESET_KNOWN :{BLACK}Reset Known
CM_STR_ACB_RESET_KNOWN_TOOLTIP :{BLACK}Reset list of known players of company.
CM_STR_ACB_MOVE_PLAYER_TO :{BLACK}Move to ...
CM_STR_ACB_MOVE_PLAYER_TO_TOOLTIP :{BLACK}Move a player (number #.. or name) to company
CM_STR_ACB_COMPANY_NEWSTICKET_BUTTON :{BLACK}News
CM_STR_ACB_COMPANY_NEWSTICKET_BUTTON_TOOLTIP :{BLACK}Open a Newspapper message directed to Company
CM_STR_ACB_COMPANY_NEWSTICKET_BUTTON_COMP :{BLACK}News (P. C.)
CM_STR_ACB_COMPANY_NEWSTICKET_BUTTON_COMP_TOOLTIP :{BLACK}Open a Newspapper message only showed to Company
CM_STR_ACB_SUSPEND :{BLACK}Suspend
CM_STR_ACB_SUSPEND_TOOLTIP :{BLACK}Suspend Company actions keeping player in the company.
CM_STR_ACB_UNSUSPEND :{BLACK}Unsuspend
CM_STR_ACB_UNSUSPEND_TOOLTIP :{BLACK}Unsuspend Company actions.
CM_STR_ACB_EMPTY :{BLACK}Empty
CM_STR_ACB_EMPTY_TOOLTIP :{BLACK}Send players in company to Spectators.
CM_STR_ACB_RESET :{BLACK}Reset
CM_STR_ACB_RESET_TOOLTIP :{BLACK}Reset the company. The company must be empty.
CM_STR_ACB_RESET_SPEC :{BLACK}Reset Spec
CM_STR_ACB_RESET_SPEC_TOOLTIP :{BLACK}Reset company and send player(s) to spectators.
CM_STR_ACB_RESET_KICK :{BLACK}Reset Kick
CM_STR_ACB_RESET_KICK_TOOLTIP :{BLACK}Reset company and Kick out of the game player(s) on it.
CM_STR_ACB_RESET_TIMER_120 :{BLACK}Reset T. 2m
CM_STR_ACB_RESET_TIMER_120_TOOLTIP :{BLACK}Starts a timer to reset company when after 2 minutes countdown.
CM_STR_ACB_RESET_TIMER :{BLACK}Reset T....
CM_STR_ACB_RESET_TIMER_TOOLTIP :{BLACK}Starts a timer to reset company when time expire (time is Admin input).
CM_STR_ACB_RESET_TIMER_VALUE :{BLACK}Time to Reset (seconds):
CM_STR_ACB_RESET_TIMER_CANCEL :{BLACK}Cancel Reset
CM_STR_ACB_RESET_TIMER_CANCEL_TOOLTIP :{BLACK}Cancel the Reset timer.
CM_STR_ACB_AWARNING :{BLACK}Warning
CM_STR_ACB_AWARNING_TOOLTIP :{BLACK}Sends a Warning to company that an admin is trying to contact.
CM_STR_ACB_RESET_COMP :{BLACK}RESET Company
CM_STR_ACB_RESET_COMP_SURE :{WHITE}Sure to RESET this company?
CM_STR_ACB_RESET_SPEC_SURE :{WHITE}Sure to RESET this company, send players to SPECTATORS?
CM_STR_ACB_RESET_KICK_SURE :{WHITE}Sure to RESET this company, and KICK players on it?
CM_STR_ACB_PLAYER_NEWSTICKET :{BLACK}Type message as newspapper ticket to this Player
CM_STR_ACB_COMPANY_NEWSTICKET :{BLACK}Type message as newspapper ticket to this Company
CM_STR_ACB_COMPANY_JOIN2 :{BLACK}A. Join
CM_STR_ACB_COMPANY_JOIN2_TOOLTIP :{BLACK}Join as an admin
### Several command strings ###
CM_STR_SCS_COMPANY_NEW_JOIN_TOOLTIP :Hold CTRL and click for joining with new company.

View File

@@ -40,6 +40,7 @@
#include "../citymania/cm_client_list_gui.hpp" #include "../citymania/cm_client_list_gui.hpp"
#include "../citymania/cm_commands.hpp" #include "../citymania/cm_commands.hpp"
#include "../citymania/cm_newgrf_revisions.hpp" #include "../citymania/cm_newgrf_revisions.hpp"
#include "../citymania/cm_commands_gui.hpp" /* Admin company buttons */
#include "../safeguards.h" #include "../safeguards.h"
@@ -1325,7 +1326,8 @@ void NetworkClientsToSpectators(CompanyID cid)
NetworkTextMessage(NETWORK_ACTION_COMPANY_SPECTATOR, CC_DEFAULT, false, ci->client_name); NetworkTextMessage(NETWORK_ACTION_COMPANY_SPECTATOR, CC_DEFAULT, false, ci->client_name);
ci->client_playas = COMPANY_SPECTATOR; ci->client_playas = COMPANY_SPECTATOR;
} }
/* Admin company buttons: delete window */
citymania::ShowAdminCompanyButtons(0, 0, 0, cid+1, false, false);
cur_company.Restore(); cur_company.Restore();
} }

View File

@@ -902,9 +902,8 @@ static CommandCost CmdRailTrackHelper(DoCommandFlag flags, TileIndex tile, TileI
bool had_success = false; bool had_success = false;
CommandCost last_error = CMD_ERROR; CommandCost last_error = CMD_ERROR;
for (;;) { for (;;) {
ret = remove ? Command<CMD_REMOVE_SINGLE_RAIL>::Do(flags, tile, TrackdirToTrack(trackdir)) : Command<CMD_BUILD_SINGLE_RAIL>::Do(flags, tile, railtype, TrackdirToTrack(trackdir), auto_remove_signals);
TileIndex last_endtile = _rail_track_endtile; // CM TileIndex last_endtile = _rail_track_endtile; // CM
ret = remove ? Command<CMD_REMOVE_SINGLE_RAIL>::Do(flags, tile, TrackdirToTrack(trackdir)) : Command<CMD_BUILD_SINGLE_RAIL>::Do(flags, tile, railtype, TrackdirToTrack(trackdir), auto_remove_signals);
if (ret.Failed()) { if (ret.Failed()) {
last_error = ret; last_error = ret;
if (_rail_track_endtile == INVALID_TILE) _rail_track_endtile = last_endtile; // CM if (_rail_track_endtile == INVALID_TILE) _rail_track_endtile = last_endtile; // CM

View File

@@ -282,6 +282,11 @@ void ShowStatusBar()
} }
void CM_RedrawStatusBar() { void CM_RedrawStatusBar() {
StatusBarWindow *w = dynamic_cast<StatusBarWindow*>(FindWindowById(WC_STATUS_BAR, 0)); Window *w = FindWindowById(WC_STATUS_BAR, 0);
w->ReInit();
if (w == nullptr) return;
StatusBarWindow *st = static_cast<StatusBarWindow*>(w);
st->ReInit();
} }

View File

@@ -52,11 +52,8 @@ enum CompanyWidgets : WidgetID {
WID_C_COMPANY_PASSWORD, ///< Button to set company password. WID_C_COMPANY_PASSWORD, ///< Button to set company password.
WID_C_COMPANY_JOIN, ///< Button to join company. WID_C_COMPANY_JOIN, ///< Button to join company.
WID_C_SELECT_MOD, CM_WID_C_SELECT_ADMINBUTTONS,
WID_C_SELECT_MOD_JOIN, CM_WID_C_ADMINBUTTONS,
WID_C_MOD_COMPANY_JOIN,
WID_C_MOD_COMPANY_RESET,
WID_C_MOD_COMPANY_TOGGLE_LOCK,
}; };
/** Widgets of the #CompanyFinancesWindow class. */ /** Widgets of the #CompanyFinancesWindow class. */

View File

@@ -732,6 +732,8 @@ enum WindowClass {
CM_WC_COMMAND_TOOLBAR, CM_WC_COMMAND_TOOLBAR,
CM_WC_LOGIN_WINDOW, CM_WC_LOGIN_WINDOW,
CM_WC_CB_TOWN, CM_WC_CB_TOWN,
CM_WC_ADMIN_COMPANY_BUTTONS,
CM_LAST_SERVER,
WC_INVALID = 0xFFFF, ///< Invalid window. WC_INVALID = 0xFFFF, ///< Invalid window.
}; };