| 1 |
From a12c3efeb1809ac09c46facc8dc88a3695693429 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Teddy <[email protected]> |
| 3 |
Date: Mon, 28 Jul 2025 10:59:28 +0200 |
| 4 |
Subject: [PATCH] Clean up code |
| 5 |
|
| 6 |
--- |
| 7 |
DataModel/Accessory.cpp | 5 ++--- |
| 8 |
DataModel/Accessory.h | 8 ++++---- |
| 9 |
DataModel/AccessoryBase.cpp | 3 +-- |
| 10 |
DataModel/AccessoryBase.h | 4 ++-- |
| 11 |
DataModel/Cluster.cpp | 12 +++++------- |
| 12 |
DataModel/Cluster.h | 7 +++---- |
| 13 |
DataModel/Feedback.cpp | 5 ++--- |
| 14 |
DataModel/Feedback.h | 2 +- |
| 15 |
DataModel/HardwareHandle.cpp | 3 +-- |
| 16 |
DataModel/HardwareHandle.h | 2 +- |
| 17 |
DataModel/Layer.h | 8 ++++---- |
| 18 |
DataModel/LayoutItem.cpp | 7 +++---- |
| 19 |
DataModel/LayoutItem.h | 10 +++++----- |
| 20 |
DataModel/LockableItem.cpp | 3 +-- |
| 21 |
DataModel/LockableItem.h | 3 +-- |
| 22 |
DataModel/Loco.cpp | 8 ++++---- |
| 23 |
DataModel/Loco.h | 2 +- |
| 24 |
DataModel/LocoBase.cpp | 7 +++---- |
| 25 |
DataModel/LocoBase.h | 4 ++-- |
| 26 |
DataModel/LocoFunctions.cpp | 3 +-- |
| 27 |
DataModel/LocoFunctions.h | 2 +- |
| 28 |
DataModel/MultipleUnit.cpp | 8 ++++---- |
| 29 |
DataModel/MultipleUnit.h | 2 +- |
| 30 |
DataModel/Object.cpp | 7 +++---- |
| 31 |
DataModel/Object.h | 4 ++-- |
| 32 |
DataModel/ObjectIdentifier.cpp | 23 +++++++++++------------ |
| 33 |
DataModel/ObjectIdentifier.h | 2 +- |
| 34 |
DataModel/Relation.cpp | 27 +++++++++++++-------------- |
| 35 |
DataModel/Relation.h | 2 +- |
| 36 |
DataModel/Route.cpp | 8 ++++---- |
| 37 |
DataModel/Route.h | 3 ++- |
| 38 |
DataModel/Serializable.h | 11 +++++------ |
| 39 |
DataModel/Signal.cpp | 21 ++------------------- |
| 40 |
DataModel/Signal.h | 18 ++++++++++++++---- |
| 41 |
DataModel/Switch.cpp | 5 ++--- |
| 42 |
DataModel/Switch.h | 4 ++-- |
| 43 |
DataModel/Text.cpp | 5 ++--- |
| 44 |
DataModel/Text.h | 2 +- |
| 45 |
DataModel/Track.cpp | 14 ++++++-------- |
| 46 |
DataModel/Track.h | 2 +- |
| 47 |
Manager.cpp | 1 + |
| 48 |
Server/Web/HtmlTagRoute.cpp | 4 +++- |
| 49 |
Server/Web/HtmlTagTrack.cpp | 4 ++-- |
| 50 |
Server/Web/WebClientRoute.cpp | 6 +++--- |
| 51 |
Server/Web/WebClientText.cpp | 8 ++++---- |
| 52 |
Server/Web/WebClientText.h | 1 - |
| 53 |
Server/Web/WebClientTrack.h | 2 -- |
| 54 |
Server/Web/WebServer.h | 4 ++-- |
| 55 |
Storage/StorageHandler.cpp | 28 ++++++++++++++++++---------- |
| 56 |
html/style.css | 6 ++++-- |
| 57 |
50 files changed, 162 insertions(+), 178 deletions(-) |
| 58 |
|
| 59 |
Index: railcontrol/DataModel/Accessory.cpp |
| 60 |
=================================================================== |
| 61 |
--- railcontrol.orig/DataModel/Accessory.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 62 |
+++ railcontrol/DataModel/Accessory.cpp 2025-11-24 15:27:11.429856087 +0100 |
| 63 |
@@ -39,14 +39,14 @@ |
| 64 |
return str; |
| 65 |
} |
| 66 |
|
| 67 |
- bool Accessory::Deserialize(const std::string& serialized) |
| 68 |
+ void Accessory::Deserialize(const std::string& serialized) |
| 69 |
{ |
| 70 |
map<string,string> arguments; |
| 71 |
ParseArguments(serialized, arguments); |
| 72 |
string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 73 |
if (objectType.compare("Accessory") != 0) |
| 74 |
{ |
| 75 |
- return false; |
| 76 |
+ return; |
| 77 |
} |
| 78 |
AccessoryBase::Deserialize(arguments); |
| 79 |
LayoutItem::Deserialize(arguments); |
| 80 |
@@ -55,7 +55,6 @@ |
| 81 |
SetWidth(Width1); |
| 82 |
SetHeight(Height1); |
| 83 |
SetVisible(VisibleYes); |
| 84 |
- return true; |
| 85 |
} |
| 86 |
|
| 87 |
Accessory& Accessory::operator=(const Hardware::AccessoryCacheEntry& accessory) |
| 88 |
Index: railcontrol/DataModel/Accessory.h |
| 89 |
=================================================================== |
| 90 |
--- railcontrol.orig/DataModel/Accessory.h 2025-11-24 15:27:11.438141379 +0100 |
| 91 |
+++ railcontrol/DataModel/Accessory.h 2025-11-24 15:27:11.429922531 +0100 |
| 92 |
@@ -63,20 +63,20 @@ |
| 93 |
{ |
| 94 |
} |
| 95 |
|
| 96 |
- virtual ObjectType GetObjectType() const override |
| 97 |
+ inline ObjectType GetObjectType() const override |
| 98 |
{ |
| 99 |
return ObjectTypeAccessory; |
| 100 |
} |
| 101 |
|
| 102 |
- virtual std::string GetLayoutType() const override |
| 103 |
+ inline std::string GetLayoutType() const override |
| 104 |
{ |
| 105 |
return Languages::GetText(Languages::TextAccessory); |
| 106 |
} |
| 107 |
|
| 108 |
- virtual std::string Serialize() const override; |
| 109 |
+ std::string Serialize() const override; |
| 110 |
|
| 111 |
using HardwareHandle::Deserialize; |
| 112 |
- virtual bool Deserialize(const std::string& serialized) override; |
| 113 |
+ void Deserialize(const std::string& serialized) override; |
| 114 |
|
| 115 |
Accessory& operator=(const Hardware::AccessoryCacheEntry& accessory); |
| 116 |
|
| 117 |
Index: railcontrol/DataModel/AccessoryBase.cpp |
| 118 |
=================================================================== |
| 119 |
--- railcontrol.orig/DataModel/AccessoryBase.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 120 |
+++ railcontrol/DataModel/AccessoryBase.cpp 2025-11-24 15:27:11.429973149 +0100 |
| 121 |
@@ -42,7 +42,7 @@ |
| 122 |
return str; |
| 123 |
} |
| 124 |
|
| 125 |
- bool AccessoryBase::Deserialize(const map<string,string>& arguments) |
| 126 |
+ void AccessoryBase::Deserialize(const map<string,string>& arguments) |
| 127 |
{ |
| 128 |
HardwareHandle::Deserialize(arguments); |
| 129 |
accessoryType = static_cast<AccessoryType>(Utils::Utils::GetIntegerMapEntry(arguments, "type")); |
| 130 |
@@ -52,7 +52,6 @@ |
| 131 |
lastUsed = Utils::Utils::GetIntegerMapEntry(arguments, "lastused", 0); |
| 132 |
counter = Utils::Utils::GetIntegerMapEntry(arguments, "counter", 0); |
| 133 |
matchKey = Utils::Utils::GetStringMapEntry(arguments, "matchkey"); |
| 134 |
- return true; |
| 135 |
} |
| 136 |
|
| 137 |
AccessoryState AccessoryBase::CalculateInvertedAccessoryState(const AccessoryState state) const |
| 138 |
Index: railcontrol/DataModel/AccessoryBase.h |
| 139 |
=================================================================== |
| 140 |
--- railcontrol.orig/DataModel/AccessoryBase.h 2025-11-24 15:27:11.438141379 +0100 |
| 141 |
+++ railcontrol/DataModel/AccessoryBase.h 2025-11-24 15:27:11.430063726 +0100 |
| 142 |
@@ -115,7 +115,7 @@ |
| 143 |
class AccessoryBase : public HardwareHandle |
| 144 |
{ |
| 145 |
public: |
| 146 |
- AccessoryBase() |
| 147 |
+ inline AccessoryBase() |
| 148 |
: HardwareHandle(), |
| 149 |
accessoryType(AccessoryTypeDefault), |
| 150 |
accessoryState(AccessoryStateOff), |
| 151 |
@@ -201,7 +201,7 @@ |
| 152 |
|
| 153 |
protected: |
| 154 |
virtual std::string Serialize() const; |
| 155 |
- virtual bool Deserialize(const std::map<std::string,std::string>& arguments); |
| 156 |
+ virtual void Deserialize(const std::map<std::string,std::string>& arguments); |
| 157 |
|
| 158 |
private: |
| 159 |
AccessoryType accessoryType; |
| 160 |
Index: railcontrol/DataModel/Cluster.cpp |
| 161 |
=================================================================== |
| 162 |
--- railcontrol.orig/DataModel/Cluster.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 163 |
+++ railcontrol/DataModel/Cluster.cpp 2025-11-24 15:27:11.430119357 +0100 |
| 164 |
@@ -19,12 +19,10 @@ |
| 165 |
*/ |
| 166 |
|
| 167 |
#include <map> |
| 168 |
-#include <string> |
| 169 |
|
| 170 |
#include "DataModel/Cluster.h" |
| 171 |
#include "DataModel/LockableItem.h" |
| 172 |
#include "DataModel/Relation.h" |
| 173 |
-#include "DataModel/Signal.h" |
| 174 |
#include "DataModel/Track.h" |
| 175 |
#include "Manager.h" |
| 176 |
#include "Utils/Utils.h" |
| 177 |
@@ -45,17 +43,17 @@ |
| 178 |
return str; |
| 179 |
} |
| 180 |
|
| 181 |
- bool Cluster::Deserialize(const string& serialized) |
| 182 |
+ void Cluster::Deserialize(const string& serialized) |
| 183 |
{ |
| 184 |
map<string,string> arguments; |
| 185 |
ParseArguments(serialized, arguments); |
| 186 |
- Object::Deserialize(arguments); |
| 187 |
- if (!arguments.count("objectType") || arguments.at("objectType").compare("Cluster") != 0) |
| 188 |
+ string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 189 |
+ if (objectType.compare("Cluster") != 0) |
| 190 |
{ |
| 191 |
- return false; |
| 192 |
+ return; |
| 193 |
} |
| 194 |
+ Object::Deserialize(arguments); |
| 195 |
orientation = static_cast<Orientation>(Utils::Utils::GetBoolMapEntry(arguments, "orientation", OrientationRight)); |
| 196 |
- return true; |
| 197 |
} |
| 198 |
|
| 199 |
bool Cluster::CanSetLocoBaseOrientationUnlocked(const Orientation orientation, const ObjectIdentifier& locoBaseIdentifier) |
| 200 |
Index: railcontrol/DataModel/Cluster.h |
| 201 |
=================================================================== |
| 202 |
--- railcontrol.orig/DataModel/Cluster.h 2025-11-24 15:27:11.438141379 +0100 |
| 203 |
+++ railcontrol/DataModel/Cluster.h 2025-11-24 15:27:11.430173426 +0100 |
| 204 |
@@ -32,19 +32,18 @@ |
| 205 |
namespace DataModel |
| 206 |
{ |
| 207 |
class Relation; |
| 208 |
- class Signal; |
| 209 |
class Track; |
| 210 |
|
| 211 |
class Cluster : public Object |
| 212 |
{ |
| 213 |
public: |
| 214 |
- Cluster(__attribute__((unused)) Manager* manager, const ClusterID clusterID) |
| 215 |
+ inline Cluster(__attribute__((unused)) Manager* manager, const ClusterID clusterID) |
| 216 |
: Object(clusterID), |
| 217 |
orientation(OrientationRight) |
| 218 |
{ |
| 219 |
} |
| 220 |
|
| 221 |
- Cluster(const std::string& serialized) |
| 222 |
+ inline Cluster(const std::string& serialized) |
| 223 |
: Object(ClusterNone), |
| 224 |
orientation(OrientationRight) |
| 225 |
{ |
| 226 |
@@ -62,7 +61,7 @@ |
| 227 |
} |
| 228 |
|
| 229 |
std::string Serialize() const override; |
| 230 |
- bool Deserialize(const std::string& serialized) override; |
| 231 |
+ void Deserialize(const std::string& serialized) override; |
| 232 |
|
| 233 |
inline bool CanSetLocoBaseOrientation(const Orientation orientation, |
| 234 |
const ObjectIdentifier& locoBaseIdentifier) |
| 235 |
Index: railcontrol/DataModel/Feedback.cpp |
| 236 |
=================================================================== |
| 237 |
--- railcontrol.orig/DataModel/Feedback.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 238 |
+++ railcontrol/DataModel/Feedback.cpp 2025-11-24 15:27:11.430226583 +0100 |
| 239 |
@@ -45,14 +45,14 @@ |
| 240 |
return str; |
| 241 |
} |
| 242 |
|
| 243 |
- bool Feedback::Deserialize(const string& serialized) |
| 244 |
+ void Feedback::Deserialize(const string& serialized) |
| 245 |
{ |
| 246 |
map<string, string> arguments; |
| 247 |
ParseArguments(serialized, arguments); |
| 248 |
string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 249 |
if (objectType.compare("Feedback") != 0) |
| 250 |
{ |
| 251 |
- return false; |
| 252 |
+ return; |
| 253 |
} |
| 254 |
LayoutItem::Deserialize(arguments); |
| 255 |
SetHeight(Height1); |
| 256 |
@@ -64,7 +64,6 @@ |
| 257 |
inverted = Utils::Utils::GetBoolMapEntry(arguments, "inverted", false); |
| 258 |
stateCounter = Utils::Utils::GetBoolMapEntry(arguments, "state", FeedbackStateFree) ? MaxStateCounter : 0; |
| 259 |
matchKey = Utils::Utils::GetStringMapEntry(arguments, "matchkey"); |
| 260 |
- return true; |
| 261 |
} |
| 262 |
|
| 263 |
void Feedback::SetState(const FeedbackState newState) |
| 264 |
Index: railcontrol/DataModel/Feedback.h |
| 265 |
=================================================================== |
| 266 |
--- railcontrol.orig/DataModel/Feedback.h 2025-11-24 15:27:11.438141379 +0100 |
| 267 |
+++ railcontrol/DataModel/Feedback.h 2025-11-24 15:27:11.430274683 +0100 |
| 268 |
@@ -79,7 +79,7 @@ |
| 269 |
|
| 270 |
std::string Serialize() const override; |
| 271 |
|
| 272 |
- bool Deserialize(const std::string& serialized) override; |
| 273 |
+ void Deserialize(const std::string& serialized) override; |
| 274 |
|
| 275 |
inline bool IsInUse() const |
| 276 |
{ |
| 277 |
Index: railcontrol/DataModel/HardwareHandle.cpp |
| 278 |
=================================================================== |
| 279 |
--- railcontrol.orig/DataModel/HardwareHandle.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 280 |
+++ railcontrol/DataModel/HardwareHandle.cpp 2025-11-24 15:27:11.430319385 +0100 |
| 281 |
@@ -36,12 +36,11 @@ |
| 282 |
return str; |
| 283 |
} |
| 284 |
|
| 285 |
- bool HardwareHandle::Deserialize(const map<string,string>& arguments) |
| 286 |
+ void HardwareHandle::Deserialize(const map<string,string>& arguments) |
| 287 |
{ |
| 288 |
controlID = Utils::Utils::GetIntegerMapEntry(arguments, "controlID", ControlIdNone); |
| 289 |
protocol = static_cast<Protocol>(Utils::Utils::GetIntegerMapEntry(arguments, "protocol", ProtocolNone)); |
| 290 |
address = Utils::Utils::GetIntegerMapEntry(arguments, "address"); |
| 291 |
serverAddress = static_cast<Address>(Utils::Utils::GetIntegerMapEntry(arguments, "serveraddress", AddressNone)); |
| 292 |
- return true; |
| 293 |
} |
| 294 |
} // namespace DataModel |
| 295 |
Index: railcontrol/DataModel/HardwareHandle.h |
| 296 |
=================================================================== |
| 297 |
--- railcontrol.orig/DataModel/HardwareHandle.h 2025-11-24 15:27:11.438141379 +0100 |
| 298 |
+++ railcontrol/DataModel/HardwareHandle.h 2025-11-24 15:27:11.430364845 +0100 |
| 299 |
@@ -101,7 +101,7 @@ |
| 300 |
|
| 301 |
protected: |
| 302 |
virtual std::string Serialize() const; |
| 303 |
- virtual bool Deserialize(const std::map<std::string,std::string>& arguments); |
| 304 |
+ virtual void Deserialize(const std::map<std::string,std::string>& arguments); |
| 305 |
|
| 306 |
private: |
| 307 |
ControlID controlID; |
| 308 |
Index: railcontrol/DataModel/Layer.h |
| 309 |
=================================================================== |
| 310 |
--- railcontrol.orig/DataModel/Layer.h 2025-11-24 15:27:11.438141379 +0100 |
| 311 |
+++ railcontrol/DataModel/Layer.h 2025-11-24 15:27:11.430411723 +0100 |
| 312 |
@@ -33,23 +33,23 @@ |
| 313 |
class Layer : public Object |
| 314 |
{ |
| 315 |
public: |
| 316 |
- Layer(const std::string& serialized) |
| 317 |
+ inline Layer(const std::string& serialized) |
| 318 |
: Object() |
| 319 |
{ |
| 320 |
Object::Deserialize(serialized); |
| 321 |
} |
| 322 |
|
| 323 |
- Layer(__attribute__((unused)) Manager* manager, const LayerID layerID) |
| 324 |
+ inline Layer(__attribute__((unused)) Manager* manager, const LayerID layerID) |
| 325 |
: Object(layerID) |
| 326 |
{ |
| 327 |
} |
| 328 |
|
| 329 |
- virtual std::string Serialize() const |
| 330 |
+ inline std::string Serialize() const override |
| 331 |
{ |
| 332 |
return "objectType=Layer;" + Object::Serialize(); |
| 333 |
} |
| 334 |
|
| 335 |
- ObjectType GetObjectType() const |
| 336 |
+ inline ObjectType GetObjectType() const override |
| 337 |
{ |
| 338 |
return ObjectTypeLayer; |
| 339 |
} |
| 340 |
Index: railcontrol/DataModel/LayoutItem.cpp |
| 341 |
=================================================================== |
| 342 |
--- railcontrol.orig/DataModel/LayoutItem.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 343 |
+++ railcontrol/DataModel/LayoutItem.cpp 2025-11-24 15:27:11.430490433 +0100 |
| 344 |
@@ -111,14 +111,14 @@ |
| 345 |
return ss.str(); |
| 346 |
} |
| 347 |
|
| 348 |
- bool LayoutItem::Deserialize(const std::string& serialized) |
| 349 |
+ void LayoutItem::Deserialize(const std::string& serialized) |
| 350 |
{ |
| 351 |
map<string,string> arguments; |
| 352 |
ParseArguments(serialized, arguments); |
| 353 |
- return Deserialize(arguments); |
| 354 |
+ Deserialize(arguments); |
| 355 |
} |
| 356 |
|
| 357 |
- bool LayoutItem::Deserialize(const map<string,string>& arguments) |
| 358 |
+ void LayoutItem::Deserialize(const map<string,string>& arguments) |
| 359 |
{ |
| 360 |
Object::Deserialize(arguments); |
| 361 |
visible = static_cast<Visible>(Utils::Utils::GetIntegerMapEntry(arguments, "visible")); |
| 362 |
@@ -136,7 +136,6 @@ |
| 363 |
{ |
| 364 |
rotation = Rotation0; |
| 365 |
} |
| 366 |
- return true; |
| 367 |
} |
| 368 |
|
| 369 |
std::string LayoutItem::Rotation(LayoutRotation rotation) |
| 370 |
Index: railcontrol/DataModel/LayoutItem.h |
| 371 |
=================================================================== |
| 372 |
--- railcontrol.orig/DataModel/LayoutItem.h 2025-11-24 15:27:11.438141379 +0100 |
| 373 |
+++ railcontrol/DataModel/LayoutItem.h 2025-11-24 15:27:11.430568160 +0100 |
| 374 |
@@ -60,7 +60,7 @@ |
| 375 |
|
| 376 |
inline LayoutRotation& operator=(const int rotation) |
| 377 |
{ |
| 378 |
- this->rotation = (rotation > RotationNotRelevant || rotation < Rotation0) ? Rotation0 : static_cast<LayoutRotationEnum>(rotation); |
| 379 |
+ this->rotation = static_cast<LayoutRotationEnum>(rotation & 0x03); |
| 380 |
return *this; |
| 381 |
} |
| 382 |
|
| 383 |
@@ -148,7 +148,7 @@ |
| 384 |
|
| 385 |
virtual bool CheckPositionFree(const LayoutPosition posX, const LayoutPosition posY, const LayoutPosition posZ); |
| 386 |
virtual std::string Serialize() const override; |
| 387 |
- virtual bool Deserialize(const std::string& serialized) override; |
| 388 |
+ virtual void Deserialize(const std::string& serialized) override; |
| 389 |
virtual std::string GetLayoutType() const = 0; |
| 390 |
|
| 391 |
inline void SetVisible(const Visible visible) |
| 392 |
@@ -195,12 +195,12 @@ |
| 393 |
const LayoutPosition y, |
| 394 |
const LayoutPosition z) const |
| 395 |
{ |
| 396 |
- return posX == x && posY == y && posZ == z; |
| 397 |
+ return (posX == x) && (posY == y) && (posZ == z); |
| 398 |
} |
| 399 |
|
| 400 |
inline bool IsVisibleOnLayer(const LayoutPosition z) const |
| 401 |
{ |
| 402 |
- return posZ == z && visible == VisibleYes; |
| 403 |
+ return (posZ == z) && (visible == VisibleYes); |
| 404 |
} |
| 405 |
|
| 406 |
inline void SetWidth(const LayoutItemSize width) |
| 407 |
@@ -246,7 +246,7 @@ |
| 408 |
static std::string Rotation(LayoutRotation rotation); |
| 409 |
|
| 410 |
protected: |
| 411 |
- virtual bool Deserialize(const std::map<std::string,std::string>& arguments) override; |
| 412 |
+ virtual void Deserialize(const std::map<std::string,std::string>& arguments) override; |
| 413 |
|
| 414 |
private: |
| 415 |
Visible visible; |
| 416 |
Index: railcontrol/DataModel/LockableItem.cpp |
| 417 |
=================================================================== |
| 418 |
--- railcontrol.orig/DataModel/LockableItem.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 419 |
+++ railcontrol/DataModel/LockableItem.cpp 2025-11-24 15:27:11.430643463 +0100 |
| 420 |
@@ -35,14 +35,13 @@ |
| 421 |
+ ";locobasetype=" + std::to_string(locoBaseIdentifier.GetObjectType()); |
| 422 |
} |
| 423 |
|
| 424 |
- bool LockableItem::Deserialize(const map<string, string> arguments) |
| 425 |
+ void LockableItem::Deserialize(const map<string, string> arguments) |
| 426 |
{ |
| 427 |
const LocoID locoID = Utils::Utils::GetIntegerMapEntry(arguments, "locoID", LocoNone); // FIXME: Remove later: 2024-02-08 |
| 428 |
locoBaseIdentifier.SetObjectID(Utils::Utils::GetIntegerMapEntry(arguments, "locobaseid", locoID)); |
| 429 |
locoBaseIdentifier.SetObjectType(static_cast<ObjectType>(Utils::Utils::GetIntegerMapEntry(arguments, "locobasetype", ObjectTypeLoco))); |
| 430 |
lockState = static_cast<LockState>(Utils::Utils::GetIntegerMapEntry(arguments, "lockState", LockStateFree)); // FIXME: Remove later: 2024-02-08 |
| 431 |
lockState = static_cast<LockState>(Utils::Utils::GetIntegerMapEntry(arguments, "lockstate", lockState)); |
| 432 |
- return true; |
| 433 |
} |
| 434 |
|
| 435 |
bool LockableItem::Reserve(Logger::Logger* logger, const ObjectIdentifier& locoBaseIdentifier) |
| 436 |
Index: railcontrol/DataModel/LockableItem.h |
| 437 |
=================================================================== |
| 438 |
--- railcontrol.orig/DataModel/LockableItem.h 2025-11-24 15:27:11.438141379 +0100 |
| 439 |
+++ railcontrol/DataModel/LockableItem.h 2025-11-24 15:27:11.430691717 +0100 |
| 440 |
@@ -48,8 +48,7 @@ |
| 441 |
virtual ~LockableItem() {}; |
| 442 |
|
| 443 |
std::string Serialize() const; |
| 444 |
- bool Deserialize(const std::map<std::string,std::string> arguments); |
| 445 |
- |
| 446 |
+ void Deserialize(const std::map<std::string,std::string> arguments); |
| 447 |
|
| 448 |
inline const ObjectIdentifier& GetLocoBase() const |
| 449 |
{ |
| 450 |
Index: railcontrol/DataModel/Loco.cpp |
| 451 |
=================================================================== |
| 452 |
--- railcontrol.orig/DataModel/Loco.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 453 |
+++ railcontrol/DataModel/Loco.cpp 2025-11-24 15:27:11.430737424 +0100 |
| 454 |
@@ -41,16 +41,16 @@ |
| 455 |
return str; |
| 456 |
} |
| 457 |
|
| 458 |
- bool Loco::Deserialize(const std::string& serialized) |
| 459 |
+ void Loco::Deserialize(const std::string& serialized) |
| 460 |
{ |
| 461 |
map<string,string> arguments; |
| 462 |
ParseArguments(serialized, arguments); |
| 463 |
- if (!arguments.count("objectType") || arguments.at("objectType").compare("Loco") != 0) |
| 464 |
+ string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 465 |
+ if (objectType.compare("Loco") != 0) |
| 466 |
{ |
| 467 |
- return false; |
| 468 |
+ return; |
| 469 |
} |
| 470 |
LocoBase::Deserialize(arguments); |
| 471 |
- return true; |
| 472 |
} |
| 473 |
|
| 474 |
Loco& Loco::operator=(const Hardware::LocoCacheEntry& loco) |
| 475 |
Index: railcontrol/DataModel/Loco.h |
| 476 |
=================================================================== |
| 477 |
--- railcontrol.orig/DataModel/Loco.h 2025-11-24 15:27:11.438141379 +0100 |
| 478 |
+++ railcontrol/DataModel/Loco.h 2025-11-24 15:27:11.430783654 +0100 |
| 479 |
@@ -62,7 +62,7 @@ |
| 480 |
|
| 481 |
std::string Serialize() const override; |
| 482 |
|
| 483 |
- bool Deserialize(const std::string& serialized) override; |
| 484 |
+ void Deserialize(const std::string& serialized) override; |
| 485 |
|
| 486 |
Loco& operator=(const Hardware::LocoCacheEntry& loco); |
| 487 |
}; |
| 488 |
Index: railcontrol/DataModel/LocoBase.cpp |
| 489 |
=================================================================== |
| 490 |
--- railcontrol.orig/DataModel/LocoBase.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 491 |
+++ railcontrol/DataModel/LocoBase.cpp 2025-11-24 15:27:11.430864197 +0100 |
| 492 |
@@ -71,14 +71,14 @@ |
| 493 |
return str; |
| 494 |
} |
| 495 |
|
| 496 |
- bool LocoBase::Deserialize(const std::string& serialized) |
| 497 |
+ void LocoBase::Deserialize(const std::string& serialized) |
| 498 |
{ |
| 499 |
map<string, string> arguments; |
| 500 |
ParseArguments(serialized, arguments); |
| 501 |
- return LocoBase::Deserialize(arguments); |
| 502 |
+ LocoBase::Deserialize(arguments); |
| 503 |
} |
| 504 |
|
| 505 |
- bool LocoBase::Deserialize(const std::map<std::string,std::string>& arguments) |
| 506 |
+ void LocoBase::Deserialize(const std::map<std::string,std::string>& arguments) |
| 507 |
{ |
| 508 |
Object::Deserialize(arguments); |
| 509 |
HardwareHandle::Deserialize(arguments); |
| 510 |
@@ -95,7 +95,6 @@ |
| 511 |
propulsion = static_cast<Propulsion>(Utils::Utils::GetIntegerMapEntry(arguments, "propulsion", PropulsionUnknown)); |
| 512 |
trainType = static_cast<TrainType>(Utils::Utils::GetIntegerMapEntry(arguments, "type", TrainTypeUnknown)); |
| 513 |
matchKey = Utils::Utils::GetStringMapEntry(arguments, "matchkey"); |
| 514 |
- return true; |
| 515 |
} |
| 516 |
|
| 517 |
bool LocoBase::SetTrack(const TrackID trackID) |
| 518 |
Index: railcontrol/DataModel/LocoBase.h |
| 519 |
=================================================================== |
| 520 |
--- railcontrol.orig/DataModel/LocoBase.h 2025-11-24 15:27:11.438141379 +0100 |
| 521 |
+++ railcontrol/DataModel/LocoBase.h 2025-11-24 15:27:11.430946435 +0100 |
| 522 |
@@ -118,9 +118,9 @@ |
| 523 |
|
| 524 |
std::string Serialize() const override; |
| 525 |
|
| 526 |
- bool Deserialize(const std::string& serialized) override; |
| 527 |
+ void Deserialize(const std::string& serialized) override; |
| 528 |
|
| 529 |
- bool Deserialize(const std::map<std::string,std::string>& arguments) override; |
| 530 |
+ void Deserialize(const std::map<std::string,std::string>& arguments) override; |
| 531 |
|
| 532 |
virtual void SetName(const std::string& name) override |
| 533 |
{ |
| 534 |
Index: railcontrol/DataModel/LocoFunctions.cpp |
| 535 |
=================================================================== |
| 536 |
--- railcontrol.orig/DataModel/LocoFunctions.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 537 |
+++ railcontrol/DataModel/LocoFunctions.cpp 2025-11-24 15:27:11.431085177 +0100 |
| 538 |
@@ -103,7 +103,7 @@ |
| 539 |
return out; |
| 540 |
} |
| 541 |
|
| 542 |
- bool LocoFunctions::Deserialize(const std::string& serialized) |
| 543 |
+ void LocoFunctions::Deserialize(const std::string& serialized) |
| 544 |
{ |
| 545 |
std::deque<std::string> functionsSerialized; |
| 546 |
Utils::Utils::SplitString(serialized, "f", functionsSerialized); |
| 547 |
@@ -136,7 +136,6 @@ |
| 548 |
entries[nr].timer = static_cast<LocoFunctionTimer>(Utils::Integer::StringToInteger(functionTexts.front(), 0)); |
| 549 |
functionTexts.pop_front(); |
| 550 |
} |
| 551 |
- return true; |
| 552 |
} |
| 553 |
|
| 554 |
std::string LocoFunctions::GetLocoFunctionIcon(const LocoFunctionNr nr, const LocoFunctionIcon icon) |
| 555 |
Index: railcontrol/DataModel/LocoFunctions.h |
| 556 |
=================================================================== |
| 557 |
--- railcontrol.orig/DataModel/LocoFunctions.h 2025-11-24 15:27:11.438141379 +0100 |
| 558 |
+++ railcontrol/DataModel/LocoFunctions.h 2025-11-24 15:27:11.431210806 +0100 |
| 559 |
@@ -261,7 +261,7 @@ |
| 560 |
|
| 561 |
std::string Serialize() const override; |
| 562 |
|
| 563 |
- bool Deserialize(const std::string& serialized) override; |
| 564 |
+ void Deserialize(const std::string& serialized) override; |
| 565 |
|
| 566 |
inline LocoFunctionIcon GetFunctionIcon(const LocoFunctionNr nr) const |
| 567 |
{ |
| 568 |
Index: railcontrol/DataModel/MultipleUnit.cpp |
| 569 |
=================================================================== |
| 570 |
--- railcontrol.orig/DataModel/MultipleUnit.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 571 |
+++ railcontrol/DataModel/MultipleUnit.cpp 2025-11-24 15:27:11.431264994 +0100 |
| 572 |
@@ -36,16 +36,16 @@ |
| 573 |
return str; |
| 574 |
} |
| 575 |
|
| 576 |
- bool MultipleUnit::Deserialize(const std::string& serialized) |
| 577 |
+ void MultipleUnit::Deserialize(const std::string& serialized) |
| 578 |
{ |
| 579 |
map<string,string> arguments; |
| 580 |
ParseArguments(serialized, arguments); |
| 581 |
- if (!arguments.count("objectType") || arguments.at("objectType").compare("MultipleUnit") != 0) |
| 582 |
+ string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 583 |
+ if (objectType.compare("MultipleUnit") != 0) |
| 584 |
{ |
| 585 |
- return false; |
| 586 |
+ return; |
| 587 |
} |
| 588 |
LocoBase::Deserialize(arguments); |
| 589 |
- return true; |
| 590 |
} |
| 591 |
|
| 592 |
void MultipleUnit::CalculatePropulsion() |
| 593 |
Index: railcontrol/DataModel/MultipleUnit.h |
| 594 |
=================================================================== |
| 595 |
--- railcontrol.orig/DataModel/MultipleUnit.h 2025-11-24 15:27:11.438141379 +0100 |
| 596 |
+++ railcontrol/DataModel/MultipleUnit.h 2025-11-24 15:27:11.431310274 +0100 |
| 597 |
@@ -58,7 +58,7 @@ |
| 598 |
|
| 599 |
std::string Serialize() const override; |
| 600 |
|
| 601 |
- bool Deserialize(const std::string& serialized) override; |
| 602 |
+ void Deserialize(const std::string& serialized) override; |
| 603 |
|
| 604 |
void CalculatePropulsion(); |
| 605 |
|
| 606 |
Index: railcontrol/DataModel/Object.cpp |
| 607 |
=================================================================== |
| 608 |
--- railcontrol.orig/DataModel/Object.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 609 |
+++ railcontrol/DataModel/Object.cpp 2025-11-24 15:27:11.431383120 +0100 |
| 610 |
@@ -35,18 +35,17 @@ |
| 611 |
return "objectID=" + std::to_string(objectID) + ";name=" + Utils::Utils::UrlEncode(name); |
| 612 |
} |
| 613 |
|
| 614 |
- bool Object::Deserialize(const std::string& serialized) |
| 615 |
+ void Object::Deserialize(const std::string& serialized) |
| 616 |
{ |
| 617 |
map<string, string> arguments; |
| 618 |
ParseArguments(serialized, arguments); |
| 619 |
- return Object::Deserialize(arguments); |
| 620 |
+ Object::Deserialize(arguments); |
| 621 |
} |
| 622 |
|
| 623 |
- bool Object::Deserialize(const map<string, string>& arguments) |
| 624 |
+ void Object::Deserialize(const map<string, string>& arguments) |
| 625 |
{ |
| 626 |
objectID = Utils::Utils::GetIntegerMapEntry(arguments, "objectID", ObjectNone); |
| 627 |
name = Utils::Utils::UrlDecode(Utils::Utils::GetStringMapEntry(arguments, "name")); |
| 628 |
- return true; |
| 629 |
} |
| 630 |
|
| 631 |
} // namespace DataModel |
| 632 |
Index: railcontrol/DataModel/Object.h |
| 633 |
=================================================================== |
| 634 |
--- railcontrol.orig/DataModel/Object.h 2025-11-24 15:27:11.438141379 +0100 |
| 635 |
+++ railcontrol/DataModel/Object.h 2025-11-24 15:27:11.431438980 +0100 |
| 636 |
@@ -55,7 +55,7 @@ |
| 637 |
|
| 638 |
virtual std::string Serialize() const override; |
| 639 |
|
| 640 |
- virtual bool Deserialize(const std::string& serialized) override; |
| 641 |
+ virtual void Deserialize(const std::string& serialized) override; |
| 642 |
|
| 643 |
inline ObjectID GetID() const |
| 644 |
{ |
| 645 |
@@ -78,7 +78,7 @@ |
| 646 |
} |
| 647 |
|
| 648 |
protected: |
| 649 |
- virtual bool Deserialize(const std::map<std::string,std::string>& arguments); |
| 650 |
+ virtual void Deserialize(const std::map<std::string,std::string>& arguments); |
| 651 |
|
| 652 |
private: |
| 653 |
ObjectID objectID; |
| 654 |
Index: railcontrol/DataModel/ObjectIdentifier.cpp |
| 655 |
=================================================================== |
| 656 |
--- railcontrol.orig/DataModel/ObjectIdentifier.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 657 |
+++ railcontrol/DataModel/ObjectIdentifier.cpp 2025-11-24 15:27:11.431512923 +0100 |
| 658 |
@@ -24,80 +24,79 @@ |
| 659 |
|
| 660 |
namespace DataModel |
| 661 |
{ |
| 662 |
- bool ObjectIdentifier::Deserialize(const std::map<std::string, std::string>& arguments) |
| 663 |
+ void ObjectIdentifier::Deserialize(const std::map<std::string, std::string>& arguments) |
| 664 |
{ |
| 665 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "track", ObjectNone)); |
| 666 |
if (objectID != ObjectNone) |
| 667 |
{ |
| 668 |
objectType = ObjectTypeTrack; |
| 669 |
- return true; |
| 670 |
+ return; |
| 671 |
} |
| 672 |
|
| 673 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "signal", ObjectNone)); |
| 674 |
if (objectID != ObjectNone) |
| 675 |
{ |
| 676 |
objectType = ObjectTypeSignal; |
| 677 |
- return true; |
| 678 |
+ return; |
| 679 |
} |
| 680 |
|
| 681 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "switch", ObjectNone)); |
| 682 |
if (objectID != ObjectNone) |
| 683 |
{ |
| 684 |
objectType = ObjectTypeSwitch; |
| 685 |
- return true; |
| 686 |
+ return; |
| 687 |
} |
| 688 |
|
| 689 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "accessory", ObjectNone)); |
| 690 |
if (objectID != ObjectNone) |
| 691 |
{ |
| 692 |
objectType = ObjectTypeAccessory; |
| 693 |
- return true; |
| 694 |
+ return; |
| 695 |
} |
| 696 |
|
| 697 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "feedback", ObjectNone)); |
| 698 |
if (objectID != ObjectNone) |
| 699 |
{ |
| 700 |
objectType = ObjectTypeFeedback; |
| 701 |
- return true; |
| 702 |
+ return; |
| 703 |
} |
| 704 |
|
| 705 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "route", ObjectNone)); |
| 706 |
if (objectID != ObjectNone) |
| 707 |
{ |
| 708 |
objectType = ObjectTypeRoute; |
| 709 |
- return true; |
| 710 |
+ return; |
| 711 |
} |
| 712 |
|
| 713 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "text", ObjectNone)); |
| 714 |
if (objectID != ObjectNone) |
| 715 |
{ |
| 716 |
objectType = ObjectTypeText; |
| 717 |
- return true; |
| 718 |
+ return; |
| 719 |
} |
| 720 |
|
| 721 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "pause", ObjectNone)); |
| 722 |
if (objectID != ObjectNone) |
| 723 |
{ |
| 724 |
objectType = ObjectTypePause; |
| 725 |
- return true; |
| 726 |
+ return; |
| 727 |
} |
| 728 |
|
| 729 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "multipleunit", ObjectNone)); |
| 730 |
if (objectID != ObjectNone) |
| 731 |
{ |
| 732 |
objectType = ObjectTypeMultipleUnit; |
| 733 |
- return true; |
| 734 |
+ return; |
| 735 |
} |
| 736 |
|
| 737 |
objectID = static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "booster", ObjectNone)); |
| 738 |
if (objectID != ObjectNone) |
| 739 |
{ |
| 740 |
objectType = ObjectTypeBooster; |
| 741 |
- return true; |
| 742 |
+ return; |
| 743 |
} |
| 744 |
|
| 745 |
objectType = ObjectTypeNone; |
| 746 |
- return false; |
| 747 |
} |
| 748 |
|
| 749 |
ObjectIdentifier& ObjectIdentifier::operator=(const std::string& text) |
| 750 |
Index: railcontrol/DataModel/ObjectIdentifier.h |
| 751 |
=================================================================== |
| 752 |
--- railcontrol.orig/DataModel/ObjectIdentifier.h 2025-11-24 15:27:11.438141379 +0100 |
| 753 |
+++ railcontrol/DataModel/ObjectIdentifier.h 2025-11-24 15:27:11.431577054 +0100 |
| 754 |
@@ -59,7 +59,7 @@ |
| 755 |
return GetObjectTypeAsString() + "=" + GetObjectIdAsString(); |
| 756 |
} |
| 757 |
|
| 758 |
- bool Deserialize(const std::map<std::string,std::string>& arguments); |
| 759 |
+ void Deserialize(const std::map<std::string,std::string>& arguments); |
| 760 |
|
| 761 |
inline ObjectIdentifier& operator=(const ObjectIdentifier& other) = default; |
| 762 |
|
| 763 |
Index: railcontrol/DataModel/Relation.cpp |
| 764 |
=================================================================== |
| 765 |
--- railcontrol.orig/DataModel/Relation.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 766 |
+++ railcontrol/DataModel/Relation.cpp 2025-11-24 15:27:11.431644476 +0100 |
| 767 |
@@ -46,7 +46,7 @@ |
| 768 |
return ss.str(); |
| 769 |
} |
| 770 |
|
| 771 |
- bool Relation::Deserialize(const std::string& serialized) |
| 772 |
+ void Relation::Deserialize(const std::string& serialized) |
| 773 |
{ |
| 774 |
map<string,string> arguments; |
| 775 |
ParseArguments(serialized, arguments); |
| 776 |
@@ -58,7 +58,6 @@ |
| 777 |
object2.SetObjectID(static_cast<ObjectID>(Utils::Utils::GetIntegerMapEntry(arguments, "objectID2"))); |
| 778 |
priority = Utils::Utils::GetIntegerMapEntry(arguments, "priority"); |
| 779 |
data = Utils::Utils::GetIntegerMapEntry(arguments, "data"); |
| 780 |
- return true; |
| 781 |
} |
| 782 |
|
| 783 |
bool Relation::Execute(Logger::Logger* logger, const ObjectIdentifier& locoBaseIdentifier, const Delay delay) |
| 784 |
@@ -68,7 +67,7 @@ |
| 785 |
case ObjectTypeAccessory: |
| 786 |
{ |
| 787 |
bool ret = manager->AccessoryState(ControlTypeInternal, ObjectID2(), static_cast<AccessoryState>(data), true); |
| 788 |
- if (ret == false) |
| 789 |
+ if (!ret) |
| 790 |
{ |
| 791 |
return false; |
| 792 |
} |
| 793 |
@@ -78,7 +77,7 @@ |
| 794 |
case ObjectTypeSwitch: |
| 795 |
{ |
| 796 |
bool ret = manager->SwitchState(ControlTypeInternal, ObjectID2(), static_cast<AccessoryState>(data), true); |
| 797 |
- if (ret == false) |
| 798 |
+ if (!ret) |
| 799 |
{ |
| 800 |
return false; |
| 801 |
} |
| 802 |
@@ -88,7 +87,7 @@ |
| 803 |
case ObjectTypeSignal: |
| 804 |
{ |
| 805 |
bool ret = manager->SignalState(ControlTypeInternal, ObjectID2(), static_cast<AccessoryState>(data), true); |
| 806 |
- if (ret == false) |
| 807 |
+ if (!ret) |
| 808 |
{ |
| 809 |
return false; |
| 810 |
} |
| 811 |
@@ -164,7 +163,7 @@ |
| 812 |
bool Relation::Reserve(Logger::Logger* logger, const ObjectIdentifier& locoBaseIdentifier) |
| 813 |
{ |
| 814 |
bool ret = LockableItem::Reserve(logger, locoBaseIdentifier); |
| 815 |
- if (ret == false) |
| 816 |
+ if (!ret) |
| 817 |
{ |
| 818 |
logger->Debug(Languages::TextUnableToReserve); |
| 819 |
return false; |
| 820 |
@@ -180,7 +179,7 @@ |
| 821 |
} |
| 822 |
|
| 823 |
LockableItem* lockable = GetObject2(); |
| 824 |
- if (lockable == nullptr) |
| 825 |
+ if (!lockable) |
| 826 |
{ |
| 827 |
logger->Debug(Languages::TextRelationTargetNotFound); |
| 828 |
LockableItem::Release(logger, locoBaseIdentifier); |
| 829 |
@@ -188,7 +187,7 @@ |
| 830 |
} |
| 831 |
|
| 832 |
Route* route = dynamic_cast<Route*>(lockable); |
| 833 |
- if (route != nullptr) |
| 834 |
+ if (route) |
| 835 |
{ |
| 836 |
return route->Reserve(logger, locoBaseIdentifier); |
| 837 |
} |
| 838 |
@@ -199,7 +198,7 @@ |
| 839 |
bool Relation::Lock(Logger::Logger* logger, const ObjectIdentifier& locoBaseIdentifier) |
| 840 |
{ |
| 841 |
bool ret = LockableItem::Lock(logger, locoBaseIdentifier); |
| 842 |
- if (ret == false) |
| 843 |
+ if (!ret) |
| 844 |
{ |
| 845 |
return false; |
| 846 |
} |
| 847 |
@@ -214,26 +213,26 @@ |
| 848 |
} |
| 849 |
|
| 850 |
LockableItem* lockable = GetObject2(); |
| 851 |
- if (lockable == nullptr) |
| 852 |
+ if (!lockable) |
| 853 |
{ |
| 854 |
LockableItem::Release(logger, locoBaseIdentifier); |
| 855 |
return false; |
| 856 |
} |
| 857 |
|
| 858 |
Route* route = dynamic_cast<Route*>(lockable); |
| 859 |
- if (route != nullptr) |
| 860 |
+ if (route) |
| 861 |
{ |
| 862 |
return route->Lock(logger, locoBaseIdentifier); |
| 863 |
} |
| 864 |
|
| 865 |
bool retLockable = lockable->Lock(logger, locoBaseIdentifier); |
| 866 |
- if (retLockable == true) |
| 867 |
+ if (retLockable) |
| 868 |
{ |
| 869 |
return true; |
| 870 |
} |
| 871 |
|
| 872 |
Object* object = dynamic_cast<Object*>(lockable); |
| 873 |
- if (object == nullptr) |
| 874 |
+ if (!object) |
| 875 |
{ |
| 876 |
return false; |
| 877 |
} |
| 878 |
@@ -245,7 +244,7 @@ |
| 879 |
bool Relation::Release(Logger::Logger* logger, const ObjectIdentifier& locoBaseIdentifier) |
| 880 |
{ |
| 881 |
LockableItem* object = GetObject2(); |
| 882 |
- if (object != nullptr) |
| 883 |
+ if (object) |
| 884 |
{ |
| 885 |
object->Release(logger, locoBaseIdentifier); |
| 886 |
} |
| 887 |
Index: railcontrol/DataModel/Relation.h |
| 888 |
=================================================================== |
| 889 |
--- railcontrol.orig/DataModel/Relation.h 2025-11-24 15:27:11.438141379 +0100 |
| 890 |
+++ railcontrol/DataModel/Relation.h 2025-11-24 15:27:11.431722430 +0100 |
| 891 |
@@ -82,7 +82,7 @@ |
| 892 |
} |
| 893 |
|
| 894 |
virtual std::string Serialize() const override; |
| 895 |
- virtual bool Deserialize(const std::string& serialized) override; |
| 896 |
+ virtual void Deserialize(const std::string& serialized) override; |
| 897 |
|
| 898 |
inline ObjectID ObjectID1() const |
| 899 |
{ |
| 900 |
Index: railcontrol/DataModel/Route.cpp |
| 901 |
=================================================================== |
| 902 |
--- railcontrol.orig/DataModel/Route.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 903 |
+++ railcontrol/DataModel/Route.cpp 2025-11-24 15:27:11.431787992 +0100 |
| 904 |
@@ -84,17 +84,18 @@ |
| 905 |
return str; |
| 906 |
} |
| 907 |
|
| 908 |
- bool Route::Deserialize(const std::string& serialized) |
| 909 |
+ void Route::Deserialize(const std::string& serialized) |
| 910 |
{ |
| 911 |
map<string,string> arguments; |
| 912 |
ParseArguments(serialized, arguments); |
| 913 |
string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 914 |
if (objectType.compare("Route") != 0) |
| 915 |
{ |
| 916 |
- return false; |
| 917 |
+ return; |
| 918 |
} |
| 919 |
|
| 920 |
LayoutItem::Deserialize(arguments); |
| 921 |
+ SetRotation(LayoutItem::Rotation0); |
| 922 |
LockableItem::Deserialize(arguments); |
| 923 |
|
| 924 |
delay = static_cast<Delay>(Utils::Utils::GetIntegerMapEntry(arguments, "delay", DefaultDelay)); |
| 925 |
@@ -122,7 +123,7 @@ |
| 926 |
maxTrainLength = 0; |
| 927 |
waitAfterRelease = 0; |
| 928 |
followUpRoute = RouteNone; |
| 929 |
- return true; |
| 930 |
+ return; |
| 931 |
} |
| 932 |
fromTrack = static_cast<Length>(Utils::Utils::GetIntegerMapEntry(arguments, "fromTrack", TrackNone)); |
| 933 |
fromOrientation = static_cast<Orientation>(Utils::Utils::GetBoolMapEntry(arguments, "fromorientation", OrientationRight)); |
| 934 |
@@ -143,7 +144,6 @@ |
| 935 |
maxTrainLength = static_cast<Length>(Utils::Utils::GetIntegerMapEntry(arguments, "maxtrainlength", 0)); |
| 936 |
waitAfterRelease = Utils::Utils::GetIntegerMapEntry(arguments, "waitafterrelease", 0); |
| 937 |
followUpRoute = Utils::Utils::GetIntegerMapEntry(arguments, "followuproute", RouteNone); |
| 938 |
- return true; |
| 939 |
} |
| 940 |
|
| 941 |
void Route::DeleteRelations(std::vector<DataModel::Relation*>& relations) |
| 942 |
Index: railcontrol/DataModel/Route.h |
| 943 |
=================================================================== |
| 944 |
--- railcontrol.orig/DataModel/Route.h 2025-11-24 15:27:11.438141379 +0100 |
| 945 |
+++ railcontrol/DataModel/Route.h 2025-11-24 15:27:11.431862272 +0100 |
| 946 |
@@ -87,6 +87,7 @@ |
| 947 |
lastUsed(0), |
| 948 |
counter(0) |
| 949 |
{ |
| 950 |
+ SetRotation(LayoutItem::Rotation0); |
| 951 |
} |
| 952 |
|
| 953 |
Route(Manager* manager, const std::string& serialized); |
| 954 |
@@ -103,7 +104,7 @@ |
| 955 |
} |
| 956 |
|
| 957 |
std::string Serialize() const override; |
| 958 |
- bool Deserialize(const std::string& serialized) override; |
| 959 |
+ void Deserialize(const std::string& serialized) override; |
| 960 |
|
| 961 |
inline std::string GetLayoutType() const override |
| 962 |
{ |
| 963 |
Index: railcontrol/DataModel/Serializable.h |
| 964 |
=================================================================== |
| 965 |
--- railcontrol.orig/DataModel/Serializable.h 2025-11-24 15:27:11.438141379 +0100 |
| 966 |
+++ railcontrol/DataModel/Serializable.h 2025-11-24 15:27:11.431926442 +0100 |
| 967 |
@@ -23,17 +23,16 @@ |
| 968 |
#include <map> |
| 969 |
#include <string> |
| 970 |
|
| 971 |
-namespace DataModel { |
| 972 |
- |
| 973 |
- class Serializable { |
| 974 |
+namespace DataModel |
| 975 |
+{ |
| 976 |
+ class Serializable |
| 977 |
+ { |
| 978 |
public: |
| 979 |
virtual ~Serializable() {}; |
| 980 |
virtual std::string Serialize() const = 0; |
| 981 |
- virtual bool Deserialize(const std::string& serialized) = 0; |
| 982 |
+ virtual void Deserialize(const std::string& serialized) = 0; |
| 983 |
|
| 984 |
protected: |
| 985 |
static void ParseArguments(const std::string& serialized, std::map<std::string,std::string>& arguments); |
| 986 |
}; |
| 987 |
- |
| 988 |
} // namespace DataModel |
| 989 |
- |
| 990 |
Index: railcontrol/DataModel/Signal.cpp |
| 991 |
=================================================================== |
| 992 |
--- railcontrol.orig/DataModel/Signal.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 993 |
+++ railcontrol/DataModel/Signal.cpp 2025-11-24 15:27:11.432003346 +0100 |
| 994 |
@@ -29,22 +29,6 @@ |
| 995 |
|
| 996 |
namespace DataModel |
| 997 |
{ |
| 998 |
- void Signal::SetAccessoryType(AccessoryType type) |
| 999 |
- { |
| 1000 |
- AccessoryBase::SetAccessoryType(type); |
| 1001 |
- ResetStateAddressMap(); |
| 1002 |
- } |
| 1003 |
- |
| 1004 |
- ObjectType Signal::GetObjectType() const |
| 1005 |
- { |
| 1006 |
- return ObjectTypeSignal; |
| 1007 |
- } |
| 1008 |
- |
| 1009 |
- std::string Signal::GetLayoutType() const |
| 1010 |
- { |
| 1011 |
- return Languages::GetText(Languages::TextSignal); |
| 1012 |
- } |
| 1013 |
- |
| 1014 |
std::string Signal::Serialize() const |
| 1015 |
{ |
| 1016 |
string str = "objectType=Signal;"; |
| 1017 |
@@ -63,14 +47,14 @@ |
| 1018 |
return str; |
| 1019 |
} |
| 1020 |
|
| 1021 |
- bool Signal::Deserialize(const std::string& serialized) |
| 1022 |
+ void Signal::Deserialize(const std::string& serialized) |
| 1023 |
{ |
| 1024 |
map<string,string> arguments; |
| 1025 |
ParseArguments(serialized, arguments); |
| 1026 |
string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 1027 |
if (objectType.compare("Signal") != 0) |
| 1028 |
{ |
| 1029 |
- return false; |
| 1030 |
+ return; |
| 1031 |
} |
| 1032 |
|
| 1033 |
AccessoryBase::Deserialize(arguments); |
| 1034 |
@@ -87,7 +71,6 @@ |
| 1035 |
} |
| 1036 |
SetStateAddressOffset(static_cast<AccessoryState>(i), address); |
| 1037 |
} |
| 1038 |
- return true; |
| 1039 |
} |
| 1040 |
|
| 1041 |
Signal& Signal::operator=(const Hardware::AccessoryCacheEntry& accessory) |
| 1042 |
Index: railcontrol/DataModel/Signal.h |
| 1043 |
=================================================================== |
| 1044 |
--- railcontrol.orig/DataModel/Signal.h 2025-11-24 15:27:11.438141379 +0100 |
| 1045 |
+++ railcontrol/DataModel/Signal.h 2025-11-24 15:27:11.432081922 +0100 |
| 1046 |
@@ -78,16 +78,26 @@ |
| 1047 |
Deserialize(serialized); |
| 1048 |
} |
| 1049 |
|
| 1050 |
- virtual void SetAccessoryType(AccessoryType type) override; |
| 1051 |
+ inline void SetAccessoryType(AccessoryType type) override |
| 1052 |
+ { |
| 1053 |
+ AccessoryBase::SetAccessoryType(type); |
| 1054 |
+ ResetStateAddressMap(); |
| 1055 |
+ } |
| 1056 |
|
| 1057 |
- virtual ObjectType GetObjectType() const override; |
| 1058 |
+ inline ObjectType GetObjectType() const override |
| 1059 |
+ { |
| 1060 |
+ return ObjectTypeSignal; |
| 1061 |
+ } |
| 1062 |
|
| 1063 |
- virtual std::string GetLayoutType() const override; |
| 1064 |
+ inline std::string GetLayoutType() const override |
| 1065 |
+ { |
| 1066 |
+ return Languages::GetText(Languages::TextSignal); |
| 1067 |
+ } |
| 1068 |
|
| 1069 |
std::string Serialize() const override; |
| 1070 |
|
| 1071 |
using HardwareHandle::Deserialize; |
| 1072 |
- virtual bool Deserialize(const std::string& serialized) override; |
| 1073 |
+ void Deserialize(const std::string& serialized) override; |
| 1074 |
|
| 1075 |
inline Track* GetTrack() const |
| 1076 |
{ |
| 1077 |
Index: railcontrol/DataModel/Switch.cpp |
| 1078 |
=================================================================== |
| 1079 |
--- railcontrol.orig/DataModel/Switch.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 1080 |
+++ railcontrol/DataModel/Switch.cpp 2025-11-24 15:27:11.432140982 +0100 |
| 1081 |
@@ -40,14 +40,14 @@ |
| 1082 |
return str; |
| 1083 |
} |
| 1084 |
|
| 1085 |
- bool Switch::Deserialize(const std::string& serialized) |
| 1086 |
+ void Switch::Deserialize(const std::string& serialized) |
| 1087 |
{ |
| 1088 |
map<string,string> arguments; |
| 1089 |
ParseArguments(serialized, arguments); |
| 1090 |
string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 1091 |
if (objectType.compare("Switch") != 0) |
| 1092 |
{ |
| 1093 |
- return false; |
| 1094 |
+ return; |
| 1095 |
} |
| 1096 |
|
| 1097 |
AccessoryBase::Deserialize(arguments); |
| 1098 |
@@ -55,7 +55,6 @@ |
| 1099 |
LockableItem::Deserialize(arguments); |
| 1100 |
SetSizeFromType(); |
| 1101 |
SetVisible(VisibleYes); |
| 1102 |
- return true; |
| 1103 |
} |
| 1104 |
|
| 1105 |
void Switch::SetAccessoryState(const AccessoryState state) |
| 1106 |
Index: railcontrol/DataModel/Switch.h |
| 1107 |
=================================================================== |
| 1108 |
--- railcontrol.orig/DataModel/Switch.h 2025-11-24 15:27:11.438141379 +0100 |
| 1109 |
+++ railcontrol/DataModel/Switch.h 2025-11-24 15:27:11.432196584 +0100 |
| 1110 |
@@ -68,11 +68,11 @@ |
| 1111 |
std::string Serialize() const override; |
| 1112 |
|
| 1113 |
using HardwareHandle::Deserialize; |
| 1114 |
- bool Deserialize(const std::string& serialized) override; |
| 1115 |
+ void Deserialize(const std::string& serialized) override; |
| 1116 |
|
| 1117 |
void SetAccessoryState(const AccessoryState state); |
| 1118 |
|
| 1119 |
- virtual inline void SetAccessoryType(AccessoryType type) override |
| 1120 |
+ inline void SetAccessoryType(AccessoryType type) override |
| 1121 |
{ |
| 1122 |
AccessoryBase::SetAccessoryType(type); |
| 1123 |
SetSizeFromType(); |
| 1124 |
Index: railcontrol/DataModel/Text.cpp |
| 1125 |
=================================================================== |
| 1126 |
--- railcontrol.orig/DataModel/Text.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 1127 |
+++ railcontrol/DataModel/Text.cpp 2025-11-24 15:27:11.432250140 +0100 |
| 1128 |
@@ -37,18 +37,17 @@ |
| 1129 |
return str; |
| 1130 |
} |
| 1131 |
|
| 1132 |
- bool Text::Deserialize(const string& serialized) |
| 1133 |
+ void Text::Deserialize(const string& serialized) |
| 1134 |
{ |
| 1135 |
map<string, string> arguments; |
| 1136 |
ParseArguments(serialized, arguments); |
| 1137 |
string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 1138 |
if (objectType.compare("Text") != 0) |
| 1139 |
{ |
| 1140 |
- return false; |
| 1141 |
+ return; |
| 1142 |
} |
| 1143 |
LayoutItem::Deserialize(arguments); |
| 1144 |
SetHeight(Height1); |
| 1145 |
SetVisible(VisibleYes); |
| 1146 |
- return true; |
| 1147 |
} |
| 1148 |
} // namespace DataModel |
| 1149 |
Index: railcontrol/DataModel/Text.h |
| 1150 |
=================================================================== |
| 1151 |
--- railcontrol.orig/DataModel/Text.h 2025-11-24 15:27:11.438141379 +0100 |
| 1152 |
+++ railcontrol/DataModel/Text.h 2025-11-24 15:27:11.432303697 +0100 |
| 1153 |
@@ -62,7 +62,7 @@ |
| 1154 |
} |
| 1155 |
|
| 1156 |
std::string Serialize() const override; |
| 1157 |
- bool Deserialize(const std::string& serialized) override; |
| 1158 |
+ void Deserialize(const std::string& serialized) override; |
| 1159 |
|
| 1160 |
inline std::string GetLayoutType() const override |
| 1161 |
{ |
| 1162 |
Index: railcontrol/DataModel/Track.cpp |
| 1163 |
=================================================================== |
| 1164 |
--- railcontrol.orig/DataModel/Track.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 1165 |
+++ railcontrol/DataModel/Track.cpp 2025-11-24 15:27:11.432374586 +0100 |
| 1166 |
@@ -41,7 +41,10 @@ |
| 1167 |
std::string Track::Serialize() const |
| 1168 |
{ |
| 1169 |
std::string str; |
| 1170 |
- str = "objectType=Track"; |
| 1171 |
+ str = "objectType=Track;"; |
| 1172 |
+ str += LayoutItem::Serialize(); |
| 1173 |
+ str += ";"; |
| 1174 |
+ str += LockableItem::Serialize(); |
| 1175 |
str += ";selectrouteapproach="; |
| 1176 |
str += to_string(selectRouteApproach); |
| 1177 |
str += ";trackstate="; |
| 1178 |
@@ -64,10 +67,6 @@ |
| 1179 |
str += to_string(showName); |
| 1180 |
str += ";displayname="; |
| 1181 |
str += displayName; |
| 1182 |
- str += ";"; |
| 1183 |
- str += LayoutItem::Serialize(); |
| 1184 |
- str += ";"; |
| 1185 |
- str += LockableItem::Serialize(); |
| 1186 |
str += ";tracktype="; |
| 1187 |
str += to_string(trackType); |
| 1188 |
str += ";main="; |
| 1189 |
@@ -75,14 +74,14 @@ |
| 1190 |
return str; |
| 1191 |
} |
| 1192 |
|
| 1193 |
- bool Track::Deserialize(const std::string& serialized) |
| 1194 |
+ void Track::Deserialize(const std::string& serialized) |
| 1195 |
{ |
| 1196 |
map<string, string> arguments; |
| 1197 |
ParseArguments(serialized, arguments); |
| 1198 |
string objectType = Utils::Utils::GetStringMapEntry(arguments, "objectType"); |
| 1199 |
if (objectType.compare("Track") != 0) |
| 1200 |
{ |
| 1201 |
- return false; |
| 1202 |
+ return; |
| 1203 |
} |
| 1204 |
LayoutItem::Deserialize(arguments); |
| 1205 |
LockableItem::Deserialize(arguments); |
| 1206 |
@@ -139,7 +138,6 @@ |
| 1207 |
} |
| 1208 |
mainID = static_cast<TrackID>(Utils::Utils::GetIntegerMapEntry(arguments, "master", TrackNone)); // FIXME: 2025-02-28 can be removed later |
| 1209 |
mainID = static_cast<TrackID>(Utils::Utils::GetIntegerMapEntry(arguments, "main", mainID)); |
| 1210 |
- return true; |
| 1211 |
} |
| 1212 |
|
| 1213 |
void Track::DeleteFeedbacks() |
| 1214 |
Index: railcontrol/DataModel/Track.h |
| 1215 |
=================================================================== |
| 1216 |
--- railcontrol.orig/DataModel/Track.h 2025-11-24 15:27:11.438141379 +0100 |
| 1217 |
+++ railcontrol/DataModel/Track.h 2025-11-24 15:27:11.432449470 +0100 |
| 1218 |
@@ -108,7 +108,7 @@ |
| 1219 |
|
| 1220 |
std::string Serialize() const override; |
| 1221 |
|
| 1222 |
- bool Deserialize(const std::string& serialized) override; |
| 1223 |
+ void Deserialize(const std::string& serialized) override; |
| 1224 |
|
| 1225 |
inline std::string GetLayoutType() const override |
| 1226 |
{ |
| 1227 |
Index: railcontrol/Manager.cpp |
| 1228 |
=================================================================== |
| 1229 |
--- railcontrol.orig/Manager.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 1230 |
+++ railcontrol/Manager.cpp 2025-11-24 15:27:11.432656143 +0100 |
| 1231 |
@@ -2679,6 +2679,7 @@ |
| 1232 |
route->SetPosX(posX); |
| 1233 |
route->SetPosY(posY); |
| 1234 |
route->SetPosZ(posZ); |
| 1235 |
+ route->SetRotation(DataModel::LayoutItem::Rotation0); |
| 1236 |
route->SetAutomode(automode); |
| 1237 |
if (automode == AutomodeYes) |
| 1238 |
{ |
| 1239 |
Index: railcontrol/Server/Web/HtmlTagRoute.cpp |
| 1240 |
=================================================================== |
| 1241 |
--- railcontrol.orig/Server/Web/HtmlTagRoute.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 1242 |
+++ railcontrol/Server/Web/HtmlTagRoute.cpp 2025-11-24 15:27:11.432883931 +0100 |
| 1243 |
@@ -31,7 +31,9 @@ |
| 1244 |
HtmlTagRoute::HtmlTagRoute(const DataModel::Route* route) |
| 1245 |
: HtmlTagLayoutItem(dynamic_cast<const DataModel::LayoutItem*>(route)) |
| 1246 |
{ |
| 1247 |
- image += "<svg width=\"" + EdgeLengthString + "\" height=\"" + EdgeLengthString + "\" id=\"_img\"><polygon points=\"1,21 7,21 7,29 1,29\" fill=\"none\" stroke=\"white\"/><polygon points=\"35,7 29,7 29,15 35,15\" fill=\"none\" stroke=\"white\"/><polyline points=\"7,25 15,25 21,11 29,11\" stroke=\"white\" fill=\"none\"/></svg>"; |
| 1248 |
+ image = "<polygon points=\"1,21 7,21 7,29 1,29\" fill=\"none\" stroke=\"white\"/>" |
| 1249 |
+ "<polygon points=\"35,7 29,7 29,15 35,15\" fill=\"none\" stroke=\"white\"/>" |
| 1250 |
+ "<polyline points=\"7,25 15,25 21,11 29,11\" stroke=\"white\" fill=\"none\"/>"; |
| 1251 |
|
| 1252 |
string routeIdString = to_string(route->GetID()); |
| 1253 |
imageDiv.AddClass("route_item"); |
| 1254 |
Index: railcontrol/Server/Web/HtmlTagTrack.cpp |
| 1255 |
=================================================================== |
| 1256 |
--- railcontrol.orig/Server/Web/HtmlTagTrack.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 1257 |
+++ railcontrol/Server/Web/HtmlTagTrack.cpp 2025-11-24 15:27:11.432946828 +0100 |
| 1258 |
@@ -139,9 +139,9 @@ |
| 1259 |
const string& orientationSign = track->GetMainLocoOrientation() == OrientationRight ? "→ " : "← "; |
| 1260 |
const string& locoName = reserved ? orientationSign + manager.GetLocoBaseName(locoBaseIdentifier) : ""; |
| 1261 |
const string textPositionX = to_string(EdgeLength * trackHeight - 1); |
| 1262 |
- image += "<text class=\"loconame\" x=\"-" + textPositionX + "\" y=\"11\" id=\"" + identifier + "_text_loconame\" transform=\"rotate(270 0,0)\" font-size=\"14\">" + locoName + "</text>"; |
| 1263 |
+ image += "<text class=\"loconame\" x=\"-" + textPositionX + "\" y=\"11\" id=\"" + identifier + "_text_loconame\" transform=\"rotate(270 0,0)\">" + locoName + "</text>"; |
| 1264 |
const string& displayName = track->GetMainDisplayName(); |
| 1265 |
- image += "<text class=\"trackname\" x=\"-" + textPositionX + "\" y=\"33\" id=\"" + identifier + "_text_trackname\" transform=\"rotate(270 0,0)\" font-size=\"14\">" + (displayName.size() ? displayName : trackName) + "</text>"; |
| 1266 |
+ image += "<text class=\"trackname\" x=\"-" + textPositionX + "\" y=\"33\" id=\"" + identifier + "_text_trackname\" transform=\"rotate(270 0,0)\">" + (displayName.size() ? displayName : trackName) + "</text>"; |
| 1267 |
} |
| 1268 |
break; |
| 1269 |
} |
| 1270 |
Index: railcontrol/Server/Web/WebClientRoute.cpp |
| 1271 |
=================================================================== |
| 1272 |
--- railcontrol.orig/Server/Web/WebClientRoute.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 1273 |
+++ railcontrol/Server/Web/WebClientRoute.cpp 2025-11-24 15:27:11.433036915 +0100 |
| 1274 |
@@ -74,7 +74,7 @@ |
| 1275 |
void WebClientRoute::HandleRouteEdit(const map<string, string>& arguments) |
| 1276 |
{ |
| 1277 |
HtmlTag content; |
| 1278 |
- RouteID routeID = Utils::Utils::GetIntegerMapEntry(arguments, "route", RouteNone); |
| 1279 |
+ const RouteID routeID = Utils::Utils::GetIntegerMapEntry(arguments, "route", RouteNone); |
| 1280 |
string name = Languages::GetText(Languages::TextNew); |
| 1281 |
Delay delay = Route::DefaultDelay; |
| 1282 |
Route::PushpullType pushpull = Route::PushpullTypeBoth; |
| 1283 |
@@ -727,9 +727,9 @@ |
| 1284 |
{ |
| 1285 |
std::map<string, Route*> routes = manager.RouteListByName(); |
| 1286 |
map<string, RouteID> routeOptions; |
| 1287 |
- for (auto& track : routes) |
| 1288 |
+ for (auto& route : routes) |
| 1289 |
{ |
| 1290 |
- routeOptions[track.first] = track.second->GetID(); |
| 1291 |
+ routeOptions[route.first] = route.second->GetID(); |
| 1292 |
} |
| 1293 |
content.AddChildTag(HtmlTagSelect(name + "_id", routeOptions, objectId).AddClass("select_relation_id")); |
| 1294 |
return content; |
| 1295 |
Index: railcontrol/Server/Web/WebClientText.cpp |
| 1296 |
=================================================================== |
| 1297 |
--- railcontrol.orig/Server/Web/WebClientText.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 1298 |
+++ railcontrol/Server/Web/WebClientText.cpp 2025-11-24 15:27:11.433153379 +0100 |
| 1299 |
@@ -61,7 +61,7 @@ |
| 1300 |
if (textID > TextNone) |
| 1301 |
{ |
| 1302 |
const DataModel::Text* text = manager.GetText(textID); |
| 1303 |
- if (text != nullptr) |
| 1304 |
+ if (text) |
| 1305 |
{ |
| 1306 |
name = text->GetName(); |
| 1307 |
posx = text->GetPosX(); |
| 1308 |
@@ -158,7 +158,7 @@ |
| 1309 |
} |
| 1310 |
|
| 1311 |
const DataModel::Text* text = manager.GetText(textID); |
| 1312 |
- if (text == nullptr) |
| 1313 |
+ if (!text) |
| 1314 |
{ |
| 1315 |
client.ReplyHtmlWithHeaderAndParagraph(Languages::TextTextDoesNotExist); |
| 1316 |
return; |
| 1317 |
@@ -181,7 +181,7 @@ |
| 1318 |
{ |
| 1319 |
TextID textID = Utils::Utils::GetIntegerMapEntry(arguments, "text", TextNone); |
| 1320 |
const DataModel::Text* text = manager.GetText(textID); |
| 1321 |
- if (text == nullptr) |
| 1322 |
+ if (!text) |
| 1323 |
{ |
| 1324 |
client.ReplyResponse(WebClient::ResponseError, Languages::TextTextDoesNotExist); |
| 1325 |
return; |
| 1326 |
@@ -202,7 +202,7 @@ |
| 1327 |
{ |
| 1328 |
TextID textID = Utils::Utils::GetIntegerMapEntry(arguments, "text"); |
| 1329 |
const DataModel::Text* text = manager.GetText(textID); |
| 1330 |
- if (text == nullptr) |
| 1331 |
+ if (!text) |
| 1332 |
{ |
| 1333 |
client.ReplyHtmlWithHeader(HtmlTag()); |
| 1334 |
return; |
| 1335 |
Index: railcontrol/Server/Web/WebClientText.h |
| 1336 |
=================================================================== |
| 1337 |
--- railcontrol.orig/Server/Web/WebClientText.h 2025-11-24 15:27:11.438141379 +0100 |
| 1338 |
+++ railcontrol/Server/Web/WebClientText.h 2025-11-24 15:27:11.433230445 +0100 |
| 1339 |
@@ -23,7 +23,6 @@ |
| 1340 |
#include <map> |
| 1341 |
#include <string> |
| 1342 |
|
| 1343 |
-#include "Logger/Logger.h" |
| 1344 |
#include "Manager.h" |
| 1345 |
|
| 1346 |
namespace Server { namespace Web |
| 1347 |
Index: railcontrol/Server/Web/WebClientTrack.h |
| 1348 |
=================================================================== |
| 1349 |
--- railcontrol.orig/Server/Web/WebClientTrack.h 2025-11-24 15:27:11.438141379 +0100 |
| 1350 |
+++ railcontrol/Server/Web/WebClientTrack.h 2025-11-24 15:27:11.433282059 +0100 |
| 1351 |
@@ -75,6 +75,4 @@ |
| 1352 |
WebClient& client; |
| 1353 |
Logger::Logger* logger; |
| 1354 |
}; |
| 1355 |
- |
| 1356 |
}} // namespace Server::Web |
| 1357 |
- |
| 1358 |
Index: railcontrol/Server/Web/WebServer.h |
| 1359 |
=================================================================== |
| 1360 |
--- railcontrol.orig/Server/Web/WebServer.h 2025-11-24 15:27:11.438141379 +0100 |
| 1361 |
+++ railcontrol/Server/Web/WebServer.h 2025-11-24 15:27:11.433380545 +0100 |
| 1362 |
@@ -121,8 +121,8 @@ |
| 1363 |
void SignalState(const ControlType controlType, const DataModel::Signal* signal) override; |
| 1364 |
void ClusterDelete(const ClusterID clusterID, const std::string& name) override; |
| 1365 |
void ClusterSettings(const ClusterID clusterID, const std::string& name) override; |
| 1366 |
- void TextDelete(const ClusterID clusterID, const std::string& name) override; |
| 1367 |
- void TextSettings(const ClusterID clusterID, const std::string& name) override; |
| 1368 |
+ void TextDelete(const TextID textID, const std::string& name) override; |
| 1369 |
+ void TextSettings(const TextID textID, const std::string& name) override; |
| 1370 |
void ProgramValue(const CvNumber cv, const CvValue value) override; |
| 1371 |
|
| 1372 |
inline bool UpdateAvailable() |
| 1373 |
Index: railcontrol/Storage/StorageHandler.cpp |
| 1374 |
=================================================================== |
| 1375 |
--- railcontrol.orig/Storage/StorageHandler.cpp 2025-11-24 15:27:11.438141379 +0100 |
| 1376 |
+++ railcontrol/Storage/StorageHandler.cpp 2025-11-24 15:27:11.433489117 +0100 |
| 1377 |
@@ -51,6 +51,10 @@ |
| 1378 |
for (auto& serializedObject : serializedObjects) |
| 1379 |
{ |
| 1380 |
Loco* loco = new Loco(manager, serializedObject); |
| 1381 |
+ if (!loco) |
| 1382 |
+ { |
| 1383 |
+ continue; |
| 1384 |
+ } |
| 1385 |
locos[loco->GetID()] = loco; |
| 1386 |
} |
| 1387 |
} |
| 1388 |
@@ -69,6 +73,10 @@ |
| 1389 |
for (auto& serializedObject : serializedObjects) |
| 1390 |
{ |
| 1391 |
MultipleUnit* multipleUnit = new MultipleUnit(manager, serializedObject); |
| 1392 |
+ if (!multipleUnit) |
| 1393 |
+ { |
| 1394 |
+ continue; |
| 1395 |
+ } |
| 1396 |
const MultipleUnitID multipleUnitID = multipleUnit->GetID(); |
| 1397 |
multipleUnit->AssignSlaves(RelationsFrom(DataModel::Relation::RelationTypeMultipleUnitLoco, multipleUnitID)); |
| 1398 |
multipleUnits[multipleUnitID] = multipleUnit; |
| 1399 |
@@ -89,7 +97,7 @@ |
| 1400 |
for (auto& serializedObject : serializedObjects) |
| 1401 |
{ |
| 1402 |
Accessory* accessory = new Accessory(serializedObject); |
| 1403 |
- if (accessory == nullptr) |
| 1404 |
+ if (!accessory) |
| 1405 |
{ |
| 1406 |
continue; |
| 1407 |
} |
| 1408 |
@@ -104,7 +112,7 @@ |
| 1409 |
for (auto& serializedObject : serializedObjects) |
| 1410 |
{ |
| 1411 |
Feedback* feedback = new Feedback(manager, serializedObject); |
| 1412 |
- if (feedback == nullptr) |
| 1413 |
+ if (!feedback) |
| 1414 |
{ |
| 1415 |
continue; |
| 1416 |
} |
| 1417 |
@@ -119,7 +127,7 @@ |
| 1418 |
for (auto& serializedObject : serializedObjects) |
| 1419 |
{ |
| 1420 |
Track* track = new Track(manager, serializedObject); |
| 1421 |
- if (track == nullptr) |
| 1422 |
+ if (!track) |
| 1423 |
{ |
| 1424 |
continue; |
| 1425 |
} |
| 1426 |
@@ -151,7 +159,7 @@ |
| 1427 |
for (auto& serializedObject : serializedObjects) |
| 1428 |
{ |
| 1429 |
Switch* mySwitch = new Switch(serializedObject); |
| 1430 |
- if (mySwitch == nullptr) |
| 1431 |
+ if (!mySwitch) |
| 1432 |
{ |
| 1433 |
continue; |
| 1434 |
} |
| 1435 |
@@ -214,7 +222,7 @@ |
| 1436 |
for (auto& serializedObject : serializedObjects) |
| 1437 |
{ |
| 1438 |
Route* route = new Route(manager, serializedObject); |
| 1439 |
- if (route == nullptr) |
| 1440 |
+ if (!route) |
| 1441 |
{ |
| 1442 |
continue; |
| 1443 |
} |
| 1444 |
@@ -239,7 +247,7 @@ |
| 1445 |
for (auto& serializedObject : serializedObjects) |
| 1446 |
{ |
| 1447 |
Layer* layer = new Layer(serializedObject); |
| 1448 |
- if (layer == nullptr) |
| 1449 |
+ if (!layer) |
| 1450 |
{ |
| 1451 |
continue; |
| 1452 |
} |
| 1453 |
@@ -254,7 +262,7 @@ |
| 1454 |
for (auto& serializedObject : serializedObjects) |
| 1455 |
{ |
| 1456 |
Signal* signal = new Signal(manager, serializedObject); |
| 1457 |
- if (signal == nullptr) |
| 1458 |
+ if (!signal) |
| 1459 |
{ |
| 1460 |
continue; |
| 1461 |
} |
| 1462 |
@@ -275,7 +283,7 @@ |
| 1463 |
for (auto& serializedObject : serializedObjects) |
| 1464 |
{ |
| 1465 |
Cluster* cluster = new Cluster(serializedObject); |
| 1466 |
- if (cluster == nullptr) |
| 1467 |
+ if (!cluster) |
| 1468 |
{ |
| 1469 |
continue; |
| 1470 |
} |
| 1471 |
@@ -292,7 +300,7 @@ |
| 1472 |
for (auto& serializedObject : serializedObjects) |
| 1473 |
{ |
| 1474 |
Text* text = new Text(serializedObject); |
| 1475 |
- if (text == nullptr) |
| 1476 |
+ if (!text) |
| 1477 |
{ |
| 1478 |
continue; |
| 1479 |
} |
| 1480 |
@@ -317,7 +325,7 @@ |
| 1481 |
for (auto& relationString : relationStrings) |
| 1482 |
{ |
| 1483 |
Relation* relation = new Relation(manager, relationString); |
| 1484 |
- if (relation == nullptr) |
| 1485 |
+ if (!relation) |
| 1486 |
{ |
| 1487 |
continue; |
| 1488 |
} |
| 1489 |
Index: railcontrol/html/style.css |
| 1490 |
=================================================================== |
| 1491 |
--- railcontrol.orig/html/style.css 2025-11-24 15:27:11.438141379 +0100 |
| 1492 |
+++ railcontrol/html/style.css 2025-11-24 15:27:11.433601693 +0100 |
| 1493 |
@@ -82,7 +82,7 @@ |
| 1494 |
} |
| 1495 |
} |
| 1496 |
|
| 1497 |
-@media (min-width: 650px) and (max-width: 999px) { |
| 1498 |
+@media (min-width: 616px) and (max-width: 1023px) { |
| 1499 |
.menu_config { |
| 1500 |
display: none; |
| 1501 |
} |
| 1502 |
@@ -103,7 +103,7 @@ |
| 1503 |
} |
| 1504 |
} |
| 1505 |
|
| 1506 |
-@media (min-width: 1000px) { |
| 1507 |
+@media (min-width: 1024px) { |
| 1508 |
.menu_add, |
| 1509 |
.menu_config, |
| 1510 |
.menu_config_visible { |
| 1511 |
@@ -438,8 +438,10 @@ |
| 1512 |
} |
| 1513 |
|
| 1514 |
.text_item, |
| 1515 |
+.loconame, |
| 1516 |
.trackname { |
| 1517 |
fill: white; |
| 1518 |
+ font-size: 14px; |
| 1519 |
} |
| 1520 |
|
| 1521 |
.popup { |