/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
*
* Known contributors to this file:
* Dave Pare, 1989
- * Markus Armbruster, 2004-2011
+ * Markus Armbruster, 2004-2013
*/
#include <config.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
-#include "file.h"
#include "misc.h"
#include "nat.h"
#include "optlist.h"
}
/*
- * Convert initial part of STR to normalized x-coordinate.
+ * Convert initial part of @str to normalized x-coordinate.
* Return -1 on error. This works, as normalized coordinates are
* non-negative.
- * Assign pointer to first character after the coordinate to *END,
- * unless END is a null pointer.
+ * Assign pointer to first character after the coordinate to *@end,
+ * unless @end is a null pointer.
*/
coord
strtox(char *str, char **end)
}
/*
- * Convert initial part of STR to normalized y-coordinate.
+ * Convert initial part of @str to normalized y-coordinate.
* Return -1 on error. This works, as normalized coordinates are
* non-negative.
- * Assign pointer to first character after the coordinate to *END,
- * unless END is a null pointer.
+ * Assign pointer to first character after the coordinate to *@end,
+ * unless @end is a null pointer.
*/
coord
strtoy(char *str, char **end)
return XYOFFSET(XNORM(x), YNORM(y));
}
+void sctoff2xy(coord *x, coord *y, int off)
+{
+ *y = off * 2 / WORLD_X;
+ *x = off * 2 % WORLD_X + *y % 2;
+}
+
coord
xnorm(coord x)
{