MCPcopy Create free account
hub / github.com/SimHacker/micropolis / n_glassheat

Method n_glassheat

MicropolisCore/src/CellEngine/src/cellengine.cpp:4432–5685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4430
4431
4432void CellEngine::n_glassheat()
4433{
4434 int code;
4435 int error = 0;
4436
4437#define GLASSHEAT ( \
4438 (code = GlassHeatTable[MARG]), \
4439 (error += SUM8REG(0x7f) + frob), \
4440 (error = ((error < 0) \
4441 ? 0 \
4442 : ((error > (0x7f << 3)) \
4443 ? (0x7f << 3) \
4444 : error))), \
4445 ((code == 2) \
4446 ? (((error >= low) && \
4447 (error >= inflation)) /* can we get from bank? */ \
4448 ? (error -= inflation, code ^= 1) /* flip and debit */ \
4449 : 0 \
4450 ) \
4451 : ((code == 3) \
4452 ? (((error <= high) && \
4453 (error < (0x80 << 3) - inflation)) /* can we put to bank? */ \
4454 ? (error += inflation, code ^= 1) /* flip and credit */ \
4455 : 0 \
4456 ) \
4457 : 0 \
4458 ) \
4459 ), \
4460 (code = ((code << 7) & 0x80) | \
4461 ((error >> 3) & 0x7f)), \
4462 (error &= 0x07), \
4463 code \
4464)
4465
4466 CAM_MASKED_REG_LOOP(GLASSHEAT)
4467
4468}
4469
4470
4471#if 0
4472
4473FUNCTION JCRule(Oldstate,NW,N,NE,W,Self,E,SW,S,SE:integer):integer;
4474CONST
4475 RN=127; L=2; U=2; K=2; Y=2;
4476VAR EightSum,NewState:integer;
4477BEGIN {Function}
4478 EightSum:=NW+N+NE+E+SE+S+SW+W; ]
4479 NewState:=0;
4480 IF (OldState=0) AND
4481 (L<=EightSum) AND (EightSum<=U) THEN
4482 NewState:=1;
4483 IF (OldState=1) THEN
4484 IF (K<=EightSum) AND (EightSum<=Y) THEN
4485 NewState:=1
4486 ELSE
4487 NewState:=2;
4488 IF NOT(odd(OldState)) AND
4489 (0<OldState)AND(OldState<2*RN) THEN

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected