Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 Couple bugs
Yesterday, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yandex

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Chess into smaug1.4a
Forum Rules | Mark all | Recent Posts

Chess into smaug1.4a
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Apr 15, 2010, 2:52 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

I am having problems with adding in smaugfuss 1.9's chess system into my smaug1.4a codebase.

  if( board->player2 )
   {
      if( ch = get_char_world( supermob, board->player2 ) ) // Added for bugfix <---- This part
      {
         ch_printf( ch, "The game has been stopped at %d total moves.\r\n", board->turn );
         ch->pcdata->game_board = NULL;
      }
   }



chess.c:880: warning: suggest parentheses around assignment used as truth value

At first it was
  if( board->player2 )
   {
      if( CHAR_DATA *ch = get_char_world( supermob, board->player2 ) ) // Added for bugfix <---- This part
      {
         ch_printf( ch, "The game has been stopped at %d total moves.\r\n", board->turn );
         ch->pcdata->game_board = NULL;
      }
   }

but that gave the following problems
chess.c:871: error: expected expression before 'CHAR_DATA'
chess.c:873: error: 'ch' undeclared (first use in this function)
chess.c:873: error: (Each undeclared identifier is reported only once
chess.c:873: error: for each function it appears in.)
chess.c:880: error: expected expression before 'CHAR_DATA'

So I just defined CHAR_DATA * ch at the top of the function, then I switched it to read what it does at the top. Any suggestions?
       
Post is unread #2 Apr 15, 2010, 2:54 pm
Go to the top of the page
Go to the bottom of the page

Caius
Magician
GroupMembers
Posts132
JoinedJan 29, 2006

Add an extra pair of parentheses:

if( ( ch = get_char_world( supermob, board->player2 ) ) )

       
Post is unread #3 Apr 15, 2010, 2:57 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Thanks.
       
Post is unread #4 Apr 15, 2010, 5:21 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Anyone have a helpfile on this?
       
Post is unread #5 Apr 15, 2010, 7:36 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

On different note: Remcon do you have a helpfile for Rubiks cube system?
       
Post is unread #6 Apr 16, 2010, 3:09 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

#COMMAND
Name        rubiks~
Code        do_rubiks
Position    dead~
Perm        all~
Group       all~
Log         0
HText       Syntax:
-------------------------------------------------------------------------------
rubik       | Shows the current rubik's cube.
rubik start | Starts the rubik's cube.
rubik quit  | Quits the rubik's cube.
rubik mix   | Mixes up the cube.
rubik f     | Moves the front side of the rubik's cube clockwise.
rubik fi    | Moves the front side of the rubik's cube counter-clockwise.
rubik r     | Moves the right side of the rubik's cube clockwise.
rubik ri    | Moves the right side of the rubik's cube counter-clockwise.
rubik l     | Moves the left side of the rubik's cube clockwise.
rubik li    | Moves the left side of the rubik's cube counter-clockwise.
rubik d     | Moves the down side of the rubik's cube clockwise.
rubik di    | Moves the down side of the rubik's cube counter-clockwise.
rubik b     | Moves the back side of the rubik's cube clockwise.
rubik bi    | Moves the back side of the rubik's cube counter-clockwise.
rubik u     | Moves the up side of the rubik's cube clockwise.
rubik ui    | Moves the up side of the rubik's cube counter-clockwise.
rubik turn  | Allows you to turn the rubik's cube so a different side is front.
            | "rubik turn left" will turn the cube so the right side is front.
            | "rubik turn right" will turn the cube so the left side is front.
            | "rubik turn up" will turn the cube so the down side is front.
            | "rubik turn down" will turn the cube so the up side is front.
            | "rubik turn back" will turn the cube so the back side is front.
~
End

Help rubiks should bring it up for you in game. Think that was the only help file I did for it though.
       
Post is unread #7 Apr 16, 2010, 5:19 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Thanks
       
Post is unread #8 Apr 16, 2010, 7:35 am   Last edited Apr 16, 2010, 7:57 am by dbna2
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

hey Remcon I have a problem with Sudoku now.


                   Columns               
