diff options
author | mescalinum <mescalinum@users.sourceforge.net> | 2009-09-26 14:53:22 +0000 |
---|---|---|
committer | mescalinum <mescalinum@users.sourceforge.net> | 2009-09-26 14:53:22 +0000 |
commit | becd4c66f77da3ff9078ec06aebb9ade3247e30b (patch) | |
tree | e5524f11b4cdc2457c27765cf0a97184ad7c16c5 /composer/Pattern.cpp | |
parent | 1e1d2285d538c7fc71e687ce0eb77ea880e113e0 (diff) |
restored normality (editor/pd protocol and load/save in-patch data)
svn path=/trunk/externals/ffext/; revision=12459
Diffstat (limited to 'composer/Pattern.cpp')
-rw-r--r-- | composer/Pattern.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/composer/Pattern.cpp b/composer/Pattern.cpp index 69c60f4..8335b28 100644 --- a/composer/Pattern.cpp +++ b/composer/Pattern.cpp @@ -6,6 +6,8 @@ using std::cout; using std::cerr; using std::endl; +#define WRAP(v,w) (((v)<0)?(((w)-1)-((-(v)-1)%(w))):((v)%(w))) + Pattern::Pattern(int numRows, int numCols, string patternName) : name(patternName) { @@ -72,10 +74,14 @@ void Pattern::resize(int numRows, int numCols) void Pattern::setCell(int row, int col, Cell cell) { + row = WRAP(row, rows.size()); + col = WRAP(col, columns); rows[row][col] = cell; } Cell Pattern::getCell(int row, int col) { + row = WRAP(row, rows.size()); + col = WRAP(col, columns); return rows[row][col]; } |