Fix compilation errors
This commit is contained in:
@@ -76,8 +76,7 @@ struct CargosWindow : Window {
|
|||||||
}
|
}
|
||||||
case WID_CT_HEADER_CARGO:
|
case WID_CT_HEADER_CARGO:
|
||||||
case WID_CT_LIST: {
|
case WID_CT_LIST: {
|
||||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
const CargoSpec *cs = _sorted_cargo_specs[i];
|
|
||||||
size->width = std::max(GetStringBoundingBox(cs->name).width + icon_space, size->width);
|
size->width = std::max(GetStringBoundingBox(cs->name).width + icon_space, size->width);
|
||||||
}
|
}
|
||||||
size->width = std::max(GetStringBoundingBox(STR_TOOLBAR_CARGOS_HEADER_TOTAL_MONTH).width, size->width);
|
size->width = std::max(GetStringBoundingBox(STR_TOOLBAR_CARGOS_HEADER_TOTAL_MONTH).width, size->width);
|
||||||
@@ -94,7 +93,7 @@ struct CargosWindow : Window {
|
|||||||
case WID_CT_AMOUNT:
|
case WID_CT_AMOUNT:
|
||||||
case WID_CT_INCOME:
|
case WID_CT_INCOME:
|
||||||
case WID_CT_LIST: {
|
case WID_CT_LIST: {
|
||||||
size->height = _sorted_standard_cargo_specs_size * line_height + CT_LINESPACE + FONT_HEIGHT_NORMAL;
|
size->height = _sorted_standard_cargo_specs.size() * line_height + CT_LINESPACE + FONT_HEIGHT_NORMAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +102,7 @@ struct CargosWindow : Window {
|
|||||||
Dimension GetMaxIconSize() const {
|
Dimension GetMaxIconSize() const {
|
||||||
const CargoSpec *cs;
|
const CargoSpec *cs;
|
||||||
Dimension size = {0, 0};
|
Dimension size = {0, 0};
|
||||||
FOR_ALL_CARGOSPECS(cs) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
Dimension icon_size = GetSpriteSize(cs->GetCargoIcon());
|
Dimension icon_size = GetSpriteSize(cs->GetCargoIcon());
|
||||||
size.width = std::max(size.width, icon_size.width);
|
size.width = std::max(size.width, icon_size.width);
|
||||||
size.height = std::max(size.height, icon_size.height);
|
size.height = std::max(size.height, icon_size.height);
|
||||||
@@ -134,8 +133,7 @@ struct CargosWindow : Window {
|
|||||||
|
|
||||||
case WID_CT_LIST: {
|
case WID_CT_LIST: {
|
||||||
int rect_x = r.left + WD_FRAMERECT_LEFT;
|
int rect_x = r.left + WD_FRAMERECT_LEFT;
|
||||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
const CargoSpec *cs = _sorted_cargo_specs[i];
|
|
||||||
Dimension icon_size = GetSpriteSize(cs->GetCargoIcon());
|
Dimension icon_size = GetSpriteSize(cs->GetCargoIcon());
|
||||||
DrawSprite(cs->GetCargoIcon(), PAL_NONE,
|
DrawSprite(cs->GetCargoIcon(), PAL_NONE,
|
||||||
r.left + max_icon_size.width - icon_size.width,
|
r.left + max_icon_size.width - icon_size.width,
|
||||||
@@ -156,8 +154,7 @@ struct CargosWindow : Window {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WID_CT_AMOUNT:
|
case WID_CT_AMOUNT:
|
||||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
const CargoSpec *cs = _sorted_cargo_specs[i];
|
|
||||||
auto &economy = (this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH ? c->old_economy[0] : c->cur_economy);
|
auto &economy = (this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH ? c->old_economy[0] : c->cur_economy);
|
||||||
sum_cargo_amount += economy.delivered_cargo[cs->Index()];
|
sum_cargo_amount += economy.delivered_cargo[cs->Index()];
|
||||||
SetDParam(0, economy.delivered_cargo[cs->Index()]);
|
SetDParam(0, economy.delivered_cargo[cs->Index()]);
|
||||||
@@ -173,8 +170,7 @@ struct CargosWindow : Window {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_CT_INCOME:
|
case WID_CT_INCOME:
|
||||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
const CargoSpec *cs = _sorted_cargo_specs[i];
|
|
||||||
auto &economy = (this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH ? c->old_economy[0] : c->cur_economy);
|
auto &economy = (this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH ? c->old_economy[0] : c->cur_economy);
|
||||||
|
|
||||||
sum_cargo_income += economy.cm.cargo_income[cs->Index()];
|
sum_cargo_income += economy.cm.cargo_income[cs->Index()];
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include "citymania/cm_commands_gui.hpp"
|
#include "cm_commands_gui.hpp"
|
||||||
|
|
||||||
#include "citymania/cm_base64.hpp"
|
#include "cm_base64.hpp"
|
||||||
|
#include "cm_main.hpp"
|
||||||
|
|
||||||
#include "core/geometry_func.hpp" //maxdim
|
#include "core/geometry_func.hpp" //maxdim
|
||||||
#include "settings_type.h"
|
#include "settings_type.h"
|
||||||
@@ -367,7 +368,8 @@ struct CommandsToolbarWindow : Window {
|
|||||||
strecpy(ip, NOVAPOLIS_IPV4_PRIMARY, lastof(ip));
|
strecpy(ip, NOVAPOLIS_IPV4_PRIMARY, lastof(ip));
|
||||||
// else strecpy(ip, NOVAPOLIS_IPV4_SECONDARY, lastof(ip));
|
// else strecpy(ip, NOVAPOLIS_IPV4_SECONDARY, lastof(ip));
|
||||||
|
|
||||||
NetworkClientConnectGame(ip, (3980 + widget - CTW_NS0), COMPANY_SPECTATOR);
|
// FIXME
|
||||||
|
// NetworkClientConnectGame(ip, (3980 + widget - CTW_NS0), COMPANY_SPECTATOR);
|
||||||
}
|
}
|
||||||
else if (widget >= CTW_CARGO_FIRST) {
|
else if (widget >= CTW_CARGO_FIRST) {
|
||||||
int i = widget - CTW_CARGO_FIRST;
|
int i = widget - CTW_CARGO_FIRST;
|
||||||
@@ -446,7 +448,7 @@ struct CommandsToolbarWindow : Window {
|
|||||||
|
|
||||||
void OnHundredthTick()
|
void OnHundredthTick()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
for (int i = 0; i < _sorted_standard_cargo_specs.size(); i++) {
|
||||||
if (this->IsWidgetLowered(i + CTW_CARGO_FIRST)) {
|
if (this->IsWidgetLowered(i + CTW_CARGO_FIRST)) {
|
||||||
static int x = 0;
|
static int x = 0;
|
||||||
x++;
|
x++;
|
||||||
@@ -466,13 +468,13 @@ static NWidgetBase *MakeCargoButtons(int *biggest_index)
|
|||||||
{
|
{
|
||||||
NWidgetVertical *ver = new NWidgetVertical;
|
NWidgetVertical *ver = new NWidgetVertical;
|
||||||
|
|
||||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
for (int i = 0; i < _sorted_standard_cargo_specs.size(); i++) {
|
||||||
NWidgetBackground *leaf = new NWidgetBackground(WWT_PANEL, COLOUR_ORANGE, CTW_CARGO_FIRST + i, NULL);
|
NWidgetBackground *leaf = new NWidgetBackground(WWT_PANEL, COLOUR_ORANGE, CTW_CARGO_FIRST + i, NULL);
|
||||||
leaf->tool_tip = STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO;
|
leaf->tool_tip = STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO;
|
||||||
leaf->SetFill(1, 0);
|
leaf->SetFill(1, 0);
|
||||||
ver->Add(leaf);
|
ver->Add(leaf);
|
||||||
}
|
}
|
||||||
*biggest_index = CTW_CARGO_FIRST + _sorted_standard_cargo_specs_size - 1;
|
*biggest_index = CTW_CARGO_FIRST + _sorted_standard_cargo_specs.size() - 1;
|
||||||
return ver;
|
return ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,7 +851,7 @@ static WindowDesc _login_window_desc(
|
|||||||
void ShowLoginWindow()
|
void ShowLoginWindow()
|
||||||
{
|
{
|
||||||
IniLoginInitiate();
|
IniLoginInitiate();
|
||||||
DeleteWindowByClass(WC_LOGIN_WINDOW);
|
CloseWindowByClass(WC_LOGIN_WINDOW);
|
||||||
AllocateWindowDescFront<LoginWindow>(&_login_window_desc, 0);
|
AllocateWindowDescFront<LoginWindow>(&_login_window_desc, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,13 +83,13 @@ bool ConTreeMap(byte argc, char *argv[]) {
|
|||||||
std::string filename = argv[1];
|
std::string filename = argv[1];
|
||||||
|
|
||||||
if (_game_mode != GM_EDITOR) {
|
if (_game_mode != GM_EDITOR) {
|
||||||
IConsolePrintF(CC_ERROR, "This command is only available in scenario editor.");
|
IConsolePrint(CC_ERROR, "This command is only available in scenario editor.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (filename.size() < 4) {
|
if (filename.size() < 4) {
|
||||||
IConsolePrintF(CC_ERROR, "Unknown treemap extension should be .bmp or .png.");
|
IConsolePrint(CC_ERROR, "Unknown treemap extension should be .bmp or .png.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,9 +101,9 @@ bool ConTreeMap(byte argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
#ifdef WITH_PNG
|
#ifdef WITH_PNG
|
||||||
IConsolePrintF(CC_ERROR, "Unknown treemap extension %s, should be .bmp or .png.", ext.c_str());
|
IConsolePrint(CC_ERROR, "Unknown treemap extension {}, should be .bmp or .png.", ext.c_str());
|
||||||
#else
|
#else
|
||||||
IConsolePrintF(CC_ERROR, "Unknown treemap extension %s, should be .bmp (game was compiled without PNG support).", ext.c_str());
|
IConsolePrint(CC_ERROR, "Unknown treemap extension {}, should be .bmp (game was compiled without PNG support).", ext.c_str());
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -166,9 +166,9 @@ static std::queue<FakeCommand> _fake_commands;
|
|||||||
void MakeReplaySave() {
|
void MakeReplaySave() {
|
||||||
char *filename = str_fmt("replay_%d.sav", _replay_ticks);
|
char *filename = str_fmt("replay_%d.sav", _replay_ticks);
|
||||||
if (SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, SAVE_DIR) != SL_OK) {
|
if (SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, SAVE_DIR) != SL_OK) {
|
||||||
IConsolePrintF(CC_ERROR, "Replay save failed");
|
IConsolePrint(CC_ERROR, "Replay save failed");
|
||||||
} else {
|
} else {
|
||||||
IConsolePrintF(CC_DEFAULT, "Replay saved to %s", filename);
|
IConsolePrint(CC_DEFAULT, "Replay saved to {}", filename);
|
||||||
}
|
}
|
||||||
_replay_last_save = _replay_ticks;
|
_replay_last_save = _replay_ticks;
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ void ExecuteFakeCommands(Date date, DateFract date_fract) {
|
|||||||
cp.p1 = x.p1;
|
cp.p1 = x.p1;
|
||||||
cp.p2 = x.p2;
|
cp.p2 = x.p2;
|
||||||
cp.cmd = x.cmd;
|
cp.cmd = x.cmd;
|
||||||
strecpy(cp.text, x.text.c_str(), lastof(cp.text));
|
cp.text = x.text;
|
||||||
cp.company = (CompanyID)x.company_id;
|
cp.company = (CompanyID)x.company_id;
|
||||||
cp.frame = _frame_counter_max + 1;
|
cp.frame = _frame_counter_max + 1;
|
||||||
cp.callback = nullptr;
|
cp.callback = nullptr;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ extern DiagDirection _build_depot_direction; ///< Currently selected depot direc
|
|||||||
extern DiagDirection _road_station_picker_orientation;
|
extern DiagDirection _road_station_picker_orientation;
|
||||||
extern DiagDirection _road_depot_orientation;
|
extern DiagDirection _road_depot_orientation;
|
||||||
extern uint32 _realtime_tick;
|
extern uint32 _realtime_tick;
|
||||||
extern void GetStationLayout(byte *layout, int numtracks, int plat_len, const StationSpec *statspec);
|
extern void GetStationLayout(byte *layout, uint numtracks, uint plat_len, const StationSpec *statspec);
|
||||||
|
|
||||||
struct RailStationGUISettings {
|
struct RailStationGUISettings {
|
||||||
Axis orientation; ///< Currently selected rail station orientation
|
Axis orientation; ///< Currently selected rail station orientation
|
||||||
@@ -266,7 +266,7 @@ static bool CanBuild(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd) {
|
|||||||
p2,
|
p2,
|
||||||
cmd,
|
cmd,
|
||||||
nullptr, // callback
|
nullptr, // callback
|
||||||
nullptr, // text
|
"", // text
|
||||||
true, // my_cmd
|
true, // my_cmd
|
||||||
true // estimate_only
|
true // estimate_only
|
||||||
).Succeeded();
|
).Succeeded();
|
||||||
@@ -340,7 +340,7 @@ void ObjectHighlight::UpdateTiles() {
|
|||||||
CMD_BUILD_ROAD_STOP
|
CMD_BUILD_ROAD_STOP
|
||||||
) ? PALETTE_TINT_WHITE : PALETTE_TINT_RED_DEEP);
|
) ? PALETTE_TINT_WHITE : PALETTE_TINT_RED_DEEP);
|
||||||
TileIndex tile;
|
TileIndex tile;
|
||||||
TILE_AREA_LOOP(tile, ta) {
|
for (TileIndex tile : ta) {
|
||||||
this->tiles.insert(std::make_pair(tile, ObjectTileHighlight::make_road_stop(palette, this->roadtype, this->ddir, this->is_truck)));
|
this->tiles.insert(std::make_pair(tile, ObjectTileHighlight::make_road_stop(palette, this->roadtype, this->ddir, this->is_truck)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1313,7 +1313,7 @@ void UpdateTownZoning(Town *town, uint32 prev_edge) {
|
|||||||
recalc = false;
|
recalc = false;
|
||||||
}
|
}
|
||||||
// TODO mark dirty only if zoning is on
|
// TODO mark dirty only if zoning is on
|
||||||
TILE_AREA_LOOP(tile, area) {
|
for(TileIndex tile : area) {
|
||||||
uint8 group = GetTownZone(town, tile);
|
uint8 group = GetTownZone(town, tile);
|
||||||
|
|
||||||
if (_mz[tile].town_zone != group)
|
if (_mz[tile].town_zone != group)
|
||||||
|
|||||||
@@ -85,14 +85,13 @@ void UpdateModKeys(bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
|
|||||||
_remove_mod = mod_pressed[(size_t)_settings_client.gui.cm_remove_mod];
|
_remove_mod = mod_pressed[(size_t)_settings_client.gui.cm_remove_mod];
|
||||||
_estimate_mod = mod_pressed[(size_t)_settings_client.gui.cm_estimate_mod];
|
_estimate_mod = mod_pressed[(size_t)_settings_client.gui.cm_estimate_mod];
|
||||||
|
|
||||||
Window *w;
|
|
||||||
if (fn_mod_prev != _fn_mod) {
|
if (fn_mod_prev != _fn_mod) {
|
||||||
FOR_ALL_WINDOWS_FROM_FRONT(w) {
|
for (auto w : Window::IterateFromFront()) {
|
||||||
if (w->CM_OnFnModStateChange() == ES_HANDLED) break;
|
if (w->CM_OnFnModStateChange() == ES_HANDLED) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (remove_mod_prev != _remove_mod) {
|
if (remove_mod_prev != _remove_mod) {
|
||||||
FOR_ALL_WINDOWS_FROM_FRONT(w) {
|
for (auto w : Window::IterateFromFront()) {
|
||||||
if (w->CM_OnRemoveModStateChange() == ES_HANDLED) break;
|
if (w->CM_OnRemoveModStateChange() == ES_HANDLED) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,7 +165,7 @@ void RailToolbar_UpdateRemoveWidgetStatus(Window *w, int widget, bool remove_act
|
|||||||
bool RailToolbar_RemoveModChanged(Window *w, bool invert_remove, bool remove_active, bool button_clicked) {
|
bool RailToolbar_RemoveModChanged(Window *w, bool invert_remove, bool remove_active, bool button_clicked) {
|
||||||
if (w->IsWidgetDisabled(WID_RAT_REMOVE)) return false;
|
if (w->IsWidgetDisabled(WID_RAT_REMOVE)) return false;
|
||||||
|
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
for (uint i = WID_RAT_BUILD_NS; i < WID_RAT_REMOVE; i++) {
|
for (uint i = WID_RAT_BUILD_NS; i < WID_RAT_REMOVE; i++) {
|
||||||
if (w->IsWidgetLowered(i)) {
|
if (w->IsWidgetLowered(i)) {
|
||||||
auto old_active = remove_active;
|
auto old_active = remove_active;
|
||||||
@@ -248,7 +247,7 @@ void RoadToolbar_UpdateOptionWidgetStatus(Window *w, int widget, bool remove_act
|
|||||||
|
|
||||||
bool RoadToolbar_RemoveModChanged(Window *w, bool remove_active, bool button_clicked, bool is_road) {
|
bool RoadToolbar_RemoveModChanged(Window *w, bool remove_active, bool button_clicked, bool is_road) {
|
||||||
if (w->IsWidgetDisabled(WID_ROT_REMOVE)) return false;
|
if (w->IsWidgetDisabled(WID_ROT_REMOVE)) return false;
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
for (uint i = WID_ROT_ROAD_X; i < WID_ROT_REMOVE; i++) {
|
for (uint i = WID_ROT_ROAD_X; i < WID_ROT_REMOVE; i++) {
|
||||||
if (w->IsWidgetLowered(i)) {
|
if (w->IsWidgetLowered(i)) {
|
||||||
auto old_active = remove_active;
|
auto old_active = remove_active;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "cm_hotkeys.hpp"
|
#include "cm_hotkeys.hpp"
|
||||||
#include "cm_minimap.hpp"
|
#include "cm_minimap.hpp"
|
||||||
|
|
||||||
|
#include "../network/network_func.h"
|
||||||
#include "../window_func.h"
|
#include "../window_func.h"
|
||||||
|
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
@@ -27,4 +28,8 @@ void ToggleSmallMap() {
|
|||||||
delete w;
|
delete w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkClientSendChatToServer(const std::string &msg) {
|
||||||
|
NetworkClientSendChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, CLIENT_ID_SERVER, msg);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace citymania
|
} // namespace citymania
|
||||||
@@ -17,6 +17,7 @@ void Emit(const T &event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ToggleSmallMap();
|
void ToggleSmallMap();
|
||||||
|
void NetworkClientSendChatToServer(const std::string &msg);
|
||||||
|
|
||||||
} // namespace citymania
|
} // namespace citymania
|
||||||
|
|
||||||
|
|||||||
@@ -729,7 +729,7 @@ inline uint32 SmallMapWindow::GetTileColours(const TileArea &ta) const
|
|||||||
TileIndex tile = INVALID_TILE; // Position of the most important tile.
|
TileIndex tile = INVALID_TILE; // Position of the most important tile.
|
||||||
TileType et = MP_VOID; // Effective tile type at that position.
|
TileType et = MP_VOID; // Effective tile type at that position.
|
||||||
|
|
||||||
TILE_AREA_LOOP(ti, ta) {
|
for(TileIndex ti : ta) {
|
||||||
TileType ttype = GetTileType(ti);
|
TileType ttype = GetTileType(ti);
|
||||||
|
|
||||||
switch (ttype) {
|
switch (ttype) {
|
||||||
|
|||||||
@@ -112,17 +112,17 @@ public:
|
|||||||
#else
|
#else
|
||||||
# define LANDINFOD_LEVEL 1
|
# define LANDINFOD_LEVEL 1
|
||||||
#endif
|
#endif
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "TILE: %#x (%i,%i)", tile, TileX(tile), TileY(tile));
|
Debug(misc, LANDINFOD_LEVEL, "TILE: %#x (%i,%i)", tile, TileX(tile), TileY(tile));
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "type = %#x", _m[tile].type);
|
Debug(misc, LANDINFOD_LEVEL, "type = %#x", _m[tile].type);
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "height = %#x", _m[tile].height);
|
Debug(misc, LANDINFOD_LEVEL, "height = %#x", _m[tile].height);
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "m1 = %#x", _m[tile].m1);
|
Debug(misc, LANDINFOD_LEVEL, "m1 = %#x", _m[tile].m1);
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "m2 = %#x", _m[tile].m2);
|
Debug(misc, LANDINFOD_LEVEL, "m2 = %#x", _m[tile].m2);
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "m3 = %#x", _m[tile].m3);
|
Debug(misc, LANDINFOD_LEVEL, "m3 = %#x", _m[tile].m3);
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "m4 = %#x", _m[tile].m4);
|
Debug(misc, LANDINFOD_LEVEL, "m4 = %#x", _m[tile].m4);
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "m5 = %#x", _m[tile].m5);
|
Debug(misc, LANDINFOD_LEVEL, "m5 = %#x", _m[tile].m5);
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "m6 = %#x", _me[tile].m6);
|
Debug(misc, LANDINFOD_LEVEL, "m6 = %#x", _me[tile].m6);
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "m7 = %#x", _me[tile].m7);
|
Debug(misc, LANDINFOD_LEVEL, "m7 = %#x", _me[tile].m7);
|
||||||
DEBUG(misc, LANDINFOD_LEVEL, "m8 = %#x", _me[tile].m8);
|
Debug(misc, LANDINFOD_LEVEL, "m8 = %#x", _me[tile].m8);
|
||||||
#undef LANDINFOD_LEVEL
|
#undef LANDINFOD_LEVEL
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,7 +386,7 @@ void ShowLandInfo(TileIndex tile, TileIndex end_tile)
|
|||||||
if (tile == last_tooltip_tile) return;
|
if (tile == last_tooltip_tile) return;
|
||||||
last_tooltip_tile = tile;
|
last_tooltip_tile = tile;
|
||||||
|
|
||||||
DeleteWindowById(WC_LAND_INFO, 0);
|
CloseWindowById(WC_LAND_INFO, 0);
|
||||||
if (tile == INVALID_TILE) return;
|
if (tile == INVALID_TILE) return;
|
||||||
new LandInfoWindow(tile, end_tile);
|
new LandInfoWindow(tile, end_tile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ static RoadBits FindRoadsToConnect(TileIndex tile, RoadType roadtype) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CheckDriveThroughRoadStopDirection(TileArea area, RoadBits r) {
|
bool CheckDriveThroughRoadStopDirection(TileArea area, RoadBits r) {
|
||||||
TILE_AREA_LOOP(tile, area) {
|
for (TileIndex tile : area) {
|
||||||
if (GetTileType(tile) != MP_ROAD) continue;
|
if (GetTileType(tile) != MP_ROAD) continue;
|
||||||
if (GetRoadTileType(tile) != ROAD_TILE_NORMAL) continue;
|
if (GetRoadTileType(tile) != ROAD_TILE_NORMAL) continue;
|
||||||
if (GetAllRoadBits(tile) & ~r) return false;
|
if (GetAllRoadBits(tile) & ~r) return false;
|
||||||
@@ -436,7 +436,7 @@ static void FindStationsAroundSelection(const TileArea &location)
|
|||||||
Station *adjacent = nullptr;
|
Station *adjacent = nullptr;
|
||||||
|
|
||||||
/* Direct loop instead of FindStationsAroundTiles as we are not interested in catchment area */
|
/* Direct loop instead of FindStationsAroundTiles as we are not interested in catchment area */
|
||||||
TILE_AREA_LOOP(tile, ta) {
|
for (auto tile : ta) {
|
||||||
if (IsTileType(tile, MP_STATION) && GetTileOwner(tile) == _local_company) {
|
if (IsTileType(tile, MP_STATION) && GetTileOwner(tile) == _local_company) {
|
||||||
Station *st = Station::GetByTile(tile);
|
Station *st = Station::GetByTile(tile);
|
||||||
if (st == nullptr) continue;
|
if (st == nullptr) continue;
|
||||||
@@ -571,7 +571,7 @@ CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
|
|||||||
|
|
||||||
/* Loop over all tiles to get the produced cargo of
|
/* Loop over all tiles to get the produced cargo of
|
||||||
* everything except industries */
|
* everything except industries */
|
||||||
TILE_AREA_LOOP(tile, ta) {
|
for(auto tile : ta) {
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_INDUSTRY:
|
case MP_INDUSTRY:
|
||||||
industries.insert(GetIndustryIndex(tile));
|
industries.insert(GetIndustryIndex(tile));
|
||||||
|
|||||||
@@ -104,9 +104,7 @@ struct LandTooltipsWindow : public Window
|
|||||||
SetDParam(0, st->index);
|
SetDParam(0, st->index);
|
||||||
size->width = std::max(GetStringBoundingBox(STR_CM_LAND_TOOLTIPS_STATION_NAME).width, size->width);
|
size->width = std::max(GetStringBoundingBox(STR_CM_LAND_TOOLTIPS_STATION_NAME).width, size->width);
|
||||||
|
|
||||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
const CargoSpec *cs = _sorted_cargo_specs[i];
|
|
||||||
if(cs == NULL) continue;
|
|
||||||
int cargoid = cs->Index();
|
int cargoid = cs->Index();
|
||||||
if (HasBit(st->goods[cargoid].status, GoodsEntry::GES_RATING)) {
|
if (HasBit(st->goods[cargoid].status, GoodsEntry::GES_RATING)) {
|
||||||
size->height += line_height;
|
size->height += line_height;
|
||||||
@@ -186,9 +184,7 @@ struct LandTooltipsWindow : public Window
|
|||||||
DrawString(left, right, y, STR_CM_LAND_TOOLTIPS_STATION_NAME, TC_BLACK, SA_CENTER);
|
DrawString(left, right, y, STR_CM_LAND_TOOLTIPS_STATION_NAME, TC_BLACK, SA_CENTER);
|
||||||
y += FONT_HEIGHT_NORMAL + 2;
|
y += FONT_HEIGHT_NORMAL + 2;
|
||||||
|
|
||||||
for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
const CargoSpec *cs = _sorted_cargo_specs[i];
|
|
||||||
if(cs == NULL) continue;
|
|
||||||
int cargoid = cs->Index();
|
int cargoid = cs->Index();
|
||||||
if (HasBit(st->goods[cargoid].status, GoodsEntry::GES_RATING)) {
|
if (HasBit(st->goods[cargoid].status, GoodsEntry::GES_RATING)) {
|
||||||
SetDParam(0, cs->name);
|
SetDParam(0, cs->name);
|
||||||
@@ -223,7 +219,7 @@ void ShowLandTooltips(TileIndex tile, Window *parent) {
|
|||||||
last_tooltip_tile = tile;
|
last_tooltip_tile = tile;
|
||||||
|
|
||||||
if (tile == INVALID_TILE) {
|
if (tile == INVALID_TILE) {
|
||||||
DeleteWindowById(CM_WC_LAND_TOOLTIPS, 0);
|
CloseWindowById(CM_WC_LAND_TOOLTIPS, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +251,7 @@ void ShowLandTooltips(TileIndex tile, Window *parent) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DeleteWindowById(CM_WC_LAND_TOOLTIPS, 0);
|
CloseWindowById(CM_WC_LAND_TOOLTIPS, 0);
|
||||||
|
|
||||||
if (param == 0) return;
|
if (param == 0) return;
|
||||||
new LandTooltipsWindow(parent, param);
|
new LandTooltipsWindow(parent, param);
|
||||||
@@ -504,7 +500,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool ShowStationRatingTooltip(Window *parent, const Station *st, const CargoSpec *cs, TooltipCloseCondition close_cond) {
|
bool ShowStationRatingTooltip(Window *parent, const Station *st, const CargoSpec *cs, TooltipCloseCondition close_cond) {
|
||||||
DeleteWindowById(WC_STATION_RATING_TOOLTIP, 0);
|
CloseWindowById(WC_STATION_RATING_TOOLTIP, 0);
|
||||||
new StationRatingTooltipWindow(parent, st, cs, close_cond);
|
new StationRatingTooltipWindow(parent, st, cs, close_cond);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "../stdafx.h"
|
#include "../stdafx.h"
|
||||||
|
|
||||||
#include "cm_watch_gui.hpp"
|
#include "cm_watch_gui.hpp"
|
||||||
|
#include "cm_main.hpp"
|
||||||
|
|
||||||
#include "../widget_type.h"
|
#include "../widget_type.h"
|
||||||
#include "../gfx_type.h"
|
#include "../gfx_type.h"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "../window_gui.h"
|
#include "../window_gui.h"
|
||||||
#include "../company_base.h"
|
#include "../company_base.h"
|
||||||
|
#include "../network/core/config.h"
|
||||||
|
|
||||||
namespace citymania {
|
namespace citymania {
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "widgets/company_widget.h"
|
#include "widgets/company_widget.h"
|
||||||
|
|
||||||
#include "citymania/cm_hotkeys.hpp"
|
#include "citymania/cm_hotkeys.hpp"
|
||||||
|
#include "citymania/cm_main.hpp"
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
@@ -2220,7 +2221,7 @@ static void ResetCallback(Window *w, bool confirmed)
|
|||||||
CompanyID company2 = (CompanyID)w->window_number;
|
CompanyID company2 = (CompanyID)w->window_number;
|
||||||
char msg[128];
|
char msg[128];
|
||||||
seprintf(msg, lastof(msg), "!reset %i", company2 + 1);
|
seprintf(msg, lastof(msg), "!reset %i", company2 + 1);
|
||||||
NetworkClientSendChatToServer(msg);
|
citymania::NetworkClientSendChatToServer(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2652,7 +2653,7 @@ struct CompanyWindow : Window
|
|||||||
// this->query_widget = WID_C_MOD_COMPANY_JOIN;
|
// this->query_widget = WID_C_MOD_COMPANY_JOIN;
|
||||||
char msg[128];
|
char msg[128];
|
||||||
seprintf(msg, lastof(msg), "!move %i", company2 + 1);
|
seprintf(msg, lastof(msg), "!move %i", company2 + 1);
|
||||||
NetworkClientSendChatToServer(msg);
|
citymania::NetworkClientSendChatToServer(msg);
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2668,7 +2669,7 @@ struct CompanyWindow : Window
|
|||||||
CompanyID company2 = (CompanyID)this->window_number;
|
CompanyID company2 = (CompanyID)this->window_number;
|
||||||
char msg[128];
|
char msg[128];
|
||||||
seprintf(msg, lastof(msg), "!lockp %i", company2 + 1);
|
seprintf(msg, lastof(msg), "!lockp %i", company2 + 1);
|
||||||
NetworkClientSendChatToServer(msg);
|
citymania::NetworkClientSendChatToServer(msg);
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ static void LoadSpriteTables()
|
|||||||
PAL_DOS != used_set->palette
|
PAL_DOS != used_set->palette
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
LoadGrfFile("cmclient-3.grf", SPR_INNER_HIGHLIGHT_BASE - 4, i++);
|
LoadGrfFile("cmclient-3.grf", SPR_INNER_HIGHLIGHT_BASE - 4, PAL_DOS != used_set->palette);
|
||||||
|
|
||||||
/* Initialize the unicode to sprite mapping table */
|
/* Initialize the unicode to sprite mapping table */
|
||||||
InitializeUnicodeGlyphMap();
|
InitializeUnicodeGlyphMap();
|
||||||
|
|||||||
@@ -725,8 +725,7 @@ struct ExcludingCargoBaseGraphWindow : BaseGraphWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dimension max_cargo_dim = {0, 0};
|
Dimension max_cargo_dim = {0, 0};
|
||||||
const CargoSpec *cs;
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
|
||||||
SetDParam(0, cs->name);
|
SetDParam(0, cs->name);
|
||||||
max_cargo_dim = maxdim(max_cargo_dim, GetStringBoundingBox(STR_GRAPH_CARGO_PAYMENT_CARGO));
|
max_cargo_dim = maxdim(max_cargo_dim, GetStringBoundingBox(STR_GRAPH_CARGO_PAYMENT_CARGO));
|
||||||
}
|
}
|
||||||
@@ -735,7 +734,7 @@ struct ExcludingCargoBaseGraphWindow : BaseGraphWindow {
|
|||||||
this->line_height = this->icon_size + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
this->line_height = this->icon_size + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
||||||
size->width = (max_cargo_dim.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT + 1
|
size->width = (max_cargo_dim.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT + 1
|
||||||
+ (this->show_cargo_colors ? this->icon_size + WD_PAR_VSEP_NORMAL : 0));
|
+ (this->show_cargo_colors ? this->icon_size + WD_PAR_VSEP_NORMAL : 0));
|
||||||
size->height = std::max<uint>(size->height, this->line_height * _sorted_standard_cargo_specs_size);
|
size->height = std::max<uint>(size->height, this->line_height * _sorted_standard_cargo_specs.size());
|
||||||
resize->width = 0;
|
resize->width = 0;
|
||||||
resize->height = this->line_height;
|
resize->height = this->line_height;
|
||||||
fill->width = 0;
|
fill->width = 0;
|
||||||
@@ -757,8 +756,7 @@ struct ExcludingCargoBaseGraphWindow : BaseGraphWindow {
|
|||||||
int pos = this->vscroll->GetPosition();
|
int pos = this->vscroll->GetPosition();
|
||||||
int max = pos + this->vscroll->GetCapacity();
|
int max = pos + this->vscroll->GetCapacity();
|
||||||
|
|
||||||
const CargoSpec *cs;
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
|
||||||
if (pos-- > 0) continue;
|
if (pos-- > 0) continue;
|
||||||
if (--max < 0) break;
|
if (--max < 0) break;
|
||||||
|
|
||||||
@@ -789,8 +787,7 @@ struct ExcludingCargoBaseGraphWindow : BaseGraphWindow {
|
|||||||
this->excluded_data = 0;
|
this->excluded_data = 0;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const CargoSpec *cs;
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
|
||||||
if (HasBit(_legend_excluded_cargo, cs->Index())) SetBit(this->excluded_data, i);
|
if (HasBit(_legend_excluded_cargo, cs->Index())) SetBit(this->excluded_data, i);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -813,8 +810,7 @@ struct ExcludingCargoBaseGraphWindow : BaseGraphWindow {
|
|||||||
case WID_CPR_DISABLE_CARGOES: {
|
case WID_CPR_DISABLE_CARGOES: {
|
||||||
/* Add all cargoes to the excluded lists. */
|
/* Add all cargoes to the excluded lists. */
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const CargoSpec *cs;
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
|
||||||
SetBit(_legend_excluded_cargo, cs->Index());
|
SetBit(_legend_excluded_cargo, cs->Index());
|
||||||
SetBit(this->excluded_data, i);
|
SetBit(this->excluded_data, i);
|
||||||
i++;
|
i++;
|
||||||
@@ -824,11 +820,10 @@ struct ExcludingCargoBaseGraphWindow : BaseGraphWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WID_CPR_MATRIX: {
|
case WID_CPR_MATRIX: {
|
||||||
uint row = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_CPR_MATRIX, 0, this->line_height);
|
uint row = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_CPR_MATRIX);
|
||||||
if (row >= this->vscroll->GetCount()) return;
|
if (row >= this->vscroll->GetCount()) return;
|
||||||
|
|
||||||
const CargoSpec *cs;
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
|
||||||
if (row-- > 0) continue;
|
if (row-- > 0) continue;
|
||||||
|
|
||||||
ToggleBit(_legend_excluded_cargo, cs->Index());
|
ToggleBit(_legend_excluded_cargo, cs->Index());
|
||||||
@@ -945,7 +940,7 @@ struct IncomeGraphWindow : ExcludingCargoBaseGraphWindow {
|
|||||||
{
|
{
|
||||||
this->CreateNestedTree();
|
this->CreateNestedTree();
|
||||||
this->vscroll = this->GetScrollbar(WID_CPR_MATRIX_SCROLLBAR);
|
this->vscroll = this->GetScrollbar(WID_CPR_MATRIX_SCROLLBAR);
|
||||||
this->vscroll->SetCount(_sorted_standard_cargo_specs_size);
|
this->vscroll->SetCount(_sorted_standard_cargo_specs.size());
|
||||||
this->UpdateExcludedData();
|
this->UpdateExcludedData();
|
||||||
this->FinishInitNested(window_number);
|
this->FinishInitNested(window_number);
|
||||||
}
|
}
|
||||||
@@ -956,8 +951,7 @@ struct IncomeGraphWindow : ExcludingCargoBaseGraphWindow {
|
|||||||
return c->old_economy[j].income;
|
return c->old_economy[j].income;
|
||||||
}
|
}
|
||||||
uint total_income = 0;
|
uint total_income = 0;
|
||||||
const CargoSpec *cs;
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
|
||||||
if (!HasBit(_legend_excluded_cargo, cs->Index())){
|
if (!HasBit(_legend_excluded_cargo, cs->Index())){
|
||||||
total_income += c->old_economy[j].cm.cargo_income[cs->Index()];
|
total_income += c->old_economy[j].cm.cargo_income[cs->Index()];
|
||||||
}
|
}
|
||||||
@@ -1063,7 +1057,7 @@ struct DeliveredCargoGraphWindow : ExcludingCargoBaseGraphWindow {
|
|||||||
{
|
{
|
||||||
this->CreateNestedTree();
|
this->CreateNestedTree();
|
||||||
this->vscroll = this->GetScrollbar(WID_CPR_MATRIX_SCROLLBAR);
|
this->vscroll = this->GetScrollbar(WID_CPR_MATRIX_SCROLLBAR);
|
||||||
this->vscroll->SetCount(_sorted_standard_cargo_specs_size);
|
this->vscroll->SetCount(_sorted_standard_cargo_specs.size());
|
||||||
this->OnHundredthTick();
|
this->OnHundredthTick();
|
||||||
this->FinishInitNested(window_number);
|
this->FinishInitNested(window_number);
|
||||||
}
|
}
|
||||||
@@ -1074,8 +1068,7 @@ struct DeliveredCargoGraphWindow : ExcludingCargoBaseGraphWindow {
|
|||||||
return c->old_economy[j].delivered_cargo.GetSum<OverflowSafeInt64>();
|
return c->old_economy[j].delivered_cargo.GetSum<OverflowSafeInt64>();
|
||||||
}
|
}
|
||||||
uint total_delivered = 0;
|
uint total_delivered = 0;
|
||||||
const CargoSpec *cs;
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
|
||||||
if (!HasBit(_legend_excluded_cargo, cs->Index())){
|
if (!HasBit(_legend_excluded_cargo, cs->Index())){
|
||||||
total_delivered += c->old_economy[j].delivered_cargo[cs->Index()];
|
total_delivered += c->old_economy[j].delivered_cargo[cs->Index()];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
/* This file handles all the client-commands */
|
/* This file handles all the client-commands */
|
||||||
|
|
||||||
void SyncCMUser(const char *msg);
|
void SyncCMUser(const std::string &msg);
|
||||||
// extern const std::map<std::string, uint32> OPENTTD_NEWGRF_VERSIONS;
|
// extern const std::map<std::string, uint32> OPENTTD_NEWGRF_VERSIONS;
|
||||||
// extern const std::map<uint32, uint32> OPENTTD_RELEASE_REVISIONS;
|
// extern const std::map<uint32, uint32> OPENTTD_RELEASE_REVISIONS;
|
||||||
static const uint32 OPENTTD_NEWGRF_REVISION_MASK = (1 << 19) - 1;
|
static const uint32 OPENTTD_NEWGRF_REVISION_MASK = (1 << 19) - 1;
|
||||||
@@ -1016,7 +1016,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CHAT(Packet *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ci != nullptr) {
|
if (ci != nullptr) {
|
||||||
if (strncmp(msg, "synccmuser", 10) == 0) SyncCMUser(msg);
|
if (msg.rfind("synccmuser", 0) == 0) SyncCMUser(msg);
|
||||||
else NetworkTextMessage(action, GetDrawStringCompanyColour(ci->client_playas), self_send, name, msg, data);
|
else NetworkTextMessage(action, GetDrawStringCompanyColour(ci->client_playas), self_send, name, msg, data);
|
||||||
}
|
}
|
||||||
return NETWORK_RECV_STATUS_OKAY;
|
return NETWORK_RECV_STATUS_OKAY;
|
||||||
@@ -1339,10 +1339,6 @@ void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const
|
|||||||
MyClient::SendChat(action, type, dest, msg, data);
|
MyClient::SendChat(action, type, dest, msg, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkClientSendChatToServer(const char * msg)
|
|
||||||
{
|
|
||||||
NetworkClientSendChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, CLIENT_ID_SERVER, msg);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Set/Reset company password on the client side.
|
* Set/Reset company password on the client side.
|
||||||
* @param password Password to be set.
|
* @param password Password to be set.
|
||||||
@@ -1378,10 +1374,10 @@ bool NetworkMaxCompaniesReached()
|
|||||||
return Company::GetNumItems() >= (_network_server ? _settings_client.network.max_companies : _network_server_max_companies);
|
return Company::GetNumItems() >= (_network_server ? _settings_client.network.max_companies : _network_server_max_companies);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SyncCMUser(const char *msg) {
|
void SyncCMUser(const std::string &msg) {
|
||||||
uint user_id, role;
|
uint user_id, role;
|
||||||
sscanf(msg + 10, "%u %u", &user_id, &role);
|
sscanf(msg.c_str() + 10, "%u %u", &user_id, &role);
|
||||||
_novarole = (role >= 50);
|
_novarole = (role >= 50);
|
||||||
DEBUG(net, 1, "CityMania user synchronized: %u %u", user_id, role);
|
Debug(net, 1, "CityMania user synchronized: %u %u", user_id, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ void NetworkClientJoinGame();
|
|||||||
void NetworkClientRequestMove(CompanyID company, const std::string &pass = "");
|
void NetworkClientRequestMove(CompanyID company, const std::string &pass = "");
|
||||||
void NetworkClientSendRcon(const std::string &password, const std::string &command);
|
void NetworkClientSendRcon(const std::string &password, const std::string &command);
|
||||||
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64 data = 0);
|
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64 data = 0);
|
||||||
void NetworkClientSendChatToServer(const std::string &msg);
|
|
||||||
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
|
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
|
||||||
bool NetworkCompanyIsPassworded(CompanyID company_id);
|
bool NetworkCompanyIsPassworded(CompanyID company_id);
|
||||||
bool NetworkMaxCompaniesReached();
|
bool NetworkMaxCompaniesReached();
|
||||||
|
|||||||
@@ -798,7 +798,7 @@ public:
|
|||||||
case WID_NG_REDDIT:
|
case WID_NG_REDDIT:
|
||||||
case WID_NG_CITYMANIA:
|
case WID_NG_CITYMANIA:
|
||||||
if(!UDP_CC_queried){
|
if(!UDP_CC_queried){
|
||||||
NetworkUDPQueryMasterServer();
|
// FIXME NetworkUDPQueryMasterServer();
|
||||||
UDP_CC_queried = true;
|
UDP_CC_queried = true;
|
||||||
}
|
}
|
||||||
if(widget == WID_NG_NICE) this->filter_editbox.text.Assign("n-ice");
|
if(widget == WID_NG_NICE) this->filter_editbox.text.Assign("n-ice");
|
||||||
|
|||||||
@@ -655,7 +655,7 @@ int openttd_main(int argc, char *argv[])
|
|||||||
case 'x': scanner->save_config = false; break;
|
case 'x': scanner->save_config = false; break;
|
||||||
case 'X': only_local_path = true; break;
|
case 'X': only_local_path = true; break;
|
||||||
case 'C': {
|
case 'C': {
|
||||||
DeterminePaths(argv[0]);
|
DeterminePaths(argv[0], true);
|
||||||
if (StrEmpty(mgo.opt)) {
|
if (StrEmpty(mgo.opt)) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -763,8 +763,6 @@ private:
|
|||||||
|
|
||||||
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
|
||||||
|
|
||||||
/* Transfer and unload orders with leave empty as default */
|
|
||||||
if (unload_type == OUFB_TRANSFER || unload_type == OUFB_UNLOAD) {
|
|
||||||
bool set_no_load = false;
|
bool set_no_load = false;
|
||||||
if (unload_type == OUFB_TRANSFER){
|
if (unload_type == OUFB_TRANSFER){
|
||||||
set_no_load = _settings_client.gui.auto_noload_on_transfer;
|
set_no_load = _settings_client.gui.auto_noload_on_transfer;
|
||||||
|
|||||||
@@ -1327,7 +1327,7 @@ public:
|
|||||||
_railstation.orientation = OtherAxis(_railstation.orientation);
|
_railstation.orientation = OtherAxis(_railstation.orientation);
|
||||||
this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X);
|
this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
CloseWindowById(WC_SELECT_STATION, 0);
|
||||||
return ES_HANDLED;
|
return ES_HANDLED;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -2139,8 +2139,7 @@ struct StationViewWindow : public Window {
|
|||||||
if (ofs_y < 0) return false;
|
if (ofs_y < 0) return false;
|
||||||
|
|
||||||
const Station *st = Station::Get(this->window_number);
|
const Station *st = Station::Get(this->window_number);
|
||||||
const CargoSpec *cs;
|
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
|
||||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
|
||||||
const GoodsEntry *ge = &st->goods[cs->Index()];
|
const GoodsEntry *ge = &st->goods[cs->Index()];
|
||||||
if (!ge->HasRating()) continue;
|
if (!ge->HasRating()) continue;
|
||||||
ofs_y -= FONT_HEIGHT_NORMAL;
|
ofs_y -= FONT_HEIGHT_NORMAL;
|
||||||
|
|||||||
@@ -126,49 +126,48 @@ bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_t
|
|||||||
tree_start_tile = tree_recent_tile = prev_tile = 0;
|
tree_start_tile = tree_recent_tile = prev_tile = 0;
|
||||||
if (!citymania::_fn_mod) {
|
if (!citymania::_fn_mod) {
|
||||||
OrthogonalTileArea square_area = OrthogonalTileArea(start_tile, end_tile);
|
OrthogonalTileArea square_area = OrthogonalTileArea(start_tile, end_tile);
|
||||||
TILE_AREA_LOOP(curr_tile, square_area) {
|
for (auto cur_tile : square_area) {
|
||||||
// if we're on a non-consecutive tile or we've hit a black-marked tile
|
// if we're on a non-consecutive tile or we've hit a black-marked tile
|
||||||
// safe tiles are: TREES or non-FIELD clear tiles (because they're expensive to demolish)
|
// safe tiles are: TREES or non-FIELD clear tiles (because they're expensive to demolish)
|
||||||
if (tree_start_tile != 0 &&
|
if (tree_start_tile != 0 &&
|
||||||
(curr_tile != prev_tile + 1 ||
|
(cur_tile != prev_tile + 1 ||
|
||||||
(!IsTileType(curr_tile, MP_TREES) && (!IsTileType(curr_tile, MP_CLEAR) || IsClearGround(curr_tile, CLEAR_FIELDS))))) {
|
(!IsTileType(cur_tile, MP_TREES) && (!IsTileType(cur_tile, MP_CLEAR) || IsClearGround(cur_tile, CLEAR_FIELDS))))) {
|
||||||
DoCommandP(tree_start_tile, tree_recent_tile, 0, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound_EXPLOSION);
|
DoCommandP(tree_start_tile, tree_recent_tile, 0, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound_EXPLOSION);
|
||||||
tree_start_tile = tree_recent_tile = 0;
|
tree_start_tile = tree_recent_tile = 0;
|
||||||
}
|
}
|
||||||
// if current tile is a tree
|
// if current tile is a tree
|
||||||
if (IsTileType(curr_tile, MP_TREES)) {
|
if (IsTileType(cur_tile, MP_TREES)) {
|
||||||
if (tree_start_tile == 0) {
|
if (tree_start_tile == 0) {
|
||||||
tree_start_tile = curr_tile;
|
tree_start_tile = cur_tile;
|
||||||
}
|
}
|
||||||
tree_recent_tile = curr_tile;
|
tree_recent_tile = cur_tile;
|
||||||
}
|
}
|
||||||
prev_tile = curr_tile;
|
prev_tile = cur_tile;
|
||||||
}
|
}
|
||||||
// one last ride to flavortown
|
// one last ride to flavortown
|
||||||
if (tree_start_tile != 0) {
|
if (tree_start_tile != 0) {
|
||||||
DoCommandP(tree_start_tile, tree_recent_tile, 0, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound_EXPLOSION);
|
DoCommandP(tree_start_tile, tree_recent_tile, 0, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound_EXPLOSION);
|
||||||
}
|
}
|
||||||
} else { // diagonal area
|
} else { // diagonal area
|
||||||
DiagonalTileArea diagonal_area = DiagonalTileArea(start_tile, end_tile);
|
for (DiagonalTileIterator cur_tile{start_tile, end_tile}; cur_tile != INVALID_TILE; ++cur_tile) {
|
||||||
DIAGONAL_TILE_AREA_LOOP(curr_tile, diagonal_area) {
|
|
||||||
// same as above but with a different criteria for consecutive tiles
|
// same as above but with a different criteria for consecutive tiles
|
||||||
TileIndexDiffC tile_diff = TileIndexToTileIndexDiffC(curr_tile, prev_tile);
|
TileIndexDiffC tile_diff = TileIndexToTileIndexDiffC(cur_tile, prev_tile);
|
||||||
// if we're on a non-consecutive tile or we've hit a black-marked tile
|
// if we're on a non-consecutive tile or we've hit a black-marked tile
|
||||||
// safe tiles are: TREES or non-FIELD clear tiles (because they're expensive to demolish)
|
// safe tiles are: TREES or non-FIELD clear tiles (because they're expensive to demolish)
|
||||||
if (tree_start_tile != 0 &&
|
if (tree_start_tile != 0 &&
|
||||||
(!((tile_diff.x == 1 && tile_diff.y == 1) || (tile_diff.x == -1 && tile_diff.y == -1)) ||
|
(!((tile_diff.x == 1 && tile_diff.y == 1) || (tile_diff.x == -1 && tile_diff.y == -1)) ||
|
||||||
(!IsTileType(curr_tile, MP_TREES) && (!IsTileType(curr_tile, MP_CLEAR) || IsClearGround(curr_tile, CLEAR_FIELDS))))) {
|
(!IsTileType(cur_tile, MP_TREES) && (!IsTileType(cur_tile, MP_CLEAR) || IsClearGround(cur_tile, CLEAR_FIELDS))))) {
|
||||||
DoCommandP(tree_start_tile, tree_recent_tile, 1, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound_EXPLOSION);
|
DoCommandP(tree_start_tile, tree_recent_tile, 1, CMD_CLEAR_AREA | CMD_MSG(STR_ERROR_CAN_T_CLEAR_THIS_AREA), CcPlaySound_EXPLOSION);
|
||||||
tree_start_tile = tree_recent_tile = 0;
|
tree_start_tile = tree_recent_tile = 0;
|
||||||
}
|
}
|
||||||
// if current tile is a tree
|
// if current tile is a tree
|
||||||
if (IsTileType(curr_tile, MP_TREES)) {
|
if (IsTileType(cur_tile, MP_TREES)) {
|
||||||
if (tree_start_tile == 0) {
|
if (tree_start_tile == 0) {
|
||||||
tree_start_tile = curr_tile;
|
tree_start_tile = cur_tile;
|
||||||
}
|
}
|
||||||
tree_recent_tile = curr_tile;
|
tree_recent_tile = cur_tile;
|
||||||
}
|
}
|
||||||
prev_tile = curr_tile;
|
prev_tile = cur_tile;
|
||||||
}
|
}
|
||||||
// one last ride to flavortown
|
// one last ride to flavortown
|
||||||
if (tree_start_tile != 0) {
|
if (tree_start_tile != 0) {
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ void VideoDriver_Null::MainLoop()
|
|||||||
fprintf(stderr, "Null driver ran for %u tics, save: %s\n", this->ticks, this->savefile.c_str());
|
fprintf(stderr, "Null driver ran for %u tics, save: %s\n", this->ticks, this->savefile.c_str());
|
||||||
if (!this->savefile.empty()) {
|
if (!this->savefile.empty()) {
|
||||||
if (SaveOrLoad(this->savefile.c_str(), SLO_SAVE, DFT_GAME_FILE, SAVE_DIR) != SL_OK) {
|
if (SaveOrLoad(this->savefile.c_str(), SLO_SAVE, DFT_GAME_FILE, SAVE_DIR) != SL_OK) {
|
||||||
IConsolePrintF(CC_ERROR, "Error saving the final game state.");
|
IConsolePrint(CC_ERROR, "Error saving the final game state.");
|
||||||
} else {
|
} else {
|
||||||
IConsolePrintF(CC_DEFAULT, "Saved the final game state to %s", this->savefile.c_str());
|
IConsolePrint(CC_DEFAULT, "Saved the final game state to {}", this->savefile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user