Rows  1   2   3   4   5   6   7   8   9  
    -------------------------------------
  1 |   |   |   | 4 |   |   |   |   | 1 | 
    |--- --- ---|--- --- ---|--- --- ---|
  2 |   |   | 6 |   |   | 1 | 2 | 8 |   | 
    |--- --- ---|--- --- ---|--- --- ---|
  3 | 1 |   |   |   |   | 8 |   |   |   | 
    -------------------------------------
  4 |   |   |   |   |   | 3 | 5 | 6 |   | 
    |--- --- ---|--- --- ---|--- --- ---|
  5 | 3 |   |   |   |   |   |   |   |   | 
    |--- --- ---|--- --- ---|--- --- ---|
  6 |   | 4 |   | 6 |   | 2 | 7 | 9 | 3 | 
    -------------------------------------
  7 | 9 | 7 |   |   |   |   |   | 2 |   | 
    |--- --- ---|--- --- ---|--- --- ---|
  8 |   |   |   | 3 |   |   |   | 5 |   | 
    |--- --- ---|--- --- ---|--- --- ---|
  9 | 6 |   |   |   |   | 7 | 8 | 3 | 4 | 
    -------------------------------------
sudoku set 1 1 0
Invalid column, please specify a row 1-9.

Can you let me know what I am doing wrong?
On a Side note: Does anyone know if there is a snippet for Poker and Craps Game
       
Post is unread #9 Apr 16, 2010, 11:14 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

try it like sudoku set 110 for example. I'm fairly sure I didn't do the spaces in it because it was just another key to hit lol
       
Post is unread #10 Apr 16, 2010, 11:18 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

how would I make spaces work?
       
Post is unread #11 Apr 17, 2010, 7:09 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Never mind got it to work.
       
Post is unread #12 Apr 17, 2010, 4:16 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Noticed a BUG when a person tries to chess cease it crashes.
in free_game (board=0x9557798) at chess.c:875
875              ch->pcdata->game_board = NULL;


But everything else works fine.

[/code]

if( board->player1 )
{
if( (ch = get_char_world( supermob, board->player1 )) ) // Added for bugfix - Findecano 23/11/07
{
ch_printf( ch, "The game has been stopped at %d totalmoves.\r\n", board->turn );
ch->pcdata->game_board = NULL;
}
}

[code]
       
Post is unread #13 Apr 19, 2010, 10:39 pm
Go to the top of the page
Go to the bottom of the page

Sharmair
Fledgling
GroupMembers
Posts7
JoinedApr 19, 2010

Could the string in board->player1 happen to also be able to match an NPC in the game?
If so (and off hand I would say that is the most probable problem), add an NPC check to
the code. If this is the problem though, this code really should have a better way to id
the player. You might be able to add 0. to the start of the name so it will only match a
PC, or you could add some sort of persistent id to characters and use that instead of
a string (the SMAUG code I use has such a system).

In any case, about the only thing that would crash that line in that context is a NULL or
otherwise invalid pcdata.
       
Post is unread #14 Apr 19, 2010, 10:53 pm   Last edited Apr 19, 2010, 11:53 pm by dbna2
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

yeah your right :) But i am having a problem writing a fix. If I use the !IS_NPC ( ch ) and the get_char_world picks up a npc then the board wouldn't be nulled. not sure what to do here... Any help would be appericated.
       
Post is unread #15 Apr 20, 2010, 8:11 am
Go to the top of the page
Go to the bottom of the page

Sharmair
Fledgling
GroupMembers
Posts7
JoinedApr 19, 2010

After giving some more thought to this, and thinking of a couple more ways of
handling the problem then the two things I mentioned in the last post, I have
decided an easy way that should handle the issues nicely would be to replace
the get_char_world call with a simplified get_player_world function:
CHAR_DATA* get_player_world(const char* name){
    CHAR_DATA* tch;

    for(tch = first_char; tch; tch = tch->next)
        if(!IS_NPC(tch) && !str_cmp(name, tch->name))
            return tch;
    return NULL;
}

This function will return a player in the game given exact name and is not dependent
on if the target is visible to anyone or not. You could probably find other uses for this
function in the code, and even modify it to give it more options (like an option to do
prefix matching etc). You should be able to put this code someplace your code will
see it (or add a prototype in mud.h), then replace the get_char_world calls, removing
the first (supermob) argument.

       
Post is unread #16 Apr 20, 2010, 10:20 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Funny thing is I was thinking of something along these lines.
I just didn't know how I should go about it. I was Glad I was
atleast on the right track, shows how much I have come
along when coding. :) thanks for the fix.
       
Pages:<< prev 1 next >>