21 Nov, 2008, Aranel wrote in the 1st comment:
Votes: 0
First of all, I'm not good at C, I know, my code is ridiculous and funny but just ignore it :)

I want to REMOVE PLR_TENNANT flag from player, ROOM_PRIVATE & ROOM_RENTED flags from his rented room, and give ROOM_RENTAL flag to his room, when he quit from game. For example, if his room(ch->pcdata->rentroom) is 3001, when he leave the mud(or disconnect) he'll lose PLR_TENNANT flag, and 3001 will be ROOM_RENTAL.

I added this code to act_comm.c (do_quit), but It didnt work:

/*if ( IS_SET(ch->act, PLR_TENNANT)){
int kiralanan;
kiralanan = ch->pcdata->rentroom;
REMOVE_BIT(ch->act,PLR_TENNANT);
REMOVE_BIT(kiralanan->room_flags, ROOM_PRIVATE);
REMOVE_BIT(kiralanan->room_flags, ROOM_RENTED);
SET_BIT(kiralanan->room_flags, ROOM_RENTAL);
ch->pcdata->rentroom = 0;
}*/


Here's the compiler output:

act_comm.c:1128: hata: invalid type argument of '->' (have 'int')
act_comm.c:1129: hata: invalid type argument of '->' (have 'int')
act_comm.c:1130: hata: invalid type argument of '->' (have 'int')


Any ideas, suggestions, or working code? :)


PS: Sorry for my bad English.
21 Nov, 2008, David Haley wrote in the 2nd comment:
Votes: 0
What is the type of rentroom? Presumably it is ROOM_INDEX_DATA* or something like that. You need to store it into the proper data type (pointer to ROOM_INDEX_DATA) and not into an "int", which is just a number.

(BTW what language do you speak?)
21 Nov, 2008, Aranel wrote in the 3rd comment:
Votes: 0
(I hope I understood your question correctly)

ch->pcdata->rentroom is a number, like 3001, it is vnum of your room. In fact, I want to use something like ch->pcdata->rentroom->room_flags, but C doesnt have an option like this.

I speak Turkish.
21 Nov, 2008, Davion wrote in the 4th comment:
Votes: 0
What you have is the associated vnum. ROM has a function that turns your integer, into a tangible room object.
ROOM_INDEX_DATA *kiralana;
kiralana = get_room_index(ch->pcdata->rentroom);


Then just use kiralana the way you already have.
22 Nov, 2008, Aranel wrote in the 5th comment:
Votes: 0
Thanks it compiles & works now, but I have a problem:

When player runs "do_quit" command, it works, but when he just disconnects, it doesnt work. My code is under do_quit (act_comm.c). It must run this code in every disconnect&leave. Wheres the correct location for this code?

Thanks for your help,
22 Nov, 2008, Igabod wrote in the 6th comment:
Votes: 0
try looking around where your code handles link-dead characters and add the code in there somewhere, sorry i can't be a little more helpful, i don't know which codebase you're using nor have i fiddled around with that part of my code yet. hopefully you're at least skilled enough to find where your code handles link-dead players and then guess where the appropriate code goes.

[edit to add] oh yeah, and from what it sounds like, the do_quit function is the correct location for that code but you also need it in places where all the other forms of disconnecting are.
22 Nov, 2008, Aranel wrote in the 7th comment:
Votes: 0
Ok, I found it and it works now :)

Thanks everybody for your help.
22 Nov, 2008, David Haley wrote in the 8th comment:
Votes: 0
Oh, I didn't realize it was a number, not a vnum – sorry. :smile:

Ah, I was wondering about the language, because it wasn't one I recognized at all. Now I know how to say "error" in Turkish :smile:
0.0/8