src/fsmblockmap.cpp
author richk
Tue, 17 Jun 2008 13:22:13 +0000
branchNewGRF_ports
changeset 10994 cd9968b6f96b
parent 6758 1545d187ab64
permissions -rw-r--r--
(svn r13548) [NewGRF_ports] -Sync: with trunk r13412:13544.
6751
08176dfe64b7 (svn r10790) [NewGRF_ports] -Codechange: constify the fsmblockmaps where possible.
rubidium
parents: 6739
diff changeset
     1
/* $Id$ */
6739
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
     2
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
     3
/** @file fsmblockmap.cpp */
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
     4
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
     5
#include "fsmblockmap.h"
6751
08176dfe64b7 (svn r10790) [NewGRF_ports] -Codechange: constify the fsmblockmaps where possible.
rubidium
parents: 6739
diff changeset
     6
#include "debug.h"
6739
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
     7
6751
08176dfe64b7 (svn r10790) [NewGRF_ports] -Codechange: constify the fsmblockmaps where possible.
rubidium
parents: 6739
diff changeset
     8
FSMblockmap* SetFSMSingleBlock(const byte *blocklist)
6739
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
     9
{
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
    10
	FSMblockmap *singleblock = new FSMblockmap;
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
    11
	singleblock->ResetAll();
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
    12
	singleblock->Initialise(blocklist, 1);
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
    13
	return singleblock;
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
    14
}
3f2ca4d0abda (svn r10738) [NewGRF_ports] -Feature: FSMblockmap class added. Basic FSM import complete. Need to handle multiple blocks on import. Aircraft controller recoded to work with new 128 bit blocks. Still need to write saveload for new blocks.
richk
parents:
diff changeset
    15
6751
08176dfe64b7 (svn r10790) [NewGRF_ports] -Codechange: constify the fsmblockmaps where possible.
rubidium
parents: 6739
diff changeset
    16
void FSMblockmap::PrintBlock(bool newline) const
08176dfe64b7 (svn r10790) [NewGRF_ports] -Codechange: constify the fsmblockmaps where possible.
rubidium
parents: 6739
diff changeset
    17
{
6758
1545d187ab64 (svn r10800) [NewGRF_ports] -Add: saving of FSMblockmaps.
rubidium
parents: 6751
diff changeset
    18
	printf("%016" OTTD_PRINTF64 "x%016" OTTD_PRINTF64 "x", this->GetUpper(), this->GetLower());
6751
08176dfe64b7 (svn r10790) [NewGRF_ports] -Codechange: constify the fsmblockmaps where possible.
rubidium
parents: 6739
diff changeset
    19
	if (newline) printf("\n");
08176dfe64b7 (svn r10790) [NewGRF_ports] -Codechange: constify the fsmblockmaps where possible.
rubidium
parents: 6739
diff changeset
    20
}
6758
1545d187ab64 (svn r10800) [NewGRF_ports] -Add: saving of FSMblockmaps.
rubidium
parents: 6751
diff changeset
    21
1545d187ab64 (svn r10800) [NewGRF_ports] -Add: saving of FSMblockmaps.
rubidium
parents: 6751
diff changeset
    22
/* static */ void FSMblockmap::AssertOnWrongBlockOffset()
1545d187ab64 (svn r10800) [NewGRF_ports] -Add: saving of FSMblockmaps.
rubidium
parents: 6751
diff changeset
    23
{
1545d187ab64 (svn r10800) [NewGRF_ports] -Add: saving of FSMblockmaps.
rubidium
parents: 6751
diff changeset
    24
	FSMblockmap fsmb;
1545d187ab64 (svn r10800) [NewGRF_ports] -Add: saving of FSMblockmaps.
rubidium
parents: 6751
diff changeset
    25
	if ((void*)&fsmb != (void*)fsmb.blocks) NOT_REACHED();
1545d187ab64 (svn r10800) [NewGRF_ports] -Add: saving of FSMblockmaps.
rubidium
parents: 6751
diff changeset
    26
}