RCRPG/C++98: Difference between revisions
m
Fixed syntax highlighting.
m (Fixed syntax highlighting.) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1:
Yet another C++ RCRPG, this one has some tweaks
* You can lose: If you try to break one of the cave's boundary walls, your sledge will break. If that happens in a room that has no exits (first room), you are trapped and dies!
* If you enter a room that you visited, at least 3 minutes ago, there is a 40% chance that the loot will re-spawn.
* The Treasure Room is placed at random in the cave.
<span style='font-family: "Linux Libertine",Georgia,Times,serif;font-size:150%;'>[[C++]]</span><hr>
<
#include <stdio.h>
#include <time.h>
Line 25:
{
public:
position() : x(0), y(0), z(0) { }
position( int a, int
▲ void set( int a, int b, int c ) {
}
bool operator ==( const position o ) {
Line 137 ⟶ 133:
unsigned hashStr( std::string s ) {
unsigned wrd = 0x4e67c6a7, p = 0;
while(
wrd ^= ( ( wrd << 5 ) + s[p++] + ( wrd >> 2 ) );
return wrd;
Line 148 ⟶ 144:
{
public:
treasure( keyWord k, uint c ) : key(k), cnt(c) { }
keyWord key;
uint cnt;
Line 216 ⟶ 210:
{
public:
room( std::string n ) : name(n), visited(false) {
memset( bRooms, 0, sizeof( bRooms ) );
memset( ladderZ, 0, sizeof( ladderZ ) );
}
void describe() {
Line 297 ⟶ 289:
{
public:
player() : curRoom(0) { }
~player() {
deleteRooms();
Line 546 ⟶ 536:
return 0;
}
</syntaxhighlight>
|