/* * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net) * * 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 2 of the License, or * (at your option) any later version. */ #include "Dir.h" #include //----------------------------------------------------------------- /** * Convert dir to relative coordinations. */ V2 Dir::dir2xy(eDir dir) { int x = 0; int y = 0; switch (dir) { case DIR_UP: y = -1; break; case DIR_DOWN: y = +1; break; case DIR_LEFT: x = -1; break; case DIR_RIGHT: x = +1; break; case DIR_NO: break; default: assert(!"unknown dir"); break; } return V2(x, y); }