summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/squirrel/squirrel/sqfuncproto.h13
-rw-r--r--src/3rdparty/squirrel/squirrel/sqvm.h5
-rw-r--r--src/error_gui.cpp6
-rw-r--r--src/network/core/address.h9
-rw-r--r--src/newgrf_text.cpp27
-rw-r--r--src/pathfinder/yapf/yapf_costrail.hpp8
6 files changed, 17 insertions, 51 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqfuncproto.h b/src/3rdparty/squirrel/squirrel/sqfuncproto.h
index e58ccd299..2966d0654 100644
--- a/src/3rdparty/squirrel/squirrel/sqfuncproto.h
+++ b/src/3rdparty/squirrel/squirrel/sqfuncproto.h
@@ -20,12 +20,6 @@ struct SQOuterVar
_src=src;
_type=t;
}
- SQOuterVar(const SQOuterVar &ov)
- {
- _type=ov._type;
- _src=ov._src;
- _name=ov._name;
- }
SQOuterType _type;
SQObjectPtr _name;
SQObjectPtr _src;
@@ -34,13 +28,6 @@ struct SQOuterVar
struct SQLocalVarInfo
{
SQLocalVarInfo():_start_op(0),_end_op(0), _pos(0){}
- SQLocalVarInfo(const SQLocalVarInfo &lvi)
- {
- _name=lvi._name;
- _start_op=lvi._start_op;
- _end_op=lvi._end_op;
- _pos=lvi._pos;
- }
SQObjectPtr _name;
SQUnsignedInteger _start_op;
SQUnsignedInteger _end_op;
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.h b/src/3rdparty/squirrel/squirrel/sqvm.h
index 89a592e13..97557b133 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.h
+++ b/src/3rdparty/squirrel/squirrel/sqvm.h
@@ -12,9 +12,8 @@
void sq_base_register(HSQUIRRELVM v);
struct SQExceptionTrap{
- SQExceptionTrap() {}
- SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target){ _stacksize = ss; _stackbase = stackbase; _ip = ip; _extarget = ex_target;}
- SQExceptionTrap(const SQExceptionTrap &et) { (*this) = et; }
+ SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target)
+ : _stackbase(stackbase), _stacksize(ss), _ip(ip), _extarget(ex_target) {}
SQInteger _stackbase;
SQInteger _stacksize;
SQInstruction *_ip;
diff --git a/src/error_gui.cpp b/src/error_gui.cpp
index 1fa83db16..501ebb82f 100644
--- a/src/error_gui.cpp
+++ b/src/error_gui.cpp
@@ -72,9 +72,11 @@ static WindowDesc _errmsg_face_desc(
* Copy the given data into our instance.
* @param data The data to copy.
*/
-ErrorMessageData::ErrorMessageData(const ErrorMessageData &data)
+ErrorMessageData::ErrorMessageData(const ErrorMessageData &data) :
+ duration(data.duration), textref_stack_grffile(data.textref_stack_grffile), textref_stack_size(data.textref_stack_size),
+ summary_msg(data.summary_msg), detailed_msg(data.detailed_msg), position(data.position), face(data.face)
{
- *this = data;
+ memcpy(this->textref_stack, data.textref_stack, sizeof(this->textref_stack));
for (size_t i = 0; i < lengthof(this->strings); i++) {
if (this->strings[i] != nullptr) {
this->strings[i] = stredup(this->strings[i]);
diff --git a/src/network/core/address.h b/src/network/core/address.h
index 4dd0edbc0..2f27a083a 100644
--- a/src/network/core/address.h
+++ b/src/network/core/address.h
@@ -91,15 +91,6 @@ public:
this->SetPort(port);
}
- /**
- * Make a clone of another address
- * @param address the address to clone
- */
- NetworkAddress(const NetworkAddress &address)
- {
- memcpy(this, &address, sizeof(*this));
- }
-
const char *GetHostname();
void GetAddressAsString(char *buffer, const char *last, bool with_family = true);
const char *GetAddressAsString(bool with_family = true);
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index 55a1301b1..0a6cfd4a8 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -18,6 +18,10 @@
*/
#include "stdafx.h"
+
+#include <algorithm>
+#include <array>
+
#include "newgrf.h"
#include "strings_func.h"
#include "newgrf_storage.h"
@@ -812,22 +816,14 @@ void CleanUpStrings()
}
struct TextRefStack {
- byte stack[0x30];
+ std::array<byte, 0x30> stack;
byte position;
const GRFFile *grffile;
bool used;
TextRefStack() : position(0), grffile(nullptr), used(false) {}
- TextRefStack(const TextRefStack &stack) :
- position(stack.position),
- grffile(stack.grffile),
- used(stack.used)
- {
- memcpy(this->stack, stack.stack, sizeof(this->stack));
- }
-
- uint8 PopUnsignedByte() { assert(this->position < lengthof(this->stack)); return this->stack[this->position++]; }
+ uint8 PopUnsignedByte() { assert(this->position < this->stack.size()); return this->stack[this->position++]; }
int8 PopSignedByte() { return (int8)this->PopUnsignedByte(); }
uint16 PopUnsignedWord()
@@ -865,9 +861,8 @@ struct TextRefStack {
if (this->position >= 2) {
this->position -= 2;
} else {
- for (int i = lengthof(stack) - 1; i >= this->position + 2; i--) {
- this->stack[i] = this->stack[i - 2];
- }
+ // Rotate right 2 positions
+ std::rotate(this->stack.rbegin(), this->stack.rbegin() + 2, this->stack.rend());
}
this->stack[this->position] = GB(word, 0, 8);
this->stack[this->position + 1] = GB(word, 8, 8);
@@ -939,12 +934,12 @@ void StartTextRefStackUsage(const GRFFile *grffile, byte numEntries, const uint3
_newgrf_textrefstack.ResetStack(grffile);
- byte *p = _newgrf_textrefstack.stack;
+ auto stack_it = _newgrf_textrefstack.stack.begin();
for (uint i = 0; i < numEntries; i++) {
uint32 value = values != nullptr ? values[i] : _temp_store.GetValue(0x100 + i);
for (uint j = 0; j < 32; j += 8) {
- *p = GB(value, j, 8);
- p++;
+ *stack_it = GB(value, j, 8);
+ stack_it++;
}
}
}
diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp
index 9613fd079..d7f9a519e 100644
--- a/src/pathfinder/yapf/yapf_costrail.hpp
+++ b/src/pathfinder/yapf/yapf_costrail.hpp
@@ -47,14 +47,6 @@ protected:
this->tile_type = GetTileType(tile);
this->rail_type = GetTileRailType(tile);
}
-
- TILE(const TILE &src)
- {
- tile = src.tile;
- td = src.td;
- tile_type = src.tile_type;
- rail_type = src.rail_type;
- }
};
protected: