Skip to content

Commit

Permalink
(ras52) Disable copying of planquadrat_t
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@5345 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
Dwachs committed Feb 17, 2012
1 parent 7485e4a commit 612e506
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
11 changes: 10 additions & 1 deletion simplan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "simworld.h"
#include "simhalt.h"
#include "player/simplay.h"
#include "simdebug.h"
#include "simconst.h"
#include "macros.h"
#include "besch/grund_besch.h"
#include "boden/grund.h"
#include "boden/boden.h"
Expand All @@ -31,6 +31,15 @@
#include "gui/karte.h"


void swap(planquadrat_t& a, planquadrat_t& b)
{
sim::swap(a.this_halt, b.this_halt);
sim::swap(a.halt_list, b.halt_list);
sim::swap(a.ground_size, b.ground_size);
sim::swap(a.halt_list_count, b.halt_list_count);
sim::swap(a.data, b.data);
}

// deletes also all grounds in this array!
planquadrat_t::~planquadrat_t()
{
Expand Down
9 changes: 9 additions & 0 deletions simplan.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class karte_t;
class grund_t;
class ding_t;

class planquadrat_t;
void swap(planquadrat_t& a, planquadrat_t& b);


/**
* Die Karte ist aus Planquadraten zusammengesetzt.
Expand Down Expand Up @@ -47,6 +50,12 @@ class planquadrat_t

~planquadrat_t();

private:
planquadrat_t(planquadrat_t const&);
planquadrat_t& operator=(planquadrat_t const&);
friend void swap(planquadrat_t& a, planquadrat_t& b);

public:
/**
* Setzen des "normalen" Bodens auf Kartenniveau
* @author V. Meyer
Expand Down
6 changes: 2 additions & 4 deletions simworld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1449,8 +1449,7 @@ void karte_t::enlarge_map(settings_t const* sets, sint8 const* const h_field)
for (sint16 iy = 0; iy<old_y; iy++) {
uint32 nr = ix+(iy*old_x);
uint32 nnr = ix+(iy*new_groesse_x);
new_plan[nnr] = plan[nr];
plan[nr] = planquadrat_t();
swap(new_plan[nnr], plan[nr]);
}
}
for (sint16 ix = 0; ix<=old_x; ix++) {
Expand Down Expand Up @@ -2481,8 +2480,7 @@ void karte_t::rotate90()
for( int y=0; y<cached_groesse_gitter_y; y++ ) {
int nr = x+(y*cached_groesse_gitter_x);
int new_nr = (cached_groesse_karte_y-y)+(x*cached_groesse_gitter_y);
new_plan[new_nr] = plan[nr];
plan[nr] = planquadrat_t();
swap(new_plan[new_nr], plan[nr]);

// now rotate everything on the ground(s)
for( uint i=0; i<new_plan[new_nr].get_boden_count(); i++ ) {
Expand Down

0 comments on commit 612e506

Please sign in to comment.