Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion game.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Game;
#include "object.h"
#include "orders.h"

#define CURRENT_ATL_VER MAKE_ATL_VER( 4, 2, 68 )
#define CURRENT_ATL_VER MAKE_ATL_VER( 4, 2, 60 )

class OrdersCheck
{
Expand Down
28 changes: 8 additions & 20 deletions gameio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
#include <stdlib.h>
#include <time.h>
#include <iostream>
extern "C" {
#include "i_rand.h"
}

static randctx isaac_ctx;

char buf[256];

Expand All @@ -53,6 +48,7 @@ static void morewait()

void initIO()
{
// I am unsure of why this is hard-coded.
seedrandom( 1783 );
}

Expand All @@ -69,32 +65,24 @@ int getrandom(int range)
if (neg)
range = -range;

unsigned long i = isaac_rand( &isaac_ctx );
i %= range;
int random = rand() % range;

int ret = 0;
if (neg)
ret = (int)(i * -1);
else
ret = (int)i;
random = (int)(random * -1);

return ret;
return random;
}

void seedrandom(int num)
{
isaac_ctx.randa = isaac_ctx.randb = isaac_ctx.randc = (ub4)0;

for (ub4 i = 0; i < RANDSIZ; ++i)
{
isaac_ctx.randrsl[i] = (ub4)num + i;
}
randinit( &isaac_ctx, TRUE );
// Now to do this directly.
srand((unsigned int)num);
}

void seedrandomrandom()
{
seedrandom( time(0) );
time_t now = clock();
seedrandom((unsigned int)now);
}

int Agetint()
Expand Down