Commit c2fb9dd3 authored by Colomban Wendling's avatar Colomban Wendling

Move clock_mod() to Utils

parent 71b12e22
......@@ -13,6 +13,7 @@ libovcc_la_SOURCES = enumtypes.c \
tileobject.vala \
tileset.c \
tilesdef.c \
utils.vala \
xmlutils.c
ovccinclude_HEADERS = ovcc.h \
board.h \
......
......@@ -71,19 +71,9 @@ namespace OVCC
Object (name: name, otype: type, attributes: attributes, links: links);
}
private inline uint clock_mod (int x,
uint mod)
{
if (x < 0) {
return (mod - ((uint)(-x) % mod)) % mod;
} else {
return (uint)x % mod;
}
}
public void rotate (int steps)
{
var wise = clock_mod (steps, 4) * 3;
var wise = Utils.clock_mod (steps, 4) * 3;
var tmp = this.links & ((1 << (wise + 1)) - 1);
this.links = (TileObjectLinks)((this.links << wise) | tmp << (12 - wise));
}
......
/*
*
* Copyright (C) 2011 Colomban Wendling <ban@herbesfolles.org>
* Jonathan Michalon <studios.chalmion@no-log.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OVCC.Utils
{
public inline uint clock_mod (int x,
uint mod)
{
if (x < 0) {
return (mod - ((uint)(-x) % mod)) % mod;
} else {
return (uint)x % mod;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment