Fix: GCC9's warnings about deprecated implicit assignment operators

pull/104/head
Charles Pigott 5 years ago
parent acf0242961
commit 71a3e83468

@ -20,12 +20,6 @@ struct SQOuterVar
_src=src; _src=src;
_type=t; _type=t;
} }
SQOuterVar(const SQOuterVar &ov)
{
_type=ov._type;
_src=ov._src;
_name=ov._name;
}
SQOuterType _type; SQOuterType _type;
SQObjectPtr _name; SQObjectPtr _name;
SQObjectPtr _src; SQObjectPtr _src;
@ -34,13 +28,6 @@ struct SQOuterVar
struct SQLocalVarInfo struct SQLocalVarInfo
{ {
SQLocalVarInfo():_start_op(0),_end_op(0), _pos(0){} 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; SQObjectPtr _name;
SQUnsignedInteger _start_op; SQUnsignedInteger _start_op;
SQUnsignedInteger _end_op; SQUnsignedInteger _end_op;

@ -12,9 +12,8 @@
void sq_base_register(HSQUIRRELVM v); void sq_base_register(HSQUIRRELVM v);
struct SQExceptionTrap{ struct SQExceptionTrap{
SQExceptionTrap() {} SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target)
SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target){ _stacksize = ss; _stackbase = stackbase; _ip = ip; _extarget = ex_target;} : _stackbase(stackbase), _stacksize(ss), _ip(ip), _extarget(ex_target) {}
SQExceptionTrap(const SQExceptionTrap &et) { (*this) = et; }
SQInteger _stackbase; SQInteger _stackbase;
SQInteger _stacksize; SQInteger _stacksize;
SQInstruction *_ip; SQInstruction *_ip;

@ -72,9 +72,11 @@ static WindowDesc _errmsg_face_desc(
* Copy the given data into our instance. * Copy the given data into our instance.
* @param data The data to copy. * @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++) { for (size_t i = 0; i < lengthof(this->strings); i++) {
if (this->strings[i] != nullptr) { if (this->strings[i] != nullptr) {
this->strings[i] = stredup(this->strings[i]); this->strings[i] = stredup(this->strings[i]);

@ -91,15 +91,6 @@ public:
this->SetPort(port); 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(); const char *GetHostname();
void GetAddressAsString(char *buffer, const char *last, bool with_family = true); void GetAddressAsString(char *buffer, const char *last, bool with_family = true);
const char *GetAddressAsString(bool with_family = true); const char *GetAddressAsString(bool with_family = true);

@ -18,6 +18,10 @@
*/ */
#include "stdafx.h" #include "stdafx.h"
#include <algorithm>
#include <array>
#include "newgrf.h" #include "newgrf.h"
#include "strings_func.h" #include "strings_func.h"
#include "newgrf_storage.h" #include "newgrf_storage.h"
@ -812,22 +816,14 @@ void CleanUpStrings()
} }
struct TextRefStack { struct TextRefStack {
byte stack[0x30]; std::array<byte, 0x30> stack;
byte position; byte position;
const GRFFile *grffile; const GRFFile *grffile;
bool used; bool used;
TextRefStack() : position(0), grffile(nullptr), used(false) {} TextRefStack() : position(0), grffile(nullptr), used(false) {}
TextRefStack(const TextRefStack &stack) : uint8 PopUnsignedByte() { assert(this->position < this->stack.size()); return this->stack[this->position++]; }
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++]; }
int8 PopSignedByte() { return (int8)this->PopUnsignedByte(); } int8 PopSignedByte() { return (int8)this->PopUnsignedByte(); }
uint16 PopUnsignedWord() uint16 PopUnsignedWord()
@ -865,9 +861,8 @@ struct TextRefStack {
if (this->position >= 2) { if (this->position >= 2) {
this->position -= 2; this->position -= 2;
} else { } else {
for (int i = lengthof(stack) - 1; i >= this->position + 2; i--) { // Rotate right 2 positions
this->stack[i] = this->stack[i - 2]; std::rotate(this->stack.rbegin(), this->stack.rbegin() + 2, this->stack.rend());
}
} }
this->stack[this->position] = GB(word, 0, 8); this->stack[this->position] = GB(word, 0, 8);
this->stack[this->position + 1] = GB(word, 8, 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); _newgrf_textrefstack.ResetStack(grffile);
byte *p = _newgrf_textrefstack.stack; auto stack_it = _newgrf_textrefstack.stack.begin();
for (uint i = 0; i < numEntries; i++) { for (uint i = 0; i < numEntries; i++) {
uint32 value = values != nullptr ? values[i] : _temp_store.GetValue(0x100 + i); uint32 value = values != nullptr ? values[i] : _temp_store.GetValue(0x100 + i);
for (uint j = 0; j < 32; j += 8) { for (uint j = 0; j < 32; j += 8) {
*p = GB(value, j, 8); *stack_it = GB(value, j, 8);
p++; stack_it++;
} }
} }
} }

@ -47,14 +47,6 @@ protected:
this->tile_type = GetTileType(tile); this->tile_type = GetTileType(tile);
this->rail_type = GetTileRailType(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: protected:

Loading…
Cancel
Save