This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void army::Walk(signed int dir, int last, int notFirst) { | |
int targCell = this->GetAdjacentCellIndex(this->occupiedHex, dir); | |
gCloseMove = IsCloseMove(targCell); | |
// Bridge opening | |
if (this->owningSide == 1 | |
&& gpCombatManager->isCastleBattle | |
&& (targCell == 58 || targCell == 59 || targCell == 60 && this->owningSide == 1 && this->creature.creature_flags & TWO_HEXER) | |
&& gpCombatManager->drawBridgePosition == BRIDGE_CLOSED) { | |
this->animationType = ANIMATION_TYPE_STANDING; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
signed int __thiscall iconWidget::Main(iconWidget *this, tag_message *evt) | |
{ | |
iconWidget *thisa; // esi@1 | |
__int16 v3; // cx@1 | |
signed int result; // eax@4 | |
INPUT_EVENT_CODE evtCode; // edx@6 | |
heroWindow *parent; // ebp@14 | |
__int16 xRelParent; // ax@14 | |
__int16 yRelParent; // bx@14 | |
resource *v9; // ST00_4@36 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original inspiration (verbatim code): | |
void combatManager::ArcShot(icon *icn, int fromX, int fromY, int targX, int targY) | |
{ | |
bool firingLeft = false; | |
if (fromX > targX) | |
firingLeft = true; | |
int imageIdx = 0; // changes the sprite when its angle changes | |
// temporarily save the screen so we can clear it from the projectile sprite later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class interval: | |
def init(low, hi): | |
self.low = low | |
self.hi = hi | |
# bad version | |
def intersect(oth): | |
if self.low <= oth.low: | |
if self.hi < oth.low: | |
return interval(0,0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalize_interval(a, b): | |
if a <= b: return (a, b) | |
else: return (a, a) | |
# good version | |
def intersect(oth): | |
return interval(normalize_interval(min(self.hi, oth,hi), max(self.low, oth.low))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeOperators, GADTs, Strict #-} | |
module Main where | |
data (:+:) f g a = Inl !(f a) | Inr !(g a) | |
data A | |
data B | |
data Foo l where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Documentation | |
The behavior of the NormalDialog is interesting. The method displays a messagebox but, the contents of the message box are based around a total of 10 parameters. Here is an example: | |
NormalDialog(msg, DIALOG_OKAY, -1, -1, -1, 0, -1, 0, -1, 0); | |
The first input is a message with the data type of char, and the remainder of the parameters are integers. Each aspect of the function can be altered by changing those numbers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Var: | |
def __init__(self, name): | |
self.name = name | |
def execute(self, bindings): | |
return bindings[self.name] | |
class ConstInt: | |
def __init__(self, val): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE AllowAmbiguousTypes, FlexibleInstances, MultiParamTypeClasses, ScopedTypeVariables, TypeApplications, UndecidableInstances #-} | |
class Lift' m a b where | |
lift' :: m a -> b | |
instance (Applicative m) => Lift' m a (m a) where | |
lift' = id | |
instance (Applicative m, Lift' m a b) => Lift' m (x -> a) (m x -> b) where | |
lift' f = lift' . ((<*>) f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------- MODULE multi_user_wire -------------------------- | |
EXTENDS Integers, Sequences | |
CONSTANTS Users, Servers, Accounts | |
MAX_MONEY == 20 | |
AtMostOneAdminPerOrg(users, orgs) == {roles \in [users -> {"user","admin"}]: | |
\A x,y \in users: (roles[x] = "admin" /\ roles[y] = "admin") => x = y} |