(fldoff): Use offsetof() instead. Rest of struct.h is unused, remove.
This commit is contained in:
parent
65bb65f63d
commit
7d34832100
3 changed files with 4 additions and 44 deletions
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Empire - A multi-player, client/server Internet based war game.
|
||||
* Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
|
||||
* Ken Stevens, Steve McClure
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
|
||||
* related information and legal notices. It is expected that any future
|
||||
* projects/authors will amend these files as needed.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* struct.h: Used to access information relating to the fields of a structure.
|
||||
*
|
||||
* Known contributors to this file:
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _STRUCT_H_
|
||||
#define _STRUCT_H_
|
||||
|
||||
#define fldoff(str, fld) ((int)&(((struct str *)0)->fld))
|
||||
#define fldsiz(str, fld) (sizeof(((struct str *)0)->fld))
|
||||
#define strbase(str, ptr, fld) ((struct str *)((s_char *)(ptr)-fldoff(str, fld)))
|
||||
|
||||
#endif /* _STRUCT_H_ */
|
|
@ -44,7 +44,6 @@
|
|||
#include "nsc.h"
|
||||
#include "file.h"
|
||||
#include "match.h"
|
||||
#include "struct.h"
|
||||
#include "common.h"
|
||||
#include "gen.h"
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <struct.h>
|
||||
#include <stddef.h>
|
||||
#include "misc.h"
|
||||
#include "var.h"
|
||||
#include "xy.h"
|
||||
|
@ -52,6 +52,8 @@
|
|||
#include "commodity.h"
|
||||
#include "lost.h"
|
||||
|
||||
#define fldoff(str, fld) offsetof(struct str, fld)
|
||||
|
||||
#define NSC_IELT(name, pfx, sfx, base, itype) \
|
||||
{NSC_SHORT, 0, 0, ((base) + (itype)*sizeof(u_short)), \
|
||||
sizeof(sfx) == 1 ? name : pfx sfx}
|
||||
|
@ -84,9 +86,9 @@ struct castr sect_ca[] = {
|
|||
{NSC_UCHAR, NSC_EXTRA, 0, fldoff(sctstr, sct_terr), "terr0"},
|
||||
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr1), "terr1"},
|
||||
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr2), "terr2"},
|
||||
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr3), "terr3"},
|
||||
{NSC_XCOORD, 0, 0, fldoff(sctstr, sct_dist_x), "xdist"},
|
||||
{NSC_YCOORD, 0, 0, fldoff(sctstr, sct_dist_y), "ydist"},
|
||||
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr3), "terr3"},
|
||||
{NSC_SHORT, 0, 0, fldoff(sctstr, sct_avail), "avail"},
|
||||
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_work), "work"},
|
||||
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_coastal), "coastal"},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue